@kaitranntt/ccs 8.6.1 → 8.7.0-dev.1
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/auth/profile-detector.d.ts.map +1 -1
- package/dist/auth/profile-detector.js +7 -0
- package/dist/auth/profile-detector.js.map +1 -1
- package/dist/cliproxy/config/provider-route.d.ts +3 -0
- package/dist/cliproxy/config/provider-route.d.ts.map +1 -1
- package/dist/cliproxy/config/provider-route.js +35 -1
- package/dist/cliproxy/config/provider-route.js.map +1 -1
- package/dist/cliproxy/executor/claude-launcher.d.ts.map +1 -1
- package/dist/cliproxy/executor/claude-launcher.js +38 -15
- package/dist/cliproxy/executor/claude-launcher.js.map +1 -1
- package/dist/cliproxy/executor/index.js +1 -1
- package/dist/cliproxy/executor/index.js.map +1 -1
- package/dist/cliproxy/executor/launch-settings.d.ts +48 -0
- package/dist/cliproxy/executor/launch-settings.d.ts.map +1 -0
- package/dist/cliproxy/executor/launch-settings.js +154 -0
- package/dist/cliproxy/executor/launch-settings.js.map +1 -0
- package/dist/commands/bar/bar-paths.d.ts +1 -1
- package/dist/commands/bar/bar-paths.d.ts.map +1 -1
- package/dist/commands/bar/bar-server-probe.d.ts +4 -6
- package/dist/commands/bar/bar-server-probe.d.ts.map +1 -1
- package/dist/commands/bar/bar-server-probe.js +21 -15
- package/dist/commands/bar/bar-server-probe.js.map +1 -1
- package/dist/commands/bar/install-subcommand.d.ts.map +1 -1
- package/dist/commands/bar/install-subcommand.js +2 -7
- package/dist/commands/bar/install-subcommand.js.map +1 -1
- package/dist/commands/bar/launch-descriptor.d.ts +20 -0
- package/dist/commands/bar/launch-descriptor.d.ts.map +1 -0
- package/dist/commands/bar/launch-descriptor.js +82 -0
- package/dist/commands/bar/launch-descriptor.js.map +1 -0
- package/dist/commands/bar/launch-subcommand.d.ts +3 -0
- package/dist/commands/bar/launch-subcommand.d.ts.map +1 -1
- package/dist/commands/bar/launch-subcommand.js +27 -15
- package/dist/commands/bar/launch-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.js +1 -1
- package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts +5 -4
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js +7 -5
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js.map +1 -1
- package/dist/commands/cursor-command.d.ts.map +1 -1
- package/dist/commands/cursor-command.js +2 -0
- package/dist/commands/cursor-command.js.map +1 -1
- package/dist/config/loader/config-getters.d.ts +5 -0
- package/dist/config/loader/config-getters.d.ts.map +1 -1
- package/dist/config/loader/config-getters.js +7 -0
- package/dist/config/loader/config-getters.js.map +1 -1
- package/dist/config/loader/defaults-merger.d.ts.map +1 -1
- package/dist/config/loader/defaults-merger.js +5 -0
- package/dist/config/loader/defaults-merger.js.map +1 -1
- package/dist/config/loader/yaml-serializer.d.ts.map +1 -1
- package/dist/config/loader/yaml-serializer.js +3 -2
- package/dist/config/loader/yaml-serializer.js.map +1 -1
- package/dist/config/schemas/index.d.ts +1 -1
- package/dist/config/schemas/index.d.ts.map +1 -1
- package/dist/config/schemas/index.js.map +1 -1
- package/dist/config/schemas/unified-config.d.ts.map +1 -1
- package/dist/config/schemas/unified-config.js +5 -0
- package/dist/config/schemas/unified-config.js.map +1 -1
- package/dist/config/schemas/websearch.d.ts +20 -2
- package/dist/config/schemas/websearch.d.ts.map +1 -1
- package/dist/config/schemas/websearch.js +1 -1
- package/dist/cursor/cursor-daemon-entry.d.ts.map +1 -1
- package/dist/cursor/cursor-daemon-entry.js +32 -13
- package/dist/cursor/cursor-daemon-entry.js.map +1 -1
- package/dist/cursor/cursor-daemon.d.ts +4 -1
- package/dist/cursor/cursor-daemon.d.ts.map +1 -1
- package/dist/cursor/cursor-daemon.js +14 -8
- package/dist/cursor/cursor-daemon.js.map +1 -1
- package/dist/cursor/cursor-runtime-probe.d.ts.map +1 -1
- package/dist/cursor/cursor-runtime-probe.js +2 -1
- package/dist/cursor/cursor-runtime-probe.js.map +1 -1
- package/dist/glmt/pipeline/response-builder.d.ts +5 -0
- package/dist/glmt/pipeline/response-builder.d.ts.map +1 -1
- package/dist/glmt/pipeline/response-builder.js +6 -7
- package/dist/glmt/pipeline/response-builder.js.map +1 -1
- package/dist/glmt/pipeline/types.d.ts +2 -7
- package/dist/glmt/pipeline/types.d.ts.map +1 -1
- package/dist/services/logging/log-redaction.d.ts.map +1 -1
- package/dist/services/logging/log-redaction.js +12 -2
- package/dist/services/logging/log-redaction.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 +14 -0
- package/dist/shared/provider-preset-catalog.js.map +1 -1
- package/dist/targets/codex-adapter.d.ts.map +1 -1
- package/dist/targets/codex-adapter.js +8 -7
- package/dist/targets/codex-adapter.js.map +1 -1
- package/dist/targets/codex-cliproxy-provider-config.d.ts.map +1 -1
- package/dist/targets/codex-cliproxy-provider-config.js +12 -1
- package/dist/targets/codex-cliproxy-provider-config.js.map +1 -1
- package/dist/ui/assets/{Trans-BpNkQ7ek.js → Trans-By7poS8F.js} +1 -1
- package/dist/ui/assets/{accounts-BjBpKHAo.js → accounts-CT4cNpXE.js} +1 -1
- package/dist/ui/assets/{alert-dialog-pDQKbmfk.js → alert-dialog-D-4eNWT-.js} +1 -1
- package/dist/ui/assets/{api-Bz4gk1bk.js → api-BOsmB6JC.js} +1 -1
- package/dist/ui/assets/{auth-section-DPJ_tnXs.js → auth-section-BNu9bqxZ.js} +1 -1
- package/dist/ui/assets/{backups-section-DGeCRWP2.js → backups-section-QEZ5MeIb.js} +1 -1
- package/dist/ui/assets/{channels-BZHQSZ2O.js → channels-C8lOwrre.js} +1 -1
- package/dist/ui/assets/{checkbox-H7Yhg_4C.js → checkbox-DxCvOyao.js} +1 -1
- package/dist/ui/assets/{claude-extension-BFpic0ox.js → claude-extension-CvbfmbdL.js} +1 -1
- package/dist/ui/assets/{cliproxy-ai-providers-E8zkuN9-.js → cliproxy-ai-providers-jeMd_Enz.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-CXij15eo.js → cliproxy-control-panel-Ylrw7Vt0.js} +1 -1
- package/dist/ui/assets/{cliproxy-DQizRbbC.js → cliproxy-daECx_cg.js} +1 -1
- package/dist/ui/assets/{codex-Clsf_Ll9.js → codex-7d3v_F3-.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-D-AtmCDF.js → confirm-dialog-BGbC3827.js} +1 -1
- package/dist/ui/assets/{copilot-D0Z8CZJb.js → copilot-DGVMqIvj.js} +1 -1
- package/dist/ui/assets/{cursor-BXf4OXxE.js → cursor-D94mZoOn.js} +1 -1
- package/dist/ui/assets/{droid-DUaaFFGf.js → droid-CijT6OtA.js} +1 -1
- package/dist/ui/assets/{globalenv-section-Bi6g0RHv.js → globalenv-section-Cro0fjBM.js} +1 -1
- package/dist/ui/assets/{health-qWLTnC0s.js → health-DFG40_kD.js} +1 -1
- package/dist/ui/assets/{index-BTfHfkkh.js → index-BTJNmedC.js} +1 -1
- package/dist/ui/assets/{index-2aTPFpCV.js → index-Bf0--BiU.js} +1 -1
- package/dist/ui/assets/{index-B8BRpC7W.js → index-Bf5DDwJP.js} +1 -1
- package/dist/ui/assets/{index-BBdOx52b.js → index-BfbJlKvM.js} +1 -1
- package/dist/ui/assets/{index-D4nxVNz2.js → index-D77S3tlM.js} +1 -1
- package/dist/ui/assets/{index-bTno3t7S.js → index-DLRoa85N.js} +1 -1
- package/dist/ui/assets/{index-Dx2jv0Ov.js → index-K_KarWwQ.js} +3 -3
- package/dist/ui/assets/{logs-dRi0gOyI.js → logs-Bc1-UurC.js} +1 -1
- package/dist/ui/assets/{masked-input-DtbQSbOn.js → masked-input-uuW_Ngh8.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-DxwDomuX.js → proxy-status-widget-BFrQZqYz.js} +1 -1
- package/dist/ui/assets/{raw-json-settings-editor-panel-CDlRVxaa.js → raw-json-settings-editor-panel-DEHwL2oY.js} +1 -1
- package/dist/ui/assets/{searchable-select-DNOKIELZ.js → searchable-select-pEfkrlZT.js} +1 -1
- package/dist/ui/assets/{separator-DlmzFyxp.js → separator-BTcnUF3t.js} +1 -1
- package/dist/ui/assets/{shared-D1fHDQQG.js → shared-DWBCHrPI.js} +1 -1
- package/dist/ui/assets/{table-B0nIYCuj.js → table-DdMU9lLS.js} +1 -1
- package/dist/ui/assets/{updates-BqVdDTJj.js → updates-DfYyQw34.js} +1 -1
- package/dist/ui/assets/{use-accounts-BkjSf38E.js → use-accounts-DnMcRpOC.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/utils/bar-auth-token.d.ts +5 -0
- package/dist/utils/bar-auth-token.d.ts.map +1 -1
- package/dist/utils/bar-auth-token.js +23 -1
- package/dist/utils/bar-auth-token.js.map +1 -1
- package/dist/utils/openai-compat-launch-settings.d.ts.map +1 -1
- package/dist/utils/openai-compat-launch-settings.js +6 -0
- package/dist/utils/openai-compat-launch-settings.js.map +1 -1
- package/dist/utils/shell-executor.d.ts +2 -0
- package/dist/utils/shell-executor.d.ts.map +1 -1
- package/dist/utils/shell-executor.js +11 -7
- package/dist/utils/shell-executor.js.map +1 -1
- package/dist/utils/websearch/agy.d.ts +28 -0
- package/dist/utils/websearch/agy.d.ts.map +1 -0
- package/dist/utils/websearch/agy.js +83 -0
- package/dist/utils/websearch/agy.js.map +1 -0
- package/dist/utils/websearch/hook-config.d.ts.map +1 -1
- package/dist/utils/websearch/hook-config.js +3 -0
- package/dist/utils/websearch/hook-config.js.map +1 -1
- package/dist/utils/websearch/hook-env.d.ts.map +1 -1
- package/dist/utils/websearch/hook-env.js +13 -1
- package/dist/utils/websearch/hook-env.js.map +1 -1
- package/dist/utils/websearch/index.d.ts +2 -1
- package/dist/utils/websearch/index.d.ts.map +1 -1
- package/dist/utils/websearch/index.js +7 -2
- package/dist/utils/websearch/index.js.map +1 -1
- package/dist/utils/websearch/mcp-installer.d.ts +5 -4
- package/dist/utils/websearch/mcp-installer.d.ts.map +1 -1
- package/dist/utils/websearch/mcp-installer.js +7 -13
- package/dist/utils/websearch/mcp-installer.js.map +1 -1
- package/dist/utils/websearch/status.d.ts.map +1 -1
- package/dist/utils/websearch/status.js +25 -5
- package/dist/utils/websearch/status.js.map +1 -1
- package/dist/utils/websearch/types.d.ts +7 -1
- package/dist/utils/websearch/types.d.ts.map +1 -1
- package/dist/utils/websearch/types.js.map +1 -1
- package/dist/utils/websearch-manager.d.ts +2 -1
- package/dist/utils/websearch-manager.d.ts.map +1 -1
- package/dist/utils/websearch-manager.js +6 -1
- package/dist/utils/websearch-manager.js.map +1 -1
- package/dist/web-server/routes/bar-routes.d.ts +16 -0
- package/dist/web-server/routes/bar-routes.d.ts.map +1 -1
- package/dist/web-server/routes/bar-routes.js.map +1 -1
- package/dist/web-server/routes/cursor-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cursor-routes.js +2 -0
- package/dist/web-server/routes/cursor-routes.js.map +1 -1
- package/dist/web-server/routes/index.d.ts.map +1 -1
- package/dist/web-server/routes/index.js +7 -5
- package/dist/web-server/routes/index.js.map +1 -1
- package/dist/web-server/routes/route-helpers.d.ts.map +1 -1
- package/dist/web-server/routes/route-helpers.js +8 -5
- package/dist/web-server/routes/route-helpers.js.map +1 -1
- package/dist/web-server/routes/websearch-routes.d.ts.map +1 -1
- package/dist/web-server/routes/websearch-routes.js +7 -0
- package/dist/web-server/routes/websearch-routes.js.map +1 -1
- package/dist/web-server/usage/native-quota-collector.d.ts +50 -8
- package/dist/web-server/usage/native-quota-collector.d.ts.map +1 -1
- package/dist/web-server/usage/native-quota-collector.js +883 -71
- package/dist/web-server/usage/native-quota-collector.js.map +1 -1
- package/lib/hooks/websearch-transformer.cjs +73 -4
- 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-D77S3tlM.js","assets/radix-ui-nu4wz29m.js","assets/react-vendor-Bjx91N7w.js","assets/masked-input-uuW_Ngh8.js","assets/icons-DSLG1YsC.js","assets/tanstack-bhJxV1h8.js","assets/notifications-B4_o8bcr.js","assets/utils-CzKF5WmX.js","assets/form-utils-CuHzLhJZ.js","assets/charts-eIPy2oG6.js","assets/index-Bf5DDwJP.js","assets/proxy-C4-M_9kB.js","assets/index-BTJNmedC.js","assets/channels-C8lOwrre.js","assets/globalenv-section-Cro0fjBM.js","assets/index-DLRoa85N.js","assets/index-Bf0--BiU.js","assets/default-ports-1QQSffYX.js","assets/proxy-status-widget-BFrQZqYz.js","assets/alert-dialog-D-4eNWT-.js","assets/Trans-By7poS8F.js","assets/antigravity-responsibility-constants-Bvh4Ybz0.js","assets/auth-section-BNu9bqxZ.js","assets/backups-section-QEZ5MeIb.js","assets/index-BfbJlKvM.js","assets/use-accounts-DnMcRpOC.js","assets/api-BOsmB6JC.js","assets/confirm-dialog-BGbC3827.js","assets/cliproxy-daECx_cg.js","assets/checkbox-DxCvOyao.js","assets/separator-BTcnUF3t.js","assets/searchable-select-pEfkrlZT.js","assets/cliproxy-ai-providers-jeMd_Enz.js","assets/cliproxy-control-panel-Ylrw7Vt0.js","assets/copilot-DGVMqIvj.js","assets/cursor-D94mZoOn.js","assets/claude-extension-CvbfmbdL.js","assets/codex-7d3v_F3-.js","assets/table-DdMU9lLS.js","assets/raw-json-settings-editor-panel-DEHwL2oY.js","assets/droid-CijT6OtA.js","assets/logs-Bc1-UurC.js","assets/accounts-CT4cNpXE.js","assets/health-DFG40_kD.js","assets/shared-DWBCHrPI.js","assets/updates-DfYyQw34.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{j as p,S as Kh,R as BA,C as HA,a as _A,T as UA,D as zA,P as FA,O as qA,b as RR,c as ER,d as IR,e as jR,f as BR,A as HR,g as _R,h as UR,i as zR,k as FR,l as qR,m as GR,n as KR,I as VR,o as GA,p as WR,q as KA,r as VA,s as QR,t as WA,V as YR,L as QA,u as YA,v as $R,w as XR,x as $A,y as JR,z as ZR,B as XA,E as eE,F as tE,G as JA,H as nE,J as ZA,K as eP,M as tP,N as iE,Q as oE,U as sE,W as aE,X as rE,Y as nP,Z as lE,_ as cE,$ as uE}from"./radix-ui-nu4wz29m.js";import{b as iP,d as dE,r as w,u as Vh,O as ty,N as oP,e as bb,L as dh,R as hE,h as sP,E as me,B as fE,i as pE,j as Et}from"./react-vendor-Bjx91N7w.js";import{Q as gE,u as jt,a as bt,b as pt,c as mE,d as yE}from"./tanstack-bhJxV1h8.js";import{t as fe,T as bE}from"./notifications-B4_o8bcr.js";import{L as hi,X as Kr,P as xE,C as Wh,H as vE,a as CE,K as ny,G as SE,Z as aP,F as rP,U as lP,b as kE,S as wE,c as cP,A as xc,d as uP,e as AE,f as dP,M as hP,E as Vc,g as Wc,B as PE,R as vc,W as DE,h as OE,i as TE,j as ME,k as NE,l as XS,m as JS,n as Rr,o as xb,p as hh,q as fP,r as pP,s as LE,t as Qh,u as vb,v as gP,w as Er,T as wi,x as Cc,y as Qc,z as ZS,D as RE,I as mP,J as Cb,N as EE,O as Yh,Q as IE,V as jE,Y as BE,_ as HE,$ as $h,a0 as _E,a1 as UE,a2 as yP,a3 as zE,a4 as FE,a5 as qE,a6 as GE,a7 as KE,a8 as Sb,a9 as bP,aa as ek,ab as VE,ac as WE,ad as QE,ae as YE,af as $E,ag as XE,ah as tk,ai as JE,aj as Sd,ak as nk,al as ik,am as ZE}from"./icons-DSLG1YsC.js";import{t as e2,c as t2,a as Xh,e as zl,f as $l,b as n2,d as i2,g as o2,h as s2,i as a2,j as r2,k as l2,l as c2,m as u2,n as d2,o as h2,p as f2,q as p2,r as g2,s as m2,u as y2,v as b2,w as x2,x as v2,y as C2,z as S2,A as k2,B as w2,C as A2,D as P2,E as D2,F as O2,G as T2,H as M2,I as N2,J as L2}from"./utils-CzKF5WmX.js";import{o as ok,s as sk,p as R2,a as E2,$ as I2,b as xP,c as cs,d as j2,_ as B2,u as H2,e as ak}from"./form-utils-CuHzLhJZ.js";import{_ as _2,a as U2}from"./charts-eIPy2oG6.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const r of a.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function t(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(o){if(o.ep)return;o.ep=!0;const a=t(o);fetch(o.href,a)}})();var $g={exports:{}},Fl={},Xg={exports:{}},Jg={};var rk;function z2(){return rk||(rk=1,(function(n){function e(H,Z){var se=H.length;H.push(Z);e:for(;0<se;){var Y=se-1>>>1,ae=H[Y];if(0<o(ae,Z))H[Y]=Z,H[se]=ae,se=Y;else break e}}function t(H){return H.length===0?null:H[0]}function i(H){if(H.length===0)return null;var Z=H[0],se=H.pop();if(se!==Z){H[0]=se;e:for(var Y=0,ae=H.length,de=ae>>>1;Y<de;){var be=2*(Y+1)-1,te=H[be],le=be+1,ve=H[le];if(0>o(te,se))le<ae&&0>o(ve,te)?(H[Y]=ve,H[le]=se,Y=le):(H[Y]=te,H[be]=se,Y=be);else if(le<ae&&0>o(ve,se))H[Y]=ve,H[le]=se,Y=le;else break e}}return Z}function o(H,Z){var se=H.sortIndex-Z.sortIndex;return se!==0?se:H.id-Z.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;n.unstable_now=function(){return a.now()}}else{var r=Date,c=r.now();n.unstable_now=function(){return r.now()-c}}var d=[],f=[],g=1,m=null,x=3,v=!1,C=!1,k=!1,A=!1,D=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function M(H){for(var Z=t(f);Z!==null;){if(Z.callback===null)i(f);else if(Z.startTime<=H)i(f),Z.sortIndex=Z.expirationTime,e(d,Z);else break;Z=t(f)}}function L(H){if(k=!1,M(H),!C)if(t(d)!==null)C=!0,N||(N=!0,F());else{var Z=t(f);Z!==null&&oe(L,Z.startTime-H)}}var N=!1,I=-1,W=5,U=-1;function z(){return A?!0:!(n.unstable_now()-U<W)}function $(){if(A=!1,N){var H=n.unstable_now();U=H;var Z=!0;try{e:{C=!1,k&&(k=!1,O(I),I=-1),v=!0;var se=x;try{t:{for(M(H),m=t(d);m!==null&&!(m.expirationTime>H&&z());){var Y=m.callback;if(typeof Y=="function"){m.callback=null,x=m.priorityLevel;var ae=Y(m.expirationTime<=H);if(H=n.unstable_now(),typeof ae=="function"){m.callback=ae,M(H),Z=!0;break t}m===t(d)&&i(d),M(H)}else i(d);m=t(d)}if(m!==null)Z=!0;else{var de=t(f);de!==null&&oe(L,de.startTime-H),Z=!1}}break e}finally{m=null,x=se,v=!1}Z=void 0}}finally{Z?F():N=!1}}}var F;if(typeof T=="function")F=function(){T($)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,ie=B.port2;B.port1.onmessage=$,F=function(){ie.postMessage(null)}}else F=function(){D($,0)};function oe(H,Z){I=D(function(){H(n.unstable_now())},Z)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(H){H.callback=null},n.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"):W=0<H?Math.floor(1e3/H):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(H){switch(x){case 1:case 2:case 3:var Z=3;break;default:Z=x}var se=x;x=Z;try{return H()}finally{x=se}},n.unstable_requestPaint=function(){A=!0},n.unstable_runWithPriority=function(H,Z){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var se=x;x=H;try{return Z()}finally{x=se}},n.unstable_scheduleCallback=function(H,Z,se){var Y=n.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?Y+se:Y):se=Y,H){case 1:var ae=-1;break;case 2:ae=250;break;case 5:ae=1073741823;break;case 4:ae=1e4;break;default:ae=5e3}return ae=se+ae,H={id:g++,callback:Z,priorityLevel:H,startTime:se,expirationTime:ae,sortIndex:-1},se>Y?(H.sortIndex=se,e(f,H),t(d)===null&&H===t(f)&&(k?(O(I),I=-1):k=!0,oe(L,se-Y))):(H.sortIndex=ae,e(d,H),C||v||(C=!0,N||(N=!0,F()))),H},n.unstable_shouldYield=z,n.unstable_wrapCallback=function(H){var Z=x;return function(){var se=x;x=Z;try{return H.apply(this,arguments)}finally{x=se}}}})(Jg)),Jg}var lk;function F2(){return lk||(lk=1,Xg.exports=z2()),Xg.exports}var ck;function q2(){if(ck)return Fl;ck=1;var n=F2(),e=iP(),t=dE();function i(s){var l="https://react.dev/errors/"+s;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)l+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+s+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function a(s){var l=s,u=s;if(s.alternate)for(;l.return;)l=l.return;else{s=l;do l=s,(l.flags&4098)!==0&&(u=l.return),s=l.return;while(s)}return l.tag===3?u:null}function r(s){if(s.tag===13){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function c(s){if(s.tag===31){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function d(s){if(a(s)!==s)throw Error(i(188))}function f(s){var l=s.alternate;if(!l){if(l=a(s),l===null)throw Error(i(188));return l!==s?null:s}for(var u=s,h=l;;){var y=u.return;if(y===null)break;var b=y.alternate;if(b===null){if(h=y.return,h!==null){u=h;continue}break}if(y.child===b.child){for(b=y.child;b;){if(b===u)return d(y),s;if(b===h)return d(y),l;b=b.sibling}throw Error(i(188))}if(u.return!==h.return)u=y,h=b;else{for(var S=!1,P=y.child;P;){if(P===u){S=!0,u=y,h=b;break}if(P===h){S=!0,h=y,u=b;break}P=P.sibling}if(!S){for(P=b.child;P;){if(P===u){S=!0,u=b,h=y;break}if(P===h){S=!0,h=b,u=y;break}P=P.sibling}if(!S)throw Error(i(189))}}if(u.alternate!==h)throw Error(i(190))}if(u.tag!==3)throw Error(i(188));return u.stateNode.current===u?s:l}function g(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s;for(s=s.child;s!==null;){if(l=g(s),l!==null)return l;s=s.sibling}return null}var m=Object.assign,x=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),T=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function F(s){return s===null||typeof s!="object"?null:(s=$&&s[$]||s["@@iterator"],typeof s=="function"?s:null)}var B=Symbol.for("react.client.reference");function ie(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===B?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case k:return"Fragment";case D:return"Profiler";case A:return"StrictMode";case L:return"Suspense";case N:return"SuspenseList";case U:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case C:return"Portal";case T:return s.displayName||"Context";case O:return(s._context.displayName||"Context")+".Consumer";case M:var l=s.render;return s=s.displayName,s||(s=l.displayName||l.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case I:return l=s.displayName||null,l!==null?l:ie(s.type)||"Memo";case W:l=s._payload,s=s._init;try{return ie(s(l))}catch{}}return null}var oe=Array.isArray,H=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},Y=[],ae=-1;function de(s){return{current:s}}function be(s){0>ae||(s.current=Y[ae],Y[ae]=null,ae--)}function te(s,l){ae++,Y[ae]=s.current,s.current=l}var le=de(null),ve=de(null),Se=de(null),ye=de(null);function Oe(s,l){switch(te(Se,l),te(ve,s),te(le,null),l.nodeType){case 9:case 11:s=(s=l.documentElement)&&(s=s.namespaceURI)?vS(s):0;break;default:if(s=l.tagName,l=l.namespaceURI)l=vS(l),s=CS(l,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}be(le),te(le,s)}function je(){be(le),be(ve),be(Se)}function nt(s){s.memoizedState!==null&&te(ye,s);var l=le.current,u=CS(l,s.type);l!==u&&(te(ve,s),te(le,u))}function Pt(s){ve.current===s&&(be(le),be(ve)),ye.current===s&&(be(ye),Bl._currentValue=se)}var Te,Ye;function it(s){if(Te===void 0)try{throw Error()}catch(u){var l=u.stack.trim().match(/\n( *(at )?)/);Te=l&&l[1]||"",Ye=-1<u.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+Te+s+Ye}var ln=!1;function Sn(s,l){if(!s||ln)return"";ln=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(l){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(Q){var V=Q}Reflect.construct(s,[],ne)}else{try{ne.call()}catch(Q){V=Q}s.call(ne.prototype)}}else{try{throw Error()}catch(Q){V=Q}(ne=s())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(Q){if(Q&&V&&typeof Q.stack=="string")return[Q.stack,V.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=h.DetermineComponentFrameRoot(),S=b[0],P=b[1];if(S&&P){var R=S.split(`
|
|
@@ -14,7 +14,7 @@ Error generating stack: `+h.message+`
|
|
|
14
14
|
`);for(const i of t){const[o,...a]=i.split(":"),r=a.join(":").trim();switch(o?.trim()?.toLowerCase()){case"version":e.version=r;break;case"url":e.url=r;break;case"method":e.method=r;break;case"timestamp":e.timestamp=r;break}}}function d3(n){const e={},t=n.split(`
|
|
15
15
|
`);for(const i of t){const o=i.indexOf(":");if(o>0){const a=i.slice(0,o).trim(),r=i.slice(o+1).trim();a&&(e[a]=r)}}return e}function h3(n,e){const t=n.split(`
|
|
16
16
|
`);let i=!1;const o=[];for(const a of t){if(a.startsWith("Status:")){const c=a.replace("Status:","").trim().split(/\s+/);e.statusCode=parseInt(c[0],10)||0,e.statusText=c.slice(1).join(" ")||m3(e.statusCode);continue}if(a.trim()===""&&!i){i=!0;continue}if(i)o.push(a);else{const r=a.indexOf(":");if(r>0){const c=a.slice(0,r).trim(),d=a.slice(r+1).trim();c&&(e.responseHeaders[c]=d)}}}e.responseBody=o.join(`
|
|
17
|
-
`).trim()}function f3(n){const e=n.url.match(/\/api\/provider\/([^/]+)/);e&&(n.provider=e[1]);const t=n.url.match(/\/api\/provider\/[^/]+\/(.+?)(?:\?|$)/);t&&(n.endpoint=t[1]),n.isClientError=n.statusCode>=400&&n.statusCode<500,n.isServerError=n.statusCode>=500,n.statusCode===429?n.errorType="rate_limit":n.statusCode===401||n.statusCode===403?n.errorType="auth":n.statusCode===404?n.errorType="not_found":n.statusCode>=500?n.errorType="server":(n.statusCode===408||n.statusCode===504)&&(n.errorType="timeout"),p3(n),n.statusCode===429&&g3(n)}function p3(n){if(n.requestBody)try{const e=JSON.parse(n.requestBody);typeof e.model=="string"&&(n.model=e.model)}catch{}}function g3(n){if(n.responseBody)try{const e=JSON.parse(n.responseBody),t=fy(e);t!==null&&(n.quotaResetDelay=t);const i=py(e);i&&(n.quotaResetTimestamp=i)}catch{}}function fy(n){if(typeof n!="object"||n===null)return null;const e=n;if("quotaResetDelay"in e){const t=e.quotaResetDelay;if(typeof t=="number")return t;if(typeof t=="string"){const i=t.match(/^(\d+)s?$/);if(i)return parseInt(i[1],10)}}if("error"in e&&typeof e.error=="object"){const t=fy(e.error);if(t!==null)return t}if("details"in e&&Array.isArray(e.details))for(const t of e.details){const i=fy(t);if(i!==null)return i}return null}function py(n){if(typeof n!="object"||n===null)return null;const e=n;for(const t of["quotaResetTimeStamp","quotaResetTimestamp","resetTime","reset_time"])if(t in e&&typeof e[t]=="string")return e[t];if("error"in e&&typeof e.error=="object"){const t=py(e.error);if(t)return t}if("details"in e&&Array.isArray(e.details))for(const t of e.details){const i=py(t);if(i)return i}return null}function m3(n){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"}[n]||""}function y3(n,e){const t=kb(),i=Date.now(),o=n*1e3,a=i-o,r=Math.floor(a/1e3),c=Math.floor(r/60),d=Math.floor(c/60),f=Math.floor(d/24);if(r<60){const m=t==="zh-CN",x=t==="vi";return m?"刚刚":x?"vừa xong":"just now"}if(c<60){const m=t==="zh-CN",x=t==="vi";return m?`${c} 分钟前`:x?`${c} phút trước`:`${c}m ago`}if(d<24){const m=t==="zh-CN",x=t==="vi";return m?`${d} 小时前`:x?`${d} giờ trước`:`${d}h ago`}if(f<7){const m=t==="zh-CN",x=t==="vi";return m?`${f} 天前`:x?`${f} ngày trước`:`${f}d ago`}return new Date(o).toLocaleDateString(t,{month:"short",day:"numeric"})}function b3(n){return n>=500?"text-red-500":n===429?"text-orange-500":n>=400?"text-yellow-500":"text-gray-500"}function x3(n,e){const t=kb();return t==="zh-CN"?{rate_limit:"限流",auth:"认证错误",not_found:"未找到",server:"服务错误",timeout:"超时",unknown:"错误"}[n]||"错误":t==="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"}[n]||"Lỗi":{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[n]||"Error"}function v3(n){if(n===null||n<=0)return null;if(n<60)return`${n}s`;if(n<3600)return`${Math.floor(n/60)}m`;const e=Math.floor(n/3600),t=Math.floor(n%3600/60);return t>0?`${e}h ${t}m`:`${e}h`}function C3(n,e){if(!n)return null;const t=kb(),i=t==="zh-CN",o=t==="vi";try{const a=new Date(n),r=new Date,c=a.getTime()-r.getTime();if(c<=0)return i?"现在":o?"bây giờ":"now";const d=Math.floor(c/1e3);if(d<60)return i?`${d}秒`:o?`${d} giây`:`${d}s`;if(d<3600){const m=Math.floor(d/60);return i?`${m}分钟`:o?`${m} phút`:`${m}m`}const f=Math.floor(d/3600),g=Math.floor(d%3600/60);return i?g>0?`${f}小时 ${g}分钟`:`${f}小时`:o?g>0?`${f} giờ ${g} phút`:`${f} giờ`:g>0?`${f}h ${g}m`:`${f}h`}catch{return null}}function S3(n){return n?n===429?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":n>=500?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":n>=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 k3(n){return n||""}function w3({name:n,size:e,modified:t,isSelected:i,onClick:o,statusCode:a,model:r}){const c=w.useMemo(()=>l3(n),[n]),d=w.useMemo(()=>k3(r),[r]);return p.jsxs("button",{onClick:o,className:q("w-full px-2.5 py-2 flex items-center gap-2 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",i?"bg-muted/50 border-l-red-500":"border-l-transparent"),children:[p.jsx("span",{className:q("shrink-0 text-[10px] font-bold px-1.5 py-0.5 rounded min-w-[32px] text-center",S3(a)),children:a||"???"}),p.jsx(Kb,{provider:c.provider,size:18,withBackground:!0,className:"shrink-0"}),p.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[p.jsx("span",{className:"text-[11px] font-medium text-foreground truncate",children:c.endpoint||"unknown"}),d&&p.jsx("span",{className:"text-[10px] text-muted-foreground truncate",title:d,children:d}),p.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-muted-foreground/60",children:[p.jsx(Er,{className:"w-2.5 h-2.5"}),p.jsx("span",{children:y3(t)})]})]})]})}function sw({value:n,className:e,variant:t="outline",size:i="icon",label:o="Copy to clipboard"}){const[a,r]=w.useState(!1),c=()=>{navigator.clipboard.writeText(n),r(!0),setTimeout(()=>r(!1),2e3)};return p.jsx(ga,{children:p.jsxs($i,{children:[p.jsx(Xi,{asChild:!0,children:p.jsxs(ht,{size:i,variant:t,className:q("relative z-10 text-muted-foreground hover:text-foreground",e),onClick:d=>{d.stopPropagation(),c()},children:[a?p.jsx(Rr,{className:"h-3.5 w-3.5 text-green-500"}):p.jsx(hh,{className:"h-3.5 w-3.5"}),p.jsx("span",{className:"sr-only",children:o})]})}),p.jsx(Ji,{children:p.jsx("p",{children:a?"Copied!":o})})]})})}function Gl({active:n,onClick:e,children:t,icon:i}){return p.jsxs("button",{onClick:e,className:q("px-2.5 py-1.5 text-xs font-medium rounded transition-colors flex items-center gap-1.5",n?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[i&&p.jsx(i,{className:"w-3.5 h-3.5"}),t]})}function wD({code:n}){const e=b3(n);return p.jsx("span",{className:q("inline-flex items-center justify-center min-w-[36px] px-2 py-0.5 rounded text-xs font-bold","bg-current/10 border border-current/20",e),children:n})}function A3({parsed:n}){const{t:e}=xe(),t=v3(n.quotaResetDelay)||C3(n.quotaResetTimestamp),i=e("errorLogs.na");return p.jsx(Vr,{className:"h-full",children:p.jsxs("div",{className:"p-4 space-y-4",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(wD,{code:n.statusCode}),p.jsx("span",{className:"text-sm font-medium",children:n.statusText}),p.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:x3(n.errorType)})]}),n.model&&p.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-violet-500/10 border border-violet-500/20",children:[p.jsx(HE,{className:"w-4 h-4 text-violet-500 shrink-0"}),p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-muted-foreground",children:e("errorLogs.modelLabel")}),p.jsx("span",{className:"font-semibold text-violet-600 dark:text-violet-400",children:n.model})]})]}),n.errorType==="rate_limit"&&t&&p.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[p.jsx(Er,{className:"w-4 h-4 text-amber-500 shrink-0"}),p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-muted-foreground",children:e("errorLogs.quotaResetsIn")}),p.jsx("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:t})]})]}),p.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.method")}),p.jsx("div",{className:"font-medium",children:n.method||i})]}),p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.provider")}),p.jsx("div",{className:"font-medium",children:n.provider||i})]}),p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.version")}),p.jsx("div",{className:"font-medium",children:n.version||i})]}),p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.endpoint")}),p.jsx("div",{className:"font-medium truncate",title:n.endpoint,children:n.endpoint||i})]})]}),p.jsxs("div",{className:"text-xs",children:[p.jsx("div",{className:"text-muted-foreground mb-1.5",children:e("errorLogs.url")}),p.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:n.url||i})]}),p.jsxs("div",{className:"text-xs",children:[p.jsx("div",{className:"text-muted-foreground mb-1.5",children:e("errorLogs.timestamp")}),p.jsx("div",{className:"font-mono",children:n.timestamp||i})]}),n.errorType!=="unknown"&&p.jsxs("div",{className:q("flex items-start gap-3 p-3 rounded text-xs",n.errorType==="rate_limit"?"bg-amber-500/10 border border-amber-500/20":n.errorType==="auth"?"bg-red-500/10 border border-red-500/20":"bg-blue-500/10 border border-blue-500/20"),children:[n.errorType==="rate_limit"?p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}):n.errorType==="auth"?p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-red-500 shrink-0"}):p.jsx($h,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),p.jsxs("div",{className:q("leading-relaxed",n.errorType==="rate_limit"?"text-amber-600 dark:text-amber-400":n.errorType==="auth"?"text-red-600 dark:text-red-400":"text-blue-600 dark:text-blue-400"),children:[n.errorType==="rate_limit"&&(n.model?e("errorLogs.rateLimitedMsg",{model:n.model}):e("errorLogs.rateLimitedMsgNoModel")),n.errorType==="auth"&&e("errorLogs.authFailedMsg"),n.errorType==="not_found"&&e("errorLogs.notFoundMsg"),n.errorType==="server"&&e("errorLogs.serverErrorMsg"),n.errorType==="timeout"&&e("errorLogs.timeoutMsg")]})]})]})})}function P3({headers:n}){const{t:e}=xe(),t=Object.entries(n);return t.length===0?p.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:e("errorLogs.noHeaders")}):p.jsx(Vr,{className:"h-full",children:p.jsx("div",{className:"p-4 space-y-1",children:t.map(([i,o])=>p.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[p.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[i,":"]}),p.jsx("span",{className:"break-all",children:o})]},i))})})}function aw({content:n,label:e}){const{t}=xe();if(!n||n.trim()===""){const a=e==="Request"?"errorLogs.noRequestBody":"errorLogs.noResponseBody";return p.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:t(a)})}let i=n,o=!1;try{const a=JSON.parse(n);i=JSON.stringify(a,null,2),o=!0}catch{}return p.jsx(Vr,{className:"h-full",children:p.jsx("pre",{className:q("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",o?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:i})})}function D3({content:n}){return p.jsx(Vr,{className:"h-full",children:p.jsx("pre",{className:"p-4 text-xs font-mono text-zinc-700 dark:text-muted-foreground whitespace-pre-wrap break-all leading-relaxed",children:n})})}function O3({name:n,absolutePath:e}){const{t}=xe(),[i,o]=w.useState("overview"),{data:a,isLoading:r,error:c}=tH(n),d=w.useMemo(()=>a?c3(a):null,[a]);return n?r?p.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[p.jsx(tt,{className:"h-5 w-full"}),p.jsx(tt,{className:"h-5 w-3/4"}),p.jsx(tt,{className:"h-5 w-5/6"}),p.jsx(tt,{className:"h-5 w-2/3"})]}):c||!a||!d?p.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:p.jsx("p",{className:"text-sm",children:t("errorLogs.failedLoadContent")})}):p.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[p.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[p.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[p.jsx(wD,{code:d.statusCode}),p.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[d.provider,"/",d.endpoint||"unknown"]}),n&&p.jsx(sw,{value:e||n,label:t("errorLogs.copyAbsolutePath"),size:"icon-sm",className:"ml-1 text-muted-foreground hover:text-foreground opacity-50 hover:opacity-100 transition-opacity"})]}),p.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a&&p.jsx(sw,{value:a,label:t("errorLogs.copyRawContent"),variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),p.jsx("span",{className:"text-[10px] text-muted-foreground font-mono bg-muted px-1.5 py-0.5 rounded border border-border/50",children:d.method})]})]}),p.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:[p.jsx(Gl,{active:i==="overview",onClick:()=>o("overview"),icon:$h,children:t("errorLogs.tabOverview")}),p.jsx(Gl,{active:i==="headers",onClick:()=>o("headers"),icon:UE,children:t("errorLogs.tabHeaders")}),p.jsx(Gl,{active:i==="request",onClick:()=>o("request"),icon:yP,children:t("errorLogs.tabRequest")}),p.jsx(Gl,{active:i==="response",onClick:()=>o("response"),icon:zE,children:t("errorLogs.tabResponse")}),p.jsx(Gl,{active:i==="raw",onClick:()=>o("raw"),icon:FE,children:t("errorLogs.tabRaw")})]}),p.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[i==="overview"&&p.jsx(A3,{parsed:d}),i==="headers"&&p.jsx(P3,{headers:d.requestHeaders}),i==="request"&&p.jsx(aw,{content:d.requestBody,label:t("errorLogs.tabRequest")}),i==="response"&&p.jsx(aw,{content:d.responseBody,label:t("errorLogs.tabResponse")}),i==="raw"&&p.jsx(D3,{content:a})]})]}):p.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:p.jsxs("div",{className:"text-center space-y-3",children:[p.jsx(_E,{className:"w-10 h-10 mx-auto opacity-40"}),p.jsx("p",{className:"text-sm",children:t("errorLogs.selectLog")})]})})}function T3(){const{t:n}=xe(),{data:e,isLoading:t}=WP(),{data:i,isLoading:o,error:a}=eH(e?.running??!1),[r,c]=w.useState(500),[d,f]=w.useState(!1),g=w.useRef(null),m=w.useRef(null),x=()=>{m.current&&(clearInterval(m.current),m.current=null)};w.useEffect(()=>{if(!d)return;const M=N=>{const I=g.current;if(!I)return;const U=I.getBoundingClientRect().top+window.scrollY,z=N.pageY-U;c(Math.max(300,z));const F=window.innerHeight-N.clientY,B=15;x(),F<50?m.current=setInterval(()=>{window.scrollBy(0,B)},16):N.clientY<50&&(m.current=setInterval(()=>{window.scrollBy(0,-B)},16))},L=()=>{f(!1),x(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",M),document.addEventListener("mouseup",L),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",L),document.body.style.cursor="default",document.body.style.userSelect="auto",x()}},[d]);const v=M=>{M.preventDefault(),f(!0)},C=w.useMemo(()=>i?.[0]?.name??null,[i]),[k,A]=w.useState(null),D=k??C,O=w.useMemo(()=>!D||!i?void 0:i.find(L=>L.name===D)?.absolutePath,[D,i]);if(t||!e?.running)return null;if(o)return p.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:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[p.jsx(tt,{className:"h-4 w-32"}),p.jsx(tt,{className:"h-4 w-20"})]}),p.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(M=>p.jsx(tt,{className:"h-12 w-full rounded-lg"},M))})]});if(!i||i.length===0)return null;const T=i.length;return p.jsxs("div",{ref:g,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:r},children:[p.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:[p.jsxs("div",{className:"flex items-center gap-2.5",children:[p.jsx(wi,{className:"w-4 h-4 text-amber-500"}),p.jsx("span",{className:"text-sm font-semibold tracking-tight",children:n("errorLogs.title")}),p.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:n("errorLogs.failedRequests",{count:T})})]}),p.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[p.jsx(qE,{className:"w-3.5 h-3.5"}),p.jsx("span",{children:n("errorLogs.cliproxyDiagnostics")})]})]}),p.jsx("div",{className:"flex-1 min-h-0",children:p.jsxs(Yb,{direction:"horizontal",children:[p.jsx(kc,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:p.jsxs(Vr,{className:"h-full",children:[p.jsx("div",{className:"divide-y divide-border/50",children:i.slice(0,50).map(M=>p.jsx(w3,{name:M.name,size:M.size,modified:M.modified,isSelected:D===M.name,onClick:()=>A(M.name),statusCode:M.statusCode,model:M.model},M.name))}),i.length>50&&p.jsx("div",{className:"px-3 py-3 text-center text-[10px] text-muted-foreground border-t border-border/50",children:n("errorLogs.showingCount",{total:i.length})})]})}),p.jsxs($b,{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:[p.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),p.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:p.jsx(Yh,{className:"h-4 w-4 text-muted-foreground"})})]}),p.jsx(kc,{className:"flex flex-col min-w-0 bg-background/50",children:p.jsx(O3,{name:D,absolutePath:O})})]})}),a?p.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:a.message}):p.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:v,children:p.jsx(GE,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const M3=Xh("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"}}),lc=w.forwardRef(({className:n,variant:e,...t},i)=>p.jsx("div",{ref:i,role:"alert",className:q(M3({variant:e}),n),...t}));lc.displayName="Alert";const bh=w.forwardRef(({className:n,...e},t)=>p.jsx("h5",{ref:t,className:q("mb-1 font-medium leading-none tracking-tight",n),...e}));bh.displayName="AlertTitle";const cc=w.forwardRef(({className:n,...e},t)=>p.jsx("div",{ref:t,className:q("text-sm [&_p]:leading-relaxed",n),...e}));cc.displayName="AlertDescription";function N3(){return jt({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function AD(n,e){return typeof n=="object"&&n!==null&&"error"in n&&typeof n.error=="string"?n.error:e}function PD(n){const e=n.trim();if(!e)return null;try{return JSON.parse(e)}catch{return null}}function L3(n){const e=n.trim().toLowerCase();return e.startsWith("<!doctype html")||e.startsWith("<html")}function R3(n){if(!n||typeof n!="object")return!1;const e=n;return!(typeof e.content!="string"||"contentPath"in e&&typeof e.contentPath!="string")}async function DD(n,e){const t=await n.text(),i=PD(t);if(!n.ok){const o=AD(i,e);throw new Error(o)}if(i===null)throw new Error(e);return i}function E3(){return jt({queryKey:["shared","summary"],queryFn:async()=>{const n=await fetch("/api/shared/summary");return DD(n,"Failed to fetch shared summary")}})}function EW(n){return jt({queryKey:["shared",n],enabled:n!=="settings",queryFn:async()=>{if(n==="settings")return{items:[]};const e=await fetch(`/api/shared/${n}`);return DD(e,`Failed to fetch shared ${n}`)}})}function IW(n,e){return jt({queryKey:["shared",n,"content",e],enabled:typeof e=="string"&&e.length>0,queryFn:async()=>{if(!e)throw new Error("Missing shared item path");const t=new URLSearchParams({type:n,path:e}),i=await fetch(`/api/shared/content?${t.toString()}`),o=await i.text(),a=PD(o);if(!i.ok)throw new Error(AD(a,`Failed to fetch shared ${n} content`));if(R3(a))return{content:a.content,contentPath:typeof a.contentPath=="string"&&a.contentPath.length>0?a.contentPath:e};if(o.trim().length>0){if(L3(o))throw new Error("Shared content endpoint unavailable. Restart `ccs config` and try again.");return{content:o,contentPath:e}}throw new Error(`Failed to fetch shared ${n} content`)}})}const I3={ok:"success",warning:"warning",error:"error"},j3={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 Dd({title:n,value:e,icon:t,variant:i="default",onClick:o}){const a=j3[i];return p.jsxs("button",{onClick:o,className:q("flex items-center gap-3 px-4 py-2.5 rounded-lg border bg-card/50","transition-all hover:bg-card hover:shadow-sm hover:-translate-y-0.5","active:scale-[0.98]"),children:[p.jsx("div",{className:q("flex items-center justify-center w-9 h-9 rounded-md",a.iconBg),children:p.jsx(t,{className:q("w-4 h-4",a.iconColor)})}),p.jsxs("div",{className:"text-left",children:[p.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:n}),p.jsx("p",{className:q("text-lg font-bold font-mono leading-tight",a.iconColor),children:e})]})]})}function B3(){const{t:n}=xe(),e=bb(),{data:t,isLoading:i}=N3(),{data:o,isLoading:a}=E3();if(i||a)return p.jsxs("div",{className:"p-6 space-y-6",children:[p.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx(tt,{className:"h-12 w-12 rounded-lg"}),p.jsxs("div",{children:[p.jsx(tt,{className:"h-7 w-[180px] mb-2"}),p.jsx(tt,{className:"h-4 w-[220px]"})]})]}),p.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(c=>p.jsx(tt,{className:"h-14 w-28 rounded-lg"},c))})]}),p.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[p.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[p.jsx(tt,{className:"h-4 w-32"}),p.jsx(tt,{className:"h-4 w-20"})]}),p.jsx("div",{className:"px-4 py-3 border-b",children:p.jsx(tt,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(c=>p.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[p.jsx(tt,{className:"w-2.5 h-2.5 rounded-full"}),p.jsx(tt,{className:"h-4 flex-1"}),p.jsx(tt,{className:"h-1.5 w-24 rounded-full"}),p.jsx(tt,{className:"h-4 w-16"})]},c))]})]});const r=t?.health?I3[t.health.status]:void 0;return p.jsxs("div",{className:"p-6 space-y-6",children:[p.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[p.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:p.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),p.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[p.jsx(g5,{version:t?.version}),p.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[p.jsx(Dd,{title:n("home.profiles"),value:t?.profiles??0,icon:ny,variant:"accent",onClick:()=>e("/providers")}),p.jsx(Dd,{title:n("home.cliproxy"),value:t?.cliproxy??0,icon:aP,variant:"accent",onClick:()=>e("/cliproxy")}),p.jsx(Dd,{title:n("home.accounts"),value:t?.accounts??0,icon:lP,variant:"default",onClick:()=>e("/accounts")}),p.jsx(Dd,{title:n("home.health"),value:t?.health?`${t.health.passed}/${t.health.total}`:"-",icon:xc,variant:r,onClick:()=>e("/health")})]})]})]}),o?.symlinkStatus&&!o.symlinkStatus.valid&&p.jsxs(lc,{variant:"warning",children:[p.jsx(wi,{className:"h-4 w-4"}),p.jsx(bh,{children:n("home.configurationRequired")}),p.jsx(cc,{children:o.symlinkStatus.message})]}),p.jsx(RH,{}),p.jsx("div",{className:"rounded-xl border bg-card/70 p-5",children:p.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"rounded-xl bg-muted p-2.5",children:p.jsx(uP,{className:"h-5 w-5 text-muted-foreground"})}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("h2",{className:"text-lg font-semibold",children:n("homePageV2.logsMoved")}),p.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."})]})]}),p.jsxs(ht,{variant:"outline",className:"gap-2",onClick:()=>e("/logs"),children:["Open logs",p.jsx(KE,{className:"h-4 w-4"})]})]})}),p.jsx(T3,{})]})}const OD=iE,Xb=w.forwardRef(({className:n,...e},t)=>p.jsx(ZA,{ref:t,className:q("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",n),...e}));Xb.displayName=ZA.displayName;const xh=w.forwardRef(({className:n,...e},t)=>p.jsx(eP,{ref:t,className:q("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",n),...e}));xh.displayName=eP.displayName;const gy=w.forwardRef(({className:n,...e},t)=>p.jsx(tP,{ref:t,className:q("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...e}));gy.displayName=tP.displayName;function yn({className:n,...e}){return p.jsx(oE,{"data-slot":"label",className:q("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",n),...e})}const Jb="ccs:openrouter-models",H3=1440*60*1e3,TD="1";function my(n){const e=parseFloat(n);return isNaN(e)||e===0?0:e*1e6}function rw(n){const e=my(n);return e===0?re.t("openrouterUtils.priceFree"):e<.01?re.t("openrouterUtils.priceLessThanCent"):e<1?`$${e.toFixed(2)}`:`$${e.toFixed(e<10?2:0)}`}function _3(n){const e=rw(n.prompt),t=rw(n.completion);return e===re.t("openrouterUtils.priceFree")&&t===re.t("openrouterUtils.priceFree")?re.t("openrouterUtils.priceFree"):`${e}/${t}`}function U3(n){const e=n.id.toLowerCase();return e.startsWith("anthropic/")?"anthropic":e.startsWith("openai/")?"openai":e.startsWith("google/")?"google":e.startsWith("meta-llama/")||e.startsWith("meta/")?"meta":e.startsWith("mistralai/")?"mistral":e.includes(":free")||e.includes("qwen")||e.includes("deepseek")?"opensource":"other"}function z3(n){return{...n,category:U3(n),pricePerMillionPrompt:my(n.pricing.prompt),pricePerMillionCompletion:my(n.pricing.completion),isFree:n.pricing.prompt==="0"&&n.pricing.completion==="0",isExacto:n.id.includes(":exacto")}}function F3(n,e,t){const i=e.toLowerCase().trim();return n.filter(o=>t?.category&&o.category!==t.category||t?.freeOnly&&!o.isFree||t?.minContext&&o.context_length<t.minContext?!1:i?o.id.toLowerCase().includes(i)||o.name.toLowerCase().includes(i)||o.description?.toLowerCase().includes(i):!0)}function jW(n){return[...n].sort((e,t)=>{if(e.isFree&&!t.isFree)return-1;if(!e.isFree&&t.isFree)return 1;if(!e.isFree&&!t.isFree){if(e.isExacto&&!t.isExacto)return-1;if(!e.isExacto&&t.isExacto)return 1}return e.name.localeCompare(t.name)})}function q3(){try{const n=localStorage.getItem(Jb);if(!n)return null;const e=JSON.parse(n);return e.version!==TD||Date.now()-e.fetchedAt>H3?null:e.models}catch{return null}}function G3(n){try{localStorage.setItem(Jb,JSON.stringify({models:n,fetchedAt:Date.now(),version:TD}))}catch{}}function K3(){localStorage.removeItem(Jb)}function BW(n,e){const[t]=n.split("/");if(!t)return{};const i=e.filter(r=>r.id.startsWith(`${t}/`));if(i.length===0)return{};const o=[...i].sort((r,c)=>c.pricePerMillionPrompt-r.pricePerMillionPrompt),a=Math.ceil(o.length/3);return{opus:o[0]?.id,sonnet:o[Math.min(a,o.length-1)]?.id,haiku:o[o.length-1]?.id}}function V3(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${Math.round(n/1e3)}K`:String(n)}const HW={anthropic:"Anthropic (Claude)",openai:"OpenAI (GPT)",google:"Google (Gemini)",meta:"Meta (Llama)",mistral:"Mistral",opensource:"Open Source",other:"Other"},W3={anthropic:["anthropic/"],openai:["openai/"],google:["google/"],meta:["meta-llama/","meta/"],mistral:["mistralai/"],opensource:["deepseek/","qwen/","cohere/"],other:[]};function Q3(n,e=2){const t=[],i=["anthropic","openai","google","meta","mistral","opensource"];for(const o of i){const a=W3[o];if(a.length===0)continue;const c=[...n.filter(d=>a.some(f=>d.id.toLowerCase().startsWith(f)))].sort((d,f)=>(f.created??0)-(d.created??0));t.push(...c.slice(0,e))}return t.sort((o,a)=>(a.created??0)-(o.created??0))}function Y3(n){const t=Date.now()/1e3-n;return t<86400?re.t("openrouterUtils.ageToday"):t<172800?re.t("openrouterUtils.ageYesterday"):t<604800?re.t("openrouterUtils.ageDaysAgo",{count:Math.floor(t/86400)}):t<2592e3?re.t("openrouterUtils.ageWeeksAgo",{count:Math.floor(t/604800)}):t<31536e3?re.t("openrouterUtils.ageMonthsAgo",{count:Math.floor(t/2592e3)}):re.t("openrouterUtils.ageYearsAgo",{count:Math.floor(t/31536e3)})}const $3="https://openrouter.ai/api/v1/models",MD=["openrouter-models"],lw=1440*60*1e3;async function X3(){const n=await fetch($3);if(!n.ok)throw new Error(`Failed to fetch OpenRouter models: ${n.status}`);const t=(await n.json()).data;return G3(t),t}function ND(){return jt({queryKey:MD,queryFn:X3,staleTime:lw,gcTime:lw,initialData:()=>q3()??void 0,refetchOnWindowFocus:!1})}function J3(){const n=ND(),e=(n.data??[]).map(z3);return{...n,models:e}}function _W(){const n=bt();return()=>(K3(),n.invalidateQueries({queryKey:MD}))}function UW(){const{data:n,isLoading:e,isError:t}=ND();return{isReady:!!n&&n.length>0,isLoading:e,isError:t,modelCount:n?.length??0}}function Zb({profileEnv:n={}}){const{t:e}=xe(),[t,i]=w.useState(null),[o,a]=w.useState(!0),[r,c]=w.useState(!1);w.useEffect(()=>{d()},[]);const d=async()=>{try{a(!0);const v=await fetch("/api/global-env");if(!v.ok)throw new Error("Failed to load");const C=await v.json();i(C)}catch{i(null)}finally{a(!1)}};if(o||!t?.enabled)return null;const f=t.env||{},g=Object.keys(f);if(g.length===0)return null;const m=g.filter(v=>!(v in n)),x=g.filter(v=>v in n);return p.jsxs("div",{className:"border-t bg-muted/20",children:[p.jsxs("button",{onClick:()=>c(!r),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[p.jsx($h,{className:"w-4 h-4 text-blue-500"}),p.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[e("globalEnvIndicator.injectedCount",{count:m.length}),x.length>0&&p.jsx("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:e("globalEnvIndicator.overriddenCount",{count:x.length})})]}),r?p.jsx(vb,{className:"w-4 h-4 text-muted-foreground"}):p.jsx(Qh,{className:"w-4 h-4 text-muted-foreground"})]}),r&&p.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[m.length>0&&p.jsx("div",{className:"space-y-1",children:m.map(v=>p.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:[p.jsx("span",{className:"text-green-500",children:"+"}),p.jsxs("span",{className:"truncate",children:[v,"=",f[v]]})]},v))}),x.length>0&&p.jsxs("div",{className:"space-y-1",children:[p.jsx("p",{className:"text-xs text-muted-foreground",children:e("globalEnvIndicator.skippedLabel")}),x.map(v=>p.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:[p.jsx("span",{className:"text-amber-500",children:"~"}),p.jsx("span",{className:"truncate",children:v})]},v))]}),p.jsx("div",{className:"pt-2 border-t border-border/50",children:p.jsx(ht,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:p.jsxs(dh,{to:"/settings?tab=globalenv",children:[p.jsx(Sb,{className:"w-3.5 h-3.5"}),e("globalEnvIndicator.configureInSettings"),p.jsx(fP,{className:"w-3 h-3 opacity-50"})]})})})]})]})}function Z3({className:n,...e}){return p.jsx(sE,{"data-slot":"switch",className:q("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",n),...e,children:p.jsx(aE,{"data-slot":"switch-thumb",className:q("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 e_(n,e,t){return n(t==="refreshing"?"imageAnalysisStatus.refreshingPreview":t==="invalid"?"imageAnalysisStatus.savedStatus":e==="editor"?"imageAnalysisStatus.livePreview":"imageAnalysisStatus.savedStatus")}function t_(n,e,t){return e.status==="disabled"?n("imageAnalysisStatus.disabledGlobally"):t!=="claude"?n("imageAnalysisStatus.targetBypassesHook",{target:n(`imageAnalysisStatus.targetLabel.${t}`)}):e.nativeReadPreference?n("imageAnalysisStatus.nativeImageReading"):e.status==="hook-missing"?n("imageAnalysisStatus.setupNeeded"):e.authReadiness==="missing"?n("imageAnalysisStatus.needsAuth"):e.proxyReadiness==="unavailable"?n("imageAnalysisStatus.needsProxy"):e.effectiveRuntimeMode==="native-read"?n("imageAnalysisStatus.nativeFallback"):n("imageAnalysisStatus.transformerReady")}function n_(n,e,t){return e.status==="disabled"?{label:n("imageAnalysisStatus.badgeDisabled"),className:"border-border/80 bg-background/85 text-muted-foreground"}:t!=="claude"?{label:n("imageAnalysisStatus.badgeBypassed"),className:"border-sky-500/25 bg-sky-500/10 text-sky-800 dark:text-sky-200"}:e.nativeReadPreference?{label:n("imageAnalysisStatus.badgeNative"),className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}:e.status==="hook-missing"||e.authReadiness==="missing"?{label:e.status==="hook-missing"?n("imageAnalysisStatus.badgeSetup"):n("imageAnalysisStatus.badgeAuth"),className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:e.proxyReadiness==="unavailable"?{label:n("imageAnalysisStatus.badgeProxy"),className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:{label:n("imageAnalysisStatus.badgeReady"),className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}}function i_(n,e,t){if(e.nativeReadPreference)return e.profileModel&&e.nativeImageCapable?n("imageAnalysisStatus.toggleSummaryNativeCapable",{model:e.profileModel}):e.profileModel?n("imageAnalysisStatus.toggleSummaryNativeModel",{model:e.profileModel}):n("imageAnalysisStatus.toggleSummaryNativeDefault");if(!e.backendDisplayName&&t==="claude")return n("imageAnalysisStatus.toggleSummaryNativeFileAccess");if(!e.backendDisplayName)return n("imageAnalysisStatus.toggleSummaryInactiveTarget",{target:n(`imageAnalysisStatus.targetLabel.${t}`)});const i=e.model?` · ${e.model}`:"";return n("imageAnalysisStatus.toggleSummaryTransformerRoute",{backend:e.backendDisplayName,modelSuffix:i})}function o_(n,e,t){return e.status==="disabled"?n("imageAnalysisStatus.noteDisabledGlobally"):t!=="claude"?n("imageAnalysisStatus.noteTargetBypassesHook",{target:n(`imageAnalysisStatus.targetLabel.${t}`)}):e.nativeReadPreference?e.nativeImageCapable===!0?null:e.nativeImageReason:e.status==="hook-missing"?n("imageAnalysisStatus.notePersistHook"):e.authReadiness==="missing"?e.authReason:e.proxyReadiness==="unavailable"?e.proxyReason:null}function s_({status:n,target:e="claude",source:t="saved",previewState:i="saved",nativeReadPreferenceOverride:o,onToggleNativeRead:a}){const{t:r}=xe();if(!n)return p.jsxs("div",{className:"rounded-2xl border bg-muted/20 px-4 py-3","aria-live":"polite",children:[p.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),p.jsx("div",{className:"mt-2 h-3 w-52 animate-pulse rounded bg-muted"})]});const c=o??n.nativeReadPreference,d={...n,nativeReadPreference:c},f=n_(r,d,e),g=o_(r,d,e),m=n.nativeImageCapable?r("imageAnalysisStatus.capabilityVerified"):n.profileModel?r("imageAnalysisStatus.capabilityUnknown"):null;return p.jsxs("section",{className:"rounded-2xl border bg-background/95 px-4 py-3 shadow-sm",children:[p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsx("div",{className:"min-w-0",children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.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:p.jsx(bP,{className:"h-4 w-4"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("h3",{className:"text-sm font-semibold",children:r("imageAnalysisStatus.sectionTitle")}),p.jsx(Qt,{className:q("h-5 border px-1.5 text-[10px]",f.className),children:f.label})]}),p.jsxs("p",{className:"text-xs text-muted-foreground",children:[e_(r,t,i)," ·"," ",t_(r,d,e)]})]})]})}),p.jsx(ht,{size:"sm",variant:"outline",className:"h-8 shrink-0",asChild:!0,children:p.jsxs(dh,{to:"/settings?tab=image",children:[r("imageAnalysisStatus.openSettings"),p.jsx(yP,{className:"ml-1 h-3.5 w-3.5"})]})})]}),p.jsx("div",{className:"mt-3 rounded-xl border bg-muted/15 px-3 py-3",children:p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("div",{className:"text-sm font-medium text-foreground",children:r("imageAnalysisStatus.useNativeImageReading")}),m&&p.jsx(Qt,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:m})]}),p.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:i_(r,d,e)})]}),p.jsx(Z3,{checked:c,onCheckedChange:a,disabled:!a,"aria-label":r("imageAnalysisStatus.useNativeImageReading")})]})}),g&&p.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:g})]})}const a_=w.lazy(()=>rt(()=>Promise.resolve().then(()=>Nf),void 0).then(n=>({default:n.CodeEditor})));function zW({rawJsonContent:n,isRawJsonValid:e,rawJsonEdits:t,settings:i,profileTarget:o="claude",imageAnalysisStatus:a,imageAnalysisStatusSource:r="saved",imageAnalysisStatusPreviewState:c="saved",nativeReadPreferenceOverride:d,onToggleNativeRead:f,onChange:g,missingRequiredFields:m=[]}){const{t:x}=xe(),v=m.length>0;return p.jsx(w.Suspense,{fallback:p.jsxs("div",{className:"flex items-center justify-center h-full",children:[p.jsx(hi,{className:"w-6 h-6 animate-spin text-muted-foreground"}),p.jsx("span",{className:"ml-2 text-muted-foreground",children:x("profileEditorSections.loadingEditor")})]}),children:p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!e&&t!==null&&p.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:[p.jsx(Kr,{className:"w-4 h-4"}),x("profileEditor.invalidJson")]}),e&&v&&p.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:[p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),p.jsxs("div",{children:[p.jsxs("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:[x("profileEditor.missingFields"),":"]})," ",p.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:m.join(", ")}),p.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:x("profileEditor.missingFieldsHint")})]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:p.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:p.jsx(a_,{value:n,onChange:g,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx(s_,{status:a,target:o,source:r,previewState:c,nativeReadPreferenceOverride:d,onToggleNativeRead:f})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx("div",{className:"border rounded-md overflow-hidden",children:p.jsx(Zb,{profileEnv:i?.env})})})]})})}function cw(n,e){try{var t=n()}catch(i){return e(i)}return t&&t.then?t.then(void 0,e):t}function r_(n,e){for(var t={};n.length;){var i=n[0],o=i.code,a=i.message,r=i.path.join(".");if(!t[r])if("unionErrors"in i){var c=i.unionErrors[0].errors[0];t[r]={message:c.message,type:c.code}}else t[r]={message:a,type:o};if("unionErrors"in i&&i.unionErrors.forEach(function(g){return g.errors.forEach(function(m){return n.push(m)})}),e){var d=t[r].types,f=d&&d[i.code];t[r]=xP(r,e,t,o,f?[].concat(f,i.message):i.message)}n.shift()}return t}function l_(n,e){for(var t={};n.length;){var i=n[0],o=i.code,a=i.message,r=i.path.join(".");if(!t[r])if(i.code==="invalid_union"&&i.errors.length>0){var c=i.errors[0][0];t[r]={message:c.message,type:c.code}}else t[r]={message:a,type:o};if(i.code==="invalid_union"&&i.errors.forEach(function(g){return g.forEach(function(m){return n.push(m)})}),e){var d=t[r].types,f=d&&d[i.code];t[r]=xP(r,e,t,o,f?[].concat(f,i.message):i.message)}n.shift()}return t}function c_(n,e,t){if(t===void 0&&(t={}),(function(i){return"_def"in i&&typeof i._def=="object"&&"typeName"in i._def})(n))return function(i,o,a){try{return Promise.resolve(cw(function(){return Promise.resolve(n[t.mode==="sync"?"parse":"parseAsync"](i,e)).then(function(r){return a.shouldUseNativeValidation&&ok({},a),{errors:{},values:t.raw?Object.assign({},i):r}})},function(r){if((function(c){return Array.isArray(c?.issues)})(r))return{values:{},errors:sk(r_(r.errors,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw r}))}catch(r){return Promise.reject(r)}};if((function(i){return"_zod"in i&&typeof i._zod=="object"})(n))return function(i,o,a){try{return Promise.resolve(cw(function(){return Promise.resolve((t.mode==="sync"?R2:E2)(n,i,e)).then(function(r){return a.shouldUseNativeValidation&&ok({},a),{errors:{},values:t.raw?Object.assign({},i):r}})},function(r){if((function(c){return c instanceof I2})(r))return{values:{},errors:sk(l_(r.issues,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw r}))}catch(r){return Promise.reject(r)}};throw new Error("Invalid input: not a Zod schema")}const u_={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 d_({provider:n,className:e,size:t="md"}){const i=UB(n),o=u_[t],a=zP(n),r=FB(n);return p.jsx("div",{className:q("flex items-center justify-center rounded-md",a&&!r&&(zB(n)?"bg-gray-900 p-1":"bg-white p-1"),o.container,e),children:a?p.jsx("img",{src:a,alt:`${n} logo`,className:q(r?o.container:o.icon,"object-contain")}):p.jsx("span",{className:q("font-semibold",i.textClass,o.text),children:i.letter})})}function FW(){return jt({queryKey:["profiles"],queryFn:()=>Ue.profiles.list()})}function h_(){const n=bt(),{t:e}=xe();return pt({mutationFn:t=>Ue.profiles.create(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileCreated"))},onError:t=>{fe.error(t.message)}})}function qW(){const n=bt(),{t:e}=xe();return pt({mutationFn:t=>Ue.profiles.delete(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileDeleted"))},onError:t=>{fe.error(t.message)}})}function GW(){return pt({mutationFn:()=>Ue.profiles.discoverOrphans()})}function KW(){const n=bt(),{t:e}=xe();return pt({mutationFn:t=>Ue.profiles.registerOrphans(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.orphanProfilesComplete"))}})}function VW(){const n=bt(),{t:e}=xe();return pt({mutationFn:({name:t,data:i})=>Ue.profiles.copy(t,i),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileCopied"))}})}function WW(){return pt({mutationFn:({name:n,includeSecrets:e})=>Ue.profiles.export(n,e??!1)})}function QW(){const n=bt(),{t:e}=xe();return pt({mutationFn:t=>Ue.profiles.import(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileImported"))}})}const f_="https://openrouter.ai/api/v1",LD=Object.freeze({glmt:"glm",kimi:"km",alibaba:"alibaba-coding-plan",acp:"alibaba-coding-plan",hf:"huggingface",te:"tuningengines",tuning:"tuningengines"}),RD=[{id:"openrouter",name:"OpenRouter",description:"349+ models from OpenAI, Anthropic, Google, Meta",baseUrl:f_,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:"tuningengines",name:"Tuning Engines",description:"OpenAI-compatible chat completions gateway",baseUrl:"https://api.tuningengines.com/v1",defaultProfileName:"te",defaultModel:"gpt-4o",apiKeyPlaceholder:"sk-te-...",apiKeyHint:"Create an inference key at app.tuningengines.com/inference/keys",category:"alternative",requiresApiKey:!0,defaultTarget:"droid",badge:"Gateway"},{id:"glm",name:"GLM",description:"Direct Z.AI Anthropic-compatible API profile",baseUrl:"https://api.z.ai/api/anthropic",defaultProfileName:"glm",defaultModel:"glm-5.2",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:"Kimi Code membership API with stable latest-coding model alias",baseUrl:"https://api.kimi.com/coding/",defaultProfileName:"km",defaultModel:"kimi-for-coding",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from the Kimi Code Console",category:"alternative",requiresApiKey:!0,alwaysThinkingEnabled:!0,badge:"Kimi Code",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:"M3 frontier multimodal coding model with 1M context",baseUrl:"https://api.minimax.io/anthropic",defaultProfileName:"mm",defaultModel:"MiniMax-M3",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"},{id:"fireworks",name:"Fireworks AI",description:"Anthropic-compatible inference (Kimi, Qwen, Llama) via api.fireworks.ai",baseUrl:"https://api.fireworks.ai/inference",defaultProfileName:"fireworks",defaultModel:"accounts/fireworks/models/kimi-k2p5",apiKeyPlaceholder:"fw_...",apiKeyHint:"Get your API key at fireworks.ai/api-keys",category:"alternative",requiresApiKey:!0,badge:"Anthropic-compatible"}];function ED(n){return{...n,extraEnv:n.extraEnv?{...n.extraEnv}:void 0}}function p_(n){const e=ED(n);return e.extraEnv&&Object.freeze(e.extraEnv),Object.freeze(e)}function g_(n,e){const t=new Set;for(const o of n){const a=o.id.trim().toLowerCase();if(o.id!==a)throw new Error(`Preset ID must be normalized: "${o.id}"`);if(t.has(o.id))throw new Error(`Duplicate preset ID detected: "${o.id}"`);t.add(o.id)}const i=new Set;for(const[o,a]of Object.entries(e)){const r=o.trim().toLowerCase();if(!r)throw new Error("Preset alias keys cannot be empty");if(o!==r)throw new Error(`Preset alias must be normalized: "${o}"`);if(i.has(r))throw new Error(`Duplicate normalized preset alias detected: "${o}"`);if(i.add(r),!t.has(a))throw new Error(`Preset alias "${o}" points to unknown target "${a}"`);if(t.has(r))throw new Error(`Preset alias "${o}" collides with canonical preset ID "${r}"`)}}g_(RD,LD);const m_=Object.freeze(RD.map(p_));function y_(){return m_.map(ED)}function b_(n){const e=n.trim().toLowerCase();return LD[e]||e}const x_=y_(),ex=Object.freeze(x_.map(n=>({...n})));function v_(n,e){return e||(n?.requiresApiKey===!1?n.apiKeyPlaceholder||n.id:"")}function C_(n){return ex.filter(e=>e.category===n)}function fm(n){const e=b_(n);return ex.find(t=>t.id===e)}const S_=cs().refine(n=>n.trim().length===0||cs().url().safeParse(n).success,{message:"Invalid URL format"}),k_=j2({name:cs().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:S_,apiKey:cs(),model:cs().optional(),opusModel:cs().optional(),sonnetModel:cs().optional(),haikuModel:cs().optional(),target:B2(["claude","droid","codex"])}),w_=["/chat/completions","/v1/messages","/messages","/completions"],Xs="custom",pm="openrouter",ID=new Set(["ollama","llamacpp"]),gm={name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:"",target:"claude"},jD=C_("recommended"),A_=jD.filter(n=>!ID.has(n.id)),P_=jD.filter(n=>ID.has(n.id)),D_=ex.filter(n=>n.category!=="recommended");function YW({open:n,onOpenChange:e,onSuccess:t,initialMode:i="openrouter"}){const{t:o}=xe(),a=h_(),[r,c]=w.useState("basic"),[d,f]=w.useState(null),[g,m]=w.useState(!1),[x,v]=w.useState(pm),[C,k]=w.useState(""),{models:A}=J3(),{register:D,handleSubmit:O,formState:{errors:T},control:M,reset:L,setValue:N}=H2({resolver:c_(k_),defaultValues:gm}),I=ak({control:M,name:"baseUrl"}),W=ak({control:M,name:"target"}),U=w.useCallback(Y=>{if(!Y){L(gm);return}L({...gm,name:Y.defaultProfileName,baseUrl:Y.baseUrl,model:Y.defaultModel,opusModel:Y.defaultModel,sonnetModel:Y.defaultModel,haikuModel:Y.defaultModel,target:Y.defaultTarget??"claude"})},[L]),z=w.useMemo(()=>x===Xs?null:fm(x)??null,[x]),$=w.useMemo(()=>C.trim()?[...F3(A,C)].sort((ae,de)=>(de.created??0)-(ae.created??0)).slice(0,20):Q3(A,2),[A,C]);w.useEffect(()=>{if(n)if(c("basic"),f(null),m(!1),k(""),i==="normal")v(Xs),U(null);else{const ae=fm(i==="openrouter"?pm:i);if(ae){v(ae.id),U(ae);return}v(Xs),U(null)}},[n,i,U,L]);const F=Y=>{const ae=fm(Y);if(ae){v(ae.id),U(ae);return}v(Xs),U(null)},B=Y=>{N("model",Y.id),N("opusModel",Y.id),N("sonnetModel",Y.id),N("haikuModel",Y.id),k(Y.name),fe.success(o("profileCreateDialog.appliedModelToTiers",{model:Y.name}),{duration:2e3})};w.useEffect(()=>{if(I&&x===Xs){const ae=I.toLowerCase();for(const de of w_)if(ae.endsWith(de)){const be=I.replace(new RegExp(de+"$","i"),"");f(`URL ends with "${de}" - Claude appends this automatically. You likely want: ${be}`);return}}f(null)},[I,x]);const ie=async Y=>{if(z?.requiresApiKey!==!1&&!Y.apiKey){fe.error(re.t("commonToast.apiKeyRequired"));return}const ae={...Y,apiKey:v_(z,Y.apiKey)};try{await a.mutateAsync(ae),fe.success(o("profileCreateDialog.profileCreated",{name:ae.name})),t(ae.name),e(!1)}catch(de){fe.error(de.message||o("profileCreateDialog.failedCreate"))}},oe=!!T.name||!!T.baseUrl||!!T.apiKey,H=!!T.model||!!T.opusModel||!!T.sonnetModel||!!T.haikuModel,Z=a.isPending,se=z?.id===pm;return p.jsx(Lb,{open:n,onOpenChange:e,children:p.jsxs(Rb,{"data-testid":"profile-create-dialog",className:"h-[calc(100dvh-2rem)] max-h-[900px] gap-0 overflow-hidden p-0 sm:max-w-[700px] !flex !flex-col",children:[p.jsxs(Eb,{className:"shrink-0 border-b p-6 pb-4",children:[p.jsxs(Ib,{className:"flex items-center gap-2",children:[p.jsx(ek,{className:"w-5 h-5 text-primary"}),o("profileCreateDialog.createProfile")]}),p.jsx(jb,{children:o("profileCreateDialog.chooseProviderHint")})]}),p.jsxs("form",{onSubmit:O(ie),className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[p.jsx("div",{"data-testid":"profile-create-provider-chooser",className:"max-h-[34dvh] shrink-0 space-y-3 overflow-y-auto overscroll-contain border-b bg-muted/10 px-6 py-3",children:p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex items-start justify-between gap-4",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx(yn,{className:"text-xs text-muted-foreground",children:o("profileEditor.provider")}),p.jsx("p",{className:"text-xs text-muted-foreground",children:o("profileEditor.providerChooserHint")})]}),p.jsx("span",{className:"pt-0.5 text-[11px] text-muted-foreground",children:o("profileEditor.scrollHint")})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:o("profileEditor.featuredProviders")}),p.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:p.jsxs("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:[A_.map(Y=>p.jsx(mm,{preset:Y,isSelected:x===Y.id,onClick:()=>F(Y.id),density:"featured"},Y.id)),p.jsx("div",{className:"mx-1 hidden w-px rounded-full bg-border/70 sm:block"}),p.jsx(O_,{isSelected:x===Xs,onClick:()=>F(Xs)})]})})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:o("profileEditor.morePresets")}),p.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:p.jsx("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:D_.map(Y=>p.jsx(mm,{preset:Y,isSelected:x===Y.id,onClick:()=>F(Y.id),density:"compact"},Y.id))})})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:o("openrouterQuickStart.localRuntimesTitle")}),p.jsx("div",{className:"flex flex-wrap gap-2",children:P_.map(Y=>p.jsx(mm,{preset:Y,isSelected:x===Y.id,onClick:()=>F(Y.id),density:"compact"},Y.id))})]})]})}),p.jsxs(OD,{value:r,onValueChange:c,className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[p.jsx("div",{className:"px-6 pt-4",children:p.jsxs(Xb,{className:"grid w-full grid-cols-2",children:[p.jsxs(xh,{value:"basic",className:"relative",children:[o("profileCreateDialog.basicInformation"),oe&&p.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),p.jsxs(xh,{value:"models",className:"relative",children:[o("profileCreateDialog.modelConfiguration"),H&&p.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),p.jsxs("div",{"data-testid":"profile-create-tab-scroll",className:"flex-1 min-h-0 overflow-y-auto",children:[p.jsxs(gy,{value:"basic",className:"p-6 space-y-4 mt-0",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"name",children:[o("profileDialog.name")," ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsx(Hi,{id:"name",...D("name"),placeholder:o("profileDialog.namePlaceholder"),className:"font-mono"}),T.name?p.jsx("p",{className:"text-xs text-destructive",children:T.name.message}):p.jsxs("p",{className:"text-xs text-muted-foreground",children:[o("profileCreateDialog.usedInCli")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(yn,{htmlFor:"baseUrl",children:o("profileCreateDialog.apiBaseUrl")}),p.jsx(Hi,{id:"baseUrl",...D("baseUrl"),placeholder:o("profileCreateDialog.baseUrlPlaceholder")}),T.baseUrl?p.jsx("p",{className:"text-xs text-destructive",children:T.baseUrl.message}):d?p.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:[p.jsx(wi,{className:"w-4 h-4 shrink-0 mt-0.5"}),p.jsx("span",{children:d})]}):z?p.jsx("p",{className:"text-xs text-muted-foreground",children:z.baseUrl?o("profileCreateDialog.prefilledFromPreset",{name:z.name}):o("profileCreateDialog.optionalForPreset",{name:z.name})}):p.jsx("p",{className:"text-xs text-muted-foreground",children:o("profileCreateDialog.endpointHint")})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"apiKey",children:[o("profileDialog.apiKey")," ",z?.requiresApiKey!==!1&&p.jsx("span",{className:"text-destructive",children:"*"}),z?.requiresApiKey===!1&&p.jsx("span",{className:"text-muted-foreground text-xs font-normal",children:o("profileCreateDialog.optional")})]}),p.jsxs("div",{className:"relative",children:[p.jsx(Hi,{id:"apiKey",type:g?"text":"password",...D("apiKey"),placeholder:z?.requiresApiKey===!1?o("profileCreateDialog.apiKeyOptionalPlaceholder"):z?.apiKeyPlaceholder??o("profileCreateDialog.apiKeyPlaceholder"),className:"pr-10"}),p.jsx(ht,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>m(!g),tabIndex:-1,children:g?p.jsx(Vc,{className:"h-4 w-4"}):p.jsx(Wc,{className:"h-4 w-4"})})]}),T.apiKey?p.jsx("p",{className:"text-xs text-destructive",children:T.apiKey.message}):z?.requiresApiKey===!1?p.jsx("p",{className:"text-xs text-muted-foreground",children:o("profileCreateDialog.apiKeyOptionalHint")}):z?.apiKeyHint&&p.jsx("p",{className:"text-xs text-muted-foreground",children:z.apiKeyHint})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(yn,{htmlFor:"target",children:o("codex.defaultTargetCli")}),p.jsxs(FP,{value:W,onValueChange:Y=>N("target",Y),children:[p.jsx(zb,{id:"target",children:p.jsx(qP,{})}),p.jsxs(Fb,{children:[p.jsx(rc,{value:"claude",children:o("profileCard.claudeCodeDefault")}),p.jsx(rc,{value:"droid",children:o("profileCard.factoryDroid")}),p.jsx(rc,{value:"codex",children:o("profileCard.codexCli")})]})]}),p.jsxs("p",{className:"text-xs text-muted-foreground",children:[W==="droid"?p.jsxs(p.Fragment,{children:[o("profileEditor.targetHintPreferredAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-droid"}),"."]}):W==="codex"?p.jsxs(p.Fragment,{children:[o("profileEditor.targetHintPreferredAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsx"}),"."]}):p.jsxs(p.Fragment,{children:[o("profileEditor.targetHintClaudeDefault")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs"}),"."]}),W==="droid"?p.jsxs(p.Fragment,{children:[" ",o("profileEditor.targetHintLegacyAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsd"}),"."]}):W==="codex"?p.jsxs(p.Fragment,{children:[" ",o("profileEditor.targetHintLegacyAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-codex"}),"."]}):null," ",o("profileEditor.targetHintOverride")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"--target"}),"."]})]})]}),p.jsxs(gy,{value:"models",className:"p-6 mt-0 space-y-4",children:[p.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:[p.jsx($h,{className:"w-5 h-5 shrink-0 mt-0.5"}),p.jsxs("div",{children:[p.jsx("p",{className:"font-medium mb-1",children:o("profileCreateDialog.modelMapping")}),p.jsx("p",{className:"text-xs opacity-90",children:o("profileCreateDialog.modelMappingDesc")})]})]}),se&&p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{children:o("openrouterModelPicker.searchModels")}),p.jsx(Hi,{value:C,onChange:Y=>k(Y.target.value),placeholder:o("profileCreateDialog.searchModelsPlaceholder"),onKeyDown:Y=>{Y.key==="Enter"&&$.length>0&&(Y.preventDefault(),B($[0]))}}),p.jsx("div",{className:"border rounded-md max-h-48 overflow-y-auto",children:$.length===0?p.jsx("p",{className:"text-sm text-muted-foreground p-3 text-center",children:C?o("profileCreateDialog.noModelsFound",{query:C}):o("profileCreateDialog.loadingModels")}):p.jsxs("div",{className:"p-1",children:[!C&&p.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground",children:[p.jsx(VE,{className:"w-3 h-3 text-accent"}),p.jsx("span",{children:o("openrouterModelPicker.newestModels")})]}),$.map(Y=>p.jsx(T_,{model:Y,onClick:()=>B(Y),showAge:!C},Y.id))]})})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"model",children:[o("profileCreateDialog.defaultModel"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),p.jsx(Hi,{id:"model",...D("model"),placeholder:z?.defaultModel??"claude-sonnet-4",className:"font-mono text-sm"})]}),p.jsxs("div",{className:"grid gap-3 pt-2 border-t",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"sonnetModel",className:"text-sm",children:[o("profileCreateDialog.sonnetMapping"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),p.jsx(Hi,{id:"sonnetModel",...D("sonnetModel"),placeholder:o("profileCreateDialog.sonnetMappingPlaceholder"),className:"font-mono text-sm h-9"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"opusModel",className:"text-sm",children:[o("profileCreateDialog.opusMapping"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),p.jsx(Hi,{id:"opusModel",...D("opusModel"),placeholder:o("profileCreateDialog.opusMappingPlaceholder"),className:"font-mono text-sm h-9"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"haikuModel",className:"text-sm",children:[o("profileCreateDialog.haikuMapping"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),p.jsx(Hi,{id:"haikuModel",...D("haikuModel"),placeholder:o("profileCreateDialog.haikuMappingPlaceholder"),className:"font-mono text-sm h-9"})]})]})]})]})]}),p.jsxs(CB,{"data-testid":"profile-create-footer",className:"shrink-0 border-t bg-muted/10 p-6 pt-4",children:[p.jsx(ht,{type:"button",variant:"outline",onClick:()=>e(!1),children:o("profileDialog.cancel")}),p.jsx(ht,{type:"submit",disabled:Z,className:q(Z&&"opacity-80"),children:Z?p.jsxs(p.Fragment,{children:[p.jsx(hi,{className:"w-4 h-4 mr-2 animate-spin"}),o("cliproxyDialog.creating")]}):p.jsxs(p.Fragment,{children:[p.jsx(ek,{className:"w-4 h-4 mr-2"}),o("profileCreateDialog.createProfile")]})})]})]})]})]})})}function mm({preset:n,isSelected:e,onClick:t,density:i="compact"}){const o=n.id==="anthropic",a=i==="featured";return p.jsxs("button",{type:"button",onClick:t,className:q("flex flex-none items-center gap-3 rounded-xl border px-3 py-2.5 text-left transition-all",a?"h-[68px] w-[236px]":"h-[64px] w-[168px]",e?"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:[p.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-background",children:o?p.jsx(d_,{provider:"claude",size:"md",className:"rounded-lg"}):n.icon?p.jsx("img",{src:n.icon,alt:"",className:"h-5 w-5 object-contain"}):p.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:n.name.charAt(0)})}),p.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("div",{className:"truncate text-[13px] font-semibold leading-tight tracking-[-0.01em]",children:n.name}),n.badge&&a&&p.jsx(Qt,{variant:"secondary",className:"inline-flex bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:n.badge})]}),n.badge&&!a&&p.jsx(Qt,{variant:"secondary",className:"inline-flex w-fit bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:n.badge})]})]})}function O_({isSelected:n,onClick:e}){const{t}=xe();return p.jsxs("button",{type:"button",onClick:e,className:q("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",n?"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:[p.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:p.jsx(Sb,{className:"h-4 w-4 text-muted-foreground"})}),p.jsx("div",{className:"min-w-0 flex-1",children:p.jsx("div",{className:"text-sm font-semibold leading-tight",children:t("profileEditor.customEndpoint")})})]})}function T_({model:n,onClick:e,showAge:t}){const{t:i}=xe();return p.jsxs("button",{type:"button",onClick:e,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:[p.jsx("span",{className:"flex-1 truncate",children:n.name}),p.jsxs("span",{className:"text-muted-foreground group-hover:text-accent-foreground/80 ml-2 flex items-center gap-2 text-xs",children:[t&&n.created&&p.jsx(Qt,{variant:"outline",className:"text-[10px] text-accent group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30",children:Y3(n.created)}),n.isFree?p.jsx(Qt,{variant:"secondary",className:"text-xs group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground",children:i("profileCreateDialog.free")}):p.jsx("span",{children:_3(n.pricing)}),p.jsx("span",{children:V3(n.context_length)})]})]})}function M_({className:n,...e}){return p.jsx("div",{"data-slot":"card",className:q("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",n),...e})}function N_({className:n,...e}){return p.jsx("div",{"data-slot":"card-header",className:q("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",n),...e})}function L_({className:n,...e}){return p.jsx("div",{"data-slot":"card-title",className:q("leading-none font-semibold",n),...e})}function R_({className:n,...e}){return p.jsx("div",{"data-slot":"card-description",className:q("text-muted-foreground text-sm",n),...e})}function E_({className:n,...e}){return p.jsx("div",{"data-slot":"card-content",className:q("px-6",n),...e})}const tx="[1m]",nx=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL"],I_=new Set(nx);function $W(n){return n.toLowerCase().startsWith("gemini-")}function ix(n){return n.toLowerCase().endsWith(tx.toLowerCase())}function j_(n){return!n||ix(n)?n:`${n}${tx}`}function BD(n){return n&&(ix(n)?n.slice(0,-tx.length):n)}function XW(n){return I_.has(n)}function B_(n){return BD(n.trim()).replace(/\([^)]+\)$/,"")}function JW(n){return nx.some(e=>{const t=n[e];return typeof t=="string"&&ix(t)})}function ZW(n,e,t={}){const i={...n};for(const o of nx){const a=i[o];if(typeof a!="string"||a.trim().length===0)continue;const r=B_(a),c=t.supportsExtendedContext?.(r,o)??!0;i[o]=e&&c?j_(a):BD(a)}return i}const H_=["agy","claude","gemini","codex","cursor","gitlab","codebuddy","qwen","kimi","iflow","kilo","kiro","qoder"],eQ=H_.map(n=>({id:n,name:Ub(n),description:GB(n)})),__=["provider","auth","variant","success"];function tQ(n){return n==="account"?1:__.indexOf(n)}const nQ=lE,iQ=uE,oQ=cE,U_=w.forwardRef(({className:n,align:e="center",sideOffset:t=4,...i},o)=>p.jsx(rE,{children:p.jsx(nP,{ref:o,align:e,sideOffset:t,className:q("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",n),...i})}));U_.displayName=nP.displayName;const z_=w.lazy(()=>rt(()=>Promise.resolve().then(()=>Nf),void 0).then(n=>({default:n.CodeEditor})));function sQ({rawJsonContent:n,isRawJsonValid:e,rawJsonEdits:t,onRawJsonChange:i,profileEnv:o,missingRequiredFields:a=[]}){const{t:r}=xe(),c=a.length>0;return p.jsx(w.Suspense,{fallback:p.jsxs("div",{className:"flex items-center justify-center h-full",children:[p.jsx(hi,{className:"w-6 h-6 animate-spin text-muted-foreground"}),p.jsx("span",{className:"ml-2 text-muted-foreground",children:r("providerEditor.loadingEditor")})]}),children:p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!e&&t!==null&&p.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:[p.jsx(Kr,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),e&&c&&p.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:[p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",p.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:a.join(", ")}),p.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."})]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:p.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:p.jsx(z_,{value:n,onChange:i,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx("div",{className:"border rounded-md overflow-hidden",children:p.jsx(Zb,{profileEnv:o})})})]})})}let yy=[],HD=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?HD:yy).push(t=t+n[e])})();function F_(n){if(n<768)return!1;for(let e=0,t=yy.length;;){let i=e+t>>1;if(n<yy[i])t=i;else if(n>=HD[i])e=i+1;else return!0;if(e==t)return!1}}function uw(n){return n>=127462&&n<=127487}const dw=8205;function q_(n,e,t=!0,i=!0){return(t?_D:G_)(n,e,i)}function _D(n,e,t){if(e==n.length)return e;e&&UD(n.charCodeAt(e))&&zD(n.charCodeAt(e-1))&&e--;let i=ym(n,e);for(e+=hw(i);e<n.length;){let o=ym(n,e);if(i==dw||o==dw||t&&F_(o))e+=hw(o),i=o;else if(uw(o)){let a=0,r=e-2;for(;r>=0&&uw(ym(n,r));)a++,r-=2;if(a%2==0)break;e+=2}else break}return e}function G_(n,e,t){for(;e>0;){let i=_D(n,e-2,t);if(i<e)return i;e--}return 0}function ym(n,e){let t=n.charCodeAt(e);if(!zD(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return UD(i)?(t-55296<<10)+(i-56320)+65536:t}function UD(n){return n>=56320&&n<57344}function zD(n){return n>=55296&&n<56320}function hw(n){return n<65536?1:2}class Je{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=jr(this,e,t);let o=[];return this.decompose(0,e,o,2),i.length&&i.decompose(0,i.length,o,3),this.decompose(t,this.length,o,1),Ui.from(o,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=jr(this,e,t);let i=[];return this.decompose(e,t,i,0),Ui.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),o=new uc(this),a=new uc(e);for(let r=t,c=t;;){if(o.next(r),a.next(r),r=0,o.lineBreak!=a.lineBreak||o.done!=a.done||o.value!=a.value)return!1;if(c+=o.value.length,o.done||c>=i)return!0}}iter(e=1){return new uc(this,e)}iterRange(e,t=this.length){return new FD(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let o=this.line(e).from;i=this.iterRange(o,Math.max(o,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new qD(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Je.empty:e.length<=32?new It(e):Ui.from(It.split(e,[]))}}class It extends Je{constructor(e,t=K_(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,o){for(let a=0;;a++){let r=this.text[a],c=o+r.length;if((t?i:c)>=e)return new V_(o,c,i,r);o=c+1,i++}}decompose(e,t,i,o){let a=e<=0&&t>=this.length?this:new It(fw(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(o&1){let r=i.pop(),c=nh(a.text,r.text.slice(),0,a.length);if(c.length<=32)i.push(new It(c,r.length+a.length));else{let d=c.length>>1;i.push(new It(c.slice(0,d)),new It(c.slice(d)))}}else i.push(a)}replace(e,t,i){if(!(i instanceof It))return super.replace(e,t,i);[e,t]=jr(this,e,t);let o=nh(this.text,nh(i.text,fw(this.text,0,e)),t),a=this.length+i.length-(t-e);return o.length<=32?new It(o,a):Ui.from(It.split(o,[]),a)}sliceString(e,t=this.length,i=`
|
|
17
|
+
`).trim()}function f3(n){const e=n.url.match(/\/api\/provider\/([^/]+)/);e&&(n.provider=e[1]);const t=n.url.match(/\/api\/provider\/[^/]+\/(.+?)(?:\?|$)/);t&&(n.endpoint=t[1]),n.isClientError=n.statusCode>=400&&n.statusCode<500,n.isServerError=n.statusCode>=500,n.statusCode===429?n.errorType="rate_limit":n.statusCode===401||n.statusCode===403?n.errorType="auth":n.statusCode===404?n.errorType="not_found":n.statusCode>=500?n.errorType="server":(n.statusCode===408||n.statusCode===504)&&(n.errorType="timeout"),p3(n),n.statusCode===429&&g3(n)}function p3(n){if(n.requestBody)try{const e=JSON.parse(n.requestBody);typeof e.model=="string"&&(n.model=e.model)}catch{}}function g3(n){if(n.responseBody)try{const e=JSON.parse(n.responseBody),t=fy(e);t!==null&&(n.quotaResetDelay=t);const i=py(e);i&&(n.quotaResetTimestamp=i)}catch{}}function fy(n){if(typeof n!="object"||n===null)return null;const e=n;if("quotaResetDelay"in e){const t=e.quotaResetDelay;if(typeof t=="number")return t;if(typeof t=="string"){const i=t.match(/^(\d+)s?$/);if(i)return parseInt(i[1],10)}}if("error"in e&&typeof e.error=="object"){const t=fy(e.error);if(t!==null)return t}if("details"in e&&Array.isArray(e.details))for(const t of e.details){const i=fy(t);if(i!==null)return i}return null}function py(n){if(typeof n!="object"||n===null)return null;const e=n;for(const t of["quotaResetTimeStamp","quotaResetTimestamp","resetTime","reset_time"])if(t in e&&typeof e[t]=="string")return e[t];if("error"in e&&typeof e.error=="object"){const t=py(e.error);if(t)return t}if("details"in e&&Array.isArray(e.details))for(const t of e.details){const i=py(t);if(i)return i}return null}function m3(n){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"}[n]||""}function y3(n,e){const t=kb(),i=Date.now(),o=n*1e3,a=i-o,r=Math.floor(a/1e3),c=Math.floor(r/60),d=Math.floor(c/60),f=Math.floor(d/24);if(r<60){const m=t==="zh-CN",x=t==="vi";return m?"刚刚":x?"vừa xong":"just now"}if(c<60){const m=t==="zh-CN",x=t==="vi";return m?`${c} 分钟前`:x?`${c} phút trước`:`${c}m ago`}if(d<24){const m=t==="zh-CN",x=t==="vi";return m?`${d} 小时前`:x?`${d} giờ trước`:`${d}h ago`}if(f<7){const m=t==="zh-CN",x=t==="vi";return m?`${f} 天前`:x?`${f} ngày trước`:`${f}d ago`}return new Date(o).toLocaleDateString(t,{month:"short",day:"numeric"})}function b3(n){return n>=500?"text-red-500":n===429?"text-orange-500":n>=400?"text-yellow-500":"text-gray-500"}function x3(n,e){const t=kb();return t==="zh-CN"?{rate_limit:"限流",auth:"认证错误",not_found:"未找到",server:"服务错误",timeout:"超时",unknown:"错误"}[n]||"错误":t==="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"}[n]||"Lỗi":{rate_limit:"Rate Limited",auth:"Auth Error",not_found:"Not Found",server:"Server Error",timeout:"Timeout",unknown:"Error"}[n]||"Error"}function v3(n){if(n===null||n<=0)return null;if(n<60)return`${n}s`;if(n<3600)return`${Math.floor(n/60)}m`;const e=Math.floor(n/3600),t=Math.floor(n%3600/60);return t>0?`${e}h ${t}m`:`${e}h`}function C3(n,e){if(!n)return null;const t=kb(),i=t==="zh-CN",o=t==="vi";try{const a=new Date(n),r=new Date,c=a.getTime()-r.getTime();if(c<=0)return i?"现在":o?"bây giờ":"now";const d=Math.floor(c/1e3);if(d<60)return i?`${d}秒`:o?`${d} giây`:`${d}s`;if(d<3600){const m=Math.floor(d/60);return i?`${m}分钟`:o?`${m} phút`:`${m}m`}const f=Math.floor(d/3600),g=Math.floor(d%3600/60);return i?g>0?`${f}小时 ${g}分钟`:`${f}小时`:o?g>0?`${f} giờ ${g} phút`:`${f} giờ`:g>0?`${f}h ${g}m`:`${f}h`}catch{return null}}function S3(n){return n?n===429?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":n>=500?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":n>=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 k3(n){return n||""}function w3({name:n,size:e,modified:t,isSelected:i,onClick:o,statusCode:a,model:r}){const c=w.useMemo(()=>l3(n),[n]),d=w.useMemo(()=>k3(r),[r]);return p.jsxs("button",{onClick:o,className:q("w-full px-2.5 py-2 flex items-center gap-2 text-left transition-colors","hover:bg-muted/40 border-l-[3px]",i?"bg-muted/50 border-l-red-500":"border-l-transparent"),children:[p.jsx("span",{className:q("shrink-0 text-[10px] font-bold px-1.5 py-0.5 rounded min-w-[32px] text-center",S3(a)),children:a||"???"}),p.jsx(Kb,{provider:c.provider,size:18,withBackground:!0,className:"shrink-0"}),p.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[p.jsx("span",{className:"text-[11px] font-medium text-foreground truncate",children:c.endpoint||"unknown"}),d&&p.jsx("span",{className:"text-[10px] text-muted-foreground truncate",title:d,children:d}),p.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-muted-foreground/60",children:[p.jsx(Er,{className:"w-2.5 h-2.5"}),p.jsx("span",{children:y3(t)})]})]})]})}function sw({value:n,className:e,variant:t="outline",size:i="icon",label:o="Copy to clipboard"}){const[a,r]=w.useState(!1),c=()=>{navigator.clipboard.writeText(n),r(!0),setTimeout(()=>r(!1),2e3)};return p.jsx(ga,{children:p.jsxs($i,{children:[p.jsx(Xi,{asChild:!0,children:p.jsxs(ht,{size:i,variant:t,className:q("relative z-10 text-muted-foreground hover:text-foreground",e),onClick:d=>{d.stopPropagation(),c()},children:[a?p.jsx(Rr,{className:"h-3.5 w-3.5 text-green-500"}):p.jsx(hh,{className:"h-3.5 w-3.5"}),p.jsx("span",{className:"sr-only",children:o})]})}),p.jsx(Ji,{children:p.jsx("p",{children:a?"Copied!":o})})]})})}function Gl({active:n,onClick:e,children:t,icon:i}){return p.jsxs("button",{onClick:e,className:q("px-2.5 py-1.5 text-xs font-medium rounded transition-colors flex items-center gap-1.5",n?"bg-primary/15 text-primary":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[i&&p.jsx(i,{className:"w-3.5 h-3.5"}),t]})}function wD({code:n}){const e=b3(n);return p.jsx("span",{className:q("inline-flex items-center justify-center min-w-[36px] px-2 py-0.5 rounded text-xs font-bold","bg-current/10 border border-current/20",e),children:n})}function A3({parsed:n}){const{t:e}=xe(),t=v3(n.quotaResetDelay)||C3(n.quotaResetTimestamp),i=e("errorLogs.na");return p.jsx(Vr,{className:"h-full",children:p.jsxs("div",{className:"p-4 space-y-4",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(wD,{code:n.statusCode}),p.jsx("span",{className:"text-sm font-medium",children:n.statusText}),p.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 rounded bg-muted/50",children:x3(n.errorType)})]}),n.model&&p.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-violet-500/10 border border-violet-500/20",children:[p.jsx(HE,{className:"w-4 h-4 text-violet-500 shrink-0"}),p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-muted-foreground",children:e("errorLogs.modelLabel")}),p.jsx("span",{className:"font-semibold text-violet-600 dark:text-violet-400",children:n.model})]})]}),n.errorType==="rate_limit"&&t&&p.jsxs("div",{className:"flex items-center gap-2.5 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[p.jsx(Er,{className:"w-4 h-4 text-amber-500 shrink-0"}),p.jsxs("div",{className:"text-sm",children:[p.jsx("span",{className:"text-muted-foreground",children:e("errorLogs.quotaResetsIn")}),p.jsx("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:t})]})]}),p.jsxs("div",{className:"grid grid-cols-4 gap-3 text-xs",children:[p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.method")}),p.jsx("div",{className:"font-medium",children:n.method||i})]}),p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.provider")}),p.jsx("div",{className:"font-medium",children:n.provider||i})]}),p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.version")}),p.jsx("div",{className:"font-medium",children:n.version||i})]}),p.jsxs("div",{className:"p-2.5 rounded bg-muted/30 border border-border/50",children:[p.jsx("div",{className:"text-muted-foreground mb-1",children:e("errorLogs.endpoint")}),p.jsx("div",{className:"font-medium truncate",title:n.endpoint,children:n.endpoint||i})]})]}),p.jsxs("div",{className:"text-xs",children:[p.jsx("div",{className:"text-muted-foreground mb-1.5",children:e("errorLogs.url")}),p.jsx("div",{className:"font-mono p-2.5 rounded bg-muted/30 border border-border/50 break-all leading-relaxed",children:n.url||i})]}),p.jsxs("div",{className:"text-xs",children:[p.jsx("div",{className:"text-muted-foreground mb-1.5",children:e("errorLogs.timestamp")}),p.jsx("div",{className:"font-mono",children:n.timestamp||i})]}),n.errorType!=="unknown"&&p.jsxs("div",{className:q("flex items-start gap-3 p-3 rounded text-xs",n.errorType==="rate_limit"?"bg-amber-500/10 border border-amber-500/20":n.errorType==="auth"?"bg-red-500/10 border border-red-500/20":"bg-blue-500/10 border border-blue-500/20"),children:[n.errorType==="rate_limit"?p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}):n.errorType==="auth"?p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-red-500 shrink-0"}):p.jsx($h,{className:"w-4 h-4 mt-0.5 text-blue-500 shrink-0"}),p.jsxs("div",{className:q("leading-relaxed",n.errorType==="rate_limit"?"text-amber-600 dark:text-amber-400":n.errorType==="auth"?"text-red-600 dark:text-red-400":"text-blue-600 dark:text-blue-400"),children:[n.errorType==="rate_limit"&&(n.model?e("errorLogs.rateLimitedMsg",{model:n.model}):e("errorLogs.rateLimitedMsgNoModel")),n.errorType==="auth"&&e("errorLogs.authFailedMsg"),n.errorType==="not_found"&&e("errorLogs.notFoundMsg"),n.errorType==="server"&&e("errorLogs.serverErrorMsg"),n.errorType==="timeout"&&e("errorLogs.timeoutMsg")]})]})]})})}function P3({headers:n}){const{t:e}=xe(),t=Object.entries(n);return t.length===0?p.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:e("errorLogs.noHeaders")}):p.jsx(Vr,{className:"h-full",children:p.jsx("div",{className:"p-4 space-y-1",children:t.map(([i,o])=>p.jsxs("div",{className:"flex gap-3 text-xs font-mono py-1.5 border-b border-border/30 last:border-0",children:[p.jsxs("span",{className:"text-muted-foreground shrink-0 min-w-[140px]",children:[i,":"]}),p.jsx("span",{className:"break-all",children:o})]},i))})})}function aw({content:n,label:e}){const{t}=xe();if(!n||n.trim()===""){const a=e==="Request"?"errorLogs.noRequestBody":"errorLogs.noResponseBody";return p.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:t(a)})}let i=n,o=!1;try{const a=JSON.parse(n);i=JSON.stringify(a,null,2),o=!0}catch{}return p.jsx(Vr,{className:"h-full",children:p.jsx("pre",{className:q("p-4 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",o?"text-emerald-700 dark:text-green-400":"text-zinc-700 dark:text-muted-foreground"),children:i})})}function D3({content:n}){return p.jsx(Vr,{className:"h-full",children:p.jsx("pre",{className:"p-4 text-xs font-mono text-zinc-700 dark:text-muted-foreground whitespace-pre-wrap break-all leading-relaxed",children:n})})}function O3({name:n,absolutePath:e}){const{t}=xe(),[i,o]=w.useState("overview"),{data:a,isLoading:r,error:c}=tH(n),d=w.useMemo(()=>a?c3(a):null,[a]);return n?r?p.jsxs("div",{className:"flex-1 p-6 space-y-3",children:[p.jsx(tt,{className:"h-5 w-full"}),p.jsx(tt,{className:"h-5 w-3/4"}),p.jsx(tt,{className:"h-5 w-5/6"}),p.jsx(tt,{className:"h-5 w-2/3"})]}):c||!a||!d?p.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:p.jsx("p",{className:"text-sm",children:t("errorLogs.failedLoadContent")})}):p.jsxs("div",{className:"flex-1 flex flex-col min-w-0 h-full",children:[p.jsxs("div",{className:"px-4 py-3 border-b border-border bg-muted/30 flex items-center justify-between gap-3 shrink-0",children:[p.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[p.jsx(wD,{code:d.statusCode}),p.jsxs("span",{className:"text-xs font-semibold truncate text-foreground",children:[d.provider,"/",d.endpoint||"unknown"]}),n&&p.jsx(sw,{value:e||n,label:t("errorLogs.copyAbsolutePath"),size:"icon-sm",className:"ml-1 text-muted-foreground hover:text-foreground opacity-50 hover:opacity-100 transition-opacity"})]}),p.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a&&p.jsx(sw,{value:a,label:t("errorLogs.copyRawContent"),variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),p.jsx("span",{className:"text-[10px] text-muted-foreground font-mono bg-muted px-1.5 py-0.5 rounded border border-border/50",children:d.method})]})]}),p.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:[p.jsx(Gl,{active:i==="overview",onClick:()=>o("overview"),icon:$h,children:t("errorLogs.tabOverview")}),p.jsx(Gl,{active:i==="headers",onClick:()=>o("headers"),icon:UE,children:t("errorLogs.tabHeaders")}),p.jsx(Gl,{active:i==="request",onClick:()=>o("request"),icon:yP,children:t("errorLogs.tabRequest")}),p.jsx(Gl,{active:i==="response",onClick:()=>o("response"),icon:zE,children:t("errorLogs.tabResponse")}),p.jsx(Gl,{active:i==="raw",onClick:()=>o("raw"),icon:FE,children:t("errorLogs.tabRaw")})]}),p.jsxs("div",{className:"flex-1 overflow-hidden bg-card/30",children:[i==="overview"&&p.jsx(A3,{parsed:d}),i==="headers"&&p.jsx(P3,{headers:d.requestHeaders}),i==="request"&&p.jsx(aw,{content:d.requestBody,label:t("errorLogs.tabRequest")}),i==="response"&&p.jsx(aw,{content:d.responseBody,label:t("errorLogs.tabResponse")}),i==="raw"&&p.jsx(D3,{content:a})]})]}):p.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:p.jsxs("div",{className:"text-center space-y-3",children:[p.jsx(_E,{className:"w-10 h-10 mx-auto opacity-40"}),p.jsx("p",{className:"text-sm",children:t("errorLogs.selectLog")})]})})}function T3(){const{t:n}=xe(),{data:e,isLoading:t}=WP(),{data:i,isLoading:o,error:a}=eH(e?.running??!1),[r,c]=w.useState(500),[d,f]=w.useState(!1),g=w.useRef(null),m=w.useRef(null),x=()=>{m.current&&(clearInterval(m.current),m.current=null)};w.useEffect(()=>{if(!d)return;const M=N=>{const I=g.current;if(!I)return;const U=I.getBoundingClientRect().top+window.scrollY,z=N.pageY-U;c(Math.max(300,z));const F=window.innerHeight-N.clientY,B=15;x(),F<50?m.current=setInterval(()=>{window.scrollBy(0,B)},16):N.clientY<50&&(m.current=setInterval(()=>{window.scrollBy(0,-B)},16))},L=()=>{f(!1),x(),document.body.style.cursor="default",document.body.style.userSelect="auto"};return document.addEventListener("mousemove",M),document.addEventListener("mouseup",L),document.body.style.cursor="row-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",L),document.body.style.cursor="default",document.body.style.userSelect="auto",x()}},[d]);const v=M=>{M.preventDefault(),f(!0)},C=w.useMemo(()=>i?.[0]?.name??null,[i]),[k,A]=w.useState(null),D=k??C,O=w.useMemo(()=>!D||!i?void 0:i.find(L=>L.name===D)?.absolutePath,[D,i]);if(t||!e?.running)return null;if(o)return p.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:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[p.jsx(tt,{className:"h-4 w-32"}),p.jsx(tt,{className:"h-4 w-20"})]}),p.jsx("div",{className:"p-4 space-y-3",children:[1,2,3].map(M=>p.jsx(tt,{className:"h-12 w-full rounded-lg"},M))})]});if(!i||i.length===0)return null;const T=i.length;return p.jsxs("div",{ref:g,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:r},children:[p.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:[p.jsxs("div",{className:"flex items-center gap-2.5",children:[p.jsx(wi,{className:"w-4 h-4 text-amber-500"}),p.jsx("span",{className:"text-sm font-semibold tracking-tight",children:n("errorLogs.title")}),p.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:n("errorLogs.failedRequests",{count:T})})]}),p.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[p.jsx(qE,{className:"w-3.5 h-3.5"}),p.jsx("span",{children:n("errorLogs.cliproxyDiagnostics")})]})]}),p.jsx("div",{className:"flex-1 min-h-0",children:p.jsxs(Yb,{direction:"horizontal",children:[p.jsx(kc,{defaultSize:30,minSize:20,maxSize:50,className:"flex flex-col min-w-0",children:p.jsxs(Vr,{className:"h-full",children:[p.jsx("div",{className:"divide-y divide-border/50",children:i.slice(0,50).map(M=>p.jsx(w3,{name:M.name,size:M.size,modified:M.modified,isSelected:D===M.name,onClick:()=>A(M.name),statusCode:M.statusCode,model:M.model},M.name))}),i.length>50&&p.jsx("div",{className:"px-3 py-3 text-center text-[10px] text-muted-foreground border-t border-border/50",children:n("errorLogs.showingCount",{total:i.length})})]})}),p.jsxs($b,{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:[p.jsx("div",{className:"w-[1px] h-full bg-border group-hover:bg-primary/50 transition-colors"}),p.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:p.jsx(Yh,{className:"h-4 w-4 text-muted-foreground"})})]}),p.jsx(kc,{className:"flex flex-col min-w-0 bg-background/50",children:p.jsx(O3,{name:D,absolutePath:O})})]})}),a?p.jsx("div",{className:"px-4 py-2 border-t border-border text-xs text-destructive bg-destructive/5 shrink-0",children:a.message}):p.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:v,children:p.jsx(GE,{className:"w-8 h-3 text-border group-hover:text-primary/50 transition-colors"})})]})}const M3=Xh("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"}}),lc=w.forwardRef(({className:n,variant:e,...t},i)=>p.jsx("div",{ref:i,role:"alert",className:q(M3({variant:e}),n),...t}));lc.displayName="Alert";const bh=w.forwardRef(({className:n,...e},t)=>p.jsx("h5",{ref:t,className:q("mb-1 font-medium leading-none tracking-tight",n),...e}));bh.displayName="AlertTitle";const cc=w.forwardRef(({className:n,...e},t)=>p.jsx("div",{ref:t,className:q("text-sm [&_p]:leading-relaxed",n),...e}));cc.displayName="AlertDescription";function N3(){return jt({queryKey:["overview"],queryFn:async()=>(await fetch("/api/overview")).json()})}function AD(n,e){return typeof n=="object"&&n!==null&&"error"in n&&typeof n.error=="string"?n.error:e}function PD(n){const e=n.trim();if(!e)return null;try{return JSON.parse(e)}catch{return null}}function L3(n){const e=n.trim().toLowerCase();return e.startsWith("<!doctype html")||e.startsWith("<html")}function R3(n){if(!n||typeof n!="object")return!1;const e=n;return!(typeof e.content!="string"||"contentPath"in e&&typeof e.contentPath!="string")}async function DD(n,e){const t=await n.text(),i=PD(t);if(!n.ok){const o=AD(i,e);throw new Error(o)}if(i===null)throw new Error(e);return i}function E3(){return jt({queryKey:["shared","summary"],queryFn:async()=>{const n=await fetch("/api/shared/summary");return DD(n,"Failed to fetch shared summary")}})}function EW(n){return jt({queryKey:["shared",n],enabled:n!=="settings",queryFn:async()=>{if(n==="settings")return{items:[]};const e=await fetch(`/api/shared/${n}`);return DD(e,`Failed to fetch shared ${n}`)}})}function IW(n,e){return jt({queryKey:["shared",n,"content",e],enabled:typeof e=="string"&&e.length>0,queryFn:async()=>{if(!e)throw new Error("Missing shared item path");const t=new URLSearchParams({type:n,path:e}),i=await fetch(`/api/shared/content?${t.toString()}`),o=await i.text(),a=PD(o);if(!i.ok)throw new Error(AD(a,`Failed to fetch shared ${n} content`));if(R3(a))return{content:a.content,contentPath:typeof a.contentPath=="string"&&a.contentPath.length>0?a.contentPath:e};if(o.trim().length>0){if(L3(o))throw new Error("Shared content endpoint unavailable. Restart `ccs config` and try again.");return{content:o,contentPath:e}}throw new Error(`Failed to fetch shared ${n} content`)}})}const I3={ok:"success",warning:"warning",error:"error"},j3={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 Dd({title:n,value:e,icon:t,variant:i="default",onClick:o}){const a=j3[i];return p.jsxs("button",{onClick:o,className:q("flex items-center gap-3 px-4 py-2.5 rounded-lg border bg-card/50","transition-all hover:bg-card hover:shadow-sm hover:-translate-y-0.5","active:scale-[0.98]"),children:[p.jsx("div",{className:q("flex items-center justify-center w-9 h-9 rounded-md",a.iconBg),children:p.jsx(t,{className:q("w-4 h-4",a.iconColor)})}),p.jsxs("div",{className:"text-left",children:[p.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:n}),p.jsx("p",{className:q("text-lg font-bold font-mono leading-tight",a.iconColor),children:e})]})]})}function B3(){const{t:n}=xe(),e=bb(),{data:t,isLoading:i}=N3(),{data:o,isLoading:a}=E3();if(i||a)return p.jsxs("div",{className:"p-6 space-y-6",children:[p.jsxs("div",{className:"rounded-xl border p-6 flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx(tt,{className:"h-12 w-12 rounded-lg"}),p.jsxs("div",{children:[p.jsx(tt,{className:"h-7 w-[180px] mb-2"}),p.jsx(tt,{className:"h-4 w-[220px]"})]})]}),p.jsx("div",{className:"flex items-center gap-3",children:[1,2,3,4].map(c=>p.jsx(tt,{className:"h-14 w-28 rounded-lg"},c))})]}),p.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[p.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center justify-between",children:[p.jsx(tt,{className:"h-4 w-32"}),p.jsx(tt,{className:"h-4 w-20"})]}),p.jsx("div",{className:"px-4 py-3 border-b",children:p.jsx(tt,{className:"h-2 w-full rounded-full"})}),[1,2,3].map(c=>p.jsxs("div",{className:"px-4 py-2.5 flex items-center gap-3 border-b last:border-b-0",children:[p.jsx(tt,{className:"w-2.5 h-2.5 rounded-full"}),p.jsx(tt,{className:"h-4 flex-1"}),p.jsx(tt,{className:"h-1.5 w-24 rounded-full"}),p.jsx(tt,{className:"h-4 w-16"})]},c))]})]});const r=t?.health?I3[t.health.status]:void 0;return p.jsxs("div",{className:"p-6 space-y-6",children:[p.jsxs("div",{className:"relative overflow-hidden rounded-xl border bg-gradient-to-br from-background via-background to-muted/30",children:[p.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:p.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),p.jsxs("div",{className:"relative p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[p.jsx(g5,{version:t?.version}),p.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[p.jsx(Dd,{title:n("home.profiles"),value:t?.profiles??0,icon:ny,variant:"accent",onClick:()=>e("/providers")}),p.jsx(Dd,{title:n("home.cliproxy"),value:t?.cliproxy??0,icon:aP,variant:"accent",onClick:()=>e("/cliproxy")}),p.jsx(Dd,{title:n("home.accounts"),value:t?.accounts??0,icon:lP,variant:"default",onClick:()=>e("/accounts")}),p.jsx(Dd,{title:n("home.health"),value:t?.health?`${t.health.passed}/${t.health.total}`:"-",icon:xc,variant:r,onClick:()=>e("/health")})]})]})]}),o?.symlinkStatus&&!o.symlinkStatus.valid&&p.jsxs(lc,{variant:"warning",children:[p.jsx(wi,{className:"h-4 w-4"}),p.jsx(bh,{children:n("home.configurationRequired")}),p.jsx(cc,{children:o.symlinkStatus.message})]}),p.jsx(RH,{}),p.jsx("div",{className:"rounded-xl border bg-card/70 p-5",children:p.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"rounded-xl bg-muted p-2.5",children:p.jsx(uP,{className:"h-5 w-5 text-muted-foreground"})}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("h2",{className:"text-lg font-semibold",children:n("homePageV2.logsMoved")}),p.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."})]})]}),p.jsxs(ht,{variant:"outline",className:"gap-2",onClick:()=>e("/logs"),children:["Open logs",p.jsx(KE,{className:"h-4 w-4"})]})]})}),p.jsx(T3,{})]})}const OD=iE,Xb=w.forwardRef(({className:n,...e},t)=>p.jsx(ZA,{ref:t,className:q("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",n),...e}));Xb.displayName=ZA.displayName;const xh=w.forwardRef(({className:n,...e},t)=>p.jsx(eP,{ref:t,className:q("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",n),...e}));xh.displayName=eP.displayName;const gy=w.forwardRef(({className:n,...e},t)=>p.jsx(tP,{ref:t,className:q("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...e}));gy.displayName=tP.displayName;function yn({className:n,...e}){return p.jsx(oE,{"data-slot":"label",className:q("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",n),...e})}const Jb="ccs:openrouter-models",H3=1440*60*1e3,TD="1";function my(n){const e=parseFloat(n);return isNaN(e)||e===0?0:e*1e6}function rw(n){const e=my(n);return e===0?re.t("openrouterUtils.priceFree"):e<.01?re.t("openrouterUtils.priceLessThanCent"):e<1?`$${e.toFixed(2)}`:`$${e.toFixed(e<10?2:0)}`}function _3(n){const e=rw(n.prompt),t=rw(n.completion);return e===re.t("openrouterUtils.priceFree")&&t===re.t("openrouterUtils.priceFree")?re.t("openrouterUtils.priceFree"):`${e}/${t}`}function U3(n){const e=n.id.toLowerCase();return e.startsWith("anthropic/")?"anthropic":e.startsWith("openai/")?"openai":e.startsWith("google/")?"google":e.startsWith("meta-llama/")||e.startsWith("meta/")?"meta":e.startsWith("mistralai/")?"mistral":e.includes(":free")||e.includes("qwen")||e.includes("deepseek")?"opensource":"other"}function z3(n){return{...n,category:U3(n),pricePerMillionPrompt:my(n.pricing.prompt),pricePerMillionCompletion:my(n.pricing.completion),isFree:n.pricing.prompt==="0"&&n.pricing.completion==="0",isExacto:n.id.includes(":exacto")}}function F3(n,e,t){const i=e.toLowerCase().trim();return n.filter(o=>t?.category&&o.category!==t.category||t?.freeOnly&&!o.isFree||t?.minContext&&o.context_length<t.minContext?!1:i?o.id.toLowerCase().includes(i)||o.name.toLowerCase().includes(i)||o.description?.toLowerCase().includes(i):!0)}function jW(n){return[...n].sort((e,t)=>{if(e.isFree&&!t.isFree)return-1;if(!e.isFree&&t.isFree)return 1;if(!e.isFree&&!t.isFree){if(e.isExacto&&!t.isExacto)return-1;if(!e.isExacto&&t.isExacto)return 1}return e.name.localeCompare(t.name)})}function q3(){try{const n=localStorage.getItem(Jb);if(!n)return null;const e=JSON.parse(n);return e.version!==TD||Date.now()-e.fetchedAt>H3?null:e.models}catch{return null}}function G3(n){try{localStorage.setItem(Jb,JSON.stringify({models:n,fetchedAt:Date.now(),version:TD}))}catch{}}function K3(){localStorage.removeItem(Jb)}function BW(n,e){const[t]=n.split("/");if(!t)return{};const i=e.filter(r=>r.id.startsWith(`${t}/`));if(i.length===0)return{};const o=[...i].sort((r,c)=>c.pricePerMillionPrompt-r.pricePerMillionPrompt),a=Math.ceil(o.length/3);return{opus:o[0]?.id,sonnet:o[Math.min(a,o.length-1)]?.id,haiku:o[o.length-1]?.id}}function V3(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${Math.round(n/1e3)}K`:String(n)}const HW={anthropic:"Anthropic (Claude)",openai:"OpenAI (GPT)",google:"Google (Gemini)",meta:"Meta (Llama)",mistral:"Mistral",opensource:"Open Source",other:"Other"},W3={anthropic:["anthropic/"],openai:["openai/"],google:["google/"],meta:["meta-llama/","meta/"],mistral:["mistralai/"],opensource:["deepseek/","qwen/","cohere/"],other:[]};function Q3(n,e=2){const t=[],i=["anthropic","openai","google","meta","mistral","opensource"];for(const o of i){const a=W3[o];if(a.length===0)continue;const c=[...n.filter(d=>a.some(f=>d.id.toLowerCase().startsWith(f)))].sort((d,f)=>(f.created??0)-(d.created??0));t.push(...c.slice(0,e))}return t.sort((o,a)=>(a.created??0)-(o.created??0))}function Y3(n){const t=Date.now()/1e3-n;return t<86400?re.t("openrouterUtils.ageToday"):t<172800?re.t("openrouterUtils.ageYesterday"):t<604800?re.t("openrouterUtils.ageDaysAgo",{count:Math.floor(t/86400)}):t<2592e3?re.t("openrouterUtils.ageWeeksAgo",{count:Math.floor(t/604800)}):t<31536e3?re.t("openrouterUtils.ageMonthsAgo",{count:Math.floor(t/2592e3)}):re.t("openrouterUtils.ageYearsAgo",{count:Math.floor(t/31536e3)})}const $3="https://openrouter.ai/api/v1/models",MD=["openrouter-models"],lw=1440*60*1e3;async function X3(){const n=await fetch($3);if(!n.ok)throw new Error(`Failed to fetch OpenRouter models: ${n.status}`);const t=(await n.json()).data;return G3(t),t}function ND(){return jt({queryKey:MD,queryFn:X3,staleTime:lw,gcTime:lw,initialData:()=>q3()??void 0,refetchOnWindowFocus:!1})}function J3(){const n=ND(),e=(n.data??[]).map(z3);return{...n,models:e}}function _W(){const n=bt();return()=>(K3(),n.invalidateQueries({queryKey:MD}))}function UW(){const{data:n,isLoading:e,isError:t}=ND();return{isReady:!!n&&n.length>0,isLoading:e,isError:t,modelCount:n?.length??0}}function Zb({profileEnv:n={}}){const{t:e}=xe(),[t,i]=w.useState(null),[o,a]=w.useState(!0),[r,c]=w.useState(!1);w.useEffect(()=>{d()},[]);const d=async()=>{try{a(!0);const v=await fetch("/api/global-env");if(!v.ok)throw new Error("Failed to load");const C=await v.json();i(C)}catch{i(null)}finally{a(!1)}};if(o||!t?.enabled)return null;const f=t.env||{},g=Object.keys(f);if(g.length===0)return null;const m=g.filter(v=>!(v in n)),x=g.filter(v=>v in n);return p.jsxs("div",{className:"border-t bg-muted/20",children:[p.jsxs("button",{onClick:()=>c(!r),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-muted/30 transition-colors",children:[p.jsx($h,{className:"w-4 h-4 text-blue-500"}),p.jsxs("span",{className:"text-xs text-muted-foreground flex-1 text-left",children:[e("globalEnvIndicator.injectedCount",{count:m.length}),x.length>0&&p.jsx("span",{className:"text-amber-600 dark:text-amber-400 ml-1",children:e("globalEnvIndicator.overriddenCount",{count:x.length})})]}),r?p.jsx(vb,{className:"w-4 h-4 text-muted-foreground"}):p.jsx(Qh,{className:"w-4 h-4 text-muted-foreground"})]}),r&&p.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[m.length>0&&p.jsx("div",{className:"space-y-1",children:m.map(v=>p.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:[p.jsx("span",{className:"text-green-500",children:"+"}),p.jsxs("span",{className:"truncate",children:[v,"=",f[v]]})]},v))}),x.length>0&&p.jsxs("div",{className:"space-y-1",children:[p.jsx("p",{className:"text-xs text-muted-foreground",children:e("globalEnvIndicator.skippedLabel")}),x.map(v=>p.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:[p.jsx("span",{className:"text-amber-500",children:"~"}),p.jsx("span",{className:"truncate",children:v})]},v))]}),p.jsx("div",{className:"pt-2 border-t border-border/50",children:p.jsx(ht,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 text-xs gap-1.5 -ml-2",children:p.jsxs(dh,{to:"/settings?tab=globalenv",children:[p.jsx(Sb,{className:"w-3.5 h-3.5"}),e("globalEnvIndicator.configureInSettings"),p.jsx(fP,{className:"w-3 h-3 opacity-50"})]})})})]})]})}function Z3({className:n,...e}){return p.jsx(sE,{"data-slot":"switch",className:q("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",n),...e,children:p.jsx(aE,{"data-slot":"switch-thumb",className:q("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 e_(n,e,t){return n(t==="refreshing"?"imageAnalysisStatus.refreshingPreview":t==="invalid"?"imageAnalysisStatus.savedStatus":e==="editor"?"imageAnalysisStatus.livePreview":"imageAnalysisStatus.savedStatus")}function t_(n,e,t){return e.status==="disabled"?n("imageAnalysisStatus.disabledGlobally"):t!=="claude"?n("imageAnalysisStatus.targetBypassesHook",{target:n(`imageAnalysisStatus.targetLabel.${t}`)}):e.nativeReadPreference?n("imageAnalysisStatus.nativeImageReading"):e.status==="hook-missing"?n("imageAnalysisStatus.setupNeeded"):e.authReadiness==="missing"?n("imageAnalysisStatus.needsAuth"):e.proxyReadiness==="unavailable"?n("imageAnalysisStatus.needsProxy"):e.effectiveRuntimeMode==="native-read"?n("imageAnalysisStatus.nativeFallback"):n("imageAnalysisStatus.transformerReady")}function n_(n,e,t){return e.status==="disabled"?{label:n("imageAnalysisStatus.badgeDisabled"),className:"border-border/80 bg-background/85 text-muted-foreground"}:t!=="claude"?{label:n("imageAnalysisStatus.badgeBypassed"),className:"border-sky-500/25 bg-sky-500/10 text-sky-800 dark:text-sky-200"}:e.nativeReadPreference?{label:n("imageAnalysisStatus.badgeNative"),className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}:e.status==="hook-missing"||e.authReadiness==="missing"?{label:e.status==="hook-missing"?n("imageAnalysisStatus.badgeSetup"):n("imageAnalysisStatus.badgeAuth"),className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:e.proxyReadiness==="unavailable"?{label:n("imageAnalysisStatus.badgeProxy"),className:"border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200"}:{label:n("imageAnalysisStatus.badgeReady"),className:"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200"}}function i_(n,e,t){if(e.nativeReadPreference)return e.profileModel&&e.nativeImageCapable?n("imageAnalysisStatus.toggleSummaryNativeCapable",{model:e.profileModel}):e.profileModel?n("imageAnalysisStatus.toggleSummaryNativeModel",{model:e.profileModel}):n("imageAnalysisStatus.toggleSummaryNativeDefault");if(!e.backendDisplayName&&t==="claude")return n("imageAnalysisStatus.toggleSummaryNativeFileAccess");if(!e.backendDisplayName)return n("imageAnalysisStatus.toggleSummaryInactiveTarget",{target:n(`imageAnalysisStatus.targetLabel.${t}`)});const i=e.model?` · ${e.model}`:"";return n("imageAnalysisStatus.toggleSummaryTransformerRoute",{backend:e.backendDisplayName,modelSuffix:i})}function o_(n,e,t){return e.status==="disabled"?n("imageAnalysisStatus.noteDisabledGlobally"):t!=="claude"?n("imageAnalysisStatus.noteTargetBypassesHook",{target:n(`imageAnalysisStatus.targetLabel.${t}`)}):e.nativeReadPreference?e.nativeImageCapable===!0?null:e.nativeImageReason:e.status==="hook-missing"?n("imageAnalysisStatus.notePersistHook"):e.authReadiness==="missing"?e.authReason:e.proxyReadiness==="unavailable"?e.proxyReason:null}function s_({status:n,target:e="claude",source:t="saved",previewState:i="saved",nativeReadPreferenceOverride:o,onToggleNativeRead:a}){const{t:r}=xe();if(!n)return p.jsxs("div",{className:"rounded-2xl border bg-muted/20 px-4 py-3","aria-live":"polite",children:[p.jsx("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),p.jsx("div",{className:"mt-2 h-3 w-52 animate-pulse rounded bg-muted"})]});const c=o??n.nativeReadPreference,d={...n,nativeReadPreference:c},f=n_(r,d,e),g=o_(r,d,e),m=n.nativeImageCapable?r("imageAnalysisStatus.capabilityVerified"):n.profileModel?r("imageAnalysisStatus.capabilityUnknown"):null;return p.jsxs("section",{className:"rounded-2xl border bg-background/95 px-4 py-3 shadow-sm",children:[p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsx("div",{className:"min-w-0",children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.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:p.jsx(bP,{className:"h-4 w-4"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("h3",{className:"text-sm font-semibold",children:r("imageAnalysisStatus.sectionTitle")}),p.jsx(Qt,{className:q("h-5 border px-1.5 text-[10px]",f.className),children:f.label})]}),p.jsxs("p",{className:"text-xs text-muted-foreground",children:[e_(r,t,i)," ·"," ",t_(r,d,e)]})]})]})}),p.jsx(ht,{size:"sm",variant:"outline",className:"h-8 shrink-0",asChild:!0,children:p.jsxs(dh,{to:"/settings?tab=image",children:[r("imageAnalysisStatus.openSettings"),p.jsx(yP,{className:"ml-1 h-3.5 w-3.5"})]})})]}),p.jsx("div",{className:"mt-3 rounded-xl border bg-muted/15 px-3 py-3",children:p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("div",{className:"text-sm font-medium text-foreground",children:r("imageAnalysisStatus.useNativeImageReading")}),m&&p.jsx(Qt,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:m})]}),p.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:i_(r,d,e)})]}),p.jsx(Z3,{checked:c,onCheckedChange:a,disabled:!a,"aria-label":r("imageAnalysisStatus.useNativeImageReading")})]})}),g&&p.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:g})]})}const a_=w.lazy(()=>rt(()=>Promise.resolve().then(()=>Nf),void 0).then(n=>({default:n.CodeEditor})));function zW({rawJsonContent:n,isRawJsonValid:e,rawJsonEdits:t,settings:i,profileTarget:o="claude",imageAnalysisStatus:a,imageAnalysisStatusSource:r="saved",imageAnalysisStatusPreviewState:c="saved",nativeReadPreferenceOverride:d,onToggleNativeRead:f,onChange:g,missingRequiredFields:m=[]}){const{t:x}=xe(),v=m.length>0;return p.jsx(w.Suspense,{fallback:p.jsxs("div",{className:"flex items-center justify-center h-full",children:[p.jsx(hi,{className:"w-6 h-6 animate-spin text-muted-foreground"}),p.jsx("span",{className:"ml-2 text-muted-foreground",children:x("profileEditorSections.loadingEditor")})]}),children:p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!e&&t!==null&&p.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:[p.jsx(Kr,{className:"w-4 h-4"}),x("profileEditor.invalidJson")]}),e&&v&&p.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:[p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),p.jsxs("div",{children:[p.jsxs("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:[x("profileEditor.missingFields"),":"]})," ",p.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:m.join(", ")}),p.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:x("profileEditor.missingFieldsHint")})]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:p.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:p.jsx(a_,{value:n,onChange:g,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx(s_,{status:a,target:o,source:r,previewState:c,nativeReadPreferenceOverride:d,onToggleNativeRead:f})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx("div",{className:"border rounded-md overflow-hidden",children:p.jsx(Zb,{profileEnv:i?.env})})})]})})}function cw(n,e){try{var t=n()}catch(i){return e(i)}return t&&t.then?t.then(void 0,e):t}function r_(n,e){for(var t={};n.length;){var i=n[0],o=i.code,a=i.message,r=i.path.join(".");if(!t[r])if("unionErrors"in i){var c=i.unionErrors[0].errors[0];t[r]={message:c.message,type:c.code}}else t[r]={message:a,type:o};if("unionErrors"in i&&i.unionErrors.forEach(function(g){return g.errors.forEach(function(m){return n.push(m)})}),e){var d=t[r].types,f=d&&d[i.code];t[r]=xP(r,e,t,o,f?[].concat(f,i.message):i.message)}n.shift()}return t}function l_(n,e){for(var t={};n.length;){var i=n[0],o=i.code,a=i.message,r=i.path.join(".");if(!t[r])if(i.code==="invalid_union"&&i.errors.length>0){var c=i.errors[0][0];t[r]={message:c.message,type:c.code}}else t[r]={message:a,type:o};if(i.code==="invalid_union"&&i.errors.forEach(function(g){return g.forEach(function(m){return n.push(m)})}),e){var d=t[r].types,f=d&&d[i.code];t[r]=xP(r,e,t,o,f?[].concat(f,i.message):i.message)}n.shift()}return t}function c_(n,e,t){if(t===void 0&&(t={}),(function(i){return"_def"in i&&typeof i._def=="object"&&"typeName"in i._def})(n))return function(i,o,a){try{return Promise.resolve(cw(function(){return Promise.resolve(n[t.mode==="sync"?"parse":"parseAsync"](i,e)).then(function(r){return a.shouldUseNativeValidation&&ok({},a),{errors:{},values:t.raw?Object.assign({},i):r}})},function(r){if((function(c){return Array.isArray(c?.issues)})(r))return{values:{},errors:sk(r_(r.errors,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw r}))}catch(r){return Promise.reject(r)}};if((function(i){return"_zod"in i&&typeof i._zod=="object"})(n))return function(i,o,a){try{return Promise.resolve(cw(function(){return Promise.resolve((t.mode==="sync"?R2:E2)(n,i,e)).then(function(r){return a.shouldUseNativeValidation&&ok({},a),{errors:{},values:t.raw?Object.assign({},i):r}})},function(r){if((function(c){return c instanceof I2})(r))return{values:{},errors:sk(l_(r.issues,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw r}))}catch(r){return Promise.reject(r)}};throw new Error("Invalid input: not a Zod schema")}const u_={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 d_({provider:n,className:e,size:t="md"}){const i=UB(n),o=u_[t],a=zP(n),r=FB(n);return p.jsx("div",{className:q("flex items-center justify-center rounded-md",a&&!r&&(zB(n)?"bg-gray-900 p-1":"bg-white p-1"),o.container,e),children:a?p.jsx("img",{src:a,alt:`${n} logo`,className:q(r?o.container:o.icon,"object-contain")}):p.jsx("span",{className:q("font-semibold",i.textClass,o.text),children:i.letter})})}function FW(){return jt({queryKey:["profiles"],queryFn:()=>Ue.profiles.list()})}function h_(){const n=bt(),{t:e}=xe();return pt({mutationFn:t=>Ue.profiles.create(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileCreated"))},onError:t=>{fe.error(t.message)}})}function qW(){const n=bt(),{t:e}=xe();return pt({mutationFn:t=>Ue.profiles.delete(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileDeleted"))},onError:t=>{fe.error(t.message)}})}function GW(){return pt({mutationFn:()=>Ue.profiles.discoverOrphans()})}function KW(){const n=bt(),{t:e}=xe();return pt({mutationFn:t=>Ue.profiles.registerOrphans(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.orphanProfilesComplete"))}})}function VW(){const n=bt(),{t:e}=xe();return pt({mutationFn:({name:t,data:i})=>Ue.profiles.copy(t,i),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileCopied"))}})}function WW(){return pt({mutationFn:({name:n,includeSecrets:e})=>Ue.profiles.export(n,e??!1)})}function QW(){const n=bt(),{t:e}=xe();return pt({mutationFn:t=>Ue.profiles.import(t),onSuccess:()=>{n.invalidateQueries({queryKey:["profiles"]}),fe.success(e("toasts.profileImported"))}})}const f_="https://openrouter.ai/api/v1",LD=Object.freeze({glmt:"glm",kimi:"km",alibaba:"alibaba-coding-plan",acp:"alibaba-coding-plan",hf:"huggingface",te:"tuningengines",tuning:"tuningengines"}),RD=[{id:"openrouter",name:"OpenRouter",description:"349+ models from OpenAI, Anthropic, Google, Meta",baseUrl:f_,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:"tuningengines",name:"Tuning Engines",description:"OpenAI-compatible chat completions gateway",baseUrl:"https://api.tuningengines.com/v1",defaultProfileName:"te",defaultModel:"gpt-4o",apiKeyPlaceholder:"sk-te-...",apiKeyHint:"Create an inference key at app.tuningengines.com/inference/keys",category:"alternative",requiresApiKey:!0,defaultTarget:"droid",badge:"Gateway"},{id:"glm",name:"GLM",description:"Direct Z.AI Anthropic-compatible API profile",baseUrl:"https://api.z.ai/api/anthropic",defaultProfileName:"glm",defaultModel:"glm-5.2",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:"Kimi Code membership API with stable latest-coding model alias",baseUrl:"https://api.kimi.com/coding/",defaultProfileName:"km",defaultModel:"kimi-for-coding",apiKeyPlaceholder:"sk-...",apiKeyHint:"Get your API key from the Kimi Code Console",category:"alternative",requiresApiKey:!0,alwaysThinkingEnabled:!0,badge:"Kimi Code",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:"M3 frontier multimodal coding model with 1M context",baseUrl:"https://api.minimax.io/anthropic",defaultProfileName:"mm",defaultModel:"MiniMax-M3",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"},{id:"fireworks",name:"Fireworks AI",description:"Anthropic-compatible inference (Kimi, Qwen, Llama) via api.fireworks.ai",baseUrl:"https://api.fireworks.ai/inference",defaultProfileName:"fireworks",defaultModel:"accounts/fireworks/models/kimi-k2p5",apiKeyPlaceholder:"fw_...",apiKeyHint:"Get your API key at fireworks.ai/api-keys",category:"alternative",requiresApiKey:!0,badge:"Anthropic-compatible"},{id:"requesty",name:"Requesty",description:"OpenAI-compatible LLM gateway (provider/model naming, e.g. openai/gpt-4o-mini)",baseUrl:"https://router.requesty.ai/v1",defaultProfileName:"requesty",defaultModel:"openai/gpt-4o-mini",apiKeyPlaceholder:"rqsty-sk-...",apiKeyHint:"Create an API key at app.requesty.ai/api-keys",category:"alternative",requiresApiKey:!0,badge:"OpenAI-compatible"}];function ED(n){return{...n,extraEnv:n.extraEnv?{...n.extraEnv}:void 0}}function p_(n){const e=ED(n);return e.extraEnv&&Object.freeze(e.extraEnv),Object.freeze(e)}function g_(n,e){const t=new Set;for(const o of n){const a=o.id.trim().toLowerCase();if(o.id!==a)throw new Error(`Preset ID must be normalized: "${o.id}"`);if(t.has(o.id))throw new Error(`Duplicate preset ID detected: "${o.id}"`);t.add(o.id)}const i=new Set;for(const[o,a]of Object.entries(e)){const r=o.trim().toLowerCase();if(!r)throw new Error("Preset alias keys cannot be empty");if(o!==r)throw new Error(`Preset alias must be normalized: "${o}"`);if(i.has(r))throw new Error(`Duplicate normalized preset alias detected: "${o}"`);if(i.add(r),!t.has(a))throw new Error(`Preset alias "${o}" points to unknown target "${a}"`);if(t.has(r))throw new Error(`Preset alias "${o}" collides with canonical preset ID "${r}"`)}}g_(RD,LD);const m_=Object.freeze(RD.map(p_));function y_(){return m_.map(ED)}function b_(n){const e=n.trim().toLowerCase();return LD[e]||e}const x_=y_(),ex=Object.freeze(x_.map(n=>({...n})));function v_(n,e){return e||(n?.requiresApiKey===!1?n.apiKeyPlaceholder||n.id:"")}function C_(n){return ex.filter(e=>e.category===n)}function fm(n){const e=b_(n);return ex.find(t=>t.id===e)}const S_=cs().refine(n=>n.trim().length===0||cs().url().safeParse(n).success,{message:"Invalid URL format"}),k_=j2({name:cs().min(1,"Name is required").regex(/^[a-zA-Z][a-zA-Z0-9._-]*$/,"Must start with letter, only letters/numbers/.-_"),baseUrl:S_,apiKey:cs(),model:cs().optional(),opusModel:cs().optional(),sonnetModel:cs().optional(),haikuModel:cs().optional(),target:B2(["claude","droid","codex"])}),w_=["/chat/completions","/v1/messages","/messages","/completions"],Xs="custom",pm="openrouter",ID=new Set(["ollama","llamacpp"]),gm={name:"",baseUrl:"",apiKey:"",model:"",opusModel:"",sonnetModel:"",haikuModel:"",target:"claude"},jD=C_("recommended"),A_=jD.filter(n=>!ID.has(n.id)),P_=jD.filter(n=>ID.has(n.id)),D_=ex.filter(n=>n.category!=="recommended");function YW({open:n,onOpenChange:e,onSuccess:t,initialMode:i="openrouter"}){const{t:o}=xe(),a=h_(),[r,c]=w.useState("basic"),[d,f]=w.useState(null),[g,m]=w.useState(!1),[x,v]=w.useState(pm),[C,k]=w.useState(""),{models:A}=J3(),{register:D,handleSubmit:O,formState:{errors:T},control:M,reset:L,setValue:N}=H2({resolver:c_(k_),defaultValues:gm}),I=ak({control:M,name:"baseUrl"}),W=ak({control:M,name:"target"}),U=w.useCallback(Y=>{if(!Y){L(gm);return}L({...gm,name:Y.defaultProfileName,baseUrl:Y.baseUrl,model:Y.defaultModel,opusModel:Y.defaultModel,sonnetModel:Y.defaultModel,haikuModel:Y.defaultModel,target:Y.defaultTarget??"claude"})},[L]),z=w.useMemo(()=>x===Xs?null:fm(x)??null,[x]),$=w.useMemo(()=>C.trim()?[...F3(A,C)].sort((ae,de)=>(de.created??0)-(ae.created??0)).slice(0,20):Q3(A,2),[A,C]);w.useEffect(()=>{if(n)if(c("basic"),f(null),m(!1),k(""),i==="normal")v(Xs),U(null);else{const ae=fm(i==="openrouter"?pm:i);if(ae){v(ae.id),U(ae);return}v(Xs),U(null)}},[n,i,U,L]);const F=Y=>{const ae=fm(Y);if(ae){v(ae.id),U(ae);return}v(Xs),U(null)},B=Y=>{N("model",Y.id),N("opusModel",Y.id),N("sonnetModel",Y.id),N("haikuModel",Y.id),k(Y.name),fe.success(o("profileCreateDialog.appliedModelToTiers",{model:Y.name}),{duration:2e3})};w.useEffect(()=>{if(I&&x===Xs){const ae=I.toLowerCase();for(const de of w_)if(ae.endsWith(de)){const be=I.replace(new RegExp(de+"$","i"),"");f(`URL ends with "${de}" - Claude appends this automatically. You likely want: ${be}`);return}}f(null)},[I,x]);const ie=async Y=>{if(z?.requiresApiKey!==!1&&!Y.apiKey){fe.error(re.t("commonToast.apiKeyRequired"));return}const ae={...Y,apiKey:v_(z,Y.apiKey)};try{await a.mutateAsync(ae),fe.success(o("profileCreateDialog.profileCreated",{name:ae.name})),t(ae.name),e(!1)}catch(de){fe.error(de.message||o("profileCreateDialog.failedCreate"))}},oe=!!T.name||!!T.baseUrl||!!T.apiKey,H=!!T.model||!!T.opusModel||!!T.sonnetModel||!!T.haikuModel,Z=a.isPending,se=z?.id===pm;return p.jsx(Lb,{open:n,onOpenChange:e,children:p.jsxs(Rb,{"data-testid":"profile-create-dialog",className:"h-[calc(100dvh-2rem)] max-h-[900px] gap-0 overflow-hidden p-0 sm:max-w-[700px] !flex !flex-col",children:[p.jsxs(Eb,{className:"shrink-0 border-b p-6 pb-4",children:[p.jsxs(Ib,{className:"flex items-center gap-2",children:[p.jsx(ek,{className:"w-5 h-5 text-primary"}),o("profileCreateDialog.createProfile")]}),p.jsx(jb,{children:o("profileCreateDialog.chooseProviderHint")})]}),p.jsxs("form",{onSubmit:O(ie),className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[p.jsx("div",{"data-testid":"profile-create-provider-chooser",className:"max-h-[34dvh] shrink-0 space-y-3 overflow-y-auto overscroll-contain border-b bg-muted/10 px-6 py-3",children:p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex items-start justify-between gap-4",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx(yn,{className:"text-xs text-muted-foreground",children:o("profileEditor.provider")}),p.jsx("p",{className:"text-xs text-muted-foreground",children:o("profileEditor.providerChooserHint")})]}),p.jsx("span",{className:"pt-0.5 text-[11px] text-muted-foreground",children:o("profileEditor.scrollHint")})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:o("profileEditor.featuredProviders")}),p.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:p.jsxs("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:[A_.map(Y=>p.jsx(mm,{preset:Y,isSelected:x===Y.id,onClick:()=>F(Y.id),density:"featured"},Y.id)),p.jsx("div",{className:"mx-1 hidden w-px rounded-full bg-border/70 sm:block"}),p.jsx(O_,{isSelected:x===Xs,onClick:()=>F(Xs)})]})})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:o("profileEditor.morePresets")}),p.jsx("div",{className:"-mx-1 overflow-x-auto pb-1",children:p.jsx("div",{className:"flex min-w-max items-stretch gap-2 px-1",children:D_.map(Y=>p.jsx(mm,{preset:Y,isSelected:x===Y.id,onClick:()=>F(Y.id),density:"compact"},Y.id))})})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{className:"text-xs font-medium uppercase tracking-[0.12em] text-foreground/70",children:o("openrouterQuickStart.localRuntimesTitle")}),p.jsx("div",{className:"flex flex-wrap gap-2",children:P_.map(Y=>p.jsx(mm,{preset:Y,isSelected:x===Y.id,onClick:()=>F(Y.id),density:"compact"},Y.id))})]})]})}),p.jsxs(OD,{value:r,onValueChange:c,className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[p.jsx("div",{className:"px-6 pt-4",children:p.jsxs(Xb,{className:"grid w-full grid-cols-2",children:[p.jsxs(xh,{value:"basic",className:"relative",children:[o("profileCreateDialog.basicInformation"),oe&&p.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]}),p.jsxs(xh,{value:"models",className:"relative",children:[o("profileCreateDialog.modelConfiguration"),H&&p.jsx("span",{className:"absolute top-1 right-2 w-2 h-2 rounded-full bg-destructive animate-pulse"})]})]})}),p.jsxs("div",{"data-testid":"profile-create-tab-scroll",className:"flex-1 min-h-0 overflow-y-auto",children:[p.jsxs(gy,{value:"basic",className:"p-6 space-y-4 mt-0",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"name",children:[o("profileDialog.name")," ",p.jsx("span",{className:"text-destructive",children:"*"})]}),p.jsx(Hi,{id:"name",...D("name"),placeholder:o("profileDialog.namePlaceholder"),className:"font-mono"}),T.name?p.jsx("p",{className:"text-xs text-destructive",children:T.name.message}):p.jsxs("p",{className:"text-xs text-muted-foreground",children:[o("profileCreateDialog.usedInCli")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:'ccs my-api "prompt"'})]})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(yn,{htmlFor:"baseUrl",children:o("profileCreateDialog.apiBaseUrl")}),p.jsx(Hi,{id:"baseUrl",...D("baseUrl"),placeholder:o("profileCreateDialog.baseUrlPlaceholder")}),T.baseUrl?p.jsx("p",{className:"text-xs text-destructive",children:T.baseUrl.message}):d?p.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:[p.jsx(wi,{className:"w-4 h-4 shrink-0 mt-0.5"}),p.jsx("span",{children:d})]}):z?p.jsx("p",{className:"text-xs text-muted-foreground",children:z.baseUrl?o("profileCreateDialog.prefilledFromPreset",{name:z.name}):o("profileCreateDialog.optionalForPreset",{name:z.name})}):p.jsx("p",{className:"text-xs text-muted-foreground",children:o("profileCreateDialog.endpointHint")})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"apiKey",children:[o("profileDialog.apiKey")," ",z?.requiresApiKey!==!1&&p.jsx("span",{className:"text-destructive",children:"*"}),z?.requiresApiKey===!1&&p.jsx("span",{className:"text-muted-foreground text-xs font-normal",children:o("profileCreateDialog.optional")})]}),p.jsxs("div",{className:"relative",children:[p.jsx(Hi,{id:"apiKey",type:g?"text":"password",...D("apiKey"),placeholder:z?.requiresApiKey===!1?o("profileCreateDialog.apiKeyOptionalPlaceholder"):z?.apiKeyPlaceholder??o("profileCreateDialog.apiKeyPlaceholder"),className:"pr-10"}),p.jsx(ht,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:()=>m(!g),tabIndex:-1,children:g?p.jsx(Vc,{className:"h-4 w-4"}):p.jsx(Wc,{className:"h-4 w-4"})})]}),T.apiKey?p.jsx("p",{className:"text-xs text-destructive",children:T.apiKey.message}):z?.requiresApiKey===!1?p.jsx("p",{className:"text-xs text-muted-foreground",children:o("profileCreateDialog.apiKeyOptionalHint")}):z?.apiKeyHint&&p.jsx("p",{className:"text-xs text-muted-foreground",children:z.apiKeyHint})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(yn,{htmlFor:"target",children:o("codex.defaultTargetCli")}),p.jsxs(FP,{value:W,onValueChange:Y=>N("target",Y),children:[p.jsx(zb,{id:"target",children:p.jsx(qP,{})}),p.jsxs(Fb,{children:[p.jsx(rc,{value:"claude",children:o("profileCard.claudeCodeDefault")}),p.jsx(rc,{value:"droid",children:o("profileCard.factoryDroid")}),p.jsx(rc,{value:"codex",children:o("profileCard.codexCli")})]})]}),p.jsxs("p",{className:"text-xs text-muted-foreground",children:[W==="droid"?p.jsxs(p.Fragment,{children:[o("profileEditor.targetHintPreferredAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-droid"}),"."]}):W==="codex"?p.jsxs(p.Fragment,{children:[o("profileEditor.targetHintPreferredAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsx"}),"."]}):p.jsxs(p.Fragment,{children:[o("profileEditor.targetHintClaudeDefault")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs"}),"."]}),W==="droid"?p.jsxs(p.Fragment,{children:[" ",o("profileEditor.targetHintLegacyAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccsd"}),"."]}):W==="codex"?p.jsxs(p.Fragment,{children:[" ",o("profileEditor.targetHintLegacyAlias")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"ccs-codex"}),"."]}):null," ",o("profileEditor.targetHintOverride")," ",p.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"--target"}),"."]})]})]}),p.jsxs(gy,{value:"models",className:"p-6 mt-0 space-y-4",children:[p.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:[p.jsx($h,{className:"w-5 h-5 shrink-0 mt-0.5"}),p.jsxs("div",{children:[p.jsx("p",{className:"font-medium mb-1",children:o("profileCreateDialog.modelMapping")}),p.jsx("p",{className:"text-xs opacity-90",children:o("profileCreateDialog.modelMappingDesc")})]})]}),se&&p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{children:o("openrouterModelPicker.searchModels")}),p.jsx(Hi,{value:C,onChange:Y=>k(Y.target.value),placeholder:o("profileCreateDialog.searchModelsPlaceholder"),onKeyDown:Y=>{Y.key==="Enter"&&$.length>0&&(Y.preventDefault(),B($[0]))}}),p.jsx("div",{className:"border rounded-md max-h-48 overflow-y-auto",children:$.length===0?p.jsx("p",{className:"text-sm text-muted-foreground p-3 text-center",children:C?o("profileCreateDialog.noModelsFound",{query:C}):o("profileCreateDialog.loadingModels")}):p.jsxs("div",{className:"p-1",children:[!C&&p.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground",children:[p.jsx(VE,{className:"w-3 h-3 text-accent"}),p.jsx("span",{children:o("openrouterModelPicker.newestModels")})]}),$.map(Y=>p.jsx(T_,{model:Y,onClick:()=>B(Y),showAge:!C},Y.id))]})})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"model",children:[o("profileCreateDialog.defaultModel"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"ANTHROPIC_MODEL"})]}),p.jsx(Hi,{id:"model",...D("model"),placeholder:z?.defaultModel??"claude-sonnet-4",className:"font-mono text-sm"})]}),p.jsxs("div",{className:"grid gap-3 pt-2 border-t",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"sonnetModel",className:"text-sm",children:[o("profileCreateDialog.sonnetMapping"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_SONNET"})]}),p.jsx(Hi,{id:"sonnetModel",...D("sonnetModel"),placeholder:o("profileCreateDialog.sonnetMappingPlaceholder"),className:"font-mono text-sm h-9"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"opusModel",className:"text-sm",children:[o("profileCreateDialog.opusMapping"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_OPUS"})]}),p.jsx(Hi,{id:"opusModel",...D("opusModel"),placeholder:o("profileCreateDialog.opusMappingPlaceholder"),className:"font-mono text-sm h-9"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs(yn,{htmlFor:"haikuModel",className:"text-sm",children:[o("profileCreateDialog.haikuMapping"),p.jsx(Qt,{variant:"outline",className:"ml-2 text-[10px] font-mono",children:"DEFAULT_HAIKU"})]}),p.jsx(Hi,{id:"haikuModel",...D("haikuModel"),placeholder:o("profileCreateDialog.haikuMappingPlaceholder"),className:"font-mono text-sm h-9"})]})]})]})]})]}),p.jsxs(CB,{"data-testid":"profile-create-footer",className:"shrink-0 border-t bg-muted/10 p-6 pt-4",children:[p.jsx(ht,{type:"button",variant:"outline",onClick:()=>e(!1),children:o("profileDialog.cancel")}),p.jsx(ht,{type:"submit",disabled:Z,className:q(Z&&"opacity-80"),children:Z?p.jsxs(p.Fragment,{children:[p.jsx(hi,{className:"w-4 h-4 mr-2 animate-spin"}),o("cliproxyDialog.creating")]}):p.jsxs(p.Fragment,{children:[p.jsx(ek,{className:"w-4 h-4 mr-2"}),o("profileCreateDialog.createProfile")]})})]})]})]})]})})}function mm({preset:n,isSelected:e,onClick:t,density:i="compact"}){const o=n.id==="anthropic",a=i==="featured";return p.jsxs("button",{type:"button",onClick:t,className:q("flex flex-none items-center gap-3 rounded-xl border px-3 py-2.5 text-left transition-all",a?"h-[68px] w-[236px]":"h-[64px] w-[168px]",e?"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:[p.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-background",children:o?p.jsx(d_,{provider:"claude",size:"md",className:"rounded-lg"}):n.icon?p.jsx("img",{src:n.icon,alt:"",className:"h-5 w-5 object-contain"}):p.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:n.name.charAt(0)})}),p.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("div",{className:"truncate text-[13px] font-semibold leading-tight tracking-[-0.01em]",children:n.name}),n.badge&&a&&p.jsx(Qt,{variant:"secondary",className:"inline-flex bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:n.badge})]}),n.badge&&!a&&p.jsx(Qt,{variant:"secondary",className:"inline-flex w-fit bg-muted px-1.5 py-0 text-[10px] text-muted-foreground",children:n.badge})]})]})}function O_({isSelected:n,onClick:e}){const{t}=xe();return p.jsxs("button",{type:"button",onClick:e,className:q("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",n?"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:[p.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:p.jsx(Sb,{className:"h-4 w-4 text-muted-foreground"})}),p.jsx("div",{className:"min-w-0 flex-1",children:p.jsx("div",{className:"text-sm font-semibold leading-tight",children:t("profileEditor.customEndpoint")})})]})}function T_({model:n,onClick:e,showAge:t}){const{t:i}=xe();return p.jsxs("button",{type:"button",onClick:e,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:[p.jsx("span",{className:"flex-1 truncate",children:n.name}),p.jsxs("span",{className:"text-muted-foreground group-hover:text-accent-foreground/80 ml-2 flex items-center gap-2 text-xs",children:[t&&n.created&&p.jsx(Qt,{variant:"outline",className:"text-[10px] text-accent group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30",children:Y3(n.created)}),n.isFree?p.jsx(Qt,{variant:"secondary",className:"text-xs group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground",children:i("profileCreateDialog.free")}):p.jsx("span",{children:_3(n.pricing)}),p.jsx("span",{children:V3(n.context_length)})]})]})}function M_({className:n,...e}){return p.jsx("div",{"data-slot":"card",className:q("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",n),...e})}function N_({className:n,...e}){return p.jsx("div",{"data-slot":"card-header",className:q("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",n),...e})}function L_({className:n,...e}){return p.jsx("div",{"data-slot":"card-title",className:q("leading-none font-semibold",n),...e})}function R_({className:n,...e}){return p.jsx("div",{"data-slot":"card-description",className:q("text-muted-foreground text-sm",n),...e})}function E_({className:n,...e}){return p.jsx("div",{"data-slot":"card-content",className:q("px-6",n),...e})}const tx="[1m]",nx=["ANTHROPIC_MODEL","ANTHROPIC_DEFAULT_OPUS_MODEL","ANTHROPIC_DEFAULT_SONNET_MODEL","ANTHROPIC_DEFAULT_HAIKU_MODEL"],I_=new Set(nx);function $W(n){return n.toLowerCase().startsWith("gemini-")}function ix(n){return n.toLowerCase().endsWith(tx.toLowerCase())}function j_(n){return!n||ix(n)?n:`${n}${tx}`}function BD(n){return n&&(ix(n)?n.slice(0,-tx.length):n)}function XW(n){return I_.has(n)}function B_(n){return BD(n.trim()).replace(/\([^)]+\)$/,"")}function JW(n){return nx.some(e=>{const t=n[e];return typeof t=="string"&&ix(t)})}function ZW(n,e,t={}){const i={...n};for(const o of nx){const a=i[o];if(typeof a!="string"||a.trim().length===0)continue;const r=B_(a),c=t.supportsExtendedContext?.(r,o)??!0;i[o]=e&&c?j_(a):BD(a)}return i}const H_=["agy","claude","gemini","codex","cursor","gitlab","codebuddy","qwen","kimi","iflow","kilo","kiro","qoder"],eQ=H_.map(n=>({id:n,name:Ub(n),description:GB(n)})),__=["provider","auth","variant","success"];function tQ(n){return n==="account"?1:__.indexOf(n)}const nQ=lE,iQ=uE,oQ=cE,U_=w.forwardRef(({className:n,align:e="center",sideOffset:t=4,...i},o)=>p.jsx(rE,{children:p.jsx(nP,{ref:o,align:e,sideOffset:t,className:q("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",n),...i})}));U_.displayName=nP.displayName;const z_=w.lazy(()=>rt(()=>Promise.resolve().then(()=>Nf),void 0).then(n=>({default:n.CodeEditor})));function sQ({rawJsonContent:n,isRawJsonValid:e,rawJsonEdits:t,onRawJsonChange:i,profileEnv:o,missingRequiredFields:a=[]}){const{t:r}=xe(),c=a.length>0;return p.jsx(w.Suspense,{fallback:p.jsxs("div",{className:"flex items-center justify-center h-full",children:[p.jsx(hi,{className:"w-6 h-6 animate-spin text-muted-foreground"}),p.jsx("span",{className:"ml-2 text-muted-foreground",children:r("providerEditor.loadingEditor")})]}),children:p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!e&&t!==null&&p.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:[p.jsx(Kr,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),e&&c&&p.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:[p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",p.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:a.join(", ")}),p.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."})]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:p.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:p.jsx(z_,{value:n,onChange:i,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx("div",{className:"border rounded-md overflow-hidden",children:p.jsx(Zb,{profileEnv:o})})})]})})}let yy=[],HD=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?HD:yy).push(t=t+n[e])})();function F_(n){if(n<768)return!1;for(let e=0,t=yy.length;;){let i=e+t>>1;if(n<yy[i])t=i;else if(n>=HD[i])e=i+1;else return!0;if(e==t)return!1}}function uw(n){return n>=127462&&n<=127487}const dw=8205;function q_(n,e,t=!0,i=!0){return(t?_D:G_)(n,e,i)}function _D(n,e,t){if(e==n.length)return e;e&&UD(n.charCodeAt(e))&&zD(n.charCodeAt(e-1))&&e--;let i=ym(n,e);for(e+=hw(i);e<n.length;){let o=ym(n,e);if(i==dw||o==dw||t&&F_(o))e+=hw(o),i=o;else if(uw(o)){let a=0,r=e-2;for(;r>=0&&uw(ym(n,r));)a++,r-=2;if(a%2==0)break;e+=2}else break}return e}function G_(n,e,t){for(;e>0;){let i=_D(n,e-2,t);if(i<e)return i;e--}return 0}function ym(n,e){let t=n.charCodeAt(e);if(!zD(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return UD(i)?(t-55296<<10)+(i-56320)+65536:t}function UD(n){return n>=56320&&n<57344}function zD(n){return n>=55296&&n<56320}function hw(n){return n<65536?1:2}class Je{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=jr(this,e,t);let o=[];return this.decompose(0,e,o,2),i.length&&i.decompose(0,i.length,o,3),this.decompose(t,this.length,o,1),Ui.from(o,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=jr(this,e,t);let i=[];return this.decompose(e,t,i,0),Ui.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),o=new uc(this),a=new uc(e);for(let r=t,c=t;;){if(o.next(r),a.next(r),r=0,o.lineBreak!=a.lineBreak||o.done!=a.done||o.value!=a.value)return!1;if(c+=o.value.length,o.done||c>=i)return!0}}iter(e=1){return new uc(this,e)}iterRange(e,t=this.length){return new FD(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let o=this.line(e).from;i=this.iterRange(o,Math.max(o,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new qD(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Je.empty:e.length<=32?new It(e):Ui.from(It.split(e,[]))}}class It extends Je{constructor(e,t=K_(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,o){for(let a=0;;a++){let r=this.text[a],c=o+r.length;if((t?i:c)>=e)return new V_(o,c,i,r);o=c+1,i++}}decompose(e,t,i,o){let a=e<=0&&t>=this.length?this:new It(fw(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(o&1){let r=i.pop(),c=nh(a.text,r.text.slice(),0,a.length);if(c.length<=32)i.push(new It(c,r.length+a.length));else{let d=c.length>>1;i.push(new It(c.slice(0,d)),new It(c.slice(d)))}}else i.push(a)}replace(e,t,i){if(!(i instanceof It))return super.replace(e,t,i);[e,t]=jr(this,e,t);let o=nh(this.text,nh(i.text,fw(this.text,0,e)),t),a=this.length+i.length-(t-e);return o.length<=32?new It(o,a):Ui.from(It.split(o,[]),a)}sliceString(e,t=this.length,i=`
|
|
18
18
|
`){[e,t]=jr(this,e,t);let o="";for(let a=0,r=0;a<=t&&r<this.text.length;r++){let c=this.text[r],d=a+c.length;a>e&&r&&(o+=i),e<d&&t>a&&(o+=c.slice(Math.max(0,e-a),t-a)),a=d+1}return o}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],o=-1;for(let a of e)i.push(a),o+=a.length+1,i.length==32&&(t.push(new It(i,o)),i=[],o=-1);return o>-1&&t.push(new It(i,o)),t}}class Ui extends Je{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,o){for(let a=0;;a++){let r=this.children[a],c=o+r.length,d=i+r.lines-1;if((t?d:c)>=e)return r.lineInner(e,t,i,o);o=c+1,i=d+1}}decompose(e,t,i,o){for(let a=0,r=0;r<=t&&a<this.children.length;a++){let c=this.children[a],d=r+c.length;if(e<=d&&t>=r){let f=o&((r<=e?1:0)|(d>=t?2:0));r>=e&&d<=t&&!f?i.push(c):c.decompose(e-r,t-r,i,f)}r=d+1}}replace(e,t,i){if([e,t]=jr(this,e,t),i.lines<this.lines)for(let o=0,a=0;o<this.children.length;o++){let r=this.children[o],c=a+r.length;if(e>=a&&t<=c){let d=r.replace(e-a,t-a,i),f=this.lines-r.lines+d.lines;if(d.lines<f>>4&&d.lines>f>>6){let g=this.children.slice();return g[o]=d,new Ui(g,this.length-(t-e)+i.length)}return super.replace(a,c,d)}a=c+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
19
19
|
`){[e,t]=jr(this,e,t);let o="";for(let a=0,r=0;a<this.children.length&&r<=t;a++){let c=this.children[a],d=r+c.length;r>e&&a&&(o+=i),e<d&&t>r&&(o+=c.sliceString(e-r,t-r,i)),r=d+1}return o}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ui))return 0;let i=0,[o,a,r,c]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;o+=t,a+=t){if(o==r||a==c)return i;let d=this.children[o],f=e.children[a];if(d!=f)return i+d.scanIdentical(f,t);i+=d.length+1}}static from(e,t=e.reduce((i,o)=>i+o.length+1,-1)){let i=0;for(let v of e)i+=v.lines;if(i<32){let v=[];for(let C of e)C.flatten(v);return new It(v,t)}let o=Math.max(32,i>>5),a=o<<1,r=o>>1,c=[],d=0,f=-1,g=[];function m(v){let C;if(v.lines>a&&v instanceof Ui)for(let k of v.children)m(k);else v.lines>r&&(d>r||!d)?(x(),c.push(v)):v instanceof It&&d&&(C=g[g.length-1])instanceof It&&v.lines+C.lines<=32?(d+=v.lines,f+=v.length+1,g[g.length-1]=new It(C.text.concat(v.text),C.length+1+v.length)):(d+v.lines>o&&x(),d+=v.lines,f+=v.length+1,g.push(v))}function x(){d!=0&&(c.push(g.length==1?g[0]:Ui.from(g,f)),f=-1,d=g.length=0)}for(let v of e)m(v);return x(),c.length==1?c[0]:new Ui(c,t)}}Je.empty=new It([""],0);function K_(n){let e=-1;for(let t of n)e+=t.length+1;return e}function nh(n,e,t=0,i=1e9){for(let o=0,a=0,r=!0;a<n.length&&o<=i;a++){let c=n[a],d=o+c.length;d>=t&&(d>i&&(c=c.slice(0,i-o)),o<t&&(c=c.slice(t-o)),r?(e[e.length-1]+=c,r=!1):e.push(c)),o=d+1}return e}function fw(n,e,t){return nh(n,[""],e,t)}class uc{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof It?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,o=this.nodes[i],a=this.offsets[i],r=a>>1,c=o instanceof It?o.text.length:o.children.length;if(r==(t>0?c:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
20
20
|
`,this;e--}else if(o instanceof It){let d=o.text[r+(t<0?-1:0)];if(this.offsets[i]+=t,d.length>Math.max(0,e))return this.value=e==0?d:t>0?d.slice(e):d.slice(0,d.length-e),this;e-=d.length}else{let d=o.children[r+(t<0?-1:0)];e>d.length?(e-=d.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(d),this.offsets.push(t>0?1:(d instanceof It?d.text.length:d.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class FD{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new uc(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:o}=this.cursor.next(e);return this.pos+=(o.length+e)*t,this.value=o.length<=i?o:t<0?o.slice(o.length-i):o.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class qD{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:o}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=o,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Je.prototype[Symbol.iterator]=function(){return this.iter()},uc.prototype[Symbol.iterator]=FD.prototype[Symbol.iterator]=qD.prototype[Symbol.iterator]=function(){return this});class V_{constructor(e,t,i,o){this.from=e,this.to=t,this.number=i,this.text=o}get length(){return this.to-this.from}}function jr(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function $t(n,e,t=!0,i=!0){return q_(n,e,t,i)}function W_(n){return n>=56320&&n<57344}function Q_(n){return n>=55296&&n<56320}function Mn(n,e){let t=n.charCodeAt(e);if(!Q_(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return W_(i)?(t-55296<<10)+(i-56320)+65536:t}function ox(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function zi(n){return n<65536?1:2}const by=/\r\n?|\n/;var xn=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(xn||(xn={}));class Yi{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,o=0;t<this.sections.length;){let a=this.sections[t++],r=this.sections[t++];r<0?(e(i,o,a),o+=a):o+=r,i+=a}}iterChangedRanges(e,t=!1){xy(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],o=this.sections[t++];o<0?e.push(i,o):e.push(o,i)}return new Yi(e)}composeDesc(e){return this.empty?e:e.empty?this:GD(this,e)}mapDesc(e,t=!1){return e.empty?this:vy(this,e,t)}mapPos(e,t=-1,i=xn.Simple){let o=0,a=0;for(let r=0;r<this.sections.length;){let c=this.sections[r++],d=this.sections[r++],f=o+c;if(d<0){if(f>e)return a+(e-o);a+=c}else{if(i!=xn.Simple&&f>=e&&(i==xn.TrackDel&&o<e&&f>e||i==xn.TrackBefore&&o<e||i==xn.TrackAfter&&f>e))return null;if(f>e||f==e&&t<0&&!c)return e==o||t<0?a:a+d;a+=d}o=f}if(e>o)throw new RangeError(`Position ${e} is out of range for changeset of length ${o}`);return a}touchesRange(e,t=e){for(let i=0,o=0;i<this.sections.length&&o<=t;){let a=this.sections[i++],r=this.sections[i++],c=o+a;if(r>=0&&o<=t&&c>=e)return o<e&&c>t?"cover":!0;o=c}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],o=this.sections[t++];e+=(e?" ":"")+i+(o>=0?":"+o:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Yi(e)}static create(e){return new Yi(e)}}class qt extends Yi{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return xy(this,(t,i,o,a,r)=>e=e.replace(o,o+(i-t),r),!1),e}mapDesc(e,t=!1){return vy(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let o=0,a=0;o<t.length;o+=2){let r=t[o],c=t[o+1];if(c>=0){t[o]=c,t[o+1]=r;let d=o>>1;for(;i.length<d;)i.push(Je.empty);i.push(r?e.slice(a,a+r):Je.empty)}a+=r}return new qt(t,i)}compose(e){return this.empty?e:e.empty?this:GD(this,e,!0)}map(e,t=!1){return e.empty?this:vy(this,e,t,!0)}iterChanges(e,t=!1){xy(this,e,t)}get desc(){return Yi.create(this.sections)}filter(e){let t=[],i=[],o=[],a=new Pc(this);e:for(let r=0,c=0;;){let d=r==e.length?1e9:e[r++];for(;c<d||c==d&&a.len==0;){if(a.done)break e;let g=Math.min(a.len,d-c);un(o,g,-1);let m=a.ins==-1?-1:a.off==0?a.ins:0;un(t,g,m),m>0&&gs(i,t,a.text),a.forward(g),c+=g}let f=e[r++];for(;c<f;){if(a.done)break e;let g=Math.min(a.len,f-c);un(t,g,-1),un(o,g,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(g),c+=g}}return{changes:new qt(t,i),filtered:Yi.create(o)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],o=this.sections[t+1];o<0?e.push(i):o==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let o=[],a=[],r=0,c=null;function d(g=!1){if(!g&&!o.length)return;r<t&&un(o,t-r,-1);let m=new qt(o,a);c=c?c.compose(m.map(c)):m,o=[],a=[],r=0}function f(g){if(Array.isArray(g))for(let m of g)f(m);else if(g instanceof qt){if(g.length!=t)throw new RangeError(`Mismatched change set length (got ${g.length}, expected ${t})`);d(),c=c?c.compose(g.map(c)):g}else{let{from:m,to:x=m,insert:v}=g;if(m>x||m<0||x>t)throw new RangeError(`Invalid change range ${m} to ${x} (in doc of length ${t})`);let C=v?typeof v=="string"?Je.of(v.split(i||by)):v:Je.empty,k=C.length;if(m==x&&k==0)return;m<r&&d(),m>r&&un(o,m-r,-1),un(o,x-m,k),gs(a,o,C),r=x}}return f(e),d(!c),c}static empty(e){return new qt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let o=0;o<e.length;o++){let a=e[o];if(typeof a=="number")t.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((r,c)=>c&&typeof r!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)t.push(a[0],0);else{for(;i.length<o;)i.push(Je.empty);i[o]=Je.of(a.slice(1)),t.push(a[0],i[o].length)}}}return new qt(t,i)}static createSet(e,t){return new qt(e,t)}}function un(n,e,t,i=!1){if(e==0&&t<=0)return;let o=n.length-2;o>=0&&t<=0&&t==n[o+1]?n[o]+=e:o>=0&&e==0&&n[o]==0?n[o+1]+=t:i?(n[o]+=e,n[o+1]+=t):n.push(e,t)}function gs(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(Je.empty);n.push(t)}}function xy(n,e,t){let i=n.inserted;for(let o=0,a=0,r=0;r<n.sections.length;){let c=n.sections[r++],d=n.sections[r++];if(d<0)o+=c,a+=c;else{let f=o,g=a,m=Je.empty;for(;f+=c,g+=d,d&&i&&(m=m.append(i[r-2>>1])),!(t||r==n.sections.length||n.sections[r+1]<0);)c=n.sections[r++],d=n.sections[r++];e(o,f,a,g,m),o=f,a=g}}}function vy(n,e,t,i=!1){let o=[],a=i?[]:null,r=new Pc(n),c=new Pc(e);for(let d=-1;;){if(r.done&&c.len||c.done&&r.len)throw new Error("Mismatched change set lengths");if(r.ins==-1&&c.ins==-1){let f=Math.min(r.len,c.len);un(o,f,-1),r.forward(f),c.forward(f)}else if(c.ins>=0&&(r.ins<0||d==r.i||r.off==0&&(c.len<r.len||c.len==r.len&&!t))){let f=c.len;for(un(o,c.ins,-1);f;){let g=Math.min(r.len,f);r.ins>=0&&d<r.i&&r.len<=g&&(un(o,0,r.ins),a&&gs(a,o,r.text),d=r.i),r.forward(g),f-=g}c.next()}else if(r.ins>=0){let f=0,g=r.len;for(;g;)if(c.ins==-1){let m=Math.min(g,c.len);f+=m,g-=m,c.forward(m)}else if(c.ins==0&&c.len<g)g-=c.len,c.next();else break;un(o,f,d<r.i?r.ins:0),a&&d<r.i&&gs(a,o,r.text),d=r.i,r.forward(r.len-g)}else{if(r.done&&c.done)return a?qt.createSet(o,a):Yi.create(o);throw new Error("Mismatched change set lengths")}}}function GD(n,e,t=!1){let i=[],o=t?[]:null,a=new Pc(n),r=new Pc(e);for(let c=!1;;){if(a.done&&r.done)return o?qt.createSet(i,o):Yi.create(i);if(a.ins==0)un(i,a.len,0,c),a.next();else if(r.len==0&&!r.done)un(i,0,r.ins,c),o&&gs(o,i,r.text),r.next();else{if(a.done||r.done)throw new Error("Mismatched change set lengths");{let d=Math.min(a.len2,r.len),f=i.length;if(a.ins==-1){let g=r.ins==-1?-1:r.off?0:r.ins;un(i,d,g,c),o&&g&&gs(o,i,r.text)}else r.ins==-1?(un(i,a.off?0:a.len,d,c),o&&gs(o,i,a.textBit(d))):(un(i,a.off?0:a.len,r.off?0:r.ins,c),o&&!r.off&&gs(o,i,r.text));c=(a.ins>d||r.ins>=0&&r.len>d)&&(c||i.length>f),a.forward2(d),r.forward(d)}}}}class Pc{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?Je.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?Je.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class ia{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,o;return this.empty?i=o=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),o=e.mapPos(this.to,-1)),i==this.from&&o==this.to?this:new ia(i,o,this.flags)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return J.range(e,t,void 0,void 0,i);let o=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return J.range(this.anchor,o,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return J.range(e.anchor,e.head)}static create(e,t,i){return new ia(e,t,i)}}class J{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:J.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new J([this.main],0)}addRange(e,t=!0){return J.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,J.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new J(e.ranges.map(t=>ia.fromJSON(t)),e.main)}static single(e,t=e){return new J([J.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,o=0;o<e.length;o++){let a=e[o];if(a.empty?a.from<=i:a.from<i)return J.normalized(e.slice(),t);i=a.to}return new J(e,t)}static cursor(e,t=0,i,o){return ia.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(o??16777215)<<6)}static range(e,t,i,o,a){let r=(i??16777215)<<6|(o==null?7:Math.min(6,o));return!a&&e!=t&&(a=t<e?1:-1),t<e?ia.create(t,e,48|r):ia.create(e,t,(a?a<0?8:16:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((o,a)=>o.from-a.from),t=e.indexOf(i);for(let o=1;o<e.length;o++){let a=e[o],r=e[o-1];if(a.empty?a.from<=r.to:a.from<r.to){let c=r.from,d=Math.max(a.to,r.to);o<=t&&t--,e.splice(--o,2,a.anchor>a.head?J.range(d,c):J.range(c,d))}}return new J(e,t)}}function KD(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let sx=0;class pe{constructor(e,t,i,o,a){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=o,this.id=sx++,this.default=e([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(e={}){return new pe(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:ax),!!e.static,e.enables)}of(e){return new ih([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ih(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ih(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function ax(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class ih{constructor(e,t,i,o){this.dependencies=e,this.facet=t,this.type=i,this.value=o,this.id=sx++}dynamicSlot(e){var t;let i=this.value,o=this.facet.compareInput,a=this.id,r=e[a]>>1,c=this.type==2,d=!1,f=!1,g=[];for(let m of this.dependencies)m=="doc"?d=!0:m=="selection"?f=!0:(((t=e[m.id])!==null&&t!==void 0?t:1)&1)==0&&g.push(e[m.id]);return{create(m){return m.values[r]=i(m),1},update(m,x){if(d&&x.docChanged||f&&(x.docChanged||x.selection)||Cy(m,g)){let v=i(m);if(c?!pw(v,m.values[r],o):!o(v,m.values[r]))return m.values[r]=v,1}return 0},reconfigure:(m,x)=>{let v,C=x.config.address[a];if(C!=null){let k=Ch(x,C);if(this.dependencies.every(A=>A instanceof pe?x.facet(A)===m.facet(A):A instanceof hn?x.field(A,!1)==m.field(A,!1):!0)||(c?pw(v=i(m),k,o):o(v=i(m),k)))return m.values[r]=k,0}else v=i(m);return m.values[r]=v,1}}}}function pw(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function Cy(n,e){let t=!1;for(let i of e)dc(n,i)&1&&(t=!0);return t}function Y_(n,e,t){let i=t.map(d=>n[d.id]),o=t.map(d=>d.type),a=i.filter(d=>!(d&1)),r=n[e.id]>>1;function c(d){let f=[];for(let g=0;g<i.length;g++){let m=Ch(d,i[g]);if(o[g]==2)for(let x of m)f.push(x);else f.push(m)}return e.combine(f)}return{create(d){for(let f of i)dc(d,f);return d.values[r]=c(d),1},update(d,f){if(!Cy(d,a))return 0;let g=c(d);return e.compare(g,d.values[r])?0:(d.values[r]=g,1)},reconfigure(d,f){let g=Cy(d,i),m=f.config.facets[e.id],x=f.facet(e);if(m&&!g&&ax(t,m))return d.values[r]=x,0;let v=c(d);return e.compare(v,x)?(d.values[r]=x,0):(d.values[r]=v,1)}}}const Od=pe.define({static:!0});class hn{constructor(e,t,i,o,a){this.id=e,this.createF=t,this.updateF=i,this.compareF=o,this.spec=a,this.provides=void 0}static define(e){let t=new hn(sx++,e.create,e.update,e.compare||((i,o)=>i===o),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Od).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,o)=>{let a=i.values[t],r=this.updateF(a,o);return this.compareF(a,r)?0:(i.values[t]=r,1)},reconfigure:(i,o)=>{let a=i.facet(Od),r=o.facet(Od),c;return(c=a.find(d=>d.field==this))&&c!=r.find(d=>d.field==this)?(i.values[t]=c.create(i),1):o.config.address[this.id]!=null?(i.values[t]=o.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,Od.of({field:this,create:e})]}get extension(){return this}}const ea={lowest:4,low:3,default:2,high:1,highest:0};function Kl(n){return e=>new VD(e,n)}const ka={highest:Kl(ea.highest),high:Kl(ea.high),default:Kl(ea.default),low:Kl(ea.low),lowest:Kl(ea.lowest)};class VD{constructor(e,t){this.inner=e,this.prec=t}}class df{of(e){return new Sy(this,e)}reconfigure(e){return df.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Sy{constructor(e,t){this.compartment=e,this.inner=t}}class vh{constructor(e,t,i,o,a,r){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=o,this.staticValues=a,this.facets=r,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let o=[],a=Object.create(null),r=new Map;for(let x of $_(e,t,r))x instanceof hn?o.push(x):(a[x.facet.id]||(a[x.facet.id]=[])).push(x);let c=Object.create(null),d=[],f=[];for(let x of o)c[x.id]=f.length<<1,f.push(v=>x.slot(v));let g=i?.config.facets;for(let x in a){let v=a[x],C=v[0].facet,k=g&&g[x]||[];if(v.every(A=>A.type==0))if(c[C.id]=d.length<<1|1,ax(k,v))d.push(i.facet(C));else{let A=C.combine(v.map(D=>D.value));d.push(i&&C.compare(A,i.facet(C))?i.facet(C):A)}else{for(let A of v)A.type==0?(c[A.id]=d.length<<1|1,d.push(A.value)):(c[A.id]=f.length<<1,f.push(D=>A.dynamicSlot(D)));c[C.id]=f.length<<1,f.push(A=>Y_(A,C,v))}}let m=f.map(x=>x(c));return new vh(e,r,m,c,d,a)}}function $_(n,e,t){let i=[[],[],[],[],[]],o=new Map;function a(r,c){let d=o.get(r);if(d!=null){if(d<=c)return;let f=i[d].indexOf(r);f>-1&&i[d].splice(f,1),r instanceof Sy&&t.delete(r.compartment)}if(o.set(r,c),Array.isArray(r))for(let f of r)a(f,c);else if(r instanceof Sy){if(t.has(r.compartment))throw new RangeError("Duplicate use of compartment in extensions");let f=e.get(r.compartment)||r.inner;t.set(r.compartment,f),a(f,c)}else if(r instanceof VD)a(r.inner,r.prec);else if(r instanceof hn)i[c].push(r),r.provides&&a(r.provides,c);else if(r instanceof ih)i[c].push(r),r.facet.extensions&&a(r.facet.extensions,ea.default);else{let f=r.extension;if(!f)throw new Error(`Unrecognized extension value in extension set (${r}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(f,c)}}return a(n,ea.default),i.reduce((r,c)=>r.concat(c))}function dc(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let o=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|o}function Ch(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const WD=pe.define(),ky=pe.define({combine:n=>n.some(e=>e),static:!0}),QD=pe.define({combine:n=>n.length?n[0]:void 0,static:!0}),YD=pe.define(),$D=pe.define(),XD=pe.define(),JD=pe.define({combine:n=>n.length?n[0]:!1});class eo{constructor(e,t){this.type=e,this.value=t}static define(){return new X_}}class X_{of(e){return new eo(this,e)}}class J_{constructor(e){this.map=e}of(e){return new Le(this,e)}}class Le{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Le(this.type,t)}is(e){return this.type==e}static define(e={}){return new J_(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let o of e){let a=o.map(t);a&&i.push(a)}return i}}Le.reconfigure=Le.define();Le.appendConfig=Le.define();class Gt{constructor(e,t,i,o,a,r){this.startState=e,this.changes=t,this.selection=i,this.effects=o,this.annotations=a,this.scrollIntoView=r,this._doc=null,this._state=null,i&&KD(i,t.newLength),a.some(c=>c.type==Gt.time)||(this.annotations=a.concat(Gt.time.of(Date.now())))}static create(e,t,i,o,a,r){return new Gt(e,t,i,o,a,r)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Gt.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Gt.time=eo.define();Gt.userEvent=eo.define();Gt.addToHistory=eo.define();Gt.remote=eo.define();function Z_(n,e){let t=[];for(let i=0,o=0;;){let a,r;if(i<n.length&&(o==e.length||e[o]>=n[i]))a=n[i++],r=n[i++];else if(o<e.length)a=e[o++],r=e[o++];else return t;!t.length||t[t.length-1]<a?t.push(a,r):t[t.length-1]<r&&(t[t.length-1]=r)}}function ZD(n,e,t){var i;let o,a,r;return t?(o=e.changes,a=qt.empty(e.changes.length),r=n.changes.compose(e.changes)):(o=e.changes.map(n.changes),a=n.changes.mapDesc(e.changes,!0),r=n.changes.compose(o)),{changes:r,selection:e.selection?e.selection.map(a):(i=n.selection)===null||i===void 0?void 0:i.map(o),effects:Le.mapEffects(n.effects,o).concat(Le.mapEffects(e.effects,a)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function wy(n,e,t){let i=e.selection,o=Pr(e.annotations);return e.userEvent&&(o=o.concat(Gt.userEvent.of(e.userEvent))),{changes:e.changes instanceof qt?e.changes:qt.of(e.changes||[],t,n.facet(QD)),selection:i&&(i instanceof J?i:J.single(i.anchor,i.head)),effects:Pr(e.effects),annotations:o,scrollIntoView:!!e.scrollIntoView}}function eO(n,e,t){let i=wy(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let a=1;a<e.length;a++){e[a].filter===!1&&(t=!1);let r=!!e[a].sequential;i=ZD(i,wy(n,e[a],r?i.changes.newLength:n.doc.length),r)}let o=Gt.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return tU(t?eU(o):o)}function eU(n){let e=n.startState,t=!0;for(let o of e.facet(YD)){let a=o(n);if(a===!1){t=!1;break}Array.isArray(a)&&(t=t===!0?a:Z_(t,a))}if(t!==!0){let o,a;if(t===!1)a=n.changes.invertedDesc,o=qt.empty(e.doc.length);else{let r=n.changes.filter(t);o=r.changes,a=r.filtered.mapDesc(r.changes).invertedDesc}n=Gt.create(e,o,n.selection&&n.selection.map(a),Le.mapEffects(n.effects,a),n.annotations,n.scrollIntoView)}let i=e.facet($D);for(let o=i.length-1;o>=0;o--){let a=i[o](n);a instanceof Gt?n=a:Array.isArray(a)&&a.length==1&&a[0]instanceof Gt?n=a[0]:n=eO(e,Pr(a),!1)}return n}function tU(n){let e=n.startState,t=e.facet(XD),i=n;for(let o=t.length-1;o>=0;o--){let a=t[o](n);a&&Object.keys(a).length&&(i=ZD(i,wy(e,a,n.changes.newLength),!0))}return i==n?n:Gt.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const nU=[];function Pr(n){return n==null?nU:Array.isArray(n)?n:[n]}var kt=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(kt||(kt={}));const iU=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Ay;try{Ay=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function oU(n){if(Ay)return Ay.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||iU.test(t)))return!0}return!1}function sU(n){return e=>{if(!/\S/.test(e))return kt.Space;if(oU(e))return kt.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return kt.Word;return kt.Other}}class Qe{constructor(e,t,i,o,a,r){this.config=e,this.doc=t,this.selection=i,this.values=o,this.status=e.statusTemplate.slice(),this.computeSlot=a,r&&(r._state=this);for(let c=0;c<this.config.dynamicSlots.length;c++)dc(this,c<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return dc(this,i),Ch(this,i)}update(...e){return eO(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:o}=t;for(let c of e.effects)c.is(df.reconfigure)?(t&&(o=new Map,t.compartments.forEach((d,f)=>o.set(f,d)),t=null),o.set(c.value.compartment,c.value.extension)):c.is(Le.reconfigure)?(t=null,i=c.value):c.is(Le.appendConfig)&&(t=null,i=Pr(i).concat(c.value));let a;t?a=e.startState.values.slice():(t=vh.resolve(i,o,this),a=new Qe(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(d,f)=>f.reconfigure(d,this),null).values);let r=e.startState.facet(ky)?e.newSelection:e.newSelection.asSingle();new Qe(t,e.newDoc,r,a,(c,d)=>d.update(c,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:J.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),o=this.changes(i.changes),a=[i.range],r=Pr(i.effects);for(let c=1;c<t.ranges.length;c++){let d=e(t.ranges[c]),f=this.changes(d.changes),g=f.map(o);for(let x=0;x<c;x++)a[x]=a[x].map(g);let m=o.mapDesc(f,!0);a.push(d.range.map(m)),o=o.compose(g),r=Le.mapEffects(r,g).concat(Le.mapEffects(Pr(d.effects),m))}return{changes:o,selection:J.create(a,t.mainIndex),effects:r}}changes(e=[]){return e instanceof qt?e:qt.of(e,this.doc.length,this.facet(Qe.lineSeparator))}toText(e){return Je.of(e.split(this.facet(Qe.lineSeparator)||by))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(dc(this,t),Ch(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let o=e[i];o instanceof hn&&this.config.address[o.id]!=null&&(t[i]=o.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let o=[];if(i){for(let a in i)if(Object.prototype.hasOwnProperty.call(e,a)){let r=i[a],c=e[a];o.push(r.init(d=>r.spec.fromJSON(c,d)))}}return Qe.create({doc:e.doc,selection:J.fromJSON(e.selection),extensions:t.extensions?o.concat([t.extensions]):o})}static create(e={}){let t=vh.resolve(e.extensions||[],new Map),i=e.doc instanceof Je?e.doc:Je.of((e.doc||"").split(t.staticFacet(Qe.lineSeparator)||by)),o=e.selection?e.selection instanceof J?e.selection:J.single(e.selection.anchor,e.selection.head):J.single(0);return KD(o,i.length),t.staticFacet(ky)||(o=o.asSingle()),new Qe(t,i,o,t.dynamicSlots.map(()=>null),(a,r)=>r.create(a),null)}get tabSize(){return this.facet(Qe.tabSize)}get lineBreak(){return this.facet(Qe.lineSeparator)||`
|
|
@@ -53,4 +53,4 @@ ${a}`,t),this.line=i,this.column=o,this.codeblock=a}}function rK(n,e){let t=0;fo
|
|
|
53
53
|
`,d);d=g>=0?g+1:o;continue}if(f==="[")c++;else if(f==="]"&&(c--,c===0))return d+1;d++}return o}return n.lineAt(e).to}if(t==="yaml"){if(a[0]==="|"||a[0]===">"){let r=n.lineAt(e),c=r.to;for(;r.number<n.lines;){const d=n.line(r.number+1);if(d.text.replace(/\s+$/,"")===""){c=d.to,r=d;continue}if(d.text.search(/\S/)<=i)break;c=d.to,r=d}return c}return n.lineAt(e).to}if(a[0]==="["||a[0]==="{"){const r=a[0],c=r==="["?"]":"}",d=n.toString();let f=0,g=e;for(;g<o;){const m=d[g];if(m==='"'){g=$x(d,g,'"');continue}if(m===r)f++;else if(m===c&&(f--,f===0))return g+1;g++}return o}return n.lineAt(e).to}function PK(n){const e=[];let t=0,i=null;for(;t<n.length;){const o=n[t];if(o===" "||o===" "||o===`
|
|
54
54
|
`||o==="\r"){t++;continue}if(o==='"'){const a=t,r=$x(n,t,'"');let c=r;for(;c<n.length&&(n[c]===" "||n[c]===" "||n[c]===`
|
|
55
55
|
`||n[c]==="\r");)c++;if((i==="{"||i===","||i===null)&&n[c]===":"){const g=n.slice(a+1,r-1).replace(/\\(.)/g,"$1");let m=c+1;for(;m<n.length&&(n[m]===" "||n[m]===" "||n[m]===`
|
|
56
|
-
`||n[m]==="\r");)m++;e.push({valueStart:m,key:g}),i='"',t=c+1;continue}i='"',t=r;continue}i=o,t++}return e}function yA(n,e){const t=new Zi,i=n.state.doc,o=i.toString();if(e==="json"){for(const{valueStart:c,key:d}of PK(o)){if(!gA(d)||c>=i.length)continue;const f=mA(i,c,"json",0),g=i.sliceString(c,f).replace(/\s+$/,"").length;g!==0&&t.add(c,c+g,Pe.mark({class:"cm-sensitive-mask"}))}return t.finish()}const a=new RegExp(kK[e].source,"gm");let r;for(;(r=a.exec(o))!==null;){const c=wK(r[2]),d=r[1].length;if(!gA(c))continue;const f=r.index+r[0].length;if(f>=i.length)continue;const g=mA(i,f,e,d),m=i.sliceString(f,g).replace(/\s+$/,"").length;m!==0&&t.add(f,f+m,Pe.mark({class:"cm-sensitive-mask"}))}return t.finish()}function DK(n){return At.fromClass(class{decorations;constructor(e){this.decorations=yA(e,n)}update(e){e.docChanged&&(this.decorations=yA(e.view,n))}},{decorations:e=>e.decorations})}const OK=QM({theme:"light",settings:{background:"transparent",foreground:"#393A34",caret:"#393A34",selection:"rgba(57, 58, 52, 0.18)",selectionMatch:"rgba(57, 58, 52, 0.12)",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"#999988"},styles:[{tag:[E.comment,E.lineComment,E.blockComment],color:"#999988",fontStyle:"italic"},{tag:[E.string,E.special(E.string),E.regexp],color:"#e3116c"},{tag:[E.number,E.bool,E.null,E.atom,E.variableName,E.propertyName,E.url],color:"#36acaa"},{tag:[E.keyword,E.attributeName,E.modifier,E.operatorKeyword],color:"#00a4db"},{tag:[E.function(E.variableName),E.labelName],color:"#6f42c1"},{tag:[E.tagName,E.heading],color:"#00009f",fontWeight:"bold"},{tag:[E.deleted,E.invalid],color:"#d73a49"},{tag:[E.punctuation,E.operator,E.bracket,E.brace,E.separator],color:"#393A34"}]}),TK=QM({theme:"dark",settings:{background:"transparent",foreground:"#d6deeb",caret:"#80a4c2",selection:"rgba(29, 59, 83, 0.99)",selectionMatch:"rgba(35, 77, 112, 0.6)",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"#4b6479"},styles:[{tag:[E.comment,E.lineComment,E.blockComment],color:"#637777",fontStyle:"italic"},{tag:[E.string,E.special(E.string),E.url],color:"rgb(173, 219, 103)"},{tag:E.number,color:"rgb(247, 140, 108)"},{tag:[E.bool,E.null,E.atom],color:"rgb(255, 88, 116)"},{tag:[E.keyword,E.modifier,E.operatorKeyword],color:"rgb(127, 219, 202)"},{tag:[E.propertyName,E.attributeName],color:"rgb(128, 203, 196)"},{tag:[E.variableName,E.labelName],color:"rgb(214, 222, 235)"},{tag:E.function(E.variableName),color:"rgb(130, 170, 255)"},{tag:[E.tagName,E.heading],color:"rgb(127, 219, 202)"},{tag:[E.bracket,E.punctuation,E.operator,E.brace,E.separator],color:"rgb(199, 146, 234)"},{tag:[E.className,E.special(E.string)],color:"rgb(255, 203, 139)"},{tag:[E.deleted,E.invalid],color:"rgba(239, 83, 80, 0.56)"}]}),MK=ue.baseTheme({".cm-sensitive-mask":{filter:"blur(3px)",opacity:"0.7",transition:"filter 200ms ease, opacity 200ms ease"},".cm-sensitive-revealed .cm-sensitive-mask":{filter:"none",opacity:"1"}});function XM({value:n,onChange:e,language:t="json",readonly:i=!1,exactText:o=!1,className:a,minHeight:r="300px",heightMode:c="content"}){const{isDark:d}=Nb(),{t:f}=xe(),[g,m]=w.useState(!1),[x,v]=w.useState(!0),C=c==="fill-parent",k=w.useMemo(()=>t==="json"?CK(n):t==="toml"?SK(n):{valid:!0},[n,t]),A=w.useMemo(()=>[t==="json"?D8():t==="yaml"?iK():Lx.define(oK),ue.lineWrapping,MK,DK(t),ue.theme({"&":{fontSize:"0.875rem",backgroundColor:"transparent"},"&.cm-focused":{outline:"none"},".cm-content":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",padding:"12px 0",caretColor:"currentColor"},".cm-line":{padding:"0 12px",lineHeight:"1.625"},".cm-scroller":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",lineHeight:"1.625"},".cm-gutters":{display:"none"}})],[t]);return p.jsxs("div",{className:q("flex min-h-0 flex-col",C&&"h-full",a),style:C?{height:r==="auto"?void 0:r}:void 0,"data-slot":"code-editor-root",children:[p.jsxs("div",{className:q("relative rounded-md border overflow-hidden bg-muted/30",C&&"flex min-h-0 flex-1 flex-col",g&&"ring-2 ring-ring ring-offset-2 ring-offset-background",i&&"opacity-70",!k.valid&&"border-destructive"),"data-slot":"code-editor-surface",children:[p.jsx("div",{className:q(C?"scrollbar-editor min-h-0 flex-1 overflow-hidden":void 0),"data-slot":C?"code-editor-viewport":void 0,children:p.jsx(UM,{value:n,onChange:i?void 0:e,readOnly:i,editable:!i,theme:d?TK:OK,extensions:A,height:C?"100%":void 0,minHeight:C?void 0:r,basicSetup:{lineNumbers:!1,foldGutter:!1,highlightActiveLine:!1,highlightActiveLineGutter:!1,autocompletion:!1,searchKeymap:!0},onFocus:()=>m(!0),onBlur:()=>m(!1),className:q("cm-editor-root",!x&&"cm-sensitive-revealed",C&&"h-full"),"data-slot":"code-editor-codemirror"})}),p.jsx("div",{className:"absolute top-2 right-2 z-20 opacity-50 hover:opacity-100 transition-opacity",children:p.jsx(ht,{variant:"ghost",size:"icon",className:"h-6 w-6 bg-background/50 hover:bg-background border shadow-sm rounded-full",onClick:()=>v(!x),title:f(x?"codeEditor.revealSensitive":"codeEditor.maskSensitive"),children:x?p.jsx(Wc,{className:"h-3 w-3"}):p.jsx(Vc,{className:"h-3 w-3"})})})]}),p.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs",children:[k.valid?p.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[p.jsx(Qc,{className:"w-3 h-3 text-green-500"}),f("codeEditor.valid",{language:t.toUpperCase()})]}):p.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[p.jsx(Cc,{className:"w-3 h-3"}),k.error,k.line&&` (line ${k.line})`]}),i&&p.jsx("span",{className:"ml-auto text-muted-foreground",children:f("codeEditor.readOnly")})]})]})}const Nf=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:XM},Symbol.toStringTag,{value:"Module"})),NK={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 LK(n,e){switch(e.type){case"SET_BROWSER_CONFIG":return{...n,browserConfig:e.payload};case"SET_BROWSER_STATUS":return{...n,browserStatus:e.payload};case"SET_BROWSER_LOADING":return{...n,browserLoading:e.payload};case"SET_BROWSER_STATUS_LOADING":return{...n,browserStatusLoading:e.payload};case"SET_BROWSER_SAVING":return{...n,browserSaving:e.payload};case"SET_BROWSER_ERROR":return{...n,browserError:e.payload};case"SET_BROWSER_SUCCESS":return{...n,browserSuccess:e.payload};case"SET_WEBSEARCH_CONFIG":return{...n,webSearchConfig:e.payload};case"SET_WEBSEARCH_STATUS":return{...n,webSearchStatus:e.payload};case"SET_WEBSEARCH_LOADING":return{...n,webSearchLoading:e.payload};case"SET_WEBSEARCH_STATUS_LOADING":return{...n,webSearchStatusLoading:e.payload};case"SET_WEBSEARCH_SAVING":return{...n,webSearchSaving:e.payload};case"SET_WEBSEARCH_ERROR":return{...n,webSearchError:e.payload};case"SET_WEBSEARCH_SUCCESS":return{...n,webSearchSuccess:e.payload};case"SET_GLOBALENV_CONFIG":return{...n,globalEnvConfig:e.payload};case"SET_GLOBALENV_LOADING":return{...n,globalEnvLoading:e.payload};case"SET_GLOBALENV_SAVING":return{...n,globalEnvSaving:e.payload};case"SET_GLOBALENV_ERROR":return{...n,globalEnvError:e.payload};case"SET_GLOBALENV_SUCCESS":return{...n,globalEnvSuccess:e.payload};case"SET_PROXY_CONFIG":return{...n,proxyConfig:e.payload};case"SET_PROXY_LOADING":return{...n,proxyLoading:e.payload};case"SET_PROXY_SAVING":return{...n,proxySaving:e.payload};case"SET_PROXY_ERROR":return{...n,proxyError:e.payload};case"SET_PROXY_SUCCESS":return{...n,proxySuccess:e.payload};case"SET_PROXY_TEST_RESULT":return{...n,proxyTestResult:e.payload};case"SET_PROXY_TESTING":return{...n,proxyTesting:e.payload};case"SET_RAW_CONFIG":return{...n,rawConfig:e.payload};case"SET_RAW_CONFIG_LOADING":return{...n,rawConfigLoading:e.payload};default:return n}}const JM=w.createContext(null);function RK({children:n}){const[e,t]=w.useReducer(LK,NK);return p.jsx(JM.Provider,{value:{state:e,dispatch:t},children:n})}function ZM(){const n=w.useContext(JM);if(!n)throw new Error("useSettingsContext must be used within a SettingsProvider");return n}function EK(){const{dispatch:n}=ZM(),e=w.useCallback(B=>n({type:"SET_BROWSER_CONFIG",payload:B}),[n]),t=w.useCallback(B=>n({type:"SET_BROWSER_STATUS",payload:B}),[n]),i=w.useCallback(B=>n({type:"SET_BROWSER_LOADING",payload:B}),[n]),o=w.useCallback(B=>n({type:"SET_BROWSER_STATUS_LOADING",payload:B}),[n]),a=w.useCallback(B=>n({type:"SET_BROWSER_SAVING",payload:B}),[n]),r=w.useCallback(B=>n({type:"SET_BROWSER_ERROR",payload:B}),[n]),c=w.useCallback(B=>n({type:"SET_BROWSER_SUCCESS",payload:B}),[n]),d=w.useCallback(B=>n({type:"SET_WEBSEARCH_CONFIG",payload:B}),[n]),f=w.useCallback(B=>n({type:"SET_WEBSEARCH_STATUS",payload:B}),[n]),g=w.useCallback(B=>n({type:"SET_WEBSEARCH_LOADING",payload:B}),[n]),m=w.useCallback(B=>n({type:"SET_WEBSEARCH_STATUS_LOADING",payload:B}),[n]),x=w.useCallback(B=>n({type:"SET_WEBSEARCH_SAVING",payload:B}),[n]),v=w.useCallback(B=>n({type:"SET_WEBSEARCH_ERROR",payload:B}),[n]),C=w.useCallback(B=>n({type:"SET_WEBSEARCH_SUCCESS",payload:B}),[n]),k=w.useCallback(B=>n({type:"SET_GLOBALENV_CONFIG",payload:B}),[n]),A=w.useCallback(B=>n({type:"SET_GLOBALENV_LOADING",payload:B}),[n]),D=w.useCallback(B=>n({type:"SET_GLOBALENV_SAVING",payload:B}),[n]),O=w.useCallback(B=>n({type:"SET_GLOBALENV_ERROR",payload:B}),[n]),T=w.useCallback(B=>n({type:"SET_GLOBALENV_SUCCESS",payload:B}),[n]),M=w.useCallback(B=>n({type:"SET_PROXY_CONFIG",payload:B}),[n]),L=w.useCallback(B=>n({type:"SET_PROXY_LOADING",payload:B}),[n]),N=w.useCallback(B=>n({type:"SET_PROXY_SAVING",payload:B}),[n]),I=w.useCallback(B=>n({type:"SET_PROXY_ERROR",payload:B}),[n]),W=w.useCallback(B=>n({type:"SET_PROXY_SUCCESS",payload:B}),[n]),U=w.useCallback(B=>n({type:"SET_PROXY_TEST_RESULT",payload:B}),[n]),z=w.useCallback(B=>n({type:"SET_PROXY_TESTING",payload:B}),[n]),$=w.useCallback(B=>n({type:"SET_RAW_CONFIG",payload:B}),[n]),F=w.useCallback(B=>n({type:"SET_RAW_CONFIG_LOADING",payload:B}),[n]);return w.useMemo(()=>({setBrowserConfig:e,setBrowserStatus:t,setBrowserLoading:i,setBrowserStatusLoading:o,setBrowserSaving:a,setBrowserError:r,setBrowserSuccess:c,setWebSearchConfig:d,setWebSearchStatus:f,setWebSearchLoading:g,setWebSearchStatusLoading:m,setWebSearchSaving:x,setWebSearchError:v,setWebSearchSuccess:C,setGlobalEnvConfig:k,setGlobalEnvLoading:A,setGlobalEnvSaving:D,setGlobalEnvError:O,setGlobalEnvSuccess:T,setProxyConfig:M,setProxyLoading:L,setProxySaving:N,setProxyError:I,setProxySuccess:W,setProxyTestResult:U,setProxyTesting:z,setRawConfig:$,setRawConfigLoading:F}),[e,t,i,o,a,r,c,d,f,g,m,x,v,C,k,A,D,O,T,M,L,N,I,W,U,z,$,F])}function IK(){const[n,e]=sP(),t=n.get("tab")?.toLowerCase(),i=t==="imageanalysis"||t==="image"?"image":t==="channels"?"channels":t==="globalenv"?"globalenv":t==="proxy"?"proxy":t==="auth"?"auth":t==="thinking"?"thinking":t==="backups"?"backups":"websearch",o=w.useCallback(a=>{e({tab:a},{replace:!0})},[e]);return{activeTab:i,setActiveTab:o}}function jK(){const{state:n}=ZM(),e=EK(),[t,i]=w.useState(!1),o=w.useCallback(async()=>{try{e.setRawConfigLoading(!0);const r=await fetch("/api/config/raw");if(!r.ok){e.setRawConfig(null);return}const c=await r.text();e.setRawConfig(c)}catch{e.setRawConfig(null)}finally{e.setRawConfigLoading(!1)}},[e]),a=w.useCallback(async()=>{if(n.rawConfig)try{await navigator.clipboard.writeText(n.rawConfig),i(!0),setTimeout(()=>i(!1),2e3)}catch{}},[n.rawConfig]);return{rawConfig:n.rawConfig,loading:n.rawConfigLoading,copied:t,fetchRawConfig:o,copyToClipboard:a}}function bA({activeTab:n,onTabChange:e}){const{t}=xe(),i=[{value:"browser",label:t("settingsTabs.browser"),icon:WE},{value:"websearch",label:t("settingsTabs.web"),icon:gP},{value:"image",label:t("settingsTabs.image"),icon:bP},{value:"channels",label:t("settingsTabs.channels"),icon:QE},{value:"globalenv",label:t("settingsTabs.env"),icon:Sb},{value:"thinking",label:t("settingsTabs.think"),icon:YE},{value:"proxy",label:t("settingsTabs.proxy"),icon:$E},{value:"auth",label:t("settingsTabs.auth"),icon:xb},{value:"backups",label:t("settingsTabs.backup"),icon:XE}];return p.jsx(OD,{value:n,onValueChange:o=>e(o),children:p.jsx(Xb,{className:"grid w-full grid-cols-9",children:i.map(({value:o,label:a,icon:r})=>p.jsxs(xh,{value:o,className:"gap-1.5 px-2 text-xs",children:[p.jsx(r,{className:"h-3.5 w-3.5 shrink-0"}),p.jsx("span",{className:"truncate",children:a})]},o))})})}function xA(){return p.jsxs("div",{className:"flex-1 p-5 space-y-6",children:[p.jsx(tt,{className:"h-4 w-2/3"}),p.jsx("div",{className:"p-4 rounded-lg border",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx(tt,{className:"h-5 w-32"}),p.jsx(tt,{className:"h-4 w-48"})]}),p.jsx(tt,{className:"h-6 w-10 rounded-full"})]})}),p.jsxs("div",{className:"space-y-3",children:[p.jsx(tt,{className:"h-5 w-24"}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(tt,{className:"h-20 w-full rounded-lg"}),p.jsx(tt,{className:"h-20 w-full rounded-lg"}),p.jsx(tt,{className:"h-20 w-full rounded-lg"})]})]})]})}function eN(n,e=3,t=1e3){return n().catch(i=>{if(e<=0)throw i;return new Promise(o=>setTimeout(o,t)).then(()=>eN(n,e-1,t*2))})}function Bo(n){return w.lazy(()=>eN(n))}const vA=Bo(()=>rt(()=>import("./index-D4nxVNz2.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),CA=Bo(()=>rt(()=>import("./index-B8BRpC7W.js"),__vite__mapDeps([10,1,2,11,4,5,6,7,8,9]))),SA=Bo(()=>rt(()=>import("./index-BTfHfkkh.js"),__vite__mapDeps([12,1,2,4,5,6,7,8,9]))),kA=Bo(()=>rt(()=>import("./channels-BZHQSZ2O.js"),__vite__mapDeps([13,1,2,4,5,6,7,8,9]))),wA=Bo(()=>rt(()=>import("./globalenv-section-Bi6g0RHv.js"),__vite__mapDeps([14,1,2,4,5,6,7,8,9]))),AA=Bo(()=>rt(()=>import("./index-bTno3t7S.js"),__vite__mapDeps([15,1,2,4,5,6,7,8,9]))),PA=Bo(()=>rt(()=>import("./index-2aTPFpCV.js"),__vite__mapDeps([16,1,2,17,4,18,19,5,6,20,21,7,8,9]))),DA=Bo(()=>rt(()=>import("./auth-section-DPJ_tnXs.js"),__vite__mapDeps([22,1,2,4,5,6,7,8,9]))),OA=Bo(()=>rt(()=>import("./backups-section-DGeCRWP2.js"),__vite__mapDeps([23,1,2,19,4,5,6,7,8,9])));class TA extends w.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){return this.state.hasError?p.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:p.jsxs("div",{className:"text-center p-6 max-w-md",children:[p.jsx(Cc,{className:"w-12 h-12 mx-auto mb-4 text-destructive"}),p.jsx("p",{className:"font-medium text-foreground mb-2",children:re.t("settings.sectionLoadFailed")}),p.jsx("p",{className:"text-sm mb-4",children:this.state.error?.message||re.t("settings.unknownError")}),p.jsxs(ht,{variant:"outline",onClick:()=>window.location.reload(),className:"inline-flex items-center gap-2",children:[p.jsx(vc,{className:"w-4 h-4"}),re.t("settings.reloadPage")]})]})}):this.props.children}}function BK(n){switch(n?.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 HK(){const{t:n}=xe(),{setActiveTab:e}=IK(),[t]=sP(),i=BK(t.get("tab")),{rawConfig:o,loading:a,copied:r,fetchRawConfig:c,copyToClipboard:d}=jK();w.useEffect(()=>{c()},[c]);const f=g=>{w.startTransition(()=>{e(g)})};return p.jsxs("div",{className:"h-full min-h-0",children:[p.jsxs("div",{className:"md:hidden h-full flex flex-col",children:[p.jsx("div",{className:"border-b bg-background p-4",children:p.jsx(bA,{activeTab:i,onTabChange:f})}),p.jsx(TA,{children:p.jsxs(w.Suspense,{fallback:p.jsx(xA,{}),children:[i==="browser"&&p.jsx(CA,{}),i==="websearch"&&p.jsx(vA,{}),i==="image"&&p.jsx(SA,{}),i==="channels"&&p.jsx(kA,{}),i==="globalenv"&&p.jsx(wA,{}),i==="thinking"&&p.jsx(AA,{}),i==="proxy"&&p.jsx(PA,{}),i==="auth"&&p.jsx(DA,{}),i==="backups"&&p.jsx(OA,{})]})})]}),p.jsxs(Yb,{direction:"horizontal",className:"h-full hidden md:flex",children:[p.jsx(kc,{defaultSize:46,minSize:36,maxSize:62,children:p.jsxs("div",{className:"h-full border-r flex flex-col bg-muted/30 relative",children:[p.jsx("div",{className:"p-5 border-b bg-background",children:p.jsx(bA,{activeTab:i,onTabChange:f})}),p.jsx(TA,{children:p.jsxs(w.Suspense,{fallback:p.jsx(xA,{}),children:[i==="browser"&&p.jsx(CA,{}),i==="websearch"&&p.jsx(vA,{}),i==="image"&&p.jsx(SA,{}),i==="channels"&&p.jsx(kA,{}),i==="globalenv"&&p.jsx(wA,{}),i==="thinking"&&p.jsx(AA,{}),i==="proxy"&&p.jsx(PA,{}),i==="auth"&&p.jsx(DA,{}),i==="backups"&&p.jsx(OA,{})]})})]})}),p.jsx($b,{className:"w-2 bg-border hover:bg-primary/20 transition-colors cursor-col-resize flex items-center justify-center group",children:p.jsx(Yh,{className:"w-3 h-3 text-muted-foreground group-hover:text-primary"})}),p.jsx(kc,{defaultSize:54,minSize:35,children:p.jsxs("div",{className:"h-full flex flex-col",children:[p.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(tk,{className:"w-5 h-5 text-primary"}),p.jsxs("div",{children:[p.jsx("h2",{className:"font-semibold",children:"config.yaml"}),p.jsx("p",{className:"text-sm text-muted-foreground",children:"~/.ccs/config.yaml"})]})]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx(ht,{variant:"outline",size:"sm",onClick:d,disabled:!o,children:r?p.jsxs(p.Fragment,{children:[p.jsx(Rr,{className:"w-4 h-4 mr-1"}),n("settings.copied")]}):p.jsxs(p.Fragment,{children:[p.jsx(hh,{className:"w-4 h-4 mr-1"}),n("settings.copy")]})}),p.jsx(ht,{variant:"outline",size:"sm",onClick:c,disabled:a,children:p.jsx(vc,{className:`w-4 h-4 ${a?"animate-spin":""}`})})]})]}),p.jsx("div",{className:"flex-1 overflow-auto",children:o?p.jsx(XM,{value:o,onChange:()=>{},language:"yaml",readonly:!0,minHeight:"auto",className:"min-h-full"}):a?p.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:[p.jsx(vc,{className:"w-5 h-5 animate-spin mr-2"}),n("settings.loading")]}):p.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:p.jsxs("div",{className:"text-center",children:[p.jsx(tk,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),p.jsx("p",{children:n("settings.configFileNotFound")}),p.jsx("code",{className:"text-sm bg-muted px-2 py-1 rounded mt-2 inline-block",children:"ccs migrate"})]})})})]})})]})]})}function _K(){return p.jsx(RK,{children:p.jsx(HK,{})})}const UK=Object.freeze(Object.defineProperty({__proto__:null,SettingsPage:_K},Symbol.toStringTag,{value:"Module"}));function zK(n,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:n,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const FK={},oc={};function la(n,e){try{const i=(FK[n]||=new Intl.DateTimeFormat("en-US",{timeZone:n,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return i in oc?oc[i]:MA(i,i.split(":"))}catch{if(n in oc)return oc[n];const t=n?.match(qK);return t?MA(n,t.slice(1)):NaN}}const qK=/([+-]\d\d):?(\d\d)?/;function MA(n,e){const t=+(e[0]||0),i=+(e[1]||0),o=+(e[2]||0)/60;return oc[n]=t*60+i>0?t*60+i+o:t*60-i-o}class Wi extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(la(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),tN(this),yb(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new Wi(...t,e):new Wi(Date.now(),e)}withTimeZone(e){return new Wi(+this,e)}getTimezoneOffset(){const e=-la(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),yb(this),+this}[Symbol.for("constructDateFrom")](e){return new Wi(+new Date(e),this.timeZone)}}const NA=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(n=>{if(!NA.test(n))return;const e=n.replace(NA,"$1UTC");Wi.prototype[e]&&(n.startsWith("get")?Wi.prototype[n]=function(){return this.internal[e]()}:(Wi.prototype[n]=function(){return Date.prototype[e].apply(this.internal,arguments),GK(this),+this},Wi.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),yb(this),+this}))});function yb(n){n.internal.setTime(+n),n.internal.setUTCSeconds(n.internal.getUTCSeconds()-Math.round(-la(n.timeZone,n)*60))}function GK(n){Date.prototype.setFullYear.call(n,n.internal.getUTCFullYear(),n.internal.getUTCMonth(),n.internal.getUTCDate()),Date.prototype.setHours.call(n,n.internal.getUTCHours(),n.internal.getUTCMinutes(),n.internal.getUTCSeconds(),n.internal.getUTCMilliseconds()),tN(n)}function tN(n){const e=la(n.timeZone,n),t=e>0?Math.floor(e):Math.ceil(e),i=new Date(+n);i.setUTCHours(i.getUTCHours()-1);const o=-new Date(+n).getTimezoneOffset(),a=-new Date(+i).getTimezoneOffset(),r=o-a,c=Date.prototype.getHours.apply(n)!==n.internal.getUTCHours();r&&c&&n.internal.setUTCMinutes(n.internal.getUTCMinutes()+r);const d=o-t;d&&Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+d);const f=new Date(+n);f.setUTCSeconds(0);const g=o>0?f.getSeconds():(f.getSeconds()-60)%60,m=Math.round(-(la(n.timeZone,n)*60))%60;(m||g)&&(n.internal.setUTCSeconds(n.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(n,Date.prototype.getUTCSeconds.call(n)+m+g));const x=la(n.timeZone,n),v=x>0?Math.floor(x):Math.ceil(x),k=-new Date(+n).getTimezoneOffset()-v,A=v!==t,D=k-d;if(A&&D){Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+D);const O=la(n.timeZone,n),T=O>0?Math.floor(O):Math.ceil(O),M=v-T;M&&(n.internal.setUTCMinutes(n.internal.getUTCMinutes()+M),Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+M))}}class Oo extends Wi{static tz(e,...t){return t.length?new Oo(...t,e):new Oo(Date.now(),e)}toISOString(){const[e,t,i]=this.tzComponents(),o=`${e}${t}:${i}`;return this.internal.toISOString().slice(0,-1)+o}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,i,o]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${i} ${t} ${o}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,i,o]=this.tzComponents();return`${e} GMT${t}${i}${o} (${zK(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",i=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),o=String(Math.abs(e)%60).padStart(2,"0");return[t,i,o]}withTimeZone(e){return new Oo(+this,e)}[Symbol.for("constructDateFrom")](e){return new Oo(+new Date(e),this.timeZone)}}const LA=5,KK=4;function VK(n,e){const t=e.startOfMonth(n),i=t.getDay()>0?t.getDay():7,o=e.addDays(n,-i+1),a=e.addDays(o,LA*7-1);return e.getMonth(n)===e.getMonth(a)?LA:KK}function nN(n,e){const t=e.startOfMonth(n),i=t.getDay();return i===1?t:i===0?e.addDays(t,-6):e.addDays(t,-1*(i-1))}function WK(n,e){const t=nN(n,e),i=VK(n,e);return e.addDays(t,i*7-1)}const iN={...zl,labels:{labelDayButton:(n,e,t,i)=>{let o;i&&typeof i.format=="function"?o=i.format.bind(i):o=(r,c)=>$l(r,c,{locale:zl,...t});let a=o(n,"PPPP");return e.today&&(a=`Today, ${a}`),e.selected&&(a=`${a}, selected`),a},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:n=>`Week ${n}`,labelYearDropdown:"Choose the Year",labelGrid:(n,e,t)=>{let i;return t&&typeof t.format=="function"?i=t.format.bind(t):i=(o,a)=>$l(o,a,{locale:zl,...e}),i(n,"LLLL yyyy")},labelGridcell:(n,e,t,i)=>{let o;i&&typeof i.format=="function"?o=i.format.bind(i):o=(r,c)=>$l(r,c,{locale:zl,...t});let a=o(n,"PPPP");return e?.today&&(a=`Today, ${a}`),a},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(n,e,t)=>{let i;return t&&typeof t.format=="function"?i=t.format.bind(t):i=(o,a)=>$l(o,a,{locale:zl,...e}),i(n,"cccc")}}};class $n{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Oo.tz(this.options.timeZone):new this.Date,this.newDate=(i,o,a)=>this.overrides?.newDate?this.overrides.newDate(i,o,a):this.options.timeZone?new Oo(i,o,a,this.options.timeZone):new Date(i,o,a),this.addDays=(i,o)=>this.overrides?.addDays?this.overrides.addDays(i,o):n2(i,o),this.addMonths=(i,o)=>this.overrides?.addMonths?this.overrides.addMonths(i,o):i2(i,o),this.addWeeks=(i,o)=>this.overrides?.addWeeks?this.overrides.addWeeks(i,o):o2(i,o),this.addYears=(i,o)=>this.overrides?.addYears?this.overrides.addYears(i,o):s2(i,o),this.differenceInCalendarDays=(i,o)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(i,o):a2(i,o),this.differenceInCalendarMonths=(i,o)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(i,o):r2(i,o),this.eachMonthOfInterval=i=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(i):l2(i),this.eachYearOfInterval=i=>{const o=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(i):c2(i),a=new Set(o.map(c=>this.getYear(c)));if(a.size===o.length)return o;const r=[];return a.forEach(c=>{r.push(new Date(c,0,1))}),r},this.endOfBroadcastWeek=i=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(i):WK(i,this),this.endOfISOWeek=i=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(i):u2(i),this.endOfMonth=i=>this.overrides?.endOfMonth?this.overrides.endOfMonth(i):d2(i),this.endOfWeek=(i,o)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(i,o):h2(i,this.options),this.endOfYear=i=>this.overrides?.endOfYear?this.overrides.endOfYear(i):f2(i),this.format=(i,o,a)=>{const r=this.overrides?.format?this.overrides.format(i,o,this.options):$l(i,o,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(r):r},this.getISOWeek=i=>this.overrides?.getISOWeek?this.overrides.getISOWeek(i):p2(i),this.getMonth=(i,o)=>this.overrides?.getMonth?this.overrides.getMonth(i,this.options):g2(i,this.options),this.getYear=(i,o)=>this.overrides?.getYear?this.overrides.getYear(i,this.options):m2(i,this.options),this.getWeek=(i,o)=>this.overrides?.getWeek?this.overrides.getWeek(i,this.options):y2(i,this.options),this.isAfter=(i,o)=>this.overrides?.isAfter?this.overrides.isAfter(i,o):b2(i,o),this.isBefore=(i,o)=>this.overrides?.isBefore?this.overrides.isBefore(i,o):x2(i,o),this.isDate=i=>this.overrides?.isDate?this.overrides.isDate(i):v2(i),this.isSameDay=(i,o)=>this.overrides?.isSameDay?this.overrides.isSameDay(i,o):C2(i,o),this.isSameMonth=(i,o)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(i,o):S2(i,o),this.isSameYear=(i,o)=>this.overrides?.isSameYear?this.overrides.isSameYear(i,o):k2(i,o),this.max=i=>this.overrides?.max?this.overrides.max(i):w2(i),this.min=i=>this.overrides?.min?this.overrides.min(i):A2(i),this.setMonth=(i,o)=>this.overrides?.setMonth?this.overrides.setMonth(i,o):P2(i,o),this.setYear=(i,o)=>this.overrides?.setYear?this.overrides.setYear(i,o):D2(i,o),this.startOfBroadcastWeek=(i,o)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(i,this):nN(i,this),this.startOfDay=i=>this.overrides?.startOfDay?this.overrides.startOfDay(i):O2(i),this.startOfISOWeek=i=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(i):T2(i),this.startOfMonth=i=>this.overrides?.startOfMonth?this.overrides.startOfMonth(i):M2(i),this.startOfWeek=(i,o)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(i,this.options):N2(i,this.options),this.startOfYear=i=>this.overrides?.startOfYear?this.overrides.startOfYear(i):L2(i),this.options={locale:iN,...e},this.overrides=t}getDigitMap(){const{numerals:e="latn"}=this.options,t=new Intl.NumberFormat("en-US",{numberingSystem:e}),i={};for(let o=0;o<10;o++)i[o.toString()]=t.format(o);return i}replaceDigits(e){const t=this.getDigitMap();return e.replace(/\d/g,i=>t[i]||i)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&$n.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:t,timeZone:i,numerals:o}=this.options,a=t?.code;if(a&&$n.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:"long",year:"numeric",timeZone:i,numberingSystem:o}).format(e)}catch{}const r=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,r)}}$n.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 io=new $n;class oN{constructor(e,t,i=io){this.date=e,this.displayMonth=t,this.outside=!!(t&&!i.isSameMonth(e,t)),this.dateLib=i,this.isoDate=i.format(e,"yyyy-MM-dd"),this.displayMonthId=i.format(t,"yyyy-MM"),this.dateMonthId=i.format(e,"yyyy-MM")}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class QK{constructor(e,t){this.date=e,this.weeks=t}}class YK{constructor(e,t){this.days=t,this.weekNumber=e}}function $K(n){return me.createElement("button",{...n})}function XK(n){return me.createElement("span",{...n})}function JK(n){const{size:e=24,orientation:t="left",className:i}=n;return me.createElement("svg",{className:i,width:e,height:e,viewBox:"0 0 24 24"},t==="up"&&me.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),t==="down"&&me.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),t==="left"&&me.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),t==="right"&&me.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function ZK(n){const{day:e,modifiers:t,...i}=n;return me.createElement("td",{...i})}function eV(n){const{day:e,modifiers:t,...i}=n,o=me.useRef(null);return me.useEffect(()=>{t.focused&&o.current?.focus()},[t.focused]),me.createElement("button",{ref:o,...i})}var we;(function(n){n.Root="root",n.Chevron="chevron",n.Day="day",n.DayButton="day_button",n.CaptionLabel="caption_label",n.Dropdowns="dropdowns",n.Dropdown="dropdown",n.DropdownRoot="dropdown_root",n.Footer="footer",n.MonthGrid="month_grid",n.MonthCaption="month_caption",n.MonthsDropdown="months_dropdown",n.Month="month",n.Months="months",n.Nav="nav",n.NextMonthButton="button_next",n.PreviousMonthButton="button_previous",n.Week="week",n.Weeks="weeks",n.Weekday="weekday",n.Weekdays="weekdays",n.WeekNumber="week_number",n.WeekNumberHeader="week_number_header",n.YearsDropdown="years_dropdown"})(we||(we={}));var wt;(function(n){n.disabled="disabled",n.hidden="hidden",n.outside="outside",n.focused="focused",n.today="today"})(wt||(wt={}));var Si;(function(n){n.range_end="range_end",n.range_middle="range_middle",n.range_start="range_start",n.selected="selected"})(Si||(Si={}));var Qn;(function(n){n.weeks_before_enter="weeks_before_enter",n.weeks_before_exit="weeks_before_exit",n.weeks_after_enter="weeks_after_enter",n.weeks_after_exit="weeks_after_exit",n.caption_after_enter="caption_after_enter",n.caption_after_exit="caption_after_exit",n.caption_before_enter="caption_before_enter",n.caption_before_exit="caption_before_exit"})(Qn||(Qn={}));function tV(n){const{options:e,className:t,components:i,classNames:o,...a}=n,r=[o[we.Dropdown],t].join(" "),c=e?.find(({value:d})=>d===a.value);return me.createElement("span",{"data-disabled":a.disabled,className:o[we.DropdownRoot]},me.createElement(i.Select,{className:r,...a},e?.map(({value:d,label:f,disabled:g})=>me.createElement(i.Option,{key:d,value:d,disabled:g},f))),me.createElement("span",{className:o[we.CaptionLabel],"aria-hidden":!0},c?.label,me.createElement(i.Chevron,{orientation:"down",size:18,className:o[we.Chevron]})))}function nV(n){return me.createElement("div",{...n})}function iV(n){return me.createElement("div",{...n})}function oV(n){const{calendarMonth:e,displayIndex:t,...i}=n;return me.createElement("div",{...i},n.children)}function sV(n){const{calendarMonth:e,displayIndex:t,...i}=n;return me.createElement("div",{...i})}function aV(n){return me.createElement("table",{...n})}function rV(n){return me.createElement("div",{...n})}const sN=w.createContext(void 0);function iu(){const n=w.useContext(sN);if(n===void 0)throw new Error("useDayPicker() must be used within a custom component.");return n}function lV(n){const{components:e}=iu();return me.createElement(e.Dropdown,{...n})}function cV(n){const{onPreviousClick:e,onNextClick:t,previousMonth:i,nextMonth:o,...a}=n,{components:r,classNames:c,labels:{labelPrevious:d,labelNext:f}}=iu(),g=w.useCallback(x=>{o&&t?.(x)},[o,t]),m=w.useCallback(x=>{i&&e?.(x)},[i,e]);return me.createElement("nav",{...a},me.createElement(r.PreviousMonthButton,{type:"button",className:c[we.PreviousMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":d(i),onClick:m},me.createElement(r.Chevron,{disabled:i?void 0:!0,className:c[we.Chevron],orientation:"left"})),me.createElement(r.NextMonthButton,{type:"button",className:c[we.NextMonthButton],tabIndex:o?void 0:-1,"aria-disabled":o?void 0:!0,"aria-label":f(o),onClick:g},me.createElement(r.Chevron,{disabled:o?void 0:!0,orientation:"right",className:c[we.Chevron]})))}function uV(n){const{components:e}=iu();return me.createElement(e.Button,{...n})}function dV(n){return me.createElement("option",{...n})}function hV(n){const{components:e}=iu();return me.createElement(e.Button,{...n})}function fV(n){const{rootRef:e,...t}=n;return me.createElement("div",{...t,ref:e})}function pV(n){return me.createElement("select",{...n})}function gV(n){const{week:e,...t}=n;return me.createElement("tr",{...t})}function mV(n){return me.createElement("th",{...n})}function yV(n){return me.createElement("thead",{"aria-hidden":!0},me.createElement("tr",{...n}))}function bV(n){const{week:e,...t}=n;return me.createElement("th",{...t})}function xV(n){return me.createElement("th",{...n})}function vV(n){return me.createElement("tbody",{...n})}function CV(n){const{components:e}=iu();return me.createElement(e.Dropdown,{...n})}const SV=Object.freeze(Object.defineProperty({__proto__:null,Button:$K,CaptionLabel:XK,Chevron:JK,Day:ZK,DayButton:eV,Dropdown:tV,DropdownNav:nV,Footer:iV,Month:oV,MonthCaption:sV,MonthGrid:aV,Months:rV,MonthsDropdown:lV,Nav:cV,NextMonthButton:uV,Option:dV,PreviousMonthButton:hV,Root:fV,Select:pV,Week:gV,WeekNumber:bV,WeekNumberHeader:xV,Weekday:mV,Weekdays:yV,Weeks:vV,YearsDropdown:CV},Symbol.toStringTag,{value:"Module"}));function To(n,e,t=!1,i=io){let{from:o,to:a}=n;const{differenceInCalendarDays:r,isSameDay:c}=i;return o&&a?(r(a,o)<0&&([o,a]=[a,o]),r(e,o)>=(t?1:0)&&r(a,e)>=(t?1:0)):!t&&a?c(a,e):!t&&o?c(o,e):!1}function Xx(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function Lf(n){return!!(n&&typeof n=="object"&&"from"in n)}function Jx(n){return!!(n&&typeof n=="object"&&"after"in n)}function Zx(n){return!!(n&&typeof n=="object"&&"before"in n)}function aN(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function rN(n,e){return Array.isArray(n)&&n.every(e.isDate)}function Mo(n,e,t=io){const i=Array.isArray(e)?e:[e],{isSameDay:o,differenceInCalendarDays:a,isAfter:r}=t;return i.some(c=>{if(typeof c=="boolean")return c;if(t.isDate(c))return o(n,c);if(rN(c,t))return c.some(d=>o(n,d));if(Lf(c))return To(c,n,!1,t);if(aN(c))return Array.isArray(c.dayOfWeek)?c.dayOfWeek.includes(n.getDay()):c.dayOfWeek===n.getDay();if(Xx(c)){const d=a(c.before,n),f=a(c.after,n),g=d>0,m=f<0;return r(c.before,c.after)?m&&g:g||m}return Jx(c)?a(n,c.after)>0:Zx(c)?a(c.before,n)>0:typeof c=="function"?c(n):!1})}function kV(n,e,t,i,o){const{disabled:a,hidden:r,modifiers:c,showOutsideDays:d,broadcastCalendar:f,today:g=o.today()}=e,{isSameDay:m,isSameMonth:x,startOfMonth:v,isBefore:C,endOfMonth:k,isAfter:A}=o,D=t&&v(t),O=i&&k(i),T={[wt.focused]:[],[wt.outside]:[],[wt.disabled]:[],[wt.hidden]:[],[wt.today]:[]},M={};for(const L of n){const{date:N,displayMonth:I}=L,W=!!(I&&!x(N,I)),U=!!(D&&C(N,D)),z=!!(O&&A(N,O)),$=!!(a&&Mo(N,a,o)),F=!!(r&&Mo(N,r,o))||U||z||!f&&!d&&W||f&&d===!1&&W,B=m(N,g);W&&T.outside.push(L),$&&T.disabled.push(L),F&&T.hidden.push(L),B&&T.today.push(L),c&&Object.keys(c).forEach(ie=>{const oe=c?.[ie];oe&&Mo(N,oe,o)&&(M[ie]?M[ie].push(L):M[ie]=[L])})}return L=>{const N={[wt.focused]:!1,[wt.disabled]:!1,[wt.hidden]:!1,[wt.outside]:!1,[wt.today]:!1},I={};for(const W in T){const U=T[W];N[W]=U.some(z=>z===L)}for(const W in M)I[W]=M[W].some(U=>U===L);return{...N,...I}}}function wV(n,e,t={}){return Object.entries(n).filter(([,o])=>o===!0).reduce((o,[a])=>(t[a]?o.push(t[a]):e[wt[a]]?o.push(e[wt[a]]):e[Si[a]]&&o.push(e[Si[a]]),o),[e[we.Day]])}function AV(n){return{...SV,...n}}function PV(n){const e={"data-mode":n.mode??void 0,"data-required":"required"in n?n.required:void 0,"data-multiple-months":n.numberOfMonths&&n.numberOfMonths>1||void 0,"data-week-numbers":n.showWeekNumber||void 0,"data-broadcast-calendar":n.broadcastCalendar||void 0,"data-nav-layout":n.navLayout||void 0};return Object.entries(n).forEach(([t,i])=>{t.startsWith("data-")&&(e[t]=i)}),e}function DV(){const n={};for(const e in we)n[we[e]]=`rdp-${we[e]}`;for(const e in wt)n[wt[e]]=`rdp-${wt[e]}`;for(const e in Si)n[Si[e]]=`rdp-${Si[e]}`;for(const e in Qn)n[Qn[e]]=`rdp-${Qn[e]}`;return n}function lN(n,e,t){return(t??new $n(e)).formatMonthYear(n)}const OV=lN;function TV(n,e,t){return(t??new $n(e)).format(n,"d")}function MV(n,e=io){return e.format(n,"LLLL")}function NV(n,e,t){return(t??new $n(e)).format(n,"cccccc")}function LV(n,e=io){return n<10?e.formatNumber(`0${n.toLocaleString()}`):e.formatNumber(`${n.toLocaleString()}`)}function RV(){return""}function cN(n,e=io){return e.format(n,"yyyy")}const EV=cN,IV=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:lN,formatDay:TV,formatMonthCaption:OV,formatMonthDropdown:MV,formatWeekNumber:LV,formatWeekNumberHeader:RV,formatWeekdayName:NV,formatYearCaption:EV,formatYearDropdown:cN},Symbol.toStringTag,{value:"Module"}));function jV(n){return n?.formatMonthCaption&&!n.formatCaption&&(n.formatCaption=n.formatMonthCaption),n?.formatYearCaption&&!n.formatYearDropdown&&(n.formatYearDropdown=n.formatYearCaption),{...IV,...n}}function ev(n,e,t,i){let o=(i??new $n(t)).format(n,"PPPP");return e.today&&(o=`Today, ${o}`),e.selected&&(o=`${o}, selected`),o}const BV=ev;function tv(n,e,t){return(t??new $n(e)).formatMonthYear(n)}const HV=tv;function uN(n,e,t,i){let o=(i??new $n(t)).format(n,"PPPP");return e?.today&&(o=`Today, ${o}`),o}function dN(n){return"Choose the Month"}function hN(){return""}const _V="Go to the Next Month";function fN(n,e){return _V}function pN(n){return"Go to the Previous Month"}function gN(n,e,t){return(t??new $n(e)).format(n,"cccc")}function mN(n,e){return`Week ${n}`}function yN(n){return"Week Number"}function bN(n){return"Choose the Year"}const UV=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:HV,labelDay:BV,labelDayButton:ev,labelGrid:tv,labelGridcell:uN,labelMonthDropdown:dN,labelNav:hN,labelNext:fN,labelPrevious:pN,labelWeekNumber:mN,labelWeekNumberHeader:yN,labelWeekday:gN,labelYearDropdown:bN},Symbol.toStringTag,{value:"Module"})),xi=(n,e,t)=>e||(t?typeof t=="function"?t:(...i)=>t:n);function zV(n,e){const t=e.locale?.labels??{};return{...UV,...n??{},labelDayButton:xi(ev,n?.labelDayButton,t.labelDayButton),labelMonthDropdown:xi(dN,n?.labelMonthDropdown,t.labelMonthDropdown),labelNext:xi(fN,n?.labelNext,t.labelNext),labelPrevious:xi(pN,n?.labelPrevious,t.labelPrevious),labelWeekNumber:xi(mN,n?.labelWeekNumber,t.labelWeekNumber),labelYearDropdown:xi(bN,n?.labelYearDropdown,t.labelYearDropdown),labelGrid:xi(tv,n?.labelGrid,t.labelGrid),labelGridcell:xi(uN,n?.labelGridcell,t.labelGridcell),labelNav:xi(hN,n?.labelNav,t.labelNav),labelWeekNumberHeader:xi(yN,n?.labelWeekNumberHeader,t.labelWeekNumberHeader),labelWeekday:xi(gN,n?.labelWeekday,t.labelWeekday)}}function FV(n,e,t,i,o){const{startOfMonth:a,startOfYear:r,endOfYear:c,eachMonthOfInterval:d,getMonth:f}=o;return d({start:r(n),end:c(n)}).map(x=>{const v=i.formatMonthDropdown(x,o),C=f(x),k=e&&x<a(e)||t&&x>a(t)||!1;return{value:C,label:v,disabled:k}})}function qV(n,e={},t={}){let i={...e?.[we.Day]};return Object.entries(n).filter(([,o])=>o===!0).forEach(([o])=>{i={...i,...t?.[o]}}),i}function GV(n,e,t,i){const o=i??n.today(),a=t?n.startOfBroadcastWeek(o,n):e?n.startOfISOWeek(o):n.startOfWeek(o),r=[];for(let c=0;c<7;c++){const d=n.addDays(a,c);r.push(d)}return r}function KV(n,e,t,i,o=!1){if(!n||!e)return;const{startOfYear:a,endOfYear:r,eachYearOfInterval:c,getYear:d}=i,f=a(n),g=r(e),m=c({start:f,end:g});return o&&m.reverse(),m.map(x=>{const v=t.formatYearDropdown(x,i);return{value:d(x),label:v,disabled:!1}})}const ou=n=>n instanceof HTMLElement?n:null,Xm=n=>[...n.querySelectorAll("[data-animated-month]")??[]],VV=n=>ou(n.querySelector("[data-animated-month]")),Jm=n=>ou(n.querySelector("[data-animated-caption]")),Zm=n=>ou(n.querySelector("[data-animated-weeks]")),WV=n=>ou(n.querySelector("[data-animated-nav]")),QV=n=>ou(n.querySelector("[data-animated-weekdays]"));function YV(n,e,{classNames:t,months:i,focused:o,dateLib:a}){const r=w.useRef(null),c=w.useRef(i),d=w.useRef(!1);w.useLayoutEffect(()=>{const f=c.current;if(c.current=i,!e||!n.current||!(n.current instanceof HTMLElement)||i.length===0||f.length===0||i.length!==f.length)return;const g=a.isSameMonth(i[0].date,f[0].date),m=a.isAfter(i[0].date,f[0].date),x=m?t[Qn.caption_after_enter]:t[Qn.caption_before_enter],v=m?t[Qn.weeks_after_enter]:t[Qn.weeks_before_enter],C=r.current,k=n.current.cloneNode(!0);if(k instanceof HTMLElement?(Xm(k).forEach(T=>{if(!(T instanceof HTMLElement))return;const M=VV(T);M&&T.contains(M)&&T.removeChild(M);const L=Jm(T);L&&L.classList.remove(x);const N=Zm(T);N&&N.classList.remove(v)}),r.current=k):r.current=null,d.current||g||o)return;const A=C instanceof HTMLElement?Xm(C):[],D=Xm(n.current);if(D?.every(O=>O instanceof HTMLElement)&&A&&A.every(O=>O instanceof HTMLElement)){d.current=!0,n.current.style.isolation="isolate";const O=WV(n.current);O&&(O.style.zIndex="1"),D.forEach((T,M)=>{const L=A[M];if(!L)return;T.style.position="relative",T.style.overflow="hidden";const N=Jm(T);N&&N.classList.add(x);const I=Zm(T);I&&I.classList.add(v);const W=()=>{d.current=!1,n.current&&(n.current.style.isolation=""),O&&(O.style.zIndex=""),N&&N.classList.remove(x),I&&I.classList.remove(v),T.style.position="",T.style.overflow="",T.contains(L)&&T.removeChild(L)};L.style.pointerEvents="none",L.style.position="absolute",L.style.overflow="hidden",L.setAttribute("aria-hidden","true");const U=QV(L);U&&(U.style.opacity="0");const z=Jm(L);z&&(z.classList.add(m?t[Qn.caption_before_exit]:t[Qn.caption_after_exit]),z.addEventListener("animationend",W));const $=Zm(L);$&&$.classList.add(m?t[Qn.weeks_before_exit]:t[Qn.weeks_after_exit]),T.insertBefore(L,T.firstChild)})}})}function $V(n,e,t,i){const o=n[0],a=n[n.length-1],{ISOWeek:r,fixedWeeks:c,broadcastCalendar:d}=t??{},{addDays:f,differenceInCalendarDays:g,differenceInCalendarMonths:m,endOfBroadcastWeek:x,endOfISOWeek:v,endOfMonth:C,endOfWeek:k,isAfter:A,startOfBroadcastWeek:D,startOfISOWeek:O,startOfWeek:T}=i,M=d?D(o,i):r?O(o):T(o),L=d?x(a):r?v(C(a)):k(C(a)),N=e&&(d?x(e):r?v(e):k(e)),I=N&&A(L,N)?N:L,W=g(I,M),U=m(a,o)+1,z=[];for(let B=0;B<=W;B++){const ie=f(M,B);z.push(ie)}const F=(d?35:42)*U;if(c&&z.length<F){const B=F-z.length;for(let ie=0;ie<B;ie++){const oe=f(z[z.length-1],1);z.push(oe)}}return z}function XV(n){const e=[];return n.reduce((t,i)=>{const o=i.weeks.reduce((a,r)=>a.concat(r.days.slice()),e.slice());return t.concat(o.slice())},e.slice())}function JV(n,e,t,i){const{numberOfMonths:o=1}=t,a=[];for(let r=0;r<o;r++){const c=i.addMonths(n,r);if(e&&c>e)break;a.push(c)}return a}function RA(n,e,t,i){const{month:o,defaultMonth:a,today:r=i.today(),numberOfMonths:c=1}=n;let d=o||a||r;const{differenceInCalendarMonths:f,addMonths:g,startOfMonth:m}=i;if(t&&f(t,d)<c-1){const x=-1*(c-1);d=g(t,x)}return e&&f(d,e)<0&&(d=e),m(d)}function ZV(n,e,t,i){const{addDays:o,endOfBroadcastWeek:a,endOfISOWeek:r,endOfMonth:c,endOfWeek:d,getISOWeek:f,getWeek:g,startOfBroadcastWeek:m,startOfISOWeek:x,startOfWeek:v}=i,C=n.reduce((k,A)=>{const D=t.broadcastCalendar?m(A,i):t.ISOWeek?x(A):v(A),O=t.broadcastCalendar?a(A):t.ISOWeek?r(c(A)):d(c(A)),T=e.filter(I=>I>=D&&I<=O),M=t.broadcastCalendar?35:42;if(t.fixedWeeks&&T.length<M){const I=e.filter(W=>{const U=M-T.length;return W>O&&W<=o(O,U)});T.push(...I)}const L=T.reduce((I,W)=>{const U=t.ISOWeek?f(W):g(W),z=I.find(F=>F.weekNumber===U),$=new oN(W,A,i);return z?z.days.push($):I.push(new YK(U,[$])),I},[]),N=new QK(A,L);return k.push(N),k},[]);return t.reverseMonths?C.reverse():C}function e9(n,e){let{startMonth:t,endMonth:i}=n;const{startOfYear:o,startOfDay:a,startOfMonth:r,endOfMonth:c,addYears:d,endOfYear:f,newDate:g,today:m}=e,{fromYear:x,toYear:v,fromMonth:C,toMonth:k}=n;!t&&C&&(t=C),!t&&x&&(t=e.newDate(x,0,1)),!i&&k&&(i=k),!i&&v&&(i=g(v,11,31));const A=n.captionLayout==="dropdown"||n.captionLayout==="dropdown-years";return t?t=r(t):x?t=g(x,0,1):!t&&A&&(t=o(d(n.today??m(),-100))),i?i=c(i):v?i=g(v,11,31):!i&&A&&(i=f(n.today??m())),[t&&a(t),i&&a(i)]}function t9(n,e,t,i){if(t.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:a=1}=t,{startOfMonth:r,addMonths:c,differenceInCalendarMonths:d}=i,f=o?a:1,g=r(n);if(!e)return c(g,f);if(!(d(e,n)<a))return c(g,f)}function n9(n,e,t,i){if(t.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:a}=t,{startOfMonth:r,addMonths:c,differenceInCalendarMonths:d}=i,f=o?a??1:1,g=r(n);if(!e)return c(g,-f);if(!(d(g,e)<=0))return c(g,-f)}function i9(n){const e=[];return n.reduce((t,i)=>t.concat(i.weeks.slice()),e.slice())}function Rf(n,e){const[t,i]=w.useState(n);return[e===void 0?t:e,i]}function o9(n,e){const[t,i]=e9(n,e),{startOfMonth:o,endOfMonth:a}=e,r=RA(n,t,i,e),[c,d]=Rf(r,n.month?r:void 0);w.useEffect(()=>{const M=RA(n,t,i,e);d(M)},[n.timeZone]);const{months:f,weeks:g,days:m,previousMonth:x,nextMonth:v}=w.useMemo(()=>{const M=JV(c,i,{numberOfMonths:n.numberOfMonths},e),L=$V(M,n.endMonth?a(n.endMonth):void 0,{ISOWeek:n.ISOWeek,fixedWeeks:n.fixedWeeks,broadcastCalendar:n.broadcastCalendar},e),N=ZV(M,L,{broadcastCalendar:n.broadcastCalendar,fixedWeeks:n.fixedWeeks,ISOWeek:n.ISOWeek,reverseMonths:n.reverseMonths},e),I=i9(N),W=XV(N),U=n9(c,t,n,e),z=t9(c,i,n,e);return{months:N,weeks:I,days:W,previousMonth:U,nextMonth:z}},[e,c.getTime(),i?.getTime(),t?.getTime(),n.disableNavigation,n.broadcastCalendar,n.endMonth?.getTime(),n.fixedWeeks,n.ISOWeek,n.numberOfMonths,n.pagedNavigation,n.reverseMonths]),{disableNavigation:C,onMonthChange:k}=n,A=M=>g.some(L=>L.days.some(N=>N.isEqualTo(M))),D=M=>{if(C)return;let L=o(M);t&&L<o(t)&&(L=o(t)),i&&L>o(i)&&(L=o(i)),d(L),k?.(L)};return{months:f,weeks:g,days:m,navStart:t,navEnd:i,previousMonth:x,nextMonth:v,goToMonth:D,goToDay:M=>{A(M)||D(M.date)}}}var _i;(function(n){n[n.Today=0]="Today",n[n.Selected=1]="Selected",n[n.LastFocused=2]="LastFocused",n[n.FocusedModifier=3]="FocusedModifier"})(_i||(_i={}));function EA(n){return!n[wt.disabled]&&!n[wt.hidden]&&!n[wt.outside]}function s9(n,e,t,i){let o,a=-1;for(const r of n){const c=e(r);EA(c)&&(c[wt.focused]&&a<_i.FocusedModifier?(o=r,a=_i.FocusedModifier):i?.isEqualTo(r)&&a<_i.LastFocused?(o=r,a=_i.LastFocused):t(r.date)&&a<_i.Selected?(o=r,a=_i.Selected):c[wt.today]&&a<_i.Today&&(o=r,a=_i.Today))}return o||(o=n.find(r=>EA(e(r)))),o}function a9(n,e,t,i,o,a,r){const{ISOWeek:c,broadcastCalendar:d}=a,{addDays:f,addMonths:g,addWeeks:m,addYears:x,endOfBroadcastWeek:v,endOfISOWeek:C,endOfWeek:k,max:A,min:D,startOfBroadcastWeek:O,startOfISOWeek:T,startOfWeek:M}=r;let N={day:f,week:m,month:g,year:x,startOfWeek:I=>d?O(I,r):c?T(I):M(I),endOfWeek:I=>d?v(I):c?C(I):k(I)}[n](t,e==="after"?1:-1);return e==="before"&&i?N=A([i,N]):e==="after"&&o&&(N=D([o,N])),N}function xN(n,e,t,i,o,a,r,c=0){if(c>365)return;const d=a9(n,e,t.date,i,o,a,r),f=!!(a.disabled&&Mo(d,a.disabled,r)),g=!!(a.hidden&&Mo(d,a.hidden,r)),m=d,x=new oN(d,m,r);return!f&&!g?x:xN(n,e,x,i,o,a,r,c+1)}function r9(n,e,t,i,o){const{autoFocus:a}=n,[r,c]=w.useState(),d=s9(e.days,t,i||(()=>!1),r),[f,g]=w.useState(a?d:void 0);return{isFocusTarget:k=>!!d?.isEqualTo(k),setFocused:g,focused:f,blur:()=>{c(f),g(void 0)},moveFocus:(k,A)=>{if(!f)return;const D=xN(k,A,f,e.navStart,e.navEnd,n,o);D&&(n.disableNavigation&&!e.days.some(T=>T.isEqualTo(D))||(e.goToDay(D),g(D)))}}}function l9(n,e){const{selected:t,required:i,onSelect:o}=n,[a,r]=Rf(t,o?t:void 0),c=o?t:a,{isSameDay:d}=e,f=v=>c?.some(C=>d(C,v))??!1,{min:g,max:m}=n;return{selected:c,select:(v,C,k)=>{let A=[...c??[]];if(f(v)){if(c?.length===g||i&&c?.length===1)return;A=c?.filter(D=>!d(D,v))}else c?.length===m?A=[v]:A=[...A,v];return o||r(A),o?.(A,v,C,k),A},isSelected:f}}function c9(n,e,t=0,i=0,o=!1,a=io){const{from:r,to:c}=e||{},{isSameDay:d,isAfter:f,isBefore:g}=a;let m;if(!r&&!c)m={from:n,to:t>0?void 0:n};else if(r&&!c)d(r,n)?t===0?m={from:r,to:n}:o?m={from:r,to:void 0}:m=void 0:g(n,r)?m={from:n,to:r}:m={from:r,to:n};else if(r&&c)if(d(r,n)&&d(c,n))o?m={from:r,to:c}:m=void 0;else if(d(r,n))m={from:r,to:t>0?void 0:n};else if(d(c,n))m={from:n,to:t>0?void 0:n};else if(g(n,r))m={from:n,to:c};else if(f(n,r))m={from:r,to:n};else if(f(n,c))m={from:r,to:n};else throw new Error("Invalid range");if(m?.from&&m?.to){const x=a.differenceInCalendarDays(m.to,m.from);i>0&&x>i?m={from:n,to:void 0}:t>1&&x<t&&(m={from:n,to:void 0})}return m}function u9(n,e,t=io){const i=Array.isArray(e)?e:[e];let o=n.from;const a=t.differenceInCalendarDays(n.to,n.from),r=Math.min(a,6);for(let c=0;c<=r;c++){if(i.includes(o.getDay()))return!0;o=t.addDays(o,1)}return!1}function IA(n,e,t=io){return To(n,e.from,!1,t)||To(n,e.to,!1,t)||To(e,n.from,!1,t)||To(e,n.to,!1,t)}function d9(n,e,t=io){const i=Array.isArray(e)?e:[e];if(i.filter(c=>typeof c!="function").some(c=>typeof c=="boolean"?c:t.isDate(c)?To(n,c,!1,t):rN(c,t)?c.some(d=>To(n,d,!1,t)):Lf(c)?c.from&&c.to?IA(n,{from:c.from,to:c.to},t):!1:aN(c)?u9(n,c.dayOfWeek,t):Xx(c)?t.isAfter(c.before,c.after)?IA(n,{from:t.addDays(c.after,1),to:t.addDays(c.before,-1)},t):Mo(n.from,c,t)||Mo(n.to,c,t):Jx(c)||Zx(c)?Mo(n.from,c,t)||Mo(n.to,c,t):!1))return!0;const r=i.filter(c=>typeof c=="function");if(r.length){let c=n.from;const d=t.differenceInCalendarDays(n.to,n.from);for(let f=0;f<=d;f++){if(r.some(g=>g(c)))return!0;c=t.addDays(c,1)}}return!1}function h9(n,e){const{disabled:t,excludeDisabled:i,selected:o,required:a,onSelect:r}=n,[c,d]=Rf(o,r?o:void 0),f=r?o:c;return{selected:f,select:(x,v,C)=>{const{min:k,max:A}=n,D=x?c9(x,f,k,A,a,e):void 0;return i&&t&&D?.from&&D.to&&d9({from:D.from,to:D.to},t,e)&&(D.from=x,D.to=void 0),r||d(D),r?.(D,x,v,C),D},isSelected:x=>f&&To(f,x,!1,e)}}function f9(n,e){const{selected:t,required:i,onSelect:o}=n,[a,r]=Rf(t,o?t:void 0),c=o?t:a,{isSameDay:d}=e;return{selected:c,select:(m,x,v)=>{let C=m;return!i&&c&&c&&d(m,c)&&(C=void 0),o||r(C),o?.(C,m,x,v),C},isSelected:m=>c?d(c,m):!1}}function p9(n,e){const t=f9(n,e),i=l9(n,e),o=h9(n,e);switch(n.mode){case"single":return t;case"multiple":return i;case"range":return o;default:return}}function sn(n,e){return n instanceof Oo&&n.timeZone===e?n:new Oo(n,e)}function jA(n,e){return typeof n=="boolean"||typeof n=="function"?n:n instanceof Date?sn(n,e):Array.isArray(n)?n.map(t=>t instanceof Date?sn(t,e):t):Lf(n)?{...n,from:n.from?sn(n.from,e):n.from,to:n.to?sn(n.to,e):n.to}:Xx(n)?{before:sn(n.before,e),after:sn(n.after,e)}:Jx(n)?{after:sn(n.after,e)}:Zx(n)?{before:sn(n.before,e)}:n}function ey(n,e){return n&&(Array.isArray(n)?n.map(t=>jA(t,e)):jA(n,e))}function g9(n){let e=n;const t=e.timeZone;if(t&&(e={...n,timeZone:t},e.today&&(e.today=sn(e.today,t)),e.month&&(e.month=sn(e.month,t)),e.defaultMonth&&(e.defaultMonth=sn(e.defaultMonth,t)),e.startMonth&&(e.startMonth=sn(e.startMonth,t)),e.endMonth&&(e.endMonth=sn(e.endMonth,t)),e.mode==="single"&&e.selected?e.selected=sn(e.selected,t):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(Re=>sn(Re,t)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?sn(e.selected.from,t):e.selected.from,to:e.selected.to?sn(e.selected.to,t):e.selected.to}),e.disabled!==void 0&&(e.disabled=ey(e.disabled,t)),e.hidden!==void 0&&(e.hidden=ey(e.hidden,t)),e.modifiers)){const Re={};Object.keys(e.modifiers).forEach(Ve=>{Re[Ve]=ey(e.modifiers?.[Ve],t)}),e.modifiers=Re}const{components:i,formatters:o,labels:a,dateLib:r,locale:c,classNames:d}=w.useMemo(()=>{const Re={...iN,...e.locale},Ve=new $n({locale:Re,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib);return{dateLib:Ve,components:AV(e.components),formatters:jV(e.formatters),labels:zV(e.labels,Ve.options),locale:Re,classNames:{...DV(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]);e.today||(e={...e,today:r.today()});const{captionLayout:f,mode:g,navLayout:m,numberOfMonths:x=1,onDayBlur:v,onDayClick:C,onDayFocus:k,onDayKeyDown:A,onDayMouseEnter:D,onDayMouseLeave:O,onNextClick:T,onPrevClick:M,showWeekNumber:L,styles:N}=e,{formatCaption:I,formatDay:W,formatMonthDropdown:U,formatWeekNumber:z,formatWeekNumberHeader:$,formatWeekdayName:F,formatYearDropdown:B}=o,ie=o9(e,r),{days:oe,months:H,navStart:Z,navEnd:se,previousMonth:Y,nextMonth:ae,goToMonth:de}=ie,be=kV(oe,e,Z,se,r),{isSelected:te,select:le,selected:ve}=p9(e,r)??{},{blur:Se,focused:ye,isFocusTarget:Oe,moveFocus:je,setFocused:nt}=r9(e,ie,be,te??(()=>!1),r),{labelDayButton:Pt,labelGridcell:Te,labelGrid:Ye,labelMonthDropdown:it,labelNav:ln,labelPrevious:Sn,labelNext:Ps,labelWeekday:zt,labelWeekNumber:Ho,labelWeekNumberHeader:Ds,labelYearDropdown:gi}=a,wa=w.useMemo(()=>GV(r,e.ISOWeek,e.broadcastCalendar,e.today),[r,e.ISOWeek,e.broadcastCalendar,e.today]),Aa=g!==void 0||C!==void 0,Xt=w.useCallback(()=>{Y&&(de(Y),M?.(Y))},[Y,de,M]),Xr=w.useCallback(()=>{ae&&(de(ae),T?.(ae))},[de,ae,T]),su=w.useCallback((Re,Ve)=>Me=>{Me.preventDefault(),Me.stopPropagation(),nt(Re),!Ve.disabled&&(le?.(Re.date,Ve,Me),C?.(Re.date,Ve,Me))},[le,C,nt]),au=w.useCallback((Re,Ve)=>Me=>{nt(Re),k?.(Re.date,Ve,Me)},[k,nt]),Pa=w.useCallback((Re,Ve)=>Me=>{Se(),v?.(Re.date,Ve,Me)},[Se,v]),Ef=w.useCallback((Re,Ve)=>Me=>{const $e={ArrowLeft:[Me.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[Me.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[Me.shiftKey?"year":"week","after"],ArrowUp:[Me.shiftKey?"year":"week","before"],PageUp:[Me.shiftKey?"year":"month","before"],PageDown:[Me.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if($e[Me.key]){Me.preventDefault(),Me.stopPropagation();const[Kt,He]=$e[Me.key];je(Kt,He)}A?.(Re.date,Ve,Me)},[je,A,e.dir]),ru=w.useCallback((Re,Ve)=>Me=>{D?.(Re.date,Ve,Me)},[D]),If=w.useCallback((Re,Ve)=>Me=>{O?.(Re.date,Ve,Me)},[O]),jf=w.useCallback(Re=>Ve=>{const Me=Number(Ve.target.value),$e=r.setMonth(r.startOfMonth(Re),Me);de($e)},[r,de]),Os=w.useCallback(Re=>Ve=>{const Me=Number(Ve.target.value),$e=r.setYear(r.startOfMonth(Re),Me);de($e)},[r,de]),{className:pn,style:Oi}=w.useMemo(()=>({className:[d[we.Root],e.className].filter(Boolean).join(" "),style:{...N?.[we.Root],...e.style}}),[d,e.className,e.style,N]),gn=PV(e),lu=w.useRef(null);YV(lu,!!e.animate,{classNames:d,months:H,focused:ye,dateLib:r});const Bf={dayPickerProps:e,selected:ve,select:le,isSelected:te,months:H,nextMonth:ae,previousMonth:Y,goToMonth:de,getModifiers:be,components:i,classNames:d,styles:N,labels:a,formatters:o};return me.createElement(sN.Provider,{value:Bf},me.createElement(i.Root,{rootRef:e.animate?lu:void 0,className:pn,style:Oi,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...gn},me.createElement(i.Months,{className:d[we.Months],style:N?.[we.Months]},!e.hideNavigation&&!m&&me.createElement(i.Nav,{"data-animated-nav":e.animate?"true":void 0,className:d[we.Nav],style:N?.[we.Nav],"aria-label":ln(),onPreviousClick:Xt,onNextClick:Xr,previousMonth:Y,nextMonth:ae}),H.map((Re,Ve)=>me.createElement(i.Month,{"data-animated-month":e.animate?"true":void 0,className:d[we.Month],style:N?.[we.Month],key:Ve,displayIndex:Ve,calendarMonth:Re},m==="around"&&!e.hideNavigation&&Ve===0&&me.createElement(i.PreviousMonthButton,{type:"button",className:d[we.PreviousMonthButton],tabIndex:Y?void 0:-1,"aria-disabled":Y?void 0:!0,"aria-label":Sn(Y),onClick:Xt,"data-animated-button":e.animate?"true":void 0},me.createElement(i.Chevron,{disabled:Y?void 0:!0,className:d[we.Chevron],orientation:e.dir==="rtl"?"right":"left"})),me.createElement(i.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:d[we.MonthCaption],style:N?.[we.MonthCaption],calendarMonth:Re,displayIndex:Ve},f?.startsWith("dropdown")?me.createElement(i.DropdownNav,{className:d[we.Dropdowns],style:N?.[we.Dropdowns]},(()=>{const Me=f==="dropdown"||f==="dropdown-months"?me.createElement(i.MonthsDropdown,{key:"month",className:d[we.MonthsDropdown],"aria-label":it(),classNames:d,components:i,disabled:!!e.disableNavigation,onChange:jf(Re.date),options:FV(Re.date,Z,se,o,r),style:N?.[we.Dropdown],value:r.getMonth(Re.date)}):me.createElement("span",{key:"month"},U(Re.date,r)),$e=f==="dropdown"||f==="dropdown-years"?me.createElement(i.YearsDropdown,{key:"year",className:d[we.YearsDropdown],"aria-label":gi(r.options),classNames:d,components:i,disabled:!!e.disableNavigation,onChange:Os(Re.date),options:KV(Z,se,o,r,!!e.reverseYears),style:N?.[we.Dropdown],value:r.getYear(Re.date)}):me.createElement("span",{key:"year"},B(Re.date,r));return r.getMonthYearOrder()==="year-first"?[$e,Me]:[Me,$e]})(),me.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"}},I(Re.date,r.options,r))):me.createElement(i.CaptionLabel,{className:d[we.CaptionLabel],role:"status","aria-live":"polite"},I(Re.date,r.options,r))),m==="around"&&!e.hideNavigation&&Ve===x-1&&me.createElement(i.NextMonthButton,{type:"button",className:d[we.NextMonthButton],tabIndex:ae?void 0:-1,"aria-disabled":ae?void 0:!0,"aria-label":Ps(ae),onClick:Xr,"data-animated-button":e.animate?"true":void 0},me.createElement(i.Chevron,{disabled:ae?void 0:!0,className:d[we.Chevron],orientation:e.dir==="rtl"?"left":"right"})),Ve===x-1&&m==="after"&&!e.hideNavigation&&me.createElement(i.Nav,{"data-animated-nav":e.animate?"true":void 0,className:d[we.Nav],style:N?.[we.Nav],"aria-label":ln(),onPreviousClick:Xt,onNextClick:Xr,previousMonth:Y,nextMonth:ae}),me.createElement(i.MonthGrid,{role:"grid","aria-multiselectable":g==="multiple"||g==="range","aria-label":Ye(Re.date,r.options,r)||void 0,className:d[we.MonthGrid],style:N?.[we.MonthGrid]},!e.hideWeekdays&&me.createElement(i.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:d[we.Weekdays],style:N?.[we.Weekdays]},L&&me.createElement(i.WeekNumberHeader,{"aria-label":Ds(r.options),className:d[we.WeekNumberHeader],style:N?.[we.WeekNumberHeader],scope:"col"},$()),wa.map(Me=>me.createElement(i.Weekday,{"aria-label":zt(Me,r.options,r),className:d[we.Weekday],key:String(Me),style:N?.[we.Weekday],scope:"col"},F(Me,r.options,r)))),me.createElement(i.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:d[we.Weeks],style:N?.[we.Weeks]},Re.weeks.map(Me=>me.createElement(i.Week,{className:d[we.Week],key:Me.weekNumber,style:N?.[we.Week],week:Me},L&&me.createElement(i.WeekNumber,{week:Me,style:N?.[we.WeekNumber],"aria-label":Ho(Me.weekNumber,{locale:c}),className:d[we.WeekNumber],scope:"row",role:"rowheader"},z(Me.weekNumber,r)),Me.days.map($e=>{const{date:Kt}=$e,He=be($e);if(He[wt.focused]=!He.hidden&&!!ye?.isEqualTo($e),He[Si.selected]=te?.(Kt)||He.selected,Lf(ve)){const{from:Ms,to:oo}=ve;He[Si.range_start]=!!(Ms&&oo&&r.isSameDay(Kt,Ms)),He[Si.range_end]=!!(Ms&&oo&&r.isSameDay(Kt,oo)),He[Si.range_middle]=To(ve,Kt,!0,r)}const Ts=qV(He,N,e.modifiersStyles),Hf=wV(He,d,e.modifiersClassNames),cu=!Aa&&!He.hidden?Te(Kt,He,r.options,r):void 0;return me.createElement(i.Day,{key:`${$e.isoDate}_${$e.displayMonthId}`,day:$e,modifiers:He,className:Hf.join(" "),style:Ts,role:"gridcell","aria-selected":He.selected||void 0,"aria-label":cu,"data-day":$e.isoDate,"data-month":$e.outside?$e.dateMonthId:void 0,"data-selected":He.selected||void 0,"data-disabled":He.disabled||void 0,"data-hidden":He.hidden||void 0,"data-outside":$e.outside||void 0,"data-focused":He.focused||void 0,"data-today":He.today||void 0},!He.hidden&&Aa?me.createElement(i.DayButton,{className:d[we.DayButton],style:N?.[we.DayButton],type:"button",day:$e,modifiers:He,disabled:!He.focused&&He.disabled||void 0,"aria-disabled":He.focused&&He.disabled||void 0,tabIndex:Oe($e)?0:-1,"aria-label":Pt(Kt,He,r.options,r),onClick:su($e,He),onBlur:Pa($e,He),onFocus:au($e,He),onKeyDown:Ef($e,He),onMouseEnter:ru($e,He),onMouseLeave:If($e,He)},W(Kt,r.options,r)):!He.hidden&&W($e.date,r.options,r))})))))))),e.footer&&me.createElement(i.Footer,{className:d[we.Footer],style:N?.[we.Footer],role:"status","aria-live":"polite"},e.footer)))}function m9({className:n,classNames:e,showOutsideDays:t=!0,...i}){return p.jsx(g9,{showOutsideDays:t,className:q("p-2",n),classNames:{root:"relative",months:"flex flex-col sm:flex-row gap-2 sm:gap-4",month:"flex flex-col gap-2",month_caption:"flex justify-center pt-1 relative items-center h-8",caption_label:"text-sm font-medium",nav:"absolute inset-x-0 top-2 flex items-center justify-between px-1 z-10",button_previous:q(Jd({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:q(Jd({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),month_grid:"w-full border-collapse",weekdays:"flex w-full",weekday:"text-muted-foreground w-8 font-normal text-xs text-center",weeks:"flex flex-col",week:"flex w-full",day:q("relative h-8 w-8 p-0 text-center text-xs font-normal focus-within:relative focus-within:z-20","hover:bg-accent hover:text-accent-foreground rounded-full select-none"),day_button:q(Jd({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-l-full aria-selected:rounded-r-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_end:q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-r-full aria-selected:rounded-l-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_middle:q("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:q("bg-primary text-primary-foreground rounded-full","hover:bg-primary hover:text-primary-foreground","focus:bg-primary focus:text-primary-foreground"),today:"bg-accent text-accent-foreground rounded-full",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...e},components:{Chevron:({orientation:o,className:a,...r})=>{const c=o==="left"?JE:o==="right"?Wh:o==="up"?vb:Qh;return p.jsx(c,{className:q("h-4 w-4",a),...r})}},...i})}m9.displayName="Calendar";const y9=w.lazy(()=>rt(()=>Promise.resolve().then(()=>Nf),void 0).then(n=>({default:n.CodeEditor})));function uQ({rawJsonContent:n,isRawJsonValid:e,rawJsonEdits:t,rawSettingsEnv:i,onChange:o,missingRequiredFields:a=[]}){const{t:r}=xe(),c=a.length>0;return p.jsx(w.Suspense,{fallback:p.jsxs("div",{className:"flex items-center justify-center h-full",children:[p.jsx(hi,{className:"w-6 h-6 animate-spin text-muted-foreground"}),p.jsx("span",{className:"ml-2 text-muted-foreground",children:r("providerEditor.loadingEditor")})]}),children:p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!e&&t!==null&&p.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:[p.jsx(Kr,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),e&&c&&p.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:[p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",p.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:a.join(", ")}),p.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:p.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:p.jsx(y9,{value:n,onChange:o,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx("div",{className:"border rounded-md overflow-hidden",children:p.jsx(Zb,{profileEnv:i})})})]})})}w.lazy(()=>rt(()=>Promise.resolve().then(()=>Nf),void 0).then(n=>({default:n.CodeEditor})));function b9(){const{t:n}=xe(),{isDark:e,setTheme:t}=Nb(),[i,o]=w.useState(""),[a,r]=w.useState(""),[c,d]=w.useState(!1),[f,g]=w.useState(null),[m,x]=w.useState(!1),{login:v,authRequired:C,isAuthenticated:k,loading:A,accessMode:D,authEnabled:O}=Zh(),T=bb(),M=Vh(),L=D==="setup",N=n(L?"auth.remoteGuardLabel":"auth.protectedAccessLabel"),I=n(L?O?"auth.incompleteSetupDescription":"auth.remoteSetupDescription":"auth.loginDescription"),W=M.state?.from?.pathname||"/";if(w.useEffect(()=>{A||(k||!C)&&T(W,{replace:!0})},[k,C,A,T,W]),A)return p.jsx("div",{className:"flex min-h-[100dvh] items-center justify-center bg-background px-4",children:p.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:[p.jsx(hi,{className:"h-4 w-4 animate-spin"}),n("auth.loading")]})});if(k||!C)return null;const U=async z=>{z.preventDefault(),g(null),x(!0);try{await v(i,a),T(W,{replace:!0})}catch($){g($ instanceof Error?$.message:n("auth.loginFailed"))}finally{x(!1)}};return p.jsxs("div",{className:"relative min-h-[100dvh] overflow-hidden bg-background",children:[p.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%)]"}),p.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]"}),p.jsx("div",{className:"relative mx-auto flex min-h-[100dvh] max-w-6xl items-center px-4 py-8 sm:px-6",children:p.jsxs("div",{className:"grid w-full items-stretch gap-6 lg:grid-cols-[minmax(0,1.05fr)_minmax(360px,430px)]",children:[p.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:[p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[p.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:[p.jsx(Sd,{className:"h-3.5 w-3.5 text-accent"}),N]}),p.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:[p.jsxs(ht,{type:"button",variant:"ghost",size:"sm",className:q("rounded-full px-3 text-xs font-semibold",!e&&"bg-card text-foreground shadow-sm"),"aria-pressed":!e,onClick:()=>t("light"),children:[p.jsx(dP,{className:"h-3.5 w-3.5"}),n("auth.lightMode")]}),p.jsxs(ht,{type:"button",variant:"ghost",size:"sm",className:q("rounded-full px-3 text-xs font-semibold",e&&"bg-card text-foreground shadow-sm"),"aria-pressed":e,onClick:()=>t("dark"),children:[p.jsx(hP,{className:"h-3.5 w-3.5"}),n("auth.darkMode")]})]})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsx("h1",{className:"max-w-xl text-4xl font-semibold tracking-[-0.04em] text-balance text-foreground sm:text-5xl",children:n(L?"auth.remoteSetupTitle":"auth.dashboardTitle")}),p.jsx("p",{className:"max-w-2xl text-base leading-7 text-muted-foreground sm:text-lg",children:I})]})]}),p.jsxs("div",{className:"mt-8 grid gap-3 text-sm text-muted-foreground sm:grid-cols-3",children:[p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[p.jsx(nk,{className:"mb-3 h-4 w-4 text-accent"}),p.jsx("p",{children:n("auth.safetyNoteRemote")})]}),p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[p.jsx(ik,{className:"mb-3 h-4 w-4 text-accent"}),p.jsx("p",{children:n("auth.safetyNoteLocal")})]}),p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[p.jsx(Sd,{className:"mb-3 h-4 w-4 text-accent"}),p.jsx("p",{children:n("auth.safetyNoteSession")})]})]})]}),p.jsxs(M_,{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:[p.jsxs(N_,{className:"space-y-3 border-b border-border/70 px-6 py-6",children:[p.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl border border-accent/20 bg-accent/10",children:L?p.jsx(nk,{className:"h-5 w-5 text-accent"}):p.jsx(ik,{className:"h-5 w-5 text-accent"})}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(L_,{className:"text-2xl tracking-[-0.03em]",children:n(L?"auth.remoteSetupTitle":"auth.dashboardTitle")}),p.jsx(R_,{className:"text-sm leading-6 text-muted-foreground",children:L?I:n("auth.credentialsHint")})]})]}),p.jsx(E_,{className:"space-y-5 px-6 py-6",children:L?p.jsxs(p.Fragment,{children:[p.jsxs(lc,{variant:"warning",className:"rounded-2xl border-yellow-300/70 bg-yellow-50/80",children:[p.jsx(Cc,{className:"h-4 w-4"}),p.jsx(bh,{children:n("auth.noDefaultCredentials")}),p.jsx(cc,{children:n("auth.credentialsHint")})]}),p.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[p.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[p.jsx(ZE,{className:"h-4 w-4 text-accent"}),n("auth.hostStepTitle")]}),p.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:n("auth.hostStepDescription")}),p.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"}),p.jsx("p",{className:"mt-3 text-xs leading-5 text-muted-foreground",children:n("auth.dockerStepDescription")}),p.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"})]}),p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[p.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[p.jsx(Sd,{className:"h-4 w-4 text-accent"}),n("auth.localStepTitle")]}),p.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:n("auth.localStepDescription")})]})]})]}):p.jsxs("form",{onSubmit:U,className:"space-y-4",children:[f&&p.jsxs(lc,{variant:"destructive",className:"rounded-2xl",children:[p.jsx(Cc,{className:"h-4 w-4"}),p.jsx(cc,{children:f})]}),p.jsxs(lc,{variant:"info",className:"rounded-2xl border-blue-200/80 bg-blue-50/80",children:[p.jsx(Sd,{className:"h-4 w-4"}),p.jsx(bh,{children:n("auth.noDefaultCredentials")}),p.jsx(cc,{children:n("auth.credentialsHint")})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{htmlFor:"username",className:"text-sm font-semibold",children:n("auth.username")}),p.jsx(Hi,{id:"username",type:"text",value:i,onChange:z=>o(z.target.value),placeholder:n("auth.usernamePlaceholder"),autoComplete:"username",className:"h-12 rounded-2xl border-border/80 bg-background/85 px-4 text-base md:text-base",disabled:m,required:!0})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{htmlFor:"password",className:"text-sm font-semibold",children:n("auth.password")}),p.jsxs("div",{className:"relative",children:[p.jsx(Hi,{id:"password",type:c?"text":"password",value:a,onChange:z=>r(z.target.value),placeholder:n("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:m,required:!0}),p.jsx(ht,{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":n(c?"auth.hidePassword":"auth.showPassword"),"aria-pressed":c,onClick:()=>d(z=>!z),disabled:m,children:c?p.jsx(Vc,{className:"h-4 w-4"}):p.jsx(Wc,{className:"h-4 w-4"})})]})]}),p.jsx(ht,{type:"submit",className:"h-12 w-full rounded-2xl text-sm font-semibold",disabled:m,children:m?p.jsxs(p.Fragment,{children:[p.jsx(hi,{className:"mr-2 h-4 w-4 animate-spin"}),n("auth.signingIn")]}):n("auth.signIn")})]})})]})]})})]})}const x9=w.lazy(()=>rt(()=>import("./index-BBdOx52b.js"),__vite__mapDeps([24,1,2,4,5,25,6,7,9,8])).then(n=>({default:n.AnalyticsPage}))),v9=w.lazy(()=>rt(()=>import("./api-Bz4gk1bk.js"),__vite__mapDeps([26,1,2,5,27,19,6,4,3,7,8,9])).then(n=>({default:n.ApiPage}))),C9=w.lazy(()=>rt(()=>import("./cliproxy-DQizRbbC.js"),__vite__mapDeps([28,1,2,5,17,6,4,21,29,27,19,30,31,18,20,7,8,9])).then(n=>({default:n.CliproxyPage}))),S9=w.lazy(()=>rt(()=>import("./cliproxy-ai-providers-E8zkuN9-.js"),__vite__mapDeps([32,1,2,18,19,5,6,4,20,27,7,8,9])).then(n=>({default:n.CliproxyAiProvidersPage}))),k9=w.lazy(()=>rt(()=>import("./cliproxy-control-panel-CXij15eo.js"),__vite__mapDeps([33,1,2,5,17,4,6,7,8,9])).then(n=>({default:n.CliproxyControlPanelPage}))),w9=w.lazy(()=>rt(()=>import("./copilot-D0Z8CZJb.js"),__vite__mapDeps([34,1,2,5,27,19,4,30,31,6,7,8,9])).then(n=>({default:n.CopilotPage}))),A9=w.lazy(()=>rt(()=>import("./cursor-BXf4OXxE.js"),__vite__mapDeps([35,1,2,6,5,17,30,31,4,7,8,9])).then(n=>({default:n.CursorPage}))),P9=w.lazy(()=>rt(()=>import("./claude-extension-BFpic0ox.js"),__vite__mapDeps([36,1,2,5,6,4,7,8,9])).then(n=>({default:n.ClaudeExtensionPage}))),D9=w.lazy(()=>rt(()=>import("./codex-Clsf_Ll9.js"),__vite__mapDeps([37,1,2,6,38,5,4,20,30,39,7,8,9])).then(n=>({default:n.CodexPage}))),O9=w.lazy(()=>rt(()=>import("./droid-DUaaFFGf.js"),__vite__mapDeps([40,1,2,6,5,39,4,30,7,8,9])).then(n=>({default:n.DroidPage}))),T9=w.lazy(()=>rt(()=>import("./logs-dRi0gOyI.js"),__vite__mapDeps([41,1,2,4,5,6,7,8,9])).then(n=>({default:n.LogsPage}))),M9=w.lazy(()=>rt(()=>import("./accounts-BjBpKHAo.js"),__vite__mapDeps([42,1,2,5,38,19,25,6,4,29,7,8,9])).then(n=>({default:n.AccountsPage}))),N9=w.lazy(()=>rt(()=>Promise.resolve().then(()=>UK),void 0).then(n=>({default:n.SettingsPage}))),L9=w.lazy(()=>rt(()=>import("./health-qWLTnC0s.js"),__vite__mapDeps([43,1,2,5,6,4,11,7,8,9])).then(n=>({default:n.HealthPage}))),R9=w.lazy(()=>rt(()=>import("./shared-D1fHDQQG.js"),__vite__mapDeps([44,1,2,25,5,6,4,7,8,9])).then(n=>({default:n.SharedPage}))),E9=w.lazy(()=>rt(()=>import("./updates-BqVdDTJj.js"),__vite__mapDeps([45,1,2,4,5,6,7,8,9])).then(n=>({default:n.UpdatesPage}))),I9=null;function cn(){return p.jsx("div",{className:"flex h-64 items-center justify-center",children:p.jsx(hi,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function j9(){return p.jsx(yE,{client:Q2,children:p.jsx(FI,{defaultTheme:"system",storageKey:"vite-ui-theme",children:p.jsx(qI,{children:p.jsx(QI,{children:p.jsxs(fE,{children:[p.jsxs(pE,{children:[p.jsx(Et,{path:"/login",element:p.jsx(b9,{})}),p.jsx(Et,{element:p.jsx(YI,{}),children:p.jsxs(Et,{element:p.jsx(f5,{}),children:[p.jsx(Et,{path:"/",element:p.jsx(B3,{})}),p.jsx(Et,{path:"/analytics",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(x9,{})})}),p.jsx(Et,{path:"/updates",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(E9,{})})}),p.jsx(Et,{path:"/providers",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(v9,{})})}),p.jsx(Et,{path:"/cliproxy",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(C9,{})})}),p.jsx(Et,{path:"/cliproxy/ai-providers",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(S9,{})})}),p.jsx(Et,{path:"/cliproxy/control-panel",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(k9,{})})}),p.jsx(Et,{path:"/copilot",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(w9,{})})}),p.jsx(Et,{path:"/cursor",element:p.jsx(oP,{to:"/cliproxy?provider=cursor",replace:!0})}),p.jsx(Et,{path:"/legacy/cursor",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(A9,{})})}),p.jsx(Et,{path:"/claude-extension",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(P9,{})})}),p.jsx(Et,{path:"/codex",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(D9,{})})}),p.jsx(Et,{path:"/droid",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(O9,{})})}),p.jsx(Et,{path:"/accounts",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(M9,{})})}),p.jsx(Et,{path:"/settings",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(N9,{})})}),p.jsx(Et,{path:"/health",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(L9,{})})}),p.jsx(Et,{path:"/logs",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(T9,{})})}),p.jsx(Et,{path:"/shared",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(R9,{})})}),I9]})})]}),p.jsx(bE,{position:"top-right"})]})})})})})}const vN=document.getElementById("root");if(!vN)throw new Error("Root element not found. Failed to mount React application.");K2.createRoot(vN).render(p.jsx(w.StrictMode,{children:p.jsx(j9,{})}));export{UW as $,J3 as A,Qt as B,M_ as C,_W as D,F3 as E,Q3 as F,jW as G,HW as H,Hi as I,_3 as J,V3 as K,yn as L,Y3 as M,BW as N,Zj as O,ji as P,eB as Q,tB as R,tt as S,ga as T,OD as U,Xb as V,xh as W,gy as X,re as Y,zW as Z,Ue as _,xe as a,oW as a$,R_ as a0,qW as a1,GW as a2,KW as a3,VW as a4,WW as a5,QW as a6,ND as a7,YW as a8,B_ as a9,LW as aA,JW as aB,ZW as aC,XW as aD,CB as aE,AW as aF,Ek as aG,d_ as aH,$W as aI,Z3 as aJ,BD as aK,lH as aL,wH as aM,ZB as aN,e5 as aO,t5 as aP,n5 as aQ,Q5 as aR,QP as aS,cW as aT,uW as aU,dW as aV,hW as aW,sQ as aX,Y9 as aY,Jj as aZ,iW as a_,qb as aa,Gb as ab,V9 as ac,Wj as ad,$9 as ae,tW as af,aW as ag,rW as ah,Lb as ai,Rb as aj,Eb as ak,Ib as al,jb as am,eQ as an,__ as ao,tQ as ap,Sa as aq,OW as ar,Jl as as,TW as at,cy as au,lW as av,MW as aw,NW as ax,RW as ay,Ik as az,E_ as b,Qj as b0,Yj as b1,sW as b2,$j as b3,Xj as b4,nW as b5,Ub as b6,DW as b7,vW as b8,SW as b9,jK as bA,mW as bB,fW as bC,RB as bD,EB as bE,PW as bF,yW as bG,X9 as bH,J9 as bI,Z9 as bJ,eW as bK,pW as bL,gW as bM,xW as bN,bW as bO,wP as bP,DI as bQ,AI as bR,oy as bS,fa as bT,yI as bU,xI as bV,kI as bW,TI as bX,Jd as bY,kW as ba,CW as bb,XM as bc,Zb as bd,wW as be,Xl as bf,W9 as bg,Q9 as bh,lc as bi,bh as bj,cc as bk,uQ as bl,Yb as bm,kc as bn,$b as bo,T3 as bp,mj as bq,xj as br,vj as bs,Cj as bt,Sj as bu,E3 as bv,EW as bw,IW as bx,ZM as by,EK as bz,q as c,FW as d,ht as e,nQ as f,iQ as g,U_ as h,m9 as i,FP as j,zb as k,qP as l,Fb as m,rc as n,$i as o,Xi as p,Ji as q,K9 as r,N_ as s,L_ as t,wb as u,WP as v,X5 as w,Vr as x,oQ as y,sw as z};
|
|
56
|
+
`||n[m]==="\r");)m++;e.push({valueStart:m,key:g}),i='"',t=c+1;continue}i='"',t=r;continue}i=o,t++}return e}function yA(n,e){const t=new Zi,i=n.state.doc,o=i.toString();if(e==="json"){for(const{valueStart:c,key:d}of PK(o)){if(!gA(d)||c>=i.length)continue;const f=mA(i,c,"json",0),g=i.sliceString(c,f).replace(/\s+$/,"").length;g!==0&&t.add(c,c+g,Pe.mark({class:"cm-sensitive-mask"}))}return t.finish()}const a=new RegExp(kK[e].source,"gm");let r;for(;(r=a.exec(o))!==null;){const c=wK(r[2]),d=r[1].length;if(!gA(c))continue;const f=r.index+r[0].length;if(f>=i.length)continue;const g=mA(i,f,e,d),m=i.sliceString(f,g).replace(/\s+$/,"").length;m!==0&&t.add(f,f+m,Pe.mark({class:"cm-sensitive-mask"}))}return t.finish()}function DK(n){return At.fromClass(class{decorations;constructor(e){this.decorations=yA(e,n)}update(e){e.docChanged&&(this.decorations=yA(e.view,n))}},{decorations:e=>e.decorations})}const OK=QM({theme:"light",settings:{background:"transparent",foreground:"#393A34",caret:"#393A34",selection:"rgba(57, 58, 52, 0.18)",selectionMatch:"rgba(57, 58, 52, 0.12)",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"#999988"},styles:[{tag:[E.comment,E.lineComment,E.blockComment],color:"#999988",fontStyle:"italic"},{tag:[E.string,E.special(E.string),E.regexp],color:"#e3116c"},{tag:[E.number,E.bool,E.null,E.atom,E.variableName,E.propertyName,E.url],color:"#36acaa"},{tag:[E.keyword,E.attributeName,E.modifier,E.operatorKeyword],color:"#00a4db"},{tag:[E.function(E.variableName),E.labelName],color:"#6f42c1"},{tag:[E.tagName,E.heading],color:"#00009f",fontWeight:"bold"},{tag:[E.deleted,E.invalid],color:"#d73a49"},{tag:[E.punctuation,E.operator,E.bracket,E.brace,E.separator],color:"#393A34"}]}),TK=QM({theme:"dark",settings:{background:"transparent",foreground:"#d6deeb",caret:"#80a4c2",selection:"rgba(29, 59, 83, 0.99)",selectionMatch:"rgba(35, 77, 112, 0.6)",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"#4b6479"},styles:[{tag:[E.comment,E.lineComment,E.blockComment],color:"#637777",fontStyle:"italic"},{tag:[E.string,E.special(E.string),E.url],color:"rgb(173, 219, 103)"},{tag:E.number,color:"rgb(247, 140, 108)"},{tag:[E.bool,E.null,E.atom],color:"rgb(255, 88, 116)"},{tag:[E.keyword,E.modifier,E.operatorKeyword],color:"rgb(127, 219, 202)"},{tag:[E.propertyName,E.attributeName],color:"rgb(128, 203, 196)"},{tag:[E.variableName,E.labelName],color:"rgb(214, 222, 235)"},{tag:E.function(E.variableName),color:"rgb(130, 170, 255)"},{tag:[E.tagName,E.heading],color:"rgb(127, 219, 202)"},{tag:[E.bracket,E.punctuation,E.operator,E.brace,E.separator],color:"rgb(199, 146, 234)"},{tag:[E.className,E.special(E.string)],color:"rgb(255, 203, 139)"},{tag:[E.deleted,E.invalid],color:"rgba(239, 83, 80, 0.56)"}]}),MK=ue.baseTheme({".cm-sensitive-mask":{filter:"blur(3px)",opacity:"0.7",transition:"filter 200ms ease, opacity 200ms ease"},".cm-sensitive-revealed .cm-sensitive-mask":{filter:"none",opacity:"1"}});function XM({value:n,onChange:e,language:t="json",readonly:i=!1,exactText:o=!1,className:a,minHeight:r="300px",heightMode:c="content"}){const{isDark:d}=Nb(),{t:f}=xe(),[g,m]=w.useState(!1),[x,v]=w.useState(!0),C=c==="fill-parent",k=w.useMemo(()=>t==="json"?CK(n):t==="toml"?SK(n):{valid:!0},[n,t]),A=w.useMemo(()=>[t==="json"?D8():t==="yaml"?iK():Lx.define(oK),ue.lineWrapping,MK,DK(t),ue.theme({"&":{fontSize:"0.875rem",backgroundColor:"transparent"},"&.cm-focused":{outline:"none"},".cm-content":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",padding:"12px 0",caretColor:"currentColor"},".cm-line":{padding:"0 12px",lineHeight:"1.625"},".cm-scroller":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",lineHeight:"1.625"},".cm-gutters":{display:"none"}})],[t]);return p.jsxs("div",{className:q("flex min-h-0 flex-col",C&&"h-full",a),style:C?{height:r==="auto"?void 0:r}:void 0,"data-slot":"code-editor-root",children:[p.jsxs("div",{className:q("relative rounded-md border overflow-hidden bg-muted/30",C&&"flex min-h-0 flex-1 flex-col",g&&"ring-2 ring-ring ring-offset-2 ring-offset-background",i&&"opacity-70",!k.valid&&"border-destructive"),"data-slot":"code-editor-surface",children:[p.jsx("div",{className:q(C?"scrollbar-editor min-h-0 flex-1 overflow-hidden":void 0),"data-slot":C?"code-editor-viewport":void 0,children:p.jsx(UM,{value:n,onChange:i?void 0:e,readOnly:i,editable:!i,theme:d?TK:OK,extensions:A,height:C?"100%":void 0,minHeight:C?void 0:r,basicSetup:{lineNumbers:!1,foldGutter:!1,highlightActiveLine:!1,highlightActiveLineGutter:!1,autocompletion:!1,searchKeymap:!0},onFocus:()=>m(!0),onBlur:()=>m(!1),className:q("cm-editor-root",!x&&"cm-sensitive-revealed",C&&"h-full"),"data-slot":"code-editor-codemirror"})}),p.jsx("div",{className:"absolute top-2 right-2 z-20 opacity-50 hover:opacity-100 transition-opacity",children:p.jsx(ht,{variant:"ghost",size:"icon",className:"h-6 w-6 bg-background/50 hover:bg-background border shadow-sm rounded-full",onClick:()=>v(!x),title:f(x?"codeEditor.revealSensitive":"codeEditor.maskSensitive"),children:x?p.jsx(Wc,{className:"h-3 w-3"}):p.jsx(Vc,{className:"h-3 w-3"})})})]}),p.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs",children:[k.valid?p.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[p.jsx(Qc,{className:"w-3 h-3 text-green-500"}),f("codeEditor.valid",{language:t.toUpperCase()})]}):p.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[p.jsx(Cc,{className:"w-3 h-3"}),k.error,k.line&&` (line ${k.line})`]}),i&&p.jsx("span",{className:"ml-auto text-muted-foreground",children:f("codeEditor.readOnly")})]})]})}const Nf=Object.freeze(Object.defineProperty({__proto__:null,CodeEditor:XM},Symbol.toStringTag,{value:"Module"})),NK={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 LK(n,e){switch(e.type){case"SET_BROWSER_CONFIG":return{...n,browserConfig:e.payload};case"SET_BROWSER_STATUS":return{...n,browserStatus:e.payload};case"SET_BROWSER_LOADING":return{...n,browserLoading:e.payload};case"SET_BROWSER_STATUS_LOADING":return{...n,browserStatusLoading:e.payload};case"SET_BROWSER_SAVING":return{...n,browserSaving:e.payload};case"SET_BROWSER_ERROR":return{...n,browserError:e.payload};case"SET_BROWSER_SUCCESS":return{...n,browserSuccess:e.payload};case"SET_WEBSEARCH_CONFIG":return{...n,webSearchConfig:e.payload};case"SET_WEBSEARCH_STATUS":return{...n,webSearchStatus:e.payload};case"SET_WEBSEARCH_LOADING":return{...n,webSearchLoading:e.payload};case"SET_WEBSEARCH_STATUS_LOADING":return{...n,webSearchStatusLoading:e.payload};case"SET_WEBSEARCH_SAVING":return{...n,webSearchSaving:e.payload};case"SET_WEBSEARCH_ERROR":return{...n,webSearchError:e.payload};case"SET_WEBSEARCH_SUCCESS":return{...n,webSearchSuccess:e.payload};case"SET_GLOBALENV_CONFIG":return{...n,globalEnvConfig:e.payload};case"SET_GLOBALENV_LOADING":return{...n,globalEnvLoading:e.payload};case"SET_GLOBALENV_SAVING":return{...n,globalEnvSaving:e.payload};case"SET_GLOBALENV_ERROR":return{...n,globalEnvError:e.payload};case"SET_GLOBALENV_SUCCESS":return{...n,globalEnvSuccess:e.payload};case"SET_PROXY_CONFIG":return{...n,proxyConfig:e.payload};case"SET_PROXY_LOADING":return{...n,proxyLoading:e.payload};case"SET_PROXY_SAVING":return{...n,proxySaving:e.payload};case"SET_PROXY_ERROR":return{...n,proxyError:e.payload};case"SET_PROXY_SUCCESS":return{...n,proxySuccess:e.payload};case"SET_PROXY_TEST_RESULT":return{...n,proxyTestResult:e.payload};case"SET_PROXY_TESTING":return{...n,proxyTesting:e.payload};case"SET_RAW_CONFIG":return{...n,rawConfig:e.payload};case"SET_RAW_CONFIG_LOADING":return{...n,rawConfigLoading:e.payload};default:return n}}const JM=w.createContext(null);function RK({children:n}){const[e,t]=w.useReducer(LK,NK);return p.jsx(JM.Provider,{value:{state:e,dispatch:t},children:n})}function ZM(){const n=w.useContext(JM);if(!n)throw new Error("useSettingsContext must be used within a SettingsProvider");return n}function EK(){const{dispatch:n}=ZM(),e=w.useCallback(B=>n({type:"SET_BROWSER_CONFIG",payload:B}),[n]),t=w.useCallback(B=>n({type:"SET_BROWSER_STATUS",payload:B}),[n]),i=w.useCallback(B=>n({type:"SET_BROWSER_LOADING",payload:B}),[n]),o=w.useCallback(B=>n({type:"SET_BROWSER_STATUS_LOADING",payload:B}),[n]),a=w.useCallback(B=>n({type:"SET_BROWSER_SAVING",payload:B}),[n]),r=w.useCallback(B=>n({type:"SET_BROWSER_ERROR",payload:B}),[n]),c=w.useCallback(B=>n({type:"SET_BROWSER_SUCCESS",payload:B}),[n]),d=w.useCallback(B=>n({type:"SET_WEBSEARCH_CONFIG",payload:B}),[n]),f=w.useCallback(B=>n({type:"SET_WEBSEARCH_STATUS",payload:B}),[n]),g=w.useCallback(B=>n({type:"SET_WEBSEARCH_LOADING",payload:B}),[n]),m=w.useCallback(B=>n({type:"SET_WEBSEARCH_STATUS_LOADING",payload:B}),[n]),x=w.useCallback(B=>n({type:"SET_WEBSEARCH_SAVING",payload:B}),[n]),v=w.useCallback(B=>n({type:"SET_WEBSEARCH_ERROR",payload:B}),[n]),C=w.useCallback(B=>n({type:"SET_WEBSEARCH_SUCCESS",payload:B}),[n]),k=w.useCallback(B=>n({type:"SET_GLOBALENV_CONFIG",payload:B}),[n]),A=w.useCallback(B=>n({type:"SET_GLOBALENV_LOADING",payload:B}),[n]),D=w.useCallback(B=>n({type:"SET_GLOBALENV_SAVING",payload:B}),[n]),O=w.useCallback(B=>n({type:"SET_GLOBALENV_ERROR",payload:B}),[n]),T=w.useCallback(B=>n({type:"SET_GLOBALENV_SUCCESS",payload:B}),[n]),M=w.useCallback(B=>n({type:"SET_PROXY_CONFIG",payload:B}),[n]),L=w.useCallback(B=>n({type:"SET_PROXY_LOADING",payload:B}),[n]),N=w.useCallback(B=>n({type:"SET_PROXY_SAVING",payload:B}),[n]),I=w.useCallback(B=>n({type:"SET_PROXY_ERROR",payload:B}),[n]),W=w.useCallback(B=>n({type:"SET_PROXY_SUCCESS",payload:B}),[n]),U=w.useCallback(B=>n({type:"SET_PROXY_TEST_RESULT",payload:B}),[n]),z=w.useCallback(B=>n({type:"SET_PROXY_TESTING",payload:B}),[n]),$=w.useCallback(B=>n({type:"SET_RAW_CONFIG",payload:B}),[n]),F=w.useCallback(B=>n({type:"SET_RAW_CONFIG_LOADING",payload:B}),[n]);return w.useMemo(()=>({setBrowserConfig:e,setBrowserStatus:t,setBrowserLoading:i,setBrowserStatusLoading:o,setBrowserSaving:a,setBrowserError:r,setBrowserSuccess:c,setWebSearchConfig:d,setWebSearchStatus:f,setWebSearchLoading:g,setWebSearchStatusLoading:m,setWebSearchSaving:x,setWebSearchError:v,setWebSearchSuccess:C,setGlobalEnvConfig:k,setGlobalEnvLoading:A,setGlobalEnvSaving:D,setGlobalEnvError:O,setGlobalEnvSuccess:T,setProxyConfig:M,setProxyLoading:L,setProxySaving:N,setProxyError:I,setProxySuccess:W,setProxyTestResult:U,setProxyTesting:z,setRawConfig:$,setRawConfigLoading:F}),[e,t,i,o,a,r,c,d,f,g,m,x,v,C,k,A,D,O,T,M,L,N,I,W,U,z,$,F])}function IK(){const[n,e]=sP(),t=n.get("tab")?.toLowerCase(),i=t==="imageanalysis"||t==="image"?"image":t==="channels"?"channels":t==="globalenv"?"globalenv":t==="proxy"?"proxy":t==="auth"?"auth":t==="thinking"?"thinking":t==="backups"?"backups":"websearch",o=w.useCallback(a=>{e({tab:a},{replace:!0})},[e]);return{activeTab:i,setActiveTab:o}}function jK(){const{state:n}=ZM(),e=EK(),[t,i]=w.useState(!1),o=w.useCallback(async()=>{try{e.setRawConfigLoading(!0);const r=await fetch("/api/config/raw");if(!r.ok){e.setRawConfig(null);return}const c=await r.text();e.setRawConfig(c)}catch{e.setRawConfig(null)}finally{e.setRawConfigLoading(!1)}},[e]),a=w.useCallback(async()=>{if(n.rawConfig)try{await navigator.clipboard.writeText(n.rawConfig),i(!0),setTimeout(()=>i(!1),2e3)}catch{}},[n.rawConfig]);return{rawConfig:n.rawConfig,loading:n.rawConfigLoading,copied:t,fetchRawConfig:o,copyToClipboard:a}}function bA({activeTab:n,onTabChange:e}){const{t}=xe(),i=[{value:"browser",label:t("settingsTabs.browser"),icon:WE},{value:"websearch",label:t("settingsTabs.web"),icon:gP},{value:"image",label:t("settingsTabs.image"),icon:bP},{value:"channels",label:t("settingsTabs.channels"),icon:QE},{value:"globalenv",label:t("settingsTabs.env"),icon:Sb},{value:"thinking",label:t("settingsTabs.think"),icon:YE},{value:"proxy",label:t("settingsTabs.proxy"),icon:$E},{value:"auth",label:t("settingsTabs.auth"),icon:xb},{value:"backups",label:t("settingsTabs.backup"),icon:XE}];return p.jsx(OD,{value:n,onValueChange:o=>e(o),children:p.jsx(Xb,{className:"grid w-full grid-cols-9",children:i.map(({value:o,label:a,icon:r})=>p.jsxs(xh,{value:o,className:"gap-1.5 px-2 text-xs",children:[p.jsx(r,{className:"h-3.5 w-3.5 shrink-0"}),p.jsx("span",{className:"truncate",children:a})]},o))})})}function xA(){return p.jsxs("div",{className:"flex-1 p-5 space-y-6",children:[p.jsx(tt,{className:"h-4 w-2/3"}),p.jsx("div",{className:"p-4 rounded-lg border",children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx(tt,{className:"h-5 w-32"}),p.jsx(tt,{className:"h-4 w-48"})]}),p.jsx(tt,{className:"h-6 w-10 rounded-full"})]})}),p.jsxs("div",{className:"space-y-3",children:[p.jsx(tt,{className:"h-5 w-24"}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(tt,{className:"h-20 w-full rounded-lg"}),p.jsx(tt,{className:"h-20 w-full rounded-lg"}),p.jsx(tt,{className:"h-20 w-full rounded-lg"})]})]})]})}function eN(n,e=3,t=1e3){return n().catch(i=>{if(e<=0)throw i;return new Promise(o=>setTimeout(o,t)).then(()=>eN(n,e-1,t*2))})}function Bo(n){return w.lazy(()=>eN(n))}const vA=Bo(()=>rt(()=>import("./index-D77S3tlM.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),CA=Bo(()=>rt(()=>import("./index-Bf5DDwJP.js"),__vite__mapDeps([10,1,2,11,4,5,6,7,8,9]))),SA=Bo(()=>rt(()=>import("./index-BTJNmedC.js"),__vite__mapDeps([12,1,2,4,5,6,7,8,9]))),kA=Bo(()=>rt(()=>import("./channels-C8lOwrre.js"),__vite__mapDeps([13,1,2,4,5,6,7,8,9]))),wA=Bo(()=>rt(()=>import("./globalenv-section-Cro0fjBM.js"),__vite__mapDeps([14,1,2,4,5,6,7,8,9]))),AA=Bo(()=>rt(()=>import("./index-DLRoa85N.js"),__vite__mapDeps([15,1,2,4,5,6,7,8,9]))),PA=Bo(()=>rt(()=>import("./index-Bf0--BiU.js"),__vite__mapDeps([16,1,2,17,4,18,19,5,6,20,21,7,8,9]))),DA=Bo(()=>rt(()=>import("./auth-section-BNu9bqxZ.js"),__vite__mapDeps([22,1,2,4,5,6,7,8,9]))),OA=Bo(()=>rt(()=>import("./backups-section-QEZ5MeIb.js"),__vite__mapDeps([23,1,2,19,4,5,6,7,8,9])));class TA extends w.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){return this.state.hasError?p.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:p.jsxs("div",{className:"text-center p-6 max-w-md",children:[p.jsx(Cc,{className:"w-12 h-12 mx-auto mb-4 text-destructive"}),p.jsx("p",{className:"font-medium text-foreground mb-2",children:re.t("settings.sectionLoadFailed")}),p.jsx("p",{className:"text-sm mb-4",children:this.state.error?.message||re.t("settings.unknownError")}),p.jsxs(ht,{variant:"outline",onClick:()=>window.location.reload(),className:"inline-flex items-center gap-2",children:[p.jsx(vc,{className:"w-4 h-4"}),re.t("settings.reloadPage")]})]})}):this.props.children}}function BK(n){switch(n?.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 HK(){const{t:n}=xe(),{setActiveTab:e}=IK(),[t]=sP(),i=BK(t.get("tab")),{rawConfig:o,loading:a,copied:r,fetchRawConfig:c,copyToClipboard:d}=jK();w.useEffect(()=>{c()},[c]);const f=g=>{w.startTransition(()=>{e(g)})};return p.jsxs("div",{className:"h-full min-h-0",children:[p.jsxs("div",{className:"md:hidden h-full flex flex-col",children:[p.jsx("div",{className:"border-b bg-background p-4",children:p.jsx(bA,{activeTab:i,onTabChange:f})}),p.jsx(TA,{children:p.jsxs(w.Suspense,{fallback:p.jsx(xA,{}),children:[i==="browser"&&p.jsx(CA,{}),i==="websearch"&&p.jsx(vA,{}),i==="image"&&p.jsx(SA,{}),i==="channels"&&p.jsx(kA,{}),i==="globalenv"&&p.jsx(wA,{}),i==="thinking"&&p.jsx(AA,{}),i==="proxy"&&p.jsx(PA,{}),i==="auth"&&p.jsx(DA,{}),i==="backups"&&p.jsx(OA,{})]})})]}),p.jsxs(Yb,{direction:"horizontal",className:"h-full hidden md:flex",children:[p.jsx(kc,{defaultSize:46,minSize:36,maxSize:62,children:p.jsxs("div",{className:"h-full border-r flex flex-col bg-muted/30 relative",children:[p.jsx("div",{className:"p-5 border-b bg-background",children:p.jsx(bA,{activeTab:i,onTabChange:f})}),p.jsx(TA,{children:p.jsxs(w.Suspense,{fallback:p.jsx(xA,{}),children:[i==="browser"&&p.jsx(CA,{}),i==="websearch"&&p.jsx(vA,{}),i==="image"&&p.jsx(SA,{}),i==="channels"&&p.jsx(kA,{}),i==="globalenv"&&p.jsx(wA,{}),i==="thinking"&&p.jsx(AA,{}),i==="proxy"&&p.jsx(PA,{}),i==="auth"&&p.jsx(DA,{}),i==="backups"&&p.jsx(OA,{})]})})]})}),p.jsx($b,{className:"w-2 bg-border hover:bg-primary/20 transition-colors cursor-col-resize flex items-center justify-center group",children:p.jsx(Yh,{className:"w-3 h-3 text-muted-foreground group-hover:text-primary"})}),p.jsx(kc,{defaultSize:54,minSize:35,children:p.jsxs("div",{className:"h-full flex flex-col",children:[p.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(tk,{className:"w-5 h-5 text-primary"}),p.jsxs("div",{children:[p.jsx("h2",{className:"font-semibold",children:"config.yaml"}),p.jsx("p",{className:"text-sm text-muted-foreground",children:"~/.ccs/config.yaml"})]})]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx(ht,{variant:"outline",size:"sm",onClick:d,disabled:!o,children:r?p.jsxs(p.Fragment,{children:[p.jsx(Rr,{className:"w-4 h-4 mr-1"}),n("settings.copied")]}):p.jsxs(p.Fragment,{children:[p.jsx(hh,{className:"w-4 h-4 mr-1"}),n("settings.copy")]})}),p.jsx(ht,{variant:"outline",size:"sm",onClick:c,disabled:a,children:p.jsx(vc,{className:`w-4 h-4 ${a?"animate-spin":""}`})})]})]}),p.jsx("div",{className:"flex-1 overflow-auto",children:o?p.jsx(XM,{value:o,onChange:()=>{},language:"yaml",readonly:!0,minHeight:"auto",className:"min-h-full"}):a?p.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:[p.jsx(vc,{className:"w-5 h-5 animate-spin mr-2"}),n("settings.loading")]}):p.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:p.jsxs("div",{className:"text-center",children:[p.jsx(tk,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),p.jsx("p",{children:n("settings.configFileNotFound")}),p.jsx("code",{className:"text-sm bg-muted px-2 py-1 rounded mt-2 inline-block",children:"ccs migrate"})]})})})]})})]})]})}function _K(){return p.jsx(RK,{children:p.jsx(HK,{})})}const UK=Object.freeze(Object.defineProperty({__proto__:null,SettingsPage:_K},Symbol.toStringTag,{value:"Module"}));function zK(n,e,t="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:n,timeZoneName:t}).format(e).split(/\s/g).slice(2).join(" ")}const FK={},oc={};function la(n,e){try{const i=(FK[n]||=new Intl.DateTimeFormat("en-US",{timeZone:n,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return i in oc?oc[i]:MA(i,i.split(":"))}catch{if(n in oc)return oc[n];const t=n?.match(qK);return t?MA(n,t.slice(1)):NaN}}const qK=/([+-]\d\d):?(\d\d)?/;function MA(n,e){const t=+(e[0]||0),i=+(e[1]||0),o=+(e[2]||0)/60;return oc[n]=t*60+i>0?t*60+i+o:t*60-i-o}class Wi extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(la(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),tN(this),yb(this)):this.setTime(Date.now())}static tz(e,...t){return t.length?new Wi(...t,e):new Wi(Date.now(),e)}withTimeZone(e){return new Wi(+this,e)}getTimezoneOffset(){const e=-la(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),yb(this),+this}[Symbol.for("constructDateFrom")](e){return new Wi(+new Date(e),this.timeZone)}}const NA=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(n=>{if(!NA.test(n))return;const e=n.replace(NA,"$1UTC");Wi.prototype[e]&&(n.startsWith("get")?Wi.prototype[n]=function(){return this.internal[e]()}:(Wi.prototype[n]=function(){return Date.prototype[e].apply(this.internal,arguments),GK(this),+this},Wi.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),yb(this),+this}))});function yb(n){n.internal.setTime(+n),n.internal.setUTCSeconds(n.internal.getUTCSeconds()-Math.round(-la(n.timeZone,n)*60))}function GK(n){Date.prototype.setFullYear.call(n,n.internal.getUTCFullYear(),n.internal.getUTCMonth(),n.internal.getUTCDate()),Date.prototype.setHours.call(n,n.internal.getUTCHours(),n.internal.getUTCMinutes(),n.internal.getUTCSeconds(),n.internal.getUTCMilliseconds()),tN(n)}function tN(n){const e=la(n.timeZone,n),t=e>0?Math.floor(e):Math.ceil(e),i=new Date(+n);i.setUTCHours(i.getUTCHours()-1);const o=-new Date(+n).getTimezoneOffset(),a=-new Date(+i).getTimezoneOffset(),r=o-a,c=Date.prototype.getHours.apply(n)!==n.internal.getUTCHours();r&&c&&n.internal.setUTCMinutes(n.internal.getUTCMinutes()+r);const d=o-t;d&&Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+d);const f=new Date(+n);f.setUTCSeconds(0);const g=o>0?f.getSeconds():(f.getSeconds()-60)%60,m=Math.round(-(la(n.timeZone,n)*60))%60;(m||g)&&(n.internal.setUTCSeconds(n.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(n,Date.prototype.getUTCSeconds.call(n)+m+g));const x=la(n.timeZone,n),v=x>0?Math.floor(x):Math.ceil(x),k=-new Date(+n).getTimezoneOffset()-v,A=v!==t,D=k-d;if(A&&D){Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+D);const O=la(n.timeZone,n),T=O>0?Math.floor(O):Math.ceil(O),M=v-T;M&&(n.internal.setUTCMinutes(n.internal.getUTCMinutes()+M),Date.prototype.setUTCMinutes.call(n,Date.prototype.getUTCMinutes.call(n)+M))}}class Oo extends Wi{static tz(e,...t){return t.length?new Oo(...t,e):new Oo(Date.now(),e)}toISOString(){const[e,t,i]=this.tzComponents(),o=`${e}${t}:${i}`;return this.internal.toISOString().slice(0,-1)+o}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,t,i,o]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${i} ${t} ${o}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[t,i,o]=this.tzComponents();return`${e} GMT${t}${i}${o} (${zK(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),t=e>0?"-":"+",i=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),o=String(Math.abs(e)%60).padStart(2,"0");return[t,i,o]}withTimeZone(e){return new Oo(+this,e)}[Symbol.for("constructDateFrom")](e){return new Oo(+new Date(e),this.timeZone)}}const LA=5,KK=4;function VK(n,e){const t=e.startOfMonth(n),i=t.getDay()>0?t.getDay():7,o=e.addDays(n,-i+1),a=e.addDays(o,LA*7-1);return e.getMonth(n)===e.getMonth(a)?LA:KK}function nN(n,e){const t=e.startOfMonth(n),i=t.getDay();return i===1?t:i===0?e.addDays(t,-6):e.addDays(t,-1*(i-1))}function WK(n,e){const t=nN(n,e),i=VK(n,e);return e.addDays(t,i*7-1)}const iN={...zl,labels:{labelDayButton:(n,e,t,i)=>{let o;i&&typeof i.format=="function"?o=i.format.bind(i):o=(r,c)=>$l(r,c,{locale:zl,...t});let a=o(n,"PPPP");return e.today&&(a=`Today, ${a}`),e.selected&&(a=`${a}, selected`),a},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:n=>`Week ${n}`,labelYearDropdown:"Choose the Year",labelGrid:(n,e,t)=>{let i;return t&&typeof t.format=="function"?i=t.format.bind(t):i=(o,a)=>$l(o,a,{locale:zl,...e}),i(n,"LLLL yyyy")},labelGridcell:(n,e,t,i)=>{let o;i&&typeof i.format=="function"?o=i.format.bind(i):o=(r,c)=>$l(r,c,{locale:zl,...t});let a=o(n,"PPPP");return e?.today&&(a=`Today, ${a}`),a},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(n,e,t)=>{let i;return t&&typeof t.format=="function"?i=t.format.bind(t):i=(o,a)=>$l(o,a,{locale:zl,...e}),i(n,"cccc")}}};class $n{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Oo.tz(this.options.timeZone):new this.Date,this.newDate=(i,o,a)=>this.overrides?.newDate?this.overrides.newDate(i,o,a):this.options.timeZone?new Oo(i,o,a,this.options.timeZone):new Date(i,o,a),this.addDays=(i,o)=>this.overrides?.addDays?this.overrides.addDays(i,o):n2(i,o),this.addMonths=(i,o)=>this.overrides?.addMonths?this.overrides.addMonths(i,o):i2(i,o),this.addWeeks=(i,o)=>this.overrides?.addWeeks?this.overrides.addWeeks(i,o):o2(i,o),this.addYears=(i,o)=>this.overrides?.addYears?this.overrides.addYears(i,o):s2(i,o),this.differenceInCalendarDays=(i,o)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(i,o):a2(i,o),this.differenceInCalendarMonths=(i,o)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(i,o):r2(i,o),this.eachMonthOfInterval=i=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(i):l2(i),this.eachYearOfInterval=i=>{const o=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(i):c2(i),a=new Set(o.map(c=>this.getYear(c)));if(a.size===o.length)return o;const r=[];return a.forEach(c=>{r.push(new Date(c,0,1))}),r},this.endOfBroadcastWeek=i=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(i):WK(i,this),this.endOfISOWeek=i=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(i):u2(i),this.endOfMonth=i=>this.overrides?.endOfMonth?this.overrides.endOfMonth(i):d2(i),this.endOfWeek=(i,o)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(i,o):h2(i,this.options),this.endOfYear=i=>this.overrides?.endOfYear?this.overrides.endOfYear(i):f2(i),this.format=(i,o,a)=>{const r=this.overrides?.format?this.overrides.format(i,o,this.options):$l(i,o,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(r):r},this.getISOWeek=i=>this.overrides?.getISOWeek?this.overrides.getISOWeek(i):p2(i),this.getMonth=(i,o)=>this.overrides?.getMonth?this.overrides.getMonth(i,this.options):g2(i,this.options),this.getYear=(i,o)=>this.overrides?.getYear?this.overrides.getYear(i,this.options):m2(i,this.options),this.getWeek=(i,o)=>this.overrides?.getWeek?this.overrides.getWeek(i,this.options):y2(i,this.options),this.isAfter=(i,o)=>this.overrides?.isAfter?this.overrides.isAfter(i,o):b2(i,o),this.isBefore=(i,o)=>this.overrides?.isBefore?this.overrides.isBefore(i,o):x2(i,o),this.isDate=i=>this.overrides?.isDate?this.overrides.isDate(i):v2(i),this.isSameDay=(i,o)=>this.overrides?.isSameDay?this.overrides.isSameDay(i,o):C2(i,o),this.isSameMonth=(i,o)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(i,o):S2(i,o),this.isSameYear=(i,o)=>this.overrides?.isSameYear?this.overrides.isSameYear(i,o):k2(i,o),this.max=i=>this.overrides?.max?this.overrides.max(i):w2(i),this.min=i=>this.overrides?.min?this.overrides.min(i):A2(i),this.setMonth=(i,o)=>this.overrides?.setMonth?this.overrides.setMonth(i,o):P2(i,o),this.setYear=(i,o)=>this.overrides?.setYear?this.overrides.setYear(i,o):D2(i,o),this.startOfBroadcastWeek=(i,o)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(i,this):nN(i,this),this.startOfDay=i=>this.overrides?.startOfDay?this.overrides.startOfDay(i):O2(i),this.startOfISOWeek=i=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(i):T2(i),this.startOfMonth=i=>this.overrides?.startOfMonth?this.overrides.startOfMonth(i):M2(i),this.startOfWeek=(i,o)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(i,this.options):N2(i,this.options),this.startOfYear=i=>this.overrides?.startOfYear?this.overrides.startOfYear(i):L2(i),this.options={locale:iN,...e},this.overrides=t}getDigitMap(){const{numerals:e="latn"}=this.options,t=new Intl.NumberFormat("en-US",{numberingSystem:e}),i={};for(let o=0;o<10;o++)i[o.toString()]=t.format(o);return i}replaceDigits(e){const t=this.getDigitMap();return e.replace(/\d/g,i=>t[i]||i)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&$n.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:t,timeZone:i,numerals:o}=this.options,a=t?.code;if(a&&$n.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:"long",year:"numeric",timeZone:i,numberingSystem:o}).format(e)}catch{}const r=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,r)}}$n.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 io=new $n;class oN{constructor(e,t,i=io){this.date=e,this.displayMonth=t,this.outside=!!(t&&!i.isSameMonth(e,t)),this.dateLib=i,this.isoDate=i.format(e,"yyyy-MM-dd"),this.displayMonthId=i.format(t,"yyyy-MM"),this.dateMonthId=i.format(e,"yyyy-MM")}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class QK{constructor(e,t){this.date=e,this.weeks=t}}class YK{constructor(e,t){this.days=t,this.weekNumber=e}}function $K(n){return me.createElement("button",{...n})}function XK(n){return me.createElement("span",{...n})}function JK(n){const{size:e=24,orientation:t="left",className:i}=n;return me.createElement("svg",{className:i,width:e,height:e,viewBox:"0 0 24 24"},t==="up"&&me.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),t==="down"&&me.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),t==="left"&&me.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),t==="right"&&me.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function ZK(n){const{day:e,modifiers:t,...i}=n;return me.createElement("td",{...i})}function eV(n){const{day:e,modifiers:t,...i}=n,o=me.useRef(null);return me.useEffect(()=>{t.focused&&o.current?.focus()},[t.focused]),me.createElement("button",{ref:o,...i})}var we;(function(n){n.Root="root",n.Chevron="chevron",n.Day="day",n.DayButton="day_button",n.CaptionLabel="caption_label",n.Dropdowns="dropdowns",n.Dropdown="dropdown",n.DropdownRoot="dropdown_root",n.Footer="footer",n.MonthGrid="month_grid",n.MonthCaption="month_caption",n.MonthsDropdown="months_dropdown",n.Month="month",n.Months="months",n.Nav="nav",n.NextMonthButton="button_next",n.PreviousMonthButton="button_previous",n.Week="week",n.Weeks="weeks",n.Weekday="weekday",n.Weekdays="weekdays",n.WeekNumber="week_number",n.WeekNumberHeader="week_number_header",n.YearsDropdown="years_dropdown"})(we||(we={}));var wt;(function(n){n.disabled="disabled",n.hidden="hidden",n.outside="outside",n.focused="focused",n.today="today"})(wt||(wt={}));var Si;(function(n){n.range_end="range_end",n.range_middle="range_middle",n.range_start="range_start",n.selected="selected"})(Si||(Si={}));var Qn;(function(n){n.weeks_before_enter="weeks_before_enter",n.weeks_before_exit="weeks_before_exit",n.weeks_after_enter="weeks_after_enter",n.weeks_after_exit="weeks_after_exit",n.caption_after_enter="caption_after_enter",n.caption_after_exit="caption_after_exit",n.caption_before_enter="caption_before_enter",n.caption_before_exit="caption_before_exit"})(Qn||(Qn={}));function tV(n){const{options:e,className:t,components:i,classNames:o,...a}=n,r=[o[we.Dropdown],t].join(" "),c=e?.find(({value:d})=>d===a.value);return me.createElement("span",{"data-disabled":a.disabled,className:o[we.DropdownRoot]},me.createElement(i.Select,{className:r,...a},e?.map(({value:d,label:f,disabled:g})=>me.createElement(i.Option,{key:d,value:d,disabled:g},f))),me.createElement("span",{className:o[we.CaptionLabel],"aria-hidden":!0},c?.label,me.createElement(i.Chevron,{orientation:"down",size:18,className:o[we.Chevron]})))}function nV(n){return me.createElement("div",{...n})}function iV(n){return me.createElement("div",{...n})}function oV(n){const{calendarMonth:e,displayIndex:t,...i}=n;return me.createElement("div",{...i},n.children)}function sV(n){const{calendarMonth:e,displayIndex:t,...i}=n;return me.createElement("div",{...i})}function aV(n){return me.createElement("table",{...n})}function rV(n){return me.createElement("div",{...n})}const sN=w.createContext(void 0);function iu(){const n=w.useContext(sN);if(n===void 0)throw new Error("useDayPicker() must be used within a custom component.");return n}function lV(n){const{components:e}=iu();return me.createElement(e.Dropdown,{...n})}function cV(n){const{onPreviousClick:e,onNextClick:t,previousMonth:i,nextMonth:o,...a}=n,{components:r,classNames:c,labels:{labelPrevious:d,labelNext:f}}=iu(),g=w.useCallback(x=>{o&&t?.(x)},[o,t]),m=w.useCallback(x=>{i&&e?.(x)},[i,e]);return me.createElement("nav",{...a},me.createElement(r.PreviousMonthButton,{type:"button",className:c[we.PreviousMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":d(i),onClick:m},me.createElement(r.Chevron,{disabled:i?void 0:!0,className:c[we.Chevron],orientation:"left"})),me.createElement(r.NextMonthButton,{type:"button",className:c[we.NextMonthButton],tabIndex:o?void 0:-1,"aria-disabled":o?void 0:!0,"aria-label":f(o),onClick:g},me.createElement(r.Chevron,{disabled:o?void 0:!0,orientation:"right",className:c[we.Chevron]})))}function uV(n){const{components:e}=iu();return me.createElement(e.Button,{...n})}function dV(n){return me.createElement("option",{...n})}function hV(n){const{components:e}=iu();return me.createElement(e.Button,{...n})}function fV(n){const{rootRef:e,...t}=n;return me.createElement("div",{...t,ref:e})}function pV(n){return me.createElement("select",{...n})}function gV(n){const{week:e,...t}=n;return me.createElement("tr",{...t})}function mV(n){return me.createElement("th",{...n})}function yV(n){return me.createElement("thead",{"aria-hidden":!0},me.createElement("tr",{...n}))}function bV(n){const{week:e,...t}=n;return me.createElement("th",{...t})}function xV(n){return me.createElement("th",{...n})}function vV(n){return me.createElement("tbody",{...n})}function CV(n){const{components:e}=iu();return me.createElement(e.Dropdown,{...n})}const SV=Object.freeze(Object.defineProperty({__proto__:null,Button:$K,CaptionLabel:XK,Chevron:JK,Day:ZK,DayButton:eV,Dropdown:tV,DropdownNav:nV,Footer:iV,Month:oV,MonthCaption:sV,MonthGrid:aV,Months:rV,MonthsDropdown:lV,Nav:cV,NextMonthButton:uV,Option:dV,PreviousMonthButton:hV,Root:fV,Select:pV,Week:gV,WeekNumber:bV,WeekNumberHeader:xV,Weekday:mV,Weekdays:yV,Weeks:vV,YearsDropdown:CV},Symbol.toStringTag,{value:"Module"}));function To(n,e,t=!1,i=io){let{from:o,to:a}=n;const{differenceInCalendarDays:r,isSameDay:c}=i;return o&&a?(r(a,o)<0&&([o,a]=[a,o]),r(e,o)>=(t?1:0)&&r(a,e)>=(t?1:0)):!t&&a?c(a,e):!t&&o?c(o,e):!1}function Xx(n){return!!(n&&typeof n=="object"&&"before"in n&&"after"in n)}function Lf(n){return!!(n&&typeof n=="object"&&"from"in n)}function Jx(n){return!!(n&&typeof n=="object"&&"after"in n)}function Zx(n){return!!(n&&typeof n=="object"&&"before"in n)}function aN(n){return!!(n&&typeof n=="object"&&"dayOfWeek"in n)}function rN(n,e){return Array.isArray(n)&&n.every(e.isDate)}function Mo(n,e,t=io){const i=Array.isArray(e)?e:[e],{isSameDay:o,differenceInCalendarDays:a,isAfter:r}=t;return i.some(c=>{if(typeof c=="boolean")return c;if(t.isDate(c))return o(n,c);if(rN(c,t))return c.some(d=>o(n,d));if(Lf(c))return To(c,n,!1,t);if(aN(c))return Array.isArray(c.dayOfWeek)?c.dayOfWeek.includes(n.getDay()):c.dayOfWeek===n.getDay();if(Xx(c)){const d=a(c.before,n),f=a(c.after,n),g=d>0,m=f<0;return r(c.before,c.after)?m&&g:g||m}return Jx(c)?a(n,c.after)>0:Zx(c)?a(c.before,n)>0:typeof c=="function"?c(n):!1})}function kV(n,e,t,i,o){const{disabled:a,hidden:r,modifiers:c,showOutsideDays:d,broadcastCalendar:f,today:g=o.today()}=e,{isSameDay:m,isSameMonth:x,startOfMonth:v,isBefore:C,endOfMonth:k,isAfter:A}=o,D=t&&v(t),O=i&&k(i),T={[wt.focused]:[],[wt.outside]:[],[wt.disabled]:[],[wt.hidden]:[],[wt.today]:[]},M={};for(const L of n){const{date:N,displayMonth:I}=L,W=!!(I&&!x(N,I)),U=!!(D&&C(N,D)),z=!!(O&&A(N,O)),$=!!(a&&Mo(N,a,o)),F=!!(r&&Mo(N,r,o))||U||z||!f&&!d&&W||f&&d===!1&&W,B=m(N,g);W&&T.outside.push(L),$&&T.disabled.push(L),F&&T.hidden.push(L),B&&T.today.push(L),c&&Object.keys(c).forEach(ie=>{const oe=c?.[ie];oe&&Mo(N,oe,o)&&(M[ie]?M[ie].push(L):M[ie]=[L])})}return L=>{const N={[wt.focused]:!1,[wt.disabled]:!1,[wt.hidden]:!1,[wt.outside]:!1,[wt.today]:!1},I={};for(const W in T){const U=T[W];N[W]=U.some(z=>z===L)}for(const W in M)I[W]=M[W].some(U=>U===L);return{...N,...I}}}function wV(n,e,t={}){return Object.entries(n).filter(([,o])=>o===!0).reduce((o,[a])=>(t[a]?o.push(t[a]):e[wt[a]]?o.push(e[wt[a]]):e[Si[a]]&&o.push(e[Si[a]]),o),[e[we.Day]])}function AV(n){return{...SV,...n}}function PV(n){const e={"data-mode":n.mode??void 0,"data-required":"required"in n?n.required:void 0,"data-multiple-months":n.numberOfMonths&&n.numberOfMonths>1||void 0,"data-week-numbers":n.showWeekNumber||void 0,"data-broadcast-calendar":n.broadcastCalendar||void 0,"data-nav-layout":n.navLayout||void 0};return Object.entries(n).forEach(([t,i])=>{t.startsWith("data-")&&(e[t]=i)}),e}function DV(){const n={};for(const e in we)n[we[e]]=`rdp-${we[e]}`;for(const e in wt)n[wt[e]]=`rdp-${wt[e]}`;for(const e in Si)n[Si[e]]=`rdp-${Si[e]}`;for(const e in Qn)n[Qn[e]]=`rdp-${Qn[e]}`;return n}function lN(n,e,t){return(t??new $n(e)).formatMonthYear(n)}const OV=lN;function TV(n,e,t){return(t??new $n(e)).format(n,"d")}function MV(n,e=io){return e.format(n,"LLLL")}function NV(n,e,t){return(t??new $n(e)).format(n,"cccccc")}function LV(n,e=io){return n<10?e.formatNumber(`0${n.toLocaleString()}`):e.formatNumber(`${n.toLocaleString()}`)}function RV(){return""}function cN(n,e=io){return e.format(n,"yyyy")}const EV=cN,IV=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:lN,formatDay:TV,formatMonthCaption:OV,formatMonthDropdown:MV,formatWeekNumber:LV,formatWeekNumberHeader:RV,formatWeekdayName:NV,formatYearCaption:EV,formatYearDropdown:cN},Symbol.toStringTag,{value:"Module"}));function jV(n){return n?.formatMonthCaption&&!n.formatCaption&&(n.formatCaption=n.formatMonthCaption),n?.formatYearCaption&&!n.formatYearDropdown&&(n.formatYearDropdown=n.formatYearCaption),{...IV,...n}}function ev(n,e,t,i){let o=(i??new $n(t)).format(n,"PPPP");return e.today&&(o=`Today, ${o}`),e.selected&&(o=`${o}, selected`),o}const BV=ev;function tv(n,e,t){return(t??new $n(e)).formatMonthYear(n)}const HV=tv;function uN(n,e,t,i){let o=(i??new $n(t)).format(n,"PPPP");return e?.today&&(o=`Today, ${o}`),o}function dN(n){return"Choose the Month"}function hN(){return""}const _V="Go to the Next Month";function fN(n,e){return _V}function pN(n){return"Go to the Previous Month"}function gN(n,e,t){return(t??new $n(e)).format(n,"cccc")}function mN(n,e){return`Week ${n}`}function yN(n){return"Week Number"}function bN(n){return"Choose the Year"}const UV=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:HV,labelDay:BV,labelDayButton:ev,labelGrid:tv,labelGridcell:uN,labelMonthDropdown:dN,labelNav:hN,labelNext:fN,labelPrevious:pN,labelWeekNumber:mN,labelWeekNumberHeader:yN,labelWeekday:gN,labelYearDropdown:bN},Symbol.toStringTag,{value:"Module"})),xi=(n,e,t)=>e||(t?typeof t=="function"?t:(...i)=>t:n);function zV(n,e){const t=e.locale?.labels??{};return{...UV,...n??{},labelDayButton:xi(ev,n?.labelDayButton,t.labelDayButton),labelMonthDropdown:xi(dN,n?.labelMonthDropdown,t.labelMonthDropdown),labelNext:xi(fN,n?.labelNext,t.labelNext),labelPrevious:xi(pN,n?.labelPrevious,t.labelPrevious),labelWeekNumber:xi(mN,n?.labelWeekNumber,t.labelWeekNumber),labelYearDropdown:xi(bN,n?.labelYearDropdown,t.labelYearDropdown),labelGrid:xi(tv,n?.labelGrid,t.labelGrid),labelGridcell:xi(uN,n?.labelGridcell,t.labelGridcell),labelNav:xi(hN,n?.labelNav,t.labelNav),labelWeekNumberHeader:xi(yN,n?.labelWeekNumberHeader,t.labelWeekNumberHeader),labelWeekday:xi(gN,n?.labelWeekday,t.labelWeekday)}}function FV(n,e,t,i,o){const{startOfMonth:a,startOfYear:r,endOfYear:c,eachMonthOfInterval:d,getMonth:f}=o;return d({start:r(n),end:c(n)}).map(x=>{const v=i.formatMonthDropdown(x,o),C=f(x),k=e&&x<a(e)||t&&x>a(t)||!1;return{value:C,label:v,disabled:k}})}function qV(n,e={},t={}){let i={...e?.[we.Day]};return Object.entries(n).filter(([,o])=>o===!0).forEach(([o])=>{i={...i,...t?.[o]}}),i}function GV(n,e,t,i){const o=i??n.today(),a=t?n.startOfBroadcastWeek(o,n):e?n.startOfISOWeek(o):n.startOfWeek(o),r=[];for(let c=0;c<7;c++){const d=n.addDays(a,c);r.push(d)}return r}function KV(n,e,t,i,o=!1){if(!n||!e)return;const{startOfYear:a,endOfYear:r,eachYearOfInterval:c,getYear:d}=i,f=a(n),g=r(e),m=c({start:f,end:g});return o&&m.reverse(),m.map(x=>{const v=t.formatYearDropdown(x,i);return{value:d(x),label:v,disabled:!1}})}const ou=n=>n instanceof HTMLElement?n:null,Xm=n=>[...n.querySelectorAll("[data-animated-month]")??[]],VV=n=>ou(n.querySelector("[data-animated-month]")),Jm=n=>ou(n.querySelector("[data-animated-caption]")),Zm=n=>ou(n.querySelector("[data-animated-weeks]")),WV=n=>ou(n.querySelector("[data-animated-nav]")),QV=n=>ou(n.querySelector("[data-animated-weekdays]"));function YV(n,e,{classNames:t,months:i,focused:o,dateLib:a}){const r=w.useRef(null),c=w.useRef(i),d=w.useRef(!1);w.useLayoutEffect(()=>{const f=c.current;if(c.current=i,!e||!n.current||!(n.current instanceof HTMLElement)||i.length===0||f.length===0||i.length!==f.length)return;const g=a.isSameMonth(i[0].date,f[0].date),m=a.isAfter(i[0].date,f[0].date),x=m?t[Qn.caption_after_enter]:t[Qn.caption_before_enter],v=m?t[Qn.weeks_after_enter]:t[Qn.weeks_before_enter],C=r.current,k=n.current.cloneNode(!0);if(k instanceof HTMLElement?(Xm(k).forEach(T=>{if(!(T instanceof HTMLElement))return;const M=VV(T);M&&T.contains(M)&&T.removeChild(M);const L=Jm(T);L&&L.classList.remove(x);const N=Zm(T);N&&N.classList.remove(v)}),r.current=k):r.current=null,d.current||g||o)return;const A=C instanceof HTMLElement?Xm(C):[],D=Xm(n.current);if(D?.every(O=>O instanceof HTMLElement)&&A&&A.every(O=>O instanceof HTMLElement)){d.current=!0,n.current.style.isolation="isolate";const O=WV(n.current);O&&(O.style.zIndex="1"),D.forEach((T,M)=>{const L=A[M];if(!L)return;T.style.position="relative",T.style.overflow="hidden";const N=Jm(T);N&&N.classList.add(x);const I=Zm(T);I&&I.classList.add(v);const W=()=>{d.current=!1,n.current&&(n.current.style.isolation=""),O&&(O.style.zIndex=""),N&&N.classList.remove(x),I&&I.classList.remove(v),T.style.position="",T.style.overflow="",T.contains(L)&&T.removeChild(L)};L.style.pointerEvents="none",L.style.position="absolute",L.style.overflow="hidden",L.setAttribute("aria-hidden","true");const U=QV(L);U&&(U.style.opacity="0");const z=Jm(L);z&&(z.classList.add(m?t[Qn.caption_before_exit]:t[Qn.caption_after_exit]),z.addEventListener("animationend",W));const $=Zm(L);$&&$.classList.add(m?t[Qn.weeks_before_exit]:t[Qn.weeks_after_exit]),T.insertBefore(L,T.firstChild)})}})}function $V(n,e,t,i){const o=n[0],a=n[n.length-1],{ISOWeek:r,fixedWeeks:c,broadcastCalendar:d}=t??{},{addDays:f,differenceInCalendarDays:g,differenceInCalendarMonths:m,endOfBroadcastWeek:x,endOfISOWeek:v,endOfMonth:C,endOfWeek:k,isAfter:A,startOfBroadcastWeek:D,startOfISOWeek:O,startOfWeek:T}=i,M=d?D(o,i):r?O(o):T(o),L=d?x(a):r?v(C(a)):k(C(a)),N=e&&(d?x(e):r?v(e):k(e)),I=N&&A(L,N)?N:L,W=g(I,M),U=m(a,o)+1,z=[];for(let B=0;B<=W;B++){const ie=f(M,B);z.push(ie)}const F=(d?35:42)*U;if(c&&z.length<F){const B=F-z.length;for(let ie=0;ie<B;ie++){const oe=f(z[z.length-1],1);z.push(oe)}}return z}function XV(n){const e=[];return n.reduce((t,i)=>{const o=i.weeks.reduce((a,r)=>a.concat(r.days.slice()),e.slice());return t.concat(o.slice())},e.slice())}function JV(n,e,t,i){const{numberOfMonths:o=1}=t,a=[];for(let r=0;r<o;r++){const c=i.addMonths(n,r);if(e&&c>e)break;a.push(c)}return a}function RA(n,e,t,i){const{month:o,defaultMonth:a,today:r=i.today(),numberOfMonths:c=1}=n;let d=o||a||r;const{differenceInCalendarMonths:f,addMonths:g,startOfMonth:m}=i;if(t&&f(t,d)<c-1){const x=-1*(c-1);d=g(t,x)}return e&&f(d,e)<0&&(d=e),m(d)}function ZV(n,e,t,i){const{addDays:o,endOfBroadcastWeek:a,endOfISOWeek:r,endOfMonth:c,endOfWeek:d,getISOWeek:f,getWeek:g,startOfBroadcastWeek:m,startOfISOWeek:x,startOfWeek:v}=i,C=n.reduce((k,A)=>{const D=t.broadcastCalendar?m(A,i):t.ISOWeek?x(A):v(A),O=t.broadcastCalendar?a(A):t.ISOWeek?r(c(A)):d(c(A)),T=e.filter(I=>I>=D&&I<=O),M=t.broadcastCalendar?35:42;if(t.fixedWeeks&&T.length<M){const I=e.filter(W=>{const U=M-T.length;return W>O&&W<=o(O,U)});T.push(...I)}const L=T.reduce((I,W)=>{const U=t.ISOWeek?f(W):g(W),z=I.find(F=>F.weekNumber===U),$=new oN(W,A,i);return z?z.days.push($):I.push(new YK(U,[$])),I},[]),N=new QK(A,L);return k.push(N),k},[]);return t.reverseMonths?C.reverse():C}function e9(n,e){let{startMonth:t,endMonth:i}=n;const{startOfYear:o,startOfDay:a,startOfMonth:r,endOfMonth:c,addYears:d,endOfYear:f,newDate:g,today:m}=e,{fromYear:x,toYear:v,fromMonth:C,toMonth:k}=n;!t&&C&&(t=C),!t&&x&&(t=e.newDate(x,0,1)),!i&&k&&(i=k),!i&&v&&(i=g(v,11,31));const A=n.captionLayout==="dropdown"||n.captionLayout==="dropdown-years";return t?t=r(t):x?t=g(x,0,1):!t&&A&&(t=o(d(n.today??m(),-100))),i?i=c(i):v?i=g(v,11,31):!i&&A&&(i=f(n.today??m())),[t&&a(t),i&&a(i)]}function t9(n,e,t,i){if(t.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:a=1}=t,{startOfMonth:r,addMonths:c,differenceInCalendarMonths:d}=i,f=o?a:1,g=r(n);if(!e)return c(g,f);if(!(d(e,n)<a))return c(g,f)}function n9(n,e,t,i){if(t.disableNavigation)return;const{pagedNavigation:o,numberOfMonths:a}=t,{startOfMonth:r,addMonths:c,differenceInCalendarMonths:d}=i,f=o?a??1:1,g=r(n);if(!e)return c(g,-f);if(!(d(g,e)<=0))return c(g,-f)}function i9(n){const e=[];return n.reduce((t,i)=>t.concat(i.weeks.slice()),e.slice())}function Rf(n,e){const[t,i]=w.useState(n);return[e===void 0?t:e,i]}function o9(n,e){const[t,i]=e9(n,e),{startOfMonth:o,endOfMonth:a}=e,r=RA(n,t,i,e),[c,d]=Rf(r,n.month?r:void 0);w.useEffect(()=>{const M=RA(n,t,i,e);d(M)},[n.timeZone]);const{months:f,weeks:g,days:m,previousMonth:x,nextMonth:v}=w.useMemo(()=>{const M=JV(c,i,{numberOfMonths:n.numberOfMonths},e),L=$V(M,n.endMonth?a(n.endMonth):void 0,{ISOWeek:n.ISOWeek,fixedWeeks:n.fixedWeeks,broadcastCalendar:n.broadcastCalendar},e),N=ZV(M,L,{broadcastCalendar:n.broadcastCalendar,fixedWeeks:n.fixedWeeks,ISOWeek:n.ISOWeek,reverseMonths:n.reverseMonths},e),I=i9(N),W=XV(N),U=n9(c,t,n,e),z=t9(c,i,n,e);return{months:N,weeks:I,days:W,previousMonth:U,nextMonth:z}},[e,c.getTime(),i?.getTime(),t?.getTime(),n.disableNavigation,n.broadcastCalendar,n.endMonth?.getTime(),n.fixedWeeks,n.ISOWeek,n.numberOfMonths,n.pagedNavigation,n.reverseMonths]),{disableNavigation:C,onMonthChange:k}=n,A=M=>g.some(L=>L.days.some(N=>N.isEqualTo(M))),D=M=>{if(C)return;let L=o(M);t&&L<o(t)&&(L=o(t)),i&&L>o(i)&&(L=o(i)),d(L),k?.(L)};return{months:f,weeks:g,days:m,navStart:t,navEnd:i,previousMonth:x,nextMonth:v,goToMonth:D,goToDay:M=>{A(M)||D(M.date)}}}var _i;(function(n){n[n.Today=0]="Today",n[n.Selected=1]="Selected",n[n.LastFocused=2]="LastFocused",n[n.FocusedModifier=3]="FocusedModifier"})(_i||(_i={}));function EA(n){return!n[wt.disabled]&&!n[wt.hidden]&&!n[wt.outside]}function s9(n,e,t,i){let o,a=-1;for(const r of n){const c=e(r);EA(c)&&(c[wt.focused]&&a<_i.FocusedModifier?(o=r,a=_i.FocusedModifier):i?.isEqualTo(r)&&a<_i.LastFocused?(o=r,a=_i.LastFocused):t(r.date)&&a<_i.Selected?(o=r,a=_i.Selected):c[wt.today]&&a<_i.Today&&(o=r,a=_i.Today))}return o||(o=n.find(r=>EA(e(r)))),o}function a9(n,e,t,i,o,a,r){const{ISOWeek:c,broadcastCalendar:d}=a,{addDays:f,addMonths:g,addWeeks:m,addYears:x,endOfBroadcastWeek:v,endOfISOWeek:C,endOfWeek:k,max:A,min:D,startOfBroadcastWeek:O,startOfISOWeek:T,startOfWeek:M}=r;let N={day:f,week:m,month:g,year:x,startOfWeek:I=>d?O(I,r):c?T(I):M(I),endOfWeek:I=>d?v(I):c?C(I):k(I)}[n](t,e==="after"?1:-1);return e==="before"&&i?N=A([i,N]):e==="after"&&o&&(N=D([o,N])),N}function xN(n,e,t,i,o,a,r,c=0){if(c>365)return;const d=a9(n,e,t.date,i,o,a,r),f=!!(a.disabled&&Mo(d,a.disabled,r)),g=!!(a.hidden&&Mo(d,a.hidden,r)),m=d,x=new oN(d,m,r);return!f&&!g?x:xN(n,e,x,i,o,a,r,c+1)}function r9(n,e,t,i,o){const{autoFocus:a}=n,[r,c]=w.useState(),d=s9(e.days,t,i||(()=>!1),r),[f,g]=w.useState(a?d:void 0);return{isFocusTarget:k=>!!d?.isEqualTo(k),setFocused:g,focused:f,blur:()=>{c(f),g(void 0)},moveFocus:(k,A)=>{if(!f)return;const D=xN(k,A,f,e.navStart,e.navEnd,n,o);D&&(n.disableNavigation&&!e.days.some(T=>T.isEqualTo(D))||(e.goToDay(D),g(D)))}}}function l9(n,e){const{selected:t,required:i,onSelect:o}=n,[a,r]=Rf(t,o?t:void 0),c=o?t:a,{isSameDay:d}=e,f=v=>c?.some(C=>d(C,v))??!1,{min:g,max:m}=n;return{selected:c,select:(v,C,k)=>{let A=[...c??[]];if(f(v)){if(c?.length===g||i&&c?.length===1)return;A=c?.filter(D=>!d(D,v))}else c?.length===m?A=[v]:A=[...A,v];return o||r(A),o?.(A,v,C,k),A},isSelected:f}}function c9(n,e,t=0,i=0,o=!1,a=io){const{from:r,to:c}=e||{},{isSameDay:d,isAfter:f,isBefore:g}=a;let m;if(!r&&!c)m={from:n,to:t>0?void 0:n};else if(r&&!c)d(r,n)?t===0?m={from:r,to:n}:o?m={from:r,to:void 0}:m=void 0:g(n,r)?m={from:n,to:r}:m={from:r,to:n};else if(r&&c)if(d(r,n)&&d(c,n))o?m={from:r,to:c}:m=void 0;else if(d(r,n))m={from:r,to:t>0?void 0:n};else if(d(c,n))m={from:n,to:t>0?void 0:n};else if(g(n,r))m={from:n,to:c};else if(f(n,r))m={from:r,to:n};else if(f(n,c))m={from:r,to:n};else throw new Error("Invalid range");if(m?.from&&m?.to){const x=a.differenceInCalendarDays(m.to,m.from);i>0&&x>i?m={from:n,to:void 0}:t>1&&x<t&&(m={from:n,to:void 0})}return m}function u9(n,e,t=io){const i=Array.isArray(e)?e:[e];let o=n.from;const a=t.differenceInCalendarDays(n.to,n.from),r=Math.min(a,6);for(let c=0;c<=r;c++){if(i.includes(o.getDay()))return!0;o=t.addDays(o,1)}return!1}function IA(n,e,t=io){return To(n,e.from,!1,t)||To(n,e.to,!1,t)||To(e,n.from,!1,t)||To(e,n.to,!1,t)}function d9(n,e,t=io){const i=Array.isArray(e)?e:[e];if(i.filter(c=>typeof c!="function").some(c=>typeof c=="boolean"?c:t.isDate(c)?To(n,c,!1,t):rN(c,t)?c.some(d=>To(n,d,!1,t)):Lf(c)?c.from&&c.to?IA(n,{from:c.from,to:c.to},t):!1:aN(c)?u9(n,c.dayOfWeek,t):Xx(c)?t.isAfter(c.before,c.after)?IA(n,{from:t.addDays(c.after,1),to:t.addDays(c.before,-1)},t):Mo(n.from,c,t)||Mo(n.to,c,t):Jx(c)||Zx(c)?Mo(n.from,c,t)||Mo(n.to,c,t):!1))return!0;const r=i.filter(c=>typeof c=="function");if(r.length){let c=n.from;const d=t.differenceInCalendarDays(n.to,n.from);for(let f=0;f<=d;f++){if(r.some(g=>g(c)))return!0;c=t.addDays(c,1)}}return!1}function h9(n,e){const{disabled:t,excludeDisabled:i,selected:o,required:a,onSelect:r}=n,[c,d]=Rf(o,r?o:void 0),f=r?o:c;return{selected:f,select:(x,v,C)=>{const{min:k,max:A}=n,D=x?c9(x,f,k,A,a,e):void 0;return i&&t&&D?.from&&D.to&&d9({from:D.from,to:D.to},t,e)&&(D.from=x,D.to=void 0),r||d(D),r?.(D,x,v,C),D},isSelected:x=>f&&To(f,x,!1,e)}}function f9(n,e){const{selected:t,required:i,onSelect:o}=n,[a,r]=Rf(t,o?t:void 0),c=o?t:a,{isSameDay:d}=e;return{selected:c,select:(m,x,v)=>{let C=m;return!i&&c&&c&&d(m,c)&&(C=void 0),o||r(C),o?.(C,m,x,v),C},isSelected:m=>c?d(c,m):!1}}function p9(n,e){const t=f9(n,e),i=l9(n,e),o=h9(n,e);switch(n.mode){case"single":return t;case"multiple":return i;case"range":return o;default:return}}function sn(n,e){return n instanceof Oo&&n.timeZone===e?n:new Oo(n,e)}function jA(n,e){return typeof n=="boolean"||typeof n=="function"?n:n instanceof Date?sn(n,e):Array.isArray(n)?n.map(t=>t instanceof Date?sn(t,e):t):Lf(n)?{...n,from:n.from?sn(n.from,e):n.from,to:n.to?sn(n.to,e):n.to}:Xx(n)?{before:sn(n.before,e),after:sn(n.after,e)}:Jx(n)?{after:sn(n.after,e)}:Zx(n)?{before:sn(n.before,e)}:n}function ey(n,e){return n&&(Array.isArray(n)?n.map(t=>jA(t,e)):jA(n,e))}function g9(n){let e=n;const t=e.timeZone;if(t&&(e={...n,timeZone:t},e.today&&(e.today=sn(e.today,t)),e.month&&(e.month=sn(e.month,t)),e.defaultMonth&&(e.defaultMonth=sn(e.defaultMonth,t)),e.startMonth&&(e.startMonth=sn(e.startMonth,t)),e.endMonth&&(e.endMonth=sn(e.endMonth,t)),e.mode==="single"&&e.selected?e.selected=sn(e.selected,t):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(Re=>sn(Re,t)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?sn(e.selected.from,t):e.selected.from,to:e.selected.to?sn(e.selected.to,t):e.selected.to}),e.disabled!==void 0&&(e.disabled=ey(e.disabled,t)),e.hidden!==void 0&&(e.hidden=ey(e.hidden,t)),e.modifiers)){const Re={};Object.keys(e.modifiers).forEach(Ve=>{Re[Ve]=ey(e.modifiers?.[Ve],t)}),e.modifiers=Re}const{components:i,formatters:o,labels:a,dateLib:r,locale:c,classNames:d}=w.useMemo(()=>{const Re={...iN,...e.locale},Ve=new $n({locale:Re,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib);return{dateLib:Ve,components:AV(e.components),formatters:jV(e.formatters),labels:zV(e.labels,Ve.options),locale:Re,classNames:{...DV(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]);e.today||(e={...e,today:r.today()});const{captionLayout:f,mode:g,navLayout:m,numberOfMonths:x=1,onDayBlur:v,onDayClick:C,onDayFocus:k,onDayKeyDown:A,onDayMouseEnter:D,onDayMouseLeave:O,onNextClick:T,onPrevClick:M,showWeekNumber:L,styles:N}=e,{formatCaption:I,formatDay:W,formatMonthDropdown:U,formatWeekNumber:z,formatWeekNumberHeader:$,formatWeekdayName:F,formatYearDropdown:B}=o,ie=o9(e,r),{days:oe,months:H,navStart:Z,navEnd:se,previousMonth:Y,nextMonth:ae,goToMonth:de}=ie,be=kV(oe,e,Z,se,r),{isSelected:te,select:le,selected:ve}=p9(e,r)??{},{blur:Se,focused:ye,isFocusTarget:Oe,moveFocus:je,setFocused:nt}=r9(e,ie,be,te??(()=>!1),r),{labelDayButton:Pt,labelGridcell:Te,labelGrid:Ye,labelMonthDropdown:it,labelNav:ln,labelPrevious:Sn,labelNext:Ps,labelWeekday:zt,labelWeekNumber:Ho,labelWeekNumberHeader:Ds,labelYearDropdown:gi}=a,wa=w.useMemo(()=>GV(r,e.ISOWeek,e.broadcastCalendar,e.today),[r,e.ISOWeek,e.broadcastCalendar,e.today]),Aa=g!==void 0||C!==void 0,Xt=w.useCallback(()=>{Y&&(de(Y),M?.(Y))},[Y,de,M]),Xr=w.useCallback(()=>{ae&&(de(ae),T?.(ae))},[de,ae,T]),su=w.useCallback((Re,Ve)=>Me=>{Me.preventDefault(),Me.stopPropagation(),nt(Re),!Ve.disabled&&(le?.(Re.date,Ve,Me),C?.(Re.date,Ve,Me))},[le,C,nt]),au=w.useCallback((Re,Ve)=>Me=>{nt(Re),k?.(Re.date,Ve,Me)},[k,nt]),Pa=w.useCallback((Re,Ve)=>Me=>{Se(),v?.(Re.date,Ve,Me)},[Se,v]),Ef=w.useCallback((Re,Ve)=>Me=>{const $e={ArrowLeft:[Me.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[Me.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[Me.shiftKey?"year":"week","after"],ArrowUp:[Me.shiftKey?"year":"week","before"],PageUp:[Me.shiftKey?"year":"month","before"],PageDown:[Me.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if($e[Me.key]){Me.preventDefault(),Me.stopPropagation();const[Kt,He]=$e[Me.key];je(Kt,He)}A?.(Re.date,Ve,Me)},[je,A,e.dir]),ru=w.useCallback((Re,Ve)=>Me=>{D?.(Re.date,Ve,Me)},[D]),If=w.useCallback((Re,Ve)=>Me=>{O?.(Re.date,Ve,Me)},[O]),jf=w.useCallback(Re=>Ve=>{const Me=Number(Ve.target.value),$e=r.setMonth(r.startOfMonth(Re),Me);de($e)},[r,de]),Os=w.useCallback(Re=>Ve=>{const Me=Number(Ve.target.value),$e=r.setYear(r.startOfMonth(Re),Me);de($e)},[r,de]),{className:pn,style:Oi}=w.useMemo(()=>({className:[d[we.Root],e.className].filter(Boolean).join(" "),style:{...N?.[we.Root],...e.style}}),[d,e.className,e.style,N]),gn=PV(e),lu=w.useRef(null);YV(lu,!!e.animate,{classNames:d,months:H,focused:ye,dateLib:r});const Bf={dayPickerProps:e,selected:ve,select:le,isSelected:te,months:H,nextMonth:ae,previousMonth:Y,goToMonth:de,getModifiers:be,components:i,classNames:d,styles:N,labels:a,formatters:o};return me.createElement(sN.Provider,{value:Bf},me.createElement(i.Root,{rootRef:e.animate?lu:void 0,className:pn,style:Oi,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...gn},me.createElement(i.Months,{className:d[we.Months],style:N?.[we.Months]},!e.hideNavigation&&!m&&me.createElement(i.Nav,{"data-animated-nav":e.animate?"true":void 0,className:d[we.Nav],style:N?.[we.Nav],"aria-label":ln(),onPreviousClick:Xt,onNextClick:Xr,previousMonth:Y,nextMonth:ae}),H.map((Re,Ve)=>me.createElement(i.Month,{"data-animated-month":e.animate?"true":void 0,className:d[we.Month],style:N?.[we.Month],key:Ve,displayIndex:Ve,calendarMonth:Re},m==="around"&&!e.hideNavigation&&Ve===0&&me.createElement(i.PreviousMonthButton,{type:"button",className:d[we.PreviousMonthButton],tabIndex:Y?void 0:-1,"aria-disabled":Y?void 0:!0,"aria-label":Sn(Y),onClick:Xt,"data-animated-button":e.animate?"true":void 0},me.createElement(i.Chevron,{disabled:Y?void 0:!0,className:d[we.Chevron],orientation:e.dir==="rtl"?"right":"left"})),me.createElement(i.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:d[we.MonthCaption],style:N?.[we.MonthCaption],calendarMonth:Re,displayIndex:Ve},f?.startsWith("dropdown")?me.createElement(i.DropdownNav,{className:d[we.Dropdowns],style:N?.[we.Dropdowns]},(()=>{const Me=f==="dropdown"||f==="dropdown-months"?me.createElement(i.MonthsDropdown,{key:"month",className:d[we.MonthsDropdown],"aria-label":it(),classNames:d,components:i,disabled:!!e.disableNavigation,onChange:jf(Re.date),options:FV(Re.date,Z,se,o,r),style:N?.[we.Dropdown],value:r.getMonth(Re.date)}):me.createElement("span",{key:"month"},U(Re.date,r)),$e=f==="dropdown"||f==="dropdown-years"?me.createElement(i.YearsDropdown,{key:"year",className:d[we.YearsDropdown],"aria-label":gi(r.options),classNames:d,components:i,disabled:!!e.disableNavigation,onChange:Os(Re.date),options:KV(Z,se,o,r,!!e.reverseYears),style:N?.[we.Dropdown],value:r.getYear(Re.date)}):me.createElement("span",{key:"year"},B(Re.date,r));return r.getMonthYearOrder()==="year-first"?[$e,Me]:[Me,$e]})(),me.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"}},I(Re.date,r.options,r))):me.createElement(i.CaptionLabel,{className:d[we.CaptionLabel],role:"status","aria-live":"polite"},I(Re.date,r.options,r))),m==="around"&&!e.hideNavigation&&Ve===x-1&&me.createElement(i.NextMonthButton,{type:"button",className:d[we.NextMonthButton],tabIndex:ae?void 0:-1,"aria-disabled":ae?void 0:!0,"aria-label":Ps(ae),onClick:Xr,"data-animated-button":e.animate?"true":void 0},me.createElement(i.Chevron,{disabled:ae?void 0:!0,className:d[we.Chevron],orientation:e.dir==="rtl"?"left":"right"})),Ve===x-1&&m==="after"&&!e.hideNavigation&&me.createElement(i.Nav,{"data-animated-nav":e.animate?"true":void 0,className:d[we.Nav],style:N?.[we.Nav],"aria-label":ln(),onPreviousClick:Xt,onNextClick:Xr,previousMonth:Y,nextMonth:ae}),me.createElement(i.MonthGrid,{role:"grid","aria-multiselectable":g==="multiple"||g==="range","aria-label":Ye(Re.date,r.options,r)||void 0,className:d[we.MonthGrid],style:N?.[we.MonthGrid]},!e.hideWeekdays&&me.createElement(i.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:d[we.Weekdays],style:N?.[we.Weekdays]},L&&me.createElement(i.WeekNumberHeader,{"aria-label":Ds(r.options),className:d[we.WeekNumberHeader],style:N?.[we.WeekNumberHeader],scope:"col"},$()),wa.map(Me=>me.createElement(i.Weekday,{"aria-label":zt(Me,r.options,r),className:d[we.Weekday],key:String(Me),style:N?.[we.Weekday],scope:"col"},F(Me,r.options,r)))),me.createElement(i.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:d[we.Weeks],style:N?.[we.Weeks]},Re.weeks.map(Me=>me.createElement(i.Week,{className:d[we.Week],key:Me.weekNumber,style:N?.[we.Week],week:Me},L&&me.createElement(i.WeekNumber,{week:Me,style:N?.[we.WeekNumber],"aria-label":Ho(Me.weekNumber,{locale:c}),className:d[we.WeekNumber],scope:"row",role:"rowheader"},z(Me.weekNumber,r)),Me.days.map($e=>{const{date:Kt}=$e,He=be($e);if(He[wt.focused]=!He.hidden&&!!ye?.isEqualTo($e),He[Si.selected]=te?.(Kt)||He.selected,Lf(ve)){const{from:Ms,to:oo}=ve;He[Si.range_start]=!!(Ms&&oo&&r.isSameDay(Kt,Ms)),He[Si.range_end]=!!(Ms&&oo&&r.isSameDay(Kt,oo)),He[Si.range_middle]=To(ve,Kt,!0,r)}const Ts=qV(He,N,e.modifiersStyles),Hf=wV(He,d,e.modifiersClassNames),cu=!Aa&&!He.hidden?Te(Kt,He,r.options,r):void 0;return me.createElement(i.Day,{key:`${$e.isoDate}_${$e.displayMonthId}`,day:$e,modifiers:He,className:Hf.join(" "),style:Ts,role:"gridcell","aria-selected":He.selected||void 0,"aria-label":cu,"data-day":$e.isoDate,"data-month":$e.outside?$e.dateMonthId:void 0,"data-selected":He.selected||void 0,"data-disabled":He.disabled||void 0,"data-hidden":He.hidden||void 0,"data-outside":$e.outside||void 0,"data-focused":He.focused||void 0,"data-today":He.today||void 0},!He.hidden&&Aa?me.createElement(i.DayButton,{className:d[we.DayButton],style:N?.[we.DayButton],type:"button",day:$e,modifiers:He,disabled:!He.focused&&He.disabled||void 0,"aria-disabled":He.focused&&He.disabled||void 0,tabIndex:Oe($e)?0:-1,"aria-label":Pt(Kt,He,r.options,r),onClick:su($e,He),onBlur:Pa($e,He),onFocus:au($e,He),onKeyDown:Ef($e,He),onMouseEnter:ru($e,He),onMouseLeave:If($e,He)},W(Kt,r.options,r)):!He.hidden&&W($e.date,r.options,r))})))))))),e.footer&&me.createElement(i.Footer,{className:d[we.Footer],style:N?.[we.Footer],role:"status","aria-live":"polite"},e.footer)))}function m9({className:n,classNames:e,showOutsideDays:t=!0,...i}){return p.jsx(g9,{showOutsideDays:t,className:q("p-2",n),classNames:{root:"relative",months:"flex flex-col sm:flex-row gap-2 sm:gap-4",month:"flex flex-col gap-2",month_caption:"flex justify-center pt-1 relative items-center h-8",caption_label:"text-sm font-medium",nav:"absolute inset-x-0 top-2 flex items-center justify-between px-1 z-10",button_previous:q(Jd({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),button_next:q(Jd({variant:"ghost"}),"h-7 w-7 bg-transparent p-0 opacity-70 hover:opacity-100 hover:bg-accent rounded-md"),month_grid:"w-full border-collapse",weekdays:"flex w-full",weekday:"text-muted-foreground w-8 font-normal text-xs text-center",weeks:"flex flex-col",week:"flex w-full",day:q("relative h-8 w-8 p-0 text-center text-xs font-normal focus-within:relative focus-within:z-20","hover:bg-accent hover:text-accent-foreground rounded-full select-none"),day_button:q(Jd({variant:"ghost"}),"h-8 w-8 p-0 font-normal rounded-full text-xs","aria-selected:opacity-100"),range_start:q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-l-full aria-selected:rounded-r-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_end:q("aria-selected:bg-primary aria-selected:text-primary-foreground","aria-selected:rounded-r-full aria-selected:rounded-l-none","aria-selected:hover:bg-primary aria-selected:hover:text-primary-foreground"),range_middle:q("aria-selected:bg-accent aria-selected:text-accent-foreground","aria-selected:rounded-none"),selected:q("bg-primary text-primary-foreground rounded-full","hover:bg-primary hover:text-primary-foreground","focus:bg-primary focus:text-primary-foreground"),today:"bg-accent text-accent-foreground rounded-full",outside:"text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...e},components:{Chevron:({orientation:o,className:a,...r})=>{const c=o==="left"?JE:o==="right"?Wh:o==="up"?vb:Qh;return p.jsx(c,{className:q("h-4 w-4",a),...r})}},...i})}m9.displayName="Calendar";const y9=w.lazy(()=>rt(()=>Promise.resolve().then(()=>Nf),void 0).then(n=>({default:n.CodeEditor})));function uQ({rawJsonContent:n,isRawJsonValid:e,rawJsonEdits:t,rawSettingsEnv:i,onChange:o,missingRequiredFields:a=[]}){const{t:r}=xe(),c=a.length>0;return p.jsx(w.Suspense,{fallback:p.jsxs("div",{className:"flex items-center justify-center h-full",children:[p.jsx(hi,{className:"w-6 h-6 animate-spin text-muted-foreground"}),p.jsx("span",{className:"ml-2 text-muted-foreground",children:r("providerEditor.loadingEditor")})]}),children:p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!e&&t!==null&&p.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:[p.jsx(Kr,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),e&&c&&p.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:[p.jsx(wi,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",p.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:a.join(", ")}),p.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-hidden px-6 pb-4 pt-4",children:p.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:p.jsx(y9,{value:n,onChange:o,language:"json",minHeight:"100%",heightMode:"fill-parent"})})}),p.jsx("div",{className:"mx-6 mb-4",children:p.jsx("div",{className:"border rounded-md overflow-hidden",children:p.jsx(Zb,{profileEnv:i})})})]})})}w.lazy(()=>rt(()=>Promise.resolve().then(()=>Nf),void 0).then(n=>({default:n.CodeEditor})));function b9(){const{t:n}=xe(),{isDark:e,setTheme:t}=Nb(),[i,o]=w.useState(""),[a,r]=w.useState(""),[c,d]=w.useState(!1),[f,g]=w.useState(null),[m,x]=w.useState(!1),{login:v,authRequired:C,isAuthenticated:k,loading:A,accessMode:D,authEnabled:O}=Zh(),T=bb(),M=Vh(),L=D==="setup",N=n(L?"auth.remoteGuardLabel":"auth.protectedAccessLabel"),I=n(L?O?"auth.incompleteSetupDescription":"auth.remoteSetupDescription":"auth.loginDescription"),W=M.state?.from?.pathname||"/";if(w.useEffect(()=>{A||(k||!C)&&T(W,{replace:!0})},[k,C,A,T,W]),A)return p.jsx("div",{className:"flex min-h-[100dvh] items-center justify-center bg-background px-4",children:p.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:[p.jsx(hi,{className:"h-4 w-4 animate-spin"}),n("auth.loading")]})});if(k||!C)return null;const U=async z=>{z.preventDefault(),g(null),x(!0);try{await v(i,a),T(W,{replace:!0})}catch($){g($ instanceof Error?$.message:n("auth.loginFailed"))}finally{x(!1)}};return p.jsxs("div",{className:"relative min-h-[100dvh] overflow-hidden bg-background",children:[p.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%)]"}),p.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]"}),p.jsx("div",{className:"relative mx-auto flex min-h-[100dvh] max-w-6xl items-center px-4 py-8 sm:px-6",children:p.jsxs("div",{className:"grid w-full items-stretch gap-6 lg:grid-cols-[minmax(0,1.05fr)_minmax(360px,430px)]",children:[p.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:[p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[p.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:[p.jsx(Sd,{className:"h-3.5 w-3.5 text-accent"}),N]}),p.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:[p.jsxs(ht,{type:"button",variant:"ghost",size:"sm",className:q("rounded-full px-3 text-xs font-semibold",!e&&"bg-card text-foreground shadow-sm"),"aria-pressed":!e,onClick:()=>t("light"),children:[p.jsx(dP,{className:"h-3.5 w-3.5"}),n("auth.lightMode")]}),p.jsxs(ht,{type:"button",variant:"ghost",size:"sm",className:q("rounded-full px-3 text-xs font-semibold",e&&"bg-card text-foreground shadow-sm"),"aria-pressed":e,onClick:()=>t("dark"),children:[p.jsx(hP,{className:"h-3.5 w-3.5"}),n("auth.darkMode")]})]})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsx("h1",{className:"max-w-xl text-4xl font-semibold tracking-[-0.04em] text-balance text-foreground sm:text-5xl",children:n(L?"auth.remoteSetupTitle":"auth.dashboardTitle")}),p.jsx("p",{className:"max-w-2xl text-base leading-7 text-muted-foreground sm:text-lg",children:I})]})]}),p.jsxs("div",{className:"mt-8 grid gap-3 text-sm text-muted-foreground sm:grid-cols-3",children:[p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[p.jsx(nk,{className:"mb-3 h-4 w-4 text-accent"}),p.jsx("p",{children:n("auth.safetyNoteRemote")})]}),p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[p.jsx(ik,{className:"mb-3 h-4 w-4 text-accent"}),p.jsx("p",{children:n("auth.safetyNoteLocal")})]}),p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/70 p-4",children:[p.jsx(Sd,{className:"mb-3 h-4 w-4 text-accent"}),p.jsx("p",{children:n("auth.safetyNoteSession")})]})]})]}),p.jsxs(M_,{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:[p.jsxs(N_,{className:"space-y-3 border-b border-border/70 px-6 py-6",children:[p.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl border border-accent/20 bg-accent/10",children:L?p.jsx(nk,{className:"h-5 w-5 text-accent"}):p.jsx(ik,{className:"h-5 w-5 text-accent"})}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(L_,{className:"text-2xl tracking-[-0.03em]",children:n(L?"auth.remoteSetupTitle":"auth.dashboardTitle")}),p.jsx(R_,{className:"text-sm leading-6 text-muted-foreground",children:L?I:n("auth.credentialsHint")})]})]}),p.jsx(E_,{className:"space-y-5 px-6 py-6",children:L?p.jsxs(p.Fragment,{children:[p.jsxs(lc,{variant:"warning",className:"rounded-2xl border-yellow-300/70 bg-yellow-50/80",children:[p.jsx(Cc,{className:"h-4 w-4"}),p.jsx(bh,{children:n("auth.noDefaultCredentials")}),p.jsx(cc,{children:n("auth.credentialsHint")})]}),p.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[p.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[p.jsx(ZE,{className:"h-4 w-4 text-accent"}),n("auth.hostStepTitle")]}),p.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:n("auth.hostStepDescription")}),p.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"}),p.jsx("p",{className:"mt-3 text-xs leading-5 text-muted-foreground",children:n("auth.dockerStepDescription")}),p.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"})]}),p.jsxs("div",{className:"rounded-2xl border border-border/70 bg-background/75 p-4",children:[p.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[p.jsx(Sd,{className:"h-4 w-4 text-accent"}),n("auth.localStepTitle")]}),p.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:n("auth.localStepDescription")})]})]})]}):p.jsxs("form",{onSubmit:U,className:"space-y-4",children:[f&&p.jsxs(lc,{variant:"destructive",className:"rounded-2xl",children:[p.jsx(Cc,{className:"h-4 w-4"}),p.jsx(cc,{children:f})]}),p.jsxs(lc,{variant:"info",className:"rounded-2xl border-blue-200/80 bg-blue-50/80",children:[p.jsx(Sd,{className:"h-4 w-4"}),p.jsx(bh,{children:n("auth.noDefaultCredentials")}),p.jsx(cc,{children:n("auth.credentialsHint")})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{htmlFor:"username",className:"text-sm font-semibold",children:n("auth.username")}),p.jsx(Hi,{id:"username",type:"text",value:i,onChange:z=>o(z.target.value),placeholder:n("auth.usernamePlaceholder"),autoComplete:"username",className:"h-12 rounded-2xl border-border/80 bg-background/85 px-4 text-base md:text-base",disabled:m,required:!0})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(yn,{htmlFor:"password",className:"text-sm font-semibold",children:n("auth.password")}),p.jsxs("div",{className:"relative",children:[p.jsx(Hi,{id:"password",type:c?"text":"password",value:a,onChange:z=>r(z.target.value),placeholder:n("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:m,required:!0}),p.jsx(ht,{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":n(c?"auth.hidePassword":"auth.showPassword"),"aria-pressed":c,onClick:()=>d(z=>!z),disabled:m,children:c?p.jsx(Vc,{className:"h-4 w-4"}):p.jsx(Wc,{className:"h-4 w-4"})})]})]}),p.jsx(ht,{type:"submit",className:"h-12 w-full rounded-2xl text-sm font-semibold",disabled:m,children:m?p.jsxs(p.Fragment,{children:[p.jsx(hi,{className:"mr-2 h-4 w-4 animate-spin"}),n("auth.signingIn")]}):n("auth.signIn")})]})})]})]})})]})}const x9=w.lazy(()=>rt(()=>import("./index-BfbJlKvM.js"),__vite__mapDeps([24,1,2,4,5,25,6,7,9,8])).then(n=>({default:n.AnalyticsPage}))),v9=w.lazy(()=>rt(()=>import("./api-BOsmB6JC.js"),__vite__mapDeps([26,1,2,5,27,19,6,4,3,7,8,9])).then(n=>({default:n.ApiPage}))),C9=w.lazy(()=>rt(()=>import("./cliproxy-daECx_cg.js"),__vite__mapDeps([28,1,2,5,17,6,4,21,29,27,19,30,31,18,20,7,8,9])).then(n=>({default:n.CliproxyPage}))),S9=w.lazy(()=>rt(()=>import("./cliproxy-ai-providers-jeMd_Enz.js"),__vite__mapDeps([32,1,2,18,19,5,6,4,20,27,7,8,9])).then(n=>({default:n.CliproxyAiProvidersPage}))),k9=w.lazy(()=>rt(()=>import("./cliproxy-control-panel-Ylrw7Vt0.js"),__vite__mapDeps([33,1,2,5,17,4,6,7,8,9])).then(n=>({default:n.CliproxyControlPanelPage}))),w9=w.lazy(()=>rt(()=>import("./copilot-DGVMqIvj.js"),__vite__mapDeps([34,1,2,5,27,19,4,30,31,6,7,8,9])).then(n=>({default:n.CopilotPage}))),A9=w.lazy(()=>rt(()=>import("./cursor-D94mZoOn.js"),__vite__mapDeps([35,1,2,6,5,17,30,31,4,7,8,9])).then(n=>({default:n.CursorPage}))),P9=w.lazy(()=>rt(()=>import("./claude-extension-CvbfmbdL.js"),__vite__mapDeps([36,1,2,5,6,4,7,8,9])).then(n=>({default:n.ClaudeExtensionPage}))),D9=w.lazy(()=>rt(()=>import("./codex-7d3v_F3-.js"),__vite__mapDeps([37,1,2,6,38,5,4,20,30,39,7,8,9])).then(n=>({default:n.CodexPage}))),O9=w.lazy(()=>rt(()=>import("./droid-CijT6OtA.js"),__vite__mapDeps([40,1,2,6,5,39,4,30,7,8,9])).then(n=>({default:n.DroidPage}))),T9=w.lazy(()=>rt(()=>import("./logs-Bc1-UurC.js"),__vite__mapDeps([41,1,2,4,5,6,7,8,9])).then(n=>({default:n.LogsPage}))),M9=w.lazy(()=>rt(()=>import("./accounts-CT4cNpXE.js"),__vite__mapDeps([42,1,2,5,38,19,25,6,4,29,7,8,9])).then(n=>({default:n.AccountsPage}))),N9=w.lazy(()=>rt(()=>Promise.resolve().then(()=>UK),void 0).then(n=>({default:n.SettingsPage}))),L9=w.lazy(()=>rt(()=>import("./health-DFG40_kD.js"),__vite__mapDeps([43,1,2,5,6,4,11,7,8,9])).then(n=>({default:n.HealthPage}))),R9=w.lazy(()=>rt(()=>import("./shared-DWBCHrPI.js"),__vite__mapDeps([44,1,2,25,5,6,4,7,8,9])).then(n=>({default:n.SharedPage}))),E9=w.lazy(()=>rt(()=>import("./updates-DfYyQw34.js"),__vite__mapDeps([45,1,2,4,5,6,7,8,9])).then(n=>({default:n.UpdatesPage}))),I9=null;function cn(){return p.jsx("div",{className:"flex h-64 items-center justify-center",children:p.jsx(hi,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}function j9(){return p.jsx(yE,{client:Q2,children:p.jsx(FI,{defaultTheme:"system",storageKey:"vite-ui-theme",children:p.jsx(qI,{children:p.jsx(QI,{children:p.jsxs(fE,{children:[p.jsxs(pE,{children:[p.jsx(Et,{path:"/login",element:p.jsx(b9,{})}),p.jsx(Et,{element:p.jsx(YI,{}),children:p.jsxs(Et,{element:p.jsx(f5,{}),children:[p.jsx(Et,{path:"/",element:p.jsx(B3,{})}),p.jsx(Et,{path:"/analytics",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(x9,{})})}),p.jsx(Et,{path:"/updates",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(E9,{})})}),p.jsx(Et,{path:"/providers",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(v9,{})})}),p.jsx(Et,{path:"/cliproxy",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(C9,{})})}),p.jsx(Et,{path:"/cliproxy/ai-providers",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(S9,{})})}),p.jsx(Et,{path:"/cliproxy/control-panel",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(k9,{})})}),p.jsx(Et,{path:"/copilot",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(w9,{})})}),p.jsx(Et,{path:"/cursor",element:p.jsx(oP,{to:"/cliproxy?provider=cursor",replace:!0})}),p.jsx(Et,{path:"/legacy/cursor",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(A9,{})})}),p.jsx(Et,{path:"/claude-extension",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(P9,{})})}),p.jsx(Et,{path:"/codex",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(D9,{})})}),p.jsx(Et,{path:"/droid",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(O9,{})})}),p.jsx(Et,{path:"/accounts",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(M9,{})})}),p.jsx(Et,{path:"/settings",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(N9,{})})}),p.jsx(Et,{path:"/health",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(L9,{})})}),p.jsx(Et,{path:"/logs",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(T9,{})})}),p.jsx(Et,{path:"/shared",element:p.jsx(w.Suspense,{fallback:p.jsx(cn,{}),children:p.jsx(R9,{})})}),I9]})})]}),p.jsx(bE,{position:"top-right"})]})})})})})}const vN=document.getElementById("root");if(!vN)throw new Error("Root element not found. Failed to mount React application.");K2.createRoot(vN).render(p.jsx(w.StrictMode,{children:p.jsx(j9,{})}));export{UW as $,J3 as A,Qt as B,M_ as C,_W as D,F3 as E,Q3 as F,jW as G,HW as H,Hi as I,_3 as J,V3 as K,yn as L,Y3 as M,BW as N,Zj as O,ji as P,eB as Q,tB as R,tt as S,ga as T,OD as U,Xb as V,xh as W,gy as X,re as Y,zW as Z,Ue as _,xe as a,oW as a$,R_ as a0,qW as a1,GW as a2,KW as a3,VW as a4,WW as a5,QW as a6,ND as a7,YW as a8,B_ as a9,LW as aA,JW as aB,ZW as aC,XW as aD,CB as aE,AW as aF,Ek as aG,d_ as aH,$W as aI,Z3 as aJ,BD as aK,lH as aL,wH as aM,ZB as aN,e5 as aO,t5 as aP,n5 as aQ,Q5 as aR,QP as aS,cW as aT,uW as aU,dW as aV,hW as aW,sQ as aX,Y9 as aY,Jj as aZ,iW as a_,qb as aa,Gb as ab,V9 as ac,Wj as ad,$9 as ae,tW as af,aW as ag,rW as ah,Lb as ai,Rb as aj,Eb as ak,Ib as al,jb as am,eQ as an,__ as ao,tQ as ap,Sa as aq,OW as ar,Jl as as,TW as at,cy as au,lW as av,MW as aw,NW as ax,RW as ay,Ik as az,E_ as b,Qj as b0,Yj as b1,sW as b2,$j as b3,Xj as b4,nW as b5,Ub as b6,DW as b7,vW as b8,SW as b9,jK as bA,mW as bB,fW as bC,RB as bD,EB as bE,PW as bF,yW as bG,X9 as bH,J9 as bI,Z9 as bJ,eW as bK,pW as bL,gW as bM,xW as bN,bW as bO,wP as bP,DI as bQ,AI as bR,oy as bS,fa as bT,yI as bU,xI as bV,kI as bW,TI as bX,Jd as bY,kW as ba,CW as bb,XM as bc,Zb as bd,wW as be,Xl as bf,W9 as bg,Q9 as bh,lc as bi,bh as bj,cc as bk,uQ as bl,Yb as bm,kc as bn,$b as bo,T3 as bp,mj as bq,xj as br,vj as bs,Cj as bt,Sj as bu,E3 as bv,EW as bw,IW as bx,ZM as by,EK as bz,q as c,FW as d,ht as e,nQ as f,iQ as g,U_ as h,m9 as i,FP as j,zb as k,qP as l,Fb as m,rc as n,$i as o,Xi as p,Ji as q,K9 as r,N_ as s,L_ as t,wb as u,WP as v,X5 as w,Vr as x,oQ as y,sw as z};
|