@kaitranntt/ccs 7.77.1-dev.1 → 7.77.1-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.
- package/dist/proxy/upstream-url.d.ts.map +1 -1
- package/dist/proxy/upstream-url.js +8 -0
- package/dist/proxy/upstream-url.js.map +1 -1
- package/dist/shared/provider-preset-catalog.d.ts +1 -1
- package/dist/shared/provider-preset-catalog.d.ts.map +1 -1
- package/dist/shared/provider-preset-catalog.js +1 -1
- package/dist/shared/provider-preset-catalog.js.map +1 -1
- package/dist/ui/assets/{accounts-CybVGDsm.js → accounts-TsSkNVen.js} +1 -1
- package/dist/ui/assets/{alert-dialog-C6npAhT0.js → alert-dialog-hGKLLafj.js} +1 -1
- package/dist/ui/assets/{api-DZosWVkR.js → api-DKvIxLdW.js} +1 -1
- package/dist/ui/assets/{auth-section-D4MZkgcP.js → auth-section-BOvKd0Sl.js} +1 -1
- package/dist/ui/assets/{backups-section-DvMJrmHH.js → backups-section-BktH4gXP.js} +1 -1
- package/dist/ui/assets/{channels-BVftYfOn.js → channels-Cu60Cd8-.js} +1 -1
- package/dist/ui/assets/{checkbox-BLRznRTO.js → checkbox-CvFR8Vac.js} +1 -1
- package/dist/ui/assets/{claude-extension-C6OeBQ73.js → claude-extension-yBbUoGj_.js} +1 -1
- package/dist/ui/assets/{cliproxy-B3Jyu3r9.js → cliproxy-B4OFi937.js} +1 -1
- package/dist/ui/assets/{cliproxy-ai-providers-BAJ78pUc.js → cliproxy-ai-providers-BKTmYHel.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-XEvUMVJe.js → cliproxy-control-panel-BhZWHeYe.js} +1 -1
- package/dist/ui/assets/{codex-CY2vikqX.js → codex-Dl4vlmaB.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-DjLHh1qX.js → confirm-dialog-DC-s0Lza.js} +1 -1
- package/dist/ui/assets/{copilot-afee2lL9.js → copilot-Cl3Kj_ql.js} +1 -1
- package/dist/ui/assets/{cursor-DuWy60wp.js → cursor-CNjO4Z44.js} +1 -1
- package/dist/ui/assets/{droid-FlceoQ6k.js → droid-DTjmkIyQ.js} +1 -1
- package/dist/ui/assets/{globalenv-section-DpJ7unxC.js → globalenv-section-CId2zBTe.js} +1 -1
- package/dist/ui/assets/{health-BEMgcKD3.js → health-BudwIkEr.js} +1 -1
- package/dist/ui/assets/{index-0n_43sCZ.js → index-BGuD2ZzA.js} +1 -1
- package/dist/ui/assets/{index-Cq9VySs6.js → index-D9dQkYrN.js} +1 -1
- package/dist/ui/assets/{index-Cj7EjEq6.js → index-DS_mOUz0.js} +1 -1
- package/dist/ui/assets/{index-Ba4ysocb.js → index-DXnvUKiV.js} +1 -1
- package/dist/ui/assets/{index-BRtgic66.js → index-DinHmYv0.js} +3 -3
- package/dist/ui/assets/{index-DOC7_hun.js → index-G4oOKx1a.js} +1 -1
- package/dist/ui/assets/{index-0GkznW41.js → index-QAYRGqq3.js} +1 -1
- package/dist/ui/assets/{logs-Dth4naJl.js → logs-BkEGnqlr.js} +1 -1
- package/dist/ui/assets/{masked-input-DL6pJ8pE.js → masked-input-auFe8ZWs.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-DW4cPFeD.js → proxy-status-widget-CtR9rShF.js} +1 -1
- package/dist/ui/assets/{raw-json-settings-editor-panel-Dcumu3Qi.js → raw-json-settings-editor-panel-BL9CRBUf.js} +1 -1
- package/dist/ui/assets/{searchable-select-CWL2D5Ft.js → searchable-select-DFa4XBEG.js} +1 -1
- package/dist/ui/assets/{separator-Do_vqTQD.js → separator-BdwlLg_X.js} +1 -1
- package/dist/ui/assets/{shared-CwWuZx24.js → shared-CaCM5JhJ.js} +1 -1
- package/dist/ui/assets/{table-BP6nBZzg.js → table-cBvaa4dp.js} +1 -1
- package/dist/ui/assets/{updates-BTHJZ7Rk.js → updates-CPLM0pNI.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BGuD2ZzA.js","assets/radix-ui-nu4wz29m.js","assets/react-vendor-Bjx91N7w.js","assets/masked-input-auFe8ZWs.js","assets/icons-DQFHtVq5.js","assets/tanstack-bhJxV1h8.js","assets/notifications-B4_o8bcr.js","assets/utils-CzKF5WmX.js","assets/form-utils-CuHzLhJZ.js","assets/code-highlight-D4E79GKQ.js","assets/index-DS_mOUz0.js","assets/proxy-C4-M_9kB.js","assets/index-DXnvUKiV.js","assets/channels-Cu60Cd8-.js","assets/globalenv-section-CId2zBTe.js","assets/index-G4oOKx1a.js","assets/index-QAYRGqq3.js","assets/default-ports-1QQSffYX.js","assets/proxy-status-widget-CtR9rShF.js","assets/alert-dialog-hGKLLafj.js","assets/antigravity-responsibility-constants-Bvh4Ybz0.js","assets/auth-section-BOvKd0Sl.js","assets/backups-section-BktH4gXP.js","assets/index-D9dQkYrN.js","assets/charts-CeK2xCSo.js","assets/api-DKvIxLdW.js","assets/confirm-dialog-DC-s0Lza.js","assets/cliproxy-B4OFi937.js","assets/checkbox-CvFR8Vac.js","assets/separator-BdwlLg_X.js","assets/searchable-select-DFa4XBEG.js","assets/cliproxy-ai-providers-BKTmYHel.js","assets/cliproxy-control-panel-BhZWHeYe.js","assets/copilot-Cl3Kj_ql.js","assets/cursor-CNjO4Z44.js","assets/claude-extension-yBbUoGj_.js","assets/codex-Dl4vlmaB.js","assets/table-cBvaa4dp.js","assets/raw-json-settings-editor-panel-BL9CRBUf.js","assets/droid-DTjmkIyQ.js","assets/logs-BkEGnqlr.js","assets/accounts-TsSkNVen.js","assets/health-BudwIkEr.js","assets/shared-CaCM5JhJ.js","assets/updates-CPLM0pNI.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{j as l,S as jl,R as kb,C as Ab,a as Db,T as Nb,D as Tb,P as Pb,O as Mb,b as s0,c as l0,d as c0,e as u0,f as d0,A as h0,g as f0,h as p0,i as g0,k as m0,l as y0,m as b0,n as v0,I as x0,o as Lb,p as C0,q as Eb,r as jb,s as S0,t as Rb,V as w0,L as Ob,u as Ib,v as k0,w as A0,x as _b,y as D0,z as N0,B as Ub,E as T0,F as P0,G as Hb,H as M0,J as zb,K as Bb,M as Fb,N as L0,Q as E0,U as j0,W as R0,X as O0,Y as qb,Z as I0,_ as _0,$ as U0}from"./radix-ui-nu4wz29m.js";import{b as nh,d as H0,r as C,u as Rl,O as _d,N as Kb,e as ah,L as kl,R as z0,g as Gb,c as zm,h as Vb,E as ue,B as B0,i as F0,j as Ct}from"./react-vendor-Bjx91N7w.js";import{Q as q0,u as St,a as lt,b as ot,c as K0,d as G0}from"./tanstack-bhJxV1h8.js";import{t as ce,T as V0}from"./notifications-B4_o8bcr.js";import{L as An,X as Mo,P as Y0,C as Ol,H as W0,a as Q0,K as Ud,G as $0,Z as Yb,b as Wb,F as Qb,U as $b,c as X0,S as J0,A as Fr,d as Xb,e as Z0,f as Jb,M as Zb,E as Qr,g as $r,B as ew,R as qr,W as tw,h as nw,i as aw,j as iw,k as Bm,l as Fm,m as No,n as ih,o as Al,p as ev,q as tv,r as ow,s as Il,t as oh,u as nv,v as To,T as Vn,w as Kr,x as Xr,y as qm,z as rw,D as av,I as rh,J as sw,N as _l,O as lw,Q as cw,V as uw,Y as dw,_ as Ul,$ as hw,a0 as fw,a1 as iv,a2 as pw,a3 as gw,a4 as mw,a5 as yw,a6 as bw,a7 as sh,a8 as ov,a9 as Km,aa as vw,ab as xw,ac as Cw,ad as Sw,ae as ww,af as kw,ag as Gm,ah as Aw,ai as pl,aj as Vm,ak as Ym,al as Dw}from"./icons-DQFHtVq5.js";import{t as Nw,c as Tw,a as Hl,e as Nr,f as Lr,b as Pw,d as Mw,g as Lw,h as Ew,i as jw,j as Rw,k as Ow,l as Iw,m as _w,n as Uw,o as Hw,p as zw,q as Bw,r as Fw,s as qw,u as Kw,v as Gw,w as Vw,x as Yw,y as Ww,z as Qw,A as $w,B as Xw,C as Jw,D as Zw,E as ek,F as tk,G as nk,H as ak,I as ik,J as ok}from"./utils-CzKF5WmX.js";import{o as Wm,s as Qm,p as rk,a as sk,$ as lk,b as rv,c as Za,d as ck,_ as uk,u as dk,e as $m}from"./form-utils-CuHzLhJZ.js";import{H as hk,t as Xm}from"./code-highlight-D4E79GKQ.js";(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function o(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(c){if(c.ep)return;c.ep=!0;const d=o(c);fetch(c.href,d)}})();var dd={exports:{}},Tr={},hd={exports:{}},fd={};var Jm;function fk(){return Jm||(Jm=1,(function(t){function a(H,Z){var ne=H.length;H.push(Z);e:for(;0<ne;){var Q=ne-1>>>1,se=H[Q];if(0<c(se,Z))H[Q]=Z,H[ne]=se,ne=Q;else break e}}function o(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var Z=H[0],ne=H.pop();if(ne!==Z){H[0]=ne;e:for(var Q=0,se=H.length,de=se>>>1;Q<de;){var ge=2*(Q+1)-1,J=H[ge],ae=ge+1,he=H[ae];if(0>c(J,ne))ae<se&&0>c(he,J)?(H[Q]=he,H[ae]=ne,Q=ae):(H[Q]=J,H[ge]=ne,Q=ge);else if(ae<se&&0>c(he,ne))H[Q]=he,H[ae]=ne,Q=ae;else break e}}return Z}function c(H,Z){var ne=H.sortIndex-Z.sortIndex;return ne!==0?ne:H.id-Z.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;t.unstable_now=function(){return d.now()}}else{var h=Date,p=h.now();t.unstable_now=function(){return h.now()-p}}var g=[],m=[],S=1,b=null,x=3,T=!1,w=!1,M=!1,j=!1,E=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function A(H){for(var Z=o(m);Z!==null;){if(Z.callback===null)r(m);else if(Z.startTime<=H)r(m),Z.sortIndex=Z.expirationTime,a(g,Z);else break;Z=o(m)}}function P(H){if(M=!1,A(H),!w)if(o(g)!==null)w=!0,k||(k=!0,Y());else{var Z=o(m);Z!==null&&pe(P,Z.startTime-H)}}var k=!1,O=-1,U=5,_=-1;function K(){return j?!0:!(t.unstable_now()-_<U)}function ee(){if(j=!1,k){var H=t.unstable_now();_=H;var Z=!0;try{e:{w=!1,M&&(M=!1,D(O),O=-1),T=!0;var ne=x;try{t:{for(A(H),b=o(g);b!==null&&!(b.expirationTime>H&&K());){var Q=b.callback;if(typeof Q=="function"){b.callback=null,x=b.priorityLevel;var se=Q(b.expirationTime<=H);if(H=t.unstable_now(),typeof se=="function"){b.callback=se,A(H),Z=!0;break t}b===o(g)&&r(g),A(H)}else r(g);b=o(g)}if(b!==null)Z=!0;else{var de=o(m);de!==null&&pe(P,de.startTime-H),Z=!1}}break e}finally{b=null,x=ne,T=!1}Z=void 0}}finally{Z?Y():k=!1}}}var Y;if(typeof N=="function")Y=function(){N(ee)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,fe=$.port2;$.port1.onmessage=ee,Y=function(){fe.postMessage(null)}}else Y=function(){E(ee,0)};function pe(H,Z){O=E(function(){H(t.unstable_now())},Z)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(H){H.callback=null},t.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<H?Math.floor(1e3/H):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function(H){switch(x){case 1:case 2:case 3:var Z=3;break;default:Z=x}var ne=x;x=Z;try{return H()}finally{x=ne}},t.unstable_requestPaint=function(){j=!0},t.unstable_runWithPriority=function(H,Z){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var ne=x;x=H;try{return Z()}finally{x=ne}},t.unstable_scheduleCallback=function(H,Z,ne){var Q=t.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?Q+ne:Q):ne=Q,H){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=ne+se,H={id:S++,callback:Z,priorityLevel:H,startTime:ne,expirationTime:se,sortIndex:-1},ne>Q?(H.sortIndex=ne,a(m,H),o(g)===null&&H===o(m)&&(M?(D(O),O=-1):M=!0,pe(P,ne-Q))):(H.sortIndex=se,a(g,H),w||T||(w=!0,k||(k=!0,Y()))),H},t.unstable_shouldYield=K,t.unstable_wrapCallback=function(H){var Z=x;return function(){var ne=x;x=Z;try{return H.apply(this,arguments)}finally{x=ne}}}})(fd)),fd}var Zm;function pk(){return Zm||(Zm=1,hd.exports=fk()),hd.exports}var ey;function gk(){if(ey)return Tr;ey=1;var t=pk(),a=nh(),o=H0();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)n+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var n=e,i=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(i=n.return),e=n.return;while(e)}return n.tag===3?i:null}function h(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function g(e){if(d(e)!==e)throw Error(r(188))}function m(e){var n=e.alternate;if(!n){if(n=d(e),n===null)throw Error(r(188));return n!==e?null:e}for(var i=e,s=n;;){var u=i.return;if(u===null)break;var f=u.alternate;if(f===null){if(s=u.return,s!==null){i=s;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===i)return g(u),e;if(f===s)return g(u),n;f=f.sibling}throw Error(r(188))}if(i.return!==s.return)i=u,s=f;else{for(var y=!1,v=u.child;v;){if(v===i){y=!0,i=u,s=f;break}if(v===s){y=!0,s=u,i=f;break}v=v.sibling}if(!y){for(v=f.child;v;){if(v===i){y=!0,i=f,s=u;break}if(v===s){y=!0,s=f,i=u;break}v=v.sibling}if(!y)throw Error(r(189))}}if(i.alternate!==s)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?e:n}function S(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=S(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,x=Symbol.for("react.element"),T=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),N=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),ee=Symbol.iterator;function Y(e){return e===null||typeof e!="object"?null:(e=ee&&e[ee]||e["@@iterator"],typeof e=="function"?e:null)}var $=Symbol.for("react.client.reference");function fe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===$?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case M:return"Fragment";case E:return"Profiler";case j:return"StrictMode";case P:return"Suspense";case k:return"SuspenseList";case _:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case N:return e.displayName||"Context";case D:return(e._context.displayName||"Context")+".Consumer";case A:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case O:return n=e.displayName||null,n!==null?n:fe(e.type)||"Memo";case U:n=e._payload,e=e._init;try{return fe(e(n))}catch{}}return null}var pe=Array.isArray,H=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},Q=[],se=-1;function de(e){return{current:e}}function ge(e){0>se||(e.current=Q[se],Q[se]=null,se--)}function J(e,n){se++,Q[se]=e.current,e.current=n}var ae=de(null),he=de(null),re=de(null),le=de(null);function xe(e,n){switch(J(re,n),J(he,e),J(ae,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?cm(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=cm(n),e=um(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ge(ae),J(ae,e)}function Pe(){ge(ae),ge(he),ge(re)}function ze(e){e.memoizedState!==null&&J(le,e);var n=ae.current,i=um(n,e.type);n!==i&&(J(he,e),J(ae,i))}function Je(e){he.current===e&&(ge(ae),ge(he)),le.current===e&&(ge(le),wr._currentValue=ne)}var we,Re;function Ve(e){if(we===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);we=n&&n[1]||"",Re=-1<i.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+we+e+Re}var Tt=!1;function jt(e,n){if(!e||Tt)return"";Tt=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(n){var X=function(){throw Error()};if(Object.defineProperty(X.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(X,[])}catch(G){var q=G}Reflect.construct(e,[],X)}else{try{X.call()}catch(G){q=G}e.call(X.prototype)}}else{try{throw Error()}catch(G){q=G}(X=e())&&typeof X.catch=="function"&&X.catch(function(){})}}catch(G){if(G&&q&&typeof G.stack=="string")return[G.stack,q.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=s.DetermineComponentFrameRoot(),y=f[0],v=f[1];if(y&&v){var L=y.split(`
|
|
@@ -14,7 +14,7 @@ Error generating stack: `+s.message+`
|
|
|
14
14
|
`);for(const r of o){const[c,...d]=r.split(":"),h=d.join(":").trim();switch(c?.trim()?.toLowerCase()){case"version":a.version=h;break;case"url":a.url=h;break;case"method":a.method=h;break;case"timestamp":a.timestamp=h;break}}}function MP(t){const a={},o=t.split(`
|
|
15
15
|
`);for(const r of o){const c=r.indexOf(":");if(c>0){const d=r.slice(0,c).trim(),h=r.slice(c+1).trim();d&&(a[d]=h)}}return a}function LP(t,a){const o=t.split(`
|
|
16
16
|
`);let r=!1;const c=[];for(const d of o){if(d.startsWith("Status:")){const p=d.replace("Status:","").trim().split(/\s+/);a.statusCode=parseInt(p[0],10)||0,a.statusText=p.slice(1).join(" ")||OP(a.statusCode);continue}if(d.trim()===""&&!r){r=!0;continue}if(r)c.push(d);else{const h=d.indexOf(":");if(h>0){const p=d.slice(0,h).trim(),g=d.slice(h+1).trim();p&&(a.responseHeaders[p]=g)}}}a.responseBody=c.join(`
|
|
17
|
-
`).trim()}function EP(t){const a=t.url.match(/\/api\/provider\/([^/]+)/);a&&(t.provider=a[1]);const o=t.url.match(/\/api\/provider\/[^/]+\/(.+?)(?:\?|$)/);o&&(t.endpoint=o[1]),t.isClientError=t.statusCode>=400&&t.statusCode<500,t.isServerError=t.statusCode>=500,t.statusCode===429?t.errorType="rate_limit":t.statusCode===401||t.statusCode===403?t.errorType="auth":t.statusCode===404?t.errorType="not_found":t.statusCode>=500?t.errorType="server":(t.statusCode===408||t.statusCode===504)&&(t.errorType="timeout"),jP(t),t.statusCode===429&&RP(t)}function jP(t){if(t.requestBody)try{const a=JSON.parse(t.requestBody);typeof a.model=="string"&&(t.model=a.model)}catch{}}function RP(t){if(t.responseBody)try{const a=JSON.parse(t.responseBody),o=Qd(a);o!==null&&(t.quotaResetDelay=o);const r=$d(a);r&&(t.quotaResetTimestamp=r)}catch{}}function Qd(t){if(typeof t!="object"||t===null)return null;const a=t;if("quotaResetDelay"in a){const o=a.quotaResetDelay;if(typeof o=="number")return o;if(typeof o=="string"){const r=o.match(/^(\d+)s?$/);if(r)return parseInt(r[1],10)}}if("error"in a&&typeof a.error=="object"){const o=Qd(a.error);if(o!==null)return o}if("details"in a&&Array.isArray(a.details))for(const o of a.details){const r=Qd(o);if(r!==null)return r}return null}function $d(t){if(typeof t!="object"||t===null)return null;const a=t;for(const o of["quotaResetTimeStamp","quotaResetTimestamp","resetTime","reset_time"])if(o in a&&typeof a[o]=="string")return a[o];if("error"in a&&typeof a.error=="object"){const o=$d(a.error);if(o)return o}if("details"in a&&Array.isArray(a.details))for(const o of a.details){const r=$d(o);if(r)return r}return null}function OP(t){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"}[t]||""}function IP(t,a){const o=lh(),r=Date.now(),c=t*1e3,d=r-c,h=Math.floor(d/1e3),p=Math.floor(h/60),g=Math.floor(p/60),m=Math.floor(g/24);if(h<60){const b=o==="zh-CN",x=o==="vi";return b?"刚刚":x?"vừa xong":"just now"}if(p<60){const b=o==="zh-CN",x=o==="vi";return b?`${p} 分钟前`:x?`${p} phút trước`:`${p}m ago`}if(g<24){const b=o==="zh-CN",x=o==="vi";return b?`${g} 小时前`:x?`${g} giờ trước`:`${g}h ago`}if(m<7){const b=o==="zh-CN",x=o==="vi";return b?`${m} 天前`:x?`${m} ngày trước`:`${m}d ago`}return new Date(c).toLocaleDateString(o,{month:"short",day:"numeric"})}function _P(t){return t>=500?"text-red-500":t===429?"text-orange-500":t>=400?"text-yellow-500":"text-gray-500"}function UP(t,a){const o=lh();return o==="zh-CN"?{rate_limit:"限流",auth:"认证错误",not_found:"未找到",server:"服务错误",timeout:"超时",unknown:"错误"}[t]||"错误":o==="vi"?{rate_limit:"Quá giới hạn",auth:"Lỗi xác thực",not_found:"Không tìm thấy",server:"Lỗi máy chủ",timeout:"Hết thời gian chờ",unknown:"Lỗi"}[t]||"Lỗi":{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[t]||"Error"}function HP(t){if(t===null||t<=0)return null;if(t<60)return`${t}s`;if(t<3600)return`${Math.floor(t/60)}m`;const a=Math.floor(t/3600),o=Math.floor(t%3600/60);return o>0?`${a}h ${o}m`:`${a}h`}function zP(t,a){if(!t)return null;const o=lh(),r=o==="zh-CN",c=o==="vi";try{const d=new Date(t),h=new Date,p=d.getTime()-h.getTime();if(p<=0)return r?"现在":c?"bây giờ":"now";const g=Math.floor(p/1e3);if(g<60)return r?`${g}秒`:c?`${g} giây`:`${g}s`;if(g<3600){const b=Math.floor(g/60);return r?`${b}分钟`:c?`${b} phút`:`${b}m`}const m=Math.floor(g/3600),S=Math.floor(g%3600/60);return r?S>0?`${m}小时 ${S}分钟`:`${m}小时`:c?S>0?`${m} giờ ${S} phút`:`${m} giờ`:S>0?`${m}h ${S}m`:`${m}h`}catch{return null}}function BP(t){return t?t===429?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":t>=500?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":t>=400?"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400":"bg-gray-100 text-gray-600":"bg-gray-100 text-gray-600"}function FP(t){return t||""}function qP({name:t,size:a,modified:o,isSelected:r,onClick:c,statusCode:d,model:h}){const p=C.useMemo(()=>NP(t),[t]),g=C.useMemo(()=>FP(h),[h]);return l.jsxs("button",{onClick:c,className:z("w-full px-2.5 py-2 flex items-center gap-2 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",r?"bg-muted/50 border-l-red-500":"border-l-transparent"),children:[l.jsx("span",{className:z("shrink-0 text-[10px] font-bold px-1.5 py-0.5 rounded min-w-[32px] text-center",BP(d)),children:d||"???"}),l.jsx(Mh,{provider:p.provider,size:18,withBackground:!0,className:"shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[l.jsx("span",{className:"text-[11px] font-medium text-foreground truncate",children:p.endpoint||"unknown"}),g&&l.jsx("span",{className:"text-[10px] text-muted-foreground truncate",title:g,children:g}),l.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-muted-foreground/60",children:[l.jsx(To,{className:"w-2.5 h-2.5"}),l.jsx("span",{children:IP(o)})]})]})]})}function $y({value:t,className:a,variant:o="outline",size:r="icon",label:c="Copy to clipboard"}){const[d,h]=C.useState(!1),p=()=>{navigator.clipboard.writeText(t),h(!0),setTimeout(()=>h(!1),2e3)};return l.jsx(Pi,{children:l.jsxs(wa,{children:[l.jsx(ka,{asChild:!0,children:l.jsxs(st,{size:r,variant:o,className:z("relative z-10 text-muted-foreground hover:text-foreground",a),onClick:g=>{g.stopPropagation(),p()},children:[d?l.jsx(No,{className:"h-3.5 w-3.5 text-green-500"}):l.jsx(Al,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:c})]})}),l.jsx(Aa,{children:l.jsx("p",{children:d?"Copied!":c})})]})})}function Mr({active:t,onClick:a,children:o,icon:r}){return l.jsxs("button",{onClick:a,className:z("px-2.5 py-1.5 text-xs font-medium rounded transition-colors flex items-center gap-1.5",t?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[r&&l.jsx(r,{className:"w-3.5 h-3.5"}),o]})}function ux({code:t}){const a=_P(t);return l.jsx("span",{className:z("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",a),children:t})}function KP({parsed:t}){const{t:a}=ye(),o=HP(t.quotaResetDelay)||zP(t.quotaResetTimestamp),r=a("errorLogs.na");return l.jsx(Lo,{className:"h-full",children:l.jsxs("div",{className:"p-4 space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(ux,{code:t.statusCode}),l.jsx("span",{className:"text-sm font-medium",children:t.statusText}),l.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:UP(t.errorType)})]}),t.model&&l.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-violet-500/10 border border-violet-500/20",children:[l.jsx(dw,{className:"w-4 h-4 text-violet-500 shrink-0"}),l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"text-muted-foreground",children:a("errorLogs.modelLabel")}),l.jsx("span",{className:"font-semibold text-violet-600 dark:text-violet-400",children:t.model})]})]}),t.errorType==="rate_limit"&&o&&l.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[l.jsx(To,{className:"w-4 h-4 text-amber-500 shrink-0"}),l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"text-muted-foreground",children:a("errorLogs.quotaResetsIn")}),l.jsx("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:o})]})]}),l.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.method")}),l.jsx("div",{className:"font-medium",children:t.method||r})]}),l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.provider")}),l.jsx("div",{className:"font-medium",children:t.provider||r})]}),l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.version")}),l.jsx("div",{className:"font-medium",children:t.version||r})]}),l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.endpoint")}),l.jsx("div",{className:"font-medium truncate",title:t.endpoint,children:t.endpoint||r})]})]}),l.jsxs("div",{className:"text-xs",children:[l.jsx("div",{className:"text-muted-foreground mb-1.5",children:a("errorLogs.url")}),l.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:t.url||r})]}),l.jsxs("div",{className:"text-xs",children:[l.jsx("div",{className:"text-muted-foreground mb-1.5",children:a("errorLogs.timestamp")}),l.jsx("div",{className:"font-mono",children:t.timestamp||r})]}),t.errorType!=="unknown"&&l.jsxs("div",{className:z("flex items-start gap-3 p-3 rounded text-xs",t.errorType==="rate_limit"?"bg-amber-500/10 border border-amber-500/20":t.errorType==="auth"?"bg-red-500/10 border border-red-500/20":"bg-blue-500/10 border border-blue-500/20"),children:[t.errorType==="rate_limit"?l.jsx(Vn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}):t.errorType==="auth"?l.jsx(Vn,{className:"w-4 h-4 mt-0.5 text-red-500 shrink-0"}):l.jsx(Ul,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),l.jsxs("div",{className:z("leading-relaxed",t.errorType==="rate_limit"?"text-amber-600 dark:text-amber-400":t.errorType==="auth"?"text-red-600 dark:text-red-400":"text-blue-600 dark:text-blue-400"),children:[t.errorType==="rate_limit"&&(t.model?a("errorLogs.rateLimitedMsg",{model:t.model}):a("errorLogs.rateLimitedMsgNoModel")),t.errorType==="auth"&&a("errorLogs.authFailedMsg"),t.errorType==="not_found"&&a("errorLogs.notFoundMsg"),t.errorType==="server"&&a("errorLogs.serverErrorMsg"),t.errorType==="timeout"&&a("errorLogs.timeoutMsg")]})]})]})})}function GP({headers:t}){const{t:a}=ye(),o=Object.entries(t);return o.length===0?l.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:a("errorLogs.noHeaders")}):l.jsx(Lo,{className:"h-full",children:l.jsx("div",{className:"p-4 space-y-1",children:o.map(([r,c])=>l.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[l.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[r,":"]}),l.jsx("span",{className:"break-all",children:c})]},r))})})}function Xy({content:t,label:a}){const{t:o}=ye();if(!t||t.trim()===""){const d=a==="Request"?"errorLogs.noRequestBody":"errorLogs.noResponseBody";return l.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:o(d)})}let r=t,c=!1;try{const d=JSON.parse(t);r=JSON.stringify(d,null,2),c=!0}catch{}return l.jsx(Lo,{className:"h-full",children:l.jsx("pre",{className:z("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",c?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:r})})}function VP({content:t}){return l.jsx(Lo,{className:"h-full",children:l.jsx("pre",{className:"p-4 text-xs font-mono text-zinc-700 dark:text-muted-foreground whitespace-pre-wrap break-all leading-relaxed",children:t})})}function YP({name:t,absolutePath:a}){const{t:o}=ye(),[r,c]=C.useState("overview"),{data:d,isLoading:h,error:p}=xT(t),g=C.useMemo(()=>d?TP(d):null,[d]);return t?h?l.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[l.jsx($e,{className:"h-5 w-full"}),l.jsx($e,{className:"h-5 w-3/4"}),l.jsx($e,{className:"h-5 w-5/6"}),l.jsx($e,{className:"h-5 w-2/3"})]}):p||!d||!g?l.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:l.jsx("p",{className:"text-sm",children:o("errorLogs.failedLoadContent")})}):l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[l.jsx(ux,{code:g.statusCode}),l.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[g.provider,"/",g.endpoint||"unknown"]}),t&&l.jsx($y,{value:a||t,label:o("errorLogs.copyAbsolutePath"),size:"icon-sm",className:"ml-1 text-muted-foreground hover:text-foreground opacity-50 hover:opacity-100 transition-opacity"})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[d&&l.jsx($y,{value:d,label:o("errorLogs.copyRawContent"),variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),l.jsx("span",{className:"text-[10px] text-muted-foreground font-mono bg-muted px-1.5 py-0.5 rounded border border-border/50",children:g.method})]})]}),l.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:[l.jsx(Mr,{active:r==="overview",onClick:()=>c("overview"),icon:Ul,children:o("errorLogs.tabOverview")}),l.jsx(Mr,{active:r==="headers",onClick:()=>c("headers"),icon:fw,children:o("errorLogs.tabHeaders")}),l.jsx(Mr,{active:r==="request",onClick:()=>c("request"),icon:iv,children:o("errorLogs.tabRequest")}),l.jsx(Mr,{active:r==="response",onClick:()=>c("response"),icon:pw,children:o("errorLogs.tabResponse")}),l.jsx(Mr,{active:r==="raw",onClick:()=>c("raw"),icon:gw,children:o("errorLogs.tabRaw")})]}),l.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[r==="overview"&&l.jsx(KP,{parsed:g}),r==="headers"&&l.jsx(GP,{headers:g.requestHeaders}),r==="request"&&l.jsx(Xy,{content:g.requestBody,label:o("errorLogs.tabRequest")}),r==="response"&&l.jsx(Xy,{content:g.responseBody,label:o("errorLogs.tabResponse")}),r==="raw"&&l.jsx(VP,{content:d})]})]}):l.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:l.jsxs("div",{className:"text-center space-y-3",children:[l.jsx(hw,{className:"w-10 h-10 mx-auto opacity-40"}),l.jsx("p",{className:"text-sm",children:o("errorLogs.selectLog")})]})})}function WP(){const{t}=ye(),{data:a,isLoading:o}=gT(),{data:r,isLoading:c,error:d}=vT(a?.running??!1),[h,p]=C.useState(500),[g,m]=C.useState(!1),S=C.useRef(null),b=C.useRef(null),x=()=>{b.current&&(clearInterval(b.current),b.current=null)};C.useEffect(()=>{if(!g)return;const A=k=>{const O=S.current;if(!O)return;const _=O.getBoundingClientRect().top+window.scrollY,K=k.pageY-_;p(Math.max(300,K));const Y=window.innerHeight-k.clientY,$=15;x(),Y<50?b.current=setInterval(()=>{window.scrollBy(0,$)},16):k.clientY<50&&(b.current=setInterval(()=>{window.scrollBy(0,-$)},16))},P=()=>{m(!1),x(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",A),document.addEventListener("mouseup",P),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",P),document.body.style.cursor="default",document.body.style.userSelect="auto",x()}},[g]);const T=A=>{A.preventDefault(),m(!0)},w=C.useMemo(()=>r?.[0]?.name??null,[r]),[M,j]=C.useState(null),E=M??w,D=C.useMemo(()=>!E||!r?void 0:r.find(P=>P.name===E)?.absolutePath,[E,r]);if(o||!a?.running)return null;if(c)return l.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:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[l.jsx($e,{className:"h-4 w-32"}),l.jsx($e,{className:"h-4 w-20"})]}),l.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(A=>l.jsx($e,{className:"h-12 w-full rounded-lg"},A))})]});if(!r||r.length===0)return null;const N=r.length;return l.jsxs("div",{ref:S,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:[l.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:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx(Vn,{className:"w-4 h-4 text-amber-500"}),l.jsx("span",{className:"text-sm font-semibold tracking-tight",children:t("errorLogs.title")}),l.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:t("errorLogs.failedRequests",{count:N})})]}),l.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[l.jsx(mw,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:t("errorLogs.cliproxyDiagnostics")})]})]}),l.jsx("div",{className:"flex-1 min-h-0",children:l.jsxs(Rh,{direction:"horizontal",children:[l.jsx(Vr,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:l.jsxs(Lo,{className:"h-full",children:[l.jsx("div",{className:"divide-y divide-border/50",children:r.slice(0,50).map(A=>l.jsx(qP,{name:A.name,size:A.size,modified:A.modified,isSelected:E===A.name,onClick:()=>j(A.name),statusCode:A.statusCode,model:A.model},A.name))}),r.length>50&&l.jsx("div",{className:"px-3 py-3 text-center text-[10px] text-muted-foreground border-t border-border/50",children:t("errorLogs.showingCount",{total:r.length})})]})}),l.jsxs(Oh,{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:[l.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),l.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:l.jsx(_l,{className:"h-4 w-4 text-muted-foreground"})})]}),l.jsx(Vr,{className:"flex flex-col min-w-0 bg-background/50",children:l.jsx(YP,{name:E,absolutePath:D})})]})}),d?l.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:d.message}):l.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:T,children:l.jsx(yw,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const QP=Hl("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"}}),zr=C.forwardRef(({className:t,variant:a,...o},r)=>l.jsx("div",{ref:r,role:"alert",className:z(QP({variant:a}),t),...o}));zr.displayName="Alert";const Ll=C.forwardRef(({className:t,...a},o)=>l.jsx("h5",{ref:o,className:z("mb-1 font-medium leading-none tracking-tight",t),...a}));Ll.displayName="AlertTitle";const Br=C.forwardRef(({className:t,...a},o)=>l.jsx("div",{ref:o,className:z("text-sm [&_p]:leading-relaxed",t),...a}));Br.displayName="AlertDescription";function $P(){return St({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function dx(t,a){return typeof t=="object"&&t!==null&&"error"in t&&typeof t.error=="string"?t.error:a}function hx(t){const a=t.trim();if(!a)return null;try{return JSON.parse(a)}catch{return null}}function XP(t){const a=t.trim().toLowerCase();return a.startsWith("<!doctype html")||a.startsWith("<html")}function JP(t){if(!t||typeof t!="object")return!1;const a=t;return!(typeof a.content!="string"||"contentPath"in a&&typeof a.contentPath!="string")}async function fx(t,a){const o=await t.text(),r=hx(o);if(!t.ok){const c=dx(r,a);throw new Error(c)}if(r===null)throw new Error(a);return r}function ZP(){return St({queryKey:["shared","summary"],queryFn:async()=>{const t=await fetch("/api/shared/summary");return fx(t,"Failed to fetch shared summary")}})}function Oj(t){return St({queryKey:["shared",t],queryFn:async()=>{const a=await fetch(`/api/shared/${t}`);return fx(a,`Failed to fetch shared ${t}`)}})}function Ij(t,a){return St({queryKey:["shared",t,"content",a],enabled:typeof a=="string"&&a.length>0,queryFn:async()=>{if(!a)throw new Error("Missing shared item path");const o=new URLSearchParams({type:t,path:a}),r=await fetch(`/api/shared/content?${o.toString()}`),c=await r.text(),d=hx(c);if(!r.ok)throw new Error(dx(d,`Failed to fetch shared ${t} content`));if(JP(d))return{content:d.content,contentPath:typeof d.contentPath=="string"&&d.contentPath.length>0?d.contentPath:a};if(c.trim().length>0){if(XP(c))throw new Error("Shared content endpoint unavailable. Restart `ccs config` and try again.");return{content:c,contentPath:a}}throw new Error(`Failed to fetch shared ${t} content`)}})}const eM={ok:"success",warning:"warning",error:"error"},tM={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 vl({title:t,value:a,icon:o,variant:r="default",onClick:c}){const d=tM[r];return l.jsxs("button",{onClick:c,className:z("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:[l.jsx("div",{className:z("flex items-center justify-center w-9 h-9 rounded-md",d.iconBg),children:l.jsx(o,{className:z("w-4 h-4",d.iconColor)})}),l.jsxs("div",{className:"text-left",children:[l.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:t}),l.jsx("p",{className:z("text-lg font-bold font-mono leading-tight",d.iconColor),children:a})]})]})}function nM(){const{t}=ye(),a=ah(),{data:o,isLoading:r}=$P(),{data:c,isLoading:d}=ZP();if(r||d)return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx($e,{className:"h-12 w-12 rounded-lg"}),l.jsxs("div",{children:[l.jsx($e,{className:"h-7 w-[180px] mb-2"}),l.jsx($e,{className:"h-4 w-[220px]"})]})]}),l.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(p=>l.jsx($e,{className:"h-14 w-28 rounded-lg"},p))})]}),l.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[l.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[l.jsx($e,{className:"h-4 w-32"}),l.jsx($e,{className:"h-4 w-20"})]}),l.jsx("div",{className:"px-4 py-3 border-b",children:l.jsx($e,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(p=>l.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[l.jsx($e,{className:"w-2.5 h-2.5 rounded-full"}),l.jsx($e,{className:"h-4 flex-1"}),l.jsx($e,{className:"h-1.5 w-24 rounded-full"}),l.jsx($e,{className:"h-4 w-16"})]},p))]})]});const h=o?.health?eM[o.health.status]:void 0;return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[l.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:l.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),l.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[l.jsx(jN,{version:o?.version}),l.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[l.jsx(vl,{title:t("home.profiles"),value:o?.profiles??0,icon:Ud,variant:"accent",onClick:()=>a("/providers")}),l.jsx(vl,{title:t("home.cliproxy"),value:o?.cliproxy??0,icon:Yb,variant:"accent",onClick:()=>a("/cliproxy")}),l.jsx(vl,{title:t("home.accounts"),value:o?.accounts??0,icon:$b,variant:"default",onClick:()=>a("/accounts")}),l.jsx(vl,{title:t("home.health"),value:o?.health?`${o.health.passed}/${o.health.total}`:"-",icon:Fr,variant:h,onClick:()=>a("/health")})]})]})]}),c?.symlinkStatus&&!c.symlinkStatus.valid&&l.jsxs(zr,{variant:"warning",children:[l.jsx(Vn,{className:"h-4 w-4"}),l.jsx(Ll,{children:t("home.configurationRequired")}),l.jsx(Br,{children:c.symlinkStatus.message})]}),l.jsx(JT,{}),l.jsx("div",{className:"rounded-xl border bg-card/70 p-5",children:l.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"rounded-xl bg-muted p-2.5",children:l.jsx(Xb,{className:"h-5 w-5 text-muted-foreground"})}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("h2",{className:"text-lg font-semibold",children:t("homePageV2.logsMoved")}),l.jsx("p",{className:"max-w-2xl text-sm text-muted-foreground",children:"Use the unified logs page for source-level filtering, structured entry inspection, and retention policy edits without crowding the home dashboard."})]})]}),l.jsxs(st,{variant:"outline",className:"gap-2",onClick:()=>a("/logs"),children:["Open logs",l.jsx(bw,{className:"h-4 w-4"})]})]})}),l.jsx(WP,{})]})}const px=L0,Ih=C.forwardRef(({className:t,...a},o)=>l.jsx(zb,{ref:o,className:z("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...a}));Ih.displayName=zb.displayName;const El=C.forwardRef(({className:t,...a},o)=>l.jsx(Bb,{ref:o,className:z("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",t),...a}));El.displayName=Bb.displayName;const Xd=C.forwardRef(({className:t,...a},o)=>l.jsx(Fb,{ref:o,className:z("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...a}));Xd.displayName=Fb.displayName;function qt({className:t,...a}){return l.jsx(E0,{"data-slot":"label",className:z("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",t),...a})}const _h="ccs:openrouter-models",aM=1440*60*1e3,gx="1";function Jd(t){const a=parseFloat(t);return isNaN(a)||a===0?0:a*1e6}function Jy(t){const a=Jd(t);return a===0?ie.t("openrouterUtils.priceFree"):a<.01?ie.t("openrouterUtils.priceLessThanCent"):a<1?`$${a.toFixed(2)}`:`$${a.toFixed(a<10?2:0)}`}function iM(t){const a=Jy(t.prompt),o=Jy(t.completion);return a===ie.t("openrouterUtils.priceFree")&&o===ie.t("openrouterUtils.priceFree")?ie.t("openrouterUtils.priceFree"):`${a}/${o}`}function oM(t){const a=t.id.toLowerCase();return a.startsWith("anthropic/")?"anthropic":a.startsWith("openai/")?"openai":a.startsWith("google/")?"google":a.startsWith("meta-llama/")||a.startsWith("meta/")?"meta":a.startsWith("mistralai/")?"mistral":a.includes(":free")||a.includes("qwen")||a.includes("deepseek")?"opensource":"other"}function rM(t){return{...t,category:oM(t),pricePerMillionPrompt:Jd(t.pricing.prompt),pricePerMillionCompletion:Jd(t.pricing.completion),isFree:t.pricing.prompt==="0"&&t.pricing.completion==="0",isExacto:t.id.includes(":exacto")}}function sM(t,a,o){const r=a.toLowerCase().trim();return t.filter(c=>o?.category&&c.category!==o.category||o?.freeOnly&&!c.isFree||o?.minContext&&c.context_length<o.minContext?!1:r?c.id.toLowerCase().includes(r)||c.name.toLowerCase().includes(r)||c.description?.toLowerCase().includes(r):!0)}function _j(t){return[...t].sort((a,o)=>{if(a.isFree&&!o.isFree)return-1;if(!a.isFree&&o.isFree)return 1;if(!a.isFree&&!o.isFree){if(a.isExacto&&!o.isExacto)return-1;if(!a.isExacto&&o.isExacto)return 1}return a.name.localeCompare(o.name)})}function lM(){try{const t=localStorage.getItem(_h);if(!t)return null;const a=JSON.parse(t);return a.version!==gx||Date.now()-a.fetchedAt>aM?null:a.models}catch{return null}}function cM(t){try{localStorage.setItem(_h,JSON.stringify({models:t,fetchedAt:Date.now(),version:gx}))}catch{}}function uM(){localStorage.removeItem(_h)}function Uj(t,a){const[o]=t.split("/");if(!o)return{};const r=a.filter(h=>h.id.startsWith(`${o}/`));if(r.length===0)return{};const c=[...r].sort((h,p)=>p.pricePerMillionPrompt-h.pricePerMillionPrompt),d=Math.ceil(c.length/3);return{opus:c[0]?.id,sonnet:c[Math.min(d,c.length-1)]?.id,haiku:c[c.length-1]?.id}}function dM(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}const Hj={anthropic:"Anthropic (Claude)",openai:"OpenAI (GPT)",google:"Google (Gemini)",meta:"Meta (Llama)",mistral:"Mistral",opensource:"Open Source",other:"Other"},hM={anthropic:["anthropic/"],openai:["openai/"],google:["google/"],meta:["meta-llama/","meta/"],mistral:["mistralai/"],opensource:["deepseek/","qwen/","cohere/"],other:[]};function fM(t,a=2){const o=[],r=["anthropic","openai","google","meta","mistral","opensource"];for(const c of r){const d=hM[c];if(d.length===0)continue;const p=[...t.filter(g=>d.some(m=>g.id.toLowerCase().startsWith(m)))].sort((g,m)=>(m.created??0)-(g.created??0));o.push(...p.slice(0,a))}return o.sort((c,d)=>(d.created??0)-(c.created??0))}function pM(t){const o=Date.now()/1e3-t;return o<86400?ie.t("openrouterUtils.ageToday"):o<172800?ie.t("openrouterUtils.ageYesterday"):o<604800?ie.t("openrouterUtils.ageDaysAgo",{count:Math.floor(o/86400)}):o<2592e3?ie.t("openrouterUtils.ageWeeksAgo",{count:Math.floor(o/604800)}):o<31536e3?ie.t("openrouterUtils.ageMonthsAgo",{count:Math.floor(o/2592e3)}):ie.t("openrouterUtils.ageYearsAgo",{count:Math.floor(o/31536e3)})}const gM="https://openrouter.ai/api/v1/models",mx=["openrouter-models"],Zy=1440*60*1e3;async function mM(){const t=await fetch(gM);if(!t.ok)throw new Error(`Failed to fetch OpenRouter models: ${t.status}`);const o=(await t.json()).data;return cM(o),o}function yx(){return St({queryKey:mx,queryFn:mM,staleTime:Zy,gcTime:Zy,initialData:()=>lM()??void 0,refetchOnWindowFocus:!1})}function yM(){const t=yx(),a=(t.data??[]).map(rM);return{...t,models:a}}function zj(){const t=lt();return()=>(uM(),t.invalidateQueries({queryKey:mx}))}function Bj(){const{data:t,isLoading:a,isError:o}=yx();return{isReady:!!t&&t.length>0,isLoading:a,isError:o,modelCount:t?.length??0}}function Uh({profileEnv:t={}}){const{t:a}=ye(),[o,r]=C.useState(null),[c,d]=C.useState(!0),[h,p]=C.useState(!1);C.useEffect(()=>{g()},[]);const g=async()=>{try{d(!0);const T=await fetch("/api/global-env");if(!T.ok)throw new Error("Failed to load");const w=await T.json();r(w)}catch{r(null)}finally{d(!1)}};if(c||!o?.enabled)return null;const m=o.env||{},S=Object.keys(m);if(S.length===0)return null;const b=S.filter(T=>!(T in t)),x=S.filter(T=>T in t);return l.jsxs("div",{className:"border-t bg-muted/20",children:[l.jsxs("button",{onClick:()=>p(!h),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[l.jsx(Ul,{className:"w-4 h-4 text-blue-500"}),l.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[a("globalEnvIndicator.injectedCount",{count:b.length}),x.length>0&&l.jsx("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:a("globalEnvIndicator.overriddenCount",{count:x.length})})]}),h?l.jsx(oh,{className:"w-4 h-4 text-muted-foreground"}):l.jsx(Il,{className:"w-4 h-4 text-muted-foreground"})]}),h&&l.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[b.length>0&&l.jsx("div",{className:"space-y-1",children:b.map(T=>l.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:[l.jsx("span",{className:"text-green-500",children:"+"}),l.jsxs("span",{className:"truncate",children:[T,"=",m[T]]})]},T))}),x.length>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-xs text-muted-foreground",children:a("globalEnvIndicator.skippedLabel")}),x.map(T=>l.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:[l.jsx("span",{className:"text-amber-500",children:"~"}),l.jsx("span",{className:"truncate",children:T})]},T))]}),l.jsx("div",{className:"pt-2 border-t border-border/50",children:l.jsx(st,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:l.jsxs(kl,{to:"/settings?tab=globalenv",children:[l.jsx(sh,{className:"w-3.5 h-3.5"}),a("globalEnvIndicator.configureInSettings"),l.jsx(ev,{className:"w-3 h-3 opacity-50"})]})})})]})]})}function bM({className:t,...a}){return l.jsx(j0,{"data-slot":"switch",className:z("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...a,children:l.jsx(R0,{"data-slot":"switch-thumb",className:z("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}function vM(t,a,o){return t(o==="refreshing"?"imageAnalysisStatus.refreshingPreview":o==="invalid"?"imageAnalysisStatus.savedStatus":a==="editor"?"imageAnalysisStatus.livePreview":"imageAnalysisStatus.savedStatus")}function xM(t,a,o){return a.status==="disabled"?t("imageAnalysisStatus.disabledGlobally"):o!=="claude"?t("imageAnalysisStatus.targetBypassesHook",{target:t(`imageAnalysisStatus.targetLabel.${o}`)}):a.nativeReadPreference?t("imageAnalysisStatus.nativeImageReading"):a.status==="hook-missing"?t("imageAnalysisStatus.setupNeeded"):a.authReadiness==="missing"?t("imageAnalysisStatus.needsAuth"):a.proxyReadiness==="unavailable"?t("imageAnalysisStatus.needsProxy"):a.effectiveRuntimeMode==="native-read"?t("imageAnalysisStatus.nativeFallback"):t("imageAnalysisStatus.transformerReady")}function CM(t,a,o){return a.status==="disabled"?{label:t("imageAnalysisStatus.badgeDisabled"),className:"border-border/80 bg-background/85 text-muted-foreground"}:o!=="claude"?{label:t("imageAnalysisStatus.badgeBypassed"),className:"border-sky-500/25 bg-sky-500/10 text-sky-800 dark:text-sky-200"}:a.nativeReadPreference?{label:t("imageAnalysisStatus.badgeNative"),className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}:a.status==="hook-missing"||a.authReadiness==="missing"?{label:a.status==="hook-missing"?t("imageAnalysisStatus.badgeSetup"):t("imageAnalysisStatus.badgeAuth"),className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:a.proxyReadiness==="unavailable"?{label:t("imageAnalysisStatus.badgeProxy"),className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:{label:t("imageAnalysisStatus.badgeReady"),className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}}function SM(t,a,o){if(a.nativeReadPreference)return a.profileModel&&a.nativeImageCapable?t("imageAnalysisStatus.toggleSummaryNativeCapable",{model:a.profileModel}):a.profileModel?t("imageAnalysisStatus.toggleSummaryNativeModel",{model:a.profileModel}):t("imageAnalysisStatus.toggleSummaryNativeDefault");if(!a.backendDisplayName&&o==="claude")return t("imageAnalysisStatus.toggleSummaryNativeFileAccess");if(!a.backendDisplayName)return t("imageAnalysisStatus.toggleSummaryInactiveTarget",{target:t(`imageAnalysisStatus.targetLabel.${o}`)});const r=a.model?` · ${a.model}`:"";return t("imageAnalysisStatus.toggleSummaryTransformerRoute",{backend:a.backendDisplayName,modelSuffix:r})}function wM(t,a,o){return a.status==="disabled"?t("imageAnalysisStatus.noteDisabledGlobally"):o!=="claude"?t("imageAnalysisStatus.noteTargetBypassesHook",{target:t(`imageAnalysisStatus.targetLabel.${o}`)}):a.nativeReadPreference?a.nativeImageCapable===!0?null:a.nativeImageReason:a.status==="hook-missing"?t("imageAnalysisStatus.notePersistHook"):a.authReadiness==="missing"?a.authReason:a.proxyReadiness==="unavailable"?a.proxyReason:null}function kM({status:t,target:a="claude",source:o="saved",previewState:r="saved",nativeReadPreferenceOverride:c,onToggleNativeRead:d}){const{t:h}=ye();if(!t)return l.jsxs("div",{className:"rounded-2xl border bg-muted/20 px-4 py-3","aria-live":"polite",children:[l.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),l.jsx("div",{className:"mt-2 h-3 w-52 animate-pulse rounded bg-muted"})]});const p=c??t.nativeReadPreference,g={...t,nativeReadPreference:p},m=CM(h,g,a),S=wM(h,g,a),b=t.nativeImageCapable?h("imageAnalysisStatus.capabilityVerified"):t.profileModel?h("imageAnalysisStatus.capabilityUnknown"):null;return l.jsxs("section",{className:"rounded-2xl border bg-background/95 px-4 py-3 shadow-sm",children:[l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsx("div",{className:"min-w-0",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"inline-flex h-8 w-8 items-center justify-center rounded-xl border border-sky-500/20 bg-sky-500/10 text-sky-700 dark:text-sky-300",children:l.jsx(ov,{className:"h-4 w-4"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h3",{className:"text-sm font-semibold",children:h("imageAnalysisStatus.sectionTitle")}),l.jsx(Et,{className:z("h-5 border px-1.5 text-[10px]",m.className),children:m.label})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:[vM(h,o,r)," ·"," ",xM(h,g,a)]})]})]})}),l.jsx(st,{size:"sm",variant:"outline",className:"h-8 shrink-0",asChild:!0,children:l.jsxs(kl,{to:"/settings?tab=image",children:[h("imageAnalysisStatus.openSettings"),l.jsx(iv,{className:"ml-1 h-3.5 w-3.5"})]})})]}),l.jsx("div",{className:"mt-3 rounded-xl border bg-muted/15 px-3 py-3",children:l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("div",{className:"text-sm font-medium text-foreground",children:h("imageAnalysisStatus.useNativeImageReading")}),b&&l.jsx(Et,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:b})]}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:SM(h,g,a)})]}),l.jsx(bM,{checked:p,onCheckedChange:d,disabled:!d,"aria-label":h("imageAnalysisStatus.useNativeImageReading")})]})}),S&&l.jsx("div",{className:"mt-2 rounded-lg border border-border/70 bg-muted/20 px-3 py-2 text-xs leading-5 text-muted-foreground",children:S})]})}const AM=C.lazy(()=>tt(()=>Promise.resolve().then(()=>Zl),void 0).then(t=>({default:t.CodeEditor})));function Fj({rawJsonContent:t,isRawJsonValid:a,rawJsonEdits:o,settings:r,profileTarget:c="claude",imageAnalysisStatus:d,imageAnalysisStatusSource:h="saved",imageAnalysisStatusPreviewState:p="saved",nativeReadPreferenceOverride:g,onToggleNativeRead:m,onChange:S,missingRequiredFields:b=[]}){const{t:x}=ye(),T=b.length>0;return l.jsx(C.Suspense,{fallback:l.jsxs("div",{className:"flex items-center justify-center h-full",children:[l.jsx(An,{className:"w-6 h-6 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-2 text-muted-foreground",children:x("profileEditorSections.loadingEditor")})]}),children:l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!a&&o!==null&&l.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:[l.jsx(Mo,{className:"w-4 h-4"}),x("profileEditor.invalidJson")]}),a&&T&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[l.jsx(Vn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),l.jsxs("div",{children:[l.jsxs("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:[x("profileEditor.missingFields"),":"]})," ",l.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:b.join(", ")}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:x("profileEditor.missingFieldsHint")})]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:l.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:l.jsx(AM,{value:t,onChange:S,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx(kM,{status:d,target:c,source:h,previewState:p,nativeReadPreferenceOverride:g,onToggleNativeRead:m})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx("div",{className:"border rounded-md overflow-hidden",children:l.jsx(Uh,{profileEnv:r?.env})})})]})})}function eb(t,a){try{var o=t()}catch(r){return a(r)}return o&&o.then?o.then(void 0,a):o}function DM(t,a){for(var o={};t.length;){var r=t[0],c=r.code,d=r.message,h=r.path.join(".");if(!o[h])if("unionErrors"in r){var p=r.unionErrors[0].errors[0];o[h]={message:p.message,type:p.code}}else o[h]={message:d,type:c};if("unionErrors"in r&&r.unionErrors.forEach(function(S){return S.errors.forEach(function(b){return t.push(b)})}),a){var g=o[h].types,m=g&&g[r.code];o[h]=rv(h,a,o,c,m?[].concat(m,r.message):r.message)}t.shift()}return o}function NM(t,a){for(var o={};t.length;){var r=t[0],c=r.code,d=r.message,h=r.path.join(".");if(!o[h])if(r.code==="invalid_union"&&r.errors.length>0){var p=r.errors[0][0];o[h]={message:p.message,type:p.code}}else o[h]={message:d,type:c};if(r.code==="invalid_union"&&r.errors.forEach(function(S){return S.forEach(function(b){return t.push(b)})}),a){var g=o[h].types,m=g&&g[r.code];o[h]=rv(h,a,o,c,m?[].concat(m,r.message):r.message)}t.shift()}return o}function TM(t,a,o){if(o===void 0&&(o={}),(function(r){return"_def"in r&&typeof r._def=="object"&&"typeName"in r._def})(t))return function(r,c,d){try{return Promise.resolve(eb(function(){return Promise.resolve(t[o.mode==="sync"?"parse":"parseAsync"](r,a)).then(function(h){return d.shouldUseNativeValidation&&Wm({},d),{errors:{},values:o.raw?Object.assign({},r):h}})},function(h){if((function(p){return Array.isArray(p?.issues)})(h))return{values:{},errors:Qm(DM(h.errors,!d.shouldUseNativeValidation&&d.criteriaMode==="all"),d)};throw h}))}catch(h){return Promise.reject(h)}};if((function(r){return"_zod"in r&&typeof r._zod=="object"})(t))return function(r,c,d){try{return Promise.resolve(eb(function(){return Promise.resolve((o.mode==="sync"?rk:sk)(t,r,a)).then(function(h){return d.shouldUseNativeValidation&&Wm({},d),{errors:{},values:o.raw?Object.assign({},r):h}})},function(h){if((function(p){return p instanceof lk})(h))return{values:{},errors:Qm(NM(h.issues,!d.shouldUseNativeValidation&&d.criteriaMode==="all"),d)};throw h}))}catch(h){return Promise.reject(h)}};throw new Error("Invalid input: not a Zod schema")}const PM={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 MM({provider:t,className:a,size:o="md"}){const r=iN(t),c=PM[o],d=Tv(t),h=rN(t);return l.jsx("div",{className:z("flex items-center justify-center rounded-md",d&&!h&&(oN(t)?"bg-gray-900 p-1":"bg-white p-1"),c.container,a),children:d?l.jsx("img",{src:d,alt:`${t} logo`,className:z(h?c.container:c.icon,"object-contain")}):l.jsx("span",{className:z("font-semibold",r.textClass,c.text),children:r.letter})})}function qj(){return St({queryKey:["profiles"],queryFn:()=>He.profiles.list()})}function LM(){const t=lt(),{t:a}=ye();return ot({mutationFn:o=>He.profiles.create(o),onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),ce.success(a("toasts.profileCreated"))},onError:o=>{ce.error(o.message)}})}function Kj(){const t=lt(),{t:a}=ye();return ot({mutationFn:o=>He.profiles.delete(o),onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),ce.success(a("toasts.profileDeleted"))},onError:o=>{ce.error(o.message)}})}function Gj(){return ot({mutationFn:()=>He.profiles.discoverOrphans()})}function Vj(){const t=lt(),{t:a}=ye();return ot({mutationFn:o=>He.profiles.registerOrphans(o),onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),ce.success(a("toasts.orphanProfilesComplete"))}})}function Yj(){const t=lt(),{t:a}=ye();return ot({mutationFn:({name:o,data:r})=>He.profiles.copy(o,r),onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),ce.success(a("toasts.profileCopied"))}})}function Wj(){return ot({mutationFn:({name:t,includeSecrets:a})=>He.profiles.export(t,a??!1)})}function Qj(){const t=lt(),{t:a}=ye();return ot({mutationFn:o=>He.profiles.import(o),onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),ce.success(a("toasts.profileImported"))}})}const EM="https://openrouter.ai/api",bx=Object.freeze({glmt:"glm",kimi:"km",alibaba:"alibaba-coding-plan",acp:"alibaba-coding-plan",hf:"huggingface"}),vx=[{id:"openrouter",name:"OpenRouter",description:"349+ models from OpenAI, Anthropic, Google, Meta",baseUrl:EM,defaultProfileName:"openrouter",defaultModel:"anthropic/claude-opus-4.5",apiKeyPlaceholder:"sk-or-...",apiKeyHint:"Get your API key at openrouter.ai/keys",category:"recommended",requiresApiKey:!0,badge:"349+ models",featured:!0,icon:"/icons/openrouter.svg"},{id:"alibaba-coding-plan",name:"Alibaba Coding Plan",description:"Alibaba Cloud Coding Plan via Anthropic-compatible endpoint",baseUrl:"https://coding-intl.dashscope.aliyuncs.com/apps/anthropic",defaultProfileName:"albb",defaultModel:"qwen3-coder-plus",apiKeyPlaceholder:"sk-sp-...",apiKeyHint:"Get your Coding Plan key from Alibaba Cloud Model Studio",category:"recommended",requiresApiKey:!0,badge:"Coding Plan",featured:!0,icon:"/assets/providers/alibabacloud-color.svg"},{id:"ollama",name:"Ollama (Local)",description:"Local open-source models via Ollama (32K+ context)",baseUrl:"http://localhost:11434",defaultProfileName:"ollama",defaultModel:"qwen3-coder",apiKeyPlaceholder:"ollama",apiKeyHint:"Install Ollama from ollama.com - no API key needed for local",category:"recommended",requiresApiKey:!1,badge:"Local",featured:!0,icon:"/icons/ollama.svg"},{id:"llamacpp",name:"llama.cpp (Local)",description:"Local inference via llama.cpp (LLaMA models)",baseUrl:"http://127.0.0.1:8080",defaultProfileName:"llamacpp",defaultModel:"llama3-8b",apiKeyPlaceholder:"llamacpp",apiKeyHint:"Run llama.cpp server: ./server --host 0.0.0.0 --port 8080 -m model.gguf",category:"recommended",requiresApiKey:!1,badge:"Local",featured:!0,icon:"/assets/providers/llama-cpp.svg"},{id:"anthropic",name:"Anthropic (Direct API)",description:"Use your own Anthropic API key (sk-ant-...)",baseUrl:"",defaultProfileName:"anthropic",defaultModel:"claude-sonnet-4-5-20250929",apiKeyPlaceholder:"sk-ant-api03-...",apiKeyHint:"Get key at console.anthropic.com/settings/keys",category:"recommended",requiresApiKey:!0,badge:"Direct",featured:!0,icon:"/assets/providers/claude.svg"},{id:"huggingface",name:"Hugging Face",description:"Inference Providers router via OpenAI-compatible chat completions",baseUrl:"https://router.huggingface.co/v1",defaultProfileName:"hf",defaultModel:"openai/gpt-oss-120b:fastest",apiKeyPlaceholder:"hf_...",apiKeyHint:"Create a User Access Token at hf.co/settings/tokens",category:"alternative",requiresApiKey:!0,defaultTarget:"droid",badge:"Router"},{id:"glm",name:"GLM",description:"Direct Z.AI Anthropic-compatible API profile",baseUrl:"https://api.z.ai/api/anthropic",defaultProfileName:"glm",defaultModel:"glm-5",apiKeyPlaceholder:"ghp_...",apiKeyHint:"Get your API key from Z.AI",category:"alternative",requiresApiKey:!0,badge:"Z.AI",icon:"/icons/zai.svg"},{id:"km",name:"Kimi",description:"Moonshot AI - Fast reasoning model",baseUrl:"https://api.kimi.com/coding/",defaultProfileName:"km",defaultModel:"kimi-k2-thinking-turbo",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Moonshot AI",category:"alternative",requiresApiKey:!0,alwaysThinkingEnabled:!0,badge:"Reasoning",icon:"/icons/kimi.svg"},{id:"foundry",name:"Azure Foundry",description:"Claude via Microsoft Azure AI Foundry",baseUrl:"https://<your-resource>.services.ai.azure.com/api/anthropic",defaultProfileName:"foundry",defaultModel:"claude-sonnet-4-5",apiKeyPlaceholder:"YOUR_AZURE_API_KEY",apiKeyHint:"Create resource at ai.azure.com, get API key from Keys tab",category:"alternative",requiresApiKey:!0,badge:"Azure",icon:"/icons/azure.svg"},{id:"mm",name:"Minimax",description:"M2.1/M2.1-lightning/M2 - multilang coding (1M context)",baseUrl:"https://api.minimax.io/anthropic",defaultProfileName:"mm",defaultModel:"MiniMax-M2.1",apiKeyPlaceholder:"YOUR_MINIMAX_API_KEY_HERE",apiKeyHint:"Get your API key at platform.minimax.io",category:"alternative",requiresApiKey:!0,badge:"1M context",icon:"/icons/minimax.svg"},{id:"deepseek",name:"DeepSeek",description:"V3.2 and R1 reasoning model (128K context)",baseUrl:"https://api.deepseek.com/anthropic",defaultProfileName:"deepseek",defaultModel:"deepseek-chat",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key at platform.deepseek.com",category:"alternative",requiresApiKey:!0,badge:"Reasoning",icon:"/icons/deepseek.svg"},{id:"qwen",name:"Qwen",description:"Alibaba Cloud - Qwen3 models (256K-1M context, thinking support)",baseUrl:"https://dashscope-intl.aliyuncs.com/apps/anthropic",defaultProfileName:"qwen-api",defaultModel:"qwen3-coder-plus",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Alibaba Cloud Model Studio",category:"alternative",requiresApiKey:!0,badge:"Alibaba",icon:"/assets/providers/qwen-color.svg"},{id:"ollama-cloud",name:"Ollama Cloud",description:"Ollama cloud models via direct API (glm-5:cloud, minimax-m2.1:cloud)",baseUrl:"https://ollama.com",defaultProfileName:"ollama-cloud",defaultModel:"glm-5:cloud",apiKeyPlaceholder:"YOUR_OLLAMA_CLOUD_API_KEY",apiKeyHint:"Get your API key at ollama.com",category:"alternative",requiresApiKey:!0,badge:"Cloud",icon:"/icons/ollama.svg"},{id:"novita",name:"Novita AI",description:"Anthropic-compatible API for Claude Code and CCS profiles",baseUrl:"https://api.novita.ai/anthropic",defaultProfileName:"novita",defaultModel:"deepseek/deepseek-v3.2",apiKeyPlaceholder:"YOUR_NOVITA_API_KEY",apiKeyHint:"Get your API key at novita.ai",category:"alternative",requiresApiKey:!0,badge:"Anthropic-compatible",icon:"/icons/novita.svg"}];function xx(t){return{...t,extraEnv:t.extraEnv?{...t.extraEnv}:void 0}}function jM(t){const a=xx(t);return a.extraEnv&&Object.freeze(a.extraEnv),Object.freeze(a)}function RM(t,a){const o=new Set;for(const c of t){const d=c.id.trim().toLowerCase();if(c.id!==d)throw new Error(`Preset ID must be normalized: "${c.id}"`);if(o.has(c.id))throw new Error(`Duplicate preset ID detected: "${c.id}"`);o.add(c.id)}const r=new Set;for(const[c,d]of Object.entries(a)){const h=c.trim().toLowerCase();if(!h)throw new Error("Preset alias keys cannot be empty");if(c!==h)throw new Error(`Preset alias must be normalized: "${c}"`);if(r.has(h))throw new Error(`Duplicate normalized preset alias detected: "${c}"`);if(r.add(h),!o.has(d))throw new Error(`Preset alias "${c}" points to unknown target "${d}"`);if(o.has(h))throw new Error(`Preset alias "${c}" collides with canonical preset ID "${h}"`)}}RM(vx,bx);const OM=Object.freeze(vx.map(jM));function IM(){return OM.map(xx)}function _M(t){const a=t.trim().toLowerCase();return bx[a]||a}const UM=IM(),Hh=Object.freeze(UM.map(t=>({...t})));function HM(t,a){return a||(t?.requiresApiKey===!1?t.apiKeyPlaceholder||t.id:"")}function zM(t){return Hh.filter(a=>a.category===t)}function Td(t){const a=_M(t);return Hh.find(o=>o.id===a)}const BM=Za().refine(t=>t.trim().length===0||Za().url().safeParse(t).success,{message:"Invalid URL format"}),FM=ck({name:Za().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:BM,apiKey:Za(),model:Za().optional(),opusModel:Za().optional(),sonnetModel:Za().optional(),haikuModel:Za().optional(),target:uk(["claude","droid","codex"])}),qM=["/chat/completions","/v1/messages","/messages","/completions"],ki="custom",Pd="openrouter",Cx=new Set(["ollama","llamacpp"]),Md={name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:"",target:"claude"},Sx=zM("recommended"),KM=Sx.filter(t=>!Cx.has(t.id)),GM=Sx.filter(t=>Cx.has(t.id)),VM=Hh.filter(t=>t.category!=="recommended");function $j({open:t,onOpenChange:a,onSuccess:o,initialMode:r="openrouter"}){const{t:c}=ye(),d=LM(),[h,p]=C.useState("basic"),[g,m]=C.useState(null),[S,b]=C.useState(!1),[x,T]=C.useState(Pd),[w,M]=C.useState(""),{models:j}=yM(),{register:E,handleSubmit:D,formState:{errors:N},control:A,reset:P,setValue:k}=dk({resolver:TM(FM),defaultValues:Md}),O=$m({control:A,name:"baseUrl"}),U=$m({control:A,name:"target"}),_=C.useCallback(Q=>{if(!Q){P(Md);return}P({...Md,name:Q.defaultProfileName,baseUrl:Q.baseUrl,model:Q.defaultModel,opusModel:Q.defaultModel,sonnetModel:Q.defaultModel,haikuModel:Q.defaultModel,target:Q.defaultTarget??"claude"})},[P]),K=C.useMemo(()=>x===ki?null:Td(x)??null,[x]),ee=C.useMemo(()=>w.trim()?[...sM(j,w)].sort((se,de)=>(de.created??0)-(se.created??0)).slice(0,20):fM(j,2),[j,w]);C.useEffect(()=>{if(t)if(p("basic"),m(null),b(!1),M(""),r==="normal")T(ki),_(null);else{const se=Td(r==="openrouter"?Pd:r);if(se){T(se.id),_(se);return}T(ki),_(null)}},[t,r,_,P]);const Y=Q=>{const se=Td(Q);if(se){T(se.id),_(se);return}T(ki),_(null)},$=Q=>{k("model",Q.id),k("opusModel",Q.id),k("sonnetModel",Q.id),k("haikuModel",Q.id),M(Q.name),ce.success(c("profileCreateDialog.appliedModelToTiers",{model:Q.name}),{duration:2e3})};C.useEffect(()=>{if(O&&x===ki){const se=O.toLowerCase();for(const de of qM)if(se.endsWith(de)){const ge=O.replace(new RegExp(de+"$","i"),"");m(`URL ends with "${de}" - Claude appends this automatically. You likely want: ${ge}`);return}}m(null)},[O,x]);const fe=async Q=>{if(K?.requiresApiKey!==!1&&!Q.apiKey){ce.error(ie.t("commonToast.apiKeyRequired"));return}const se={...Q,apiKey:HM(K,Q.apiKey)};try{await d.mutateAsync(se),ce.success(c("profileCreateDialog.profileCreated",{name:se.name})),o(se.name),a(!1)}catch(de){ce.error(de.message||c("profileCreateDialog.failedCreate"))}},pe=!!N.name||!!N.baseUrl||!!N.apiKey,H=!!N.model||!!N.opusModel||!!N.sonnetModel||!!N.haikuModel,Z=d.isPending,ne=K?.id===Pd;return l.jsx(yh,{open:t,onOpenChange:a,children:l.jsxs(bh,{className:"sm:max-w-[700px] p-0 gap-0 overflow-hidden max-h-[90vh] !flex !flex-col",children:[l.jsxs(vh,{className:"p-6 pb-4 border-b",children:[l.jsxs(xh,{className:"flex items-center gap-2",children:[l.jsx(Km,{className:"w-5 h-5 text-primary"}),c("profileCreateDialog.createProfile")]}),l.jsx(Ch,{children:c("profileCreateDialog.chooseProviderHint")})]}),l.jsxs("form",{onSubmit:D(fe),className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[l.jsx("div",{className:"border-b bg-muted/10 px-6 py-3 space-y-3",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(qt,{className:"text-xs text-muted-foreground",children:c("profileEditor.provider")}),l.jsx("p",{className:"text-xs text-muted-foreground",children:c("profileEditor.providerChooserHint")})]}),l.jsx("span",{className:"pt-0.5 text-[11px] text-muted-foreground",children:c("profileEditor.scrollHint")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:c("profileEditor.featuredProviders")}),l.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:l.jsxs("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:[KM.map(Q=>l.jsx(Ld,{preset:Q,isSelected:x===Q.id,onClick:()=>Y(Q.id),density:"featured"},Q.id)),l.jsx("div",{className:"mx-1 hidden w-px rounded-full bg-border/70 sm:block"}),l.jsx(YM,{isSelected:x===ki,onClick:()=>Y(ki)})]})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:c("profileEditor.morePresets")}),l.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:l.jsx("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:VM.map(Q=>l.jsx(Ld,{preset:Q,isSelected:x===Q.id,onClick:()=>Y(Q.id),density:"compact"},Q.id))})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:c("openrouterQuickStart.localRuntimesTitle")}),l.jsx("div",{className:"flex flex-wrap gap-2",children:GM.map(Q=>l.jsx(Ld,{preset:Q,isSelected:x===Q.id,onClick:()=>Y(Q.id),density:"compact"},Q.id))})]})]})}),l.jsxs(px,{value:h,onValueChange:p,className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[l.jsx("div",{className:"px-6 pt-4",children:l.jsxs(Ih,{className:"grid w-full grid-cols-2",children:[l.jsxs(El,{value:"basic",className:"relative",children:[c("profileCreateDialog.basicInformation"),pe&&l.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),l.jsxs(El,{value:"models",className:"relative",children:[c("profileCreateDialog.modelConfiguration"),H&&l.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),l.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[l.jsxs(Xd,{value:"basic",className:"p-6 space-y-4 mt-0",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"name",children:[c("profileDialog.name")," ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx(Bn,{id:"name",...E("name"),placeholder:c("profileDialog.namePlaceholder"),className:"font-mono"}),N.name?l.jsx("p",{className:"text-xs text-destructive",children:N.name.message}):l.jsxs("p",{className:"text-xs text-muted-foreground",children:[c("profileCreateDialog.usedInCli")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(qt,{htmlFor:"baseUrl",children:c("profileCreateDialog.apiBaseUrl")}),l.jsx(Bn,{id:"baseUrl",...E("baseUrl"),placeholder:c("profileCreateDialog.baseUrlPlaceholder")}),N.baseUrl?l.jsx("p",{className:"text-xs text-destructive",children:N.baseUrl.message}):g?l.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:[l.jsx(Vn,{className:"w-4 h-4 shrink-0 mt-0.5"}),l.jsx("span",{children:g})]}):K?l.jsx("p",{className:"text-xs text-muted-foreground",children:K.baseUrl?c("profileCreateDialog.prefilledFromPreset",{name:K.name}):c("profileCreateDialog.optionalForPreset",{name:K.name})}):l.jsx("p",{className:"text-xs text-muted-foreground",children:c("profileCreateDialog.endpointHint")})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"apiKey",children:[c("profileDialog.apiKey")," ",K?.requiresApiKey!==!1&&l.jsx("span",{className:"text-destructive",children:"*"}),K?.requiresApiKey===!1&&l.jsx("span",{className:"text-muted-foreground text-xs font-normal",children:c("profileCreateDialog.optional")})]}),l.jsxs("div",{className:"relative",children:[l.jsx(Bn,{id:"apiKey",type:S?"text":"password",...E("apiKey"),placeholder:K?.requiresApiKey===!1?c("profileCreateDialog.apiKeyOptionalPlaceholder"):K?.apiKeyPlaceholder??c("profileCreateDialog.apiKeyPlaceholder"),className:"pr-10"}),l.jsx(st,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>b(!S),tabIndex:-1,children:S?l.jsx(Qr,{className:"h-4 w-4"}):l.jsx($r,{className:"h-4 w-4"})})]}),N.apiKey?l.jsx("p",{className:"text-xs text-destructive",children:N.apiKey.message}):K?.requiresApiKey===!1?l.jsx("p",{className:"text-xs text-muted-foreground",children:c("profileCreateDialog.apiKeyOptionalHint")}):K?.apiKeyHint&&l.jsx("p",{className:"text-xs text-muted-foreground",children:K.apiKeyHint})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(qt,{htmlFor:"target",children:c("codex.defaultTargetCli")}),l.jsxs(Pv,{value:U,onValueChange:Q=>k("target",Q),children:[l.jsx(Dh,{id:"target",children:l.jsx(Mv,{})}),l.jsxs(Nh,{children:[l.jsx(Hr,{value:"claude",children:c("profileCard.claudeCodeDefault")}),l.jsx(Hr,{value:"droid",children:c("profileCard.factoryDroid")}),l.jsx(Hr,{value:"codex",children:c("profileCard.codexCli")})]})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:[U==="droid"?l.jsxs(l.Fragment,{children:[c("profileEditor.targetHintPreferredAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-droid"}),"."]}):U==="codex"?l.jsxs(l.Fragment,{children:[c("profileEditor.targetHintPreferredAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsx"}),"."]}):l.jsxs(l.Fragment,{children:[c("profileEditor.targetHintClaudeDefault")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs"}),"."]}),U==="droid"?l.jsxs(l.Fragment,{children:[" ",c("profileEditor.targetHintLegacyAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsd"}),"."]}):U==="codex"?l.jsxs(l.Fragment,{children:[" ",c("profileEditor.targetHintLegacyAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-codex"}),"."]}):null," ",c("profileEditor.targetHintOverride")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"--target"}),"."]})]})]}),l.jsxs(Xd,{value:"models",className:"p-6 mt-0 space-y-4",children:[l.jsxs("div",{className:"flex items-start gap-3 p-3 bg-blue-50 dark:bg-blue-950/20 text-blue-800 dark:text-blue-300 rounded-md text-sm border border-blue-100 dark:border-blue-900/30",children:[l.jsx(Ul,{className:"w-5 h-5 shrink-0 mt-0.5"}),l.jsxs("div",{children:[l.jsx("p",{className:"font-medium mb-1",children:c("profileCreateDialog.modelMapping")}),l.jsx("p",{className:"text-xs opacity-90",children:c("profileCreateDialog.modelMappingDesc")})]})]}),ne&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{children:c("openrouterModelPicker.searchModels")}),l.jsx(Bn,{value:w,onChange:Q=>M(Q.target.value),placeholder:c("profileCreateDialog.searchModelsPlaceholder"),onKeyDown:Q=>{Q.key==="Enter"&&ee.length>0&&(Q.preventDefault(),$(ee[0]))}}),l.jsx("div",{className:"border rounded-md max-h-48 overflow-y-auto",children:ee.length===0?l.jsx("p",{className:"text-sm text-muted-foreground p-3 text-center",children:w?c("profileCreateDialog.noModelsFound",{query:w}):c("profileCreateDialog.loadingModels")}):l.jsxs("div",{className:"p-1",children:[!w&&l.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground",children:[l.jsx(vw,{className:"w-3 h-3 text-accent"}),l.jsx("span",{children:c("openrouterModelPicker.newestModels")})]}),ee.map(Q=>l.jsx(WM,{model:Q,onClick:()=>$(Q),showAge:!w},Q.id))]})})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"model",children:[c("profileCreateDialog.defaultModel"),l.jsx(Et,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),l.jsx(Bn,{id:"model",...E("model"),placeholder:K?.defaultModel??"claude-sonnet-4",className:"font-mono text-sm"})]}),l.jsxs("div",{className:"grid gap-3 pt-2 border-t",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"sonnetModel",className:"text-sm",children:[c("profileCreateDialog.sonnetMapping"),l.jsx(Et,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),l.jsx(Bn,{id:"sonnetModel",...E("sonnetModel"),placeholder:c("profileCreateDialog.sonnetMappingPlaceholder"),className:"font-mono text-sm h-9"})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"opusModel",className:"text-sm",children:[c("profileCreateDialog.opusMapping"),l.jsx(Et,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),l.jsx(Bn,{id:"opusModel",...E("opusModel"),placeholder:c("profileCreateDialog.opusMappingPlaceholder"),className:"font-mono text-sm h-9"})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"haikuModel",className:"text-sm",children:[c("profileCreateDialog.haikuMapping"),l.jsx(Et,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),l.jsx(Bn,{id:"haikuModel",...E("haikuModel"),placeholder:c("profileCreateDialog.haikuMappingPlaceholder"),className:"font-mono text-sm h-9"})]})]})]})]})]}),l.jsxs(GD,{className:"p-6 pt-4 border-t bg-muted/10",children:[l.jsx(st,{type:"button",variant:"outline",onClick:()=>a(!1),children:c("profileDialog.cancel")}),l.jsx(st,{type:"submit",disabled:Z,className:z(Z&&"opacity-80"),children:Z?l.jsxs(l.Fragment,{children:[l.jsx(An,{className:"w-4 h-4 mr-2 animate-spin"}),c("cliproxyDialog.creating")]}):l.jsxs(l.Fragment,{children:[l.jsx(Km,{className:"w-4 h-4 mr-2"}),c("profileCreateDialog.createProfile")]})})]})]})]})]})})}function Ld({preset:t,isSelected:a,onClick:o,density:r="compact"}){const c=t.id==="anthropic",d=r==="featured";return l.jsxs("button",{type:"button",onClick:o,className:z("flex flex-none items-center gap-3 rounded-xl border px-3 py-2.5 text-left transition-all",d?"h-[68px] w-[236px]":"h-[64px] w-[168px]",a?"border-primary bg-primary/8 shadow-sm ring-1 ring-primary/10":"border-border/60 bg-background hover:border-primary/40 hover:bg-accent/20"),children:[l.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-background",children:c?l.jsx(MM,{provider:"claude",size:"md",className:"rounded-lg"}):t.icon?l.jsx("img",{src:t.icon,alt:"",className:"h-5 w-5 object-contain"}):l.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/70 text-xs font-semibold text-foreground/70",children:t.name.charAt(0)})}),l.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"truncate text-[13px] font-semibold leading-tight tracking-[-0.01em]",children:t.name}),t.badge&&d&&l.jsx(Et,{variant:"secondary",className:"inline-flex bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:t.badge})]}),t.badge&&!d&&l.jsx(Et,{variant:"secondary",className:"inline-flex w-fit bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:t.badge})]})]})}function YM({isSelected:t,onClick:a}){const{t:o}=ye();return l.jsxs("button",{type:"button",onClick:a,className:z("flex h-[68px] w-[236px] flex-none items-center gap-3 rounded-xl border border-dashed px-3 py-2.5 text-left transition-all",t?"border-primary bg-primary/8 shadow-sm ring-1 ring-primary/10":"border-muted-foreground/30 bg-background hover:border-primary/40 hover:bg-accent/20"),children:[l.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-dashed border-current/30 bg-muted/70",children:l.jsx(sh,{className:"h-4 w-4 text-muted-foreground"})}),l.jsx("div",{className:"min-w-0 flex-1",children:l.jsx("div",{className:"text-sm font-semibold leading-tight",children:o("profileEditor.customEndpoint")})})]})}function WM({model:t,onClick:a,showAge:o}){const{t:r}=ye();return l.jsxs("button",{type:"button",onClick:a,className:"group flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",children:[l.jsx("span",{className:"flex-1 truncate",children:t.name}),l.jsxs("span",{className:"text-muted-foreground group-hover:text-accent-foreground/80 ml-2 flex items-center gap-2 text-xs",children:[o&&t.created&&l.jsx(Et,{variant:"outline",className:"text-[10px] text-accent group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30",children:pM(t.created)}),t.isFree?l.jsx(Et,{variant:"secondary",className:"text-xs group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground",children:r("profileCreateDialog.free")}):l.jsx("span",{children:iM(t.pricing)}),l.jsx("span",{children:dM(t.context_length)})]})]})}function QM({className:t,...a}){return l.jsx("div",{"data-slot":"card",className:z("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...a})}function $M({className:t,...a}){return l.jsx("div",{"data-slot":"card-header",className:z("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...a})}function XM({className:t,...a}){return l.jsx("div",{"data-slot":"card-title",className:z("leading-none font-semibold",t),...a})}function JM({className:t,...a}){return l.jsx("div",{"data-slot":"card-description",className:z("text-muted-foreground text-sm",t),...a})}function ZM({className:t,...a}){return l.jsx("div",{"data-slot":"card-content",className:z("px-6",t),...a})}const zh="[1m]",Bh=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL"],eL=new Set(Bh);function Xj(t){return t.toLowerCase().startsWith("gemini-")}function Fh(t){return t.toLowerCase().endsWith(zh.toLowerCase())}function tL(t){return!t||Fh(t)?t:`${t}${zh}`}function wx(t){return t&&(Fh(t)?t.slice(0,-zh.length):t)}function Jj(t){return eL.has(t)}function nL(t){return wx(t.trim()).replace(/\([^)]+\)$/,"")}function Zj(t){return Bh.some(a=>{const o=t[a];return typeof o=="string"&&Fh(o)})}function eR(t,a,o={}){const r={...t};for(const c of Bh){const d=r[c];if(typeof d!="string"||d.trim().length===0)continue;const h=nL(d),p=o.supportsExtendedContext?.(h,c)??!0;r[c]=a&&p?tL(d):wx(d)}return r}const aL=["agy","claude","gemini","codex","cursor","gitlab","codebuddy","qwen","kimi","iflow","kilo","kiro","ghcp"],tR=aL.map(t=>({id:t,name:Ah(t),description:lN(t)})),iL=["provider","auth","variant","success"];function nR(t){return t==="account"?1:iL.indexOf(t)}const aR=I0,iR=U0,oR=_0,oL=C.forwardRef(({className:t,align:a="center",sideOffset:o=4,...r},c)=>l.jsx(O0,{children:l.jsx(qb,{ref:c,align:a,sideOffset:o,className:z("z-50 w-80 max-w-[calc(100vw-2rem)] rounded-lg border border-border/70 bg-popover p-4 text-popover-foreground shadow-xl shadow-black/10 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",t),...r})}));oL.displayName=qb.displayName;const rL=C.lazy(()=>tt(()=>Promise.resolve().then(()=>Zl),void 0).then(t=>({default:t.CodeEditor})));function rR({rawJsonContent:t,isRawJsonValid:a,rawJsonEdits:o,onRawJsonChange:r,profileEnv:c,missingRequiredFields:d=[]}){const{t:h}=ye(),p=d.length>0;return l.jsx(C.Suspense,{fallback:l.jsxs("div",{className:"flex items-center justify-center h-full",children:[l.jsx(An,{className:"w-6 h-6 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-2 text-muted-foreground",children:h("providerEditor.loadingEditor")})]}),children:l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!a&&o!==null&&l.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:[l.jsx(Mo,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&p&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[l.jsx(Vn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),l.jsxs("div",{children:[l.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",l.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:d.join(", ")}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Apply a preset from Model Config tab or add these fields manually. Without them, Claude Code will fail with 404 errors."})]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:l.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:l.jsx(rL,{value:t,onChange:r,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx("div",{className:"border rounded-md overflow-hidden",children:l.jsx(Uh,{profileEnv:c})})})]})})}var Xt={},tb;function sL(){if(tb)return Xt;tb=1;var t=Xt&&Xt.__assign||function(){return t=Object.assign||function(P){for(var k,O=1,U=arguments.length;O<U;O++){k=arguments[O];for(var _ in k)Object.prototype.hasOwnProperty.call(k,_)&&(P[_]=k[_])}return P},t.apply(this,arguments)},a=Xt&&Xt.__createBinding||(Object.create?(function(P,k,O,U){U===void 0&&(U=O);var _=Object.getOwnPropertyDescriptor(k,O);(!_||("get"in _?!k.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return k[O]}}),Object.defineProperty(P,U,_)}):(function(P,k,O,U){U===void 0&&(U=O),P[U]=k[O]})),o=Xt&&Xt.__setModuleDefault||(Object.create?(function(P,k){Object.defineProperty(P,"default",{enumerable:!0,value:k})}):function(P,k){P.default=k}),r=Xt&&Xt.__importStar||function(P){if(P&&P.__esModule)return P;var k={};if(P!=null)for(var O in P)O!=="default"&&Object.prototype.hasOwnProperty.call(P,O)&&a(k,P,O);return o(k,P),k},c=Xt&&Xt.__rest||function(P,k){var O={};for(var U in P)Object.prototype.hasOwnProperty.call(P,U)&&k.indexOf(U)<0&&(O[U]=P[U]);if(P!=null&&typeof Object.getOwnPropertySymbols=="function")for(var _=0,U=Object.getOwnPropertySymbols(P);_<U.length;_++)k.indexOf(U[_])<0&&Object.prototype.propertyIsEnumerable.call(P,U[_])&&(O[U[_]]=P[U[_]]);return O};Object.defineProperty(Xt,"__esModule",{value:!0});var d=r(nh()),h=89,p=90,g=77,m=57,S=219,b=222,x=192,T=100,w=3e3,M=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),j=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),E="npm__react-simple-code-editor__textarea",D=`
|
|
17
|
+
`).trim()}function EP(t){const a=t.url.match(/\/api\/provider\/([^/]+)/);a&&(t.provider=a[1]);const o=t.url.match(/\/api\/provider\/[^/]+\/(.+?)(?:\?|$)/);o&&(t.endpoint=o[1]),t.isClientError=t.statusCode>=400&&t.statusCode<500,t.isServerError=t.statusCode>=500,t.statusCode===429?t.errorType="rate_limit":t.statusCode===401||t.statusCode===403?t.errorType="auth":t.statusCode===404?t.errorType="not_found":t.statusCode>=500?t.errorType="server":(t.statusCode===408||t.statusCode===504)&&(t.errorType="timeout"),jP(t),t.statusCode===429&&RP(t)}function jP(t){if(t.requestBody)try{const a=JSON.parse(t.requestBody);typeof a.model=="string"&&(t.model=a.model)}catch{}}function RP(t){if(t.responseBody)try{const a=JSON.parse(t.responseBody),o=Qd(a);o!==null&&(t.quotaResetDelay=o);const r=$d(a);r&&(t.quotaResetTimestamp=r)}catch{}}function Qd(t){if(typeof t!="object"||t===null)return null;const a=t;if("quotaResetDelay"in a){const o=a.quotaResetDelay;if(typeof o=="number")return o;if(typeof o=="string"){const r=o.match(/^(\d+)s?$/);if(r)return parseInt(r[1],10)}}if("error"in a&&typeof a.error=="object"){const o=Qd(a.error);if(o!==null)return o}if("details"in a&&Array.isArray(a.details))for(const o of a.details){const r=Qd(o);if(r!==null)return r}return null}function $d(t){if(typeof t!="object"||t===null)return null;const a=t;for(const o of["quotaResetTimeStamp","quotaResetTimestamp","resetTime","reset_time"])if(o in a&&typeof a[o]=="string")return a[o];if("error"in a&&typeof a.error=="object"){const o=$d(a.error);if(o)return o}if("details"in a&&Array.isArray(a.details))for(const o of a.details){const r=$d(o);if(r)return r}return null}function OP(t){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"}[t]||""}function IP(t,a){const o=lh(),r=Date.now(),c=t*1e3,d=r-c,h=Math.floor(d/1e3),p=Math.floor(h/60),g=Math.floor(p/60),m=Math.floor(g/24);if(h<60){const b=o==="zh-CN",x=o==="vi";return b?"刚刚":x?"vừa xong":"just now"}if(p<60){const b=o==="zh-CN",x=o==="vi";return b?`${p} 分钟前`:x?`${p} phút trước`:`${p}m ago`}if(g<24){const b=o==="zh-CN",x=o==="vi";return b?`${g} 小时前`:x?`${g} giờ trước`:`${g}h ago`}if(m<7){const b=o==="zh-CN",x=o==="vi";return b?`${m} 天前`:x?`${m} ngày trước`:`${m}d ago`}return new Date(c).toLocaleDateString(o,{month:"short",day:"numeric"})}function _P(t){return t>=500?"text-red-500":t===429?"text-orange-500":t>=400?"text-yellow-500":"text-gray-500"}function UP(t,a){const o=lh();return o==="zh-CN"?{rate_limit:"限流",auth:"认证错误",not_found:"未找到",server:"服务错误",timeout:"超时",unknown:"错误"}[t]||"错误":o==="vi"?{rate_limit:"Quá giới hạn",auth:"Lỗi xác thực",not_found:"Không tìm thấy",server:"Lỗi máy chủ",timeout:"Hết thời gian chờ",unknown:"Lỗi"}[t]||"Lỗi":{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[t]||"Error"}function HP(t){if(t===null||t<=0)return null;if(t<60)return`${t}s`;if(t<3600)return`${Math.floor(t/60)}m`;const a=Math.floor(t/3600),o=Math.floor(t%3600/60);return o>0?`${a}h ${o}m`:`${a}h`}function zP(t,a){if(!t)return null;const o=lh(),r=o==="zh-CN",c=o==="vi";try{const d=new Date(t),h=new Date,p=d.getTime()-h.getTime();if(p<=0)return r?"现在":c?"bây giờ":"now";const g=Math.floor(p/1e3);if(g<60)return r?`${g}秒`:c?`${g} giây`:`${g}s`;if(g<3600){const b=Math.floor(g/60);return r?`${b}分钟`:c?`${b} phút`:`${b}m`}const m=Math.floor(g/3600),S=Math.floor(g%3600/60);return r?S>0?`${m}小时 ${S}分钟`:`${m}小时`:c?S>0?`${m} giờ ${S} phút`:`${m} giờ`:S>0?`${m}h ${S}m`:`${m}h`}catch{return null}}function BP(t){return t?t===429?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":t>=500?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":t>=400?"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400":"bg-gray-100 text-gray-600":"bg-gray-100 text-gray-600"}function FP(t){return t||""}function qP({name:t,size:a,modified:o,isSelected:r,onClick:c,statusCode:d,model:h}){const p=C.useMemo(()=>NP(t),[t]),g=C.useMemo(()=>FP(h),[h]);return l.jsxs("button",{onClick:c,className:z("w-full px-2.5 py-2 flex items-center gap-2 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",r?"bg-muted/50 border-l-red-500":"border-l-transparent"),children:[l.jsx("span",{className:z("shrink-0 text-[10px] font-bold px-1.5 py-0.5 rounded min-w-[32px] text-center",BP(d)),children:d||"???"}),l.jsx(Mh,{provider:p.provider,size:18,withBackground:!0,className:"shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[l.jsx("span",{className:"text-[11px] font-medium text-foreground truncate",children:p.endpoint||"unknown"}),g&&l.jsx("span",{className:"text-[10px] text-muted-foreground truncate",title:g,children:g}),l.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-muted-foreground/60",children:[l.jsx(To,{className:"w-2.5 h-2.5"}),l.jsx("span",{children:IP(o)})]})]})]})}function $y({value:t,className:a,variant:o="outline",size:r="icon",label:c="Copy to clipboard"}){const[d,h]=C.useState(!1),p=()=>{navigator.clipboard.writeText(t),h(!0),setTimeout(()=>h(!1),2e3)};return l.jsx(Pi,{children:l.jsxs(wa,{children:[l.jsx(ka,{asChild:!0,children:l.jsxs(st,{size:r,variant:o,className:z("relative z-10 text-muted-foreground hover:text-foreground",a),onClick:g=>{g.stopPropagation(),p()},children:[d?l.jsx(No,{className:"h-3.5 w-3.5 text-green-500"}):l.jsx(Al,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:c})]})}),l.jsx(Aa,{children:l.jsx("p",{children:d?"Copied!":c})})]})})}function Mr({active:t,onClick:a,children:o,icon:r}){return l.jsxs("button",{onClick:a,className:z("px-2.5 py-1.5 text-xs font-medium rounded transition-colors flex items-center gap-1.5",t?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[r&&l.jsx(r,{className:"w-3.5 h-3.5"}),o]})}function ux({code:t}){const a=_P(t);return l.jsx("span",{className:z("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",a),children:t})}function KP({parsed:t}){const{t:a}=ye(),o=HP(t.quotaResetDelay)||zP(t.quotaResetTimestamp),r=a("errorLogs.na");return l.jsx(Lo,{className:"h-full",children:l.jsxs("div",{className:"p-4 space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(ux,{code:t.statusCode}),l.jsx("span",{className:"text-sm font-medium",children:t.statusText}),l.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:UP(t.errorType)})]}),t.model&&l.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-violet-500/10 border border-violet-500/20",children:[l.jsx(dw,{className:"w-4 h-4 text-violet-500 shrink-0"}),l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"text-muted-foreground",children:a("errorLogs.modelLabel")}),l.jsx("span",{className:"font-semibold text-violet-600 dark:text-violet-400",children:t.model})]})]}),t.errorType==="rate_limit"&&o&&l.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[l.jsx(To,{className:"w-4 h-4 text-amber-500 shrink-0"}),l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"text-muted-foreground",children:a("errorLogs.quotaResetsIn")}),l.jsx("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:o})]})]}),l.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.method")}),l.jsx("div",{className:"font-medium",children:t.method||r})]}),l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.provider")}),l.jsx("div",{className:"font-medium",children:t.provider||r})]}),l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.version")}),l.jsx("div",{className:"font-medium",children:t.version||r})]}),l.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[l.jsx("div",{className:"text-muted-foreground mb-1",children:a("errorLogs.endpoint")}),l.jsx("div",{className:"font-medium truncate",title:t.endpoint,children:t.endpoint||r})]})]}),l.jsxs("div",{className:"text-xs",children:[l.jsx("div",{className:"text-muted-foreground mb-1.5",children:a("errorLogs.url")}),l.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:t.url||r})]}),l.jsxs("div",{className:"text-xs",children:[l.jsx("div",{className:"text-muted-foreground mb-1.5",children:a("errorLogs.timestamp")}),l.jsx("div",{className:"font-mono",children:t.timestamp||r})]}),t.errorType!=="unknown"&&l.jsxs("div",{className:z("flex items-start gap-3 p-3 rounded text-xs",t.errorType==="rate_limit"?"bg-amber-500/10 border border-amber-500/20":t.errorType==="auth"?"bg-red-500/10 border border-red-500/20":"bg-blue-500/10 border border-blue-500/20"),children:[t.errorType==="rate_limit"?l.jsx(Vn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}):t.errorType==="auth"?l.jsx(Vn,{className:"w-4 h-4 mt-0.5 text-red-500 shrink-0"}):l.jsx(Ul,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),l.jsxs("div",{className:z("leading-relaxed",t.errorType==="rate_limit"?"text-amber-600 dark:text-amber-400":t.errorType==="auth"?"text-red-600 dark:text-red-400":"text-blue-600 dark:text-blue-400"),children:[t.errorType==="rate_limit"&&(t.model?a("errorLogs.rateLimitedMsg",{model:t.model}):a("errorLogs.rateLimitedMsgNoModel")),t.errorType==="auth"&&a("errorLogs.authFailedMsg"),t.errorType==="not_found"&&a("errorLogs.notFoundMsg"),t.errorType==="server"&&a("errorLogs.serverErrorMsg"),t.errorType==="timeout"&&a("errorLogs.timeoutMsg")]})]})]})})}function GP({headers:t}){const{t:a}=ye(),o=Object.entries(t);return o.length===0?l.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:a("errorLogs.noHeaders")}):l.jsx(Lo,{className:"h-full",children:l.jsx("div",{className:"p-4 space-y-1",children:o.map(([r,c])=>l.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[l.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[r,":"]}),l.jsx("span",{className:"break-all",children:c})]},r))})})}function Xy({content:t,label:a}){const{t:o}=ye();if(!t||t.trim()===""){const d=a==="Request"?"errorLogs.noRequestBody":"errorLogs.noResponseBody";return l.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:o(d)})}let r=t,c=!1;try{const d=JSON.parse(t);r=JSON.stringify(d,null,2),c=!0}catch{}return l.jsx(Lo,{className:"h-full",children:l.jsx("pre",{className:z("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",c?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:r})})}function VP({content:t}){return l.jsx(Lo,{className:"h-full",children:l.jsx("pre",{className:"p-4 text-xs font-mono text-zinc-700 dark:text-muted-foreground whitespace-pre-wrap break-all leading-relaxed",children:t})})}function YP({name:t,absolutePath:a}){const{t:o}=ye(),[r,c]=C.useState("overview"),{data:d,isLoading:h,error:p}=xT(t),g=C.useMemo(()=>d?TP(d):null,[d]);return t?h?l.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[l.jsx($e,{className:"h-5 w-full"}),l.jsx($e,{className:"h-5 w-3/4"}),l.jsx($e,{className:"h-5 w-5/6"}),l.jsx($e,{className:"h-5 w-2/3"})]}):p||!d||!g?l.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:l.jsx("p",{className:"text-sm",children:o("errorLogs.failedLoadContent")})}):l.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[l.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[l.jsx(ux,{code:g.statusCode}),l.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[g.provider,"/",g.endpoint||"unknown"]}),t&&l.jsx($y,{value:a||t,label:o("errorLogs.copyAbsolutePath"),size:"icon-sm",className:"ml-1 text-muted-foreground hover:text-foreground opacity-50 hover:opacity-100 transition-opacity"})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[d&&l.jsx($y,{value:d,label:o("errorLogs.copyRawContent"),variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),l.jsx("span",{className:"text-[10px] text-muted-foreground font-mono bg-muted px-1.5 py-0.5 rounded border border-border/50",children:g.method})]})]}),l.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:[l.jsx(Mr,{active:r==="overview",onClick:()=>c("overview"),icon:Ul,children:o("errorLogs.tabOverview")}),l.jsx(Mr,{active:r==="headers",onClick:()=>c("headers"),icon:fw,children:o("errorLogs.tabHeaders")}),l.jsx(Mr,{active:r==="request",onClick:()=>c("request"),icon:iv,children:o("errorLogs.tabRequest")}),l.jsx(Mr,{active:r==="response",onClick:()=>c("response"),icon:pw,children:o("errorLogs.tabResponse")}),l.jsx(Mr,{active:r==="raw",onClick:()=>c("raw"),icon:gw,children:o("errorLogs.tabRaw")})]}),l.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[r==="overview"&&l.jsx(KP,{parsed:g}),r==="headers"&&l.jsx(GP,{headers:g.requestHeaders}),r==="request"&&l.jsx(Xy,{content:g.requestBody,label:o("errorLogs.tabRequest")}),r==="response"&&l.jsx(Xy,{content:g.responseBody,label:o("errorLogs.tabResponse")}),r==="raw"&&l.jsx(VP,{content:d})]})]}):l.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:l.jsxs("div",{className:"text-center space-y-3",children:[l.jsx(hw,{className:"w-10 h-10 mx-auto opacity-40"}),l.jsx("p",{className:"text-sm",children:o("errorLogs.selectLog")})]})})}function WP(){const{t}=ye(),{data:a,isLoading:o}=gT(),{data:r,isLoading:c,error:d}=vT(a?.running??!1),[h,p]=C.useState(500),[g,m]=C.useState(!1),S=C.useRef(null),b=C.useRef(null),x=()=>{b.current&&(clearInterval(b.current),b.current=null)};C.useEffect(()=>{if(!g)return;const A=k=>{const O=S.current;if(!O)return;const _=O.getBoundingClientRect().top+window.scrollY,K=k.pageY-_;p(Math.max(300,K));const Y=window.innerHeight-k.clientY,$=15;x(),Y<50?b.current=setInterval(()=>{window.scrollBy(0,$)},16):k.clientY<50&&(b.current=setInterval(()=>{window.scrollBy(0,-$)},16))},P=()=>{m(!1),x(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",A),document.addEventListener("mouseup",P),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",P),document.body.style.cursor="default",document.body.style.userSelect="auto",x()}},[g]);const T=A=>{A.preventDefault(),m(!0)},w=C.useMemo(()=>r?.[0]?.name??null,[r]),[M,j]=C.useState(null),E=M??w,D=C.useMemo(()=>!E||!r?void 0:r.find(P=>P.name===E)?.absolutePath,[E,r]);if(o||!a?.running)return null;if(c)return l.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:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[l.jsx($e,{className:"h-4 w-32"}),l.jsx($e,{className:"h-4 w-20"})]}),l.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(A=>l.jsx($e,{className:"h-12 w-full rounded-lg"},A))})]});if(!r||r.length===0)return null;const N=r.length;return l.jsxs("div",{ref:S,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:[l.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:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx(Vn,{className:"w-4 h-4 text-amber-500"}),l.jsx("span",{className:"text-sm font-semibold tracking-tight",children:t("errorLogs.title")}),l.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:t("errorLogs.failedRequests",{count:N})})]}),l.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[l.jsx(mw,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:t("errorLogs.cliproxyDiagnostics")})]})]}),l.jsx("div",{className:"flex-1 min-h-0",children:l.jsxs(Rh,{direction:"horizontal",children:[l.jsx(Vr,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:l.jsxs(Lo,{className:"h-full",children:[l.jsx("div",{className:"divide-y divide-border/50",children:r.slice(0,50).map(A=>l.jsx(qP,{name:A.name,size:A.size,modified:A.modified,isSelected:E===A.name,onClick:()=>j(A.name),statusCode:A.statusCode,model:A.model},A.name))}),r.length>50&&l.jsx("div",{className:"px-3 py-3 text-center text-[10px] text-muted-foreground border-t border-border/50",children:t("errorLogs.showingCount",{total:r.length})})]})}),l.jsxs(Oh,{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:[l.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),l.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:l.jsx(_l,{className:"h-4 w-4 text-muted-foreground"})})]}),l.jsx(Vr,{className:"flex flex-col min-w-0 bg-background/50",children:l.jsx(YP,{name:E,absolutePath:D})})]})}),d?l.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:d.message}):l.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:T,children:l.jsx(yw,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const QP=Hl("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"}}),zr=C.forwardRef(({className:t,variant:a,...o},r)=>l.jsx("div",{ref:r,role:"alert",className:z(QP({variant:a}),t),...o}));zr.displayName="Alert";const Ll=C.forwardRef(({className:t,...a},o)=>l.jsx("h5",{ref:o,className:z("mb-1 font-medium leading-none tracking-tight",t),...a}));Ll.displayName="AlertTitle";const Br=C.forwardRef(({className:t,...a},o)=>l.jsx("div",{ref:o,className:z("text-sm [&_p]:leading-relaxed",t),...a}));Br.displayName="AlertDescription";function $P(){return St({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function dx(t,a){return typeof t=="object"&&t!==null&&"error"in t&&typeof t.error=="string"?t.error:a}function hx(t){const a=t.trim();if(!a)return null;try{return JSON.parse(a)}catch{return null}}function XP(t){const a=t.trim().toLowerCase();return a.startsWith("<!doctype html")||a.startsWith("<html")}function JP(t){if(!t||typeof t!="object")return!1;const a=t;return!(typeof a.content!="string"||"contentPath"in a&&typeof a.contentPath!="string")}async function fx(t,a){const o=await t.text(),r=hx(o);if(!t.ok){const c=dx(r,a);throw new Error(c)}if(r===null)throw new Error(a);return r}function ZP(){return St({queryKey:["shared","summary"],queryFn:async()=>{const t=await fetch("/api/shared/summary");return fx(t,"Failed to fetch shared summary")}})}function Oj(t){return St({queryKey:["shared",t],queryFn:async()=>{const a=await fetch(`/api/shared/${t}`);return fx(a,`Failed to fetch shared ${t}`)}})}function Ij(t,a){return St({queryKey:["shared",t,"content",a],enabled:typeof a=="string"&&a.length>0,queryFn:async()=>{if(!a)throw new Error("Missing shared item path");const o=new URLSearchParams({type:t,path:a}),r=await fetch(`/api/shared/content?${o.toString()}`),c=await r.text(),d=hx(c);if(!r.ok)throw new Error(dx(d,`Failed to fetch shared ${t} content`));if(JP(d))return{content:d.content,contentPath:typeof d.contentPath=="string"&&d.contentPath.length>0?d.contentPath:a};if(c.trim().length>0){if(XP(c))throw new Error("Shared content endpoint unavailable. Restart `ccs config` and try again.");return{content:c,contentPath:a}}throw new Error(`Failed to fetch shared ${t} content`)}})}const eM={ok:"success",warning:"warning",error:"error"},tM={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 vl({title:t,value:a,icon:o,variant:r="default",onClick:c}){const d=tM[r];return l.jsxs("button",{onClick:c,className:z("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:[l.jsx("div",{className:z("flex items-center justify-center w-9 h-9 rounded-md",d.iconBg),children:l.jsx(o,{className:z("w-4 h-4",d.iconColor)})}),l.jsxs("div",{className:"text-left",children:[l.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:t}),l.jsx("p",{className:z("text-lg font-bold font-mono leading-tight",d.iconColor),children:a})]})]})}function nM(){const{t}=ye(),a=ah(),{data:o,isLoading:r}=$P(),{data:c,isLoading:d}=ZP();if(r||d)return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx($e,{className:"h-12 w-12 rounded-lg"}),l.jsxs("div",{children:[l.jsx($e,{className:"h-7 w-[180px] mb-2"}),l.jsx($e,{className:"h-4 w-[220px]"})]})]}),l.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(p=>l.jsx($e,{className:"h-14 w-28 rounded-lg"},p))})]}),l.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[l.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[l.jsx($e,{className:"h-4 w-32"}),l.jsx($e,{className:"h-4 w-20"})]}),l.jsx("div",{className:"px-4 py-3 border-b",children:l.jsx($e,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(p=>l.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[l.jsx($e,{className:"w-2.5 h-2.5 rounded-full"}),l.jsx($e,{className:"h-4 flex-1"}),l.jsx($e,{className:"h-1.5 w-24 rounded-full"}),l.jsx($e,{className:"h-4 w-16"})]},p))]})]});const h=o?.health?eM[o.health.status]:void 0;return l.jsxs("div",{className:"p-6 space-y-6",children:[l.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[l.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:l.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),l.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[l.jsx(jN,{version:o?.version}),l.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[l.jsx(vl,{title:t("home.profiles"),value:o?.profiles??0,icon:Ud,variant:"accent",onClick:()=>a("/providers")}),l.jsx(vl,{title:t("home.cliproxy"),value:o?.cliproxy??0,icon:Yb,variant:"accent",onClick:()=>a("/cliproxy")}),l.jsx(vl,{title:t("home.accounts"),value:o?.accounts??0,icon:$b,variant:"default",onClick:()=>a("/accounts")}),l.jsx(vl,{title:t("home.health"),value:o?.health?`${o.health.passed}/${o.health.total}`:"-",icon:Fr,variant:h,onClick:()=>a("/health")})]})]})]}),c?.symlinkStatus&&!c.symlinkStatus.valid&&l.jsxs(zr,{variant:"warning",children:[l.jsx(Vn,{className:"h-4 w-4"}),l.jsx(Ll,{children:t("home.configurationRequired")}),l.jsx(Br,{children:c.symlinkStatus.message})]}),l.jsx(JT,{}),l.jsx("div",{className:"rounded-xl border bg-card/70 p-5",children:l.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"rounded-xl bg-muted p-2.5",children:l.jsx(Xb,{className:"h-5 w-5 text-muted-foreground"})}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("h2",{className:"text-lg font-semibold",children:t("homePageV2.logsMoved")}),l.jsx("p",{className:"max-w-2xl text-sm text-muted-foreground",children:"Use the unified logs page for source-level filtering, structured entry inspection, and retention policy edits without crowding the home dashboard."})]})]}),l.jsxs(st,{variant:"outline",className:"gap-2",onClick:()=>a("/logs"),children:["Open logs",l.jsx(bw,{className:"h-4 w-4"})]})]})}),l.jsx(WP,{})]})}const px=L0,Ih=C.forwardRef(({className:t,...a},o)=>l.jsx(zb,{ref:o,className:z("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...a}));Ih.displayName=zb.displayName;const El=C.forwardRef(({className:t,...a},o)=>l.jsx(Bb,{ref:o,className:z("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",t),...a}));El.displayName=Bb.displayName;const Xd=C.forwardRef(({className:t,...a},o)=>l.jsx(Fb,{ref:o,className:z("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...a}));Xd.displayName=Fb.displayName;function qt({className:t,...a}){return l.jsx(E0,{"data-slot":"label",className:z("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",t),...a})}const _h="ccs:openrouter-models",aM=1440*60*1e3,gx="1";function Jd(t){const a=parseFloat(t);return isNaN(a)||a===0?0:a*1e6}function Jy(t){const a=Jd(t);return a===0?ie.t("openrouterUtils.priceFree"):a<.01?ie.t("openrouterUtils.priceLessThanCent"):a<1?`$${a.toFixed(2)}`:`$${a.toFixed(a<10?2:0)}`}function iM(t){const a=Jy(t.prompt),o=Jy(t.completion);return a===ie.t("openrouterUtils.priceFree")&&o===ie.t("openrouterUtils.priceFree")?ie.t("openrouterUtils.priceFree"):`${a}/${o}`}function oM(t){const a=t.id.toLowerCase();return a.startsWith("anthropic/")?"anthropic":a.startsWith("openai/")?"openai":a.startsWith("google/")?"google":a.startsWith("meta-llama/")||a.startsWith("meta/")?"meta":a.startsWith("mistralai/")?"mistral":a.includes(":free")||a.includes("qwen")||a.includes("deepseek")?"opensource":"other"}function rM(t){return{...t,category:oM(t),pricePerMillionPrompt:Jd(t.pricing.prompt),pricePerMillionCompletion:Jd(t.pricing.completion),isFree:t.pricing.prompt==="0"&&t.pricing.completion==="0",isExacto:t.id.includes(":exacto")}}function sM(t,a,o){const r=a.toLowerCase().trim();return t.filter(c=>o?.category&&c.category!==o.category||o?.freeOnly&&!c.isFree||o?.minContext&&c.context_length<o.minContext?!1:r?c.id.toLowerCase().includes(r)||c.name.toLowerCase().includes(r)||c.description?.toLowerCase().includes(r):!0)}function _j(t){return[...t].sort((a,o)=>{if(a.isFree&&!o.isFree)return-1;if(!a.isFree&&o.isFree)return 1;if(!a.isFree&&!o.isFree){if(a.isExacto&&!o.isExacto)return-1;if(!a.isExacto&&o.isExacto)return 1}return a.name.localeCompare(o.name)})}function lM(){try{const t=localStorage.getItem(_h);if(!t)return null;const a=JSON.parse(t);return a.version!==gx||Date.now()-a.fetchedAt>aM?null:a.models}catch{return null}}function cM(t){try{localStorage.setItem(_h,JSON.stringify({models:t,fetchedAt:Date.now(),version:gx}))}catch{}}function uM(){localStorage.removeItem(_h)}function Uj(t,a){const[o]=t.split("/");if(!o)return{};const r=a.filter(h=>h.id.startsWith(`${o}/`));if(r.length===0)return{};const c=[...r].sort((h,p)=>p.pricePerMillionPrompt-h.pricePerMillionPrompt),d=Math.ceil(c.length/3);return{opus:c[0]?.id,sonnet:c[Math.min(d,c.length-1)]?.id,haiku:c[c.length-1]?.id}}function dM(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}const Hj={anthropic:"Anthropic (Claude)",openai:"OpenAI (GPT)",google:"Google (Gemini)",meta:"Meta (Llama)",mistral:"Mistral",opensource:"Open Source",other:"Other"},hM={anthropic:["anthropic/"],openai:["openai/"],google:["google/"],meta:["meta-llama/","meta/"],mistral:["mistralai/"],opensource:["deepseek/","qwen/","cohere/"],other:[]};function fM(t,a=2){const o=[],r=["anthropic","openai","google","meta","mistral","opensource"];for(const c of r){const d=hM[c];if(d.length===0)continue;const p=[...t.filter(g=>d.some(m=>g.id.toLowerCase().startsWith(m)))].sort((g,m)=>(m.created??0)-(g.created??0));o.push(...p.slice(0,a))}return o.sort((c,d)=>(d.created??0)-(c.created??0))}function pM(t){const o=Date.now()/1e3-t;return o<86400?ie.t("openrouterUtils.ageToday"):o<172800?ie.t("openrouterUtils.ageYesterday"):o<604800?ie.t("openrouterUtils.ageDaysAgo",{count:Math.floor(o/86400)}):o<2592e3?ie.t("openrouterUtils.ageWeeksAgo",{count:Math.floor(o/604800)}):o<31536e3?ie.t("openrouterUtils.ageMonthsAgo",{count:Math.floor(o/2592e3)}):ie.t("openrouterUtils.ageYearsAgo",{count:Math.floor(o/31536e3)})}const gM="https://openrouter.ai/api/v1/models",mx=["openrouter-models"],Zy=1440*60*1e3;async function mM(){const t=await fetch(gM);if(!t.ok)throw new Error(`Failed to fetch OpenRouter models: ${t.status}`);const o=(await t.json()).data;return cM(o),o}function yx(){return St({queryKey:mx,queryFn:mM,staleTime:Zy,gcTime:Zy,initialData:()=>lM()??void 0,refetchOnWindowFocus:!1})}function yM(){const t=yx(),a=(t.data??[]).map(rM);return{...t,models:a}}function zj(){const t=lt();return()=>(uM(),t.invalidateQueries({queryKey:mx}))}function Bj(){const{data:t,isLoading:a,isError:o}=yx();return{isReady:!!t&&t.length>0,isLoading:a,isError:o,modelCount:t?.length??0}}function Uh({profileEnv:t={}}){const{t:a}=ye(),[o,r]=C.useState(null),[c,d]=C.useState(!0),[h,p]=C.useState(!1);C.useEffect(()=>{g()},[]);const g=async()=>{try{d(!0);const T=await fetch("/api/global-env");if(!T.ok)throw new Error("Failed to load");const w=await T.json();r(w)}catch{r(null)}finally{d(!1)}};if(c||!o?.enabled)return null;const m=o.env||{},S=Object.keys(m);if(S.length===0)return null;const b=S.filter(T=>!(T in t)),x=S.filter(T=>T in t);return l.jsxs("div",{className:"border-t bg-muted/20",children:[l.jsxs("button",{onClick:()=>p(!h),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[l.jsx(Ul,{className:"w-4 h-4 text-blue-500"}),l.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[a("globalEnvIndicator.injectedCount",{count:b.length}),x.length>0&&l.jsx("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:a("globalEnvIndicator.overriddenCount",{count:x.length})})]}),h?l.jsx(oh,{className:"w-4 h-4 text-muted-foreground"}):l.jsx(Il,{className:"w-4 h-4 text-muted-foreground"})]}),h&&l.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[b.length>0&&l.jsx("div",{className:"space-y-1",children:b.map(T=>l.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:[l.jsx("span",{className:"text-green-500",children:"+"}),l.jsxs("span",{className:"truncate",children:[T,"=",m[T]]})]},T))}),x.length>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-xs text-muted-foreground",children:a("globalEnvIndicator.skippedLabel")}),x.map(T=>l.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:[l.jsx("span",{className:"text-amber-500",children:"~"}),l.jsx("span",{className:"truncate",children:T})]},T))]}),l.jsx("div",{className:"pt-2 border-t border-border/50",children:l.jsx(st,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:l.jsxs(kl,{to:"/settings?tab=globalenv",children:[l.jsx(sh,{className:"w-3.5 h-3.5"}),a("globalEnvIndicator.configureInSettings"),l.jsx(ev,{className:"w-3 h-3 opacity-50"})]})})})]})]})}function bM({className:t,...a}){return l.jsx(j0,{"data-slot":"switch",className:z("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...a,children:l.jsx(R0,{"data-slot":"switch-thumb",className:z("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}function vM(t,a,o){return t(o==="refreshing"?"imageAnalysisStatus.refreshingPreview":o==="invalid"?"imageAnalysisStatus.savedStatus":a==="editor"?"imageAnalysisStatus.livePreview":"imageAnalysisStatus.savedStatus")}function xM(t,a,o){return a.status==="disabled"?t("imageAnalysisStatus.disabledGlobally"):o!=="claude"?t("imageAnalysisStatus.targetBypassesHook",{target:t(`imageAnalysisStatus.targetLabel.${o}`)}):a.nativeReadPreference?t("imageAnalysisStatus.nativeImageReading"):a.status==="hook-missing"?t("imageAnalysisStatus.setupNeeded"):a.authReadiness==="missing"?t("imageAnalysisStatus.needsAuth"):a.proxyReadiness==="unavailable"?t("imageAnalysisStatus.needsProxy"):a.effectiveRuntimeMode==="native-read"?t("imageAnalysisStatus.nativeFallback"):t("imageAnalysisStatus.transformerReady")}function CM(t,a,o){return a.status==="disabled"?{label:t("imageAnalysisStatus.badgeDisabled"),className:"border-border/80 bg-background/85 text-muted-foreground"}:o!=="claude"?{label:t("imageAnalysisStatus.badgeBypassed"),className:"border-sky-500/25 bg-sky-500/10 text-sky-800 dark:text-sky-200"}:a.nativeReadPreference?{label:t("imageAnalysisStatus.badgeNative"),className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}:a.status==="hook-missing"||a.authReadiness==="missing"?{label:a.status==="hook-missing"?t("imageAnalysisStatus.badgeSetup"):t("imageAnalysisStatus.badgeAuth"),className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:a.proxyReadiness==="unavailable"?{label:t("imageAnalysisStatus.badgeProxy"),className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:{label:t("imageAnalysisStatus.badgeReady"),className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}}function SM(t,a,o){if(a.nativeReadPreference)return a.profileModel&&a.nativeImageCapable?t("imageAnalysisStatus.toggleSummaryNativeCapable",{model:a.profileModel}):a.profileModel?t("imageAnalysisStatus.toggleSummaryNativeModel",{model:a.profileModel}):t("imageAnalysisStatus.toggleSummaryNativeDefault");if(!a.backendDisplayName&&o==="claude")return t("imageAnalysisStatus.toggleSummaryNativeFileAccess");if(!a.backendDisplayName)return t("imageAnalysisStatus.toggleSummaryInactiveTarget",{target:t(`imageAnalysisStatus.targetLabel.${o}`)});const r=a.model?` · ${a.model}`:"";return t("imageAnalysisStatus.toggleSummaryTransformerRoute",{backend:a.backendDisplayName,modelSuffix:r})}function wM(t,a,o){return a.status==="disabled"?t("imageAnalysisStatus.noteDisabledGlobally"):o!=="claude"?t("imageAnalysisStatus.noteTargetBypassesHook",{target:t(`imageAnalysisStatus.targetLabel.${o}`)}):a.nativeReadPreference?a.nativeImageCapable===!0?null:a.nativeImageReason:a.status==="hook-missing"?t("imageAnalysisStatus.notePersistHook"):a.authReadiness==="missing"?a.authReason:a.proxyReadiness==="unavailable"?a.proxyReason:null}function kM({status:t,target:a="claude",source:o="saved",previewState:r="saved",nativeReadPreferenceOverride:c,onToggleNativeRead:d}){const{t:h}=ye();if(!t)return l.jsxs("div",{className:"rounded-2xl border bg-muted/20 px-4 py-3","aria-live":"polite",children:[l.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),l.jsx("div",{className:"mt-2 h-3 w-52 animate-pulse rounded bg-muted"})]});const p=c??t.nativeReadPreference,g={...t,nativeReadPreference:p},m=CM(h,g,a),S=wM(h,g,a),b=t.nativeImageCapable?h("imageAnalysisStatus.capabilityVerified"):t.profileModel?h("imageAnalysisStatus.capabilityUnknown"):null;return l.jsxs("section",{className:"rounded-2xl border bg-background/95 px-4 py-3 shadow-sm",children:[l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsx("div",{className:"min-w-0",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"inline-flex h-8 w-8 items-center justify-center rounded-xl border border-sky-500/20 bg-sky-500/10 text-sky-700 dark:text-sky-300",children:l.jsx(ov,{className:"h-4 w-4"})}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("h3",{className:"text-sm font-semibold",children:h("imageAnalysisStatus.sectionTitle")}),l.jsx(Et,{className:z("h-5 border px-1.5 text-[10px]",m.className),children:m.label})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:[vM(h,o,r)," ·"," ",xM(h,g,a)]})]})]})}),l.jsx(st,{size:"sm",variant:"outline",className:"h-8 shrink-0",asChild:!0,children:l.jsxs(kl,{to:"/settings?tab=image",children:[h("imageAnalysisStatus.openSettings"),l.jsx(iv,{className:"ml-1 h-3.5 w-3.5"})]})})]}),l.jsx("div",{className:"mt-3 rounded-xl border bg-muted/15 px-3 py-3",children:l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("div",{className:"text-sm font-medium text-foreground",children:h("imageAnalysisStatus.useNativeImageReading")}),b&&l.jsx(Et,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:b})]}),l.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:SM(h,g,a)})]}),l.jsx(bM,{checked:p,onCheckedChange:d,disabled:!d,"aria-label":h("imageAnalysisStatus.useNativeImageReading")})]})}),S&&l.jsx("div",{className:"mt-2 rounded-lg border border-border/70 bg-muted/20 px-3 py-2 text-xs leading-5 text-muted-foreground",children:S})]})}const AM=C.lazy(()=>tt(()=>Promise.resolve().then(()=>Zl),void 0).then(t=>({default:t.CodeEditor})));function Fj({rawJsonContent:t,isRawJsonValid:a,rawJsonEdits:o,settings:r,profileTarget:c="claude",imageAnalysisStatus:d,imageAnalysisStatusSource:h="saved",imageAnalysisStatusPreviewState:p="saved",nativeReadPreferenceOverride:g,onToggleNativeRead:m,onChange:S,missingRequiredFields:b=[]}){const{t:x}=ye(),T=b.length>0;return l.jsx(C.Suspense,{fallback:l.jsxs("div",{className:"flex items-center justify-center h-full",children:[l.jsx(An,{className:"w-6 h-6 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-2 text-muted-foreground",children:x("profileEditorSections.loadingEditor")})]}),children:l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!a&&o!==null&&l.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:[l.jsx(Mo,{className:"w-4 h-4"}),x("profileEditor.invalidJson")]}),a&&T&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[l.jsx(Vn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),l.jsxs("div",{children:[l.jsxs("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:[x("profileEditor.missingFields"),":"]})," ",l.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:b.join(", ")}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:x("profileEditor.missingFieldsHint")})]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:l.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:l.jsx(AM,{value:t,onChange:S,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx(kM,{status:d,target:c,source:h,previewState:p,nativeReadPreferenceOverride:g,onToggleNativeRead:m})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx("div",{className:"border rounded-md overflow-hidden",children:l.jsx(Uh,{profileEnv:r?.env})})})]})})}function eb(t,a){try{var o=t()}catch(r){return a(r)}return o&&o.then?o.then(void 0,a):o}function DM(t,a){for(var o={};t.length;){var r=t[0],c=r.code,d=r.message,h=r.path.join(".");if(!o[h])if("unionErrors"in r){var p=r.unionErrors[0].errors[0];o[h]={message:p.message,type:p.code}}else o[h]={message:d,type:c};if("unionErrors"in r&&r.unionErrors.forEach(function(S){return S.errors.forEach(function(b){return t.push(b)})}),a){var g=o[h].types,m=g&&g[r.code];o[h]=rv(h,a,o,c,m?[].concat(m,r.message):r.message)}t.shift()}return o}function NM(t,a){for(var o={};t.length;){var r=t[0],c=r.code,d=r.message,h=r.path.join(".");if(!o[h])if(r.code==="invalid_union"&&r.errors.length>0){var p=r.errors[0][0];o[h]={message:p.message,type:p.code}}else o[h]={message:d,type:c};if(r.code==="invalid_union"&&r.errors.forEach(function(S){return S.forEach(function(b){return t.push(b)})}),a){var g=o[h].types,m=g&&g[r.code];o[h]=rv(h,a,o,c,m?[].concat(m,r.message):r.message)}t.shift()}return o}function TM(t,a,o){if(o===void 0&&(o={}),(function(r){return"_def"in r&&typeof r._def=="object"&&"typeName"in r._def})(t))return function(r,c,d){try{return Promise.resolve(eb(function(){return Promise.resolve(t[o.mode==="sync"?"parse":"parseAsync"](r,a)).then(function(h){return d.shouldUseNativeValidation&&Wm({},d),{errors:{},values:o.raw?Object.assign({},r):h}})},function(h){if((function(p){return Array.isArray(p?.issues)})(h))return{values:{},errors:Qm(DM(h.errors,!d.shouldUseNativeValidation&&d.criteriaMode==="all"),d)};throw h}))}catch(h){return Promise.reject(h)}};if((function(r){return"_zod"in r&&typeof r._zod=="object"})(t))return function(r,c,d){try{return Promise.resolve(eb(function(){return Promise.resolve((o.mode==="sync"?rk:sk)(t,r,a)).then(function(h){return d.shouldUseNativeValidation&&Wm({},d),{errors:{},values:o.raw?Object.assign({},r):h}})},function(h){if((function(p){return p instanceof lk})(h))return{values:{},errors:Qm(NM(h.issues,!d.shouldUseNativeValidation&&d.criteriaMode==="all"),d)};throw h}))}catch(h){return Promise.reject(h)}};throw new Error("Invalid input: not a Zod schema")}const PM={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 MM({provider:t,className:a,size:o="md"}){const r=iN(t),c=PM[o],d=Tv(t),h=rN(t);return l.jsx("div",{className:z("flex items-center justify-center rounded-md",d&&!h&&(oN(t)?"bg-gray-900 p-1":"bg-white p-1"),c.container,a),children:d?l.jsx("img",{src:d,alt:`${t} logo`,className:z(h?c.container:c.icon,"object-contain")}):l.jsx("span",{className:z("font-semibold",r.textClass,c.text),children:r.letter})})}function qj(){return St({queryKey:["profiles"],queryFn:()=>He.profiles.list()})}function LM(){const t=lt(),{t:a}=ye();return ot({mutationFn:o=>He.profiles.create(o),onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),ce.success(a("toasts.profileCreated"))},onError:o=>{ce.error(o.message)}})}function Kj(){const t=lt(),{t:a}=ye();return ot({mutationFn:o=>He.profiles.delete(o),onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),ce.success(a("toasts.profileDeleted"))},onError:o=>{ce.error(o.message)}})}function Gj(){return ot({mutationFn:()=>He.profiles.discoverOrphans()})}function Vj(){const t=lt(),{t:a}=ye();return ot({mutationFn:o=>He.profiles.registerOrphans(o),onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),ce.success(a("toasts.orphanProfilesComplete"))}})}function Yj(){const t=lt(),{t:a}=ye();return ot({mutationFn:({name:o,data:r})=>He.profiles.copy(o,r),onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),ce.success(a("toasts.profileCopied"))}})}function Wj(){return ot({mutationFn:({name:t,includeSecrets:a})=>He.profiles.export(t,a??!1)})}function Qj(){const t=lt(),{t:a}=ye();return ot({mutationFn:o=>He.profiles.import(o),onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),ce.success(a("toasts.profileImported"))}})}const EM="https://openrouter.ai/api/v1",bx=Object.freeze({glmt:"glm",kimi:"km",alibaba:"alibaba-coding-plan",acp:"alibaba-coding-plan",hf:"huggingface"}),vx=[{id:"openrouter",name:"OpenRouter",description:"349+ models from OpenAI, Anthropic, Google, Meta",baseUrl:EM,defaultProfileName:"openrouter",defaultModel:"anthropic/claude-opus-4.5",apiKeyPlaceholder:"sk-or-...",apiKeyHint:"Get your API key at openrouter.ai/keys",category:"recommended",requiresApiKey:!0,badge:"349+ models",featured:!0,icon:"/icons/openrouter.svg"},{id:"alibaba-coding-plan",name:"Alibaba Coding Plan",description:"Alibaba Cloud Coding Plan via Anthropic-compatible endpoint",baseUrl:"https://coding-intl.dashscope.aliyuncs.com/apps/anthropic",defaultProfileName:"albb",defaultModel:"qwen3-coder-plus",apiKeyPlaceholder:"sk-sp-...",apiKeyHint:"Get your Coding Plan key from Alibaba Cloud Model Studio",category:"recommended",requiresApiKey:!0,badge:"Coding Plan",featured:!0,icon:"/assets/providers/alibabacloud-color.svg"},{id:"ollama",name:"Ollama (Local)",description:"Local open-source models via Ollama (32K+ context)",baseUrl:"http://localhost:11434",defaultProfileName:"ollama",defaultModel:"qwen3-coder",apiKeyPlaceholder:"ollama",apiKeyHint:"Install Ollama from ollama.com - no API key needed for local",category:"recommended",requiresApiKey:!1,badge:"Local",featured:!0,icon:"/icons/ollama.svg"},{id:"llamacpp",name:"llama.cpp (Local)",description:"Local inference via llama.cpp (LLaMA models)",baseUrl:"http://127.0.0.1:8080",defaultProfileName:"llamacpp",defaultModel:"llama3-8b",apiKeyPlaceholder:"llamacpp",apiKeyHint:"Run llama.cpp server: ./server --host 0.0.0.0 --port 8080 -m model.gguf",category:"recommended",requiresApiKey:!1,badge:"Local",featured:!0,icon:"/assets/providers/llama-cpp.svg"},{id:"anthropic",name:"Anthropic (Direct API)",description:"Use your own Anthropic API key (sk-ant-...)",baseUrl:"",defaultProfileName:"anthropic",defaultModel:"claude-sonnet-4-5-20250929",apiKeyPlaceholder:"sk-ant-api03-...",apiKeyHint:"Get key at console.anthropic.com/settings/keys",category:"recommended",requiresApiKey:!0,badge:"Direct",featured:!0,icon:"/assets/providers/claude.svg"},{id:"huggingface",name:"Hugging Face",description:"Inference Providers router via OpenAI-compatible chat completions",baseUrl:"https://router.huggingface.co/v1",defaultProfileName:"hf",defaultModel:"openai/gpt-oss-120b:fastest",apiKeyPlaceholder:"hf_...",apiKeyHint:"Create a User Access Token at hf.co/settings/tokens",category:"alternative",requiresApiKey:!0,defaultTarget:"droid",badge:"Router"},{id:"glm",name:"GLM",description:"Direct Z.AI Anthropic-compatible API profile",baseUrl:"https://api.z.ai/api/anthropic",defaultProfileName:"glm",defaultModel:"glm-5",apiKeyPlaceholder:"ghp_...",apiKeyHint:"Get your API key from Z.AI",category:"alternative",requiresApiKey:!0,badge:"Z.AI",icon:"/icons/zai.svg"},{id:"km",name:"Kimi",description:"Moonshot AI - Fast reasoning model",baseUrl:"https://api.kimi.com/coding/",defaultProfileName:"km",defaultModel:"kimi-k2-thinking-turbo",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Moonshot AI",category:"alternative",requiresApiKey:!0,alwaysThinkingEnabled:!0,badge:"Reasoning",icon:"/icons/kimi.svg"},{id:"foundry",name:"Azure Foundry",description:"Claude via Microsoft Azure AI Foundry",baseUrl:"https://<your-resource>.services.ai.azure.com/api/anthropic",defaultProfileName:"foundry",defaultModel:"claude-sonnet-4-5",apiKeyPlaceholder:"YOUR_AZURE_API_KEY",apiKeyHint:"Create resource at ai.azure.com, get API key from Keys tab",category:"alternative",requiresApiKey:!0,badge:"Azure",icon:"/icons/azure.svg"},{id:"mm",name:"Minimax",description:"M2.1/M2.1-lightning/M2 - multilang coding (1M context)",baseUrl:"https://api.minimax.io/anthropic",defaultProfileName:"mm",defaultModel:"MiniMax-M2.1",apiKeyPlaceholder:"YOUR_MINIMAX_API_KEY_HERE",apiKeyHint:"Get your API key at platform.minimax.io",category:"alternative",requiresApiKey:!0,badge:"1M context",icon:"/icons/minimax.svg"},{id:"deepseek",name:"DeepSeek",description:"V3.2 and R1 reasoning model (128K context)",baseUrl:"https://api.deepseek.com/anthropic",defaultProfileName:"deepseek",defaultModel:"deepseek-chat",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key at platform.deepseek.com",category:"alternative",requiresApiKey:!0,badge:"Reasoning",icon:"/icons/deepseek.svg"},{id:"qwen",name:"Qwen",description:"Alibaba Cloud - Qwen3 models (256K-1M context, thinking support)",baseUrl:"https://dashscope-intl.aliyuncs.com/apps/anthropic",defaultProfileName:"qwen-api",defaultModel:"qwen3-coder-plus",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from Alibaba Cloud Model Studio",category:"alternative",requiresApiKey:!0,badge:"Alibaba",icon:"/assets/providers/qwen-color.svg"},{id:"ollama-cloud",name:"Ollama Cloud",description:"Ollama cloud models via direct API (glm-5:cloud, minimax-m2.1:cloud)",baseUrl:"https://ollama.com",defaultProfileName:"ollama-cloud",defaultModel:"glm-5:cloud",apiKeyPlaceholder:"YOUR_OLLAMA_CLOUD_API_KEY",apiKeyHint:"Get your API key at ollama.com",category:"alternative",requiresApiKey:!0,badge:"Cloud",icon:"/icons/ollama.svg"},{id:"novita",name:"Novita AI",description:"Anthropic-compatible API for Claude Code and CCS profiles",baseUrl:"https://api.novita.ai/anthropic",defaultProfileName:"novita",defaultModel:"deepseek/deepseek-v3.2",apiKeyPlaceholder:"YOUR_NOVITA_API_KEY",apiKeyHint:"Get your API key at novita.ai",category:"alternative",requiresApiKey:!0,badge:"Anthropic-compatible",icon:"/icons/novita.svg"}];function xx(t){return{...t,extraEnv:t.extraEnv?{...t.extraEnv}:void 0}}function jM(t){const a=xx(t);return a.extraEnv&&Object.freeze(a.extraEnv),Object.freeze(a)}function RM(t,a){const o=new Set;for(const c of t){const d=c.id.trim().toLowerCase();if(c.id!==d)throw new Error(`Preset ID must be normalized: "${c.id}"`);if(o.has(c.id))throw new Error(`Duplicate preset ID detected: "${c.id}"`);o.add(c.id)}const r=new Set;for(const[c,d]of Object.entries(a)){const h=c.trim().toLowerCase();if(!h)throw new Error("Preset alias keys cannot be empty");if(c!==h)throw new Error(`Preset alias must be normalized: "${c}"`);if(r.has(h))throw new Error(`Duplicate normalized preset alias detected: "${c}"`);if(r.add(h),!o.has(d))throw new Error(`Preset alias "${c}" points to unknown target "${d}"`);if(o.has(h))throw new Error(`Preset alias "${c}" collides with canonical preset ID "${h}"`)}}RM(vx,bx);const OM=Object.freeze(vx.map(jM));function IM(){return OM.map(xx)}function _M(t){const a=t.trim().toLowerCase();return bx[a]||a}const UM=IM(),Hh=Object.freeze(UM.map(t=>({...t})));function HM(t,a){return a||(t?.requiresApiKey===!1?t.apiKeyPlaceholder||t.id:"")}function zM(t){return Hh.filter(a=>a.category===t)}function Td(t){const a=_M(t);return Hh.find(o=>o.id===a)}const BM=Za().refine(t=>t.trim().length===0||Za().url().safeParse(t).success,{message:"Invalid URL format"}),FM=ck({name:Za().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:BM,apiKey:Za(),model:Za().optional(),opusModel:Za().optional(),sonnetModel:Za().optional(),haikuModel:Za().optional(),target:uk(["claude","droid","codex"])}),qM=["/chat/completions","/v1/messages","/messages","/completions"],ki="custom",Pd="openrouter",Cx=new Set(["ollama","llamacpp"]),Md={name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:"",target:"claude"},Sx=zM("recommended"),KM=Sx.filter(t=>!Cx.has(t.id)),GM=Sx.filter(t=>Cx.has(t.id)),VM=Hh.filter(t=>t.category!=="recommended");function $j({open:t,onOpenChange:a,onSuccess:o,initialMode:r="openrouter"}){const{t:c}=ye(),d=LM(),[h,p]=C.useState("basic"),[g,m]=C.useState(null),[S,b]=C.useState(!1),[x,T]=C.useState(Pd),[w,M]=C.useState(""),{models:j}=yM(),{register:E,handleSubmit:D,formState:{errors:N},control:A,reset:P,setValue:k}=dk({resolver:TM(FM),defaultValues:Md}),O=$m({control:A,name:"baseUrl"}),U=$m({control:A,name:"target"}),_=C.useCallback(Q=>{if(!Q){P(Md);return}P({...Md,name:Q.defaultProfileName,baseUrl:Q.baseUrl,model:Q.defaultModel,opusModel:Q.defaultModel,sonnetModel:Q.defaultModel,haikuModel:Q.defaultModel,target:Q.defaultTarget??"claude"})},[P]),K=C.useMemo(()=>x===ki?null:Td(x)??null,[x]),ee=C.useMemo(()=>w.trim()?[...sM(j,w)].sort((se,de)=>(de.created??0)-(se.created??0)).slice(0,20):fM(j,2),[j,w]);C.useEffect(()=>{if(t)if(p("basic"),m(null),b(!1),M(""),r==="normal")T(ki),_(null);else{const se=Td(r==="openrouter"?Pd:r);if(se){T(se.id),_(se);return}T(ki),_(null)}},[t,r,_,P]);const Y=Q=>{const se=Td(Q);if(se){T(se.id),_(se);return}T(ki),_(null)},$=Q=>{k("model",Q.id),k("opusModel",Q.id),k("sonnetModel",Q.id),k("haikuModel",Q.id),M(Q.name),ce.success(c("profileCreateDialog.appliedModelToTiers",{model:Q.name}),{duration:2e3})};C.useEffect(()=>{if(O&&x===ki){const se=O.toLowerCase();for(const de of qM)if(se.endsWith(de)){const ge=O.replace(new RegExp(de+"$","i"),"");m(`URL ends with "${de}" - Claude appends this automatically. You likely want: ${ge}`);return}}m(null)},[O,x]);const fe=async Q=>{if(K?.requiresApiKey!==!1&&!Q.apiKey){ce.error(ie.t("commonToast.apiKeyRequired"));return}const se={...Q,apiKey:HM(K,Q.apiKey)};try{await d.mutateAsync(se),ce.success(c("profileCreateDialog.profileCreated",{name:se.name})),o(se.name),a(!1)}catch(de){ce.error(de.message||c("profileCreateDialog.failedCreate"))}},pe=!!N.name||!!N.baseUrl||!!N.apiKey,H=!!N.model||!!N.opusModel||!!N.sonnetModel||!!N.haikuModel,Z=d.isPending,ne=K?.id===Pd;return l.jsx(yh,{open:t,onOpenChange:a,children:l.jsxs(bh,{className:"sm:max-w-[700px] p-0 gap-0 overflow-hidden max-h-[90vh] !flex !flex-col",children:[l.jsxs(vh,{className:"p-6 pb-4 border-b",children:[l.jsxs(xh,{className:"flex items-center gap-2",children:[l.jsx(Km,{className:"w-5 h-5 text-primary"}),c("profileCreateDialog.createProfile")]}),l.jsx(Ch,{children:c("profileCreateDialog.chooseProviderHint")})]}),l.jsxs("form",{onSubmit:D(fe),className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[l.jsx("div",{className:"border-b bg-muted/10 px-6 py-3 space-y-3",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(qt,{className:"text-xs text-muted-foreground",children:c("profileEditor.provider")}),l.jsx("p",{className:"text-xs text-muted-foreground",children:c("profileEditor.providerChooserHint")})]}),l.jsx("span",{className:"pt-0.5 text-[11px] text-muted-foreground",children:c("profileEditor.scrollHint")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:c("profileEditor.featuredProviders")}),l.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:l.jsxs("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:[KM.map(Q=>l.jsx(Ld,{preset:Q,isSelected:x===Q.id,onClick:()=>Y(Q.id),density:"featured"},Q.id)),l.jsx("div",{className:"mx-1 hidden w-px rounded-full bg-border/70 sm:block"}),l.jsx(YM,{isSelected:x===ki,onClick:()=>Y(ki)})]})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:c("profileEditor.morePresets")}),l.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:l.jsx("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:VM.map(Q=>l.jsx(Ld,{preset:Q,isSelected:x===Q.id,onClick:()=>Y(Q.id),density:"compact"},Q.id))})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:c("openrouterQuickStart.localRuntimesTitle")}),l.jsx("div",{className:"flex flex-wrap gap-2",children:GM.map(Q=>l.jsx(Ld,{preset:Q,isSelected:x===Q.id,onClick:()=>Y(Q.id),density:"compact"},Q.id))})]})]})}),l.jsxs(px,{value:h,onValueChange:p,className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[l.jsx("div",{className:"px-6 pt-4",children:l.jsxs(Ih,{className:"grid w-full grid-cols-2",children:[l.jsxs(El,{value:"basic",className:"relative",children:[c("profileCreateDialog.basicInformation"),pe&&l.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),l.jsxs(El,{value:"models",className:"relative",children:[c("profileCreateDialog.modelConfiguration"),H&&l.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),l.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[l.jsxs(Xd,{value:"basic",className:"p-6 space-y-4 mt-0",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"name",children:[c("profileDialog.name")," ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx(Bn,{id:"name",...E("name"),placeholder:c("profileDialog.namePlaceholder"),className:"font-mono"}),N.name?l.jsx("p",{className:"text-xs text-destructive",children:N.name.message}):l.jsxs("p",{className:"text-xs text-muted-foreground",children:[c("profileCreateDialog.usedInCli")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(qt,{htmlFor:"baseUrl",children:c("profileCreateDialog.apiBaseUrl")}),l.jsx(Bn,{id:"baseUrl",...E("baseUrl"),placeholder:c("profileCreateDialog.baseUrlPlaceholder")}),N.baseUrl?l.jsx("p",{className:"text-xs text-destructive",children:N.baseUrl.message}):g?l.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:[l.jsx(Vn,{className:"w-4 h-4 shrink-0 mt-0.5"}),l.jsx("span",{children:g})]}):K?l.jsx("p",{className:"text-xs text-muted-foreground",children:K.baseUrl?c("profileCreateDialog.prefilledFromPreset",{name:K.name}):c("profileCreateDialog.optionalForPreset",{name:K.name})}):l.jsx("p",{className:"text-xs text-muted-foreground",children:c("profileCreateDialog.endpointHint")})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"apiKey",children:[c("profileDialog.apiKey")," ",K?.requiresApiKey!==!1&&l.jsx("span",{className:"text-destructive",children:"*"}),K?.requiresApiKey===!1&&l.jsx("span",{className:"text-muted-foreground text-xs font-normal",children:c("profileCreateDialog.optional")})]}),l.jsxs("div",{className:"relative",children:[l.jsx(Bn,{id:"apiKey",type:S?"text":"password",...E("apiKey"),placeholder:K?.requiresApiKey===!1?c("profileCreateDialog.apiKeyOptionalPlaceholder"):K?.apiKeyPlaceholder??c("profileCreateDialog.apiKeyPlaceholder"),className:"pr-10"}),l.jsx(st,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>b(!S),tabIndex:-1,children:S?l.jsx(Qr,{className:"h-4 w-4"}):l.jsx($r,{className:"h-4 w-4"})})]}),N.apiKey?l.jsx("p",{className:"text-xs text-destructive",children:N.apiKey.message}):K?.requiresApiKey===!1?l.jsx("p",{className:"text-xs text-muted-foreground",children:c("profileCreateDialog.apiKeyOptionalHint")}):K?.apiKeyHint&&l.jsx("p",{className:"text-xs text-muted-foreground",children:K.apiKeyHint})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(qt,{htmlFor:"target",children:c("codex.defaultTargetCli")}),l.jsxs(Pv,{value:U,onValueChange:Q=>k("target",Q),children:[l.jsx(Dh,{id:"target",children:l.jsx(Mv,{})}),l.jsxs(Nh,{children:[l.jsx(Hr,{value:"claude",children:c("profileCard.claudeCodeDefault")}),l.jsx(Hr,{value:"droid",children:c("profileCard.factoryDroid")}),l.jsx(Hr,{value:"codex",children:c("profileCard.codexCli")})]})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:[U==="droid"?l.jsxs(l.Fragment,{children:[c("profileEditor.targetHintPreferredAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-droid"}),"."]}):U==="codex"?l.jsxs(l.Fragment,{children:[c("profileEditor.targetHintPreferredAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsx"}),"."]}):l.jsxs(l.Fragment,{children:[c("profileEditor.targetHintClaudeDefault")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs"}),"."]}),U==="droid"?l.jsxs(l.Fragment,{children:[" ",c("profileEditor.targetHintLegacyAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsd"}),"."]}):U==="codex"?l.jsxs(l.Fragment,{children:[" ",c("profileEditor.targetHintLegacyAlias")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-codex"}),"."]}):null," ",c("profileEditor.targetHintOverride")," ",l.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"--target"}),"."]})]})]}),l.jsxs(Xd,{value:"models",className:"p-6 mt-0 space-y-4",children:[l.jsxs("div",{className:"flex items-start gap-3 p-3 bg-blue-50 dark:bg-blue-950/20 text-blue-800 dark:text-blue-300 rounded-md text-sm border border-blue-100 dark:border-blue-900/30",children:[l.jsx(Ul,{className:"w-5 h-5 shrink-0 mt-0.5"}),l.jsxs("div",{children:[l.jsx("p",{className:"font-medium mb-1",children:c("profileCreateDialog.modelMapping")}),l.jsx("p",{className:"text-xs opacity-90",children:c("profileCreateDialog.modelMappingDesc")})]})]}),ne&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{children:c("openrouterModelPicker.searchModels")}),l.jsx(Bn,{value:w,onChange:Q=>M(Q.target.value),placeholder:c("profileCreateDialog.searchModelsPlaceholder"),onKeyDown:Q=>{Q.key==="Enter"&&ee.length>0&&(Q.preventDefault(),$(ee[0]))}}),l.jsx("div",{className:"border rounded-md max-h-48 overflow-y-auto",children:ee.length===0?l.jsx("p",{className:"text-sm text-muted-foreground p-3 text-center",children:w?c("profileCreateDialog.noModelsFound",{query:w}):c("profileCreateDialog.loadingModels")}):l.jsxs("div",{className:"p-1",children:[!w&&l.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground",children:[l.jsx(vw,{className:"w-3 h-3 text-accent"}),l.jsx("span",{children:c("openrouterModelPicker.newestModels")})]}),ee.map(Q=>l.jsx(WM,{model:Q,onClick:()=>$(Q),showAge:!w},Q.id))]})})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"model",children:[c("profileCreateDialog.defaultModel"),l.jsx(Et,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),l.jsx(Bn,{id:"model",...E("model"),placeholder:K?.defaultModel??"claude-sonnet-4",className:"font-mono text-sm"})]}),l.jsxs("div",{className:"grid gap-3 pt-2 border-t",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"sonnetModel",className:"text-sm",children:[c("profileCreateDialog.sonnetMapping"),l.jsx(Et,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),l.jsx(Bn,{id:"sonnetModel",...E("sonnetModel"),placeholder:c("profileCreateDialog.sonnetMappingPlaceholder"),className:"font-mono text-sm h-9"})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"opusModel",className:"text-sm",children:[c("profileCreateDialog.opusMapping"),l.jsx(Et,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),l.jsx(Bn,{id:"opusModel",...E("opusModel"),placeholder:c("profileCreateDialog.opusMappingPlaceholder"),className:"font-mono text-sm h-9"})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs(qt,{htmlFor:"haikuModel",className:"text-sm",children:[c("profileCreateDialog.haikuMapping"),l.jsx(Et,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),l.jsx(Bn,{id:"haikuModel",...E("haikuModel"),placeholder:c("profileCreateDialog.haikuMappingPlaceholder"),className:"font-mono text-sm h-9"})]})]})]})]})]}),l.jsxs(GD,{className:"p-6 pt-4 border-t bg-muted/10",children:[l.jsx(st,{type:"button",variant:"outline",onClick:()=>a(!1),children:c("profileDialog.cancel")}),l.jsx(st,{type:"submit",disabled:Z,className:z(Z&&"opacity-80"),children:Z?l.jsxs(l.Fragment,{children:[l.jsx(An,{className:"w-4 h-4 mr-2 animate-spin"}),c("cliproxyDialog.creating")]}):l.jsxs(l.Fragment,{children:[l.jsx(Km,{className:"w-4 h-4 mr-2"}),c("profileCreateDialog.createProfile")]})})]})]})]})]})})}function Ld({preset:t,isSelected:a,onClick:o,density:r="compact"}){const c=t.id==="anthropic",d=r==="featured";return l.jsxs("button",{type:"button",onClick:o,className:z("flex flex-none items-center gap-3 rounded-xl border px-3 py-2.5 text-left transition-all",d?"h-[68px] w-[236px]":"h-[64px] w-[168px]",a?"border-primary bg-primary/8 shadow-sm ring-1 ring-primary/10":"border-border/60 bg-background hover:border-primary/40 hover:bg-accent/20"),children:[l.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-background",children:c?l.jsx(MM,{provider:"claude",size:"md",className:"rounded-lg"}):t.icon?l.jsx("img",{src:t.icon,alt:"",className:"h-5 w-5 object-contain"}):l.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/70 text-xs font-semibold text-foreground/70",children:t.name.charAt(0)})}),l.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"truncate text-[13px] font-semibold leading-tight tracking-[-0.01em]",children:t.name}),t.badge&&d&&l.jsx(Et,{variant:"secondary",className:"inline-flex bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:t.badge})]}),t.badge&&!d&&l.jsx(Et,{variant:"secondary",className:"inline-flex w-fit bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:t.badge})]})]})}function YM({isSelected:t,onClick:a}){const{t:o}=ye();return l.jsxs("button",{type:"button",onClick:a,className:z("flex h-[68px] w-[236px] flex-none items-center gap-3 rounded-xl border border-dashed px-3 py-2.5 text-left transition-all",t?"border-primary bg-primary/8 shadow-sm ring-1 ring-primary/10":"border-muted-foreground/30 bg-background hover:border-primary/40 hover:bg-accent/20"),children:[l.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-dashed border-current/30 bg-muted/70",children:l.jsx(sh,{className:"h-4 w-4 text-muted-foreground"})}),l.jsx("div",{className:"min-w-0 flex-1",children:l.jsx("div",{className:"text-sm font-semibold leading-tight",children:o("profileEditor.customEndpoint")})})]})}function WM({model:t,onClick:a,showAge:o}){const{t:r}=ye();return l.jsxs("button",{type:"button",onClick:a,className:"group flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",children:[l.jsx("span",{className:"flex-1 truncate",children:t.name}),l.jsxs("span",{className:"text-muted-foreground group-hover:text-accent-foreground/80 ml-2 flex items-center gap-2 text-xs",children:[o&&t.created&&l.jsx(Et,{variant:"outline",className:"text-[10px] text-accent group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30",children:pM(t.created)}),t.isFree?l.jsx(Et,{variant:"secondary",className:"text-xs group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground",children:r("profileCreateDialog.free")}):l.jsx("span",{children:iM(t.pricing)}),l.jsx("span",{children:dM(t.context_length)})]})]})}function QM({className:t,...a}){return l.jsx("div",{"data-slot":"card",className:z("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...a})}function $M({className:t,...a}){return l.jsx("div",{"data-slot":"card-header",className:z("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...a})}function XM({className:t,...a}){return l.jsx("div",{"data-slot":"card-title",className:z("leading-none font-semibold",t),...a})}function JM({className:t,...a}){return l.jsx("div",{"data-slot":"card-description",className:z("text-muted-foreground text-sm",t),...a})}function ZM({className:t,...a}){return l.jsx("div",{"data-slot":"card-content",className:z("px-6",t),...a})}const zh="[1m]",Bh=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL"],eL=new Set(Bh);function Xj(t){return t.toLowerCase().startsWith("gemini-")}function Fh(t){return t.toLowerCase().endsWith(zh.toLowerCase())}function tL(t){return!t||Fh(t)?t:`${t}${zh}`}function wx(t){return t&&(Fh(t)?t.slice(0,-zh.length):t)}function Jj(t){return eL.has(t)}function nL(t){return wx(t.trim()).replace(/\([^)]+\)$/,"")}function Zj(t){return Bh.some(a=>{const o=t[a];return typeof o=="string"&&Fh(o)})}function eR(t,a,o={}){const r={...t};for(const c of Bh){const d=r[c];if(typeof d!="string"||d.trim().length===0)continue;const h=nL(d),p=o.supportsExtendedContext?.(h,c)??!0;r[c]=a&&p?tL(d):wx(d)}return r}const aL=["agy","claude","gemini","codex","cursor","gitlab","codebuddy","qwen","kimi","iflow","kilo","kiro","ghcp"],tR=aL.map(t=>({id:t,name:Ah(t),description:lN(t)})),iL=["provider","auth","variant","success"];function nR(t){return t==="account"?1:iL.indexOf(t)}const aR=I0,iR=U0,oR=_0,oL=C.forwardRef(({className:t,align:a="center",sideOffset:o=4,...r},c)=>l.jsx(O0,{children:l.jsx(qb,{ref:c,align:a,sideOffset:o,className:z("z-50 w-80 max-w-[calc(100vw-2rem)] rounded-lg border border-border/70 bg-popover p-4 text-popover-foreground shadow-xl shadow-black/10 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",t),...r})}));oL.displayName=qb.displayName;const rL=C.lazy(()=>tt(()=>Promise.resolve().then(()=>Zl),void 0).then(t=>({default:t.CodeEditor})));function rR({rawJsonContent:t,isRawJsonValid:a,rawJsonEdits:o,onRawJsonChange:r,profileEnv:c,missingRequiredFields:d=[]}){const{t:h}=ye(),p=d.length>0;return l.jsx(C.Suspense,{fallback:l.jsxs("div",{className:"flex items-center justify-center h-full",children:[l.jsx(An,{className:"w-6 h-6 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-2 text-muted-foreground",children:h("providerEditor.loadingEditor")})]}),children:l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!a&&o!==null&&l.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:[l.jsx(Mo,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&p&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[l.jsx(Vn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),l.jsxs("div",{children:[l.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",l.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:d.join(", ")}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Apply a preset from Model Config tab or add these fields manually. Without them, Claude Code will fail with 404 errors."})]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:l.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:l.jsx(rL,{value:t,onChange:r,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx("div",{className:"border rounded-md overflow-hidden",children:l.jsx(Uh,{profileEnv:c})})})]})})}var Xt={},tb;function sL(){if(tb)return Xt;tb=1;var t=Xt&&Xt.__assign||function(){return t=Object.assign||function(P){for(var k,O=1,U=arguments.length;O<U;O++){k=arguments[O];for(var _ in k)Object.prototype.hasOwnProperty.call(k,_)&&(P[_]=k[_])}return P},t.apply(this,arguments)},a=Xt&&Xt.__createBinding||(Object.create?(function(P,k,O,U){U===void 0&&(U=O);var _=Object.getOwnPropertyDescriptor(k,O);(!_||("get"in _?!k.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return k[O]}}),Object.defineProperty(P,U,_)}):(function(P,k,O,U){U===void 0&&(U=O),P[U]=k[O]})),o=Xt&&Xt.__setModuleDefault||(Object.create?(function(P,k){Object.defineProperty(P,"default",{enumerable:!0,value:k})}):function(P,k){P.default=k}),r=Xt&&Xt.__importStar||function(P){if(P&&P.__esModule)return P;var k={};if(P!=null)for(var O in P)O!=="default"&&Object.prototype.hasOwnProperty.call(P,O)&&a(k,P,O);return o(k,P),k},c=Xt&&Xt.__rest||function(P,k){var O={};for(var U in P)Object.prototype.hasOwnProperty.call(P,U)&&k.indexOf(U)<0&&(O[U]=P[U]);if(P!=null&&typeof Object.getOwnPropertySymbols=="function")for(var _=0,U=Object.getOwnPropertySymbols(P);_<U.length;_++)k.indexOf(U[_])<0&&Object.prototype.propertyIsEnumerable.call(P,U[_])&&(O[U[_]]=P[U[_]]);return O};Object.defineProperty(Xt,"__esModule",{value:!0});var d=r(nh()),h=89,p=90,g=77,m=57,S=219,b=222,x=192,T=100,w=3e3,M=typeof window<"u"&&"navigator"in window&&/Win/i.test(navigator.platform),j=typeof window<"u"&&"navigator"in window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),E="npm__react-simple-code-editor__textarea",D=`
|
|
18
18
|
/**
|
|
19
19
|
* Reset the text fill color so that placeholder is visible
|
|
20
20
|
*/
|
|
@@ -69,4 +69,4 @@ ${d}`,o),this.line=r,this.column=c,this.codeblock=d}}function gL(t,a){let o=0;fo
|
|
|
69
69
|
`&&h!=="\r"){let p,g=c,m=!1,[S,b]=eh(t,a-1);for(let w=0;w<S.length;w++){if(w&&(g=m?g[p]:g[p]={}),p=S[w],(m=Object.hasOwn(g,p))&&(typeof g[p]!="object"||d.has(g[p])))throw new Ye("trying to redefine an already defined value",{toml:t,ptr:a});!m&&p==="__proto__"&&Object.defineProperty(g,p,{enumerable:!0,configurable:!0,writable:!0})}if(m)throw new Ye("trying to redefine an already defined value",{toml:t,ptr:a});let[x,T]=qh(t,b,"}",o-1,r);d.add(x),g[p]=x,a=T}}if(!h)throw new Ye("unfinished table encountered",{toml:t,ptr:a});return[c,a]}function DL(t,a,o,r){let c=[],d;for(a++;(d=t[a++])!=="]"&&d;){if(d===",")throw new Ye("expected value, found comma",{toml:t,ptr:a-1});if(d==="#")a=Jl(t,a);else if(d!==" "&&d!==" "&&d!==`
|
|
70
70
|
`&&d!=="\r"){let h=qh(t,a-1,"]",o-1,r);c.push(h[0]),a=h[1]}}if(!d)throw new Ye("unfinished array encountered",{toml:t,ptr:a});return[c,a]}function ib(t,a,o,r){let c=a,d=o,h,p=!1,g;for(let m=0;m<t.length;m++){if(m){if(c=p?c[h]:c[h]={},d=(g=d[h]).c,r===0&&(g.t===1||g.t===2))return null;if(g.t===2){let S=c.length-1;c=c[S],d=d[S].c}}if(h=t[m],(p=Object.hasOwn(c,h))&&d[h]?.t===0&&d[h]?.d)return null;p||(h==="__proto__"&&(Object.defineProperty(c,h,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(d,h,{enumerable:!0,configurable:!0,writable:!0})),d[h]={t:m<t.length-1&&r===2?3:r,d:!1,i:0,c:{}})}if(g=d[h],g.t!==r&&!(r===1&&g.t===3)||(r===2&&(g.d||(g.d=!0,c[h]=[]),c[h].push(c={}),g.c[g.i++]=g={t:1,d:!1,i:0,c:{}}),g.d))return null;if(g.d=!0,r===1)c=p?c[h]:c[h]={};else if(r===0&&p)return null;return[h,c,g.c]}function NL(t,{maxDepth:a=1e3,integersAsBigInt:o}={}){let r={},c={},d=r,h=c;for(let p=Sa(t,0);p<t.length;){if(t[p]==="["){let g=t[++p]==="[",m=eh(t,p+=+g,"]");if(g){if(t[m[1]-1]!=="]")throw new Ye("expected end of table declaration",{toml:t,ptr:m[1]-1});m[1]++}let S=ib(m[0],r,c,g?2:1);if(!S)throw new Ye("trying to redefine an already defined table or value",{toml:t,ptr:p});h=S[2],d=S[1],p=m[1]}else{let g=eh(t,p),m=ib(g[0],d,h,0);if(!m)throw new Ye("trying to redefine an already defined table or value",{toml:t,ptr:p});let S=qh(t,g[1],void 0,a,o);m[1][m[0]]=S[0],p=S[1]}if(p=Sa(t,p,!0),t[p]&&t[p]!==`
|
|
71
71
|
`&&t[p]!=="\r")throw new Ye("each key-value declaration must be followed by an end-of-line",{toml:t,ptr:p});p=Sa(t,p)}return r}const TL=[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/_SECRET$/,/_SECRET_KEY$/,/^API_KEY$/,/^AUTH_TOKEN$/,/^SECRET$/,/_PASSWORD$/,/^PASSWORD$/,/_CREDENTIAL$/,/_PRIVATE_KEY$/];function PL(t){return TL.some(a=>a.test(t))}function ML(t){if(!t.trim())return{valid:!0};try{return JSON.parse(t),{valid:!0}}catch(a){const r=a.message,c=r.match(/position (\d+)/);if(c){const d=parseInt(c[1],10),h=t.substring(0,d).split(`
|
|
72
|
-
`);return{valid:!1,error:r,line:h.length}}return{valid:!1,error:r}}}function LL(t){if(!t.trim())return{valid:!0};try{return NL(t),{valid:!0}}catch(a){const o=a.message,r=o.match(/line\s+(\d+)/i);return{valid:!1,error:o,line:r?Number.parseInt(r[1],10):void 0}}}function Dx({value:t,onChange:a,language:o="json",readonly:r=!1,className:c,minHeight:d="300px",heightMode:h="content"}){const{isDark:p}=mh(),{t:g}=ye(),[m,S]=C.useState(!1),[b,x]=C.useState(!0),T=h==="fill-parent",w=C.useMemo(()=>o==="json"?ML(t):o==="toml"?LL(t):{valid:!0},[t,o]),M=C.useCallback(j=>l.jsx(hk,{prism:hL,theme:p?Xm.nightOwl:Xm.github,code:j,language:o,children:({tokens:E,getLineProps:D,getTokenProps:N})=>{let A=!1;return l.jsx(l.Fragment,{children:E.map((P,k)=>l.jsx("div",{...D({line:P}),className:z(w.line===k+1&&"bg-destructive/20"),children:P.map((O,U)=>{let _=!1;if(O.types.includes("property")){const ee=O.content.replace(/['"]/g,"");PL(ee)?A=!0:A=!1}else(O.types.includes("string")||O.types.includes("number")||O.types.includes("boolean"))&&A?(_=!0,A=!1):O.types.includes("punctuation")&&O.content!==":"&&O.content!=="["&&O.content!=="{"&&(A=!1);const K=N({token:O});return _&&b&&(K.className=z(K.className,"blur-[3px] select-none opacity-70 transition-all duration-200")),l.jsx("span",{...K},U)})},k))})}}),[p,o,w.line,b]);return l.jsxs("div",{className:z("flex min-h-0 flex-col",T&&"h-full",c),style:T?{height:d==="auto"?void 0:d}:void 0,children:[l.jsxs("div",{className:z("relative rounded-md border overflow-hidden","bg-muted/30",T&&"flex min-h-0 flex-1 flex-col",m&&"ring-2 ring-ring ring-offset-2 ring-offset-background",r&&"opacity-70 cursor-not-allowed",!w.valid&&"border-destructive"),"data-slot":"code-editor-surface",children:[l.jsx("div",{className:z(T&&"scrollbar-editor min-h-0 flex-1 overflow-auto"),"data-slot":T?"code-editor-viewport":void 0,children:l.jsx(cL,{value:t,onValueChange:r?()=>{}:a,highlight:M,padding:12,disabled:r,onFocus:()=>S(!0),onBlur:()=>S(!1),textareaClassName:z("focus:outline-none font-mono text-sm",r&&"cursor-not-allowed"),preClassName:"font-mono text-sm",style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:"0.875rem",minHeight:d}},p?"dark-editor":"light-editor")}),l.jsx("div",{className:"absolute top-2 right-2 z-10 opacity-50 hover:opacity-100 transition-opacity",children:l.jsx(st,{variant:"ghost",size:"icon",className:"h-6 w-6 bg-background/50 hover:bg-background border shadow-sm rounded-full",onClick:()=>x(!b),title:g(b?"codeEditor.revealSensitive":"codeEditor.maskSensitive"),children:b?l.jsx($r,{className:"h-3 w-3"}):l.jsx(Qr,{className:"h-3 w-3"})})})]}),l.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs",children:[w.valid?l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[l.jsx(Xr,{className:"w-3 h-3 text-green-500"}),g("codeEditor.valid",{language:o.toUpperCase()})]}):l.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[l.jsx(Kr,{className:"w-3 h-3"}),w.error,w.line&&` (line ${w.line})`]}),r&&l.jsx("span",{className:"ml-auto text-muted-foreground",children:g("codeEditor.readOnly")})]})]})}const Zl=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:Dx},Symbol.toStringTag,{value:"Module"})),EL={browserConfig:null,browserStatus:null,browserLoading:!0,browserStatusLoading:!0,browserSaving:!1,browserError:null,browserSuccess:!1,webSearchConfig:null,webSearchStatus:null,webSearchLoading:!0,webSearchStatusLoading:!0,webSearchSaving:!1,webSearchError:null,webSearchSuccess:!1,globalEnvConfig:null,globalEnvLoading:!0,globalEnvSaving:!1,globalEnvError:null,globalEnvSuccess:!1,proxyConfig:null,proxyLoading:!0,proxySaving:!1,proxyError:null,proxySuccess:!1,proxyTestResult:null,proxyTesting:!1,rawConfig:null,rawConfigLoading:!1};function jL(t,a){switch(a.type){case"SET_BROWSER_CONFIG":return{...t,browserConfig:a.payload};case"SET_BROWSER_STATUS":return{...t,browserStatus:a.payload};case"SET_BROWSER_LOADING":return{...t,browserLoading:a.payload};case"SET_BROWSER_STATUS_LOADING":return{...t,browserStatusLoading:a.payload};case"SET_BROWSER_SAVING":return{...t,browserSaving:a.payload};case"SET_BROWSER_ERROR":return{...t,browserError:a.payload};case"SET_BROWSER_SUCCESS":return{...t,browserSuccess:a.payload};case"SET_WEBSEARCH_CONFIG":return{...t,webSearchConfig:a.payload};case"SET_WEBSEARCH_STATUS":return{...t,webSearchStatus:a.payload};case"SET_WEBSEARCH_LOADING":return{...t,webSearchLoading:a.payload};case"SET_WEBSEARCH_STATUS_LOADING":return{...t,webSearchStatusLoading:a.payload};case"SET_WEBSEARCH_SAVING":return{...t,webSearchSaving:a.payload};case"SET_WEBSEARCH_ERROR":return{...t,webSearchError:a.payload};case"SET_WEBSEARCH_SUCCESS":return{...t,webSearchSuccess:a.payload};case"SET_GLOBALENV_CONFIG":return{...t,globalEnvConfig:a.payload};case"SET_GLOBALENV_LOADING":return{...t,globalEnvLoading:a.payload};case"SET_GLOBALENV_SAVING":return{...t,globalEnvSaving:a.payload};case"SET_GLOBALENV_ERROR":return{...t,globalEnvError:a.payload};case"SET_GLOBALENV_SUCCESS":return{...t,globalEnvSuccess:a.payload};case"SET_PROXY_CONFIG":return{...t,proxyConfig:a.payload};case"SET_PROXY_LOADING":return{...t,proxyLoading:a.payload};case"SET_PROXY_SAVING":return{...t,proxySaving:a.payload};case"SET_PROXY_ERROR":return{...t,proxyError:a.payload};case"SET_PROXY_SUCCESS":return{...t,proxySuccess:a.payload};case"SET_PROXY_TEST_RESULT":return{...t,proxyTestResult:a.payload};case"SET_PROXY_TESTING":return{...t,proxyTesting:a.payload};case"SET_RAW_CONFIG":return{...t,rawConfig:a.payload};case"SET_RAW_CONFIG_LOADING":return{...t,rawConfigLoading:a.payload};default:return t}}const Nx=C.createContext(null);function RL({children:t}){const[a,o]=C.useReducer(jL,EL);return l.jsx(Nx.Provider,{value:{state:a,dispatch:o},children:t})}function Tx(){const t=C.useContext(Nx);if(!t)throw new Error("useSettingsContext must be used within a SettingsProvider");return t}function OL(){const{dispatch:t}=Tx(),a=C.useCallback($=>t({type:"SET_BROWSER_CONFIG",payload:$}),[t]),o=C.useCallback($=>t({type:"SET_BROWSER_STATUS",payload:$}),[t]),r=C.useCallback($=>t({type:"SET_BROWSER_LOADING",payload:$}),[t]),c=C.useCallback($=>t({type:"SET_BROWSER_STATUS_LOADING",payload:$}),[t]),d=C.useCallback($=>t({type:"SET_BROWSER_SAVING",payload:$}),[t]),h=C.useCallback($=>t({type:"SET_BROWSER_ERROR",payload:$}),[t]),p=C.useCallback($=>t({type:"SET_BROWSER_SUCCESS",payload:$}),[t]),g=C.useCallback($=>t({type:"SET_WEBSEARCH_CONFIG",payload:$}),[t]),m=C.useCallback($=>t({type:"SET_WEBSEARCH_STATUS",payload:$}),[t]),S=C.useCallback($=>t({type:"SET_WEBSEARCH_LOADING",payload:$}),[t]),b=C.useCallback($=>t({type:"SET_WEBSEARCH_STATUS_LOADING",payload:$}),[t]),x=C.useCallback($=>t({type:"SET_WEBSEARCH_SAVING",payload:$}),[t]),T=C.useCallback($=>t({type:"SET_WEBSEARCH_ERROR",payload:$}),[t]),w=C.useCallback($=>t({type:"SET_WEBSEARCH_SUCCESS",payload:$}),[t]),M=C.useCallback($=>t({type:"SET_GLOBALENV_CONFIG",payload:$}),[t]),j=C.useCallback($=>t({type:"SET_GLOBALENV_LOADING",payload:$}),[t]),E=C.useCallback($=>t({type:"SET_GLOBALENV_SAVING",payload:$}),[t]),D=C.useCallback($=>t({type:"SET_GLOBALENV_ERROR",payload:$}),[t]),N=C.useCallback($=>t({type:"SET_GLOBALENV_SUCCESS",payload:$}),[t]),A=C.useCallback($=>t({type:"SET_PROXY_CONFIG",payload:$}),[t]),P=C.useCallback($=>t({type:"SET_PROXY_LOADING",payload:$}),[t]),k=C.useCallback($=>t({type:"SET_PROXY_SAVING",payload:$}),[t]),O=C.useCallback($=>t({type:"SET_PROXY_ERROR",payload:$}),[t]),U=C.useCallback($=>t({type:"SET_PROXY_SUCCESS",payload:$}),[t]),_=C.useCallback($=>t({type:"SET_PROXY_TEST_RESULT",payload:$}),[t]),K=C.useCallback($=>t({type:"SET_PROXY_TESTING",payload:$}),[t]),ee=C.useCallback($=>t({type:"SET_RAW_CONFIG",payload:$}),[t]),Y=C.useCallback($=>t({type:"SET_RAW_CONFIG_LOADING",payload:$}),[t]);return C.useMemo(()=>({setBrowserConfig:a,setBrowserStatus:o,setBrowserLoading:r,setBrowserStatusLoading:c,setBrowserSaving:d,setBrowserError:h,setBrowserSuccess:p,setWebSearchConfig:g,setWebSearchStatus:m,setWebSearchLoading:S,setWebSearchStatusLoading:b,setWebSearchSaving:x,setWebSearchError:T,setWebSearchSuccess:w,setGlobalEnvConfig:M,setGlobalEnvLoading:j,setGlobalEnvSaving:E,setGlobalEnvError:D,setGlobalEnvSuccess:N,setProxyConfig:A,setProxyLoading:P,setProxySaving:k,setProxyError:O,setProxySuccess:U,setProxyTestResult:_,setProxyTesting:K,setRawConfig:ee,setRawConfigLoading:Y}),[a,o,r,c,d,h,p,g,m,S,b,x,T,w,M,j,E,D,N,A,P,k,O,U,_,K,ee,Y])}function IL(){const[t,a]=Vb(),o=t.get("tab")?.toLowerCase(),r=o==="imageanalysis"||o==="image"?"image":o==="channels"?"channels":o==="globalenv"?"globalenv":o==="proxy"?"proxy":o==="auth"?"auth":o==="thinking"?"thinking":o==="backups"?"backups":"websearch",c=C.useCallback(d=>{a({tab:d},{replace:!0})},[a]);return{activeTab:r,setActiveTab:c}}function _L(){const{state:t}=Tx(),a=OL(),[o,r]=C.useState(!1),c=C.useCallback(async()=>{try{a.setRawConfigLoading(!0);const h=await fetch("/api/config/raw");if(!h.ok){a.setRawConfig(null);return}const p=await h.text();a.setRawConfig(p)}catch{a.setRawConfig(null)}finally{a.setRawConfigLoading(!1)}},[a]),d=C.useCallback(async()=>{if(t.rawConfig)try{await navigator.clipboard.writeText(t.rawConfig),r(!0),setTimeout(()=>r(!1),2e3)}catch{}},[t.rawConfig]);return{rawConfig:t.rawConfig,loading:t.rawConfigLoading,copied:o,fetchRawConfig:c,copyToClipboard:d}}function ob({activeTab:t,onTabChange:a}){const{t:o}=ye(),r=[{value:"browser",label:o("settingsTabs.browser"),icon:xw},{value:"websearch",label:o("settingsTabs.web"),icon:nv},{value:"image",label:o("settingsTabs.image"),icon:ov},{value:"channels",label:o("settingsTabs.channels"),icon:Cw},{value:"globalenv",label:o("settingsTabs.env"),icon:sh},{value:"thinking",label:o("settingsTabs.think"),icon:Sw},{value:"proxy",label:o("settingsTabs.proxy"),icon:ww},{value:"auth",label:o("settingsTabs.auth"),icon:ih},{value:"backups",label:o("settingsTabs.backup"),icon:kw}];return l.jsx(px,{value:t,onValueChange:c=>a(c),children:l.jsx(Ih,{className:"grid w-full grid-cols-9",children:r.map(({value:c,label:d,icon:h})=>l.jsxs(El,{value:c,className:"gap-1.5 px-2 text-xs",children:[l.jsx(h,{className:"h-3.5 w-3.5 shrink-0"}),l.jsx("span",{className:"truncate",children:d})]},c))})})}function rb(){return l.jsxs("div",{className:"flex-1 p-5 space-y-6",children:[l.jsx($e,{className:"h-4 w-2/3"}),l.jsx("div",{className:"p-4 rounded-lg border",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx($e,{className:"h-5 w-32"}),l.jsx($e,{className:"h-4 w-48"})]}),l.jsx($e,{className:"h-6 w-10 rounded-full"})]})}),l.jsxs("div",{className:"space-y-3",children:[l.jsx($e,{className:"h-5 w-24"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx($e,{className:"h-20 w-full rounded-lg"}),l.jsx($e,{className:"h-20 w-full rounded-lg"}),l.jsx($e,{className:"h-20 w-full rounded-lg"})]})]})]})}function Px(t,a=3,o=1e3){return t().catch(r=>{if(a<=0)throw r;return new Promise(c=>setTimeout(c,o)).then(()=>Px(t,a-1,o*2))})}function Na(t){return C.lazy(()=>Px(t))}const sb=Na(()=>tt(()=>import("./index-0n_43sCZ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),lb=Na(()=>tt(()=>import("./index-Cj7EjEq6.js"),__vite__mapDeps([10,1,2,11,4,5,6,7,8,9]))),cb=Na(()=>tt(()=>import("./index-Ba4ysocb.js"),__vite__mapDeps([12,1,2,4,5,6,7,8,9]))),ub=Na(()=>tt(()=>import("./channels-BVftYfOn.js"),__vite__mapDeps([13,1,2,4,5,6,7,8,9]))),db=Na(()=>tt(()=>import("./globalenv-section-DpJ7unxC.js"),__vite__mapDeps([14,1,2,4,5,6,7,8,9]))),hb=Na(()=>tt(()=>import("./index-DOC7_hun.js"),__vite__mapDeps([15,1,2,4,5,6,7,8,9]))),fb=Na(()=>tt(()=>import("./index-0GkznW41.js"),__vite__mapDeps([16,1,2,17,4,18,19,5,6,20,7,8,9]))),pb=Na(()=>tt(()=>import("./auth-section-D4MZkgcP.js"),__vite__mapDeps([21,1,2,4,5,6,7,8,9]))),gb=Na(()=>tt(()=>import("./backups-section-DvMJrmHH.js"),__vite__mapDeps([22,1,2,19,4,5,6,7,8,9])));class mb extends C.Component{constructor(a){super(a),this.state={hasError:!1,error:null}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}render(){return this.state.hasError?l.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:l.jsxs("div",{className:"text-center p-6 max-w-md",children:[l.jsx(Kr,{className:"w-12 h-12 mx-auto mb-4 text-destructive"}),l.jsx("p",{className:"font-medium text-foreground mb-2",children:ie.t("settings.sectionLoadFailed")}),l.jsx("p",{className:"text-sm mb-4",children:this.state.error?.message||ie.t("settings.unknownError")}),l.jsxs(st,{variant:"outline",onClick:()=>window.location.reload(),className:"inline-flex items-center gap-2",children:[l.jsx(qr,{className:"w-4 h-4"}),ie.t("settings.reloadPage")]})]})}):this.props.children}}function UL(t){switch(t?.toLowerCase()){case"browser":return"browser";case"imageanalysis":case"image":return"image";case"channels":return"channels";case"globalenv":return"globalenv";case"proxy":return"proxy";case"auth":return"auth";case"thinking":return"thinking";case"backups":return"backups";default:return"websearch"}}function HL(){const{t}=ye(),{setActiveTab:a}=IL(),[o]=Vb(),r=UL(o.get("tab")),{rawConfig:c,loading:d,copied:h,fetchRawConfig:p,copyToClipboard:g}=_L();C.useEffect(()=>{p()},[p]);const m=S=>{C.startTransition(()=>{a(S)})};return l.jsxs("div",{className:"h-full min-h-0",children:[l.jsxs("div",{className:"md:hidden h-full flex flex-col",children:[l.jsx("div",{className:"border-b bg-background p-4",children:l.jsx(ob,{activeTab:r,onTabChange:m})}),l.jsx(mb,{children:l.jsxs(C.Suspense,{fallback:l.jsx(rb,{}),children:[r==="browser"&&l.jsx(lb,{}),r==="websearch"&&l.jsx(sb,{}),r==="image"&&l.jsx(cb,{}),r==="channels"&&l.jsx(ub,{}),r==="globalenv"&&l.jsx(db,{}),r==="thinking"&&l.jsx(hb,{}),r==="proxy"&&l.jsx(fb,{}),r==="auth"&&l.jsx(pb,{}),r==="backups"&&l.jsx(gb,{})]})})]}),l.jsxs(Rh,{direction:"horizontal",className:"h-full hidden md:flex",children:[l.jsx(Vr,{defaultSize:46,minSize:36,maxSize:62,children:l.jsxs("div",{className:"h-full border-r flex flex-col bg-muted/30 relative",children:[l.jsx("div",{className:"p-5 border-b bg-background",children:l.jsx(ob,{activeTab:r,onTabChange:m})}),l.jsx(mb,{children:l.jsxs(C.Suspense,{fallback:l.jsx(rb,{}),children:[r==="browser"&&l.jsx(lb,{}),r==="websearch"&&l.jsx(sb,{}),r==="image"&&l.jsx(cb,{}),r==="channels"&&l.jsx(ub,{}),r==="globalenv"&&l.jsx(db,{}),r==="thinking"&&l.jsx(hb,{}),r==="proxy"&&l.jsx(fb,{}),r==="auth"&&l.jsx(pb,{}),r==="backups"&&l.jsx(gb,{})]})})]})}),l.jsx(Oh,{className:"w-2 bg-border hover:bg-primary/20 transition-colors cursor-col-resize flex items-center justify-center group",children:l.jsx(_l,{className:"w-3 h-3 text-muted-foreground group-hover:text-primary"})}),l.jsx(Vr,{defaultSize:54,minSize:35,children:l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Gm,{className:"w-5 h-5 text-primary"}),l.jsxs("div",{children:[l.jsx("h2",{className:"font-semibold",children:"config.yaml"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"~/.ccs/config.yaml"})]})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(st,{variant:"outline",size:"sm",onClick:g,disabled:!c,children:h?l.jsxs(l.Fragment,{children:[l.jsx(No,{className:"w-4 h-4 mr-1"}),t("settings.copied")]}):l.jsxs(l.Fragment,{children:[l.jsx(Al,{className:"w-4 h-4 mr-1"}),t("settings.copy")]})}),l.jsx(st,{variant:"outline",size:"sm",onClick:p,disabled:d,children:l.jsx(qr,{className:`w-4 h-4 ${d?"animate-spin":""}`})})]})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:c?l.jsx(Dx,{value:c,onChange:()=>{},language:"yaml",readonly:!0,minHeight:"auto",className:"min-h-full"}):d?l.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:[l.jsx(qr,{className:"w-5 h-5 animate-spin mr-2"}),t("settings.loading")]}):l.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:l.jsxs("div",{className:"text-center",children:[l.jsx(Gm,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),l.jsx("p",{children:t("settings.configFileNotFound")}),l.jsx("code",{className:"text-sm bg-muted px-2 py-1 rounded mt-2 inline-block",children:"ccs migrate"})]})})})]})})]})]})}function zL(){return l.jsx(RL,{children:l.jsx(HL,{})})}const BL=Object.freeze(Object.defineProperty({__proto__:null,SettingsPage:zL},Symbol.toStringTag,{value:"Module"}));function FL(t,a,o="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:o}).format(a).split(/\s/g).slice(2).join(" ")}const qL={},Ir={};function Ai(t,a){try{const r=(qL[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(a).split("GMT")[1];return r in Ir?Ir[r]:yb(r,r.split(":"))}catch{if(t in Ir)return Ir[t];const o=t?.match(KL);return o?yb(t,o.slice(1)):NaN}}const KL=/([+-]\d\d):?(\d\d)?/;function yb(t,a){const o=+(a[0]||0),r=+(a[1]||0),c=+(a[2]||0)/60;return Ir[t]=o*60+r>0?o*60+r+c:o*60-r-c}class Kn extends Date{constructor(...a){super(),a.length>1&&typeof a[a.length-1]=="string"&&(this.timeZone=a.pop()),this.internal=new Date,isNaN(Ai(this.timeZone,this))?this.setTime(NaN):a.length?typeof a[0]=="number"&&(a.length===1||a.length===2&&typeof a[1]!="number")?this.setTime(a[0]):typeof a[0]=="string"?this.setTime(+new Date(a[0])):a[0]instanceof Date?this.setTime(+a[0]):(this.setTime(+new Date(...a)),Mx(this),th(this)):this.setTime(Date.now())}static tz(a,...o){return o.length?new Kn(...o,a):new Kn(Date.now(),a)}withTimeZone(a){return new Kn(+this,a)}getTimezoneOffset(){const a=-Ai(this.timeZone,this);return a>0?Math.floor(a):Math.ceil(a)}setTime(a){return Date.prototype.setTime.apply(this,arguments),th(this),+this}[Symbol.for("constructDateFrom")](a){return new Kn(+new Date(a),this.timeZone)}}const bb=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!bb.test(t))return;const a=t.replace(bb,"$1UTC");Kn.prototype[a]&&(t.startsWith("get")?Kn.prototype[t]=function(){return this.internal[a]()}:(Kn.prototype[t]=function(){return Date.prototype[a].apply(this.internal,arguments),GL(this),+this},Kn.prototype[a]=function(){return Date.prototype[a].apply(this,arguments),th(this),+this}))});function th(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-Ai(t.timeZone,t)*60))}function GL(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),Mx(t)}function Mx(t){const a=Ai(t.timeZone,t),o=a>0?Math.floor(a):Math.ceil(a),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const c=-new Date(+t).getTimezoneOffset(),d=-new Date(+r).getTimezoneOffset(),h=c-d,p=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();h&&p&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+h);const g=c-o;g&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+g);const m=new Date(+t);m.setUTCSeconds(0);const S=c>0?m.getSeconds():(m.getSeconds()-60)%60,b=Math.round(-(Ai(t.timeZone,t)*60))%60;(b||S)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+b),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+b+S));const x=Ai(t.timeZone,t),T=x>0?Math.floor(x):Math.ceil(x),M=-new Date(+t).getTimezoneOffset()-T,j=T!==o,E=M-g;if(j&&E){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+E);const D=Ai(t.timeZone,t),N=D>0?Math.floor(D):Math.ceil(D),A=T-N;A&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+A),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+A))}}class va extends Kn{static tz(a,...o){return o.length?new va(...o,a):new va(Date.now(),a)}toISOString(){const[a,o,r]=this.tzComponents(),c=`${a}${o}:${r}`;return this.internal.toISOString().slice(0,-1)+c}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[a,o,r,c]=this.internal.toUTCString().split(" ");return`${a?.slice(0,-1)} ${r} ${o} ${c}`}toTimeString(){const a=this.internal.toUTCString().split(" ")[4],[o,r,c]=this.tzComponents();return`${a} GMT${o}${r}${c} (${FL(this.timeZone,this)})`}toLocaleString(a,o){return Date.prototype.toLocaleString.call(this,a,{...o,timeZone:o?.timeZone||this.timeZone})}toLocaleDateString(a,o){return Date.prototype.toLocaleDateString.call(this,a,{...o,timeZone:o?.timeZone||this.timeZone})}toLocaleTimeString(a,o){return Date.prototype.toLocaleTimeString.call(this,a,{...o,timeZone:o?.timeZone||this.timeZone})}tzComponents(){const a=this.getTimezoneOffset(),o=a>0?"-":"+",r=String(Math.floor(Math.abs(a)/60)).padStart(2,"0"),c=String(Math.abs(a)%60).padStart(2,"0");return[o,r,c]}withTimeZone(a){return new va(+this,a)}[Symbol.for("constructDateFrom")](a){return new va(+new Date(a),this.timeZone)}}const vb=5,VL=4;function YL(t,a){const o=a.startOfMonth(t),r=o.getDay()>0?o.getDay():7,c=a.addDays(t,-r+1),d=a.addDays(c,vb*7-1);return a.getMonth(t)===a.getMonth(d)?vb:VL}function Lx(t,a){const o=a.startOfMonth(t),r=o.getDay();return r===1?o:r===0?a.addDays(o,-6):a.addDays(o,-1*(r-1))}function WL(t,a){const o=Lx(t,a),r=YL(t,a);return a.addDays(o,r*7-1)}const Ex={...Nr,labels:{labelDayButton:(t,a,o,r)=>{let c;r&&typeof r.format=="function"?c=r.format.bind(r):c=(h,p)=>Lr(h,p,{locale:Nr,...o});let d=c(t,"PPPP");return a.today&&(d=`Today, ${d}`),a.selected&&(d=`${d}, selected`),d},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:t=>`Week ${t}`,labelYearDropdown:"Choose the Year",labelGrid:(t,a,o)=>{let r;return o&&typeof o.format=="function"?r=o.format.bind(o):r=(c,d)=>Lr(c,d,{locale:Nr,...a}),r(t,"LLLL yyyy")},labelGridcell:(t,a,o,r)=>{let c;r&&typeof r.format=="function"?c=r.format.bind(r):c=(h,p)=>Lr(h,p,{locale:Nr,...o});let d=c(t,"PPPP");return a?.today&&(d=`Today, ${d}`),d},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(t,a,o)=>{let r;return o&&typeof o.format=="function"?r=o.format.bind(o):r=(c,d)=>Lr(c,d,{locale:Nr,...a}),r(t,"cccc")}}};class fn{constructor(a,o){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?va.tz(this.options.timeZone):new this.Date,this.newDate=(r,c,d)=>this.overrides?.newDate?this.overrides.newDate(r,c,d):this.options.timeZone?new va(r,c,d,this.options.timeZone):new Date(r,c,d),this.addDays=(r,c)=>this.overrides?.addDays?this.overrides.addDays(r,c):Pw(r,c),this.addMonths=(r,c)=>this.overrides?.addMonths?this.overrides.addMonths(r,c):Mw(r,c),this.addWeeks=(r,c)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,c):Lw(r,c),this.addYears=(r,c)=>this.overrides?.addYears?this.overrides.addYears(r,c):Ew(r,c),this.differenceInCalendarDays=(r,c)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,c):jw(r,c),this.differenceInCalendarMonths=(r,c)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,c):Rw(r,c),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Ow(r),this.eachYearOfInterval=r=>{const c=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Iw(r),d=new Set(c.map(p=>this.getYear(p)));if(d.size===c.length)return c;const h=[];return d.forEach(p=>{h.push(new Date(p,0,1))}),h},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):WL(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):_w(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Uw(r),this.endOfWeek=(r,c)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,c):Hw(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):zw(r),this.format=(r,c,d)=>{const h=this.overrides?.format?this.overrides.format(r,c,this.options):Lr(r,c,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(h):h},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):Bw(r),this.getMonth=(r,c)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Fw(r,this.options),this.getYear=(r,c)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):qw(r,this.options),this.getWeek=(r,c)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):Kw(r,this.options),this.isAfter=(r,c)=>this.overrides?.isAfter?this.overrides.isAfter(r,c):Gw(r,c),this.isBefore=(r,c)=>this.overrides?.isBefore?this.overrides.isBefore(r,c):Vw(r,c),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):Yw(r),this.isSameDay=(r,c)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,c):Ww(r,c),this.isSameMonth=(r,c)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,c):Qw(r,c),this.isSameYear=(r,c)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,c):$w(r,c),this.max=r=>this.overrides?.max?this.overrides.max(r):Xw(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Jw(r),this.setMonth=(r,c)=>this.overrides?.setMonth?this.overrides.setMonth(r,c):Zw(r,c),this.setYear=(r,c)=>this.overrides?.setYear?this.overrides.setYear(r,c):ek(r,c),this.startOfBroadcastWeek=(r,c)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Lx(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):tk(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):nk(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):ak(r),this.startOfWeek=(r,c)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):ik(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):ok(r),this.options={locale:Ex,...a},this.overrides=o}getDigitMap(){const{numerals:a="latn"}=this.options,o=new Intl.NumberFormat("en-US",{numberingSystem:a}),r={};for(let c=0;c<10;c++)r[c.toString()]=o.format(c);return r}replaceDigits(a){const o=this.getDigitMap();return a.replace(/\d/g,r=>o[r]||r)}formatNumber(a){return this.replaceDigits(a.toString())}getMonthYearOrder(){const a=this.options.locale?.code;return a&&fn.yearFirstLocales.has(a)?"year-first":"month-first"}formatMonthYear(a){const{locale:o,timeZone:r,numerals:c}=this.options,d=o?.code;if(d&&fn.yearFirstLocales.has(d))try{return new Intl.DateTimeFormat(d,{month:"long",year:"numeric",timeZone:r,numberingSystem:c}).format(a)}catch{}const h=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(a,h)}}fn.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 Yn=new fn;class jx{constructor(a,o,r=Yn){this.date=a,this.displayMonth=o,this.outside=!!(o&&!r.isSameMonth(a,o)),this.dateLib=r,this.isoDate=r.format(a,"yyyy-MM-dd"),this.displayMonthId=r.format(o,"yyyy-MM"),this.dateMonthId=r.format(a,"yyyy-MM")}isEqualTo(a){return this.dateLib.isSameDay(a.date,this.date)&&this.dateLib.isSameMonth(a.displayMonth,this.displayMonth)}}class QL{constructor(a,o){this.date=a,this.weeks=o}}class $L{constructor(a,o){this.days=o,this.weekNumber=a}}function XL(t){return ue.createElement("button",{...t})}function JL(t){return ue.createElement("span",{...t})}function ZL(t){const{size:a=24,orientation:o="left",className:r}=t;return ue.createElement("svg",{className:r,width:a,height:a,viewBox:"0 0 24 24"},o==="up"&&ue.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),o==="down"&&ue.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),o==="left"&&ue.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),o==="right"&&ue.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function e1(t){const{day:a,modifiers:o,...r}=t;return ue.createElement("td",{...r})}function t1(t){const{day:a,modifiers:o,...r}=t,c=ue.useRef(null);return ue.useEffect(()=>{o.focused&&c.current?.focus()},[o.focused]),ue.createElement("button",{ref:c,...r})}var Ce;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(Ce||(Ce={}));var pt;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(pt||(pt={}));var En;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(En||(En={}));var hn;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(hn||(hn={}));function n1(t){const{options:a,className:o,components:r,classNames:c,...d}=t,h=[c[Ce.Dropdown],o].join(" "),p=a?.find(({value:g})=>g===d.value);return ue.createElement("span",{"data-disabled":d.disabled,className:c[Ce.DropdownRoot]},ue.createElement(r.Select,{className:h,...d},a?.map(({value:g,label:m,disabled:S})=>ue.createElement(r.Option,{key:g,value:g,disabled:S},m))),ue.createElement("span",{className:c[Ce.CaptionLabel],"aria-hidden":!0},p?.label,ue.createElement(r.Chevron,{orientation:"down",size:18,className:c[Ce.Chevron]})))}function a1(t){return ue.createElement("div",{...t})}function i1(t){return ue.createElement("div",{...t})}function o1(t){const{calendarMonth:a,displayIndex:o,...r}=t;return ue.createElement("div",{...r},t.children)}function r1(t){const{calendarMonth:a,displayIndex:o,...r}=t;return ue.createElement("div",{...r})}function s1(t){return ue.createElement("table",{...t})}function l1(t){return ue.createElement("div",{...t})}const Rx=C.createContext(void 0);function es(){const t=C.useContext(Rx);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function c1(t){const{components:a}=es();return ue.createElement(a.Dropdown,{...t})}function u1(t){const{onPreviousClick:a,onNextClick:o,previousMonth:r,nextMonth:c,...d}=t,{components:h,classNames:p,labels:{labelPrevious:g,labelNext:m}}=es(),S=C.useCallback(x=>{c&&o?.(x)},[c,o]),b=C.useCallback(x=>{r&&a?.(x)},[r,a]);return ue.createElement("nav",{...d},ue.createElement(h.PreviousMonthButton,{type:"button",className:p[Ce.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":g(r),onClick:b},ue.createElement(h.Chevron,{disabled:r?void 0:!0,className:p[Ce.Chevron],orientation:"left"})),ue.createElement(h.NextMonthButton,{type:"button",className:p[Ce.NextMonthButton],tabIndex:c?void 0:-1,"aria-disabled":c?void 0:!0,"aria-label":m(c),onClick:S},ue.createElement(h.Chevron,{disabled:c?void 0:!0,orientation:"right",className:p[Ce.Chevron]})))}function d1(t){const{components:a}=es();return ue.createElement(a.Button,{...t})}function h1(t){return ue.createElement("option",{...t})}function f1(t){const{components:a}=es();return ue.createElement(a.Button,{...t})}function p1(t){const{rootRef:a,...o}=t;return ue.createElement("div",{...o,ref:a})}function g1(t){return ue.createElement("select",{...t})}function m1(t){const{week:a,...o}=t;return ue.createElement("tr",{...o})}function y1(t){return ue.createElement("th",{...t})}function b1(t){return ue.createElement("thead",{"aria-hidden":!0},ue.createElement("tr",{...t}))}function v1(t){const{week:a,...o}=t;return ue.createElement("th",{...o})}function x1(t){return ue.createElement("th",{...t})}function C1(t){return ue.createElement("tbody",{...t})}function S1(t){const{components:a}=es();return ue.createElement(a.Dropdown,{...t})}const w1=Object.freeze(Object.defineProperty({__proto__:null,Button:XL,CaptionLabel:JL,Chevron:ZL,Day:e1,DayButton:t1,Dropdown:n1,DropdownNav:a1,Footer:i1,Month:o1,MonthCaption:r1,MonthGrid:s1,Months:l1,MonthsDropdown:c1,Nav:u1,NextMonthButton:d1,Option:h1,PreviousMonthButton:f1,Root:p1,Select:g1,Week:m1,WeekNumber:v1,WeekNumberHeader:x1,Weekday:y1,Weekdays:b1,Weeks:C1,YearsDropdown:S1},Symbol.toStringTag,{value:"Module"}));function xa(t,a,o=!1,r=Yn){let{from:c,to:d}=t;const{differenceInCalendarDays:h,isSameDay:p}=r;return c&&d?(h(d,c)<0&&([c,d]=[d,c]),h(a,c)>=(o?1:0)&&h(d,a)>=(o?1:0)):!o&&d?p(d,a):!o&&c?p(c,a):!1}function Kh(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function ec(t){return!!(t&&typeof t=="object"&&"from"in t)}function Gh(t){return!!(t&&typeof t=="object"&&"after"in t)}function Vh(t){return!!(t&&typeof t=="object"&&"before"in t)}function Ox(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function Ix(t,a){return Array.isArray(t)&&t.every(a.isDate)}function Ca(t,a,o=Yn){const r=Array.isArray(a)?a:[a],{isSameDay:c,differenceInCalendarDays:d,isAfter:h}=o;return r.some(p=>{if(typeof p=="boolean")return p;if(o.isDate(p))return c(t,p);if(Ix(p,o))return p.some(g=>c(t,g));if(ec(p))return xa(p,t,!1,o);if(Ox(p))return Array.isArray(p.dayOfWeek)?p.dayOfWeek.includes(t.getDay()):p.dayOfWeek===t.getDay();if(Kh(p)){const g=d(p.before,t),m=d(p.after,t),S=g>0,b=m<0;return h(p.before,p.after)?b&&S:S||b}return Gh(p)?d(t,p.after)>0:Vh(p)?d(p.before,t)>0:typeof p=="function"?p(t):!1})}function k1(t,a,o,r,c){const{disabled:d,hidden:h,modifiers:p,showOutsideDays:g,broadcastCalendar:m,today:S=c.today()}=a,{isSameDay:b,isSameMonth:x,startOfMonth:T,isBefore:w,endOfMonth:M,isAfter:j}=c,E=o&&T(o),D=r&&M(r),N={[pt.focused]:[],[pt.outside]:[],[pt.disabled]:[],[pt.hidden]:[],[pt.today]:[]},A={};for(const P of t){const{date:k,displayMonth:O}=P,U=!!(O&&!x(k,O)),_=!!(E&&w(k,E)),K=!!(D&&j(k,D)),ee=!!(d&&Ca(k,d,c)),Y=!!(h&&Ca(k,h,c))||_||K||!m&&!g&&U||m&&g===!1&&U,$=b(k,S);U&&N.outside.push(P),ee&&N.disabled.push(P),Y&&N.hidden.push(P),$&&N.today.push(P),p&&Object.keys(p).forEach(fe=>{const pe=p?.[fe];pe&&Ca(k,pe,c)&&(A[fe]?A[fe].push(P):A[fe]=[P])})}return P=>{const k={[pt.focused]:!1,[pt.disabled]:!1,[pt.hidden]:!1,[pt.outside]:!1,[pt.today]:!1},O={};for(const U in N){const _=N[U];k[U]=_.some(K=>K===P)}for(const U in A)O[U]=A[U].some(_=>_===P);return{...k,...O}}}function A1(t,a,o={}){return Object.entries(t).filter(([,c])=>c===!0).reduce((c,[d])=>(o[d]?c.push(o[d]):a[pt[d]]?c.push(a[pt[d]]):a[En[d]]&&c.push(a[En[d]]),c),[a[Ce.Day]])}function D1(t){return{...w1,...t}}function N1(t){const a={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([o,r])=>{o.startsWith("data-")&&(a[o]=r)}),a}function T1(){const t={};for(const a in Ce)t[Ce[a]]=`rdp-${Ce[a]}`;for(const a in pt)t[pt[a]]=`rdp-${pt[a]}`;for(const a in En)t[En[a]]=`rdp-${En[a]}`;for(const a in hn)t[hn[a]]=`rdp-${hn[a]}`;return t}function _x(t,a,o){return(o??new fn(a)).formatMonthYear(t)}const P1=_x;function M1(t,a,o){return(o??new fn(a)).format(t,"d")}function L1(t,a=Yn){return a.format(t,"LLLL")}function E1(t,a,o){return(o??new fn(a)).format(t,"cccccc")}function j1(t,a=Yn){return t<10?a.formatNumber(`0${t.toLocaleString()}`):a.formatNumber(`${t.toLocaleString()}`)}function R1(){return""}function Ux(t,a=Yn){return a.format(t,"yyyy")}const O1=Ux,I1=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:_x,formatDay:M1,formatMonthCaption:P1,formatMonthDropdown:L1,formatWeekNumber:j1,formatWeekNumberHeader:R1,formatWeekdayName:E1,formatYearCaption:O1,formatYearDropdown:Ux},Symbol.toStringTag,{value:"Module"}));function _1(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...I1,...t}}function Yh(t,a,o,r){let c=(r??new fn(o)).format(t,"PPPP");return a.today&&(c=`Today, ${c}`),a.selected&&(c=`${c}, selected`),c}const U1=Yh;function Wh(t,a,o){return(o??new fn(a)).formatMonthYear(t)}const H1=Wh;function Hx(t,a,o,r){let c=(r??new fn(o)).format(t,"PPPP");return a?.today&&(c=`Today, ${c}`),c}function zx(t){return"Choose the Month"}function Bx(){return""}const z1="Go to the Next Month";function Fx(t,a){return z1}function qx(t){return"Go to the Previous Month"}function Kx(t,a,o){return(o??new fn(a)).format(t,"cccc")}function Gx(t,a){return`Week ${t}`}function Vx(t){return"Week Number"}function Yx(t){return"Choose the Year"}const B1=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:H1,labelDay:U1,labelDayButton:Yh,labelGrid:Wh,labelGridcell:Hx,labelMonthDropdown:zx,labelNav:Bx,labelNext:Fx,labelPrevious:qx,labelWeekNumber:Gx,labelWeekNumberHeader:Vx,labelWeekday:Kx,labelYearDropdown:Yx},Symbol.toStringTag,{value:"Module"})),Ln=(t,a,o)=>a||(o?typeof o=="function"?o:(...r)=>o:t);function F1(t,a){const o=a.locale?.labels??{};return{...B1,...t??{},labelDayButton:Ln(Yh,t?.labelDayButton,o.labelDayButton),labelMonthDropdown:Ln(zx,t?.labelMonthDropdown,o.labelMonthDropdown),labelNext:Ln(Fx,t?.labelNext,o.labelNext),labelPrevious:Ln(qx,t?.labelPrevious,o.labelPrevious),labelWeekNumber:Ln(Gx,t?.labelWeekNumber,o.labelWeekNumber),labelYearDropdown:Ln(Yx,t?.labelYearDropdown,o.labelYearDropdown),labelGrid:Ln(Wh,t?.labelGrid,o.labelGrid),labelGridcell:Ln(Hx,t?.labelGridcell,o.labelGridcell),labelNav:Ln(Bx,t?.labelNav,o.labelNav),labelWeekNumberHeader:Ln(Vx,t?.labelWeekNumberHeader,o.labelWeekNumberHeader),labelWeekday:Ln(Kx,t?.labelWeekday,o.labelWeekday)}}function q1(t,a,o,r,c){const{startOfMonth:d,startOfYear:h,endOfYear:p,eachMonthOfInterval:g,getMonth:m}=c;return g({start:h(t),end:p(t)}).map(x=>{const T=r.formatMonthDropdown(x,c),w=m(x),M=a&&x<d(a)||o&&x>d(o)||!1;return{value:w,label:T,disabled:M}})}function K1(t,a={},o={}){let r={...a?.[Ce.Day]};return Object.entries(t).filter(([,c])=>c===!0).forEach(([c])=>{r={...r,...o?.[c]}}),r}function G1(t,a,o,r){const c=r??t.today(),d=o?t.startOfBroadcastWeek(c,t):a?t.startOfISOWeek(c):t.startOfWeek(c),h=[];for(let p=0;p<7;p++){const g=t.addDays(d,p);h.push(g)}return h}function V1(t,a,o,r,c=!1){if(!t||!a)return;const{startOfYear:d,endOfYear:h,eachYearOfInterval:p,getYear:g}=r,m=d(t),S=h(a),b=p({start:m,end:S});return c&&b.reverse(),b.map(x=>{const T=o.formatYearDropdown(x,r);return{value:g(x),label:T,disabled:!1}})}const ts=t=>t instanceof HTMLElement?t:null,jd=t=>[...t.querySelectorAll("[data-animated-month]")??[]],Y1=t=>ts(t.querySelector("[data-animated-month]")),Rd=t=>ts(t.querySelector("[data-animated-caption]")),Od=t=>ts(t.querySelector("[data-animated-weeks]")),W1=t=>ts(t.querySelector("[data-animated-nav]")),Q1=t=>ts(t.querySelector("[data-animated-weekdays]"));function $1(t,a,{classNames:o,months:r,focused:c,dateLib:d}){const h=C.useRef(null),p=C.useRef(r),g=C.useRef(!1);C.useLayoutEffect(()=>{const m=p.current;if(p.current=r,!a||!t.current||!(t.current instanceof HTMLElement)||r.length===0||m.length===0||r.length!==m.length)return;const S=d.isSameMonth(r[0].date,m[0].date),b=d.isAfter(r[0].date,m[0].date),x=b?o[hn.caption_after_enter]:o[hn.caption_before_enter],T=b?o[hn.weeks_after_enter]:o[hn.weeks_before_enter],w=h.current,M=t.current.cloneNode(!0);if(M instanceof HTMLElement?(jd(M).forEach(N=>{if(!(N instanceof HTMLElement))return;const A=Y1(N);A&&N.contains(A)&&N.removeChild(A);const P=Rd(N);P&&P.classList.remove(x);const k=Od(N);k&&k.classList.remove(T)}),h.current=M):h.current=null,g.current||S||c)return;const j=w instanceof HTMLElement?jd(w):[],E=jd(t.current);if(E?.every(D=>D instanceof HTMLElement)&&j&&j.every(D=>D instanceof HTMLElement)){g.current=!0,t.current.style.isolation="isolate";const D=W1(t.current);D&&(D.style.zIndex="1"),E.forEach((N,A)=>{const P=j[A];if(!P)return;N.style.position="relative",N.style.overflow="hidden";const k=Rd(N);k&&k.classList.add(x);const O=Od(N);O&&O.classList.add(T);const U=()=>{g.current=!1,t.current&&(t.current.style.isolation=""),D&&(D.style.zIndex=""),k&&k.classList.remove(x),O&&O.classList.remove(T),N.style.position="",N.style.overflow="",N.contains(P)&&N.removeChild(P)};P.style.pointerEvents="none",P.style.position="absolute",P.style.overflow="hidden",P.setAttribute("aria-hidden","true");const _=Q1(P);_&&(_.style.opacity="0");const K=Rd(P);K&&(K.classList.add(b?o[hn.caption_before_exit]:o[hn.caption_after_exit]),K.addEventListener("animationend",U));const ee=Od(P);ee&&ee.classList.add(b?o[hn.weeks_before_exit]:o[hn.weeks_after_exit]),N.insertBefore(P,N.firstChild)})}})}function X1(t,a,o,r){const c=t[0],d=t[t.length-1],{ISOWeek:h,fixedWeeks:p,broadcastCalendar:g}=o??{},{addDays:m,differenceInCalendarDays:S,differenceInCalendarMonths:b,endOfBroadcastWeek:x,endOfISOWeek:T,endOfMonth:w,endOfWeek:M,isAfter:j,startOfBroadcastWeek:E,startOfISOWeek:D,startOfWeek:N}=r,A=g?E(c,r):h?D(c):N(c),P=g?x(d):h?T(w(d)):M(w(d)),k=a&&(g?x(a):h?T(a):M(a)),O=k&&j(P,k)?k:P,U=S(O,A),_=b(d,c)+1,K=[];for(let $=0;$<=U;$++){const fe=m(A,$);K.push(fe)}const Y=(g?35:42)*_;if(p&&K.length<Y){const $=Y-K.length;for(let fe=0;fe<$;fe++){const pe=m(K[K.length-1],1);K.push(pe)}}return K}function J1(t){const a=[];return t.reduce((o,r)=>{const c=r.weeks.reduce((d,h)=>d.concat(h.days.slice()),a.slice());return o.concat(c.slice())},a.slice())}function Z1(t,a,o,r){const{numberOfMonths:c=1}=o,d=[];for(let h=0;h<c;h++){const p=r.addMonths(t,h);if(a&&p>a)break;d.push(p)}return d}function xb(t,a,o,r){const{month:c,defaultMonth:d,today:h=r.today(),numberOfMonths:p=1}=t;let g=c||d||h;const{differenceInCalendarMonths:m,addMonths:S,startOfMonth:b}=r;if(o&&m(o,g)<p-1){const x=-1*(p-1);g=S(o,x)}return a&&m(g,a)<0&&(g=a),b(g)}function eE(t,a,o,r){const{addDays:c,endOfBroadcastWeek:d,endOfISOWeek:h,endOfMonth:p,endOfWeek:g,getISOWeek:m,getWeek:S,startOfBroadcastWeek:b,startOfISOWeek:x,startOfWeek:T}=r,w=t.reduce((M,j)=>{const E=o.broadcastCalendar?b(j,r):o.ISOWeek?x(j):T(j),D=o.broadcastCalendar?d(j):o.ISOWeek?h(p(j)):g(p(j)),N=a.filter(O=>O>=E&&O<=D),A=o.broadcastCalendar?35:42;if(o.fixedWeeks&&N.length<A){const O=a.filter(U=>{const _=A-N.length;return U>D&&U<=c(D,_)});N.push(...O)}const P=N.reduce((O,U)=>{const _=o.ISOWeek?m(U):S(U),K=O.find(Y=>Y.weekNumber===_),ee=new jx(U,j,r);return K?K.days.push(ee):O.push(new $L(_,[ee])),O},[]),k=new QL(j,P);return M.push(k),M},[]);return o.reverseMonths?w.reverse():w}function tE(t,a){let{startMonth:o,endMonth:r}=t;const{startOfYear:c,startOfDay:d,startOfMonth:h,endOfMonth:p,addYears:g,endOfYear:m,newDate:S,today:b}=a,{fromYear:x,toYear:T,fromMonth:w,toMonth:M}=t;!o&&w&&(o=w),!o&&x&&(o=a.newDate(x,0,1)),!r&&M&&(r=M),!r&&T&&(r=S(T,11,31));const j=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return o?o=h(o):x?o=S(x,0,1):!o&&j&&(o=c(g(t.today??b(),-100))),r?r=p(r):T?r=S(T,11,31):!r&&j&&(r=m(t.today??b())),[o&&d(o),r&&d(r)]}function nE(t,a,o,r){if(o.disableNavigation)return;const{pagedNavigation:c,numberOfMonths:d=1}=o,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:g}=r,m=c?d:1,S=h(t);if(!a)return p(S,m);if(!(g(a,t)<d))return p(S,m)}function aE(t,a,o,r){if(o.disableNavigation)return;const{pagedNavigation:c,numberOfMonths:d}=o,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:g}=r,m=c?d??1:1,S=h(t);if(!a)return p(S,-m);if(!(g(S,a)<=0))return p(S,-m)}function iE(t){const a=[];return t.reduce((o,r)=>o.concat(r.weeks.slice()),a.slice())}function tc(t,a){const[o,r]=C.useState(t);return[a===void 0?o:a,r]}function oE(t,a){const[o,r]=tE(t,a),{startOfMonth:c,endOfMonth:d}=a,h=xb(t,o,r,a),[p,g]=tc(h,t.month?h:void 0);C.useEffect(()=>{const A=xb(t,o,r,a);g(A)},[t.timeZone]);const{months:m,weeks:S,days:b,previousMonth:x,nextMonth:T}=C.useMemo(()=>{const A=Z1(p,r,{numberOfMonths:t.numberOfMonths},a),P=X1(A,t.endMonth?d(t.endMonth):void 0,{ISOWeek:t.ISOWeek,fixedWeeks:t.fixedWeeks,broadcastCalendar:t.broadcastCalendar},a),k=eE(A,P,{broadcastCalendar:t.broadcastCalendar,fixedWeeks:t.fixedWeeks,ISOWeek:t.ISOWeek,reverseMonths:t.reverseMonths},a),O=iE(k),U=J1(k),_=aE(p,o,t,a),K=nE(p,r,t,a);return{months:k,weeks:O,days:U,previousMonth:_,nextMonth:K}},[a,p.getTime(),r?.getTime(),o?.getTime(),t.disableNavigation,t.broadcastCalendar,t.endMonth?.getTime(),t.fixedWeeks,t.ISOWeek,t.numberOfMonths,t.pagedNavigation,t.reverseMonths]),{disableNavigation:w,onMonthChange:M}=t,j=A=>S.some(P=>P.days.some(k=>k.isEqualTo(A))),E=A=>{if(w)return;let P=c(A);o&&P<c(o)&&(P=c(o)),r&&P>c(r)&&(P=c(r)),g(P),M?.(P)};return{months:m,weeks:S,days:b,navStart:o,navEnd:r,previousMonth:x,nextMonth:T,goToMonth:E,goToDay:A=>{j(A)||E(A.date)}}}var Fn;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(Fn||(Fn={}));function Cb(t){return!t[pt.disabled]&&!t[pt.hidden]&&!t[pt.outside]}function rE(t,a,o,r){let c,d=-1;for(const h of t){const p=a(h);Cb(p)&&(p[pt.focused]&&d<Fn.FocusedModifier?(c=h,d=Fn.FocusedModifier):r?.isEqualTo(h)&&d<Fn.LastFocused?(c=h,d=Fn.LastFocused):o(h.date)&&d<Fn.Selected?(c=h,d=Fn.Selected):p[pt.today]&&d<Fn.Today&&(c=h,d=Fn.Today))}return c||(c=t.find(h=>Cb(a(h)))),c}function sE(t,a,o,r,c,d,h){const{ISOWeek:p,broadcastCalendar:g}=d,{addDays:m,addMonths:S,addWeeks:b,addYears:x,endOfBroadcastWeek:T,endOfISOWeek:w,endOfWeek:M,max:j,min:E,startOfBroadcastWeek:D,startOfISOWeek:N,startOfWeek:A}=h;let k={day:m,week:b,month:S,year:x,startOfWeek:O=>g?D(O,h):p?N(O):A(O),endOfWeek:O=>g?T(O):p?w(O):M(O)}[t](o,a==="after"?1:-1);return a==="before"&&r?k=j([r,k]):a==="after"&&c&&(k=E([c,k])),k}function Wx(t,a,o,r,c,d,h,p=0){if(p>365)return;const g=sE(t,a,o.date,r,c,d,h),m=!!(d.disabled&&Ca(g,d.disabled,h)),S=!!(d.hidden&&Ca(g,d.hidden,h)),b=g,x=new jx(g,b,h);return!m&&!S?x:Wx(t,a,x,r,c,d,h,p+1)}function lE(t,a,o,r,c){const{autoFocus:d}=t,[h,p]=C.useState(),g=rE(a.days,o,r||(()=>!1),h),[m,S]=C.useState(d?g:void 0);return{isFocusTarget:M=>!!g?.isEqualTo(M),setFocused:S,focused:m,blur:()=>{p(m),S(void 0)},moveFocus:(M,j)=>{if(!m)return;const E=Wx(M,j,m,a.navStart,a.navEnd,t,c);E&&(t.disableNavigation&&!a.days.some(N=>N.isEqualTo(E))||(a.goToDay(E),S(E)))}}}function cE(t,a){const{selected:o,required:r,onSelect:c}=t,[d,h]=tc(o,c?o:void 0),p=c?o:d,{isSameDay:g}=a,m=T=>p?.some(w=>g(w,T))??!1,{min:S,max:b}=t;return{selected:p,select:(T,w,M)=>{let j=[...p??[]];if(m(T)){if(p?.length===S||r&&p?.length===1)return;j=p?.filter(E=>!g(E,T))}else p?.length===b?j=[T]:j=[...j,T];return c||h(j),c?.(j,T,w,M),j},isSelected:m}}function uE(t,a,o=0,r=0,c=!1,d=Yn){const{from:h,to:p}=a||{},{isSameDay:g,isAfter:m,isBefore:S}=d;let b;if(!h&&!p)b={from:t,to:o>0?void 0:t};else if(h&&!p)g(h,t)?o===0?b={from:h,to:t}:c?b={from:h,to:void 0}:b=void 0:S(t,h)?b={from:t,to:h}:b={from:h,to:t};else if(h&&p)if(g(h,t)&&g(p,t))c?b={from:h,to:p}:b=void 0;else if(g(h,t))b={from:h,to:o>0?void 0:t};else if(g(p,t))b={from:t,to:o>0?void 0:t};else if(S(t,h))b={from:t,to:p};else if(m(t,h))b={from:h,to:t};else if(m(t,p))b={from:h,to:t};else throw new Error("Invalid range");if(b?.from&&b?.to){const x=d.differenceInCalendarDays(b.to,b.from);r>0&&x>r?b={from:t,to:void 0}:o>1&&x<o&&(b={from:t,to:void 0})}return b}function dE(t,a,o=Yn){const r=Array.isArray(a)?a:[a];let c=t.from;const d=o.differenceInCalendarDays(t.to,t.from),h=Math.min(d,6);for(let p=0;p<=h;p++){if(r.includes(c.getDay()))return!0;c=o.addDays(c,1)}return!1}function Sb(t,a,o=Yn){return xa(t,a.from,!1,o)||xa(t,a.to,!1,o)||xa(a,t.from,!1,o)||xa(a,t.to,!1,o)}function hE(t,a,o=Yn){const r=Array.isArray(a)?a:[a];if(r.filter(p=>typeof p!="function").some(p=>typeof p=="boolean"?p:o.isDate(p)?xa(t,p,!1,o):Ix(p,o)?p.some(g=>xa(t,g,!1,o)):ec(p)?p.from&&p.to?Sb(t,{from:p.from,to:p.to},o):!1:Ox(p)?dE(t,p.dayOfWeek,o):Kh(p)?o.isAfter(p.before,p.after)?Sb(t,{from:o.addDays(p.after,1),to:o.addDays(p.before,-1)},o):Ca(t.from,p,o)||Ca(t.to,p,o):Gh(p)||Vh(p)?Ca(t.from,p,o)||Ca(t.to,p,o):!1))return!0;const h=r.filter(p=>typeof p=="function");if(h.length){let p=t.from;const g=o.differenceInCalendarDays(t.to,t.from);for(let m=0;m<=g;m++){if(h.some(S=>S(p)))return!0;p=o.addDays(p,1)}}return!1}function fE(t,a){const{disabled:o,excludeDisabled:r,selected:c,required:d,onSelect:h}=t,[p,g]=tc(c,h?c:void 0),m=h?c:p;return{selected:m,select:(x,T,w)=>{const{min:M,max:j}=t,E=x?uE(x,m,M,j,d,a):void 0;return r&&o&&E?.from&&E.to&&hE({from:E.from,to:E.to},o,a)&&(E.from=x,E.to=void 0),h||g(E),h?.(E,x,T,w),E},isSelected:x=>m&&xa(m,x,!1,a)}}function pE(t,a){const{selected:o,required:r,onSelect:c}=t,[d,h]=tc(o,c?o:void 0),p=c?o:d,{isSameDay:g}=a;return{selected:p,select:(b,x,T)=>{let w=b;return!r&&p&&p&&g(b,p)&&(w=void 0),c||h(w),c?.(w,b,x,T),w},isSelected:b=>p?g(p,b):!1}}function gE(t,a){const o=pE(t,a),r=cE(t,a),c=fE(t,a);switch(t.mode){case"single":return o;case"multiple":return r;case"range":return c;default:return}}function Ht(t,a){return t instanceof va&&t.timeZone===a?t:new va(t,a)}function wb(t,a){return typeof t=="boolean"||typeof t=="function"?t:t instanceof Date?Ht(t,a):Array.isArray(t)?t.map(o=>o instanceof Date?Ht(o,a):o):ec(t)?{...t,from:t.from?Ht(t.from,a):t.from,to:t.to?Ht(t.to,a):t.to}:Kh(t)?{before:Ht(t.before,a),after:Ht(t.after,a)}:Gh(t)?{after:Ht(t.after,a)}:Vh(t)?{before:Ht(t.before,a)}:t}function Id(t,a){return t&&(Array.isArray(t)?t.map(o=>wb(o,a)):wb(t,a))}function mE(t){let a=t;const o=a.timeZone;if(o&&(a={...t,timeZone:o},a.today&&(a.today=Ht(a.today,o)),a.month&&(a.month=Ht(a.month,o)),a.defaultMonth&&(a.defaultMonth=Ht(a.defaultMonth,o)),a.startMonth&&(a.startMonth=Ht(a.startMonth,o)),a.endMonth&&(a.endMonth=Ht(a.endMonth,o)),a.mode==="single"&&a.selected?a.selected=Ht(a.selected,o):a.mode==="multiple"&&a.selected?a.selected=a.selected?.map(ve=>Ht(ve,o)):a.mode==="range"&&a.selected&&(a.selected={from:a.selected.from?Ht(a.selected.from,o):a.selected.from,to:a.selected.to?Ht(a.selected.to,o):a.selected.to}),a.disabled!==void 0&&(a.disabled=Id(a.disabled,o)),a.hidden!==void 0&&(a.hidden=Id(a.hidden,o)),a.modifiers)){const ve={};Object.keys(a.modifiers).forEach(Me=>{ve[Me]=Id(a.modifiers?.[Me],o)}),a.modifiers=ve}const{components:r,formatters:c,labels:d,dateLib:h,locale:p,classNames:g}=C.useMemo(()=>{const ve={...Ex,...a.locale},Me=new fn({locale:ve,weekStartsOn:a.broadcastCalendar?1:a.weekStartsOn,firstWeekContainsDate:a.firstWeekContainsDate,useAdditionalWeekYearTokens:a.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:a.useAdditionalDayOfYearTokens,timeZone:a.timeZone,numerals:a.numerals},a.dateLib);return{dateLib:Me,components:D1(a.components),formatters:_1(a.formatters),labels:F1(a.labels,Me.options),locale:ve,classNames:{...T1(),...a.classNames}}},[a.locale,a.broadcastCalendar,a.weekStartsOn,a.firstWeekContainsDate,a.useAdditionalWeekYearTokens,a.useAdditionalDayOfYearTokens,a.timeZone,a.numerals,a.dateLib,a.components,a.formatters,a.labels,a.classNames]);a.today||(a={...a,today:h.today()});const{captionLayout:m,mode:S,navLayout:b,numberOfMonths:x=1,onDayBlur:T,onDayClick:w,onDayFocus:M,onDayKeyDown:j,onDayMouseEnter:E,onDayMouseLeave:D,onNextClick:N,onPrevClick:A,showWeekNumber:P,styles:k}=a,{formatCaption:O,formatDay:U,formatMonthDropdown:_,formatWeekNumber:K,formatWeekNumberHeader:ee,formatWeekdayName:Y,formatYearDropdown:$}=c,fe=oE(a,h),{days:pe,months:H,navStart:Z,navEnd:ne,previousMonth:Q,nextMonth:se,goToMonth:de}=fe,ge=k1(pe,a,Z,ne,h),{isSelected:J,select:ae,selected:he}=gE(a,h)??{},{blur:re,focused:le,isFocusTarget:xe,moveFocus:Pe,setFocused:ze}=lE(a,fe,ge,J??(()=>!1),h),{labelDayButton:Je,labelGridcell:we,labelGrid:Re,labelMonthDropdown:Ve,labelNav:Tt,labelPrevious:jt,labelNext:Wn,labelWeekday:Le,labelWeekNumber:Zt,labelWeekNumberHeader:Rn,labelYearDropdown:en}=d,Ta=C.useMemo(()=>G1(h,a.ISOWeek,a.broadcastCalendar,a.today),[h,a.ISOWeek,a.broadcastCalendar,a.today]),Qn=S!==void 0||w!==void 0,bt=C.useCallback(()=>{Q&&(de(Q),A?.(Q))},[Q,de,A]),tn=C.useCallback(()=>{se&&(de(se),N?.(se))},[de,se,N]),$n=C.useCallback((ve,Me)=>Ae=>{Ae.preventDefault(),Ae.stopPropagation(),ze(ve),!Me.disabled&&(ae?.(ve.date,Me,Ae),w?.(ve.date,Me,Ae))},[ae,w,ze]),ni=C.useCallback((ve,Me)=>Ae=>{ze(ve),M?.(ve.date,Me,Ae)},[M,ze]),On=C.useCallback((ve,Me)=>Ae=>{re(),T?.(ve.date,Me,Ae)},[re,T]),In=C.useCallback((ve,Me)=>Ae=>{const _e={ArrowLeft:[Ae.shiftKey?"month":"day",a.dir==="rtl"?"after":"before"],ArrowRight:[Ae.shiftKey?"month":"day",a.dir==="rtl"?"before":"after"],ArrowDown:[Ae.shiftKey?"year":"week","after"],ArrowUp:[Ae.shiftKey?"year":"week","before"],PageUp:[Ae.shiftKey?"year":"month","before"],PageDown:[Ae.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(_e[Ae.key]){Ae.preventDefault(),Ae.stopPropagation();const[ct,Ne]=_e[Ae.key];Pe(ct,Ne)}j?.(ve.date,Me,Ae)},[Pe,j,a.dir]),Ei=C.useCallback((ve,Me)=>Ae=>{E?.(ve.date,Me,Ae)},[E]),Eo=C.useCallback((ve,Me)=>Ae=>{D?.(ve.date,Me,Ae)},[D]),jo=C.useCallback(ve=>Me=>{const Ae=Number(Me.target.value),_e=h.setMonth(h.startOfMonth(ve),Ae);de(_e)},[h,de]),Xn=C.useCallback(ve=>Me=>{const Ae=Number(Me.target.value),_e=h.setYear(h.startOfMonth(ve),Ae);de(_e)},[h,de]),{className:te,style:Oe}=C.useMemo(()=>({className:[g[Ce.Root],a.className].filter(Boolean).join(" "),style:{...k?.[Ce.Root],...a.style}}),[g,a.className,a.style,k]),ke=N1(a),Ie=C.useRef(null);$1(Ie,!!a.animate,{classNames:g,months:H,focused:le,dateLib:h});const ht={dayPickerProps:a,selected:he,select:ae,isSelected:J,months:H,nextMonth:se,previousMonth:Q,goToMonth:de,getModifiers:ge,components:r,classNames:g,styles:k,labels:d,formatters:c};return ue.createElement(Rx.Provider,{value:ht},ue.createElement(r.Root,{rootRef:a.animate?Ie:void 0,className:te,style:Oe,dir:a.dir,id:a.id,lang:a.lang,nonce:a.nonce,title:a.title,role:a.role,"aria-label":a["aria-label"],"aria-labelledby":a["aria-labelledby"],...ke},ue.createElement(r.Months,{className:g[Ce.Months],style:k?.[Ce.Months]},!a.hideNavigation&&!b&&ue.createElement(r.Nav,{"data-animated-nav":a.animate?"true":void 0,className:g[Ce.Nav],style:k?.[Ce.Nav],"aria-label":Tt(),onPreviousClick:bt,onNextClick:tn,previousMonth:Q,nextMonth:se}),H.map((ve,Me)=>ue.createElement(r.Month,{"data-animated-month":a.animate?"true":void 0,className:g[Ce.Month],style:k?.[Ce.Month],key:Me,displayIndex:Me,calendarMonth:ve},b==="around"&&!a.hideNavigation&&Me===0&&ue.createElement(r.PreviousMonthButton,{type:"button",className:g[Ce.PreviousMonthButton],tabIndex:Q?void 0:-1,"aria-disabled":Q?void 0:!0,"aria-label":jt(Q),onClick:bt,"data-animated-button":a.animate?"true":void 0},ue.createElement(r.Chevron,{disabled:Q?void 0:!0,className:g[Ce.Chevron],orientation:a.dir==="rtl"?"right":"left"})),ue.createElement(r.MonthCaption,{"data-animated-caption":a.animate?"true":void 0,className:g[Ce.MonthCaption],style:k?.[Ce.MonthCaption],calendarMonth:ve,displayIndex:Me},m?.startsWith("dropdown")?ue.createElement(r.DropdownNav,{className:g[Ce.Dropdowns],style:k?.[Ce.Dropdowns]},(()=>{const Ae=m==="dropdown"||m==="dropdown-months"?ue.createElement(r.MonthsDropdown,{key:"month",className:g[Ce.MonthsDropdown],"aria-label":Ve(),classNames:g,components:r,disabled:!!a.disableNavigation,onChange:jo(ve.date),options:q1(ve.date,Z,ne,c,h),style:k?.[Ce.Dropdown],value:h.getMonth(ve.date)}):ue.createElement("span",{key:"month"},_(ve.date,h)),_e=m==="dropdown"||m==="dropdown-years"?ue.createElement(r.YearsDropdown,{key:"year",className:g[Ce.YearsDropdown],"aria-label":en(h.options),classNames:g,components:r,disabled:!!a.disableNavigation,onChange:Xn(ve.date),options:V1(Z,ne,c,h,!!a.reverseYears),style:k?.[Ce.Dropdown],value:h.getYear(ve.date)}):ue.createElement("span",{key:"year"},$(ve.date,h));return h.getMonthYearOrder()==="year-first"?[_e,Ae]:[Ae,_e]})(),ue.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"}},O(ve.date,h.options,h))):ue.createElement(r.CaptionLabel,{className:g[Ce.CaptionLabel],role:"status","aria-live":"polite"},O(ve.date,h.options,h))),b==="around"&&!a.hideNavigation&&Me===x-1&&ue.createElement(r.NextMonthButton,{type:"button",className:g[Ce.NextMonthButton],tabIndex:se?void 0:-1,"aria-disabled":se?void 0:!0,"aria-label":Wn(se),onClick:tn,"data-animated-button":a.animate?"true":void 0},ue.createElement(r.Chevron,{disabled:se?void 0:!0,className:g[Ce.Chevron],orientation:a.dir==="rtl"?"left":"right"})),Me===x-1&&b==="after"&&!a.hideNavigation&&ue.createElement(r.Nav,{"data-animated-nav":a.animate?"true":void 0,className:g[Ce.Nav],style:k?.[Ce.Nav],"aria-label":Tt(),onPreviousClick:bt,onNextClick:tn,previousMonth:Q,nextMonth:se}),ue.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":S==="multiple"||S==="range","aria-label":Re(ve.date,h.options,h)||void 0,className:g[Ce.MonthGrid],style:k?.[Ce.MonthGrid]},!a.hideWeekdays&&ue.createElement(r.Weekdays,{"data-animated-weekdays":a.animate?"true":void 0,className:g[Ce.Weekdays],style:k?.[Ce.Weekdays]},P&&ue.createElement(r.WeekNumberHeader,{"aria-label":Rn(h.options),className:g[Ce.WeekNumberHeader],style:k?.[Ce.WeekNumberHeader],scope:"col"},ee()),Ta.map(Ae=>ue.createElement(r.Weekday,{"aria-label":Le(Ae,h.options,h),className:g[Ce.Weekday],key:String(Ae),style:k?.[Ce.Weekday],scope:"col"},Y(Ae,h.options,h)))),ue.createElement(r.Weeks,{"data-animated-weeks":a.animate?"true":void 0,className:g[Ce.Weeks],style:k?.[Ce.Weeks]},ve.weeks.map(Ae=>ue.createElement(r.Week,{className:g[Ce.Week],key:Ae.weekNumber,style:k?.[Ce.Week],week:Ae},P&&ue.createElement(r.WeekNumber,{week:Ae,style:k?.[Ce.WeekNumber],"aria-label":Zt(Ae.weekNumber,{locale:p}),className:g[Ce.WeekNumber],scope:"row",role:"rowheader"},K(Ae.weekNumber,h)),Ae.days.map(_e=>{const{date:ct}=_e,Ne=ge(_e);if(Ne[pt.focused]=!Ne.hidden&&!!le?.isEqualTo(_e),Ne[En.selected]=J?.(ct)||Ne.selected,ec(he)){const{from:nn,to:Nn}=he;Ne[En.range_start]=!!(nn&&Nn&&h.isSameDay(ct,nn)),Ne[En.range_end]=!!(nn&&Nn&&h.isSameDay(ct,Nn)),Ne[En.range_middle]=xa(he,ct,!0,h)}const zt=K1(Ne,k,a.modifiersStyles),Jn=A1(Ne,g,a.modifiersClassNames),Pt=!Qn&&!Ne.hidden?we(ct,Ne,h.options,h):void 0;return ue.createElement(r.Day,{key:`${_e.isoDate}_${_e.displayMonthId}`,day:_e,modifiers:Ne,className:Jn.join(" "),style:zt,role:"gridcell","aria-selected":Ne.selected||void 0,"aria-label":Pt,"data-day":_e.isoDate,"data-month":_e.outside?_e.dateMonthId:void 0,"data-selected":Ne.selected||void 0,"data-disabled":Ne.disabled||void 0,"data-hidden":Ne.hidden||void 0,"data-outside":_e.outside||void 0,"data-focused":Ne.focused||void 0,"data-today":Ne.today||void 0},!Ne.hidden&&Qn?ue.createElement(r.DayButton,{className:g[Ce.DayButton],style:k?.[Ce.DayButton],type:"button",day:_e,modifiers:Ne,disabled:!Ne.focused&&Ne.disabled||void 0,"aria-disabled":Ne.focused&&Ne.disabled||void 0,tabIndex:xe(_e)?0:-1,"aria-label":Je(ct,Ne,h.options,h),onClick:$n(_e,Ne),onBlur:On(_e,Ne),onFocus:ni(_e,Ne),onKeyDown:In(_e,Ne),onMouseEnter:Ei(_e,Ne),onMouseLeave:Eo(_e,Ne)},U(ct,h.options,h)):!Ne.hidden&&U(_e.date,h.options,h))})))))))),a.footer&&ue.createElement(r.Footer,{className:g[Ce.Footer],style:k?.[Ce.Footer],role:"status","aria-live":"polite"},a.footer)))}function yE({className:t,classNames:a,showOutsideDays:o=!0,...r}){return l.jsx(mE,{showOutsideDays:o,className:z("p-2",t),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:z(xl({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:z(xl({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:z("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:z(xl({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:z("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:z("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:z("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:z("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",...a},components:{Chevron:({orientation:c,className:d,...h})=>{const p=c==="left"?Aw:c==="right"?Ol:c==="up"?oh:Il;return l.jsx(p,{className:z("h-4 w-4",d),...h})}},...r})}yE.displayName="Calendar";const bE=C.lazy(()=>tt(()=>Promise.resolve().then(()=>Zl),void 0).then(t=>({default:t.CodeEditor})));function sR({rawJsonContent:t,isRawJsonValid:a,rawJsonEdits:o,rawSettingsEnv:r,onChange:c,missingRequiredFields:d=[]}){const{t:h}=ye(),p=d.length>0;return l.jsx(C.Suspense,{fallback:l.jsxs("div",{className:"flex items-center justify-center h-full",children:[l.jsx(An,{className:"w-6 h-6 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-2 text-muted-foreground",children:h("providerEditor.loadingEditor")})]}),children:l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!a&&o!==null&&l.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:[l.jsx(Mo,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&p&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[l.jsx(Vn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),l.jsxs("div",{children:[l.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",l.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:d.join(", ")}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:l.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:l.jsx(bE,{value:t,onChange:c,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx("div",{className:"border rounded-md overflow-hidden",children:l.jsx(Uh,{profileEnv:r})})})]})})}C.lazy(()=>tt(()=>Promise.resolve().then(()=>Zl),void 0).then(t=>({default:t.CodeEditor})));function vE(){const{t}=ye(),{isDark:a,setTheme:o}=mh(),[r,c]=C.useState(""),[d,h]=C.useState(""),[p,g]=C.useState(!1),[m,S]=C.useState(null),[b,x]=C.useState(!1),{login:T,authRequired:w,isAuthenticated:M,loading:j,accessMode:E,authEnabled:D}=Bl(),N=ah(),A=Rl(),P=E==="setup",k=t(P?"auth.remoteGuardLabel":"auth.protectedAccessLabel"),O=t(P?D?"auth.incompleteSetupDescription":"auth.remoteSetupDescription":"auth.loginDescription"),U=A.state?.from?.pathname||"/";if(C.useEffect(()=>{j||(M||!w)&&N(U,{replace:!0})},[M,w,j,N,U]),j)return l.jsx("div",{className:"flex min-h-[100dvh] items-center justify-center bg-background px-4",children:l.jsxs("div",{className:"flex items-center gap-3 rounded-full border border-border/80 bg-card/90 px-5 py-3 text-sm text-muted-foreground shadow-sm",children:[l.jsx(An,{className:"h-4 w-4 animate-spin"}),t("auth.loading")]})});if(M||!w)return null;const _=async K=>{K.preventDefault(),S(null),x(!0);try{await T(r,d),N(U,{replace:!0})}catch(ee){S(ee instanceof Error?ee.message:t("auth.loginFailed"))}finally{x(!1)}};return l.jsxs("div",{className:"relative min-h-[100dvh] overflow-hidden bg-background",children:[l.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(167,85,52,0.16),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(39,39,42,0.12),transparent_48%)]"}),l.jsx("div",{className:"absolute inset-0 opacity-[0.18] [background-image:linear-gradient(rgba(127,117,107,0.14)_1px,transparent_1px),linear-gradient(90deg,rgba(127,117,107,0.14)_1px,transparent_1px)] [background-size:24px_24px]"}),l.jsx("div",{className:"relative mx-auto flex min-h-[100dvh] max-w-6xl items-center px-4 py-8 sm:px-6",children:l.jsxs("div",{className:"grid w-full items-stretch gap-6 lg:grid-cols-[minmax(0,1.05fr)_minmax(360px,430px)]",children:[l.jsxs("section",{className:"flex flex-col justify-between rounded-[28px] border border-border/70 bg-card/85 p-6 shadow-[0_24px_80px_-48px_rgba(68,48,34,0.55)] backdrop-blur sm:p-8",children:[l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[l.jsxs("span",{className:"inline-flex w-fit items-center gap-2 rounded-full border border-border/70 bg-background/75 px-3 py-1 text-xs font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:[l.jsx(pl,{className:"h-3.5 w-3.5 text-accent"}),k]}),l.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full border border-border/70 bg-background/75 p-1 shadow-sm backdrop-blur",children:[l.jsxs(st,{type:"button",variant:"ghost",size:"sm",className:z("rounded-full px-3 text-xs font-semibold",!a&&"bg-card text-foreground shadow-sm"),"aria-pressed":!a,onClick:()=>o("light"),children:[l.jsx(Jb,{className:"h-3.5 w-3.5"}),t("auth.lightMode")]}),l.jsxs(st,{type:"button",variant:"ghost",size:"sm",className:z("rounded-full px-3 text-xs font-semibold",a&&"bg-card text-foreground shadow-sm"),"aria-pressed":a,onClick:()=>o("dark"),children:[l.jsx(Zb,{className:"h-3.5 w-3.5"}),t("auth.darkMode")]})]})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("h1",{className:"max-w-xl text-4xl font-semibold tracking-[-0.04em] text-balance text-foreground sm:text-5xl",children:t(P?"auth.remoteSetupTitle":"auth.dashboardTitle")}),l.jsx("p",{className:"max-w-2xl text-base leading-7 text-muted-foreground sm:text-lg",children:O})]})]}),l.jsxs("div",{className:"mt-8 grid gap-3 text-sm text-muted-foreground sm:grid-cols-3",children:[l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[l.jsx(Vm,{className:"mb-3 h-4 w-4 text-accent"}),l.jsx("p",{children:t("auth.safetyNoteRemote")})]}),l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[l.jsx(Ym,{className:"mb-3 h-4 w-4 text-accent"}),l.jsx("p",{children:t("auth.safetyNoteLocal")})]}),l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[l.jsx(pl,{className:"mb-3 h-4 w-4 text-accent"}),l.jsx("p",{children:t("auth.safetyNoteSession")})]})]})]}),l.jsxs(QM,{className:"justify-center rounded-[28px] border-border/70 bg-card/95 py-0 shadow-[0_24px_90px_-54px_rgba(34,24,16,0.62)]",children:[l.jsxs($M,{className:"space-y-3 border-b border-border/70 px-6 py-6",children:[l.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl border border-accent/20 bg-accent/10",children:P?l.jsx(Vm,{className:"h-5 w-5 text-accent"}):l.jsx(Ym,{className:"h-5 w-5 text-accent"})}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(XM,{className:"text-2xl tracking-[-0.03em]",children:t(P?"auth.remoteSetupTitle":"auth.dashboardTitle")}),l.jsx(JM,{className:"text-sm leading-6 text-muted-foreground",children:P?O:t("auth.credentialsHint")})]})]}),l.jsx(ZM,{className:"space-y-5 px-6 py-6",children:P?l.jsxs(l.Fragment,{children:[l.jsxs(zr,{variant:"warning",className:"rounded-2xl border-yellow-300/70 bg-yellow-50/80",children:[l.jsx(Kr,{className:"h-4 w-4"}),l.jsx(Ll,{children:t("auth.noDefaultCredentials")}),l.jsx(Br,{children:t("auth.credentialsHint")})]}),l.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[l.jsx(Dw,{className:"h-4 w-4 text-accent"}),t("auth.hostStepTitle")]}),l.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:t("auth.hostStepDescription")}),l.jsx("code",{className:"mt-4 block rounded-xl border border-border/70 bg-muted/60 px-3 py-2 font-mono text-[13px] text-foreground",children:"ccs config auth setup"}),l.jsx("p",{className:"mt-3 text-xs leading-5 text-muted-foreground",children:t("auth.dockerStepDescription")}),l.jsx("code",{className:"mt-2 block rounded-xl border border-border/70 bg-muted/60 px-3 py-2 font-mono text-[13px] text-foreground",children:"docker exec -it ccs-cliproxy ccs config auth setup"})]}),l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[l.jsx(pl,{className:"h-4 w-4 text-accent"}),t("auth.localStepTitle")]}),l.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:t("auth.localStepDescription")})]})]})]}):l.jsxs("form",{onSubmit:_,className:"space-y-4",children:[m&&l.jsxs(zr,{variant:"destructive",className:"rounded-2xl",children:[l.jsx(Kr,{className:"h-4 w-4"}),l.jsx(Br,{children:m})]}),l.jsxs(zr,{variant:"info",className:"rounded-2xl border-blue-200/80 bg-blue-50/80",children:[l.jsx(pl,{className:"h-4 w-4"}),l.jsx(Ll,{children:t("auth.noDefaultCredentials")}),l.jsx(Br,{children:t("auth.credentialsHint")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{htmlFor:"username",className:"text-sm font-semibold",children:t("auth.username")}),l.jsx(Bn,{id:"username",type:"text",value:r,onChange:K=>c(K.target.value),placeholder:t("auth.usernamePlaceholder"),autoComplete:"username",className:"h-12 rounded-2xl border-border/80 bg-background/85 px-4 text-base md:text-base",disabled:b,required:!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{htmlFor:"password",className:"text-sm font-semibold",children:t("auth.password")}),l.jsxs("div",{className:"relative",children:[l.jsx(Bn,{id:"password",type:p?"text":"password",value:d,onChange:K=>h(K.target.value),placeholder:t("auth.passwordPlaceholder"),autoComplete:"current-password",className:"h-12 rounded-2xl border-border/80 bg-background/85 px-4 pr-14 text-base md:text-base",disabled:b,required:!0}),l.jsx(st,{type:"button",variant:"ghost",size:"sm",className:"absolute inset-y-1 right-1 h-auto rounded-xl px-3 text-muted-foreground hover:text-foreground","aria-label":t(p?"auth.hidePassword":"auth.showPassword"),"aria-pressed":p,onClick:()=>g(K=>!K),disabled:b,children:p?l.jsx(Qr,{className:"h-4 w-4"}):l.jsx($r,{className:"h-4 w-4"})})]})]}),l.jsx(st,{type:"submit",className:"h-12 w-full rounded-2xl text-sm font-semibold",disabled:b,children:b?l.jsxs(l.Fragment,{children:[l.jsx(An,{className:"mr-2 h-4 w-4 animate-spin"}),t("auth.signingIn")]}):t("auth.signIn")})]})})]})]})})]})}const xE=C.lazy(()=>tt(()=>import("./index-Cq9VySs6.js"),__vite__mapDeps([23,1,2,4,5,7,24,6,8,9])).then(t=>({default:t.AnalyticsPage}))),CE=C.lazy(()=>tt(()=>import("./api-DZosWVkR.js"),__vite__mapDeps([25,1,2,5,26,19,6,4,3,7,8,9])).then(t=>({default:t.ApiPage}))),SE=C.lazy(()=>tt(()=>import("./cliproxy-B3Jyu3r9.js"),__vite__mapDeps([27,1,2,5,17,6,4,20,28,26,19,29,30,18,7,8,9])).then(t=>({default:t.CliproxyPage}))),wE=C.lazy(()=>tt(()=>import("./cliproxy-ai-providers-BAJ78pUc.js"),__vite__mapDeps([31,1,2,18,19,5,6,4,26,7,8,9])).then(t=>({default:t.CliproxyAiProvidersPage}))),kE=C.lazy(()=>tt(()=>import("./cliproxy-control-panel-XEvUMVJe.js"),__vite__mapDeps([32,1,2,5,17,4,6,7,8,9])).then(t=>({default:t.CliproxyControlPanelPage}))),AE=C.lazy(()=>tt(()=>import("./copilot-afee2lL9.js"),__vite__mapDeps([33,1,2,5,26,19,4,29,30,6,7,8,9])).then(t=>({default:t.CopilotPage}))),DE=C.lazy(()=>tt(()=>import("./cursor-DuWy60wp.js"),__vite__mapDeps([34,1,2,6,5,17,29,30,4,7,8,9])).then(t=>({default:t.CursorPage}))),NE=C.lazy(()=>tt(()=>import("./claude-extension-C6OeBQ73.js"),__vite__mapDeps([35,1,2,5,6,4,7,8,9])).then(t=>({default:t.ClaudeExtensionPage}))),TE=C.lazy(()=>tt(()=>import("./codex-CY2vikqX.js"),__vite__mapDeps([36,1,2,6,4,29,5,9,7,37,38,8])).then(t=>({default:t.CodexPage}))),PE=C.lazy(()=>tt(()=>import("./droid-FlceoQ6k.js"),__vite__mapDeps([39,1,2,6,5,38,4,29,7,8,9])).then(t=>({default:t.DroidPage}))),ME=C.lazy(()=>tt(()=>import("./logs-Dth4naJl.js"),__vite__mapDeps([40,1,2,4,5,6,7,8,9])).then(t=>({default:t.LogsPage}))),LE=C.lazy(()=>tt(()=>import("./accounts-CybVGDsm.js"),__vite__mapDeps([41,1,2,5,37,19,6,4,28,7,8,9])).then(t=>({default:t.AccountsPage}))),EE=C.lazy(()=>tt(()=>Promise.resolve().then(()=>BL),void 0).then(t=>({default:t.SettingsPage}))),jE=C.lazy(()=>tt(()=>import("./health-BEMgcKD3.js"),__vite__mapDeps([42,1,2,5,6,4,11,7,8,9])).then(t=>({default:t.HealthPage}))),RE=C.lazy(()=>tt(()=>import("./shared-CwWuZx24.js"),__vite__mapDeps([43,1,2,4,5,6,7,8,9])).then(t=>({default:t.SharedPage}))),OE=C.lazy(()=>tt(()=>import("./updates-BTHJZ7Rk.js"),__vite__mapDeps([44,1,2,4,5,6,7,8,9])).then(t=>({default:t.UpdatesPage}))),IE=null;function Bt(){return l.jsx("div",{className:"flex h-64 items-center justify-center",children:l.jsx(An,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function _E(){return l.jsx(G0,{client:xk,children:l.jsx(pA,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(gA,{children:l.jsx(xA,{children:l.jsxs(B0,{children:[l.jsxs(F0,{children:[l.jsx(Ct,{path:"/login",element:l.jsx(vE,{})}),l.jsx(Ct,{element:l.jsx(CA,{}),children:l.jsxs(Ct,{element:l.jsx(LN,{}),children:[l.jsx(Ct,{path:"/",element:l.jsx(nM,{})}),l.jsx(Ct,{path:"/analytics",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(xE,{})})}),l.jsx(Ct,{path:"/updates",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(OE,{})})}),l.jsx(Ct,{path:"/providers",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(CE,{})})}),l.jsx(Ct,{path:"/cliproxy",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(SE,{})})}),l.jsx(Ct,{path:"/cliproxy/ai-providers",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(wE,{})})}),l.jsx(Ct,{path:"/cliproxy/control-panel",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(kE,{})})}),l.jsx(Ct,{path:"/copilot",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(AE,{})})}),l.jsx(Ct,{path:"/cursor",element:l.jsx(Kb,{to:"/cliproxy?provider=cursor",replace:!0})}),l.jsx(Ct,{path:"/legacy/cursor",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(DE,{})})}),l.jsx(Ct,{path:"/claude-extension",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(NE,{})})}),l.jsx(Ct,{path:"/codex",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(TE,{})})}),l.jsx(Ct,{path:"/droid",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(PE,{})})}),l.jsx(Ct,{path:"/accounts",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(LE,{})})}),l.jsx(Ct,{path:"/settings",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(EE,{})})}),l.jsx(Ct,{path:"/health",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(jE,{})})}),l.jsx(Ct,{path:"/logs",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(ME,{})})}),l.jsx(Ct,{path:"/shared",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(RE,{})})}),IE]})})]}),l.jsx(V0,{position:"top-right"})]})})})})})}const Qx=document.getElementById("root");if(!Qx)throw new Error("Root element not found. Failed to mount React application.");yk.createRoot(Qx).render(l.jsx(C.StrictMode,{children:l.jsx(_E,{})}));export{qj as $,sM as A,Et as B,QM as C,fM as D,_j as E,Hj as F,iM as G,dM as H,Bn as I,pM as J,Uj as K,qt as L,AD as M,DD as N,ND as O,bv as P,px as Q,Ih as R,$e as S,wa as T,El as U,Xd as V,ie as W,Fj as X,He as Y,Bj as Z,JM as _,ye as a,oj as a$,Kj as a0,Gj as a1,Vj as a2,Yj as a3,Wj as a4,Qj as a5,yx as a6,$j as a7,nL as a8,Th as a9,Zj as aA,eR as aB,Jj as aC,GD as aD,Dj as aE,Ay as aF,MM as aG,Xj as aH,bM as aI,wx as aJ,NT as aK,qT as aL,Pi as aM,yN as aN,bN as aO,vN as aP,xN as aQ,hT as aR,Rv as aS,uj as aT,dj as aU,hj as aV,fj as aW,rR as aX,$E as aY,kD as aZ,ij as a_,Ph as aa,YE as ab,vD as ac,XE as ad,nj as ae,sj as af,lj as ag,yh as ah,bh as ai,vh as aj,xh as ak,Ch as al,tR as am,iL as an,nR as ao,Li as ap,Pj as aq,jr as ar,Mj as as,Gd as at,cj as au,Lj as av,Ej as aw,Rj as ax,Dy as ay,jj as az,ZM as b,xD as b0,CD as b1,rj as b2,SD as b3,wD as b4,aj as b5,Ah as b6,Tj as b7,Cj as b8,wj as b9,_L as bA,yj as bB,pj as bC,XD as bD,JD as bE,Nj as bF,dv as bG,Zk as bH,Xk as bI,zd as bJ,Ni as bK,qk as bL,Gk as bM,Qk as bN,tA as bO,bj as bP,JE as bQ,ZE as bR,ej as bS,tj as bT,gj as bU,mj as bV,xj as bW,vj as bX,xl as bY,kj as ba,Sj as bb,Dx as bc,Uh as bd,Aj as be,Er as bf,WE as bg,QE as bh,zr as bi,Ll as bj,Br as bk,sR as bl,Rh as bm,Vr as bn,Oh as bo,WP as bp,FA as bq,GA as br,VA as bs,YA as bt,WA as bu,ZP as bv,Oj as bw,Ij as bx,Tx as by,OL as bz,z as c,st as d,aR as e,iR as f,oL as g,yE as h,VE as i,$M as j,XM as k,gT as l,mT as m,Lo as n,oR as o,ka as p,Aa as q,Pv as r,Dh as s,Mv as t,ch as u,Nh as v,Hr as w,$y as x,yM as y,zj as z};
|
|
72
|
+
`);return{valid:!1,error:r,line:h.length}}return{valid:!1,error:r}}}function LL(t){if(!t.trim())return{valid:!0};try{return NL(t),{valid:!0}}catch(a){const o=a.message,r=o.match(/line\s+(\d+)/i);return{valid:!1,error:o,line:r?Number.parseInt(r[1],10):void 0}}}function Dx({value:t,onChange:a,language:o="json",readonly:r=!1,className:c,minHeight:d="300px",heightMode:h="content"}){const{isDark:p}=mh(),{t:g}=ye(),[m,S]=C.useState(!1),[b,x]=C.useState(!0),T=h==="fill-parent",w=C.useMemo(()=>o==="json"?ML(t):o==="toml"?LL(t):{valid:!0},[t,o]),M=C.useCallback(j=>l.jsx(hk,{prism:hL,theme:p?Xm.nightOwl:Xm.github,code:j,language:o,children:({tokens:E,getLineProps:D,getTokenProps:N})=>{let A=!1;return l.jsx(l.Fragment,{children:E.map((P,k)=>l.jsx("div",{...D({line:P}),className:z(w.line===k+1&&"bg-destructive/20"),children:P.map((O,U)=>{let _=!1;if(O.types.includes("property")){const ee=O.content.replace(/['"]/g,"");PL(ee)?A=!0:A=!1}else(O.types.includes("string")||O.types.includes("number")||O.types.includes("boolean"))&&A?(_=!0,A=!1):O.types.includes("punctuation")&&O.content!==":"&&O.content!=="["&&O.content!=="{"&&(A=!1);const K=N({token:O});return _&&b&&(K.className=z(K.className,"blur-[3px] select-none opacity-70 transition-all duration-200")),l.jsx("span",{...K},U)})},k))})}}),[p,o,w.line,b]);return l.jsxs("div",{className:z("flex min-h-0 flex-col",T&&"h-full",c),style:T?{height:d==="auto"?void 0:d}:void 0,children:[l.jsxs("div",{className:z("relative rounded-md border overflow-hidden","bg-muted/30",T&&"flex min-h-0 flex-1 flex-col",m&&"ring-2 ring-ring ring-offset-2 ring-offset-background",r&&"opacity-70 cursor-not-allowed",!w.valid&&"border-destructive"),"data-slot":"code-editor-surface",children:[l.jsx("div",{className:z(T&&"scrollbar-editor min-h-0 flex-1 overflow-auto"),"data-slot":T?"code-editor-viewport":void 0,children:l.jsx(cL,{value:t,onValueChange:r?()=>{}:a,highlight:M,padding:12,disabled:r,onFocus:()=>S(!0),onBlur:()=>S(!1),textareaClassName:z("focus:outline-none font-mono text-sm",r&&"cursor-not-allowed"),preClassName:"font-mono text-sm",style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:"0.875rem",minHeight:d}},p?"dark-editor":"light-editor")}),l.jsx("div",{className:"absolute top-2 right-2 z-10 opacity-50 hover:opacity-100 transition-opacity",children:l.jsx(st,{variant:"ghost",size:"icon",className:"h-6 w-6 bg-background/50 hover:bg-background border shadow-sm rounded-full",onClick:()=>x(!b),title:g(b?"codeEditor.revealSensitive":"codeEditor.maskSensitive"),children:b?l.jsx($r,{className:"h-3 w-3"}):l.jsx(Qr,{className:"h-3 w-3"})})})]}),l.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs",children:[w.valid?l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[l.jsx(Xr,{className:"w-3 h-3 text-green-500"}),g("codeEditor.valid",{language:o.toUpperCase()})]}):l.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[l.jsx(Kr,{className:"w-3 h-3"}),w.error,w.line&&` (line ${w.line})`]}),r&&l.jsx("span",{className:"ml-auto text-muted-foreground",children:g("codeEditor.readOnly")})]})]})}const Zl=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:Dx},Symbol.toStringTag,{value:"Module"})),EL={browserConfig:null,browserStatus:null,browserLoading:!0,browserStatusLoading:!0,browserSaving:!1,browserError:null,browserSuccess:!1,webSearchConfig:null,webSearchStatus:null,webSearchLoading:!0,webSearchStatusLoading:!0,webSearchSaving:!1,webSearchError:null,webSearchSuccess:!1,globalEnvConfig:null,globalEnvLoading:!0,globalEnvSaving:!1,globalEnvError:null,globalEnvSuccess:!1,proxyConfig:null,proxyLoading:!0,proxySaving:!1,proxyError:null,proxySuccess:!1,proxyTestResult:null,proxyTesting:!1,rawConfig:null,rawConfigLoading:!1};function jL(t,a){switch(a.type){case"SET_BROWSER_CONFIG":return{...t,browserConfig:a.payload};case"SET_BROWSER_STATUS":return{...t,browserStatus:a.payload};case"SET_BROWSER_LOADING":return{...t,browserLoading:a.payload};case"SET_BROWSER_STATUS_LOADING":return{...t,browserStatusLoading:a.payload};case"SET_BROWSER_SAVING":return{...t,browserSaving:a.payload};case"SET_BROWSER_ERROR":return{...t,browserError:a.payload};case"SET_BROWSER_SUCCESS":return{...t,browserSuccess:a.payload};case"SET_WEBSEARCH_CONFIG":return{...t,webSearchConfig:a.payload};case"SET_WEBSEARCH_STATUS":return{...t,webSearchStatus:a.payload};case"SET_WEBSEARCH_LOADING":return{...t,webSearchLoading:a.payload};case"SET_WEBSEARCH_STATUS_LOADING":return{...t,webSearchStatusLoading:a.payload};case"SET_WEBSEARCH_SAVING":return{...t,webSearchSaving:a.payload};case"SET_WEBSEARCH_ERROR":return{...t,webSearchError:a.payload};case"SET_WEBSEARCH_SUCCESS":return{...t,webSearchSuccess:a.payload};case"SET_GLOBALENV_CONFIG":return{...t,globalEnvConfig:a.payload};case"SET_GLOBALENV_LOADING":return{...t,globalEnvLoading:a.payload};case"SET_GLOBALENV_SAVING":return{...t,globalEnvSaving:a.payload};case"SET_GLOBALENV_ERROR":return{...t,globalEnvError:a.payload};case"SET_GLOBALENV_SUCCESS":return{...t,globalEnvSuccess:a.payload};case"SET_PROXY_CONFIG":return{...t,proxyConfig:a.payload};case"SET_PROXY_LOADING":return{...t,proxyLoading:a.payload};case"SET_PROXY_SAVING":return{...t,proxySaving:a.payload};case"SET_PROXY_ERROR":return{...t,proxyError:a.payload};case"SET_PROXY_SUCCESS":return{...t,proxySuccess:a.payload};case"SET_PROXY_TEST_RESULT":return{...t,proxyTestResult:a.payload};case"SET_PROXY_TESTING":return{...t,proxyTesting:a.payload};case"SET_RAW_CONFIG":return{...t,rawConfig:a.payload};case"SET_RAW_CONFIG_LOADING":return{...t,rawConfigLoading:a.payload};default:return t}}const Nx=C.createContext(null);function RL({children:t}){const[a,o]=C.useReducer(jL,EL);return l.jsx(Nx.Provider,{value:{state:a,dispatch:o},children:t})}function Tx(){const t=C.useContext(Nx);if(!t)throw new Error("useSettingsContext must be used within a SettingsProvider");return t}function OL(){const{dispatch:t}=Tx(),a=C.useCallback($=>t({type:"SET_BROWSER_CONFIG",payload:$}),[t]),o=C.useCallback($=>t({type:"SET_BROWSER_STATUS",payload:$}),[t]),r=C.useCallback($=>t({type:"SET_BROWSER_LOADING",payload:$}),[t]),c=C.useCallback($=>t({type:"SET_BROWSER_STATUS_LOADING",payload:$}),[t]),d=C.useCallback($=>t({type:"SET_BROWSER_SAVING",payload:$}),[t]),h=C.useCallback($=>t({type:"SET_BROWSER_ERROR",payload:$}),[t]),p=C.useCallback($=>t({type:"SET_BROWSER_SUCCESS",payload:$}),[t]),g=C.useCallback($=>t({type:"SET_WEBSEARCH_CONFIG",payload:$}),[t]),m=C.useCallback($=>t({type:"SET_WEBSEARCH_STATUS",payload:$}),[t]),S=C.useCallback($=>t({type:"SET_WEBSEARCH_LOADING",payload:$}),[t]),b=C.useCallback($=>t({type:"SET_WEBSEARCH_STATUS_LOADING",payload:$}),[t]),x=C.useCallback($=>t({type:"SET_WEBSEARCH_SAVING",payload:$}),[t]),T=C.useCallback($=>t({type:"SET_WEBSEARCH_ERROR",payload:$}),[t]),w=C.useCallback($=>t({type:"SET_WEBSEARCH_SUCCESS",payload:$}),[t]),M=C.useCallback($=>t({type:"SET_GLOBALENV_CONFIG",payload:$}),[t]),j=C.useCallback($=>t({type:"SET_GLOBALENV_LOADING",payload:$}),[t]),E=C.useCallback($=>t({type:"SET_GLOBALENV_SAVING",payload:$}),[t]),D=C.useCallback($=>t({type:"SET_GLOBALENV_ERROR",payload:$}),[t]),N=C.useCallback($=>t({type:"SET_GLOBALENV_SUCCESS",payload:$}),[t]),A=C.useCallback($=>t({type:"SET_PROXY_CONFIG",payload:$}),[t]),P=C.useCallback($=>t({type:"SET_PROXY_LOADING",payload:$}),[t]),k=C.useCallback($=>t({type:"SET_PROXY_SAVING",payload:$}),[t]),O=C.useCallback($=>t({type:"SET_PROXY_ERROR",payload:$}),[t]),U=C.useCallback($=>t({type:"SET_PROXY_SUCCESS",payload:$}),[t]),_=C.useCallback($=>t({type:"SET_PROXY_TEST_RESULT",payload:$}),[t]),K=C.useCallback($=>t({type:"SET_PROXY_TESTING",payload:$}),[t]),ee=C.useCallback($=>t({type:"SET_RAW_CONFIG",payload:$}),[t]),Y=C.useCallback($=>t({type:"SET_RAW_CONFIG_LOADING",payload:$}),[t]);return C.useMemo(()=>({setBrowserConfig:a,setBrowserStatus:o,setBrowserLoading:r,setBrowserStatusLoading:c,setBrowserSaving:d,setBrowserError:h,setBrowserSuccess:p,setWebSearchConfig:g,setWebSearchStatus:m,setWebSearchLoading:S,setWebSearchStatusLoading:b,setWebSearchSaving:x,setWebSearchError:T,setWebSearchSuccess:w,setGlobalEnvConfig:M,setGlobalEnvLoading:j,setGlobalEnvSaving:E,setGlobalEnvError:D,setGlobalEnvSuccess:N,setProxyConfig:A,setProxyLoading:P,setProxySaving:k,setProxyError:O,setProxySuccess:U,setProxyTestResult:_,setProxyTesting:K,setRawConfig:ee,setRawConfigLoading:Y}),[a,o,r,c,d,h,p,g,m,S,b,x,T,w,M,j,E,D,N,A,P,k,O,U,_,K,ee,Y])}function IL(){const[t,a]=Vb(),o=t.get("tab")?.toLowerCase(),r=o==="imageanalysis"||o==="image"?"image":o==="channels"?"channels":o==="globalenv"?"globalenv":o==="proxy"?"proxy":o==="auth"?"auth":o==="thinking"?"thinking":o==="backups"?"backups":"websearch",c=C.useCallback(d=>{a({tab:d},{replace:!0})},[a]);return{activeTab:r,setActiveTab:c}}function _L(){const{state:t}=Tx(),a=OL(),[o,r]=C.useState(!1),c=C.useCallback(async()=>{try{a.setRawConfigLoading(!0);const h=await fetch("/api/config/raw");if(!h.ok){a.setRawConfig(null);return}const p=await h.text();a.setRawConfig(p)}catch{a.setRawConfig(null)}finally{a.setRawConfigLoading(!1)}},[a]),d=C.useCallback(async()=>{if(t.rawConfig)try{await navigator.clipboard.writeText(t.rawConfig),r(!0),setTimeout(()=>r(!1),2e3)}catch{}},[t.rawConfig]);return{rawConfig:t.rawConfig,loading:t.rawConfigLoading,copied:o,fetchRawConfig:c,copyToClipboard:d}}function ob({activeTab:t,onTabChange:a}){const{t:o}=ye(),r=[{value:"browser",label:o("settingsTabs.browser"),icon:xw},{value:"websearch",label:o("settingsTabs.web"),icon:nv},{value:"image",label:o("settingsTabs.image"),icon:ov},{value:"channels",label:o("settingsTabs.channels"),icon:Cw},{value:"globalenv",label:o("settingsTabs.env"),icon:sh},{value:"thinking",label:o("settingsTabs.think"),icon:Sw},{value:"proxy",label:o("settingsTabs.proxy"),icon:ww},{value:"auth",label:o("settingsTabs.auth"),icon:ih},{value:"backups",label:o("settingsTabs.backup"),icon:kw}];return l.jsx(px,{value:t,onValueChange:c=>a(c),children:l.jsx(Ih,{className:"grid w-full grid-cols-9",children:r.map(({value:c,label:d,icon:h})=>l.jsxs(El,{value:c,className:"gap-1.5 px-2 text-xs",children:[l.jsx(h,{className:"h-3.5 w-3.5 shrink-0"}),l.jsx("span",{className:"truncate",children:d})]},c))})})}function rb(){return l.jsxs("div",{className:"flex-1 p-5 space-y-6",children:[l.jsx($e,{className:"h-4 w-2/3"}),l.jsx("div",{className:"p-4 rounded-lg border",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx($e,{className:"h-5 w-32"}),l.jsx($e,{className:"h-4 w-48"})]}),l.jsx($e,{className:"h-6 w-10 rounded-full"})]})}),l.jsxs("div",{className:"space-y-3",children:[l.jsx($e,{className:"h-5 w-24"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx($e,{className:"h-20 w-full rounded-lg"}),l.jsx($e,{className:"h-20 w-full rounded-lg"}),l.jsx($e,{className:"h-20 w-full rounded-lg"})]})]})]})}function Px(t,a=3,o=1e3){return t().catch(r=>{if(a<=0)throw r;return new Promise(c=>setTimeout(c,o)).then(()=>Px(t,a-1,o*2))})}function Na(t){return C.lazy(()=>Px(t))}const sb=Na(()=>tt(()=>import("./index-BGuD2ZzA.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),lb=Na(()=>tt(()=>import("./index-DS_mOUz0.js"),__vite__mapDeps([10,1,2,11,4,5,6,7,8,9]))),cb=Na(()=>tt(()=>import("./index-DXnvUKiV.js"),__vite__mapDeps([12,1,2,4,5,6,7,8,9]))),ub=Na(()=>tt(()=>import("./channels-Cu60Cd8-.js"),__vite__mapDeps([13,1,2,4,5,6,7,8,9]))),db=Na(()=>tt(()=>import("./globalenv-section-CId2zBTe.js"),__vite__mapDeps([14,1,2,4,5,6,7,8,9]))),hb=Na(()=>tt(()=>import("./index-G4oOKx1a.js"),__vite__mapDeps([15,1,2,4,5,6,7,8,9]))),fb=Na(()=>tt(()=>import("./index-QAYRGqq3.js"),__vite__mapDeps([16,1,2,17,4,18,19,5,6,20,7,8,9]))),pb=Na(()=>tt(()=>import("./auth-section-BOvKd0Sl.js"),__vite__mapDeps([21,1,2,4,5,6,7,8,9]))),gb=Na(()=>tt(()=>import("./backups-section-BktH4gXP.js"),__vite__mapDeps([22,1,2,19,4,5,6,7,8,9])));class mb extends C.Component{constructor(a){super(a),this.state={hasError:!1,error:null}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}render(){return this.state.hasError?l.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:l.jsxs("div",{className:"text-center p-6 max-w-md",children:[l.jsx(Kr,{className:"w-12 h-12 mx-auto mb-4 text-destructive"}),l.jsx("p",{className:"font-medium text-foreground mb-2",children:ie.t("settings.sectionLoadFailed")}),l.jsx("p",{className:"text-sm mb-4",children:this.state.error?.message||ie.t("settings.unknownError")}),l.jsxs(st,{variant:"outline",onClick:()=>window.location.reload(),className:"inline-flex items-center gap-2",children:[l.jsx(qr,{className:"w-4 h-4"}),ie.t("settings.reloadPage")]})]})}):this.props.children}}function UL(t){switch(t?.toLowerCase()){case"browser":return"browser";case"imageanalysis":case"image":return"image";case"channels":return"channels";case"globalenv":return"globalenv";case"proxy":return"proxy";case"auth":return"auth";case"thinking":return"thinking";case"backups":return"backups";default:return"websearch"}}function HL(){const{t}=ye(),{setActiveTab:a}=IL(),[o]=Vb(),r=UL(o.get("tab")),{rawConfig:c,loading:d,copied:h,fetchRawConfig:p,copyToClipboard:g}=_L();C.useEffect(()=>{p()},[p]);const m=S=>{C.startTransition(()=>{a(S)})};return l.jsxs("div",{className:"h-full min-h-0",children:[l.jsxs("div",{className:"md:hidden h-full flex flex-col",children:[l.jsx("div",{className:"border-b bg-background p-4",children:l.jsx(ob,{activeTab:r,onTabChange:m})}),l.jsx(mb,{children:l.jsxs(C.Suspense,{fallback:l.jsx(rb,{}),children:[r==="browser"&&l.jsx(lb,{}),r==="websearch"&&l.jsx(sb,{}),r==="image"&&l.jsx(cb,{}),r==="channels"&&l.jsx(ub,{}),r==="globalenv"&&l.jsx(db,{}),r==="thinking"&&l.jsx(hb,{}),r==="proxy"&&l.jsx(fb,{}),r==="auth"&&l.jsx(pb,{}),r==="backups"&&l.jsx(gb,{})]})})]}),l.jsxs(Rh,{direction:"horizontal",className:"h-full hidden md:flex",children:[l.jsx(Vr,{defaultSize:46,minSize:36,maxSize:62,children:l.jsxs("div",{className:"h-full border-r flex flex-col bg-muted/30 relative",children:[l.jsx("div",{className:"p-5 border-b bg-background",children:l.jsx(ob,{activeTab:r,onTabChange:m})}),l.jsx(mb,{children:l.jsxs(C.Suspense,{fallback:l.jsx(rb,{}),children:[r==="browser"&&l.jsx(lb,{}),r==="websearch"&&l.jsx(sb,{}),r==="image"&&l.jsx(cb,{}),r==="channels"&&l.jsx(ub,{}),r==="globalenv"&&l.jsx(db,{}),r==="thinking"&&l.jsx(hb,{}),r==="proxy"&&l.jsx(fb,{}),r==="auth"&&l.jsx(pb,{}),r==="backups"&&l.jsx(gb,{})]})})]})}),l.jsx(Oh,{className:"w-2 bg-border hover:bg-primary/20 transition-colors cursor-col-resize flex items-center justify-center group",children:l.jsx(_l,{className:"w-3 h-3 text-muted-foreground group-hover:text-primary"})}),l.jsx(Vr,{defaultSize:54,minSize:35,children:l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Gm,{className:"w-5 h-5 text-primary"}),l.jsxs("div",{children:[l.jsx("h2",{className:"font-semibold",children:"config.yaml"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"~/.ccs/config.yaml"})]})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(st,{variant:"outline",size:"sm",onClick:g,disabled:!c,children:h?l.jsxs(l.Fragment,{children:[l.jsx(No,{className:"w-4 h-4 mr-1"}),t("settings.copied")]}):l.jsxs(l.Fragment,{children:[l.jsx(Al,{className:"w-4 h-4 mr-1"}),t("settings.copy")]})}),l.jsx(st,{variant:"outline",size:"sm",onClick:p,disabled:d,children:l.jsx(qr,{className:`w-4 h-4 ${d?"animate-spin":""}`})})]})]}),l.jsx("div",{className:"flex-1 overflow-auto",children:c?l.jsx(Dx,{value:c,onChange:()=>{},language:"yaml",readonly:!0,minHeight:"auto",className:"min-h-full"}):d?l.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:[l.jsx(qr,{className:"w-5 h-5 animate-spin mr-2"}),t("settings.loading")]}):l.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:l.jsxs("div",{className:"text-center",children:[l.jsx(Gm,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),l.jsx("p",{children:t("settings.configFileNotFound")}),l.jsx("code",{className:"text-sm bg-muted px-2 py-1 rounded mt-2 inline-block",children:"ccs migrate"})]})})})]})})]})]})}function zL(){return l.jsx(RL,{children:l.jsx(HL,{})})}const BL=Object.freeze(Object.defineProperty({__proto__:null,SettingsPage:zL},Symbol.toStringTag,{value:"Module"}));function FL(t,a,o="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:o}).format(a).split(/\s/g).slice(2).join(" ")}const qL={},Ir={};function Ai(t,a){try{const r=(qL[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(a).split("GMT")[1];return r in Ir?Ir[r]:yb(r,r.split(":"))}catch{if(t in Ir)return Ir[t];const o=t?.match(KL);return o?yb(t,o.slice(1)):NaN}}const KL=/([+-]\d\d):?(\d\d)?/;function yb(t,a){const o=+(a[0]||0),r=+(a[1]||0),c=+(a[2]||0)/60;return Ir[t]=o*60+r>0?o*60+r+c:o*60-r-c}class Kn extends Date{constructor(...a){super(),a.length>1&&typeof a[a.length-1]=="string"&&(this.timeZone=a.pop()),this.internal=new Date,isNaN(Ai(this.timeZone,this))?this.setTime(NaN):a.length?typeof a[0]=="number"&&(a.length===1||a.length===2&&typeof a[1]!="number")?this.setTime(a[0]):typeof a[0]=="string"?this.setTime(+new Date(a[0])):a[0]instanceof Date?this.setTime(+a[0]):(this.setTime(+new Date(...a)),Mx(this),th(this)):this.setTime(Date.now())}static tz(a,...o){return o.length?new Kn(...o,a):new Kn(Date.now(),a)}withTimeZone(a){return new Kn(+this,a)}getTimezoneOffset(){const a=-Ai(this.timeZone,this);return a>0?Math.floor(a):Math.ceil(a)}setTime(a){return Date.prototype.setTime.apply(this,arguments),th(this),+this}[Symbol.for("constructDateFrom")](a){return new Kn(+new Date(a),this.timeZone)}}const bb=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!bb.test(t))return;const a=t.replace(bb,"$1UTC");Kn.prototype[a]&&(t.startsWith("get")?Kn.prototype[t]=function(){return this.internal[a]()}:(Kn.prototype[t]=function(){return Date.prototype[a].apply(this.internal,arguments),GL(this),+this},Kn.prototype[a]=function(){return Date.prototype[a].apply(this,arguments),th(this),+this}))});function th(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-Ai(t.timeZone,t)*60))}function GL(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),Mx(t)}function Mx(t){const a=Ai(t.timeZone,t),o=a>0?Math.floor(a):Math.ceil(a),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const c=-new Date(+t).getTimezoneOffset(),d=-new Date(+r).getTimezoneOffset(),h=c-d,p=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();h&&p&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+h);const g=c-o;g&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+g);const m=new Date(+t);m.setUTCSeconds(0);const S=c>0?m.getSeconds():(m.getSeconds()-60)%60,b=Math.round(-(Ai(t.timeZone,t)*60))%60;(b||S)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+b),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+b+S));const x=Ai(t.timeZone,t),T=x>0?Math.floor(x):Math.ceil(x),M=-new Date(+t).getTimezoneOffset()-T,j=T!==o,E=M-g;if(j&&E){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+E);const D=Ai(t.timeZone,t),N=D>0?Math.floor(D):Math.ceil(D),A=T-N;A&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+A),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+A))}}class va extends Kn{static tz(a,...o){return o.length?new va(...o,a):new va(Date.now(),a)}toISOString(){const[a,o,r]=this.tzComponents(),c=`${a}${o}:${r}`;return this.internal.toISOString().slice(0,-1)+c}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[a,o,r,c]=this.internal.toUTCString().split(" ");return`${a?.slice(0,-1)} ${r} ${o} ${c}`}toTimeString(){const a=this.internal.toUTCString().split(" ")[4],[o,r,c]=this.tzComponents();return`${a} GMT${o}${r}${c} (${FL(this.timeZone,this)})`}toLocaleString(a,o){return Date.prototype.toLocaleString.call(this,a,{...o,timeZone:o?.timeZone||this.timeZone})}toLocaleDateString(a,o){return Date.prototype.toLocaleDateString.call(this,a,{...o,timeZone:o?.timeZone||this.timeZone})}toLocaleTimeString(a,o){return Date.prototype.toLocaleTimeString.call(this,a,{...o,timeZone:o?.timeZone||this.timeZone})}tzComponents(){const a=this.getTimezoneOffset(),o=a>0?"-":"+",r=String(Math.floor(Math.abs(a)/60)).padStart(2,"0"),c=String(Math.abs(a)%60).padStart(2,"0");return[o,r,c]}withTimeZone(a){return new va(+this,a)}[Symbol.for("constructDateFrom")](a){return new va(+new Date(a),this.timeZone)}}const vb=5,VL=4;function YL(t,a){const o=a.startOfMonth(t),r=o.getDay()>0?o.getDay():7,c=a.addDays(t,-r+1),d=a.addDays(c,vb*7-1);return a.getMonth(t)===a.getMonth(d)?vb:VL}function Lx(t,a){const o=a.startOfMonth(t),r=o.getDay();return r===1?o:r===0?a.addDays(o,-6):a.addDays(o,-1*(r-1))}function WL(t,a){const o=Lx(t,a),r=YL(t,a);return a.addDays(o,r*7-1)}const Ex={...Nr,labels:{labelDayButton:(t,a,o,r)=>{let c;r&&typeof r.format=="function"?c=r.format.bind(r):c=(h,p)=>Lr(h,p,{locale:Nr,...o});let d=c(t,"PPPP");return a.today&&(d=`Today, ${d}`),a.selected&&(d=`${d}, selected`),d},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:t=>`Week ${t}`,labelYearDropdown:"Choose the Year",labelGrid:(t,a,o)=>{let r;return o&&typeof o.format=="function"?r=o.format.bind(o):r=(c,d)=>Lr(c,d,{locale:Nr,...a}),r(t,"LLLL yyyy")},labelGridcell:(t,a,o,r)=>{let c;r&&typeof r.format=="function"?c=r.format.bind(r):c=(h,p)=>Lr(h,p,{locale:Nr,...o});let d=c(t,"PPPP");return a?.today&&(d=`Today, ${d}`),d},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(t,a,o)=>{let r;return o&&typeof o.format=="function"?r=o.format.bind(o):r=(c,d)=>Lr(c,d,{locale:Nr,...a}),r(t,"cccc")}}};class fn{constructor(a,o){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?va.tz(this.options.timeZone):new this.Date,this.newDate=(r,c,d)=>this.overrides?.newDate?this.overrides.newDate(r,c,d):this.options.timeZone?new va(r,c,d,this.options.timeZone):new Date(r,c,d),this.addDays=(r,c)=>this.overrides?.addDays?this.overrides.addDays(r,c):Pw(r,c),this.addMonths=(r,c)=>this.overrides?.addMonths?this.overrides.addMonths(r,c):Mw(r,c),this.addWeeks=(r,c)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,c):Lw(r,c),this.addYears=(r,c)=>this.overrides?.addYears?this.overrides.addYears(r,c):Ew(r,c),this.differenceInCalendarDays=(r,c)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,c):jw(r,c),this.differenceInCalendarMonths=(r,c)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,c):Rw(r,c),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Ow(r),this.eachYearOfInterval=r=>{const c=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Iw(r),d=new Set(c.map(p=>this.getYear(p)));if(d.size===c.length)return c;const h=[];return d.forEach(p=>{h.push(new Date(p,0,1))}),h},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):WL(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):_w(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):Uw(r),this.endOfWeek=(r,c)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,c):Hw(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):zw(r),this.format=(r,c,d)=>{const h=this.overrides?.format?this.overrides.format(r,c,this.options):Lr(r,c,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(h):h},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):Bw(r),this.getMonth=(r,c)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Fw(r,this.options),this.getYear=(r,c)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):qw(r,this.options),this.getWeek=(r,c)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):Kw(r,this.options),this.isAfter=(r,c)=>this.overrides?.isAfter?this.overrides.isAfter(r,c):Gw(r,c),this.isBefore=(r,c)=>this.overrides?.isBefore?this.overrides.isBefore(r,c):Vw(r,c),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):Yw(r),this.isSameDay=(r,c)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,c):Ww(r,c),this.isSameMonth=(r,c)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,c):Qw(r,c),this.isSameYear=(r,c)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,c):$w(r,c),this.max=r=>this.overrides?.max?this.overrides.max(r):Xw(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Jw(r),this.setMonth=(r,c)=>this.overrides?.setMonth?this.overrides.setMonth(r,c):Zw(r,c),this.setYear=(r,c)=>this.overrides?.setYear?this.overrides.setYear(r,c):ek(r,c),this.startOfBroadcastWeek=(r,c)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):Lx(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):tk(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):nk(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):ak(r),this.startOfWeek=(r,c)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):ik(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):ok(r),this.options={locale:Ex,...a},this.overrides=o}getDigitMap(){const{numerals:a="latn"}=this.options,o=new Intl.NumberFormat("en-US",{numberingSystem:a}),r={};for(let c=0;c<10;c++)r[c.toString()]=o.format(c);return r}replaceDigits(a){const o=this.getDigitMap();return a.replace(/\d/g,r=>o[r]||r)}formatNumber(a){return this.replaceDigits(a.toString())}getMonthYearOrder(){const a=this.options.locale?.code;return a&&fn.yearFirstLocales.has(a)?"year-first":"month-first"}formatMonthYear(a){const{locale:o,timeZone:r,numerals:c}=this.options,d=o?.code;if(d&&fn.yearFirstLocales.has(d))try{return new Intl.DateTimeFormat(d,{month:"long",year:"numeric",timeZone:r,numberingSystem:c}).format(a)}catch{}const h=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(a,h)}}fn.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 Yn=new fn;class jx{constructor(a,o,r=Yn){this.date=a,this.displayMonth=o,this.outside=!!(o&&!r.isSameMonth(a,o)),this.dateLib=r,this.isoDate=r.format(a,"yyyy-MM-dd"),this.displayMonthId=r.format(o,"yyyy-MM"),this.dateMonthId=r.format(a,"yyyy-MM")}isEqualTo(a){return this.dateLib.isSameDay(a.date,this.date)&&this.dateLib.isSameMonth(a.displayMonth,this.displayMonth)}}class QL{constructor(a,o){this.date=a,this.weeks=o}}class $L{constructor(a,o){this.days=o,this.weekNumber=a}}function XL(t){return ue.createElement("button",{...t})}function JL(t){return ue.createElement("span",{...t})}function ZL(t){const{size:a=24,orientation:o="left",className:r}=t;return ue.createElement("svg",{className:r,width:a,height:a,viewBox:"0 0 24 24"},o==="up"&&ue.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),o==="down"&&ue.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),o==="left"&&ue.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),o==="right"&&ue.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function e1(t){const{day:a,modifiers:o,...r}=t;return ue.createElement("td",{...r})}function t1(t){const{day:a,modifiers:o,...r}=t,c=ue.useRef(null);return ue.useEffect(()=>{o.focused&&c.current?.focus()},[o.focused]),ue.createElement("button",{ref:c,...r})}var Ce;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(Ce||(Ce={}));var pt;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(pt||(pt={}));var En;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(En||(En={}));var hn;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(hn||(hn={}));function n1(t){const{options:a,className:o,components:r,classNames:c,...d}=t,h=[c[Ce.Dropdown],o].join(" "),p=a?.find(({value:g})=>g===d.value);return ue.createElement("span",{"data-disabled":d.disabled,className:c[Ce.DropdownRoot]},ue.createElement(r.Select,{className:h,...d},a?.map(({value:g,label:m,disabled:S})=>ue.createElement(r.Option,{key:g,value:g,disabled:S},m))),ue.createElement("span",{className:c[Ce.CaptionLabel],"aria-hidden":!0},p?.label,ue.createElement(r.Chevron,{orientation:"down",size:18,className:c[Ce.Chevron]})))}function a1(t){return ue.createElement("div",{...t})}function i1(t){return ue.createElement("div",{...t})}function o1(t){const{calendarMonth:a,displayIndex:o,...r}=t;return ue.createElement("div",{...r},t.children)}function r1(t){const{calendarMonth:a,displayIndex:o,...r}=t;return ue.createElement("div",{...r})}function s1(t){return ue.createElement("table",{...t})}function l1(t){return ue.createElement("div",{...t})}const Rx=C.createContext(void 0);function es(){const t=C.useContext(Rx);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function c1(t){const{components:a}=es();return ue.createElement(a.Dropdown,{...t})}function u1(t){const{onPreviousClick:a,onNextClick:o,previousMonth:r,nextMonth:c,...d}=t,{components:h,classNames:p,labels:{labelPrevious:g,labelNext:m}}=es(),S=C.useCallback(x=>{c&&o?.(x)},[c,o]),b=C.useCallback(x=>{r&&a?.(x)},[r,a]);return ue.createElement("nav",{...d},ue.createElement(h.PreviousMonthButton,{type:"button",className:p[Ce.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":g(r),onClick:b},ue.createElement(h.Chevron,{disabled:r?void 0:!0,className:p[Ce.Chevron],orientation:"left"})),ue.createElement(h.NextMonthButton,{type:"button",className:p[Ce.NextMonthButton],tabIndex:c?void 0:-1,"aria-disabled":c?void 0:!0,"aria-label":m(c),onClick:S},ue.createElement(h.Chevron,{disabled:c?void 0:!0,orientation:"right",className:p[Ce.Chevron]})))}function d1(t){const{components:a}=es();return ue.createElement(a.Button,{...t})}function h1(t){return ue.createElement("option",{...t})}function f1(t){const{components:a}=es();return ue.createElement(a.Button,{...t})}function p1(t){const{rootRef:a,...o}=t;return ue.createElement("div",{...o,ref:a})}function g1(t){return ue.createElement("select",{...t})}function m1(t){const{week:a,...o}=t;return ue.createElement("tr",{...o})}function y1(t){return ue.createElement("th",{...t})}function b1(t){return ue.createElement("thead",{"aria-hidden":!0},ue.createElement("tr",{...t}))}function v1(t){const{week:a,...o}=t;return ue.createElement("th",{...o})}function x1(t){return ue.createElement("th",{...t})}function C1(t){return ue.createElement("tbody",{...t})}function S1(t){const{components:a}=es();return ue.createElement(a.Dropdown,{...t})}const w1=Object.freeze(Object.defineProperty({__proto__:null,Button:XL,CaptionLabel:JL,Chevron:ZL,Day:e1,DayButton:t1,Dropdown:n1,DropdownNav:a1,Footer:i1,Month:o1,MonthCaption:r1,MonthGrid:s1,Months:l1,MonthsDropdown:c1,Nav:u1,NextMonthButton:d1,Option:h1,PreviousMonthButton:f1,Root:p1,Select:g1,Week:m1,WeekNumber:v1,WeekNumberHeader:x1,Weekday:y1,Weekdays:b1,Weeks:C1,YearsDropdown:S1},Symbol.toStringTag,{value:"Module"}));function xa(t,a,o=!1,r=Yn){let{from:c,to:d}=t;const{differenceInCalendarDays:h,isSameDay:p}=r;return c&&d?(h(d,c)<0&&([c,d]=[d,c]),h(a,c)>=(o?1:0)&&h(d,a)>=(o?1:0)):!o&&d?p(d,a):!o&&c?p(c,a):!1}function Kh(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function ec(t){return!!(t&&typeof t=="object"&&"from"in t)}function Gh(t){return!!(t&&typeof t=="object"&&"after"in t)}function Vh(t){return!!(t&&typeof t=="object"&&"before"in t)}function Ox(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function Ix(t,a){return Array.isArray(t)&&t.every(a.isDate)}function Ca(t,a,o=Yn){const r=Array.isArray(a)?a:[a],{isSameDay:c,differenceInCalendarDays:d,isAfter:h}=o;return r.some(p=>{if(typeof p=="boolean")return p;if(o.isDate(p))return c(t,p);if(Ix(p,o))return p.some(g=>c(t,g));if(ec(p))return xa(p,t,!1,o);if(Ox(p))return Array.isArray(p.dayOfWeek)?p.dayOfWeek.includes(t.getDay()):p.dayOfWeek===t.getDay();if(Kh(p)){const g=d(p.before,t),m=d(p.after,t),S=g>0,b=m<0;return h(p.before,p.after)?b&&S:S||b}return Gh(p)?d(t,p.after)>0:Vh(p)?d(p.before,t)>0:typeof p=="function"?p(t):!1})}function k1(t,a,o,r,c){const{disabled:d,hidden:h,modifiers:p,showOutsideDays:g,broadcastCalendar:m,today:S=c.today()}=a,{isSameDay:b,isSameMonth:x,startOfMonth:T,isBefore:w,endOfMonth:M,isAfter:j}=c,E=o&&T(o),D=r&&M(r),N={[pt.focused]:[],[pt.outside]:[],[pt.disabled]:[],[pt.hidden]:[],[pt.today]:[]},A={};for(const P of t){const{date:k,displayMonth:O}=P,U=!!(O&&!x(k,O)),_=!!(E&&w(k,E)),K=!!(D&&j(k,D)),ee=!!(d&&Ca(k,d,c)),Y=!!(h&&Ca(k,h,c))||_||K||!m&&!g&&U||m&&g===!1&&U,$=b(k,S);U&&N.outside.push(P),ee&&N.disabled.push(P),Y&&N.hidden.push(P),$&&N.today.push(P),p&&Object.keys(p).forEach(fe=>{const pe=p?.[fe];pe&&Ca(k,pe,c)&&(A[fe]?A[fe].push(P):A[fe]=[P])})}return P=>{const k={[pt.focused]:!1,[pt.disabled]:!1,[pt.hidden]:!1,[pt.outside]:!1,[pt.today]:!1},O={};for(const U in N){const _=N[U];k[U]=_.some(K=>K===P)}for(const U in A)O[U]=A[U].some(_=>_===P);return{...k,...O}}}function A1(t,a,o={}){return Object.entries(t).filter(([,c])=>c===!0).reduce((c,[d])=>(o[d]?c.push(o[d]):a[pt[d]]?c.push(a[pt[d]]):a[En[d]]&&c.push(a[En[d]]),c),[a[Ce.Day]])}function D1(t){return{...w1,...t}}function N1(t){const a={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([o,r])=>{o.startsWith("data-")&&(a[o]=r)}),a}function T1(){const t={};for(const a in Ce)t[Ce[a]]=`rdp-${Ce[a]}`;for(const a in pt)t[pt[a]]=`rdp-${pt[a]}`;for(const a in En)t[En[a]]=`rdp-${En[a]}`;for(const a in hn)t[hn[a]]=`rdp-${hn[a]}`;return t}function _x(t,a,o){return(o??new fn(a)).formatMonthYear(t)}const P1=_x;function M1(t,a,o){return(o??new fn(a)).format(t,"d")}function L1(t,a=Yn){return a.format(t,"LLLL")}function E1(t,a,o){return(o??new fn(a)).format(t,"cccccc")}function j1(t,a=Yn){return t<10?a.formatNumber(`0${t.toLocaleString()}`):a.formatNumber(`${t.toLocaleString()}`)}function R1(){return""}function Ux(t,a=Yn){return a.format(t,"yyyy")}const O1=Ux,I1=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:_x,formatDay:M1,formatMonthCaption:P1,formatMonthDropdown:L1,formatWeekNumber:j1,formatWeekNumberHeader:R1,formatWeekdayName:E1,formatYearCaption:O1,formatYearDropdown:Ux},Symbol.toStringTag,{value:"Module"}));function _1(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...I1,...t}}function Yh(t,a,o,r){let c=(r??new fn(o)).format(t,"PPPP");return a.today&&(c=`Today, ${c}`),a.selected&&(c=`${c}, selected`),c}const U1=Yh;function Wh(t,a,o){return(o??new fn(a)).formatMonthYear(t)}const H1=Wh;function Hx(t,a,o,r){let c=(r??new fn(o)).format(t,"PPPP");return a?.today&&(c=`Today, ${c}`),c}function zx(t){return"Choose the Month"}function Bx(){return""}const z1="Go to the Next Month";function Fx(t,a){return z1}function qx(t){return"Go to the Previous Month"}function Kx(t,a,o){return(o??new fn(a)).format(t,"cccc")}function Gx(t,a){return`Week ${t}`}function Vx(t){return"Week Number"}function Yx(t){return"Choose the Year"}const B1=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:H1,labelDay:U1,labelDayButton:Yh,labelGrid:Wh,labelGridcell:Hx,labelMonthDropdown:zx,labelNav:Bx,labelNext:Fx,labelPrevious:qx,labelWeekNumber:Gx,labelWeekNumberHeader:Vx,labelWeekday:Kx,labelYearDropdown:Yx},Symbol.toStringTag,{value:"Module"})),Ln=(t,a,o)=>a||(o?typeof o=="function"?o:(...r)=>o:t);function F1(t,a){const o=a.locale?.labels??{};return{...B1,...t??{},labelDayButton:Ln(Yh,t?.labelDayButton,o.labelDayButton),labelMonthDropdown:Ln(zx,t?.labelMonthDropdown,o.labelMonthDropdown),labelNext:Ln(Fx,t?.labelNext,o.labelNext),labelPrevious:Ln(qx,t?.labelPrevious,o.labelPrevious),labelWeekNumber:Ln(Gx,t?.labelWeekNumber,o.labelWeekNumber),labelYearDropdown:Ln(Yx,t?.labelYearDropdown,o.labelYearDropdown),labelGrid:Ln(Wh,t?.labelGrid,o.labelGrid),labelGridcell:Ln(Hx,t?.labelGridcell,o.labelGridcell),labelNav:Ln(Bx,t?.labelNav,o.labelNav),labelWeekNumberHeader:Ln(Vx,t?.labelWeekNumberHeader,o.labelWeekNumberHeader),labelWeekday:Ln(Kx,t?.labelWeekday,o.labelWeekday)}}function q1(t,a,o,r,c){const{startOfMonth:d,startOfYear:h,endOfYear:p,eachMonthOfInterval:g,getMonth:m}=c;return g({start:h(t),end:p(t)}).map(x=>{const T=r.formatMonthDropdown(x,c),w=m(x),M=a&&x<d(a)||o&&x>d(o)||!1;return{value:w,label:T,disabled:M}})}function K1(t,a={},o={}){let r={...a?.[Ce.Day]};return Object.entries(t).filter(([,c])=>c===!0).forEach(([c])=>{r={...r,...o?.[c]}}),r}function G1(t,a,o,r){const c=r??t.today(),d=o?t.startOfBroadcastWeek(c,t):a?t.startOfISOWeek(c):t.startOfWeek(c),h=[];for(let p=0;p<7;p++){const g=t.addDays(d,p);h.push(g)}return h}function V1(t,a,o,r,c=!1){if(!t||!a)return;const{startOfYear:d,endOfYear:h,eachYearOfInterval:p,getYear:g}=r,m=d(t),S=h(a),b=p({start:m,end:S});return c&&b.reverse(),b.map(x=>{const T=o.formatYearDropdown(x,r);return{value:g(x),label:T,disabled:!1}})}const ts=t=>t instanceof HTMLElement?t:null,jd=t=>[...t.querySelectorAll("[data-animated-month]")??[]],Y1=t=>ts(t.querySelector("[data-animated-month]")),Rd=t=>ts(t.querySelector("[data-animated-caption]")),Od=t=>ts(t.querySelector("[data-animated-weeks]")),W1=t=>ts(t.querySelector("[data-animated-nav]")),Q1=t=>ts(t.querySelector("[data-animated-weekdays]"));function $1(t,a,{classNames:o,months:r,focused:c,dateLib:d}){const h=C.useRef(null),p=C.useRef(r),g=C.useRef(!1);C.useLayoutEffect(()=>{const m=p.current;if(p.current=r,!a||!t.current||!(t.current instanceof HTMLElement)||r.length===0||m.length===0||r.length!==m.length)return;const S=d.isSameMonth(r[0].date,m[0].date),b=d.isAfter(r[0].date,m[0].date),x=b?o[hn.caption_after_enter]:o[hn.caption_before_enter],T=b?o[hn.weeks_after_enter]:o[hn.weeks_before_enter],w=h.current,M=t.current.cloneNode(!0);if(M instanceof HTMLElement?(jd(M).forEach(N=>{if(!(N instanceof HTMLElement))return;const A=Y1(N);A&&N.contains(A)&&N.removeChild(A);const P=Rd(N);P&&P.classList.remove(x);const k=Od(N);k&&k.classList.remove(T)}),h.current=M):h.current=null,g.current||S||c)return;const j=w instanceof HTMLElement?jd(w):[],E=jd(t.current);if(E?.every(D=>D instanceof HTMLElement)&&j&&j.every(D=>D instanceof HTMLElement)){g.current=!0,t.current.style.isolation="isolate";const D=W1(t.current);D&&(D.style.zIndex="1"),E.forEach((N,A)=>{const P=j[A];if(!P)return;N.style.position="relative",N.style.overflow="hidden";const k=Rd(N);k&&k.classList.add(x);const O=Od(N);O&&O.classList.add(T);const U=()=>{g.current=!1,t.current&&(t.current.style.isolation=""),D&&(D.style.zIndex=""),k&&k.classList.remove(x),O&&O.classList.remove(T),N.style.position="",N.style.overflow="",N.contains(P)&&N.removeChild(P)};P.style.pointerEvents="none",P.style.position="absolute",P.style.overflow="hidden",P.setAttribute("aria-hidden","true");const _=Q1(P);_&&(_.style.opacity="0");const K=Rd(P);K&&(K.classList.add(b?o[hn.caption_before_exit]:o[hn.caption_after_exit]),K.addEventListener("animationend",U));const ee=Od(P);ee&&ee.classList.add(b?o[hn.weeks_before_exit]:o[hn.weeks_after_exit]),N.insertBefore(P,N.firstChild)})}})}function X1(t,a,o,r){const c=t[0],d=t[t.length-1],{ISOWeek:h,fixedWeeks:p,broadcastCalendar:g}=o??{},{addDays:m,differenceInCalendarDays:S,differenceInCalendarMonths:b,endOfBroadcastWeek:x,endOfISOWeek:T,endOfMonth:w,endOfWeek:M,isAfter:j,startOfBroadcastWeek:E,startOfISOWeek:D,startOfWeek:N}=r,A=g?E(c,r):h?D(c):N(c),P=g?x(d):h?T(w(d)):M(w(d)),k=a&&(g?x(a):h?T(a):M(a)),O=k&&j(P,k)?k:P,U=S(O,A),_=b(d,c)+1,K=[];for(let $=0;$<=U;$++){const fe=m(A,$);K.push(fe)}const Y=(g?35:42)*_;if(p&&K.length<Y){const $=Y-K.length;for(let fe=0;fe<$;fe++){const pe=m(K[K.length-1],1);K.push(pe)}}return K}function J1(t){const a=[];return t.reduce((o,r)=>{const c=r.weeks.reduce((d,h)=>d.concat(h.days.slice()),a.slice());return o.concat(c.slice())},a.slice())}function Z1(t,a,o,r){const{numberOfMonths:c=1}=o,d=[];for(let h=0;h<c;h++){const p=r.addMonths(t,h);if(a&&p>a)break;d.push(p)}return d}function xb(t,a,o,r){const{month:c,defaultMonth:d,today:h=r.today(),numberOfMonths:p=1}=t;let g=c||d||h;const{differenceInCalendarMonths:m,addMonths:S,startOfMonth:b}=r;if(o&&m(o,g)<p-1){const x=-1*(p-1);g=S(o,x)}return a&&m(g,a)<0&&(g=a),b(g)}function eE(t,a,o,r){const{addDays:c,endOfBroadcastWeek:d,endOfISOWeek:h,endOfMonth:p,endOfWeek:g,getISOWeek:m,getWeek:S,startOfBroadcastWeek:b,startOfISOWeek:x,startOfWeek:T}=r,w=t.reduce((M,j)=>{const E=o.broadcastCalendar?b(j,r):o.ISOWeek?x(j):T(j),D=o.broadcastCalendar?d(j):o.ISOWeek?h(p(j)):g(p(j)),N=a.filter(O=>O>=E&&O<=D),A=o.broadcastCalendar?35:42;if(o.fixedWeeks&&N.length<A){const O=a.filter(U=>{const _=A-N.length;return U>D&&U<=c(D,_)});N.push(...O)}const P=N.reduce((O,U)=>{const _=o.ISOWeek?m(U):S(U),K=O.find(Y=>Y.weekNumber===_),ee=new jx(U,j,r);return K?K.days.push(ee):O.push(new $L(_,[ee])),O},[]),k=new QL(j,P);return M.push(k),M},[]);return o.reverseMonths?w.reverse():w}function tE(t,a){let{startMonth:o,endMonth:r}=t;const{startOfYear:c,startOfDay:d,startOfMonth:h,endOfMonth:p,addYears:g,endOfYear:m,newDate:S,today:b}=a,{fromYear:x,toYear:T,fromMonth:w,toMonth:M}=t;!o&&w&&(o=w),!o&&x&&(o=a.newDate(x,0,1)),!r&&M&&(r=M),!r&&T&&(r=S(T,11,31));const j=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return o?o=h(o):x?o=S(x,0,1):!o&&j&&(o=c(g(t.today??b(),-100))),r?r=p(r):T?r=S(T,11,31):!r&&j&&(r=m(t.today??b())),[o&&d(o),r&&d(r)]}function nE(t,a,o,r){if(o.disableNavigation)return;const{pagedNavigation:c,numberOfMonths:d=1}=o,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:g}=r,m=c?d:1,S=h(t);if(!a)return p(S,m);if(!(g(a,t)<d))return p(S,m)}function aE(t,a,o,r){if(o.disableNavigation)return;const{pagedNavigation:c,numberOfMonths:d}=o,{startOfMonth:h,addMonths:p,differenceInCalendarMonths:g}=r,m=c?d??1:1,S=h(t);if(!a)return p(S,-m);if(!(g(S,a)<=0))return p(S,-m)}function iE(t){const a=[];return t.reduce((o,r)=>o.concat(r.weeks.slice()),a.slice())}function tc(t,a){const[o,r]=C.useState(t);return[a===void 0?o:a,r]}function oE(t,a){const[o,r]=tE(t,a),{startOfMonth:c,endOfMonth:d}=a,h=xb(t,o,r,a),[p,g]=tc(h,t.month?h:void 0);C.useEffect(()=>{const A=xb(t,o,r,a);g(A)},[t.timeZone]);const{months:m,weeks:S,days:b,previousMonth:x,nextMonth:T}=C.useMemo(()=>{const A=Z1(p,r,{numberOfMonths:t.numberOfMonths},a),P=X1(A,t.endMonth?d(t.endMonth):void 0,{ISOWeek:t.ISOWeek,fixedWeeks:t.fixedWeeks,broadcastCalendar:t.broadcastCalendar},a),k=eE(A,P,{broadcastCalendar:t.broadcastCalendar,fixedWeeks:t.fixedWeeks,ISOWeek:t.ISOWeek,reverseMonths:t.reverseMonths},a),O=iE(k),U=J1(k),_=aE(p,o,t,a),K=nE(p,r,t,a);return{months:k,weeks:O,days:U,previousMonth:_,nextMonth:K}},[a,p.getTime(),r?.getTime(),o?.getTime(),t.disableNavigation,t.broadcastCalendar,t.endMonth?.getTime(),t.fixedWeeks,t.ISOWeek,t.numberOfMonths,t.pagedNavigation,t.reverseMonths]),{disableNavigation:w,onMonthChange:M}=t,j=A=>S.some(P=>P.days.some(k=>k.isEqualTo(A))),E=A=>{if(w)return;let P=c(A);o&&P<c(o)&&(P=c(o)),r&&P>c(r)&&(P=c(r)),g(P),M?.(P)};return{months:m,weeks:S,days:b,navStart:o,navEnd:r,previousMonth:x,nextMonth:T,goToMonth:E,goToDay:A=>{j(A)||E(A.date)}}}var Fn;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(Fn||(Fn={}));function Cb(t){return!t[pt.disabled]&&!t[pt.hidden]&&!t[pt.outside]}function rE(t,a,o,r){let c,d=-1;for(const h of t){const p=a(h);Cb(p)&&(p[pt.focused]&&d<Fn.FocusedModifier?(c=h,d=Fn.FocusedModifier):r?.isEqualTo(h)&&d<Fn.LastFocused?(c=h,d=Fn.LastFocused):o(h.date)&&d<Fn.Selected?(c=h,d=Fn.Selected):p[pt.today]&&d<Fn.Today&&(c=h,d=Fn.Today))}return c||(c=t.find(h=>Cb(a(h)))),c}function sE(t,a,o,r,c,d,h){const{ISOWeek:p,broadcastCalendar:g}=d,{addDays:m,addMonths:S,addWeeks:b,addYears:x,endOfBroadcastWeek:T,endOfISOWeek:w,endOfWeek:M,max:j,min:E,startOfBroadcastWeek:D,startOfISOWeek:N,startOfWeek:A}=h;let k={day:m,week:b,month:S,year:x,startOfWeek:O=>g?D(O,h):p?N(O):A(O),endOfWeek:O=>g?T(O):p?w(O):M(O)}[t](o,a==="after"?1:-1);return a==="before"&&r?k=j([r,k]):a==="after"&&c&&(k=E([c,k])),k}function Wx(t,a,o,r,c,d,h,p=0){if(p>365)return;const g=sE(t,a,o.date,r,c,d,h),m=!!(d.disabled&&Ca(g,d.disabled,h)),S=!!(d.hidden&&Ca(g,d.hidden,h)),b=g,x=new jx(g,b,h);return!m&&!S?x:Wx(t,a,x,r,c,d,h,p+1)}function lE(t,a,o,r,c){const{autoFocus:d}=t,[h,p]=C.useState(),g=rE(a.days,o,r||(()=>!1),h),[m,S]=C.useState(d?g:void 0);return{isFocusTarget:M=>!!g?.isEqualTo(M),setFocused:S,focused:m,blur:()=>{p(m),S(void 0)},moveFocus:(M,j)=>{if(!m)return;const E=Wx(M,j,m,a.navStart,a.navEnd,t,c);E&&(t.disableNavigation&&!a.days.some(N=>N.isEqualTo(E))||(a.goToDay(E),S(E)))}}}function cE(t,a){const{selected:o,required:r,onSelect:c}=t,[d,h]=tc(o,c?o:void 0),p=c?o:d,{isSameDay:g}=a,m=T=>p?.some(w=>g(w,T))??!1,{min:S,max:b}=t;return{selected:p,select:(T,w,M)=>{let j=[...p??[]];if(m(T)){if(p?.length===S||r&&p?.length===1)return;j=p?.filter(E=>!g(E,T))}else p?.length===b?j=[T]:j=[...j,T];return c||h(j),c?.(j,T,w,M),j},isSelected:m}}function uE(t,a,o=0,r=0,c=!1,d=Yn){const{from:h,to:p}=a||{},{isSameDay:g,isAfter:m,isBefore:S}=d;let b;if(!h&&!p)b={from:t,to:o>0?void 0:t};else if(h&&!p)g(h,t)?o===0?b={from:h,to:t}:c?b={from:h,to:void 0}:b=void 0:S(t,h)?b={from:t,to:h}:b={from:h,to:t};else if(h&&p)if(g(h,t)&&g(p,t))c?b={from:h,to:p}:b=void 0;else if(g(h,t))b={from:h,to:o>0?void 0:t};else if(g(p,t))b={from:t,to:o>0?void 0:t};else if(S(t,h))b={from:t,to:p};else if(m(t,h))b={from:h,to:t};else if(m(t,p))b={from:h,to:t};else throw new Error("Invalid range");if(b?.from&&b?.to){const x=d.differenceInCalendarDays(b.to,b.from);r>0&&x>r?b={from:t,to:void 0}:o>1&&x<o&&(b={from:t,to:void 0})}return b}function dE(t,a,o=Yn){const r=Array.isArray(a)?a:[a];let c=t.from;const d=o.differenceInCalendarDays(t.to,t.from),h=Math.min(d,6);for(let p=0;p<=h;p++){if(r.includes(c.getDay()))return!0;c=o.addDays(c,1)}return!1}function Sb(t,a,o=Yn){return xa(t,a.from,!1,o)||xa(t,a.to,!1,o)||xa(a,t.from,!1,o)||xa(a,t.to,!1,o)}function hE(t,a,o=Yn){const r=Array.isArray(a)?a:[a];if(r.filter(p=>typeof p!="function").some(p=>typeof p=="boolean"?p:o.isDate(p)?xa(t,p,!1,o):Ix(p,o)?p.some(g=>xa(t,g,!1,o)):ec(p)?p.from&&p.to?Sb(t,{from:p.from,to:p.to},o):!1:Ox(p)?dE(t,p.dayOfWeek,o):Kh(p)?o.isAfter(p.before,p.after)?Sb(t,{from:o.addDays(p.after,1),to:o.addDays(p.before,-1)},o):Ca(t.from,p,o)||Ca(t.to,p,o):Gh(p)||Vh(p)?Ca(t.from,p,o)||Ca(t.to,p,o):!1))return!0;const h=r.filter(p=>typeof p=="function");if(h.length){let p=t.from;const g=o.differenceInCalendarDays(t.to,t.from);for(let m=0;m<=g;m++){if(h.some(S=>S(p)))return!0;p=o.addDays(p,1)}}return!1}function fE(t,a){const{disabled:o,excludeDisabled:r,selected:c,required:d,onSelect:h}=t,[p,g]=tc(c,h?c:void 0),m=h?c:p;return{selected:m,select:(x,T,w)=>{const{min:M,max:j}=t,E=x?uE(x,m,M,j,d,a):void 0;return r&&o&&E?.from&&E.to&&hE({from:E.from,to:E.to},o,a)&&(E.from=x,E.to=void 0),h||g(E),h?.(E,x,T,w),E},isSelected:x=>m&&xa(m,x,!1,a)}}function pE(t,a){const{selected:o,required:r,onSelect:c}=t,[d,h]=tc(o,c?o:void 0),p=c?o:d,{isSameDay:g}=a;return{selected:p,select:(b,x,T)=>{let w=b;return!r&&p&&p&&g(b,p)&&(w=void 0),c||h(w),c?.(w,b,x,T),w},isSelected:b=>p?g(p,b):!1}}function gE(t,a){const o=pE(t,a),r=cE(t,a),c=fE(t,a);switch(t.mode){case"single":return o;case"multiple":return r;case"range":return c;default:return}}function Ht(t,a){return t instanceof va&&t.timeZone===a?t:new va(t,a)}function wb(t,a){return typeof t=="boolean"||typeof t=="function"?t:t instanceof Date?Ht(t,a):Array.isArray(t)?t.map(o=>o instanceof Date?Ht(o,a):o):ec(t)?{...t,from:t.from?Ht(t.from,a):t.from,to:t.to?Ht(t.to,a):t.to}:Kh(t)?{before:Ht(t.before,a),after:Ht(t.after,a)}:Gh(t)?{after:Ht(t.after,a)}:Vh(t)?{before:Ht(t.before,a)}:t}function Id(t,a){return t&&(Array.isArray(t)?t.map(o=>wb(o,a)):wb(t,a))}function mE(t){let a=t;const o=a.timeZone;if(o&&(a={...t,timeZone:o},a.today&&(a.today=Ht(a.today,o)),a.month&&(a.month=Ht(a.month,o)),a.defaultMonth&&(a.defaultMonth=Ht(a.defaultMonth,o)),a.startMonth&&(a.startMonth=Ht(a.startMonth,o)),a.endMonth&&(a.endMonth=Ht(a.endMonth,o)),a.mode==="single"&&a.selected?a.selected=Ht(a.selected,o):a.mode==="multiple"&&a.selected?a.selected=a.selected?.map(ve=>Ht(ve,o)):a.mode==="range"&&a.selected&&(a.selected={from:a.selected.from?Ht(a.selected.from,o):a.selected.from,to:a.selected.to?Ht(a.selected.to,o):a.selected.to}),a.disabled!==void 0&&(a.disabled=Id(a.disabled,o)),a.hidden!==void 0&&(a.hidden=Id(a.hidden,o)),a.modifiers)){const ve={};Object.keys(a.modifiers).forEach(Me=>{ve[Me]=Id(a.modifiers?.[Me],o)}),a.modifiers=ve}const{components:r,formatters:c,labels:d,dateLib:h,locale:p,classNames:g}=C.useMemo(()=>{const ve={...Ex,...a.locale},Me=new fn({locale:ve,weekStartsOn:a.broadcastCalendar?1:a.weekStartsOn,firstWeekContainsDate:a.firstWeekContainsDate,useAdditionalWeekYearTokens:a.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:a.useAdditionalDayOfYearTokens,timeZone:a.timeZone,numerals:a.numerals},a.dateLib);return{dateLib:Me,components:D1(a.components),formatters:_1(a.formatters),labels:F1(a.labels,Me.options),locale:ve,classNames:{...T1(),...a.classNames}}},[a.locale,a.broadcastCalendar,a.weekStartsOn,a.firstWeekContainsDate,a.useAdditionalWeekYearTokens,a.useAdditionalDayOfYearTokens,a.timeZone,a.numerals,a.dateLib,a.components,a.formatters,a.labels,a.classNames]);a.today||(a={...a,today:h.today()});const{captionLayout:m,mode:S,navLayout:b,numberOfMonths:x=1,onDayBlur:T,onDayClick:w,onDayFocus:M,onDayKeyDown:j,onDayMouseEnter:E,onDayMouseLeave:D,onNextClick:N,onPrevClick:A,showWeekNumber:P,styles:k}=a,{formatCaption:O,formatDay:U,formatMonthDropdown:_,formatWeekNumber:K,formatWeekNumberHeader:ee,formatWeekdayName:Y,formatYearDropdown:$}=c,fe=oE(a,h),{days:pe,months:H,navStart:Z,navEnd:ne,previousMonth:Q,nextMonth:se,goToMonth:de}=fe,ge=k1(pe,a,Z,ne,h),{isSelected:J,select:ae,selected:he}=gE(a,h)??{},{blur:re,focused:le,isFocusTarget:xe,moveFocus:Pe,setFocused:ze}=lE(a,fe,ge,J??(()=>!1),h),{labelDayButton:Je,labelGridcell:we,labelGrid:Re,labelMonthDropdown:Ve,labelNav:Tt,labelPrevious:jt,labelNext:Wn,labelWeekday:Le,labelWeekNumber:Zt,labelWeekNumberHeader:Rn,labelYearDropdown:en}=d,Ta=C.useMemo(()=>G1(h,a.ISOWeek,a.broadcastCalendar,a.today),[h,a.ISOWeek,a.broadcastCalendar,a.today]),Qn=S!==void 0||w!==void 0,bt=C.useCallback(()=>{Q&&(de(Q),A?.(Q))},[Q,de,A]),tn=C.useCallback(()=>{se&&(de(se),N?.(se))},[de,se,N]),$n=C.useCallback((ve,Me)=>Ae=>{Ae.preventDefault(),Ae.stopPropagation(),ze(ve),!Me.disabled&&(ae?.(ve.date,Me,Ae),w?.(ve.date,Me,Ae))},[ae,w,ze]),ni=C.useCallback((ve,Me)=>Ae=>{ze(ve),M?.(ve.date,Me,Ae)},[M,ze]),On=C.useCallback((ve,Me)=>Ae=>{re(),T?.(ve.date,Me,Ae)},[re,T]),In=C.useCallback((ve,Me)=>Ae=>{const _e={ArrowLeft:[Ae.shiftKey?"month":"day",a.dir==="rtl"?"after":"before"],ArrowRight:[Ae.shiftKey?"month":"day",a.dir==="rtl"?"before":"after"],ArrowDown:[Ae.shiftKey?"year":"week","after"],ArrowUp:[Ae.shiftKey?"year":"week","before"],PageUp:[Ae.shiftKey?"year":"month","before"],PageDown:[Ae.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(_e[Ae.key]){Ae.preventDefault(),Ae.stopPropagation();const[ct,Ne]=_e[Ae.key];Pe(ct,Ne)}j?.(ve.date,Me,Ae)},[Pe,j,a.dir]),Ei=C.useCallback((ve,Me)=>Ae=>{E?.(ve.date,Me,Ae)},[E]),Eo=C.useCallback((ve,Me)=>Ae=>{D?.(ve.date,Me,Ae)},[D]),jo=C.useCallback(ve=>Me=>{const Ae=Number(Me.target.value),_e=h.setMonth(h.startOfMonth(ve),Ae);de(_e)},[h,de]),Xn=C.useCallback(ve=>Me=>{const Ae=Number(Me.target.value),_e=h.setYear(h.startOfMonth(ve),Ae);de(_e)},[h,de]),{className:te,style:Oe}=C.useMemo(()=>({className:[g[Ce.Root],a.className].filter(Boolean).join(" "),style:{...k?.[Ce.Root],...a.style}}),[g,a.className,a.style,k]),ke=N1(a),Ie=C.useRef(null);$1(Ie,!!a.animate,{classNames:g,months:H,focused:le,dateLib:h});const ht={dayPickerProps:a,selected:he,select:ae,isSelected:J,months:H,nextMonth:se,previousMonth:Q,goToMonth:de,getModifiers:ge,components:r,classNames:g,styles:k,labels:d,formatters:c};return ue.createElement(Rx.Provider,{value:ht},ue.createElement(r.Root,{rootRef:a.animate?Ie:void 0,className:te,style:Oe,dir:a.dir,id:a.id,lang:a.lang,nonce:a.nonce,title:a.title,role:a.role,"aria-label":a["aria-label"],"aria-labelledby":a["aria-labelledby"],...ke},ue.createElement(r.Months,{className:g[Ce.Months],style:k?.[Ce.Months]},!a.hideNavigation&&!b&&ue.createElement(r.Nav,{"data-animated-nav":a.animate?"true":void 0,className:g[Ce.Nav],style:k?.[Ce.Nav],"aria-label":Tt(),onPreviousClick:bt,onNextClick:tn,previousMonth:Q,nextMonth:se}),H.map((ve,Me)=>ue.createElement(r.Month,{"data-animated-month":a.animate?"true":void 0,className:g[Ce.Month],style:k?.[Ce.Month],key:Me,displayIndex:Me,calendarMonth:ve},b==="around"&&!a.hideNavigation&&Me===0&&ue.createElement(r.PreviousMonthButton,{type:"button",className:g[Ce.PreviousMonthButton],tabIndex:Q?void 0:-1,"aria-disabled":Q?void 0:!0,"aria-label":jt(Q),onClick:bt,"data-animated-button":a.animate?"true":void 0},ue.createElement(r.Chevron,{disabled:Q?void 0:!0,className:g[Ce.Chevron],orientation:a.dir==="rtl"?"right":"left"})),ue.createElement(r.MonthCaption,{"data-animated-caption":a.animate?"true":void 0,className:g[Ce.MonthCaption],style:k?.[Ce.MonthCaption],calendarMonth:ve,displayIndex:Me},m?.startsWith("dropdown")?ue.createElement(r.DropdownNav,{className:g[Ce.Dropdowns],style:k?.[Ce.Dropdowns]},(()=>{const Ae=m==="dropdown"||m==="dropdown-months"?ue.createElement(r.MonthsDropdown,{key:"month",className:g[Ce.MonthsDropdown],"aria-label":Ve(),classNames:g,components:r,disabled:!!a.disableNavigation,onChange:jo(ve.date),options:q1(ve.date,Z,ne,c,h),style:k?.[Ce.Dropdown],value:h.getMonth(ve.date)}):ue.createElement("span",{key:"month"},_(ve.date,h)),_e=m==="dropdown"||m==="dropdown-years"?ue.createElement(r.YearsDropdown,{key:"year",className:g[Ce.YearsDropdown],"aria-label":en(h.options),classNames:g,components:r,disabled:!!a.disableNavigation,onChange:Xn(ve.date),options:V1(Z,ne,c,h,!!a.reverseYears),style:k?.[Ce.Dropdown],value:h.getYear(ve.date)}):ue.createElement("span",{key:"year"},$(ve.date,h));return h.getMonthYearOrder()==="year-first"?[_e,Ae]:[Ae,_e]})(),ue.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"}},O(ve.date,h.options,h))):ue.createElement(r.CaptionLabel,{className:g[Ce.CaptionLabel],role:"status","aria-live":"polite"},O(ve.date,h.options,h))),b==="around"&&!a.hideNavigation&&Me===x-1&&ue.createElement(r.NextMonthButton,{type:"button",className:g[Ce.NextMonthButton],tabIndex:se?void 0:-1,"aria-disabled":se?void 0:!0,"aria-label":Wn(se),onClick:tn,"data-animated-button":a.animate?"true":void 0},ue.createElement(r.Chevron,{disabled:se?void 0:!0,className:g[Ce.Chevron],orientation:a.dir==="rtl"?"left":"right"})),Me===x-1&&b==="after"&&!a.hideNavigation&&ue.createElement(r.Nav,{"data-animated-nav":a.animate?"true":void 0,className:g[Ce.Nav],style:k?.[Ce.Nav],"aria-label":Tt(),onPreviousClick:bt,onNextClick:tn,previousMonth:Q,nextMonth:se}),ue.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":S==="multiple"||S==="range","aria-label":Re(ve.date,h.options,h)||void 0,className:g[Ce.MonthGrid],style:k?.[Ce.MonthGrid]},!a.hideWeekdays&&ue.createElement(r.Weekdays,{"data-animated-weekdays":a.animate?"true":void 0,className:g[Ce.Weekdays],style:k?.[Ce.Weekdays]},P&&ue.createElement(r.WeekNumberHeader,{"aria-label":Rn(h.options),className:g[Ce.WeekNumberHeader],style:k?.[Ce.WeekNumberHeader],scope:"col"},ee()),Ta.map(Ae=>ue.createElement(r.Weekday,{"aria-label":Le(Ae,h.options,h),className:g[Ce.Weekday],key:String(Ae),style:k?.[Ce.Weekday],scope:"col"},Y(Ae,h.options,h)))),ue.createElement(r.Weeks,{"data-animated-weeks":a.animate?"true":void 0,className:g[Ce.Weeks],style:k?.[Ce.Weeks]},ve.weeks.map(Ae=>ue.createElement(r.Week,{className:g[Ce.Week],key:Ae.weekNumber,style:k?.[Ce.Week],week:Ae},P&&ue.createElement(r.WeekNumber,{week:Ae,style:k?.[Ce.WeekNumber],"aria-label":Zt(Ae.weekNumber,{locale:p}),className:g[Ce.WeekNumber],scope:"row",role:"rowheader"},K(Ae.weekNumber,h)),Ae.days.map(_e=>{const{date:ct}=_e,Ne=ge(_e);if(Ne[pt.focused]=!Ne.hidden&&!!le?.isEqualTo(_e),Ne[En.selected]=J?.(ct)||Ne.selected,ec(he)){const{from:nn,to:Nn}=he;Ne[En.range_start]=!!(nn&&Nn&&h.isSameDay(ct,nn)),Ne[En.range_end]=!!(nn&&Nn&&h.isSameDay(ct,Nn)),Ne[En.range_middle]=xa(he,ct,!0,h)}const zt=K1(Ne,k,a.modifiersStyles),Jn=A1(Ne,g,a.modifiersClassNames),Pt=!Qn&&!Ne.hidden?we(ct,Ne,h.options,h):void 0;return ue.createElement(r.Day,{key:`${_e.isoDate}_${_e.displayMonthId}`,day:_e,modifiers:Ne,className:Jn.join(" "),style:zt,role:"gridcell","aria-selected":Ne.selected||void 0,"aria-label":Pt,"data-day":_e.isoDate,"data-month":_e.outside?_e.dateMonthId:void 0,"data-selected":Ne.selected||void 0,"data-disabled":Ne.disabled||void 0,"data-hidden":Ne.hidden||void 0,"data-outside":_e.outside||void 0,"data-focused":Ne.focused||void 0,"data-today":Ne.today||void 0},!Ne.hidden&&Qn?ue.createElement(r.DayButton,{className:g[Ce.DayButton],style:k?.[Ce.DayButton],type:"button",day:_e,modifiers:Ne,disabled:!Ne.focused&&Ne.disabled||void 0,"aria-disabled":Ne.focused&&Ne.disabled||void 0,tabIndex:xe(_e)?0:-1,"aria-label":Je(ct,Ne,h.options,h),onClick:$n(_e,Ne),onBlur:On(_e,Ne),onFocus:ni(_e,Ne),onKeyDown:In(_e,Ne),onMouseEnter:Ei(_e,Ne),onMouseLeave:Eo(_e,Ne)},U(ct,h.options,h)):!Ne.hidden&&U(_e.date,h.options,h))})))))))),a.footer&&ue.createElement(r.Footer,{className:g[Ce.Footer],style:k?.[Ce.Footer],role:"status","aria-live":"polite"},a.footer)))}function yE({className:t,classNames:a,showOutsideDays:o=!0,...r}){return l.jsx(mE,{showOutsideDays:o,className:z("p-2",t),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:z(xl({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:z(xl({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:z("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:z(xl({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:z("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:z("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:z("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:z("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",...a},components:{Chevron:({orientation:c,className:d,...h})=>{const p=c==="left"?Aw:c==="right"?Ol:c==="up"?oh:Il;return l.jsx(p,{className:z("h-4 w-4",d),...h})}},...r})}yE.displayName="Calendar";const bE=C.lazy(()=>tt(()=>Promise.resolve().then(()=>Zl),void 0).then(t=>({default:t.CodeEditor})));function sR({rawJsonContent:t,isRawJsonValid:a,rawJsonEdits:o,rawSettingsEnv:r,onChange:c,missingRequiredFields:d=[]}){const{t:h}=ye(),p=d.length>0;return l.jsx(C.Suspense,{fallback:l.jsxs("div",{className:"flex items-center justify-center h-full",children:[l.jsx(An,{className:"w-6 h-6 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-2 text-muted-foreground",children:h("providerEditor.loadingEditor")})]}),children:l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!a&&o!==null&&l.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:[l.jsx(Mo,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),a&&p&&l.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[l.jsx(Vn,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),l.jsxs("div",{children:[l.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",l.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:d.join(", ")}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:l.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:l.jsx(bE,{value:t,onChange:c,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),l.jsx("div",{className:"mx-6 mb-4",children:l.jsx("div",{className:"border rounded-md overflow-hidden",children:l.jsx(Uh,{profileEnv:r})})})]})})}C.lazy(()=>tt(()=>Promise.resolve().then(()=>Zl),void 0).then(t=>({default:t.CodeEditor})));function vE(){const{t}=ye(),{isDark:a,setTheme:o}=mh(),[r,c]=C.useState(""),[d,h]=C.useState(""),[p,g]=C.useState(!1),[m,S]=C.useState(null),[b,x]=C.useState(!1),{login:T,authRequired:w,isAuthenticated:M,loading:j,accessMode:E,authEnabled:D}=Bl(),N=ah(),A=Rl(),P=E==="setup",k=t(P?"auth.remoteGuardLabel":"auth.protectedAccessLabel"),O=t(P?D?"auth.incompleteSetupDescription":"auth.remoteSetupDescription":"auth.loginDescription"),U=A.state?.from?.pathname||"/";if(C.useEffect(()=>{j||(M||!w)&&N(U,{replace:!0})},[M,w,j,N,U]),j)return l.jsx("div",{className:"flex min-h-[100dvh] items-center justify-center bg-background px-4",children:l.jsxs("div",{className:"flex items-center gap-3 rounded-full border border-border/80 bg-card/90 px-5 py-3 text-sm text-muted-foreground shadow-sm",children:[l.jsx(An,{className:"h-4 w-4 animate-spin"}),t("auth.loading")]})});if(M||!w)return null;const _=async K=>{K.preventDefault(),S(null),x(!0);try{await T(r,d),N(U,{replace:!0})}catch(ee){S(ee instanceof Error?ee.message:t("auth.loginFailed"))}finally{x(!1)}};return l.jsxs("div",{className:"relative min-h-[100dvh] overflow-hidden bg-background",children:[l.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(167,85,52,0.16),transparent_42%),radial-gradient(circle_at_bottom_right,rgba(39,39,42,0.12),transparent_48%)]"}),l.jsx("div",{className:"absolute inset-0 opacity-[0.18] [background-image:linear-gradient(rgba(127,117,107,0.14)_1px,transparent_1px),linear-gradient(90deg,rgba(127,117,107,0.14)_1px,transparent_1px)] [background-size:24px_24px]"}),l.jsx("div",{className:"relative mx-auto flex min-h-[100dvh] max-w-6xl items-center px-4 py-8 sm:px-6",children:l.jsxs("div",{className:"grid w-full items-stretch gap-6 lg:grid-cols-[minmax(0,1.05fr)_minmax(360px,430px)]",children:[l.jsxs("section",{className:"flex flex-col justify-between rounded-[28px] border border-border/70 bg-card/85 p-6 shadow-[0_24px_80px_-48px_rgba(68,48,34,0.55)] backdrop-blur sm:p-8",children:[l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[l.jsxs("span",{className:"inline-flex w-fit items-center gap-2 rounded-full border border-border/70 bg-background/75 px-3 py-1 text-xs font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:[l.jsx(pl,{className:"h-3.5 w-3.5 text-accent"}),k]}),l.jsxs("div",{className:"inline-flex items-center gap-1 rounded-full border border-border/70 bg-background/75 p-1 shadow-sm backdrop-blur",children:[l.jsxs(st,{type:"button",variant:"ghost",size:"sm",className:z("rounded-full px-3 text-xs font-semibold",!a&&"bg-card text-foreground shadow-sm"),"aria-pressed":!a,onClick:()=>o("light"),children:[l.jsx(Jb,{className:"h-3.5 w-3.5"}),t("auth.lightMode")]}),l.jsxs(st,{type:"button",variant:"ghost",size:"sm",className:z("rounded-full px-3 text-xs font-semibold",a&&"bg-card text-foreground shadow-sm"),"aria-pressed":a,onClick:()=>o("dark"),children:[l.jsx(Zb,{className:"h-3.5 w-3.5"}),t("auth.darkMode")]})]})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("h1",{className:"max-w-xl text-4xl font-semibold tracking-[-0.04em] text-balance text-foreground sm:text-5xl",children:t(P?"auth.remoteSetupTitle":"auth.dashboardTitle")}),l.jsx("p",{className:"max-w-2xl text-base leading-7 text-muted-foreground sm:text-lg",children:O})]})]}),l.jsxs("div",{className:"mt-8 grid gap-3 text-sm text-muted-foreground sm:grid-cols-3",children:[l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[l.jsx(Vm,{className:"mb-3 h-4 w-4 text-accent"}),l.jsx("p",{children:t("auth.safetyNoteRemote")})]}),l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[l.jsx(Ym,{className:"mb-3 h-4 w-4 text-accent"}),l.jsx("p",{children:t("auth.safetyNoteLocal")})]}),l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[l.jsx(pl,{className:"mb-3 h-4 w-4 text-accent"}),l.jsx("p",{children:t("auth.safetyNoteSession")})]})]})]}),l.jsxs(QM,{className:"justify-center rounded-[28px] border-border/70 bg-card/95 py-0 shadow-[0_24px_90px_-54px_rgba(34,24,16,0.62)]",children:[l.jsxs($M,{className:"space-y-3 border-b border-border/70 px-6 py-6",children:[l.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl border border-accent/20 bg-accent/10",children:P?l.jsx(Vm,{className:"h-5 w-5 text-accent"}):l.jsx(Ym,{className:"h-5 w-5 text-accent"})}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(XM,{className:"text-2xl tracking-[-0.03em]",children:t(P?"auth.remoteSetupTitle":"auth.dashboardTitle")}),l.jsx(JM,{className:"text-sm leading-6 text-muted-foreground",children:P?O:t("auth.credentialsHint")})]})]}),l.jsx(ZM,{className:"space-y-5 px-6 py-6",children:P?l.jsxs(l.Fragment,{children:[l.jsxs(zr,{variant:"warning",className:"rounded-2xl border-yellow-300/70 bg-yellow-50/80",children:[l.jsx(Kr,{className:"h-4 w-4"}),l.jsx(Ll,{children:t("auth.noDefaultCredentials")}),l.jsx(Br,{children:t("auth.credentialsHint")})]}),l.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[l.jsx(Dw,{className:"h-4 w-4 text-accent"}),t("auth.hostStepTitle")]}),l.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:t("auth.hostStepDescription")}),l.jsx("code",{className:"mt-4 block rounded-xl border border-border/70 bg-muted/60 px-3 py-2 font-mono text-[13px] text-foreground",children:"ccs config auth setup"}),l.jsx("p",{className:"mt-3 text-xs leading-5 text-muted-foreground",children:t("auth.dockerStepDescription")}),l.jsx("code",{className:"mt-2 block rounded-xl border border-border/70 bg-muted/60 px-3 py-2 font-mono text-[13px] text-foreground",children:"docker exec -it ccs-cliproxy ccs config auth setup"})]}),l.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[l.jsx(pl,{className:"h-4 w-4 text-accent"}),t("auth.localStepTitle")]}),l.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:t("auth.localStepDescription")})]})]})]}):l.jsxs("form",{onSubmit:_,className:"space-y-4",children:[m&&l.jsxs(zr,{variant:"destructive",className:"rounded-2xl",children:[l.jsx(Kr,{className:"h-4 w-4"}),l.jsx(Br,{children:m})]}),l.jsxs(zr,{variant:"info",className:"rounded-2xl border-blue-200/80 bg-blue-50/80",children:[l.jsx(pl,{className:"h-4 w-4"}),l.jsx(Ll,{children:t("auth.noDefaultCredentials")}),l.jsx(Br,{children:t("auth.credentialsHint")})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{htmlFor:"username",className:"text-sm font-semibold",children:t("auth.username")}),l.jsx(Bn,{id:"username",type:"text",value:r,onChange:K=>c(K.target.value),placeholder:t("auth.usernamePlaceholder"),autoComplete:"username",className:"h-12 rounded-2xl border-border/80 bg-background/85 px-4 text-base md:text-base",disabled:b,required:!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(qt,{htmlFor:"password",className:"text-sm font-semibold",children:t("auth.password")}),l.jsxs("div",{className:"relative",children:[l.jsx(Bn,{id:"password",type:p?"text":"password",value:d,onChange:K=>h(K.target.value),placeholder:t("auth.passwordPlaceholder"),autoComplete:"current-password",className:"h-12 rounded-2xl border-border/80 bg-background/85 px-4 pr-14 text-base md:text-base",disabled:b,required:!0}),l.jsx(st,{type:"button",variant:"ghost",size:"sm",className:"absolute inset-y-1 right-1 h-auto rounded-xl px-3 text-muted-foreground hover:text-foreground","aria-label":t(p?"auth.hidePassword":"auth.showPassword"),"aria-pressed":p,onClick:()=>g(K=>!K),disabled:b,children:p?l.jsx(Qr,{className:"h-4 w-4"}):l.jsx($r,{className:"h-4 w-4"})})]})]}),l.jsx(st,{type:"submit",className:"h-12 w-full rounded-2xl text-sm font-semibold",disabled:b,children:b?l.jsxs(l.Fragment,{children:[l.jsx(An,{className:"mr-2 h-4 w-4 animate-spin"}),t("auth.signingIn")]}):t("auth.signIn")})]})})]})]})})]})}const xE=C.lazy(()=>tt(()=>import("./index-D9dQkYrN.js"),__vite__mapDeps([23,1,2,4,5,7,24,6,8,9])).then(t=>({default:t.AnalyticsPage}))),CE=C.lazy(()=>tt(()=>import("./api-DKvIxLdW.js"),__vite__mapDeps([25,1,2,5,26,19,6,4,3,7,8,9])).then(t=>({default:t.ApiPage}))),SE=C.lazy(()=>tt(()=>import("./cliproxy-B4OFi937.js"),__vite__mapDeps([27,1,2,5,17,6,4,20,28,26,19,29,30,18,7,8,9])).then(t=>({default:t.CliproxyPage}))),wE=C.lazy(()=>tt(()=>import("./cliproxy-ai-providers-BKTmYHel.js"),__vite__mapDeps([31,1,2,18,19,5,6,4,26,7,8,9])).then(t=>({default:t.CliproxyAiProvidersPage}))),kE=C.lazy(()=>tt(()=>import("./cliproxy-control-panel-BhZWHeYe.js"),__vite__mapDeps([32,1,2,5,17,4,6,7,8,9])).then(t=>({default:t.CliproxyControlPanelPage}))),AE=C.lazy(()=>tt(()=>import("./copilot-Cl3Kj_ql.js"),__vite__mapDeps([33,1,2,5,26,19,4,29,30,6,7,8,9])).then(t=>({default:t.CopilotPage}))),DE=C.lazy(()=>tt(()=>import("./cursor-CNjO4Z44.js"),__vite__mapDeps([34,1,2,6,5,17,29,30,4,7,8,9])).then(t=>({default:t.CursorPage}))),NE=C.lazy(()=>tt(()=>import("./claude-extension-yBbUoGj_.js"),__vite__mapDeps([35,1,2,5,6,4,7,8,9])).then(t=>({default:t.ClaudeExtensionPage}))),TE=C.lazy(()=>tt(()=>import("./codex-Dl4vlmaB.js"),__vite__mapDeps([36,1,2,6,4,29,5,9,7,37,38,8])).then(t=>({default:t.CodexPage}))),PE=C.lazy(()=>tt(()=>import("./droid-DTjmkIyQ.js"),__vite__mapDeps([39,1,2,6,5,38,4,29,7,8,9])).then(t=>({default:t.DroidPage}))),ME=C.lazy(()=>tt(()=>import("./logs-BkEGnqlr.js"),__vite__mapDeps([40,1,2,4,5,6,7,8,9])).then(t=>({default:t.LogsPage}))),LE=C.lazy(()=>tt(()=>import("./accounts-TsSkNVen.js"),__vite__mapDeps([41,1,2,5,37,19,6,4,28,7,8,9])).then(t=>({default:t.AccountsPage}))),EE=C.lazy(()=>tt(()=>Promise.resolve().then(()=>BL),void 0).then(t=>({default:t.SettingsPage}))),jE=C.lazy(()=>tt(()=>import("./health-BudwIkEr.js"),__vite__mapDeps([42,1,2,5,6,4,11,7,8,9])).then(t=>({default:t.HealthPage}))),RE=C.lazy(()=>tt(()=>import("./shared-CaCM5JhJ.js"),__vite__mapDeps([43,1,2,4,5,6,7,8,9])).then(t=>({default:t.SharedPage}))),OE=C.lazy(()=>tt(()=>import("./updates-CPLM0pNI.js"),__vite__mapDeps([44,1,2,4,5,6,7,8,9])).then(t=>({default:t.UpdatesPage}))),IE=null;function Bt(){return l.jsx("div",{className:"flex h-64 items-center justify-center",children:l.jsx(An,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function _E(){return l.jsx(G0,{client:xk,children:l.jsx(pA,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(gA,{children:l.jsx(xA,{children:l.jsxs(B0,{children:[l.jsxs(F0,{children:[l.jsx(Ct,{path:"/login",element:l.jsx(vE,{})}),l.jsx(Ct,{element:l.jsx(CA,{}),children:l.jsxs(Ct,{element:l.jsx(LN,{}),children:[l.jsx(Ct,{path:"/",element:l.jsx(nM,{})}),l.jsx(Ct,{path:"/analytics",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(xE,{})})}),l.jsx(Ct,{path:"/updates",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(OE,{})})}),l.jsx(Ct,{path:"/providers",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(CE,{})})}),l.jsx(Ct,{path:"/cliproxy",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(SE,{})})}),l.jsx(Ct,{path:"/cliproxy/ai-providers",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(wE,{})})}),l.jsx(Ct,{path:"/cliproxy/control-panel",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(kE,{})})}),l.jsx(Ct,{path:"/copilot",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(AE,{})})}),l.jsx(Ct,{path:"/cursor",element:l.jsx(Kb,{to:"/cliproxy?provider=cursor",replace:!0})}),l.jsx(Ct,{path:"/legacy/cursor",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(DE,{})})}),l.jsx(Ct,{path:"/claude-extension",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(NE,{})})}),l.jsx(Ct,{path:"/codex",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(TE,{})})}),l.jsx(Ct,{path:"/droid",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(PE,{})})}),l.jsx(Ct,{path:"/accounts",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(LE,{})})}),l.jsx(Ct,{path:"/settings",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(EE,{})})}),l.jsx(Ct,{path:"/health",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(jE,{})})}),l.jsx(Ct,{path:"/logs",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(ME,{})})}),l.jsx(Ct,{path:"/shared",element:l.jsx(C.Suspense,{fallback:l.jsx(Bt,{}),children:l.jsx(RE,{})})}),IE]})})]}),l.jsx(V0,{position:"top-right"})]})})})})})}const Qx=document.getElementById("root");if(!Qx)throw new Error("Root element not found. Failed to mount React application.");yk.createRoot(Qx).render(l.jsx(C.StrictMode,{children:l.jsx(_E,{})}));export{qj as $,sM as A,Et as B,QM as C,fM as D,_j as E,Hj as F,iM as G,dM as H,Bn as I,pM as J,Uj as K,qt as L,AD as M,DD as N,ND as O,bv as P,px as Q,Ih as R,$e as S,wa as T,El as U,Xd as V,ie as W,Fj as X,He as Y,Bj as Z,JM as _,ye as a,oj as a$,Kj as a0,Gj as a1,Vj as a2,Yj as a3,Wj as a4,Qj as a5,yx as a6,$j as a7,nL as a8,Th as a9,Zj as aA,eR as aB,Jj as aC,GD as aD,Dj as aE,Ay as aF,MM as aG,Xj as aH,bM as aI,wx as aJ,NT as aK,qT as aL,Pi as aM,yN as aN,bN as aO,vN as aP,xN as aQ,hT as aR,Rv as aS,uj as aT,dj as aU,hj as aV,fj as aW,rR as aX,$E as aY,kD as aZ,ij as a_,Ph as aa,YE as ab,vD as ac,XE as ad,nj as ae,sj as af,lj as ag,yh as ah,bh as ai,vh as aj,xh as ak,Ch as al,tR as am,iL as an,nR as ao,Li as ap,Pj as aq,jr as ar,Mj as as,Gd as at,cj as au,Lj as av,Ej as aw,Rj as ax,Dy as ay,jj as az,ZM as b,xD as b0,CD as b1,rj as b2,SD as b3,wD as b4,aj as b5,Ah as b6,Tj as b7,Cj as b8,wj as b9,_L as bA,yj as bB,pj as bC,XD as bD,JD as bE,Nj as bF,dv as bG,Zk as bH,Xk as bI,zd as bJ,Ni as bK,qk as bL,Gk as bM,Qk as bN,tA as bO,bj as bP,JE as bQ,ZE as bR,ej as bS,tj as bT,gj as bU,mj as bV,xj as bW,vj as bX,xl as bY,kj as ba,Sj as bb,Dx as bc,Uh as bd,Aj as be,Er as bf,WE as bg,QE as bh,zr as bi,Ll as bj,Br as bk,sR as bl,Rh as bm,Vr as bn,Oh as bo,WP as bp,FA as bq,GA as br,VA as bs,YA as bt,WA as bu,ZP as bv,Oj as bw,Ij as bx,Tx as by,OL as bz,z as c,st as d,aR as e,iR as f,oL as g,yE as h,VE as i,$M as j,XM as k,gT as l,mT as m,Lo as n,oR as o,ka as p,Aa as q,Pv as r,Dh as s,Mv as t,ch as u,Nh as v,Hr as w,$y as x,yM as y,zj as z};
|