@ian2018cs/agenthub 0.1.92 → 0.1.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,25 @@
1
- import{j as e,s as ua,R as pa,o as ma,E as fa,m as ha,b as xa,c as ga,h as ya,p as ba,d as va}from"./vendor-codemirror-B2saKA4-.js";import{b as ja,g as Zr,a as n,d as Hr,R as mt,u as Qr,L as qt,e as Vo,B as ka,f as Zo,h as dr}from"./vendor-react-C_uEg43g.js";import{t as wa,c as Na,a as Qo,F as Sa}from"./vendor-utils-00TdZexr.js";import{T as Bt,C as es,I as en,F as Tr,X as Ge,L as bt,B as _t,S as Mt,R as st,D as It,a as On,b as ur,Z as Cr,c as tn,G as rn,d as Vt,e as Br,U as Ht,f as Cn,g as pr,h as Bn,i as Ta,j as Zt,k as Xr,l as yo,m as vt,P as En,n as Mr,o as Xa,p as zt,q as Ut,r as Gt,M as hn,s as Ma,t as Un,u as Oa,v as Ca,E as ts,w as Ea,x as bo,y as xn,z as Da,A as Er,H as Gn,J as mr,K as rs,N as Qt,O as ns,Q as Pa,V as Dn,W as os,Y as ss,_ as Aa,$ as La,a0 as _a,a1 as Ur,a2 as Gr,a3 as Ia,a4 as za,a5 as Pn,a6 as Ra,a7 as as,a8 as $a,a9 as Wa,aa as Fa,ab as Yn,ac as Ha,ad as Ba,ae as Ua,af as Ga,ag as Ya,ah as An,ai as Ja,aj as Yr,ak as is,al as ls,am as qa,an as Ka}from"./vendor-icons-BLTKkQIn.js";import{r as cs,a as Va,b as Za,M as ds}from"./vendor-markdown-Ok8-Lurq.js";import{h as us}from"./vendor-syntax-CEC-Nb_2.js";import{r as Qa,a as ei,b as ti,c as ri}from"./vendor-xterm-CvdiG4-n.js";import"./vendor-katex-DK8hFnhL.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))u(c);new MutationObserver(c=>{for(const m of c)if(m.type==="childList")for(const d of m.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&u(d)}).observe(document,{childList:!0,subtree:!0});function l(c){const m={};return c.integrity&&(m.integrity=c.integrity),c.referrerPolicy&&(m.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?m.credentials="include":c.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function u(c){if(c.ep)return;c.ep=!0;const m=l(c);fetch(c.href,m)}})();var Rr={},vo;function ni(){if(vo)return Rr;vo=1;var r=ja();return Rr.createRoot=r.createRoot,Rr.hydrateRoot=r.hydrateRoot,Rr}var oi=ni();const si=Zr(oi);function ot(...r){return wa(Na(r))}function ai(r){if(!r||typeof r!="string")return null;try{return JSON.parse(r)}catch{return null}}const Jn=n.forwardRef(({className:r,children:o,...l},u)=>e.jsx("div",{ref:u,className:ot("relative overflow-hidden",r),...l,children:e.jsx("div",{className:"h-full w-full rounded-[inherit] overflow-auto",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:o})}));Jn.displayName="ScrollArea";const ii=Qo("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),U=n.forwardRef(({className:r,variant:o,size:l,...u},c)=>e.jsx("button",{className:ot(ii({variant:o,size:l,className:r})),ref:c,...u}));U.displayName="Button";const li=Qo("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",success:"border-transparent bg-green-500 text-white shadow hover:bg-green-500/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function nt({className:r,variant:o,...l}){return e.jsx("div",{className:ot(li({variant:o}),r),...l})}const ct=n.forwardRef(({className:r,type:o,...l},u)=>e.jsx("input",{type:o,className:ot("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",r),ref:u,...l}));ct.displayName="Input";const ps="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",ms="[a-zA-Z0-9._/~:+@%=\\\\-]",ci=new RegExp(`${ms}*\\/user-data\\/${ps}\\/`,"gi"),di=new RegExp(`${ms}*\\/user-projects\\/${ps}\\/`,"gi");function Ue(r){return!r||typeof r!="string"?r||"":r.replace(ci,"./").replace(di,"./")}var ui={};const Ve="AgentHub",fs="你的 AI 助手",jo=typeof process<"u"&&ui?.PRODUCT_WEB_URL||"http://10.0.1.133:6175",ko=[{icon:"📋",text:"帮我整理今天的工作计划"},{icon:"📊",text:"分析这段数据并给出洞察"},{icon:"✍️",text:"帮我润色这段文字"},{icon:"💡",text:"给我一些解决问题的思路"}],wo="default",hs=n.createContext(null);function lt(){const r=n.useContext(hs);if(!r)throw new Error("useDialog must be used within DialogProvider");return r}function pi({children:r}){const[o,l]=n.useState(null),u=n.useRef(null),c=n.useCallback(s=>{u.current?.(s),u.current=null,l(null)},[]),m=n.useCallback((s,p={})=>new Promise(t=>{u.current=t,l({type:"alert",message:s,title:p.title||"提示",variant:p.variant||"info"})}),[]),d=n.useCallback((s,p={})=>new Promise(t=>{u.current=t,l({type:"confirm",message:s,title:p.title||"确认操作",subtitle:p.subtitle,detail:p.detail,confirmText:p.confirmText||"确认",cancelText:p.cancelText||"取消",variant:p.variant||"warning",checkboxLabel:p.checkboxLabel})}),[]);return e.jsxs(hs.Provider,{value:{showAlert:m,showConfirm:d},children:[r,o&&Hr.createPortal(e.jsx(mi,{dialog:o,onClose:c}),document.body)]})}function mi({dialog:r,onClose:o}){const l=n.useRef(null),u=n.useRef(null),[c,m]=n.useState(!1),d=n.useCallback(a=>{r.checkboxLabel!==void 0?o({confirmed:a,checked:a?c:!1}):o(a)},[r.checkboxLabel,c,o]);n.useEffect(()=>{r.type==="confirm"?l.current?.focus():u.current?.focus()},[r.type]),n.useEffect(()=>{const a=i=>{i.key==="Escape"&&(r.type==="confirm"?d(!1):o(void 0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[r.type,o,d]);const s={info:e.jsx(en,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"}),warning:e.jsx(Bt,{className:"w-5 h-5 text-amber-600 dark:text-amber-400"}),error:e.jsx(es,{className:"w-5 h-5 text-red-600 dark:text-red-400"}),danger:e.jsx(Bt,{className:"w-5 h-5 text-red-600 dark:text-red-400"})},p={info:"bg-blue-100 dark:bg-blue-900/30",warning:"bg-amber-100 dark:bg-amber-900/30",error:"bg-red-100 dark:bg-red-900/30",danger:"bg-red-100 dark:bg-red-900/30"},t={warning:"bg-amber-600 hover:bg-amber-700 text-white",danger:"bg-red-600 hover:bg-red-700 text-white",info:"bg-primary hover:bg-primary/90 text-primary-foreground"},x=s[r.variant]||s.info,h=p[r.variant]||p.info;return r.type==="alert"?e.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",onClick:()=>o(),children:e.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-2xl w-full max-w-sm p-6 space-y-4",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-full ${h} flex items-center justify-center flex-shrink-0`,children:x}),e.jsx("h3",{className:"font-semibold text-foreground",children:r.title})]}),e.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:r.message}),e.jsx("div",{className:"flex justify-end pt-1",children:e.jsx("button",{ref:u,className:"px-4 py-2 rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground text-sm font-medium transition-colors",onClick:()=>o(),children:"确定"})})]})}):e.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",onClick:()=>d(!1),children:e.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-2xl w-full max-w-sm p-6 space-y-4",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-full ${h} flex items-center justify-center flex-shrink-0`,children:x}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-foreground",children:r.title}),r.subtitle&&e.jsx("p",{className:"text-sm text-muted-foreground",children:r.subtitle})]})]}),e.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:r.message}),r.detail&&e.jsx("p",{className:"text-xs text-muted-foreground bg-muted/50 rounded-lg p-3",children:r.detail}),r.checkboxLabel&&e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[e.jsx("input",{type:"checkbox",checked:c,onChange:a=>m(a.target.checked),className:"w-4 h-4 rounded border-border accent-primary cursor-pointer"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:r.checkboxLabel})]}),e.jsxs("div",{className:"flex gap-3 pt-1",children:[e.jsx("button",{className:"flex-1 px-4 py-2 rounded-lg border border-border text-sm font-medium hover:bg-accent transition-colors",onClick:()=>d(!1),children:r.cancelText}),e.jsx("button",{ref:l,className:`flex-1 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t[r.variant]||t.info}`,onClick:()=>d(!0),children:r.confirmText})]})]})})}const J=(r,o={})=>{const l=localStorage.getItem("auth-token"),u={};return o.body instanceof FormData||(u["Content-Type"]="application/json"),l&&(u.Authorization=`Bearer ${l}`),fetch(r,{...o,headers:{...u,...o.headers}})},me={auth:{status:()=>fetch("/api/auth/status"),login:(r,o)=>fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:o})}),sendCode:r=>fetch("/api/auth/send-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r})}),verifyCode:(r,o)=>fetch("/api/auth/verify-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r,code:o})}),user:()=>J("/api/auth/user"),logout:()=>J("/api/auth/logout",{method:"POST"}),limitStatus:()=>J("/api/auth/limit-status"),changePassword:(r,o)=>J("/api/auth/change-password",{method:"PATCH",body:JSON.stringify({current_password:r,new_password:o})}),feishuBindToken:()=>J("/api/auth/feishu-bind-token",{method:"POST"}),feishuStatus:()=>J("/api/auth/feishu-status"),featurePermissions:()=>J("/api/auth/feature-permissions")},admin:{getUsers:()=>J("/api/admin/users"),createUser:(r,o)=>J("/api/admin/users",{method:"POST",body:JSON.stringify({username:r,password:o})}),updateUserStatus:(r,o)=>J(`/api/admin/users/${r}`,{method:"PATCH",body:JSON.stringify({status:o})}),deleteUser:r=>J(`/api/admin/users/${r}`,{method:"DELETE"}),getEmailDomains:()=>J("/api/admin/email-domains"),addEmailDomain:r=>J("/api/admin/email-domains",{method:"POST",body:JSON.stringify({domain:r})}),removeEmailDomain:r=>J(`/api/admin/email-domains/${r}`,{method:"DELETE"}),getUserLimits:r=>J(`/api/admin/users/${r}/limits`),updateUserLimits:(r,o)=>J(`/api/admin/users/${r}/limits`,{method:"PATCH",body:JSON.stringify(o)}),resetUserPassword:(r,o)=>J(`/api/admin/users/${r}/password`,{method:"PATCH",body:JSON.stringify({new_password:o})}),updateUserRole:(r,o)=>J(`/api/admin/users/${r}/role`,{method:"PATCH",body:JSON.stringify({role:o})}),getDefaultLimits:()=>J("/api/admin/settings/default-limits"),updateDefaultLimits:r=>J("/api/admin/settings/default-limits",{method:"PUT",body:JSON.stringify(r)}),getUserPermissions:r=>J(`/api/admin/users/${r}/permissions`),updateUserPermissions:(r,o)=>J(`/api/admin/users/${r}/permissions`,{method:"PATCH",body:JSON.stringify({permissions:o})}),getDefaultPermissions:()=>J("/api/admin/settings/default-permissions"),updateDefaultPermissions:r=>J("/api/admin/settings/default-permissions",{method:"PUT",body:JSON.stringify({permissions:r})}),getUserVisibleAgents:r=>J(`/api/admin/users/${r}/visible-agents`),updateUserVisibleAgents:(r,o)=>J(`/api/admin/users/${r}/visible-agents`,{method:"PATCH",body:JSON.stringify({agents:o})})},projects:()=>J("/api/projects"),sessions:(r,o=5,l=0)=>J(`/api/projects/${r}/sessions?limit=${o}&offset=${l}`),sessionMessages:(r,o,l=null,u=0)=>{const c=new URLSearchParams;l!==null&&(c.append("limit",l),c.append("offset",u));const m=c.toString(),d=`/api/projects/${r}/sessions/${o}/messages${m?`?${m}`:""}`;return J(d)},renameProject:(r,o)=>J(`/api/projects/${r}/rename`,{method:"PUT",body:JSON.stringify({displayName:o})}),deleteSession:(r,o)=>J(`/api/projects/${r}/sessions/${o}`,{method:"DELETE"}),renameSession:(r,o,l)=>J(`/api/projects/${r}/sessions/${o}/rename`,{method:"PUT",body:JSON.stringify({title:l})}),forkSession:(r,o,l)=>J(`/api/projects/${r}/sessions/${o}/fork`,{method:"POST",body:JSON.stringify({upToMessageId:l})}),deleteProject:(r,o=!0)=>J(`/api/projects/${r}?deleteFolder=${o}`,{method:"DELETE"}),createProject:r=>J("/api/projects/create",{method:"POST",body:JSON.stringify({path:r})}),createWorkspace:r=>J("/api/projects/create-workspace",{method:"POST",body:JSON.stringify(r)}),readFile:(r,o)=>J(`/api/projects/${r}/file?filePath=${encodeURIComponent(o)}`),saveFile:(r,o,l)=>J(`/api/projects/${r}/file`,{method:"PUT",body:JSON.stringify({filePath:o,content:l})}),getFiles:(r,o={})=>{const l=new URLSearchParams;o.dirPath&&l.set("dirPath",o.dirPath),o.depth&&l.set("depth",o.depth.toString()),o.showHidden&&l.set("showHidden","true");const u=l.toString();return J(`/api/projects/${r}/files${u?"?"+u:""}`)},uploadFiles:(r,o)=>J(`/api/projects/${r}/upload-files`,{method:"POST",body:o,headers:{}}),deleteFile:(r,o)=>J(`/api/projects/${r}/files?filePath=${encodeURIComponent(o)}`,{method:"DELETE"}),createDir:(r,o)=>J(`/api/projects/${r}/create-dir`,{method:"POST",body:JSON.stringify({dirPath:o})}),getFileContent:(r,o)=>J(`/api/projects/${r}/files/content?path=${encodeURIComponent(o)}`),transcribe:r=>J("/api/transcribe",{method:"POST",body:r,headers:{}}),settings:{getAgentPermissions:()=>J("/api/settings/agent-permissions"),saveAgentPermissions:r=>J("/api/settings/agent-permissions",{method:"PUT",body:JSON.stringify({agentPermissions:r})})},get:r=>J(`/api${r}`)},Sr={claude_shell:!0,codex_shell:!0,gemini_shell:!0,submit_agent:!0,tab_models:!0,tab_skills:!0,tab_mcp:!0,tab_permissions:!0,feishu_binding:!0,create_project:!0},xs=n.createContext({user:null,token:null,login:()=>{},sendCode:()=>{},verifyCode:()=>{},logout:()=>{},isLoading:!0,needsSetup:!1,smtpConfigured:!1,error:null,isAdmin:!1,isSuperAdmin:!1,limitStatus:{allowed:!0},checkLimitStatus:()=>{},setLimitStatus:()=>{},featurePermissions:Sr,hasPermission:()=>!0,refreshFeaturePermissions:()=>{}}),Ot=()=>{const r=n.useContext(xs);if(!r)throw new Error("useAuth must be used within an AuthProvider");return r};async function gn(){try{const r=await me.settings.getAgentPermissions();if(r.ok){const o=await r.json();o.agentPermissions&&localStorage.setItem("claude-settings",JSON.stringify(o.agentPermissions))}}catch{}}const fi=({children:r})=>{const[o,l]=n.useState(null),[u,c]=n.useState(localStorage.getItem("auth-token")),[m,d]=n.useState(!0),[s,p]=n.useState(!1),[t,x]=n.useState(!1),[h,a]=n.useState(null),[i,g]=n.useState({allowed:!0}),[v,k]=n.useState(Sr);n.useEffect(()=>{b()},[]);const b=async()=>{try{d(!0),a(null);const E=await(await me.auth.status()).json();if(x(E.smtpConfigured||!1),E.needsSetup){p(!0),d(!1);return}if(u)try{const $=await me.auth.user();if($.ok){const T=await $.json();l(T.user),p(!1),T.featurePermissions&&k({...Sr,...T.featurePermissions}),await gn()}else localStorage.removeItem("auth-token"),c(null),l(null)}catch($){console.error("Token verification failed:",$),localStorage.removeItem("auth-token"),c(null),l(null)}}catch(M){console.error("[AuthContext] Auth status check failed:",M),a("Failed to check authentication status")}finally{d(!1)}},j=async M=>{try{a(null);const E=await me.auth.sendCode(M),$=await E.json();return E.ok?{success:!0,type:$.type}:{success:!1,error:$.error||"发送验证码失败",waitSeconds:$.waitSeconds}}catch(E){return console.error("Send code error:",E),{success:!1,error:"网络错误,请稍后再试"}}},f=async(M,E)=>{try{a(null);const $=await me.auth.verifyCode(M,E),T=await $.json();return $.ok?(c(T.token),l(T.user),p(!1),localStorage.setItem("auth-token",T.token),await gn(),await D(),{success:!0}):(a(T.error||"验证失败"),{success:!1,error:T.error||"验证失败"})}catch($){return console.error("Verify code error:",$),{success:!1,error:"网络错误,请稍后再试"}}},w=async(M,E)=>{try{a(null);const $=await me.auth.login(M,E),T=await $.json();return $.ok?(c(T.token),l(T.user),localStorage.setItem("auth-token",T.token),await gn(),await D(),{success:!0}):(a(T.error||"登录失败"),{success:!1,error:T.error||"登录失败"})}catch($){console.error("Login error:",$);const T="网络错误,请稍后再试";return a(T),{success:!1,error:T}}},S=()=>{c(null),l(null),g({allowed:!0}),k(Sr),localStorage.removeItem("auth-token"),u&&me.auth.logout().catch(M=>{console.error("Logout endpoint error:",M)})},z=async()=>{if(!o)return{allowed:!0};try{const M=await me.auth.limitStatus();if(M.ok){const E=await M.json();return g(E),E}}catch(M){console.error("Error checking limit status:",M)}return{allowed:!0}},D=n.useCallback(async()=>{try{const M=await me.auth.featurePermissions();if(M.ok){const E=await M.json();E.featurePermissions&&k({...Sr,...E.featurePermissions})}}catch(M){console.error("Error refreshing feature permissions:",M)}},[]),N=n.useCallback(M=>v[M]!==!1,[v]);n.useEffect(()=>{o&&!m&&z()},[o,m]);const R={user:o,token:u,login:w,sendCode:j,verifyCode:f,logout:S,isLoading:m,needsSetup:s,smtpConfigured:t,error:h,isAdmin:o?.role==="admin"||o?.role==="super_admin",isSuperAdmin:o?.role==="super_admin",limitStatus:i,checkLimitStatus:z,setLimitStatus:g,featurePermissions:v,hasPermission:N,refreshFeaturePermissions:D};return e.jsx(xs.Provider,{value:R,children:r})},hi=/^[a-zA-Z0-9_-]+$/,xi=({onClose:r,onProjectCreated:o})=>{const[l,u]=n.useState(""),[c,m]=n.useState(""),[d,s]=n.useState(!1),[p,t]=n.useState(null),x=i=>i.trim()?hi.test(i.trim())?null:"项目名称只能包含字母、数字、连字符和下划线":"项目名称为必填项",h=async()=>{t(null);const i=x(l);if(i){t(i);return}s(!0);try{const g={name:l.trim()};c.trim()&&(g.githubUrl=c.trim());const v=await me.createWorkspace(g),k=await v.json();if(!v.ok)throw new Error(k.error||"Failed to create project");o&&o(k.project),r()}catch(g){console.error("Error creating project:",g),t(g.message||"Failed to create project")}finally{s(!1)}},a=i=>{i.key==="Enter"&&!d&&h()};return e.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-[60] p-0 sm:p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-none sm:rounded-lg shadow-xl w-full h-full sm:h-auto sm:max-w-md border-0 sm:border border-gray-200 dark:border-gray-700 overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:e.jsx(Tr,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"创建新项目"})]}),e.jsx("button",{onClick:r,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",disabled:d,children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-6 space-y-5",children:[p&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 flex items-start gap-3",children:[e.jsx(es,{className:"w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),e.jsx("div",{className:"flex-1",children:e.jsx("p",{className:"text-sm text-red-800 dark:text-red-200",children:p})})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:["项目名称 ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ct,{type:"text",value:l,onChange:i=>u(i.target.value),onKeyDown:a,placeholder:"my-awesome-project",className:"w-full",autoFocus:!0}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"仅允许字母、数字、连字符和下划线"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"GitHub 链接(可选)"}),e.jsx(ct,{type:"text",value:c,onChange:i=>m(i.target.value),onKeyDown:a,placeholder:"https://github.com/user/repo",className:"w-full"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"留空以创建空项目,或输入公共仓库链接以克隆"})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-gray-200 dark:border-gray-700",children:[e.jsx(U,{variant:"outline",onClick:r,disabled:d,children:"取消"}),e.jsx(U,{onClick:h,disabled:d||!l.trim(),children:d?e.jsxs(e.Fragment,{children:[e.jsx(bt,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):"创建项目"})]})]})})};function gi({projects:r=[],onClose:o}){const{showAlert:l,showConfirm:u}=lt(),[c,m]=n.useState([]),[d,s]=n.useState(!0),[p,t]=n.useState(null),[x,h]=n.useState(""),a={};for(const b of r)b.agentInfo?.isAgent&&(a[b.agentInfo.agentName]=b.agentInfo.installedVersion);n.useEffect(()=>{i()},[]),n.useEffect(()=>{const b=j=>{j.key==="Escape"&&o()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[o]);const i=async()=>{try{s(!0);const b=await J("/api/agents");if(b.ok){const j=await b.json();m(j.agents||[])}else{const j=await b.json();l(j.error||"获取 Agent 列表失败",{variant:"error"})}}catch(b){l(b.message,{variant:"error"})}finally{s(!1)}},g=async(b,j=!1)=>{const f=b.dirName||b.name;t(f);try{const w=await J("/api/agents/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentName:f,force:j})}),S=await w.json();if(w.status===409&&S.conflict){t(null),await u("检测到本地 CLAUDE.md 已被修改,更新将覆盖本地改动,是否继续?",{title:"本地文件冲突",confirmText:"强制更新",variant:"warning"})&&await g(b,!0);return}w.ok?(l(`Agent "${b.display_name||b.name}" ${j?"更新":"使用"}成功!项目已创建,Skills 和 MCP 服务已安装。`,{title:j?"更新成功":"使用成功"}),window.refreshProjects?.(),window.refreshMcpServers?.(),i()):l(S.error||"使用失败",{variant:"error"})}catch(w){l(w.message,{variant:"error"})}finally{t(null)}},v=b=>{const j=b.dirName||b.name,f=a[j];return f?f===b.version?{state:"up_to_date",installedVersion:f}:{state:"update_available",installedVersion:f,latestVersion:b.version}:{state:"not_installed"}},k=n.useMemo(()=>{if(!x.trim())return c;const b=x.toLowerCase();return c.filter(j=>(j.display_name||j.name||"").toLowerCase().includes(b)||(j.description||"").toLowerCase().includes(b))},[c,x]);return e.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",onClick:o,children:e.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-2xl w-full max-w-lg flex flex-col max-h-[80vh]",onClick:b=>b.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center",children:e.jsx(_t,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"使用共享项目模板"}),!d&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.length," 个可用"]})]})]}),e.jsx("button",{onClick:o,className:"w-7 h-7 rounded-md flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:e.jsx(Ge,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"px-4 py-3 border-b border-border",children:e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground"}),e.jsx("input",{type:"text",placeholder:"搜索共享项目模板...",value:x,onChange:b=>h(b.target.value),className:"w-full h-8 pl-9 pr-3 text-sm bg-muted/50 border border-border rounded-md focus:outline-none focus:ring-1 focus:ring-primary/30 focus:bg-background text-foreground placeholder:text-muted-foreground",autoFocus:!0})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-2",children:d?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(st,{className:"w-5 h-5 animate-spin mr-2"}),"加载中..."]}):c.length===0?e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx(_t,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"暂无可用共享项目模板"})]}):k.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Mt,{className:"w-6 h-6 mx-auto mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"未找到匹配的共享项目模板"})]}):k.map(b=>{const j=b.dirName||b.name,f=v(b),w=p===j;return e.jsxs("div",{className:"flex items-center gap-3 p-3 border border-border rounded-lg hover:bg-accent/50 transition-colors",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center flex-shrink-0",children:e.jsx(_t,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium text-sm text-foreground truncate",children:b.display_name||b.name}),e.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:["v",b.version]}),f.state==="update_available"&&e.jsxs(nt,{className:"text-xs bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400 border-amber-200 dark:border-amber-700 hover:bg-amber-200 dark:hover:bg-amber-900/50 flex-shrink-0",children:["有更新 v",f.latestVersion]}),f.state==="up_to_date"&&e.jsx(nt,{className:"text-xs bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 border-green-200 dark:border-green-700 hover:bg-green-200 dark:hover:bg-green-900/50 flex-shrink-0",children:"已使用"})]}),b.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:b.description}),e.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[b.skills?.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[b.skills.length," 个 Skill"]}),b.mcps?.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[b.mcps.length," 个 MCP"]})]})]}),e.jsx(U,{size:"sm",variant:f.state==="not_installed"?"default":"outline",onClick:()=>g(b),disabled:w||f.state==="up_to_date",className:"text-xs h-7 px-2.5 flex-shrink-0",children:w?e.jsx(st,{className:"w-3 h-3 animate-spin"}):f.state==="up_to_date"?"已是最新":f.state==="update_available"?e.jsxs(e.Fragment,{children:[e.jsx(It,{className:"w-3 h-3 mr-1"}),"更新"]}):e.jsxs(e.Fragment,{children:[e.jsx(It,{className:"w-3 h-3 mr-1"}),"使用"]})})]},j)})}),e.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:!d&&x.trim()?`${k.length} / ${c.length} 个 共享项目模板`:d?"":`共 ${c.length} 个 共享项目模板`}),e.jsx(U,{variant:"outline",size:"sm",onClick:o,className:"text-xs h-7",children:"关闭"})]})]})})}function qn({projects:r=[],onClose:o,onSubmitted:l,initialProjectKey:u="",prefillData:c=null}){const{showAlert:m}=lt(),[d,s]=n.useState(u),[p,t]=n.useState(""),[x,h]=n.useState(""),[a,i]=n.useState(""),[g,v]=n.useState(!1),[k,b]=n.useState({hasClaudeMd:!1,skills:[],mcps:[],refFiles:[],gitRepos:[]}),[j,f]=n.useState(new Set),[w,S]=n.useState(new Set),[z,D]=n.useState(new Set),[N,R]=n.useState(new Set),[M,E]=n.useState(!1),[$,T]=n.useState(""),[X,_]=n.useState({files:[],truncated:!1}),[te,ne]=n.useState(!1),[G,le]=n.useState(new Set),[de,fe]=n.useState(""),[Ee,ge]=n.useState(!1),[Me,Fe]=n.useState(null),[ae,Ne]=n.useState(null),[He,Be]=n.useState(""),[he,Oe]=n.useState(!1),De=n.useRef(null),Ye=n.useRef(null),Te=r.filter(K=>K.fullPath);n.useEffect(()=>{if(d){Je(d),Ce(d);const K=Te.find(B=>B.name===d);if(K){const B=K.fullPath.split("/").filter(Boolean).pop()||"";t(B),h(K.displayName||K.name)}else if(c?.projectPath){const B=c.projectPath.split("/").filter(Boolean).pop()||"";t(B)}}else _({files:[],truncated:!1}),le(new Set),fe(""),ge(!1)},[d]),n.useEffect(()=>{c?.projectKey&&(s(c.projectKey),Ye.current={displayName:c.displayName||"",description:c.description||"",updateNotes:c.updateNotes||"",skills:c.skills||[],mcps:c.mcps||[],files:c.files||[],gitRepos:c.gitRepos||[]})},[c]),n.useEffect(()=>{if(De.current&&clearTimeout(De.current),!p||!/^[a-zA-Z0-9_-]{1,100}$/.test(p)){Fe(null),Ne(null),Oe(!1);return}return Oe(!0),De.current=setTimeout(async()=>{try{const K=await J(`/api/agents/check-name/${encodeURIComponent(p)}`);if(K.ok){const B=await K.json();Fe(B.existing),Ne(B.pendingConflict);const C=Ye.current;C?(B.existing?(x||h(B.existing.display_name||""),C.updateNotes&&Be(C.updateNotes),!a&&B.existing.description&&i(B.existing.description)):(C.displayName&&!x&&h(C.displayName),C.description&&!a&&i(C.description)),Ye.current=null):B.existing&&!a&&i(B.existing.description||"")}}catch{Fe(null),Ne(null)}finally{Oe(!1)}},400),()=>{De.current&&clearTimeout(De.current)}},[p]);const Je=async K=>{if(K)try{const B=await J(`/api/agents/preview?projectKey=${encodeURIComponent(K)}`);if(B.ok){const C=await B.json();b(C);const V=Ye.current;V?(V.skills?.length>0?f(new Set(V.skills)):f(new Set((C.skills||[]).map(I=>I.name))),V.mcps?.length>0?S(new Set(V.mcps)):S(new Set((C.mcps||[]).map(I=>I.name))),D(new Set((C.refFiles||[]).filter(I=>I.exists).map(I=>I.path))),V.gitRepos?.length>0?R(new Set(V.gitRepos.map(I=>I.name))):R(new Set((C.gitRepos||[]).map(I=>I.name))),V.files?.length>0&&(le(new Set(V.files)),ge(!0))):(f(new Set((C.skills||[]).map(I=>I.name))),S(new Set((C.mcps||[]).map(I=>I.name))),D(new Set((C.refFiles||[]).filter(I=>I.exists).map(I=>I.path))),R(new Set((C.gitRepos||[]).map(I=>I.name))))}}catch{b({hasClaudeMd:!1,skills:[],mcps:[],refFiles:[],gitRepos:[]}),f(new Set),S(new Set),D(new Set),R(new Set)}},Ce=async K=>{ne(!0),le(new Set),fe(""),ge(!1);try{const B=await J(`/api/agents/project-files?projectKey=${encodeURIComponent(K)}`);if(B.ok){const C=await B.json();_(C)}else _({files:[],truncated:!1})}catch{_({files:[],truncated:!1})}finally{ne(!1)}},Re=K=>K<1024?`${K} B`:K<1024*1024?`${(K/1024).toFixed(1)} KB`:`${(K/(1024*1024)).toFixed(1)} MB`,$e=n.useMemo(()=>{const K=new Set((k.refFiles||[]).map(C=>C.path));let B=(X.files||[]).filter(C=>!K.has(C.path));if(de.trim()){const C=de.toLowerCase();B=B.filter(V=>V.path.toLowerCase().includes(C))}return B},[X.files,k.refFiles,de]),Ie=async()=>{if(d){v(!0);try{const K=await J("/api/agents/generate-description",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectKey:d,skills:[...j],mcps:[...w]})}),B=await K.json();K.ok?i(B.description||""):m(B.error||"生成失败",{variant:"error"})}catch(K){m(K.message,{variant:"error"})}finally{v(!1)}}},ze=K=>/^[a-zA-Z0-9_-]{1,100}$/.test(K)?(T(""),!0):(T("只能包含字母、数字、连字符和下划线,1-100 字符"),!1),Ze=async()=>{if(!d){m("请选择一个项目",{variant:"warning"});return}if(!ze(p))return;if(!x.trim()){m("请填写显示名称",{variant:"warning"});return}if(!(!Te.find(B=>B.name===d)&&!c)){E(!0);try{const B=new Date().toISOString(),C=(k.skills||[]).filter(ye=>j.has(ye.name)),V=(k.mcps||[]).filter(ye=>w.has(ye.name)),I=(k.gitRepos||[]).filter(ye=>N.has(ye.name)),re=C.map(ye=>` - name: "${ye.name}"
2
- repo: "${ye.localPath||ye.repo||""}"`).join(`
3
- `),Y=V.map(ye=>` - name: "${ye.name}"
4
- repo: "${ye.repo||""}"`).join(`
5
- `),ie=I.map(ye=>` - name: "${ye.name}"
6
- repo: "${ye.repo}"
7
- branch: "${ye.branch}"`).join(`
8
- `),ce=[...new Set([...z,...G])],Ae=[" - CLAUDE.md",...ce.map(ye=>` - ${ye}`)].join(`
9
- `),Xe=[`name: "${p}"`,`display_name: "${x}"`,"description: |",a.split(`
10
- `).map(ye=>` ${ye}`).join(`
1
+ import{j as e,s as ua,R as pa,o as ma,E as fa,m as ha,b as xa,c as ga,h as ya,p as ba,d as va}from"./vendor-codemirror-B2saKA4-.js";import{b as ja,g as Zr,a as n,d as Hr,R as mt,u as Qr,L as qt,e as Vo,B as ka,f as Zo,h as dr}from"./vendor-react-C_uEg43g.js";import{t as wa,c as Na,a as Qo,F as Sa}from"./vendor-utils-00TdZexr.js";import{T as Bt,C as es,I as en,F as Tr,X as Ge,L as bt,B as It,S as Mt,R as st,D as _t,a as On,b as ur,Z as Cr,c as tn,G as rn,d as Vt,e as Br,U as Ht,f as Cn,g as pr,h as Bn,i as Ta,j as Zt,k as Xr,l as yo,m as vt,P as En,n as Mr,o as Xa,p as zt,q as Ut,r as Gt,M as hn,s as Ma,t as Un,u as Oa,v as Ca,E as ts,w as Ea,x as bo,y as xn,z as Da,A as Er,H as Gn,J as mr,K as rs,N as Qt,O as ns,Q as Pa,V as Dn,W as os,Y as ss,_ as Aa,$ as La,a0 as Ia,a1 as Ur,a2 as Gr,a3 as _a,a4 as za,a5 as Pn,a6 as Ra,a7 as as,a8 as $a,a9 as Wa,aa as Fa,ab as Yn,ac as Ha,ad as Ba,ae as Ua,af as Ga,ag as Ya,ah as An,ai as Ja,aj as Yr,ak as is,al as ls,am as qa,an as Ka}from"./vendor-icons-BLTKkQIn.js";import{r as cs,a as Va,b as Za,M as ds}from"./vendor-markdown-Ok8-Lurq.js";import{h as us}from"./vendor-syntax-CEC-Nb_2.js";import{r as Qa,a as ei,b as ti,c as ri}from"./vendor-xterm-CvdiG4-n.js";import"./vendor-katex-DK8hFnhL.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))u(c);new MutationObserver(c=>{for(const m of c)if(m.type==="childList")for(const d of m.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&u(d)}).observe(document,{childList:!0,subtree:!0});function l(c){const m={};return c.integrity&&(m.integrity=c.integrity),c.referrerPolicy&&(m.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?m.credentials="include":c.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function u(c){if(c.ep)return;c.ep=!0;const m=l(c);fetch(c.href,m)}})();var Rr={},vo;function ni(){if(vo)return Rr;vo=1;var r=ja();return Rr.createRoot=r.createRoot,Rr.hydrateRoot=r.hydrateRoot,Rr}var oi=ni();const si=Zr(oi);function ot(...r){return wa(Na(r))}function ai(r){if(!r||typeof r!="string")return null;try{return JSON.parse(r)}catch{return null}}const Jn=n.forwardRef(({className:r,children:o,...l},u)=>e.jsx("div",{ref:u,className:ot("relative overflow-hidden",r),...l,children:e.jsx("div",{className:"h-full w-full rounded-[inherit] overflow-auto",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:o})}));Jn.displayName="ScrollArea";const ii=Qo("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),U=n.forwardRef(({className:r,variant:o,size:l,...u},c)=>e.jsx("button",{className:ot(ii({variant:o,size:l,className:r})),ref:c,...u}));U.displayName="Button";const li=Qo("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",success:"border-transparent bg-green-500 text-white shadow hover:bg-green-500/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function nt({className:r,variant:o,...l}){return e.jsx("div",{className:ot(li({variant:o}),r),...l})}const ct=n.forwardRef(({className:r,type:o,...l},u)=>e.jsx("input",{type:o,className:ot("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",r),ref:u,...l}));ct.displayName="Input";const ps="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",ms="[a-zA-Z0-9._/~:+@%=\\\\-]",ci=new RegExp(`${ms}*\\/user-data\\/${ps}\\/`,"gi"),di=new RegExp(`${ms}*\\/user-projects\\/${ps}\\/`,"gi");function Ue(r){return!r||typeof r!="string"?r||"":r.replace(ci,"./").replace(di,"./")}var ui={};const Ve="AgentHub",fs="你的 AI 助手",jo=typeof process<"u"&&ui?.PRODUCT_WEB_URL||"http://10.0.1.133:6175",ko=[{icon:"📋",text:"帮我整理今天的工作计划"},{icon:"📊",text:"分析这段数据并给出洞察"},{icon:"✍️",text:"帮我润色这段文字"},{icon:"💡",text:"给我一些解决问题的思路"}],wo="default",hs=n.createContext(null);function lt(){const r=n.useContext(hs);if(!r)throw new Error("useDialog must be used within DialogProvider");return r}function pi({children:r}){const[o,l]=n.useState(null),u=n.useRef(null),c=n.useCallback(s=>{u.current?.(s),u.current=null,l(null)},[]),m=n.useCallback((s,p={})=>new Promise(t=>{u.current=t,l({type:"alert",message:s,title:p.title||"提示",variant:p.variant||"info"})}),[]),d=n.useCallback((s,p={})=>new Promise(t=>{u.current=t,l({type:"confirm",message:s,title:p.title||"确认操作",subtitle:p.subtitle,detail:p.detail,confirmText:p.confirmText||"确认",cancelText:p.cancelText||"取消",variant:p.variant||"warning",checkboxLabel:p.checkboxLabel})}),[]);return e.jsxs(hs.Provider,{value:{showAlert:m,showConfirm:d},children:[r,o&&Hr.createPortal(e.jsx(mi,{dialog:o,onClose:c}),document.body)]})}function mi({dialog:r,onClose:o}){const l=n.useRef(null),u=n.useRef(null),[c,m]=n.useState(!1),d=n.useCallback(a=>{r.checkboxLabel!==void 0?o({confirmed:a,checked:a?c:!1}):o(a)},[r.checkboxLabel,c,o]);n.useEffect(()=>{r.type==="confirm"?l.current?.focus():u.current?.focus()},[r.type]),n.useEffect(()=>{const a=i=>{i.key==="Escape"&&(r.type==="confirm"?d(!1):o(void 0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[r.type,o,d]);const s={info:e.jsx(en,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"}),warning:e.jsx(Bt,{className:"w-5 h-5 text-amber-600 dark:text-amber-400"}),error:e.jsx(es,{className:"w-5 h-5 text-red-600 dark:text-red-400"}),danger:e.jsx(Bt,{className:"w-5 h-5 text-red-600 dark:text-red-400"})},p={info:"bg-blue-100 dark:bg-blue-900/30",warning:"bg-amber-100 dark:bg-amber-900/30",error:"bg-red-100 dark:bg-red-900/30",danger:"bg-red-100 dark:bg-red-900/30"},t={warning:"bg-amber-600 hover:bg-amber-700 text-white",danger:"bg-red-600 hover:bg-red-700 text-white",info:"bg-primary hover:bg-primary/90 text-primary-foreground"},x=s[r.variant]||s.info,h=p[r.variant]||p.info;return r.type==="alert"?e.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",onClick:()=>o(),children:e.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-2xl w-full max-w-sm p-6 space-y-4",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-full ${h} flex items-center justify-center flex-shrink-0`,children:x}),e.jsx("h3",{className:"font-semibold text-foreground",children:r.title})]}),e.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:r.message}),e.jsx("div",{className:"flex justify-end pt-1",children:e.jsx("button",{ref:u,className:"px-4 py-2 rounded-lg bg-primary hover:bg-primary/90 text-primary-foreground text-sm font-medium transition-colors",onClick:()=>o(),children:"确定"})})]})}):e.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",onClick:()=>d(!1),children:e.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-2xl w-full max-w-sm p-6 space-y-4",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-full ${h} flex items-center justify-center flex-shrink-0`,children:x}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-foreground",children:r.title}),r.subtitle&&e.jsx("p",{className:"text-sm text-muted-foreground",children:r.subtitle})]})]}),e.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:r.message}),r.detail&&e.jsx("p",{className:"text-xs text-muted-foreground bg-muted/50 rounded-lg p-3",children:r.detail}),r.checkboxLabel&&e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[e.jsx("input",{type:"checkbox",checked:c,onChange:a=>m(a.target.checked),className:"w-4 h-4 rounded border-border accent-primary cursor-pointer"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:r.checkboxLabel})]}),e.jsxs("div",{className:"flex gap-3 pt-1",children:[e.jsx("button",{className:"flex-1 px-4 py-2 rounded-lg border border-border text-sm font-medium hover:bg-accent transition-colors",onClick:()=>d(!1),children:r.cancelText}),e.jsx("button",{ref:l,className:`flex-1 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t[r.variant]||t.info}`,onClick:()=>d(!0),children:r.confirmText})]})]})})}const J=(r,o={})=>{const l=localStorage.getItem("auth-token"),u={};return o.body instanceof FormData||(u["Content-Type"]="application/json"),l&&(u.Authorization=`Bearer ${l}`),fetch(r,{...o,headers:{...u,...o.headers}})},me={auth:{status:()=>fetch("/api/auth/status"),login:(r,o)=>fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:o})}),sendCode:r=>fetch("/api/auth/send-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r})}),verifyCode:(r,o)=>fetch("/api/auth/verify-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r,code:o})}),user:()=>J("/api/auth/user"),logout:()=>J("/api/auth/logout",{method:"POST"}),limitStatus:()=>J("/api/auth/limit-status"),changePassword:(r,o)=>J("/api/auth/change-password",{method:"PATCH",body:JSON.stringify({current_password:r,new_password:o})}),feishuBindToken:()=>J("/api/auth/feishu-bind-token",{method:"POST"}),feishuStatus:()=>J("/api/auth/feishu-status"),featurePermissions:()=>J("/api/auth/feature-permissions")},admin:{getUsers:()=>J("/api/admin/users"),createUser:(r,o)=>J("/api/admin/users",{method:"POST",body:JSON.stringify({username:r,password:o})}),updateUserStatus:(r,o)=>J(`/api/admin/users/${r}`,{method:"PATCH",body:JSON.stringify({status:o})}),deleteUser:r=>J(`/api/admin/users/${r}`,{method:"DELETE"}),getEmailDomains:()=>J("/api/admin/email-domains"),addEmailDomain:r=>J("/api/admin/email-domains",{method:"POST",body:JSON.stringify({domain:r})}),removeEmailDomain:r=>J(`/api/admin/email-domains/${r}`,{method:"DELETE"}),getUserLimits:r=>J(`/api/admin/users/${r}/limits`),updateUserLimits:(r,o)=>J(`/api/admin/users/${r}/limits`,{method:"PATCH",body:JSON.stringify(o)}),resetUserPassword:(r,o)=>J(`/api/admin/users/${r}/password`,{method:"PATCH",body:JSON.stringify({new_password:o})}),updateUserRole:(r,o)=>J(`/api/admin/users/${r}/role`,{method:"PATCH",body:JSON.stringify({role:o})}),getDefaultLimits:()=>J("/api/admin/settings/default-limits"),updateDefaultLimits:r=>J("/api/admin/settings/default-limits",{method:"PUT",body:JSON.stringify(r)}),getUserPermissions:r=>J(`/api/admin/users/${r}/permissions`),updateUserPermissions:(r,o)=>J(`/api/admin/users/${r}/permissions`,{method:"PATCH",body:JSON.stringify({permissions:o})}),getDefaultPermissions:()=>J("/api/admin/settings/default-permissions"),updateDefaultPermissions:r=>J("/api/admin/settings/default-permissions",{method:"PUT",body:JSON.stringify({permissions:r})}),getUserVisibleAgents:r=>J(`/api/admin/users/${r}/visible-agents`),updateUserVisibleAgents:(r,o)=>J(`/api/admin/users/${r}/visible-agents`,{method:"PATCH",body:JSON.stringify({agents:o})})},projects:()=>J("/api/projects"),sessions:(r,o=5,l=0)=>J(`/api/projects/${r}/sessions?limit=${o}&offset=${l}`),sessionMessages:(r,o,l=null,u=0)=>{const c=new URLSearchParams;l!==null&&(c.append("limit",l),c.append("offset",u));const m=c.toString(),d=`/api/projects/${r}/sessions/${o}/messages${m?`?${m}`:""}`;return J(d)},renameProject:(r,o)=>J(`/api/projects/${r}/rename`,{method:"PUT",body:JSON.stringify({displayName:o})}),deleteSession:(r,o)=>J(`/api/projects/${r}/sessions/${o}`,{method:"DELETE"}),renameSession:(r,o,l)=>J(`/api/projects/${r}/sessions/${o}/rename`,{method:"PUT",body:JSON.stringify({title:l})}),forkSession:(r,o,l)=>J(`/api/projects/${r}/sessions/${o}/fork`,{method:"POST",body:JSON.stringify({upToMessageId:l})}),deleteProject:(r,o=!0)=>J(`/api/projects/${r}?deleteFolder=${o}`,{method:"DELETE"}),createProject:r=>J("/api/projects/create",{method:"POST",body:JSON.stringify({path:r})}),createWorkspace:r=>J("/api/projects/create-workspace",{method:"POST",body:JSON.stringify(r)}),readFile:(r,o)=>J(`/api/projects/${r}/file?filePath=${encodeURIComponent(o)}`),saveFile:(r,o,l)=>J(`/api/projects/${r}/file`,{method:"PUT",body:JSON.stringify({filePath:o,content:l})}),getFiles:(r,o={})=>{const l=new URLSearchParams;o.dirPath&&l.set("dirPath",o.dirPath),o.depth&&l.set("depth",o.depth.toString()),o.showHidden&&l.set("showHidden","true");const u=l.toString();return J(`/api/projects/${r}/files${u?"?"+u:""}`)},uploadFiles:(r,o)=>J(`/api/projects/${r}/upload-files`,{method:"POST",body:o,headers:{}}),deleteFile:(r,o)=>J(`/api/projects/${r}/files?filePath=${encodeURIComponent(o)}`,{method:"DELETE"}),createDir:(r,o)=>J(`/api/projects/${r}/create-dir`,{method:"POST",body:JSON.stringify({dirPath:o})}),getFileContent:(r,o)=>J(`/api/projects/${r}/files/content?path=${encodeURIComponent(o)}`),transcribe:r=>J("/api/transcribe",{method:"POST",body:r,headers:{}}),settings:{getAgentPermissions:()=>J("/api/settings/agent-permissions"),saveAgentPermissions:r=>J("/api/settings/agent-permissions",{method:"PUT",body:JSON.stringify({agentPermissions:r})})},get:r=>J(`/api${r}`)},Sr={claude_shell:!0,codex_shell:!0,gemini_shell:!0,submit_agent:!0,tab_models:!0,tab_skills:!0,tab_mcp:!0,tab_permissions:!0,feishu_binding:!0,create_project:!0},xs=n.createContext({user:null,token:null,login:()=>{},sendCode:()=>{},verifyCode:()=>{},logout:()=>{},isLoading:!0,needsSetup:!1,smtpConfigured:!1,error:null,isAdmin:!1,isSuperAdmin:!1,limitStatus:{allowed:!0},checkLimitStatus:()=>{},setLimitStatus:()=>{},featurePermissions:Sr,hasPermission:()=>!0,refreshFeaturePermissions:()=>{}}),Ot=()=>{const r=n.useContext(xs);if(!r)throw new Error("useAuth must be used within an AuthProvider");return r};async function gn(){try{const r=await me.settings.getAgentPermissions();if(r.ok){const o=await r.json();o.agentPermissions&&localStorage.setItem("claude-settings",JSON.stringify(o.agentPermissions))}}catch{}}const fi=({children:r})=>{const[o,l]=n.useState(null),[u,c]=n.useState(localStorage.getItem("auth-token")),[m,d]=n.useState(!0),[s,p]=n.useState(!1),[t,x]=n.useState(!1),[h,a]=n.useState(null),[i,g]=n.useState({allowed:!0}),[v,k]=n.useState(Sr);n.useEffect(()=>{b()},[]);const b=async()=>{try{d(!0),a(null);const D=await(await me.auth.status()).json();if(x(D.smtpConfigured||!1),D.needsSetup){p(!0),d(!1);return}if(u)try{const $=await me.auth.user();if($.ok){const T=await $.json();l(T.user),p(!1),T.featurePermissions&&k({...Sr,...T.featurePermissions}),await gn()}else localStorage.removeItem("auth-token"),c(null),l(null)}catch($){console.error("Token verification failed:",$),localStorage.removeItem("auth-token"),c(null),l(null)}}catch(M){console.error("[AuthContext] Auth status check failed:",M),a("Failed to check authentication status")}finally{d(!1)}},j=async M=>{try{a(null);const D=await me.auth.sendCode(M),$=await D.json();return D.ok?{success:!0,type:$.type}:{success:!1,error:$.error||"发送验证码失败",waitSeconds:$.waitSeconds}}catch(D){return console.error("Send code error:",D),{success:!1,error:"网络错误,请稍后再试"}}},f=async(M,D)=>{try{a(null);const $=await me.auth.verifyCode(M,D),T=await $.json();return $.ok?(c(T.token),l(T.user),p(!1),localStorage.setItem("auth-token",T.token),await gn(),await E(),{success:!0}):(a(T.error||"验证失败"),{success:!1,error:T.error||"验证失败"})}catch($){return console.error("Verify code error:",$),{success:!1,error:"网络错误,请稍后再试"}}},w=async(M,D)=>{try{a(null);const $=await me.auth.login(M,D),T=await $.json();return $.ok?(c(T.token),l(T.user),localStorage.setItem("auth-token",T.token),await gn(),await E(),{success:!0}):(a(T.error||"登录失败"),{success:!1,error:T.error||"登录失败"})}catch($){console.error("Login error:",$);const T="网络错误,请稍后再试";return a(T),{success:!1,error:T}}},N=()=>{c(null),l(null),g({allowed:!0}),k(Sr),localStorage.removeItem("auth-token"),u&&me.auth.logout().catch(M=>{console.error("Logout endpoint error:",M)})},L=async()=>{if(!o)return{allowed:!0};try{const M=await me.auth.limitStatus();if(M.ok){const D=await M.json();return g(D),D}}catch(M){console.error("Error checking limit status:",M)}return{allowed:!0}},E=n.useCallback(async()=>{try{const M=await me.auth.featurePermissions();if(M.ok){const D=await M.json();D.featurePermissions&&k({...Sr,...D.featurePermissions})}}catch(M){console.error("Error refreshing feature permissions:",M)}},[]),S=n.useCallback(M=>v[M]!==!1,[v]);n.useEffect(()=>{o&&!m&&L()},[o,m]);const R={user:o,token:u,login:w,sendCode:j,verifyCode:f,logout:N,isLoading:m,needsSetup:s,smtpConfigured:t,error:h,isAdmin:o?.role==="admin"||o?.role==="super_admin",isSuperAdmin:o?.role==="super_admin",limitStatus:i,checkLimitStatus:L,setLimitStatus:g,featurePermissions:v,hasPermission:S,refreshFeaturePermissions:E};return e.jsx(xs.Provider,{value:R,children:r})},hi=/^[a-zA-Z0-9_-]+$/,xi=({onClose:r,onProjectCreated:o})=>{const[l,u]=n.useState(""),[c,m]=n.useState(""),[d,s]=n.useState(!1),[p,t]=n.useState(null),x=i=>i.trim()?hi.test(i.trim())?null:"项目名称只能包含字母、数字、连字符和下划线":"项目名称为必填项",h=async()=>{t(null);const i=x(l);if(i){t(i);return}s(!0);try{const g={name:l.trim()};c.trim()&&(g.githubUrl=c.trim());const v=await me.createWorkspace(g),k=await v.json();if(!v.ok)throw new Error(k.error||"Failed to create project");o&&o(k.project),r()}catch(g){console.error("Error creating project:",g),t(g.message||"Failed to create project")}finally{s(!1)}},a=i=>{i.key==="Enter"&&!d&&h()};return e.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-[60] p-0 sm:p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-none sm:rounded-lg shadow-xl w-full h-full sm:h-auto sm:max-w-md border-0 sm:border border-gray-200 dark:border-gray-700 overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:e.jsx(Tr,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"创建新项目"})]}),e.jsx("button",{onClick:r,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",disabled:d,children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-6 space-y-5",children:[p&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 flex items-start gap-3",children:[e.jsx(es,{className:"w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),e.jsx("div",{className:"flex-1",children:e.jsx("p",{className:"text-sm text-red-800 dark:text-red-200",children:p})})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:["项目名称 ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(ct,{type:"text",value:l,onChange:i=>u(i.target.value),onKeyDown:a,placeholder:"my-awesome-project",className:"w-full",autoFocus:!0}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"仅允许字母、数字、连字符和下划线"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"GitHub 链接(可选)"}),e.jsx(ct,{type:"text",value:c,onChange:i=>m(i.target.value),onKeyDown:a,placeholder:"https://github.com/user/repo",className:"w-full"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"留空以创建空项目,或输入公共仓库链接以克隆"})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-gray-200 dark:border-gray-700",children:[e.jsx(U,{variant:"outline",onClick:r,disabled:d,children:"取消"}),e.jsx(U,{onClick:h,disabled:d||!l.trim(),children:d?e.jsxs(e.Fragment,{children:[e.jsx(bt,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):"创建项目"})]})]})})};function gi({projects:r=[],onClose:o}){const{showAlert:l,showConfirm:u}=lt(),[c,m]=n.useState([]),[d,s]=n.useState(!0),[p,t]=n.useState(null),[x,h]=n.useState(""),a={};for(const b of r)b.agentInfo?.isAgent&&(a[b.agentInfo.agentName]=b.agentInfo.installedVersion);n.useEffect(()=>{i()},[]),n.useEffect(()=>{const b=j=>{j.key==="Escape"&&o()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[o]);const i=async()=>{try{s(!0);const b=await J("/api/agents");if(b.ok){const j=await b.json();m(j.agents||[])}else{const j=await b.json();l(j.error||"获取 Agent 列表失败",{variant:"error"})}}catch(b){l(b.message,{variant:"error"})}finally{s(!1)}},g=async(b,j=!1)=>{const f=b.dirName||b.name;t(f);try{const w=await J("/api/agents/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentName:f,force:j})}),N=await w.json();if(w.status===409&&N.conflict){t(null),await u("检测到本地 CLAUDE.md 已被修改,更新将覆盖本地改动,是否继续?",{title:"本地文件冲突",confirmText:"强制更新",variant:"warning"})&&await g(b,!0);return}w.ok?(l(`Agent "${b.display_name||b.name}" ${j?"更新":"使用"}成功!项目已创建,Skills 和 MCP 服务已安装。`,{title:j?"更新成功":"使用成功"}),window.refreshProjects?.(),window.refreshMcpServers?.(),i()):l(N.error||"使用失败",{variant:"error"})}catch(w){l(w.message,{variant:"error"})}finally{t(null)}},v=b=>{const j=b.dirName||b.name,f=a[j];return f?f===b.version?{state:"up_to_date",installedVersion:f}:{state:"update_available",installedVersion:f,latestVersion:b.version}:{state:"not_installed"}},k=n.useMemo(()=>{if(!x.trim())return c;const b=x.toLowerCase();return c.filter(j=>(j.display_name||j.name||"").toLowerCase().includes(b)||(j.description||"").toLowerCase().includes(b))},[c,x]);return e.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",onClick:o,children:e.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-2xl w-full max-w-lg flex flex-col max-h-[80vh]",onClick:b=>b.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center",children:e.jsx(It,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"使用共享项目模板"}),!d&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.length," 个可用"]})]})]}),e.jsx("button",{onClick:o,className:"w-7 h-7 rounded-md flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:e.jsx(Ge,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"px-4 py-3 border-b border-border",children:e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground"}),e.jsx("input",{type:"text",placeholder:"搜索共享项目模板...",value:x,onChange:b=>h(b.target.value),className:"w-full h-8 pl-9 pr-3 text-sm bg-muted/50 border border-border rounded-md focus:outline-none focus:ring-1 focus:ring-primary/30 focus:bg-background text-foreground placeholder:text-muted-foreground",autoFocus:!0})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-2",children:d?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(st,{className:"w-5 h-5 animate-spin mr-2"}),"加载中..."]}):c.length===0?e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx(It,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"暂无可用共享项目模板"})]}):k.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Mt,{className:"w-6 h-6 mx-auto mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"未找到匹配的共享项目模板"})]}):k.map(b=>{const j=b.dirName||b.name,f=v(b),w=p===j;return e.jsxs("div",{className:"flex items-center gap-3 p-3 border border-border rounded-lg hover:bg-accent/50 transition-colors",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center flex-shrink-0",children:e.jsx(It,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium text-sm text-foreground truncate",children:b.display_name||b.name}),e.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:["v",b.version]}),f.state==="update_available"&&e.jsxs(nt,{className:"text-xs bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400 border-amber-200 dark:border-amber-700 hover:bg-amber-200 dark:hover:bg-amber-900/50 flex-shrink-0",children:["有更新 v",f.latestVersion]}),f.state==="up_to_date"&&e.jsx(nt,{className:"text-xs bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 border-green-200 dark:border-green-700 hover:bg-green-200 dark:hover:bg-green-900/50 flex-shrink-0",children:"已使用"})]}),b.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:b.description}),e.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[b.skills?.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[b.skills.length," 个 Skill"]}),b.mcps?.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[b.mcps.length," 个 MCP"]})]})]}),e.jsx(U,{size:"sm",variant:f.state==="not_installed"?"default":"outline",onClick:()=>g(b),disabled:w||f.state==="up_to_date",className:"text-xs h-7 px-2.5 flex-shrink-0",children:w?e.jsx(st,{className:"w-3 h-3 animate-spin"}):f.state==="up_to_date"?"已是最新":f.state==="update_available"?e.jsxs(e.Fragment,{children:[e.jsx(_t,{className:"w-3 h-3 mr-1"}),"更新"]}):e.jsxs(e.Fragment,{children:[e.jsx(_t,{className:"w-3 h-3 mr-1"}),"使用"]})})]},j)})}),e.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:!d&&x.trim()?`${k.length} / ${c.length} 个 共享项目模板`:d?"":`共 ${c.length} 个 共享项目模板`}),e.jsx(U,{variant:"outline",size:"sm",onClick:o,className:"text-xs h-7",children:"关闭"})]})]})})}function qn({projects:r=[],onClose:o,onSubmitted:l,initialProjectKey:u="",prefillData:c=null}){const{showAlert:m}=lt(),[d,s]=n.useState(u),[p,t]=n.useState(""),[x,h]=n.useState(""),[a,i]=n.useState(""),[g,v]=n.useState(!1),[k,b]=n.useState({hasClaudeMd:!1,skills:[],mcps:[],refFiles:[],gitRepos:[]}),[j,f]=n.useState(new Set),[w,N]=n.useState(new Set),[L,E]=n.useState(new Set),[S,R]=n.useState(new Set),[M,D]=n.useState(!1),[$,T]=n.useState(""),[X,_]=n.useState({files:[],truncated:!1}),[te,ne]=n.useState(!1),[Y,le]=n.useState(new Set),[de,fe]=n.useState(""),[Ee,ye]=n.useState(!1),[Me,Fe]=n.useState(null),[ie,Se]=n.useState(null),[He,Be]=n.useState(""),[he,Oe]=n.useState(!1),De=n.useRef(null),Ye=n.useRef(null),Xe=r.filter(K=>K.fullPath);n.useEffect(()=>{if(d){Je(d),Ce(d);const K=Xe.find(B=>B.name===d);if(K){const B=K.fullPath.split("/").filter(Boolean).pop()||"";t(B),h(K.displayName||K.name)}else if(c?.projectPath){const B=c.projectPath.split("/").filter(Boolean).pop()||"";t(B)}}else _({files:[],truncated:!1}),le(new Set),fe(""),ye(!1)},[d]),n.useEffect(()=>{c?.projectKey&&(s(c.projectKey),Ye.current={displayName:c.displayName||"",description:c.description||"",updateNotes:c.updateNotes||"",skills:c.skills||[],mcps:c.mcps||[],files:c.files||[],gitRepos:c.gitRepos||[]})},[c]),n.useEffect(()=>{if(De.current&&clearTimeout(De.current),!p||!/^[a-zA-Z0-9_-]{1,100}$/.test(p)){Fe(null),Se(null),Oe(!1);return}return Oe(!0),De.current=setTimeout(async()=>{try{const K=await J(`/api/agents/check-name/${encodeURIComponent(p)}`);if(K.ok){const B=await K.json();Fe(B.existing),Se(B.pendingConflict);const C=Ye.current;C?(B.existing?(x||h(B.existing.display_name||""),C.updateNotes&&Be(C.updateNotes),!a&&B.existing.description&&i(B.existing.description)):(C.displayName&&!x&&h(C.displayName),C.description&&!a&&i(C.description)),Ye.current=null):B.existing&&!a&&i(B.existing.description||"")}}catch{Fe(null),Se(null)}finally{Oe(!1)}},400),()=>{De.current&&clearTimeout(De.current)}},[p]);const Je=async K=>{if(K)try{const B=await J(`/api/agents/preview?projectKey=${encodeURIComponent(K)}`);if(B.ok){const C=await B.json();b(C);const V=Ye.current;V?(V.skills?.length>0?f(new Set(V.skills)):f(new Set((C.skills||[]).map(z=>z.name))),V.mcps?.length>0?N(new Set(V.mcps)):N(new Set((C.mcps||[]).map(z=>z.name))),E(new Set((C.refFiles||[]).filter(z=>z.exists).map(z=>z.path))),V.gitRepos?.length>0?R(new Set(V.gitRepos.map(z=>z.name))):R(new Set((C.gitRepos||[]).map(z=>z.name))),V.files?.length>0&&(le(new Set(V.files)),ye(!0))):(f(new Set((C.skills||[]).map(z=>z.name))),N(new Set((C.mcps||[]).map(z=>z.name))),E(new Set((C.refFiles||[]).filter(z=>z.exists).map(z=>z.path))),R(new Set((C.gitRepos||[]).map(z=>z.name))))}}catch{b({hasClaudeMd:!1,skills:[],mcps:[],refFiles:[],gitRepos:[]}),f(new Set),N(new Set),E(new Set),R(new Set)}},Ce=async K=>{ne(!0),le(new Set),fe(""),ye(!1);try{const B=await J(`/api/agents/project-files?projectKey=${encodeURIComponent(K)}`);if(B.ok){const C=await B.json();_(C)}else _({files:[],truncated:!1})}catch{_({files:[],truncated:!1})}finally{ne(!1)}},_e=K=>K<1024?`${K} B`:K<1024*1024?`${(K/1024).toFixed(1)} KB`:`${(K/(1024*1024)).toFixed(1)} MB`,$e=n.useMemo(()=>{const K=new Set((k.refFiles||[]).map(C=>C.path));let B=(X.files||[]).filter(C=>!K.has(C.path));if(de.trim()){const C=de.toLowerCase();B=B.filter(V=>V.path.toLowerCase().includes(C))}return B},[X.files,k.refFiles,de]),ze=async()=>{if(d){v(!0);try{const K=await J("/api/agents/generate-description",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectKey:d,skills:[...j],mcps:[...w]})}),B=await K.json();K.ok?i(B.description||""):m(B.error||"生成失败",{variant:"error"})}catch(K){m(K.message,{variant:"error"})}finally{v(!1)}}},Re=K=>/^[a-zA-Z0-9_-]{1,100}$/.test(K)?(T(""),!0):(T("只能包含字母、数字、连字符和下划线,1-100 字符"),!1),Ze=async()=>{if(!d){m("请选择一个项目",{variant:"warning"});return}if(!Re(p))return;if(!x.trim()){m("请填写显示名称",{variant:"warning"});return}if(!(!Xe.find(B=>B.name===d)&&!c)){D(!0);try{const B=new Date().toISOString(),C=(k.skills||[]).filter(be=>j.has(be.name)),V=(k.mcps||[]).filter(be=>w.has(be.name)),z=(k.gitRepos||[]).filter(be=>S.has(be.name)),re=C.map(be=>` - name: "${be.name}"
2
+ repo: "${be.localPath||be.repo||""}"`).join(`
3
+ `),G=V.map(be=>` - name: "${be.name}"
4
+ repo: "${be.repo||""}"`).join(`
5
+ `),ae=z.map(be=>` - name: "${be.name}"
6
+ repo: "${be.repo}"
7
+ branch: "${be.branch}"`).join(`
8
+ `),ce=[...new Set([...L,...Y])],Pe=[" - CLAUDE.md",...ce.map(be=>` - ${be}`)].join(`
9
+ `),xe=[`name: "${p}"`,`display_name: "${x}"`,"description: |",a.split(`
10
+ `).map(be=>` ${be}`).join(`
11
11
  `)||" (no description)",'version: "1.0.0"',`created_at: "${B}"`,`updated_at: "${B}"`,C.length>0?`skills:
12
12
  ${re}`:"skills: []",V.length>0?`mcps:
13
- ${Y}`:"mcps: []",I.length>0?`git_repos:
14
- ${ie}`:"git_repos: []",`files:
15
- ${Ae}`].join(`
16
- `),Le=await J("/api/agents/submit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentName:p,displayName:x,description:a,projectKey:d,agentYaml:Xe,refFiles:ce,...Me?{updateNotes:He||void 0}:{}})}),oe=await Le.json();Le.ok?(await m((Qe?"更新已提交!本次更新将在管理员审核通过后公开生效。":"分享成功!项目将在管理员审核通过后公开可见。")+`
17
-
18
- 审核结果请在 设置 → 共享项目模板 → 我的提交记录 中查看。`,{title:Qe?"更新已提交":"提交成功",variant:"info"}),l?.({submissionId:oe.submissionId,message:oe.message})):m(oe.error||"提交失败",{variant:"error"})}catch(B){m(B.message,{variant:"error"})}finally{E(!1)}}},Qe=!!Me;return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-lg mx-4 flex flex-col max-h-[90vh]",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_t,{className:"w-5 h-5 text-blue-500"}),e.jsx("h2",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:Qe?"更新项目模板":"分享项目模板"})]}),e.jsx("button",{onClick:o,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto flex-1",children:[c&&!c.isExistingProject?e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"项目路径"}),e.jsx("div",{className:"w-full border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2 text-sm bg-gray-50 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:Ue(c.projectPath)})]}):e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"选择项目"}),e.jsxs("select",{value:d,onChange:K=>s(K.target.value),className:"w-full border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2 text-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[e.jsx("option",{value:"",children:"-- 选择项目 --"}),Te.map(K=>e.jsx("option",{value:K.name,children:K.displayName||K.name},K.name))]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["项目标识名 ",e.jsx("span",{className:"text-gray-400 text-xs",children:"(英文,用于目录名)"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ct,{value:p,readOnly:!0,placeholder:"e.g. my-agent",className:"text-sm bg-gray-50 dark:bg-gray-800/50 cursor-default"}),he&&e.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:e.jsx(bt,{className:"w-4 h-4 text-gray-400 animate-spin"})})]}),$&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:$})]}),he&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700",children:[e.jsx(bt,{className:"w-3.5 h-3.5 text-gray-400 animate-spin flex-shrink-0"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"正在检查项目信息..."})]}),!he&&Qe&&e.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-700",children:[e.jsx(en,{className:"w-4 h-4 text-blue-500 flex-shrink-0 mt-0.5"}),e.jsxs("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:[e.jsx("span",{className:"font-medium",children:"更新模式"}),":仓库中已存在项目「",Me.display_name,"」,当前版本 v",Me.version,"。提交将作为版本更新处理。"]})]}),!he&&ae&&e.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700",children:[e.jsx(Bt,{className:"w-4 h-4 text-amber-500 flex-shrink-0 mt-0.5"}),e.jsxs("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["用户 ",ae.username," 已在 ",new Date(ae.submitted_at).toLocaleString("zh-CN",{dateStyle:"short",timeStyle:"short"})," 提交了同名项目的审核,建议更换标识名以避免冲突。"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"显示名称"}),e.jsx(ct,{value:x,onChange:K=>h(K.target.value),placeholder:"My Project",className:"text-sm",disabled:he})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"描述"}),e.jsxs("button",{type:"button",onClick:Ie,disabled:!d||g||he,className:"flex items-center gap-1 text-xs text-blue-500 hover:text-blue-600 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[e.jsx(On,{className:"w-3 h-3"}),g?"AI 生成中...":"AI 生成"]})]}),e.jsx("textarea",{value:a,onChange:K=>i(K.target.value),placeholder:"描述这个项目的用途和功能...",rows:3,disabled:he,className:"w-full border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2 text-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none disabled:opacity-50 disabled:cursor-not-allowed"})]}),Qe&&e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["更新说明 ",e.jsx("span",{className:"text-gray-400 text-xs",children:"(描述本次更新的内容)"})]}),e.jsx("textarea",{value:He,onChange:K=>Be(K.target.value),placeholder:"例如:修复了 XXX 问题,新增了 YYY 功能...",rows:2,className:"w-full border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2 text-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none"})]}),d&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-3 bg-gray-50 dark:bg-gray-800/50",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:"将包含的内容"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-700 dark:text-gray-300",children:[e.jsx(ur,{className:"w-3.5 h-3.5 text-blue-500 flex-shrink-0"}),e.jsxs("span",{children:["agent.yaml ",e.jsx("span",{className:"text-gray-400",children:"(自动生成)"})]})]}),e.jsxs("div",{className:`flex items-center gap-2 text-xs ${k.hasClaudeMd?"text-gray-700 dark:text-gray-300":"text-gray-400 dark:text-gray-600"}`,children:[e.jsx(ur,{className:`w-3.5 h-3.5 flex-shrink-0 ${k.hasClaudeMd?"text-green-500":"text-gray-300"}`}),e.jsxs("span",{children:["CLAUDE.md ",!k.hasClaudeMd&&e.jsx("span",{className:"text-amber-500",children:"(未找到)"})]})]}),k.skills?.length>0&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("p",{className:"text-[11px] text-gray-400 dark:text-gray-500 mb-1.5",children:["Skills ",e.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"(勾选需要包含的)"})]}),k.skills.map(K=>e.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-700 dark:text-gray-300 cursor-pointer py-0.5 hover:text-gray-900 dark:hover:text-gray-100",children:[e.jsx("input",{type:"checkbox",checked:j.has(K.name),onChange:B=>{const C=new Set(j);B.target.checked?C.add(K.name):C.delete(K.name),f(C)},className:"rounded text-purple-500 focus:ring-purple-400 focus:ring-offset-0"}),e.jsx(Cr,{className:"w-3.5 h-3.5 text-purple-500 flex-shrink-0"}),e.jsx("span",{children:K.name})]},K.name))]}),k.mcps?.length>0&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("p",{className:"text-[11px] text-gray-400 dark:text-gray-500 mb-1.5",children:["MCP 服务 ",e.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"(勾选需要包含的)"})]}),k.mcps.map(K=>e.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-700 dark:text-gray-300 cursor-pointer py-0.5 hover:text-gray-900 dark:hover:text-gray-100",children:[e.jsx("input",{type:"checkbox",checked:w.has(K.name),onChange:B=>{const C=new Set(w);B.target.checked?C.add(K.name):C.delete(K.name),S(C)},className:"rounded text-orange-500 focus:ring-orange-400 focus:ring-offset-0"}),e.jsx(tn,{className:"w-3.5 h-3.5 text-orange-500 flex-shrink-0"}),e.jsx("span",{children:K.name})]},K.name))]}),k.gitRepos?.length>0&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("p",{className:"text-[11px] text-gray-400 dark:text-gray-500 mb-1.5",children:["Git 仓库依赖 ",e.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"(勾选需要包含的子目录 git 仓库)"})]}),k.gitRepos.map(K=>e.jsxs("label",{className:"flex items-start gap-2 text-xs text-gray-700 dark:text-gray-300 cursor-pointer py-0.5 hover:text-gray-900 dark:hover:text-gray-100",children:[e.jsx("input",{type:"checkbox",checked:N.has(K.name),onChange:B=>{const C=new Set(N);B.target.checked?C.add(K.name):C.delete(K.name),R(C)},className:"rounded text-emerald-500 focus:ring-emerald-400 focus:ring-offset-0 mt-0.5"}),e.jsx(rn,{className:"w-3.5 h-3.5 text-emerald-500 flex-shrink-0 mt-0.5"}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium",children:K.name}),e.jsxs("span",{className:"text-gray-400 dark:text-gray-500 text-[10px] block truncate",children:[K.repo," (",K.branch,")"]})]})]},K.name))]}),k.refFiles?.length>0&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("p",{className:"text-[11px] text-gray-400 dark:text-gray-500 mb-1.5",children:["CLAUDE.md 引用文件 ",e.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"(勾选需要包含的)"})]}),k.refFiles.map(K=>e.jsxs("label",{className:`flex items-center gap-2 text-xs cursor-pointer py-0.5 ${K.exists?"text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100":"text-gray-400 dark:text-gray-600"}`,children:[e.jsx("input",{type:"checkbox",checked:z.has(K.path),disabled:!K.exists,onChange:B=>{const C=new Set(z);B.target.checked?C.add(K.path):C.delete(K.path),D(C)},className:"rounded text-blue-500 focus:ring-blue-400 focus:ring-offset-0 disabled:opacity-40"}),e.jsx(ur,{className:`w-3.5 h-3.5 flex-shrink-0 ${K.exists?"text-blue-400":"text-gray-300"}`}),e.jsx("span",{className:"truncate",children:K.path}),!K.exists&&e.jsx("span",{className:"text-amber-500 flex-shrink-0",children:"(未找到)"})]},K.path))]}),e.jsxs("div",{className:"mt-2 pt-2 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("button",{type:"button",onClick:()=>ge(!Ee),className:"flex items-center justify-between w-full text-[11px] text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400 transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[Ee?e.jsx(Vt,{className:"w-3 h-3"}):e.jsx(Br,{className:"w-3 h-3"}),"项目文件 ",e.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"(手动选择需要包含的)"})]}),G.size>0&&e.jsxs("span",{className:"text-[10px] bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 px-1.5 py-0.5 rounded-full",children:["已选 ",G.size]})]}),Ee&&e.jsxs("div",{className:"mt-1.5 space-y-1.5",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"w-3 h-3 text-gray-400 absolute left-2 top-1/2 -translate-y-1/2"}),e.jsx("input",{type:"text",value:de,onChange:K=>fe(K.target.value),placeholder:"搜索文件名...",className:"w-full pl-6 pr-2 py-1 text-[11px] border border-gray-200 dark:border-gray-700 rounded bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 focus:outline-none focus:ring-1 focus:ring-blue-500"})]}),te?e.jsx("div",{className:"flex items-center justify-center py-3",children:e.jsx(bt,{className:"w-3.5 h-3.5 text-gray-400 animate-spin"})}):$e.length===0?e.jsx("p",{className:"text-[11px] text-gray-400 text-center py-2",children:"无匹配文件"}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 cursor-pointer py-0.5 border-b border-gray-100 dark:border-gray-700 mb-0.5",children:[e.jsx("input",{type:"checkbox",checked:$e.length>0&&$e.every(K=>G.has(K.path)),onChange:K=>{const B=new Set(G);K.target.checked?$e.forEach(C=>B.add(C.path)):$e.forEach(C=>B.delete(C.path)),le(B)},className:"rounded text-teal-500 focus:ring-teal-400 focus:ring-offset-0"}),e.jsxs("span",{children:["全选(",$e.length," 个文件)"]})]}),e.jsx("div",{className:"max-h-48 overflow-y-auto space-y-0.5",children:$e.map(K=>e.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-700 dark:text-gray-300 cursor-pointer py-0.5 hover:text-gray-900 dark:hover:text-gray-100",children:[e.jsx("input",{type:"checkbox",checked:G.has(K.path),onChange:B=>{const C=new Set(G);B.target.checked?C.add(K.path):C.delete(K.path),le(C)},className:"rounded text-teal-500 focus:ring-teal-400 focus:ring-offset-0"}),e.jsx(ur,{className:"w-3.5 h-3.5 text-teal-400 flex-shrink-0"}),e.jsx("span",{className:"truncate flex-1 min-w-0",children:K.path}),e.jsx("span",{className:"text-[10px] text-gray-400 flex-shrink-0",children:Re(K.size)})]},K.path))})]}),X.truncated&&e.jsx("p",{className:"text-[10px] text-amber-500",children:"项目文件较多,仅显示前 500 个。请使用搜索缩小范围。"})]})]})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 p-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx(U,{variant:"outline",size:"sm",onClick:o,disabled:M,children:"取消"}),e.jsx(U,{size:"sm",onClick:Ze,disabled:M||!d||he,className:"flex items-center gap-1.5",children:M?e.jsx("span",{children:"提交中..."}):e.jsxs(e.Fragment,{children:[e.jsx(Ht,{className:"w-3.5 h-3.5"}),Qe?"更新":"分享"]})})]})]})})}function gs({sessionId:r,projectName:o,sessionTitle:l,isOpen:u,onClose:c}){const{showAlert:m}=lt(),[d,s]=n.useState(!1),[p,t]=n.useState(!1),[x,h]=n.useState(!1),[a,i]=n.useState(null),[g,v]=n.useState(!1),[k,b]=n.useState("realtime"),[j,f]=n.useState(!1);n.useEffect(()=>{!u||!r||(v(!1),i(null),w())},[u,r]);const w=async()=>{s(!0);try{const T=await J(`/api/share/info/${r}`);if(T.ok){const X=await T.json();i(X)}else T.status===404&&(v(!0),i(null))}catch{v(!0)}finally{s(!1)}},S=async()=>{t(!0);try{const T=await J("/api/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:r,projectName:o,mode:k,title:l})});if(!T.ok){const _=await T.json().catch(()=>({}));await m(_.error||"分享失败",{title:"错误",variant:"error"});return}const X=await T.json();i({mode:k,shareUrl:X.shareUrl,status:"active"}),v(!1)}catch{await m("网络错误,请重试",{title:"错误",variant:"error"})}finally{t(!1)}},z=async()=>{h(!0);try{if(!(await J(`/api/share/${r}`,{method:"DELETE"})).ok){await m("操作失败",{title:"错误",variant:"error"});return}i(X=>({...X,status:"stopped"}))}catch{await m("网络错误,请重试",{title:"错误",variant:"error"})}finally{h(!1)}},D=async()=>{t(!0);try{const T=await J("/api/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:r,projectName:o,mode:"static",title:l})});if(!T.ok){const _=await T.json().catch(()=>({}));await m(_.error||"操作失败",{title:"错误",variant:"error"});return}const X=await T.json();i({mode:"static",shareUrl:X.shareUrl,status:"active"})}catch{await m("网络错误,请重试",{title:"错误",variant:"error"})}finally{t(!1)}},N=()=>{if(!a?.shareUrl)return;const T=`${window.location.origin}${a.shareUrl}`,X=()=>{f(!0),setTimeout(()=>f(!1),2e3)};navigator.clipboard?.writeText?navigator.clipboard.writeText(T).then(X).catch(()=>R(T,X)):R(T,X)},R=(T,X)=>{const _=document.createElement("textarea");_.value=T,_.style.cssText="position:fixed;top:-9999px;left:-9999px",document.body.appendChild(_),_.focus(),_.select();try{document.execCommand("copy"),X()}catch{}document.body.removeChild(_)};if(!u)return null;const M=a?.status==="active",E=a?.status==="stopped",$=a?.shareUrl?`${window.location.origin}${a.shareUrl}`:"";return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-md mx-4 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Cn,{className:"w-5 h-5 text-blue-500"}),e.jsx("h2",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:"分享会话"})]}),e.jsx("button",{onClick:c,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500",children:e.jsx(Ge,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"p-4 space-y-4",children:d?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(bt,{className:"w-6 h-6 animate-spin text-gray-400"})}):M?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${a.mode==="realtime"?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"}`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current"}),a.mode==="realtime"?"实时共享":"静态快照"]}),e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:"已开启"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 min-w-0 bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2",children:e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 truncate font-mono",children:$})}),e.jsx("button",{onClick:N,className:"flex-shrink-0 p-2 rounded-lg border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 text-gray-600 dark:text-gray-400",title:"复制链接",children:j?e.jsx(pr,{className:"w-4 h-4 text-green-500"}):e.jsx(Bn,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex gap-2",children:[a.mode==="realtime"&&e.jsxs("button",{onClick:D,disabled:p,className:"flex items-center gap-1.5 px-3 py-2 text-sm rounded-lg border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300 disabled:opacity-50",children:[p?e.jsx(bt,{className:"w-4 h-4 animate-spin"}):e.jsx(st,{className:"w-4 h-4"}),"生成静态快照"]}),e.jsxs("button",{onClick:z,disabled:x,className:"flex items-center gap-1.5 px-3 py-2 text-sm rounded-lg border border-red-200 dark:border-red-800 hover:bg-red-50 dark:hover:bg-red-900/20 text-red-600 dark:text-red-400 disabled:opacity-50",children:[x?e.jsx(bt,{className:"w-4 h-4 animate-spin"}):e.jsx(Ta,{className:"w-4 h-4"}),"停止共享"]})]})]}):e.jsxs("div",{className:"space-y-4",children:[E&&e.jsx("div",{className:"flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 rounded-lg text-sm text-gray-500 dark:text-gray-400",children:"该会话分享已关闭,可重新开启。"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"选择分享模式"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:`flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${k==="realtime"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:[e.jsx("input",{type:"radio",value:"realtime",checked:k==="realtime",onChange:()=>b("realtime"),className:"mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:"实时共享"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:"访问者刷新页面即可看到最新对话内容"})]})]}),e.jsxs("label",{className:`flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${k==="static"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:[e.jsx("input",{type:"radio",value:"static",checked:k==="static",onChange:()=>b("static"),className:"mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:"静态快照"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:"仅分享此刻的对话内容,后续更新不会同步"})]})]})]})]}),e.jsxs("button",{onClick:S,disabled:p,className:"w-full flex items-center justify-center gap-2 py-2.5 px-4 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 text-white text-sm font-medium rounded-lg transition-colors",children:[p?e.jsx(bt,{className:"w-4 h-4 animate-spin"}):e.jsx(Cn,{className:"w-4 h-4"}),p?"处理中...":"开始分享"]})]})})]})})}const No=(r,o)=>{const l=new Date(r),u=o;if(isNaN(l.getTime()))return"Unknown";const c=u-l,m=Math.floor(c/1e3),d=Math.floor(c/(1e3*60)),s=Math.floor(c/(1e3*60*60)),p=Math.floor(c/(1e3*60*60*24));return m<60?"Just now":d===1?"1 min ago":d<60?`${d} mins ago`:s===1?"1 hour ago":s<24?`${s} hours ago`:p===1?"1 day ago":p<7?`${p} days ago`:l.toLocaleDateString()};function So({projects:r,selectedProject:o,selectedSession:l,onProjectSelect:u,onSessionSelect:c,onNewSession:m,onSessionDelete:d,onProjectDelete:s,isLoading:p,onRefresh:t,onShowSettings:x,onShowAdmin:h,isPWA:a,isMobile:i,onToggleSidebar:g}){const{showAlert:v,showConfirm:k}=lt(),{user:b,isAdmin:j,hasPermission:f}=Ot(),[w,S]=n.useState(new Set),[z,D]=n.useState(null),[N,R]=n.useState(!1),[M,E]=n.useState(!1),[$,T]=n.useState(""),[X,_]=n.useState({}),[te,ne]=n.useState({}),[G,le]=n.useState(new Set),[de,fe]=n.useState(new Date),[Ee,ge]=n.useState("name"),[Me,Fe]=n.useState(!1),[ae,Ne]=n.useState(null),[He,Be]=n.useState(""),[he,Oe]=n.useState({}),[De,Ye]=n.useState({}),[Te,Je]=n.useState(null),[Ce,Re]=n.useState(""),[$e,Ie]=n.useState(!1),[ze,Ze]=n.useState(""),[Qe,K]=n.useState(""),[B,C]=n.useState(()=>{try{const O=localStorage.getItem("starredProjects");return O?new Set(JSON.parse(O)):new Set}catch(O){return console.error("Error loading starred projects:",O),new Set}});n.useEffect(()=>{fetch("/api/version").then(O=>O.json()).then(O=>K(O.version||"")).catch(()=>{})},[]);const V=O=>se=>{se.target.closest(".overflow-y-auto")||se.target.closest("[data-scroll-container]")||(se.preventDefault(),se.stopPropagation(),O())};n.useEffect(()=>{const O=setInterval(()=>{fe(new Date)},6e4);return()=>clearInterval(O)},[]),n.useEffect(()=>{ne({}),le(new Set)},[r]),n.useEffect(()=>{l&&o&&S(O=>new Set([...O,o.name]))},[l,o]),n.useEffect(()=>{if(r.length>0&&!p){const O=new Set;r.forEach(se=>{se.sessions&&se.sessions.length>=0&&O.add(se.name)}),le(O)}},[r,p]),n.useEffect(()=>{const O=()=>{try{const ke=localStorage.getItem("claude-settings");if(ke){const Z=JSON.parse(ke);ge(Z.projectSortOrder||"name")}}catch(ke){console.error("Error loading sort order:",ke)}};O();const se=ke=>{ke.key==="claude-settings"&&O()};window.addEventListener("storage",se);const je=setInterval(()=>{document.hasFocus()&&O()},1e3);return()=>{window.removeEventListener("storage",se),clearInterval(je)}},[]);const I=O=>{const se=new Set;w.has(O)||se.add(O),S(se)},re=(O,se)=>{c({...O,__projectName:se})},Y=O=>{const se=new Set(B);se.has(O)?se.delete(O):se.add(O),C(se);try{localStorage.setItem("starredProjects",JSON.stringify([...se]))}catch(je){console.error("Error saving starred projects:",je)}},ie=O=>B.has(O),ce=O=>[...O.sessions||[],...te[O.name]||[]].map(je=>({...je,__provider:"claude"})).sort((je,ke)=>new Date(ke.lastActivity)-new Date(je.lastActivity)),Ae=O=>{const se=ce(O);return se.length===0?O.lastActivity?new Date(O.lastActivity):O.createdAt?new Date(O.createdAt):new Date(0):se.reduce((ke,Z)=>{const We=new Date(Z.lastActivity);return We>ke?We:ke},new Date(0))},Xe=[...r].sort((O,se)=>{const je=ie(O.name),ke=ie(se.name);if(je&&!ke)return-1;if(!je&&ke)return 1;if(Ee==="date")return Ae(se)-Ae(O);{const Z=O.displayName||O.name,We=se.displayName||se.name;return Z.localeCompare(We)}}),Le=O=>{D(O.name),T(O.displayName)},oe=()=>{D(null),T("")},ye=async O=>{try{(await me.renameProject(O,$)).ok?window.refreshProjects?window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(se){console.error("Error renaming project:",se)}D(null),T("")},at=async(O,se,je="claude")=>{if(await k("确定要删除此会话吗?此操作不可撤销。",{title:"删除会话",variant:"danger",confirmText:"确认删除"}))try{console.log("[Sidebar] Deleting session:",{projectName:O,sessionId:se,provider:je});const Z=await me.deleteSession(O,se);if(console.log("[Sidebar] Delete response:",{ok:Z.ok,status:Z.status}),Z.ok)console.log("[Sidebar] Session deleted successfully, calling callback"),d?d(se):console.warn("[Sidebar] No onSessionDelete callback provided");else{const We=await Z.text();console.error("[Sidebar] Failed to delete session:",{status:Z.status,error:We}),v("删除会话失败,请重试。",{variant:"error"})}}catch(Z){console.error("[Sidebar] Error deleting session:",Z),v("删除会话出错,请重试。",{variant:"error"})}},Pe=async(O,se,je)=>{if(!je||!je.trim()){Ne(null),Be("");return}const ke=je.trim();Oe(Z=>({...Z,[se]:ke})),Ne(null),Be("");try{(await me.renameSession(O,se,ke)).ok||(Oe(We=>{const tt={...We};return delete tt[se],tt}),v("重命名会话失败,请重试。",{variant:"error"}))}catch(Z){console.error("[Sidebar] Error renaming session:",Z),Oe(We=>{const tt={...We};return delete tt[se],tt}),v("重命名会话出错,请重试。",{variant:"error"})}},dt=async(O,se)=>{if(await k(`确定要删除项目 "${se||O}" 吗?`,{title:"删除项目",subtitle:"此操作不可撤销",detail:"将同时删除:所有会话记录(JSONL 文件)和项目文件夹及其所有内容。",variant:"danger",confirmText:"确认删除"}))try{const ke=await me.deleteProject(O,!0);if(ke.ok)s&&s(O);else{const Z=await ke.json();console.error("Failed to delete project"),v(Z.error||"删除项目失败,请重试。",{variant:"error"})}}catch(ke){console.error("Error deleting project:",ke),v("删除项目出错,请重试。",{variant:"error"})}},gt=async O=>{if(!(!(O.sessionMeta?.hasMore!==!1)||X[O.name])){_(je=>({...je,[O.name]:!0}));try{const je=(O.sessions?.length||0)+(te[O.name]?.length||0),ke=await me.sessions(O.name,5,je);if(ke.ok){const Z=await ke.json();ne(We=>({...We,[O.name]:[...We[O.name]||[],...Z.sessions]})),Z.hasMore===!1&&(O.sessionMeta={...O.sessionMeta,hasMore:!1})}}catch(je){console.error("Error loading more sessions:",je)}finally{_(je=>({...je,[O.name]:!1}))}}},F=Xe.filter(O=>{if(!Ce.trim())return!0;const se=Ce.toLowerCase(),je=(O.displayName||O.name).toLowerCase(),ke=O.name.toLowerCase();return je.includes(se)||ke.includes(se)}),Se=O=>{u(O)};return e.jsxs(e.Fragment,{children:[N&&Hr.createPortal(e.jsx(xi,{onClose:()=>R(!1),onProjectCreated:O=>{window.refreshProjects?window.refreshProjects():window.location.reload()}}),document.body),M&&Hr.createPortal(e.jsx(gi,{projects:r,onClose:()=>E(!1)}),document.body),$e&&Hr.createPortal(e.jsx(qn,{projects:r,initialProjectKey:ze,onClose:()=>Ie(!1),onSubmitted:()=>Ie(!1)}),document.body),Te&&e.jsx(gs,{sessionId:Te.id,projectName:Te.projectName,sessionTitle:Te.summary,isOpen:!0,onClose:()=>Je(null)}),e.jsxs("div",{className:"h-full flex flex-col bg-card md:select-none",style:a&&i?{paddingTop:"44px"}:{},children:[e.jsxs("div",{className:"md:p-4 md:border-b md:border-border",children:[e.jsxs("div",{className:"hidden md:flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:"/logo.svg",className:"w-8 h-8",alt:Ve}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("h1",{className:"text-lg font-bold text-foreground",children:Ve}),e.jsx("span",{className:"text-xs text-muted-foreground/60",children:Qe?`v${Qe}`:""})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:fs})]})]}),g&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 px-0 hover:bg-accent transition-colors duration-200",onClick:g,title:"收起侧边栏",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})})]}),e.jsx("div",{className:"md:hidden p-3 border-b border-border",style:a&&i?{paddingTop:"16px"}:{},children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:"/logo.svg",className:"w-8 h-8",alt:Ve}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:Ve}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"项目"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{className:"w-8 h-8 rounded-md bg-background border border-border flex items-center justify-center active:scale-95 transition-all duration-150",onClick:async()=>{Fe(!0);try{await t()}finally{Fe(!1)}},disabled:Me,children:e.jsx(st,{className:`w-4 h-4 text-foreground ${Me?"animate-spin":""}`})}),e.jsx("button",{className:"w-8 h-8 rounded-md bg-background border border-border flex items-center justify-center active:scale-95 transition-all duration-150",onClick:()=>E(!0),children:e.jsx(_t,{className:"w-4 h-4 text-foreground"})}),f("create_project")&&e.jsx("button",{className:"w-8 h-8 rounded-md bg-primary text-primary-foreground flex items-center justify-center active:scale-95 transition-all duration-150",onClick:()=>R(!0),children:e.jsx(Tr,{className:"w-4 h-4"})})]})]})})]}),!p&&!i&&e.jsx("div",{className:"px-3 md:px-4 py-2 border-b border-border",children:e.jsxs("div",{className:"flex gap-2",children:[f("create_project")&&e.jsxs(U,{variant:"default",size:"sm",className:"flex-1 h-8 text-xs bg-primary hover:bg-primary/90 transition-all duration-200",onClick:()=>R(!0),title:"新建项目",children:[e.jsx(Tr,{className:"w-3.5 h-3.5 mr-1.5"}),"新建项目"]}),e.jsxs(U,{variant:"default",size:"sm",className:"flex-1 h-8 text-xs bg-primary hover:bg-primary/90 transition-all duration-200",onClick:()=>E(!0),title:"使用项目模板",children:[e.jsx(_t,{className:"w-3.5 h-3.5 mr-1.5"}),"使用项目模板"]}),e.jsx(U,{variant:"outline",size:"sm",className:"h-8 w-8 px-0 hover:bg-accent transition-colors duration-200 group",onClick:async()=>{Fe(!0);try{await t()}finally{Fe(!1)}},disabled:Me,title:"刷新项目和会话 (Ctrl+R)",children:e.jsx(st,{className:`w-3.5 h-3.5 ${Me?"animate-spin":""} group-hover:rotate-180 transition-transform duration-300`})})]})}),r.length>0&&!p&&e.jsx("div",{className:"px-3 md:px-4 py-2 border-b border-border",children:e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(ct,{type:"text",placeholder:"搜索项目...",value:Ce,onChange:O=>Re(O.target.value),className:"pl-9 h-9 text-sm bg-muted/50 border-0 focus:bg-background focus:ring-1 focus:ring-primary/20"}),Ce&&e.jsx("button",{onClick:()=>Re(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 p-1 hover:bg-accent rounded",children:e.jsx(Ge,{className:"w-3 h-3 text-muted-foreground"})})]})}),e.jsx(Jn,{className:"flex-1 md:px-2 md:py-3 overflow-y-auto overscroll-contain",children:e.jsx("div",{className:"md:space-y-1 pb-safe-area-inset-bottom",children:p?e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"加载项目中..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取您的项目和会话"})]}):r.length===0?e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx(Zt,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"未找到项目"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["请先创建一个项目,开始与 ",Ve," 进行交流"]})]}):F.length===0?e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx(Mt,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"无匹配的项目"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"尝试调整搜索条件"})]}):F.map(O=>{const se=w.has(O.name),je=o?.name===O.name,ke=ie(O.name);return e.jsxs("div",{className:"md:space-y-1",children:[e.jsxs("div",{className:"group md:group",children:[e.jsx("div",{className:"md:hidden",children:e.jsx("div",{className:ot("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",je&&"bg-primary/5 border-primary/20",ke&&!je&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:()=>{I(O.name)},onTouchEnd:V(()=>I(O.name)),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:ot("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",se?"bg-primary/10":"bg-muted"),children:se?e.jsx(Xr,{className:"w-4 h-4 text-primary"}):e.jsx(Zt,{className:"w-4 h-4 text-muted-foreground"})}),e.jsx("div",{className:"min-w-0 flex-1",children:z===O.name?e.jsx("input",{type:"text",value:$,onChange:Z=>T(Z.target.value),className:"w-full px-3 py-2 text-sm border-2 border-primary/40 focus:border-primary rounded-lg bg-background text-foreground shadow-sm focus:shadow-md transition-all duration-200 focus:outline-none",placeholder:"项目名称",autoFocus:!0,autoComplete:"off",onClick:Z=>Z.stopPropagation(),onKeyDown:Z=>{Z.key==="Enter"&&ye(O.name),Z.key==="Escape"&&oe()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-center justify-between min-w-0 flex-1",children:e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:O.displayName}),O.agentInfo?.isAgent&&e.jsx("span",{className:"flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full bg-blue-100 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400 font-medium leading-none",children:"Agent"})]})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(()=>{const Z=ce(O).length;return`${O.sessionMeta?.hasMore!==!1&&Z>=5?`${Z}+`:Z} 会话`})()})]})})]}),e.jsx("div",{className:"flex items-center gap-1",children:z===O.name?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"w-8 h-8 rounded-lg bg-green-500 dark:bg-green-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:Z=>{Z.stopPropagation(),ye(O.name)},children:e.jsx(pr,{className:"w-4 h-4 text-white"})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-gray-500 dark:bg-gray-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:Z=>{Z.stopPropagation(),oe()},children:e.jsx(Ge,{className:"w-4 h-4 text-white"})})]}):e.jsxs(e.Fragment,{children:[f("submit_agent")&&e.jsx("button",{className:"w-8 h-8 rounded-lg bg-blue-500/10 dark:bg-blue-900/30 flex items-center justify-center active:scale-90 transition-all duration-150 border border-blue-200 dark:border-blue-800",onClick:Z=>{Z.stopPropagation(),Ze(O.name),Ie(!0)},onTouchEnd:V(()=>{Ze(O.name),Ie(!0)}),title:"共享项目模板",children:e.jsx(Ht,{className:"w-4 h-4 text-blue-500"})}),e.jsx("button",{className:ot("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",ke?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:Z=>{Z.stopPropagation(),Y(O.name)},onTouchEnd:V(()=>Y(O.name)),title:ke?"从收藏中移除":"添加到收藏",children:e.jsx(yo,{className:ot("w-4 h-4 transition-colors",ke?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-red-500/10 dark:bg-red-900/30 flex items-center justify-center active:scale-90 border border-red-200 dark:border-red-800",onClick:Z=>{Z.stopPropagation(),dt(O.name,O.displayName)},onTouchEnd:V(()=>dt(O.name,O.displayName)),children:e.jsx(vt,{className:"w-4 h-4 text-red-600 dark:text-red-400"})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-primary/10 dark:bg-primary/20 flex items-center justify-center active:scale-90 border border-primary/20 dark:border-primary/30",onClick:Z=>{Z.stopPropagation(),Le(O)},onTouchEnd:V(()=>Le(O)),children:e.jsx(En,{className:"w-4 h-4 text-primary"})}),e.jsx("div",{className:"w-6 h-6 rounded-md bg-muted/30 flex items-center justify-center",children:se?e.jsx(Vt,{className:"w-3 h-3 text-muted-foreground"}):e.jsx(Br,{className:"w-3 h-3 text-muted-foreground"})})]})})]})})}),e.jsxs(U,{variant:"ghost",className:ot("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",je&&"bg-accent text-accent-foreground",ke&&!je&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:()=>{o?.name!==O.name&&Se(O),I(O.name)},onTouchEnd:V(()=>{o?.name!==O.name&&Se(O),I(O.name)}),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[se?e.jsx(Xr,{className:"w-4 h-4 text-primary flex-shrink-0"}):e.jsx(Zt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsx("div",{className:"min-w-0 flex-1 text-left",children:z===O.name?e.jsxs("div",{className:"space-y-1",children:[e.jsx("input",{type:"text",value:$,onChange:Z=>T(Z.target.value),className:"w-full px-2 py-1 text-sm border border-border rounded bg-background text-foreground focus:ring-2 focus:ring-primary/20",placeholder:"项目名称",autoFocus:!0,onKeyDown:Z=>{Z.key==="Enter"&&ye(O.name),Z.key==="Escape"&&oe()}}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",title:Ue(O.fullPath),children:Ue(O.fullPath)})]}):e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold truncate text-foreground",title:O.displayName,children:O.displayName}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[(()=>{const Z=ce(O).length;return O.sessionMeta?.hasMore!==!1&&Z>=5?`${Z}+`:Z})(),O.fullPath!==O.displayName&&e.jsxs("span",{className:"ml-1 opacity-60",title:Ue(O.fullPath),children:["• ",(()=>{const Z=Ue(O.fullPath);return Z.length>25?"..."+Z.slice(-22):Z})()]})]})]})})]}),e.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:z===O.name?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-6 h-6 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-900/20 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:Z=>{Z.stopPropagation(),ye(O.name)},children:e.jsx(pr,{className:"w-3 h-3"})}),e.jsx("div",{className:"w-6 h-6 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:Z=>{Z.stopPropagation(),oe()},children:e.jsx(Ge,{className:"w-3 h-3"})})]}):e.jsxs(e.Fragment,{children:[f("submit_agent")&&e.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-blue-50 dark:hover:bg-blue-900/20 flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:Z=>{Z.stopPropagation(),Ze(O.name),Ie(!0)},title:"共享项目模板",children:e.jsx(Ht,{className:"w-3 h-3 text-blue-500"})}),e.jsx("div",{className:ot("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",ke?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:Z=>{Z.stopPropagation(),Y(O.name)},title:ke?"从收藏中移除":"添加到收藏",children:e.jsx(yo,{className:ot("w-3 h-3 transition-colors",ke?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),e.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-accent flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:Z=>{Z.stopPropagation(),Le(O)},title:"重命名项目 (F2)",children:e.jsx(En,{className:"w-3 h-3"})}),e.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:Z=>{Z.stopPropagation(),dt(O.name,O.displayName)},title:"删除项目",children:e.jsx(vt,{className:"w-3 h-3 text-red-600 dark:text-red-400"})}),se?e.jsx(Vt,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"}):e.jsx(Br,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"})]})})]})]}),se&&e.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[G.has(O.name)?ce(O).length===0&&!X[O.name]?e.jsx("div",{className:"py-2 px-3 text-left",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:"还没有会话"})}):ce(O).map(Z=>{const We=new Date(Z.lastActivity),ft=Math.floor((de-We)/(1e3*60))<10,ht=he[Z.id]||Z.summary||"新会话",hr=Z.lastActivity,jt=Z.messageCount||0;return e.jsxs("div",{className:"group relative",children:[ft&&e.jsx("div",{className:"absolute left-0 top-1/2 transform -translate-y-1/2 -translate-x-1",children:e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"})}),e.jsx("div",{className:"md:hidden",children:e.jsx("div",{className:ot("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",l?.id===Z.id?"bg-primary/5 border-primary/20":ft?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:()=>{Se(O),re(Z,O.name)},onTouchEnd:V(()=>{Se(O),re(Z,O.name)}),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:ht}),e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx(Mr,{className:"w-2.5 h-2.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:No(hr,de)}),jt>0&&e.jsx(nt,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:jt})]})]}),e.jsx("button",{className:"w-5 h-5 rounded-md bg-red-50 dark:bg-red-900/20 flex items-center justify-center active:scale-95 transition-transform opacity-70 ml-1",onClick:et=>{et.stopPropagation(),at(O.name,Z.id)},onTouchEnd:V(()=>at(O.name,Z.id)),children:e.jsx(vt,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})]})})}),e.jsxs("div",{className:"hidden md:block",children:[e.jsx(U,{variant:"ghost",className:ot("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",l?.id===Z.id&&"bg-accent text-accent-foreground"),onClick:()=>re(Z,O.name),onTouchEnd:V(()=>re(Z,O.name)),children:e.jsx("div",{className:"flex items-start gap-2 min-w-0 w-full",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:ht}),e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx(Mr,{className:"w-2.5 h-2.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:No(hr,de)}),jt>0&&e.jsx(nt,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:jt})]})]})})}),e.jsx("div",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-all duration-200",children:ae===Z.id?e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",value:He,onChange:et=>Be(et.target.value),onKeyDown:et=>{et.stopPropagation(),et.key==="Enter"?Pe(O.name,Z.id,He):et.key==="Escape"&&(Ne(null),Be(""))},onClick:et=>et.stopPropagation(),className:"w-32 px-2 py-1 text-xs border border-border rounded bg-background focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),e.jsx("button",{className:"w-6 h-6 bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40 rounded flex items-center justify-center",onClick:et=>{et.stopPropagation(),Pe(O.name,Z.id,He)},title:"Save",children:e.jsx(pr,{className:"w-3 h-3 text-green-600 dark:text-green-400"})}),e.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:et=>{et.stopPropagation(),Ne(null),Be("")},title:"Cancel",children:e.jsx(Ge,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:et=>{et.stopPropagation(),Ne(Z.id),Be(he[Z.id]||Z.summary||"新会话")},title:"手动编辑会话名称",children:e.jsx(Xa,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{className:"w-6 h-6 bg-blue-50 hover:bg-blue-100 dark:bg-blue-900/20 dark:hover:bg-blue-900/40 rounded flex items-center justify-center",onClick:et=>{et.stopPropagation(),Je({id:Z.id,projectName:O.name,summary:he[Z.id]||Z.summary||null})},title:"分享会话",children:e.jsx(Cn,{className:"w-3 h-3 text-blue-600 dark:text-blue-400"})}),e.jsx("button",{className:"w-6 h-6 bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40 rounded flex items-center justify-center",onClick:et=>{et.stopPropagation(),at(O.name,Z.id)},title:"永久删除此会话",children:e.jsx(vt,{className:"w-3 h-3 text-red-600 dark:text-red-400"})})]})})]})]},Z.id)}):Array.from({length:3}).map((Z,We)=>e.jsx("div",{className:"p-2 rounded-md",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-3 h-3 bg-muted rounded-full animate-pulse mt-0.5"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("div",{className:"h-3 bg-muted rounded animate-pulse",style:{width:`${60+We*15}%`}}),e.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-1/2"})]})]})},We)),ce(O).length>0&&O.sessionMeta?.hasMore!==!1&&e.jsx(U,{variant:"ghost",size:"sm",className:"w-full justify-center gap-2 mt-2 text-muted-foreground",onClick:()=>gt(O),disabled:X[O.name],children:X[O.name]?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3 h-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),"加载中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Vt,{className:"w-3 h-3"}),"显示更多会话"]})}),e.jsx("div",{className:"md:hidden px-3 pb-2",children:e.jsxs("button",{className:"w-full h-8 bg-primary hover:bg-primary/90 text-primary-foreground rounded-md flex items-center justify-center gap-2 font-medium text-xs active:scale-[0.98] transition-all duration-150",onClick:()=>{Se(O),m(O)},children:[e.jsx(zt,{className:"w-3 h-3"}),"新会话"]})}),e.jsxs(U,{variant:"default",size:"sm",className:"hidden md:flex w-full justify-start gap-2 mt-1 h-8 text-xs font-medium bg-primary hover:bg-primary/90 text-primary-foreground transition-colors",onClick:()=>m(O),children:[e.jsx(zt,{className:"w-3 h-3"}),"新会话"]})]})]},O.name)})})}),e.jsxs("div",{className:"md:p-2 md:border-t md:border-border flex-shrink-0",children:[e.jsxs("div",{className:"md:hidden p-4 pb-20 border-t border-border/50 space-y-2",children:[e.jsxs("button",{className:"w-full h-14 bg-muted/50 hover:bg-muted/70 rounded-2xl flex items-center justify-start gap-4 px-4 active:scale-[0.98] transition-all duration-150",onClick:x,children:[e.jsx("div",{className:"w-10 h-10 rounded-2xl bg-background/80 flex items-center justify-center",children:e.jsx(Ut,{className:"w-5 h-5 text-muted-foreground"})}),e.jsx("span",{className:"text-lg font-medium text-foreground",children:"设置"})]}),j&&e.jsxs("button",{className:"w-full h-14 bg-muted/50 hover:bg-muted/70 rounded-2xl flex items-center justify-start gap-4 px-4 active:scale-[0.98] transition-all duration-150",onClick:h,children:[e.jsx("div",{className:"w-10 h-10 rounded-2xl bg-background/80 flex items-center justify-center",children:e.jsx(Gt,{className:"w-5 h-5 text-muted-foreground"})}),e.jsx("span",{className:"text-lg font-medium text-foreground",children:"管理"})]})]}),e.jsxs(U,{variant:"ghost",className:"hidden md:flex w-full justify-start gap-2 p-2 h-auto font-normal text-muted-foreground hover:text-foreground hover:bg-accent transition-colors duration-200",onClick:x,children:[e.jsx(Ut,{className:"w-3 h-3"}),e.jsx("span",{className:"text-xs",children:"设置"})]}),j&&e.jsxs(U,{variant:"ghost",className:"hidden md:flex w-full justify-start gap-2 p-2 h-auto font-normal text-muted-foreground hover:text-foreground hover:bg-accent transition-colors duration-200",onClick:h,children:[e.jsx(Gt,{className:"w-3 h-3"}),e.jsx("span",{className:"text-xs",children:"管理"})]})]})]})]})}const ys={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}};var yn={exports:{}},bn,To;function yi(){if(To)return bn;To=1;var r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return bn=r,bn}var vn,Xo;function bi(){if(Xo)return vn;Xo=1;var r=yi();function o(){}function l(){}return l.resetWarningCache=o,vn=function(){function u(d,s,p,t,x,h){if(h!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}u.isRequired=u;function c(){return u}var m={array:u,bigint:u,bool:u,func:u,number:u,object:u,string:u,symbol:u,any:u,arrayOf:c,element:u,elementType:u,instanceOf:c,node:u,objectOf:c,oneOf:c,oneOfType:c,shape:c,exact:c,checkPropTypes:l,resetWarningCache:o};return m.PropTypes=m,m},vn}var Mo;function vi(){return Mo||(Mo=1,yn.exports=bi()()),yn.exports}var ji=vi();const qe=Zr(ji);function er(r,o,l,u){function c(m){return m instanceof l?m:new l(function(d){d(m)})}return new(l||(l=Promise))(function(m,d){function s(x){try{t(u.next(x))}catch(h){d(h)}}function p(x){try{t(u.throw(x))}catch(h){d(h)}}function t(x){x.done?m(x.value):c(x.value).then(s,p)}t((u=u.apply(r,o||[])).next())})}const ki=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function fr(r,o,l){const u=wi(r),{webkitRelativePath:c}=r,m=typeof o=="string"?o:typeof c=="string"&&c.length>0?c:`./${r.name}`;return typeof u.path!="string"&&Oo(u,"path",m),Oo(u,"relativePath",m),u}function wi(r){const{name:o}=r;if(o&&o.lastIndexOf(".")!==-1&&!r.type){const u=o.split(".").pop().toLowerCase(),c=ki.get(u);c&&Object.defineProperty(r,"type",{value:c,writable:!1,configurable:!1,enumerable:!0})}return r}function Oo(r,o,l){Object.defineProperty(r,o,{value:l,writable:!1,configurable:!1,enumerable:!0})}const Ni=[".DS_Store","Thumbs.db"];function Si(r){return er(this,void 0,void 0,function*(){return Jr(r)&&Ti(r.dataTransfer)?Ci(r.dataTransfer,r.type):Xi(r)?Mi(r):Array.isArray(r)&&r.every(o=>"getFile"in o&&typeof o.getFile=="function")?Oi(r):[]})}function Ti(r){return Jr(r)}function Xi(r){return Jr(r)&&Jr(r.target)}function Jr(r){return typeof r=="object"&&r!==null}function Mi(r){return Ln(r.target.files).map(o=>fr(o))}function Oi(r){return er(this,void 0,void 0,function*(){return(yield Promise.all(r.map(l=>l.getFile()))).map(l=>fr(l))})}function Ci(r,o){return er(this,void 0,void 0,function*(){if(r.items){const l=Ln(r.items).filter(c=>c.kind==="file");if(o!=="drop")return l;const u=yield Promise.all(l.map(Ei));return Co(bs(u))}return Co(Ln(r.files).map(l=>fr(l)))})}function Co(r){return r.filter(o=>Ni.indexOf(o.name)===-1)}function Ln(r){if(r===null)return[];const o=[];for(let l=0;l<r.length;l++){const u=r[l];o.push(u)}return o}function Ei(r){if(typeof r.webkitGetAsEntry!="function")return Eo(r);const o=r.webkitGetAsEntry();return o&&o.isDirectory?vs(o):Eo(r,o)}function bs(r){return r.reduce((o,l)=>[...o,...Array.isArray(l)?bs(l):[l]],[])}function Eo(r,o){return er(this,void 0,void 0,function*(){var l;if(globalThis.isSecureContext&&typeof r.getAsFileSystemHandle=="function"){const m=yield r.getAsFileSystemHandle();if(m===null)throw new Error(`${r} is not a File`);if(m!==void 0){const d=yield m.getFile();return d.handle=m,fr(d)}}const u=r.getAsFile();if(!u)throw new Error(`${r} is not a File`);return fr(u,(l=o?.fullPath)!==null&&l!==void 0?l:void 0)})}function Di(r){return er(this,void 0,void 0,function*(){return r.isDirectory?vs(r):Pi(r)})}function vs(r){const o=r.createReader();return new Promise((l,u)=>{const c=[];function m(){o.readEntries(d=>er(this,void 0,void 0,function*(){if(d.length){const s=Promise.all(d.map(Di));c.push(s),m()}else try{const s=yield Promise.all(c);l(s)}catch(s){u(s)}}),d=>{u(d)})}m()})}function Pi(r){return er(this,void 0,void 0,function*(){return new Promise((o,l)=>{r.file(u=>{const c=fr(u,r.fullPath);o(c)},u=>{l(u)})})})}var $r={},Do;function Ai(){return Do||(Do=1,$r.__esModule=!0,$r.default=function(r,o){if(r&&o){var l=Array.isArray(o)?o:o.split(",");if(l.length===0)return!0;var u=r.name||"",c=(r.type||"").toLowerCase(),m=c.replace(/\/.*$/,"");return l.some(function(d){var s=d.trim().toLowerCase();return s.charAt(0)==="."?u.toLowerCase().endsWith(s):s.endsWith("/*")?m===s.replace(/\/.*$/,""):c===s})}return!0}),$r}var Li=Ai();const jn=Zr(Li);function Po(r){return zi(r)||Ii(r)||ks(r)||_i()}function _i(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
19
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ii(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function zi(r){if(Array.isArray(r))return _n(r)}function Ao(r,o){var l=Object.keys(r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(r);o&&(u=u.filter(function(c){return Object.getOwnPropertyDescriptor(r,c).enumerable})),l.push.apply(l,u)}return l}function Lo(r){for(var o=1;o<arguments.length;o++){var l=arguments[o]!=null?arguments[o]:{};o%2?Ao(Object(l),!0).forEach(function(u){js(r,u,l[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(l)):Ao(Object(l)).forEach(function(u){Object.defineProperty(r,u,Object.getOwnPropertyDescriptor(l,u))})}return r}function js(r,o,l){return o in r?Object.defineProperty(r,o,{value:l,enumerable:!0,configurable:!0,writable:!0}):r[o]=l,r}function Or(r,o){return Wi(r)||$i(r,o)||ks(r,o)||Ri()}function Ri(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
20
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ks(r,o){if(r){if(typeof r=="string")return _n(r,o);var l=Object.prototype.toString.call(r).slice(8,-1);if(l==="Object"&&r.constructor&&(l=r.constructor.name),l==="Map"||l==="Set")return Array.from(r);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return _n(r,o)}}function _n(r,o){(o==null||o>r.length)&&(o=r.length);for(var l=0,u=new Array(o);l<o;l++)u[l]=r[l];return u}function $i(r,o){var l=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(l!=null){var u=[],c=!0,m=!1,d,s;try{for(l=l.call(r);!(c=(d=l.next()).done)&&(u.push(d.value),!(o&&u.length===o));c=!0);}catch(p){m=!0,s=p}finally{try{!c&&l.return!=null&&l.return()}finally{if(m)throw s}}return u}}function Wi(r){if(Array.isArray(r))return r}var Fi=typeof jn=="function"?jn:jn.default,Hi="file-invalid-type",Bi="file-too-large",Ui="file-too-small",Gi="too-many-files",Yi=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",l=o.split(","),u=l.length>1?"one of ".concat(l.join(", ")):l[0];return{code:Hi,message:"File type must be ".concat(u)}},_o=function(o){return{code:Bi,message:"File is larger than ".concat(o," ").concat(o===1?"byte":"bytes")}},Io=function(o){return{code:Ui,message:"File is smaller than ".concat(o," ").concat(o===1?"byte":"bytes")}},Ji={code:Gi,message:"Too many files"};function ws(r,o){var l=r.type==="application/x-moz-file"||Fi(r,o);return[l,l?null:Yi(o)]}function Ns(r,o,l){if(Jt(r.size))if(Jt(o)&&Jt(l)){if(r.size>l)return[!1,_o(l)];if(r.size<o)return[!1,Io(o)]}else{if(Jt(o)&&r.size<o)return[!1,Io(o)];if(Jt(l)&&r.size>l)return[!1,_o(l)]}return[!0,null]}function Jt(r){return r!=null}function qi(r){var o=r.files,l=r.accept,u=r.minSize,c=r.maxSize,m=r.multiple,d=r.maxFiles,s=r.validator;return!m&&o.length>1||m&&d>=1&&o.length>d?!1:o.every(function(p){var t=ws(p,l),x=Or(t,1),h=x[0],a=Ns(p,u,c),i=Or(a,1),g=i[0],v=s?s(p):null;return h&&g&&!v})}function qr(r){return typeof r.isPropagationStopped=="function"?r.isPropagationStopped():typeof r.cancelBubble<"u"?r.cancelBubble:!1}function Wr(r){return r.dataTransfer?Array.prototype.some.call(r.dataTransfer.types,function(o){return o==="Files"||o==="application/x-moz-file"}):!!r.target&&!!r.target.files}function zo(r){r.preventDefault()}function Ki(r){return r.indexOf("MSIE")!==-1||r.indexOf("Trident/")!==-1}function Vi(r){return r.indexOf("Edge/")!==-1}function Zi(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Ki(r)||Vi(r)}function Et(){for(var r=arguments.length,o=new Array(r),l=0;l<r;l++)o[l]=arguments[l];return function(u){for(var c=arguments.length,m=new Array(c>1?c-1:0),d=1;d<c;d++)m[d-1]=arguments[d];return o.some(function(s){return!qr(u)&&s&&s.apply(void 0,[u].concat(m)),qr(u)})}}function Qi(){return"showOpenFilePicker"in window}function el(r){if(Jt(r)){var o=Object.entries(r).filter(function(l){var u=Or(l,2),c=u[0],m=u[1],d=!0;return Ss(c)||(console.warn('Skipped "'.concat(c,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),d=!1),(!Array.isArray(m)||!m.every(Ts))&&(console.warn('Skipped "'.concat(c,'" because an invalid file extension was provided.')),d=!1),d}).reduce(function(l,u){var c=Or(u,2),m=c[0],d=c[1];return Lo(Lo({},l),{},js({},m,d))},{});return[{description:"Files",accept:o}]}return r}function tl(r){if(Jt(r))return Object.entries(r).reduce(function(o,l){var u=Or(l,2),c=u[0],m=u[1];return[].concat(Po(o),[c],Po(m))},[]).filter(function(o){return Ss(o)||Ts(o)}).join(",")}function rl(r){return r instanceof DOMException&&(r.name==="AbortError"||r.code===r.ABORT_ERR)}function nl(r){return r instanceof DOMException&&(r.name==="SecurityError"||r.code===r.SECURITY_ERR)}function Ss(r){return r==="audio/*"||r==="video/*"||r==="image/*"||r==="text/*"||r==="application/*"||/\w+\/[-+.\w]+/g.test(r)}function Ts(r){return/^.*\.[\w]+$/.test(r)}var ol=["children"],sl=["open"],al=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],il=["refKey","onChange","onClick"];function ll(r){return ul(r)||dl(r)||Xs(r)||cl()}function cl(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
21
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dl(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function ul(r){if(Array.isArray(r))return In(r)}function kn(r,o){return fl(r)||ml(r,o)||Xs(r,o)||pl()}function pl(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
22
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xs(r,o){if(r){if(typeof r=="string")return In(r,o);var l=Object.prototype.toString.call(r).slice(8,-1);if(l==="Object"&&r.constructor&&(l=r.constructor.name),l==="Map"||l==="Set")return Array.from(r);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return In(r,o)}}function In(r,o){(o==null||o>r.length)&&(o=r.length);for(var l=0,u=new Array(o);l<o;l++)u[l]=r[l];return u}function ml(r,o){var l=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(l!=null){var u=[],c=!0,m=!1,d,s;try{for(l=l.call(r);!(c=(d=l.next()).done)&&(u.push(d.value),!(o&&u.length===o));c=!0);}catch(p){m=!0,s=p}finally{try{!c&&l.return!=null&&l.return()}finally{if(m)throw s}}return u}}function fl(r){if(Array.isArray(r))return r}function Ro(r,o){var l=Object.keys(r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(r);o&&(u=u.filter(function(c){return Object.getOwnPropertyDescriptor(r,c).enumerable})),l.push.apply(l,u)}return l}function rt(r){for(var o=1;o<arguments.length;o++){var l=arguments[o]!=null?arguments[o]:{};o%2?Ro(Object(l),!0).forEach(function(u){zn(r,u,l[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(l)):Ro(Object(l)).forEach(function(u){Object.defineProperty(r,u,Object.getOwnPropertyDescriptor(l,u))})}return r}function zn(r,o,l){return o in r?Object.defineProperty(r,o,{value:l,enumerable:!0,configurable:!0,writable:!0}):r[o]=l,r}function Kr(r,o){if(r==null)return{};var l=hl(r,o),u,c;if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(r);for(c=0;c<m.length;c++)u=m[c],!(o.indexOf(u)>=0)&&Object.prototype.propertyIsEnumerable.call(r,u)&&(l[u]=r[u])}return l}function hl(r,o){if(r==null)return{};var l={},u=Object.keys(r),c,m;for(m=0;m<u.length;m++)c=u[m],!(o.indexOf(c)>=0)&&(l[c]=r[c]);return l}var Kn=n.forwardRef(function(r,o){var l=r.children,u=Kr(r,ol),c=Vn(u),m=c.open,d=Kr(c,sl);return n.useImperativeHandle(o,function(){return{open:m}},[m]),mt.createElement(n.Fragment,null,l(rt(rt({},d),{},{open:m})))});Kn.displayName="Dropzone";var Ms={disabled:!1,getFilesFromEvent:Si,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};Kn.defaultProps=Ms;Kn.propTypes={children:qe.func,accept:qe.objectOf(qe.arrayOf(qe.string)),multiple:qe.bool,preventDropOnDocument:qe.bool,noClick:qe.bool,noKeyboard:qe.bool,noDrag:qe.bool,noDragEventsBubbling:qe.bool,minSize:qe.number,maxSize:qe.number,maxFiles:qe.number,disabled:qe.bool,getFilesFromEvent:qe.func,onFileDialogCancel:qe.func,onFileDialogOpen:qe.func,useFsAccessApi:qe.bool,autoFocus:qe.bool,onDragEnter:qe.func,onDragLeave:qe.func,onDragOver:qe.func,onDrop:qe.func,onDropAccepted:qe.func,onDropRejected:qe.func,onError:qe.func,validator:qe.func};var Rn={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Vn(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=rt(rt({},Ms),r),l=o.accept,u=o.disabled,c=o.getFilesFromEvent,m=o.maxSize,d=o.minSize,s=o.multiple,p=o.maxFiles,t=o.onDragEnter,x=o.onDragLeave,h=o.onDragOver,a=o.onDrop,i=o.onDropAccepted,g=o.onDropRejected,v=o.onFileDialogCancel,k=o.onFileDialogOpen,b=o.useFsAccessApi,j=o.autoFocus,f=o.preventDropOnDocument,w=o.noClick,S=o.noKeyboard,z=o.noDrag,D=o.noDragEventsBubbling,N=o.onError,R=o.validator,M=n.useMemo(function(){return tl(l)},[l]),E=n.useMemo(function(){return el(l)},[l]),$=n.useMemo(function(){return typeof k=="function"?k:$o},[k]),T=n.useMemo(function(){return typeof v=="function"?v:$o},[v]),X=n.useRef(null),_=n.useRef(null),te=n.useReducer(xl,Rn),ne=kn(te,2),G=ne[0],le=ne[1],de=G.isFocused,fe=G.isFileDialogActive,Ee=n.useRef(typeof window<"u"&&window.isSecureContext&&b&&Qi()),ge=function(){!Ee.current&&fe&&setTimeout(function(){if(_.current){var C=_.current.files;C.length||(le({type:"closeDialog"}),T())}},300)};n.useEffect(function(){return window.addEventListener("focus",ge,!1),function(){window.removeEventListener("focus",ge,!1)}},[_,fe,T,Ee]);var Me=n.useRef([]),Fe=function(C){X.current&&X.current.contains(C.target)||(C.preventDefault(),Me.current=[])};n.useEffect(function(){return f&&(document.addEventListener("dragover",zo,!1),document.addEventListener("drop",Fe,!1)),function(){f&&(document.removeEventListener("dragover",zo),document.removeEventListener("drop",Fe))}},[X,f]),n.useEffect(function(){return!u&&j&&X.current&&X.current.focus(),function(){}},[X,j,u]);var ae=n.useCallback(function(B){N?N(B):console.error(B)},[N]),Ne=n.useCallback(function(B){B.preventDefault(),B.persist(),ze(B),Me.current=[].concat(ll(Me.current),[B.target]),Wr(B)&&Promise.resolve(c(B)).then(function(C){if(!(qr(B)&&!D)){var V=C.length,I=V>0&&qi({files:C,accept:M,minSize:d,maxSize:m,multiple:s,maxFiles:p,validator:R}),re=V>0&&!I;le({isDragAccept:I,isDragReject:re,isDragActive:!0,type:"setDraggedFiles"}),t&&t(B)}}).catch(function(C){return ae(C)})},[c,t,ae,D,M,d,m,s,p,R]),He=n.useCallback(function(B){B.preventDefault(),B.persist(),ze(B);var C=Wr(B);if(C&&B.dataTransfer)try{B.dataTransfer.dropEffect="copy"}catch{}return C&&h&&h(B),!1},[h,D]),Be=n.useCallback(function(B){B.preventDefault(),B.persist(),ze(B);var C=Me.current.filter(function(I){return X.current&&X.current.contains(I)}),V=C.indexOf(B.target);V!==-1&&C.splice(V,1),Me.current=C,!(C.length>0)&&(le({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Wr(B)&&x&&x(B))},[X,x,D]),he=n.useCallback(function(B,C){var V=[],I=[];B.forEach(function(re){var Y=ws(re,M),ie=kn(Y,2),ce=ie[0],Ae=ie[1],Xe=Ns(re,d,m),Le=kn(Xe,2),oe=Le[0],ye=Le[1],at=R?R(re):null;if(ce&&oe&&!at)V.push(re);else{var Pe=[Ae,ye];at&&(Pe=Pe.concat(at)),I.push({file:re,errors:Pe.filter(function(dt){return dt})})}}),(!s&&V.length>1||s&&p>=1&&V.length>p)&&(V.forEach(function(re){I.push({file:re,errors:[Ji]})}),V.splice(0)),le({acceptedFiles:V,fileRejections:I,isDragReject:I.length>0,type:"setFiles"}),a&&a(V,I,C),I.length>0&&g&&g(I,C),V.length>0&&i&&i(V,C)},[le,s,M,d,m,p,a,i,g,R]),Oe=n.useCallback(function(B){B.preventDefault(),B.persist(),ze(B),Me.current=[],Wr(B)&&Promise.resolve(c(B)).then(function(C){qr(B)&&!D||he(C,B)}).catch(function(C){return ae(C)}),le({type:"reset"})},[c,he,ae,D]),De=n.useCallback(function(){if(Ee.current){le({type:"openDialog"}),$();var B={multiple:s,types:E};window.showOpenFilePicker(B).then(function(C){return c(C)}).then(function(C){he(C,null),le({type:"closeDialog"})}).catch(function(C){rl(C)?(T(C),le({type:"closeDialog"})):nl(C)?(Ee.current=!1,_.current?(_.current.value=null,_.current.click()):ae(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):ae(C)});return}_.current&&(le({type:"openDialog"}),$(),_.current.value=null,_.current.click())},[le,$,T,b,he,ae,E,s]),Ye=n.useCallback(function(B){!X.current||!X.current.isEqualNode(B.target)||(B.key===" "||B.key==="Enter"||B.keyCode===32||B.keyCode===13)&&(B.preventDefault(),De())},[X,De]),Te=n.useCallback(function(){le({type:"focus"})},[]),Je=n.useCallback(function(){le({type:"blur"})},[]),Ce=n.useCallback(function(){w||(Zi()?setTimeout(De,0):De())},[w,De]),Re=function(C){return u?null:C},$e=function(C){return S?null:Re(C)},Ie=function(C){return z?null:Re(C)},ze=function(C){D&&C.stopPropagation()},Ze=n.useMemo(function(){return function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},C=B.refKey,V=C===void 0?"ref":C,I=B.role,re=B.onKeyDown,Y=B.onFocus,ie=B.onBlur,ce=B.onClick,Ae=B.onDragEnter,Xe=B.onDragOver,Le=B.onDragLeave,oe=B.onDrop,ye=Kr(B,al);return rt(rt(zn({onKeyDown:$e(Et(re,Ye)),onFocus:$e(Et(Y,Te)),onBlur:$e(Et(ie,Je)),onClick:Re(Et(ce,Ce)),onDragEnter:Ie(Et(Ae,Ne)),onDragOver:Ie(Et(Xe,He)),onDragLeave:Ie(Et(Le,Be)),onDrop:Ie(Et(oe,Oe)),role:typeof I=="string"&&I!==""?I:"presentation"},V,X),!u&&!S?{tabIndex:0}:{}),ye)}},[X,Ye,Te,Je,Ce,Ne,He,Be,Oe,S,z,u]),Qe=n.useCallback(function(B){B.stopPropagation()},[]),K=n.useMemo(function(){return function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},C=B.refKey,V=C===void 0?"ref":C,I=B.onChange,re=B.onClick,Y=Kr(B,il),ie=zn({accept:M,multiple:s,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:Re(Et(I,Oe)),onClick:Re(Et(re,Qe)),tabIndex:-1},V,_);return rt(rt({},ie),Y)}},[_,l,s,Oe,u]);return rt(rt({},G),{},{isFocused:de&&!u,getRootProps:Ze,getInputProps:K,rootRef:X,inputRef:_,open:Re(De)})}function xl(r,o){switch(o.type){case"focus":return rt(rt({},r),{},{isFocused:!0});case"blur":return rt(rt({},r),{},{isFocused:!1});case"openDialog":return rt(rt({},Rn),{},{isFileDialogActive:!0});case"closeDialog":return rt(rt({},r),{},{isFileDialogActive:!1});case"setDraggedFiles":return rt(rt({},r),{},{isDragActive:o.isDragActive,isDragAccept:o.isDragAccept,isDragReject:o.isDragReject});case"setFiles":return rt(rt({},r),{},{acceptedFiles:o.acceptedFiles,fileRejections:o.fileRejections,isDragReject:o.isDragReject});case"reset":return rt({},Rn);default:return r}}function $o(){}const Wo=({todos:r,isResult:o=!1})=>{if(!r||!Array.isArray(r))return null;const l=c=>{switch(c){case"completed":return e.jsx("svg",{className:"w-3.5 h-3.5 text-green-500 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})});case"in_progress":return e.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-400 animate-pulse flex-shrink-0 mt-0.5"});case"pending":default:return e.jsx("div",{className:"w-2 h-2 rounded-full border border-gray-300 dark:border-gray-600 flex-shrink-0 mt-0.5"})}},u=r.filter(c=>c.status==="completed").length;return e.jsxs("div",{className:"border border-gray-200/60 dark:border-gray-700/40 rounded-lg overflow-hidden my-1.5",children:[o&&e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 dark:bg-gray-800/60 border-b border-gray-200/60 dark:border-gray-700/40 flex items-center gap-2",children:[e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),e.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["待办事项 · ",u,"/",r.length," 已完成"]})]}),e.jsx("div",{className:"divide-y divide-gray-100 dark:divide-gray-700/40",children:r.map((c,m)=>e.jsxs("div",{className:"flex items-start gap-2.5 px-3 py-2 hover:bg-gray-50 dark:hover:bg-gray-800/30 transition-colors",children:[e.jsx("div",{className:"mt-1",children:l(c.status)}),e.jsx("span",{className:`text-xs flex-1 leading-relaxed ${c.status==="completed"?"line-through text-gray-400 dark:text-gray-500":c.status==="in_progress"?"text-gray-700 dark:text-gray-300 font-medium":"text-gray-500 dark:text-gray-400"}`,children:c.content})]},c.id||`todo-${m}`))})]})},Vr=({className:r="w-5 h-5",size:o})=>{const l=o?{width:o,height:o}:void 0;return e.jsx("img",{src:"/logo.svg",alt:Ve,className:r,style:l})};function gl({status:r,onAbort:o,isLoading:l,provider:u="claude"}){const[c,m]=n.useState(0),[d,s]=n.useState(0),[p,t]=n.useState(0);if(n.useEffect(()=>{if(!l){m(0),t(0);return}const b=Date.now(),j=30+Math.random()*20,f=setInterval(()=>{const w=Math.floor((Date.now()-b)/1e3);m(w),t(Math.floor(w*j))},1e3);return()=>clearInterval(f)},[l]),n.useEffect(()=>{if(!l)return;const b=setInterval(()=>{s(j=>(j+1)%4)},500);return()=>clearInterval(b)},[l]),!l)return null;const x=["思考中","处理中","分析中","工作中","计算中","推理中"],h=Math.floor(c/3)%x.length,a=r?.text||x[h],i=r?.tokens||p,g=r?.can_interrupt!==!1,k=["✻","✹","✸","✶"][d];return e.jsx("div",{className:"w-full mb-3 sm:mb-6 animate-in slide-in-from-bottom duration-300",children:e.jsxs("div",{className:"flex items-center justify-between max-w-4xl mx-auto bg-gray-800 dark:bg-gray-900 text-white rounded-lg shadow-lg px-2.5 py-2 sm:px-4 sm:py-3 border border-gray-700 dark:border-gray-800",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx("span",{className:ot("text-base sm:text-xl transition-all duration-500 flex-shrink-0",d%2===0?"text-blue-400 scale-110":"text-blue-300"),children:k}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[e.jsxs("span",{className:"font-medium text-xs sm:text-sm truncate",children:[a,"..."]}),e.jsxs("span",{className:"text-gray-400 text-xs sm:text-sm flex-shrink-0",children:["(",c,"s)"]}),i>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-500 hidden sm:inline",children:"·"}),e.jsxs("span",{className:"text-gray-300 text-xs sm:text-sm hidden sm:inline flex-shrink-0",children:["⚒ ",i.toLocaleString()]})]}),e.jsx("span",{className:"text-gray-500 hidden sm:inline",children:"·"}),e.jsx("span",{className:"text-gray-400 text-xs sm:text-sm hidden sm:inline",children:"按 esc 停止"})]})})]})}),g&&o&&e.jsxs("button",{onClick:o,className:"ml-2 sm:ml-3 text-xs bg-red-600 hover:bg-red-700 active:bg-red-800 text-white px-2 py-1 sm:px-3 sm:py-1.5 rounded-md transition-colors flex items-center gap-1 sm:gap-1.5 flex-shrink-0 font-medium",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),e.jsx("span",{className:"hidden sm:inline",children:"停止"})]})]})})}async function yl(r,o){const l=new FormData,u=`recording_${Date.now()}.webm`,c=new File([r],u,{type:r.type});l.append("audio",c);const m=window.localStorage.getItem("whisperMode")||"default";l.append("mode",m);try{const d=await me.transcribe(l);if(!d.ok){const p=await d.json().catch(()=>({}));throw new Error(p.error||`Transcription error: ${d.status} ${d.statusText}`)}return(await d.json()).text||""}catch(d){throw d.name==="TypeError"&&d.message.includes("fetch")?new Error("Cannot connect to server. Please ensure the backend is running."):d}}function bl({onTranscript:r,className:o=""}){const[l,u]=n.useState("idle"),[c,m]=n.useState(null),[d,s]=n.useState(!0),p=n.useRef(null),t=n.useRef(null),x=n.useRef([]),h=n.useRef(0);n.useEffect(()=>{(()=>{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){s(!1),m("Microphone not supported. Please use HTTPS or a modern browser.");return}if(location.protocol!=="https:"&&location.hostname!=="localhost"){s(!1),m("Microphone requires HTTPS. Please use a secure connection.");return}s(!0),m(null)})()},[]);const a=async()=>{try{if(console.log("Starting recording..."),m(null),x.current=[],!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Microphone access not available. Please use HTTPS or a supported browser.");const f=await navigator.mediaDevices.getUserMedia({audio:!0});t.current=f;const w=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",S=new MediaRecorder(f,{mimeType:w});p.current=S,S.ondataavailable=z=>{z.data.size>0&&x.current.push(z.data)},S.onstop=async()=>{console.log("Recording stopped, creating blob...");const z=new Blob(x.current,{type:w});t.current&&(t.current.getTracks().forEach(M=>M.stop()),t.current=null),u("transcribing");const D=window.localStorage.getItem("whisperMode")||"default",N=D==="prompt"||D==="vibe"||D==="instructions"||D==="architect";let R;N&&(R=setTimeout(()=>{u("processing")},2e3));try{const M=await yl(z);M&&r&&r(M)}catch(M){console.error("Transcription error:",M),m(M.message)}finally{R&&clearTimeout(R),u("idle")}},S.start(),u("recording"),console.log("Recording started successfully")}catch(f){console.error("Failed to start recording:",f);let w="Microphone access failed";f.name==="NotAllowedError"?w="Microphone access denied. Please allow microphone permissions.":f.name==="NotFoundError"?w="No microphone found. Please check your audio devices.":f.name==="NotSupportedError"?w="Microphone not supported by this browser.":f.name==="NotReadableError"?w="Microphone is being used by another application.":f.message.includes("HTTPS")&&(w=f.message),m(w),u("idle")}},i=()=>{console.log("Stopping recording..."),p.current&&p.current.state==="recording"?p.current.stop():(console.log("Recorder not in recording state, forcing cleanup"),t.current&&(t.current.getTracks().forEach(f=>f.stop()),t.current=null),u("idle"))},g=f=>{if(f&&(f.preventDefault(),f.stopPropagation()),!d)return;const w=Date.now();if(w-h.current<300){console.log("Ignoring rapid tap");return}h.current=w,console.log("Button clicked, current state:",l),l==="idle"?a():l==="recording"&&i()};n.useEffect(()=>()=>{t.current&&t.current.getTracks().forEach(f=>f.stop())},[]);const v=()=>{if(!d)return{icon:e.jsx(hn,{className:"w-5 h-5"}),className:"bg-gray-400 cursor-not-allowed",disabled:!0};switch(l){case"recording":return{icon:e.jsx(hn,{className:"w-5 h-5 text-white"}),className:"bg-red-500 hover:bg-red-600 animate-pulse",disabled:!1};case"transcribing":return{icon:e.jsx(bt,{className:"w-5 h-5 animate-spin"}),className:"bg-blue-500 hover:bg-blue-600",disabled:!0};case"processing":return{icon:e.jsx(Ma,{className:"w-5 h-5 animate-pulse"}),className:"bg-purple-500 hover:bg-purple-600",disabled:!0};default:return{icon:e.jsx(hn,{className:"w-5 h-5"}),className:"bg-gray-700 hover:bg-gray-600",disabled:!1}}},{icon:k,className:b,disabled:j}=v();return e.jsxs("div",{className:"relative",children:[e.jsx("button",{type:"button",style:{backgroundColor:l==="recording"?"#ef4444":l==="transcribing"?"#3b82f6":l==="processing"?"#a855f7":"#374151"},className:`
13
+ ${G}`:"mcps: []",z.length>0?`git_repos:
14
+ ${ae}`:"git_repos: []",`files:
15
+ ${Pe}`].join(`
16
+ `),Le=await J("/api/agents/submit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentName:p,displayName:x,description:a,projectKey:d,agentYaml:xe,refFiles:ce,...Me?{updateNotes:He||void 0}:{}})}),oe=await Le.json();Le.ok?(await m((Qe?"更新已提交!本次更新将在管理员审核通过后公开生效。":"分享成功!项目将在管理员审核通过后公开可见。")+`
17
+
18
+ 审核结果请在 设置 → 共享项目模板 → 我的提交记录 中查看。`,{title:Qe?"更新已提交":"提交成功",variant:"info"}),l?.({submissionId:oe.submissionId,message:oe.message})):m(oe.error||"提交失败",{variant:"error"})}catch(B){m(B.message,{variant:"error"})}finally{D(!1)}}},Qe=!!Me;return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-lg mx-4 flex flex-col max-h-[90vh]",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(It,{className:"w-5 h-5 text-blue-500"}),e.jsx("h2",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:Qe?"更新项目模板":"分享项目模板"})]}),e.jsx("button",{onClick:o,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 space-y-4 overflow-y-auto flex-1",children:[c&&!c.isExistingProject?e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"项目路径"}),e.jsx("div",{className:"w-full border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2 text-sm bg-gray-50 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:Ue(c.projectPath)})]}):e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"选择项目"}),e.jsxs("select",{value:d,onChange:K=>s(K.target.value),className:"w-full border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2 text-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[e.jsx("option",{value:"",children:"-- 选择项目 --"}),Xe.map(K=>e.jsx("option",{value:K.name,children:K.displayName||K.name},K.name))]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["项目标识名 ",e.jsx("span",{className:"text-gray-400 text-xs",children:"(英文,用于目录名)"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ct,{value:p,readOnly:!0,placeholder:"e.g. my-agent",className:"text-sm bg-gray-50 dark:bg-gray-800/50 cursor-default"}),he&&e.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:e.jsx(bt,{className:"w-4 h-4 text-gray-400 animate-spin"})})]}),$&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:$})]}),he&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-gray-50 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700",children:[e.jsx(bt,{className:"w-3.5 h-3.5 text-gray-400 animate-spin flex-shrink-0"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"正在检查项目信息..."})]}),!he&&Qe&&e.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-700",children:[e.jsx(en,{className:"w-4 h-4 text-blue-500 flex-shrink-0 mt-0.5"}),e.jsxs("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:[e.jsx("span",{className:"font-medium",children:"更新模式"}),":仓库中已存在项目「",Me.display_name,"」,当前版本 v",Me.version,"。提交将作为版本更新处理。"]})]}),!he&&ie&&e.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700",children:[e.jsx(Bt,{className:"w-4 h-4 text-amber-500 flex-shrink-0 mt-0.5"}),e.jsxs("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["用户 ",ie.username," 已在 ",new Date(ie.submitted_at).toLocaleString("zh-CN",{dateStyle:"short",timeStyle:"short"})," 提交了同名项目的审核,建议更换标识名以避免冲突。"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"显示名称"}),e.jsx(ct,{value:x,onChange:K=>h(K.target.value),placeholder:"My Project",className:"text-sm",disabled:he})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"描述"}),e.jsxs("button",{type:"button",onClick:ze,disabled:!d||g||he,className:"flex items-center gap-1 text-xs text-blue-500 hover:text-blue-600 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[e.jsx(On,{className:"w-3 h-3"}),g?"AI 生成中...":"AI 生成"]})]}),e.jsx("textarea",{value:a,onChange:K=>i(K.target.value),placeholder:"描述这个项目的用途和功能...",rows:3,disabled:he,className:"w-full border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2 text-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none disabled:opacity-50 disabled:cursor-not-allowed"})]}),Qe&&e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:["更新说明 ",e.jsx("span",{className:"text-gray-400 text-xs",children:"(描述本次更新的内容)"})]}),e.jsx("textarea",{value:He,onChange:K=>Be(K.target.value),placeholder:"例如:修复了 XXX 问题,新增了 YYY 功能...",rows:2,className:"w-full border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2 text-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none"})]}),d&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-3 bg-gray-50 dark:bg-gray-800/50",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-2",children:"将包含的内容"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-700 dark:text-gray-300",children:[e.jsx(ur,{className:"w-3.5 h-3.5 text-blue-500 flex-shrink-0"}),e.jsxs("span",{children:["agent.yaml ",e.jsx("span",{className:"text-gray-400",children:"(自动生成)"})]})]}),e.jsxs("div",{className:`flex items-center gap-2 text-xs ${k.hasClaudeMd?"text-gray-700 dark:text-gray-300":"text-gray-400 dark:text-gray-600"}`,children:[e.jsx(ur,{className:`w-3.5 h-3.5 flex-shrink-0 ${k.hasClaudeMd?"text-green-500":"text-gray-300"}`}),e.jsxs("span",{children:["CLAUDE.md ",!k.hasClaudeMd&&e.jsx("span",{className:"text-amber-500",children:"(未找到)"})]})]}),k.skills?.length>0&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("p",{className:"text-[11px] text-gray-400 dark:text-gray-500 mb-1.5",children:["Skills ",e.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"(勾选需要包含的)"})]}),k.skills.map(K=>e.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-700 dark:text-gray-300 cursor-pointer py-0.5 hover:text-gray-900 dark:hover:text-gray-100",children:[e.jsx("input",{type:"checkbox",checked:j.has(K.name),onChange:B=>{const C=new Set(j);B.target.checked?C.add(K.name):C.delete(K.name),f(C)},className:"rounded text-purple-500 focus:ring-purple-400 focus:ring-offset-0"}),e.jsx(Cr,{className:"w-3.5 h-3.5 text-purple-500 flex-shrink-0"}),e.jsx("span",{children:K.name})]},K.name))]}),k.mcps?.length>0&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("p",{className:"text-[11px] text-gray-400 dark:text-gray-500 mb-1.5",children:["MCP 服务 ",e.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"(勾选需要包含的)"})]}),k.mcps.map(K=>e.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-700 dark:text-gray-300 cursor-pointer py-0.5 hover:text-gray-900 dark:hover:text-gray-100",children:[e.jsx("input",{type:"checkbox",checked:w.has(K.name),onChange:B=>{const C=new Set(w);B.target.checked?C.add(K.name):C.delete(K.name),N(C)},className:"rounded text-orange-500 focus:ring-orange-400 focus:ring-offset-0"}),e.jsx(tn,{className:"w-3.5 h-3.5 text-orange-500 flex-shrink-0"}),e.jsx("span",{children:K.name})]},K.name))]}),k.gitRepos?.length>0&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("p",{className:"text-[11px] text-gray-400 dark:text-gray-500 mb-1.5",children:["Git 仓库依赖 ",e.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"(勾选需要包含的子目录 git 仓库)"})]}),k.gitRepos.map(K=>e.jsxs("label",{className:"flex items-start gap-2 text-xs text-gray-700 dark:text-gray-300 cursor-pointer py-0.5 hover:text-gray-900 dark:hover:text-gray-100",children:[e.jsx("input",{type:"checkbox",checked:S.has(K.name),onChange:B=>{const C=new Set(S);B.target.checked?C.add(K.name):C.delete(K.name),R(C)},className:"rounded text-emerald-500 focus:ring-emerald-400 focus:ring-offset-0 mt-0.5"}),e.jsx(rn,{className:"w-3.5 h-3.5 text-emerald-500 flex-shrink-0 mt-0.5"}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium",children:K.name}),e.jsxs("span",{className:"text-gray-400 dark:text-gray-500 text-[10px] block truncate",children:[K.repo," (",K.branch,")"]})]})]},K.name))]}),k.refFiles?.length>0&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("p",{className:"text-[11px] text-gray-400 dark:text-gray-500 mb-1.5",children:["CLAUDE.md 引用文件 ",e.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"(勾选需要包含的)"})]}),k.refFiles.map(K=>e.jsxs("label",{className:`flex items-center gap-2 text-xs cursor-pointer py-0.5 ${K.exists?"text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100":"text-gray-400 dark:text-gray-600"}`,children:[e.jsx("input",{type:"checkbox",checked:L.has(K.path),disabled:!K.exists,onChange:B=>{const C=new Set(L);B.target.checked?C.add(K.path):C.delete(K.path),E(C)},className:"rounded text-blue-500 focus:ring-blue-400 focus:ring-offset-0 disabled:opacity-40"}),e.jsx(ur,{className:`w-3.5 h-3.5 flex-shrink-0 ${K.exists?"text-blue-400":"text-gray-300"}`}),e.jsx("span",{className:"truncate",children:K.path}),!K.exists&&e.jsx("span",{className:"text-amber-500 flex-shrink-0",children:"(未找到)"})]},K.path))]}),e.jsxs("div",{className:"mt-2 pt-2 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("button",{type:"button",onClick:()=>ye(!Ee),className:"flex items-center justify-between w-full text-[11px] text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-400 transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[Ee?e.jsx(Vt,{className:"w-3 h-3"}):e.jsx(Br,{className:"w-3 h-3"}),"项目文件 ",e.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"(手动选择需要包含的)"})]}),Y.size>0&&e.jsxs("span",{className:"text-[10px] bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 px-1.5 py-0.5 rounded-full",children:["已选 ",Y.size]})]}),Ee&&e.jsxs("div",{className:"mt-1.5 space-y-1.5",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"w-3 h-3 text-gray-400 absolute left-2 top-1/2 -translate-y-1/2"}),e.jsx("input",{type:"text",value:de,onChange:K=>fe(K.target.value),placeholder:"搜索文件名...",className:"w-full pl-6 pr-2 py-1 text-[11px] border border-gray-200 dark:border-gray-700 rounded bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 focus:outline-none focus:ring-1 focus:ring-blue-500"})]}),te?e.jsx("div",{className:"flex items-center justify-center py-3",children:e.jsx(bt,{className:"w-3.5 h-3.5 text-gray-400 animate-spin"})}):$e.length===0?e.jsx("p",{className:"text-[11px] text-gray-400 text-center py-2",children:"无匹配文件"}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400 cursor-pointer py-0.5 border-b border-gray-100 dark:border-gray-700 mb-0.5",children:[e.jsx("input",{type:"checkbox",checked:$e.length>0&&$e.every(K=>Y.has(K.path)),onChange:K=>{const B=new Set(Y);K.target.checked?$e.forEach(C=>B.add(C.path)):$e.forEach(C=>B.delete(C.path)),le(B)},className:"rounded text-teal-500 focus:ring-teal-400 focus:ring-offset-0"}),e.jsxs("span",{children:["全选(",$e.length," 个文件)"]})]}),e.jsx("div",{className:"max-h-48 overflow-y-auto space-y-0.5",children:$e.map(K=>e.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-700 dark:text-gray-300 cursor-pointer py-0.5 hover:text-gray-900 dark:hover:text-gray-100",children:[e.jsx("input",{type:"checkbox",checked:Y.has(K.path),onChange:B=>{const C=new Set(Y);B.target.checked?C.add(K.path):C.delete(K.path),le(C)},className:"rounded text-teal-500 focus:ring-teal-400 focus:ring-offset-0"}),e.jsx(ur,{className:"w-3.5 h-3.5 text-teal-400 flex-shrink-0"}),e.jsx("span",{className:"truncate flex-1 min-w-0",children:K.path}),e.jsx("span",{className:"text-[10px] text-gray-400 flex-shrink-0",children:_e(K.size)})]},K.path))})]}),X.truncated&&e.jsx("p",{className:"text-[10px] text-amber-500",children:"项目文件较多,仅显示前 500 个。请使用搜索缩小范围。"})]})]})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 p-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx(U,{variant:"outline",size:"sm",onClick:o,disabled:M,children:"取消"}),e.jsx(U,{size:"sm",onClick:Ze,disabled:M||!d||he,className:"flex items-center gap-1.5",children:M?e.jsx("span",{children:"提交中..."}):e.jsxs(e.Fragment,{children:[e.jsx(Ht,{className:"w-3.5 h-3.5"}),Qe?"更新":"分享"]})})]})]})})}function gs({sessionId:r,projectName:o,sessionTitle:l,isOpen:u,onClose:c}){const{showAlert:m}=lt(),[d,s]=n.useState(!1),[p,t]=n.useState(!1),[x,h]=n.useState(!1),[a,i]=n.useState(null),[g,v]=n.useState(!1),[k,b]=n.useState("realtime"),[j,f]=n.useState(!1);n.useEffect(()=>{!u||!r||(v(!1),i(null),w())},[u,r]);const w=async()=>{s(!0);try{const T=await J(`/api/share/info/${r}`);if(T.ok){const X=await T.json();i(X)}else T.status===404&&(v(!0),i(null))}catch{v(!0)}finally{s(!1)}},N=async()=>{t(!0);try{const T=await J("/api/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:r,projectName:o,mode:k,title:l})});if(!T.ok){const _=await T.json().catch(()=>({}));await m(_.error||"分享失败",{title:"错误",variant:"error"});return}const X=await T.json();i({mode:k,shareUrl:X.shareUrl,status:"active"}),v(!1)}catch{await m("网络错误,请重试",{title:"错误",variant:"error"})}finally{t(!1)}},L=async()=>{h(!0);try{if(!(await J(`/api/share/${r}`,{method:"DELETE"})).ok){await m("操作失败",{title:"错误",variant:"error"});return}i(X=>({...X,status:"stopped"}))}catch{await m("网络错误,请重试",{title:"错误",variant:"error"})}finally{h(!1)}},E=async()=>{t(!0);try{const T=await J("/api/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:r,projectName:o,mode:"static",title:l})});if(!T.ok){const _=await T.json().catch(()=>({}));await m(_.error||"操作失败",{title:"错误",variant:"error"});return}const X=await T.json();i({mode:"static",shareUrl:X.shareUrl,status:"active"})}catch{await m("网络错误,请重试",{title:"错误",variant:"error"})}finally{t(!1)}},S=()=>{if(!a?.shareUrl)return;const T=`${window.location.origin}${a.shareUrl}`,X=()=>{f(!0),setTimeout(()=>f(!1),2e3)};navigator.clipboard?.writeText?navigator.clipboard.writeText(T).then(X).catch(()=>R(T,X)):R(T,X)},R=(T,X)=>{const _=document.createElement("textarea");_.value=T,_.style.cssText="position:fixed;top:-9999px;left:-9999px",document.body.appendChild(_),_.focus(),_.select();try{document.execCommand("copy"),X()}catch{}document.body.removeChild(_)};if(!u)return null;const M=a?.status==="active",D=a?.status==="stopped",$=a?.shareUrl?`${window.location.origin}${a.shareUrl}`:"";return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-md mx-4 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Cn,{className:"w-5 h-5 text-blue-500"}),e.jsx("h2",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:"分享会话"})]}),e.jsx("button",{onClick:c,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500",children:e.jsx(Ge,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"p-4 space-y-4",children:d?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(bt,{className:"w-6 h-6 animate-spin text-gray-400"})}):M?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${a.mode==="realtime"?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"}`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current"}),a.mode==="realtime"?"实时共享":"静态快照"]}),e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:"已开启"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 min-w-0 bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2",children:e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 truncate font-mono",children:$})}),e.jsx("button",{onClick:S,className:"flex-shrink-0 p-2 rounded-lg border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 text-gray-600 dark:text-gray-400",title:"复制链接",children:j?e.jsx(pr,{className:"w-4 h-4 text-green-500"}):e.jsx(Bn,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex gap-2",children:[a.mode==="realtime"&&e.jsxs("button",{onClick:E,disabled:p,className:"flex items-center gap-1.5 px-3 py-2 text-sm rounded-lg border border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300 disabled:opacity-50",children:[p?e.jsx(bt,{className:"w-4 h-4 animate-spin"}):e.jsx(st,{className:"w-4 h-4"}),"生成静态快照"]}),e.jsxs("button",{onClick:L,disabled:x,className:"flex items-center gap-1.5 px-3 py-2 text-sm rounded-lg border border-red-200 dark:border-red-800 hover:bg-red-50 dark:hover:bg-red-900/20 text-red-600 dark:text-red-400 disabled:opacity-50",children:[x?e.jsx(bt,{className:"w-4 h-4 animate-spin"}):e.jsx(Ta,{className:"w-4 h-4"}),"停止共享"]})]})]}):e.jsxs("div",{className:"space-y-4",children:[D&&e.jsx("div",{className:"flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 rounded-lg text-sm text-gray-500 dark:text-gray-400",children:"该会话分享已关闭,可重新开启。"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:"选择分享模式"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:`flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${k==="realtime"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:[e.jsx("input",{type:"radio",value:"realtime",checked:k==="realtime",onChange:()=>b("realtime"),className:"mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:"实时共享"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:"访问者刷新页面即可看到最新对话内容"})]})]}),e.jsxs("label",{className:`flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors ${k==="static"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:[e.jsx("input",{type:"radio",value:"static",checked:k==="static",onChange:()=>b("static"),className:"mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:"静态快照"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:"仅分享此刻的对话内容,后续更新不会同步"})]})]})]})]}),e.jsxs("button",{onClick:N,disabled:p,className:"w-full flex items-center justify-center gap-2 py-2.5 px-4 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 text-white text-sm font-medium rounded-lg transition-colors",children:[p?e.jsx(bt,{className:"w-4 h-4 animate-spin"}):e.jsx(Cn,{className:"w-4 h-4"}),p?"处理中...":"开始分享"]})]})})]})})}const No=(r,o)=>{const l=new Date(r),u=o;if(isNaN(l.getTime()))return"Unknown";const c=u-l,m=Math.floor(c/1e3),d=Math.floor(c/(1e3*60)),s=Math.floor(c/(1e3*60*60)),p=Math.floor(c/(1e3*60*60*24));return m<60?"Just now":d===1?"1 min ago":d<60?`${d} mins ago`:s===1?"1 hour ago":s<24?`${s} hours ago`:p===1?"1 day ago":p<7?`${p} days ago`:l.toLocaleDateString()};function So({projects:r,selectedProject:o,selectedSession:l,onProjectSelect:u,onSessionSelect:c,onNewSession:m,onSessionDelete:d,onProjectDelete:s,isLoading:p,onRefresh:t,onShowSettings:x,onShowAdmin:h,isPWA:a,isMobile:i,onToggleSidebar:g}){const{showAlert:v,showConfirm:k}=lt(),{user:b,isAdmin:j,hasPermission:f}=Ot(),[w,N]=n.useState(new Set),[L,E]=n.useState(null),[S,R]=n.useState(!1),[M,D]=n.useState(!1),[$,T]=n.useState(""),[X,_]=n.useState({}),[te,ne]=n.useState({}),[Y,le]=n.useState(new Set),[de,fe]=n.useState(new Date),[Ee,ye]=n.useState("name"),[Me,Fe]=n.useState(!1),[ie,Se]=n.useState(null),[He,Be]=n.useState(""),[he,Oe]=n.useState({}),[De,Ye]=n.useState({}),[Xe,Je]=n.useState(null),[Ce,_e]=n.useState(""),[$e,ze]=n.useState(!1),[Re,Ze]=n.useState(""),[Qe,K]=n.useState(""),[B,C]=n.useState(()=>{try{const O=localStorage.getItem("starredProjects");return O?new Set(JSON.parse(O)):new Set}catch(O){return console.error("Error loading starred projects:",O),new Set}});n.useEffect(()=>{fetch("/api/version").then(O=>O.json()).then(O=>K(O.version||"")).catch(()=>{})},[]);const V=O=>se=>{se.target.closest(".overflow-y-auto")||se.target.closest("[data-scroll-container]")||(se.preventDefault(),se.stopPropagation(),O())};n.useEffect(()=>{const O=setInterval(()=>{fe(new Date)},6e4);return()=>clearInterval(O)},[]),n.useEffect(()=>{ne({}),le(new Set)},[r]),n.useEffect(()=>{l&&o&&N(O=>new Set([...O,o.name]))},[l,o]),n.useEffect(()=>{if(r.length>0&&!p){const O=new Set;r.forEach(se=>{se.sessions&&se.sessions.length>=0&&O.add(se.name)}),le(O)}},[r,p]),n.useEffect(()=>{const O=()=>{try{const we=localStorage.getItem("claude-settings");if(we){const Z=JSON.parse(we);ye(Z.projectSortOrder||"name")}}catch(we){console.error("Error loading sort order:",we)}};O();const se=we=>{we.key==="claude-settings"&&O()};window.addEventListener("storage",se);const ke=setInterval(()=>{document.hasFocus()&&O()},1e3);return()=>{window.removeEventListener("storage",se),clearInterval(ke)}},[]);const z=O=>{const se=new Set;w.has(O)||se.add(O),N(se)},re=(O,se)=>{c({...O,__projectName:se})},G=O=>{const se=new Set(B);se.has(O)?se.delete(O):se.add(O),C(se);try{localStorage.setItem("starredProjects",JSON.stringify([...se]))}catch(ke){console.error("Error saving starred projects:",ke)}},ae=O=>B.has(O),ce=O=>[...O.sessions||[],...te[O.name]||[]].map(ke=>({...ke,__provider:"claude"})).sort((ke,we)=>new Date(we.lastActivity)-new Date(ke.lastActivity)),Pe=O=>{const se=ce(O);return se.length===0?O.lastActivity?new Date(O.lastActivity):O.createdAt?new Date(O.createdAt):new Date(0):se.reduce((we,Z)=>{const We=new Date(Z.lastActivity);return We>we?We:we},new Date(0))},xe=[...r].sort((O,se)=>{const ke=ae(O.name),we=ae(se.name);if(ke&&!we)return-1;if(!ke&&we)return 1;if(Ee==="date")return Pe(se)-Pe(O);{const Z=O.displayName||O.name,We=se.displayName||se.name;return Z.localeCompare(We)}}),Le=O=>{E(O.name),T(O.displayName)},oe=()=>{E(null),T("")},be=async O=>{try{(await me.renameProject(O,$)).ok?window.refreshProjects?window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(se){console.error("Error renaming project:",se)}E(null),T("")},at=async(O,se,ke="claude")=>{if(await k("确定要删除此会话吗?此操作不可撤销。",{title:"删除会话",variant:"danger",confirmText:"确认删除"}))try{console.log("[Sidebar] Deleting session:",{projectName:O,sessionId:se,provider:ke});const Z=await me.deleteSession(O,se);if(console.log("[Sidebar] Delete response:",{ok:Z.ok,status:Z.status}),Z.ok)console.log("[Sidebar] Session deleted successfully, calling callback"),d?d(se):console.warn("[Sidebar] No onSessionDelete callback provided");else{const We=await Z.text();console.error("[Sidebar] Failed to delete session:",{status:Z.status,error:We}),v("删除会话失败,请重试。",{variant:"error"})}}catch(Z){console.error("[Sidebar] Error deleting session:",Z),v("删除会话出错,请重试。",{variant:"error"})}},Ae=async(O,se,ke)=>{if(!ke||!ke.trim()){Se(null),Be("");return}const we=ke.trim();Oe(Z=>({...Z,[se]:we})),Se(null),Be("");try{(await me.renameSession(O,se,we)).ok||(Oe(We=>{const tt={...We};return delete tt[se],tt}),v("重命名会话失败,请重试。",{variant:"error"}))}catch(Z){console.error("[Sidebar] Error renaming session:",Z),Oe(We=>{const tt={...We};return delete tt[se],tt}),v("重命名会话出错,请重试。",{variant:"error"})}},dt=async(O,se)=>{if(await k(`确定要删除项目 "${se||O}" 吗?`,{title:"删除项目",subtitle:"此操作不可撤销",detail:"将同时删除:所有会话记录(JSONL 文件)和项目文件夹及其所有内容。",variant:"danger",confirmText:"确认删除"}))try{const we=await me.deleteProject(O,!0);if(we.ok)s&&s(O);else{const Z=await we.json();console.error("Failed to delete project"),v(Z.error||"删除项目失败,请重试。",{variant:"error"})}}catch(we){console.error("Error deleting project:",we),v("删除项目出错,请重试。",{variant:"error"})}},gt=async O=>{if(!(!(O.sessionMeta?.hasMore!==!1)||X[O.name])){_(ke=>({...ke,[O.name]:!0}));try{const ke=(O.sessions?.length||0)+(te[O.name]?.length||0),we=await me.sessions(O.name,5,ke);if(we.ok){const Z=await we.json();ne(We=>({...We,[O.name]:[...We[O.name]||[],...Z.sessions]})),Z.hasMore===!1&&(O.sessionMeta={...O.sessionMeta,hasMore:!1})}}catch(ke){console.error("Error loading more sessions:",ke)}finally{_(ke=>({...ke,[O.name]:!1}))}}},F=xe.filter(O=>{if(!Ce.trim())return!0;const se=Ce.toLowerCase(),ke=(O.displayName||O.name).toLowerCase(),we=O.name.toLowerCase();return ke.includes(se)||we.includes(se)}),Te=O=>{u(O)};return e.jsxs(e.Fragment,{children:[S&&Hr.createPortal(e.jsx(xi,{onClose:()=>R(!1),onProjectCreated:O=>{window.refreshProjects?window.refreshProjects():window.location.reload()}}),document.body),M&&Hr.createPortal(e.jsx(gi,{projects:r,onClose:()=>D(!1)}),document.body),$e&&Hr.createPortal(e.jsx(qn,{projects:r,initialProjectKey:Re,onClose:()=>ze(!1),onSubmitted:()=>ze(!1)}),document.body),Xe&&e.jsx(gs,{sessionId:Xe.id,projectName:Xe.projectName,sessionTitle:Xe.summary,isOpen:!0,onClose:()=>Je(null)}),e.jsxs("div",{className:"h-full flex flex-col bg-card md:select-none",style:a&&i?{paddingTop:"44px"}:{},children:[e.jsxs("div",{className:"md:p-4 md:border-b md:border-border",children:[e.jsxs("div",{className:"hidden md:flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:"/logo.svg",className:"w-8 h-8",alt:Ve}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("h1",{className:"text-lg font-bold text-foreground",children:Ve}),e.jsx("span",{className:"text-xs text-muted-foreground/60",children:Qe?`v${Qe}`:""})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:fs})]})]}),g&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 px-0 hover:bg-accent transition-colors duration-200",onClick:g,title:"收起侧边栏",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})})]}),e.jsx("div",{className:"md:hidden p-3 border-b border-border",style:a&&i?{paddingTop:"16px"}:{},children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:"/logo.svg",className:"w-8 h-8",alt:Ve}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:Ve}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"项目"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{className:"w-8 h-8 rounded-md bg-background border border-border flex items-center justify-center active:scale-95 transition-all duration-150",onClick:async()=>{Fe(!0);try{await t()}finally{Fe(!1)}},disabled:Me,children:e.jsx(st,{className:`w-4 h-4 text-foreground ${Me?"animate-spin":""}`})}),e.jsx("button",{className:"w-8 h-8 rounded-md bg-background border border-border flex items-center justify-center active:scale-95 transition-all duration-150",onClick:()=>D(!0),children:e.jsx(It,{className:"w-4 h-4 text-foreground"})}),f("create_project")&&e.jsx("button",{className:"w-8 h-8 rounded-md bg-primary text-primary-foreground flex items-center justify-center active:scale-95 transition-all duration-150",onClick:()=>R(!0),children:e.jsx(Tr,{className:"w-4 h-4"})})]})]})})]}),!p&&!i&&e.jsx("div",{className:"px-3 md:px-4 py-2 border-b border-border",children:e.jsxs("div",{className:"flex gap-2",children:[f("create_project")&&e.jsxs(U,{variant:"default",size:"sm",className:"flex-1 h-8 text-xs bg-primary hover:bg-primary/90 transition-all duration-200",onClick:()=>R(!0),title:"新建项目",children:[e.jsx(Tr,{className:"w-3.5 h-3.5 mr-1.5"}),"新建项目"]}),e.jsxs(U,{variant:"default",size:"sm",className:"flex-1 h-8 text-xs bg-primary hover:bg-primary/90 transition-all duration-200",onClick:()=>D(!0),title:"使用项目模板",children:[e.jsx(It,{className:"w-3.5 h-3.5 mr-1.5"}),"使用项目模板"]}),e.jsx(U,{variant:"outline",size:"sm",className:"h-8 w-8 px-0 hover:bg-accent transition-colors duration-200 group",onClick:async()=>{Fe(!0);try{await t()}finally{Fe(!1)}},disabled:Me,title:"刷新项目和会话 (Ctrl+R)",children:e.jsx(st,{className:`w-3.5 h-3.5 ${Me?"animate-spin":""} group-hover:rotate-180 transition-transform duration-300`})})]})}),r.length>0&&!p&&e.jsx("div",{className:"px-3 md:px-4 py-2 border-b border-border",children:e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(ct,{type:"text",placeholder:"搜索项目...",value:Ce,onChange:O=>_e(O.target.value),className:"pl-9 h-9 text-sm bg-muted/50 border-0 focus:bg-background focus:ring-1 focus:ring-primary/20"}),Ce&&e.jsx("button",{onClick:()=>_e(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 p-1 hover:bg-accent rounded",children:e.jsx(Ge,{className:"w-3 h-3 text-muted-foreground"})})]})}),e.jsx(Jn,{className:"flex-1 md:px-2 md:py-3 overflow-y-auto overscroll-contain",children:e.jsx("div",{className:"md:space-y-1 pb-safe-area-inset-bottom",children:p?e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"加载项目中..."}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取您的项目和会话"})]}):r.length===0?e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx(Zt,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"未找到项目"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["请先创建一个项目,开始与 ",Ve," 进行交流"]})]}):F.length===0?e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx(Mt,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"无匹配的项目"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"尝试调整搜索条件"})]}):F.map(O=>{const se=w.has(O.name),ke=o?.name===O.name,we=ae(O.name);return e.jsxs("div",{className:"md:space-y-1",children:[e.jsxs("div",{className:"group md:group",children:[e.jsx("div",{className:"md:hidden",children:e.jsx("div",{className:ot("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",ke&&"bg-primary/5 border-primary/20",we&&!ke&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:()=>{z(O.name)},onTouchEnd:V(()=>z(O.name)),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:ot("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",se?"bg-primary/10":"bg-muted"),children:se?e.jsx(Xr,{className:"w-4 h-4 text-primary"}):e.jsx(Zt,{className:"w-4 h-4 text-muted-foreground"})}),e.jsx("div",{className:"min-w-0 flex-1",children:L===O.name?e.jsx("input",{type:"text",value:$,onChange:Z=>T(Z.target.value),className:"w-full px-3 py-2 text-sm border-2 border-primary/40 focus:border-primary rounded-lg bg-background text-foreground shadow-sm focus:shadow-md transition-all duration-200 focus:outline-none",placeholder:"项目名称",autoFocus:!0,autoComplete:"off",onClick:Z=>Z.stopPropagation(),onKeyDown:Z=>{Z.key==="Enter"&&be(O.name),Z.key==="Escape"&&oe()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-center justify-between min-w-0 flex-1",children:e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:O.displayName}),O.agentInfo?.isAgent&&e.jsx("span",{className:"flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full bg-blue-100 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400 font-medium leading-none",children:"Agent"})]})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(()=>{const Z=ce(O).length;return`${O.sessionMeta?.hasMore!==!1&&Z>=5?`${Z}+`:Z} 会话`})()})]})})]}),e.jsx("div",{className:"flex items-center gap-1",children:L===O.name?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"w-8 h-8 rounded-lg bg-green-500 dark:bg-green-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:Z=>{Z.stopPropagation(),be(O.name)},children:e.jsx(pr,{className:"w-4 h-4 text-white"})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-gray-500 dark:bg-gray-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:Z=>{Z.stopPropagation(),oe()},children:e.jsx(Ge,{className:"w-4 h-4 text-white"})})]}):e.jsxs(e.Fragment,{children:[f("submit_agent")&&e.jsx("button",{className:"w-8 h-8 rounded-lg bg-blue-500/10 dark:bg-blue-900/30 flex items-center justify-center active:scale-90 transition-all duration-150 border border-blue-200 dark:border-blue-800",onClick:Z=>{Z.stopPropagation(),Ze(O.name),ze(!0)},onTouchEnd:V(()=>{Ze(O.name),ze(!0)}),title:"共享项目模板",children:e.jsx(Ht,{className:"w-4 h-4 text-blue-500"})}),e.jsx("button",{className:ot("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",we?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:Z=>{Z.stopPropagation(),G(O.name)},onTouchEnd:V(()=>G(O.name)),title:we?"从收藏中移除":"添加到收藏",children:e.jsx(yo,{className:ot("w-4 h-4 transition-colors",we?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-red-500/10 dark:bg-red-900/30 flex items-center justify-center active:scale-90 border border-red-200 dark:border-red-800",onClick:Z=>{Z.stopPropagation(),dt(O.name,O.displayName)},onTouchEnd:V(()=>dt(O.name,O.displayName)),children:e.jsx(vt,{className:"w-4 h-4 text-red-600 dark:text-red-400"})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-primary/10 dark:bg-primary/20 flex items-center justify-center active:scale-90 border border-primary/20 dark:border-primary/30",onClick:Z=>{Z.stopPropagation(),Le(O)},onTouchEnd:V(()=>Le(O)),children:e.jsx(En,{className:"w-4 h-4 text-primary"})}),e.jsx("div",{className:"w-6 h-6 rounded-md bg-muted/30 flex items-center justify-center",children:se?e.jsx(Vt,{className:"w-3 h-3 text-muted-foreground"}):e.jsx(Br,{className:"w-3 h-3 text-muted-foreground"})})]})})]})})}),e.jsxs(U,{variant:"ghost",className:ot("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",ke&&"bg-accent text-accent-foreground",we&&!ke&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:()=>{o?.name!==O.name&&Te(O),z(O.name)},onTouchEnd:V(()=>{o?.name!==O.name&&Te(O),z(O.name)}),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[se?e.jsx(Xr,{className:"w-4 h-4 text-primary flex-shrink-0"}):e.jsx(Zt,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsx("div",{className:"min-w-0 flex-1 text-left",children:L===O.name?e.jsxs("div",{className:"space-y-1",children:[e.jsx("input",{type:"text",value:$,onChange:Z=>T(Z.target.value),className:"w-full px-2 py-1 text-sm border border-border rounded bg-background text-foreground focus:ring-2 focus:ring-primary/20",placeholder:"项目名称",autoFocus:!0,onKeyDown:Z=>{Z.key==="Enter"&&be(O.name),Z.key==="Escape"&&oe()}}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",title:Ue(O.fullPath),children:Ue(O.fullPath)})]}):e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold truncate text-foreground",title:O.displayName,children:O.displayName}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[(()=>{const Z=ce(O).length;return O.sessionMeta?.hasMore!==!1&&Z>=5?`${Z}+`:Z})(),O.fullPath!==O.displayName&&e.jsxs("span",{className:"ml-1 opacity-60",title:Ue(O.fullPath),children:["• ",(()=>{const Z=Ue(O.fullPath);return Z.length>25?"..."+Z.slice(-22):Z})()]})]})]})})]}),e.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:L===O.name?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-6 h-6 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-900/20 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:Z=>{Z.stopPropagation(),be(O.name)},children:e.jsx(pr,{className:"w-3 h-3"})}),e.jsx("div",{className:"w-6 h-6 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:Z=>{Z.stopPropagation(),oe()},children:e.jsx(Ge,{className:"w-3 h-3"})})]}):e.jsxs(e.Fragment,{children:[f("submit_agent")&&e.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-blue-50 dark:hover:bg-blue-900/20 flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:Z=>{Z.stopPropagation(),Ze(O.name),ze(!0)},title:"共享项目模板",children:e.jsx(Ht,{className:"w-3 h-3 text-blue-500"})}),e.jsx("div",{className:ot("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",we?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:Z=>{Z.stopPropagation(),G(O.name)},title:we?"从收藏中移除":"添加到收藏",children:e.jsx(yo,{className:ot("w-3 h-3 transition-colors",we?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),e.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-accent flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:Z=>{Z.stopPropagation(),Le(O)},title:"重命名项目 (F2)",children:e.jsx(En,{className:"w-3 h-3"})}),e.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:Z=>{Z.stopPropagation(),dt(O.name,O.displayName)},title:"删除项目",children:e.jsx(vt,{className:"w-3 h-3 text-red-600 dark:text-red-400"})}),se?e.jsx(Vt,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"}):e.jsx(Br,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"})]})})]})]}),se&&e.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[Y.has(O.name)?ce(O).length===0&&!X[O.name]?e.jsx("div",{className:"py-2 px-3 text-left",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:"还没有会话"})}):ce(O).map(Z=>{const We=new Date(Z.lastActivity),ft=Math.floor((de-We)/(1e3*60))<10,ht=he[Z.id]||Z.summary||"新会话",hr=Z.lastActivity,jt=Z.messageCount||0;return e.jsxs("div",{className:"group relative",children:[ft&&e.jsx("div",{className:"absolute left-0 top-1/2 transform -translate-y-1/2 -translate-x-1",children:e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"})}),e.jsx("div",{className:"md:hidden",children:e.jsx("div",{className:ot("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",l?.id===Z.id?"bg-primary/5 border-primary/20":ft?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:()=>{Te(O),re(Z,O.name)},onTouchEnd:V(()=>{Te(O),re(Z,O.name)}),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:ht}),e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx(Mr,{className:"w-2.5 h-2.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:No(hr,de)}),jt>0&&e.jsx(nt,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:jt})]})]}),e.jsx("button",{className:"w-5 h-5 rounded-md bg-red-50 dark:bg-red-900/20 flex items-center justify-center active:scale-95 transition-transform opacity-70 ml-1",onClick:et=>{et.stopPropagation(),at(O.name,Z.id)},onTouchEnd:V(()=>at(O.name,Z.id)),children:e.jsx(vt,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})]})})}),e.jsxs("div",{className:"hidden md:block",children:[e.jsx(U,{variant:"ghost",className:ot("w-full justify-start p-2 h-auto font-normal text-left hover:bg-accent/50 transition-colors duration-200",l?.id===Z.id&&"bg-accent text-accent-foreground"),onClick:()=>re(Z,O.name),onTouchEnd:V(()=>re(Z,O.name)),children:e.jsx("div",{className:"flex items-start gap-2 min-w-0 w-full",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:ht}),e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx(Mr,{className:"w-2.5 h-2.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:No(hr,de)}),jt>0&&e.jsx(nt,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:jt})]})]})})}),e.jsx("div",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-all duration-200",children:ie===Z.id?e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",value:He,onChange:et=>Be(et.target.value),onKeyDown:et=>{et.stopPropagation(),et.key==="Enter"?Ae(O.name,Z.id,He):et.key==="Escape"&&(Se(null),Be(""))},onClick:et=>et.stopPropagation(),className:"w-32 px-2 py-1 text-xs border border-border rounded bg-background focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),e.jsx("button",{className:"w-6 h-6 bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40 rounded flex items-center justify-center",onClick:et=>{et.stopPropagation(),Ae(O.name,Z.id,He)},title:"Save",children:e.jsx(pr,{className:"w-3 h-3 text-green-600 dark:text-green-400"})}),e.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:et=>{et.stopPropagation(),Se(null),Be("")},title:"Cancel",children:e.jsx(Ge,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:et=>{et.stopPropagation(),Se(Z.id),Be(he[Z.id]||Z.summary||"新会话")},title:"手动编辑会话名称",children:e.jsx(Xa,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{className:"w-6 h-6 bg-blue-50 hover:bg-blue-100 dark:bg-blue-900/20 dark:hover:bg-blue-900/40 rounded flex items-center justify-center",onClick:et=>{et.stopPropagation(),Je({id:Z.id,projectName:O.name,summary:he[Z.id]||Z.summary||null})},title:"分享会话",children:e.jsx(Cn,{className:"w-3 h-3 text-blue-600 dark:text-blue-400"})}),e.jsx("button",{className:"w-6 h-6 bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40 rounded flex items-center justify-center",onClick:et=>{et.stopPropagation(),at(O.name,Z.id)},title:"永久删除此会话",children:e.jsx(vt,{className:"w-3 h-3 text-red-600 dark:text-red-400"})})]})})]})]},Z.id)}):Array.from({length:3}).map((Z,We)=>e.jsx("div",{className:"p-2 rounded-md",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-3 h-3 bg-muted rounded-full animate-pulse mt-0.5"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("div",{className:"h-3 bg-muted rounded animate-pulse",style:{width:`${60+We*15}%`}}),e.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-1/2"})]})]})},We)),ce(O).length>0&&O.sessionMeta?.hasMore!==!1&&e.jsx(U,{variant:"ghost",size:"sm",className:"w-full justify-center gap-2 mt-2 text-muted-foreground",onClick:()=>gt(O),disabled:X[O.name],children:X[O.name]?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3 h-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),"加载中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Vt,{className:"w-3 h-3"}),"显示更多会话"]})}),e.jsx("div",{className:"md:hidden px-3 pb-2",children:e.jsxs("button",{className:"w-full h-8 bg-primary hover:bg-primary/90 text-primary-foreground rounded-md flex items-center justify-center gap-2 font-medium text-xs active:scale-[0.98] transition-all duration-150",onClick:()=>{Te(O),m(O)},children:[e.jsx(zt,{className:"w-3 h-3"}),"新会话"]})}),e.jsxs(U,{variant:"default",size:"sm",className:"hidden md:flex w-full justify-start gap-2 mt-1 h-8 text-xs font-medium bg-primary hover:bg-primary/90 text-primary-foreground transition-colors",onClick:()=>m(O),children:[e.jsx(zt,{className:"w-3 h-3"}),"新会话"]})]})]},O.name)})})}),e.jsxs("div",{className:"md:p-2 md:border-t md:border-border flex-shrink-0",children:[e.jsxs("div",{className:"md:hidden p-4 pb-20 border-t border-border/50 space-y-2",children:[e.jsxs("button",{className:"w-full h-14 bg-muted/50 hover:bg-muted/70 rounded-2xl flex items-center justify-start gap-4 px-4 active:scale-[0.98] transition-all duration-150",onClick:x,children:[e.jsx("div",{className:"w-10 h-10 rounded-2xl bg-background/80 flex items-center justify-center",children:e.jsx(Ut,{className:"w-5 h-5 text-muted-foreground"})}),e.jsx("span",{className:"text-lg font-medium text-foreground",children:"设置"})]}),j&&e.jsxs("button",{className:"w-full h-14 bg-muted/50 hover:bg-muted/70 rounded-2xl flex items-center justify-start gap-4 px-4 active:scale-[0.98] transition-all duration-150",onClick:h,children:[e.jsx("div",{className:"w-10 h-10 rounded-2xl bg-background/80 flex items-center justify-center",children:e.jsx(Gt,{className:"w-5 h-5 text-muted-foreground"})}),e.jsx("span",{className:"text-lg font-medium text-foreground",children:"管理"})]})]}),e.jsxs(U,{variant:"ghost",className:"hidden md:flex w-full justify-start gap-2 p-2 h-auto font-normal text-muted-foreground hover:text-foreground hover:bg-accent transition-colors duration-200",onClick:x,children:[e.jsx(Ut,{className:"w-3 h-3"}),e.jsx("span",{className:"text-xs",children:"设置"})]}),j&&e.jsxs(U,{variant:"ghost",className:"hidden md:flex w-full justify-start gap-2 p-2 h-auto font-normal text-muted-foreground hover:text-foreground hover:bg-accent transition-colors duration-200",onClick:h,children:[e.jsx(Gt,{className:"w-3 h-3"}),e.jsx("span",{className:"text-xs",children:"管理"})]})]})]})]})}const ys={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}};var yn={exports:{}},bn,To;function yi(){if(To)return bn;To=1;var r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return bn=r,bn}var vn,Xo;function bi(){if(Xo)return vn;Xo=1;var r=yi();function o(){}function l(){}return l.resetWarningCache=o,vn=function(){function u(d,s,p,t,x,h){if(h!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}u.isRequired=u;function c(){return u}var m={array:u,bigint:u,bool:u,func:u,number:u,object:u,string:u,symbol:u,any:u,arrayOf:c,element:u,elementType:u,instanceOf:c,node:u,objectOf:c,oneOf:c,oneOfType:c,shape:c,exact:c,checkPropTypes:l,resetWarningCache:o};return m.PropTypes=m,m},vn}var Mo;function vi(){return Mo||(Mo=1,yn.exports=bi()()),yn.exports}var ji=vi();const qe=Zr(ji);function er(r,o,l,u){function c(m){return m instanceof l?m:new l(function(d){d(m)})}return new(l||(l=Promise))(function(m,d){function s(x){try{t(u.next(x))}catch(h){d(h)}}function p(x){try{t(u.throw(x))}catch(h){d(h)}}function t(x){x.done?m(x.value):c(x.value).then(s,p)}t((u=u.apply(r,o||[])).next())})}const ki=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function fr(r,o,l){const u=wi(r),{webkitRelativePath:c}=r,m=typeof o=="string"?o:typeof c=="string"&&c.length>0?c:`./${r.name}`;return typeof u.path!="string"&&Oo(u,"path",m),Oo(u,"relativePath",m),u}function wi(r){const{name:o}=r;if(o&&o.lastIndexOf(".")!==-1&&!r.type){const u=o.split(".").pop().toLowerCase(),c=ki.get(u);c&&Object.defineProperty(r,"type",{value:c,writable:!1,configurable:!1,enumerable:!0})}return r}function Oo(r,o,l){Object.defineProperty(r,o,{value:l,writable:!1,configurable:!1,enumerable:!0})}const Ni=[".DS_Store","Thumbs.db"];function Si(r){return er(this,void 0,void 0,function*(){return Jr(r)&&Ti(r.dataTransfer)?Ci(r.dataTransfer,r.type):Xi(r)?Mi(r):Array.isArray(r)&&r.every(o=>"getFile"in o&&typeof o.getFile=="function")?Oi(r):[]})}function Ti(r){return Jr(r)}function Xi(r){return Jr(r)&&Jr(r.target)}function Jr(r){return typeof r=="object"&&r!==null}function Mi(r){return Ln(r.target.files).map(o=>fr(o))}function Oi(r){return er(this,void 0,void 0,function*(){return(yield Promise.all(r.map(l=>l.getFile()))).map(l=>fr(l))})}function Ci(r,o){return er(this,void 0,void 0,function*(){if(r.items){const l=Ln(r.items).filter(c=>c.kind==="file");if(o!=="drop")return l;const u=yield Promise.all(l.map(Ei));return Co(bs(u))}return Co(Ln(r.files).map(l=>fr(l)))})}function Co(r){return r.filter(o=>Ni.indexOf(o.name)===-1)}function Ln(r){if(r===null)return[];const o=[];for(let l=0;l<r.length;l++){const u=r[l];o.push(u)}return o}function Ei(r){if(typeof r.webkitGetAsEntry!="function")return Eo(r);const o=r.webkitGetAsEntry();return o&&o.isDirectory?vs(o):Eo(r,o)}function bs(r){return r.reduce((o,l)=>[...o,...Array.isArray(l)?bs(l):[l]],[])}function Eo(r,o){return er(this,void 0,void 0,function*(){var l;if(globalThis.isSecureContext&&typeof r.getAsFileSystemHandle=="function"){const m=yield r.getAsFileSystemHandle();if(m===null)throw new Error(`${r} is not a File`);if(m!==void 0){const d=yield m.getFile();return d.handle=m,fr(d)}}const u=r.getAsFile();if(!u)throw new Error(`${r} is not a File`);return fr(u,(l=o?.fullPath)!==null&&l!==void 0?l:void 0)})}function Di(r){return er(this,void 0,void 0,function*(){return r.isDirectory?vs(r):Pi(r)})}function vs(r){const o=r.createReader();return new Promise((l,u)=>{const c=[];function m(){o.readEntries(d=>er(this,void 0,void 0,function*(){if(d.length){const s=Promise.all(d.map(Di));c.push(s),m()}else try{const s=yield Promise.all(c);l(s)}catch(s){u(s)}}),d=>{u(d)})}m()})}function Pi(r){return er(this,void 0,void 0,function*(){return new Promise((o,l)=>{r.file(u=>{const c=fr(u,r.fullPath);o(c)},u=>{l(u)})})})}var $r={},Do;function Ai(){return Do||(Do=1,$r.__esModule=!0,$r.default=function(r,o){if(r&&o){var l=Array.isArray(o)?o:o.split(",");if(l.length===0)return!0;var u=r.name||"",c=(r.type||"").toLowerCase(),m=c.replace(/\/.*$/,"");return l.some(function(d){var s=d.trim().toLowerCase();return s.charAt(0)==="."?u.toLowerCase().endsWith(s):s.endsWith("/*")?m===s.replace(/\/.*$/,""):c===s})}return!0}),$r}var Li=Ai();const jn=Zr(Li);function Po(r){return zi(r)||_i(r)||ks(r)||Ii()}function Ii(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
19
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _i(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function zi(r){if(Array.isArray(r))return In(r)}function Ao(r,o){var l=Object.keys(r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(r);o&&(u=u.filter(function(c){return Object.getOwnPropertyDescriptor(r,c).enumerable})),l.push.apply(l,u)}return l}function Lo(r){for(var o=1;o<arguments.length;o++){var l=arguments[o]!=null?arguments[o]:{};o%2?Ao(Object(l),!0).forEach(function(u){js(r,u,l[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(l)):Ao(Object(l)).forEach(function(u){Object.defineProperty(r,u,Object.getOwnPropertyDescriptor(l,u))})}return r}function js(r,o,l){return o in r?Object.defineProperty(r,o,{value:l,enumerable:!0,configurable:!0,writable:!0}):r[o]=l,r}function Or(r,o){return Wi(r)||$i(r,o)||ks(r,o)||Ri()}function Ri(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
20
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ks(r,o){if(r){if(typeof r=="string")return In(r,o);var l=Object.prototype.toString.call(r).slice(8,-1);if(l==="Object"&&r.constructor&&(l=r.constructor.name),l==="Map"||l==="Set")return Array.from(r);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return In(r,o)}}function In(r,o){(o==null||o>r.length)&&(o=r.length);for(var l=0,u=new Array(o);l<o;l++)u[l]=r[l];return u}function $i(r,o){var l=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(l!=null){var u=[],c=!0,m=!1,d,s;try{for(l=l.call(r);!(c=(d=l.next()).done)&&(u.push(d.value),!(o&&u.length===o));c=!0);}catch(p){m=!0,s=p}finally{try{!c&&l.return!=null&&l.return()}finally{if(m)throw s}}return u}}function Wi(r){if(Array.isArray(r))return r}var Fi=typeof jn=="function"?jn:jn.default,Hi="file-invalid-type",Bi="file-too-large",Ui="file-too-small",Gi="too-many-files",Yi=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",l=o.split(","),u=l.length>1?"one of ".concat(l.join(", ")):l[0];return{code:Hi,message:"File type must be ".concat(u)}},Io=function(o){return{code:Bi,message:"File is larger than ".concat(o," ").concat(o===1?"byte":"bytes")}},_o=function(o){return{code:Ui,message:"File is smaller than ".concat(o," ").concat(o===1?"byte":"bytes")}},Ji={code:Gi,message:"Too many files"};function ws(r,o){var l=r.type==="application/x-moz-file"||Fi(r,o);return[l,l?null:Yi(o)]}function Ns(r,o,l){if(Jt(r.size))if(Jt(o)&&Jt(l)){if(r.size>l)return[!1,Io(l)];if(r.size<o)return[!1,_o(o)]}else{if(Jt(o)&&r.size<o)return[!1,_o(o)];if(Jt(l)&&r.size>l)return[!1,Io(l)]}return[!0,null]}function Jt(r){return r!=null}function qi(r){var o=r.files,l=r.accept,u=r.minSize,c=r.maxSize,m=r.multiple,d=r.maxFiles,s=r.validator;return!m&&o.length>1||m&&d>=1&&o.length>d?!1:o.every(function(p){var t=ws(p,l),x=Or(t,1),h=x[0],a=Ns(p,u,c),i=Or(a,1),g=i[0],v=s?s(p):null;return h&&g&&!v})}function qr(r){return typeof r.isPropagationStopped=="function"?r.isPropagationStopped():typeof r.cancelBubble<"u"?r.cancelBubble:!1}function Wr(r){return r.dataTransfer?Array.prototype.some.call(r.dataTransfer.types,function(o){return o==="Files"||o==="application/x-moz-file"}):!!r.target&&!!r.target.files}function zo(r){r.preventDefault()}function Ki(r){return r.indexOf("MSIE")!==-1||r.indexOf("Trident/")!==-1}function Vi(r){return r.indexOf("Edge/")!==-1}function Zi(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Ki(r)||Vi(r)}function Et(){for(var r=arguments.length,o=new Array(r),l=0;l<r;l++)o[l]=arguments[l];return function(u){for(var c=arguments.length,m=new Array(c>1?c-1:0),d=1;d<c;d++)m[d-1]=arguments[d];return o.some(function(s){return!qr(u)&&s&&s.apply(void 0,[u].concat(m)),qr(u)})}}function Qi(){return"showOpenFilePicker"in window}function el(r){if(Jt(r)){var o=Object.entries(r).filter(function(l){var u=Or(l,2),c=u[0],m=u[1],d=!0;return Ss(c)||(console.warn('Skipped "'.concat(c,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),d=!1),(!Array.isArray(m)||!m.every(Ts))&&(console.warn('Skipped "'.concat(c,'" because an invalid file extension was provided.')),d=!1),d}).reduce(function(l,u){var c=Or(u,2),m=c[0],d=c[1];return Lo(Lo({},l),{},js({},m,d))},{});return[{description:"Files",accept:o}]}return r}function tl(r){if(Jt(r))return Object.entries(r).reduce(function(o,l){var u=Or(l,2),c=u[0],m=u[1];return[].concat(Po(o),[c],Po(m))},[]).filter(function(o){return Ss(o)||Ts(o)}).join(",")}function rl(r){return r instanceof DOMException&&(r.name==="AbortError"||r.code===r.ABORT_ERR)}function nl(r){return r instanceof DOMException&&(r.name==="SecurityError"||r.code===r.SECURITY_ERR)}function Ss(r){return r==="audio/*"||r==="video/*"||r==="image/*"||r==="text/*"||r==="application/*"||/\w+\/[-+.\w]+/g.test(r)}function Ts(r){return/^.*\.[\w]+$/.test(r)}var ol=["children"],sl=["open"],al=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],il=["refKey","onChange","onClick"];function ll(r){return ul(r)||dl(r)||Xs(r)||cl()}function cl(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
21
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dl(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function ul(r){if(Array.isArray(r))return _n(r)}function kn(r,o){return fl(r)||ml(r,o)||Xs(r,o)||pl()}function pl(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
22
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xs(r,o){if(r){if(typeof r=="string")return _n(r,o);var l=Object.prototype.toString.call(r).slice(8,-1);if(l==="Object"&&r.constructor&&(l=r.constructor.name),l==="Map"||l==="Set")return Array.from(r);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return _n(r,o)}}function _n(r,o){(o==null||o>r.length)&&(o=r.length);for(var l=0,u=new Array(o);l<o;l++)u[l]=r[l];return u}function ml(r,o){var l=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(l!=null){var u=[],c=!0,m=!1,d,s;try{for(l=l.call(r);!(c=(d=l.next()).done)&&(u.push(d.value),!(o&&u.length===o));c=!0);}catch(p){m=!0,s=p}finally{try{!c&&l.return!=null&&l.return()}finally{if(m)throw s}}return u}}function fl(r){if(Array.isArray(r))return r}function Ro(r,o){var l=Object.keys(r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(r);o&&(u=u.filter(function(c){return Object.getOwnPropertyDescriptor(r,c).enumerable})),l.push.apply(l,u)}return l}function rt(r){for(var o=1;o<arguments.length;o++){var l=arguments[o]!=null?arguments[o]:{};o%2?Ro(Object(l),!0).forEach(function(u){zn(r,u,l[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(l)):Ro(Object(l)).forEach(function(u){Object.defineProperty(r,u,Object.getOwnPropertyDescriptor(l,u))})}return r}function zn(r,o,l){return o in r?Object.defineProperty(r,o,{value:l,enumerable:!0,configurable:!0,writable:!0}):r[o]=l,r}function Kr(r,o){if(r==null)return{};var l=hl(r,o),u,c;if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(r);for(c=0;c<m.length;c++)u=m[c],!(o.indexOf(u)>=0)&&Object.prototype.propertyIsEnumerable.call(r,u)&&(l[u]=r[u])}return l}function hl(r,o){if(r==null)return{};var l={},u=Object.keys(r),c,m;for(m=0;m<u.length;m++)c=u[m],!(o.indexOf(c)>=0)&&(l[c]=r[c]);return l}var Kn=n.forwardRef(function(r,o){var l=r.children,u=Kr(r,ol),c=Vn(u),m=c.open,d=Kr(c,sl);return n.useImperativeHandle(o,function(){return{open:m}},[m]),mt.createElement(n.Fragment,null,l(rt(rt({},d),{},{open:m})))});Kn.displayName="Dropzone";var Ms={disabled:!1,getFilesFromEvent:Si,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};Kn.defaultProps=Ms;Kn.propTypes={children:qe.func,accept:qe.objectOf(qe.arrayOf(qe.string)),multiple:qe.bool,preventDropOnDocument:qe.bool,noClick:qe.bool,noKeyboard:qe.bool,noDrag:qe.bool,noDragEventsBubbling:qe.bool,minSize:qe.number,maxSize:qe.number,maxFiles:qe.number,disabled:qe.bool,getFilesFromEvent:qe.func,onFileDialogCancel:qe.func,onFileDialogOpen:qe.func,useFsAccessApi:qe.bool,autoFocus:qe.bool,onDragEnter:qe.func,onDragLeave:qe.func,onDragOver:qe.func,onDrop:qe.func,onDropAccepted:qe.func,onDropRejected:qe.func,onError:qe.func,validator:qe.func};var Rn={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Vn(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=rt(rt({},Ms),r),l=o.accept,u=o.disabled,c=o.getFilesFromEvent,m=o.maxSize,d=o.minSize,s=o.multiple,p=o.maxFiles,t=o.onDragEnter,x=o.onDragLeave,h=o.onDragOver,a=o.onDrop,i=o.onDropAccepted,g=o.onDropRejected,v=o.onFileDialogCancel,k=o.onFileDialogOpen,b=o.useFsAccessApi,j=o.autoFocus,f=o.preventDropOnDocument,w=o.noClick,N=o.noKeyboard,L=o.noDrag,E=o.noDragEventsBubbling,S=o.onError,R=o.validator,M=n.useMemo(function(){return tl(l)},[l]),D=n.useMemo(function(){return el(l)},[l]),$=n.useMemo(function(){return typeof k=="function"?k:$o},[k]),T=n.useMemo(function(){return typeof v=="function"?v:$o},[v]),X=n.useRef(null),_=n.useRef(null),te=n.useReducer(xl,Rn),ne=kn(te,2),Y=ne[0],le=ne[1],de=Y.isFocused,fe=Y.isFileDialogActive,Ee=n.useRef(typeof window<"u"&&window.isSecureContext&&b&&Qi()),ye=function(){!Ee.current&&fe&&setTimeout(function(){if(_.current){var C=_.current.files;C.length||(le({type:"closeDialog"}),T())}},300)};n.useEffect(function(){return window.addEventListener("focus",ye,!1),function(){window.removeEventListener("focus",ye,!1)}},[_,fe,T,Ee]);var Me=n.useRef([]),Fe=function(C){X.current&&X.current.contains(C.target)||(C.preventDefault(),Me.current=[])};n.useEffect(function(){return f&&(document.addEventListener("dragover",zo,!1),document.addEventListener("drop",Fe,!1)),function(){f&&(document.removeEventListener("dragover",zo),document.removeEventListener("drop",Fe))}},[X,f]),n.useEffect(function(){return!u&&j&&X.current&&X.current.focus(),function(){}},[X,j,u]);var ie=n.useCallback(function(B){S?S(B):console.error(B)},[S]),Se=n.useCallback(function(B){B.preventDefault(),B.persist(),Re(B),Me.current=[].concat(ll(Me.current),[B.target]),Wr(B)&&Promise.resolve(c(B)).then(function(C){if(!(qr(B)&&!E)){var V=C.length,z=V>0&&qi({files:C,accept:M,minSize:d,maxSize:m,multiple:s,maxFiles:p,validator:R}),re=V>0&&!z;le({isDragAccept:z,isDragReject:re,isDragActive:!0,type:"setDraggedFiles"}),t&&t(B)}}).catch(function(C){return ie(C)})},[c,t,ie,E,M,d,m,s,p,R]),He=n.useCallback(function(B){B.preventDefault(),B.persist(),Re(B);var C=Wr(B);if(C&&B.dataTransfer)try{B.dataTransfer.dropEffect="copy"}catch{}return C&&h&&h(B),!1},[h,E]),Be=n.useCallback(function(B){B.preventDefault(),B.persist(),Re(B);var C=Me.current.filter(function(z){return X.current&&X.current.contains(z)}),V=C.indexOf(B.target);V!==-1&&C.splice(V,1),Me.current=C,!(C.length>0)&&(le({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Wr(B)&&x&&x(B))},[X,x,E]),he=n.useCallback(function(B,C){var V=[],z=[];B.forEach(function(re){var G=ws(re,M),ae=kn(G,2),ce=ae[0],Pe=ae[1],xe=Ns(re,d,m),Le=kn(xe,2),oe=Le[0],be=Le[1],at=R?R(re):null;if(ce&&oe&&!at)V.push(re);else{var Ae=[Pe,be];at&&(Ae=Ae.concat(at)),z.push({file:re,errors:Ae.filter(function(dt){return dt})})}}),(!s&&V.length>1||s&&p>=1&&V.length>p)&&(V.forEach(function(re){z.push({file:re,errors:[Ji]})}),V.splice(0)),le({acceptedFiles:V,fileRejections:z,isDragReject:z.length>0,type:"setFiles"}),a&&a(V,z,C),z.length>0&&g&&g(z,C),V.length>0&&i&&i(V,C)},[le,s,M,d,m,p,a,i,g,R]),Oe=n.useCallback(function(B){B.preventDefault(),B.persist(),Re(B),Me.current=[],Wr(B)&&Promise.resolve(c(B)).then(function(C){qr(B)&&!E||he(C,B)}).catch(function(C){return ie(C)}),le({type:"reset"})},[c,he,ie,E]),De=n.useCallback(function(){if(Ee.current){le({type:"openDialog"}),$();var B={multiple:s,types:D};window.showOpenFilePicker(B).then(function(C){return c(C)}).then(function(C){he(C,null),le({type:"closeDialog"})}).catch(function(C){rl(C)?(T(C),le({type:"closeDialog"})):nl(C)?(Ee.current=!1,_.current?(_.current.value=null,_.current.click()):ie(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):ie(C)});return}_.current&&(le({type:"openDialog"}),$(),_.current.value=null,_.current.click())},[le,$,T,b,he,ie,D,s]),Ye=n.useCallback(function(B){!X.current||!X.current.isEqualNode(B.target)||(B.key===" "||B.key==="Enter"||B.keyCode===32||B.keyCode===13)&&(B.preventDefault(),De())},[X,De]),Xe=n.useCallback(function(){le({type:"focus"})},[]),Je=n.useCallback(function(){le({type:"blur"})},[]),Ce=n.useCallback(function(){w||(Zi()?setTimeout(De,0):De())},[w,De]),_e=function(C){return u?null:C},$e=function(C){return N?null:_e(C)},ze=function(C){return L?null:_e(C)},Re=function(C){E&&C.stopPropagation()},Ze=n.useMemo(function(){return function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},C=B.refKey,V=C===void 0?"ref":C,z=B.role,re=B.onKeyDown,G=B.onFocus,ae=B.onBlur,ce=B.onClick,Pe=B.onDragEnter,xe=B.onDragOver,Le=B.onDragLeave,oe=B.onDrop,be=Kr(B,al);return rt(rt(zn({onKeyDown:$e(Et(re,Ye)),onFocus:$e(Et(G,Xe)),onBlur:$e(Et(ae,Je)),onClick:_e(Et(ce,Ce)),onDragEnter:ze(Et(Pe,Se)),onDragOver:ze(Et(xe,He)),onDragLeave:ze(Et(Le,Be)),onDrop:ze(Et(oe,Oe)),role:typeof z=="string"&&z!==""?z:"presentation"},V,X),!u&&!N?{tabIndex:0}:{}),be)}},[X,Ye,Xe,Je,Ce,Se,He,Be,Oe,N,L,u]),Qe=n.useCallback(function(B){B.stopPropagation()},[]),K=n.useMemo(function(){return function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},C=B.refKey,V=C===void 0?"ref":C,z=B.onChange,re=B.onClick,G=Kr(B,il),ae=zn({accept:M,multiple:s,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:_e(Et(z,Oe)),onClick:_e(Et(re,Qe)),tabIndex:-1},V,_);return rt(rt({},ae),G)}},[_,l,s,Oe,u]);return rt(rt({},Y),{},{isFocused:de&&!u,getRootProps:Ze,getInputProps:K,rootRef:X,inputRef:_,open:_e(De)})}function xl(r,o){switch(o.type){case"focus":return rt(rt({},r),{},{isFocused:!0});case"blur":return rt(rt({},r),{},{isFocused:!1});case"openDialog":return rt(rt({},Rn),{},{isFileDialogActive:!0});case"closeDialog":return rt(rt({},r),{},{isFileDialogActive:!1});case"setDraggedFiles":return rt(rt({},r),{},{isDragActive:o.isDragActive,isDragAccept:o.isDragAccept,isDragReject:o.isDragReject});case"setFiles":return rt(rt({},r),{},{acceptedFiles:o.acceptedFiles,fileRejections:o.fileRejections,isDragReject:o.isDragReject});case"reset":return rt({},Rn);default:return r}}function $o(){}const Wo=({todos:r,isResult:o=!1})=>{if(!r||!Array.isArray(r))return null;const l=c=>{switch(c){case"completed":return e.jsx("svg",{className:"w-3.5 h-3.5 text-green-500 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})});case"in_progress":return e.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-400 animate-pulse flex-shrink-0 mt-0.5"});case"pending":default:return e.jsx("div",{className:"w-2 h-2 rounded-full border border-gray-300 dark:border-gray-600 flex-shrink-0 mt-0.5"})}},u=r.filter(c=>c.status==="completed").length;return e.jsxs("div",{className:"border border-gray-200/60 dark:border-gray-700/40 rounded-lg overflow-hidden my-1.5",children:[o&&e.jsxs("div",{className:"px-3 py-1.5 bg-gray-50 dark:bg-gray-800/60 border-b border-gray-200/60 dark:border-gray-700/40 flex items-center gap-2",children:[e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),e.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["待办事项 · ",u,"/",r.length," 已完成"]})]}),e.jsx("div",{className:"divide-y divide-gray-100 dark:divide-gray-700/40",children:r.map((c,m)=>e.jsxs("div",{className:"flex items-start gap-2.5 px-3 py-2 hover:bg-gray-50 dark:hover:bg-gray-800/30 transition-colors",children:[e.jsx("div",{className:"mt-1",children:l(c.status)}),e.jsx("span",{className:`text-xs flex-1 leading-relaxed ${c.status==="completed"?"line-through text-gray-400 dark:text-gray-500":c.status==="in_progress"?"text-gray-700 dark:text-gray-300 font-medium":"text-gray-500 dark:text-gray-400"}`,children:c.content})]},c.id||`todo-${m}`))})]})},Vr=({className:r="w-5 h-5",size:o})=>{const l=o?{width:o,height:o}:void 0;return e.jsx("img",{src:"/logo.svg",alt:Ve,className:r,style:l})};function gl({status:r,onAbort:o,isLoading:l,provider:u="claude"}){const[c,m]=n.useState(0),[d,s]=n.useState(0),[p,t]=n.useState(0);if(n.useEffect(()=>{if(!l){m(0),t(0);return}const b=Date.now(),j=30+Math.random()*20,f=setInterval(()=>{const w=Math.floor((Date.now()-b)/1e3);m(w),t(Math.floor(w*j))},1e3);return()=>clearInterval(f)},[l]),n.useEffect(()=>{if(!l)return;const b=setInterval(()=>{s(j=>(j+1)%4)},500);return()=>clearInterval(b)},[l]),!l)return null;const x=["思考中","处理中","分析中","工作中","计算中","推理中"],h=Math.floor(c/3)%x.length,a=r?.text||x[h],i=r?.tokens||p,g=r?.can_interrupt!==!1,k=["✻","✹","✸","✶"][d];return e.jsx("div",{className:"w-full mb-3 sm:mb-6 animate-in slide-in-from-bottom duration-300",children:e.jsxs("div",{className:"flex items-center justify-between max-w-4xl mx-auto bg-gray-800 dark:bg-gray-900 text-white rounded-lg shadow-lg px-2.5 py-2 sm:px-4 sm:py-3 border border-gray-700 dark:border-gray-800",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx("span",{className:ot("text-base sm:text-xl transition-all duration-500 flex-shrink-0",d%2===0?"text-blue-400 scale-110":"text-blue-300"),children:k}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[e.jsxs("span",{className:"font-medium text-xs sm:text-sm truncate",children:[a,"..."]}),e.jsxs("span",{className:"text-gray-400 text-xs sm:text-sm flex-shrink-0",children:["(",c,"s)"]}),i>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-500 hidden sm:inline",children:"·"}),e.jsxs("span",{className:"text-gray-300 text-xs sm:text-sm hidden sm:inline flex-shrink-0",children:["⚒ ",i.toLocaleString()]})]}),e.jsx("span",{className:"text-gray-500 hidden sm:inline",children:"·"}),e.jsx("span",{className:"text-gray-400 text-xs sm:text-sm hidden sm:inline",children:"按 esc 停止"})]})})]})}),g&&o&&e.jsxs("button",{onClick:o,className:"ml-2 sm:ml-3 text-xs bg-red-600 hover:bg-red-700 active:bg-red-800 text-white px-2 py-1 sm:px-3 sm:py-1.5 rounded-md transition-colors flex items-center gap-1 sm:gap-1.5 flex-shrink-0 font-medium",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),e.jsx("span",{className:"hidden sm:inline",children:"停止"})]})]})})}async function yl(r,o){const l=new FormData,u=`recording_${Date.now()}.webm`,c=new File([r],u,{type:r.type});l.append("audio",c);const m=window.localStorage.getItem("whisperMode")||"default";l.append("mode",m);try{const d=await me.transcribe(l);if(!d.ok){const p=await d.json().catch(()=>({}));throw new Error(p.error||`Transcription error: ${d.status} ${d.statusText}`)}return(await d.json()).text||""}catch(d){throw d.name==="TypeError"&&d.message.includes("fetch")?new Error("Cannot connect to server. Please ensure the backend is running."):d}}function bl({onTranscript:r,className:o=""}){const[l,u]=n.useState("idle"),[c,m]=n.useState(null),[d,s]=n.useState(!0),p=n.useRef(null),t=n.useRef(null),x=n.useRef([]),h=n.useRef(0);n.useEffect(()=>{(()=>{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){s(!1),m("Microphone not supported. Please use HTTPS or a modern browser.");return}if(location.protocol!=="https:"&&location.hostname!=="localhost"){s(!1),m("Microphone requires HTTPS. Please use a secure connection.");return}s(!0),m(null)})()},[]);const a=async()=>{try{if(console.log("Starting recording..."),m(null),x.current=[],!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Microphone access not available. Please use HTTPS or a supported browser.");const f=await navigator.mediaDevices.getUserMedia({audio:!0});t.current=f;const w=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",N=new MediaRecorder(f,{mimeType:w});p.current=N,N.ondataavailable=L=>{L.data.size>0&&x.current.push(L.data)},N.onstop=async()=>{console.log("Recording stopped, creating blob...");const L=new Blob(x.current,{type:w});t.current&&(t.current.getTracks().forEach(M=>M.stop()),t.current=null),u("transcribing");const E=window.localStorage.getItem("whisperMode")||"default",S=E==="prompt"||E==="vibe"||E==="instructions"||E==="architect";let R;S&&(R=setTimeout(()=>{u("processing")},2e3));try{const M=await yl(L);M&&r&&r(M)}catch(M){console.error("Transcription error:",M),m(M.message)}finally{R&&clearTimeout(R),u("idle")}},N.start(),u("recording"),console.log("Recording started successfully")}catch(f){console.error("Failed to start recording:",f);let w="Microphone access failed";f.name==="NotAllowedError"?w="Microphone access denied. Please allow microphone permissions.":f.name==="NotFoundError"?w="No microphone found. Please check your audio devices.":f.name==="NotSupportedError"?w="Microphone not supported by this browser.":f.name==="NotReadableError"?w="Microphone is being used by another application.":f.message.includes("HTTPS")&&(w=f.message),m(w),u("idle")}},i=()=>{console.log("Stopping recording..."),p.current&&p.current.state==="recording"?p.current.stop():(console.log("Recorder not in recording state, forcing cleanup"),t.current&&(t.current.getTracks().forEach(f=>f.stop()),t.current=null),u("idle"))},g=f=>{if(f&&(f.preventDefault(),f.stopPropagation()),!d)return;const w=Date.now();if(w-h.current<300){console.log("Ignoring rapid tap");return}h.current=w,console.log("Button clicked, current state:",l),l==="idle"?a():l==="recording"&&i()};n.useEffect(()=>()=>{t.current&&t.current.getTracks().forEach(f=>f.stop())},[]);const v=()=>{if(!d)return{icon:e.jsx(hn,{className:"w-5 h-5"}),className:"bg-gray-400 cursor-not-allowed",disabled:!0};switch(l){case"recording":return{icon:e.jsx(hn,{className:"w-5 h-5 text-white"}),className:"bg-red-500 hover:bg-red-600 animate-pulse",disabled:!1};case"transcribing":return{icon:e.jsx(bt,{className:"w-5 h-5 animate-spin"}),className:"bg-blue-500 hover:bg-blue-600",disabled:!0};case"processing":return{icon:e.jsx(Ma,{className:"w-5 h-5 animate-pulse"}),className:"bg-purple-500 hover:bg-purple-600",disabled:!0};default:return{icon:e.jsx(hn,{className:"w-5 h-5"}),className:"bg-gray-700 hover:bg-gray-600",disabled:!1}}},{icon:k,className:b,disabled:j}=v();return e.jsxs("div",{className:"relative",children:[e.jsx("button",{type:"button",style:{backgroundColor:l==="recording"?"#ef4444":l==="transcribing"?"#3b82f6":l==="processing"?"#a855f7":"#374151"},className:`
23
23
  flex items-center justify-center
24
24
  w-12 h-12 rounded-full
25
25
  text-white transition-all duration-200
@@ -32,7 +32,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
32
32
  ${o}
33
33
  `,onClick:g,disabled:j,children:k}),c&&e.jsx("div",{className:`absolute top-full mt-2 left-1/2 transform -translate-x-1/2
34
34
  bg-red-500 text-white text-xs px-2 py-1 rounded whitespace-nowrap z-10
35
- animate-fade-in`,children:c}),l==="recording"&&e.jsx("div",{className:"absolute -inset-1 rounded-full border-2 border-red-500 animate-ping pointer-events-none"}),l==="processing"&&e.jsx("div",{className:"absolute -inset-1 rounded-full border-2 border-purple-500 animate-ping pointer-events-none"})]})}const vl=({commands:r=[],selectedIndex:o=-1,onSelect:l,onClose:u,position:c={top:0,left:0},isOpen:m=!1,frequentCommands:d=[]})=>{const s=n.useRef(null),p=n.useRef(null),x=window.innerWidth<640?{position:"fixed",bottom:`${c.bottom||90}px`,left:"16px",right:"16px",width:"auto",maxWidth:"calc(100vw - 32px)",maxHeight:"min(50vh, 300px)"}:{position:"fixed",bottom:`${c.bottom||90}px`,left:`${c.left}px`,width:"min(400px, calc(100vw - 32px))",maxWidth:"calc(100vw - 32px)",maxHeight:"300px"};if(n.useEffect(()=>{const j=f=>{s.current&&!s.current.contains(f.target)&&m&&u()};if(m)return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[m,u]),n.useEffect(()=>{if(p.current&&s.current){const j=s.current.getBoundingClientRect(),f=p.current.getBoundingClientRect();f.bottom>j.bottom?p.current.scrollIntoView({block:"nearest",behavior:"smooth"}):f.top<j.top&&p.current.scrollIntoView({block:"nearest",behavior:"smooth"})}},[o]),!m)return null;if(r.length===0){const j=window.innerWidth<640,f={position:"fixed",bottom:`${c.bottom||90}px`,left:j?"16px":`${c.left}px`,width:j?"auto":"min(400px, calc(100vw - 32px))",maxWidth:"calc(100vw - 32px)",...j?{right:"16px"}:{}};return e.jsx("div",{ref:s,className:"command-menu command-menu-empty",style:{...f,borderRadius:"8px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",zIndex:1e3,padding:"20px",opacity:1,transform:"translateY(0)",transition:"opacity 150ms ease-in-out, transform 150ms ease-in-out",textAlign:"center"},children:"暂无可用命令"})}const h=d.length>0,a=r.reduce((j,f)=>{const w=f.namespace||f.type||"other";return j[w]||(j[w]=[]),j[w].push(f),j},{});h&&(a.frequent=d);const g=(h?["frequent","builtin","project","user","skill","mcp","other"]:["builtin","project","user","skill","mcp","other"]).filter(j=>a[j]),v={frequent:"⭐ 常用命令",builtin:"内置命令",project:"项目命令",user:"用户命令",skill:"🔧 技能",mcp:"🔌 MCP 工具",other:"其他命令"};let k=0;const b=[];return g.forEach(j=>{a[j].forEach(f=>{b.push({...f,globalIndex:k++,namespace:j})})}),e.jsxs("div",{ref:s,role:"listbox","aria-label":"Available commands",className:"command-menu",style:{...x,maxHeight:"300px",overflowY:"auto",borderRadius:"8px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",zIndex:1e3,padding:"8px",opacity:m?1:0,transform:m?"translateY(0)":"translateY(-10px)",transition:"opacity 150ms ease-in-out, transform 150ms ease-in-out"},children:[g.map(j=>e.jsxs("div",{className:"command-group",children:[g.length>1&&e.jsx("div",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",color:"#6b7280",padding:"8px 12px 4px",letterSpacing:"0.05em"},children:v[j]||j}),a[j].map(f=>{const w=b.find(z=>z.name===f.name&&z.namespace===j),S=w&&w.globalIndex===o;return e.jsxs("div",{ref:S?p:null,role:"option","aria-selected":S,className:"command-item",onMouseEnter:()=>l&&l(f,w.globalIndex,!0),onClick:()=>l&&l(f,w.globalIndex,!1),style:{display:"flex",alignItems:"flex-start",padding:"10px 12px",borderRadius:"6px",cursor:"pointer",backgroundColor:S?"#eff6ff":"transparent",transition:"background-color 100ms ease-in-out",marginBottom:"2px"},onMouseDown:z=>z.preventDefault(),children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:f.description?"4px":0},children:[e.jsxs("span",{style:{fontSize:"16px",flexShrink:0},children:[j==="builtin"&&"⚡",j==="project"&&"📁",j==="user"&&"👤",j==="skill"&&"🔧",j==="mcp"&&"🔌",j==="other"&&"📝"]}),e.jsx("span",{style:{fontWeight:600,fontSize:"14px",color:"#111827",fontFamily:"monospace"},children:f.name}),f.metadata?.type&&e.jsx("span",{className:"command-metadata-badge",style:{fontSize:"10px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#f3f4f6",color:"#6b7280",fontWeight:500},children:f.metadata.type})]}),f.description&&e.jsx("div",{style:{fontSize:"13px",color:"#6b7280",marginLeft:"24px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:f.description})]}),S&&e.jsx("span",{style:{marginLeft:"8px",color:"#3b82f6",fontSize:"12px",fontWeight:600},children:"↵"})]},`${j}-${f.name}`)})]},j)),e.jsx("style",{children:`
35
+ animate-fade-in`,children:c}),l==="recording"&&e.jsx("div",{className:"absolute -inset-1 rounded-full border-2 border-red-500 animate-ping pointer-events-none"}),l==="processing"&&e.jsx("div",{className:"absolute -inset-1 rounded-full border-2 border-purple-500 animate-ping pointer-events-none"})]})}const vl=({commands:r=[],selectedIndex:o=-1,onSelect:l,onClose:u,position:c={top:0,left:0},isOpen:m=!1,frequentCommands:d=[]})=>{const s=n.useRef(null),p=n.useRef(null),x=window.innerWidth<640?{position:"fixed",bottom:`${c.bottom||90}px`,left:"16px",right:"16px",width:"auto",maxWidth:"calc(100vw - 32px)",maxHeight:"min(50vh, 300px)"}:{position:"fixed",bottom:`${c.bottom||90}px`,left:`${c.left}px`,width:"min(400px, calc(100vw - 32px))",maxWidth:"calc(100vw - 32px)",maxHeight:"300px"};if(n.useEffect(()=>{const j=f=>{s.current&&!s.current.contains(f.target)&&m&&u()};if(m)return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[m,u]),n.useEffect(()=>{if(p.current&&s.current){const j=s.current.getBoundingClientRect(),f=p.current.getBoundingClientRect();f.bottom>j.bottom?p.current.scrollIntoView({block:"nearest",behavior:"smooth"}):f.top<j.top&&p.current.scrollIntoView({block:"nearest",behavior:"smooth"})}},[o]),!m)return null;if(r.length===0){const j=window.innerWidth<640,f={position:"fixed",bottom:`${c.bottom||90}px`,left:j?"16px":`${c.left}px`,width:j?"auto":"min(400px, calc(100vw - 32px))",maxWidth:"calc(100vw - 32px)",...j?{right:"16px"}:{}};return e.jsx("div",{ref:s,className:"command-menu command-menu-empty",style:{...f,borderRadius:"8px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",zIndex:1e3,padding:"20px",opacity:1,transform:"translateY(0)",transition:"opacity 150ms ease-in-out, transform 150ms ease-in-out",textAlign:"center"},children:"暂无可用命令"})}const h=d.length>0,a=r.reduce((j,f)=>{const w=f.namespace||f.type||"other";return j[w]||(j[w]=[]),j[w].push(f),j},{});h&&(a.frequent=d);const g=(h?["frequent","builtin","project","user","skill","mcp","other"]:["builtin","project","user","skill","mcp","other"]).filter(j=>a[j]),v={frequent:"⭐ 常用命令",builtin:"内置命令",project:"项目命令",user:"用户命令",skill:"🔧 技能",mcp:"🔌 MCP 工具",other:"其他命令"};let k=0;const b=[];return g.forEach(j=>{a[j].forEach(f=>{b.push({...f,globalIndex:k++,namespace:j})})}),e.jsxs("div",{ref:s,role:"listbox","aria-label":"Available commands",className:"command-menu",style:{...x,maxHeight:"300px",overflowY:"auto",borderRadius:"8px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",zIndex:1e3,padding:"8px",opacity:m?1:0,transform:m?"translateY(0)":"translateY(-10px)",transition:"opacity 150ms ease-in-out, transform 150ms ease-in-out"},children:[g.map(j=>e.jsxs("div",{className:"command-group",children:[g.length>1&&e.jsx("div",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",color:"#6b7280",padding:"8px 12px 4px",letterSpacing:"0.05em"},children:v[j]||j}),a[j].map(f=>{const w=b.find(L=>L.name===f.name&&L.namespace===j),N=w&&w.globalIndex===o;return e.jsxs("div",{ref:N?p:null,role:"option","aria-selected":N,className:"command-item",onMouseEnter:()=>l&&l(f,w.globalIndex,!0),onClick:()=>l&&l(f,w.globalIndex,!1),style:{display:"flex",alignItems:"flex-start",padding:"10px 12px",borderRadius:"6px",cursor:"pointer",backgroundColor:N?"#eff6ff":"transparent",transition:"background-color 100ms ease-in-out",marginBottom:"2px"},onMouseDown:L=>L.preventDefault(),children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:f.description?"4px":0},children:[e.jsxs("span",{style:{fontSize:"16px",flexShrink:0},children:[j==="builtin"&&"⚡",j==="project"&&"📁",j==="user"&&"👤",j==="skill"&&"🔧",j==="mcp"&&"🔌",j==="other"&&"📝"]}),e.jsx("span",{style:{fontWeight:600,fontSize:"14px",color:"#111827",fontFamily:"monospace"},children:f.name}),f.metadata?.type&&e.jsx("span",{className:"command-metadata-badge",style:{fontSize:"10px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#f3f4f6",color:"#6b7280",fontWeight:500},children:f.metadata.type})]}),f.description&&e.jsx("div",{style:{fontSize:"13px",color:"#6b7280",marginLeft:"24px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:f.description})]}),N&&e.jsx("span",{style:{marginLeft:"8px",color:"#3b82f6",fontSize:"12px",fontWeight:600},children:"↵"})]},`${j}-${f.name}`)})]},j)),e.jsx("style",{children:`
36
36
  .command-menu {
37
37
  background-color: white;
38
38
  border: 1px solid #e5e7eb;
@@ -67,46 +67,46 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
67
67
  }
68
68
  }
69
69
  `})]})},wn={OPTIONS:[{value:"sonnet",label:"Sonnet"},{value:"opus",label:"Opus"},{value:"haiku",label:"Haiku"}],DEFAULT:"sonnet"};function cr(r){return r&&r.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&")}function jl(r){if(!r||typeof r!="string")return r;try{return r.replace(/```\s*([^\n\r]+?)\s*```/g,"`$1`")}catch{return r}}function Nn(r){if(!r||typeof r!="string")return r;const o=[],l="__MATH_BLOCK_",u="__";let c=r.replace(/\$\$([\s\S]*?)\$\$|\$([^\$\n]+?)\$/g,m=>{const d=o.length;return o.push(m),`${l}${d}${u}`});return c=c.replace(/\\n/g,`
70
- `).replace(/\\t/g," ").replace(/\\r/g,"\r"),c=c.replace(new RegExp(`${l}(\\d+)${u}`,"g"),(m,d)=>o[parseInt(d)]),c}const kr=({children:r,className:o})=>{const l=jl(String(r??"")),u=n.useMemo(()=>[cs,Va],[]),c=n.useMemo(()=>[Za],[]);return e.jsx("div",{className:o,children:e.jsx(ds,{remarkPlugins:u,rehypePlugins:c,components:Nl,children:l})})};function $n(r){try{return typeof r!="string"?r:r.replace(/Claude AI usage limit reached\|(\d{10,13})/g,(o,l)=>{let u=parseInt(l,10);if(!Number.isFinite(u))return o;u<1e12&&(u*=1e3);const c=new Date(u),m=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(c),d=-c.getTimezoneOffset(),s=d>=0?"+":"-",p=Math.abs(d),t=Math.floor(p/60),x=p%60,h=`GMT${s}${t}${x?":"+String(x).padStart(2,"0"):""}`,g=((Intl.DateTimeFormat().resolvedOptions().timeZone||"").split("/").pop()||"").replace(/_/g," ").toLowerCase().replace(/\b\w/g,j=>j.toUpperCase()),v=g?`${h} (${g})`:h,k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],b=`${c.getDate()} ${k[c.getMonth()]} ${c.getFullYear()}`;return`Claude usage limit reached. Your limit will reset at **${m} ${v}** - ${b}`})}catch{return r}}const pt={setItem:(r,o)=>{try{if(r.startsWith("chat_messages_")&&typeof o=="string")try{const l=JSON.parse(o);if(Array.isArray(l)&&l.length>50){console.warn(`Truncating chat history for ${r} from ${l.length} to 50 messages`);const u=l.slice(-50);o=JSON.stringify(u)}}catch(l){console.warn("Could not parse chat messages for truncation:",l)}localStorage.setItem(r,o)}catch(l){if(l.name==="QuotaExceededError"){console.warn("localStorage quota exceeded, clearing old data");const u=Object.keys(localStorage),c=u.filter(d=>d.startsWith("chat_messages_")).sort();c.length>3&&c.slice(0,c.length-3).forEach(d=>{localStorage.removeItem(d),console.log(`Removed old chat data: ${d}`)}),u.filter(d=>d.startsWith("draft_input_")).forEach(d=>{localStorage.removeItem(d)});try{localStorage.setItem(r,o)}catch(d){if(console.error("Failed to save to localStorage even after cleanup:",d),r.startsWith("chat_messages_")&&typeof o=="string")try{const s=JSON.parse(o);if(Array.isArray(s)&&s.length>10){const p=s.slice(-10);localStorage.setItem(r,JSON.stringify(p)),console.warn("Saved only last 10 messages due to quota constraints")}}catch(s){console.error("Final save attempt failed:",s)}}}else console.error("localStorage error:",l)}},getItem:r=>{try{return localStorage.getItem(r)}catch(o){return console.error("localStorage getItem error:",o),null}},removeItem:r=>{try{localStorage.removeItem(r)}catch(o){console.error("localStorage removeItem error:",o)}}},Os="claude-settings";function Zn(){const r=pt.getItem(Os);if(!r)return{allowedTools:[],disallowedTools:[],skipPermissions:!1,projectSortOrder:"name"};try{const o=JSON.parse(r);return{...o,allowedTools:Array.isArray(o.allowedTools)?o.allowedTools:[],disallowedTools:Array.isArray(o.disallowedTools)?o.disallowedTools:[],skipPermissions:!!o.skipPermissions,projectSortOrder:o.projectSortOrder||"name"}}catch{return{allowedTools:[],disallowedTools:[],skipPermissions:!1,projectSortOrder:"name"}}}function Wn(r,o){if(!r)return null;if(r!=="Bash")return r;const l=ai(o),u=typeof l?.command=="string"?l.command.trim():"";if(!u)return r;const c=u.split(/\s+/);return c.length===0?r:c[0]==="git"&&c[1]?`Bash(${c[0]} ${c[1]}:*)`:`Bash(${c[0]}:*)`}function Fo(r){if(r==null)return"";if(typeof r=="string")return r;try{return JSON.stringify(r,null,2)}catch{return String(r)}}function kl(r,o){if(o!=="claude"||!r?.toolResult?.isError||r.toolResult?.builtinHandled)return null;const l=r?.toolName,u=Wn(l,r.toolInput);if(!u)return null;const m=Zn().allowedTools.includes(u);return{toolName:l,entry:u,isAllowed:m}}function wl(r){if(!r)return{success:!1};const o=Zn(),l=o.allowedTools.includes(r),u=l?o.allowedTools:[...o.allowedTools,r],c=o.disallowedTools.filter(d=>d!==r),m={...o,allowedTools:u,disallowedTools:c,lastUpdated:new Date().toISOString()};return pt.setItem(Os,JSON.stringify(m)),{success:!0,alreadyAllowed:l,updatedSettings:m}}const Nl={code:({node:r,inline:o,className:l,children:u,...c})=>{const[m,d]=mt.useState(!1),s=Array.isArray(u)?u.join(""):String(u??""),p=/[\r\n]/.test(s);if(o||r&&r.type==="inlineCode"||!p)return e.jsx("code",{className:`font-mono text-[0.9em] px-1.5 py-0.5 rounded-md bg-gray-100 text-gray-900 border border-gray-200 dark:bg-gray-800/60 dark:text-gray-100 dark:border-gray-700 whitespace-pre-wrap break-words ${l||""}`,...c,children:u});const h=/language-(\w+)/.exec(l||""),a=h?h[1]:"text",i=s,g=()=>{const v=()=>{d(!0),setTimeout(()=>d(!1),1500)};try{if(navigator&&navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(i).then(v).catch(()=>{const k=document.createElement("textarea");k.value=i,k.style.position="fixed",k.style.opacity="0",document.body.appendChild(k),k.select();try{document.execCommand("copy")}catch{}document.body.removeChild(k),v()});else{const k=document.createElement("textarea");k.value=i,k.style.position="fixed",k.style.opacity="0",document.body.appendChild(k),k.select();try{document.execCommand("copy")}catch{}document.body.removeChild(k),v()}}catch{}};return e.jsxs("div",{className:"relative group my-2",children:[a&&a!=="text"&&e.jsx("div",{className:"absolute top-2 left-3 z-10 text-xs text-gray-400 font-medium uppercase",children:a}),e.jsx("button",{type:"button",onClick:g,className:"absolute top-2 right-2 z-10 opacity-0 group-hover:opacity-100 focus:opacity-100 active:opacity-100 transition-opacity text-xs px-2 py-1 rounded-md bg-gray-700/80 hover:bg-gray-700 text-white border border-gray-600",title:m?"已复制":"复制代码","aria-label":m?"已复制":"复制代码",children:m?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"已复制"]}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"复制"]})}),e.jsx(us,{language:a,style:ys,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem",padding:a&&a!=="text"?"2rem 1rem 1rem 1rem":"1rem"},codeTagProps:{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'}},children:s})]})},blockquote:({children:r})=>e.jsx("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 italic text-gray-600 dark:text-gray-400 my-2",children:r}),a:({href:r,children:o})=>e.jsx("a",{href:r,className:"text-blue-600 dark:text-blue-400 hover:underline",target:"_blank",rel:"noopener noreferrer",children:o}),p:({children:r})=>e.jsx("div",{className:"mb-2 last:mb-0",children:r}),table:({children:r})=>e.jsx("div",{className:"overflow-x-auto my-2",children:e.jsx("table",{className:"min-w-full border-collapse border border-gray-200 dark:border-gray-700",children:r})}),thead:({children:r})=>e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800",children:r}),th:({children:r})=>e.jsx("th",{className:"px-3 py-2 text-left text-sm font-semibold border border-gray-200 dark:border-gray-700",children:r}),td:({children:r})=>e.jsx("td",{className:"px-3 py-2 align-top text-sm border border-gray-200 dark:border-gray-700",children:r})};function Sl(r){let o=0;for(const l of r)if(!l.isMeta){if(l.type==="tool_use"&&l.toolName){o++;continue}if(l.type!=="tool_result"){if(l.message?.role==="user"&&l.message?.content){const u=l.message.content;(Array.isArray(u)?u.some(m=>m.type==="text"):!!u)&&o++}else if(l.message?.role==="assistant"&&l.message?.content){const u=l.message.content;Array.isArray(u)&&u.some(c=>c.type==="text"||c.type==="thinking")&&o++}}}return o}const wr="__other__";function Tl({request:r,onSubmit:o,onSkip:l}){const u=r.input?.questions||[],[c,m]=mt.useState(0),[d,s]=mt.useState(()=>Object.fromEntries(u.map(w=>[w.question,[]]))),[p,t]=mt.useState(()=>Object.fromEntries(u.map(w=>[w.question,""]))),x=mt.useRef(null),h=u[c],a=u.length,i=w=>{const S=d[w.question]||[];return!(S.length===0||S.includes(wr)&&!(p[w.question]||"").trim())},g=h?i(h):!1,v=c===a-1,k=u.every(i),b=w=>(d[w]||[]).includes(wr),j=(w,S,z)=>{s(D=>{const N=D[w]||[];return z?{...D,[w]:N.includes(S)?N.filter(R=>R!==S):[...N,S]}:{...D,[w]:[S]}}),!z&&S!==wr&&c<a-1&&(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>m(D=>D+1),280))},f=()=>{const w={};u.forEach(S=>{const D=(d[S.question]||[]).map(N=>N===wr?(p[S.question]||"").trim():N).filter(Boolean);w[S.question]=D.join(", ")}),o(w)};return h?e.jsxs("div",{className:"rounded-lg border border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-900/20 shadow-sm overflow-hidden",children:[e.jsxs("div",{className:"px-3 pt-3 pb-2 flex items-center justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100",children:"Claude 需要您的回答"}),a>1&&e.jsxs("div",{className:"text-xs text-blue-500 dark:text-blue-400 font-medium tabular-nums",children:[c+1," / ",a]})]}),a>1&&e.jsx("div",{className:"px-3 pb-2.5 flex gap-1.5 items-center",children:u.map((w,S)=>e.jsx("button",{type:"button",onClick:()=>m(S),title:`问题 ${S+1}`,className:`h-1.5 rounded-full transition-all duration-200 ${S===c?"w-5 bg-blue-600":i(w)?"w-2 bg-blue-400 hover:bg-blue-500":"w-2 bg-blue-200 dark:bg-blue-700 hover:bg-blue-300 dark:hover:bg-blue-600"}`},S))}),e.jsxs("div",{className:"px-3 pb-3",children:[e.jsxs("div",{className:"text-sm font-medium text-blue-800 dark:text-blue-200 mb-2",children:[h.question,h.multiSelect&&e.jsx("span",{className:"ml-2 text-xs font-normal opacity-60",children:"(可多选)"})]}),e.jsxs("div",{className:"space-y-1",children:[h.options.map((w,S)=>{const z=(d[h.question]||[]).includes(w.label);return e.jsxs("button",{type:"button",onClick:()=>j(h.question,w.label,h.multiSelect),className:`w-full text-left px-3 py-2 rounded-md text-xs border transition-colors ${z?"bg-blue-600 text-white border-blue-600":"bg-white dark:bg-gray-800 border-blue-200 dark:border-blue-700 text-blue-800 dark:text-blue-200 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,children:[e.jsx("span",{className:"font-medium",children:w.label}),w.description&&e.jsxs("span",{className:"ml-1 opacity-70",children:[" — ",w.description]})]},S)}),e.jsxs("button",{type:"button",onClick:()=>j(h.question,wr,h.multiSelect),className:`w-full text-left px-3 py-2 rounded-md text-xs border transition-colors ${b(h.question)?"bg-blue-600 text-white border-blue-600":"bg-white dark:bg-gray-800 border-blue-200 dark:border-blue-700 text-blue-800 dark:text-blue-200 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,children:[e.jsx("span",{className:"font-medium",children:"其他"}),e.jsx("span",{className:"ml-1 opacity-70",children:" — 手动输入自定义答案"})]}),b(h.question)&&e.jsx("input",{autoFocus:!0,type:"text",value:p[h.question]||"",onChange:w=>t(S=>({...S,[h.question]:w.target.value})),placeholder:"请输入您的答案…",className:"w-full mt-1 px-3 py-2 rounded-md text-xs border border-blue-300 dark:border-blue-600 bg-white dark:bg-gray-800 text-blue-900 dark:text-blue-100 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[c>0&&e.jsx("button",{type:"button",onClick:()=>m(w=>w-1),className:"inline-flex items-center gap-1 rounded-md text-xs font-medium px-2.5 py-1.5 border border-blue-300 dark:border-blue-700 text-blue-600 dark:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-900/30 transition-colors",children:"← 上一题"}),v?e.jsx("button",{type:"button",onClick:f,disabled:!k,className:"inline-flex items-center gap-1 rounded-md bg-blue-600 text-white text-xs font-medium px-3 py-1.5 hover:bg-blue-700 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"提交答案"}):e.jsx("button",{type:"button",onClick:()=>m(w=>w+1),disabled:!g,className:"inline-flex items-center gap-1 rounded-md bg-blue-600 text-white text-xs font-medium px-3 py-1.5 hover:bg-blue-700 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"下一题 →"}),e.jsx("button",{type:"button",onClick:l,className:"ml-auto inline-flex items-center rounded-md text-xs font-medium px-2.5 py-1.5 border border-gray-300 dark:border-gray-700 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800/40 transition-colors",children:"跳过"})]})]})]}):null}const Cs=n.memo(({image:r})=>{const[o,l]=n.useState(r.data||null),[u,c]=n.useState(!1),[m,d]=n.useState(!r.data&&!!r.id);return n.useEffect(()=>{if(r.data||!r.id)return;let s=!1;return d(!0),J(`/api/images/${r.id}`).then(p=>{if(!p.ok)throw new Error("expired");return p.blob()}).then(p=>{s||(l(URL.createObjectURL(p)),d(!1))}).catch(()=>{s||(c(!0),d(!1))}),()=>{s=!0}},[r.data,r.id]),u?e.jsx("div",{className:"rounded-lg bg-gray-100 dark:bg-gray-800 flex items-center justify-center text-gray-400 text-xs p-4 min-h-[60px]",children:"图片已过期"}):m?e.jsx("div",{className:"rounded-lg bg-gray-100 dark:bg-gray-800 flex items-center justify-center text-gray-400 text-xs p-4 min-h-[60px] animate-pulse",children:"加载中..."}):o?e.jsx("img",{src:o,alt:r.name||"image",className:"rounded-lg max-w-full h-auto cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>window.open(o,"_blank"),onError:()=>c(!0)}):null});Cs.displayName="PersistentImage";const Ho=n.memo(({message:r,index:o,prevMessage:l,createDiff:u,onFileOpen:c,onShowSettings:m,onGrantToolPermission:d,selectedProject:s,provider:p,onFork:t,messageUuid:x})=>{const h=l&&l.type===r.type&&(l.type==="assistant"||l.type==="user"||l.type==="tool"||l.type==="error"),a=mt.useRef(null),i=kl(r,p),[g,v]=mt.useState("idle");return mt.useEffect(()=>{v("idle")},[i?.entry,r.toolId]),e.jsx("div",{ref:a,className:`group chat-message ${r.type} ${h?"grouped":""} ${r.type==="user"?"flex justify-end px-3 sm:px-0":"px-3 sm:px-0"}`,children:r.type==="user"?e.jsx("div",{className:"flex items-end space-x-0 sm:space-x-3 w-full sm:w-auto sm:max-w-[85%] md:max-w-md lg:max-w-lg xl:max-w-xl",children:e.jsxs("div",{className:"bg-blue-600 text-white rounded-2xl rounded-br-md px-3 sm:px-4 py-2 shadow-sm flex-1 sm:flex-initial",children:[e.jsx("div",{className:"text-sm whitespace-pre-wrap break-words",children:r.content}),r.images&&r.images.length>0&&e.jsx("div",{className:"mt-2 grid grid-cols-2 gap-2",children:r.images.map((k,b)=>e.jsx(Cs,{image:k},k.id||b))}),e.jsx("div",{className:"text-xs text-blue-100 mt-1 text-right",children:new Date(r.timestamp).toLocaleTimeString()})]})}):e.jsxs("div",{className:"w-full",children:[!h&&e.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[r.type==="error"?e.jsx("div",{className:"w-8 h-8 bg-red-600 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0",children:"!"}):r.type==="tool"?e.jsx("div",{className:"w-8 h-8 bg-gray-600 dark:bg-gray-700 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0",children:"🔧"}):e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0 p-1",children:e.jsx(Vr,{className:"w-full h-full"})}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:r.type==="error"?"错误":r.type==="tool"?"工具":Ve})]}),e.jsxs("div",{className:"w-full",children:[r.isToolUse&&!["Read","TodoWrite","TodoRead"].includes(r.toolName)?(()=>{const k=(()=>{try{const j=JSON.parse(r.toolInput);switch(r.toolName){case"Bash":return Ue(j.command||"").slice(0,80);case"Edit":case"Write":return j.file_path?j.file_path.split("/").pop():"";case"Grep":{let f=j.pattern||"";return j.path&&(f+=" · "+Ue(j.path)),f}case"Glob":return j.pattern||"";default:{const f=Object.keys(j);if(f.length===0)return"";const w=f[0],S=j[w];return String(typeof S=="object"?JSON.stringify(S):S||"").slice(0,60)}}}catch{return""}})(),b=r.toolResult?.isError&&!r.toolResult?.builtinHandled;return e.jsxs("details",{className:"group/tool border border-gray-200/60 dark:border-gray-700/40 rounded-lg my-1.5 overflow-hidden",open:!1,children:[e.jsxs("summary",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/40 transition-colors select-none [list-style:none] [&::-webkit-details-marker]:hidden",children:[e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),e.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 flex-shrink-0",children:r.toolName}),e.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 truncate flex-1 font-mono min-w-0",children:k}),r.toolResult?b?e.jsx("svg",{className:"w-3.5 h-3.5 text-red-500 dark:text-red-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M6 18L18 6M6 6l12 12"})}):e.jsx("svg",{className:"w-3.5 h-3.5 text-green-500 dark:text-green-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})}):e.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-400 animate-pulse flex-shrink-0"}),e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500 flex-shrink-0 transition-transform duration-200 group-open/tool:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),e.jsxs("div",{className:"border-t border-gray-100 dark:border-gray-700/40 divide-y divide-gray-100 dark:divide-gray-700/40",children:[r.toolInput&&e.jsxs("div",{className:"px-3 py-2.5",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-2",children:"参数"}),r.toolName==="Edit"&&(()=>{try{const j=JSON.parse(r.toolInput);if(j.file_path&&j.old_string&&j.new_string)return e.jsxs("div",{children:[e.jsx("button",{onClick:async()=>{if(c)try{const S=(await(await me.readFile(s?.name,j.file_path)).json()).content||"",z=S.replace(j.new_string,j.old_string);c(j.file_path,{old_string:z,new_string:S})}catch{c(j.file_path)}},className:"text-xs font-mono text-blue-600 dark:text-blue-400 hover:underline mb-2 block truncate max-w-full",children:Ue(j.file_path)}),e.jsx("div",{className:"bg-white dark:bg-gray-900/50 border border-gray-200/60 dark:border-gray-700/60 rounded-lg overflow-hidden text-xs font-mono",children:u(j.old_string,j.new_string).map((f,w)=>e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:`w-8 text-center border-r flex-shrink-0 ${f.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800"}`,children:f.type==="removed"?"-":"+"}),e.jsx("span",{className:`px-2 py-0.5 flex-1 whitespace-pre-wrap ${f.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200":"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200"}`,children:f.content})]},w))})]})}catch{}return e.jsx("pre",{className:"text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-2.5 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-600 dark:text-gray-400 font-mono",children:Ue(r.toolInput)})})(),r.toolName==="Write"&&(()=>{try{const j=typeof r.toolInput=="string"?JSON.parse(r.toolInput):r.toolInput;if(j.file_path&&j.content!==void 0)return e.jsxs("div",{children:[e.jsx("button",{onClick:async()=>{if(c)try{const f=await me.readFile(s?.name,j.file_path),w=await f.json(),S=f.ok&&!w.error?w.content||"":j.content||"";c(j.file_path,{old_string:"",new_string:S})}catch{c(j.file_path,{old_string:"",new_string:j.content||""})}},className:"text-xs font-mono text-blue-600 dark:text-blue-400 hover:underline mb-2 block truncate max-w-full",children:Ue(j.file_path)}),e.jsx("div",{className:"bg-white dark:bg-gray-900/50 border border-gray-200/60 dark:border-gray-700/60 rounded-lg overflow-hidden text-xs font-mono",children:u("",j.content).map((f,w)=>e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:`w-8 text-center border-r flex-shrink-0 ${f.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800"}`,children:f.type==="removed"?"-":"+"}),e.jsx("span",{className:`px-2 py-0.5 flex-1 whitespace-pre-wrap ${f.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200":"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200"}`,children:f.content})]},w))})]})}catch{}return e.jsx("pre",{className:"text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-2.5 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-600 dark:text-gray-400 font-mono",children:Ue(r.toolInput)})})(),r.toolName==="Bash"&&(()=>{try{const j=JSON.parse(r.toolInput);return e.jsxs("div",{children:[e.jsxs("div",{className:"bg-gray-900 dark:bg-gray-950 rounded-md px-3 py-2 font-mono text-xs",children:[e.jsx("span",{className:"text-green-400",children:"$"}),e.jsx("span",{className:"text-gray-100 ml-2",children:Ue(j.command)})]}),j.description&&e.jsx("div",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400 italic ml-1",children:j.description})]})}catch{return null}})(),r.toolName==="exit_plan_mode"&&(()=>{try{const j=JSON.parse(r.toolInput);if(j.plan)return e.jsx(kr,{className:"prose prose-sm max-w-none dark:prose-invert",children:j.plan.replace(/\\n/g,`
70
+ `).replace(/\\t/g," ").replace(/\\r/g,"\r"),c=c.replace(new RegExp(`${l}(\\d+)${u}`,"g"),(m,d)=>o[parseInt(d)]),c}const kr=({children:r,className:o})=>{const l=jl(String(r??"")),u=n.useMemo(()=>[cs,Va],[]),c=n.useMemo(()=>[Za],[]);return e.jsx("div",{className:o,children:e.jsx(ds,{remarkPlugins:u,rehypePlugins:c,components:Nl,children:l})})};function $n(r){try{return typeof r!="string"?r:r.replace(/Claude AI usage limit reached\|(\d{10,13})/g,(o,l)=>{let u=parseInt(l,10);if(!Number.isFinite(u))return o;u<1e12&&(u*=1e3);const c=new Date(u),m=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(c),d=-c.getTimezoneOffset(),s=d>=0?"+":"-",p=Math.abs(d),t=Math.floor(p/60),x=p%60,h=`GMT${s}${t}${x?":"+String(x).padStart(2,"0"):""}`,g=((Intl.DateTimeFormat().resolvedOptions().timeZone||"").split("/").pop()||"").replace(/_/g," ").toLowerCase().replace(/\b\w/g,j=>j.toUpperCase()),v=g?`${h} (${g})`:h,k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],b=`${c.getDate()} ${k[c.getMonth()]} ${c.getFullYear()}`;return`Claude usage limit reached. Your limit will reset at **${m} ${v}** - ${b}`})}catch{return r}}const pt={setItem:(r,o)=>{try{if(r.startsWith("chat_messages_")&&typeof o=="string")try{const l=JSON.parse(o);if(Array.isArray(l)&&l.length>50){console.warn(`Truncating chat history for ${r} from ${l.length} to 50 messages`);const u=l.slice(-50);o=JSON.stringify(u)}}catch(l){console.warn("Could not parse chat messages for truncation:",l)}localStorage.setItem(r,o)}catch(l){if(l.name==="QuotaExceededError"){console.warn("localStorage quota exceeded, clearing old data");const u=Object.keys(localStorage),c=u.filter(d=>d.startsWith("chat_messages_")).sort();c.length>3&&c.slice(0,c.length-3).forEach(d=>{localStorage.removeItem(d),console.log(`Removed old chat data: ${d}`)}),u.filter(d=>d.startsWith("draft_input_")).forEach(d=>{localStorage.removeItem(d)});try{localStorage.setItem(r,o)}catch(d){if(console.error("Failed to save to localStorage even after cleanup:",d),r.startsWith("chat_messages_")&&typeof o=="string")try{const s=JSON.parse(o);if(Array.isArray(s)&&s.length>10){const p=s.slice(-10);localStorage.setItem(r,JSON.stringify(p)),console.warn("Saved only last 10 messages due to quota constraints")}}catch(s){console.error("Final save attempt failed:",s)}}}else console.error("localStorage error:",l)}},getItem:r=>{try{return localStorage.getItem(r)}catch(o){return console.error("localStorage getItem error:",o),null}},removeItem:r=>{try{localStorage.removeItem(r)}catch(o){console.error("localStorage removeItem error:",o)}}},Os="claude-settings";function Zn(){const r=pt.getItem(Os);if(!r)return{allowedTools:[],disallowedTools:[],skipPermissions:!1,projectSortOrder:"name"};try{const o=JSON.parse(r);return{...o,allowedTools:Array.isArray(o.allowedTools)?o.allowedTools:[],disallowedTools:Array.isArray(o.disallowedTools)?o.disallowedTools:[],skipPermissions:!!o.skipPermissions,projectSortOrder:o.projectSortOrder||"name"}}catch{return{allowedTools:[],disallowedTools:[],skipPermissions:!1,projectSortOrder:"name"}}}function Wn(r,o){if(!r)return null;if(r!=="Bash")return r;const l=ai(o),u=typeof l?.command=="string"?l.command.trim():"";if(!u)return r;const c=u.split(/\s+/);return c.length===0?r:c[0]==="git"&&c[1]?`Bash(${c[0]} ${c[1]}:*)`:`Bash(${c[0]}:*)`}function Fo(r){if(r==null)return"";if(typeof r=="string")return r;try{return JSON.stringify(r,null,2)}catch{return String(r)}}function kl(r,o){if(o!=="claude"||!r?.toolResult?.isError||r.toolResult?.builtinHandled)return null;const l=r?.toolName,u=Wn(l,r.toolInput);if(!u)return null;const m=Zn().allowedTools.includes(u);return{toolName:l,entry:u,isAllowed:m}}function wl(r){if(!r)return{success:!1};const o=Zn(),l=o.allowedTools.includes(r),u=l?o.allowedTools:[...o.allowedTools,r],c=o.disallowedTools.filter(d=>d!==r),m={...o,allowedTools:u,disallowedTools:c,lastUpdated:new Date().toISOString()};return pt.setItem(Os,JSON.stringify(m)),{success:!0,alreadyAllowed:l,updatedSettings:m}}const Nl={code:({node:r,inline:o,className:l,children:u,...c})=>{const[m,d]=mt.useState(!1),s=Array.isArray(u)?u.join(""):String(u??""),p=/[\r\n]/.test(s);if(o||r&&r.type==="inlineCode"||!p)return e.jsx("code",{className:`font-mono text-[0.9em] px-1.5 py-0.5 rounded-md bg-gray-100 text-gray-900 border border-gray-200 dark:bg-gray-800/60 dark:text-gray-100 dark:border-gray-700 whitespace-pre-wrap break-words ${l||""}`,...c,children:u});const h=/language-(\w+)/.exec(l||""),a=h?h[1]:"text",i=s,g=()=>{const v=()=>{d(!0),setTimeout(()=>d(!1),1500)};try{if(navigator&&navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(i).then(v).catch(()=>{const k=document.createElement("textarea");k.value=i,k.style.position="fixed",k.style.opacity="0",document.body.appendChild(k),k.select();try{document.execCommand("copy")}catch{}document.body.removeChild(k),v()});else{const k=document.createElement("textarea");k.value=i,k.style.position="fixed",k.style.opacity="0",document.body.appendChild(k),k.select();try{document.execCommand("copy")}catch{}document.body.removeChild(k),v()}}catch{}};return e.jsxs("div",{className:"relative group my-2",children:[a&&a!=="text"&&e.jsx("div",{className:"absolute top-2 left-3 z-10 text-xs text-gray-400 font-medium uppercase",children:a}),e.jsx("button",{type:"button",onClick:g,className:"absolute top-2 right-2 z-10 opacity-0 group-hover:opacity-100 focus:opacity-100 active:opacity-100 transition-opacity text-xs px-2 py-1 rounded-md bg-gray-700/80 hover:bg-gray-700 text-white border border-gray-600",title:m?"已复制":"复制代码","aria-label":m?"已复制":"复制代码",children:m?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"已复制"]}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"复制"]})}),e.jsx(us,{language:a,style:ys,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem",padding:a&&a!=="text"?"2rem 1rem 1rem 1rem":"1rem"},codeTagProps:{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'}},children:s})]})},blockquote:({children:r})=>e.jsx("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 italic text-gray-600 dark:text-gray-400 my-2",children:r}),a:({href:r,children:o})=>e.jsx("a",{href:r,className:"text-blue-600 dark:text-blue-400 hover:underline",target:"_blank",rel:"noopener noreferrer",children:o}),p:({children:r})=>e.jsx("div",{className:"mb-2 last:mb-0",children:r}),table:({children:r})=>e.jsx("div",{className:"overflow-x-auto my-2",children:e.jsx("table",{className:"min-w-full border-collapse border border-gray-200 dark:border-gray-700",children:r})}),thead:({children:r})=>e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800",children:r}),th:({children:r})=>e.jsx("th",{className:"px-3 py-2 text-left text-sm font-semibold border border-gray-200 dark:border-gray-700",children:r}),td:({children:r})=>e.jsx("td",{className:"px-3 py-2 align-top text-sm border border-gray-200 dark:border-gray-700",children:r})};function Sl(r){let o=0;for(const l of r)if(!l.isMeta){if(l.type==="tool_use"&&l.toolName){o++;continue}if(l.type!=="tool_result"){if(l.message?.role==="user"&&l.message?.content){const u=l.message.content;(Array.isArray(u)?u.some(m=>m.type==="text"):!!u)&&o++}else if(l.message?.role==="assistant"&&l.message?.content){const u=l.message.content;Array.isArray(u)&&u.some(c=>c.type==="text"||c.type==="thinking")&&o++}}}return o}const wr="__other__";function Tl({request:r,onSubmit:o,onSkip:l}){const u=r.input?.questions||[],[c,m]=mt.useState(0),[d,s]=mt.useState(()=>Object.fromEntries(u.map(w=>[w.question,[]]))),[p,t]=mt.useState(()=>Object.fromEntries(u.map(w=>[w.question,""]))),x=mt.useRef(null),h=u[c],a=u.length,i=w=>{const N=d[w.question]||[];return!(N.length===0||N.includes(wr)&&!(p[w.question]||"").trim())},g=h?i(h):!1,v=c===a-1,k=u.every(i),b=w=>(d[w]||[]).includes(wr),j=(w,N,L)=>{s(E=>{const S=E[w]||[];return L?{...E,[w]:S.includes(N)?S.filter(R=>R!==N):[...S,N]}:{...E,[w]:[N]}}),!L&&N!==wr&&c<a-1&&(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>m(E=>E+1),280))},f=()=>{const w={};u.forEach(N=>{const E=(d[N.question]||[]).map(S=>S===wr?(p[N.question]||"").trim():S).filter(Boolean);w[N.question]=E.join(", ")}),o(w)};return h?e.jsxs("div",{className:"rounded-lg border border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-900/20 shadow-sm overflow-hidden",children:[e.jsxs("div",{className:"px-3 pt-3 pb-2 flex items-center justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100",children:"Claude 需要您的回答"}),a>1&&e.jsxs("div",{className:"text-xs text-blue-500 dark:text-blue-400 font-medium tabular-nums",children:[c+1," / ",a]})]}),a>1&&e.jsx("div",{className:"px-3 pb-2.5 flex gap-1.5 items-center",children:u.map((w,N)=>e.jsx("button",{type:"button",onClick:()=>m(N),title:`问题 ${N+1}`,className:`h-1.5 rounded-full transition-all duration-200 ${N===c?"w-5 bg-blue-600":i(w)?"w-2 bg-blue-400 hover:bg-blue-500":"w-2 bg-blue-200 dark:bg-blue-700 hover:bg-blue-300 dark:hover:bg-blue-600"}`},N))}),e.jsxs("div",{className:"px-3 pb-3",children:[e.jsxs("div",{className:"text-sm font-medium text-blue-800 dark:text-blue-200 mb-2",children:[h.question,h.multiSelect&&e.jsx("span",{className:"ml-2 text-xs font-normal opacity-60",children:"(可多选)"})]}),e.jsxs("div",{className:"space-y-1",children:[h.options.map((w,N)=>{const L=(d[h.question]||[]).includes(w.label);return e.jsxs("button",{type:"button",onClick:()=>j(h.question,w.label,h.multiSelect),className:`w-full text-left px-3 py-2 rounded-md text-xs border transition-colors ${L?"bg-blue-600 text-white border-blue-600":"bg-white dark:bg-gray-800 border-blue-200 dark:border-blue-700 text-blue-800 dark:text-blue-200 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,children:[e.jsx("span",{className:"font-medium",children:w.label}),w.description&&e.jsxs("span",{className:"ml-1 opacity-70",children:[" — ",w.description]})]},N)}),e.jsxs("button",{type:"button",onClick:()=>j(h.question,wr,h.multiSelect),className:`w-full text-left px-3 py-2 rounded-md text-xs border transition-colors ${b(h.question)?"bg-blue-600 text-white border-blue-600":"bg-white dark:bg-gray-800 border-blue-200 dark:border-blue-700 text-blue-800 dark:text-blue-200 hover:bg-blue-50 dark:hover:bg-blue-900/30"}`,children:[e.jsx("span",{className:"font-medium",children:"其他"}),e.jsx("span",{className:"ml-1 opacity-70",children:" — 手动输入自定义答案"})]}),b(h.question)&&e.jsx("input",{autoFocus:!0,type:"text",value:p[h.question]||"",onChange:w=>t(N=>({...N,[h.question]:w.target.value})),placeholder:"请输入您的答案…",className:"w-full mt-1 px-3 py-2 rounded-md text-xs border border-blue-300 dark:border-blue-600 bg-white dark:bg-gray-800 text-blue-900 dark:text-blue-100 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[c>0&&e.jsx("button",{type:"button",onClick:()=>m(w=>w-1),className:"inline-flex items-center gap-1 rounded-md text-xs font-medium px-2.5 py-1.5 border border-blue-300 dark:border-blue-700 text-blue-600 dark:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-900/30 transition-colors",children:"← 上一题"}),v?e.jsx("button",{type:"button",onClick:f,disabled:!k,className:"inline-flex items-center gap-1 rounded-md bg-blue-600 text-white text-xs font-medium px-3 py-1.5 hover:bg-blue-700 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"提交答案"}):e.jsx("button",{type:"button",onClick:()=>m(w=>w+1),disabled:!g,className:"inline-flex items-center gap-1 rounded-md bg-blue-600 text-white text-xs font-medium px-3 py-1.5 hover:bg-blue-700 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:"下一题 →"}),e.jsx("button",{type:"button",onClick:l,className:"ml-auto inline-flex items-center rounded-md text-xs font-medium px-2.5 py-1.5 border border-gray-300 dark:border-gray-700 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800/40 transition-colors",children:"跳过"})]})]})]}):null}const Cs=n.memo(({image:r})=>{const[o,l]=n.useState(r.data||null),[u,c]=n.useState(!1),[m,d]=n.useState(!r.data&&!!r.id);return n.useEffect(()=>{if(r.data||!r.id)return;let s=!1;return d(!0),J(`/api/images/${r.id}`).then(p=>{if(!p.ok)throw new Error("expired");return p.blob()}).then(p=>{s||(l(URL.createObjectURL(p)),d(!1))}).catch(()=>{s||(c(!0),d(!1))}),()=>{s=!0}},[r.data,r.id]),u?e.jsx("div",{className:"rounded-lg bg-gray-100 dark:bg-gray-800 flex items-center justify-center text-gray-400 text-xs p-4 min-h-[60px]",children:"图片已过期"}):m?e.jsx("div",{className:"rounded-lg bg-gray-100 dark:bg-gray-800 flex items-center justify-center text-gray-400 text-xs p-4 min-h-[60px] animate-pulse",children:"加载中..."}):o?e.jsx("img",{src:o,alt:r.name||"image",className:"rounded-lg max-w-full h-auto cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>window.open(o,"_blank"),onError:()=>c(!0)}):null});Cs.displayName="PersistentImage";const Ho=n.memo(({message:r,index:o,prevMessage:l,createDiff:u,onFileOpen:c,onShowSettings:m,onGrantToolPermission:d,selectedProject:s,provider:p,onFork:t,messageUuid:x})=>{const h=l&&l.type===r.type&&(l.type==="assistant"||l.type==="user"||l.type==="tool"||l.type==="error"),a=mt.useRef(null),i=kl(r,p),[g,v]=mt.useState("idle");return mt.useEffect(()=>{v("idle")},[i?.entry,r.toolId]),e.jsx("div",{ref:a,className:`group chat-message ${r.type} ${h?"grouped":""} ${r.type==="user"?"flex justify-end px-3 sm:px-0":"px-3 sm:px-0"}`,children:r.type==="user"?e.jsx("div",{className:"flex items-end space-x-0 sm:space-x-3 w-full sm:w-auto sm:max-w-[85%] md:max-w-md lg:max-w-lg xl:max-w-xl",children:e.jsxs("div",{className:"bg-blue-600 text-white rounded-2xl rounded-br-md px-3 sm:px-4 py-2 shadow-sm flex-1 sm:flex-initial",children:[e.jsx("div",{className:"text-sm whitespace-pre-wrap break-words",children:r.content}),r.images&&r.images.length>0&&e.jsx("div",{className:"mt-2 grid grid-cols-2 gap-2",children:r.images.map((k,b)=>e.jsx(Cs,{image:k},k.id||b))}),e.jsx("div",{className:"text-xs text-blue-100 mt-1 text-right",children:new Date(r.timestamp).toLocaleTimeString()})]})}):e.jsxs("div",{className:"w-full",children:[!h&&e.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[r.type==="error"?e.jsx("div",{className:"w-8 h-8 bg-red-600 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0",children:"!"}):r.type==="tool"?e.jsx("div",{className:"w-8 h-8 bg-gray-600 dark:bg-gray-700 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0",children:"🔧"}):e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0 p-1",children:e.jsx(Vr,{className:"w-full h-full"})}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:r.type==="error"?"错误":r.type==="tool"?"工具":Ve})]}),e.jsxs("div",{className:"w-full",children:[r.isToolUse&&!["Read","TodoWrite","TodoRead"].includes(r.toolName)?(()=>{const k=(()=>{try{const j=JSON.parse(r.toolInput);switch(r.toolName){case"Bash":return Ue(j.command||"").slice(0,80);case"Edit":case"Write":return j.file_path?j.file_path.split("/").pop():"";case"Grep":{let f=j.pattern||"";return j.path&&(f+=" · "+Ue(j.path)),f}case"Glob":return j.pattern||"";default:{const f=Object.keys(j);if(f.length===0)return"";const w=f[0],N=j[w];return String(typeof N=="object"?JSON.stringify(N):N||"").slice(0,60)}}}catch{return""}})(),b=r.toolResult?.isError&&!r.toolResult?.builtinHandled;return e.jsxs("details",{className:"group/tool border border-gray-200/60 dark:border-gray-700/40 rounded-lg my-1.5 overflow-hidden",open:!1,children:[e.jsxs("summary",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/40 transition-colors select-none [list-style:none] [&::-webkit-details-marker]:hidden",children:[e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),e.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 flex-shrink-0",children:r.toolName}),e.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 truncate flex-1 font-mono min-w-0",children:k}),r.toolResult?b?e.jsx("svg",{className:"w-3.5 h-3.5 text-red-500 dark:text-red-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M6 18L18 6M6 6l12 12"})}):e.jsx("svg",{className:"w-3.5 h-3.5 text-green-500 dark:text-green-400 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})}):e.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-400 animate-pulse flex-shrink-0"}),e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500 flex-shrink-0 transition-transform duration-200 group-open/tool:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),e.jsxs("div",{className:"border-t border-gray-100 dark:border-gray-700/40 divide-y divide-gray-100 dark:divide-gray-700/40",children:[r.toolInput&&e.jsxs("div",{className:"px-3 py-2.5",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-gray-400 dark:text-gray-500 mb-2",children:"参数"}),r.toolName==="Edit"&&(()=>{try{const j=JSON.parse(r.toolInput);if(j.file_path&&j.old_string&&j.new_string)return e.jsxs("div",{children:[e.jsx("button",{onClick:async()=>{if(c)try{const N=(await(await me.readFile(s?.name,j.file_path)).json()).content||"",L=N.replace(j.new_string,j.old_string);c(j.file_path,{old_string:L,new_string:N})}catch{c(j.file_path)}},className:"text-xs font-mono text-blue-600 dark:text-blue-400 hover:underline mb-2 block truncate max-w-full",children:Ue(j.file_path)}),e.jsx("div",{className:"bg-white dark:bg-gray-900/50 border border-gray-200/60 dark:border-gray-700/60 rounded-lg overflow-hidden text-xs font-mono",children:u(j.old_string,j.new_string).map((f,w)=>e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:`w-8 text-center border-r flex-shrink-0 ${f.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800"}`,children:f.type==="removed"?"-":"+"}),e.jsx("span",{className:`px-2 py-0.5 flex-1 whitespace-pre-wrap ${f.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200":"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200"}`,children:f.content})]},w))})]})}catch{}return e.jsx("pre",{className:"text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-2.5 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-600 dark:text-gray-400 font-mono",children:Ue(r.toolInput)})})(),r.toolName==="Write"&&(()=>{try{const j=typeof r.toolInput=="string"?JSON.parse(r.toolInput):r.toolInput;if(j.file_path&&j.content!==void 0)return e.jsxs("div",{children:[e.jsx("button",{onClick:async()=>{if(c)try{const f=await me.readFile(s?.name,j.file_path),w=await f.json(),N=f.ok&&!w.error?w.content||"":j.content||"";c(j.file_path,{old_string:"",new_string:N})}catch{c(j.file_path,{old_string:"",new_string:j.content||""})}},className:"text-xs font-mono text-blue-600 dark:text-blue-400 hover:underline mb-2 block truncate max-w-full",children:Ue(j.file_path)}),e.jsx("div",{className:"bg-white dark:bg-gray-900/50 border border-gray-200/60 dark:border-gray-700/60 rounded-lg overflow-hidden text-xs font-mono",children:u("",j.content).map((f,w)=>e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:`w-8 text-center border-r flex-shrink-0 ${f.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800"}`,children:f.type==="removed"?"-":"+"}),e.jsx("span",{className:`px-2 py-0.5 flex-1 whitespace-pre-wrap ${f.type==="removed"?"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200":"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200"}`,children:f.content})]},w))})]})}catch{}return e.jsx("pre",{className:"text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-2.5 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-600 dark:text-gray-400 font-mono",children:Ue(r.toolInput)})})(),r.toolName==="Bash"&&(()=>{try{const j=JSON.parse(r.toolInput);return e.jsxs("div",{children:[e.jsxs("div",{className:"bg-gray-900 dark:bg-gray-950 rounded-md px-3 py-2 font-mono text-xs",children:[e.jsx("span",{className:"text-green-400",children:"$"}),e.jsx("span",{className:"text-gray-100 ml-2",children:Ue(j.command)})]}),j.description&&e.jsx("div",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400 italic ml-1",children:j.description})]})}catch{return null}})(),r.toolName==="exit_plan_mode"&&(()=>{try{const j=JSON.parse(r.toolInput);if(j.plan)return e.jsx(kr,{className:"prose prose-sm max-w-none dark:prose-invert",children:j.plan.replace(/\\n/g,`
71
71
  `)})}catch{return null}})(),!["Edit","Write","Bash","exit_plan_mode"].includes(r.toolName)&&e.jsx("pre",{className:"text-xs bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 p-2.5 rounded-lg whitespace-pre-wrap break-words overflow-hidden text-gray-600 dark:text-gray-400 font-mono",children:Ue(r.toolInput)})]}),r.toolResult&&(()=>{if(!b&&!r.toolResult?.builtinHandled&&(r.toolName==="Edit"||r.toolName==="Write"||r.toolName==="ApplyPatch"||r.toolName==="Bash"))return null;const f=Ue(String(r.toolResult.content||""));return e.jsxs("div",{className:"px-3 py-2.5",children:[e.jsx("div",{className:`text-[10px] uppercase tracking-wide mb-2 ${b?"text-red-400 dark:text-red-400":"text-gray-400 dark:text-gray-500"}`,children:b?"错误":"结果"}),e.jsxs("div",{className:`text-xs ${b?"text-red-700 dark:text-red-300":"text-gray-700 dark:text-gray-300"}`,children:[(()=>{if((r.toolName==="TodoWrite"||r.toolName==="TodoRead")&&(f.includes("Todos have been modified successfully")||f.includes("Todo list")||f.startsWith("[")&&f.includes('"content"')&&f.includes('"status"')))try{if(f.startsWith("[")){const w=JSON.parse(f);if(Array.isArray(w))return e.jsx(Wo,{todos:w,isResult:!0})}return e.jsx("span",{className:"font-medium",children:"待办列表已更新成功"})}catch{}if(r.toolName==="exit_plan_mode")try{const w=JSON.parse(f);if(w.plan)return e.jsx(kr,{className:"prose prose-sm max-w-none dark:prose-invert",children:w.plan.replace(/\\n/g,`
72
- `)})}catch{}if((r.toolName==="Grep"||r.toolName==="Glob")&&r.toolResult?.toolUseResult){const w=r.toolResult.toolUseResult;if(w.filenames&&Array.isArray(w.filenames)&&w.filenames.length>0)return e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium mb-2",children:["找到 ",w.numFiles||w.filenames.length," 个文件"]}),e.jsx("div",{className:"space-y-0.5 max-h-96 overflow-y-auto",children:w.filenames.map((S,z)=>{const D=S.split("/").pop(),N=S.substring(0,S.lastIndexOf("/"));return e.jsxs("div",{onClick:()=>c&&c(S),className:"flex items-center gap-2 px-2 py-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800/50 cursor-pointer transition-colors",children:[e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"font-mono font-medium truncate block",children:D}),e.jsx("span",{className:"font-mono text-[10px] text-gray-400 dark:text-gray-500 truncate block",children:Ue(N)})]})]},z)})})]})}if(f.includes("Do you want to proceed?")&&r.toolName==="Bash"){const w=f.split(`
73
- `),S=w.findIndex($=>$.includes("Do you want to proceed?")),z=w.slice(0,S).join(`
74
- `),D=w.slice(S),N=D.find($=>$.includes("Do you want to proceed?"))||"",R=[];D.forEach($=>{const T=$.match(/^\s*(\d+)\.\s+(.+)$/);T&&R.push({number:T[1],text:T[2].trim()})});const M=f.match(/>\s*(\d+)/),E=M?M[1]:null;return e.jsxs("div",{className:"space-y-2",children:[z&&e.jsx("div",{className:"bg-gray-900 dark:bg-gray-950 text-gray-100 rounded-lg p-3 font-mono text-xs overflow-x-auto",children:e.jsx("pre",{className:"whitespace-pre-wrap break-words",children:z})}),e.jsx("div",{className:"text-gray-500 dark:text-gray-400 text-xs",children:N}),e.jsx("div",{className:"space-y-1",children:R.map($=>e.jsxs("div",{className:`flex items-center gap-2 px-2 py-1 rounded text-xs ${E===$.number?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"text-gray-500 dark:text-gray-400"}`,children:[e.jsxs("span",{className:"font-mono",children:[$.number,"."]}),e.jsx("span",{children:$.text}),E===$.number&&e.jsx("svg",{className:"w-3.5 h-3.5 ml-auto text-green-500 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})})]},$.number))}),E&&e.jsxs("div",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:["Claude 选择了选项 ",E]})]})}return f.includes("cat -n")&&f.includes("→")?e.jsxs("details",{open:!1,children:[e.jsxs("summary",{className:"[list-style:none] [&::-webkit-details-marker]:hidden cursor-pointer text-gray-400 dark:text-gray-500 hover:text-gray-500 flex items-center gap-1 mb-1 text-xs",children:[e.jsx("svg",{className:"w-3.5 h-3.5 transition-transform [details[open]>summary_&]:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"查看文件内容"]}),e.jsx("div",{className:"mt-2 bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 rounded-lg overflow-hidden",children:e.jsx("div",{className:"text-xs font-mono p-3 whitespace-pre-wrap break-words overflow-hidden",children:f})})]}):f.length>300?e.jsxs("details",{open:!1,children:[e.jsxs("summary",{className:"[list-style:none] [&::-webkit-details-marker]:hidden cursor-pointer text-gray-400 dark:text-gray-500 hover:text-gray-500 flex items-center gap-1 mb-1 text-xs",children:[e.jsx("svg",{className:"w-3.5 h-3.5 transition-transform [details[open]>summary_&]:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"查看完整输出 (",f.length," 字符)"]}),e.jsx(kr,{className:"mt-2 prose prose-sm max-w-none dark:prose-invert",children:f})]}):e.jsx(kr,{className:"prose prose-sm max-w-none dark:prose-invert",children:f})})(),i&&e.jsxs("div",{className:"mt-3 pt-2 border-t border-gray-200/60 dark:border-gray-700/40",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{if(!d)return;d(i)?.success?v("granted"):v("error")},disabled:i.isAllowed||g==="granted",className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-md text-xs font-medium border transition-colors ${i.isAllowed||g==="granted"?"bg-green-100 dark:bg-green-900/30 border-green-300/70 dark:border-green-800/60 text-green-800 dark:text-green-200 cursor-default":"bg-white/80 dark:bg-gray-900/40 border-red-300/70 dark:border-red-800/60 text-red-700 dark:text-red-200 hover:bg-white dark:hover:bg-gray-900/70"}`,children:i.isAllowed||g==="granted"?"权限已添加":`授予权限 ${i.toolName}`}),m&&e.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),m()},className:"text-xs text-red-700 dark:text-red-200 underline hover:text-red-800 dark:hover:text-red-100",children:"打开设置"})]}),e.jsxs("div",{className:"mt-2 text-xs text-red-700/90 dark:text-red-200/80",children:["添加 ",e.jsx("span",{className:"font-mono",children:i.entry})," 到允许的工具列表。"]}),g==="error"&&e.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:"无法更新权限。请重试。"}),(i.isAllowed||g==="granted")&&e.jsx("div",{className:"mt-2 text-xs text-green-700 dark:text-green-200",children:"权限已保存。请重试请求以使用该工具。"})]})]})]})})()]})]})})():r.isInteractivePrompt?e.jsx("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-amber-500 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-semibold text-amber-900 dark:text-amber-100 text-base mb-3",children:"交互式提示"}),(()=>{const k=r.content.split(`
75
- `).filter(f=>f.trim()),b=k.find(f=>f.includes("?"))||k[0]||"",j=[];return k.forEach(f=>{const w=f.match(/[❯\s]*(\d+)\.\s+(.+)/);if(w){const S=f.includes("❯");j.push({number:w[1],text:w[2].trim(),isSelected:S})}}),e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200 mb-4",children:b}),e.jsx("div",{className:"space-y-2 mb-4",children:j.map(f=>e.jsx("button",{className:`w-full text-left px-4 py-3 rounded-lg border-2 transition-all ${f.isSelected?"bg-amber-600 dark:bg-amber-700 text-white border-amber-600 dark:border-amber-700 shadow-md":"bg-white dark:bg-gray-800 text-amber-900 dark:text-amber-100 border-amber-300 dark:border-amber-700"} cursor-not-allowed opacity-75`,disabled:!0,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${f.isSelected?"bg-white/20":"bg-amber-100 dark:bg-amber-800/50"}`,children:f.number}),e.jsx("span",{className:"text-sm sm:text-base font-medium flex-1",children:f.text}),f.isSelected&&e.jsx("span",{className:"text-lg",children:"❯"})]})},f.number))}),e.jsxs("div",{className:"bg-amber-100 dark:bg-amber-800/30 rounded-lg p-3",children:[e.jsx("p",{className:"text-amber-900 dark:text-amber-100 text-sm font-medium mb-1",children:"⏳ 等待您在 CLI 中的响应"}),e.jsx("p",{className:"text-amber-800 dark:text-amber-200 text-xs",children:"请在运行 Claude 的终端中选择一个选项。"})]})]})})()]})]})}):r.isToolUse&&r.toolName==="Read"?(()=>{try{const k=JSON.parse(r.toolInput);if(k.file_path){const b=k.file_path.split("/").pop();return e.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),e.jsx("span",{className:"font-medium",children:"Read"}),e.jsx("button",{onClick:()=>c&&c(k.file_path),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-mono transition-colors",children:b})]})})}}catch{return e.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),e.jsx("span",{className:"font-medium",children:"读取文件"})]})})}})():r.isToolUse&&r.toolName==="TodoWrite"?(()=>{try{const k=JSON.parse(r.toolInput);if(k.todos&&Array.isArray(k.todos))return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400 mb-1.5",children:[e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),"更新待办列表"]}),e.jsx(Wo,{todos:k.todos})]})}catch{return e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"更新待办列表"})}})():r.isToolUse&&r.toolName==="TodoRead"?e.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})}),e.jsx("span",{className:"font-medium",children:"读取待办列表"})]})}):e.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:(()=>{const k=Ue($n(String(r.content||""))),b=k.trim();if((b.startsWith("{")||b.startsWith("["))&&(b.endsWith("}")||b.endsWith("]")))try{const j=JSON.parse(b),f=JSON.stringify(j,null,2);return e.jsxs("div",{className:"my-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-gray-600 dark:text-gray-400",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})}),e.jsx("span",{className:"font-medium",children:"JSON 响应"})]}),e.jsx("div",{className:"bg-gray-800 dark:bg-gray-900 border border-gray-600/30 dark:border-gray-700 rounded-lg overflow-hidden",children:e.jsx("pre",{className:"p-4 overflow-x-auto",children:e.jsx("code",{className:"text-gray-100 dark:text-gray-200 text-sm font-mono block whitespace-pre",children:f})})})]})}catch{}return r.type==="assistant"?e.jsx(kr,{className:"prose prose-sm max-w-none dark:prose-invert prose-gray",children:k}):e.jsx("div",{className:"whitespace-pre-wrap",children:k})})()}),e.jsxs("div",{className:`flex items-center gap-2 mt-1 ${h?"opacity-0 group-hover:opacity-100":""}`,children:[e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(r.timestamp).toLocaleTimeString()}),t&&r.type==="assistant"&&!r.isToolUse&&e.jsx("button",{onClick:()=>t(x),className:"opacity-0 group-hover:opacity-100 transition-opacity p-0.5 rounded text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",title:"从此处创建新会话分支",children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",children:[e.jsx("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),e.jsx("circle",{cx:"18",cy:"6",r:"3"}),e.jsx("circle",{cx:"6",cy:"18",r:"3"}),e.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]})})]})]})]})})}),Xl=({file:r,onRemove:o,uploadProgress:l,error:u})=>{const[c,m]=n.useState(null);return n.useEffect(()=>{const d=URL.createObjectURL(r);return m(d),()=>URL.revokeObjectURL(d)},[r]),e.jsxs("div",{className:"relative group",children:[e.jsx("img",{src:c,alt:r.name,className:"w-20 h-20 object-cover rounded"}),l!==void 0&&l<100&&e.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:e.jsxs("div",{className:"text-white text-xs",children:[l,"%"]})}),u&&e.jsx("div",{className:"absolute inset-0 bg-red-500/50 flex items-center justify-center",children:e.jsx("svg",{className:"w-6 h-6 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("button",{onClick:o,className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full p-1 opacity-0 group-hover:opacity-100",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})};function Ml({selectedProject:r,selectedSession:o,ws:l,sendMessage:u,messages:c,onFileOpen:m,onInputFocusChange:d,onSessionActive:s,onSessionInactive:p,onSessionProcessing:t,onSessionNotProcessing:x,processingSessions:h,onReplaceTemporarySession:a,onNavigateToSession:i,onShowSettings:g,autoScrollToBottom:v,sendByCtrlEnter:k,externalMessageUpdate:b,onTaskClick:j,limitStatus:f,onLimitExceeded:w,checkLimitStatus:S}){const{showConfirm:z,showAlert:D}=lt(),[N,R]=n.useState(()=>typeof window<"u"&&r&&pt.getItem(`draft_input_${r.name}`)||""),[M,E]=n.useState(()=>{if(typeof window<"u"&&r){const y=pt.getItem(`chat_messages_${r.name}`);return y?JSON.parse(y):[]}return[]}),[$,T]=n.useState(!1),[X,_]=n.useState(o?.id||null),[te,ne]=n.useState(!1),[G,le]=n.useState([]),de=n.useRef([]),[fe,Ee]=n.useState(!1),[ge,Me]=n.useState(!1),[Fe,ae]=n.useState(0),[Ne,He]=n.useState(!1),[,Be]=n.useState(0),he=20,Oe=n.useCallback(y=>{Z.current=y,ae(y)},[]),[De,Ye]=n.useState(!1),[Te,Je]=n.useState(wo),Ce=n.useRef(null),[Re,$e]=n.useState([]),Ie=n.useRef(new Map),[ze,Ze]=n.useState(null),[Qe,K]=n.useState(!1);n.useEffect(()=>{const y=`${Ve} - ${fs}`;return Re.length>0?document.title=`[等待审批] ${y}`:document.title=y,()=>{document.title=y}},[Re.length]);const B=n.useRef(o?.id||null),C=n.useRef(null);n.useEffect(()=>{l&&!C.current&&$&&X&&u({type:"check-session-status",sessionId:X,provider:Tt}),C.current=l},[l]);const[V,I]=n.useState([]),[re,Y]=n.useState(new Map),[ie,ce]=n.useState(new Map),[Ae,Xe]=n.useState(!1),Le=n.useRef(null),oe=n.useRef(null),ye=n.useRef(null),at=n.useRef(null),Pe=n.useRef(null),dt=n.useRef(!1),gt=n.useRef(!1),F=n.useRef(!1),Se=n.useRef(!1),O=n.useRef(null),se=n.useRef(null),je=n.useRef(null),ke=n.useRef(null),Z=n.useRef(0),We=n.useRef(""),tt=n.useRef(null),ft=n.useRef(null),ht=n.useRef([]),[hr,jt]=n.useState(""),[et,kt]=n.useState(!1),[Dr,xr]=n.useState([]),[Ct,Dt]=n.useState([]),[gr,tr]=n.useState(-1),[Pr,rr]=n.useState(0),[Ar,nr]=n.useState(-1),[nn,xt]=n.useState(!1),[Rt,or]=n.useState(!1),Pt=n.useRef({height:0,top:0}),[sr,wt]=n.useState(!1),[ar,yr]=n.useState(!1),br=n.useRef(null),yt=n.useRef(null),[W,ee]=n.useState([]),[pe,_e]=n.useState([]),[ut,Ke]=n.useState(""),[_s,$t]=n.useState(!1),[so,ir]=n.useState(null),[on,At]=n.useState(-1),[ao,Lt]=n.useState(-1),[vr,Is]=n.useState(100),sn=typeof window<"u"&&window.innerWidth<640,[Wt,an]=n.useState(!1),[zs,Rs]=n.useState(380),[ln,io]=n.useState(!1),[$s,Nt]=n.useState(null),[St,lo]=n.useState(()=>localStorage.getItem("claude-model")||wn.DEFAULT),Tt="claude";n.useEffect(()=>{if(!ar)return;const y=P=>{br.current&&!br.current.contains(P.target)&&yt.current&&!yt.current.contains(P.target)&&yr(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[ar]),n.useEffect(()=>{if(o?.id){const y=localStorage.getItem(`permissionMode-${o.id}`);if(y)Je(y),Ce.current=null;else if(Ce.current){const P=Ce.current;Ce.current=null,localStorage.setItem(`permissionMode-${o.id}`,P),Je(P)}else Je(wo)}},[o?.id]),n.useEffect(()=>{const y=B.current,P=o?.id;B.current=P,$e(y&&y!==P?L=>(Ie.current.set(y,L),Ie.current.get(P)||[]):L=>L.filter(A=>!A.sessionId||A.sessionId===P))},[o?.id]),n.useEffect(()=>{(async()=>{if(r)try{const[P,L,A]=await Promise.all([J("/api/commands/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:r.path})}),J("/api/skills").catch(()=>null),J("/api/mcp/config/read").catch(()=>null)]);if(!P.ok)throw new Error("Failed to fetch commands");const H=await P.json();let q=[];L?.ok&&(q=((await L.json()).skills||[]).filter(ve=>ve.scope!=="local"||ve.projectPath===r?.path).map(ve=>({name:"/"+ve.name,description:ve.description||ve.title||"",namespace:"skill",type:"skill"})));let xe=[];if(A?.ok){const be=await A.json();be.success&&be.servers&&(xe=be.servers.filter(ve=>ve.scope!=="local"||ve.projectPath===r?.path).map(ve=>({name:ve.name,description:`${ve.type}${ve.scope?" · "+ve.scope:""}`,namespace:"mcp",type:"mcp"})))}const we=[...(H.builtIn||[]).map(be=>({...be,type:"built-in"})),...(H.custom||[]).map(be=>({...be,type:"custom"})),...q,...xe];ee(we);const Q=`command_history_${r.name}`,ue=pt.getItem(Q);if(ue)try{const be=JSON.parse(ue),ve=we.sort((it,ca)=>{const da=be[it.name]||0;return(be[ca.name]||0)-da});ee(ve)}catch(be){console.error("Error parsing command history:",be)}}catch(P){console.error("Error fetching slash commands:",P),ee([])}})()},[r]);const cn=n.useMemo(()=>W.length?new Sa(W,{keys:[{name:"name",weight:2},{name:"description",weight:1}],threshold:.4,includeScore:!0,minMatchCharLength:1}):null,[W]);n.useEffect(()=>{if(!ut){_e(W);return}if(!cn){_e([]);return}const y=cn.search(ut);_e(y.map(P=>P.item))},[ut,W,cn]);const Ws=n.useMemo(()=>{if(!r||W.length===0)return[];const y=`command_history_${r.name}`,P=pt.getItem(y);if(!P)return[];try{const L=JSON.parse(P);return W.map(H=>({...H,usageCount:L[H.name]||0})).filter(H=>H.usageCount>0).sort((H,q)=>q.usageCount-H.usageCount).slice(0,5)}catch(L){return console.error("Error parsing command history:",L),[]}},[r,W]),Fs=n.useCallback((y,P,L)=>{if(!y||!r)return;if(L){At(P);return}const A=`command_history_${r.name}`,H=pt.getItem(A);let q={};try{q=H?JSON.parse(H):{}}catch(xe){console.error("Error parsing command history:",xe)}if(q[y.name]=(q[y.name]||0)+1,pt.setItem(A,JSON.stringify(q)),y.namespace==="skill"||y.namespace==="mcp"){R(y.name+" "),wt(!1),Lt(-1),Ke(""),At(-1),oe.current&&oe.current.focus();return}Lr(y)},[r]),Hs=n.useCallback(y=>{const{action:P,data:L}=y;switch(P){case"help":E(A=>[...A,{type:"assistant",content:L.content,timestamp:Date.now()}]);break;case"model":{const A=L.available.claude,H=L.message?.includes("Switching to model:")?L.message.replace("Switching to model: ","").trim():null;H&&A.includes(H)?(lo(H),localStorage.setItem("claude-model",H),E(q=>[...q,{type:"assistant",content:`已切换到模型: **${H}**`,timestamp:Date.now()}])):E(H?q=>[...q,{type:"assistant",content:`无效的模型: ${H}
72
+ `)})}catch{}if((r.toolName==="Grep"||r.toolName==="Glob")&&r.toolResult?.toolUseResult){const w=r.toolResult.toolUseResult;if(w.filenames&&Array.isArray(w.filenames)&&w.filenames.length>0)return e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium mb-2",children:["找到 ",w.numFiles||w.filenames.length," 个文件"]}),e.jsx("div",{className:"space-y-0.5 max-h-96 overflow-y-auto",children:w.filenames.map((N,L)=>{const E=N.split("/").pop(),S=N.substring(0,N.lastIndexOf("/"));return e.jsxs("div",{onClick:()=>c&&c(N),className:"flex items-center gap-2 px-2 py-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800/50 cursor-pointer transition-colors",children:[e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-400 dark:text-gray-500 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"font-mono font-medium truncate block",children:E}),e.jsx("span",{className:"font-mono text-[10px] text-gray-400 dark:text-gray-500 truncate block",children:Ue(S)})]})]},L)})})]})}if(f.includes("Do you want to proceed?")&&r.toolName==="Bash"){const w=f.split(`
73
+ `),N=w.findIndex($=>$.includes("Do you want to proceed?")),L=w.slice(0,N).join(`
74
+ `),E=w.slice(N),S=E.find($=>$.includes("Do you want to proceed?"))||"",R=[];E.forEach($=>{const T=$.match(/^\s*(\d+)\.\s+(.+)$/);T&&R.push({number:T[1],text:T[2].trim()})});const M=f.match(/>\s*(\d+)/),D=M?M[1]:null;return e.jsxs("div",{className:"space-y-2",children:[L&&e.jsx("div",{className:"bg-gray-900 dark:bg-gray-950 text-gray-100 rounded-lg p-3 font-mono text-xs overflow-x-auto",children:e.jsx("pre",{className:"whitespace-pre-wrap break-words",children:L})}),e.jsx("div",{className:"text-gray-500 dark:text-gray-400 text-xs",children:S}),e.jsx("div",{className:"space-y-1",children:R.map($=>e.jsxs("div",{className:`flex items-center gap-2 px-2 py-1 rounded text-xs ${D===$.number?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"text-gray-500 dark:text-gray-400"}`,children:[e.jsxs("span",{className:"font-mono",children:[$.number,"."]}),e.jsx("span",{children:$.text}),D===$.number&&e.jsx("svg",{className:"w-3.5 h-3.5 ml-auto text-green-500 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M5 13l4 4L19 7"})})]},$.number))}),D&&e.jsxs("div",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:["Claude 选择了选项 ",D]})]})}return f.includes("cat -n")&&f.includes("→")?e.jsxs("details",{open:!1,children:[e.jsxs("summary",{className:"[list-style:none] [&::-webkit-details-marker]:hidden cursor-pointer text-gray-400 dark:text-gray-500 hover:text-gray-500 flex items-center gap-1 mb-1 text-xs",children:[e.jsx("svg",{className:"w-3.5 h-3.5 transition-transform [details[open]>summary_&]:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"查看文件内容"]}),e.jsx("div",{className:"mt-2 bg-gray-50 dark:bg-gray-800/50 border border-gray-200/60 dark:border-gray-700/60 rounded-lg overflow-hidden",children:e.jsx("div",{className:"text-xs font-mono p-3 whitespace-pre-wrap break-words overflow-hidden",children:f})})]}):f.length>300?e.jsxs("details",{open:!1,children:[e.jsxs("summary",{className:"[list-style:none] [&::-webkit-details-marker]:hidden cursor-pointer text-gray-400 dark:text-gray-500 hover:text-gray-500 flex items-center gap-1 mb-1 text-xs",children:[e.jsx("svg",{className:"w-3.5 h-3.5 transition-transform [details[open]>summary_&]:rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),"查看完整输出 (",f.length," 字符)"]}),e.jsx(kr,{className:"mt-2 prose prose-sm max-w-none dark:prose-invert",children:f})]}):e.jsx(kr,{className:"prose prose-sm max-w-none dark:prose-invert",children:f})})(),i&&e.jsxs("div",{className:"mt-3 pt-2 border-t border-gray-200/60 dark:border-gray-700/40",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{if(!d)return;d(i)?.success?v("granted"):v("error")},disabled:i.isAllowed||g==="granted",className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-md text-xs font-medium border transition-colors ${i.isAllowed||g==="granted"?"bg-green-100 dark:bg-green-900/30 border-green-300/70 dark:border-green-800/60 text-green-800 dark:text-green-200 cursor-default":"bg-white/80 dark:bg-gray-900/40 border-red-300/70 dark:border-red-800/60 text-red-700 dark:text-red-200 hover:bg-white dark:hover:bg-gray-900/70"}`,children:i.isAllowed||g==="granted"?"权限已添加":`授予权限 ${i.toolName}`}),m&&e.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),m()},className:"text-xs text-red-700 dark:text-red-200 underline hover:text-red-800 dark:hover:text-red-100",children:"打开设置"})]}),e.jsxs("div",{className:"mt-2 text-xs text-red-700/90 dark:text-red-200/80",children:["添加 ",e.jsx("span",{className:"font-mono",children:i.entry})," 到允许的工具列表。"]}),g==="error"&&e.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:"无法更新权限。请重试。"}),(i.isAllowed||g==="granted")&&e.jsx("div",{className:"mt-2 text-xs text-green-700 dark:text-green-200",children:"权限已保存。请重试请求以使用该工具。"})]})]})]})})()]})]})})():r.isInteractivePrompt?e.jsx("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-amber-500 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-semibold text-amber-900 dark:text-amber-100 text-base mb-3",children:"交互式提示"}),(()=>{const k=r.content.split(`
75
+ `).filter(f=>f.trim()),b=k.find(f=>f.includes("?"))||k[0]||"",j=[];return k.forEach(f=>{const w=f.match(/[❯\s]*(\d+)\.\s+(.+)/);if(w){const N=f.includes("❯");j.push({number:w[1],text:w[2].trim(),isSelected:N})}}),e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200 mb-4",children:b}),e.jsx("div",{className:"space-y-2 mb-4",children:j.map(f=>e.jsx("button",{className:`w-full text-left px-4 py-3 rounded-lg border-2 transition-all ${f.isSelected?"bg-amber-600 dark:bg-amber-700 text-white border-amber-600 dark:border-amber-700 shadow-md":"bg-white dark:bg-gray-800 text-amber-900 dark:text-amber-100 border-amber-300 dark:border-amber-700"} cursor-not-allowed opacity-75`,disabled:!0,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold ${f.isSelected?"bg-white/20":"bg-amber-100 dark:bg-amber-800/50"}`,children:f.number}),e.jsx("span",{className:"text-sm sm:text-base font-medium flex-1",children:f.text}),f.isSelected&&e.jsx("span",{className:"text-lg",children:"❯"})]})},f.number))}),e.jsxs("div",{className:"bg-amber-100 dark:bg-amber-800/30 rounded-lg p-3",children:[e.jsx("p",{className:"text-amber-900 dark:text-amber-100 text-sm font-medium mb-1",children:"⏳ 等待您在 CLI 中的响应"}),e.jsx("p",{className:"text-amber-800 dark:text-amber-200 text-xs",children:"请在运行 Claude 的终端中选择一个选项。"})]})]})})()]})]})}):r.isToolUse&&r.toolName==="Read"?(()=>{try{const k=JSON.parse(r.toolInput);if(k.file_path){const b=k.file_path.split("/").pop();return e.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),e.jsx("span",{className:"font-medium",children:"Read"}),e.jsx("button",{onClick:()=>c&&c(k.file_path),className:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-mono transition-colors",children:b})]})})}}catch{return e.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),e.jsx("span",{className:"font-medium",children:"读取文件"})]})})}})():r.isToolUse&&r.toolName==="TodoWrite"?(()=>{try{const k=JSON.parse(r.toolInput);if(k.todos&&Array.isArray(k.todos))return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400 mb-1.5",children:[e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),"更新待办列表"]}),e.jsx(Wo,{todos:k.todos})]})}catch{return e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"更新待办列表"})}})():r.isToolUse&&r.toolName==="TodoRead"?e.jsx("div",{className:"bg-gray-50/50 dark:bg-gray-800/30 border-l-2 border-gray-400 dark:border-gray-500 pl-3 py-2 my-2",children:e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-600 dark:text-gray-400",children:[e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})}),e.jsx("span",{className:"font-medium",children:"读取待办列表"})]})}):e.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:(()=>{const k=Ue($n(String(r.content||""))),b=k.trim();if((b.startsWith("{")||b.startsWith("["))&&(b.endsWith("}")||b.endsWith("]")))try{const j=JSON.parse(b),f=JSON.stringify(j,null,2);return e.jsxs("div",{className:"my-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-gray-600 dark:text-gray-400",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})}),e.jsx("span",{className:"font-medium",children:"JSON 响应"})]}),e.jsx("div",{className:"bg-gray-800 dark:bg-gray-900 border border-gray-600/30 dark:border-gray-700 rounded-lg overflow-hidden",children:e.jsx("pre",{className:"p-4 overflow-x-auto",children:e.jsx("code",{className:"text-gray-100 dark:text-gray-200 text-sm font-mono block whitespace-pre",children:f})})})]})}catch{}return r.type==="assistant"?e.jsx(kr,{className:"prose prose-sm max-w-none dark:prose-invert prose-gray",children:k}):e.jsx("div",{className:"whitespace-pre-wrap",children:k})})()}),e.jsxs("div",{className:`flex items-center gap-2 mt-1 ${h?"opacity-0 group-hover:opacity-100":""}`,children:[e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(r.timestamp).toLocaleTimeString()}),t&&r.type==="assistant"&&!r.isToolUse&&e.jsx("button",{onClick:()=>t(x),className:"opacity-0 group-hover:opacity-100 transition-opacity p-0.5 rounded text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",title:"从此处创建新会话分支",children:e.jsxs("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",viewBox:"0 0 24 24",children:[e.jsx("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),e.jsx("circle",{cx:"18",cy:"6",r:"3"}),e.jsx("circle",{cx:"6",cy:"18",r:"3"}),e.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]})})]})]})]})})}),Xl=({file:r,onRemove:o,uploadProgress:l,error:u})=>{const[c,m]=n.useState(null);return n.useEffect(()=>{const d=URL.createObjectURL(r);return m(d),()=>URL.revokeObjectURL(d)},[r]),e.jsxs("div",{className:"relative group",children:[e.jsx("img",{src:c,alt:r.name,className:"w-20 h-20 object-cover rounded"}),l!==void 0&&l<100&&e.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:e.jsxs("div",{className:"text-white text-xs",children:[l,"%"]})}),u&&e.jsx("div",{className:"absolute inset-0 bg-red-500/50 flex items-center justify-center",children:e.jsx("svg",{className:"w-6 h-6 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("button",{onClick:o,className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full p-1 opacity-0 group-hover:opacity-100",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})};function Ml({selectedProject:r,selectedSession:o,ws:l,sendMessage:u,messages:c,onFileOpen:m,onInputFocusChange:d,onSessionActive:s,onSessionInactive:p,onSessionProcessing:t,onSessionNotProcessing:x,processingSessions:h,onReplaceTemporarySession:a,onNavigateToSession:i,onShowSettings:g,autoScrollToBottom:v,sendByCtrlEnter:k,externalMessageUpdate:b,onTaskClick:j,limitStatus:f,onLimitExceeded:w,checkLimitStatus:N}){const{showConfirm:L,showAlert:E}=lt(),[S,R]=n.useState(()=>typeof window<"u"&&r&&pt.getItem(`draft_input_${r.name}`)||""),[M,D]=n.useState(()=>{if(typeof window<"u"&&r){const y=pt.getItem(`chat_messages_${r.name}`);return y?JSON.parse(y):[]}return[]}),[$,T]=n.useState(!1),[X,_]=n.useState(o?.id||null),[te,ne]=n.useState(!1),[Y,le]=n.useState([]),de=n.useRef([]),[fe,Ee]=n.useState(!1),[ye,Me]=n.useState(!1),[Fe,ie]=n.useState(0),[Se,He]=n.useState(!1),[,Be]=n.useState(0),he=20,Oe=n.useCallback(y=>{Z.current=y,ie(y)},[]),[De,Ye]=n.useState(!1),[Xe,Je]=n.useState(wo),Ce=n.useRef(null),[_e,$e]=n.useState([]),ze=n.useRef(new Map),[Re,Ze]=n.useState(null),[Qe,K]=n.useState(!1);n.useEffect(()=>{const y=`${Ve} - ${fs}`;return _e.length>0?document.title=`[等待审批] ${y}`:document.title=y,()=>{document.title=y}},[_e.length]);const B=n.useRef(o?.id||null),C=n.useRef(null);n.useEffect(()=>{l&&!C.current&&$&&X&&u({type:"check-session-status",sessionId:X,provider:Tt}),C.current=l},[l]);const[V,z]=n.useState([]),[re,G]=n.useState(new Map),[ae,ce]=n.useState(new Map),[Pe,xe]=n.useState(!1),Le=n.useRef(null),oe=n.useRef(null),be=n.useRef(null),at=n.useRef(null),Ae=n.useRef(null),dt=n.useRef(!1),gt=n.useRef(!1),F=n.useRef(!1),Te=n.useRef(!1),O=n.useRef(null),se=n.useRef(null),ke=n.useRef(null),we=n.useRef(null),Z=n.useRef(0),We=n.useRef(""),tt=n.useRef(null),ft=n.useRef(null),ht=n.useRef([]),[hr,jt]=n.useState(""),[et,kt]=n.useState(!1),[Dr,xr]=n.useState([]),[Ct,Dt]=n.useState([]),[gr,tr]=n.useState(-1),[Pr,rr]=n.useState(0),[Ar,nr]=n.useState(-1),[nn,xt]=n.useState(!1),[Rt,or]=n.useState(!1),Pt=n.useRef({height:0,top:0}),[sr,wt]=n.useState(!1),[ar,yr]=n.useState(!1),br=n.useRef(null),yt=n.useRef(null),[W,ee]=n.useState([]),[pe,Ie]=n.useState([]),[ut,Ke]=n.useState(""),[Is,$t]=n.useState(!1),[so,ir]=n.useState(null),[on,At]=n.useState(-1),[ao,Lt]=n.useState(-1),[vr,_s]=n.useState(100),sn=typeof window<"u"&&window.innerWidth<640,[Wt,an]=n.useState(!1),[zs,Rs]=n.useState(380),[ln,io]=n.useState(!1),[$s,Nt]=n.useState(null),[St,lo]=n.useState(()=>localStorage.getItem("claude-model")||wn.DEFAULT),Tt="claude";n.useEffect(()=>{if(!ar)return;const y=P=>{br.current&&!br.current.contains(P.target)&&yt.current&&!yt.current.contains(P.target)&&yr(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[ar]),n.useEffect(()=>{if(o?.id){const y=localStorage.getItem(`permissionMode-${o.id}`);if(y)Je(y),Ce.current=null;else if(Ce.current){const P=Ce.current;Ce.current=null,localStorage.setItem(`permissionMode-${o.id}`,P),Je(P)}else Je(wo)}},[o?.id]),n.useEffect(()=>{const y=B.current,P=o?.id;B.current=P,$e(y&&y!==P?I=>(ze.current.set(y,I),ze.current.get(P)||[]):I=>I.filter(A=>!A.sessionId||A.sessionId===P))},[o?.id]),n.useEffect(()=>{(async()=>{if(r)try{const[P,I,A]=await Promise.all([J("/api/commands/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:r.path})}),J("/api/skills").catch(()=>null),J("/api/mcp/config/read").catch(()=>null)]);if(!P.ok)throw new Error("Failed to fetch commands");const H=await P.json();let q=[];I?.ok&&(q=((await I.json()).skills||[]).filter(je=>je.scope!=="local"||je.projectPath===r?.path).map(je=>({name:"/"+je.name,description:je.description||je.title||"",namespace:"skill",type:"skill"})));let ge=[];if(A?.ok){const ve=await A.json();ve.success&&ve.servers&&(ge=ve.servers.filter(je=>je.scope!=="local"||je.projectPath===r?.path).map(je=>({name:je.name,description:`${je.type}${je.scope?" · "+je.scope:""}`,namespace:"mcp",type:"mcp"})))}const Ne=[...(H.builtIn||[]).map(ve=>({...ve,type:"built-in"})),...(H.custom||[]).map(ve=>({...ve,type:"custom"})),...q,...ge];ee(Ne);const Q=`command_history_${r.name}`,ue=pt.getItem(Q);if(ue)try{const ve=JSON.parse(ue),je=Ne.sort((it,ca)=>{const da=ve[it.name]||0;return(ve[ca.name]||0)-da});ee(je)}catch(ve){console.error("Error parsing command history:",ve)}}catch(P){console.error("Error fetching slash commands:",P),ee([])}})()},[r]);const cn=n.useMemo(()=>W.length?new Sa(W,{keys:[{name:"name",weight:2},{name:"description",weight:1}],threshold:.4,includeScore:!0,minMatchCharLength:1}):null,[W]);n.useEffect(()=>{if(!ut){Ie(W);return}if(!cn){Ie([]);return}const y=cn.search(ut);Ie(y.map(P=>P.item))},[ut,W,cn]);const Ws=n.useMemo(()=>{if(!r||W.length===0)return[];const y=`command_history_${r.name}`,P=pt.getItem(y);if(!P)return[];try{const I=JSON.parse(P);return W.map(H=>({...H,usageCount:I[H.name]||0})).filter(H=>H.usageCount>0).sort((H,q)=>q.usageCount-H.usageCount).slice(0,5)}catch(I){return console.error("Error parsing command history:",I),[]}},[r,W]),Fs=n.useCallback((y,P,I)=>{if(!y||!r)return;if(I){At(P);return}const A=`command_history_${r.name}`,H=pt.getItem(A);let q={};try{q=H?JSON.parse(H):{}}catch(ge){console.error("Error parsing command history:",ge)}if(q[y.name]=(q[y.name]||0)+1,pt.setItem(A,JSON.stringify(q)),y.namespace==="skill"||y.namespace==="mcp"){R(y.name+" "),wt(!1),Lt(-1),Ke(""),At(-1),oe.current&&oe.current.focus();return}Lr(y)},[r]),Hs=n.useCallback(y=>{const{action:P,data:I}=y;switch(P){case"help":D(A=>[...A,{type:"assistant",content:I.content,timestamp:Date.now()}]);break;case"model":{const A=I.available.claude,H=I.message?.includes("Switching to model:")?I.message.replace("Switching to model: ","").trim():null;H&&A.includes(H)?(lo(H),localStorage.setItem("claude-model",H),D(q=>[...q,{type:"assistant",content:`已切换到模型: **${H}**`,timestamp:Date.now()}])):D(H?q=>[...q,{type:"assistant",content:`无效的模型: ${H}
76
76
 
77
77
  **可用模型**: ${A.join(", ")}`,timestamp:Date.now()}]:q=>[...q,{type:"assistant",content:`**当前模型**: ${St}
78
78
 
79
79
  **可用模型**: ${A.join(", ")}
80
80
 
81
- 使用 \`/model <模型名>\` 切换模型,例如 \`/model opus\``,timestamp:Date.now()}]);break}case"cost":{let A;L.usage?A=`**Token 使用量**: ${L.usage.used.toLocaleString()} / ${L.usage.total.toLocaleString()} (${L.usage.percentage}%)
81
+ 使用 \`/model <模型名>\` 切换模型,例如 \`/model opus\``,timestamp:Date.now()}]);break}case"cost":{let A;I.usage?A=`**Token 使用量**: ${I.usage.used.toLocaleString()} / ${I.usage.total.toLocaleString()} (${I.usage.percentage}%)
82
82
 
83
- **剩余**: ${L.usage.remaining.toLocaleString()} tokens`:A=L.message||"无可用的 Token 使用数据。",E(H=>[...H,{type:"assistant",content:A,timestamp:Date.now()}]);break}case"memory":L.error?E(A=>[...A,{type:"assistant",content:`⚠️ ${L.message}`,timestamp:Date.now()}]):(E(A=>[...A,{type:"assistant",content:`📝 ${L.message}
83
+ **剩余**: ${I.usage.remaining.toLocaleString()} tokens`:A=I.message||"无可用的 Token 使用数据。",D(H=>[...H,{type:"assistant",content:A,timestamp:Date.now()}]);break}case"memory":I.error?D(A=>[...A,{type:"assistant",content:`⚠️ ${I.message}`,timestamp:Date.now()}]):(D(A=>[...A,{type:"assistant",content:`📝 ${I.message}
84
84
 
85
- Path: \`${Ue(L.path)}\``,timestamp:Date.now()}]),L.exists&&m&&m(L.path));break;case"config":g&&g();break;default:console.warn("Unknown built-in command action:",P)}},[m,g,St]),dn=n.useRef(null),Bs=n.useCallback(async(y,P)=>{const{content:L,hasBashCommands:A,hasFileIncludes:H}=y;if(A&&!await z("此命令包含将被执行的 bash 命令。是否继续?",{title:"执行确认",variant:"warning",confirmText:"继续执行"})){E(xe=>[...xe,{type:"assistant",content:"❌ 命令执行已取消",timestamp:Date.now()}]);return}R(L),setTimeout(()=>{if(dn.current){const q={preventDefault:()=>{}};dn.current(q)}},50)},[]),Lr=n.useCallback(async y=>{if(!(!y||!r))try{const P=N.match(new RegExp(`${y.name}\\s*(.*)`)),L=P&&P[1]?P[1].trim().split(/\s+/):[],A={projectPath:r.path,projectName:r.name,sessionId:X,provider:Tt,model:St,tokenUsage:so},H=await J("/api/commands/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandName:y.name,commandPath:y.path,args:L,context:A})});if(!H.ok)throw new Error("Failed to execute command");const q=await H.json();q.type==="builtin"?Hs(q):q.type==="custom"&&await Bs(q,L),R(""),wt(!1),Lt(-1),Ke(""),At(-1)}catch(P){console.error("Error executing command:",P),E(L=>[...L,{type:"assistant",content:`Error executing command: ${P.message}`,timestamp:Date.now()}])}},[N,r,X,Tt,St,so]),co=n.useMemo(()=>{const y=new Map;return(P,L)=>{const A=`${P.length}-${L.length}-${P.slice(0,50)}`;if(y.has(A))return y.get(A);const H=Us(P,L);if(y.set(A,H),y.size>100){const q=y.keys().next().value;y.delete(q)}return H}},[]),lr=n.useCallback(async(y,P,L=!1,A="claude",H=!1)=>{if(!y||!P)return{messages:[],hasMore:!1};const q=!L;H||(q?Ee(!0):Me(!0));try{const xe=L?Z.current:0,we=await me.sessionMessages(y,P,he,xe,A);if(!we.ok)throw new Error("Failed to load session messages");const Q=await we.json();if(q&&Q.sessionImages)de.current=Q.sessionImages;else if(L&&Q.sessionImages){const ue=new Set(de.current.map(ve=>ve.batchId)),be=Q.sessionImages.filter(ve=>!ue.has(ve.batchId));be.length>0&&(de.current=[...be,...de.current])}if(q&&Q.tokenUsage&&ir(Q.tokenUsage),Q.hasMore!==void 0)return He(Q.hasMore),Be(Q.total),Oe(xe+(Q.messages?.length||0)),{messages:Q.messages||[],hasMore:Q.hasMore};{const ue=Q.messages||[];return He(!1),Be(ue.length),{messages:ue,hasMore:!1}}}catch(xe){return console.error("Error loading session messages:",xe),{messages:[],hasMore:!1}}finally{H||(q?Ee(!1):Me(!1))}},[Oe]),Us=(y,P)=>{const L=y.split(`
85
+ Path: \`${Ue(I.path)}\``,timestamp:Date.now()}]),I.exists&&m&&m(I.path));break;case"config":g&&g();break;default:console.warn("Unknown built-in command action:",P)}},[m,g,St]),dn=n.useRef(null),Bs=n.useCallback(async(y,P)=>{const{content:I,hasBashCommands:A,hasFileIncludes:H}=y;if(A&&!await L("此命令包含将被执行的 bash 命令。是否继续?",{title:"执行确认",variant:"warning",confirmText:"继续执行"})){D(ge=>[...ge,{type:"assistant",content:"❌ 命令执行已取消",timestamp:Date.now()}]);return}R(I),setTimeout(()=>{if(dn.current){const q={preventDefault:()=>{}};dn.current(q)}},50)},[]),Lr=n.useCallback(async y=>{if(!(!y||!r))try{const P=S.match(new RegExp(`${y.name}\\s*(.*)`)),I=P&&P[1]?P[1].trim().split(/\s+/):[],A={projectPath:r.path,projectName:r.name,sessionId:X,provider:Tt,model:St,tokenUsage:so},H=await J("/api/commands/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandName:y.name,commandPath:y.path,args:I,context:A})});if(!H.ok)throw new Error("Failed to execute command");const q=await H.json();q.type==="builtin"?Hs(q):q.type==="custom"&&await Bs(q,I),R(""),wt(!1),Lt(-1),Ke(""),At(-1)}catch(P){console.error("Error executing command:",P),D(I=>[...I,{type:"assistant",content:`Error executing command: ${P.message}`,timestamp:Date.now()}])}},[S,r,X,Tt,St,so]),co=n.useMemo(()=>{const y=new Map;return(P,I)=>{const A=`${P.length}-${I.length}-${P.slice(0,50)}`;if(y.has(A))return y.get(A);const H=Us(P,I);if(y.set(A,H),y.size>100){const q=y.keys().next().value;y.delete(q)}return H}},[]),lr=n.useCallback(async(y,P,I=!1,A="claude",H=!1)=>{if(!y||!P)return{messages:[],hasMore:!1};const q=!I;H||(q?Ee(!0):Me(!0));try{const ge=I?Z.current:0,Ne=await me.sessionMessages(y,P,he,ge,A);if(!Ne.ok)throw new Error("Failed to load session messages");const Q=await Ne.json();if(q&&Q.sessionImages)de.current=Q.sessionImages;else if(I&&Q.sessionImages){const ue=new Set(de.current.map(je=>je.batchId)),ve=Q.sessionImages.filter(je=>!ue.has(je.batchId));ve.length>0&&(de.current=[...ve,...de.current])}if(q&&Q.tokenUsage&&ir(Q.tokenUsage),Q.hasMore!==void 0)return He(Q.hasMore),Be(Q.total),Oe(ge+(Q.messages?.length||0)),{messages:Q.messages||[],hasMore:Q.hasMore};{const ue=Q.messages||[];return He(!1),Be(ue.length),{messages:ue,hasMore:!1}}}catch(ge){return console.error("Error loading session messages:",ge),{messages:[],hasMore:!1}}finally{H||(q?Ee(!1):Me(!1))}},[Oe]),Us=(y,P)=>{const I=y.split(`
86
86
  `),A=P.split(`
87
- `),H=[];let q=0,xe=0;for(;q<L.length||xe<A.length;){const we=L[q],Q=A[xe];q>=L.length?(H.push({type:"added",content:Q,lineNum:xe+1}),xe++):xe>=A.length?(H.push({type:"removed",content:we,lineNum:q+1}),q++):we===Q?(q++,xe++):(H.push({type:"removed",content:we,lineNum:q+1}),H.push({type:"added",content:Q,lineNum:xe+1}),q++,xe++)}return H},uo=y=>{const P=[],L=new Map;for(const A of y)if(A.message?.role==="user"&&Array.isArray(A.message?.content))for(const H of A.message.content)H.type==="tool_result"&&L.set(H.tool_use_id,{content:H.content,isError:H.is_error,timestamp:new Date(A.timestamp||Date.now()),toolUseResult:A.toolUseResult||null});for(const A of y)if(!A.isMeta){if(A.message?.role==="user"&&A.message?.content){let H="",q="user";if(Array.isArray(A.message.content)){const Q=[];for(const ue of A.message.content)ue.type==="text"&&Q.push(cr(ue.text));H=Q.join(`
88
- `)}else typeof A.message.content=="string"?H=cr(A.message.content):H=cr(String(A.message.content));const xe=H.match(/<command-name>(\/[^<]+)<\/command-name>/);xe&&(H=xe[1]),!H||H.startsWith("<command-args>")||H.startsWith("<local-command-stdout>")||H.startsWith("<system-reminder>")||H.startsWith("[Background Task Result]")||H.startsWith("<task-notification>")||H.startsWith("Caveat:")||H.startsWith("This session is being continued from a previous")||H.startsWith("[Request interrupted")||(H=H.replace(/(\n\n)?\[Images provided at the following paths:\]\n[\s\S]*$/,""),H=Nn(H),H&&P.push({type:q,content:H,timestamp:A.timestamp||new Date().toISOString(),messageUuid:A.uuid||null}))}else if(A.type==="tool_use"&&A.toolName)P.push({type:"assistant",content:"",timestamp:A.timestamp||new Date().toISOString(),isToolUse:!0,toolName:A.toolName,toolInput:A.toolInput||"",toolCallId:A.toolCallId});else if(A.type==="tool_result"){for(let H=P.length-1;H>=0;H--)if(P[H].isToolUse&&!P[H].toolResult&&(!A.toolCallId||P[H].toolCallId===A.toolCallId)){P[H].toolResult={content:A.output||"",isError:!1};break}}else if(A.message?.role==="assistant"&&A.message?.content){if(Array.isArray(A.message.content)){for(const H of A.message.content)if(H.type==="text"){let q=H.text;typeof q=="string"&&(q=Nn(q)),P.push({type:"assistant",content:q,timestamp:A.timestamp||new Date().toISOString(),messageUuid:A.uuid||null})}else if(H.type==="tool_use"){const q=L.get(H.id),xe=H.name==="Bash"&&/^__\w+__/.test(String(H.input?.command||"").trimStart());P.push({type:"assistant",content:"",timestamp:A.timestamp||new Date().toISOString(),isToolUse:!0,toolName:H.name,toolInput:JSON.stringify(H.input),toolResult:q?{content:typeof q.content=="string"?q.content:JSON.stringify(q.content),isError:q.isError,builtinHandled:xe&&q.isError,toolUseResult:q.toolUseResult}:null,toolError:q?.isError||!1,toolResultTimestamp:q?.timestamp||new Date})}}else if(typeof A.message.content=="string"){let H=A.message.content;H=Nn(H),P.push({type:"assistant",content:H,timestamp:A.timestamp||new Date().toISOString(),messageUuid:A.uuid||null})}}}return P},un=n.useMemo(()=>uo(G),[G]),Xt=n.useCallback(()=>{Pe.current&&(Pe.current.scrollTop=Pe.current.scrollHeight)},[]),_r=n.useCallback(()=>{if(!Pe.current)return!1;const{scrollTop:y,scrollHeight:P,clientHeight:L}=Pe.current;return P-y-L<50},[]),Gs=n.useCallback(async y=>{if(await z("将基于此消息之前的对话历史创建一个新的会话分支,原会话保持不变。",{title:"创建会话分支",confirmText:"创建分支",cancelText:"取消",variant:"info"}))try{const L=await me.forkSession(r.name,X,y||void 0);if(!L.ok)throw new Error("Fork failed");const{newSessionId:A}=await L.json();i&&i(A)}catch(L){console.error("[Fork] Error:",L),D("创建会话分支失败,请稍后重试。",{variant:"error"})}},[r,X,i,z,D]),Ys=n.useCallback(async()=>{if(F.current||ge||!Ne||!o||!r)return;F.current=!0,Me(!0);const y=Pe.current,P=y?.scrollHeight??0,L=y?.scrollTop??0,A=5;let H=[],q=0,xe=!0;try{for(;q<A&&xe;){const we=await lr(r.name,o.id,!0,"claude",!0);if(we.messages.length===0)break;H=[...we.messages,...H],q+=Sl(we.messages),xe=we.hasMore}H.length>0&&(O.current={height:P,top:L},le(we=>[...H,...we]))}finally{Me(!1),F.current=!1}},[Ne,ge,o,r,lr]),pn=n.useCallback(()=>{Pe.current&&or(!_r())},[_r]);n.useLayoutEffect(()=>{if(!O.current||!Pe.current)return;const{height:y,top:P}=O.current,L=Pe.current,H=L.scrollHeight-y;L.scrollTop=P+Math.max(H,0),O.current=null,setTimeout(()=>{Pe.current&&Pe.current.scrollTop>=100&&(Se.current=!1)},300)},[M.length]),n.useEffect(()=>{(async()=>{if(o&&r){const P=localStorage.getItem("selected-provider")||"claude";dt.current=!0;const L=X!==null&&X!==o.id;if(L?(Oe(0),He(!1),Be(0),ir(null),T(!1),l&&u&&u({type:"check-session-status",sessionId:o.id,provider:P})):X===null&&(Oe(0),He(!1),Be(0),l&&u&&u({type:"check-session-status",sessionId:o.id,provider:P})),_(o.id),De)Ye(!1);else{const{messages:A}=await lr(r.name,o.id,!1,"claude");le(A),L&&E(uo(A))}}else!De&&!$&&(E([]),le([]),de.current=[]),_(null),Oe(0),He(!1),Be(0);setTimeout(()=>{dt.current=!1},250)})()},[o,r,Xt,De]),n.useEffect(()=>{if(l&&o&&r){const y=localStorage.getItem("selected-provider")||"claude";u({type:"check-session-status",sessionId:o.id,provider:y})}},[l]),n.useEffect(()=>{b>0&&o&&r&&(async()=>{try{const{messages:P}=await lr(r.name,o.id,!1,"claude");le(P),v&&_r()&&setTimeout(()=>Xt(),200)}catch(P){console.error("Error reloading messages from external update:",P)}})()},[b,o,r,lr,_r,v,Xt]),n.useEffect(()=>{G.length>0&&!$&&E(y=>{const P=new Map;for(const q of y)q.type==="user"&&q.images?.length>0&&P.set(q.content,q.images);const L=new Map;for(const q of de.current)if(q.messageContent){const xe=q.images.map(Q=>({id:Q.id,name:Q.name})),we=L.get(q.messageContent)||[];L.set(q.messageContent,[...we,...xe])}const A=P.size>0,H=L.size>0;return!A&&!H?un:un.map(q=>q.type!=="user"?q:A&&P.has(q.content)?{...q,images:P.get(q.content)}:H&&L.has(q.content)?{...q,images:L.get(q.content)}:q)})},[un,G,$]),n.useEffect(()=>{d&&d(te)},[te,d]),n.useEffect(()=>{r&&N!==""?pt.setItem(`draft_input_${r.name}`,N):r&&N===""&&pt.removeItem(`draft_input_${r.name}`)},[N,r]),n.useEffect(()=>{r&&M.length>0&&pt.setItem(`chat_messages_${r.name}`,JSON.stringify(M))},[M,r]),n.useEffect(()=>{if(r){const y=pt.getItem(`draft_input_${r.name}`)||"";y!==N&&R(y)}},[r?.name]),n.useEffect(()=>{X&&$&&t&&t(X)},[$,X,t]),n.useEffect(()=>{X&&h&&h.has(X)&&!$&&(T(!0),xt(!0))},[X,h]),n.useEffect(()=>{if(c.length>0){const y=c[c.length-1];if(!["projects_updated","session-created","claude-complete","background-task-complete"].includes(y.type)&&y.sessionId&&X&&y.sessionId!==X){console.log("⏭️ Skipping message for different session:",y.sessionId,"current:",X);return}switch(y.type){case"session-created":y.sessionId&&!X&&(sessionStorage.setItem("pendingSessionId",y.sessionId),Ye(!0),a&&a(y.sessionId),$e(Q=>Q.map(ue=>ue.sessionId?ue:{...ue,sessionId:y.sessionId})));break;case"token-budget":y.data&&ir(y.data);break;case"claude-api-retry":Nt({text:`API 请求失败,正在重试 (${y.attempt}/${y.maxRetries})${y.errorStatus?` [HTTP ${y.errorStatus}]`:""}`,tokens:0,can_interrupt:!0});break;case"claude-response":if(y.data.isMeta)return;const A=y.data.message||y.data;if(A&&typeof A=="object"&&A.type){if(A.type==="content_block_delta"&&A.delta?.text){const Q=cr(A.delta.text);We.current+=Q,tt.current||(tt.current=setTimeout(()=>{const ue=We.current;We.current="",tt.current=null,ue&&E(be=>{const ve=[...be],it=ve[ve.length-1];return it&&it.type==="assistant"&&!it.isToolUse&&it.isStreaming?it.content=(it.content||"")+ue:ve.push({type:"assistant",content:ue,timestamp:new Date,isStreaming:!0}),ve})},100));return}if(A.type==="content_block_stop"){tt.current&&(clearTimeout(tt.current),tt.current=null);const Q=We.current;We.current="",Q&&E(ue=>{const be=[...ue],ve=be[be.length-1];return ve&&ve.type==="assistant"&&!ve.isToolUse&&ve.isStreaming?ve.content=(ve.content||"")+Q:be.push({type:"assistant",content:Q,timestamp:new Date,isStreaming:!0}),be}),E(ue=>{const be=[...ue],ve=be[be.length-1];return ve&&ve.type==="assistant"&&ve.isStreaming&&(ve.isStreaming=!1),be});return}}if(y.data.type==="system"&&y.data.subtype==="init"&&y.data.session_id&&X&&y.data.session_id!==X){console.log("🔄 Claude CLI session duplication detected:",{originalSession:X,newSession:y.data.session_id}),Ye(!0),i&&i(y.data.session_id);return}if(y.data.type==="system"&&y.data.subtype==="init"&&y.data.session_id&&!X){console.log("🔄 New session init detected:",{newSession:y.data.session_id}),Ye(!0),i&&i(y.data.session_id);return}if(y.data.type==="system"&&y.data.subtype==="init"&&y.data.session_id&&X&&y.data.session_id===X){console.log("🔄 System init message for current session, ignoring");return}const H=A.role==="user"||y.data.type==="user";if(Array.isArray(A.content)&&!H){for(const Q of A.content)if(Q.type==="tool_use"){const ue=Q.input?JSON.stringify(Q.input,null,2):"";E(be=>[...be,{type:"assistant",content:"",timestamp:new Date,isToolUse:!0,toolName:Q.name,toolInput:ue,toolId:Q.id,toolResult:null}])}else if(Q.type==="text"&&Q.text?.trim()){let ue=cr(Q.text);ue=$n(ue),E(be=>[...be,{type:"assistant",content:ue,timestamp:new Date}])}}else if(typeof A.content=="string"&&A.content.trim()&&!H){let Q=cr(A.content);Q=$n(Q),E(ue=>[...ue,{type:"assistant",content:Q,timestamp:new Date}])}if(A.role==="user"&&Array.isArray(A.content))for(const Q of A.content)Q.type==="tool_result"&&E(ue=>ue.map(be=>be.isToolUse&&be.toolId===Q.tool_use_id?{...be,toolResult:{content:typeof Q.content=="string"?Q.content:JSON.stringify(Q.content),isError:Q.is_error,builtinHandled:Q._builtinHandled||!1,timestamp:new Date}}:be));break;case"claude-output":{const Q=String(y.data||"");Q.trim()&&(We.current+=We.current?`
89
- ${Q}`:Q,tt.current||(tt.current=setTimeout(()=>{const ue=We.current;We.current="",tt.current=null,ue&&E(be=>{const ve=[...be],it=ve[ve.length-1];return it&&it.type==="assistant"&&!it.isToolUse&&it.isStreaming?it.content=it.content?`${it.content}
90
- ${ue}`:ue:ve.push({type:"assistant",content:ue,timestamp:new Date,isStreaming:!0}),ve})},100)))}break;case"claude-interactive-prompt":E(Q=>[...Q,{type:"assistant",content:y.data,timestamp:new Date,isInteractivePrompt:!0}]);break;case"claude-permission-request":{if(!y.requestId)break;$e(Q=>Q.some(ue=>ue.requestId===y.requestId)?Q:[...Q,{requestId:y.requestId,toolName:y.toolName||"UnknownTool",input:y.input,context:y.context,sessionId:y.sessionId||null,receivedAt:new Date}]),T(!0),xt(!0),Nt({text:"等待权限",tokens:0,can_interrupt:!0});break}case"claude-permission-cancelled":{if(!y.requestId)break;$e(Q=>Q.filter(ue=>ue.requestId!==y.requestId));break}case"share-project-template-request":{if(!y.requestId)break;Ze({requestId:y.requestId,prefillData:y.prefillData||{}}),T(!0),xt(!0),Nt({text:"等待分享模板",tokens:0,can_interrupt:!0});break}case"background-task-complete":{const Q=y;if(Q.sessionId!==null&&Q.sessionId!==X){console.log(`[BgTask] Result for session ${Q.sessionId}, current is ${X}, queuing.`),ht.current.push(Q);break}if($){console.log(`[BgTask] Session busy, queuing result ${Q.taskId}`),ht.current.push(Q);break}ho(Q);break}case"claude-error":E(Q=>[...Q,{type:"error",content:`错误: ${y.error}`,timestamp:new Date}]),T(!1),xt(!1),Nt(null),$e([]),X&&(p&&p(X),x&&x(X));break;case"claude-complete":const q=y.sessionId||X||sessionStorage.getItem("pendingSessionId");(q===X||!X)&&(T(!1),xt(!1),Nt(null)),q&&(p&&p(q),x&&x(q));const xe=sessionStorage.getItem("pendingSessionId");if(xe&&!X&&y.exitCode===0&&(_(xe),sessionStorage.removeItem("pendingSessionId"),console.log("✅ New session complete, ID set to:",xe)),r&&y.exitCode===0&&pt.removeItem(`chat_messages_${r.name}`),q===X&&$e([]),Ie.current.delete(q),ht.current.length>0&&q===X){const Q=ht.current.findIndex(ue=>ue.sessionId===X||ue.sessionId===null);if(Q>=0){const ue=ht.current.splice(Q,1)[0];setTimeout(()=>ho(ue),100)}}break;case"session-aborted":{const Q=y.sessionId||X;Q===X&&(T(!1),xt(!1),Nt(null)),Q&&(p&&p(Q),x&&x(Q)),$e([]),E(ue=>[...ue,{type:"assistant",content:"会话已被用户中断。",timestamp:new Date}]);break}case"session-status":{const Q=y.sessionId;(Q===X||o&&Q===o.id)&&(y.isProcessing?(T(!0),xt(!0),t&&t(Q)):$&&(T(!1),xt(!1),x&&x(Q),r?.name&&lr(r.name,Q,!1,"claude").then(({messages:be})=>le(be))));break}case"claude-status":const we=y.data;if(we){let Q={text:"处理中...",tokens:0,can_interrupt:!0};we.message?Q.text=we.message:we.status?Q.text=we.status:typeof we=="string"&&(Q.text=we),we.tokens?Q.tokens=we.tokens:we.token_count&&(Q.tokens=we.token_count),we.can_interrupt!==void 0&&(Q.can_interrupt=we.can_interrupt),Nt(Q),T(!0),xt(Q.can_interrupt)}break}}},[c]),n.useEffect(()=>{r&&Js()},[r]);const Js=async()=>{try{const y=await me.getFiles(r.name);if(y.ok){const P=await y.json(),L=po(P);xr(L)}}catch(y){console.error("Error fetching files:",y)}},po=(y,P="")=>{let L=[];for(const A of y){const H=P?`${P}/${A.name}`:A.name;A.type==="directory"&&A.children?L=L.concat(po(A.children,H)):A.type==="file"&&L.push({name:A.name,path:H,relativePath:A.path})}return L};n.useEffect(()=>{const y=N.slice(0,Pr),P=y.lastIndexOf("@");if(P!==-1){const L=y.slice(P+1);if(L.includes(" "))kt(!1),nr(-1);else{nr(P),kt(!0);const A=Dr.filter(H=>H.name.toLowerCase().includes(L.toLowerCase())||H.path.toLowerCase().includes(L.toLowerCase())).slice(0,10);Dt(A),tr(-1)}}else kt(!1),nr(-1)},[N,Pr,Dr]),n.useEffect(()=>{const y=setTimeout(()=>{jt(N)},150);return()=>clearTimeout(y)},[N]);const Ir=n.useMemo(()=>M.length<=vr?M:M.slice(-vr),[M,vr]),mo=n.useMemo(()=>Ir.filter(y=>!y.isToolUse),[Ir]),Ft=n.useMemo(()=>Ir.filter(y=>y.isToolUse),[Ir]),qs=n.useMemo(()=>M.filter(y=>!y.isToolUse).length,[M]),fo=n.useMemo(()=>M.filter(y=>y.isToolUse).length,[M]);n.useEffect(()=>{if(!v&&Pe.current){const y=Pe.current;Pt.current={height:y.scrollHeight,top:y.scrollTop}}}),n.useEffect(()=>{if(Pe.current&&M.length>0)if(v)Rt||setTimeout(()=>Xt(),50);else{const y=Pe.current,P=Pt.current.height,L=Pt.current.top,H=y.scrollHeight-P;H>0&&L>0&&(y.scrollTop=L+H)}},[M.length,Rt,Xt,v]),n.useEffect(()=>{Pe.current&&M.length>0&&!dt.current&&(or(!1),setTimeout(()=>{Xt()},200))},[o?.id,r?.name]),n.useEffect(()=>{const y=Pe.current;if(y)return y.addEventListener("scroll",pn),()=>y.removeEventListener("scroll",pn)},[pn]),n.useEffect(()=>{const y=L=>{if(!ln)return;const A=se.current;if(!A)return;const H=A.parentElement;if(!H)return;const xe=H.getBoundingClientRect().right-L.clientX;xe>=300&&xe<=600&&Rs(xe)},P=()=>io(!1);return ln&&(document.addEventListener("mousemove",y),document.addEventListener("mouseup",P),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",P),document.body.style.cursor="",document.body.style.userSelect=""}},[ln]),n.useEffect(()=>{!sn&&Ft.length>0&&!Wt&&an(!0)},[Ft.length]),n.useEffect(()=>{Wt&&je.current&&(je.current.scrollTop=je.current.scrollHeight)},[Ft.length,Wt]),n.useEffect(()=>{Re.length>0&&setTimeout(()=>{Rt||Xt(),Wt&&je.current&&(je.current.scrollTop=je.current.scrollHeight)},100)},[Re.length,Rt,Xt,Wt]),n.useEffect(()=>{if(oe.current){oe.current.style.height="auto",oe.current.style.height=oe.current.scrollHeight+"px";const y=parseInt(window.getComputedStyle(oe.current).lineHeight),P=oe.current.scrollHeight>y*2;$t(P)}},[]),n.useEffect(()=>{oe.current&&!N.trim()&&(oe.current.style.height="auto",$t(!1))},[N]),n.useEffect(()=>{if(!r||!o?.id||o.id.startsWith("new-session-")){ir(null);return}(async()=>{try{const P=`/api/projects/${r.name}/sessions/${o.id}/token-usage`,L=await J(P);if(L.ok){const A=await L.json();ir(A)}else ir(null)}catch(P){console.error("Failed to fetch initial token usage:",P)}})()},[o?.id,o?.__provider,r?.path]);const Ks=n.useCallback(y=>{y.trim()&&R(P=>{const L=P.trim()?`${P} ${y}`:y;return setTimeout(()=>{if(oe.current){oe.current.style.height="auto",oe.current.style.height=oe.current.scrollHeight+"px";const A=parseInt(window.getComputedStyle(oe.current).lineHeight),H=oe.current.scrollHeight>A*2;$t(H)}},0),L})},[]),Vs=n.useCallback(()=>{Is(y=>y+100)},[]),zr=n.useCallback(y=>{const P=y.filter(L=>{try{if(!L||typeof L!="object")return console.warn("Invalid file object:",L),!1;if(!L.type||!L.type.startsWith("image/"))return!1;if(!L.size||L.size>5242880){const A=L.name||"Unknown file";return ce(H=>{const q=new Map(H);return q.set(A,"文件太大(最大 5MB)"),q}),!1}return!0}catch(A){return console.error("Error validating file:",A,L),!1}});P.length>0&&I(L=>[...L,...P].slice(0,5))},[]),Zs=n.useCallback(async y=>{const P=y.target.files;if(!(!P||P.length===0||!r)){Xe(!0);try{const L=new FormData;Array.from(P).forEach(q=>{L.append("files",q)});const A=await me.uploadFiles(r.name,L);if(!A.ok){const q=await A.json();throw new Error(q.error||"上传失败")}const H=await A.json();if(H.files&&H.files.length>0){const q=H.files.map(we=>`@${we.name}`).join(" "),xe=N?`${N} ${q} `:`${q} `;R(xe),oe.current&&oe.current.focus()}}catch(L){console.error("File upload failed:",L)}finally{Xe(!1),ye.current&&(ye.current.value="")}}},[r,N]),Qs=n.useCallback(async y=>{const P=Array.from(y.clipboardData.items);for(const L of P)if(L.type.startsWith("image/")){const A=L.getAsFile();A&&zr([A])}if(P.length===0&&y.clipboardData.files.length>0){const A=Array.from(y.clipboardData.files).filter(H=>H.type.startsWith("image/"));A.length>0&&zr(A)}},[zr]),{getRootProps:ea,getInputProps:ta,isDragActive:ra,open:na}=Vn({accept:{"image/*":[".png",".jpg",".jpeg",".gif",".webp",".svg"]},maxSize:5*1024*1024,maxFiles:5,onDrop:zr,noClick:!0,noKeyboard:!0}),ho=n.useCallback(y=>{if(!l||!u||!r)return;const P=["[Background Task Result]",`Task ID: ${y.taskId}`,`Command: ${y.command}`,`Status: ${y.status} (exit code: ${y.exitCode??"N/A"})`,`Duration: ${Math.round((y.duration||0)/1e3)}s`];y.truncated&&P.push("(Output truncated to 100KB)"),y.stdout&&P.push("","STDOUT:",y.stdout),y.stderr&&P.push("","STDERR:",y.stderr);const L=P.join(`
91
- `);let A={allowedTools:[],disallowedTools:[],skipPermissions:!1};try{const H=pt.getItem("claude-settings");H&&(A=JSON.parse(H))}catch{}u({type:"claude-command",command:L,options:{projectPath:r.path,cwd:r.fullPath,sessionId:y.sessionId,resume:!0,isBackgroundResult:!0,toolsSettings:A,permissionMode:Te,model:St}}),T(!0),xt(!0),Nt({text:"处理后台任务结果",tokens:0,can_interrupt:!0})},[l,u,r,Te,St]),Yt=n.useCallback(async y=>{if(y.preventDefault(),!N.trim()||$||!r||gt.current)return;gt.current=!0;const P=N.trim();if(P.startsWith("/")){const ue=P.indexOf(" "),be=ue!==-1?P.slice(0,ue):P,ve=W.find(it=>it.name===be&&it.namespace==="builtin");if(ve){gt.current=!1,Lr(ve);return}}if(S){const ue=await S();if(ue&&!ue.allowed){gt.current=!1,w?.(ue.reason);return}}let L=[],A=null;if(V.length>0){const ue=new FormData;V.forEach(be=>{ue.append("images",be)});try{const be=await J(`/api/projects/${r.name}/upload-images`,{method:"POST",headers:{},body:ue});if(!be.ok)throw new Error("图片上传失败");const ve=await be.json();L=ve.images,A=ve.uploadBatchId||null}catch(be){console.error("Image upload failed:",be),gt.current=!1,E(ve=>[...ve,{type:"error",content:`图片上传失败: ${be.message}`,timestamp:new Date}]);return}}const H={type:"user",content:N,images:L,timestamp:new Date};E(ue=>[...ue,H]),T(!0),gt.current=!1,xt(!0),Nt({text:"处理中",tokens:0,can_interrupt:!0}),or(!1),setTimeout(()=>Xt(),100);const xe=X||o?.id||`new-session-${Date.now()}`;s&&s(xe);const Q=(()=>{try{const ue=pt.getItem("claude-settings");if(ue)return JSON.parse(ue)}catch(ue){console.error("Error loading tools settings:",ue)}return{allowedTools:[],disallowedTools:[],skipPermissions:!1}})();X||(Ce.current=Te),u({type:"claude-command",command:N,options:{projectPath:r.path,cwd:r.fullPath,sessionId:X,resume:!!X,toolsSettings:Q,permissionMode:Te,model:St,images:L,uploadBatchId:A}}),R(""),I([]),Y(new Map),ce(new Map),$t(!1),oe.current&&(oe.current.style.height="auto"),r&&pt.removeItem(`draft_input_${r.name}`)},[N,$,r,V,X,o,Tt,Te,s,St,u,R,I,Y,ce,$t,oe,E,T,xt,Nt,or,Xt,S,w,Lr,W]),mn=n.useCallback(y=>!y||Tt!=="claude"?{success:!1}:wl(y.entry),[Tt]),jr=n.useCallback((y,P)=>{const A=(Array.isArray(y)?y:[y]).filter(Boolean);A.length!==0&&(A.forEach(H=>{u({type:"claude-permission-response",requestId:H,allow:!!P?.allow,updatedInput:P?.updatedInput,message:P?.message,rememberEntry:P?.rememberEntry})}),$e(H=>{const q=H.filter(xe=>!A.includes(xe.requestId));return q.length===0&&Nt(null),q}))},[u]),xo=n.useCallback(y=>{ze&&(u({type:"share-project-template-response",requestId:ze.requestId,...y}),Ze(null))},[ze,u]);n.useEffect(()=>{dn.current=Yt},[Yt]);const go=y=>{if(!y)return;const P=N.slice(0,ao),L=N.slice(ao),A=L.indexOf(" "),H=A!==-1?L.slice(A):"",q=P+y.name+" "+H;if(R(q),wt(!1),Lt(-1),Ke(""),At(-1),ft.current&&clearTimeout(ft.current),y.namespace==="skill"||y.namespace==="mcp"){oe.current&&oe.current.focus();return}Lr(y)},oa=y=>{if(sr&&pe.length>0){if(y.key==="ArrowDown"){y.preventDefault(),At(P=>P<pe.length-1?P+1:0);return}if(y.key==="ArrowUp"){y.preventDefault(),At(P=>P>0?P-1:pe.length-1);return}if(y.key==="Tab"||y.key==="Enter"){y.preventDefault(),on>=0?go(pe[on]):pe.length>0&&go(pe[0]);return}if(y.key==="Escape"){y.preventDefault(),wt(!1),Lt(-1),Ke(""),At(-1),ft.current&&clearTimeout(ft.current);return}}if(et&&Ct.length>0){if(y.key==="ArrowDown"){y.preventDefault(),tr(P=>P<Ct.length-1?P+1:0);return}if(y.key==="ArrowUp"){y.preventDefault(),tr(P=>P>0?P-1:Ct.length-1);return}if(y.key==="Tab"||y.key==="Enter"){y.preventDefault(),gr>=0?fn(Ct[gr]):Ct.length>0&&fn(Ct[0]);return}if(y.key==="Escape"){y.preventDefault(),kt(!1);return}}if(y.key==="Tab"&&!et&&!sr){y.preventDefault();const P=["default","acceptEdits","bypassPermissions","plan"],A=(P.indexOf(Te)+1)%P.length,H=P[A];Je(H),o?.id&&localStorage.setItem(`permissionMode-${o.id}`,H);return}if(y.key==="Enter"){if(y.nativeEvent.isComposing)return;(y.ctrlKey||y.metaKey)&&!y.shiftKey?(y.preventDefault(),Yt(y)):!y.shiftKey&&!y.ctrlKey&&!y.metaKey&&(k||(y.preventDefault(),Yt(y)))}},fn=y=>{const P=N.slice(0,Ar),L=N.slice(Ar),A=L.indexOf(" "),H=A!==-1?L.slice(A):"",q=P+"@"+y.path+" "+H,xe=P.length+1+y.path.length+1;oe.current&&!oe.current.matches(":focus")&&oe.current.focus(),R(q),rr(xe),kt(!1),nr(-1),oe.current&&requestAnimationFrame(()=>{oe.current&&(oe.current.setSelectionRange(xe,xe),oe.current.matches(":focus")||oe.current.focus())})},sa=y=>{const P=y.target.value,L=y.target.selectionStart;if(!X&&P.trim(),R(P),rr(L),!P.trim()){y.target.style.height="auto",$t(!1),wt(!1),Lt(-1),Ke("");return}const A=P.slice(0,L);if((A.match(/```/g)||[]).length%2===1){wt(!1),Lt(-1),Ke("");return}const xe=/(^|\s)\/(\S*)$/,we=A.match(xe);if(we){const Q=we.index+we[1].length,ue=we[2];Lt(Q),wt(!0),At(-1),ft.current&&clearTimeout(ft.current),ft.current=setTimeout(()=>{Ke(ue)},150)}else wt(!1),Lt(-1),Ke(""),ft.current&&clearTimeout(ft.current)},aa=y=>{rr(y.target.selectionStart)},ia=()=>{X&&nn&&u({type:"abort-session",sessionId:X,provider:Tt})},la=()=>{const y=["default","acceptEdits","bypassPermissions","plan"],L=(y.indexOf(Te)+1)%y.length,A=y[L];Je(A),o?.id&&localStorage.setItem(`permissionMode-${o.id}`,A)};return r?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
87
+ `),H=[];let q=0,ge=0;for(;q<I.length||ge<A.length;){const Ne=I[q],Q=A[ge];q>=I.length?(H.push({type:"added",content:Q,lineNum:ge+1}),ge++):ge>=A.length?(H.push({type:"removed",content:Ne,lineNum:q+1}),q++):Ne===Q?(q++,ge++):(H.push({type:"removed",content:Ne,lineNum:q+1}),H.push({type:"added",content:Q,lineNum:ge+1}),q++,ge++)}return H},uo=y=>{const P=[],I=new Map;for(const A of y)if(A.message?.role==="user"&&Array.isArray(A.message?.content))for(const H of A.message.content)H.type==="tool_result"&&I.set(H.tool_use_id,{content:H.content,isError:H.is_error,timestamp:new Date(A.timestamp||Date.now()),toolUseResult:A.toolUseResult||null});for(const A of y)if(!A.isMeta){if(A.message?.role==="user"&&A.message?.content){let H="",q="user";if(Array.isArray(A.message.content)){const Q=[];for(const ue of A.message.content)ue.type==="text"&&Q.push(cr(ue.text));H=Q.join(`
88
+ `)}else typeof A.message.content=="string"?H=cr(A.message.content):H=cr(String(A.message.content));const ge=H.match(/<command-name>(\/[^<]+)<\/command-name>/);ge&&(H=ge[1]),!H||H.startsWith("<command-args>")||H.startsWith("<local-command-stdout>")||H.startsWith("<system-reminder>")||H.startsWith("[Background Task Result]")||H.startsWith("<task-notification>")||H.startsWith("Caveat:")||H.startsWith("This session is being continued from a previous")||H.startsWith("[Request interrupted")||(H=H.replace(/(\n\n)?\[Images provided at the following paths:\]\n[\s\S]*$/,""),H=Nn(H),H&&P.push({type:q,content:H,timestamp:A.timestamp||new Date().toISOString(),messageUuid:A.uuid||null}))}else if(A.type==="tool_use"&&A.toolName)P.push({type:"assistant",content:"",timestamp:A.timestamp||new Date().toISOString(),isToolUse:!0,toolName:A.toolName,toolInput:A.toolInput||"",toolCallId:A.toolCallId});else if(A.type==="tool_result"){for(let H=P.length-1;H>=0;H--)if(P[H].isToolUse&&!P[H].toolResult&&(!A.toolCallId||P[H].toolCallId===A.toolCallId)){P[H].toolResult={content:A.output||"",isError:!1};break}}else if(A.message?.role==="assistant"&&A.message?.content){if(Array.isArray(A.message.content)){for(const H of A.message.content)if(H.type==="text"){let q=H.text;typeof q=="string"&&(q=Nn(q)),P.push({type:"assistant",content:q,timestamp:A.timestamp||new Date().toISOString(),messageUuid:A.uuid||null})}else if(H.type==="tool_use"){const q=I.get(H.id),ge=H.name==="Bash"&&/^__\w+__/.test(String(H.input?.command||"").trimStart());P.push({type:"assistant",content:"",timestamp:A.timestamp||new Date().toISOString(),isToolUse:!0,toolName:H.name,toolInput:JSON.stringify(H.input),toolResult:q?{content:typeof q.content=="string"?q.content:JSON.stringify(q.content),isError:q.isError,builtinHandled:ge&&q.isError,toolUseResult:q.toolUseResult}:null,toolError:q?.isError||!1,toolResultTimestamp:q?.timestamp||new Date})}}else if(typeof A.message.content=="string"){let H=A.message.content;H=Nn(H),P.push({type:"assistant",content:H,timestamp:A.timestamp||new Date().toISOString(),messageUuid:A.uuid||null})}}}return P},un=n.useMemo(()=>uo(Y),[Y]),Xt=n.useCallback(()=>{Ae.current&&(Ae.current.scrollTop=Ae.current.scrollHeight)},[]),Ir=n.useCallback(()=>{if(!Ae.current)return!1;const{scrollTop:y,scrollHeight:P,clientHeight:I}=Ae.current;return P-y-I<50},[]),Gs=n.useCallback(async y=>{if(await L("将基于此消息之前的对话历史创建一个新的会话分支,原会话保持不变。",{title:"创建会话分支",confirmText:"创建分支",cancelText:"取消",variant:"info"}))try{const I=await me.forkSession(r.name,X,y||void 0);if(!I.ok)throw new Error("Fork failed");const{newSessionId:A}=await I.json();i&&i(A)}catch(I){console.error("[Fork] Error:",I),E("创建会话分支失败,请稍后重试。",{variant:"error"})}},[r,X,i,L,E]),Ys=n.useCallback(async()=>{if(F.current||ye||!Se||!o||!r)return;F.current=!0,Me(!0);const y=Ae.current,P=y?.scrollHeight??0,I=y?.scrollTop??0,A=5;let H=[],q=0,ge=!0;try{for(;q<A&&ge;){const Ne=await lr(r.name,o.id,!0,"claude",!0);if(Ne.messages.length===0)break;H=[...Ne.messages,...H],q+=Sl(Ne.messages),ge=Ne.hasMore}H.length>0&&(O.current={height:P,top:I},le(Ne=>[...H,...Ne]))}finally{Me(!1),F.current=!1}},[Se,ye,o,r,lr]),pn=n.useCallback(()=>{Ae.current&&or(!Ir())},[Ir]);n.useLayoutEffect(()=>{if(!O.current||!Ae.current)return;const{height:y,top:P}=O.current,I=Ae.current,H=I.scrollHeight-y;I.scrollTop=P+Math.max(H,0),O.current=null,setTimeout(()=>{Ae.current&&Ae.current.scrollTop>=100&&(Te.current=!1)},300)},[M.length]),n.useEffect(()=>{(async()=>{if(o&&r){const P=localStorage.getItem("selected-provider")||"claude";dt.current=!0;const I=X!==null&&X!==o.id;if(I?(Oe(0),He(!1),Be(0),ir(null),T(!1),l&&u&&u({type:"check-session-status",sessionId:o.id,provider:P})):X===null&&(Oe(0),He(!1),Be(0),l&&u&&u({type:"check-session-status",sessionId:o.id,provider:P})),_(o.id),De)Ye(!1);else{const{messages:A}=await lr(r.name,o.id,!1,"claude");le(A),I&&D(uo(A))}}else!De&&!$&&(D([]),le([]),de.current=[]),_(null),Oe(0),He(!1),Be(0);setTimeout(()=>{dt.current=!1},250)})()},[o,r,Xt,De]),n.useEffect(()=>{if(l&&o&&r){const y=localStorage.getItem("selected-provider")||"claude";u({type:"check-session-status",sessionId:o.id,provider:y})}},[l]),n.useEffect(()=>{b>0&&o&&r&&(async()=>{try{const{messages:P}=await lr(r.name,o.id,!1,"claude");le(P),v&&Ir()&&setTimeout(()=>Xt(),200)}catch(P){console.error("Error reloading messages from external update:",P)}})()},[b,o,r,lr,Ir,v,Xt]),n.useEffect(()=>{Y.length>0&&!$&&D(y=>{const P=new Map;for(const q of y)q.type==="user"&&q.images?.length>0&&P.set(q.content,q.images);const I=new Map;for(const q of de.current)if(q.messageContent){const ge=q.images.map(Q=>({id:Q.id,name:Q.name})),Ne=I.get(q.messageContent)||[];I.set(q.messageContent,[...Ne,...ge])}const A=P.size>0,H=I.size>0;return!A&&!H?un:un.map(q=>q.type!=="user"?q:A&&P.has(q.content)?{...q,images:P.get(q.content)}:H&&I.has(q.content)?{...q,images:I.get(q.content)}:q)})},[un,Y,$]),n.useEffect(()=>{d&&d(te)},[te,d]),n.useEffect(()=>{r&&S!==""?pt.setItem(`draft_input_${r.name}`,S):r&&S===""&&pt.removeItem(`draft_input_${r.name}`)},[S,r]),n.useEffect(()=>{r&&M.length>0&&pt.setItem(`chat_messages_${r.name}`,JSON.stringify(M))},[M,r]),n.useEffect(()=>{if(r){const y=pt.getItem(`draft_input_${r.name}`)||"";y!==S&&R(y)}},[r?.name]),n.useEffect(()=>{X&&$&&t&&t(X)},[$,X,t]),n.useEffect(()=>{X&&h&&h.has(X)&&!$&&(T(!0),xt(!0))},[X,h]),n.useEffect(()=>{if(c.length>0){const y=c[c.length-1];if(!["projects_updated","session-created","claude-complete","background-task-complete"].includes(y.type)&&y.sessionId&&X&&y.sessionId!==X){console.log("⏭️ Skipping message for different session:",y.sessionId,"current:",X);return}switch(y.type){case"session-created":y.sessionId&&!X&&(sessionStorage.setItem("pendingSessionId",y.sessionId),Ye(!0),a&&a(y.sessionId),$e(Q=>Q.map(ue=>ue.sessionId?ue:{...ue,sessionId:y.sessionId})));break;case"token-budget":y.data&&ir(y.data);break;case"claude-api-retry":Nt({text:`API 请求失败,正在重试 (${y.attempt}/${y.maxRetries})${y.errorStatus?` [HTTP ${y.errorStatus}]`:""}`,tokens:0,can_interrupt:!0});break;case"claude-response":if(y.data.isMeta)return;const A=y.data.message||y.data;if(A&&typeof A=="object"&&A.type){if(A.type==="content_block_delta"&&A.delta?.text){const Q=cr(A.delta.text);We.current+=Q,tt.current||(tt.current=setTimeout(()=>{const ue=We.current;We.current="",tt.current=null,ue&&D(ve=>{const je=[...ve],it=je[je.length-1];return it&&it.type==="assistant"&&!it.isToolUse&&it.isStreaming?it.content=(it.content||"")+ue:je.push({type:"assistant",content:ue,timestamp:new Date,isStreaming:!0}),je})},100));return}if(A.type==="content_block_stop"){tt.current&&(clearTimeout(tt.current),tt.current=null);const Q=We.current;We.current="",Q&&D(ue=>{const ve=[...ue],je=ve[ve.length-1];return je&&je.type==="assistant"&&!je.isToolUse&&je.isStreaming?je.content=(je.content||"")+Q:ve.push({type:"assistant",content:Q,timestamp:new Date,isStreaming:!0}),ve}),D(ue=>{const ve=[...ue],je=ve[ve.length-1];return je&&je.type==="assistant"&&je.isStreaming&&(je.isStreaming=!1),ve});return}}if(y.data.type==="system"&&y.data.subtype==="init"&&y.data.session_id&&X&&y.data.session_id!==X){console.log("🔄 Claude CLI session duplication detected:",{originalSession:X,newSession:y.data.session_id}),Ye(!0),i&&i(y.data.session_id);return}if(y.data.type==="system"&&y.data.subtype==="init"&&y.data.session_id&&!X){console.log("🔄 New session init detected:",{newSession:y.data.session_id}),Ye(!0),i&&i(y.data.session_id);return}if(y.data.type==="system"&&y.data.subtype==="init"&&y.data.session_id&&X&&y.data.session_id===X){console.log("🔄 System init message for current session, ignoring");return}const H=A.role==="user"||y.data.type==="user";if(Array.isArray(A.content)&&!H){for(const Q of A.content)if(Q.type==="tool_use"){const ue=Q.input?JSON.stringify(Q.input,null,2):"";D(ve=>[...ve,{type:"assistant",content:"",timestamp:new Date,isToolUse:!0,toolName:Q.name,toolInput:ue,toolId:Q.id,toolResult:null}])}else if(Q.type==="text"&&Q.text?.trim()){let ue=cr(Q.text);ue=$n(ue),D(ve=>[...ve,{type:"assistant",content:ue,timestamp:new Date}])}}else if(typeof A.content=="string"&&A.content.trim()&&!H){let Q=cr(A.content);Q=$n(Q),D(ue=>[...ue,{type:"assistant",content:Q,timestamp:new Date}])}if(A.role==="user"&&Array.isArray(A.content))for(const Q of A.content)Q.type==="tool_result"&&D(ue=>ue.map(ve=>ve.isToolUse&&ve.toolId===Q.tool_use_id?{...ve,toolResult:{content:typeof Q.content=="string"?Q.content:JSON.stringify(Q.content),isError:Q.is_error,builtinHandled:Q._builtinHandled||!1,timestamp:new Date}}:ve));break;case"claude-output":{const Q=String(y.data||"");Q.trim()&&(We.current+=We.current?`
89
+ ${Q}`:Q,tt.current||(tt.current=setTimeout(()=>{const ue=We.current;We.current="",tt.current=null,ue&&D(ve=>{const je=[...ve],it=je[je.length-1];return it&&it.type==="assistant"&&!it.isToolUse&&it.isStreaming?it.content=it.content?`${it.content}
90
+ ${ue}`:ue:je.push({type:"assistant",content:ue,timestamp:new Date,isStreaming:!0}),je})},100)))}break;case"claude-interactive-prompt":D(Q=>[...Q,{type:"assistant",content:y.data,timestamp:new Date,isInteractivePrompt:!0}]);break;case"claude-permission-request":{if(!y.requestId)break;$e(Q=>Q.some(ue=>ue.requestId===y.requestId)?Q:[...Q,{requestId:y.requestId,toolName:y.toolName||"UnknownTool",input:y.input,context:y.context,sessionId:y.sessionId||null,receivedAt:new Date}]),T(!0),xt(!0),Nt({text:"等待权限",tokens:0,can_interrupt:!0});break}case"claude-permission-cancelled":{if(!y.requestId)break;$e(Q=>Q.filter(ue=>ue.requestId!==y.requestId));break}case"share-project-template-request":{if(!y.requestId)break;Ze({requestId:y.requestId,prefillData:y.prefillData||{}}),T(!0),xt(!0),Nt({text:"等待分享模板",tokens:0,can_interrupt:!0});break}case"background-task-complete":{const Q=y;if(Q.sessionId!==null&&Q.sessionId!==X){console.log(`[BgTask] Result for session ${Q.sessionId}, current is ${X}, queuing.`),ht.current.push(Q);break}if($){console.log(`[BgTask] Session busy, queuing result ${Q.taskId}`),ht.current.push(Q);break}ho(Q);break}case"claude-error":D(Q=>[...Q,{type:"error",content:`错误: ${y.error}`,timestamp:new Date}]),T(!1),xt(!1),Nt(null),$e([]),X&&(p&&p(X),x&&x(X));break;case"claude-complete":const q=y.sessionId||X||sessionStorage.getItem("pendingSessionId");(q===X||!X)&&(T(!1),xt(!1),Nt(null)),q&&(p&&p(q),x&&x(q));const ge=sessionStorage.getItem("pendingSessionId");if(ge&&!X&&y.exitCode===0&&(_(ge),sessionStorage.removeItem("pendingSessionId"),console.log("✅ New session complete, ID set to:",ge)),r&&y.exitCode===0&&pt.removeItem(`chat_messages_${r.name}`),q===X&&$e([]),ze.current.delete(q),ht.current.length>0&&q===X){const Q=ht.current.findIndex(ue=>ue.sessionId===X||ue.sessionId===null);if(Q>=0){const ue=ht.current.splice(Q,1)[0];setTimeout(()=>ho(ue),100)}}break;case"session-aborted":{const Q=y.sessionId||X;Q===X&&(T(!1),xt(!1),Nt(null)),Q&&(p&&p(Q),x&&x(Q)),$e([]),D(ue=>[...ue,{type:"assistant",content:"会话已被用户中断。",timestamp:new Date}]);break}case"session-status":{const Q=y.sessionId;(Q===X||o&&Q===o.id)&&(y.isProcessing?(T(!0),xt(!0),t&&t(Q)):$&&(T(!1),xt(!1),x&&x(Q),r?.name&&lr(r.name,Q,!1,"claude").then(({messages:ve})=>le(ve))));break}case"claude-status":const Ne=y.data;if(Ne){let Q={text:"处理中...",tokens:0,can_interrupt:!0};Ne.message?Q.text=Ne.message:Ne.status?Q.text=Ne.status:typeof Ne=="string"&&(Q.text=Ne),Ne.tokens?Q.tokens=Ne.tokens:Ne.token_count&&(Q.tokens=Ne.token_count),Ne.can_interrupt!==void 0&&(Q.can_interrupt=Ne.can_interrupt),Nt(Q),T(!0),xt(Q.can_interrupt)}break}}},[c]),n.useEffect(()=>{r&&Js()},[r]);const Js=async()=>{try{const y=await me.getFiles(r.name);if(y.ok){const P=await y.json(),I=po(P);xr(I)}}catch(y){console.error("Error fetching files:",y)}},po=(y,P="")=>{let I=[];for(const A of y){const H=P?`${P}/${A.name}`:A.name;A.type==="directory"&&A.children?I=I.concat(po(A.children,H)):A.type==="file"&&I.push({name:A.name,path:H,relativePath:A.path})}return I};n.useEffect(()=>{const y=S.slice(0,Pr),P=y.lastIndexOf("@");if(P!==-1){const I=y.slice(P+1);if(I.includes(" "))kt(!1),nr(-1);else{nr(P),kt(!0);const A=Dr.filter(H=>H.name.toLowerCase().includes(I.toLowerCase())||H.path.toLowerCase().includes(I.toLowerCase())).slice(0,10);Dt(A),tr(-1)}}else kt(!1),nr(-1)},[S,Pr,Dr]),n.useEffect(()=>{const y=setTimeout(()=>{jt(S)},150);return()=>clearTimeout(y)},[S]);const _r=n.useMemo(()=>M.length<=vr?M:M.slice(-vr),[M,vr]),mo=n.useMemo(()=>_r.filter(y=>!y.isToolUse),[_r]),Ft=n.useMemo(()=>_r.filter(y=>y.isToolUse),[_r]),qs=n.useMemo(()=>M.filter(y=>!y.isToolUse).length,[M]),fo=n.useMemo(()=>M.filter(y=>y.isToolUse).length,[M]);n.useEffect(()=>{if(!v&&Ae.current){const y=Ae.current;Pt.current={height:y.scrollHeight,top:y.scrollTop}}}),n.useEffect(()=>{if(Ae.current&&M.length>0)if(v)Rt||setTimeout(()=>Xt(),50);else{const y=Ae.current,P=Pt.current.height,I=Pt.current.top,H=y.scrollHeight-P;H>0&&I>0&&(y.scrollTop=I+H)}},[M.length,Rt,Xt,v]),n.useEffect(()=>{Ae.current&&M.length>0&&!dt.current&&(or(!1),setTimeout(()=>{Xt()},200))},[o?.id,r?.name]),n.useEffect(()=>{const y=Ae.current;if(y)return y.addEventListener("scroll",pn),()=>y.removeEventListener("scroll",pn)},[pn]),n.useEffect(()=>{const y=I=>{if(!ln)return;const A=se.current;if(!A)return;const H=A.parentElement;if(!H)return;const ge=H.getBoundingClientRect().right-I.clientX;ge>=300&&ge<=600&&Rs(ge)},P=()=>io(!1);return ln&&(document.addEventListener("mousemove",y),document.addEventListener("mouseup",P),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",P),document.body.style.cursor="",document.body.style.userSelect=""}},[ln]),n.useEffect(()=>{!sn&&Ft.length>0&&!Wt&&an(!0)},[Ft.length]),n.useEffect(()=>{Wt&&ke.current&&(ke.current.scrollTop=ke.current.scrollHeight)},[Ft.length,Wt]),n.useEffect(()=>{_e.length>0&&setTimeout(()=>{Rt||Xt(),Wt&&ke.current&&(ke.current.scrollTop=ke.current.scrollHeight)},100)},[_e.length,Rt,Xt,Wt]),n.useEffect(()=>{if(oe.current){oe.current.style.height="auto",oe.current.style.height=oe.current.scrollHeight+"px";const y=parseInt(window.getComputedStyle(oe.current).lineHeight),P=oe.current.scrollHeight>y*2;$t(P)}},[]),n.useEffect(()=>{oe.current&&!S.trim()&&(oe.current.style.height="auto",$t(!1))},[S]),n.useEffect(()=>{if(!r||!o?.id||o.id.startsWith("new-session-")){ir(null);return}(async()=>{try{const P=`/api/projects/${r.name}/sessions/${o.id}/token-usage`,I=await J(P);if(I.ok){const A=await I.json();ir(A)}else ir(null)}catch(P){console.error("Failed to fetch initial token usage:",P)}})()},[o?.id,o?.__provider,r?.path]);const Ks=n.useCallback(y=>{y.trim()&&R(P=>{const I=P.trim()?`${P} ${y}`:y;return setTimeout(()=>{if(oe.current){oe.current.style.height="auto",oe.current.style.height=oe.current.scrollHeight+"px";const A=parseInt(window.getComputedStyle(oe.current).lineHeight),H=oe.current.scrollHeight>A*2;$t(H)}},0),I})},[]),Vs=n.useCallback(()=>{_s(y=>y+100)},[]),zr=n.useCallback(y=>{const P=y.filter(I=>{try{if(!I||typeof I!="object")return console.warn("Invalid file object:",I),!1;if(!I.type||!I.type.startsWith("image/"))return!1;if(!I.size||I.size>5242880){const A=I.name||"Unknown file";return ce(H=>{const q=new Map(H);return q.set(A,"文件太大(最大 5MB)"),q}),!1}return!0}catch(A){return console.error("Error validating file:",A,I),!1}});P.length>0&&z(I=>[...I,...P].slice(0,5))},[]),Zs=n.useCallback(async y=>{const P=y.target.files;if(!(!P||P.length===0||!r)){xe(!0);try{const I=new FormData;Array.from(P).forEach(q=>{I.append("files",q)});const A=await me.uploadFiles(r.name,I);if(!A.ok){const q=await A.json();throw new Error(q.error||"上传失败")}const H=await A.json();if(H.files&&H.files.length>0){const q=H.files.map(Ne=>`@${Ne.name}`).join(" "),ge=S?`${S} ${q} `:`${q} `;R(ge),oe.current&&oe.current.focus()}}catch(I){console.error("File upload failed:",I)}finally{xe(!1),be.current&&(be.current.value="")}}},[r,S]),Qs=n.useCallback(async y=>{const P=Array.from(y.clipboardData.items);for(const I of P)if(I.type.startsWith("image/")){const A=I.getAsFile();A&&zr([A])}if(P.length===0&&y.clipboardData.files.length>0){const A=Array.from(y.clipboardData.files).filter(H=>H.type.startsWith("image/"));A.length>0&&zr(A)}},[zr]),{getRootProps:ea,getInputProps:ta,isDragActive:ra,open:na}=Vn({accept:{"image/*":[".png",".jpg",".jpeg",".gif",".webp",".svg"]},maxSize:5*1024*1024,maxFiles:5,onDrop:zr,noClick:!0,noKeyboard:!0}),ho=n.useCallback(y=>{if(!l||!u||!r)return;const P=["[Background Task Result]",`Task ID: ${y.taskId}`,`Command: ${y.command}`,`Status: ${y.status} (exit code: ${y.exitCode??"N/A"})`,`Duration: ${Math.round((y.duration||0)/1e3)}s`];y.truncated&&P.push("(Output truncated to 100KB)"),y.stdout&&P.push("","STDOUT:",y.stdout),y.stderr&&P.push("","STDERR:",y.stderr);const I=P.join(`
91
+ `);let A={allowedTools:[],disallowedTools:[],skipPermissions:!1};try{const H=pt.getItem("claude-settings");H&&(A=JSON.parse(H))}catch{}u({type:"claude-command",command:I,options:{projectPath:r.path,cwd:r.fullPath,sessionId:y.sessionId,resume:!0,isBackgroundResult:!0,toolsSettings:A,permissionMode:Xe,model:St}}),T(!0),xt(!0),Nt({text:"处理后台任务结果",tokens:0,can_interrupt:!0})},[l,u,r,Xe,St]),Yt=n.useCallback(async y=>{if(y.preventDefault(),!S.trim()||$||!r||gt.current)return;gt.current=!0;const P=S.trim();if(P.startsWith("/")){const ue=P.indexOf(" "),ve=ue!==-1?P.slice(0,ue):P,je=W.find(it=>it.name===ve&&it.namespace==="builtin");if(je){gt.current=!1,Lr(je);return}}if(N){const ue=await N();if(ue&&!ue.allowed){gt.current=!1,w?.(ue.reason);return}}let I=[],A=null;if(V.length>0){const ue=new FormData;V.forEach(ve=>{ue.append("images",ve)});try{const ve=await J(`/api/projects/${r.name}/upload-images`,{method:"POST",headers:{},body:ue});if(!ve.ok)throw new Error("图片上传失败");const je=await ve.json();I=je.images,A=je.uploadBatchId||null}catch(ve){console.error("Image upload failed:",ve),gt.current=!1,D(je=>[...je,{type:"error",content:`图片上传失败: ${ve.message}`,timestamp:new Date}]);return}}const H={type:"user",content:S,images:I,timestamp:new Date};D(ue=>[...ue,H]),T(!0),gt.current=!1,xt(!0),Nt({text:"处理中",tokens:0,can_interrupt:!0}),or(!1),setTimeout(()=>Xt(),100);const ge=X||o?.id||`new-session-${Date.now()}`;s&&s(ge);const Q=(()=>{try{const ue=pt.getItem("claude-settings");if(ue)return JSON.parse(ue)}catch(ue){console.error("Error loading tools settings:",ue)}return{allowedTools:[],disallowedTools:[],skipPermissions:!1}})();X||(Ce.current=Xe),u({type:"claude-command",command:S,options:{projectPath:r.path,cwd:r.fullPath,sessionId:X,resume:!!X,toolsSettings:Q,permissionMode:Xe,model:St,images:I,uploadBatchId:A}}),R(""),z([]),G(new Map),ce(new Map),$t(!1),oe.current&&(oe.current.style.height="auto"),r&&pt.removeItem(`draft_input_${r.name}`)},[S,$,r,V,X,o,Tt,Xe,s,St,u,R,z,G,ce,$t,oe,D,T,xt,Nt,or,Xt,N,w,Lr,W]),mn=n.useCallback(y=>!y||Tt!=="claude"?{success:!1}:wl(y.entry),[Tt]),jr=n.useCallback((y,P)=>{const A=(Array.isArray(y)?y:[y]).filter(Boolean);A.length!==0&&(A.forEach(H=>{u({type:"claude-permission-response",requestId:H,allow:!!P?.allow,updatedInput:P?.updatedInput,message:P?.message,rememberEntry:P?.rememberEntry})}),$e(H=>{const q=H.filter(ge=>!A.includes(ge.requestId));return q.length===0&&Nt(null),q}))},[u]),xo=n.useCallback(y=>{Re&&(u({type:"share-project-template-response",requestId:Re.requestId,...y}),Ze(null))},[Re,u]);n.useEffect(()=>{dn.current=Yt},[Yt]);const go=y=>{if(!y)return;const P=S.slice(0,ao),I=S.slice(ao),A=I.indexOf(" "),H=A!==-1?I.slice(A):"",q=P+y.name+" "+H;if(R(q),wt(!1),Lt(-1),Ke(""),At(-1),ft.current&&clearTimeout(ft.current),y.namespace==="skill"||y.namespace==="mcp"){oe.current&&oe.current.focus();return}Lr(y)},oa=y=>{if(sr&&pe.length>0){if(y.key==="ArrowDown"){y.preventDefault(),At(P=>P<pe.length-1?P+1:0);return}if(y.key==="ArrowUp"){y.preventDefault(),At(P=>P>0?P-1:pe.length-1);return}if(y.key==="Tab"||y.key==="Enter"){y.preventDefault(),on>=0?go(pe[on]):pe.length>0&&go(pe[0]);return}if(y.key==="Escape"){y.preventDefault(),wt(!1),Lt(-1),Ke(""),At(-1),ft.current&&clearTimeout(ft.current);return}}if(et&&Ct.length>0){if(y.key==="ArrowDown"){y.preventDefault(),tr(P=>P<Ct.length-1?P+1:0);return}if(y.key==="ArrowUp"){y.preventDefault(),tr(P=>P>0?P-1:Ct.length-1);return}if(y.key==="Tab"||y.key==="Enter"){y.preventDefault(),gr>=0?fn(Ct[gr]):Ct.length>0&&fn(Ct[0]);return}if(y.key==="Escape"){y.preventDefault(),kt(!1);return}}if(y.key==="Tab"&&!et&&!sr){y.preventDefault();const P=["default","acceptEdits","bypassPermissions","plan"],A=(P.indexOf(Xe)+1)%P.length,H=P[A];Je(H),o?.id&&localStorage.setItem(`permissionMode-${o.id}`,H);return}if(y.key==="Enter"){if(y.nativeEvent.isComposing)return;(y.ctrlKey||y.metaKey)&&!y.shiftKey?(y.preventDefault(),Yt(y)):!y.shiftKey&&!y.ctrlKey&&!y.metaKey&&(k||(y.preventDefault(),Yt(y)))}},fn=y=>{const P=S.slice(0,Ar),I=S.slice(Ar),A=I.indexOf(" "),H=A!==-1?I.slice(A):"",q=P+"@"+y.path+" "+H,ge=P.length+1+y.path.length+1;oe.current&&!oe.current.matches(":focus")&&oe.current.focus(),R(q),rr(ge),kt(!1),nr(-1),oe.current&&requestAnimationFrame(()=>{oe.current&&(oe.current.setSelectionRange(ge,ge),oe.current.matches(":focus")||oe.current.focus())})},sa=y=>{const P=y.target.value,I=y.target.selectionStart;if(!X&&P.trim(),R(P),rr(I),!P.trim()){y.target.style.height="auto",$t(!1),wt(!1),Lt(-1),Ke("");return}const A=P.slice(0,I);if((A.match(/```/g)||[]).length%2===1){wt(!1),Lt(-1),Ke("");return}const ge=/(^|\s)\/(\S*)$/,Ne=A.match(ge);if(Ne){const Q=Ne.index+Ne[1].length,ue=Ne[2];Lt(Q),wt(!0),At(-1),ft.current&&clearTimeout(ft.current),ft.current=setTimeout(()=>{Ke(ue)},150)}else wt(!1),Lt(-1),Ke(""),ft.current&&clearTimeout(ft.current)},aa=y=>{rr(y.target.selectionStart)},ia=()=>{X&&nn&&u({type:"abort-session",sessionId:X,provider:Tt})},la=()=>{const y=["default","acceptEdits","bypassPermissions","plan"],I=(y.indexOf(Xe)+1)%y.length,A=y[I];Je(A),o?.id&&localStorage.setItem(`permissionMode-${o.id}`,A)};return r?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
92
92
  details[open] .details-chevron {
93
93
  transform: rotate(180deg);
94
94
  }
95
- `}),e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[e.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:e.jsxs("div",{ref:Pe,className:"flex-1 overflow-y-auto overflow-x-hidden px-0 py-3 sm:p-4 space-y-3 sm:space-y-4 relative",children:[fe&&M.length===0?e.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 mt-8",children:e.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),e.jsx("p",{children:"正在加载会话消息..."})]})}):M.length===0?e.jsxs("div",{className:"flex items-center justify-center h-full",children:[!o&&!X&&e.jsxs("div",{className:"text-center px-6 sm:px-4 py-8 w-full max-w-xl mx-auto",children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-3",children:"开始新对话"}),e.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mb-8",children:["已准备好使用 ",Ve,"。试试以下常用指令:"]}),ko.length>0&&e.jsx("div",{className:"grid grid-cols-2 gap-3",children:ko.map((y,P)=>e.jsxs("button",{onClick:()=>{R(y.text),setTimeout(()=>oe.current?.focus(),0)},className:"flex items-center gap-2.5 px-4 py-3 rounded-2xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 text-left text-sm text-gray-700 dark:text-gray-300 hover:border-purple-400 dark:hover:border-purple-500 hover:bg-purple-50 dark:hover:bg-purple-900/20 transition-colors",children:[e.jsx("span",{className:"text-base",children:y.icon}),e.jsx("span",{children:y.text})]},P))})]}),o&&e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 px-6 sm:px-4",children:[e.jsx("p",{className:"font-bold text-lg sm:text-xl mb-3",children:"继续您的对话"}),e.jsx("p",{className:"text-sm sm:text-base leading-relaxed",children:"询问代码问题、请求修改或获取开发任务帮助"})]})]}):e.jsxs(e.Fragment,{children:[ge&&e.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 py-3",children:e.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),e.jsx("p",{className:"text-sm",children:"正在加载历史消息..."})]})}),Ne&&!ge&&e.jsxs("div",{className:"text-center py-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 mr-2",children:["已显示 ",qs," 条对话",fo>0?`,${fo} 个工具调用`:""]}),e.jsx("button",{onClick:Ys,className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"加载更多消息"})]}),!Ne&&M.length>vr&&e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 text-sm py-2 border-b border-gray-200 dark:border-gray-700",children:["显示最近 ",vr," 条消息(共 ",M.length," 条) •",e.jsx("button",{className:"ml-1 text-blue-600 hover:text-blue-700 underline",onClick:Vs,children:"加载更早的消息"})]}),mo.map((y,P)=>{const L=P>0?mo[P-1]:null,A=y.id||`${y.type}-${y.timestamp?.getTime?.()||P}-${P}`;return e.jsx(Ho,{message:y,index:P,prevMessage:L,createDiff:co,onFileOpen:m,onShowSettings:g,onGrantToolPermission:mn,selectedProject:r,provider:Tt,onFork:y.type==="assistant"&&!$&&X?Gs:null,messageUuid:y.messageUuid||null},A)})]}),$&&e.jsx("div",{className:"chat-message assistant",children:e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0 p-1 bg-transparent",children:e.jsx(Vr,{className:"w-full h-full"})}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:Ve})]}),e.jsx("div",{className:"w-full text-sm text-gray-500 dark:text-gray-400 pl-3 sm:pl-0",children:e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx("div",{className:"animate-pulse",children:"●"}),e.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.2s"},children:"●"}),e.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.4s"},children:"●"}),e.jsx("span",{className:"ml-2",children:"思考中..."})]})})]})}),e.jsx("div",{ref:Le})]})}),!sn&&Ft.length>0&&e.jsx("button",{onClick:()=>an(y=>!y),className:"flex-shrink-0 w-4 self-stretch flex items-center justify-center bg-gray-100 dark:bg-gray-800/80 hover:bg-blue-50 dark:hover:bg-blue-900/30 border-x border-gray-200 dark:border-gray-700 transition-colors cursor-pointer",title:Wt?"收起工具面板":"展开工具面板",children:e.jsx("svg",{className:"w-3 h-3 text-gray-400 dark:text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:Wt?"M9 5l7 7-7 7":"M15 19l-7-7 7-7"})})}),Wt&&!sn&&Ft.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:se,onMouseDown:y=>{io(!0),y.preventDefault()},className:"flex-shrink-0 w-1 bg-border hover:bg-blue-400 cursor-col-resize transition-colors duration-150"}),e.jsxs("div",{style:{width:`${zs}px`},className:"flex-shrink-0 border-l border-gray-200 dark:border-gray-700 flex flex-col overflow-hidden bg-gray-50 dark:bg-gray-900/50",children:[e.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-3 py-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("svg",{className:"w-4 h-4 text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"工具调用"}),e.jsx("span",{className:"px-1.5 py-0.5 text-xs rounded-full bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300",children:Ft.length})]}),e.jsx("button",{onClick:()=>an(!1),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",title:"关闭工具面板",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{ref:je,className:"flex-1 overflow-y-auto p-2 space-y-2",children:[Ft.map((y,P)=>{const L=P>0?Ft[P-1]:null,A=y.id||`tool-${y.timestamp?.getTime?.()||P}-${P}`;return e.jsx(Ho,{message:y,index:P,prevMessage:L,createDiff:co,onFileOpen:m,onShowSettings:g,onGrantToolPermission:mn,selectedProject:r,provider:Tt},A)}),e.jsx("div",{ref:ke})]})]})]})]}),e.jsxs("div",{className:"p-2 sm:p-4 md:p-4 flex-shrink-0 border-t border-gray-200 dark:border-gray-700 pb-2 sm:pb-4 md:pb-6",children:[e.jsx("div",{className:"flex-1",children:e.jsx(gl,{status:$s,isLoading:$,onAbort:ia,provider:Tt})}),e.jsxs("div",{ref:at,className:"max-w-4xl mx-auto mb-3",children:[Re.length>0&&e.jsx("div",{className:"mb-3 space-y-2",children:Re.map(y=>{const P=Fo(y.input),L=Wn(y.toolName,P),A=Zn(),H=L?A.allowedTools.includes(L):!1,q=H?"已允许(已保存)":"允许并记住",xe=L?Re.filter(we=>Wn(we.toolName,Fo(we.input))===L).map(we=>we.requestId):[y.requestId];return y.toolName==="AskUserQuestion"?e.jsx(Tl,{request:y,onSubmit:we=>{jr(y.requestId,{allow:!0,updatedInput:{...y.input,answers:we}})},onSkip:()=>jr(y.requestId,{allow:!1,message:"用户跳过问题"})},y.requestId):e.jsxs("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 p-3 shadow-sm",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold text-amber-900 dark:text-amber-100",children:"需要权限"}),e.jsxs("div",{className:"text-xs text-amber-800 dark:text-amber-200",children:["工具: ",e.jsx("span",{className:"font-mono",children:y.toolName})]})]}),L&&e.jsxs("div",{className:"text-xs text-amber-700 dark:text-amber-300",children:["允许规则: ",e.jsx("span",{className:"font-mono",children:Ue(L)})]})]}),P&&e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"cursor-pointer text-xs text-amber-800 dark:text-amber-200 hover:text-amber-900 dark:hover:text-amber-100",children:"查看工具输入"}),e.jsx("pre",{className:"mt-2 max-h-40 overflow-auto rounded-md bg-white/80 dark:bg-gray-900/60 border border-amber-200/60 dark:border-amber-800/60 p-2 text-xs text-amber-900 dark:text-amber-100 whitespace-pre-wrap",children:Ue(P)})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:()=>jr(y.requestId,{allow:!0}),className:"inline-flex items-center gap-2 rounded-md bg-amber-600 text-white text-xs font-medium px-3 py-1.5 hover:bg-amber-700 transition-colors",children:"允许一次"}),e.jsx("button",{type:"button",onClick:()=>{L&&!H&&mn({entry:L,toolName:y.toolName}),jr(xe,{allow:!0,rememberEntry:L})},className:`inline-flex items-center gap-2 rounded-md text-xs font-medium px-3 py-1.5 border transition-colors ${L?"border-amber-300 text-amber-800 hover:bg-amber-100 dark:border-amber-700 dark:text-amber-100 dark:hover:bg-amber-900/30":"border-gray-300 text-gray-400 cursor-not-allowed"}`,disabled:!L,children:q}),e.jsx("button",{type:"button",onClick:()=>jr(y.requestId,{allow:!1,message:"用户拒绝工具使用"}),className:"inline-flex items-center gap-2 rounded-md text-xs font-medium px-3 py-1.5 border border-red-300 text-red-700 hover:bg-red-50 dark:border-red-800 dark:text-red-200 dark:hover:bg-red-900/30 transition-colors",children:"拒绝"})]})]},y.requestId)})}),e.jsxs("div",{className:"flex items-center justify-center gap-3",children:[e.jsx("button",{type:"button",onClick:la,className:`px-3 py-1.5 rounded-lg text-sm font-medium border transition-all duration-200 ${Te==="default"?"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600 hover:bg-gray-200 dark:hover:bg-gray-600":Te==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-300 border-green-300 dark:border-green-600 hover:bg-green-100 dark:hover:bg-green-900/30":Te==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 text-orange-700 dark:text-orange-300 border-orange-300 dark:border-orange-600 hover:bg-orange-100 dark:hover:bg-orange-900/30":"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 border-blue-300 dark:border-blue-600 hover:bg-blue-100 dark:hover:bg-blue-900/30"}`,title:"点击切换权限模式(或在输入框中按 Tab)",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${Te==="default"?"bg-gray-500":Te==="acceptEdits"?"bg-green-500":Te==="bypassPermissions"?"bg-orange-500":"bg-blue-500"}`}),e.jsxs("span",{children:[Te==="default"&&"默认模式",Te==="acceptEdits"&&"接受编辑",Te==="bypassPermissions"&&"跳过权限",Te==="plan"&&"计划模式"]})]})}),e.jsx("button",{ref:yt,type:"button",onClick:()=>yr(!ar),className:"px-3 py-1.5 rounded-lg text-sm font-medium border transition-all duration-200 bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300 border-purple-300 dark:border-purple-600 hover:bg-purple-100 dark:hover:bg-purple-900/30",title:"切换模型",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),e.jsx("span",{children:wn.OPTIONS.find(y=>y.value===St)?.label||St})]})}),X&&r&&e.jsx("button",{type:"button",onClick:()=>K(!0),className:"px-3 py-1.5 rounded-lg text-sm font-medium border transition-all duration-200 bg-gray-50 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700",title:"分享会话",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z"})}),e.jsx("span",{children:"分享"})]})}),N.trim()&&e.jsx("button",{type:"button",onClick:y=>{y.preventDefault(),y.stopPropagation(),R(""),oe.current&&(oe.current.style.height="auto",oe.current.focus()),$t(!1)},className:"w-8 h-8 bg-white dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-full flex items-center justify-center transition-all duration-200 group shadow-sm",title:"清除输入",children:e.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300 group-hover:text-gray-800 dark:group-hover:text-gray-100 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),Rt&&M.length>0&&e.jsx("button",{onClick:Xt,className:"w-8 h-8 bg-blue-600 hover:bg-blue-700 text-white rounded-full shadow-lg flex items-center justify-center transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",title:"滚动到底部",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})]}),e.jsxs("form",{onSubmit:Yt,className:"relative max-w-4xl mx-auto",children:[ra&&e.jsx("div",{className:"absolute inset-0 bg-blue-500/20 border-2 border-dashed border-blue-500 rounded-lg flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-4 shadow-lg",children:[e.jsx("svg",{className:"w-8 h-8 text-blue-500 mx-auto mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),e.jsx("p",{className:"text-sm font-medium",children:"将图片拖放到这里"})]})}),V.length>0&&e.jsx("div",{className:"mb-2 p-2 bg-gray-50 dark:bg-gray-800 rounded-lg",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:V.map((y,P)=>e.jsx(Xl,{file:y,onRemove:()=>{I(L=>L.filter((A,H)=>H!==P))},uploadProgress:re.get(y.name),error:ie.get(y.name)},P))})}),et&&Ct.length>0&&e.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg max-h-48 overflow-y-auto z-50 backdrop-blur-sm",children:Ct.map((y,P)=>e.jsxs("div",{className:`px-4 py-3 cursor-pointer border-b border-gray-100 dark:border-gray-700 last:border-b-0 touch-manipulation ${P===gr?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,onMouseDown:L=>{L.preventDefault(),L.stopPropagation()},onClick:L=>{L.preventDefault(),L.stopPropagation(),fn(y)},children:[e.jsx("div",{className:"font-medium text-sm",children:y.name}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:Ue(y.path)})]},y.path))}),e.jsx(vl,{commands:pe,selectedIndex:on,onSelect:Fs,onClose:()=>{wt(!1),Lt(-1),Ke(""),At(-1)},position:{top:oe.current?Math.max(16,oe.current.getBoundingClientRect().top-316):0,left:oe.current?oe.current.getBoundingClientRect().left:16,bottom:oe.current?window.innerHeight-oe.current.getBoundingClientRect().top+8:90},isOpen:sr,frequentCommands:ut?[]:Ws}),ar&&e.jsxs("div",{ref:br,className:"rounded-lg border border-purple-200 dark:border-purple-800 bg-purple-50 dark:bg-purple-900/20 p-4 shadow-lg",style:{position:"fixed",bottom:yt.current?window.innerHeight-yt.current.getBoundingClientRect().top+8:90,left:yt.current?yt.current.getBoundingClientRect().left:16,zIndex:1e3,minWidth:"200px"},children:[e.jsx("div",{className:"text-sm font-semibold text-purple-900 dark:text-purple-100 mb-3",children:"切换模型"}),e.jsx("select",{value:St,onChange:y=>{const P=y.target.value;lo(P),localStorage.setItem("claude-model",P),yr(!1)},className:"w-full pl-3 pr-8 py-2 text-sm bg-white dark:bg-gray-800 border border-purple-300 dark:border-purple-600 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 text-gray-900 dark:text-gray-100",children:wn.OPTIONS.map(({value:y,label:P})=>e.jsx("option",{value:y,children:P},y))})]}),e.jsxs("div",{...ea(),className:`relative bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 focus-within:ring-2 focus-within:ring-blue-500 dark:focus-within:ring-blue-500 focus-within:border-blue-500 transition-all duration-200 overflow-hidden ${_s?"chat-input-expanded":""}`,children:[e.jsx("input",{...ta()}),e.jsx("textarea",{ref:oe,value:N,onChange:sa,onClick:aa,onKeyDown:oa,onPaste:Qs,onFocus:()=>ne(!0),onBlur:()=>ne(!1),onInput:y=>{y.target.style.height="auto",y.target.style.height=y.target.scrollHeight+"px",rr(y.target.selectionStart);const P=parseInt(window.getComputedStyle(y.target).lineHeight),L=y.target.scrollHeight>P*2;$t(L)},placeholder:f&&!f.allowed?f.reason==="total_limit_exceeded"?"使用上限已达到,请联系管理员":"今日使用上限已达到":`输入 / 使用命令,@ 引用文件,或向 ${Ve} 提问...`,disabled:$||f&&!f.allowed,className:"chat-input-placeholder block w-full pl-20 pr-20 sm:pr-40 py-1.5 sm:py-4 bg-transparent rounded-2xl focus:outline-none text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 disabled:opacity-50 resize-none min-h-[50px] sm:min-h-[80px] max-h-[40vh] sm:max-h-[300px] overflow-y-auto text-sm sm:text-base leading-[21px] sm:leading-6 transition-all duration-200",style:{height:"50px"}}),e.jsx("button",{type:"button",onClick:na,disabled:f&&!f.allowed,className:"absolute left-2 top-1/2 transform -translate-y-1/2 p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:f&&!f.allowed?"使用上限已达到":"添加图片",children:e.jsx("svg",{className:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),e.jsx("input",{type:"file",ref:ye,onChange:Zs,className:"hidden",multiple:!0}),e.jsx("button",{type:"button",onClick:()=>ye.current?.click(),disabled:Ae||!r||f&&!f.allowed,className:"absolute left-10 top-1/2 transform -translate-y-1/2 p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:f&&!f.allowed?"使用上限已达到":"上传文件并引用",children:Ae?e.jsxs("svg",{className:"w-5 h-5 text-gray-500 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):e.jsx("svg",{className:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})})}),e.jsx("div",{className:"absolute right-16 sm:right-16 top-1/2 transform -translate-y-1/2",style:{display:"none"},children:e.jsx(bl,{onTranscript:Ks,className:"w-10 h-10 sm:w-10 sm:h-10"})}),e.jsx("button",{type:"submit",disabled:!N.trim()||$,onMouseDown:y=>{y.preventDefault(),Yt(y)},onTouchStart:y=>{y.preventDefault(),Yt(y)},className:"absolute right-2 top-1/2 transform -translate-y-1/2 w-12 h-12 sm:w-12 sm:h-12 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",children:e.jsx("svg",{className:"w-4 h-4 sm:w-5 sm:h-5 text-white transform rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})}),e.jsx("div",{className:`absolute bottom-1 left-20 right-14 sm:right-40 text-xs text-gray-400 dark:text-gray-500 pointer-events-none hidden sm:block transition-opacity duration-200 ${N.trim()?"opacity-0":"opacity-100"}`,children:k?"Ctrl+Enter 发送 • Shift+Enter 换行 • Tab 切换模式 • / 使用命令":"Enter 发送 • Shift+Enter 换行 • Tab 切换模式 • / 使用命令"})]})]})]})]}),ze&&e.jsx(qn,{prefillData:ze.prefillData,onClose:()=>xo({cancelled:!0}),onSubmitted:y=>xo({success:!0,...y})}),Qe&&e.jsx(gs,{sessionId:X,projectName:r?.name,sessionTitle:o?.summary||null,isOpen:Qe,onClose:()=>K(!1)})]}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400",children:e.jsx("p",{children:"选择一个项目开始与 Claude 对话"})})})}const Ol=mt.memo(Ml);function Fn({file:r,onClose:o,projectPath:l,isSidebar:u=!1,isExpanded:c=!1,onToggleExpand:m=null}){const{showAlert:d}=lt(),[s,p]=n.useState(""),[t,x]=n.useState(!0),[h,a]=n.useState(!1),[i,g]=n.useState(!1),[v,k]=n.useState(()=>{const _=localStorage.getItem("codeEditorTheme");return _?_==="dark":!0}),[b,j]=n.useState(!1),[f,w]=n.useState(()=>localStorage.getItem("codeEditorWordWrap")==="true"),[S,z]=n.useState(()=>localStorage.getItem("codeEditorLineNumbers")!=="false"),[D,N]=n.useState(()=>localStorage.getItem("codeEditorFontSize")||"14"),R=n.useRef(null),M=n.useMemo(()=>{const _=()=>{const te=document.createElement("div");te.className="cm-editor-toolbar-panel";const ne=()=>{let G='<div style="display: flex; align-items: center; justify-content: flex-end; width: 100%;">';G+='<div style="display: flex; align-items: center; gap: 4px;">',G+=`
95
+ `}),e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[e.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:e.jsxs("div",{ref:Ae,className:"flex-1 overflow-y-auto overflow-x-hidden px-0 py-3 sm:p-4 space-y-3 sm:space-y-4 relative",children:[fe&&M.length===0?e.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 mt-8",children:e.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),e.jsx("p",{children:"正在加载会话消息..."})]})}):M.length===0?e.jsxs("div",{className:"flex items-center justify-center h-full",children:[!o&&!X&&e.jsxs("div",{className:"text-center px-6 sm:px-4 py-8 w-full max-w-xl mx-auto",children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-3",children:"开始新对话"}),e.jsxs("p",{className:"text-gray-600 dark:text-gray-400 mb-8",children:["已准备好使用 ",Ve,"。试试以下常用指令:"]}),ko.length>0&&e.jsx("div",{className:"grid grid-cols-2 gap-3",children:ko.map((y,P)=>e.jsxs("button",{onClick:()=>{R(y.text),setTimeout(()=>oe.current?.focus(),0)},className:"flex items-center gap-2.5 px-4 py-3 rounded-2xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 text-left text-sm text-gray-700 dark:text-gray-300 hover:border-purple-400 dark:hover:border-purple-500 hover:bg-purple-50 dark:hover:bg-purple-900/20 transition-colors",children:[e.jsx("span",{className:"text-base",children:y.icon}),e.jsx("span",{children:y.text})]},P))})]}),o&&e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 px-6 sm:px-4",children:[e.jsx("p",{className:"font-bold text-lg sm:text-xl mb-3",children:"继续您的对话"}),e.jsx("p",{className:"text-sm sm:text-base leading-relaxed",children:"询问代码问题、请求修改或获取开发任务帮助"})]})]}):e.jsxs(e.Fragment,{children:[ye&&e.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400 py-3",children:e.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-gray-400"}),e.jsx("p",{className:"text-sm",children:"正在加载历史消息..."})]})}),Se&&!ye&&e.jsxs("div",{className:"text-center py-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 mr-2",children:["已显示 ",qs," 条对话",fo>0?`,${fo} 个工具调用`:""]}),e.jsx("button",{onClick:Ys,className:"text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 underline",children:"加载更多消息"})]}),!Se&&M.length>vr&&e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 text-sm py-2 border-b border-gray-200 dark:border-gray-700",children:["显示最近 ",vr," 条消息(共 ",M.length," 条) •",e.jsx("button",{className:"ml-1 text-blue-600 hover:text-blue-700 underline",onClick:Vs,children:"加载更早的消息"})]}),mo.map((y,P)=>{const I=P>0?mo[P-1]:null,A=y.id||`${y.type}-${y.timestamp?.getTime?.()||P}-${P}`;return e.jsx(Ho,{message:y,index:P,prevMessage:I,createDiff:co,onFileOpen:m,onShowSettings:g,onGrantToolPermission:mn,selectedProject:r,provider:Tt,onFork:y.type==="assistant"&&!$&&X?Gs:null,messageUuid:y.messageUuid||null},A)})]}),$&&e.jsx("div",{className:"chat-message assistant",children:e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm flex-shrink-0 p-1 bg-transparent",children:e.jsx(Vr,{className:"w-full h-full"})}),e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:Ve})]}),e.jsx("div",{className:"w-full text-sm text-gray-500 dark:text-gray-400 pl-3 sm:pl-0",children:e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx("div",{className:"animate-pulse",children:"●"}),e.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.2s"},children:"●"}),e.jsx("div",{className:"animate-pulse",style:{animationDelay:"0.4s"},children:"●"}),e.jsx("span",{className:"ml-2",children:"思考中..."})]})})]})}),e.jsx("div",{ref:Le})]})}),!sn&&Ft.length>0&&e.jsx("button",{onClick:()=>an(y=>!y),className:"flex-shrink-0 w-4 self-stretch flex items-center justify-center bg-gray-100 dark:bg-gray-800/80 hover:bg-blue-50 dark:hover:bg-blue-900/30 border-x border-gray-200 dark:border-gray-700 transition-colors cursor-pointer",title:Wt?"收起工具面板":"展开工具面板",children:e.jsx("svg",{className:"w-3 h-3 text-gray-400 dark:text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:Wt?"M9 5l7 7-7 7":"M15 19l-7-7 7-7"})})}),Wt&&!sn&&Ft.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:se,onMouseDown:y=>{io(!0),y.preventDefault()},className:"flex-shrink-0 w-1 bg-border hover:bg-blue-400 cursor-col-resize transition-colors duration-150"}),e.jsxs("div",{style:{width:`${zs}px`},className:"flex-shrink-0 border-l border-gray-200 dark:border-gray-700 flex flex-col overflow-hidden bg-gray-50 dark:bg-gray-900/50",children:[e.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-3 py-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("svg",{className:"w-4 h-4 text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"工具调用"}),e.jsx("span",{className:"px-1.5 py-0.5 text-xs rounded-full bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300",children:Ft.length})]}),e.jsx("button",{onClick:()=>an(!1),className:"p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",title:"关闭工具面板",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{ref:ke,className:"flex-1 overflow-y-auto p-2 space-y-2",children:[Ft.map((y,P)=>{const I=P>0?Ft[P-1]:null,A=y.id||`tool-${y.timestamp?.getTime?.()||P}-${P}`;return e.jsx(Ho,{message:y,index:P,prevMessage:I,createDiff:co,onFileOpen:m,onShowSettings:g,onGrantToolPermission:mn,selectedProject:r,provider:Tt},A)}),e.jsx("div",{ref:we})]})]})]})]}),e.jsxs("div",{className:"p-2 sm:p-4 md:p-4 flex-shrink-0 border-t border-gray-200 dark:border-gray-700 pb-2 sm:pb-4 md:pb-6",children:[e.jsx("div",{className:"flex-1",children:e.jsx(gl,{status:$s,isLoading:$,onAbort:ia,provider:Tt})}),e.jsxs("div",{ref:at,className:"max-w-4xl mx-auto mb-3",children:[_e.length>0&&e.jsx("div",{className:"mb-3 space-y-2",children:_e.map(y=>{const P=Fo(y.input),I=Wn(y.toolName,P),A=Zn(),H=I?A.allowedTools.includes(I):!1,q=H?"已允许(已保存)":"允许并记住",ge=I?_e.filter(Ne=>Wn(Ne.toolName,Fo(Ne.input))===I).map(Ne=>Ne.requestId):[y.requestId];return y.toolName==="AskUserQuestion"?e.jsx(Tl,{request:y,onSubmit:Ne=>{jr(y.requestId,{allow:!0,updatedInput:{...y.input,answers:Ne}})},onSkip:()=>jr(y.requestId,{allow:!1,message:"用户跳过问题"})},y.requestId):e.jsxs("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 p-3 shadow-sm",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold text-amber-900 dark:text-amber-100",children:"需要权限"}),e.jsxs("div",{className:"text-xs text-amber-800 dark:text-amber-200",children:["工具: ",e.jsx("span",{className:"font-mono",children:y.toolName})]})]}),I&&e.jsxs("div",{className:"text-xs text-amber-700 dark:text-amber-300",children:["允许规则: ",e.jsx("span",{className:"font-mono",children:Ue(I)})]})]}),P&&e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"cursor-pointer text-xs text-amber-800 dark:text-amber-200 hover:text-amber-900 dark:hover:text-amber-100",children:"查看工具输入"}),e.jsx("pre",{className:"mt-2 max-h-40 overflow-auto rounded-md bg-white/80 dark:bg-gray-900/60 border border-amber-200/60 dark:border-amber-800/60 p-2 text-xs text-amber-900 dark:text-amber-100 whitespace-pre-wrap",children:Ue(P)})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:()=>jr(y.requestId,{allow:!0}),className:"inline-flex items-center gap-2 rounded-md bg-amber-600 text-white text-xs font-medium px-3 py-1.5 hover:bg-amber-700 transition-colors",children:"允许一次"}),e.jsx("button",{type:"button",onClick:()=>{I&&!H&&mn({entry:I,toolName:y.toolName}),jr(ge,{allow:!0,rememberEntry:I})},className:`inline-flex items-center gap-2 rounded-md text-xs font-medium px-3 py-1.5 border transition-colors ${I?"border-amber-300 text-amber-800 hover:bg-amber-100 dark:border-amber-700 dark:text-amber-100 dark:hover:bg-amber-900/30":"border-gray-300 text-gray-400 cursor-not-allowed"}`,disabled:!I,children:q}),e.jsx("button",{type:"button",onClick:()=>jr(y.requestId,{allow:!1,message:"用户拒绝工具使用"}),className:"inline-flex items-center gap-2 rounded-md text-xs font-medium px-3 py-1.5 border border-red-300 text-red-700 hover:bg-red-50 dark:border-red-800 dark:text-red-200 dark:hover:bg-red-900/30 transition-colors",children:"拒绝"})]})]},y.requestId)})}),e.jsxs("div",{className:"flex items-center justify-center gap-3",children:[e.jsx("button",{type:"button",onClick:la,className:`px-3 py-1.5 rounded-lg text-sm font-medium border transition-all duration-200 ${Xe==="default"?"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-300 dark:border-gray-600 hover:bg-gray-200 dark:hover:bg-gray-600":Xe==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-300 border-green-300 dark:border-green-600 hover:bg-green-100 dark:hover:bg-green-900/30":Xe==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 text-orange-700 dark:text-orange-300 border-orange-300 dark:border-orange-600 hover:bg-orange-100 dark:hover:bg-orange-900/30":"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 border-blue-300 dark:border-blue-600 hover:bg-blue-100 dark:hover:bg-blue-900/30"}`,title:"点击切换权限模式(或在输入框中按 Tab)",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${Xe==="default"?"bg-gray-500":Xe==="acceptEdits"?"bg-green-500":Xe==="bypassPermissions"?"bg-orange-500":"bg-blue-500"}`}),e.jsxs("span",{children:[Xe==="default"&&"默认模式",Xe==="acceptEdits"&&"接受编辑",Xe==="bypassPermissions"&&"跳过权限",Xe==="plan"&&"计划模式"]})]})}),e.jsx("button",{ref:yt,type:"button",onClick:()=>yr(!ar),className:"px-3 py-1.5 rounded-lg text-sm font-medium border transition-all duration-200 bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300 border-purple-300 dark:border-purple-600 hover:bg-purple-100 dark:hover:bg-purple-900/30",title:"切换模型",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),e.jsx("span",{children:wn.OPTIONS.find(y=>y.value===St)?.label||St})]})}),X&&r&&e.jsx("button",{type:"button",onClick:()=>K(!0),className:"px-3 py-1.5 rounded-lg text-sm font-medium border transition-all duration-200 bg-gray-50 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700 hover:bg-gray-100 dark:hover:bg-gray-700",title:"分享会话",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.684 13.342C8.886 12.938 9 12.482 9 12c0-.482-.114-.938-.316-1.342m0 2.684a3 3 0 110-2.684m0 2.684l6.632 3.316m-6.632-6l6.632-3.316m0 0a3 3 0 105.367-2.684 3 3 0 00-5.367 2.684zm0 9.316a3 3 0 105.368 2.684 3 3 0 00-5.368-2.684z"})}),e.jsx("span",{children:"分享"})]})}),S.trim()&&e.jsx("button",{type:"button",onClick:y=>{y.preventDefault(),y.stopPropagation(),R(""),oe.current&&(oe.current.style.height="auto",oe.current.focus()),$t(!1)},className:"w-8 h-8 bg-white dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-full flex items-center justify-center transition-all duration-200 group shadow-sm",title:"清除输入",children:e.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300 group-hover:text-gray-800 dark:group-hover:text-gray-100 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),Rt&&M.length>0&&e.jsx("button",{onClick:Xt,className:"w-8 h-8 bg-blue-600 hover:bg-blue-700 text-white rounded-full shadow-lg flex items-center justify-center transition-all duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",title:"滚动到底部",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})]}),e.jsxs("form",{onSubmit:Yt,className:"relative max-w-4xl mx-auto",children:[ra&&e.jsx("div",{className:"absolute inset-0 bg-blue-500/20 border-2 border-dashed border-blue-500 rounded-lg flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-4 shadow-lg",children:[e.jsx("svg",{className:"w-8 h-8 text-blue-500 mx-auto mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),e.jsx("p",{className:"text-sm font-medium",children:"将图片拖放到这里"})]})}),V.length>0&&e.jsx("div",{className:"mb-2 p-2 bg-gray-50 dark:bg-gray-800 rounded-lg",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:V.map((y,P)=>e.jsx(Xl,{file:y,onRemove:()=>{z(I=>I.filter((A,H)=>H!==P))},uploadProgress:re.get(y.name),error:ae.get(y.name)},P))})}),et&&Ct.length>0&&e.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg shadow-lg max-h-48 overflow-y-auto z-50 backdrop-blur-sm",children:Ct.map((y,P)=>e.jsxs("div",{className:`px-4 py-3 cursor-pointer border-b border-gray-100 dark:border-gray-700 last:border-b-0 touch-manipulation ${P===gr?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,onMouseDown:I=>{I.preventDefault(),I.stopPropagation()},onClick:I=>{I.preventDefault(),I.stopPropagation(),fn(y)},children:[e.jsx("div",{className:"font-medium text-sm",children:y.name}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:Ue(y.path)})]},y.path))}),e.jsx(vl,{commands:pe,selectedIndex:on,onSelect:Fs,onClose:()=>{wt(!1),Lt(-1),Ke(""),At(-1)},position:{top:oe.current?Math.max(16,oe.current.getBoundingClientRect().top-316):0,left:oe.current?oe.current.getBoundingClientRect().left:16,bottom:oe.current?window.innerHeight-oe.current.getBoundingClientRect().top+8:90},isOpen:sr,frequentCommands:ut?[]:Ws}),ar&&e.jsxs("div",{ref:br,className:"rounded-lg border border-purple-200 dark:border-purple-800 bg-purple-50 dark:bg-purple-900/20 p-4 shadow-lg",style:{position:"fixed",bottom:yt.current?window.innerHeight-yt.current.getBoundingClientRect().top+8:90,left:yt.current?yt.current.getBoundingClientRect().left:16,zIndex:1e3,minWidth:"200px"},children:[e.jsx("div",{className:"text-sm font-semibold text-purple-900 dark:text-purple-100 mb-3",children:"切换模型"}),e.jsx("select",{value:St,onChange:y=>{const P=y.target.value;lo(P),localStorage.setItem("claude-model",P),yr(!1)},className:"w-full pl-3 pr-8 py-2 text-sm bg-white dark:bg-gray-800 border border-purple-300 dark:border-purple-600 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 text-gray-900 dark:text-gray-100",children:wn.OPTIONS.map(({value:y,label:P})=>e.jsx("option",{value:y,children:P},y))})]}),e.jsxs("div",{...ea(),className:`relative bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-600 focus-within:ring-2 focus-within:ring-blue-500 dark:focus-within:ring-blue-500 focus-within:border-blue-500 transition-all duration-200 overflow-hidden ${Is?"chat-input-expanded":""}`,children:[e.jsx("input",{...ta()}),e.jsx("textarea",{ref:oe,value:S,onChange:sa,onClick:aa,onKeyDown:oa,onPaste:Qs,onFocus:()=>ne(!0),onBlur:()=>ne(!1),onInput:y=>{y.target.style.height="auto",y.target.style.height=y.target.scrollHeight+"px",rr(y.target.selectionStart);const P=parseInt(window.getComputedStyle(y.target).lineHeight),I=y.target.scrollHeight>P*2;$t(I)},placeholder:f&&!f.allowed?f.reason==="total_limit_exceeded"?"使用上限已达到,请联系管理员":"今日使用上限已达到":`输入 / 使用命令,@ 引用文件,或向 ${Ve} 提问...`,disabled:$||f&&!f.allowed,className:"chat-input-placeholder block w-full pl-20 pr-20 sm:pr-40 py-1.5 sm:py-4 bg-transparent rounded-2xl focus:outline-none text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 disabled:opacity-50 resize-none min-h-[50px] sm:min-h-[80px] max-h-[40vh] sm:max-h-[300px] overflow-y-auto text-sm sm:text-base leading-[21px] sm:leading-6 transition-all duration-200",style:{height:"50px"}}),e.jsx("button",{type:"button",onClick:na,disabled:f&&!f.allowed,className:"absolute left-2 top-1/2 transform -translate-y-1/2 p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:f&&!f.allowed?"使用上限已达到":"添加图片",children:e.jsx("svg",{className:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),e.jsx("input",{type:"file",ref:be,onChange:Zs,className:"hidden",multiple:!0}),e.jsx("button",{type:"button",onClick:()=>be.current?.click(),disabled:Pe||!r||f&&!f.allowed,className:"absolute left-10 top-1/2 transform -translate-y-1/2 p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:f&&!f.allowed?"使用上限已达到":"上传文件并引用",children:Pe?e.jsxs("svg",{className:"w-5 h-5 text-gray-500 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):e.jsx("svg",{className:"w-5 h-5 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})})}),e.jsx("div",{className:"absolute right-16 sm:right-16 top-1/2 transform -translate-y-1/2",style:{display:"none"},children:e.jsx(bl,{onTranscript:Ks,className:"w-10 h-10 sm:w-10 sm:h-10"})}),e.jsx("button",{type:"submit",disabled:!S.trim()||$,onMouseDown:y=>{y.preventDefault(),Yt(y)},onTouchStart:y=>{y.preventDefault(),Yt(y)},className:"absolute right-2 top-1/2 transform -translate-y-1/2 w-12 h-12 sm:w-12 sm:h-12 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed rounded-full flex items-center justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:ring-offset-gray-800",children:e.jsx("svg",{className:"w-4 h-4 sm:w-5 sm:h-5 text-white transform rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})}),e.jsx("div",{className:`absolute bottom-1 left-20 right-14 sm:right-40 text-xs text-gray-400 dark:text-gray-500 pointer-events-none hidden sm:block transition-opacity duration-200 ${S.trim()?"opacity-0":"opacity-100"}`,children:k?"Ctrl+Enter 发送 • Shift+Enter 换行 • Tab 切换模式 • / 使用命令":"Enter 发送 • Shift+Enter 换行 • Tab 切换模式 • / 使用命令"})]})]})]})]}),Re&&e.jsx(qn,{prefillData:Re.prefillData,onClose:()=>xo({cancelled:!0}),onSubmitted:y=>xo({success:!0,...y})}),Qe&&e.jsx(gs,{sessionId:X,projectName:r?.name,sessionTitle:o?.summary||null,isOpen:Qe,onClose:()=>K(!1)})]}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400",children:e.jsx("p",{children:"选择一个项目开始与 Claude 对话"})})})}const Ol=mt.memo(Ml);function Fn({file:r,onClose:o,projectPath:l,isSidebar:u=!1,isExpanded:c=!1,onToggleExpand:m=null}){const{showAlert:d}=lt(),[s,p]=n.useState(""),[t,x]=n.useState(!0),[h,a]=n.useState(!1),[i,g]=n.useState(!1),[v,k]=n.useState(()=>{const _=localStorage.getItem("codeEditorTheme");return _?_==="dark":!0}),[b,j]=n.useState(!1),[f,w]=n.useState(()=>localStorage.getItem("codeEditorWordWrap")==="true"),[N,L]=n.useState(()=>localStorage.getItem("codeEditorLineNumbers")!=="false"),[E,S]=n.useState(()=>localStorage.getItem("codeEditorFontSize")||"14"),R=n.useRef(null),M=n.useMemo(()=>{const _=()=>{const te=document.createElement("div");te.className="cm-editor-toolbar-panel";const ne=()=>{let Y='<div style="display: flex; align-items: center; justify-content: flex-end; width: 100%;">';Y+='<div style="display: flex; align-items: center; gap: 4px;">',Y+=`
96
96
  <button class="cm-toolbar-btn cm-settings-btn" title="Editor Settings">
97
97
  <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
98
98
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
99
99
  </svg>
100
100
  </button>
101
- `,u&&m&&(G+=`
101
+ `,u&&m&&(Y+=`
102
102
  <button class="cm-toolbar-btn cm-expand-btn" title="${c?"Collapse editor":"Expand editor to full width"}">
103
103
  <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
104
104
  ${c?'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25" />':'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" />'}
105
105
  </svg>
106
106
  </button>
107
- `),G+="</div>",G+="</div>",te.innerHTML=G,te.querySelector(".cm-settings-btn")?.addEventListener("click",()=>{window.openSettings&&window.openSettings("appearance")}),u&&m&&te.querySelector(".cm-expand-btn")?.addEventListener("click",()=>{m()})};return ne(),{top:!0,dom:te,update:ne}};return[ua.of(_)]},[u,c,m]),E=_=>{const te=_.split(".").pop()?.toLowerCase();switch(te){case"js":case"jsx":case"ts":case"tsx":return[va({jsx:!0,typescript:te.includes("ts")})];case"py":return[ba()];case"html":case"htm":return[ya()];case"css":case"scss":case"less":return[ga()];case"json":return[xa()];case"md":case"markdown":return[ha()];default:return[]}};n.useEffect(()=>{(async()=>{try{x(!0);const te=await me.readFile(r.projectName,r.path);if(!te.ok)throw new Error(`Failed to load file: ${te.status} ${te.statusText}`);const ne=await te.json();p(ne.content)}catch(te){console.error("Error loading file:",te),p(`// Error loading file: ${te.message}
107
+ `),Y+="</div>",Y+="</div>",te.innerHTML=Y,te.querySelector(".cm-settings-btn")?.addEventListener("click",()=>{window.openSettings&&window.openSettings("appearance")}),u&&m&&te.querySelector(".cm-expand-btn")?.addEventListener("click",()=>{m()})};return ne(),{top:!0,dom:te,update:ne}};return[ua.of(_)]},[u,c,m]),D=_=>{const te=_.split(".").pop()?.toLowerCase();switch(te){case"js":case"jsx":case"ts":case"tsx":return[va({jsx:!0,typescript:te.includes("ts")})];case"py":return[ba()];case"html":case"htm":return[ya()];case"css":case"scss":case"less":return[ga()];case"json":return[xa()];case"md":case"markdown":return[ha()];default:return[]}};n.useEffect(()=>{(async()=>{try{x(!0);const te=await me.readFile(r.projectName,r.path);if(!te.ok)throw new Error(`Failed to load file: ${te.status} ${te.statusText}`);const ne=await te.json();p(ne.content)}catch(te){console.error("Error loading file:",te),p(`// Error loading file: ${te.message}
108
108
  // File: ${r.name}
109
- // Path: ${Ue(r.path)}`)}finally{x(!1)}})()},[r,l]);const $=async()=>{a(!0);try{console.log("Saving file:",{projectName:r.projectName,path:r.path,contentLength:s?.length});const _=await me.saveFile(r.projectName,r.path,s);if(console.log("Save response:",{status:_.status,ok:_.ok,contentType:_.headers.get("content-type")}),!_.ok){const ne=_.headers.get("content-type");if(ne&&ne.includes("application/json")){const G=await _.json();throw new Error(G.error||`Save failed: ${_.status}`)}else{const G=await _.text();throw console.error("Non-JSON error response:",G),new Error(`Save failed: ${_.status} ${_.statusText}`)}}const te=await _.json();console.log("Save successful:",te),j(!0),setTimeout(()=>j(!1),2e3)}catch(_){console.error("Error saving file:",_),d(`保存文件失败: ${_.message}`,{variant:"error"})}finally{a(!1)}},T=()=>{const _=new Blob([s],{type:"text/plain"}),te=URL.createObjectURL(_),ne=document.createElement("a");ne.href=te,ne.download=r.name,document.body.appendChild(ne),ne.click(),document.body.removeChild(ne),URL.revokeObjectURL(te)},X=()=>{g(!i)};return n.useEffect(()=>{localStorage.setItem("codeEditorTheme",v?"dark":"light")},[v]),n.useEffect(()=>{localStorage.setItem("codeEditorWordWrap",f.toString())},[f]),n.useEffect(()=>{const _=()=>{const te=localStorage.getItem("codeEditorTheme");te&&k(te==="dark");const ne=localStorage.getItem("codeEditorWordWrap");ne!==null&&w(ne==="true");const G=localStorage.getItem("codeEditorLineNumbers");G!==null&&z(G!=="false");const le=localStorage.getItem("codeEditorFontSize");le&&N(le)};return window.addEventListener("storage",_),window.addEventListener("codeEditorSettingsChanged",_),()=>{window.removeEventListener("storage",_),window.removeEventListener("codeEditorSettingsChanged",_)}},[]),n.useEffect(()=>{const _=te=>{(te.ctrlKey||te.metaKey)&&(te.key==="s"?(te.preventDefault(),$()):te.key==="Escape"&&(te.preventDefault(),o()))};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[s]),t?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
109
+ // Path: ${Ue(r.path)}`)}finally{x(!1)}})()},[r,l]);const $=async()=>{a(!0);try{console.log("Saving file:",{projectName:r.projectName,path:r.path,contentLength:s?.length});const _=await me.saveFile(r.projectName,r.path,s);if(console.log("Save response:",{status:_.status,ok:_.ok,contentType:_.headers.get("content-type")}),!_.ok){const ne=_.headers.get("content-type");if(ne&&ne.includes("application/json")){const Y=await _.json();throw new Error(Y.error||`Save failed: ${_.status}`)}else{const Y=await _.text();throw console.error("Non-JSON error response:",Y),new Error(`Save failed: ${_.status} ${_.statusText}`)}}const te=await _.json();console.log("Save successful:",te),j(!0),setTimeout(()=>j(!1),2e3)}catch(_){console.error("Error saving file:",_),d(`保存文件失败: ${_.message}`,{variant:"error"})}finally{a(!1)}},T=()=>{const _=new Blob([s],{type:"text/plain"}),te=URL.createObjectURL(_),ne=document.createElement("a");ne.href=te,ne.download=r.name,document.body.appendChild(ne),ne.click(),document.body.removeChild(ne),URL.revokeObjectURL(te)},X=()=>{g(!i)};return n.useEffect(()=>{localStorage.setItem("codeEditorTheme",v?"dark":"light")},[v]),n.useEffect(()=>{localStorage.setItem("codeEditorWordWrap",f.toString())},[f]),n.useEffect(()=>{const _=()=>{const te=localStorage.getItem("codeEditorTheme");te&&k(te==="dark");const ne=localStorage.getItem("codeEditorWordWrap");ne!==null&&w(ne==="true");const Y=localStorage.getItem("codeEditorLineNumbers");Y!==null&&L(Y!=="false");const le=localStorage.getItem("codeEditorFontSize");le&&S(le)};return window.addEventListener("storage",_),window.addEventListener("codeEditorSettingsChanged",_),()=>{window.removeEventListener("storage",_),window.removeEventListener("codeEditorSettingsChanged",_)}},[]),n.useEffect(()=>{const _=te=>{(te.ctrlKey||te.metaKey)&&(te.key==="s"?(te.preventDefault(),$()):te.key==="Escape"&&(te.preventDefault(),o()))};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[s]),t?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
110
110
  .code-editor-loading {
111
111
  background-color: ${v?"#111827":"#ffffff"} !important;
112
112
  }
@@ -139,9 +139,9 @@ ${ue}`:ue:ve.push({type:"assistant",content:ue,timestamp:new Date,isStreaming:!0
139
139
  .cm-toolbar-btn:hover {
140
140
  background-color: ${v?"#374151":"#f3f4f6"};
141
141
  }
142
- `}),e.jsx("div",{className:u?"w-full h-full flex flex-col":`fixed inset-0 z-40 md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${i?"md:p-0":""}`,children:e.jsxs("div",{className:u?"bg-background flex flex-col w-full h-full":`bg-background shadow-2xl flex flex-col ${"w-full h-full md:rounded-lg md:shadow-2xl"+(i?" md:w-full md:h-full md:rounded-none":" md:w-full md:max-w-6xl md:h-[80vh] md:max-h-[80vh]")}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border flex-shrink-0 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"flex items-center gap-2 min-w-0",children:e.jsx("h3",{className:"font-medium text-gray-900 dark:text-white truncate",children:r.name})}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 truncate",children:Ue(r.path)})]})}),e.jsxs("div",{className:"flex items-center gap-1 md:gap-2 flex-shrink-0",children:[e.jsx("button",{onClick:T,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Download file",children:e.jsx(It,{className:"w-5 h-5 md:w-4 md:h-4"})}),e.jsx("button",{onClick:$,disabled:h,className:`px-3 py-2 text-white rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors min-h-[44px] md:min-h-0 ${b?"bg-green-600 hover:bg-green-700":"bg-blue-600 hover:bg-blue-700"}`,children:b?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"w-5 h-5 md:w-4 md:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),e.jsx("span",{className:"hidden sm:inline",children:"Saved!"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Un,{className:"w-5 h-5 md:w-4 md:h-4"}),e.jsx("span",{className:"hidden sm:inline",children:h?"Saving...":"Save"})]})}),!u&&e.jsx("button",{onClick:X,className:"hidden md:flex p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 items-center justify-center",title:i?"Exit fullscreen":"Fullscreen",children:i?e.jsx(Oa,{className:"w-4 h-4"}):e.jsx(Ca,{className:"w-4 h-4"})}),e.jsx("button",{onClick:o,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Close",children:e.jsx(Ge,{className:"w-6 h-6 md:w-4 md:h-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(pa,{ref:R,value:s,onChange:p,extensions:[...E(r.name),...M,...f?[fa.lineWrapping]:[]],theme:v?ma:void 0,height:"100%",style:{fontSize:`${D}px`,height:"100%"},basicSetup:{lineNumbers:S,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}})}),e.jsxs("div",{className:"flex items-center justify-between p-3 border-t border-border bg-muted flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[e.jsxs("span",{children:["Lines: ",s.split(`
143
- `).length]}),e.jsxs("span",{children:["Characters: ",s.length]})]}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save • Esc to close"})]})]})})]})}function Es({file:r,onClose:o}){const l=`/api/projects/${r.projectName}/files/content?path=${encodeURIComponent(r.path)}`,[u,c]=n.useState(null),[m,d]=n.useState(null),[s,p]=n.useState(!0);return n.useEffect(()=>{let t;const x=new AbortController;return(async()=>{try{p(!0),d(null),c(null);const a=await J(l,{signal:x.signal});if(!a.ok)throw new Error(`Request failed with status ${a.status}`);const i=await a.blob();t=URL.createObjectURL(i),c(t)}catch(a){if(a.name==="AbortError")return;console.error("Error loading image:",a),d("无法加载图像")}finally{p(!1)}})(),()=>{x.abort(),t&&URL.revokeObjectURL(t)}},[l]),e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-4xl max-h-[90vh] w-full mx-4 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:r.name}),e.jsx(U,{variant:"ghost",size:"sm",onClick:o,className:"h-8 w-8 p-0",children:e.jsx(Ge,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4 flex justify-center items-center bg-gray-50 dark:bg-gray-900 min-h-[400px]",children:[s&&e.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400",children:e.jsx("p",{children:"加载图像中…"})}),!s&&u&&e.jsx("img",{src:u,alt:r.name,className:"max-w-full max-h-[70vh] object-contain rounded-lg shadow-md"}),!s&&!u&&e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("p",{children:m||"无法加载图像"}),e.jsx("p",{className:"text-sm mt-2 break-all",children:Ue(r.path)})]})]}),e.jsx("div",{className:"p-4 border-t bg-gray-50 dark:bg-gray-800",children:e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:Ue(r.path)})})]})})}function Cl({selectedProject:r}){const{showAlert:o,showConfirm:l}=lt(),[u,c]=n.useState([]),[m,d]=n.useState(!1),[s,p]=n.useState(new Set),[t,x]=n.useState(new Set),[h,a]=n.useState(new Set),[i,g]=n.useState(null),[v,k]=n.useState(null),[b,j]=n.useState(""),[f,w]=n.useState([]),[S,z]=n.useState(!1),[D,N]=n.useState(!1),[R,M]=n.useState(null),[E,$]=n.useState({}),[T,X]=n.useState(null),[_,te]=n.useState(!1),[ne,G]=n.useState(""),[le,de]=n.useState(!1),[fe,Ee]=n.useState(null),[ge,Me]=n.useState(!1);n.useEffect(()=>{r&&(p(new Set),a(new Set),x(new Set),ae())},[r,ge]),n.useEffect(()=>{if(!b.trim())w(u);else{const C=Fe(u,b.toLowerCase());w(C);const V=I=>{I.forEach(re=>{re.type==="directory"&&re.children&&re.children.length>0&&(p(Y=>new Set(Y.add(re.path))),V(re.children))})};V(C)}},[u,b]);const Fe=(C,V)=>C.reduce((I,re)=>{const Y=re.name.toLowerCase().includes(V);let ie=[];return re.type==="directory"&&re.children&&(ie=Fe(re.children,V)),(Y||ie.length>0)&&I.push({...re,children:ie}),I},[]),ae=async()=>{d(!0);try{const C=await me.getFiles(r.name,{depth:1,showHidden:ge});if(!C.ok){const I=await C.text();console.error("❌ File fetch failed:",C.status,I),c([]);return}const V=await C.json();c(V)}catch(C){console.error("❌ Error fetching files:",C),c([])}finally{d(!1)}},Ne=async(C,V=!1)=>{if(!t.has(C)&&!(!V&&h.has(C))){x(I=>new Set([...I,C]));try{const I=await me.getFiles(r.name,{dirPath:C,depth:1,showHidden:ge});if(!I.ok){console.error("Failed to load directory:",C);return}const re=await I.json();c(Y=>He(Y,C,re)),a(Y=>new Set([...Y,C]))}catch(I){console.error("Error loading directory:",I)}finally{x(I=>{const re=new Set(I);return re.delete(C),re})}}},He=(C,V,I)=>C.map(re=>re.path===V?{...re,children:I}:re.type==="directory"&&re.children&&re.children.length>0?{...re,children:He(re.children,V,I)}:re),Be=n.useCallback(async C=>{if(!r||C.length===0)return;N(!0),M(null);const V=new FormData;T&&V.append("targetDir",T),C.forEach(re=>{V.append("files",re)});const I={};C.forEach(re=>{I[re.name]=0}),$(I);try{const re=await me.uploadFiles(r.name,V);if(!re.ok){const ie=await re.json();throw new Error(ie.error||"Upload failed")}const Y={};C.forEach(ie=>{Y[ie.name]=100}),$(Y),T?(p(ie=>new Set([...ie,T])),await Ne(T,!0)):await ae(),setTimeout(()=>{z(!1),$({})},1e3)}catch(re){console.error("Upload failed:",re),M(re.message)}finally{N(!1)}},[r,T]),{getRootProps:he,getInputProps:Oe,isDragActive:De,open:Ye}=Vn({onDrop:Be,noClick:!0,noKeyboard:!0}),Te=async(C,V,I)=>{const re=I==="directory";if(await l(`确定要删除${re?"文件夹":"文件"} "${V}" 吗?${re?`
144
- 这将删除内部的所有内容。`:""}`,{title:"确认删除",variant:"danger",confirmText:"删除"})&&r)try{const ie=await me.deleteFile(r.name,C);if(!ie.ok){const ce=await ie.json();throw new Error(ce.error||"Delete failed")}await ae()}catch(ie){console.error("Delete failed:",ie),o(`删除失败: ${ie.message}`,{variant:"error"})}},Je=async()=>{const C=ne.trim();if(!C||!r)return;if(/[<>:"/\\|?*\x00-\x1f]/.test(C)){o("文件夹名称包含无效字符",{variant:"error"});return}const V=fe?`${fe}/${C}`:C;de(!0);try{const I=await me.createDir(r.name,V);if(!I.ok){const re=await I.json();throw new Error(re.error||"Create failed")}fe?(p(re=>new Set([...re,fe])),await Ne(fe,!0)):await ae(),te(!1),G("")}catch(I){console.error("Create directory failed:",I),o(`创建失败: ${I.message}`,{variant:"error"})}finally{de(!1)}},Ce=async(C,V)=>{const I=new Set(s);I.has(C)?I.delete(C):(I.add(C),V&&!h.has(C)&&await Ne(C)),p(I)},Re=C=>{if(!C||C===0)return"0 B";const V=1024,I=["B","KB","MB","GB"],re=Math.floor(Math.log(C)/Math.log(V));return parseFloat((C/Math.pow(V,re)).toFixed(1))+" "+I[re]},$e=C=>{if(!C)return"-";const V=new Date,I=new Date(C),re=Math.floor((V-I)/1e3);return re<60?"just now":re<3600?`${Math.floor(re/60)} min ago`:re<86400?`${Math.floor(re/3600)} hours ago`:re<2592e3?`${Math.floor(re/86400)} days ago`:I.toLocaleDateString()},Ie=C=>C.includes("/.claude/")||C.endsWith("/.claude"),ze=C=>{const V=C.split(".").pop()?.toLowerCase();return["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(V)},Ze=C=>{const V=C.toLowerCase(),I=["dockerfile","makefile","gemfile","rakefile","procfile","vagrantfile","jenkinsfile"];if(!C.includes("."))return I.includes(V);const re=C.split(".").pop()?.toLowerCase();return new Set(["js","jsx","ts","tsx","mjs","cjs","py","pyw","pyi","java","kt","kts","scala","groovy","cpp","cxx","cc","c","h","hpp","hxx","cs","fs","fsx","go","rs","swift","php","rb","lua","pl","pm","r","dart","elm","clj","cljs","ex","exs","sh","bash","zsh","fish","ps1","bat","cmd","html","htm","xhtml","css","scss","sass","less","vue","svelte","astro","json","json5","jsonc","yaml","yml","toml","ini","cfg","conf","config","env","properties","xml","xsd","xsl","csv","tsv","graphql","gql","proto","sql","md","mdx","markdown","txt","text","rst","adoc","tex","log","lock","gitignore","gitattributes","gitmodules","editorconfig","prettierrc","eslintrc","babelrc","htaccess"]).has(re)},Qe=async C=>{try{const V=await me.getFileContent(r.name,C.path);if(!V.ok)throw new Error("Download failed");const I=await V.blob(),re=URL.createObjectURL(I),Y=document.createElement("a");Y.href=re,Y.download=C.name,document.body.appendChild(Y),Y.click(),document.body.removeChild(Y),URL.revokeObjectURL(re)}catch(V){console.error("Download failed:",V)}},K=C=>{const V=C.split(".").pop()?.toLowerCase(),I=["js","jsx","ts","tsx","py","java","cpp","c","php","rb","go","rs"],re=["md","txt","doc","pdf"],Y=["png","jpg","jpeg","gif","svg","webp","ico","bmp"];return I.includes(V)?e.jsx(Da,{className:"w-4 h-4 text-green-500 flex-shrink-0"}):re.includes(V)?e.jsx(ur,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):Y.includes(V)?e.jsx(xn,{className:"w-4 h-4 text-purple-500 flex-shrink-0"}):e.jsx(xn,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"})},B=(C,V=0)=>C.map(I=>{const re=t.has(I.path),Y=s.has(I.path),ie=I.hasChildren||I.children&&I.children.length>0;return e.jsxs("div",{className:"select-none group/item",children:[e.jsxs("div",{className:ot("grid grid-cols-12 gap-2 p-2 hover:bg-accent items-center",I.type==="directory"||ze(I.name)||Ze(I.name)?"cursor-pointer":"cursor-default"),style:{paddingLeft:`${V*16+12}px`},onClick:()=>{I.type==="directory"?Ce(I.path,ie):Ie(I.path)||(ze(I.name)?k({name:I.name,path:I.path,projectPath:r.path,projectName:r.name}):Ze(I.name)&&g({name:I.name,path:I.path,projectPath:r.path,projectName:r.name}))},children:[e.jsxs("div",{className:"col-span-4 flex items-center gap-2 min-w-0",children:[I.type==="directory"?e.jsxs("div",{className:"relative flex-shrink-0",children:[re?e.jsx(bt,{className:"w-4 h-4 text-blue-500 animate-spin"}):Y?e.jsx(Xr,{className:"w-4 h-4 text-blue-500"}):ie?e.jsx(Zt,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(Zt,{className:"w-4 h-4 text-muted-foreground/50"}),I.isSymlink&&e.jsx(bo,{className:"absolute -bottom-1 -right-1 w-2.5 h-2.5 text-yellow-500"})]}):e.jsxs("div",{className:"relative flex-shrink-0",children:[I.isBrokenSymlink?e.jsx(xn,{className:"w-4 h-4 text-destructive/60"}):K(I.name),I.isSymlink&&e.jsx(bo,{className:"absolute -bottom-1 -right-1 w-2.5 h-2.5 text-yellow-500"})]}),e.jsx("span",{className:ot("text-sm truncate",I.isBrokenSymlink?"text-destructive/60 line-through":"text-foreground"),children:I.name}),I.type==="directory"&&ie&&!Y&&!re&&e.jsx(Br,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"})]}),e.jsx("div",{className:"col-span-2 text-sm text-muted-foreground",children:I.type==="file"?Re(I.size):"-"}),e.jsx("div",{className:"col-span-3 text-sm text-muted-foreground",children:$e(I.modified)}),e.jsx("div",{className:"col-span-2 text-sm text-muted-foreground font-mono",children:I.permissionsRwx||"-"}),e.jsxs("div",{className:"col-span-1 flex justify-end items-center gap-0.5",children:[I.type==="directory"&&!Ie(I.path)&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover/item:opacity-100 transition-opacity",onClick:ce=>{ce.stopPropagation(),X(I.path),z(!0)},title:"上传文件到此文件夹",children:e.jsx(Ht,{className:"w-3.5 h-3.5 text-muted-foreground hover:text-primary"})}),I.type==="directory"&&!Ie(I.path)&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover/item:opacity-100 transition-opacity",onClick:ce=>{ce.stopPropagation(),Ee(I.path),G(""),te(!0)},title:"在此文件夹下新建子文件夹",children:e.jsx(Tr,{className:"w-3.5 h-3.5 text-muted-foreground hover:text-primary"})}),I.type==="file"&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover/item:opacity-100 transition-opacity",onClick:ce=>{ce.stopPropagation(),Qe(I)},title:"下载文件",children:e.jsx(It,{className:"w-3.5 h-3.5 text-muted-foreground hover:text-primary"})}),!Ie(I.path)&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover/item:opacity-100 transition-opacity",onClick:ce=>{ce.stopPropagation(),Te(I.path,I.name,I.type)},title:`删除${I.type==="directory"?"文件夹":"文件"}`,children:e.jsx(vt,{className:"w-3.5 h-3.5 text-muted-foreground hover:text-destructive"})})]})]}),I.type==="directory"&&Y&&e.jsx("div",{children:re?e.jsx("div",{className:"grid grid-cols-12 gap-2 p-2 text-sm text-muted-foreground items-center",style:{paddingLeft:`${(V+1)*16+12}px`},children:e.jsxs("div",{className:"col-span-4 flex items-center gap-2",children:[e.jsx(bt,{className:"w-3 h-3 animate-spin"}),"加载中..."]})}):I.children&&I.children.length>0?B(I.children,V+1):e.jsx("div",{className:"grid grid-cols-12 gap-2 p-2 text-sm text-muted-foreground",style:{paddingLeft:`${(V+1)*16+12}px`},children:e.jsx("div",{className:"col-span-4",children:"空文件夹"})})})]},I.path)});return m?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"加载文件中..."})}):e.jsxs("div",{...he(),className:ot("h-full flex flex-col bg-card relative",De&&"ring-2 ring-primary ring-inset"),children:[e.jsx("input",{...Oe()}),De&&e.jsx("div",{className:"absolute inset-0 bg-primary/10 flex items-center justify-center z-10 pointer-events-none",children:e.jsx("div",{className:"text-primary font-medium",children:"拖放文件以上传"})}),e.jsxs("div",{className:"p-4 border-b border-border space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:"文件"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{X(null),z(!0)},title:"上传文件",children:e.jsx(Ht,{className:"w-4 h-4"})}),e.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{Ee(null),G(""),te(!0)},title:"新建文件夹",children:e.jsx(Tr,{className:"w-4 h-4"})}),e.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>Me(C=>!C),title:ge?"隐藏隐藏文件":"显示隐藏文件",children:ge?e.jsx(ts,{className:"w-4 h-4"}):e.jsx(Ea,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(ct,{type:"text",placeholder:"搜索文件和文件夹...",value:b,onChange:C=>j(C.target.value),className:"pl-8 pr-8 h-8 text-sm"}),b&&e.jsx(U,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-accent",onClick:()=>j(""),title:"清除搜索",children:e.jsx(Ge,{className:"w-3 h-3"})})]})]}),f.length>0&&e.jsx("div",{className:"px-4 pt-2 pb-1 border-b border-border",children:e.jsxs("div",{className:"grid grid-cols-12 gap-2 px-2 text-xs font-medium text-muted-foreground",children:[e.jsx("div",{className:"col-span-4",children:"名称"}),e.jsx("div",{className:"col-span-2",children:"大小"}),e.jsx("div",{className:"col-span-3",children:"修改时间"}),e.jsx("div",{className:"col-span-2",children:"权限"}),e.jsx("div",{className:"col-span-1"})]})}),e.jsx(Jn,{className:"flex-1 p-4",children:u.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:e.jsx(Zt,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h4",{className:"font-medium text-foreground mb-1",children:"未找到文件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"检查项目路径是否可访问"})]}):f.length===0&&b?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:e.jsx(Mt,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h4",{className:"font-medium text-foreground mb-1",children:"无匹配结果"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"尝试不同的搜索条件或清除搜索"})]}):e.jsx("div",{children:B(f)})}),i&&e.jsx(Fn,{file:i,onClose:()=>g(null),projectPath:i.projectPath}),v&&e.jsx(Es,{file:v,onClose:()=>k(null)}),S&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-xl p-6 w-full max-w-md mx-4 border border-border",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"上传文件"}),T&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5 truncate max-w-xs",title:Ue(T),children:["位置:",Ue(T)]})]}),e.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{z(!1),M(null),$({}),X(null)},children:e.jsx(Ge,{className:"w-4 h-4"})})]}),e.jsxs("div",{onClick:Ye,className:ot("border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors","border-border hover:border-primary/50"),children:[e.jsx(Ht,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground"}),e.jsx("p",{className:"text-foreground",children:"将文件拖到此处或点击浏览"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"每次上传最多 20 个文件"})]}),Object.keys(E).length>0&&e.jsx("div",{className:"mt-4 space-y-2 max-h-40 overflow-y-auto",children:Object.entries(E).map(([C,V])=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm truncate flex-1 text-foreground",children:C}),e.jsx("div",{className:"w-20 h-2 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${V}%`}})}),e.jsxs("span",{className:"text-xs text-muted-foreground w-10",children:[V,"%"]})]},C))}),R&&e.jsx("div",{className:"mt-4 p-3 bg-destructive/10 border border-destructive/20 rounded-lg",children:e.jsx("p",{className:"text-sm text-destructive",children:R})}),D&&e.jsx("div",{className:"mt-4 text-center text-sm text-muted-foreground",children:"上传中..."})]})}),_&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-xl p-6 w-full max-w-sm mx-4 border border-border",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"新建文件夹"}),fe&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5 truncate max-w-xs",title:Ue(fe),children:["位置:",Ue(fe)]})]}),e.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>te(!1),children:e.jsx(Ge,{className:"w-4 h-4"})})]}),e.jsx(ct,{autoFocus:!0,type:"text",placeholder:"文件夹名称",value:ne,onChange:C=>G(C.target.value),onKeyDown:C=>{C.key==="Enter"&&Je(),C.key==="Escape"&&te(!1)},className:"mb-4"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>te(!1),children:"取消"}),e.jsxs(U,{size:"sm",onClick:Je,disabled:!ne.trim()||le,children:[le?e.jsx(bt,{className:"w-4 h-4 animate-spin mr-1"}):null,"创建"]})]})]})})]})}var Qn=Qa(),eo=ei(),to=ti(),ro=ri();const El=`
142
+ `}),e.jsx("div",{className:u?"w-full h-full flex flex-col":`fixed inset-0 z-40 md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${i?"md:p-0":""}`,children:e.jsxs("div",{className:u?"bg-background flex flex-col w-full h-full":`bg-background shadow-2xl flex flex-col ${"w-full h-full md:rounded-lg md:shadow-2xl"+(i?" md:w-full md:h-full md:rounded-none":" md:w-full md:max-w-6xl md:h-[80vh] md:max-h-[80vh]")}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border flex-shrink-0 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"flex items-center gap-2 min-w-0",children:e.jsx("h3",{className:"font-medium text-gray-900 dark:text-white truncate",children:r.name})}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 truncate",children:Ue(r.path)})]})}),e.jsxs("div",{className:"flex items-center gap-1 md:gap-2 flex-shrink-0",children:[e.jsx("button",{onClick:T,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Download file",children:e.jsx(_t,{className:"w-5 h-5 md:w-4 md:h-4"})}),e.jsx("button",{onClick:$,disabled:h,className:`px-3 py-2 text-white rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors min-h-[44px] md:min-h-0 ${b?"bg-green-600 hover:bg-green-700":"bg-blue-600 hover:bg-blue-700"}`,children:b?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"w-5 h-5 md:w-4 md:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),e.jsx("span",{className:"hidden sm:inline",children:"Saved!"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Un,{className:"w-5 h-5 md:w-4 md:h-4"}),e.jsx("span",{className:"hidden sm:inline",children:h?"Saving...":"Save"})]})}),!u&&e.jsx("button",{onClick:X,className:"hidden md:flex p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 items-center justify-center",title:i?"Exit fullscreen":"Fullscreen",children:i?e.jsx(Oa,{className:"w-4 h-4"}):e.jsx(Ca,{className:"w-4 h-4"})}),e.jsx("button",{onClick:o,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Close",children:e.jsx(Ge,{className:"w-6 h-6 md:w-4 md:h-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(pa,{ref:R,value:s,onChange:p,extensions:[...D(r.name),...M,...f?[fa.lineWrapping]:[]],theme:v?ma:void 0,height:"100%",style:{fontSize:`${E}px`,height:"100%"},basicSetup:{lineNumbers:N,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}})}),e.jsxs("div",{className:"flex items-center justify-between p-3 border-t border-border bg-muted flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[e.jsxs("span",{children:["Lines: ",s.split(`
143
+ `).length]}),e.jsxs("span",{children:["Characters: ",s.length]})]}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save • Esc to close"})]})]})})]})}function Es({file:r,onClose:o}){const l=`/api/projects/${r.projectName}/files/content?path=${encodeURIComponent(r.path)}`,[u,c]=n.useState(null),[m,d]=n.useState(null),[s,p]=n.useState(!0);return n.useEffect(()=>{let t;const x=new AbortController;return(async()=>{try{p(!0),d(null),c(null);const a=await J(l,{signal:x.signal});if(!a.ok)throw new Error(`Request failed with status ${a.status}`);const i=await a.blob();t=URL.createObjectURL(i),c(t)}catch(a){if(a.name==="AbortError")return;console.error("Error loading image:",a),d("无法加载图像")}finally{p(!1)}})(),()=>{x.abort(),t&&URL.revokeObjectURL(t)}},[l]),e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-4xl max-h-[90vh] w-full mx-4 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:r.name}),e.jsx(U,{variant:"ghost",size:"sm",onClick:o,className:"h-8 w-8 p-0",children:e.jsx(Ge,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4 flex justify-center items-center bg-gray-50 dark:bg-gray-900 min-h-[400px]",children:[s&&e.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400",children:e.jsx("p",{children:"加载图像中…"})}),!s&&u&&e.jsx("img",{src:u,alt:r.name,className:"max-w-full max-h-[70vh] object-contain rounded-lg shadow-md"}),!s&&!u&&e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("p",{children:m||"无法加载图像"}),e.jsx("p",{className:"text-sm mt-2 break-all",children:Ue(r.path)})]})]}),e.jsx("div",{className:"p-4 border-t bg-gray-50 dark:bg-gray-800",children:e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:Ue(r.path)})})]})})}function Cl({selectedProject:r}){const{showAlert:o,showConfirm:l}=lt(),[u,c]=n.useState([]),[m,d]=n.useState(!1),[s,p]=n.useState(new Set),[t,x]=n.useState(new Set),[h,a]=n.useState(new Set),[i,g]=n.useState(null),[v,k]=n.useState(null),[b,j]=n.useState(""),[f,w]=n.useState([]),[N,L]=n.useState(!1),[E,S]=n.useState(!1),[R,M]=n.useState(null),[D,$]=n.useState({}),[T,X]=n.useState(null),[_,te]=n.useState(!1),[ne,Y]=n.useState(""),[le,de]=n.useState(!1),[fe,Ee]=n.useState(null),[ye,Me]=n.useState(!1);n.useEffect(()=>{r&&(p(new Set),a(new Set),x(new Set),ie())},[r,ye]),n.useEffect(()=>{if(!b.trim())w(u);else{const C=Fe(u,b.toLowerCase());w(C);const V=z=>{z.forEach(re=>{re.type==="directory"&&re.children&&re.children.length>0&&(p(G=>new Set(G.add(re.path))),V(re.children))})};V(C)}},[u,b]);const Fe=(C,V)=>C.reduce((z,re)=>{const G=re.name.toLowerCase().includes(V);let ae=[];return re.type==="directory"&&re.children&&(ae=Fe(re.children,V)),(G||ae.length>0)&&z.push({...re,children:ae}),z},[]),ie=async()=>{d(!0);try{const C=await me.getFiles(r.name,{depth:1,showHidden:ye});if(!C.ok){const z=await C.text();console.error("❌ File fetch failed:",C.status,z),c([]);return}const V=await C.json();c(V)}catch(C){console.error("❌ Error fetching files:",C),c([])}finally{d(!1)}},Se=async(C,V=!1)=>{if(!t.has(C)&&!(!V&&h.has(C))){x(z=>new Set([...z,C]));try{const z=await me.getFiles(r.name,{dirPath:C,depth:1,showHidden:ye});if(!z.ok){console.error("Failed to load directory:",C);return}const re=await z.json();c(G=>He(G,C,re)),a(G=>new Set([...G,C]))}catch(z){console.error("Error loading directory:",z)}finally{x(z=>{const re=new Set(z);return re.delete(C),re})}}},He=(C,V,z)=>C.map(re=>re.path===V?{...re,children:z}:re.type==="directory"&&re.children&&re.children.length>0?{...re,children:He(re.children,V,z)}:re),Be=n.useCallback(async C=>{if(!r||C.length===0)return;S(!0),M(null);const V=new FormData;T&&V.append("targetDir",T),C.forEach(re=>{V.append("files",re)});const z={};C.forEach(re=>{z[re.name]=0}),$(z);try{const re=await me.uploadFiles(r.name,V);if(!re.ok){const ae=await re.json();throw new Error(ae.error||"Upload failed")}const G={};C.forEach(ae=>{G[ae.name]=100}),$(G),T?(p(ae=>new Set([...ae,T])),await Se(T,!0)):await ie(),setTimeout(()=>{L(!1),$({})},1e3)}catch(re){console.error("Upload failed:",re),M(re.message)}finally{S(!1)}},[r,T]),{getRootProps:he,getInputProps:Oe,isDragActive:De,open:Ye}=Vn({onDrop:Be,noClick:!0,noKeyboard:!0}),Xe=async(C,V,z)=>{const re=z==="directory";if(await l(`确定要删除${re?"文件夹":"文件"} "${V}" 吗?${re?`
144
+ 这将删除内部的所有内容。`:""}`,{title:"确认删除",variant:"danger",confirmText:"删除"})&&r)try{const ae=await me.deleteFile(r.name,C);if(!ae.ok){const ce=await ae.json();throw new Error(ce.error||"Delete failed")}await ie()}catch(ae){console.error("Delete failed:",ae),o(`删除失败: ${ae.message}`,{variant:"error"})}},Je=async()=>{const C=ne.trim();if(!C||!r)return;if(/[<>:"/\\|?*\x00-\x1f]/.test(C)){o("文件夹名称包含无效字符",{variant:"error"});return}const V=fe?`${fe}/${C}`:C;de(!0);try{const z=await me.createDir(r.name,V);if(!z.ok){const re=await z.json();throw new Error(re.error||"Create failed")}fe?(p(re=>new Set([...re,fe])),await Se(fe,!0)):await ie(),te(!1),Y("")}catch(z){console.error("Create directory failed:",z),o(`创建失败: ${z.message}`,{variant:"error"})}finally{de(!1)}},Ce=async(C,V)=>{const z=new Set(s);z.has(C)?z.delete(C):(z.add(C),V&&!h.has(C)&&await Se(C)),p(z)},_e=C=>{if(!C||C===0)return"0 B";const V=1024,z=["B","KB","MB","GB"],re=Math.floor(Math.log(C)/Math.log(V));return parseFloat((C/Math.pow(V,re)).toFixed(1))+" "+z[re]},$e=C=>{if(!C)return"-";const V=new Date,z=new Date(C),re=Math.floor((V-z)/1e3);return re<60?"just now":re<3600?`${Math.floor(re/60)} min ago`:re<86400?`${Math.floor(re/3600)} hours ago`:re<2592e3?`${Math.floor(re/86400)} days ago`:z.toLocaleDateString()},ze=C=>C.includes("/.claude/")||C.endsWith("/.claude"),Re=C=>{const V=C.split(".").pop()?.toLowerCase();return["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(V)},Ze=C=>{const V=C.toLowerCase(),z=["dockerfile","makefile","gemfile","rakefile","procfile","vagrantfile","jenkinsfile"];if(!C.includes("."))return z.includes(V);const re=C.split(".").pop()?.toLowerCase();return new Set(["js","jsx","ts","tsx","mjs","cjs","py","pyw","pyi","java","kt","kts","scala","groovy","cpp","cxx","cc","c","h","hpp","hxx","cs","fs","fsx","go","rs","swift","php","rb","lua","pl","pm","r","dart","elm","clj","cljs","ex","exs","sh","bash","zsh","fish","ps1","bat","cmd","html","htm","xhtml","css","scss","sass","less","vue","svelte","astro","json","json5","jsonc","yaml","yml","toml","ini","cfg","conf","config","env","properties","xml","xsd","xsl","csv","tsv","graphql","gql","proto","sql","md","mdx","markdown","txt","text","rst","adoc","tex","log","lock","gitignore","gitattributes","gitmodules","editorconfig","prettierrc","eslintrc","babelrc","htaccess"]).has(re)},Qe=async C=>{try{const V=await me.getFileContent(r.name,C.path);if(!V.ok)throw new Error("Download failed");const z=await V.blob(),re=URL.createObjectURL(z),G=document.createElement("a");G.href=re,G.download=C.name,document.body.appendChild(G),G.click(),document.body.removeChild(G),URL.revokeObjectURL(re)}catch(V){console.error("Download failed:",V)}},K=C=>{const V=C.split(".").pop()?.toLowerCase(),z=["js","jsx","ts","tsx","py","java","cpp","c","php","rb","go","rs"],re=["md","txt","doc","pdf"],G=["png","jpg","jpeg","gif","svg","webp","ico","bmp"];return z.includes(V)?e.jsx(Da,{className:"w-4 h-4 text-green-500 flex-shrink-0"}):re.includes(V)?e.jsx(ur,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):G.includes(V)?e.jsx(xn,{className:"w-4 h-4 text-purple-500 flex-shrink-0"}):e.jsx(xn,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"})},B=(C,V=0)=>C.map(z=>{const re=t.has(z.path),G=s.has(z.path),ae=z.hasChildren||z.children&&z.children.length>0;return e.jsxs("div",{className:"select-none group/item",children:[e.jsxs("div",{className:ot("grid grid-cols-12 gap-2 p-2 hover:bg-accent items-center",z.type==="directory"||Re(z.name)||Ze(z.name)?"cursor-pointer":"cursor-default"),style:{paddingLeft:`${V*16+12}px`},onClick:()=>{z.type==="directory"?Ce(z.path,ae):ze(z.path)||(Re(z.name)?k({name:z.name,path:z.path,projectPath:r.path,projectName:r.name}):Ze(z.name)&&g({name:z.name,path:z.path,projectPath:r.path,projectName:r.name}))},children:[e.jsxs("div",{className:"col-span-4 flex items-center gap-2 min-w-0",children:[z.type==="directory"?e.jsxs("div",{className:"relative flex-shrink-0",children:[re?e.jsx(bt,{className:"w-4 h-4 text-blue-500 animate-spin"}):G?e.jsx(Xr,{className:"w-4 h-4 text-blue-500"}):ae?e.jsx(Zt,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(Zt,{className:"w-4 h-4 text-muted-foreground/50"}),z.isSymlink&&e.jsx(bo,{className:"absolute -bottom-1 -right-1 w-2.5 h-2.5 text-yellow-500"})]}):e.jsxs("div",{className:"relative flex-shrink-0",children:[z.isBrokenSymlink?e.jsx(xn,{className:"w-4 h-4 text-destructive/60"}):K(z.name),z.isSymlink&&e.jsx(bo,{className:"absolute -bottom-1 -right-1 w-2.5 h-2.5 text-yellow-500"})]}),e.jsx("span",{className:ot("text-sm truncate",z.isBrokenSymlink?"text-destructive/60 line-through":"text-foreground"),children:z.name}),z.type==="directory"&&ae&&!G&&!re&&e.jsx(Br,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"})]}),e.jsx("div",{className:"col-span-2 text-sm text-muted-foreground",children:z.type==="file"?_e(z.size):"-"}),e.jsx("div",{className:"col-span-3 text-sm text-muted-foreground",children:$e(z.modified)}),e.jsx("div",{className:"col-span-2 text-sm text-muted-foreground font-mono",children:z.permissionsRwx||"-"}),e.jsxs("div",{className:"col-span-1 flex justify-end items-center gap-0.5",children:[z.type==="directory"&&!ze(z.path)&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover/item:opacity-100 transition-opacity",onClick:ce=>{ce.stopPropagation(),X(z.path),L(!0)},title:"上传文件到此文件夹",children:e.jsx(Ht,{className:"w-3.5 h-3.5 text-muted-foreground hover:text-primary"})}),z.type==="directory"&&!ze(z.path)&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover/item:opacity-100 transition-opacity",onClick:ce=>{ce.stopPropagation(),Ee(z.path),Y(""),te(!0)},title:"在此文件夹下新建子文件夹",children:e.jsx(Tr,{className:"w-3.5 h-3.5 text-muted-foreground hover:text-primary"})}),z.type==="file"&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover/item:opacity-100 transition-opacity",onClick:ce=>{ce.stopPropagation(),Qe(z)},title:"下载文件",children:e.jsx(_t,{className:"w-3.5 h-3.5 text-muted-foreground hover:text-primary"})}),!ze(z.path)&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover/item:opacity-100 transition-opacity",onClick:ce=>{ce.stopPropagation(),Xe(z.path,z.name,z.type)},title:`删除${z.type==="directory"?"文件夹":"文件"}`,children:e.jsx(vt,{className:"w-3.5 h-3.5 text-muted-foreground hover:text-destructive"})})]})]}),z.type==="directory"&&G&&e.jsx("div",{children:re?e.jsx("div",{className:"grid grid-cols-12 gap-2 p-2 text-sm text-muted-foreground items-center",style:{paddingLeft:`${(V+1)*16+12}px`},children:e.jsxs("div",{className:"col-span-4 flex items-center gap-2",children:[e.jsx(bt,{className:"w-3 h-3 animate-spin"}),"加载中..."]})}):z.children&&z.children.length>0?B(z.children,V+1):e.jsx("div",{className:"grid grid-cols-12 gap-2 p-2 text-sm text-muted-foreground",style:{paddingLeft:`${(V+1)*16+12}px`},children:e.jsx("div",{className:"col-span-4",children:"空文件夹"})})})]},z.path)});return m?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"加载文件中..."})}):e.jsxs("div",{...he(),className:ot("h-full flex flex-col bg-card relative",De&&"ring-2 ring-primary ring-inset"),children:[e.jsx("input",{...Oe()}),De&&e.jsx("div",{className:"absolute inset-0 bg-primary/10 flex items-center justify-center z-10 pointer-events-none",children:e.jsx("div",{className:"text-primary font-medium",children:"拖放文件以上传"})}),e.jsxs("div",{className:"p-4 border-b border-border space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:"文件"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{X(null),L(!0)},title:"上传文件",children:e.jsx(Ht,{className:"w-4 h-4"})}),e.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{Ee(null),Y(""),te(!0)},title:"新建文件夹",children:e.jsx(Tr,{className:"w-4 h-4"})}),e.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>Me(C=>!C),title:ye?"隐藏隐藏文件":"显示隐藏文件",children:ye?e.jsx(ts,{className:"w-4 h-4"}):e.jsx(Ea,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(ct,{type:"text",placeholder:"搜索文件和文件夹...",value:b,onChange:C=>j(C.target.value),className:"pl-8 pr-8 h-8 text-sm"}),b&&e.jsx(U,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-accent",onClick:()=>j(""),title:"清除搜索",children:e.jsx(Ge,{className:"w-3 h-3"})})]})]}),f.length>0&&e.jsx("div",{className:"px-4 pt-2 pb-1 border-b border-border",children:e.jsxs("div",{className:"grid grid-cols-12 gap-2 px-2 text-xs font-medium text-muted-foreground",children:[e.jsx("div",{className:"col-span-4",children:"名称"}),e.jsx("div",{className:"col-span-2",children:"大小"}),e.jsx("div",{className:"col-span-3",children:"修改时间"}),e.jsx("div",{className:"col-span-2",children:"权限"}),e.jsx("div",{className:"col-span-1"})]})}),e.jsx(Jn,{className:"flex-1 p-4",children:u.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:e.jsx(Zt,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h4",{className:"font-medium text-foreground mb-1",children:"未找到文件"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"检查项目路径是否可访问"})]}):f.length===0&&b?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:e.jsx(Mt,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h4",{className:"font-medium text-foreground mb-1",children:"无匹配结果"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"尝试不同的搜索条件或清除搜索"})]}):e.jsx("div",{children:B(f)})}),i&&e.jsx(Fn,{file:i,onClose:()=>g(null),projectPath:i.projectPath}),v&&e.jsx(Es,{file:v,onClose:()=>k(null)}),N&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-xl p-6 w-full max-w-md mx-4 border border-border",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"上传文件"}),T&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5 truncate max-w-xs",title:Ue(T),children:["位置:",Ue(T)]})]}),e.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{L(!1),M(null),$({}),X(null)},children:e.jsx(Ge,{className:"w-4 h-4"})})]}),e.jsxs("div",{onClick:Ye,className:ot("border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors","border-border hover:border-primary/50"),children:[e.jsx(Ht,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground"}),e.jsx("p",{className:"text-foreground",children:"将文件拖到此处或点击浏览"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"每次上传最多 20 个文件"})]}),Object.keys(D).length>0&&e.jsx("div",{className:"mt-4 space-y-2 max-h-40 overflow-y-auto",children:Object.entries(D).map(([C,V])=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm truncate flex-1 text-foreground",children:C}),e.jsx("div",{className:"w-20 h-2 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${V}%`}})}),e.jsxs("span",{className:"text-xs text-muted-foreground w-10",children:[V,"%"]})]},C))}),R&&e.jsx("div",{className:"mt-4 p-3 bg-destructive/10 border border-destructive/20 rounded-lg",children:e.jsx("p",{className:"text-sm text-destructive",children:R})}),E&&e.jsx("div",{className:"mt-4 text-center text-sm text-muted-foreground",children:"上传中..."})]})}),_&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-xl p-6 w-full max-w-sm mx-4 border border-border",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"新建文件夹"}),fe&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5 truncate max-w-xs",title:Ue(fe),children:["位置:",Ue(fe)]})]}),e.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>te(!1),children:e.jsx(Ge,{className:"w-4 h-4"})})]}),e.jsx(ct,{autoFocus:!0,type:"text",placeholder:"文件夹名称",value:ne,onChange:C=>Y(C.target.value),onKeyDown:C=>{C.key==="Enter"&&Je(),C.key==="Escape"&&te(!1)},className:"mb-4"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>te(!1),children:"取消"}),e.jsxs(U,{size:"sm",onClick:Je,disabled:!ne.trim()||le,children:[le?e.jsx(bt,{className:"w-4 h-4 animate-spin mr-1"}):null,"创建"]})]})]})})]})}var Qn=Qa(),eo=ei(),to=ti(),ro=ri();const El=`
145
145
  .xterm .xterm-screen {
146
146
  outline: none !important;
147
147
  }
@@ -151,32 +151,32 @@ ${ue}`:ue:ve.push({type:"assistant",content:ue,timestamp:new Date,isStreaming:!0
151
151
  .xterm-screen:focus {
152
152
  outline: none !important;
153
153
  }
154
- `;if(typeof document<"u"){const r=document.createElement("style");r.type="text/css",r.innerText=El,document.head.appendChild(r)}function Dl({selectedProject:r,selectedSession:o,initialCommand:l,isPlainShell:u=!1,onProcessComplete:c,minimal:m=!1,autoConnect:d=!1}){const s=n.useRef(null),p=n.useRef(null),t=n.useRef(null),x=n.useRef(null),[h,a]=n.useState(!1),[i,g]=n.useState(!1),[v,k]=n.useState(!1),[b,j]=n.useState(null),[f,w]=n.useState(!1),S=n.useRef(r),z=n.useRef(o),D=n.useRef(l),N=n.useRef(u),R=n.useRef(c);n.useEffect(()=>{S.current=r,z.current=o,D.current=l,N.current=u,R.current=c});const M=n.useCallback(async()=>{if(!(f||h))try{const ne=localStorage.getItem("auth-token");if(!ne){console.error("No authentication token found for Shell WebSocket connection");return}const le=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/shell?token=${encodeURIComponent(ne)}`;x.current=new WebSocket(le),x.current.onopen=()=>{a(!0),w(!1),setTimeout(()=>{t.current&&p.current&&(t.current.fit(),x.current.send(JSON.stringify({type:"init",projectPath:S.current.fullPath||S.current.path,sessionId:N.current?null:z.current?.id,hasSession:N.current?!1:!!z.current,provider:N.current?"plain-shell":z.current?.__provider||"claude",cols:p.current.cols,rows:p.current.rows,initialCommand:D.current,isPlainShell:N.current})))},100)},x.current.onmessage=de=>{try{const fe=JSON.parse(de.data);if(fe.type==="output"){let Ee=fe.data;if(N.current&&R.current){const ge=Ee.replace(/\x1b\[[0-9;]*m/g,"");if(ge.includes("Process exited with code 0"))R.current(0);else if(ge.match(/Process exited with code (\d+)/)){const Me=parseInt(ge.match(/Process exited with code (\d+)/)[1]);Me!==0&&R.current(Me)}}p.current&&p.current.write(Ee)}else fe.type==="url_open"&&window.open(fe.url,"_blank")}catch(fe){console.error("[Shell] Error handling WebSocket message:",fe,de.data)}},x.current.onclose=de=>{a(!1),w(!1),p.current&&(p.current.clear(),p.current.write("\x1B[2J\x1B[H"))},x.current.onerror=de=>{a(!1),w(!1)}}catch{a(!1),w(!1)}},[f,h]),E=n.useCallback(()=>{!i||h||f||(w(!0),M())},[i,h,f,M]),$=n.useCallback(()=>{x.current&&(x.current.readyState===WebSocket.OPEN&&x.current.send(JSON.stringify({type:"terminate"})),x.current.close(),x.current=null),p.current&&(p.current.clear(),p.current.write("\x1B[2J\x1B[H")),a(!1),w(!1)},[]),T=n.useMemo(()=>o?o.summary||"New Session":null,[o]),X=n.useMemo(()=>T?T.slice(0,30):null,[T]),_=n.useMemo(()=>T?T.slice(0,50):null,[T]),te=()=>{k(!0),x.current&&(x.current.readyState===WebSocket.OPEN&&x.current.send(JSON.stringify({type:"terminate"})),x.current.close(),x.current=null),p.current&&(p.current.dispose(),p.current=null,t.current=null),a(!1),g(!1),setTimeout(()=>{k(!1)},200)};return n.useEffect(()=>{const ne=o?.id||null;b!==null&&b!==ne&&i&&$(),j(ne)},[o?.id,i,$]),n.useEffect(()=>{if(!s.current||!r||v||p.current)return;p.current=new Qn.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,allowTransparency:!1,convertEol:!0,scrollback:1e4,tabStopWidth:4,windowsMode:!1,macOptionIsMeta:!0,macOptionClickForcesSelection:!1,theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selection:"#264f78",selectionForeground:"#ffffff",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff",extendedAnsi:["#000000","#800000","#008000","#808000","#000080","#800080","#008080","#c0c0c0","#808080","#ff0000","#00ff00","#ffff00","#0000ff","#ff00ff","#00ffff","#ffffff"]}}),t.current=new eo.FitAddon;const ne=new to.WebglAddon,G=new ro.WebLinksAddon;p.current.loadAddon(t.current),p.current.loadAddon(G);try{p.current.loadAddon(ne)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}p.current.open(s.current),p.current.attachCustomKeyEventHandler(de=>(de.ctrlKey||de.metaKey)&&de.key==="c"&&p.current.hasSelection()?(document.execCommand("copy"),!1):(de.ctrlKey||de.metaKey)&&de.key==="v"?(navigator.clipboard.readText().then(fe=>{x.current&&x.current.readyState===WebSocket.OPEN&&x.current.send(JSON.stringify({type:"input",data:fe}))}).catch(()=>{}),!1):!0),setTimeout(()=>{t.current&&(t.current.fit(),p.current&&x.current&&x.current.readyState===WebSocket.OPEN&&x.current.send(JSON.stringify({type:"resize",cols:p.current.cols,rows:p.current.rows})))},100),g(!0),p.current.onData(de=>{x.current&&x.current.readyState===WebSocket.OPEN&&x.current.send(JSON.stringify({type:"input",data:de}))});const le=new ResizeObserver(()=>{t.current&&p.current&&setTimeout(()=>{t.current.fit(),x.current&&x.current.readyState===WebSocket.OPEN&&x.current.send(JSON.stringify({type:"resize",cols:p.current.cols,rows:p.current.rows}))},50)});return s.current&&le.observe(s.current),()=>{le.disconnect(),x.current&&(x.current.readyState===WebSocket.OPEN||x.current.readyState===WebSocket.CONNECTING)&&x.current.close(),x.current=null,p.current&&(p.current.dispose(),p.current=null)}},[r?.path||r?.fullPath,v]),n.useEffect(()=>{!d||!i||f||h||E()},[d,i,f,h,E]),r?m?e.jsx("div",{className:"h-full w-full bg-gray-900",children:e.jsx("div",{ref:s,className:"h-full w-full focus:outline-none",style:{outline:"none"}})}):e.jsxs("div",{className:"h-full flex flex-col bg-gray-900 w-full",children:[e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${h?"bg-green-500":"bg-red-500"}`}),o&&e.jsxs("span",{className:"text-xs text-blue-300",children:["(",X,"...)"]}),!o&&e.jsx("span",{className:"text-xs text-gray-400",children:"(新会话)"}),!i&&e.jsx("span",{className:"text-xs text-yellow-400",children:"(正在初始化...)"}),v&&e.jsx("span",{className:"text-xs text-blue-400",children:"(正在重启...)"})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[h&&e.jsxs("button",{onClick:$,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700 flex items-center space-x-1",title:"断开 Shell 连接",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),e.jsx("span",{children:"断开连接"})]}),e.jsxs("button",{onClick:te,disabled:v||h,className:"text-xs text-gray-400 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",title:"重启 Shell(先断开连接)",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),e.jsx("span",{children:"重启"})]})]})]})}),e.jsxs("div",{className:"flex-1 p-2 overflow-hidden relative",children:[e.jsx("div",{ref:s,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),!i&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:e.jsx("div",{className:"text-white",children:"加载终端中..."})}),i&&!h&&!f&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("button",{onClick:E,className:"px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors flex items-center justify-center space-x-2 text-base font-medium w-full sm:w-auto",title:"Connect to shell",children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),e.jsx("span",{children:"在 Shell 中继续"})]}),e.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:u?`Run ${l||"command"} in ${r.displayName}`:o?`Resume session: ${_}...`:"Start a new Claude session"})]})}),f&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[e.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),e.jsx("span",{className:"text-base font-medium",children:"连接到 Shell..."})]}),e.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:u?`Running ${l||"command"} in ${r.displayName}`:`Starting Claude CLI in ${r.displayName}`})]})})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"选择项目"}),e.jsx("p",{children:"选择一个项目以在该目录中打开交互式 Shell"})]})})}function Pl({project:r,session:o=null,command:l=null,isPlainShell:u=null,autoConnect:c=!0,onComplete:m=null,onClose:d=null,title:s=null,className:p="",showHeader:t=!0,compact:x=!1,minimal:h=!1}){const[a,i]=n.useState(!1),g=u!==null?u:l!==null,v=n.useCallback(k=>{i(!0),m&&m(k)},[m]);return r?e.jsxs("div",{className:`h-full w-full flex flex-col ${p}`,children:[!h&&t&&s&&e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-200",children:s}),a&&e.jsx("span",{className:"text-xs text-green-400",children:"(已完成)"})]}),d&&e.jsx("button",{onClick:d,className:"text-gray-400 hover:text-white",title:"关闭",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),e.jsx("div",{className:"flex-1 w-full min-h-0",children:e.jsx(Dl,{selectedProject:r,selectedSession:o,initialCommand:l,isPlainShell:g,onProcessComplete:v,minimal:h,autoConnect:h?!0:c})})]}):e.jsx("div",{className:`h-full flex items-center justify-center ${p}`,children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未选择项目"}),e.jsx("p",{children:"打开 Shell 需要一个项目"})]})})}function Al({selectedProject:r,minimal:o=!1,autoConnect:l=!1}){const u=n.useRef(null),c=n.useRef(null),m=n.useRef(null),d=n.useRef(null),[s,p]=n.useState(!1),[t,x]=n.useState(!1),[h,a]=n.useState(!1),[i,g]=n.useState(!1),v=n.useRef(r);n.useEffect(()=>{v.current=r});const k=n.useCallback(async()=>{if(!(i||s))try{const w=localStorage.getItem("auth-token");if(!w){console.error("No authentication token found for Codex WebSocket connection");return}const z=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/codex?token=${encodeURIComponent(w)}`;d.current=new WebSocket(z),d.current.onopen=()=>{p(!0),g(!1),setTimeout(()=>{m.current&&c.current&&(m.current.fit(),d.current.send(JSON.stringify({type:"init",projectPath:v.current.fullPath||v.current.path,cols:c.current.cols,rows:c.current.rows})))},100)},d.current.onmessage=D=>{try{const N=JSON.parse(D.data);N.type==="output"?c.current&&c.current.write(N.data):N.type==="url_open"&&window.open(N.url,"_blank")}catch(N){console.error("[CodexShell] Error handling WebSocket message:",N)}},d.current.onclose=()=>{p(!1),g(!1),c.current&&(c.current.clear(),c.current.write("\x1B[2J\x1B[H"))},d.current.onerror=()=>{p(!1),g(!1)}}catch{p(!1),g(!1)}},[i,s]),b=n.useCallback(()=>{!t||s||i||(g(!0),k())},[t,s,i,k]),j=n.useCallback(()=>{d.current&&(d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"terminate"})),d.current.close(),d.current=null),c.current&&(c.current.clear(),c.current.write("\x1B[2J\x1B[H")),p(!1),g(!1)},[]),f=()=>{a(!0),d.current&&(d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"terminate"})),d.current.close(),d.current=null),c.current&&(c.current.dispose(),c.current=null,m.current=null),p(!1),x(!1),setTimeout(()=>a(!1),200)};return n.useEffect(()=>{if(!u.current||!r||h||c.current)return;c.current=new Qn.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,allowTransparency:!1,convertEol:!0,scrollback:1e4,tabStopWidth:4,windowsMode:!1,macOptionIsMeta:!0,macOptionClickForcesSelection:!1,theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selection:"#264f78",selectionForeground:"#ffffff",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff"}}),m.current=new eo.FitAddon;const w=new to.WebglAddon,S=new ro.WebLinksAddon;c.current.loadAddon(m.current),c.current.loadAddon(S);try{c.current.loadAddon(w)}catch{console.warn("[CodexShell] WebGL renderer unavailable, using Canvas fallback")}c.current.open(u.current),c.current.attachCustomKeyEventHandler(D=>(D.ctrlKey||D.metaKey)&&D.key==="c"&&c.current.hasSelection()?(document.execCommand("copy"),!1):(D.ctrlKey||D.metaKey)&&D.key==="v"?(navigator.clipboard.readText().then(N=>{d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"input",data:N}))}).catch(()=>{}),!1):!0),setTimeout(()=>{m.current&&(m.current.fit(),c.current&&d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:c.current.cols,rows:c.current.rows})))},100),x(!0),c.current.onData(D=>{d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"input",data:D}))});const z=new ResizeObserver(()=>{m.current&&c.current&&setTimeout(()=>{m.current.fit(),d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:c.current.cols,rows:c.current.rows}))},50)});return u.current&&z.observe(u.current),()=>{z.disconnect(),d.current&&(d.current.readyState===WebSocket.OPEN||d.current.readyState===WebSocket.CONNECTING)&&d.current.close(),d.current=null,c.current&&(c.current.dispose(),c.current=null)}},[r?.path||r?.fullPath,h]),n.useEffect(()=>{!l||!t||i||s||b()},[l,t,i,s,b]),r?o?e.jsx("div",{className:"h-full w-full bg-gray-900",children:e.jsx("div",{ref:u,className:"h-full w-full focus:outline-none",style:{outline:"none"}})}):e.jsxs("div",{className:"h-full flex flex-col bg-gray-900 w-full",children:[e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${s?"bg-green-500":"bg-red-500"}`}),e.jsx("span",{className:"text-xs text-gray-300 font-medium",children:"Codex"}),!t&&e.jsx("span",{className:"text-xs text-yellow-400",children:"(正在初始化...)"}),h&&e.jsx("span",{className:"text-xs text-blue-400",children:"(正在重启...)"})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[s&&e.jsxs("button",{onClick:j,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700 flex items-center space-x-1",title:"断开 Codex 连接",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),e.jsx("span",{children:"断开连接"})]}),e.jsxs("button",{onClick:f,disabled:h||s,className:"text-xs text-gray-400 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",title:"重启 Codex(先断开连接)",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),e.jsx("span",{children:"重启"})]})]})]})}),e.jsxs("div",{className:"flex-1 p-2 overflow-hidden relative",children:[e.jsx("div",{ref:u,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),!t&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:e.jsx("div",{className:"text-white",children:"加载终端中..."})}),t&&!s&&!i&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("button",{onClick:b,className:"px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors flex items-center justify-center space-x-2 text-base font-medium w-full sm:w-auto",children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),e.jsx("span",{children:"启动 Codex"})]}),e.jsxs("p",{className:"text-gray-400 text-sm mt-3 px-2",children:["在 ",r.displayName," 中启动 Codex CLI"]})]})}),i&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[e.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),e.jsx("span",{className:"text-base font-medium",children:"连接到 Codex..."})]}),e.jsxs("p",{className:"text-gray-400 text-sm mt-3 px-2",children:["正在 ",r.displayName," 中启动 Codex CLI"]})]})})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"选择项目"}),e.jsx("p",{children:"选择一个项目以在该目录中打开 Codex"})]})})}function Ll({project:r,autoConnect:o=!0,onClose:l=null,className:u="",showHeader:c=!0,minimal:m=!1}){return r?e.jsxs("div",{className:`h-full w-full flex flex-col ${u}`,children:[!m&&c&&l&&e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-200",children:"Codex"}),e.jsx("button",{onClick:l,className:"text-gray-400 hover:text-white",title:"关闭",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),e.jsx("div",{className:"flex-1 w-full min-h-0",children:e.jsx(Al,{selectedProject:r,minimal:m,autoConnect:m?!0:o})})]}):e.jsx("div",{className:`h-full flex items-center justify-center ${u}`,children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未选择项目"}),e.jsx("p",{children:"打开 Codex 需要一个项目"})]})})}function _l({selectedProject:r,minimal:o=!1,autoConnect:l=!1}){const u=n.useRef(null),c=n.useRef(null),m=n.useRef(null),d=n.useRef(null),[s,p]=n.useState(!1),[t,x]=n.useState(!1),[h,a]=n.useState(!1),[i,g]=n.useState(!1),v=n.useRef(r);n.useEffect(()=>{v.current=r});const k=n.useCallback(async()=>{if(!(i||s))try{const w=localStorage.getItem("auth-token");if(!w){console.error("No authentication token found for Gemini WebSocket connection");return}const z=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/gemini?token=${encodeURIComponent(w)}`;d.current=new WebSocket(z),d.current.onopen=()=>{p(!0),g(!1),setTimeout(()=>{m.current&&c.current&&(m.current.fit(),d.current.send(JSON.stringify({type:"init",projectPath:v.current.fullPath||v.current.path,cols:c.current.cols,rows:c.current.rows})))},100)},d.current.onmessage=D=>{try{const N=JSON.parse(D.data);N.type==="output"?c.current&&c.current.write(N.data):N.type==="url_open"&&window.open(N.url,"_blank")}catch(N){console.error("[GeminiShell] Error handling WebSocket message:",N)}},d.current.onclose=()=>{p(!1),g(!1),c.current&&(c.current.clear(),c.current.write("\x1B[2J\x1B[H"))},d.current.onerror=()=>{p(!1),g(!1)}}catch{p(!1),g(!1)}},[i,s]),b=n.useCallback(()=>{!t||s||i||(g(!0),k())},[t,s,i,k]),j=n.useCallback(()=>{d.current&&(d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"terminate"})),d.current.close(),d.current=null),c.current&&(c.current.clear(),c.current.write("\x1B[2J\x1B[H")),p(!1),g(!1)},[]),f=()=>{a(!0),d.current&&(d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"terminate"})),d.current.close(),d.current=null),c.current&&(c.current.dispose(),c.current=null,m.current=null),p(!1),x(!1),setTimeout(()=>a(!1),200)};return n.useEffect(()=>{if(!u.current||!r||h||c.current)return;c.current=new Qn.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,allowTransparency:!1,convertEol:!0,scrollback:1e4,tabStopWidth:4,windowsMode:!1,macOptionIsMeta:!0,macOptionClickForcesSelection:!1,theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selection:"#264f78",selectionForeground:"#ffffff",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff"}}),m.current=new eo.FitAddon;const w=new to.WebglAddon,S=new ro.WebLinksAddon;c.current.loadAddon(m.current),c.current.loadAddon(S);try{c.current.loadAddon(w)}catch{console.warn("[GeminiShell] WebGL renderer unavailable, using Canvas fallback")}c.current.open(u.current),c.current.attachCustomKeyEventHandler(D=>(D.ctrlKey||D.metaKey)&&D.key==="c"&&c.current.hasSelection()?(document.execCommand("copy"),!1):(D.ctrlKey||D.metaKey)&&D.key==="v"?(navigator.clipboard.readText().then(N=>{d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"input",data:N}))}).catch(()=>{}),!1):!0),setTimeout(()=>{m.current&&(m.current.fit(),c.current&&d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:c.current.cols,rows:c.current.rows})))},100),x(!0),c.current.onData(D=>{d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"input",data:D}))});const z=new ResizeObserver(()=>{m.current&&c.current&&setTimeout(()=>{m.current.fit(),d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:c.current.cols,rows:c.current.rows}))},50)});return u.current&&z.observe(u.current),()=>{z.disconnect(),d.current&&(d.current.readyState===WebSocket.OPEN||d.current.readyState===WebSocket.CONNECTING)&&d.current.close(),d.current=null,c.current&&(c.current.dispose(),c.current=null)}},[r?.path||r?.fullPath,h]),n.useEffect(()=>{!l||!t||i||s||b()},[l,t,i,s,b]),r?o?e.jsx("div",{className:"h-full w-full bg-gray-900",children:e.jsx("div",{ref:u,className:"h-full w-full focus:outline-none",style:{outline:"none"}})}):e.jsxs("div",{className:"h-full flex flex-col bg-gray-900 w-full",children:[e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${s?"bg-green-500":"bg-red-500"}`}),e.jsx("span",{className:"text-xs text-gray-300 font-medium",children:"Gemini"}),!t&&e.jsx("span",{className:"text-xs text-yellow-400",children:"(正在初始化...)"}),h&&e.jsx("span",{className:"text-xs text-blue-400",children:"(正在重启...)"})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[s&&e.jsxs("button",{onClick:j,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700 flex items-center space-x-1",title:"断开 Gemini 连接",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),e.jsx("span",{children:"断开连接"})]}),e.jsxs("button",{onClick:f,disabled:h||s,className:"text-xs text-gray-400 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",title:"重启 Gemini(先断开连接)",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),e.jsx("span",{children:"重启"})]})]})]})}),e.jsxs("div",{className:"flex-1 p-2 overflow-hidden relative",children:[e.jsx("div",{ref:u,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),!t&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:e.jsx("div",{className:"text-white",children:"加载终端中..."})}),t&&!s&&!i&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("button",{onClick:b,className:"px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors flex items-center justify-center space-x-2 text-base font-medium w-full sm:w-auto",children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),e.jsx("span",{children:"启动 Gemini"})]}),e.jsxs("p",{className:"text-gray-400 text-sm mt-3 px-2",children:["在 ",r.displayName," 中启动 Gemini CLI"]})]})}),i&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[e.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),e.jsx("span",{className:"text-base font-medium",children:"连接到 Gemini..."})]}),e.jsxs("p",{className:"text-gray-400 text-sm mt-3 px-2",children:["正在 ",r.displayName," 中启动 Gemini CLI"]})]})})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"选择项目"}),e.jsx("p",{children:"选择一个项目以在该目录中打开 Gemini"})]})})}function Il({project:r,autoConnect:o=!0,onClose:l=null,className:u="",showHeader:c=!0,minimal:m=!1}){return r?e.jsxs("div",{className:`h-full w-full flex flex-col ${u}`,children:[!m&&c&&l&&e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-200",children:"Gemini"}),e.jsx("button",{onClick:l,className:"text-gray-400 hover:text-white",title:"关闭",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),e.jsx("div",{className:"flex-1 w-full min-h-0",children:e.jsx(_l,{selectedProject:r,minimal:m,autoConnect:m?!0:o})})]}):e.jsx("div",{className:`h-full flex items-center justify-center ${u}`,children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未选择项目"}),e.jsx("p",{children:"打开 Gemini 需要一个项目"})]})})}class zl extends mt.Component{constructor(o){super(o),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(o){return{hasError:!0}}componentDidCatch(o,l){console.error("ErrorBoundary caught an error:",o,l),this.setState({error:o,errorInfo:l})}render(){return this.state.hasError?e.jsx("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 max-w-md",children:[e.jsxs("div",{className:"flex items-center mb-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),e.jsx("h3",{className:"ml-3 text-sm font-medium text-red-800",children:"出现问题"})]}),e.jsxs("div",{className:"text-sm text-red-700",children:[e.jsx("p",{className:"mb-2",children:"加载聊天界面时出现错误。"}),this.props.showDetails&&this.state.error&&e.jsxs("details",{className:"mt-4",children:[e.jsx("summary",{className:"cursor-pointer text-xs font-mono",children:"错误详情"}),e.jsxs("pre",{className:"mt-2 text-xs bg-red-100 p-2 rounded overflow-auto max-h-40",children:[this.state.error.toString(),this.state.errorInfo&&this.state.errorInfo.componentStack]})]})]}),e.jsx("div",{className:"mt-4",children:e.jsx("button",{onClick:()=>{this.setState({hasError:!1,error:null,errorInfo:null}),this.props.onRetry&&this.props.onRetry()},className:"bg-red-600 text-white px-4 py-2 rounded text-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500",children:"重试"})})]})}):this.props.children}}const Nr=({children:r,content:o,position:l="top",className:u="",delay:c=500})=>{const[m,d]=n.useState(!1),[s,p]=n.useState(null),t=()=>{const i=setTimeout(()=>{d(!0)},c);p(i)},x=()=>{s&&(clearTimeout(s),p(null)),d(!1)},h=()=>{switch(l){case"top":return"bottom-full left-1/2 transform -translate-x-1/2 mb-2";case"bottom":return"top-full left-1/2 transform -translate-x-1/2 mt-2";case"left":return"right-full top-1/2 transform -translate-y-1/2 mr-2";case"right":return"left-full top-1/2 transform -translate-y-1/2 ml-2";default:return"bottom-full left-1/2 transform -translate-x-1/2 mb-2"}},a=()=>{switch(l){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}};return o?e.jsxs("div",{className:"relative inline-block",onMouseEnter:t,onMouseLeave:x,children:[r,m&&e.jsxs("div",{className:ot("absolute z-50 px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",h(),u),children:[o,e.jsx("div",{className:ot("absolute w-0 h-0 border-4 border-transparent",a())})]})]}):r};function Rl(){const[r,o]=n.useState(null),[l,u]=n.useState([]),[c,m]=n.useState(!1),d=n.useRef(null),s=n.useRef(null),p=n.useRef(0),{token:t}=Ot();n.useEffect(()=>{d.current&&(clearTimeout(d.current),d.current=null),s.current&&(s.current.close(),s.current=null),t?(p.current=0,x()):(m(!1),o(null));const a=()=>{if(document.visibilityState==="visible"){const i=s.current?.readyState;(i===void 0||i===3||i===2)&&(d.current&&(clearTimeout(d.current),d.current=null),p.current=0,x())}};return document.addEventListener("visibilitychange",a),()=>{document.removeEventListener("visibilitychange",a),d.current&&clearTimeout(d.current),s.current&&s.current.close()}},[t]);const x=()=>{try{const a=t||localStorage.getItem("auth-token");if(!a){console.warn("No authentication token found for WebSocket connection");return}const g=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws?token=${encodeURIComponent(a)}`,v=new WebSocket(g);s.current=v,v.onopen=()=>{p.current=0,m(!0),o(v)},v.onmessage=k=>{try{const b=JSON.parse(k.data);u(j=>[...j,b])}catch(b){console.error("Error parsing WebSocket message:",b)}},v.onclose=()=>{if(m(!1),o(null),s.current=null,localStorage.getItem("auth-token")){const b=Math.min(1e3*Math.pow(2,p.current),15e3);p.current+=1,d.current=setTimeout(()=>{x()},b)}},v.onerror=k=>{console.error("WebSocket error:",k)}}catch(a){console.error("Error creating WebSocket connection:",a)}};return{ws:r,sendMessage:a=>{r&&c?r.send(JSON.stringify(a)):console.warn("WebSocket not connected")},messages:l,isConnected:c}}const Ds=n.createContext({ws:null,sendMessage:()=>{},messages:[],isConnected:!1}),Ps=()=>{const r=n.useContext(Ds);if(!r)throw new Error("useWebSocketContext must be used within a WebSocketProvider");return r},$l=({children:r})=>{const o=Rl();return e.jsx(Ds.Provider,{value:o,children:r})};function Wl({selectedProject:r,selectedSession:o,activeTab:l,setActiveTab:u,ws:c,sendMessage:m,messages:d,isMobile:s,isPWA:p,onMenuClick:t,isLoading:x,onInputFocusChange:h,onSessionActive:a,onSessionInactive:i,onSessionProcessing:g,onSessionNotProcessing:v,processingSessions:k,onReplaceTemporarySession:b,onNavigateToSession:j,onShowSettings:f,autoScrollToBottom:w,sendByCtrlEnter:S,externalMessageUpdate:z,limitStatus:D,onLimitBlocked:N,checkLimitStatus:R}){const{showConfirm:M}=lt(),{hasPermission:E}=Ot(),{isConnected:$}=Ps(),[T,X]=n.useState(null),[_,te]=n.useState(null),[ne,G]=n.useState(600),[le,de]=n.useState(!1),[fe,Ee]=n.useState(!1),ge=n.useRef(null),Me=async he=>{const Oe="previewTabAcknowledged";if(!localStorage.getItem(Oe)){const De=await M("此功能的对话记录不会显示在当前网页的会话列表中,与 Chat 是两套独立的系统,请注意区分。",{title:"预览功能提示",subtitle:he==="codex"?"Codex":"Gemini CLI",variant:"warning",confirmText:"我知道了,继续",cancelText:"取消",checkboxLabel:"不再提醒"});if(!De?.confirmed)return;De.checked&&localStorage.setItem(Oe,"1")}u(he)};n.useEffect(()=>{l==="shell"&&R&&R()},[l,R]);const Fe=["png","jpg","jpeg","gif","svg","webp","ico","bmp"],ae=(he,Oe=null)=>{const De=he.split(".").pop()?.toLowerCase();if(Fe.includes(De)){te({name:he.split("/").pop(),path:he,projectName:r?.name,projectPath:r?.path});return}const Ye={name:he.split("/").pop(),path:he,projectName:r?.name,diffInfo:Oe};X(Ye)},Ne=()=>{X(null),Ee(!1)},He=()=>{Ee(!fe)},Be=he=>{s||(de(!0),he.preventDefault())};return n.useEffect(()=>{const he=De=>{if(!le)return;const Ye=ge.current?.parentElement;if(!Ye)return;const Te=Ye.getBoundingClientRect(),Je=Te.right-De.clientX,Ce=300,Re=Te.width*.8;Je>=Ce&&Je<=Re&&G(Je)},Oe=()=>{de(!1)};return le&&(document.addEventListener("mousemove",he),document.addEventListener("mouseup",Oe),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",Oe),document.body.style.cursor="",document.body.style.userSelect=""}},[le]),x?e.jsxs("div",{className:"h-full flex flex-col",children:[s&&e.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:e.jsx("button",{onClick:t,className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-4",children:e.jsx("div",{className:"w-full h-full rounded-full border-4 border-gray-200 border-t-blue-500",style:{animation:"spin 1s linear infinite",WebkitAnimation:"spin 1s linear infinite",MozAnimation:"spin 1s linear infinite"}})}),e.jsxs("h2",{className:"text-xl font-semibold mb-2",children:["正在加载 ",Ve]}),e.jsx("p",{children:"正在设置您的工作区..."})]})})]}):r?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between relative",children:[e.jsxs("div",{className:"flex items-center space-x-2 min-w-0 flex-1",children:[s&&e.jsx("button",{onClick:t,onTouchStart:he=>{he.preventDefault(),t()},className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 touch-manipulation active:scale-95 pwa-menu-button flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),e.jsx("div",{className:"min-w-0 flex items-center gap-2 flex-1 overflow-x-auto scrollbar-hide",children:e.jsx("div",{className:"min-w-0 flex-1",children:l==="chat"&&o?e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white whitespace-nowrap overflow-x-auto scrollbar-hide",children:o.summary||"新会话"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:r.displayName}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-xs ${$?"text-green-600 dark:text-green-400":"text-red-500 dark:text-red-400 animate-pulse"}`,children:[$?e.jsx("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.288 15.038a5.25 5.25 0 017.424 0M5.106 11.856c3.807-3.808 9.98-3.808 13.788 0M1.924 8.674c5.565-5.565 14.587-5.565 20.152 0M12.53 18.22l-.53.53-.53-.53a.75.75 0 011.06 0z"})}):e.jsx("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.412 15.655L9.75 21.75l3.745-4.012M9.257 13.5H3.75l2.659-2.849m2.048-2.194L14.25 2.25 12 10.5h8.25l-4.707 5.043M6.53 9.345A3.778 3.778 0 0112 8.25c1.372 0 2.585.59 3.43 1.53M3 3l18 18"})}),e.jsx("span",{className:"hidden sm:inline",children:$?"连接正常":"连接异常"})]})]})]}):l==="chat"&&!o?e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white",children:"新会话"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:r.displayName}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-xs ${$?"text-green-600 dark:text-green-400":"text-red-500 dark:text-red-400 animate-pulse"}`,children:[$?e.jsx("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.288 15.038a5.25 5.25 0 017.424 0M5.106 11.856c3.807-3.808 9.98-3.808 13.788 0M1.924 8.674c5.565-5.565 14.587-5.565 20.152 0M12.53 18.22l-.53.53-.53-.53a.75.75 0 011.06 0z"})}):e.jsx("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.412 15.655L9.75 21.75l3.745-4.012M9.257 13.5H3.75l2.659-2.849m2.048-2.194L14.25 2.25 12 10.5h8.25l-4.707 5.043M6.53 9.345A3.778 3.778 0 0112 8.25c1.372 0 2.585.59 3.43 1.53M3 3l18 18"})}),e.jsx("span",{className:"hidden sm:inline",children:$?"连接正常":"连接异常"})]})]})]}):e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white",children:l==="files"?"项目文件":"项目"}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:r.displayName})]})})})]}),e.jsx("div",{className:"flex-shrink-0 hidden sm:block",children:e.jsxs("div",{className:"relative flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[e.jsx(Nr,{content:"Chat",position:"bottom",children:e.jsx("button",{onClick:()=>u("chat"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md ${l==="chat"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[e.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),e.jsx("span",{className:"hidden md:hidden lg:inline",children:"Chat"})]})})}),e.jsx(Nr,{content:"Files",position:"bottom",children:e.jsx("button",{onClick:()=>u("files"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${l==="files"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[e.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})}),e.jsx("span",{className:"hidden md:hidden lg:inline",children:"Files"})]})})}),E("claude_shell")&&e.jsx(Nr,{content:D&&!D.allowed?"使用已达上限":"Claude Code",position:"bottom",children:e.jsx("button",{onClick:()=>{if(D&&!D.allowed){N?.(D.reason);return}u("shell")},className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${D&&!D.allowed?"opacity-50 cursor-not-allowed text-gray-400 dark:text-gray-500":l==="shell"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[e.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z",fill:"#D97757",fillRule:"nonzero"})}),e.jsx("span",{className:"hidden md:hidden lg:inline",children:"Claude Code"})]})})}),E("codex_shell")&&e.jsx(Nr,{content:"Codex",position:"bottom",children:e.jsx("button",{onClick:()=>Me("codex"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${l==="codex"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[e.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"})}),e.jsx("span",{className:"hidden md:hidden lg:inline",children:"Codex"})]})})}),E("gemini_shell")&&e.jsx(Nr,{content:"Gemini CLI",position:"bottom",children:e.jsx("button",{onClick:()=>Me("gemini"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${l==="gemini"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[e.jsxs("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"#3186FF"}),e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#gemini-tab-fill-0)"}),e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#gemini-tab-fill-1)"}),e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#gemini-tab-fill-2)"}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"gemini-tab-fill-0",x1:"7",x2:"11",y1:"15.5",y2:"12",children:[e.jsx("stop",{stopColor:"#08B962"}),e.jsx("stop",{offset:"1",stopColor:"#08B962",stopOpacity:"0"})]}),e.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"gemini-tab-fill-1",x1:"8",x2:"11.5",y1:"5.5",y2:"11",children:[e.jsx("stop",{stopColor:"#F94543"}),e.jsx("stop",{offset:"1",stopColor:"#F94543",stopOpacity:"0"})]}),e.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"gemini-tab-fill-2",x1:"3.5",x2:"17.5",y1:"13.5",y2:"12",children:[e.jsx("stop",{stopColor:"#FABC12"}),e.jsx("stop",{offset:".46",stopColor:"#FABC12",stopOpacity:"0"})]})]})]}),e.jsx("span",{className:"hidden md:hidden lg:inline",children:"Gemini CLI"})]})})})]})})]})}),e.jsxs("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[e.jsxs("div",{className:`flex-1 flex flex-col min-h-0 overflow-hidden ${T?"mr-0":""} ${fe?"hidden":""}`,children:[e.jsx("div",{className:`h-full ${l==="chat"?"block":"hidden"}`,children:e.jsx(zl,{showDetails:!0,children:e.jsx(Ol,{selectedProject:r,selectedSession:o,ws:c,sendMessage:m,messages:d,onFileOpen:ae,onInputFocusChange:h,onSessionActive:a,onSessionInactive:i,onSessionProcessing:g,onSessionNotProcessing:v,processingSessions:k,onReplaceTemporarySession:b,onNavigateToSession:j,onShowSettings:f,autoScrollToBottom:w,sendByCtrlEnter:S,externalMessageUpdate:z,limitStatus:D,onLimitExceeded:N,checkLimitStatus:R})})}),l==="files"&&e.jsx("div",{className:"h-full overflow-hidden",children:e.jsx(Cl,{selectedProject:r})}),l==="shell"&&e.jsxs("div",{className:"h-full w-full overflow-hidden relative",children:[e.jsx(Pl,{project:r,session:o,showHeader:!1}),D&&!D.allowed&&e.jsx("div",{className:"absolute inset-0 bg-black/60 z-50 flex items-center justify-center",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-xl p-6 mx-4 max-w-md text-center",children:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-red-100 dark:bg-red-900/30 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-6 h-6 text-red-600 dark:text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-2",children:D.reason==="total_limit_exceeded"?"使用上限已达到":"今日使用上限已达到"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:D.reason==="total_limit_exceeded"?"您已达到使用上限,请联系管理员提升额度。":"您已达到今日使用上限,请明日再来或联系管理员提升额度。"}),e.jsx("button",{onClick:()=>u("chat"),className:"px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",children:"返回 Chat"})]})})]}),l==="codex"&&e.jsx("div",{className:"h-full w-full overflow-hidden relative",children:e.jsx(Ll,{project:r,showHeader:!1})}),l==="gemini"&&e.jsx("div",{className:"h-full w-full overflow-hidden relative",children:e.jsx(Il,{project:r,showHeader:!1})}),e.jsx("div",{className:`h-full overflow-hidden ${l==="preview"?"block":"hidden"}`})]}),T&&!s&&e.jsxs(e.Fragment,{children:[!fe&&e.jsx("div",{ref:ge,onMouseDown:Be,className:"flex-shrink-0 w-1 bg-gray-200 dark:bg-gray-700 hover:bg-blue-500 dark:hover:bg-blue-600 cursor-col-resize transition-colors relative group",title:"Drag to resize",children:e.jsx("div",{className:"absolute inset-y-0 left-1/2 -translate-x-1/2 w-1 bg-blue-500 dark:bg-blue-600 opacity-0 group-hover:opacity-100 transition-opacity"})}),e.jsx("div",{className:`flex-shrink-0 border-l border-gray-200 dark:border-gray-700 h-full overflow-hidden ${fe?"flex-1":""}`,style:fe?{}:{width:`${ne}px`},children:e.jsx(Fn,{file:T,onClose:Ne,projectPath:r?.path,isSidebar:!0,isExpanded:fe,onToggleExpand:He})})]})]}),T&&s&&e.jsx(Fn,{file:T,onClose:Ne,projectPath:r?.path,isSidebar:!1}),_&&e.jsx(Es,{file:_,onClose:()=>te(null)})]}):e.jsxs("div",{className:"h-full flex flex-col",children:[s&&e.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:e.jsx("button",{onClick:t,className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 max-w-md mx-auto px-6",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-6 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})})}),e.jsx("h2",{className:"text-2xl font-semibold mb-3 text-gray-900 dark:text-white",children:"选择您的项目"}),e.jsxs("p",{className:"text-gray-600 dark:text-gray-300 mb-6 leading-relaxed",children:["从侧边栏选择一个项目,开始与 ",Ve," 进行交流。每个项目包含您的聊天会话和文件历史。"]}),e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:e.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:["💡 ",e.jsx("strong",{children:"提示:"})," ",s?"点击上方菜单按钮访问项目":E("create_project")?"点击侧边栏中的文件夹图标创建新项目":"点击侧边栏中的「使用项目模板」按钮来创建项目"]})})]})})]})}const Fl=mt.memo(Wl);function Hl({activeTab:r,setActiveTab:o,isInputFocused:l}){const u=[{id:"chat",icon:Er,onClick:()=>o("chat")},{id:"shell",icon:Gn,onClick:()=>o("shell")},{id:"files",icon:Zt,onClick:()=>o("files")}];return e.jsx("div",{className:`fixed bottom-0 left-0 right-0 bg-background border-t border-border z-50 ios-bottom-safe transform transition-transform duration-300 ease-in-out shadow-lg ${l?"translate-y-full":"translate-y-0"}`,children:e.jsx("div",{className:"flex items-center justify-around py-1",children:u.map(c=>{const m=c.icon,d=r===c.id;return e.jsxs("button",{onClick:c.onClick,onTouchStart:s=>{s.preventDefault(),c.onClick()},className:`flex items-center justify-center p-2 rounded-lg min-h-[40px] min-w-[40px] relative touch-manipulation ${d?"text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,"aria-label":c.id,children:[e.jsx(m,{className:"w-5 h-5"}),d&&e.jsx("div",{className:"absolute top-0 left-1/2 transform -translate-x-1/2 w-6 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-full"})]},c.id)})})})}const As=n.createContext(),no=()=>{const r=n.useContext(As);if(!r)throw new Error("useTheme must be used within a ThemeProvider");return r},Bl=({children:r})=>{const[o,l]=n.useState(()=>{const m=localStorage.getItem("theme");return m?m==="dark":window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches:!1});n.useEffect(()=>{if(o){document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark");const m=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');m&&m.setAttribute("content","black-translucent");const d=document.querySelector('meta[name="theme-color"]');d&&d.setAttribute("content","#0c1117")}else{document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light");const m=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');m&&m.setAttribute("content","default");const d=document.querySelector('meta[name="theme-color"]');d&&d.setAttribute("content","#ffffff")}},[o]),n.useEffect(()=>{if(!window.matchMedia)return;const m=window.matchMedia("(prefers-color-scheme: dark)"),d=s=>{localStorage.getItem("theme")||l(s.matches)};return m.addEventListener("change",d),()=>m.removeEventListener("change",d)},[]);const c={isDarkMode:o,toggleDarkMode:()=>{l(m=>!m)}};return e.jsx(As.Provider,{value:c,children:r})},Ul=["Bash(git log:*)","Bash(git diff:*)","Bash(git status:*)","Write","Read","Edit","Glob","Grep","MultiEdit","Task","TodoWrite","TodoRead","WebFetch","WebSearch"];function Gl({skipPermissions:r,setSkipPermissions:o,allowedTools:l,setAllowedTools:u,disallowedTools:c,setDisallowedTools:m,newAllowedTool:d,setNewAllowedTool:s,newDisallowedTool:p,setNewDisallowedTool:t}){const x=g=>{g&&!l.includes(g)&&(u([...l,g]),s(""))},h=g=>{u(l.filter(v=>v!==g))},a=g=>{g&&!c.includes(g)&&(m([...c,g]),t(""))},i=g=>{m(c.filter(v=>v!==g))};return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"bg-sky-50 dark:bg-sky-900/20 border border-sky-200 dark:border-sky-800 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(en,{className:"w-5 h-5 text-sky-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-sky-800 dark:text-sky-200",children:[e.jsx("span",{className:"font-medium",children:"提示:"}),"此权限设置仅对 ",e.jsx("span",{className:"font-medium",children:"Chat(聊天)"})," 生效,对 ",e.jsx("span",{className:"font-medium",children:"Shell(终端)"})," 无效。Shell 是直接的系统终端,不受此权限控制。"]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Bt,{className:"w-5 h-5 text-orange-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"权限设置"})]}),e.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:e.jsxs("label",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:r,onChange:g=>o(g.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500 focus:ring-2"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:"跳过权限提示(请谨慎使用)"}),e.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:"等同于 --dangerously-skip-permissions 标志"})]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Gt,{className:"w-5 h-5 text-green-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"允许的工具"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"自动允许而不提示权限的工具"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(ct,{value:d,onChange:g=>s(g.target.value),placeholder:'e.g., "Bash(git log:*)" or "Write"',onKeyPress:g=>{g.key==="Enter"&&(g.preventDefault(),x(d))},className:"flex-1 h-10"}),e.jsxs(U,{onClick:()=>x(d),disabled:!d,size:"sm",className:"h-10 px-4",children:[e.jsx(zt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:"添加"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"快速添加常用工具:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Ul.map(g=>e.jsx(U,{variant:"outline",size:"sm",onClick:()=>x(g),disabled:l.includes(g),className:"text-xs h-8",children:g},g))})]}),e.jsxs("div",{className:"space-y-2",children:[l.map(g=>e.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:g}),e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>h(g),className:"text-green-600 hover:text-green-700",children:e.jsx(Ge,{className:"w-4 h-4"})})]},g)),l.length===0&&e.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:"未配置允许的工具"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Bt,{className:"w-5 h-5 text-red-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"阻止的工具"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"自动阻止而不提示权限的工具"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(ct,{value:p,onChange:g=>t(g.target.value),placeholder:'e.g., "Bash(rm:*)"',onKeyPress:g=>{g.key==="Enter"&&(g.preventDefault(),a(p))},className:"flex-1 h-10"}),e.jsxs(U,{onClick:()=>a(p),disabled:!p,size:"sm",className:"h-10 px-4",children:[e.jsx(zt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:"添加"})]})]}),e.jsxs("div",{className:"space-y-2",children:[c.map(g=>e.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:g}),e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>i(g),className:"text-red-600 hover:text-red-700",children:e.jsx(Ge,{className:"w-4 h-4"})})]},g)),c.length===0&&e.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:"未配置阻止的工具"})]})]}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"工具模式示例:"}),e.jsxs("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git log:*)"'})," - 允许所有 git log 命令"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git diff:*)"'})," - 允许所有 git diff 命令"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Write"'})," - 允许所有 Write 工具使用"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(rm:*)"'})," - 阻止所有 rm 命令(危险)"]})]})]})]})}function Yl({permissionMode:r,setPermissionMode:o}){return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Gt,{className:"w-5 h-5 text-green-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"权限模式"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"控制 Codex 如何处理文件修改和命令执行"}),e.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${r==="default"?"bg-gray-100 dark:bg-gray-800 border-gray-400 dark:border-gray-500":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>o("default"),children:e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"codexPermissionMode",checked:r==="default",onChange:()=>o("default"),className:"mt-1 w-4 h-4 text-green-600"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"默认"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"仅受信任的命令(ls、cat、grep、git status 等)会自动运行。其他命令将被跳过。可以写入工作区。"})]})]})}),e.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${r==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 border-green-400 dark:border-green-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>o("acceptEdits"),children:e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"codexPermissionMode",checked:r==="acceptEdits",onChange:()=>o("acceptEdits"),className:"mt-1 w-4 h-4 text-green-600"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-green-900 dark:text-green-100",children:"接受编辑"}),e.jsx("div",{className:"text-sm text-green-700 dark:text-green-300",children:"所有命令在工作区内自动运行。沙盒执行的完全自动模式。"})]})]})}),e.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${r==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 border-orange-400 dark:border-orange-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>o("bypassPermissions"),children:e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"codexPermissionMode",checked:r==="bypassPermissions",onChange:()=>o("bypassPermissions"),className:"mt-1 w-4 h-4 text-orange-600"}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-orange-900 dark:text-orange-100 flex items-center gap-2",children:["跳过权限",e.jsx(Bt,{className:"w-4 h-4"})]}),e.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:"无限制的完全系统访问。所有命令自动运行,具有完全的磁盘和网络访问权限。请谨慎使用。"})]})]})}),e.jsxs("details",{className:"text-sm",children:[e.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"技术详情"}),e.jsxs("div",{className:"mt-2 p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg text-xs text-muted-foreground space-y-2",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Default:"})," sandboxMode=workspace-write, approvalPolicy=untrusted. Trusted commands: cat, cd, grep, head, ls, pwd, tail, git status/log/diff/show, find (without -exec), etc."]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Accept Edits:"})," sandboxMode=workspace-write, approvalPolicy=never. All commands auto-execute within project directory."]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Bypass Permissions:"})," sandboxMode=danger-full-access, approvalPolicy=never. Full system access, use only in trusted environments."]}),e.jsx("p",{className:"text-xs opacity-75",children:"您可以在聊天界面中使用模式按钮为每个会话覆盖此设置。"})]})]})]})})}function Jl({agent:r,...o}){return r==="claude"?e.jsx(Gl,{...o}):r==="codex"?e.jsx(Yl,{...o}):null}const ql=r=>{switch(r){case"stdio":return e.jsx(Gn,{className:"w-4 h-4"});case"sse":return e.jsx(Cr,{className:"w-4 h-4"});case"http":return e.jsx(mr,{className:"w-4 h-4"});default:return e.jsx(tn,{className:"w-4 h-4"})}};function Kl({servers:r,onAdd:o,onEdit:l,onDelete:u,testResults:c,serverTools:m,onDiscoverRepo:d}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(tn,{className:"w-5 h-5 text-purple-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"MCP 服务器"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Model Context Protocol 服务器为 ",Ve," 提供额外的工具和数据源"]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs(U,{onClick:o,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[e.jsx(zt,{className:"w-4 h-4 mr-2"}),"添加 MCP 服务器"]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(U,{onClick:d,variant:"outline",size:"sm",children:[e.jsx(rn,{className:"w-4 h-4 mr-2"}),"MCP 商店"]})})]}),e.jsxs("div",{className:"space-y-2",children:[r.map(s=>e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[ql(s.type),e.jsx("span",{className:"font-medium text-foreground",children:s.name}),e.jsx(nt,{variant:"outline",className:"text-xs",children:s.type}),e.jsx(nt,{variant:"outline",className:"text-xs",title:s.scope==="local"&&s.projectPath?s.projectPath:void 0,children:s.scope==="local"?`local${s.projectPath?` · ${s.projectPath.split("/").filter(Boolean).pop()}`:""}`:s.scope==="user"?"user":s.scope})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[s.type==="stdio"&&s.config?.command&&e.jsxs("div",{children:["命令:",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.command})]}),(s.type==="sse"||s.type==="http")&&s.config?.url&&e.jsxs("div",{children:["URL:",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.url})]}),s.config?.args&&s.config.args.length>0&&e.jsxs("div",{children:["参数:",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.args.join(" ")})]})]}),c?.[s.id]&&e.jsx("div",{className:`mt-2 p-2 rounded text-xs ${c[s.id].success?"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200":"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200"}`,children:e.jsx("div",{className:"font-medium",children:c[s.id].message})}),m?.[s.id]&&m[s.id].tools?.length>0&&e.jsxs("div",{className:"mt-2 p-2 rounded text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-200",children:[e.jsxs("div",{className:"font-medium",children:["工具(",m[s.id].tools.length,"):"]}),e.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[m[s.id].tools.slice(0,5).map((p,t)=>e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:p.name},t)),m[s.id].tools.length>5&&e.jsxs("span",{className:"text-xs opacity-75",children:["+",m[s.id].tools.length-5," 更多"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx(U,{onClick:()=>l(s),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:"编辑服务器",children:e.jsx(En,{className:"w-4 h-4"})}),e.jsx(U,{onClick:()=>u(s.id,s.scope,s.projectPath),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:"删除服务器",children:e.jsx(vt,{className:"w-4 h-4"})})]})]})},`${s.scope}:${s.projectPath||""}:${s.id}`)),r.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"未配置 MCP 服务器"})]})]})}function Vl(r){return e.jsx(Kl,{...r})}const Zl=[{key:"ANTHROPIC_DEFAULT_OPUS_MODEL",label:"Opus 模型",placeholder:"例如: claude-opus-4-6",description:"覆盖 opus 别名使用的模型,Plan Mode 激活时也用于 opusplan"},{key:"ANTHROPIC_DEFAULT_SONNET_MODEL",label:"Sonnet 模型",placeholder:"例如: claude-sonnet-4-5-20250929",description:"覆盖 sonnet 别名使用的模型,Plan Mode 未激活时也用于 opusplan"},{key:"ANTHROPIC_DEFAULT_HAIKU_MODEL",label:"Haiku 模型",placeholder:"例如: claude-haiku-4-5-20251001",description:"覆盖 haiku 别名使用的模型,也用于后台功能"},{key:"CLAUDE_CODE_SUBAGENT_MODEL",label:"Subagent 模型",placeholder:"例如: claude-haiku-4-5-20251001",description:"覆盖子代理(subagents)使用的模型"}],Ql=n.forwardRef(function({onStatusChange:o},l){const[u,c]=n.useState({}),[m,d]=n.useState({}),[s,p]=n.useState(!0),[t,x]=n.useState(!1),[h,a]=n.useState(null),[i,g]=n.useState(null),v=JSON.stringify(u)!==JSON.stringify(m);n.useEffect(()=>{o?.({saving:t,hasChanges:v})},[t,v,o]),n.useEffect(()=>{k()},[]),n.useEffect(()=>{if(h){const f=setTimeout(()=>a(null),3e3);return()=>clearTimeout(f)}},[h]);const k=async()=>{try{p(!0),g(null);const f=await J("/api/settings/models");if(f.ok){const w=await f.json();c(w.models||{}),d(w.models||{})}else{const w=await f.json();g(w.error||"加载模型配置失败")}}catch(f){g(f.message)}finally{p(!1)}},b=async()=>{try{x(!0),a(null);const f=await J("/api/settings/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({models:u})});if(f.ok)return a("success"),d({...u}),!0;{const w=await f.json();return a("error"),g(w.error||"保存失败"),!1}}catch(f){return a("error"),g(f.message),!1}finally{x(!1)}},j=()=>{c({...m}),a(null)};return n.useImperativeHandle(l,()=>({save:b,reset:j,get hasChanges(){return v},get saving(){return t}}),[v,t,u,m]),s?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500"}),e.jsx("span",{className:"ml-3 text-sm text-muted-foreground",children:"加载模型配置..."})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-3",children:[e.jsx(en,{className:"w-4 h-4 text-blue-500 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[e.jsxs("p",{children:["自定义模型 ID 来覆盖 ",Ve," 和 Claude Code 使用的默认模型。留空表示使用默认模型。"]}),e.jsx("p",{className:"mt-1 text-blue-600 dark:text-blue-400",children:"非 Claude 模型将按 Sonnet 定价计费,但统计中会记录实际模型 ID。"})]})]}),i&&e.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3 text-sm text-red-600 dark:text-red-400",children:i}),h==="success"&&e.jsx("div",{className:"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3 text-sm text-green-600 dark:text-green-400",children:"模型配置已保存"}),Zl.map(f=>e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"font-medium text-sm text-foreground",children:f.label}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:f.description})]}),e.jsx("input",{type:"text",value:u[f.key]||"",onChange:w=>c(S=>({...S,[f.key]:w.target.value})),placeholder:f.placeholder,className:"w-full text-sm bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 px-3 py-2"}),e.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:f.key})]})},f.key))]})});function ec({onClose:r,onInstalled:o,onOpenRepoManager:l,projects:u=[]}){const{showAlert:c}=lt(),[m,d]=n.useState([]),[s,p]=n.useState([]),[t,x]=n.useState(!0),[h,a]=n.useState(null),[i,g]=n.useState(""),[v,k]=n.useState("all"),[b,j]=n.useState(null),[f,w]=n.useState(null),[S,z]=n.useState("user"),[D,N]=n.useState("");n.useEffect(()=>{R()},[]);const R=async(X=!1)=>{try{x(!0),a(null),X&&await J("/api/skills/repos/refresh",{method:"POST"});const[_,te]=await Promise.all([J("/api/skills/available"),J("/api/skills/repos")]);if(_.ok){const ne=await _.json();d(ne.skills||[])}if(te.ok){const ne=await te.json();p(ne.repos||[])}}catch(_){a(_.message)}finally{x(!1)}},M=X=>{w(X),z("user"),N("")},E=()=>{w(null),z("user"),N("")},$=async()=>{const X=f;if(X){if(S==="local"&&!D){c("请选择要安装到的项目",{variant:"warning"});return}try{w(null),j(X.name);const _={skillPath:X.path};S==="local"&&D&&(_.projectPath=D);const te=await J(`/api/skills/install/${X.name}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)});if(te.ok)d(ne=>ne.map(G=>G.name===X.name?{...G,installed:!0}:G)),o?.();else{const ne=await te.json();c(ne.error||"安装技能失败",{variant:"error"})}}catch(_){c(_.message,{variant:"error"})}finally{j(null),z("user"),N("")}}},T=m.filter(X=>{if(i){const _=i.toLowerCase();if(!X.name.toLowerCase().includes(_)&&!X.title?.toLowerCase().includes(_)&&!X.description?.toLowerCase().includes(_))return!1}return!(v!=="all"&&X.repository!==v)});return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-background rounded-xl shadow-xl w-full max-w-4xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Skills 管理"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(U,{variant:"ghost",size:"sm",onClick:()=>R(!0),disabled:t,children:[e.jsx(st,{className:`w-4 h-4 ${t?"animate-spin":""}`}),e.jsx("span",{className:"ml-1 hidden sm:inline",children:"刷新"})]}),e.jsxs(U,{variant:"ghost",size:"sm",onClick:l,children:[e.jsx(Ut,{className:"w-4 h-4"}),e.jsx("span",{className:"ml-1 hidden sm:inline",children:"仓库管理"})]}),e.jsx(U,{variant:"ghost",size:"icon",onClick:r,children:e.jsx(Ge,{className:"w-5 h-5"})})]})]}),e.jsx("div",{className:"px-4 pt-4 pb-2"}),e.jsxs("div",{className:"px-4 pb-4 flex flex-wrap gap-3",children:[e.jsx("div",{className:"flex-1 min-w-[200px]",children:e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(ct,{type:"text",placeholder:"搜索技能名称或描述...",value:i,onChange:X=>g(X.target.value),className:"pl-10"})]})}),e.jsxs("select",{value:v,onChange:X=>k(X.target.value),className:"px-3 py-2 rounded-md border border-border bg-background text-foreground text-sm min-w-[120px]",children:[e.jsx("option",{value:"all",children:"全部"}),s.map(X=>e.jsxs("option",{value:`${X.owner}/${X.repo}`,children:[X.owner,"/",X.repo]},`${X.owner}/${X.repo}`))]})]}),e.jsxs("div",{className:"flex-1 overflow-auto px-4 pb-4",children:[h&&e.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-800 dark:text-red-200 text-sm mb-4",children:h}),t?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):T.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:m.length===0?e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"没有可用的技能"}),e.jsx("p",{className:"text-xs mt-2",children:"请先添加技能仓库"}),e.jsxs(U,{variant:"outline",size:"sm",className:"mt-4",onClick:l,children:[e.jsx(Ut,{className:"w-4 h-4 mr-2"}),"管理仓库"]})]}):e.jsx("p",{children:"没有找到匹配的技能"})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:T.map(X=>{const _=b===X.name,te=f?.name===X.name;return e.jsx("div",{className:"border border-border rounded-lg p-4 hover:border-amber-500/50 transition-colors",children:e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"mb-2",children:[e.jsx("h4",{className:"font-medium text-foreground",children:X.title||X.name}),e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:["skills/",X.name]}),e.jsx(nt,{variant:"outline",className:"text-xs ml-2",children:X.repository})]})]}),X.description&&e.jsx("p",{className:"text-sm text-muted-foreground flex-1 line-clamp-3 mb-3",children:X.description}),te&&e.jsxs("div",{className:"mt-2 mb-3 p-3 rounded-lg bg-muted/50 border border-border text-sm",children:[e.jsx("p",{className:"font-medium text-foreground mb-2",children:"选择安装位置"}),e.jsxs("label",{className:"flex items-center gap-2 mb-1 cursor-pointer",children:[e.jsx("input",{type:"radio",name:`scope-${X.name}`,value:"user",checked:S==="user",onChange:()=>{z("user"),N("")},className:"accent-amber-600"}),e.jsx("span",{className:"text-foreground",children:"全局(所有项目可用)"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"radio",name:`scope-${X.name}`,value:"local",checked:S==="local",onChange:()=>z("local"),className:"accent-amber-600"}),e.jsx("span",{className:"text-foreground",children:"安装到指定项目"})]}),S==="local"&&e.jsxs("select",{value:D,onChange:ne=>N(ne.target.value),className:"mt-2 w-full px-2 py-1.5 rounded-md border border-border bg-background text-foreground text-xs",children:[e.jsx("option",{value:"",children:"选择项目..."}),u.map(ne=>e.jsx("option",{value:ne.path||ne.fullPath,children:ne.displayName||ne.name},ne.name))]}),e.jsxs("div",{className:"flex gap-2 mt-3",children:[e.jsx(U,{size:"sm",variant:"outline",onClick:E,className:"flex-1",children:"取消"}),e.jsx(U,{size:"sm",className:"bg-amber-600 hover:bg-amber-700 text-white flex-1",onClick:$,children:"确认安装"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-auto pt-2",children:[e.jsxs(U,{variant:"ghost",size:"sm",onClick:()=>window.open(`https://github.com/${X.repository}`,"_blank"),children:[e.jsx(rs,{className:"w-4 h-4 mr-1"}),"查看"]}),X.installed?e.jsx(U,{size:"sm",disabled:!0,variant:"outline",className:"ml-auto",children:"已安装"}):!te&&e.jsxs(U,{size:"sm",className:"bg-amber-600 hover:bg-amber-700 text-white ml-auto",onClick:()=>M(X),disabled:_||!!f,children:[e.jsx(It,{className:"w-4 h-4 mr-1"}),_?"安装中...":"安装"]})]})]})},`${X.repository}-${X.name}`)})})]})]})})}function tc({onClose:r,onChanged:o}){const{showAlert:l,showConfirm:u}=lt(),[c,m]=n.useState([]),[d,s]=n.useState(!0),[p,t]=n.useState(null),[x,h]=n.useState(""),[a,i]=n.useState("main"),[g,v]=n.useState(!1),[k,b]=n.useState(null);n.useEffect(()=>{j()},[]);const j=async()=>{try{s(!0),t(null);const S=await J("/api/skills/repos");if(S.ok){const z=await S.json();m(z.repos||[])}else{const z=await S.json();t(z.error||"Failed to fetch repos")}}catch(S){t(S.message)}finally{s(!1)}},f=async S=>{if(S.preventDefault(),!x.trim()){t("请输入仓库 URL");return}try{v(!0),t(null);const z=await J("/api/skills/repos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:x.trim(),branch:a.trim()||"main"})});if(z.ok)h(""),i("main"),j(),o?.();else{const D=await z.json();t(D.error||"Failed to add repo")}}catch(z){t(z.message)}finally{v(!1)}},w=async(S,z)=>{if(await u(`确定要移除仓库 "${S}/${z}" 吗?`,{title:"移除仓库",variant:"danger",confirmText:"确认移除"}))try{b(`${S}/${z}`);const D=await J(`/api/skills/repos/${S}/${z}`,{method:"DELETE"});if(D.ok)j(),o?.();else{const N=await D.json();l(N.error||"移除仓库失败",{variant:"error"})}}catch(D){l(D.message,{variant:"error"})}finally{b(null)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-background rounded-xl shadow-xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 p-4 border-b border-border",children:[e.jsx(U,{variant:"ghost",size:"icon",onClick:r,children:e.jsx(Qt,{className:"w-5 h-5"})}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"管理技能仓库"})]}),e.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-6",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4 space-y-4",children:[e.jsx("h3",{className:"font-medium text-foreground",children:"添加技能仓库"}),e.jsxs("form",{onSubmit:f,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-muted-foreground mb-1",children:"仓库 URL"}),e.jsx(ct,{type:"text",placeholder:"owner/name 或 https://github.com/owner/name",value:x,onChange:S=>h(S.target.value),disabled:g})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-muted-foreground mb-1",children:"分支"}),e.jsx(ct,{type:"text",placeholder:"main",value:a,onChange:S=>i(S.target.value),disabled:g})]}),e.jsxs(U,{type:"submit",disabled:g||!x.trim(),className:"bg-amber-600 hover:bg-amber-700 text-white",children:[e.jsx(zt,{className:"w-4 h-4 mr-2"}),g?"添加中...":"添加仓库"]})]})]}),p&&e.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-800 dark:text-red-200 text-sm",children:p}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-medium text-foreground",children:"已添加的仓库"}),d?e.jsx("div",{className:"text-center py-4 text-muted-foreground",children:"加载中..."}):c.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(ns,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"还没有添加任何仓库"})]}):c.map(S=>e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-medium text-foreground",children:[S.owner,"/",S.repo]}),S.isSystem&&e.jsx(nt,{variant:"outline",className:"text-xs bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300",children:"内置"})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(rn,{className:"w-3 h-3"}),"分支: main"]}),e.jsxs(nt,{variant:"outline",className:"text-xs",children:["识别到 ",S.skillCount," 个技能"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[!S.isSystem&&S.url&&e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>window.open(S.url,"_blank"),children:e.jsx(rs,{className:"w-4 h-4"})}),!S.isSystem&&e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>w(S.owner,S.repo),disabled:k===`${S.owner}/${S.repo}`,className:"text-red-500 hover:text-red-600",children:e.jsx(vt,{className:"w-4 h-4"})})]})]})},`${S.owner}/${S.repo}`))]})]})]})})}function rc({projects:r=[]}){const{showAlert:o,showConfirm:l}=lt(),[u,c]=n.useState([]),[m,d]=n.useState(!0),[s,p]=n.useState(null),[t,x]=n.useState(!1),[h,a]=n.useState(!1),[i,g]=n.useState(!1),[v,k]=n.useState(null),b=n.useRef(null);n.useEffect(()=>{j()},[]);const j=async()=>{try{d(!0),p(null);const M=await J("/api/skills");if(M.ok){const E=await M.json();c(E.skills||[])}else{const E=await M.json();p(E.error||"Failed to fetch skills")}}catch(M){p(M.message)}finally{d(!1)}},f=async()=>{try{const M=await J("/api/skills");if(M.ok){const E=await M.json();c(E.skills||[])}}catch{}},w=async M=>{try{const E=await J(`/api/skills/${M}/download`);if(!E.ok){const _=await E.json();o(_.error||"下载技能失败",{variant:"error"});return}const $=await E.blob(),T=URL.createObjectURL($),X=document.createElement("a");X.href=T,X.download=`${M}.zip`,X.click(),URL.revokeObjectURL(T)}catch(E){o(E.message,{variant:"error"})}},S=async M=>{if(await l(`确定要删除技能 "${M.name}" 吗?`,{title:"删除技能",variant:"danger",confirmText:"确认删除"}))try{const E=M.projectPath?`/api/skills/${M.name}?projectPath=${encodeURIComponent(M.projectPath)}`:`/api/skills/${M.name}`,$=await J(E,{method:"DELETE"});if($.ok)j();else{const T=await $.json();o(T.error||"删除技能失败",{variant:"error"})}}catch(E){o(E.message,{variant:"error"})}},z=async M=>{let E,$;if(M.syncType==="builtin"?($="同步修改到云端",E=`确定要将技能 "${M.name}" 的本地修改推送到共享仓库吗?
154
+ `;if(typeof document<"u"){const r=document.createElement("style");r.type="text/css",r.innerText=El,document.head.appendChild(r)}function Dl({selectedProject:r,selectedSession:o,initialCommand:l,isPlainShell:u=!1,onProcessComplete:c,minimal:m=!1,autoConnect:d=!1}){const s=n.useRef(null),p=n.useRef(null),t=n.useRef(null),x=n.useRef(null),[h,a]=n.useState(!1),[i,g]=n.useState(!1),[v,k]=n.useState(!1),[b,j]=n.useState(null),[f,w]=n.useState(!1),N=n.useRef(r),L=n.useRef(o),E=n.useRef(l),S=n.useRef(u),R=n.useRef(c);n.useEffect(()=>{N.current=r,L.current=o,E.current=l,S.current=u,R.current=c});const M=n.useCallback(async()=>{if(!(f||h))try{const ne=localStorage.getItem("auth-token");if(!ne){console.error("No authentication token found for Shell WebSocket connection");return}const le=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/shell?token=${encodeURIComponent(ne)}`;x.current=new WebSocket(le),x.current.onopen=()=>{a(!0),w(!1),setTimeout(()=>{t.current&&p.current&&(t.current.fit(),x.current.send(JSON.stringify({type:"init",projectPath:N.current.fullPath||N.current.path,sessionId:S.current?null:L.current?.id,hasSession:S.current?!1:!!L.current,provider:S.current?"plain-shell":L.current?.__provider||"claude",cols:p.current.cols,rows:p.current.rows,initialCommand:E.current,isPlainShell:S.current})))},100)},x.current.onmessage=de=>{try{const fe=JSON.parse(de.data);if(fe.type==="output"){let Ee=fe.data;if(S.current&&R.current){const ye=Ee.replace(/\x1b\[[0-9;]*m/g,"");if(ye.includes("Process exited with code 0"))R.current(0);else if(ye.match(/Process exited with code (\d+)/)){const Me=parseInt(ye.match(/Process exited with code (\d+)/)[1]);Me!==0&&R.current(Me)}}p.current&&p.current.write(Ee)}else fe.type==="url_open"&&window.open(fe.url,"_blank")}catch(fe){console.error("[Shell] Error handling WebSocket message:",fe,de.data)}},x.current.onclose=de=>{a(!1),w(!1),p.current&&(p.current.clear(),p.current.write("\x1B[2J\x1B[H"))},x.current.onerror=de=>{a(!1),w(!1)}}catch{a(!1),w(!1)}},[f,h]),D=n.useCallback(()=>{!i||h||f||(w(!0),M())},[i,h,f,M]),$=n.useCallback(()=>{x.current&&(x.current.readyState===WebSocket.OPEN&&x.current.send(JSON.stringify({type:"terminate"})),x.current.close(),x.current=null),p.current&&(p.current.clear(),p.current.write("\x1B[2J\x1B[H")),a(!1),w(!1)},[]),T=n.useMemo(()=>o?o.summary||"New Session":null,[o]),X=n.useMemo(()=>T?T.slice(0,30):null,[T]),_=n.useMemo(()=>T?T.slice(0,50):null,[T]),te=()=>{k(!0),x.current&&(x.current.readyState===WebSocket.OPEN&&x.current.send(JSON.stringify({type:"terminate"})),x.current.close(),x.current=null),p.current&&(p.current.dispose(),p.current=null,t.current=null),a(!1),g(!1),setTimeout(()=>{k(!1)},200)};return n.useEffect(()=>{const ne=o?.id||null;b!==null&&b!==ne&&i&&$(),j(ne)},[o?.id,i,$]),n.useEffect(()=>{if(!s.current||!r||v||p.current)return;p.current=new Qn.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,allowTransparency:!1,convertEol:!0,scrollback:1e4,tabStopWidth:4,windowsMode:!1,macOptionIsMeta:!0,macOptionClickForcesSelection:!1,theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selection:"#264f78",selectionForeground:"#ffffff",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff",extendedAnsi:["#000000","#800000","#008000","#808000","#000080","#800080","#008080","#c0c0c0","#808080","#ff0000","#00ff00","#ffff00","#0000ff","#ff00ff","#00ffff","#ffffff"]}}),t.current=new eo.FitAddon;const ne=new to.WebglAddon,Y=new ro.WebLinksAddon;p.current.loadAddon(t.current),p.current.loadAddon(Y);try{p.current.loadAddon(ne)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}p.current.open(s.current),p.current.attachCustomKeyEventHandler(de=>(de.ctrlKey||de.metaKey)&&de.key==="c"&&p.current.hasSelection()?(document.execCommand("copy"),!1):(de.ctrlKey||de.metaKey)&&de.key==="v"?(navigator.clipboard.readText().then(fe=>{x.current&&x.current.readyState===WebSocket.OPEN&&x.current.send(JSON.stringify({type:"input",data:fe}))}).catch(()=>{}),!1):!0),setTimeout(()=>{t.current&&(t.current.fit(),p.current&&x.current&&x.current.readyState===WebSocket.OPEN&&x.current.send(JSON.stringify({type:"resize",cols:p.current.cols,rows:p.current.rows})))},100),g(!0),p.current.onData(de=>{x.current&&x.current.readyState===WebSocket.OPEN&&x.current.send(JSON.stringify({type:"input",data:de}))});const le=new ResizeObserver(()=>{t.current&&p.current&&setTimeout(()=>{t.current.fit(),x.current&&x.current.readyState===WebSocket.OPEN&&x.current.send(JSON.stringify({type:"resize",cols:p.current.cols,rows:p.current.rows}))},50)});return s.current&&le.observe(s.current),()=>{le.disconnect(),x.current&&(x.current.readyState===WebSocket.OPEN||x.current.readyState===WebSocket.CONNECTING)&&x.current.close(),x.current=null,p.current&&(p.current.dispose(),p.current=null)}},[r?.path||r?.fullPath,v]),n.useEffect(()=>{!d||!i||f||h||D()},[d,i,f,h,D]),r?m?e.jsx("div",{className:"h-full w-full bg-gray-900",children:e.jsx("div",{ref:s,className:"h-full w-full focus:outline-none",style:{outline:"none"}})}):e.jsxs("div",{className:"h-full flex flex-col bg-gray-900 w-full",children:[e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${h?"bg-green-500":"bg-red-500"}`}),o&&e.jsxs("span",{className:"text-xs text-blue-300",children:["(",X,"...)"]}),!o&&e.jsx("span",{className:"text-xs text-gray-400",children:"(新会话)"}),!i&&e.jsx("span",{className:"text-xs text-yellow-400",children:"(正在初始化...)"}),v&&e.jsx("span",{className:"text-xs text-blue-400",children:"(正在重启...)"})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[h&&e.jsxs("button",{onClick:$,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700 flex items-center space-x-1",title:"断开 Shell 连接",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),e.jsx("span",{children:"断开连接"})]}),e.jsxs("button",{onClick:te,disabled:v||h,className:"text-xs text-gray-400 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",title:"重启 Shell(先断开连接)",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),e.jsx("span",{children:"重启"})]})]})]})}),e.jsxs("div",{className:"flex-1 p-2 overflow-hidden relative",children:[e.jsx("div",{ref:s,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),!i&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:e.jsx("div",{className:"text-white",children:"加载终端中..."})}),i&&!h&&!f&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("button",{onClick:D,className:"px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors flex items-center justify-center space-x-2 text-base font-medium w-full sm:w-auto",title:"Connect to shell",children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),e.jsx("span",{children:"在 Shell 中继续"})]}),e.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:u?`Run ${l||"command"} in ${r.displayName}`:o?`Resume session: ${_}...`:"Start a new Claude session"})]})}),f&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[e.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),e.jsx("span",{className:"text-base font-medium",children:"连接到 Shell..."})]}),e.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:u?`Running ${l||"command"} in ${r.displayName}`:`Starting Claude CLI in ${r.displayName}`})]})})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"选择项目"}),e.jsx("p",{children:"选择一个项目以在该目录中打开交互式 Shell"})]})})}function Pl({project:r,session:o=null,command:l=null,isPlainShell:u=null,autoConnect:c=!0,onComplete:m=null,onClose:d=null,title:s=null,className:p="",showHeader:t=!0,compact:x=!1,minimal:h=!1}){const[a,i]=n.useState(!1),g=u!==null?u:l!==null,v=n.useCallback(k=>{i(!0),m&&m(k)},[m]);return r?e.jsxs("div",{className:`h-full w-full flex flex-col ${p}`,children:[!h&&t&&s&&e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-200",children:s}),a&&e.jsx("span",{className:"text-xs text-green-400",children:"(已完成)"})]}),d&&e.jsx("button",{onClick:d,className:"text-gray-400 hover:text-white",title:"关闭",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),e.jsx("div",{className:"flex-1 w-full min-h-0",children:e.jsx(Dl,{selectedProject:r,selectedSession:o,initialCommand:l,isPlainShell:g,onProcessComplete:v,minimal:h,autoConnect:h?!0:c})})]}):e.jsx("div",{className:`h-full flex items-center justify-center ${p}`,children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未选择项目"}),e.jsx("p",{children:"打开 Shell 需要一个项目"})]})})}function Al({selectedProject:r,minimal:o=!1,autoConnect:l=!1}){const u=n.useRef(null),c=n.useRef(null),m=n.useRef(null),d=n.useRef(null),[s,p]=n.useState(!1),[t,x]=n.useState(!1),[h,a]=n.useState(!1),[i,g]=n.useState(!1),v=n.useRef(r);n.useEffect(()=>{v.current=r});const k=n.useCallback(async()=>{if(!(i||s))try{const w=localStorage.getItem("auth-token");if(!w){console.error("No authentication token found for Codex WebSocket connection");return}const L=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/codex?token=${encodeURIComponent(w)}`;d.current=new WebSocket(L),d.current.onopen=()=>{p(!0),g(!1),setTimeout(()=>{m.current&&c.current&&(m.current.fit(),d.current.send(JSON.stringify({type:"init",projectPath:v.current.fullPath||v.current.path,cols:c.current.cols,rows:c.current.rows})))},100)},d.current.onmessage=E=>{try{const S=JSON.parse(E.data);S.type==="output"?c.current&&c.current.write(S.data):S.type==="url_open"&&window.open(S.url,"_blank")}catch(S){console.error("[CodexShell] Error handling WebSocket message:",S)}},d.current.onclose=()=>{p(!1),g(!1),c.current&&(c.current.clear(),c.current.write("\x1B[2J\x1B[H"))},d.current.onerror=()=>{p(!1),g(!1)}}catch{p(!1),g(!1)}},[i,s]),b=n.useCallback(()=>{!t||s||i||(g(!0),k())},[t,s,i,k]),j=n.useCallback(()=>{d.current&&(d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"terminate"})),d.current.close(),d.current=null),c.current&&(c.current.clear(),c.current.write("\x1B[2J\x1B[H")),p(!1),g(!1)},[]),f=()=>{a(!0),d.current&&(d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"terminate"})),d.current.close(),d.current=null),c.current&&(c.current.dispose(),c.current=null,m.current=null),p(!1),x(!1),setTimeout(()=>a(!1),200)};return n.useEffect(()=>{if(!u.current||!r||h||c.current)return;c.current=new Qn.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,allowTransparency:!1,convertEol:!0,scrollback:1e4,tabStopWidth:4,windowsMode:!1,macOptionIsMeta:!0,macOptionClickForcesSelection:!1,theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selection:"#264f78",selectionForeground:"#ffffff",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff"}}),m.current=new eo.FitAddon;const w=new to.WebglAddon,N=new ro.WebLinksAddon;c.current.loadAddon(m.current),c.current.loadAddon(N);try{c.current.loadAddon(w)}catch{console.warn("[CodexShell] WebGL renderer unavailable, using Canvas fallback")}c.current.open(u.current),c.current.attachCustomKeyEventHandler(E=>(E.ctrlKey||E.metaKey)&&E.key==="c"&&c.current.hasSelection()?(document.execCommand("copy"),!1):(E.ctrlKey||E.metaKey)&&E.key==="v"?(navigator.clipboard.readText().then(S=>{d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"input",data:S}))}).catch(()=>{}),!1):!0),setTimeout(()=>{m.current&&(m.current.fit(),c.current&&d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:c.current.cols,rows:c.current.rows})))},100),x(!0),c.current.onData(E=>{d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"input",data:E}))});const L=new ResizeObserver(()=>{m.current&&c.current&&setTimeout(()=>{m.current.fit(),d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:c.current.cols,rows:c.current.rows}))},50)});return u.current&&L.observe(u.current),()=>{L.disconnect(),d.current&&(d.current.readyState===WebSocket.OPEN||d.current.readyState===WebSocket.CONNECTING)&&d.current.close(),d.current=null,c.current&&(c.current.dispose(),c.current=null)}},[r?.path||r?.fullPath,h]),n.useEffect(()=>{!l||!t||i||s||b()},[l,t,i,s,b]),r?o?e.jsx("div",{className:"h-full w-full bg-gray-900",children:e.jsx("div",{ref:u,className:"h-full w-full focus:outline-none",style:{outline:"none"}})}):e.jsxs("div",{className:"h-full flex flex-col bg-gray-900 w-full",children:[e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${s?"bg-green-500":"bg-red-500"}`}),e.jsx("span",{className:"text-xs text-gray-300 font-medium",children:"Codex"}),!t&&e.jsx("span",{className:"text-xs text-yellow-400",children:"(正在初始化...)"}),h&&e.jsx("span",{className:"text-xs text-blue-400",children:"(正在重启...)"})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[s&&e.jsxs("button",{onClick:j,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700 flex items-center space-x-1",title:"断开 Codex 连接",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),e.jsx("span",{children:"断开连接"})]}),e.jsxs("button",{onClick:f,disabled:h||s,className:"text-xs text-gray-400 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",title:"重启 Codex(先断开连接)",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),e.jsx("span",{children:"重启"})]})]})]})}),e.jsxs("div",{className:"flex-1 p-2 overflow-hidden relative",children:[e.jsx("div",{ref:u,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),!t&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:e.jsx("div",{className:"text-white",children:"加载终端中..."})}),t&&!s&&!i&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("button",{onClick:b,className:"px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors flex items-center justify-center space-x-2 text-base font-medium w-full sm:w-auto",children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),e.jsx("span",{children:"启动 Codex"})]}),e.jsxs("p",{className:"text-gray-400 text-sm mt-3 px-2",children:["在 ",r.displayName," 中启动 Codex CLI"]})]})}),i&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[e.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),e.jsx("span",{className:"text-base font-medium",children:"连接到 Codex..."})]}),e.jsxs("p",{className:"text-gray-400 text-sm mt-3 px-2",children:["正在 ",r.displayName," 中启动 Codex CLI"]})]})})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"选择项目"}),e.jsx("p",{children:"选择一个项目以在该目录中打开 Codex"})]})})}function Ll({project:r,autoConnect:o=!0,onClose:l=null,className:u="",showHeader:c=!0,minimal:m=!1}){return r?e.jsxs("div",{className:`h-full w-full flex flex-col ${u}`,children:[!m&&c&&l&&e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-200",children:"Codex"}),e.jsx("button",{onClick:l,className:"text-gray-400 hover:text-white",title:"关闭",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),e.jsx("div",{className:"flex-1 w-full min-h-0",children:e.jsx(Al,{selectedProject:r,minimal:m,autoConnect:m?!0:o})})]}):e.jsx("div",{className:`h-full flex items-center justify-center ${u}`,children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未选择项目"}),e.jsx("p",{children:"打开 Codex 需要一个项目"})]})})}function Il({selectedProject:r,minimal:o=!1,autoConnect:l=!1}){const u=n.useRef(null),c=n.useRef(null),m=n.useRef(null),d=n.useRef(null),[s,p]=n.useState(!1),[t,x]=n.useState(!1),[h,a]=n.useState(!1),[i,g]=n.useState(!1),v=n.useRef(r);n.useEffect(()=>{v.current=r});const k=n.useCallback(async()=>{if(!(i||s))try{const w=localStorage.getItem("auth-token");if(!w){console.error("No authentication token found for Gemini WebSocket connection");return}const L=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/gemini?token=${encodeURIComponent(w)}`;d.current=new WebSocket(L),d.current.onopen=()=>{p(!0),g(!1),setTimeout(()=>{m.current&&c.current&&(m.current.fit(),d.current.send(JSON.stringify({type:"init",projectPath:v.current.fullPath||v.current.path,cols:c.current.cols,rows:c.current.rows})))},100)},d.current.onmessage=E=>{try{const S=JSON.parse(E.data);S.type==="output"?c.current&&c.current.write(S.data):S.type==="url_open"&&window.open(S.url,"_blank")}catch(S){console.error("[GeminiShell] Error handling WebSocket message:",S)}},d.current.onclose=()=>{p(!1),g(!1),c.current&&(c.current.clear(),c.current.write("\x1B[2J\x1B[H"))},d.current.onerror=()=>{p(!1),g(!1)}}catch{p(!1),g(!1)}},[i,s]),b=n.useCallback(()=>{!t||s||i||(g(!0),k())},[t,s,i,k]),j=n.useCallback(()=>{d.current&&(d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"terminate"})),d.current.close(),d.current=null),c.current&&(c.current.clear(),c.current.write("\x1B[2J\x1B[H")),p(!1),g(!1)},[]),f=()=>{a(!0),d.current&&(d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"terminate"})),d.current.close(),d.current=null),c.current&&(c.current.dispose(),c.current=null,m.current=null),p(!1),x(!1),setTimeout(()=>a(!1),200)};return n.useEffect(()=>{if(!u.current||!r||h||c.current)return;c.current=new Qn.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,allowTransparency:!1,convertEol:!0,scrollback:1e4,tabStopWidth:4,windowsMode:!1,macOptionIsMeta:!0,macOptionClickForcesSelection:!1,theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selection:"#264f78",selectionForeground:"#ffffff",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff"}}),m.current=new eo.FitAddon;const w=new to.WebglAddon,N=new ro.WebLinksAddon;c.current.loadAddon(m.current),c.current.loadAddon(N);try{c.current.loadAddon(w)}catch{console.warn("[GeminiShell] WebGL renderer unavailable, using Canvas fallback")}c.current.open(u.current),c.current.attachCustomKeyEventHandler(E=>(E.ctrlKey||E.metaKey)&&E.key==="c"&&c.current.hasSelection()?(document.execCommand("copy"),!1):(E.ctrlKey||E.metaKey)&&E.key==="v"?(navigator.clipboard.readText().then(S=>{d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"input",data:S}))}).catch(()=>{}),!1):!0),setTimeout(()=>{m.current&&(m.current.fit(),c.current&&d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:c.current.cols,rows:c.current.rows})))},100),x(!0),c.current.onData(E=>{d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"input",data:E}))});const L=new ResizeObserver(()=>{m.current&&c.current&&setTimeout(()=>{m.current.fit(),d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"resize",cols:c.current.cols,rows:c.current.rows}))},50)});return u.current&&L.observe(u.current),()=>{L.disconnect(),d.current&&(d.current.readyState===WebSocket.OPEN||d.current.readyState===WebSocket.CONNECTING)&&d.current.close(),d.current=null,c.current&&(c.current.dispose(),c.current=null)}},[r?.path||r?.fullPath,h]),n.useEffect(()=>{!l||!t||i||s||b()},[l,t,i,s,b]),r?o?e.jsx("div",{className:"h-full w-full bg-gray-900",children:e.jsx("div",{ref:u,className:"h-full w-full focus:outline-none",style:{outline:"none"}})}):e.jsxs("div",{className:"h-full flex flex-col bg-gray-900 w-full",children:[e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${s?"bg-green-500":"bg-red-500"}`}),e.jsx("span",{className:"text-xs text-gray-300 font-medium",children:"Gemini"}),!t&&e.jsx("span",{className:"text-xs text-yellow-400",children:"(正在初始化...)"}),h&&e.jsx("span",{className:"text-xs text-blue-400",children:"(正在重启...)"})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[s&&e.jsxs("button",{onClick:j,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700 flex items-center space-x-1",title:"断开 Gemini 连接",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),e.jsx("span",{children:"断开连接"})]}),e.jsxs("button",{onClick:f,disabled:h||s,className:"text-xs text-gray-400 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",title:"重启 Gemini(先断开连接)",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),e.jsx("span",{children:"重启"})]})]})]})}),e.jsxs("div",{className:"flex-1 p-2 overflow-hidden relative",children:[e.jsx("div",{ref:u,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),!t&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:e.jsx("div",{className:"text-white",children:"加载终端中..."})}),t&&!s&&!i&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("button",{onClick:b,className:"px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors flex items-center justify-center space-x-2 text-base font-medium w-full sm:w-auto",children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),e.jsx("span",{children:"启动 Gemini"})]}),e.jsxs("p",{className:"text-gray-400 text-sm mt-3 px-2",children:["在 ",r.displayName," 中启动 Gemini CLI"]})]})}),i&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[e.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),e.jsx("span",{className:"text-base font-medium",children:"连接到 Gemini..."})]}),e.jsxs("p",{className:"text-gray-400 text-sm mt-3 px-2",children:["正在 ",r.displayName," 中启动 Gemini CLI"]})]})})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"选择项目"}),e.jsx("p",{children:"选择一个项目以在该目录中打开 Gemini"})]})})}function _l({project:r,autoConnect:o=!0,onClose:l=null,className:u="",showHeader:c=!0,minimal:m=!1}){return r?e.jsxs("div",{className:`h-full w-full flex flex-col ${u}`,children:[!m&&c&&l&&e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-200",children:"Gemini"}),e.jsx("button",{onClick:l,className:"text-gray-400 hover:text-white",title:"关闭",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),e.jsx("div",{className:"flex-1 w-full min-h-0",children:e.jsx(Il,{selectedProject:r,minimal:m,autoConnect:m?!0:o})})]}):e.jsx("div",{className:`h-full flex items-center justify-center ${u}`,children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未选择项目"}),e.jsx("p",{children:"打开 Gemini 需要一个项目"})]})})}class zl extends mt.Component{constructor(o){super(o),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(o){return{hasError:!0}}componentDidCatch(o,l){console.error("ErrorBoundary caught an error:",o,l),this.setState({error:o,errorInfo:l})}render(){return this.state.hasError?e.jsx("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 max-w-md",children:[e.jsxs("div",{className:"flex items-center mb-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),e.jsx("h3",{className:"ml-3 text-sm font-medium text-red-800",children:"出现问题"})]}),e.jsxs("div",{className:"text-sm text-red-700",children:[e.jsx("p",{className:"mb-2",children:"加载聊天界面时出现错误。"}),this.props.showDetails&&this.state.error&&e.jsxs("details",{className:"mt-4",children:[e.jsx("summary",{className:"cursor-pointer text-xs font-mono",children:"错误详情"}),e.jsxs("pre",{className:"mt-2 text-xs bg-red-100 p-2 rounded overflow-auto max-h-40",children:[this.state.error.toString(),this.state.errorInfo&&this.state.errorInfo.componentStack]})]})]}),e.jsx("div",{className:"mt-4",children:e.jsx("button",{onClick:()=>{this.setState({hasError:!1,error:null,errorInfo:null}),this.props.onRetry&&this.props.onRetry()},className:"bg-red-600 text-white px-4 py-2 rounded text-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500",children:"重试"})})]})}):this.props.children}}const Nr=({children:r,content:o,position:l="top",className:u="",delay:c=500})=>{const[m,d]=n.useState(!1),[s,p]=n.useState(null),t=()=>{const i=setTimeout(()=>{d(!0)},c);p(i)},x=()=>{s&&(clearTimeout(s),p(null)),d(!1)},h=()=>{switch(l){case"top":return"bottom-full left-1/2 transform -translate-x-1/2 mb-2";case"bottom":return"top-full left-1/2 transform -translate-x-1/2 mt-2";case"left":return"right-full top-1/2 transform -translate-y-1/2 mr-2";case"right":return"left-full top-1/2 transform -translate-y-1/2 ml-2";default:return"bottom-full left-1/2 transform -translate-x-1/2 mb-2"}},a=()=>{switch(l){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}};return o?e.jsxs("div",{className:"relative inline-block",onMouseEnter:t,onMouseLeave:x,children:[r,m&&e.jsxs("div",{className:ot("absolute z-50 px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",h(),u),children:[o,e.jsx("div",{className:ot("absolute w-0 h-0 border-4 border-transparent",a())})]})]}):r};function Rl(){const[r,o]=n.useState(null),[l,u]=n.useState([]),[c,m]=n.useState(!1),d=n.useRef(null),s=n.useRef(null),p=n.useRef(0),{token:t}=Ot();n.useEffect(()=>{d.current&&(clearTimeout(d.current),d.current=null),s.current&&(s.current.close(),s.current=null),t?(p.current=0,x()):(m(!1),o(null));const a=()=>{if(document.visibilityState==="visible"){const i=s.current?.readyState;(i===void 0||i===3||i===2)&&(d.current&&(clearTimeout(d.current),d.current=null),p.current=0,x())}};return document.addEventListener("visibilitychange",a),()=>{document.removeEventListener("visibilitychange",a),d.current&&clearTimeout(d.current),s.current&&s.current.close()}},[t]);const x=()=>{try{const a=t||localStorage.getItem("auth-token");if(!a){console.warn("No authentication token found for WebSocket connection");return}const g=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws?token=${encodeURIComponent(a)}`,v=new WebSocket(g);s.current=v,v.onopen=()=>{p.current=0,m(!0),o(v)},v.onmessage=k=>{try{const b=JSON.parse(k.data);u(j=>[...j,b])}catch(b){console.error("Error parsing WebSocket message:",b)}},v.onclose=()=>{if(m(!1),o(null),s.current=null,localStorage.getItem("auth-token")){const b=Math.min(1e3*Math.pow(2,p.current),15e3);p.current+=1,d.current=setTimeout(()=>{x()},b)}},v.onerror=k=>{console.error("WebSocket error:",k)}}catch(a){console.error("Error creating WebSocket connection:",a)}};return{ws:r,sendMessage:a=>{r&&c?r.send(JSON.stringify(a)):console.warn("WebSocket not connected")},messages:l,isConnected:c}}const Ds=n.createContext({ws:null,sendMessage:()=>{},messages:[],isConnected:!1}),Ps=()=>{const r=n.useContext(Ds);if(!r)throw new Error("useWebSocketContext must be used within a WebSocketProvider");return r},$l=({children:r})=>{const o=Rl();return e.jsx(Ds.Provider,{value:o,children:r})};function Wl({selectedProject:r,selectedSession:o,activeTab:l,setActiveTab:u,ws:c,sendMessage:m,messages:d,isMobile:s,isPWA:p,onMenuClick:t,isLoading:x,onInputFocusChange:h,onSessionActive:a,onSessionInactive:i,onSessionProcessing:g,onSessionNotProcessing:v,processingSessions:k,onReplaceTemporarySession:b,onNavigateToSession:j,onShowSettings:f,autoScrollToBottom:w,sendByCtrlEnter:N,externalMessageUpdate:L,limitStatus:E,onLimitBlocked:S,checkLimitStatus:R}){const{showConfirm:M}=lt(),{hasPermission:D}=Ot(),{isConnected:$}=Ps(),[T,X]=n.useState(null),[_,te]=n.useState(null),[ne,Y]=n.useState(600),[le,de]=n.useState(!1),[fe,Ee]=n.useState(!1),ye=n.useRef(null),Me=async he=>{const Oe="previewTabAcknowledged";if(!localStorage.getItem(Oe)){const De=await M("此功能的对话记录不会显示在当前网页的会话列表中,与 Chat 是两套独立的系统,请注意区分。",{title:"预览功能提示",subtitle:he==="codex"?"Codex":"Gemini CLI",variant:"warning",confirmText:"我知道了,继续",cancelText:"取消",checkboxLabel:"不再提醒"});if(!De?.confirmed)return;De.checked&&localStorage.setItem(Oe,"1")}u(he)};n.useEffect(()=>{l==="shell"&&R&&R()},[l,R]);const Fe=["png","jpg","jpeg","gif","svg","webp","ico","bmp"],ie=(he,Oe=null)=>{const De=he.split(".").pop()?.toLowerCase();if(Fe.includes(De)){te({name:he.split("/").pop(),path:he,projectName:r?.name,projectPath:r?.path});return}const Ye={name:he.split("/").pop(),path:he,projectName:r?.name,diffInfo:Oe};X(Ye)},Se=()=>{X(null),Ee(!1)},He=()=>{Ee(!fe)},Be=he=>{s||(de(!0),he.preventDefault())};return n.useEffect(()=>{const he=De=>{if(!le)return;const Ye=ye.current?.parentElement;if(!Ye)return;const Xe=Ye.getBoundingClientRect(),Je=Xe.right-De.clientX,Ce=300,_e=Xe.width*.8;Je>=Ce&&Je<=_e&&Y(Je)},Oe=()=>{de(!1)};return le&&(document.addEventListener("mousemove",he),document.addEventListener("mouseup",Oe),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",Oe),document.body.style.cursor="",document.body.style.userSelect=""}},[le]),x?e.jsxs("div",{className:"h-full flex flex-col",children:[s&&e.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:e.jsx("button",{onClick:t,className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-4",children:e.jsx("div",{className:"w-full h-full rounded-full border-4 border-gray-200 border-t-blue-500",style:{animation:"spin 1s linear infinite",WebkitAnimation:"spin 1s linear infinite",MozAnimation:"spin 1s linear infinite"}})}),e.jsxs("h2",{className:"text-xl font-semibold mb-2",children:["正在加载 ",Ve]}),e.jsx("p",{children:"正在设置您的工作区..."})]})})]}):r?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between relative",children:[e.jsxs("div",{className:"flex items-center space-x-2 min-w-0 flex-1",children:[s&&e.jsx("button",{onClick:t,onTouchStart:he=>{he.preventDefault(),t()},className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 touch-manipulation active:scale-95 pwa-menu-button flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),e.jsx("div",{className:"min-w-0 flex items-center gap-2 flex-1 overflow-x-auto scrollbar-hide",children:e.jsx("div",{className:"min-w-0 flex-1",children:l==="chat"&&o?e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white whitespace-nowrap overflow-x-auto scrollbar-hide",children:o.summary||"新会话"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:r.displayName}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-xs ${$?"text-green-600 dark:text-green-400":"text-red-500 dark:text-red-400 animate-pulse"}`,children:[$?e.jsx("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.288 15.038a5.25 5.25 0 017.424 0M5.106 11.856c3.807-3.808 9.98-3.808 13.788 0M1.924 8.674c5.565-5.565 14.587-5.565 20.152 0M12.53 18.22l-.53.53-.53-.53a.75.75 0 011.06 0z"})}):e.jsx("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.412 15.655L9.75 21.75l3.745-4.012M9.257 13.5H3.75l2.659-2.849m2.048-2.194L14.25 2.25 12 10.5h8.25l-4.707 5.043M6.53 9.345A3.778 3.778 0 0112 8.25c1.372 0 2.585.59 3.43 1.53M3 3l18 18"})}),e.jsx("span",{className:"hidden sm:inline",children:$?"连接正常":"连接异常"})]})]})]}):l==="chat"&&!o?e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white",children:"新会话"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:r.displayName}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-xs ${$?"text-green-600 dark:text-green-400":"text-red-500 dark:text-red-400 animate-pulse"}`,children:[$?e.jsx("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.288 15.038a5.25 5.25 0 017.424 0M5.106 11.856c3.807-3.808 9.98-3.808 13.788 0M1.924 8.674c5.565-5.565 14.587-5.565 20.152 0M12.53 18.22l-.53.53-.53-.53a.75.75 0 011.06 0z"})}):e.jsx("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.412 15.655L9.75 21.75l3.745-4.012M9.257 13.5H3.75l2.659-2.849m2.048-2.194L14.25 2.25 12 10.5h8.25l-4.707 5.043M6.53 9.345A3.778 3.778 0 0112 8.25c1.372 0 2.585.59 3.43 1.53M3 3l18 18"})}),e.jsx("span",{className:"hidden sm:inline",children:$?"连接正常":"连接异常"})]})]})]}):e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-sm sm:text-base font-semibold text-gray-900 dark:text-white",children:l==="files"?"项目文件":"项目"}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:r.displayName})]})})})]}),e.jsx("div",{className:"flex-shrink-0 hidden sm:block",children:e.jsxs("div",{className:"relative flex bg-gray-100 dark:bg-gray-800 rounded-lg p-1",children:[e.jsx(Nr,{content:"Chat",position:"bottom",children:e.jsx("button",{onClick:()=>u("chat"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md ${l==="chat"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[e.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),e.jsx("span",{className:"hidden md:hidden lg:inline",children:"Chat"})]})})}),e.jsx(Nr,{content:"Files",position:"bottom",children:e.jsx("button",{onClick:()=>u("files"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${l==="files"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[e.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})}),e.jsx("span",{className:"hidden md:hidden lg:inline",children:"Files"})]})})}),D("claude_shell")&&e.jsx(Nr,{content:E&&!E.allowed?"使用已达上限":"Claude Code",position:"bottom",children:e.jsx("button",{onClick:()=>{if(E&&!E.allowed){S?.(E.reason);return}u("shell")},className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${E&&!E.allowed?"opacity-50 cursor-not-allowed text-gray-400 dark:text-gray-500":l==="shell"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[e.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z",fill:"#D97757",fillRule:"nonzero"})}),e.jsx("span",{className:"hidden md:hidden lg:inline",children:"Claude Code"})]})})}),D("codex_shell")&&e.jsx(Nr,{content:"Codex",position:"bottom",children:e.jsx("button",{onClick:()=>Me("codex"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${l==="codex"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[e.jsx("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"})}),e.jsx("span",{className:"hidden md:hidden lg:inline",children:"Codex"})]})})}),D("gemini_shell")&&e.jsx(Nr,{content:"Gemini CLI",position:"bottom",children:e.jsx("button",{onClick:()=>Me("gemini"),className:`relative px-2 sm:px-3 py-1.5 text-xs sm:text-sm font-medium rounded-md transition-all duration-200 ${l==="gemini"?"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("span",{className:"flex items-center gap-1 sm:gap-1.5",children:[e.jsxs("svg",{className:"w-3 sm:w-3.5 h-3 sm:h-3.5",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"#3186FF"}),e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#gemini-tab-fill-0)"}),e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#gemini-tab-fill-1)"}),e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#gemini-tab-fill-2)"}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"gemini-tab-fill-0",x1:"7",x2:"11",y1:"15.5",y2:"12",children:[e.jsx("stop",{stopColor:"#08B962"}),e.jsx("stop",{offset:"1",stopColor:"#08B962",stopOpacity:"0"})]}),e.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"gemini-tab-fill-1",x1:"8",x2:"11.5",y1:"5.5",y2:"11",children:[e.jsx("stop",{stopColor:"#F94543"}),e.jsx("stop",{offset:"1",stopColor:"#F94543",stopOpacity:"0"})]}),e.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"gemini-tab-fill-2",x1:"3.5",x2:"17.5",y1:"13.5",y2:"12",children:[e.jsx("stop",{stopColor:"#FABC12"}),e.jsx("stop",{offset:".46",stopColor:"#FABC12",stopOpacity:"0"})]})]})]}),e.jsx("span",{className:"hidden md:hidden lg:inline",children:"Gemini CLI"})]})})})]})})]})}),e.jsxs("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[e.jsxs("div",{className:`flex-1 flex flex-col min-h-0 overflow-hidden ${T?"mr-0":""} ${fe?"hidden":""}`,children:[e.jsx("div",{className:`h-full ${l==="chat"?"block":"hidden"}`,children:e.jsx(zl,{showDetails:!0,children:e.jsx(Ol,{selectedProject:r,selectedSession:o,ws:c,sendMessage:m,messages:d,onFileOpen:ie,onInputFocusChange:h,onSessionActive:a,onSessionInactive:i,onSessionProcessing:g,onSessionNotProcessing:v,processingSessions:k,onReplaceTemporarySession:b,onNavigateToSession:j,onShowSettings:f,autoScrollToBottom:w,sendByCtrlEnter:N,externalMessageUpdate:L,limitStatus:E,onLimitExceeded:S,checkLimitStatus:R})})}),l==="files"&&e.jsx("div",{className:"h-full overflow-hidden",children:e.jsx(Cl,{selectedProject:r})}),l==="shell"&&e.jsxs("div",{className:"h-full w-full overflow-hidden relative",children:[e.jsx(Pl,{project:r,session:o,showHeader:!1}),E&&!E.allowed&&e.jsx("div",{className:"absolute inset-0 bg-black/60 z-50 flex items-center justify-center",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-xl p-6 mx-4 max-w-md text-center",children:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-4 bg-red-100 dark:bg-red-900/30 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-6 h-6 text-red-600 dark:text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-2",children:E.reason==="total_limit_exceeded"?"使用上限已达到":"今日使用上限已达到"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:E.reason==="total_limit_exceeded"?"您已达到使用上限,请联系管理员提升额度。":"您已达到今日使用上限,请明日再来或联系管理员提升额度。"}),e.jsx("button",{onClick:()=>u("chat"),className:"px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",children:"返回 Chat"})]})})]}),l==="codex"&&e.jsx("div",{className:"h-full w-full overflow-hidden relative",children:e.jsx(Ll,{project:r,showHeader:!1})}),l==="gemini"&&e.jsx("div",{className:"h-full w-full overflow-hidden relative",children:e.jsx(_l,{project:r,showHeader:!1})}),e.jsx("div",{className:`h-full overflow-hidden ${l==="preview"?"block":"hidden"}`})]}),T&&!s&&e.jsxs(e.Fragment,{children:[!fe&&e.jsx("div",{ref:ye,onMouseDown:Be,className:"flex-shrink-0 w-1 bg-gray-200 dark:bg-gray-700 hover:bg-blue-500 dark:hover:bg-blue-600 cursor-col-resize transition-colors relative group",title:"Drag to resize",children:e.jsx("div",{className:"absolute inset-y-0 left-1/2 -translate-x-1/2 w-1 bg-blue-500 dark:bg-blue-600 opacity-0 group-hover:opacity-100 transition-opacity"})}),e.jsx("div",{className:`flex-shrink-0 border-l border-gray-200 dark:border-gray-700 h-full overflow-hidden ${fe?"flex-1":""}`,style:fe?{}:{width:`${ne}px`},children:e.jsx(Fn,{file:T,onClose:Se,projectPath:r?.path,isSidebar:!0,isExpanded:fe,onToggleExpand:He})})]})]}),T&&s&&e.jsx(Fn,{file:T,onClose:Se,projectPath:r?.path,isSidebar:!1}),_&&e.jsx(Es,{file:_,onClose:()=>te(null)})]}):e.jsxs("div",{className:"h-full flex flex-col",children:[s&&e.jsx("div",{className:"bg-background border-b border-border p-2 sm:p-3 pwa-header-safe flex-shrink-0",children:e.jsx("button",{onClick:t,className:"p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-700 pwa-menu-button",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400 max-w-md mx-auto px-6",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-6 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-5l-2-2H5a2 2 0 00-2 2z"})})}),e.jsx("h2",{className:"text-2xl font-semibold mb-3 text-gray-900 dark:text-white",children:"选择您的项目"}),e.jsxs("p",{className:"text-gray-600 dark:text-gray-300 mb-6 leading-relaxed",children:["从侧边栏选择一个项目,开始与 ",Ve," 进行交流。每个项目包含您的聊天会话和文件历史。"]}),e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:e.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:["💡 ",e.jsx("strong",{children:"提示:"})," ",s?"点击上方菜单按钮访问项目":D("create_project")?"点击侧边栏中的文件夹图标创建新项目":"点击侧边栏中的「使用项目模板」按钮来创建项目"]})})]})})]})}const Fl=mt.memo(Wl);function Hl({activeTab:r,setActiveTab:o,isInputFocused:l}){const u=[{id:"chat",icon:Er,onClick:()=>o("chat")},{id:"shell",icon:Gn,onClick:()=>o("shell")},{id:"files",icon:Zt,onClick:()=>o("files")}];return e.jsx("div",{className:`fixed bottom-0 left-0 right-0 bg-background border-t border-border z-50 ios-bottom-safe transform transition-transform duration-300 ease-in-out shadow-lg ${l?"translate-y-full":"translate-y-0"}`,children:e.jsx("div",{className:"flex items-center justify-around py-1",children:u.map(c=>{const m=c.icon,d=r===c.id;return e.jsxs("button",{onClick:c.onClick,onTouchStart:s=>{s.preventDefault(),c.onClick()},className:`flex items-center justify-center p-2 rounded-lg min-h-[40px] min-w-[40px] relative touch-manipulation ${d?"text-blue-600 dark:text-blue-400":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"}`,"aria-label":c.id,children:[e.jsx(m,{className:"w-5 h-5"}),d&&e.jsx("div",{className:"absolute top-0 left-1/2 transform -translate-x-1/2 w-6 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-full"})]},c.id)})})})}const As=n.createContext(),no=()=>{const r=n.useContext(As);if(!r)throw new Error("useTheme must be used within a ThemeProvider");return r},Bl=({children:r})=>{const[o,l]=n.useState(()=>{const m=localStorage.getItem("theme");return m?m==="dark":window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)").matches:!1});n.useEffect(()=>{if(o){document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark");const m=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');m&&m.setAttribute("content","black-translucent");const d=document.querySelector('meta[name="theme-color"]');d&&d.setAttribute("content","#0c1117")}else{document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light");const m=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');m&&m.setAttribute("content","default");const d=document.querySelector('meta[name="theme-color"]');d&&d.setAttribute("content","#ffffff")}},[o]),n.useEffect(()=>{if(!window.matchMedia)return;const m=window.matchMedia("(prefers-color-scheme: dark)"),d=s=>{localStorage.getItem("theme")||l(s.matches)};return m.addEventListener("change",d),()=>m.removeEventListener("change",d)},[]);const c={isDarkMode:o,toggleDarkMode:()=>{l(m=>!m)}};return e.jsx(As.Provider,{value:c,children:r})},Ul=["Bash(git log:*)","Bash(git diff:*)","Bash(git status:*)","Write","Read","Edit","Glob","Grep","MultiEdit","Task","TodoWrite","TodoRead","WebFetch","WebSearch"];function Gl({skipPermissions:r,setSkipPermissions:o,allowedTools:l,setAllowedTools:u,disallowedTools:c,setDisallowedTools:m,newAllowedTool:d,setNewAllowedTool:s,newDisallowedTool:p,setNewDisallowedTool:t}){const x=g=>{g&&!l.includes(g)&&(u([...l,g]),s(""))},h=g=>{u(l.filter(v=>v!==g))},a=g=>{g&&!c.includes(g)&&(m([...c,g]),t(""))},i=g=>{m(c.filter(v=>v!==g))};return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"bg-sky-50 dark:bg-sky-900/20 border border-sky-200 dark:border-sky-800 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(en,{className:"w-5 h-5 text-sky-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-sky-800 dark:text-sky-200",children:[e.jsx("span",{className:"font-medium",children:"提示:"}),"此权限设置仅对 ",e.jsx("span",{className:"font-medium",children:"Chat(聊天)"})," 生效,对 ",e.jsx("span",{className:"font-medium",children:"Shell(终端)"})," 无效。Shell 是直接的系统终端,不受此权限控制。"]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Bt,{className:"w-5 h-5 text-orange-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"权限设置"})]}),e.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:e.jsxs("label",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:r,onChange:g=>o(g.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500 focus:ring-2"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:"跳过权限提示(请谨慎使用)"}),e.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:"等同于 --dangerously-skip-permissions 标志"})]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Gt,{className:"w-5 h-5 text-green-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"允许的工具"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"自动允许而不提示权限的工具"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(ct,{value:d,onChange:g=>s(g.target.value),placeholder:'e.g., "Bash(git log:*)" or "Write"',onKeyPress:g=>{g.key==="Enter"&&(g.preventDefault(),x(d))},className:"flex-1 h-10"}),e.jsxs(U,{onClick:()=>x(d),disabled:!d,size:"sm",className:"h-10 px-4",children:[e.jsx(zt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:"添加"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"快速添加常用工具:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Ul.map(g=>e.jsx(U,{variant:"outline",size:"sm",onClick:()=>x(g),disabled:l.includes(g),className:"text-xs h-8",children:g},g))})]}),e.jsxs("div",{className:"space-y-2",children:[l.map(g=>e.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:g}),e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>h(g),className:"text-green-600 hover:text-green-700",children:e.jsx(Ge,{className:"w-4 h-4"})})]},g)),l.length===0&&e.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:"未配置允许的工具"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Bt,{className:"w-5 h-5 text-red-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"阻止的工具"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"自动阻止而不提示权限的工具"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(ct,{value:p,onChange:g=>t(g.target.value),placeholder:'e.g., "Bash(rm:*)"',onKeyPress:g=>{g.key==="Enter"&&(g.preventDefault(),a(p))},className:"flex-1 h-10"}),e.jsxs(U,{onClick:()=>a(p),disabled:!p,size:"sm",className:"h-10 px-4",children:[e.jsx(zt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:"添加"})]})]}),e.jsxs("div",{className:"space-y-2",children:[c.map(g=>e.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:g}),e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>i(g),className:"text-red-600 hover:text-red-700",children:e.jsx(Ge,{className:"w-4 h-4"})})]},g)),c.length===0&&e.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:"未配置阻止的工具"})]})]}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"工具模式示例:"}),e.jsxs("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git log:*)"'})," - 允许所有 git log 命令"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git diff:*)"'})," - 允许所有 git diff 命令"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Write"'})," - 允许所有 Write 工具使用"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(rm:*)"'})," - 阻止所有 rm 命令(危险)"]})]})]})]})}function Yl({permissionMode:r,setPermissionMode:o}){return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Gt,{className:"w-5 h-5 text-green-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"权限模式"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"控制 Codex 如何处理文件修改和命令执行"}),e.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${r==="default"?"bg-gray-100 dark:bg-gray-800 border-gray-400 dark:border-gray-500":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>o("default"),children:e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"codexPermissionMode",checked:r==="default",onChange:()=>o("default"),className:"mt-1 w-4 h-4 text-green-600"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"默认"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"仅受信任的命令(ls、cat、grep、git status 等)会自动运行。其他命令将被跳过。可以写入工作区。"})]})]})}),e.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${r==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 border-green-400 dark:border-green-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>o("acceptEdits"),children:e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"codexPermissionMode",checked:r==="acceptEdits",onChange:()=>o("acceptEdits"),className:"mt-1 w-4 h-4 text-green-600"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-green-900 dark:text-green-100",children:"接受编辑"}),e.jsx("div",{className:"text-sm text-green-700 dark:text-green-300",children:"所有命令在工作区内自动运行。沙盒执行的完全自动模式。"})]})]})}),e.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${r==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 border-orange-400 dark:border-orange-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>o("bypassPermissions"),children:e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"codexPermissionMode",checked:r==="bypassPermissions",onChange:()=>o("bypassPermissions"),className:"mt-1 w-4 h-4 text-orange-600"}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-orange-900 dark:text-orange-100 flex items-center gap-2",children:["跳过权限",e.jsx(Bt,{className:"w-4 h-4"})]}),e.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:"无限制的完全系统访问。所有命令自动运行,具有完全的磁盘和网络访问权限。请谨慎使用。"})]})]})}),e.jsxs("details",{className:"text-sm",children:[e.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"技术详情"}),e.jsxs("div",{className:"mt-2 p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg text-xs text-muted-foreground space-y-2",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Default:"})," sandboxMode=workspace-write, approvalPolicy=untrusted. Trusted commands: cat, cd, grep, head, ls, pwd, tail, git status/log/diff/show, find (without -exec), etc."]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Accept Edits:"})," sandboxMode=workspace-write, approvalPolicy=never. All commands auto-execute within project directory."]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Bypass Permissions:"})," sandboxMode=danger-full-access, approvalPolicy=never. Full system access, use only in trusted environments."]}),e.jsx("p",{className:"text-xs opacity-75",children:"您可以在聊天界面中使用模式按钮为每个会话覆盖此设置。"})]})]})]})})}function Jl({agent:r,...o}){return r==="claude"?e.jsx(Gl,{...o}):r==="codex"?e.jsx(Yl,{...o}):null}const ql=r=>{switch(r){case"stdio":return e.jsx(Gn,{className:"w-4 h-4"});case"sse":return e.jsx(Cr,{className:"w-4 h-4"});case"http":return e.jsx(mr,{className:"w-4 h-4"});default:return e.jsx(tn,{className:"w-4 h-4"})}};function Kl({servers:r,onAdd:o,onEdit:l,onDelete:u,testResults:c,serverTools:m,onDiscoverRepo:d}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(tn,{className:"w-5 h-5 text-purple-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"MCP 服务器"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Model Context Protocol 服务器为 ",Ve," 提供额外的工具和数据源"]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs(U,{onClick:o,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[e.jsx(zt,{className:"w-4 h-4 mr-2"}),"添加 MCP 服务器"]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(U,{onClick:d,variant:"outline",size:"sm",children:[e.jsx(rn,{className:"w-4 h-4 mr-2"}),"MCP 商店"]})})]}),e.jsxs("div",{className:"space-y-2",children:[r.map(s=>e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[ql(s.type),e.jsx("span",{className:"font-medium text-foreground",children:s.name}),e.jsx(nt,{variant:"outline",className:"text-xs",children:s.type}),e.jsx(nt,{variant:"outline",className:"text-xs",title:s.scope==="local"&&s.projectPath?s.projectPath:void 0,children:s.scope==="local"?`local${s.projectPath?` · ${s.projectPath.split("/").filter(Boolean).pop()}`:""}`:s.scope==="user"?"user":s.scope})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[s.type==="stdio"&&s.config?.command&&e.jsxs("div",{children:["命令:",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.command})]}),(s.type==="sse"||s.type==="http")&&s.config?.url&&e.jsxs("div",{children:["URL:",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.url})]}),s.config?.args&&s.config.args.length>0&&e.jsxs("div",{children:["参数:",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:s.config.args.join(" ")})]})]}),c?.[s.id]&&e.jsx("div",{className:`mt-2 p-2 rounded text-xs ${c[s.id].success?"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200":"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200"}`,children:e.jsx("div",{className:"font-medium",children:c[s.id].message})}),m?.[s.id]&&m[s.id].tools?.length>0&&e.jsxs("div",{className:"mt-2 p-2 rounded text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-200",children:[e.jsxs("div",{className:"font-medium",children:["工具(",m[s.id].tools.length,"):"]}),e.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[m[s.id].tools.slice(0,5).map((p,t)=>e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:p.name},t)),m[s.id].tools.length>5&&e.jsxs("span",{className:"text-xs opacity-75",children:["+",m[s.id].tools.length-5," 更多"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx(U,{onClick:()=>l(s),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:"编辑服务器",children:e.jsx(En,{className:"w-4 h-4"})}),e.jsx(U,{onClick:()=>u(s.id,s.scope,s.projectPath),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:"删除服务器",children:e.jsx(vt,{className:"w-4 h-4"})})]})]})},`${s.scope}:${s.projectPath||""}:${s.id}`)),r.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"未配置 MCP 服务器"})]})]})}function Vl(r){return e.jsx(Kl,{...r})}const Zl=[{key:"ANTHROPIC_DEFAULT_OPUS_MODEL",label:"Opus 模型",placeholder:"例如: claude-opus-4-6",description:"覆盖 opus 别名使用的模型,Plan Mode 激活时也用于 opusplan"},{key:"ANTHROPIC_DEFAULT_SONNET_MODEL",label:"Sonnet 模型",placeholder:"例如: claude-sonnet-4-5-20250929",description:"覆盖 sonnet 别名使用的模型,Plan Mode 未激活时也用于 opusplan"},{key:"ANTHROPIC_DEFAULT_HAIKU_MODEL",label:"Haiku 模型",placeholder:"例如: claude-haiku-4-5-20251001",description:"覆盖 haiku 别名使用的模型,也用于后台功能"},{key:"CLAUDE_CODE_SUBAGENT_MODEL",label:"Subagent 模型",placeholder:"例如: claude-haiku-4-5-20251001",description:"覆盖子代理(subagents)使用的模型"}],Ql=n.forwardRef(function({onStatusChange:o},l){const[u,c]=n.useState({}),[m,d]=n.useState({}),[s,p]=n.useState(!0),[t,x]=n.useState(!1),[h,a]=n.useState(null),[i,g]=n.useState(null),v=JSON.stringify(u)!==JSON.stringify(m);n.useEffect(()=>{o?.({saving:t,hasChanges:v})},[t,v,o]),n.useEffect(()=>{k()},[]),n.useEffect(()=>{if(h){const f=setTimeout(()=>a(null),3e3);return()=>clearTimeout(f)}},[h]);const k=async()=>{try{p(!0),g(null);const f=await J("/api/settings/models");if(f.ok){const w=await f.json();c(w.models||{}),d(w.models||{})}else{const w=await f.json();g(w.error||"加载模型配置失败")}}catch(f){g(f.message)}finally{p(!1)}},b=async()=>{try{x(!0),a(null);const f=await J("/api/settings/models",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({models:u})});if(f.ok)return a("success"),d({...u}),!0;{const w=await f.json();return a("error"),g(w.error||"保存失败"),!1}}catch(f){return a("error"),g(f.message),!1}finally{x(!1)}},j=()=>{c({...m}),a(null)};return n.useImperativeHandle(l,()=>({save:b,reset:j,get hasChanges(){return v},get saving(){return t}}),[v,t,u,m]),s?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500"}),e.jsx("span",{className:"ml-3 text-sm text-muted-foreground",children:"加载模型配置..."})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-3",children:[e.jsx(en,{className:"w-4 h-4 text-blue-500 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[e.jsxs("p",{children:["自定义模型 ID 来覆盖 ",Ve," 和 Claude Code 使用的默认模型。留空表示使用默认模型。"]}),e.jsx("p",{className:"mt-1 text-blue-600 dark:text-blue-400",children:"非 Claude 模型将按 Sonnet 定价计费,但统计中会记录实际模型 ID。"})]})]}),i&&e.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3 text-sm text-red-600 dark:text-red-400",children:i}),h==="success"&&e.jsx("div",{className:"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3 text-sm text-green-600 dark:text-green-400",children:"模型配置已保存"}),Zl.map(f=>e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"font-medium text-sm text-foreground",children:f.label}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:f.description})]}),e.jsx("input",{type:"text",value:u[f.key]||"",onChange:w=>c(N=>({...N,[f.key]:w.target.value})),placeholder:f.placeholder,className:"w-full text-sm bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 px-3 py-2"}),e.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:f.key})]})},f.key))]})});function ec({onClose:r,onInstalled:o,onOpenRepoManager:l,projects:u=[]}){const{showAlert:c}=lt(),[m,d]=n.useState([]),[s,p]=n.useState([]),[t,x]=n.useState(!0),[h,a]=n.useState(null),[i,g]=n.useState(""),[v,k]=n.useState("all"),[b,j]=n.useState(null),[f,w]=n.useState(null),[N,L]=n.useState("user"),[E,S]=n.useState("");n.useEffect(()=>{R()},[]);const R=async(X=!1)=>{try{x(!0),a(null),X&&await J("/api/skills/repos/refresh",{method:"POST"});const[_,te]=await Promise.all([J("/api/skills/available"),J("/api/skills/repos")]);if(_.ok){const ne=await _.json();d(ne.skills||[])}if(te.ok){const ne=await te.json();p(ne.repos||[])}}catch(_){a(_.message)}finally{x(!1)}},M=X=>{w(X),L("user"),S("")},D=()=>{w(null),L("user"),S("")},$=async()=>{const X=f;if(X){if(N==="local"&&!E){c("请选择要安装到的项目",{variant:"warning"});return}try{w(null),j(X.name);const _={skillPath:X.path};N==="local"&&E&&(_.projectPath=E);const te=await J(`/api/skills/install/${X.name}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)});if(te.ok)d(ne=>ne.map(Y=>Y.name===X.name?{...Y,installed:!0}:Y)),o?.();else{const ne=await te.json();c(ne.error||"安装技能失败",{variant:"error"})}}catch(_){c(_.message,{variant:"error"})}finally{j(null),L("user"),S("")}}},T=m.filter(X=>{if(i){const _=i.toLowerCase();if(!X.name.toLowerCase().includes(_)&&!X.title?.toLowerCase().includes(_)&&!X.description?.toLowerCase().includes(_))return!1}return!(v!=="all"&&X.repository!==v)});return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-background rounded-xl shadow-xl w-full max-w-4xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Skills 管理"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(U,{variant:"ghost",size:"sm",onClick:()=>R(!0),disabled:t,children:[e.jsx(st,{className:`w-4 h-4 ${t?"animate-spin":""}`}),e.jsx("span",{className:"ml-1 hidden sm:inline",children:"刷新"})]}),e.jsxs(U,{variant:"ghost",size:"sm",onClick:l,children:[e.jsx(Ut,{className:"w-4 h-4"}),e.jsx("span",{className:"ml-1 hidden sm:inline",children:"仓库管理"})]}),e.jsx(U,{variant:"ghost",size:"icon",onClick:r,children:e.jsx(Ge,{className:"w-5 h-5"})})]})]}),e.jsx("div",{className:"px-4 pt-4 pb-2"}),e.jsxs("div",{className:"px-4 pb-4 flex flex-wrap gap-3",children:[e.jsx("div",{className:"flex-1 min-w-[200px]",children:e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(ct,{type:"text",placeholder:"搜索技能名称或描述...",value:i,onChange:X=>g(X.target.value),className:"pl-10"})]})}),e.jsxs("select",{value:v,onChange:X=>k(X.target.value),className:"px-3 py-2 rounded-md border border-border bg-background text-foreground text-sm min-w-[120px]",children:[e.jsx("option",{value:"all",children:"全部"}),s.map(X=>e.jsxs("option",{value:`${X.owner}/${X.repo}`,children:[X.owner,"/",X.repo]},`${X.owner}/${X.repo}`))]})]}),e.jsxs("div",{className:"flex-1 overflow-auto px-4 pb-4",children:[h&&e.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-800 dark:text-red-200 text-sm mb-4",children:h}),t?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):T.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:m.length===0?e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"没有可用的技能"}),e.jsx("p",{className:"text-xs mt-2",children:"请先添加技能仓库"}),e.jsxs(U,{variant:"outline",size:"sm",className:"mt-4",onClick:l,children:[e.jsx(Ut,{className:"w-4 h-4 mr-2"}),"管理仓库"]})]}):e.jsx("p",{children:"没有找到匹配的技能"})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:T.map(X=>{const _=b===X.name,te=f?.name===X.name;return e.jsx("div",{className:"border border-border rounded-lg p-4 hover:border-amber-500/50 transition-colors",children:e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"mb-2",children:[e.jsx("h4",{className:"font-medium text-foreground",children:X.title||X.name}),e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:["skills/",X.name]}),e.jsx(nt,{variant:"outline",className:"text-xs ml-2",children:X.repository})]})]}),X.description&&e.jsx("p",{className:"text-sm text-muted-foreground flex-1 line-clamp-3 mb-3",children:X.description}),te&&e.jsxs("div",{className:"mt-2 mb-3 p-3 rounded-lg bg-muted/50 border border-border text-sm",children:[e.jsx("p",{className:"font-medium text-foreground mb-2",children:"选择安装位置"}),e.jsxs("label",{className:"flex items-center gap-2 mb-1 cursor-pointer",children:[e.jsx("input",{type:"radio",name:`scope-${X.name}`,value:"user",checked:N==="user",onChange:()=>{L("user"),S("")},className:"accent-amber-600"}),e.jsx("span",{className:"text-foreground",children:"全局(所有项目可用)"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"radio",name:`scope-${X.name}`,value:"local",checked:N==="local",onChange:()=>L("local"),className:"accent-amber-600"}),e.jsx("span",{className:"text-foreground",children:"安装到指定项目"})]}),N==="local"&&e.jsxs("select",{value:E,onChange:ne=>S(ne.target.value),className:"mt-2 w-full px-2 py-1.5 rounded-md border border-border bg-background text-foreground text-xs",children:[e.jsx("option",{value:"",children:"选择项目..."}),u.map(ne=>e.jsx("option",{value:ne.path||ne.fullPath,children:ne.displayName||ne.name},ne.name))]}),e.jsxs("div",{className:"flex gap-2 mt-3",children:[e.jsx(U,{size:"sm",variant:"outline",onClick:D,className:"flex-1",children:"取消"}),e.jsx(U,{size:"sm",className:"bg-amber-600 hover:bg-amber-700 text-white flex-1",onClick:$,children:"确认安装"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-auto pt-2",children:[e.jsxs(U,{variant:"ghost",size:"sm",onClick:()=>window.open(`https://github.com/${X.repository}`,"_blank"),children:[e.jsx(rs,{className:"w-4 h-4 mr-1"}),"查看"]}),X.installed?e.jsx(U,{size:"sm",disabled:!0,variant:"outline",className:"ml-auto",children:"已安装"}):!te&&e.jsxs(U,{size:"sm",className:"bg-amber-600 hover:bg-amber-700 text-white ml-auto",onClick:()=>M(X),disabled:_||!!f,children:[e.jsx(_t,{className:"w-4 h-4 mr-1"}),_?"安装中...":"安装"]})]})]})},`${X.repository}-${X.name}`)})})]})]})})}function tc({onClose:r,onChanged:o}){const{showAlert:l,showConfirm:u}=lt(),[c,m]=n.useState([]),[d,s]=n.useState(!0),[p,t]=n.useState(null),[x,h]=n.useState(""),[a,i]=n.useState("main"),[g,v]=n.useState(!1),[k,b]=n.useState(null);n.useEffect(()=>{j()},[]);const j=async()=>{try{s(!0),t(null);const N=await J("/api/skills/repos");if(N.ok){const L=await N.json();m(L.repos||[])}else{const L=await N.json();t(L.error||"Failed to fetch repos")}}catch(N){t(N.message)}finally{s(!1)}},f=async N=>{if(N.preventDefault(),!x.trim()){t("请输入仓库 URL");return}try{v(!0),t(null);const L=await J("/api/skills/repos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:x.trim(),branch:a.trim()||"main"})});if(L.ok)h(""),i("main"),j(),o?.();else{const E=await L.json();t(E.error||"Failed to add repo")}}catch(L){t(L.message)}finally{v(!1)}},w=async(N,L)=>{if(await u(`确定要移除仓库 "${N}/${L}" 吗?`,{title:"移除仓库",variant:"danger",confirmText:"确认移除"}))try{b(`${N}/${L}`);const E=await J(`/api/skills/repos/${N}/${L}`,{method:"DELETE"});if(E.ok)j(),o?.();else{const S=await E.json();l(S.error||"移除仓库失败",{variant:"error"})}}catch(E){l(E.message,{variant:"error"})}finally{b(null)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-background rounded-xl shadow-xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 p-4 border-b border-border",children:[e.jsx(U,{variant:"ghost",size:"icon",onClick:r,children:e.jsx(Qt,{className:"w-5 h-5"})}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"管理技能仓库"})]}),e.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-6",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4 space-y-4",children:[e.jsx("h3",{className:"font-medium text-foreground",children:"添加技能仓库"}),e.jsxs("form",{onSubmit:f,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-muted-foreground mb-1",children:"仓库 URL"}),e.jsx(ct,{type:"text",placeholder:"owner/name 或 https://github.com/owner/name",value:x,onChange:N=>h(N.target.value),disabled:g})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-muted-foreground mb-1",children:"分支"}),e.jsx(ct,{type:"text",placeholder:"main",value:a,onChange:N=>i(N.target.value),disabled:g})]}),e.jsxs(U,{type:"submit",disabled:g||!x.trim(),className:"bg-amber-600 hover:bg-amber-700 text-white",children:[e.jsx(zt,{className:"w-4 h-4 mr-2"}),g?"添加中...":"添加仓库"]})]})]}),p&&e.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-800 dark:text-red-200 text-sm",children:p}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-medium text-foreground",children:"已添加的仓库"}),d?e.jsx("div",{className:"text-center py-4 text-muted-foreground",children:"加载中..."}):c.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(ns,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"还没有添加任何仓库"})]}):c.map(N=>e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-medium text-foreground",children:[N.owner,"/",N.repo]}),N.isSystem&&e.jsx(nt,{variant:"outline",className:"text-xs bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300",children:"内置"})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(rn,{className:"w-3 h-3"}),"分支: main"]}),e.jsxs(nt,{variant:"outline",className:"text-xs",children:["识别到 ",N.skillCount," 个技能"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[!N.isSystem&&N.url&&e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>window.open(N.url,"_blank"),children:e.jsx(rs,{className:"w-4 h-4"})}),!N.isSystem&&e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>w(N.owner,N.repo),disabled:k===`${N.owner}/${N.repo}`,className:"text-red-500 hover:text-red-600",children:e.jsx(vt,{className:"w-4 h-4"})})]})]})},`${N.owner}/${N.repo}`))]})]})]})})}function rc({projects:r=[]}){const{showAlert:o,showConfirm:l}=lt(),[u,c]=n.useState([]),[m,d]=n.useState(!0),[s,p]=n.useState(null),[t,x]=n.useState(!1),[h,a]=n.useState(!1),[i,g]=n.useState(!1),[v,k]=n.useState(null),b=n.useRef(null);n.useEffect(()=>{j()},[]);const j=async()=>{try{d(!0),p(null);const M=await J("/api/skills");if(M.ok){const D=await M.json();c(D.skills||[])}else{const D=await M.json();p(D.error||"Failed to fetch skills")}}catch(M){p(M.message)}finally{d(!1)}},f=async()=>{try{const M=await J("/api/skills");if(M.ok){const D=await M.json();c(D.skills||[])}}catch{}},w=async M=>{try{const D=await J(`/api/skills/${M}/download`);if(!D.ok){const _=await D.json();o(_.error||"下载技能失败",{variant:"error"});return}const $=await D.blob(),T=URL.createObjectURL($),X=document.createElement("a");X.href=T,X.download=`${M}.zip`,X.click(),URL.revokeObjectURL(T)}catch(D){o(D.message,{variant:"error"})}},N=async M=>{if(await l(`确定要删除技能 "${M.name}" 吗?`,{title:"删除技能",variant:"danger",confirmText:"确认删除"}))try{const D=M.projectPath?`/api/skills/${M.name}?projectPath=${encodeURIComponent(M.projectPath)}`:`/api/skills/${M.name}`,$=await J(D,{method:"DELETE"});if($.ok)j();else{const T=await $.json();o(T.error||"删除技能失败",{variant:"error"})}}catch(D){o(D.message,{variant:"error"})}},L=async M=>{let D,$;if(M.syncType==="builtin"?($="同步修改到云端",D=`确定要将技能 "${M.name}" 的本地修改推送到共享仓库吗?
155
155
 
156
- 这会把你在本地对该技能所做的修改同步到公司的共享 Git 仓库,其他用户拉取更新后即可获得最新版本。`):M.syncType==="external"?($="迁移技能到共享仓库",E=`确定要将技能 "${M.name}" 迁移到公司共享仓库吗?
156
+ 这会把你在本地对该技能所做的修改同步到公司的共享 Git 仓库,其他用户拉取更新后即可获得最新版本。`):M.syncType==="external"?($="迁移技能到共享仓库",D=`确定要将技能 "${M.name}" 迁移到公司共享仓库吗?
157
157
 
158
- 该技能目前来自第三方仓库(${M.repository}),迁移后将由你自行维护,与原仓库互不影响(原仓库中仍保留该技能)。`):($="同步技能到共享仓库",E=`确定要将技能 "${M.name}" 上传到公司共享仓库吗?
158
+ 该技能目前来自第三方仓库(${M.repository}),迁移后将由你自行维护,与原仓库互不影响(原仓库中仍保留该技能)。`):($="同步技能到共享仓库",D=`确定要将技能 "${M.name}" 上传到公司共享仓库吗?
159
159
 
160
- 同步后,这个本地技能将上传到共享 Git 仓库,其他人即可安装使用。本地副本将被删除,后续该技能将从共享仓库加载。`),!!await l(E,{title:$,confirmText:"确认同步"}))try{k(M.name);const T=await J(`/api/skills/${M.name}/sync`,{method:"POST"});if(T.ok)j();else{const X=await T.json();o(X.error||"同步失败",{variant:"error"})}}catch(T){o(T.message,{variant:"error"})}finally{k(null)}},D=()=>{b.current?.click()},N=async M=>{const E=M.target.files?.[0];if(E)try{g(!0);const $=new FormData;$.append("skillZip",E);const T=await J("/api/skills/import",{method:"POST",body:$});if(T.ok)j();else{const X=await T.json();o(X.error||"上传技能失败",{variant:"error"})}}catch($){o($.message,{variant:"error"})}finally{g(!1),b.current&&(b.current.value="")}},R=(M,E)=>{switch(M){case"repo":return e.jsx(nt,{variant:"outline",className:"text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300",children:E||"仓库"});case"imported":return e.jsx(nt,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300",children:"上传"});default:return e.jsx(nt,{variant:"outline",className:"text-xs",children:"本地新建"})}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(On,{className:"w-5 h-5 text-amber-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Skills 管理"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Skills 是 ",Ve," 的扩展能力,可以通过 SKILLS.md 文件定义自定义指令和工作流程"]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["已安装: ",e.jsx("span",{className:"font-medium text-foreground",children:u.length})," 个技能"]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("input",{ref:b,type:"file",accept:".zip",className:"hidden",onChange:N}),e.jsxs(U,{onClick:D,variant:"outline",size:"sm",disabled:i,children:[e.jsx(Ht,{className:"w-4 h-4 mr-2"}),i?"上传中...":"上传本地技能"]}),e.jsxs(U,{onClick:()=>x(!0),className:"bg-amber-600 hover:bg-amber-700 text-white",size:"sm",children:[e.jsx(Mt,{className:"w-4 h-4 mr-2"}),"发现技能"]})]})]}),s&&e.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-800 dark:text-red-200 text-sm",children:s}),m?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):u.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(On,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"还没有安装任何技能"}),e.jsx("p",{className:"text-xs mt-2",children:'点击"发现技能"从仓库安装,或"上传已有"本地技能'})]}):e.jsx("div",{className:"grid grid-cols-2 gap-3",children:u.map(M=>e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg px-4 pt-4 pb-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[e.jsx("span",{className:"font-medium text-foreground",children:M.title||M.name}),R(M.source,M.repository),e.jsx(nt,{variant:"outline",className:"text-xs",title:M.scope==="local"&&M.projectPath?M.projectPath:void 0,children:M.scope==="local"?`local · ${M.projectPath?M.projectPath.split("/").filter(Boolean).pop():""}`:"user"})]}),M.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-3 flex-1",children:M.description}),e.jsxs("div",{className:"flex items-center justify-end mt-2",children:[M.syncable&&e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>z(M),disabled:v===M.name,title:"同步到云端",children:v===M.name?e.jsx(st,{className:"w-4 h-4 animate-spin"}):e.jsx(Pa,{className:"w-4 h-4"})}),e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>w(M.name),title:"下载技能",children:e.jsx(It,{className:"w-4 h-4"})}),e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>S(M),className:"text-red-500 hover:text-red-600",title:"删除技能",children:e.jsx(vt,{className:"w-4 h-4"})})]})]},M.name))}),t&&e.jsx(ec,{onClose:()=>x(!1),onInstalled:f,onOpenRepoManager:()=>{x(!1),a(!0)},projects:r}),h&&e.jsx(tc,{onClose:()=>a(!1),onChanged:()=>{}})]})}function nc({projects:r=[]}){const{showAlert:o,showConfirm:l}=lt(),{hasPermission:u}=Ot(),[c,m]=n.useState([]),[d,s]=n.useState(!0),[p,t]=n.useState(!1),[x,h]=n.useState(null),[a,i]=n.useState(!1),[g,v]=n.useState(null),[k,b]=n.useState([]),[j,f]=n.useState(!1),[w,S]=n.useState(!1),z={};for(const T of r)if(T.agentInfo?.isAgent){const X=T.agentInfo.agentName;z[X]=T.agentInfo.installedVersion}const D=d?[]:r.filter(T=>T.agentInfo?.isAgent&&!c.some(X=>(X.dirName||X.name)===T.agentInfo.agentName));n.useEffect(()=>{N(),R()},[]);const N=async()=>{try{s(!0);const T=await J("/api/agents");if(T.ok){const X=await T.json();m(X.agents||[])}else{const X=await T.json();o(X.error||"获取 Agent 列表失败",{variant:"error"})}}catch(T){o(T.message,{variant:"error"})}finally{s(!1)}},R=async()=>{try{f(!0);const T=await J("/api/agents/submissions/my");if(T.ok){const X=await T.json();b(X.submissions||[])}}catch{}finally{f(!1)}},M=async()=>{try{t(!0);const T=await J("/api/agents/refresh",{method:"POST"});if(T.ok)await N();else{const X=await T.json();o(X.error||"刷新失败",{variant:"error"})}}catch(T){o(T.message,{variant:"error"})}finally{t(!1)}},E=async(T,X=!1)=>{const _=T.dirName||T.name;h(_);try{const te=await J("/api/agents/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentName:_,force:X})}),ne=await te.json();if(te.status===409&&ne.conflict){h(null),await l("检测到本地 CLAUDE.md 已被修改,更新将覆盖本地改动,是否继续?",{title:"本地文件冲突",confirmText:"强制更新",variant:"warning"})&&await E(T,!0);return}te.ok?(o(`Agent "${T.display_name||T.name}" ${X?"更新":"安装"}成功!项目已创建,Skills 和 MCP 服务已安装。`,{title:X?"更新成功":"安装成功"}),window.refreshProjects?.(),window.refreshMcpServers?.(),N()):o(ne.error||"安装失败",{variant:"error"})}catch(te){o(te.message,{variant:"error"})}finally{h(null)}},$=T=>{const X=T.dirName||T.name,_=z[X];return _?_===T.version?{state:"up_to_date",installedVersion:_}:{state:"update_available",installedVersion:_,latestVersion:T.version}:{state:"not_installed"}};return d?e.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500 dark:text-gray-400",children:[e.jsx(st,{className:"w-5 h-5 animate-spin mr-2"}),"加载中..."]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"从共享项目仓库使用预配置的项目模板,包含所需的 Skills 和 MCP 服务。"}),e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs(U,{variant:"outline",size:"sm",onClick:M,disabled:p,className:"flex items-center gap-1.5",children:[e.jsx(st,{className:`w-3.5 h-3.5 ${p?"animate-spin":""}`}),"刷新"]}),u("submit_agent")&&e.jsxs(U,{variant:"outline",size:"sm",onClick:()=>i(!0),className:"flex items-center gap-1.5",children:[e.jsx(Ht,{className:"w-3.5 h-3.5"}),"分享项目模板"]})]})]}),c.length===0?e.jsxs("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400 border border-dashed border-gray-200 dark:border-gray-700 rounded-lg",children:[e.jsx(_t,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"暂无可用共享项目模板"}),e.jsx("p",{className:"text-xs mt-1",children:'点击"刷新"从服务器获取最新共享项目模板列表'})]}):e.jsx("div",{className:"space-y-2",children:c.map(T=>{const X=T.dirName||T.name,_=$(T),te=g===X,ne=x===X;return e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-3 p-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center flex-shrink-0",children:e.jsx(_t,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium text-sm text-gray-900 dark:text-gray-100 truncate",children:T.display_name||T.name}),e.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:["v",T.version]}),_.state==="update_available"&&e.jsxs(nt,{className:"text-xs bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400 border-amber-200 dark:border-amber-700 hover:bg-amber-200 dark:hover:bg-amber-900/50 flex-shrink-0",children:["有更新 v",_.latestVersion]}),_.state==="up_to_date"&&e.jsx(nt,{className:"text-xs bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 border-green-200 dark:border-green-700 hover:bg-green-200 dark:hover:bg-green-900/50 flex-shrink-0",children:"已使用"})]}),T.description&&e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:T.description}),e.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[T.skills?.length>0&&e.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:[T.skills.length," 个 Skill"]}),T.mcps?.length>0&&e.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:[T.mcps.length," 个 MCP"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(U,{size:"sm",variant:_.state==="not_installed"?"default":"outline",onClick:()=>E(T),disabled:ne||_.state==="up_to_date",className:"text-xs h-7 px-2.5",children:ne?e.jsx(st,{className:"w-3 h-3 animate-spin"}):_.state==="up_to_date"?"已是最新":_.state==="update_available"?e.jsxs(e.Fragment,{children:[e.jsx(It,{className:"w-3 h-3 mr-1"}),"更新"]}):e.jsxs(e.Fragment,{children:[e.jsx(It,{className:"w-3 h-3 mr-1"}),"使用"]})}),(T.skills?.length>0||T.mcps?.length>0)&&e.jsx("button",{onClick:()=>v(te?null:X),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:te?e.jsx(Dn,{className:"w-4 h-4"}):e.jsx(Vt,{className:"w-4 h-4"})})]})]}),te&&e.jsxs("div",{className:"border-t border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 px-3 py-2 space-y-2",children:[T.skills?.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-1",children:"所需 Skills"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:T.skills.map(G=>e.jsx(nt,{variant:"outline",className:"text-xs",children:G.name},G.name))})]}),T.mcps?.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-1",children:"所需 MCP 服务"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:T.mcps.map(G=>e.jsx(nt,{variant:"outline",className:"text-xs",children:G.name},G.name))})]})]})]},X)})}),D.length>0&&e.jsxs("div",{className:"border border-amber-200 dark:border-amber-800 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-50 dark:bg-amber-900/10 border-b border-amber-200 dark:border-amber-800",children:[e.jsx(Bt,{className:"w-3.5 h-3.5 text-amber-500"}),e.jsx("span",{className:"text-xs font-medium text-amber-700 dark:text-amber-400",children:"以下 Agent 已从仓库下线"})]}),e.jsx("div",{className:"divide-y divide-amber-100 dark:divide-amber-900/20",children:D.map(T=>e.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-gray-800 dark:text-gray-200",children:T.displayName}),e.jsx("span",{className:"text-xs text-gray-400 font-mono ml-2",children:T.agentInfo.agentName}),e.jsxs("span",{className:"text-xs text-amber-600 dark:text-amber-400 ml-2",children:["v",T.agentInfo.installedVersion]})]}),e.jsx("span",{className:"text-xs text-amber-500 dark:text-amber-400",children:"已下线,本地仍可继续使用"})]},T.agentInfo.agentName))})]}),(k.length>0||j)&&e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("button",{onClick:()=>S(T=>!T),className:"flex items-center gap-1 text-sm font-medium text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100",children:[w?e.jsx(Dn,{className:"w-3.5 h-3.5"}):e.jsx(Vt,{className:"w-3.5 h-3.5"}),"我的提交记录"]}),e.jsxs("button",{onClick:R,disabled:j,className:"text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 flex items-center gap-1",children:[e.jsx(st,{className:`w-3 h-3 ${j?"animate-spin":""}`}),"刷新"]})]}),w&&e.jsx("div",{className:"space-y-2",children:k.map(T=>{const X={pending:{label:"审核中",icon:Mr,color:"text-amber-600 dark:text-amber-400",bg:"bg-amber-50 dark:bg-amber-900/20 border-amber-200 dark:border-amber-800"},approved:{label:"已通过",icon:ss,color:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800"},rejected:{label:"已拒绝",icon:os,color:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800"}},_=X[T.status]||X.pending,te=_.icon;return e.jsx("div",{className:`border rounded-lg px-3 py-2.5 ${_.bg}`,children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:T.display_name}),e.jsxs("span",{className:"text-xs text-gray-400",children:["(",T.agent_name,")"]}),T.version&&e.jsxs("span",{className:"text-xs text-gray-400",children:["v",T.version]})]}),e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:["提交于 ",new Date(T.submitted_at).toLocaleString("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})]}),T.status==="rejected"&&T.reject_reason&&e.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:["拒绝原因:",T.reject_reason]}),T.status==="approved"&&T.reviewed_at&&e.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 mt-0.5",children:["审核通过,已发布为 v",T.version]})]}),e.jsxs("div",{className:`flex items-center gap-1 flex-shrink-0 text-xs font-medium ${_.color}`,children:[e.jsx(te,{className:"w-3.5 h-3.5"}),_.label]})]})},T.id)})})]}),a&&e.jsx(qn,{projects:r,onClose:()=>i(!1),onSubmitted:()=>{i(!1),R()}})]})}var Sn={exports:{}},Bo;function oc(){return Bo||(Bo=1,function(r,o){(function(u,c){r.exports=c()})(globalThis,()=>(()=>{var l={949(d,s,p){Object.defineProperty(s,"__esModule",{value:!0}),s.CronParser=void 0;var t=p(515),x=function(){function h(a,i,g){i===void 0&&(i=!0),g===void 0&&(g=!1),this.expression=a,this.dayOfWeekStartIndexZero=i,this.monthStartIndexZero=g}return h.prototype.parse=function(){var a,i,g=(a=this.expression)!==null&&a!==void 0?a:"";if(g==="@reboot")return i=["@reboot","","","","","",""],i;if(g.startsWith("@")){var v=this.parseSpecial(this.expression);i=this.extractParts(v)}else i=this.extractParts(this.expression);return this.normalize(i),this.validate(i),i},h.prototype.parseSpecial=function(a){var i={"@yearly":"0 0 1 1 *","@annually":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *","@reboot":"@reboot"},g=i[a];if(!g)throw new Error("Unknown special expression.");return g},h.prototype.extractParts=function(a){if(!this.expression)throw new Error("cron expression is empty");for(var i=a.trim().split(/[ ]+/),g=0;g<i.length;g++)if(i[g].includes(",")){var v=i[g].split(",").map(function(b){return b.trim()}).filter(function(b){return b!==""}).map(function(b){return isNaN(Number(b))?b:Number(b)}).filter(function(b){return b!==null&&b!==""});v.length===0&&v.push("*"),v.sort(function(b,j){return b!==null&&j!==null?b-j:0}),i[g]=v.map(function(b){return b!==null?b.toString():""}).join(",")}if(i.length<5)throw new Error("Expression has only ".concat(i.length," part").concat(i.length==1?"":"s",". At least 5 parts are required."));if(i.length==5)i.unshift(""),i.push("");else if(i.length==6){var k=/\d{4}$/.test(i[5])||i[4]=="?"||i[2]=="?";k?i.unshift(""):i.push("")}else if(i.length>7)throw new Error("Expression has ".concat(i.length," parts; too many!"));return i},h.prototype.normalize=function(a){var i=this;if(a[3]=a[3].replace("?","*"),a[5]=a[5].replace("?","*"),a[2]=a[2].replace("?","*"),a[0].indexOf("0/")==0&&(a[0]=a[0].replace("0/","*/")),a[1].indexOf("0/")==0&&(a[1]=a[1].replace("0/","*/")),a[2].indexOf("0/")==0&&(a[2]=a[2].replace("0/","*/")),a[3].indexOf("1/")==0&&(a[3]=a[3].replace("1/","*/")),a[4].indexOf("1/")==0&&(a[4]=a[4].replace("1/","*/")),a[6].indexOf("1/")==0&&(a[6]=a[6].replace("1/","*/")),a[5]=a[5].replace(/(^\d)|([^#/\s]\d)/g,function(S){var z=S.replace(/\D/,""),D=z;return i.dayOfWeekStartIndexZero?z=="7"&&(D="0"):D=(parseInt(z)-1).toString(),S.replace(z,D)}),a[5]=="L"&&(a[5]="6"),a[3]=="?"&&(a[3]="*"),a[3].indexOf("W")>-1&&(a[3].indexOf(",")>-1||a[3].indexOf("-")>-1))throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");var g={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var v in g)a[5]=a[5].replace(new RegExp(v,"gi"),g[v].toString());a[4]=a[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(S){var z=S.replace(/\D/,""),D=z;return i.monthStartIndexZero&&(D=(parseInt(z)+1).toString()),S.replace(z,D)});var k={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var b in k)a[4]=a[4].replace(new RegExp(b,"gi"),k[b].toString());a[0]=="0"&&(a[0]=""),!/\*|\-|\,|\//.test(a[2])&&(/\*|\//.test(a[1])||/\*|\//.test(a[0]))&&(a[2]+="-".concat(a[2]));for(var j=0;j<a.length;j++)if(a[j].indexOf(",")!=-1&&(a[j]=a[j].split(",").filter(function(S){return S!==""}).join(",")||"*"),a[j]=="*/1"&&(a[j]="*"),a[j].indexOf("/")>-1&&!/^\*|\-|\,/.test(a[j])){var f=null;switch(j){case 4:f="12";break;case 5:f="6";break;case 6:f="9999";break;default:f=null;break}if(f!==null){var w=a[j].split("/");a[j]="".concat(w[0],"-").concat(f,"/").concat(w[1])}}},h.prototype.validate=function(a){var i="0-9,\\-*/";this.validateOnlyExpectedCharactersFound(a[0],i),this.validateOnlyExpectedCharactersFound(a[1],i),this.validateOnlyExpectedCharactersFound(a[2],i),this.validateOnlyExpectedCharactersFound(a[3],"0-9,\\-*/LW"),this.validateOnlyExpectedCharactersFound(a[4],i),this.validateOnlyExpectedCharactersFound(a[5],"0-9,\\-*/L#"),this.validateOnlyExpectedCharactersFound(a[6],i),this.validateAnyRanges(a)},h.prototype.validateAnyRanges=function(a){t.default.secondRange(a[0]),t.default.minuteRange(a[1]),t.default.hourRange(a[2]),t.default.dayOfMonthRange(a[3]),t.default.monthRange(a[4],this.monthStartIndexZero),t.default.dayOfWeekRange(a[5],this.dayOfWeekStartIndexZero)},h.prototype.validateOnlyExpectedCharactersFound=function(a,i){var g=a.match(new RegExp("[^".concat(i,"]+"),"gi"));if(g&&g.length)throw new Error("Expression contains invalid values: '".concat(g.toString(),"'"))},h}();s.CronParser=x},333(d,s,p){Object.defineProperty(s,"__esModule",{value:!0}),s.ExpressionDescriptor=void 0;var t=p(823),x=p(949),h=function(){function a(i,g){if(this.expression=i,this.options=g,this.expressionParts=new Array(5),!this.options.locale&&a.defaultLocale&&(this.options.locale=a.defaultLocale),!a.locales[this.options.locale]){var v=Object.keys(a.locales)[0];console.warn("Locale '".concat(this.options.locale,"' could not be found; falling back to '").concat(v,"'.")),this.options.locale=v}this.i18n=a.locales[this.options.locale],g.use24HourTimeFormat===void 0&&(g.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return a.toString=function(i,g){var v=g===void 0?{}:g,k=v.throwExceptionOnParseError,b=k===void 0?!0:k,j=v.verbose,f=j===void 0?!1:j,w=v.dayOfWeekStartIndexZero,S=w===void 0?!0:w,z=v.monthStartIndexZero,D=z===void 0?!1:z,N=v.use24HourTimeFormat,R=v.trimHoursLeadingZero,M=R===void 0?!1:R,E=v.locale,$=E===void 0?null:E,T=v.logicalAndDayFields,X=T===void 0?!1:T,_={throwExceptionOnParseError:b,verbose:f,dayOfWeekStartIndexZero:S,monthStartIndexZero:D,use24HourTimeFormat:N,trimHoursLeadingZero:M,locale:$,logicalAndDayFields:X};_.tzOffset&&console.warn("'tzOffset' option has been deprecated and is no longer supported.");var te=new a(i,_);return te.getFullDescription()},a.initialize=function(i,g){g===void 0&&(g="en"),a.specialCharacters=["/","-",",","*"],a.defaultLocale=g,i.load(a.locales)},a.prototype.getFullDescription=function(){var i,g,v="";try{var k=new x.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero);if(this.expressionParts=k.parse(),this.expressionParts[0]==="@reboot")return((g=(i=this.i18n).atReboot)===null||g===void 0?void 0:g.call(i))||"Run once, at startup";var b=this.getTimeOfDayDescription(),j=this.getDayOfMonthDescription(),f=this.getMonthDescription(),w=this.getDayOfWeekDescription(),S=this.getYearDescription();v+=b+j+w+f+S,v=this.transformVerbosity(v,!!this.options.verbose),v=v.charAt(0).toLocaleUpperCase()+v.substr(1)}catch(z){if(!this.options.throwExceptionOnParseError)v=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw"".concat(z)}return v},a.prototype.getTimeOfDayDescription=function(){var i=this.expressionParts[0],g=this.expressionParts[1],v=this.expressionParts[2],k="";if(!t.StringUtilities.containsAny(g,a.specialCharacters)&&!t.StringUtilities.containsAny(v,a.specialCharacters)&&!t.StringUtilities.containsAny(i,a.specialCharacters))k+=this.i18n.atSpace()+this.formatTime(v,g,i);else if(!i&&g.indexOf("-")>-1&&!(g.indexOf(",")>-1)&&!(g.indexOf("/")>-1)&&!t.StringUtilities.containsAny(v,a.specialCharacters)){var b=g.split("-");k+=t.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(v,b[0],""),this.formatTime(v,b[1],""))}else if(!i&&v.indexOf(",")>-1&&v.indexOf("-")==-1&&v.indexOf("/")==-1&&!t.StringUtilities.containsAny(g,a.specialCharacters)){var j=v.split(",");k+=this.i18n.at();for(var f=0;f<j.length;f++)k+=" ",k+=this.formatTime(j[f],g,""),f<j.length-2&&(k+=","),f==j.length-2&&(k+=this.i18n.spaceAnd())}else{var w=this.getSecondsDescription(),S=this.getMinutesDescription(),z=this.getHoursDescription();if(k+=w,k&&S&&(k+=", "),k+=S,S===z)return k;k&&z&&(k+=", "),k+=z}return k},a.prototype.getSecondsDescription=function(){var i=this,g=this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(v){return v},function(v){return t.StringUtilities.format(i.i18n.everyX0Seconds(v),v)},function(v){return i.i18n.secondsX0ThroughX1PastTheMinute()},function(v){return v=="0"?"":parseInt(v)<20?i.i18n.atX0SecondsPastTheMinute(v):i.i18n.atX0SecondsPastTheMinuteGt20()||i.i18n.atX0SecondsPastTheMinute(v)});return g},a.prototype.getMinutesDescription=function(){var i=this,g=this.expressionParts[0],v=this.expressionParts[2],k=this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(b){return b},function(b){return t.StringUtilities.format(i.i18n.everyX0Minutes(b),b)},function(b){return i.i18n.minutesX0ThroughX1PastTheHour()},function(b){var j,f;try{return b=="0"&&v.indexOf("/")==-1&&g==""?i.i18n.everyHour():b=="0"?((f=(j=i.i18n).onTheHour)===null||f===void 0?void 0:f.call(j))||i.i18n.atX0MinutesPastTheHour(b):parseInt(b)<20?i.i18n.atX0MinutesPastTheHour(b):i.i18n.atX0MinutesPastTheHourGt20()||i.i18n.atX0MinutesPastTheHour(b)}catch{return i.i18n.atX0MinutesPastTheHour(b)}});return k},a.prototype.getHoursDescription=function(){var i=this,g=this.expressionParts[2],v=0,k=[];g.split("/")[0].split(",").forEach(function(f){var w=f.split("-");w.length===2&&k.push({value:w[1],index:v+1}),v+=w.length});var b=0,j=this.getSegmentDescription(g,this.i18n.everyHour(),function(f){var w=k.find(function(z){return z.value===f&&z.index===b}),S=w&&i.expressionParts[1]!=="0";return b++,S?i.formatTime(f,"59",""):i.formatTime(f,"0","")},function(f){return t.StringUtilities.format(i.i18n.everyX0Hours(f),f)},function(f){return i.i18n.betweenX0AndX1()},function(f){return i.i18n.atX0()});return j},a.prototype.getDayOfWeekDescription=function(){var i=this,g=this.i18n.daysOfTheWeek(),v=null;return this.expressionParts[5]=="*"?v="":v=this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(k,b){var j=k;k.indexOf("#")>-1?j=k.substring(0,k.indexOf("#")):k.indexOf("L")>-1&&(j=j.replace("L",""));var f=parseInt(j),w=i.i18n.daysOfTheWeekInCase?i.i18n.daysOfTheWeekInCase(b)[f]:g[f];if(k.indexOf("#")>-1){var S=null,z=k.substring(k.indexOf("#")+1),D=k.substring(0,k.indexOf("#"));switch(z){case"1":S=i.i18n.first(D);break;case"2":S=i.i18n.second(D);break;case"3":S=i.i18n.third(D);break;case"4":S=i.i18n.fourth(D);break;case"5":S=i.i18n.fifth(D);break}w=S+" "+w}return w},function(k){return parseInt(k)==1?"":t.StringUtilities.format(i.i18n.commaEveryX0DaysOfTheWeek(k),k)},function(k){var b=k.substring(0,k.indexOf("-")),j=i.expressionParts[3]!="*";return j?i.i18n.commaAndX0ThroughX1(b):i.i18n.commaX0ThroughX1(b)},function(k){var b=null;if(k.indexOf("#")>-1){var j=k.substring(k.indexOf("#")+1),f=k.substring(0,k.indexOf("#"));b=i.i18n.commaOnThe(j,f).trim()+i.i18n.spaceX0OfTheMonth()}else if(k.indexOf("L")>-1)b=i.i18n.commaOnTheLastX0OfTheMonth(k.replace("L",""));else{var w=i.expressionParts[3]!="*";w?i.options.logicalAndDayFields?b=i.i18n.commaOnlyOnX0(k):b=i.i18n.commaAndOnX0():b=i.i18n.commaOnlyOnX0(k)}return b}),v},a.prototype.getMonthDescription=function(){var i=this,g=this.i18n.monthsOfTheYear(),v=this.getSegmentDescription(this.expressionParts[4],"",function(k,b){return b&&i.i18n.monthsOfTheYearInCase?i.i18n.monthsOfTheYearInCase(b)[parseInt(k)-1]:g[parseInt(k)-1]},function(k){return parseInt(k)==1?"":t.StringUtilities.format(i.i18n.commaEveryX0Months(k),k)},function(k){return i.i18n.commaMonthX0ThroughMonthX1()||i.i18n.commaX0ThroughX1()},function(k){return i.i18n.commaOnlyInMonthX0?i.i18n.commaOnlyInMonthX0():i.i18n.commaOnlyInX0()});return v},a.prototype.getDayOfMonthDescription=function(){var i=this,g=null,v=this.expressionParts[3];switch(v){case"L":g=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":g=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var k=v.match(/(\d{1,2}W)|(W\d{1,2})/);if(k){var b=parseInt(k[0].replace("W","")),j=b==1?this.i18n.firstWeekday():t.StringUtilities.format(this.i18n.weekdayNearestDayX0(),b.toString());g=t.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),j);break}else{var f=v.match(/L-(\d{1,2})/);if(f){var w=f[1];g=t.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(w),w);break}else{if(v=="*"&&this.expressionParts[5]!="*")return"";g=this.getSegmentDescription(v,this.i18n.commaEveryDay(),function(S){return S=="L"?i.i18n.lastDay():i.i18n.dayX0?t.StringUtilities.format(i.i18n.dayX0(),S):S},function(S){return S=="1"?i.i18n.commaEveryDay():i.i18n.commaEveryX0Days(S)},function(S){return i.i18n.commaBetweenDayX0AndX1OfTheMonth(S)},function(S){return i.i18n.commaOnDayX0OfTheMonth(S)})}break}}return g},a.prototype.getYearDescription=function(){var i=this,g=this.getSegmentDescription(this.expressionParts[6],"",function(v){return/^\d+$/.test(v)?new Date(parseInt(v),1).getFullYear().toString():v},function(v){return t.StringUtilities.format(i.i18n.commaEveryX0Years(v),v)},function(v){return i.i18n.commaYearX0ThroughYearX1()||i.i18n.commaX0ThroughX1()},function(v){return i.i18n.commaOnlyInYearX0?i.i18n.commaOnlyInYearX0():i.i18n.commaOnlyInX0()});return g},a.prototype.getSegmentDescription=function(i,g,v,k,b,j){var f=null,w=i.indexOf("/")>-1,S=i.indexOf("-")>-1,z=i.indexOf(",")>-1;if(!i)f="";else if(i==="*")f=g;else if(!w&&!S&&!z)f=t.StringUtilities.format(j(i),v(i));else if(z){for(var D=i.split(","),N="",R=0;R<D.length;R++)if(R>0&&D.length>2&&(N+=",",R<D.length-1&&(N+=" ")),R>0&&D.length>1&&(R==D.length-1||D.length==2)&&(N+="".concat(this.i18n.spaceAnd()," ")),D[R].indexOf("/")>-1||D[R].indexOf("-")>-1){var M=D[R].indexOf("-")>-1&&D[R].indexOf("/")==-1,E=this.getSegmentDescription(D[R],g,v,k,M?this.i18n.commaX0ThroughX1:b,j);M&&(E=E.replace(", ","")),N+=E}else if(!w)N+=v(D[R]);else{var $=this.getSegmentDescription(D[R],g,v,k,b,j);$&&$.startsWith(", ")&&($=$.substring(2)),N+=$}w?f=N:f=t.StringUtilities.format(j(i),N)}else if(w){var D=i.split("/");if(f=t.StringUtilities.format(k(D[1]),D[1]),D[0].indexOf("-")>-1){var T=this.generateRangeSegmentDescription(D[0],b,v);T.indexOf(", ")!=0&&(f+=", "),f+=T}else if(D[0].indexOf("*")==-1){var X=t.StringUtilities.format(j(D[0]),v(D[0]));X=X.replace(", ",""),f+=t.StringUtilities.format(this.i18n.commaStartingX0(),X)}}else S&&(f=this.generateRangeSegmentDescription(i,b,v));return f},a.prototype.generateRangeSegmentDescription=function(i,g,v){var k="",b=i.split("-"),j=v(b[0],1),f=v(b[1],2),w=g(i);return k+=t.StringUtilities.format(w,j,f),k},a.prototype.formatTime=function(i,g,v){var k=0,b=0,j=parseInt(i)+k,f=parseInt(g)+b;f>=60?(f-=60,j+=1):f<0&&(f+=60,j-=1),j>=24?j=j-24:j<0&&(j=24+j);var w="",S=!1;this.options.use24HourTimeFormat||(S=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),w=S?"".concat(this.getPeriod(j)," "):" ".concat(this.getPeriod(j)),j>12&&(j-=12),j===0&&(j=12));var z="";v&&(z=":".concat(("00"+v).substring(v.length)));var D=j.toString(),N=("00"+D).substring(D.length),R=f.toString(),M=("00"+R).substring(R.length),E=this.options.trimHoursLeadingZero?D:N;return"".concat(S?w:"").concat(E,":").concat(M).concat(z).concat(S?"":w)},a.prototype.transformVerbosity=function(i,g){if(!g&&(i=i.replace(new RegExp(", ".concat(this.i18n.everyMinute()),"g"),""),i=i.replace(new RegExp(", ".concat(this.i18n.everyHour()),"g"),""),i=i.replace(new RegExp(this.i18n.commaEveryDay(),"g"),""),i=i.replace(/\, ?$/,""),this.i18n.conciseVerbosityReplacements))for(var v=0,k=Object.entries(this.i18n.conciseVerbosityReplacements());v<k.length;v++){var b=k[v],j=b[0],f=b[1];i=i.replace(new RegExp(j,"g"),f)}return i},a.prototype.getPeriod=function(i){return i>=12?this.i18n.pm&&this.i18n.pm()||"PM":this.i18n.am&&this.i18n.am()||"AM"},a.locales={},a}();s.ExpressionDescriptor=h},99(d,s,p){Object.defineProperty(s,"__esModule",{value:!0}),s.sr=s.hr=s.bg=s.my=s.vi=s.ar=s.th=s.af=s.hu=s.be=s.ca=s.fa=s.sw=s.sl=s.fi=s.sk=s.cs=s.he=s.ja=s.zh_TW=s.zh_CN=s.uk=s.tr=s.ru=s.ro=s.pt_PT=s.pt_BR=s.pl=s.sv=s.nb=s.nl=s.ko=s.id=s.it=s.fr=s.es=s.de=s.da=s.en=void 0;var t=p(486);Object.defineProperty(s,"en",{enumerable:!0,get:function(){return t.en}});var x=p(506);Object.defineProperty(s,"da",{enumerable:!0,get:function(){return x.da}});var h=p(230);Object.defineProperty(s,"de",{enumerable:!0,get:function(){return h.de}});var a=p(153);Object.defineProperty(s,"es",{enumerable:!0,get:function(){return a.es}});var i=p(517);Object.defineProperty(s,"fr",{enumerable:!0,get:function(){return i.fr}});var g=p(488);Object.defineProperty(s,"it",{enumerable:!0,get:function(){return g.it}});var v=p(72);Object.defineProperty(s,"id",{enumerable:!0,get:function(){return v.id}});var k=p(839);Object.defineProperty(s,"ko",{enumerable:!0,get:function(){return k.ko}});var b=p(647);Object.defineProperty(s,"nl",{enumerable:!0,get:function(){return b.nl}});var j=p(957);Object.defineProperty(s,"nb",{enumerable:!0,get:function(){return j.nb}});var f=p(544);Object.defineProperty(s,"sv",{enumerable:!0,get:function(){return f.sv}});var w=p(905);Object.defineProperty(s,"pl",{enumerable:!0,get:function(){return w.pl}});var S=p(556);Object.defineProperty(s,"pt_BR",{enumerable:!0,get:function(){return S.pt_BR}});var z=p(163);Object.defineProperty(s,"pt_PT",{enumerable:!0,get:function(){return z.pt_PT}});var D=p(614);Object.defineProperty(s,"ro",{enumerable:!0,get:function(){return D.ro}});var N=p(892);Object.defineProperty(s,"ru",{enumerable:!0,get:function(){return N.ru}});var R=p(631);Object.defineProperty(s,"tr",{enumerable:!0,get:function(){return R.tr}});var M=p(225);Object.defineProperty(s,"uk",{enumerable:!0,get:function(){return M.uk}});var E=p(571);Object.defineProperty(s,"zh_CN",{enumerable:!0,get:function(){return E.zh_CN}});var $=p(983);Object.defineProperty(s,"zh_TW",{enumerable:!0,get:function(){return $.zh_TW}});var T=p(904);Object.defineProperty(s,"ja",{enumerable:!0,get:function(){return T.ja}});var X=p(82);Object.defineProperty(s,"he",{enumerable:!0,get:function(){return X.he}});var _=p(651);Object.defineProperty(s,"cs",{enumerable:!0,get:function(){return _.cs}});var te=p(923);Object.defineProperty(s,"sk",{enumerable:!0,get:function(){return te.sk}});var ne=p(964);Object.defineProperty(s,"fi",{enumerable:!0,get:function(){return ne.fi}});var G=p(474);Object.defineProperty(s,"sl",{enumerable:!0,get:function(){return G.sl}});var le=p(799);Object.defineProperty(s,"sw",{enumerable:!0,get:function(){return le.sw}});var de=p(804);Object.defineProperty(s,"fa",{enumerable:!0,get:function(){return de.fa}});var fe=p(845);Object.defineProperty(s,"ca",{enumerable:!0,get:function(){return fe.ca}});var Ee=p(348);Object.defineProperty(s,"be",{enumerable:!0,get:function(){return Ee.be}});var ge=p(194);Object.defineProperty(s,"hu",{enumerable:!0,get:function(){return ge.hu}});var Me=p(810);Object.defineProperty(s,"af",{enumerable:!0,get:function(){return Me.af}});var Fe=p(33);Object.defineProperty(s,"th",{enumerable:!0,get:function(){return Fe.th}});var ae=p(574);Object.defineProperty(s,"ar",{enumerable:!0,get:function(){return ae.ar}});var Ne=p(292);Object.defineProperty(s,"vi",{enumerable:!0,get:function(){return Ne.vi}});var He=p(919);Object.defineProperty(s,"my",{enumerable:!0,get:function(){return He.my}});var Be=p(622);Object.defineProperty(s,"bg",{enumerable:!0,get:function(){return Be.bg}});var he=p(131);Object.defineProperty(s,"hr",{enumerable:!0,get:function(){return he.hr}});var Oe=p(716);Object.defineProperty(s,"sr",{enumerable:!0,get:function(){return Oe.sr}})},420(d,s,p){Object.defineProperty(s,"__esModule",{value:!0}),s.allLocalesLoader=void 0;var t=p(99),x=function(){function h(){}return h.prototype.load=function(a){for(var i in t)t.hasOwnProperty(i)&&(a[i]=new t[i])},h}();s.allLocalesLoader=x},810(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.af=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return", jaar %s na %s"},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Daar was 'n fout om die tydsuitdrukking the genereer. Raadpleeg asb die uitdrukking formaat."},t.prototype.everyMinute=function(){return"elke minuut"},t.prototype.everyHour=function(){return"elke uur"},t.prototype.atSpace=function(){return"Teen "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Elke minuut tussen %s en %s"},t.prototype.at=function(){return"Teen"},t.prototype.spaceAnd=function(){return" en"},t.prototype.everySecond=function(){return"elke sekonde"},t.prototype.everyX0Seconds=function(){return"elke %s sekonde"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekonde %s deur na %s na die minuut"},t.prototype.atX0SecondsPastTheMinute=function(){return"teen %s sekondes na die minuut"},t.prototype.everyX0Minutes=function(){return"elke %s minute"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minute %s deur na %s na die uur"},t.prototype.atX0MinutesPastTheHour=function(){return"teen %s minute na die uur"},t.prototype.everyX0Hours=function(){return"elke %s ure"},t.prototype.betweenX0AndX1=function(){return"tussen %s en %s"},t.prototype.atX0=function(){return"teen %s"},t.prototype.commaEveryDay=function(){return", elke dag"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", elke %s dae van die week"},t.prototype.commaX0ThroughX1=function(){return", %s deur na %s"},t.prototype.commaAndX0ThroughX1=function(){return", en %s deur na %s"},t.prototype.first=function(){return"eerste"},t.prototype.second=function(){return"tweede"},t.prototype.third=function(){return"derde"},t.prototype.fourth=function(){return"vierde"},t.prototype.fifth=function(){return"vyfde"},t.prototype.commaOnThe=function(){return", op die "},t.prototype.spaceX0OfTheMonth=function(){return" %s van die maand"},t.prototype.lastDay=function(){return"die laaste dag"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", op die laaste %s van die maand"},t.prototype.commaOnlyOnX0=function(){return", net op %s"},t.prototype.commaAndOnX0=function(){return", en op %s"},t.prototype.commaEveryX0Months=function(){return", elke %s maande"},t.prototype.commaOnlyInX0=function(){return", net in %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", op die laaste dag van die maand"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", op die laaste weeksdag van die maand"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dae voor die laaste dag van die maand"},t.prototype.firstWeekday=function(){return"eerste weeksdag"},t.prototype.weekdayNearestDayX0=function(){return"weeksdag naaste aan dag %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", op die %s van die maande"},t.prototype.commaEveryX0Days=function(){return", elke %s dae"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", tussen dag %s en %s van die maand"},t.prototype.commaOnDayX0OfTheMonth=function(){return", op dag %s van die maand"},t.prototype.commaEveryHour=function(){return", elke uur"},t.prototype.commaEveryX0Years=function(){return", elke %s jare"},t.prototype.commaStartingX0=function(){return", beginnende %s"},t.prototype.daysOfTheWeek=function(){return["Sondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrydag","Saterdag"]},t.prototype.monthsOfTheYear=function(){return["Januarie","Februarie","Maart","April","Mei","Junie","Julie","Augustus","September","Oktober","November","Desember"]},t.prototype.onTheHour=function(){return"op die uur"},t}();s.af=p},574(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ar=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"حدث خطأ في إنشاء وصف المصطلح٠ تأكد من تركيب مصطلح الكرون"},t.prototype.everyMinute=function(){return"كل دقيقة"},t.prototype.everyHour=function(){return"كل ساعة"},t.prototype.atSpace=function(){return" "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"كل دقيقة بين %s و %s"},t.prototype.at=function(){return""},t.prototype.spaceAnd=function(){return" و"},t.prototype.everySecond=function(){return"كل ثانية"},t.prototype.everyX0Seconds=function(){return"كل %s ثواني"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"الثواني %s حتى %s من بداية الدقيقة"},t.prototype.atX0SecondsPastTheMinute=function(){return"الثانية %s من بداية الدقيقة"},t.prototype.everyX0Minutes=function(){return"كل %s دقائق"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"الدقائق %s حتى %s من بداية الساعة"},t.prototype.atX0MinutesPastTheHour=function(){return"الدقيقة %s من بداية الساعة"},t.prototype.everyX0Hours=function(){return"كل %s ساعات"},t.prototype.betweenX0AndX1=function(){return"بين %s و %s"},t.prototype.atX0=function(){return"%s"},t.prototype.commaEveryDay=function(){return"، كل يوم"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return"، كل %s من أيام الأسبوع"},t.prototype.commaX0ThroughX1=function(){return"، %s حتى %s"},t.prototype.commaAndX0ThroughX1=function(){return"، و %s حتى %s"},t.prototype.first=function(){return"أول"},t.prototype.second=function(){return"ثاني"},t.prototype.third=function(){return"ثالث"},t.prototype.fourth=function(){return"رابع"},t.prototype.fifth=function(){return"خامس"},t.prototype.commaOnThe=function(){return"، في ال"},t.prototype.spaceX0OfTheMonth=function(){return" %s من الشهر"},t.prototype.lastDay=function(){return"اليوم الأخير"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return"، في اخر %s من الشهر"},t.prototype.commaOnlyOnX0=function(){return"، %s فقط"},t.prototype.commaAndOnX0=function(){return"، وفي %s"},t.prototype.commaEveryX0Months=function(){return"، كل %s أشهر"},t.prototype.commaOnlyInX0=function(){return"، %s فقط"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return"، في اخر يوم من الشهر"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return"، في اخر يوم أسبوع من الشهر"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return"، %s أيام قبل اخر يوم من الشهر"},t.prototype.firstWeekday=function(){return"اول ايام الأسبوع"},t.prototype.weekdayNearestDayX0=function(){return"يوم الأسبوع الأقرب ليوم %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return"، في %s من الشهر"},t.prototype.commaEveryX0Days=function(){return"، كل %s أيام"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return"، بين يوم %s و %s من الشهر"},t.prototype.commaOnDayX0OfTheMonth=function(){return"، في اليوم %s من الشهر"},t.prototype.commaEveryHour=function(){return"، كل ساعة"},t.prototype.commaEveryX0Years=function(){return"، كل %s سنوات"},t.prototype.commaStartingX0=function(){return"، بداية من %s"},t.prototype.daysOfTheWeek=function(){return["الأحد","الإثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت"]},t.prototype.monthsOfTheYear=function(){return["يناير","فبراير","مارس","ابريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"]},t.prototype.onTheHour=function(){return"في تمام الساعة"},t}();s.ar=p},348(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.be=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!1},t.prototype.everyMinute=function(){return"кожную хвіліну"},t.prototype.everyHour=function(){return"кожную гадзіну"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Адбылася памылка падчас генерацыі апісання выразы. Праверце сінтаксіс крон-выразы."},t.prototype.atSpace=function(){return"У "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Кожную хвіліну з %s да %s"},t.prototype.at=function(){return"У"},t.prototype.spaceAnd=function(){return" і"},t.prototype.everySecond=function(){return"кожную секунду"},t.prototype.everyX0Seconds=function(){return"кожныя %s секунд"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"секунды з %s па %s"},t.prototype.atX0SecondsPastTheMinute=function(){return"у %s секунд"},t.prototype.everyX0Minutes=function(){return"кожныя %s хвілін"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"хвіліны з %s па %s"},t.prototype.atX0MinutesPastTheHour=function(){return"у %s хвілін"},t.prototype.everyX0Hours=function(){return"кожныя %s гадзін"},t.prototype.betweenX0AndX1=function(){return"з %s па %s"},t.prototype.atX0=function(){return"у %s"},t.prototype.commaEveryDay=function(){return", кожны дзень"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", кожныя %s дзён тыдня"},t.prototype.commaX0ThroughX1=function(){return", %s па %s"},t.prototype.commaAndX0ThroughX1=function(){return", і %s па %s"},t.prototype.first=function(){return"першы"},t.prototype.second=function(){return"другі"},t.prototype.third=function(){return"трэці"},t.prototype.fourth=function(){return"чацвёрты"},t.prototype.fifth=function(){return"пяты"},t.prototype.commaOnThe=function(){return", у "},t.prototype.spaceX0OfTheMonth=function(){return" %s месяца"},t.prototype.lastDay=function(){return"апошні дзень"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", у апошні %s месяца"},t.prototype.commaOnlyOnX0=function(){return", толькі ў %s"},t.prototype.commaAndOnX0=function(){return", і ў %s"},t.prototype.commaEveryX0Months=function(){return", кожныя %s месяцаў"},t.prototype.commaOnlyInX0=function(){return", толькі ў %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", у апошні дзень месяца"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", у апошні будні дзень месяца"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s дзён да апошняга дня месяца"},t.prototype.firstWeekday=function(){return"першы будны дзень"},t.prototype.weekdayNearestDayX0=function(){return"найбліжэйшы будны дзень да %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", у %s месяцы"},t.prototype.commaEveryX0Days=function(){return", кожныя %s дзён"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", з %s па %s лік месяца"},t.prototype.commaOnDayX0OfTheMonth=function(){return", у %s лік месяца"},t.prototype.commaEveryX0Years=function(){return", кожныя %s гадоў"},t.prototype.commaStartingX0=function(){return", пачатак %s"},t.prototype.daysOfTheWeek=function(){return["нядзеля","панядзелак","аўторак","серада","чацвер","пятніца","субота"]},t.prototype.monthsOfTheYear=function(){return["студзень","люты","сакавік","красавік","травень","чэрвень","ліпень","жнівень","верасень","кастрычнік","лістапад","снежань"]},t.prototype.onTheHour=function(){return"роўна ў гадзіну"},t}();s.be=p},622(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.bg=void 0;var p=function(a,i){var g=a!=null?Number(a):0;return g<2?i[0]:i[1]},t=function(a,i){var g=a!=null?Number(a):0;return i[[1,0,0,1,0,0,1][g]]},x=function(a,i){var g=a!=null?Number(a):1;g=Math.max(Math.min(g<10||g>20&&g%10!==0?g%10:3,3),1)-1;var v=["м","ж","ср"].indexOf(i);return["в","р","т"][g]+["и","а","о"][v]},h=function(){function a(){}return a.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},a.prototype.atX0MinutesPastTheHourGt20=function(){return null},a.prototype.commaMonthX0ThroughMonthX1=function(){return null},a.prototype.commaYearX0ThroughYearX1=function(){return null},a.prototype.use24HourTimeFormatByDefault=function(){return!0},a.prototype.everyMinute=function(){return"всяка минута"},a.prototype.everyHour=function(){return"всеки час"},a.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Възникна грешка при генериране на описанието на израза. Проверете синтаксиса на cron израза."},a.prototype.atSpace=function(){return"В "},a.prototype.everyMinuteBetweenX0AndX1=function(){return"Всяка минута от %s до %s"},a.prototype.at=function(){return"В"},a.prototype.spaceAnd=function(){return" и"},a.prototype.everySecond=function(){return"всяка секунда"},a.prototype.everyX0Seconds=function(i){return"всеки %s секунди"},a.prototype.secondsX0ThroughX1PastTheMinute=function(){return"секунди от %s до %s"},a.prototype.atX0SecondsPastTheMinute=function(i){return"%s-".concat(x(i,"ж")," секунда")},a.prototype.everyX0Minutes=function(i){return"всеки %s минути"},a.prototype.minutesX0ThroughX1PastTheHour=function(){return"минути от %s до %s"},a.prototype.atX0MinutesPastTheHour=function(i){return"%s-".concat(x(i,"ж")," минутa")},a.prototype.everyX0Hours=function(i){return"всеки %s часа"},a.prototype.betweenX0AndX1=function(){return"от %s до %s"},a.prototype.atX0=function(){return"в %s"},a.prototype.commaEveryDay=function(){return", всеки ден"},a.prototype.commaEveryX0DaysOfTheWeek=function(i){return p(i,[", всеки %s ден от седмицата",", всеки %s дена от седмицата"])},a.prototype.commaX0ThroughX1=function(i){return", от %s до %s"},a.prototype.commaAndX0ThroughX1=function(i){return" и от %s до %s"},a.prototype.first=function(i){return t(i,["первият","первата"])},a.prototype.second=function(i){return t(i,["вторият","втората"])},a.prototype.third=function(i){return t(i,["третият","третата"])},a.prototype.fourth=function(i){return t(i,["четвертият","четвертата"])},a.prototype.fifth=function(i){return t(i,["петият","петата"])},a.prototype.commaOnThe=function(i){return", "},a.prototype.spaceX0OfTheMonth=function(){return" %s на месеца"},a.prototype.lastDay=function(){return"последният ден"},a.prototype.commaOnTheLastX0OfTheMonth=function(i){return t(i,[", в последният %s от месеца",", в последната %s отмесеца"])},a.prototype.commaOnlyOnX0=function(i){return", %s"},a.prototype.commaAndOnX0=function(){return" и %s"},a.prototype.commaEveryX0Months=function(i){return" всеки %s месеца"},a.prototype.commaOnlyInMonthX0=function(){return", %s"},a.prototype.commaOnlyInX0=function(){return", в %s"},a.prototype.commaOnTheLastDayOfTheMonth=function(){return", в последният ден на месеца"},a.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", в последния делничен ден от месеца"},a.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(i){return p(i,[", %s ден преди края на месеца",", %s дена преди края на месеца"])},a.prototype.firstWeekday=function(){return"първият делничен ден"},a.prototype.weekdayNearestDayX0=function(){return"най-близкият делничен ден до %s число"},a.prototype.commaOnTheX0OfTheMonth=function(){return", на %s число от месеца"},a.prototype.commaEveryX0Days=function(i){return p(i,[", всеки %s ден",", всеки %s дена"])},a.prototype.commaBetweenDayX0AndX1OfTheMonth=function(i){var g,v=(g=i?.split("-"))!==null&&g!==void 0?g:[];return", от %s-".concat(x(v[0],"ср")," до %s-").concat(x(v[1],"ср")," число на месеца")},a.prototype.commaOnDayX0OfTheMonth=function(i){return", на %s-".concat(x(i,"ср")," число от месеца")},a.prototype.commaEveryX0Years=function(i){return p(i,[", всяка %s година",", всеки %s години"])},a.prototype.commaStartingX0=function(){return", започвайки %s"},a.prototype.daysOfTheWeek=function(){return["неделя","понеделник","вторник","сряда","четвъртък","петък","събота"]},a.prototype.monthsOfTheYear=function(){return["януари","февруари","март","април","май","юни","юли","август","септевмври","октомври","ноември","декември"]},a.prototype.onTheHour=function(){return"в началото на часа"},a}();s.bg=h},845(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ca=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"S'ha produït un error mentres es generava la descripció de l'expressió. Revisi la sintaxi de la expressió de cron."},t.prototype.at=function(){return"A les"},t.prototype.atSpace=function(){return"A les "},t.prototype.atX0=function(){return"a les %s"},t.prototype.atX0MinutesPastTheHour=function(){return"als %s minuts de l'hora"},t.prototype.atX0SecondsPastTheMinute=function(){return"als %s segonds del minut"},t.prototype.betweenX0AndX1=function(){return"entre les %s i les %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", entre els dies %s i %s del mes"},t.prototype.commaEveryDay=function(){return", cada dia"},t.prototype.commaEveryX0Days=function(){return", cada %s dies"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", cada %s dies de la setmana"},t.prototype.commaEveryX0Months=function(){return", cada %s mesos"},t.prototype.commaOnDayX0OfTheMonth=function(){return", el dia %s del mes"},t.prototype.commaOnlyInX0=function(){return", sólo en %s"},t.prototype.commaOnlyOnX0=function(){return", només el %s"},t.prototype.commaAndOnX0=function(){return", i el %s"},t.prototype.commaOnThe=function(){return", en el "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", en l'últim dia del mes"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", en l'últim dia de la setmana del mes"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dies abans de l'últim dia del mes"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", en l'últim %s del mes"},t.prototype.commaOnTheX0OfTheMonth=function(){return", en el %s del mes"},t.prototype.commaX0ThroughX1=function(){return", de %s a %s"},t.prototype.commaAndX0ThroughX1=function(){return", i de %s a %s"},t.prototype.everyHour=function(){return"cada hora"},t.prototype.everyMinute=function(){return"cada minut"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"cada minut entre les %s i les %s"},t.prototype.everySecond=function(){return"cada segon"},t.prototype.everyX0Hours=function(){return"cada %s hores"},t.prototype.everyX0Minutes=function(){return"cada %s minuts"},t.prototype.everyX0Seconds=function(){return"cada %s segons"},t.prototype.fifth=function(){return"cinquè"},t.prototype.first=function(){return"primer"},t.prototype.firstWeekday=function(){return"primer dia de la setmana"},t.prototype.fourth=function(){return"quart"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"del minut %s al %s passada l'hora"},t.prototype.second=function(){return"segon"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"En els segons %s al %s de cada minut"},t.prototype.spaceAnd=function(){return" i"},t.prototype.spaceX0OfTheMonth=function(){return" %s del mes"},t.prototype.lastDay=function(){return"l'últim dia"},t.prototype.third=function(){return"tercer"},t.prototype.weekdayNearestDayX0=function(){return"dia de la setmana més proper al %s"},t.prototype.commaEveryX0Years=function(){return", cada %s anys"},t.prototype.commaStartingX0=function(){return", començant %s"},t.prototype.daysOfTheWeek=function(){return["diumenge","dilluns","dimarts","dimecres","dijous","divendres","dissabte"]},t.prototype.monthsOfTheYear=function(){return["gener","febrer","març","abril","maig","juny","juliol","agost","setembre","octubre","novembre","desembre"]},t.prototype.onTheHour=function(){return"en punt"},t}();s.ca=p},651(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.cs=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Při vytváření popisu došlo k chybě. Zkontrolujte prosím správnost syntaxe cronu."},t.prototype.everyMinute=function(){return"každou minutu"},t.prototype.everyHour=function(){return"každou hodinu"},t.prototype.atSpace=function(){return"V "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Každou minutu mezi %s a %s"},t.prototype.at=function(){return"V"},t.prototype.spaceAnd=function(){return" a"},t.prototype.everySecond=function(){return"každou sekundu"},t.prototype.everyX0Seconds=function(){return"každých %s sekund"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekundy od %s do %s"},t.prototype.atX0SecondsPastTheMinute=function(){return"v %s sekund"},t.prototype.everyX0Minutes=function(){return"každých %s minut"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minuty od %s do %s"},t.prototype.atX0MinutesPastTheHour=function(){return"v %s minut"},t.prototype.everyX0Hours=function(){return"každých %s hodin"},t.prototype.betweenX0AndX1=function(){return"mezi %s a %s"},t.prototype.atX0=function(){return"v %s"},t.prototype.commaEveryDay=function(){return", každý den"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", každých %s dní v týdnu"},t.prototype.commaX0ThroughX1=function(){return", od %s do %s"},t.prototype.commaAndX0ThroughX1=function(){return", a od %s do %s"},t.prototype.first=function(){return"první"},t.prototype.second=function(){return"druhý"},t.prototype.third=function(){return"třetí"},t.prototype.fourth=function(){return"čtvrtý"},t.prototype.fifth=function(){return"pátý"},t.prototype.commaOnThe=function(){return", "},t.prototype.spaceX0OfTheMonth=function(){return" %s v měsíci"},t.prototype.lastDay=function(){return"poslední den"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", poslední %s v měsíci"},t.prototype.commaOnlyOnX0=function(){return", pouze v %s"},t.prototype.commaAndOnX0=function(){return", a v %s"},t.prototype.commaEveryX0Months=function(){return", každých %s měsíců"},t.prototype.commaOnlyInX0=function(){return", pouze v %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", poslední den v měsíci"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", poslední pracovní den v měsíci"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dní před posledním dnem v měsíci"},t.prototype.firstWeekday=function(){return"první pracovní den"},t.prototype.weekdayNearestDayX0=function(){return"pracovní den nejblíže %s. dni"},t.prototype.commaOnTheX0OfTheMonth=function(){return", v %s v měsíci"},t.prototype.commaEveryX0Days=function(){return", každých %s dnů"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", mezi dny %s a %s v měsíci"},t.prototype.commaOnDayX0OfTheMonth=function(){return", %s. den v měsíci"},t.prototype.commaEveryX0Years=function(){return", každých %s roků"},t.prototype.commaStartingX0=function(){return", začínající %s"},t.prototype.daysOfTheWeek=function(){return["Neděle","Pondělí","Úterý","Středa","Čtvrtek","Pátek","Sobota"]},t.prototype.monthsOfTheYear=function(){return["Leden","Únor","Březen","Duben","Květen","Červen","Červenec","Srpen","Září","Říjen","Listopad","Prosinec"]},t.prototype.onTheHour=function(){return"v celou hodinu"},t}();s.cs=p},506(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.da=void 0;var p=function(){function t(){}return t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Der opstod en fejl ved generering af udtryksbeskrivelsen. Tjek cron-ekspressionssyntaxen."},t.prototype.at=function(){return"kl"},t.prototype.atSpace=function(){return"kl "},t.prototype.atX0=function(){return"kl %s"},t.prototype.atX0MinutesPastTheHour=function(){return"%s minutter efter timeskift"},t.prototype.atX0SecondsPastTheMinute=function(){return"%s sekunder efter minutskift"},t.prototype.betweenX0AndX1=function(){return"mellem %s og %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", mellem dag %s og %s i måneden"},t.prototype.commaEveryDay=function(){return", hver dag"},t.prototype.commaEveryX0Days=function(){return", hver %s. dag"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", hver %s. ugedag"},t.prototype.commaEveryX0Months=function(){return", hver %s. måned"},t.prototype.commaEveryX0Years=function(){return", hvert %s. år"},t.prototype.commaOnDayX0OfTheMonth=function(){return", på dag %s i måneden"},t.prototype.commaOnlyInX0=function(){return", kun i %s"},t.prototype.commaOnlyOnX0=function(x){return", på enhver %s"},t.prototype.commaAndOnX0=function(){return", og på %s"},t.prototype.commaOnThe=function(){return", på den "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", på den sidste dag i måneden"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", på den sidste hverdag i måneden"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dage før den sidste dag i måneden"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", på den sidste %s i måneden"},t.prototype.commaOnTheX0OfTheMonth=function(){return", på den %s i måneden"},t.prototype.commaX0ThroughX1=function(){return", %s til og med %s"},t.prototype.commaAndX0ThroughX1=function(){return", og %s til og med %s"},t.prototype.everyHour=function(){return"hver time"},t.prototype.everyMinute=function(){return"hvert minut"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"hvert minut mellem %s og %s"},t.prototype.everySecond=function(){return"hvert sekund"},t.prototype.everyX0Hours=function(){return"hver %s. time"},t.prototype.everyX0Minutes=function(){return"hvert %s. minut"},t.prototype.everyX0Seconds=function(){return"hvert %s. sekund"},t.prototype.fifth=function(){return"femte"},t.prototype.first=function(){return"første"},t.prototype.firstWeekday=function(){return"første hverdag"},t.prototype.fourth=function(){return"fjerde"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutterne fra %s til og med %s hver time"},t.prototype.second=function(){return"anden"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekunderne fra %s til og med %s hvert minut"},t.prototype.spaceAnd=function(){return" og"},t.prototype.spaceX0OfTheMonth=function(){return" %s i måneden"},t.prototype.lastDay=function(){return"sidste dag"},t.prototype.third=function(){return"tredje"},t.prototype.weekdayNearestDayX0=function(){return"hverdag nærmest dag %s"},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.commaStartingX0=function(){return", startende %s"},t.prototype.daysOfTheWeek=function(){return["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"]},t.prototype.monthsOfTheYear=function(){return["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"]},t.prototype.onTheHour=function(){return"på timen"},t}();s.da=p},230(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.de=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.everyMinute=function(){return"jede Minute"},t.prototype.everyHour=function(){return"jede Stunde"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Beim Generieren der Ausdrucksbeschreibung ist ein Fehler aufgetreten. Überprüfen Sie die Syntax des Cron-Ausdrucks."},t.prototype.atSpace=function(){return"Um "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Jede Minute zwischen %s und %s"},t.prototype.at=function(){return"Um"},t.prototype.spaceAnd=function(){return" und"},t.prototype.everySecond=function(){return"Jede Sekunde"},t.prototype.everyX0Seconds=function(){return"alle %s Sekunden"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"Sekunden %s bis %s"},t.prototype.atX0SecondsPastTheMinute=function(){return"bei Sekunde %s"},t.prototype.everyX0Minutes=function(){return"alle %s Minuten"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"Minuten %s bis %s"},t.prototype.atX0MinutesPastTheHour=function(){return"bei Minute %s"},t.prototype.everyX0Hours=function(){return"alle %s Stunden"},t.prototype.betweenX0AndX1=function(){return"zwischen %s und %s"},t.prototype.atX0=function(){return"um %s"},t.prototype.commaEveryDay=function(){return", jeden Tag"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", alle %s Tage der Woche"},t.prototype.commaX0ThroughX1=function(){return", %s bis %s"},t.prototype.commaAndX0ThroughX1=function(){return", und %s bis %s"},t.prototype.first=function(){return"ersten"},t.prototype.second=function(){return"zweiten"},t.prototype.third=function(){return"dritten"},t.prototype.fourth=function(){return"vierten"},t.prototype.fifth=function(){return"fünften"},t.prototype.commaOnThe=function(){return", am "},t.prototype.spaceX0OfTheMonth=function(){return" %s des Monats"},t.prototype.lastDay=function(){return"der letzte Tag"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", am letzten %s des Monats"},t.prototype.commaOnlyOnX0=function(){return", nur jeden %s"},t.prototype.commaAndOnX0=function(){return", und jeden %s"},t.prototype.commaEveryX0Months=function(){return", alle %s Monate"},t.prototype.commaOnlyInX0=function(){return", nur im %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", am letzten Tag des Monats"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", am letzten Werktag des Monats"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s tage vor dem letzten Tag des Monats"},t.prototype.firstWeekday=function(){return"ersten Werktag"},t.prototype.weekdayNearestDayX0=function(){return"Werktag am nächsten zum %s Tag"},t.prototype.commaOnTheX0OfTheMonth=function(){return", am %s des Monats"},t.prototype.commaEveryX0Days=function(){return", alle %s Tage"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", zwischen Tag %s und %s des Monats"},t.prototype.commaOnDayX0OfTheMonth=function(){return", an Tag %s des Monats"},t.prototype.commaEveryX0Years=function(){return", alle %s Jahre"},t.prototype.commaStartingX0=function(){return", beginnend %s"},t.prototype.daysOfTheWeek=function(){return["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},t.prototype.monthsOfTheYear=function(){return["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},t.prototype.onTheHour=function(){return"zur vollen Stunde"},t}();s.de=p},486(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.en=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!1},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occurred when generating the expression description. Check the cron expression syntax."},t.prototype.everyMinute=function(){return"every minute"},t.prototype.everyHour=function(){return"every hour"},t.prototype.atSpace=function(){return"At "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Every minute between %s and %s"},t.prototype.at=function(){return"At"},t.prototype.spaceAnd=function(){return" and"},t.prototype.everySecond=function(){return"every second"},t.prototype.everyX0Seconds=function(){return"every %s seconds"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},t.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},t.prototype.everyX0Minutes=function(){return"every %s minutes"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},t.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},t.prototype.everyX0Hours=function(){return"every %s hours"},t.prototype.betweenX0AndX1=function(){return"between %s and %s"},t.prototype.atX0=function(){return"at %s"},t.prototype.commaEveryDay=function(){return", every day"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", every %s days of the week"},t.prototype.commaX0ThroughX1=function(){return", %s through %s"},t.prototype.commaAndX0ThroughX1=function(){return", %s through %s"},t.prototype.first=function(){return"first"},t.prototype.second=function(){return"second"},t.prototype.third=function(){return"third"},t.prototype.fourth=function(){return"fourth"},t.prototype.fifth=function(){return"fifth"},t.prototype.commaOnThe=function(){return", on the "},t.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},t.prototype.lastDay=function(){return"the last day"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},t.prototype.commaOnlyOnX0=function(){return", only on %s"},t.prototype.commaAndOnX0=function(){return", and on %s"},t.prototype.commaEveryX0Months=function(){return", every %s months"},t.prototype.commaOnlyInX0=function(){return", only in %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s days before the last day of the month"},t.prototype.firstWeekday=function(){return"first weekday"},t.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},t.prototype.commaEveryX0Days=function(){return", every %s days in a month"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},t.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},t.prototype.commaEveryHour=function(){return", every hour"},t.prototype.commaEveryX0Years=function(){return", every %s years"},t.prototype.commaStartingX0=function(){return", starting %s"},t.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},t.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},t.prototype.atReboot=function(){return"Run once, at startup"},t.prototype.onTheHour=function(){return"on the hour"},t}();s.en=p},153(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.es=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Ocurrió un error mientras se generaba la descripción de la expresión. Revise la sintaxis de la expresión de cron."},t.prototype.at=function(){return"A las"},t.prototype.atSpace=function(){return"A las "},t.prototype.atX0=function(){return"a las %s"},t.prototype.atX0MinutesPastTheHour=function(){return"a los %s minutos de la hora"},t.prototype.atX0SecondsPastTheMinute=function(){return"a los %s segundos del minuto"},t.prototype.betweenX0AndX1=function(){return"entre las %s y las %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", entre los días %s y %s del mes"},t.prototype.commaEveryDay=function(){return", cada día"},t.prototype.commaEveryX0Days=function(){return", cada %s días"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", cada %s días de la semana"},t.prototype.commaEveryX0Months=function(){return", cada %s meses"},t.prototype.commaOnDayX0OfTheMonth=function(){return", el día %s del mes"},t.prototype.commaOnlyInX0=function(){return", sólo en %s"},t.prototype.commaOnlyOnX0=function(){return", sólo el %s"},t.prototype.commaAndOnX0=function(){return", y el %s"},t.prototype.commaOnThe=function(){return", en el "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", en el último día del mes"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", en el último día de la semana del mes"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s días antes del último día del mes"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", en el último %s del mes"},t.prototype.commaOnTheX0OfTheMonth=function(){return", en el %s del mes"},t.prototype.commaX0ThroughX1=function(){return", de %s a %s"},t.prototype.commaAndX0ThroughX1=function(){return", y de %s a %s"},t.prototype.everyHour=function(){return"cada hora"},t.prototype.everyMinute=function(){return"cada minuto"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"cada minuto entre las %s y las %s"},t.prototype.everySecond=function(){return"cada segundo"},t.prototype.everyX0Hours=function(){return"cada %s horas"},t.prototype.everyX0Minutes=function(){return"cada %s minutos"},t.prototype.everyX0Seconds=function(){return"cada %s segundos"},t.prototype.fifth=function(){return"quinto"},t.prototype.first=function(){return"primero"},t.prototype.firstWeekday=function(){return"primer día de la semana"},t.prototype.fourth=function(){return"cuarto"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"del minuto %s al %s pasada la hora"},t.prototype.second=function(){return"segundo"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"En los segundos %s al %s de cada minuto"},t.prototype.spaceAnd=function(){return" y"},t.prototype.spaceX0OfTheMonth=function(){return" %s del mes"},t.prototype.lastDay=function(){return"el último día"},t.prototype.third=function(){return"tercer"},t.prototype.weekdayNearestDayX0=function(){return"día de la semana más próximo al %s"},t.prototype.commaEveryX0Years=function(){return", cada %s años"},t.prototype.commaStartingX0=function(){return", comenzando %s"},t.prototype.daysOfTheWeek=function(){return["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},t.prototype.monthsOfTheYear=function(){return["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},t.prototype.onTheHour=function(){return"en punto"},t}();s.es=p},804(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.fa=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"خطایی در نمایش توضیحات این وظیفه رخ داد. لطفا ساختار آن را بررسی کنید."},t.prototype.everyMinute=function(){return"هر دقیقه"},t.prototype.everyHour=function(){return"هر ساعت"},t.prototype.atSpace=function(){return"در "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"هر دقیقه بین %s و %s"},t.prototype.at=function(){return"در"},t.prototype.spaceAnd=function(){return" و"},t.prototype.everySecond=function(){return"هر ثانیه"},t.prototype.everyX0Seconds=function(){return"هر %s ثانیه"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"ثانیه %s تا %s دقیقه گذشته"},t.prototype.atX0SecondsPastTheMinute=function(){return"در %s قانیه از دقیقه گذشته"},t.prototype.everyX0Minutes=function(){return"هر %s دقیقه"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"دقیقه %s تا %s ساعت گذشته"},t.prototype.atX0MinutesPastTheHour=function(){return"در %s دقیقه پس از ساعت"},t.prototype.everyX0Hours=function(){return"هر %s ساعت"},t.prototype.betweenX0AndX1=function(){return"بین %s و %s"},t.prototype.atX0=function(){return"در %s"},t.prototype.commaEveryDay=function(){return", هر روز"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", هر %s روز از هفته"},t.prototype.commaX0ThroughX1=function(){return", %s تا %s"},t.prototype.commaAndX0ThroughX1=function(){return", و %s تا %s"},t.prototype.first=function(){return"اول"},t.prototype.second=function(){return"دوم"},t.prototype.third=function(){return"سوم"},t.prototype.fourth=function(){return"چهارم"},t.prototype.fifth=function(){return"پنجم"},t.prototype.commaOnThe=function(){return", در "},t.prototype.spaceX0OfTheMonth=function(){return" %s ماه"},t.prototype.lastDay=function(){return"آخرین روز"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", در %s ماه"},t.prototype.commaOnlyOnX0=function(){return", فقط در %s"},t.prototype.commaAndOnX0=function(){return", و در %s"},t.prototype.commaEveryX0Months=function(){return", هر %s ماه"},t.prototype.commaOnlyInX0=function(){return", فقط در %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", در آخرین روز ماه"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", در آخرین روز ماه"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s روز قبل از آخرین روز ماه"},t.prototype.firstWeekday=function(){return"اولین روز"},t.prototype.weekdayNearestDayX0=function(){return"روز نزدیک به روز %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", در %s ماه"},t.prototype.commaEveryX0Days=function(){return", هر %s روز"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", بین روز %s و %s ماه"},t.prototype.commaOnDayX0OfTheMonth=function(){return", در %s ماه"},t.prototype.commaEveryMinute=function(){return", هر minute"},t.prototype.commaEveryHour=function(){return", هر ساعت"},t.prototype.commaEveryX0Years=function(){return", هر %s سال"},t.prototype.commaStartingX0=function(){return", آغاز %s"},t.prototype.daysOfTheWeek=function(){return["یک‌شنبه","دوشنبه","سه‌شنبه","چهارشنبه","پنج‌شنبه","جمعه","شنبه"]},t.prototype.monthsOfTheYear=function(){return["ژانویه","فوریه","مارس","آپریل","مه","ژوئن","ژوئیه","آگوست","سپتامبر","اکتبر","نوامبر","دسامبر"]},t.prototype.onTheHour=function(){return"سر ساعت"},t}();s.fa=p},964(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.fi=void 0;var p=function(){function t(){}return t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Virhe kuvauksen generoinnissa. Tarkista cron-syntaksi."},t.prototype.at=function(){return"Klo"},t.prototype.atSpace=function(){return"Klo "},t.prototype.atX0=function(){return"klo %s"},t.prototype.atX0MinutesPastTheHour=function(){return"%s minuuttia yli"},t.prototype.atX0MinutesPastTheHourGt20=function(){return"%s minuuttia yli"},t.prototype.atX0SecondsPastTheMinute=function(){return"%s sekunnnin jälkeen"},t.prototype.betweenX0AndX1=function(){return"%s - %s välillä"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", kuukauden päivien %s ja %s välillä"},t.prototype.commaEveryDay=function(){return", joka päivä"},t.prototype.commaEveryHour=function(){return", joka tunti"},t.prototype.commaEveryMinute=function(){return", joka minuutti"},t.prototype.commaEveryX0Days=function(){return", joka %s. päivä"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", joka %s. viikonpäivä"},t.prototype.commaEveryX0Months=function(){return", joka %s. kuukausi"},t.prototype.commaEveryX0Years=function(){return", joka %s. vuosi"},t.prototype.commaOnDayX0OfTheMonth=function(){return", kuukauden %s päivä"},t.prototype.commaOnlyInX0=function(){return", vain %s"},t.prototype.commaOnlyOnX0=function(){return", vain %s"},t.prototype.commaOnThe=function(){return","},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", kuukauden viimeisenä päivänä"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", kuukauden viimeisenä viikonpäivänä"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", kuukauden viimeinen %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", kuukauden %s"},t.prototype.commaX0ThroughX1=function(){return", %s - %s"},t.prototype.commaAndX0ThroughX1=function(){return", %s - %s"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s päivää ennen kuukauden viimeistä päivää"},t.prototype.commaStartingX0=function(){return", alkaen %s"},t.prototype.everyHour=function(){return"joka tunti"},t.prototype.everyMinute=function(){return"joka minuutti"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"joka minuutti %s - %s välillä"},t.prototype.everySecond=function(){return"joka sekunti"},t.prototype.everyX0Hours=function(){return"joka %s. tunti"},t.prototype.everyX0Minutes=function(){return"joka %s. minuutti"},t.prototype.everyX0Seconds=function(){return"joka %s. sekunti"},t.prototype.fifth=function(){return"viides"},t.prototype.first=function(){return"ensimmäinen"},t.prototype.firstWeekday=function(){return"ensimmäinen viikonpäivä"},t.prototype.fourth=function(){return"neljäs"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"joka tunti minuuttien %s - %s välillä"},t.prototype.second=function(){return"toinen"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"joka minuutti sekunttien %s - %s välillä"},t.prototype.spaceAnd=function(){return" ja"},t.prototype.spaceAndSpace=function(){return" ja "},t.prototype.spaceX0OfTheMonth=function(){return" %s kuukaudessa"},t.prototype.third=function(){return"kolmas"},t.prototype.weekdayNearestDayX0=function(){return"viikonpäivä lähintä %s päivää"},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.lastDay=function(){return"viimeinen päivä"},t.prototype.commaAndOnX0=function(){return", ja edelleen %s"},t.prototype.daysOfTheWeek=function(){return["sunnuntai","maanantai","tiistai","keskiviikko","torstai","perjantai","lauantai"]},t.prototype.monthsOfTheYear=function(){return["tammikuu","helmikuu","maaliskuu","huhtikuu","toukokuu","kesäkuu","heinäkuu","elokuu","syyskuu","lokakuu","marraskuu","joulukuu"]},t.prototype.onTheHour=function(){return"tasalta"},t}();s.fi=p},517(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.fr=void 0;var p=function(){function t(){}return t.prototype.conciseVerbosityReplacements=function(){return{"de le":"du"}},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Une erreur est survenue en générant la description de l'expression cron. Vérifiez sa syntaxe."},t.prototype.everyMinute=function(){return"toutes les minutes"},t.prototype.everyHour=function(){return"toutes les heures"},t.prototype.atSpace=function(){return"À "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Toutes les minutes entre %s et %s"},t.prototype.at=function(){return"À"},t.prototype.spaceAnd=function(){return" et"},t.prototype.everySecond=function(){return"toutes les secondes"},t.prototype.everyX0Seconds=function(){return"toutes les %s secondes"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"les secondes entre %s et %s après la minute"},t.prototype.atX0SecondsPastTheMinute=function(){return"%s secondes après la minute"},t.prototype.everyX0Minutes=function(){return"toutes les %s minutes"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"les minutes entre %s et %s après l'heure"},t.prototype.atX0MinutesPastTheHour=function(){return"%s minutes après l'heure"},t.prototype.everyX0Hours=function(){return"toutes les %s heures"},t.prototype.betweenX0AndX1=function(){return"de %s à %s"},t.prototype.atX0=function(){return"%s"},t.prototype.commaEveryDay=function(){return", tous les jours"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", tous les %s jours de la semaine"},t.prototype.commaX0ThroughX1=function(){return", de %s à %s"},t.prototype.commaAndX0ThroughX1=function(){return", et de %s à %s"},t.prototype.first=function(){return"premier"},t.prototype.second=function(){return"second"},t.prototype.third=function(){return"troisième"},t.prototype.fourth=function(){return"quatrième"},t.prototype.fifth=function(){return"cinquième"},t.prototype.commaOnThe=function(){return", le "},t.prototype.spaceX0OfTheMonth=function(){return" %s du mois"},t.prototype.lastDay=function(){return"le dernier jour"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", le dernier %s du mois"},t.prototype.commaOnlyOnX0=function(){return", uniquement le %s"},t.prototype.commaAndOnX0=function(){return", et %s"},t.prototype.commaEveryX0Months=function(){return", tous les %s mois"},t.prototype.commaOnlyInX0=function(){return", uniquement en %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", le dernier jour du mois"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", le dernier jour ouvrable du mois"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s jours avant le dernier jour du mois"},t.prototype.firstWeekday=function(){return"premier jour ouvrable"},t.prototype.weekdayNearestDayX0=function(){return"jour ouvrable le plus proche du %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", le %s du mois"},t.prototype.commaEveryX0Days=function(){return", tous les %s jours"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", du %s au %s du mois"},t.prototype.commaOnDayX0OfTheMonth=function(){return", le %s du mois"},t.prototype.commaEveryHour=function(){return", chaque heure"},t.prototype.commaEveryX0Years=function(){return", tous les %s ans"},t.prototype.commaDaysX0ThroughX1=function(){return", du %s au %s"},t.prototype.commaStartingX0=function(){return", à partir de %s"},t.prototype.daysOfTheWeek=function(){return["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},t.prototype.monthsOfTheYear=function(){return["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},t.prototype.onTheHour=function(){return"à l'heure pile"},t}();s.fr=p},82(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.he=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"אירעה שגיאה בעת יצירת תיאור הביטוי. בדוק את תחביר הביטוי cron."},t.prototype.everyMinute=function(){return"כל דקה"},t.prototype.everyHour=function(){return"כל שעה"},t.prototype.atSpace=function(){return"ב "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"כל דקה %s עד %s"},t.prototype.at=function(){return"ב"},t.prototype.spaceAnd=function(){return" ו"},t.prototype.everySecond=function(){return"כל שניה"},t.prototype.everyX0Seconds=function(){return"כל %s שניות"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"%s עד %s שניות של הדקה"},t.prototype.atX0SecondsPastTheMinute=function(){return"ב %s שניות של הדקה"},t.prototype.everyX0Minutes=function(){return"כל %s דקות"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"%s עד %s דקות של השעה"},t.prototype.atX0MinutesPastTheHour=function(){return"ב %s דקות של השעה"},t.prototype.everyX0Hours=function(){return"כל %s שעות"},t.prototype.betweenX0AndX1=function(){return"%s עד %s"},t.prototype.atX0=function(){return"ב %s"},t.prototype.commaEveryDay=function(){return", כל יום"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", כל %s ימים בשבוע"},t.prototype.commaX0ThroughX1=function(){return", %s עד %s"},t.prototype.commaAndX0ThroughX1=function(){return", ו %s עד %s"},t.prototype.first=function(){return"ראשון"},t.prototype.second=function(){return"שני"},t.prototype.third=function(){return"שלישי"},t.prototype.fourth=function(){return"רביעי"},t.prototype.fifth=function(){return"חמישי"},t.prototype.commaOnThe=function(){return", ב "},t.prototype.spaceX0OfTheMonth=function(){return" %s של החודש"},t.prototype.lastDay=function(){return"היום האחרון"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", רק ב %s של החודש"},t.prototype.commaOnlyOnX0=function(){return", רק ב %s"},t.prototype.commaAndOnX0=function(){return", וב %s"},t.prototype.commaEveryX0Months=function(){return", כל %s חודשים"},t.prototype.commaOnlyInX0=function(){return", רק ב %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", ביום האחרון של החודש"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", ביום החול האחרון של החודש"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s ימים לפני היום האחרון בחודש"},t.prototype.firstWeekday=function(){return"יום החול הראשון"},t.prototype.weekdayNearestDayX0=function(){return"יום החול הראשון הקרוב אל %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", ביום ה%s של החודש"},t.prototype.commaEveryX0Days=function(){return", כל %s ימים"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", בין היום ה%s וה%s של החודש"},t.prototype.commaOnDayX0OfTheMonth=function(){return", ביום ה%s של החודש"},t.prototype.commaEveryX0Years=function(){return", כל %s שנים"},t.prototype.commaStartingX0=function(){return", החל מ %s"},t.prototype.daysOfTheWeek=function(){return["יום ראשון","יום שני","יום שלישי","יום רביעי","יום חמישי","יום שישי","יום שבת"]},t.prototype.monthsOfTheYear=function(){return["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"]},t.prototype.onTheHour=function(){return"בשעה עגולה"},t}();s.he=p},131(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.hr=void 0;var p=function(){function t(){}return t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Došlo je do pogreške pri generiranju izraza. Provjerite sintaksu cron izraza."},t.prototype.at=function(){return"U"},t.prototype.atSpace=function(){return"U "},t.prototype.atX0=function(){return"u %s"},t.prototype.atX0MinutesPastTheHour=function(){return"u %s minuta nakon punog sata"},t.prototype.atX0SecondsPastTheMinute=function(){return"u %s sekundi nakon pune minute"},t.prototype.betweenX0AndX1=function(){return"između %s i %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", između %s. i %s. dana u mjesecu"},t.prototype.commaEveryDay=function(){return", svaki dan"},t.prototype.commaEveryX0Days=function(){return", svakih %s dana"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", svakih %s dana u tjednu"},t.prototype.commaEveryX0Months=function(){return", svakih %s mjeseci"},t.prototype.commaEveryX0Years=function(){return", svakih %s godina"},t.prototype.commaOnDayX0OfTheMonth=function(){return", %s. dan u mjesecu"},t.prototype.commaOnlyInX0=function(){return", samo u %s"},t.prototype.commaOnlyOnX0=function(){return", samo %s"},t.prototype.commaAndOnX0=function(){return", i %s"},t.prototype.commaOnThe=function(){return", "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", zadnji dan u mjesecu"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", zadnji radni dan u mjesecu"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dana prije kraja mjeseca"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", zadnji %s u mjesecu"},t.prototype.commaOnTheX0OfTheMonth=function(){return", %s u mjesecu"},t.prototype.commaX0ThroughX1=function(){return", od %s do %s"},t.prototype.commaAndX0ThroughX1=function(){return", i od %s do %s"},t.prototype.everyHour=function(){return"svaki sat"},t.prototype.everyMinute=function(){return"svaku minutu"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Svaku minutu između %s i %s"},t.prototype.everySecond=function(){return"svaku sekundu"},t.prototype.everyX0Hours=function(){return"svakih %s sati"},t.prototype.everyX0Minutes=function(){return"svakih %s minuta"},t.prototype.everyX0Seconds=function(){return"svakih %s sekundi"},t.prototype.fifth=function(){return"peti"},t.prototype.first=function(){return"prvi"},t.prototype.firstWeekday=function(){return"prvi radni dan"},t.prototype.fourth=function(){return"četvrti"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minute od %s do %s nakon punog sata"},t.prototype.second=function(){return"drugi"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekunde od %s do %s nakon pune minute"},t.prototype.spaceAnd=function(){return" i"},t.prototype.spaceX0OfTheMonth=function(){return" %s u mjesecu"},t.prototype.lastDay=function(){return"zadnji dan"},t.prototype.third=function(){return"treći"},t.prototype.weekdayNearestDayX0=function(){return"radni dan najbliži %s. danu"},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.commaStartingX0=function(){return", počevši od %s"},t.prototype.daysOfTheWeek=function(){return["Nedjelja","Ponedjeljak","Utorak","Srijeda","Četvrtak","Petak","Subota"]},t.prototype.monthsOfTheYear=function(){return["siječanj","veljača","ožujak","travanj","svibanj","lipanj","srpanj","kolovoz","rujan","listopad","studeni","prosinac"]},t.prototype.onTheHour=function(){return"u puni sat"},t}();s.hr=p},194(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.hu=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Hiba történt a kifejezésleírás generálásakor. Ellenőrizze a cron kifejezés szintaxisát."},t.prototype.everyMinute=function(){return"minden percben"},t.prototype.everyHour=function(){return"minden órában"},t.prototype.atSpace=function(){return"Ekkor: "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"percenként %s és %s között"},t.prototype.at=function(){return"Ekkor:"},t.prototype.spaceAnd=function(){return" és"},t.prototype.everySecond=function(){return"minden másodpercben"},t.prototype.everyX0Seconds=function(){return"%s másodpercenként"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"%s. másodpercben %s perc után"},t.prototype.atX0SecondsPastTheMinute=function(){return"%s. másodpercben"},t.prototype.everyX0Minutes=function(){return"minden %s. percben"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"%s. percben %s óra után"},t.prototype.atX0MinutesPastTheHour=function(){return"%s. percben"},t.prototype.everyX0Hours=function(){return"minden %s órában"},t.prototype.betweenX0AndX1=function(){return"%s és %s között"},t.prototype.atX0=function(){return"ekkor %s"},t.prototype.commaEveryDay=function(){return", minden nap"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", a hét minden %s napján"},t.prototype.commaX0ThroughX1=function(){return", %s - %s"},t.prototype.commaAndX0ThroughX1=function(){return", és %s - %s"},t.prototype.first=function(){return"első"},t.prototype.second=function(){return"második"},t.prototype.third=function(){return"harmadik"},t.prototype.fourth=function(){return"negyedik"},t.prototype.fifth=function(){return"ötödik"},t.prototype.commaOnThe=function(){return", "},t.prototype.spaceX0OfTheMonth=function(){return" %s a hónapban"},t.prototype.lastDay=function(){return"az utolsó nap"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", a hónap utolsó %s"},t.prototype.commaOnlyOnX0=function(){return", csak ekkor: %s"},t.prototype.commaAndOnX0=function(){return", és %s"},t.prototype.commaEveryX0Months=function(){return", minden %s hónapban"},t.prototype.commaOnlyInX0=function(){return", csak ekkor: %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", a hónap utolsó napján"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", a hónap utolsó hétköznapján"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s nappal a hónap utolsó napja előtt"},t.prototype.firstWeekday=function(){return"első hétköznap"},t.prototype.weekdayNearestDayX0=function(){return"hétköznap legközelebbi nap %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", a hónap %s"},t.prototype.commaEveryX0Days=function(){return", %s naponként"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", a hónap %s és %s napja között"},t.prototype.commaOnDayX0OfTheMonth=function(){return", a hónap %s napján"},t.prototype.commaEveryHour=function(){return", minden órában"},t.prototype.commaEveryX0Years=function(){return", %s évente"},t.prototype.commaStartingX0=function(){return", %s kezdettel"},t.prototype.daysOfTheWeek=function(){return["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"]},t.prototype.monthsOfTheYear=function(){return["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"]},t.prototype.onTheHour=function(){return"órakor"},t}();s.hu=p},72(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.id=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Terjadi kesalahan saat membuat deskripsi ekspresi. Periksa sintaks ekspresi cron."},t.prototype.everyMinute=function(){return"setiap menit"},t.prototype.everyHour=function(){return"setiap jam"},t.prototype.atSpace=function(){return"Pada "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Setiap menit diantara %s dan %s"},t.prototype.at=function(){return"Pada"},t.prototype.spaceAnd=function(){return" dan"},t.prototype.everySecond=function(){return"setiap detik"},t.prototype.everyX0Seconds=function(){return"setiap %s detik"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"detik ke %s sampai %s melewati menit"},t.prototype.atX0SecondsPastTheMinute=function(){return"pada %s detik lewat satu menit"},t.prototype.everyX0Minutes=function(){return"setiap %s menit"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"menit ke %s sampai %s melewati jam"},t.prototype.atX0MinutesPastTheHour=function(){return"pada %s menit melewati jam"},t.prototype.everyX0Hours=function(){return"setiap %s jam"},t.prototype.betweenX0AndX1=function(){return"diantara %s dan %s"},t.prototype.atX0=function(){return"pada %s"},t.prototype.commaEveryDay=function(){return", setiap hari"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", setiap hari %s dalam seminggu"},t.prototype.commaX0ThroughX1=function(){return", %s sampai %s"},t.prototype.commaAndX0ThroughX1=function(){return", dan %s sampai %s"},t.prototype.first=function(){return"pertama"},t.prototype.second=function(){return"kedua"},t.prototype.third=function(){return"ketiga"},t.prototype.fourth=function(){return"keempat"},t.prototype.fifth=function(){return"kelima"},t.prototype.commaOnThe=function(){return", di "},t.prototype.spaceX0OfTheMonth=function(){return" %s pada bulan"},t.prototype.lastDay=function(){return"hari terakhir"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", pada %s terakhir bulan ini"},t.prototype.commaOnlyOnX0=function(){return", hanya pada %s"},t.prototype.commaAndOnX0=function(){return", dan pada %s"},t.prototype.commaEveryX0Months=function(){return", setiap bulan %s "},t.prototype.commaOnlyInX0=function(){return", hanya pada %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", pada hari terakhir bulan ini"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", pada hari kerja terakhir setiap bulan"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s hari sebelum hari terakhir setiap bulan"},t.prototype.firstWeekday=function(){return"hari kerja pertama"},t.prototype.weekdayNearestDayX0=function(){return"hari kerja terdekat %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", pada %s bulan ini"},t.prototype.commaEveryX0Days=function(){return", setiap %s hari"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", antara hari %s dan %s dalam sebulan"},t.prototype.commaOnDayX0OfTheMonth=function(){return", pada hari %s dalam sebulan"},t.prototype.commaEveryHour=function(){return", setiap jam"},t.prototype.commaEveryX0Years=function(){return", setiap %s tahun"},t.prototype.commaStartingX0=function(){return", mulai pada %s"},t.prototype.daysOfTheWeek=function(){return["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"]},t.prototype.monthsOfTheYear=function(){return["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"]},t.prototype.onTheHour=function(){return"tepat pada jam"},t}();s.id=p},488(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.it=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"È verificato un errore durante la generazione la descrizione espressione. Controllare la sintassi delle espressioni cron."},t.prototype.at=function(){return"Alle"},t.prototype.atSpace=function(){return"Alle "},t.prototype.atX0=function(){return"alle %s"},t.prototype.atX0MinutesPastTheHour=function(){return"al %s minuto passata l'ora"},t.prototype.atX0SecondsPastTheMinute=function(){return"al %s secondo passato il minuto"},t.prototype.betweenX0AndX1=function(){return"tra le %s e le %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", tra il giorno %s e %s del mese"},t.prototype.commaEveryDay=function(){return", ogni giorno"},t.prototype.commaEveryX0Days=function(){return", ogni %s giorni"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", ogni %s giorni della settimana"},t.prototype.commaEveryX0Months=function(){return", ogni %s mesi"},t.prototype.commaEveryX0Years=function(){return", ogni %s anni"},t.prototype.commaOnDayX0OfTheMonth=function(){return", il giorno %s del mese"},t.prototype.commaOnlyInX0=function(){return", solo in %s"},t.prototype.commaOnlyOnX0=function(){return", solo il %s"},t.prototype.commaAndOnX0=function(){return", e il %s"},t.prototype.commaOnThe=function(){return", il "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", l'ultimo giorno del mese"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", nell'ultima settimana del mese"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s giorni prima dell'ultimo giorno del mese"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", l'ultimo %s del mese"},t.prototype.commaOnTheX0OfTheMonth=function(){return", il %s del mese"},t.prototype.commaX0ThroughX1=function(){return", %s al %s"},t.prototype.commaAndX0ThroughX1=function(){return", e %s al %s"},t.prototype.everyHour=function(){return"ogni ora"},t.prototype.everyMinute=function(){return"ogni minuto"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Ogni minuto tra le %s e le %s"},t.prototype.everySecond=function(){return"ogni secondo"},t.prototype.everyX0Hours=function(){return"ogni %s ore"},t.prototype.everyX0Minutes=function(){return"ogni %s minuti"},t.prototype.everyX0Seconds=function(){return"ogni %s secondi"},t.prototype.fifth=function(){return"quinto"},t.prototype.first=function(){return"primo"},t.prototype.firstWeekday=function(){return"primo giorno della settimana"},t.prototype.fourth=function(){return"quarto"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minuti %s al %s dopo l'ora"},t.prototype.second=function(){return"secondo"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"secondi %s al %s oltre il minuto"},t.prototype.spaceAnd=function(){return" e"},t.prototype.spaceX0OfTheMonth=function(){return" %s del mese"},t.prototype.lastDay=function(){return"l'ultimo giorno"},t.prototype.third=function(){return"terzo"},t.prototype.weekdayNearestDayX0=function(){return"giorno della settimana più vicino al %s"},t.prototype.commaStartingX0=function(){return", a partire %s"},t.prototype.daysOfTheWeek=function(){return["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"]},t.prototype.monthsOfTheYear=function(){return["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"]},t.prototype.onTheHour=function(){return"all'ora esatta"},t}();s.it=p},904(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ja=void 0;var p=function(){function t(){}return t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.everyMinute=function(){return"毎分"},t.prototype.everyHour=function(){return"毎時"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"式の記述を生成する際にエラーが発生しました。Cron 式の構文を確認してください。"},t.prototype.atSpace=function(){return"次において実施"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"%s から %s まで毎分"},t.prototype.at=function(){return"次において実施"},t.prototype.spaceAnd=function(){return"と"},t.prototype.everySecond=function(){return"毎秒"},t.prototype.everyX0Seconds=function(){return"%s 秒ごと"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"毎分 %s 秒から %s 秒まで"},t.prototype.atX0SecondsPastTheMinute=function(){return"毎分 %s 秒過ぎ"},t.prototype.everyX0Minutes=function(){return"%s 分ごと"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"毎時 %s 分から %s 分まで"},t.prototype.atX0MinutesPastTheHour=function(){return"毎時 %s 分過ぎ"},t.prototype.everyX0Hours=function(){return"%s 時間ごと"},t.prototype.betweenX0AndX1=function(){return"%s と %s の間"},t.prototype.atX0=function(){return"次において実施 %s"},t.prototype.commaEveryDay=function(){return"、毎日"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return"、週のうち %s 日ごと"},t.prototype.commaX0ThroughX1=function(){return"、%s から %s まで"},t.prototype.commaAndX0ThroughX1=function(){return"、%s から %s まで"},t.prototype.first=function(){return"1 番目"},t.prototype.second=function(){return"2 番目"},t.prototype.third=function(){return"3 番目"},t.prototype.fourth=function(){return"4 番目"},t.prototype.fifth=function(){return"5 番目"},t.prototype.commaOnThe=function(){return"次に"},t.prototype.spaceX0OfTheMonth=function(){return"月のうち %s"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return"月の最後の %s に"},t.prototype.commaOnlyOnX0=function(){return"%s にのみ"},t.prototype.commaEveryX0Months=function(){return"、%s か月ごと"},t.prototype.commaOnlyInX0=function(){return"%s でのみ"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return"次の最終日に"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return"月の最後の平日に"},t.prototype.firstWeekday=function(){return"最初の平日"},t.prototype.weekdayNearestDayX0=function(){return"%s 日の直近の平日"},t.prototype.commaOnTheX0OfTheMonth=function(){return"月の %s に"},t.prototype.commaEveryX0Days=function(){return"、%s 日ごと"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return"、月の %s 日から %s 日の間"},t.prototype.commaOnDayX0OfTheMonth=function(){return"、月の %s 日目"},t.prototype.spaceAndSpace=function(){return"と"},t.prototype.commaEveryMinute=function(){return"、毎分"},t.prototype.commaEveryHour=function(){return"、毎時"},t.prototype.commaEveryX0Years=function(){return"、%s 年ごと"},t.prototype.commaStartingX0=function(){return"、%s に開始"},t.prototype.aMPeriod=function(){return"AM"},t.prototype.pMPeriod=function(){return"PM"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return"月の最終日の %s 日前"},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.lastDay=function(){return"最終日"},t.prototype.commaAndOnX0=function(){return"、〜と %s"},t.prototype.daysOfTheWeek=function(){return["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},t.prototype.monthsOfTheYear=function(){return["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},t.prototype.onTheHour=function(){return"時ちょうど"},t}();s.ja=p},839(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ko=void 0;var p=function(){function t(){}return t.prototype.setPeriodBeforeTime=function(){return!0},t.prototype.pm=function(){return"오후"},t.prototype.am=function(){return"오전"},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!1},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"표현식 설명을 생성하는 중 오류가 발생했습니다. cron 표현식 구문을 확인하십시오."},t.prototype.everyMinute=function(){return"1분마다"},t.prototype.everyHour=function(){return"1시간마다"},t.prototype.atSpace=function(){return"시간 "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"매분 %s~%s"},t.prototype.at=function(){return"시간"},t.prototype.spaceAnd=function(){return" 및"},t.prototype.everySecond=function(){return"1초마다"},t.prototype.everyX0Seconds=function(){return"%s초마다"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"%s~%s초"},t.prototype.atX0SecondsPastTheMinute=function(){return"%s초"},t.prototype.everyX0Minutes=function(){return"%s분마다"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"%s~%s분"},t.prototype.atX0MinutesPastTheHour=function(){return"%s분"},t.prototype.everyX0Hours=function(){return"%s시간마다"},t.prototype.betweenX0AndX1=function(){return"%s에서 %s 사이"},t.prototype.atX0=function(){return"%s에서"},t.prototype.commaEveryDay=function(){return", 매일"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", 주 중 %s일마다"},t.prototype.commaX0ThroughX1=function(){return", %s에서 %s까지"},t.prototype.commaAndX0ThroughX1=function(){return", 및 %s에서 %s까지"},t.prototype.first=function(){return"첫 번째"},t.prototype.second=function(){return"두 번째"},t.prototype.third=function(){return"세 번째"},t.prototype.fourth=function(){return"네 번째"},t.prototype.fifth=function(){return"다섯 번째"},t.prototype.commaOnThe=function(){return", 매월 "},t.prototype.spaceX0OfTheMonth=function(){return" %s"},t.prototype.lastDay=function(){return"마지막 날"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", 해당 월의 마지막 %s"},t.prototype.commaOnlyOnX0=function(){return", %s에만"},t.prototype.commaAndOnX0=function(){return", 및 %s에"},t.prototype.commaEveryX0Months=function(){return", %s개월마다"},t.prototype.commaOnlyInX0=function(){return", %s에만"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", 해당 월의 마지막 날에"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", 매월 마지막 평일"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", 해당 월의 마지막 날 %s일 전"},t.prototype.firstWeekday=function(){return"첫 번째 평일"},t.prototype.weekdayNearestDayX0=function(){return"%s일과 가장 가까운 평일"},t.prototype.commaOnTheX0OfTheMonth=function(){return", 매월 %s"},t.prototype.commaEveryX0Days=function(){return", %s일마다"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", 해당 월의 %s일에서 %s일까지"},t.prototype.commaOnDayX0OfTheMonth=function(){return", 매월 %s일"},t.prototype.commaEveryMinute=function(){return", 1분마다"},t.prototype.commaEveryHour=function(){return", 1시간마다"},t.prototype.commaEveryX0Years=function(){return", %s년마다"},t.prototype.commaStartingX0=function(){return", %s부터"},t.prototype.daysOfTheWeek=function(){return["일요일","월요일","화요일","수요일","목요일","금요일","토요일"]},t.prototype.monthsOfTheYear=function(){return["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"]},t.prototype.onTheHour=function(){return"정각"},t}();s.ko=p},919(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.my=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!1},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Terdapat ralat semasa menjana penerangan ungkapan. Sila periksa sintaks ungkapan cron."},t.prototype.everyMinute=function(){return"setiap minit"},t.prototype.everyHour=function(){return"setiap jam"},t.prototype.atSpace=function(){return"Pada "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Setiap minit antara %s dan %s"},t.prototype.at=function(){return"Pada"},t.prototype.spaceAnd=function(){return" dan"},t.prototype.everySecond=function(){return"setiap saat"},t.prototype.everyX0Seconds=function(){return"setiap %s saat"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"saat ke %s hingga %s selepas minit"},t.prototype.atX0SecondsPastTheMinute=function(){return"pada %s saat selepas minit"},t.prototype.everyX0Minutes=function(){return"setiap %s minit"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minit ke %s hingga %s selepas jam"},t.prototype.atX0MinutesPastTheHour=function(){return"pada %s minit selepas jam"},t.prototype.everyX0Hours=function(){return"setiap %s jam"},t.prototype.betweenX0AndX1=function(){return"antara %s dan %s"},t.prototype.atX0=function(){return"pada %s"},t.prototype.commaEveryDay=function(){return", setiap hari"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", setiap %s hari dalam minggu"},t.prototype.commaX0ThroughX1=function(){return", %s hingga %s"},t.prototype.commaAndX0ThroughX1=function(){return", dan %s hingga %s"},t.prototype.first=function(){return"pertama"},t.prototype.second=function(){return"kedua"},t.prototype.third=function(){return"ketiga"},t.prototype.fourth=function(){return"keempat"},t.prototype.fifth=function(){return"kelima"},t.prototype.commaOnThe=function(){return", pada "},t.prototype.spaceX0OfTheMonth=function(){return" %s pada bulan"},t.prototype.lastDay=function(){return"hari terakhir"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", pada %s terakhir bulan"},t.prototype.commaOnlyOnX0=function(){return", hanya pada %s"},t.prototype.commaAndOnX0=function(){return", dan pada %s"},t.prototype.commaEveryX0Months=function(){return", setiap bulan %s"},t.prototype.commaOnlyInX0=function(){return", hanya pada %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", pada hari terakhir bulan"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", pada minggu terakhir bulan"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s hari sebelum hari terakhir bulan"},t.prototype.firstWeekday=function(){return"hari pertama minggu bekerja"},t.prototype.weekdayNearestDayX0=function(){return"hari bekerja yang terdekat dengan %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", pada %s bulan"},t.prototype.commaEveryX0Days=function(){return", setiap %s hari"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", antara hari %s dan %s dalam bulan"},t.prototype.commaOnDayX0OfTheMonth=function(){return", pada hari %s dalam bulan"},t.prototype.commaEveryHour=function(){return", setiap jam"},t.prototype.commaEveryX0Years=function(){return", setiap %s tahun"},t.prototype.commaStartingX0=function(){return", bermula %s"},t.prototype.daysOfTheWeek=function(){return["Ahad","Isnin","Selasa","Rabu","Khamis","Jumaat","Sabtu"]},t.prototype.monthsOfTheYear=function(){return["Januari","Februari","Mac","April","Mei","Jun","Julai","Ogos","September","Oktober","November","Disember"]},t.prototype.onTheHour=function(){return"pada waktu yang tepat"},t}();s.my=p},957(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.nb=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"En feil inntraff ved generering av uttrykksbeskrivelse. Sjekk cron syntaks."},t.prototype.at=function(){return"Kl."},t.prototype.atSpace=function(){return"Kl."},t.prototype.atX0=function(){return"på %s"},t.prototype.atX0MinutesPastTheHour=function(){return"på %s minutter etter timen"},t.prototype.atX0SecondsPastTheMinute=function(){return"på %s sekunder etter minuttet"},t.prototype.betweenX0AndX1=function(){return"mellom %s og %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", mellom dag %s og %s av måneden"},t.prototype.commaEveryDay=function(){return", hver dag"},t.prototype.commaEveryX0Days=function(){return", hver %s dag"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", hver %s ukedag"},t.prototype.commaEveryX0Months=function(){return", hver %s måned"},t.prototype.commaEveryX0Years=function(){return", hvert %s år"},t.prototype.commaOnDayX0OfTheMonth=function(){return", på dag %s av måneden"},t.prototype.commaOnlyInX0=function(){return", bare i %s"},t.prototype.commaOnlyOnX0=function(){return", på %s"},t.prototype.commaAndOnX0=function(){return", og på %s"},t.prototype.commaOnThe=function(){return", på "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", på den siste dagen i måneden"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", den siste ukedagen i måneden"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dager før den siste dagen i måneden"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", på den siste %s av måneden"},t.prototype.commaOnTheX0OfTheMonth=function(){return", på den %s av måneden"},t.prototype.commaX0ThroughX1=function(){return", %s til og med %s"},t.prototype.commaAndX0ThroughX1=function(){return", og %s til og med %s"},t.prototype.everyHour=function(){return"hver time"},t.prototype.everyMinute=function(){return"hvert minutt"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Hvert minutt mellom %s og %s"},t.prototype.everySecond=function(){return"hvert sekund"},t.prototype.everyX0Hours=function(){return"hver %s time"},t.prototype.everyX0Minutes=function(){return"hvert %s minutt"},t.prototype.everyX0Seconds=function(){return"hvert %s sekund"},t.prototype.fifth=function(){return"femte"},t.prototype.first=function(){return"første"},t.prototype.firstWeekday=function(){return"første ukedag"},t.prototype.fourth=function(){return"fjerde"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minuttene fra %s til og med %s etter timen"},t.prototype.second=function(){return"andre"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekundene fra %s til og med %s etter minuttet"},t.prototype.spaceAnd=function(){return" og"},t.prototype.spaceX0OfTheMonth=function(){return" %s i måneden"},t.prototype.lastDay=function(){return"den siste dagen"},t.prototype.third=function(){return"tredje"},t.prototype.weekdayNearestDayX0=function(){return"ukedag nærmest dag %s"},t.prototype.commaStartingX0=function(){return", starter %s"},t.prototype.daysOfTheWeek=function(){return["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"]},t.prototype.monthsOfTheYear=function(){return["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"]},t.prototype.onTheHour=function(){return"på timen"},t}();s.nb=p},647(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.nl=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.everyMinute=function(){return"elke minuut"},t.prototype.everyHour=function(){return"elk uur"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Er is een fout opgetreden bij het vertalen van de gegevens. Controleer de gegevens."},t.prototype.atSpace=function(){return"Om "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Elke minuut tussen %s en %s"},t.prototype.at=function(){return"Om"},t.prototype.spaceAnd=function(){return" en"},t.prototype.everySecond=function(){return"elke seconde"},t.prototype.everyX0Seconds=function(){return"elke %s seconden"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconden %s t/m %s na de minuut"},t.prototype.atX0SecondsPastTheMinute=function(){return"op %s seconden na de minuut"},t.prototype.everyX0Minutes=function(){return"elke %s minuten"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minuut %s t/m %s na het uur"},t.prototype.atX0MinutesPastTheHour=function(){return"op %s minuten na het uur"},t.prototype.everyX0Hours=function(){return"elke %s uur"},t.prototype.betweenX0AndX1=function(){return"tussen %s en %s"},t.prototype.atX0=function(){return"om %s"},t.prototype.commaEveryDay=function(){return", elke dag"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", elke %s dagen van de week"},t.prototype.commaX0ThroughX1=function(){return", %s t/m %s"},t.prototype.commaAndX0ThroughX1=function(){return", en %s t/m %s"},t.prototype.first=function(){return"eerste"},t.prototype.second=function(){return"tweede"},t.prototype.third=function(){return"derde"},t.prototype.fourth=function(){return"vierde"},t.prototype.fifth=function(){return"vijfde"},t.prototype.commaOnThe=function(){return", op de "},t.prototype.spaceX0OfTheMonth=function(){return" %s van de maand"},t.prototype.lastDay=function(){return"de laatste dag"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", op de laatste %s van de maand"},t.prototype.commaOnlyOnX0=function(){return", alleen op %s"},t.prototype.commaAndOnX0=function(){return", en op %s"},t.prototype.commaEveryX0Months=function(){return", elke %s maanden"},t.prototype.commaOnlyInX0=function(){return", alleen in %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", op de laatste dag van de maand"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", op de laatste werkdag van de maand"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dagen vóór de laatste dag van de maand"},t.prototype.firstWeekday=function(){return"eerste werkdag"},t.prototype.weekdayNearestDayX0=function(){return"werkdag dichtst bij dag %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", op de %s van de maand"},t.prototype.commaEveryX0Days=function(){return", elke %s dagen"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", tussen dag %s en %s van de maand"},t.prototype.commaOnDayX0OfTheMonth=function(){return", op dag %s van de maand"},t.prototype.commaEveryX0Years=function(){return", elke %s jaren"},t.prototype.commaStartingX0=function(){return", beginnend %s"},t.prototype.daysOfTheWeek=function(){return["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"]},t.prototype.monthsOfTheYear=function(){return["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"]},t.prototype.onTheHour=function(){return"op het hele uur"},t}();s.nl=p},905(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.pl=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Wystąpił błąd podczas generowania opisu wyrażenia cron. Sprawdź składnię wyrażenia cron."},t.prototype.at=function(){return"O"},t.prototype.atSpace=function(){return"O "},t.prototype.atX0=function(){return"o %s"},t.prototype.atX0MinutesPastTheHour=function(){return"w %s minucie"},t.prototype.atX0SecondsPastTheMinute=function(){return"w %s sekundzie"},t.prototype.betweenX0AndX1=function(){return"od %s do %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", od %s-ego do %s-ego dnia miesiąca"},t.prototype.commaEveryDay=function(){return", co dzień"},t.prototype.commaEveryX0Days=function(){return", co %s dni"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", co %s dni tygodnia"},t.prototype.commaEveryX0Months=function(){return", co %s miesięcy"},t.prototype.commaEveryX0Years=function(){return", co %s lat"},t.prototype.commaOnDayX0OfTheMonth=function(){return", %s-ego dnia miesiąca"},t.prototype.commaOnlyInX0=function(){return", tylko %s"},t.prototype.commaOnlyOnX0=function(){return", tylko %s"},t.prototype.commaAndOnX0=function(){return", i %s"},t.prototype.commaOnThe=function(){return", "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", ostatni dzień miesiąca"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", ostatni dzień roboczy miesiąca"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dni przed ostatnim dniem miesiąca"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", ostatni %s miesiąca"},t.prototype.commaOnTheX0OfTheMonth=function(){return", %s miesiąca"},t.prototype.commaX0ThroughX1=function(){return", od %s do %s"},t.prototype.commaAndX0ThroughX1=function(){return", i od %s do %s"},t.prototype.everyHour=function(){return"co godzinę"},t.prototype.everyMinute=function(){return"co minutę"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Co minutę od %s do %s"},t.prototype.everySecond=function(){return"co sekundę"},t.prototype.everyX0Hours=function(){return"co %s godzin"},t.prototype.everyX0Minutes=function(){return"co %s minut"},t.prototype.everyX0Seconds=function(){return"co %s sekund"},t.prototype.fifth=function(){return"piąty"},t.prototype.first=function(){return"pierwszy"},t.prototype.firstWeekday=function(){return"pierwszy dzień roboczy"},t.prototype.fourth=function(){return"czwarty"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minuty od %s do %s"},t.prototype.second=function(){return"drugi"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekundy od %s do %s"},t.prototype.spaceAnd=function(){return" i"},t.prototype.spaceX0OfTheMonth=function(){return" %s miesiąca"},t.prototype.lastDay=function(){return"ostatni dzień"},t.prototype.third=function(){return"trzeci"},t.prototype.weekdayNearestDayX0=function(){return"dzień roboczy najbliższy %s-ego dnia"},t.prototype.commaStartingX0=function(){return", startowy %s"},t.prototype.daysOfTheWeek=function(){return["niedziela","poniedziałek","wtorek","środa","czwartek","piątek","sobota"]},t.prototype.monthsOfTheYear=function(){return["styczeń","luty","marzec","kwiecień","maj","czerwiec","lipiec","sierpień","wrzesień","październik","listopad","grudzień"]},t.prototype.onTheHour=function(){return"o pełnej godzinie"},t}();s.pl=p},556(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.pt_BR=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Ocorreu um erro ao gerar a descrição da expressão Cron."},t.prototype.at=function(){return"às"},t.prototype.atSpace=function(){return"às "},t.prototype.atX0=function(){return"Às %s"},t.prototype.atX0MinutesPastTheHour=function(){return"aos %s minutos da hora"},t.prototype.atX0SecondsPastTheMinute=function(){return"aos %s segundos do minuto"},t.prototype.betweenX0AndX1=function(){return"entre %s e %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", entre os dias %s e %s do mês"},t.prototype.commaEveryDay=function(){return", a cada dia"},t.prototype.commaEveryX0Days=function(){return", a cada %s dias"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", a cada %s dias de semana"},t.prototype.commaEveryX0Months=function(){return", a cada %s meses"},t.prototype.commaOnDayX0OfTheMonth=function(){return", no dia %s do mês"},t.prototype.commaOnlyInX0=function(x){return x&&x.length>1&&x[1]==="-"?"somente %s":", somente em %s"},t.prototype.commaOnlyOnX0=function(x){return x&&x.length>1&&x[1]==="-"?", somente %s":", somente de %s"},t.prototype.commaAndOnX0=function(){return", e de %s"},t.prototype.commaOnThe=function(x,h){return h==="6"||h==="0"?", no":", na "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", no último dia do mês"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", no último dia da semana do mês"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dias antes do último dia do mês"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", na última %s do mês"},t.prototype.commaOnTheX0OfTheMonth=function(){return", no %s do mês"},t.prototype.commaX0ThroughX1=function(){return", de %s a %s"},t.prototype.commaAndX0ThroughX1=function(){return", e de %s a %s"},t.prototype.everyHour=function(){return"a cada hora"},t.prototype.everyMinute=function(){return"a cada minuto"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"a cada minuto entre %s e %s"},t.prototype.everySecond=function(){return"a cada segundo"},t.prototype.everyX0Hours=function(){return"a cada %s horas"},t.prototype.everyX0Minutes=function(){return"a cada %s minutos"},t.prototype.everyX0Seconds=function(){return"a cada %s segundos"},t.prototype.fifth=function(x){return x==="6"||x==="0"?"quinto":"quinta"},t.prototype.first=function(x){return x==="6"||x==="0"?"primeiro":"primeira"},t.prototype.firstWeekday=function(){return"primeiro dia da semana"},t.prototype.fourth=function(x){return x==="6"||x==="0"?"quarto":"quarta"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"do minuto %s até %s de cada hora"},t.prototype.second=function(x){return x==="6"||x==="0"?"segundo":"segunda"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"No segundo %s até %s de cada minuto"},t.prototype.spaceAnd=function(){return" e"},t.prototype.spaceX0OfTheMonth=function(){return" %s do mês"},t.prototype.lastDay=function(){return"o último dia"},t.prototype.third=function(x){return x==="6"||x==="0"?"terceiro":"terceira"},t.prototype.weekdayNearestDayX0=function(){return"dia da semana mais próximo do dia %s"},t.prototype.commaEveryX0Years=function(){return", a cada %s anos"},t.prototype.commaStartingX0=function(){return", iniciando %s"},t.prototype.daysOfTheWeek=function(){return["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},t.prototype.monthsOfTheYear=function(){return["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},t.prototype.onTheHour=function(){return"na hora certa"},t}();s.pt_BR=p},163(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.pt_PT=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Ocorreu um erro ao gerar a descrição da expressão Cron."},t.prototype.at=function(){return"às"},t.prototype.atSpace=function(){return"às "},t.prototype.atX0=function(){return"Às %s"},t.prototype.atX0MinutesPastTheHour=function(){return"aos %s minutos da hora"},t.prototype.atX0SecondsPastTheMinute=function(){return"aos %s segundos do minuto"},t.prototype.betweenX0AndX1=function(){return"entre %s e %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", entre os dias %s e %s do mês"},t.prototype.commaEveryDay=function(){return", a cada dia"},t.prototype.commaEveryX0Days=function(){return", a cada %s dias"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", a cada %s dias de semana"},t.prototype.commaEveryX0Months=function(){return", a cada %s meses"},t.prototype.commaOnDayX0OfTheMonth=function(){return", no dia %s do mês"},t.prototype.commaOnlyInX0=function(){return", somente em %s"},t.prototype.commaOnlyOnX0=function(){return", somente de %s"},t.prototype.commaAndOnX0=function(){return", e de %s"},t.prototype.commaOnThe=function(x,h){return h==="6"||h==="0"?", no":", na "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", no último dia do mês"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", no último dia da semana do mês"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dias antes do último dia do mês"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", na última %s do mês"},t.prototype.commaOnTheX0OfTheMonth=function(){return", no %s do mês"},t.prototype.commaX0ThroughX1=function(){return", de %s a %s"},t.prototype.commaAndX0ThroughX1=function(){return", e de %s a %s"},t.prototype.everyHour=function(){return"a cada hora"},t.prototype.everyMinute=function(){return"a cada minuto"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"a cada minuto entre %s e %s"},t.prototype.everySecond=function(){return"a cada segundo"},t.prototype.everyX0Hours=function(){return"a cada %s horas"},t.prototype.everyX0Minutes=function(){return"a cada %s minutos"},t.prototype.everyX0Seconds=function(){return"a cada %s segundos"},t.prototype.fifth=function(x){return x==="6"||x==="0"?"quinto":"quinta"},t.prototype.first=function(x){return x==="6"||x==="0"?"primeiro":"primeira"},t.prototype.firstWeekday=function(){return"primeiro dia da semana"},t.prototype.fourth=function(x){return x==="6"||x==="0"?"quarto":"quarta"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"do minuto %s até %s de cada hora"},t.prototype.second=function(x){return x==="6"||x==="0"?"segundo":"segunda"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"No segundo %s até %s de cada minuto"},t.prototype.spaceAnd=function(){return" e"},t.prototype.spaceX0OfTheMonth=function(){return" %s do mês"},t.prototype.lastDay=function(){return"o último dia"},t.prototype.third=function(x){return x==="6"||x==="0"?"terceiro":"terceira"},t.prototype.weekdayNearestDayX0=function(){return"dia da semana mais próximo do dia %s"},t.prototype.commaEveryX0Years=function(){return", a cada %s anos"},t.prototype.commaStartingX0=function(){return", iniciando %s"},t.prototype.daysOfTheWeek=function(){return["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},t.prototype.monthsOfTheYear=function(){return["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},t.prototype.onTheHour=function(){return"à hora certa"},t}();s.pt_PT=p},614(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ro=void 0;var p=function(){function t(){}return t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Eroare la generarea descrierii. Verificați sintaxa."},t.prototype.at=function(){return"La"},t.prototype.atSpace=function(){return"La "},t.prototype.atX0=function(){return"la %s"},t.prototype.atX0MinutesPastTheHour=function(){return"la și %s minute"},t.prototype.atX0SecondsPastTheMinute=function(){return"la și %s secunde"},t.prototype.betweenX0AndX1=function(){return"între %s și %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", între zilele %s și %s ale lunii"},t.prototype.commaEveryDay=function(){return", în fiecare zi"},t.prototype.commaEveryX0Days=function(){return", la fiecare %s zile"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", la fiecare a %s-a zi a săptămânii"},t.prototype.commaEveryX0Months=function(){return", la fiecare %s luni"},t.prototype.commaEveryX0Years=function(){return", o dată la %s ani"},t.prototype.commaOnDayX0OfTheMonth=function(){return", în ziua %s a lunii"},t.prototype.commaOnlyInX0=function(){return", doar în %s"},t.prototype.commaOnlyOnX0=function(){return", doar %s"},t.prototype.commaAndOnX0=function(){return", și %s"},t.prototype.commaOnThe=function(){return", în "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", în ultima zi a lunii"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", în ultima zi lucrătoare a lunii"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s zile înainte de ultima zi a lunii"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", în ultima %s a lunii"},t.prototype.commaOnTheX0OfTheMonth=function(){return", în %s a lunii"},t.prototype.commaX0ThroughX1=function(){return", de %s până %s"},t.prototype.commaAndX0ThroughX1=function(){return", și de %s până %s"},t.prototype.everyHour=function(){return"în fiecare oră"},t.prototype.everyMinute=function(){return"în fiecare minut"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"În fiecare minut între %s și %s"},t.prototype.everySecond=function(){return"în fiecare secundă"},t.prototype.everyX0Hours=function(){return"la fiecare %s ore"},t.prototype.everyX0Minutes=function(){return"la fiecare %s minute"},t.prototype.everyX0Seconds=function(){return"la fiecare %s secunde"},t.prototype.fifth=function(){return"a cincea"},t.prototype.first=function(){return"prima"},t.prototype.firstWeekday=function(){return"prima zi a săptămânii"},t.prototype.fourth=function(){return"a patra"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"între minutele %s și %s"},t.prototype.second=function(){return"a doua"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"între secunda %s și secunda %s"},t.prototype.spaceAnd=function(){return" și"},t.prototype.spaceX0OfTheMonth=function(){return" %s a lunii"},t.prototype.lastDay=function(){return"ultima zi"},t.prototype.third=function(){return"a treia"},t.prototype.weekdayNearestDayX0=function(){return"cea mai apropiată zi a săptămânii de ziua %s"},t.prototype.commaMonthX0ThroughMonthX1=function(){return", din %s până în %s"},t.prototype.commaYearX0ThroughYearX1=function(){return", din %s până în %s"},t.prototype.atX0MinutesPastTheHourGt20=function(){return"la și %s de minute"},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return"la și %s de secunde"},t.prototype.commaStartingX0=function(){return", pornire %s"},t.prototype.daysOfTheWeek=function(){return["duminică","luni","marți","miercuri","joi","vineri","sâmbătă"]},t.prototype.monthsOfTheYear=function(){return["ianuarie","februarie","martie","aprilie","mai","iunie","iulie","august","septembrie","octombrie","noiembrie","decembrie"]},t.prototype.onTheHour=function(){return"fix la oră"},t}();s.ro=p},892(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ru=void 0;var p=function(h,a){var i=Number(h);return i!==void 0?a[i%100>4&&i%100<20?2:[2,0,1,1,1,2][i%10<5?Math.abs(i)%10:5]]:a[2]},t=function(h,a){var i=Number(h);return i!==void 0?a[i===0?0:i===1||i===2||i===4?1:2]:a[1]},x=function(){function h(){}return h.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},h.prototype.atX0MinutesPastTheHourGt20=function(){return null},h.prototype.commaMonthX0ThroughMonthX1=function(){return null},h.prototype.commaYearX0ThroughYearX1=function(){return null},h.prototype.use24HourTimeFormatByDefault=function(){return!0},h.prototype.everyMinute=function(){return"каждую минуту"},h.prototype.everyHour=function(){return"каждый час"},h.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Произошла ошибка во время генерации описания выражения. Проверьте синтаксис крон-выражения."},h.prototype.atSpace=function(){return"В "},h.prototype.everyMinuteBetweenX0AndX1=function(){return"Каждую минуту с %s по %s"},h.prototype.at=function(){return"В"},h.prototype.spaceAnd=function(){return" и"},h.prototype.everySecond=function(){return"каждую секунду"},h.prototype.everyX0Seconds=function(a){return p(a,["каждую %s секунду","каждые %s секунды","каждые %s секунд"])},h.prototype.secondsX0ThroughX1PastTheMinute=function(){return"секунды с %s по %s"},h.prototype.atX0SecondsPastTheMinute=function(a){return p(a,["в %s секунду","в %s секунды","в %s секунд"])},h.prototype.everyX0Minutes=function(a){return p(a,["каждую %s минуту","каждые %s минуты","каждые %s минут"])},h.prototype.minutesX0ThroughX1PastTheHour=function(){return"минуты с %s по %s"},h.prototype.atX0MinutesPastTheHour=function(a){return p(a,["в %s минуту","в %s минуты","в %s минут"])},h.prototype.everyX0Hours=function(a){return p(a,["каждый %s час","каждые %s часа","каждые %s часов"])},h.prototype.betweenX0AndX1=function(){return"с %s по %s"},h.prototype.atX0=function(){return"в %s"},h.prototype.commaEveryDay=function(){return", каждый день"},h.prototype.commaEveryX0DaysOfTheWeek=function(a){return p(a,[", каждый %s день недели",", каждые %s дня недели",", каждые %s дней недели"])},h.prototype.commaX0ThroughX1=function(a){return a&&(a[0]=="2"||a[0]=="3")?", со %s по %s":", с %s по %s"},h.prototype.commaAndX0ThroughX1=function(a){return a&&(a[0]=="2"||a[0]=="3")?" и со %s по %s":" и с %s по %s"},h.prototype.first=function(a){return t(a,["первое","первый","первую"])},h.prototype.second=function(a){return t(a,["второе","второй","вторую"])},h.prototype.third=function(a){return t(a,["третье","третий","третью"])},h.prototype.fourth=function(a){return t(a,["четвертое","четвертый","четвертую"])},h.prototype.fifth=function(a){return t(a,["пятое","пятый","пятую"])},h.prototype.commaOnThe=function(a){return a==="2"?", во ":", в "},h.prototype.spaceX0OfTheMonth=function(){return" %s месяца"},h.prototype.lastDay=function(){return"последний день"},h.prototype.commaOnTheLastX0OfTheMonth=function(a){return t(a,[", в последнее %s месяца",", в последний %s месяца",", в последнюю %s месяца"])},h.prototype.commaOnlyOnX0=function(a){return a&&a[0]==="2"?", только во %s":", только в %s"},h.prototype.commaAndOnX0=function(){return", и %s"},h.prototype.commaEveryX0Months=function(a){return p(a,[""," каждые %s месяца"," каждые %s месяцев"])},h.prototype.commaOnlyInMonthX0=function(){return", только %s"},h.prototype.commaOnlyInX0=function(){return", только в %s"},h.prototype.commaOnTheLastDayOfTheMonth=function(){return", в последний день месяца"},h.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", в последний будний день месяца"},h.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(a){return p(a,[", за %s день до конца месяца",", за %s дня до конца месяца",", за %s дней до конца месяца"])},h.prototype.firstWeekday=function(){return"первый будний день"},h.prototype.weekdayNearestDayX0=function(){return"ближайший будний день к %s числу"},h.prototype.commaOnTheX0OfTheMonth=function(){return", в %s месяца"},h.prototype.commaEveryX0Days=function(a){return p(a,[", каждый %s день",", каждые %s дня",", каждые %s дней"])},h.prototype.commaBetweenDayX0AndX1OfTheMonth=function(a){return a&&a.substring(0,a.indexOf("-"))=="2"?", со %s по %s число месяца":", с %s по %s число месяца"},h.prototype.commaOnDayX0OfTheMonth=function(a){return a&&a[0]=="2"?", во %s число месяца":", в %s число месяца"},h.prototype.commaEveryX0Years=function(a){return p(a,[", каждый %s год",", каждые %s года",", каждые %s лет"])},h.prototype.commaStartingX0=function(){return", начало %s"},h.prototype.daysOfTheWeek=function(){return["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"]},h.prototype.daysOfTheWeekInCase=function(a){return a===void 0&&(a=2),a==1?["воскресенья","понедельника","вторника","среды","четверга","пятницы","субботы"]:["воскресенье","понедельник","вторник","среду","четверг","пятницу","субботу"]},h.prototype.monthsOfTheYear=function(){return["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"]},h.prototype.monthsOfTheYearInCase=function(a){return a==1?["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"]:this.monthsOfTheYear()},h.prototype.onTheHour=function(){return"ровно в час"},h}();s.ru=x},923(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sk=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Pri vytváraní popisu došlo k chybe. Skontrolujte prosím správnosť syntaxe cronu."},t.prototype.everyMinute=function(){return"každú minútu"},t.prototype.everyHour=function(){return"každú hodinu"},t.prototype.atSpace=function(){return"V "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Každú minútu medzi %s a %s"},t.prototype.at=function(){return"V"},t.prototype.spaceAnd=function(){return" a"},t.prototype.everySecond=function(){return"každú sekundu"},t.prototype.everyX0Seconds=function(){return"každých %s sekúnd"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekundy od %s do %s"},t.prototype.atX0SecondsPastTheMinute=function(){return"v %s sekúnd"},t.prototype.everyX0Minutes=function(){return"každých %s minút"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minúty od %s do %s"},t.prototype.atX0MinutesPastTheHour=function(){return"v %s minút"},t.prototype.everyX0Hours=function(){return"každých %s hodín"},t.prototype.betweenX0AndX1=function(){return"medzi %s a %s"},t.prototype.atX0=function(){return"v %s"},t.prototype.commaEveryDay=function(){return", každý deň"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", každých %s dní v týždni"},t.prototype.commaX0ThroughX1=function(){return", od %s do %s"},t.prototype.commaAndX0ThroughX1=function(){return", a od %s do %s"},t.prototype.first=function(){return"prvý"},t.prototype.second=function(){return"druhý"},t.prototype.third=function(){return"tretí"},t.prototype.fourth=function(){return"štvrtý"},t.prototype.fifth=function(){return"piaty"},t.prototype.commaOnThe=function(){return", "},t.prototype.spaceX0OfTheMonth=function(){return" %s v mesiaci"},t.prototype.lastDay=function(){return"posledný deň"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", posledný %s v mesiaci"},t.prototype.commaOnlyOnX0=function(){return", iba v %s"},t.prototype.commaAndOnX0=function(){return", a v %s"},t.prototype.commaEveryX0Months=function(){return", každých %s mesiacov"},t.prototype.commaOnlyInX0=function(){return", iba v %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", posledný deň v mesiaci"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", posledný pracovný deň v mesiaci"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dní pred posledným dňom v mesiaci"},t.prototype.firstWeekday=function(){return"prvý pracovný deň"},t.prototype.weekdayNearestDayX0=function(){return"pracovný deň najbližšie %s. dňu"},t.prototype.commaOnTheX0OfTheMonth=function(){return", v %s v mesiaci"},t.prototype.commaEveryX0Days=function(){return", každých %s dní"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", medzi dňami %s a %s v mesiaci"},t.prototype.commaOnDayX0OfTheMonth=function(){return", %s. deň v mesiaci"},t.prototype.commaEveryX0Years=function(){return", každých %s rokov"},t.prototype.commaStartingX0=function(){return", začínajúcich %s"},t.prototype.daysOfTheWeek=function(){return["Nedeľa","Pondelok","Utorok","Streda","Štvrtok","Piatok","Sobota"]},t.prototype.monthsOfTheYear=function(){return["Január","Február","Marec","Apríl","Máj","Jún","Júl","August","September","Október","November","December"]},t.prototype.onTheHour=function(){return"o celú hodinu"},t}();s.sk=p},474(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sl=void 0;var p=function(){function t(){}return t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Pri generiranju opisa izraza je prišlo do napake. Preverite sintakso izraza cron."},t.prototype.at=function(){return"Ob"},t.prototype.atSpace=function(){return"Ob "},t.prototype.atX0=function(){return"ob %s"},t.prototype.atX0MinutesPastTheHour=function(){return"ob %s."},t.prototype.atX0SecondsPastTheMinute=function(){return"ob %s."},t.prototype.betweenX0AndX1=function(){return"od %s do %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", od %s. do %s. dne v mesecu"},t.prototype.commaEveryDay=function(){return", vsak dan"},t.prototype.commaEveryX0Days=function(){return", vsakih %s dni"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", vsakih %s dni v tednu"},t.prototype.commaEveryX0Months=function(){return", vsakih %s mesecev"},t.prototype.commaEveryX0Years=function(){return", vsakih %s let"},t.prototype.commaOnDayX0OfTheMonth=function(){return", %s. dan v mesecu"},t.prototype.commaOnlyInX0=function(){return", samo v %s"},t.prototype.commaOnlyOnX0=function(){return", samo v %s"},t.prototype.commaAndOnX0=function(){return"in naprej %s"},t.prototype.commaOnThe=function(){return", "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", zadnji %s v mesecu"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", zadnji delovni dan v mesecu"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dni pred koncem meseca"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", zadnji %s v mesecu"},t.prototype.commaOnTheX0OfTheMonth=function(){return", %s v mesecu"},t.prototype.commaX0ThroughX1=function(){return", od %s do %s"},t.prototype.commaAndX0ThroughX1=function(){return", in od %s do %s"},t.prototype.everyHour=function(){return"vsako uro"},t.prototype.everyMinute=function(){return"vsako minuto"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Vsako minuto od %s do %s"},t.prototype.everySecond=function(){return"vsako sekundo"},t.prototype.everyX0Hours=function(){return"vsakih %s ur"},t.prototype.everyX0Minutes=function(){return"vsakih %s minut"},t.prototype.everyX0Seconds=function(){return"vsakih %s sekund"},t.prototype.fifth=function(){return"peti"},t.prototype.first=function(){return"prvi"},t.prototype.firstWeekday=function(){return"prvi delovni dan"},t.prototype.fourth=function(){return"četrti"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minute od %s do %s"},t.prototype.second=function(){return"drugi"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekunde od %s do %s"},t.prototype.spaceAnd=function(){return" in"},t.prototype.spaceX0OfTheMonth=function(){return" %s v mesecu"},t.prototype.lastDay=function(){return"zadnjič"},t.prototype.third=function(){return"tretji"},t.prototype.weekdayNearestDayX0=function(){return"delovni dan, najbližji %s. dnevu"},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.commaStartingX0=function(){return", začenši %s"},t.prototype.daysOfTheWeek=function(){return["Nedelja","Ponedeljek","Torek","Sreda","Četrtek","Petek","Sobota"]},t.prototype.monthsOfTheYear=function(){return["januar","februar","marec","april","maj","junij","julij","avgust","september","oktober","november","december"]},t.prototype.onTheHour=function(){return"ob točni uri"},t}();s.sl=p},716(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sr=void 0;var p=function(){function t(){}return t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Došlo je do greške pri generisanju izraza. Proverite sintaksu cron izraza."},t.prototype.at=function(){return"U"},t.prototype.atSpace=function(){return"U "},t.prototype.atX0=function(){return"u %s"},t.prototype.atX0MinutesPastTheHour=function(){return"u %s minuta posle punog sata"},t.prototype.atX0SecondsPastTheMinute=function(){return"u %s sekundi posle pune minute"},t.prototype.betweenX0AndX1=function(){return"između %s i %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", između %s. i %s. dana u mesecu"},t.prototype.commaEveryDay=function(){return", svaki dan"},t.prototype.commaEveryX0Days=function(){return", svakih %s dana"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", svakih %s dana u nedelji"},t.prototype.commaEveryX0Months=function(){return", svakih %s meseci"},t.prototype.commaEveryX0Years=function(){return", svakih %s godina"},t.prototype.commaOnDayX0OfTheMonth=function(){return", %s. dan u mesecu"},t.prototype.commaOnlyInX0=function(){return", samo u %s"},t.prototype.commaOnlyOnX0=function(){return", samo %s"},t.prototype.commaAndOnX0=function(){return", i %s"},t.prototype.commaOnThe=function(){return", "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", poslednjeg dana u mesecu"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", poslednjeg radnog dana u mesecu"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dana pre kraja meseca"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", poslednji %s u mesecu"},t.prototype.commaOnTheX0OfTheMonth=function(){return", %s u mesecu"},t.prototype.commaX0ThroughX1=function(){return", od %s do %s"},t.prototype.commaAndX0ThroughX1=function(){return", i od %s do %s"},t.prototype.everyHour=function(){return"svaki sat"},t.prototype.everyMinute=function(){return"svakog minuta"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Svakog minuta između %s i %s"},t.prototype.everySecond=function(){return"svake sekunde"},t.prototype.everyX0Hours=function(){return"svakih %s sati"},t.prototype.everyX0Minutes=function(){return"svakih %s minuta"},t.prototype.everyX0Seconds=function(){return"svakih %s sekundi"},t.prototype.fifth=function(){return"peti"},t.prototype.first=function(){return"prvi"},t.prototype.firstWeekday=function(){return"prvi radni dan"},t.prototype.fourth=function(){return"četvrti"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minute od %s do %s posle punog sata"},t.prototype.second=function(){return"drugi"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekunde od %s do %s posle pune minute"},t.prototype.spaceAnd=function(){return" i"},t.prototype.spaceX0OfTheMonth=function(){return" %s u mesecu"},t.prototype.lastDay=function(){return"poslednji dan"},t.prototype.third=function(){return"treći"},t.prototype.weekdayNearestDayX0=function(){return"radni dan najbliži %s. danu"},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.commaStartingX0=function(){return", počevši od %s"},t.prototype.daysOfTheWeek=function(){return["Nedelja","Ponedeljak","Utorak","Sreda","Četvrtak","Petak","Subota"]},t.prototype.monthsOfTheYear=function(){return["januar","februar","mart","april","maj","jun","jul","avgust","septembar","oktobar","novembar","decembar"]},t.prototype.onTheHour=function(){return"u pun sat"},t}();s.sr=p},544(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sv=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Ett fel inträffade vid generering av uttryckets beskrivning. Kontrollera cron-uttryckets syntax."},t.prototype.everyMinute=function(){return"varje minut"},t.prototype.everyHour=function(){return"varje timme"},t.prototype.atSpace=function(){return"Kl "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Varje minut mellan %s och %s"},t.prototype.at=function(){return"Kl"},t.prototype.spaceAnd=function(){return" och"},t.prototype.everySecond=function(){return"varje sekund"},t.prototype.everyX0Seconds=function(){return"varje %s sekund"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekunderna från %s till och med %s efter minuten"},t.prototype.atX0SecondsPastTheMinute=function(){return"på %s sekunder efter minuten"},t.prototype.everyX0Minutes=function(){return"var %s minut"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minuterna från %s till och med %s efter timmen"},t.prototype.atX0MinutesPastTheHour=function(){return"på %s minuten efter timmen"},t.prototype.everyX0Hours=function(){return"var %s timme"},t.prototype.betweenX0AndX1=function(){return"mellan %s och %s"},t.prototype.atX0=function(){return"kl %s"},t.prototype.commaEveryDay=function(){return", varje dag"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", var %s dag i veckan"},t.prototype.commaX0ThroughX1=function(){return", %s till %s"},t.prototype.commaAndX0ThroughX1=function(){return", och %s till %s"},t.prototype.first=function(){return"första"},t.prototype.second=function(){return"andra"},t.prototype.third=function(){return"tredje"},t.prototype.fourth=function(){return"fjärde"},t.prototype.fifth=function(){return"femte"},t.prototype.commaOnThe=function(){return", den "},t.prototype.spaceX0OfTheMonth=function(){return" %sen av månaden"},t.prototype.lastDay=function(){return"den sista dagen"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", på sista %s av månaden"},t.prototype.commaOnlyOnX0=function(){return", varje %s"},t.prototype.commaAndOnX0=function(){return", och på %s"},t.prototype.commaEveryX0Months=function(){return", var %s månad"},t.prototype.commaOnlyInX0=function(){return", bara på %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", på sista dagen av månaden"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", på sista veckodag av månaden"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dagar före den sista dagen i månaden"},t.prototype.firstWeekday=function(){return"första veckodag"},t.prototype.weekdayNearestDayX0=function(){return"veckodagen närmast dag %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", på den %s av månaden"},t.prototype.commaEveryX0Days=function(){return", var %s dag"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", mellan dag %s och %s av månaden"},t.prototype.commaOnDayX0OfTheMonth=function(){return", på dag %s av månaden"},t.prototype.commaEveryX0Years=function(){return", var %s år"},t.prototype.commaStartingX0=function(){return", startar %s"},t.prototype.daysOfTheWeek=function(){return["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"]},t.prototype.monthsOfTheYear=function(){return["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"]},t.prototype.onTheHour=function(){return"på heltimmen"},t}();s.sv=p},799(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sw=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Kuna tatizo wakati wa kutunga msemo. Angalia cron expression syntax."},t.prototype.everyMinute=function(){return"kila dakika"},t.prototype.everyHour=function(){return"kila saa"},t.prototype.atSpace=function(){return"Kwa "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Kila dakika kwanzia %s hadi %s"},t.prototype.at=function(){return"Kwa"},t.prototype.spaceAnd=function(){return" na"},t.prototype.everySecond=function(){return"kila sekunde"},t.prototype.everyX0Seconds=function(){return"kila sekunde %s"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekunde ya %s hadi %s baada ya dakika"},t.prototype.atX0SecondsPastTheMinute=function(){return"sekunde %s baada ya dakika"},t.prototype.everyX0Minutes=function(){return"kila dakika %s"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},t.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},t.prototype.everyX0Hours=function(){return"every %s hours"},t.prototype.betweenX0AndX1=function(){return"kati ya %s na %s"},t.prototype.atX0=function(){return"kwenye %s"},t.prototype.commaEveryDay=function(){return", kila siku"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", kila siku %s ya wiki"},t.prototype.commaX0ThroughX1=function(){return", %s hadi %s"},t.prototype.commaAndX0ThroughX1=function(){return", na %s hadi %s"},t.prototype.first=function(){return"ya kwanza"},t.prototype.second=function(){return"ya pili"},t.prototype.third=function(){return"ya tatu"},t.prototype.fourth=function(){return"ya nne"},t.prototype.fifth=function(){return"ya tano"},t.prototype.commaOnThe=function(){return", kwenye "},t.prototype.spaceX0OfTheMonth=function(){return" siku %s ya mwezi"},t.prototype.lastDay=function(){return"siku ya mwisho"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", siku ya %s ya mwezi"},t.prototype.commaOnlyOnX0=function(){return", kwa %s tu"},t.prototype.commaAndOnX0=function(){return", na pia %s"},t.prototype.commaEveryX0Months=function(){return", kila mwezi wa %s"},t.prototype.commaOnlyInX0=function(){return", kwa %s tu"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", siku ya mwisho wa mwezi"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", wikendi ya mwisho wa mwezi"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", siku ya %s kabla ya siku ya mwisho wa mwezi"},t.prototype.firstWeekday=function(){return"siku za kazi ya kwanza"},t.prototype.weekdayNearestDayX0=function(){return"siku ya kazi karibu na siku ya %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", siku ya %s ya mwezi"},t.prototype.commaEveryX0Days=function(){return", kila siku %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", kati ya siku %s na %s ya mwezi"},t.prototype.commaOnDayX0OfTheMonth=function(){return", siku ya %s ya mwezi"},t.prototype.commaEveryX0Years=function(){return", kila miaka %s"},t.prototype.commaStartingX0=function(){return", kwanzia %s"},t.prototype.daysOfTheWeek=function(){return["Jumapili","Jumatatu","Jumanne","Jumatano","Alhamisi","Ijumaa","Jumamosi"]},t.prototype.monthsOfTheYear=function(){return["Januari","Februari","Machi","Aprili","Mei","Juni","Julai","Agosti","Septemba","Oktoba","Novemba","Desemba"]},t.prototype.onTheHour=function(){return"saa kamili"},t}();s.sw=p},33(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.th=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!1},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"เกิดข้อผิดพลาดขณะสร้างคำอธิบายนิพจน์ ตรวจสอบไวยากรณ์นิพจน์ครอน"},t.prototype.everyMinute=function(){return"ทุกๆ นาที"},t.prototype.everyHour=function(){return"ทุกๆ ชั่วโมง"},t.prototype.atSpace=function(){return"เมื่อ "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"ทุกๆ นาที %s และ %s"},t.prototype.at=function(){return"เมื่อ"},t.prototype.spaceAnd=function(){return" และ"},t.prototype.everySecond=function(){return"ทุกๆ วินาที"},t.prototype.everyX0Seconds=function(){return"ทุกๆ %s วินาที"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"วินาที %s ถึง %s นาทีที่ผ่านมา"},t.prototype.atX0SecondsPastTheMinute=function(){return"เมื่อ %s วินาที นาทีที่ผ่านมา"},t.prototype.everyX0Minutes=function(){return"ทุกๆ %s นาที"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"นาที %s ถึง %s ชั่วโมงที่ผ่านมา"},t.prototype.atX0MinutesPastTheHour=function(){return"เมื่อ %s นาที ชั่วโมงที่ผ่านมา"},t.prototype.everyX0Hours=function(){return"ทุกๆ %s ชั่วโมง"},t.prototype.betweenX0AndX1=function(){return"ระหว่าง %s ถึง %s"},t.prototype.atX0=function(){return"เมื่อ %s"},t.prototype.commaEveryDay=function(){return", ทุกๆ วัน"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", ทุกๆ %s วันของสัปดาห์"},t.prototype.commaX0ThroughX1=function(){return", %s ถึง %s"},t.prototype.commaAndX0ThroughX1=function(){return", %s ถึง %s"},t.prototype.first=function(){return"แรก"},t.prototype.second=function(){return"ที่สอง"},t.prototype.third=function(){return"ที่สาม"},t.prototype.fourth=function(){return"ที่สี่"},t.prototype.fifth=function(){return"ที่ห้า"},t.prototype.commaOnThe=function(){return", ในวัน "},t.prototype.spaceX0OfTheMonth=function(){return" %s ของเดือน"},t.prototype.lastDay=function(){return"วันสุดท้าย"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", ณ สุดท้าย %s ของเดือน"},t.prototype.commaOnlyOnX0=function(){return", เท่านั้น %s"},t.prototype.commaAndOnX0=function(){return", และใน %s"},t.prototype.commaEveryX0Months=function(){return", ทุกๆ %s เดือน"},t.prototype.commaOnlyInX0=function(){return", เท่านั้น %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", ในวันสิ้นเดือน"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", ในวันธรรมดาสุดท้ายของเดือน"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s วันก่อนวันสุดท้ายของเดือน"},t.prototype.firstWeekday=function(){return"วันธรรมดาวันแรก"},t.prototype.weekdayNearestDayX0=function(){return"วันธรรมดาที่ใกล้ที่สุด %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", ในวัน %s ของเดือน"},t.prototype.commaEveryX0Days=function(){return", ทุกๆ %s วัน"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", ระหว่างวัน %s และ %s ของเดือน"},t.prototype.commaOnDayX0OfTheMonth=function(){return", ในวัน %s ของเดือน"},t.prototype.commaEveryHour=function(){return", ทุกๆ ชั่วโมง"},t.prototype.commaEveryX0Years=function(){return", ทุกๆ %s ปี"},t.prototype.commaStartingX0=function(){return", เริ่ม %s"},t.prototype.daysOfTheWeek=function(){return["วันอาทิตย์","วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัสบดี","วันศุกร์","วันเสาร์"]},t.prototype.monthsOfTheYear=function(){return["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"]},t.prototype.onTheHour=function(){return"ตรงชั่วโมง"},t}();s.th=p},631(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.tr=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.everyMinute=function(){return"her dakika"},t.prototype.everyHour=function(){return"her saat"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"İfade açıklamasını oluştururken bir hata oluştu. Cron ifadesini gözden geçirin."},t.prototype.atSpace=function(){return"Saat "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Saat %s ve %s arasındaki her dakika"},t.prototype.at=function(){return"Saat"},t.prototype.spaceAnd=function(){return" ve"},t.prototype.everySecond=function(){return"her saniye"},t.prototype.everyX0Seconds=function(){return"her %s saniyede bir"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"dakikaların %s. ve %s. saniyeleri arası"},t.prototype.atX0SecondsPastTheMinute=function(){return"dakikaların %s. saniyesinde"},t.prototype.everyX0Minutes=function(){return"her %s dakikada bir"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"saatlerin %s. ve %s. dakikaları arası"},t.prototype.atX0MinutesPastTheHour=function(){return"saatlerin %s. dakikasında"},t.prototype.everyX0Hours=function(){return"her %s saatte"},t.prototype.betweenX0AndX1=function(){return"%s ile %s arasında"},t.prototype.atX0=function(){return"saat %s"},t.prototype.commaEveryDay=function(){return", her gün"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", ayın her %s günü"},t.prototype.commaX0ThroughX1=function(){return", %s ile %s arasında"},t.prototype.commaAndX0ThroughX1=function(){return", ve %s ile %s arasında"},t.prototype.first=function(){return"ilk"},t.prototype.second=function(){return"ikinci"},t.prototype.third=function(){return"üçüncü"},t.prototype.fourth=function(){return"dördüncü"},t.prototype.fifth=function(){return"beşinci"},t.prototype.commaOnThe=function(){return", ayın "},t.prototype.spaceX0OfTheMonth=function(){return" %s günü"},t.prototype.lastDay=function(){return"son gün"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", ayın son %s günü"},t.prototype.commaOnlyOnX0=function(){return", sadece %s günü"},t.prototype.commaAndOnX0=function(){return", ve %s"},t.prototype.commaEveryX0Months=function(){return", %s ayda bir"},t.prototype.commaOnlyInX0=function(){return", sadece %s için"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", ayın son günü"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", ayın son iş günü"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s ayın son gününden önceki günler"},t.prototype.firstWeekday=function(){return"ilk iş günü"},t.prototype.weekdayNearestDayX0=function(){return"%s. günü sonrasındaki ilk iş günü"},t.prototype.commaOnTheX0OfTheMonth=function(){return", ayın %s"},t.prototype.commaEveryX0Days=function(){return", %s günde bir"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", ayın %s. ve %s. günleri arası"},t.prototype.commaOnDayX0OfTheMonth=function(){return", ayın %s. günü"},t.prototype.commaEveryX0Years=function(){return", %s yılda bir"},t.prototype.commaStartingX0=function(){return", başlangıç %s"},t.prototype.daysOfTheWeek=function(){return["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"]},t.prototype.monthsOfTheYear=function(){return["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"]},t.prototype.onTheHour=function(){return"saatin başında"},t}();s.tr=p},225(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.uk=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.everyMinute=function(){return"щохвилини"},t.prototype.everyHour=function(){return"щогодини"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"ВІдбулася помилка підчас генерації опису. Перевірта правильність написання cron виразу."},t.prototype.atSpace=function(){return"О "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Щохвилини між %s та %s"},t.prototype.at=function(){return"О"},t.prototype.spaceAnd=function(){return" та"},t.prototype.everySecond=function(){return"Щосекунди"},t.prototype.everyX0Seconds=function(){return"кожні %s секунд"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"з %s по %s секунду"},t.prototype.atX0SecondsPastTheMinute=function(){return"о %s секунді"},t.prototype.everyX0Minutes=function(){return"кожні %s хвилин"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"з %s по %s хвилину"},t.prototype.atX0MinutesPastTheHour=function(){return"о %s хвилині"},t.prototype.everyX0Hours=function(){return"кожні %s годин"},t.prototype.betweenX0AndX1=function(){return"між %s та %s"},t.prototype.atX0=function(){return"о %s"},t.prototype.commaEveryDay=function(){return", щоденно"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", кожен %s день тижня"},t.prototype.commaX0ThroughX1=function(){return", %s по %s"},t.prototype.commaAndX0ThroughX1=function(){return", та %s по %s"},t.prototype.first=function(){return"перший"},t.prototype.second=function(){return"другий"},t.prototype.third=function(){return"третій"},t.prototype.fourth=function(){return"четвертий"},t.prototype.fifth=function(){return"п'ятий"},t.prototype.commaOnThe=function(){return", в "},t.prototype.spaceX0OfTheMonth=function(){return" %s місяця"},t.prototype.lastDay=function(){return"останній день"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", в останній %s місяця"},t.prototype.commaOnlyOnX0=function(){return", тільки в %s"},t.prototype.commaAndOnX0=function(){return", і в %s"},t.prototype.commaEveryX0Months=function(){return", кожен %s місяць"},t.prototype.commaOnlyInX0=function(){return", тільки в %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", в останній день місяця"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", в останній будень місяця"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s днів до останнього дня місяця"},t.prototype.firstWeekday=function(){return"перший будень"},t.prototype.weekdayNearestDayX0=function(){return"будень найближчий до %s дня"},t.prototype.commaOnTheX0OfTheMonth=function(){return", в %s місяця"},t.prototype.commaEveryX0Days=function(){return", кожен %s день"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", між %s та %s днями місяця"},t.prototype.commaOnDayX0OfTheMonth=function(){return", на %s день місяця"},t.prototype.commaEveryX0Years=function(){return", кожні %s роки"},t.prototype.commaStartingX0=function(){return", початок %s"},t.prototype.daysOfTheWeek=function(){return["неділя","понеділок","вівторок","середа","четвер","п'ятниця","субота"]},t.prototype.monthsOfTheYear=function(){return["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"]},t.prototype.onTheHour=function(){return"рівно о годині"},t}();s.uk=p},292(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.vi=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Đã xảy ra lỗi khi tạo mô tả biểu thức. Vui lòng kiểm tra cú pháp biểu thức cron."},t.prototype.everyMinute=function(){return"mỗi phút"},t.prototype.everyHour=function(){return"mỗi giờ"},t.prototype.atSpace=function(){return"Vào "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Mỗi phút giữa %s and %s"},t.prototype.at=function(){return"Vào"},t.prototype.spaceAnd=function(){return" và"},t.prototype.everySecond=function(){return"mỗi giây"},t.prototype.everyX0Seconds=function(){return"mỗi %s giây"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"giây thứ %s qua phút thứ %s"},t.prototype.atX0SecondsPastTheMinute=function(){return"tại giây thứ %s của mỗi phút"},t.prototype.everyX0Minutes=function(){return"mỗi %s phút"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"phút thứ %s qua %s tiếng"},t.prototype.atX0MinutesPastTheHour=function(){return"vào %s phút của mỗi tiếng"},t.prototype.everyX0Hours=function(){return"mỗi %s tiếng"},t.prototype.betweenX0AndX1=function(){return"giữa %s và %s"},t.prototype.atX0=function(){return"vào %s"},t.prototype.commaEveryDay=function(){return", mỗi ngày"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", mỗi %s ngày trong tuần"},t.prototype.commaX0ThroughX1=function(){return", %s đến %s"},t.prototype.commaAndX0ThroughX1=function(){return", %s đến %s"},t.prototype.first=function(){return"đầu tiên"},t.prototype.second=function(){return"thứ 2"},t.prototype.third=function(){return"thứ 3"},t.prototype.fourth=function(){return"thứ 4"},t.prototype.fifth=function(){return"thứ 5"},t.prototype.commaOnThe=function(){return", trên "},t.prototype.spaceX0OfTheMonth=function(){return" %s của tháng"},t.prototype.lastDay=function(){return"ngày cuối cùng"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", vào ngày %s cuối cùng của tháng"},t.prototype.commaOnlyOnX0=function(){return", chỉ trên %s"},t.prototype.commaAndOnX0=function(){return", và hơn %s"},t.prototype.commaEveryX0Months=function(){return", mỗi ngày %s tháng"},t.prototype.commaOnlyInX0=function(){return", chỉ trong %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", vào ngày cuối cùng của tháng"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", vào ngày cuối tuần của tháng"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s ngày trước ngày cuối cùng của tháng"},t.prototype.firstWeekday=function(){return"ngày đầu tuần"},t.prototype.weekdayNearestDayX0=function(){return"ngày trong tuần ngày gần nhất %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", vào ngày %s của tháng"},t.prototype.commaEveryX0Days=function(){return", mỗi %s ngày"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", giữa ngày %s và %s trong tháng"},t.prototype.commaOnDayX0OfTheMonth=function(){return", vào %s ngày trong tháng"},t.prototype.commaEveryHour=function(){return", mỗi tiếng"},t.prototype.commaEveryX0Years=function(){return", mỗi %s năm"},t.prototype.commaStartingX0=function(){return", bắt đầu %s"},t.prototype.daysOfTheWeek=function(){return["Chủ nhật","Thứ 2","Thứ 3","Thứ 4","Thứ 5","Thứ 6","Thứ 7"]},t.prototype.monthsOfTheYear=function(){return["Tháng 1","Tháng 2","Tháng 3","Tháng 4","Tháng 5","Tháng 6","Tháng 7","Tháng 8","Tháng 9","Tháng 10","Tháng 11","Tháng 12"]},t.prototype.onTheHour=function(){return"đúng giờ"},t}();s.vi=p},571(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.zh_CN=void 0;var p=function(){function t(){}return t.prototype.setPeriodBeforeTime=function(){return!0},t.prototype.pm=function(){return"下午"},t.prototype.am=function(){return"上午"},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return", 从%s年至%s年"},t.prototype.use24HourTimeFormatByDefault=function(){return!1},t.prototype.everyMinute=function(){return"每分钟"},t.prototype.everyHour=function(){return"每小时"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"生成表达式描述时发生了错误,请检查cron表达式语法。"},t.prototype.atSpace=function(){return"在"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"在 %s 至 %s 之间的每分钟"},t.prototype.at=function(){return"在"},t.prototype.spaceAnd=function(){return" 和"},t.prototype.everySecond=function(){return"每秒"},t.prototype.everyX0Seconds=function(){return"每隔 %s 秒"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"在一分钟后的第 %s 到 %s 秒"},t.prototype.atX0SecondsPastTheMinute=function(){return"在一分钟后的第 %s 秒"},t.prototype.everyX0Minutes=function(){return"每隔 %s 分钟"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"在整点后的第 %s 到 %s 分钟"},t.prototype.atX0MinutesPastTheHour=function(){return"在整点后的第 %s 分钟"},t.prototype.everyX0Hours=function(){return"每隔 %s 小时"},t.prototype.betweenX0AndX1=function(){return"在 %s 和 %s 之间"},t.prototype.atX0=function(){return"在%s"},t.prototype.commaEveryDay=function(){return", 每天"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", 每周的每 %s 天"},t.prototype.commaX0ThroughX1=function(){return", %s至%s"},t.prototype.commaAndX0ThroughX1=function(){return", 和%s至%s"},t.prototype.first=function(){return"第一个"},t.prototype.second=function(){return"第二个"},t.prototype.third=function(){return"第三个"},t.prototype.fourth=function(){return"第四个"},t.prototype.fifth=function(){return"第五个"},t.prototype.commaOnThe=function(){return", 限每月的"},t.prototype.spaceX0OfTheMonth=function(){return"%s"},t.prototype.lastDay=function(){return"本月最后一天"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", 限每月的最后一个%s"},t.prototype.commaOnlyOnX0=function(){return", 仅%s"},t.prototype.commaAndOnX0=function(){return", 或者为%s"},t.prototype.commaEveryX0Months=function(){return", 每隔 %s 个月"},t.prototype.commaOnlyInX0=function(){return", 仅限%s"},t.prototype.commaOnlyInMonthX0=function(){return", 仅于%s份"},t.prototype.commaOnlyInYearX0=function(){return", 仅于 %s 年"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", 限每月的最后一天"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", 限每月的最后一个工作日"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", 限每月最后%s天"},t.prototype.firstWeekday=function(){return"第一个工作日"},t.prototype.weekdayNearestDayX0=function(){return"最接近 %s 号的工作日"},t.prototype.commaOnTheX0OfTheMonth=function(){return", 限每月的%s"},t.prototype.commaEveryX0Days=function(){return", 每隔 %s 天"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", 限每月的 %s 至 %s 之间"},t.prototype.commaOnDayX0OfTheMonth=function(){return", 限每月%s"},t.prototype.commaEveryX0Years=function(){return", 每隔 %s 年"},t.prototype.commaStartingX0=function(){return", %s开始"},t.prototype.dayX0=function(){return" %s 号"},t.prototype.daysOfTheWeek=function(){return["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},t.prototype.monthsOfTheYear=function(){return["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},t.prototype.onTheHour=function(){return"整点"},t}();s.zh_CN=p},983(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.zh_TW=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return", 從 %s 年至 %s 年"},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.everyMinute=function(){return"每分鐘"},t.prototype.everyHour=function(){return"每小時"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"產生表達式描述時發生了錯誤,請檢查 cron 表達式語法。"},t.prototype.atSpace=function(){return"在 "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"在 %s 和 %s 之間的每分鐘"},t.prototype.at=function(){return"在"},t.prototype.spaceAnd=function(){return" 和"},t.prototype.everySecond=function(){return"每秒"},t.prototype.everyX0Seconds=function(){return"每 %s 秒"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"在一分鐘後的 %s 到 %s 秒"},t.prototype.atX0SecondsPastTheMinute=function(){return"在一分鐘後的 %s 秒"},t.prototype.everyX0Minutes=function(){return"每 %s 分鐘"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"在整點後的 %s 到 %s 分鐘"},t.prototype.atX0MinutesPastTheHour=function(){return"在整點後的 %s 分"},t.prototype.everyX0Hours=function(){return"每 %s 小時"},t.prototype.betweenX0AndX1=function(){return"在 %s 和 %s 之間"},t.prototype.atX0=function(){return"在 %s"},t.prototype.commaEveryDay=function(){return", 每天"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", 每週的每 %s 天"},t.prototype.commaX0ThroughX1=function(){return", %s 到 %s"},t.prototype.commaAndX0ThroughX1=function(){return", 和 %s 到 %s"},t.prototype.first=function(){return"第一個"},t.prototype.second=function(){return"第二個"},t.prototype.third=function(){return"第三個"},t.prototype.fourth=function(){return"第四個"},t.prototype.fifth=function(){return"第五個"},t.prototype.commaOnThe=function(){return", 在每月 "},t.prototype.spaceX0OfTheMonth=function(){return"%s "},t.prototype.lastDay=function(){return"最後一天"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", 每月的最後一個 %s "},t.prototype.commaOnlyOnX0=function(){return", 僅在 %s"},t.prototype.commaAndOnX0=function(){return", 或 %s"},t.prototype.commaEveryX0Months=function(){return", 每 %s 月"},t.prototype.commaOnlyInX0=function(){return", 僅在 %s"},t.prototype.commaOnlyInMonthX0=function(){return", 僅在 %s"},t.prototype.commaOnlyInYearX0=function(){return", 僅在 %s 年"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", 每月的最後一天"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", 每月的最後一個工作日"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s 這個月的最後一天的前幾天"},t.prototype.firstWeekday=function(){return"第一個工作日"},t.prototype.weekdayNearestDayX0=function(){return"最接近 %s 號的工作日"},t.prototype.commaOnTheX0OfTheMonth=function(){return", 每月的 %s "},t.prototype.commaEveryX0Days=function(){return", 每 %s 天"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", 在每月的 %s 和 %s 之間"},t.prototype.commaOnDayX0OfTheMonth=function(){return", 每月的 %s"},t.prototype.commaEveryX0Years=function(){return", 每 %s 年"},t.prototype.commaStartingX0=function(){return", %s 開始"},t.prototype.dayX0=function(){return" %s 號"},t.prototype.daysOfTheWeek=function(){return["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},t.prototype.monthsOfTheYear=function(){return["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},t.prototype.onTheHour=function(){return"整點"},t}();s.zh_TW=p},515(d,s){Object.defineProperty(s,"__esModule",{value:!0});function p(x,h){if(!x)throw new Error(h)}var t=function(){function x(){}return x.secondRange=function(h){for(var a=h.split(","),i=0;i<a.length;i++)if(!isNaN(parseInt(a[i],10))){var g=parseInt(a[i],10);p(g>=0&&g<=59,"seconds part must be >= 0 and <= 59")}},x.minuteRange=function(h){for(var a=h.split(","),i=0;i<a.length;i++)if(!isNaN(parseInt(a[i],10))){var g=parseInt(a[i],10);p(g>=0&&g<=59,"minutes part must be >= 0 and <= 59")}},x.hourRange=function(h){for(var a=h.split(","),i=0;i<a.length;i++)if(!isNaN(parseInt(a[i],10))){var g=parseInt(a[i],10);p(g>=0&&g<=23,"hours part must be >= 0 and <= 23")}},x.dayOfMonthRange=function(h){for(var a=h.split(","),i=0;i<a.length;i++)if(!isNaN(parseInt(a[i],10))){var g=parseInt(a[i],10);p(g>=1&&g<=31,"DOM part must be >= 1 and <= 31")}},x.monthRange=function(h,a){for(var i=h.split(","),g=0;g<i.length;g++)if(!isNaN(parseInt(i[g],10))){var v=parseInt(i[g],10);p(v>=1&&v<=12,a?"month part must be >= 0 and <= 11":"month part must be >= 1 and <= 12")}},x.dayOfWeekRange=function(h,a){for(var i=h.split(","),g=0;g<i.length;g++)if(!isNaN(parseInt(i[g],10))){var v=parseInt(i[g],10);p(v>=0&&v<=6,a?"DOW part must be >= 0 and <= 6":"DOW part must be >= 1 and <= 7")}},x}();s.default=t},823(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.StringUtilities=void 0;var p=function(){function t(){}return t.format=function(x){for(var h=[],a=1;a<arguments.length;a++)h[a-1]=arguments[a];return x.replace(/%s/g,function(i){return h.shift()})},t.containsAny=function(x,h){return h.some(function(a){return x.indexOf(a)>-1})},t}();s.StringUtilities=p}},u={};function c(d){var s=u[d];if(s!==void 0)return s.exports;var p=u[d]={exports:{}};return l[d](p,p.exports,c),p.exports}var m={};return(()=>{var d=m;Object.defineProperty(d,"__esModule",{value:!0}),d.toString=void 0;var s=c(333),p=c(420);s.ExpressionDescriptor.initialize(new p.allLocalesLoader),d.default=s.ExpressionDescriptor;var t=s.ExpressionDescriptor.toString;d.toString=t})(),m})())}(Sn)),Sn.exports}var Tn,Uo;function sc(){if(Uo)return Tn;Uo=1;var r=oc();return Tn=r,Tn}var ac=sc();const ic=Zr(ac);function Ls(r){try{const o=r.trim().split(/\s+/);if(o.length!==5)return r;const[l,u,c,m,d]=o,s=ic.toString(r,{locale:"zh_CN",use24HourTimeFormat:!0}),p=c==="*"&&m==="*"&&d==="*",t=!u.includes("*")&&!u.includes("/")&&!l.includes("*")&&!l.includes("/");return p&&t&&!s.includes("每")?"每天 "+s.replace(/^在\s*/,""):s}catch{return r}}function Go(r){return r?new Date(r).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"从未"}function lc({mode:r,intervalMin:o,hour:l,minute:u,dow:c,dom:m}){switch(r){case"interval":return`*/${o} * * * *`;case"hourly":return`${u} * * * *`;case"daily":return`${u} ${l} * * *`;case"weekly":return`${u} ${l} * * ${c}`;case"monthly":return`${u} ${l} ${m} * *`;default:return`${u} ${l} * * *`}}function cc(r){const o={mode:"daily",intervalMin:10,hour:9,minute:0,dow:1,dom:1};if(!r)return o;try{const[l,u,c,m,d]=r.trim().split(/\s+/);if(l.startsWith("*/")&&u==="*"&&c==="*"&&m==="*"&&d==="*")return{...o,mode:"interval",intervalMin:parseInt(l.slice(2))||10};if(!l.includes("*")&&!l.includes("/")&&u==="*"&&c==="*"&&m==="*"&&d==="*")return{...o,mode:"hourly",minute:parseInt(l)};if(!l.includes("*")&&!l.includes("/")&&!u.includes("*")&&!u.includes("/")&&c==="*"&&m==="*"&&d==="*")return{...o,mode:"daily",hour:parseInt(u),minute:parseInt(l)};if(!l.includes("*")&&!l.includes("/")&&!u.includes("*")&&!u.includes("/")&&c==="*"&&m==="*"&&!d.includes("*")&&!d.includes("/"))return{...o,mode:"weekly",hour:parseInt(u),minute:parseInt(l),dow:parseInt(d)};if(!l.includes("*")&&!l.includes("/")&&!u.includes("*")&&!u.includes("/")&&!c.includes("*")&&!c.includes("/")&&m==="*"&&d==="*")return{...o,mode:"monthly",hour:parseInt(u),minute:parseInt(l),dom:parseInt(c)}}catch{}return o}const dc=["周日","周一","周二","周三","周四","周五","周六"],uc=[5,10,15,20,30,45,60],pc=[{value:"interval",label:"每隔N分钟"},{value:"hourly",label:"每小时"},{value:"daily",label:"每天"},{value:"weekly",label:"每周"},{value:"monthly",label:"每月"}],Kt="rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 text-sm px-2 pr-7 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500";function Xn({hour:r,minute:o,onChange:l}){const u=Array.from({length:24},(m,d)=>d),c=Array.from({length:60},(m,d)=>d);return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("select",{value:r,onChange:m=>l({hour:parseInt(m.target.value),minute:o}),className:Kt,children:u.map(m=>e.jsx("option",{value:m,children:String(m).padStart(2,"0")},m))}),e.jsx("span",{className:"text-gray-500 dark:text-gray-400 font-medium",children:":"}),e.jsx("select",{value:o,onChange:m=>l({hour:r,minute:parseInt(m.target.value)}),className:Kt,children:c.map(m=>e.jsx("option",{value:m,children:String(m).padStart(2,"0")},m))})]})}function mc({value:r,onChange:o}){const{mode:l,intervalMin:u,hour:c,minute:m,dow:d,dom:s}=r,p=t=>o({...r,...t});return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"频率"}),e.jsx("select",{value:l,onChange:t=>p({mode:t.target.value}),className:Kt,children:pc.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))})]}),l==="interval"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"间隔"}),e.jsx("select",{value:u,onChange:t=>p({intervalMin:parseInt(t.target.value)}),className:Kt,children:uc.map(t=>e.jsxs("option",{value:t,children:["每 ",t," 分钟"]},t))})]}),l==="hourly"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"分钟"}),e.jsx("select",{value:m,onChange:t=>p({minute:parseInt(t.target.value)}),className:Kt,children:Array.from({length:60},(t,x)=>x).map(t=>e.jsxs("option",{value:t,children:["每小时第 ",String(t).padStart(2,"0")," 分"]},t))})]}),l==="daily"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"时间"}),e.jsx(Xn,{hour:c,minute:m,onChange:p})]}),l==="weekly"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"星期"}),e.jsx("div",{className:"flex gap-1 flex-wrap",children:dc.map((t,x)=>e.jsx("button",{type:"button",onClick:()=>p({dow:x}),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${d===x?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"}`,children:t},x))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"时间"}),e.jsx(Xn,{hour:c,minute:m,onChange:p})]})]}),l==="monthly"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"几号"}),e.jsx("select",{value:s,onChange:t=>p({dom:parseInt(t.target.value)}),className:Kt,children:Array.from({length:31},(t,x)=>x+1).map(t=>e.jsxs("option",{value:t,children:["每月 ",t," 号"]},t))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"时间"}),e.jsx(Xn,{hour:c,minute:m,onChange:p})]})]})]})}const fc={mode:"daily",intervalMin:10,hour:9,minute:0,dow:1,dom:1};function hc({editTask:r,onClose:o,onSave:l}){const[u,c]=n.useState(r?.prompt||""),[m,d]=n.useState(r?cc(r.cronExpr):fc),[s,p]=n.useState(r?.channel||""),[t,x]=n.useState(r?.webhookUrl||""),[h,a]=n.useState(r?r.recurring:!0),[i,g]=n.useState(r?.projectPath||""),[v,k]=n.useState([]),[b,j]=n.useState(!1),[f,w]=n.useState(!1),[S,z]=n.useState("");n.useEffect(()=>{me.auth.feishuStatus().then(E=>E.json()).then(E=>j(!!E.bound)).catch(()=>{}),me.projects().then(E=>E.json()).then(E=>{const $=Array.isArray(E)?E:E.projects||[];k($),!r&&$.length>0&&!i&&g($[0].fullPath)}).catch(()=>{})},[]);const D=lc(m),N=Ls(D),R=!!r,M=async()=>{if(!u.trim()){z("请填写执行内容");return}if(s==="webhook"&&!t.trim()){z("Webhook 渠道需要填写 URL");return}w(!0),z("");try{const E={cronExpr:D,prompt:u.trim(),recurring:h,channel:s,webhookUrl:t.trim()||void 0,projectPath:i||void 0},$=R?`/api/cron-tasks/${r.id}`:"/api/cron-tasks",T=await J($,{method:R?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)}),X=await T.json();if(!T.ok){z(X.error||"保存失败");return}l(X.task)}catch{z("网络错误,请重试")}finally{w(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",onClick:E=>E.target===E.currentTarget&&o(),children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl w-full max-w-lg max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:R?"编辑定时任务":"新建定时任务"}),e.jsx("button",{onClick:o,className:"p-1 rounded-md text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700",children:e.jsx(Ge,{size:18})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-5",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"执行项目"}),v.length===0?e.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500",children:"加载中…"}):e.jsx("select",{value:i,onChange:E=>g(E.target.value),className:`w-full ${Kt}`,children:v.map(E=>e.jsx("option",{value:E.fullPath,children:E.displayName},E.fullPath))})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"执行内容"}),e.jsx("textarea",{value:u,onChange:E=>c(E.target.value),rows:3,placeholder:"例:帮我总结今天的待办事项,以简洁清单形式呈现",className:"w-full rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 text-sm px-3 py-2 resize-none focus:outline-none focus:ring-2 focus:ring-blue-500 placeholder-gray-400 dark:placeholder-gray-500"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"执行频率"}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-3 space-y-3",children:[e.jsx(mc,{value:m,onChange:d}),e.jsxs("div",{className:"pt-2 border-t border-gray-200 dark:border-gray-600 flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-blue-600 dark:text-blue-400",children:N}),e.jsx("code",{className:"text-xs font-mono text-gray-400 dark:text-gray-500",children:D})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"投递渠道"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{value:"",icon:e.jsx(Cr,{size:14}),label:"网页端"},{value:"feishu",icon:e.jsx(Er,{size:14}),label:"飞书",disabled:!b,tip:"未绑定飞书"},{value:"webhook",icon:e.jsx(mr,{size:14}),label:"Webhook"}].map(E=>e.jsxs("button",{type:"button",disabled:E.disabled,onClick:()=>!E.disabled&&p(E.value),title:E.disabled?E.tip:void 0,className:`flex items-center justify-center gap-1.5 py-2 rounded-lg border text-sm font-medium transition-colors ${E.disabled?"opacity-40 cursor-not-allowed border-gray-200 dark:border-gray-700 text-gray-400":s===E.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400":"border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"}`,children:[E.icon,E.label]},E.value))}),s==="webhook"&&e.jsx("input",{type:"url",value:t,onChange:E=>x(E.target.value),placeholder:"https://your-webhook-url.com/...",className:"w-full rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 text-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 placeholder-gray-400 dark:placeholder-gray-500"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"单次执行"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"开启后触发一次即自动删除"})]}),e.jsx("button",{type:"button",onClick:()=>a(E=>!E),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${h?"bg-gray-300 dark:bg-gray-600":"bg-blue-600"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform ${h?"translate-x-1":"translate-x-6"}`})})]}),S&&e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:S})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("button",{onClick:o,className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100 transition-colors",children:"取消"}),e.jsx("button",{onClick:M,disabled:f,className:"px-4 py-2 text-sm font-medium rounded-lg bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-60 transition-colors",children:f?"保存中…":"保存"})]})]})})}function xc({channel:r}){return r==="feishu"?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300",children:[e.jsx(Er,{size:10})," 飞书"]}):r==="webhook"?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300",children:[e.jsx(mr,{size:10})," Webhook"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300",children:[e.jsx(Cr,{size:10})," 网页"]})}function gc(){const[r,o]=n.useState([]),[l,u]=n.useState(!0),[c,m]=n.useState(null),[d,s]=n.useState(null),{showConfirm:p}=lt(),t=n.useCallback(async()=>{u(!0);try{const i=await J("/api/cron-tasks");if(i.ok){const g=await i.json();o(g.tasks||[])}}catch(i){console.error("Failed to fetch cron tasks",i)}finally{u(!1)}},[]);n.useEffect(()=>{t()},[t]);const x=async i=>{m(i.id);try{const g=await J(`/api/cron-tasks/${i.id}/pause`,{method:"PATCH"});if(g.ok){const v=await g.json();o(k=>k.map(b=>b.id===i.id?{...b,isPaused:v.isPaused}:b))}}catch(g){console.error("Toggle pause failed",g)}finally{m(null)}},h=async i=>{if(await p(`确定要删除定时任务吗?
160
+ 同步后,这个本地技能将上传到共享 Git 仓库,其他人即可安装使用。本地副本将被删除,后续该技能将从共享仓库加载。`),!!await l(D,{title:$,confirmText:"确认同步"}))try{k(M.name);const T=await J(`/api/skills/${M.name}/sync`,{method:"POST"});if(T.ok)j();else{const X=await T.json();o(X.error||"同步失败",{variant:"error"})}}catch(T){o(T.message,{variant:"error"})}finally{k(null)}},E=()=>{b.current?.click()},S=async M=>{const D=M.target.files?.[0];if(D)try{g(!0);const $=new FormData;$.append("skillZip",D);const T=await J("/api/skills/import",{method:"POST",body:$});if(T.ok)j();else{const X=await T.json();o(X.error||"上传技能失败",{variant:"error"})}}catch($){o($.message,{variant:"error"})}finally{g(!1),b.current&&(b.current.value="")}},R=(M,D)=>{switch(M){case"repo":return e.jsx(nt,{variant:"outline",className:"text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300",children:D||"仓库"});case"imported":return e.jsx(nt,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300",children:"上传"});default:return e.jsx(nt,{variant:"outline",className:"text-xs",children:"本地新建"})}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(On,{className:"w-5 h-5 text-amber-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Skills 管理"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Skills 是 ",Ve," 的扩展能力,可以通过 SKILLS.md 文件定义自定义指令和工作流程"]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["已安装: ",e.jsx("span",{className:"font-medium text-foreground",children:u.length})," 个技能"]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("input",{ref:b,type:"file",accept:".zip",className:"hidden",onChange:S}),e.jsxs(U,{onClick:E,variant:"outline",size:"sm",disabled:i,children:[e.jsx(Ht,{className:"w-4 h-4 mr-2"}),i?"上传中...":"上传本地技能"]}),e.jsxs(U,{onClick:()=>x(!0),className:"bg-amber-600 hover:bg-amber-700 text-white",size:"sm",children:[e.jsx(Mt,{className:"w-4 h-4 mr-2"}),"发现技能"]})]})]}),s&&e.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-800 dark:text-red-200 text-sm",children:s}),m?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):u.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(On,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"还没有安装任何技能"}),e.jsx("p",{className:"text-xs mt-2",children:'点击"发现技能"从仓库安装,或"上传已有"本地技能'})]}):e.jsx("div",{className:"grid grid-cols-2 gap-3",children:u.map(M=>e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg px-4 pt-4 pb-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[e.jsx("span",{className:"font-medium text-foreground",children:M.title||M.name}),R(M.source,M.repository),e.jsx(nt,{variant:"outline",className:"text-xs",title:M.scope==="local"&&M.projectPath?M.projectPath:void 0,children:M.scope==="local"?`local · ${M.projectPath?M.projectPath.split("/").filter(Boolean).pop():""}`:"user"})]}),M.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-3 flex-1",children:M.description}),e.jsxs("div",{className:"flex items-center justify-end mt-2",children:[M.syncable&&e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>L(M),disabled:v===M.name,title:"同步到云端",children:v===M.name?e.jsx(st,{className:"w-4 h-4 animate-spin"}):e.jsx(Pa,{className:"w-4 h-4"})}),e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>w(M.name),title:"下载技能",children:e.jsx(_t,{className:"w-4 h-4"})}),e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>N(M),className:"text-red-500 hover:text-red-600",title:"删除技能",children:e.jsx(vt,{className:"w-4 h-4"})})]})]},M.name))}),t&&e.jsx(ec,{onClose:()=>x(!1),onInstalled:f,onOpenRepoManager:()=>{x(!1),a(!0)},projects:r}),h&&e.jsx(tc,{onClose:()=>a(!1),onChanged:()=>{}})]})}function nc({projects:r=[]}){const{showAlert:o,showConfirm:l}=lt(),{hasPermission:u}=Ot(),[c,m]=n.useState([]),[d,s]=n.useState(!0),[p,t]=n.useState(!1),[x,h]=n.useState(null),[a,i]=n.useState(!1),[g,v]=n.useState(null),[k,b]=n.useState([]),[j,f]=n.useState(!1),[w,N]=n.useState(!1),L={};for(const T of r)if(T.agentInfo?.isAgent){const X=T.agentInfo.agentName;L[X]=T.agentInfo.installedVersion}const E=d?[]:r.filter(T=>T.agentInfo?.isAgent&&!c.some(X=>(X.dirName||X.name)===T.agentInfo.agentName));n.useEffect(()=>{S(),R()},[]);const S=async()=>{try{s(!0);const T=await J("/api/agents");if(T.ok){const X=await T.json();m(X.agents||[])}else{const X=await T.json();o(X.error||"获取 Agent 列表失败",{variant:"error"})}}catch(T){o(T.message,{variant:"error"})}finally{s(!1)}},R=async()=>{try{f(!0);const T=await J("/api/agents/submissions/my");if(T.ok){const X=await T.json();b(X.submissions||[])}}catch{}finally{f(!1)}},M=async()=>{try{t(!0);const T=await J("/api/agents/refresh",{method:"POST"});if(T.ok)await S();else{const X=await T.json();o(X.error||"刷新失败",{variant:"error"})}}catch(T){o(T.message,{variant:"error"})}finally{t(!1)}},D=async(T,X=!1)=>{const _=T.dirName||T.name;h(_);try{const te=await J("/api/agents/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentName:_,force:X})}),ne=await te.json();if(te.status===409&&ne.conflict){h(null),await l("检测到本地 CLAUDE.md 已被修改,更新将覆盖本地改动,是否继续?",{title:"本地文件冲突",confirmText:"强制更新",variant:"warning"})&&await D(T,!0);return}te.ok?(o(`Agent "${T.display_name||T.name}" ${X?"更新":"安装"}成功!项目已创建,Skills 和 MCP 服务已安装。`,{title:X?"更新成功":"安装成功"}),window.refreshProjects?.(),window.refreshMcpServers?.(),S()):o(ne.error||"安装失败",{variant:"error"})}catch(te){o(te.message,{variant:"error"})}finally{h(null)}},$=T=>{const X=T.dirName||T.name,_=L[X];return _?_===T.version?{state:"up_to_date",installedVersion:_}:{state:"update_available",installedVersion:_,latestVersion:T.version}:{state:"not_installed"}};return d?e.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500 dark:text-gray-400",children:[e.jsx(st,{className:"w-5 h-5 animate-spin mr-2"}),"加载中..."]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"从共享项目仓库使用预配置的项目模板,包含所需的 Skills 和 MCP 服务。"}),e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs(U,{variant:"outline",size:"sm",onClick:M,disabled:p,className:"flex items-center gap-1.5",children:[e.jsx(st,{className:`w-3.5 h-3.5 ${p?"animate-spin":""}`}),"刷新"]}),u("submit_agent")&&e.jsxs(U,{variant:"outline",size:"sm",onClick:()=>i(!0),className:"flex items-center gap-1.5",children:[e.jsx(Ht,{className:"w-3.5 h-3.5"}),"分享项目模板"]})]})]}),c.length===0?e.jsxs("div",{className:"text-center py-12 text-gray-500 dark:text-gray-400 border border-dashed border-gray-200 dark:border-gray-700 rounded-lg",children:[e.jsx(It,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"暂无可用共享项目模板"}),e.jsx("p",{className:"text-xs mt-1",children:'点击"刷新"从服务器获取最新共享项目模板列表'})]}):e.jsx("div",{className:"space-y-2",children:c.map(T=>{const X=T.dirName||T.name,_=$(T),te=g===X,ne=x===X;return e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-3 p-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center flex-shrink-0",children:e.jsx(It,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium text-sm text-gray-900 dark:text-gray-100 truncate",children:T.display_name||T.name}),e.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:["v",T.version]}),_.state==="update_available"&&e.jsxs(nt,{className:"text-xs bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400 border-amber-200 dark:border-amber-700 hover:bg-amber-200 dark:hover:bg-amber-900/50 flex-shrink-0",children:["有更新 v",_.latestVersion]}),_.state==="up_to_date"&&e.jsx(nt,{className:"text-xs bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 border-green-200 dark:border-green-700 hover:bg-green-200 dark:hover:bg-green-900/50 flex-shrink-0",children:"已使用"})]}),T.description&&e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:T.description}),e.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[T.skills?.length>0&&e.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:[T.skills.length," 个 Skill"]}),T.mcps?.length>0&&e.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:[T.mcps.length," 个 MCP"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(U,{size:"sm",variant:_.state==="not_installed"?"default":"outline",onClick:()=>D(T),disabled:ne||_.state==="up_to_date",className:"text-xs h-7 px-2.5",children:ne?e.jsx(st,{className:"w-3 h-3 animate-spin"}):_.state==="up_to_date"?"已是最新":_.state==="update_available"?e.jsxs(e.Fragment,{children:[e.jsx(_t,{className:"w-3 h-3 mr-1"}),"更新"]}):e.jsxs(e.Fragment,{children:[e.jsx(_t,{className:"w-3 h-3 mr-1"}),"使用"]})}),(T.skills?.length>0||T.mcps?.length>0)&&e.jsx("button",{onClick:()=>v(te?null:X),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:te?e.jsx(Dn,{className:"w-4 h-4"}):e.jsx(Vt,{className:"w-4 h-4"})})]})]}),te&&e.jsxs("div",{className:"border-t border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 px-3 py-2 space-y-2",children:[T.skills?.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-1",children:"所需 Skills"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:T.skills.map(Y=>e.jsx(nt,{variant:"outline",className:"text-xs",children:Y.name},Y.name))})]}),T.mcps?.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-1",children:"所需 MCP 服务"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:T.mcps.map(Y=>e.jsx(nt,{variant:"outline",className:"text-xs",children:Y.name},Y.name))})]})]})]},X)})}),E.length>0&&e.jsxs("div",{className:"border border-amber-200 dark:border-amber-800 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-50 dark:bg-amber-900/10 border-b border-amber-200 dark:border-amber-800",children:[e.jsx(Bt,{className:"w-3.5 h-3.5 text-amber-500"}),e.jsx("span",{className:"text-xs font-medium text-amber-700 dark:text-amber-400",children:"以下 Agent 已从仓库下线"})]}),e.jsx("div",{className:"divide-y divide-amber-100 dark:divide-amber-900/20",children:E.map(T=>e.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-gray-800 dark:text-gray-200",children:T.displayName}),e.jsx("span",{className:"text-xs text-gray-400 font-mono ml-2",children:T.agentInfo.agentName}),e.jsxs("span",{className:"text-xs text-amber-600 dark:text-amber-400 ml-2",children:["v",T.agentInfo.installedVersion]})]}),e.jsx("span",{className:"text-xs text-amber-500 dark:text-amber-400",children:"已下线,本地仍可继续使用"})]},T.agentInfo.agentName))})]}),(k.length>0||j)&&e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("button",{onClick:()=>N(T=>!T),className:"flex items-center gap-1 text-sm font-medium text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100",children:[w?e.jsx(Dn,{className:"w-3.5 h-3.5"}):e.jsx(Vt,{className:"w-3.5 h-3.5"}),"我的提交记录"]}),e.jsxs("button",{onClick:R,disabled:j,className:"text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 flex items-center gap-1",children:[e.jsx(st,{className:`w-3 h-3 ${j?"animate-spin":""}`}),"刷新"]})]}),w&&e.jsx("div",{className:"space-y-2",children:k.map(T=>{const X={pending:{label:"审核中",icon:Mr,color:"text-amber-600 dark:text-amber-400",bg:"bg-amber-50 dark:bg-amber-900/20 border-amber-200 dark:border-amber-800"},approved:{label:"已通过",icon:ss,color:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800"},rejected:{label:"已拒绝",icon:os,color:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800"}},_=X[T.status]||X.pending,te=_.icon;return e.jsx("div",{className:`border rounded-lg px-3 py-2.5 ${_.bg}`,children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:T.display_name}),e.jsxs("span",{className:"text-xs text-gray-400",children:["(",T.agent_name,")"]}),T.version&&e.jsxs("span",{className:"text-xs text-gray-400",children:["v",T.version]})]}),e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:["提交于 ",new Date(T.submitted_at).toLocaleString("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})]}),T.status==="rejected"&&T.reject_reason&&e.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:["拒绝原因:",T.reject_reason]}),T.status==="approved"&&T.reviewed_at&&e.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 mt-0.5",children:["审核通过,已发布为 v",T.version]})]}),e.jsxs("div",{className:`flex items-center gap-1 flex-shrink-0 text-xs font-medium ${_.color}`,children:[e.jsx(te,{className:"w-3.5 h-3.5"}),_.label]})]})},T.id)})})]}),a&&e.jsx(qn,{projects:r,onClose:()=>i(!1),onSubmitted:()=>{i(!1),R()}})]})}var Sn={exports:{}},Bo;function oc(){return Bo||(Bo=1,function(r,o){(function(u,c){r.exports=c()})(globalThis,()=>(()=>{var l={949(d,s,p){Object.defineProperty(s,"__esModule",{value:!0}),s.CronParser=void 0;var t=p(515),x=function(){function h(a,i,g){i===void 0&&(i=!0),g===void 0&&(g=!1),this.expression=a,this.dayOfWeekStartIndexZero=i,this.monthStartIndexZero=g}return h.prototype.parse=function(){var a,i,g=(a=this.expression)!==null&&a!==void 0?a:"";if(g==="@reboot")return i=["@reboot","","","","","",""],i;if(g.startsWith("@")){var v=this.parseSpecial(this.expression);i=this.extractParts(v)}else i=this.extractParts(this.expression);return this.normalize(i),this.validate(i),i},h.prototype.parseSpecial=function(a){var i={"@yearly":"0 0 1 1 *","@annually":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *","@reboot":"@reboot"},g=i[a];if(!g)throw new Error("Unknown special expression.");return g},h.prototype.extractParts=function(a){if(!this.expression)throw new Error("cron expression is empty");for(var i=a.trim().split(/[ ]+/),g=0;g<i.length;g++)if(i[g].includes(",")){var v=i[g].split(",").map(function(b){return b.trim()}).filter(function(b){return b!==""}).map(function(b){return isNaN(Number(b))?b:Number(b)}).filter(function(b){return b!==null&&b!==""});v.length===0&&v.push("*"),v.sort(function(b,j){return b!==null&&j!==null?b-j:0}),i[g]=v.map(function(b){return b!==null?b.toString():""}).join(",")}if(i.length<5)throw new Error("Expression has only ".concat(i.length," part").concat(i.length==1?"":"s",". At least 5 parts are required."));if(i.length==5)i.unshift(""),i.push("");else if(i.length==6){var k=/\d{4}$/.test(i[5])||i[4]=="?"||i[2]=="?";k?i.unshift(""):i.push("")}else if(i.length>7)throw new Error("Expression has ".concat(i.length," parts; too many!"));return i},h.prototype.normalize=function(a){var i=this;if(a[3]=a[3].replace("?","*"),a[5]=a[5].replace("?","*"),a[2]=a[2].replace("?","*"),a[0].indexOf("0/")==0&&(a[0]=a[0].replace("0/","*/")),a[1].indexOf("0/")==0&&(a[1]=a[1].replace("0/","*/")),a[2].indexOf("0/")==0&&(a[2]=a[2].replace("0/","*/")),a[3].indexOf("1/")==0&&(a[3]=a[3].replace("1/","*/")),a[4].indexOf("1/")==0&&(a[4]=a[4].replace("1/","*/")),a[6].indexOf("1/")==0&&(a[6]=a[6].replace("1/","*/")),a[5]=a[5].replace(/(^\d)|([^#/\s]\d)/g,function(N){var L=N.replace(/\D/,""),E=L;return i.dayOfWeekStartIndexZero?L=="7"&&(E="0"):E=(parseInt(L)-1).toString(),N.replace(L,E)}),a[5]=="L"&&(a[5]="6"),a[3]=="?"&&(a[3]="*"),a[3].indexOf("W")>-1&&(a[3].indexOf(",")>-1||a[3].indexOf("-")>-1))throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");var g={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var v in g)a[5]=a[5].replace(new RegExp(v,"gi"),g[v].toString());a[4]=a[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(N){var L=N.replace(/\D/,""),E=L;return i.monthStartIndexZero&&(E=(parseInt(L)+1).toString()),N.replace(L,E)});var k={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var b in k)a[4]=a[4].replace(new RegExp(b,"gi"),k[b].toString());a[0]=="0"&&(a[0]=""),!/\*|\-|\,|\//.test(a[2])&&(/\*|\//.test(a[1])||/\*|\//.test(a[0]))&&(a[2]+="-".concat(a[2]));for(var j=0;j<a.length;j++)if(a[j].indexOf(",")!=-1&&(a[j]=a[j].split(",").filter(function(N){return N!==""}).join(",")||"*"),a[j]=="*/1"&&(a[j]="*"),a[j].indexOf("/")>-1&&!/^\*|\-|\,/.test(a[j])){var f=null;switch(j){case 4:f="12";break;case 5:f="6";break;case 6:f="9999";break;default:f=null;break}if(f!==null){var w=a[j].split("/");a[j]="".concat(w[0],"-").concat(f,"/").concat(w[1])}}},h.prototype.validate=function(a){var i="0-9,\\-*/";this.validateOnlyExpectedCharactersFound(a[0],i),this.validateOnlyExpectedCharactersFound(a[1],i),this.validateOnlyExpectedCharactersFound(a[2],i),this.validateOnlyExpectedCharactersFound(a[3],"0-9,\\-*/LW"),this.validateOnlyExpectedCharactersFound(a[4],i),this.validateOnlyExpectedCharactersFound(a[5],"0-9,\\-*/L#"),this.validateOnlyExpectedCharactersFound(a[6],i),this.validateAnyRanges(a)},h.prototype.validateAnyRanges=function(a){t.default.secondRange(a[0]),t.default.minuteRange(a[1]),t.default.hourRange(a[2]),t.default.dayOfMonthRange(a[3]),t.default.monthRange(a[4],this.monthStartIndexZero),t.default.dayOfWeekRange(a[5],this.dayOfWeekStartIndexZero)},h.prototype.validateOnlyExpectedCharactersFound=function(a,i){var g=a.match(new RegExp("[^".concat(i,"]+"),"gi"));if(g&&g.length)throw new Error("Expression contains invalid values: '".concat(g.toString(),"'"))},h}();s.CronParser=x},333(d,s,p){Object.defineProperty(s,"__esModule",{value:!0}),s.ExpressionDescriptor=void 0;var t=p(823),x=p(949),h=function(){function a(i,g){if(this.expression=i,this.options=g,this.expressionParts=new Array(5),!this.options.locale&&a.defaultLocale&&(this.options.locale=a.defaultLocale),!a.locales[this.options.locale]){var v=Object.keys(a.locales)[0];console.warn("Locale '".concat(this.options.locale,"' could not be found; falling back to '").concat(v,"'.")),this.options.locale=v}this.i18n=a.locales[this.options.locale],g.use24HourTimeFormat===void 0&&(g.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return a.toString=function(i,g){var v=g===void 0?{}:g,k=v.throwExceptionOnParseError,b=k===void 0?!0:k,j=v.verbose,f=j===void 0?!1:j,w=v.dayOfWeekStartIndexZero,N=w===void 0?!0:w,L=v.monthStartIndexZero,E=L===void 0?!1:L,S=v.use24HourTimeFormat,R=v.trimHoursLeadingZero,M=R===void 0?!1:R,D=v.locale,$=D===void 0?null:D,T=v.logicalAndDayFields,X=T===void 0?!1:T,_={throwExceptionOnParseError:b,verbose:f,dayOfWeekStartIndexZero:N,monthStartIndexZero:E,use24HourTimeFormat:S,trimHoursLeadingZero:M,locale:$,logicalAndDayFields:X};_.tzOffset&&console.warn("'tzOffset' option has been deprecated and is no longer supported.");var te=new a(i,_);return te.getFullDescription()},a.initialize=function(i,g){g===void 0&&(g="en"),a.specialCharacters=["/","-",",","*"],a.defaultLocale=g,i.load(a.locales)},a.prototype.getFullDescription=function(){var i,g,v="";try{var k=new x.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero);if(this.expressionParts=k.parse(),this.expressionParts[0]==="@reboot")return((g=(i=this.i18n).atReboot)===null||g===void 0?void 0:g.call(i))||"Run once, at startup";var b=this.getTimeOfDayDescription(),j=this.getDayOfMonthDescription(),f=this.getMonthDescription(),w=this.getDayOfWeekDescription(),N=this.getYearDescription();v+=b+j+w+f+N,v=this.transformVerbosity(v,!!this.options.verbose),v=v.charAt(0).toLocaleUpperCase()+v.substr(1)}catch(L){if(!this.options.throwExceptionOnParseError)v=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw"".concat(L)}return v},a.prototype.getTimeOfDayDescription=function(){var i=this.expressionParts[0],g=this.expressionParts[1],v=this.expressionParts[2],k="";if(!t.StringUtilities.containsAny(g,a.specialCharacters)&&!t.StringUtilities.containsAny(v,a.specialCharacters)&&!t.StringUtilities.containsAny(i,a.specialCharacters))k+=this.i18n.atSpace()+this.formatTime(v,g,i);else if(!i&&g.indexOf("-")>-1&&!(g.indexOf(",")>-1)&&!(g.indexOf("/")>-1)&&!t.StringUtilities.containsAny(v,a.specialCharacters)){var b=g.split("-");k+=t.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(v,b[0],""),this.formatTime(v,b[1],""))}else if(!i&&v.indexOf(",")>-1&&v.indexOf("-")==-1&&v.indexOf("/")==-1&&!t.StringUtilities.containsAny(g,a.specialCharacters)){var j=v.split(",");k+=this.i18n.at();for(var f=0;f<j.length;f++)k+=" ",k+=this.formatTime(j[f],g,""),f<j.length-2&&(k+=","),f==j.length-2&&(k+=this.i18n.spaceAnd())}else{var w=this.getSecondsDescription(),N=this.getMinutesDescription(),L=this.getHoursDescription();if(k+=w,k&&N&&(k+=", "),k+=N,N===L)return k;k&&L&&(k+=", "),k+=L}return k},a.prototype.getSecondsDescription=function(){var i=this,g=this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(v){return v},function(v){return t.StringUtilities.format(i.i18n.everyX0Seconds(v),v)},function(v){return i.i18n.secondsX0ThroughX1PastTheMinute()},function(v){return v=="0"?"":parseInt(v)<20?i.i18n.atX0SecondsPastTheMinute(v):i.i18n.atX0SecondsPastTheMinuteGt20()||i.i18n.atX0SecondsPastTheMinute(v)});return g},a.prototype.getMinutesDescription=function(){var i=this,g=this.expressionParts[0],v=this.expressionParts[2],k=this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(b){return b},function(b){return t.StringUtilities.format(i.i18n.everyX0Minutes(b),b)},function(b){return i.i18n.minutesX0ThroughX1PastTheHour()},function(b){var j,f;try{return b=="0"&&v.indexOf("/")==-1&&g==""?i.i18n.everyHour():b=="0"?((f=(j=i.i18n).onTheHour)===null||f===void 0?void 0:f.call(j))||i.i18n.atX0MinutesPastTheHour(b):parseInt(b)<20?i.i18n.atX0MinutesPastTheHour(b):i.i18n.atX0MinutesPastTheHourGt20()||i.i18n.atX0MinutesPastTheHour(b)}catch{return i.i18n.atX0MinutesPastTheHour(b)}});return k},a.prototype.getHoursDescription=function(){var i=this,g=this.expressionParts[2],v=0,k=[];g.split("/")[0].split(",").forEach(function(f){var w=f.split("-");w.length===2&&k.push({value:w[1],index:v+1}),v+=w.length});var b=0,j=this.getSegmentDescription(g,this.i18n.everyHour(),function(f){var w=k.find(function(L){return L.value===f&&L.index===b}),N=w&&i.expressionParts[1]!=="0";return b++,N?i.formatTime(f,"59",""):i.formatTime(f,"0","")},function(f){return t.StringUtilities.format(i.i18n.everyX0Hours(f),f)},function(f){return i.i18n.betweenX0AndX1()},function(f){return i.i18n.atX0()});return j},a.prototype.getDayOfWeekDescription=function(){var i=this,g=this.i18n.daysOfTheWeek(),v=null;return this.expressionParts[5]=="*"?v="":v=this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(k,b){var j=k;k.indexOf("#")>-1?j=k.substring(0,k.indexOf("#")):k.indexOf("L")>-1&&(j=j.replace("L",""));var f=parseInt(j),w=i.i18n.daysOfTheWeekInCase?i.i18n.daysOfTheWeekInCase(b)[f]:g[f];if(k.indexOf("#")>-1){var N=null,L=k.substring(k.indexOf("#")+1),E=k.substring(0,k.indexOf("#"));switch(L){case"1":N=i.i18n.first(E);break;case"2":N=i.i18n.second(E);break;case"3":N=i.i18n.third(E);break;case"4":N=i.i18n.fourth(E);break;case"5":N=i.i18n.fifth(E);break}w=N+" "+w}return w},function(k){return parseInt(k)==1?"":t.StringUtilities.format(i.i18n.commaEveryX0DaysOfTheWeek(k),k)},function(k){var b=k.substring(0,k.indexOf("-")),j=i.expressionParts[3]!="*";return j?i.i18n.commaAndX0ThroughX1(b):i.i18n.commaX0ThroughX1(b)},function(k){var b=null;if(k.indexOf("#")>-1){var j=k.substring(k.indexOf("#")+1),f=k.substring(0,k.indexOf("#"));b=i.i18n.commaOnThe(j,f).trim()+i.i18n.spaceX0OfTheMonth()}else if(k.indexOf("L")>-1)b=i.i18n.commaOnTheLastX0OfTheMonth(k.replace("L",""));else{var w=i.expressionParts[3]!="*";w?i.options.logicalAndDayFields?b=i.i18n.commaOnlyOnX0(k):b=i.i18n.commaAndOnX0():b=i.i18n.commaOnlyOnX0(k)}return b}),v},a.prototype.getMonthDescription=function(){var i=this,g=this.i18n.monthsOfTheYear(),v=this.getSegmentDescription(this.expressionParts[4],"",function(k,b){return b&&i.i18n.monthsOfTheYearInCase?i.i18n.monthsOfTheYearInCase(b)[parseInt(k)-1]:g[parseInt(k)-1]},function(k){return parseInt(k)==1?"":t.StringUtilities.format(i.i18n.commaEveryX0Months(k),k)},function(k){return i.i18n.commaMonthX0ThroughMonthX1()||i.i18n.commaX0ThroughX1()},function(k){return i.i18n.commaOnlyInMonthX0?i.i18n.commaOnlyInMonthX0():i.i18n.commaOnlyInX0()});return v},a.prototype.getDayOfMonthDescription=function(){var i=this,g=null,v=this.expressionParts[3];switch(v){case"L":g=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":g=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var k=v.match(/(\d{1,2}W)|(W\d{1,2})/);if(k){var b=parseInt(k[0].replace("W","")),j=b==1?this.i18n.firstWeekday():t.StringUtilities.format(this.i18n.weekdayNearestDayX0(),b.toString());g=t.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),j);break}else{var f=v.match(/L-(\d{1,2})/);if(f){var w=f[1];g=t.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(w),w);break}else{if(v=="*"&&this.expressionParts[5]!="*")return"";g=this.getSegmentDescription(v,this.i18n.commaEveryDay(),function(N){return N=="L"?i.i18n.lastDay():i.i18n.dayX0?t.StringUtilities.format(i.i18n.dayX0(),N):N},function(N){return N=="1"?i.i18n.commaEveryDay():i.i18n.commaEveryX0Days(N)},function(N){return i.i18n.commaBetweenDayX0AndX1OfTheMonth(N)},function(N){return i.i18n.commaOnDayX0OfTheMonth(N)})}break}}return g},a.prototype.getYearDescription=function(){var i=this,g=this.getSegmentDescription(this.expressionParts[6],"",function(v){return/^\d+$/.test(v)?new Date(parseInt(v),1).getFullYear().toString():v},function(v){return t.StringUtilities.format(i.i18n.commaEveryX0Years(v),v)},function(v){return i.i18n.commaYearX0ThroughYearX1()||i.i18n.commaX0ThroughX1()},function(v){return i.i18n.commaOnlyInYearX0?i.i18n.commaOnlyInYearX0():i.i18n.commaOnlyInX0()});return g},a.prototype.getSegmentDescription=function(i,g,v,k,b,j){var f=null,w=i.indexOf("/")>-1,N=i.indexOf("-")>-1,L=i.indexOf(",")>-1;if(!i)f="";else if(i==="*")f=g;else if(!w&&!N&&!L)f=t.StringUtilities.format(j(i),v(i));else if(L){for(var E=i.split(","),S="",R=0;R<E.length;R++)if(R>0&&E.length>2&&(S+=",",R<E.length-1&&(S+=" ")),R>0&&E.length>1&&(R==E.length-1||E.length==2)&&(S+="".concat(this.i18n.spaceAnd()," ")),E[R].indexOf("/")>-1||E[R].indexOf("-")>-1){var M=E[R].indexOf("-")>-1&&E[R].indexOf("/")==-1,D=this.getSegmentDescription(E[R],g,v,k,M?this.i18n.commaX0ThroughX1:b,j);M&&(D=D.replace(", ","")),S+=D}else if(!w)S+=v(E[R]);else{var $=this.getSegmentDescription(E[R],g,v,k,b,j);$&&$.startsWith(", ")&&($=$.substring(2)),S+=$}w?f=S:f=t.StringUtilities.format(j(i),S)}else if(w){var E=i.split("/");if(f=t.StringUtilities.format(k(E[1]),E[1]),E[0].indexOf("-")>-1){var T=this.generateRangeSegmentDescription(E[0],b,v);T.indexOf(", ")!=0&&(f+=", "),f+=T}else if(E[0].indexOf("*")==-1){var X=t.StringUtilities.format(j(E[0]),v(E[0]));X=X.replace(", ",""),f+=t.StringUtilities.format(this.i18n.commaStartingX0(),X)}}else N&&(f=this.generateRangeSegmentDescription(i,b,v));return f},a.prototype.generateRangeSegmentDescription=function(i,g,v){var k="",b=i.split("-"),j=v(b[0],1),f=v(b[1],2),w=g(i);return k+=t.StringUtilities.format(w,j,f),k},a.prototype.formatTime=function(i,g,v){var k=0,b=0,j=parseInt(i)+k,f=parseInt(g)+b;f>=60?(f-=60,j+=1):f<0&&(f+=60,j-=1),j>=24?j=j-24:j<0&&(j=24+j);var w="",N=!1;this.options.use24HourTimeFormat||(N=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),w=N?"".concat(this.getPeriod(j)," "):" ".concat(this.getPeriod(j)),j>12&&(j-=12),j===0&&(j=12));var L="";v&&(L=":".concat(("00"+v).substring(v.length)));var E=j.toString(),S=("00"+E).substring(E.length),R=f.toString(),M=("00"+R).substring(R.length),D=this.options.trimHoursLeadingZero?E:S;return"".concat(N?w:"").concat(D,":").concat(M).concat(L).concat(N?"":w)},a.prototype.transformVerbosity=function(i,g){if(!g&&(i=i.replace(new RegExp(", ".concat(this.i18n.everyMinute()),"g"),""),i=i.replace(new RegExp(", ".concat(this.i18n.everyHour()),"g"),""),i=i.replace(new RegExp(this.i18n.commaEveryDay(),"g"),""),i=i.replace(/\, ?$/,""),this.i18n.conciseVerbosityReplacements))for(var v=0,k=Object.entries(this.i18n.conciseVerbosityReplacements());v<k.length;v++){var b=k[v],j=b[0],f=b[1];i=i.replace(new RegExp(j,"g"),f)}return i},a.prototype.getPeriod=function(i){return i>=12?this.i18n.pm&&this.i18n.pm()||"PM":this.i18n.am&&this.i18n.am()||"AM"},a.locales={},a}();s.ExpressionDescriptor=h},99(d,s,p){Object.defineProperty(s,"__esModule",{value:!0}),s.sr=s.hr=s.bg=s.my=s.vi=s.ar=s.th=s.af=s.hu=s.be=s.ca=s.fa=s.sw=s.sl=s.fi=s.sk=s.cs=s.he=s.ja=s.zh_TW=s.zh_CN=s.uk=s.tr=s.ru=s.ro=s.pt_PT=s.pt_BR=s.pl=s.sv=s.nb=s.nl=s.ko=s.id=s.it=s.fr=s.es=s.de=s.da=s.en=void 0;var t=p(486);Object.defineProperty(s,"en",{enumerable:!0,get:function(){return t.en}});var x=p(506);Object.defineProperty(s,"da",{enumerable:!0,get:function(){return x.da}});var h=p(230);Object.defineProperty(s,"de",{enumerable:!0,get:function(){return h.de}});var a=p(153);Object.defineProperty(s,"es",{enumerable:!0,get:function(){return a.es}});var i=p(517);Object.defineProperty(s,"fr",{enumerable:!0,get:function(){return i.fr}});var g=p(488);Object.defineProperty(s,"it",{enumerable:!0,get:function(){return g.it}});var v=p(72);Object.defineProperty(s,"id",{enumerable:!0,get:function(){return v.id}});var k=p(839);Object.defineProperty(s,"ko",{enumerable:!0,get:function(){return k.ko}});var b=p(647);Object.defineProperty(s,"nl",{enumerable:!0,get:function(){return b.nl}});var j=p(957);Object.defineProperty(s,"nb",{enumerable:!0,get:function(){return j.nb}});var f=p(544);Object.defineProperty(s,"sv",{enumerable:!0,get:function(){return f.sv}});var w=p(905);Object.defineProperty(s,"pl",{enumerable:!0,get:function(){return w.pl}});var N=p(556);Object.defineProperty(s,"pt_BR",{enumerable:!0,get:function(){return N.pt_BR}});var L=p(163);Object.defineProperty(s,"pt_PT",{enumerable:!0,get:function(){return L.pt_PT}});var E=p(614);Object.defineProperty(s,"ro",{enumerable:!0,get:function(){return E.ro}});var S=p(892);Object.defineProperty(s,"ru",{enumerable:!0,get:function(){return S.ru}});var R=p(631);Object.defineProperty(s,"tr",{enumerable:!0,get:function(){return R.tr}});var M=p(225);Object.defineProperty(s,"uk",{enumerable:!0,get:function(){return M.uk}});var D=p(571);Object.defineProperty(s,"zh_CN",{enumerable:!0,get:function(){return D.zh_CN}});var $=p(983);Object.defineProperty(s,"zh_TW",{enumerable:!0,get:function(){return $.zh_TW}});var T=p(904);Object.defineProperty(s,"ja",{enumerable:!0,get:function(){return T.ja}});var X=p(82);Object.defineProperty(s,"he",{enumerable:!0,get:function(){return X.he}});var _=p(651);Object.defineProperty(s,"cs",{enumerable:!0,get:function(){return _.cs}});var te=p(923);Object.defineProperty(s,"sk",{enumerable:!0,get:function(){return te.sk}});var ne=p(964);Object.defineProperty(s,"fi",{enumerable:!0,get:function(){return ne.fi}});var Y=p(474);Object.defineProperty(s,"sl",{enumerable:!0,get:function(){return Y.sl}});var le=p(799);Object.defineProperty(s,"sw",{enumerable:!0,get:function(){return le.sw}});var de=p(804);Object.defineProperty(s,"fa",{enumerable:!0,get:function(){return de.fa}});var fe=p(845);Object.defineProperty(s,"ca",{enumerable:!0,get:function(){return fe.ca}});var Ee=p(348);Object.defineProperty(s,"be",{enumerable:!0,get:function(){return Ee.be}});var ye=p(194);Object.defineProperty(s,"hu",{enumerable:!0,get:function(){return ye.hu}});var Me=p(810);Object.defineProperty(s,"af",{enumerable:!0,get:function(){return Me.af}});var Fe=p(33);Object.defineProperty(s,"th",{enumerable:!0,get:function(){return Fe.th}});var ie=p(574);Object.defineProperty(s,"ar",{enumerable:!0,get:function(){return ie.ar}});var Se=p(292);Object.defineProperty(s,"vi",{enumerable:!0,get:function(){return Se.vi}});var He=p(919);Object.defineProperty(s,"my",{enumerable:!0,get:function(){return He.my}});var Be=p(622);Object.defineProperty(s,"bg",{enumerable:!0,get:function(){return Be.bg}});var he=p(131);Object.defineProperty(s,"hr",{enumerable:!0,get:function(){return he.hr}});var Oe=p(716);Object.defineProperty(s,"sr",{enumerable:!0,get:function(){return Oe.sr}})},420(d,s,p){Object.defineProperty(s,"__esModule",{value:!0}),s.allLocalesLoader=void 0;var t=p(99),x=function(){function h(){}return h.prototype.load=function(a){for(var i in t)t.hasOwnProperty(i)&&(a[i]=new t[i])},h}();s.allLocalesLoader=x},810(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.af=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return", jaar %s na %s"},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Daar was 'n fout om die tydsuitdrukking the genereer. Raadpleeg asb die uitdrukking formaat."},t.prototype.everyMinute=function(){return"elke minuut"},t.prototype.everyHour=function(){return"elke uur"},t.prototype.atSpace=function(){return"Teen "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Elke minuut tussen %s en %s"},t.prototype.at=function(){return"Teen"},t.prototype.spaceAnd=function(){return" en"},t.prototype.everySecond=function(){return"elke sekonde"},t.prototype.everyX0Seconds=function(){return"elke %s sekonde"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekonde %s deur na %s na die minuut"},t.prototype.atX0SecondsPastTheMinute=function(){return"teen %s sekondes na die minuut"},t.prototype.everyX0Minutes=function(){return"elke %s minute"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minute %s deur na %s na die uur"},t.prototype.atX0MinutesPastTheHour=function(){return"teen %s minute na die uur"},t.prototype.everyX0Hours=function(){return"elke %s ure"},t.prototype.betweenX0AndX1=function(){return"tussen %s en %s"},t.prototype.atX0=function(){return"teen %s"},t.prototype.commaEveryDay=function(){return", elke dag"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", elke %s dae van die week"},t.prototype.commaX0ThroughX1=function(){return", %s deur na %s"},t.prototype.commaAndX0ThroughX1=function(){return", en %s deur na %s"},t.prototype.first=function(){return"eerste"},t.prototype.second=function(){return"tweede"},t.prototype.third=function(){return"derde"},t.prototype.fourth=function(){return"vierde"},t.prototype.fifth=function(){return"vyfde"},t.prototype.commaOnThe=function(){return", op die "},t.prototype.spaceX0OfTheMonth=function(){return" %s van die maand"},t.prototype.lastDay=function(){return"die laaste dag"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", op die laaste %s van die maand"},t.prototype.commaOnlyOnX0=function(){return", net op %s"},t.prototype.commaAndOnX0=function(){return", en op %s"},t.prototype.commaEveryX0Months=function(){return", elke %s maande"},t.prototype.commaOnlyInX0=function(){return", net in %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", op die laaste dag van die maand"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", op die laaste weeksdag van die maand"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dae voor die laaste dag van die maand"},t.prototype.firstWeekday=function(){return"eerste weeksdag"},t.prototype.weekdayNearestDayX0=function(){return"weeksdag naaste aan dag %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", op die %s van die maande"},t.prototype.commaEveryX0Days=function(){return", elke %s dae"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", tussen dag %s en %s van die maand"},t.prototype.commaOnDayX0OfTheMonth=function(){return", op dag %s van die maand"},t.prototype.commaEveryHour=function(){return", elke uur"},t.prototype.commaEveryX0Years=function(){return", elke %s jare"},t.prototype.commaStartingX0=function(){return", beginnende %s"},t.prototype.daysOfTheWeek=function(){return["Sondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrydag","Saterdag"]},t.prototype.monthsOfTheYear=function(){return["Januarie","Februarie","Maart","April","Mei","Junie","Julie","Augustus","September","Oktober","November","Desember"]},t.prototype.onTheHour=function(){return"op die uur"},t}();s.af=p},574(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ar=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"حدث خطأ في إنشاء وصف المصطلح٠ تأكد من تركيب مصطلح الكرون"},t.prototype.everyMinute=function(){return"كل دقيقة"},t.prototype.everyHour=function(){return"كل ساعة"},t.prototype.atSpace=function(){return" "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"كل دقيقة بين %s و %s"},t.prototype.at=function(){return""},t.prototype.spaceAnd=function(){return" و"},t.prototype.everySecond=function(){return"كل ثانية"},t.prototype.everyX0Seconds=function(){return"كل %s ثواني"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"الثواني %s حتى %s من بداية الدقيقة"},t.prototype.atX0SecondsPastTheMinute=function(){return"الثانية %s من بداية الدقيقة"},t.prototype.everyX0Minutes=function(){return"كل %s دقائق"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"الدقائق %s حتى %s من بداية الساعة"},t.prototype.atX0MinutesPastTheHour=function(){return"الدقيقة %s من بداية الساعة"},t.prototype.everyX0Hours=function(){return"كل %s ساعات"},t.prototype.betweenX0AndX1=function(){return"بين %s و %s"},t.prototype.atX0=function(){return"%s"},t.prototype.commaEveryDay=function(){return"، كل يوم"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return"، كل %s من أيام الأسبوع"},t.prototype.commaX0ThroughX1=function(){return"، %s حتى %s"},t.prototype.commaAndX0ThroughX1=function(){return"، و %s حتى %s"},t.prototype.first=function(){return"أول"},t.prototype.second=function(){return"ثاني"},t.prototype.third=function(){return"ثالث"},t.prototype.fourth=function(){return"رابع"},t.prototype.fifth=function(){return"خامس"},t.prototype.commaOnThe=function(){return"، في ال"},t.prototype.spaceX0OfTheMonth=function(){return" %s من الشهر"},t.prototype.lastDay=function(){return"اليوم الأخير"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return"، في اخر %s من الشهر"},t.prototype.commaOnlyOnX0=function(){return"، %s فقط"},t.prototype.commaAndOnX0=function(){return"، وفي %s"},t.prototype.commaEveryX0Months=function(){return"، كل %s أشهر"},t.prototype.commaOnlyInX0=function(){return"، %s فقط"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return"، في اخر يوم من الشهر"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return"، في اخر يوم أسبوع من الشهر"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return"، %s أيام قبل اخر يوم من الشهر"},t.prototype.firstWeekday=function(){return"اول ايام الأسبوع"},t.prototype.weekdayNearestDayX0=function(){return"يوم الأسبوع الأقرب ليوم %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return"، في %s من الشهر"},t.prototype.commaEveryX0Days=function(){return"، كل %s أيام"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return"، بين يوم %s و %s من الشهر"},t.prototype.commaOnDayX0OfTheMonth=function(){return"، في اليوم %s من الشهر"},t.prototype.commaEveryHour=function(){return"، كل ساعة"},t.prototype.commaEveryX0Years=function(){return"، كل %s سنوات"},t.prototype.commaStartingX0=function(){return"، بداية من %s"},t.prototype.daysOfTheWeek=function(){return["الأحد","الإثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت"]},t.prototype.monthsOfTheYear=function(){return["يناير","فبراير","مارس","ابريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"]},t.prototype.onTheHour=function(){return"في تمام الساعة"},t}();s.ar=p},348(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.be=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!1},t.prototype.everyMinute=function(){return"кожную хвіліну"},t.prototype.everyHour=function(){return"кожную гадзіну"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Адбылася памылка падчас генерацыі апісання выразы. Праверце сінтаксіс крон-выразы."},t.prototype.atSpace=function(){return"У "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Кожную хвіліну з %s да %s"},t.prototype.at=function(){return"У"},t.prototype.spaceAnd=function(){return" і"},t.prototype.everySecond=function(){return"кожную секунду"},t.prototype.everyX0Seconds=function(){return"кожныя %s секунд"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"секунды з %s па %s"},t.prototype.atX0SecondsPastTheMinute=function(){return"у %s секунд"},t.prototype.everyX0Minutes=function(){return"кожныя %s хвілін"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"хвіліны з %s па %s"},t.prototype.atX0MinutesPastTheHour=function(){return"у %s хвілін"},t.prototype.everyX0Hours=function(){return"кожныя %s гадзін"},t.prototype.betweenX0AndX1=function(){return"з %s па %s"},t.prototype.atX0=function(){return"у %s"},t.prototype.commaEveryDay=function(){return", кожны дзень"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", кожныя %s дзён тыдня"},t.prototype.commaX0ThroughX1=function(){return", %s па %s"},t.prototype.commaAndX0ThroughX1=function(){return", і %s па %s"},t.prototype.first=function(){return"першы"},t.prototype.second=function(){return"другі"},t.prototype.third=function(){return"трэці"},t.prototype.fourth=function(){return"чацвёрты"},t.prototype.fifth=function(){return"пяты"},t.prototype.commaOnThe=function(){return", у "},t.prototype.spaceX0OfTheMonth=function(){return" %s месяца"},t.prototype.lastDay=function(){return"апошні дзень"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", у апошні %s месяца"},t.prototype.commaOnlyOnX0=function(){return", толькі ў %s"},t.prototype.commaAndOnX0=function(){return", і ў %s"},t.prototype.commaEveryX0Months=function(){return", кожныя %s месяцаў"},t.prototype.commaOnlyInX0=function(){return", толькі ў %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", у апошні дзень месяца"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", у апошні будні дзень месяца"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s дзён да апошняга дня месяца"},t.prototype.firstWeekday=function(){return"першы будны дзень"},t.prototype.weekdayNearestDayX0=function(){return"найбліжэйшы будны дзень да %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", у %s месяцы"},t.prototype.commaEveryX0Days=function(){return", кожныя %s дзён"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", з %s па %s лік месяца"},t.prototype.commaOnDayX0OfTheMonth=function(){return", у %s лік месяца"},t.prototype.commaEveryX0Years=function(){return", кожныя %s гадоў"},t.prototype.commaStartingX0=function(){return", пачатак %s"},t.prototype.daysOfTheWeek=function(){return["нядзеля","панядзелак","аўторак","серада","чацвер","пятніца","субота"]},t.prototype.monthsOfTheYear=function(){return["студзень","люты","сакавік","красавік","травень","чэрвень","ліпень","жнівень","верасень","кастрычнік","лістапад","снежань"]},t.prototype.onTheHour=function(){return"роўна ў гадзіну"},t}();s.be=p},622(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.bg=void 0;var p=function(a,i){var g=a!=null?Number(a):0;return g<2?i[0]:i[1]},t=function(a,i){var g=a!=null?Number(a):0;return i[[1,0,0,1,0,0,1][g]]},x=function(a,i){var g=a!=null?Number(a):1;g=Math.max(Math.min(g<10||g>20&&g%10!==0?g%10:3,3),1)-1;var v=["м","ж","ср"].indexOf(i);return["в","р","т"][g]+["и","а","о"][v]},h=function(){function a(){}return a.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},a.prototype.atX0MinutesPastTheHourGt20=function(){return null},a.prototype.commaMonthX0ThroughMonthX1=function(){return null},a.prototype.commaYearX0ThroughYearX1=function(){return null},a.prototype.use24HourTimeFormatByDefault=function(){return!0},a.prototype.everyMinute=function(){return"всяка минута"},a.prototype.everyHour=function(){return"всеки час"},a.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Възникна грешка при генериране на описанието на израза. Проверете синтаксиса на cron израза."},a.prototype.atSpace=function(){return"В "},a.prototype.everyMinuteBetweenX0AndX1=function(){return"Всяка минута от %s до %s"},a.prototype.at=function(){return"В"},a.prototype.spaceAnd=function(){return" и"},a.prototype.everySecond=function(){return"всяка секунда"},a.prototype.everyX0Seconds=function(i){return"всеки %s секунди"},a.prototype.secondsX0ThroughX1PastTheMinute=function(){return"секунди от %s до %s"},a.prototype.atX0SecondsPastTheMinute=function(i){return"%s-".concat(x(i,"ж")," секунда")},a.prototype.everyX0Minutes=function(i){return"всеки %s минути"},a.prototype.minutesX0ThroughX1PastTheHour=function(){return"минути от %s до %s"},a.prototype.atX0MinutesPastTheHour=function(i){return"%s-".concat(x(i,"ж")," минутa")},a.prototype.everyX0Hours=function(i){return"всеки %s часа"},a.prototype.betweenX0AndX1=function(){return"от %s до %s"},a.prototype.atX0=function(){return"в %s"},a.prototype.commaEveryDay=function(){return", всеки ден"},a.prototype.commaEveryX0DaysOfTheWeek=function(i){return p(i,[", всеки %s ден от седмицата",", всеки %s дена от седмицата"])},a.prototype.commaX0ThroughX1=function(i){return", от %s до %s"},a.prototype.commaAndX0ThroughX1=function(i){return" и от %s до %s"},a.prototype.first=function(i){return t(i,["первият","первата"])},a.prototype.second=function(i){return t(i,["вторият","втората"])},a.prototype.third=function(i){return t(i,["третият","третата"])},a.prototype.fourth=function(i){return t(i,["четвертият","четвертата"])},a.prototype.fifth=function(i){return t(i,["петият","петата"])},a.prototype.commaOnThe=function(i){return", "},a.prototype.spaceX0OfTheMonth=function(){return" %s на месеца"},a.prototype.lastDay=function(){return"последният ден"},a.prototype.commaOnTheLastX0OfTheMonth=function(i){return t(i,[", в последният %s от месеца",", в последната %s отмесеца"])},a.prototype.commaOnlyOnX0=function(i){return", %s"},a.prototype.commaAndOnX0=function(){return" и %s"},a.prototype.commaEveryX0Months=function(i){return" всеки %s месеца"},a.prototype.commaOnlyInMonthX0=function(){return", %s"},a.prototype.commaOnlyInX0=function(){return", в %s"},a.prototype.commaOnTheLastDayOfTheMonth=function(){return", в последният ден на месеца"},a.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", в последния делничен ден от месеца"},a.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(i){return p(i,[", %s ден преди края на месеца",", %s дена преди края на месеца"])},a.prototype.firstWeekday=function(){return"първият делничен ден"},a.prototype.weekdayNearestDayX0=function(){return"най-близкият делничен ден до %s число"},a.prototype.commaOnTheX0OfTheMonth=function(){return", на %s число от месеца"},a.prototype.commaEveryX0Days=function(i){return p(i,[", всеки %s ден",", всеки %s дена"])},a.prototype.commaBetweenDayX0AndX1OfTheMonth=function(i){var g,v=(g=i?.split("-"))!==null&&g!==void 0?g:[];return", от %s-".concat(x(v[0],"ср")," до %s-").concat(x(v[1],"ср")," число на месеца")},a.prototype.commaOnDayX0OfTheMonth=function(i){return", на %s-".concat(x(i,"ср")," число от месеца")},a.prototype.commaEveryX0Years=function(i){return p(i,[", всяка %s година",", всеки %s години"])},a.prototype.commaStartingX0=function(){return", започвайки %s"},a.prototype.daysOfTheWeek=function(){return["неделя","понеделник","вторник","сряда","четвъртък","петък","събота"]},a.prototype.monthsOfTheYear=function(){return["януари","февруари","март","април","май","юни","юли","август","септевмври","октомври","ноември","декември"]},a.prototype.onTheHour=function(){return"в началото на часа"},a}();s.bg=h},845(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ca=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"S'ha produït un error mentres es generava la descripció de l'expressió. Revisi la sintaxi de la expressió de cron."},t.prototype.at=function(){return"A les"},t.prototype.atSpace=function(){return"A les "},t.prototype.atX0=function(){return"a les %s"},t.prototype.atX0MinutesPastTheHour=function(){return"als %s minuts de l'hora"},t.prototype.atX0SecondsPastTheMinute=function(){return"als %s segonds del minut"},t.prototype.betweenX0AndX1=function(){return"entre les %s i les %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", entre els dies %s i %s del mes"},t.prototype.commaEveryDay=function(){return", cada dia"},t.prototype.commaEveryX0Days=function(){return", cada %s dies"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", cada %s dies de la setmana"},t.prototype.commaEveryX0Months=function(){return", cada %s mesos"},t.prototype.commaOnDayX0OfTheMonth=function(){return", el dia %s del mes"},t.prototype.commaOnlyInX0=function(){return", sólo en %s"},t.prototype.commaOnlyOnX0=function(){return", només el %s"},t.prototype.commaAndOnX0=function(){return", i el %s"},t.prototype.commaOnThe=function(){return", en el "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", en l'últim dia del mes"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", en l'últim dia de la setmana del mes"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dies abans de l'últim dia del mes"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", en l'últim %s del mes"},t.prototype.commaOnTheX0OfTheMonth=function(){return", en el %s del mes"},t.prototype.commaX0ThroughX1=function(){return", de %s a %s"},t.prototype.commaAndX0ThroughX1=function(){return", i de %s a %s"},t.prototype.everyHour=function(){return"cada hora"},t.prototype.everyMinute=function(){return"cada minut"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"cada minut entre les %s i les %s"},t.prototype.everySecond=function(){return"cada segon"},t.prototype.everyX0Hours=function(){return"cada %s hores"},t.prototype.everyX0Minutes=function(){return"cada %s minuts"},t.prototype.everyX0Seconds=function(){return"cada %s segons"},t.prototype.fifth=function(){return"cinquè"},t.prototype.first=function(){return"primer"},t.prototype.firstWeekday=function(){return"primer dia de la setmana"},t.prototype.fourth=function(){return"quart"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"del minut %s al %s passada l'hora"},t.prototype.second=function(){return"segon"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"En els segons %s al %s de cada minut"},t.prototype.spaceAnd=function(){return" i"},t.prototype.spaceX0OfTheMonth=function(){return" %s del mes"},t.prototype.lastDay=function(){return"l'últim dia"},t.prototype.third=function(){return"tercer"},t.prototype.weekdayNearestDayX0=function(){return"dia de la setmana més proper al %s"},t.prototype.commaEveryX0Years=function(){return", cada %s anys"},t.prototype.commaStartingX0=function(){return", començant %s"},t.prototype.daysOfTheWeek=function(){return["diumenge","dilluns","dimarts","dimecres","dijous","divendres","dissabte"]},t.prototype.monthsOfTheYear=function(){return["gener","febrer","març","abril","maig","juny","juliol","agost","setembre","octubre","novembre","desembre"]},t.prototype.onTheHour=function(){return"en punt"},t}();s.ca=p},651(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.cs=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Při vytváření popisu došlo k chybě. Zkontrolujte prosím správnost syntaxe cronu."},t.prototype.everyMinute=function(){return"každou minutu"},t.prototype.everyHour=function(){return"každou hodinu"},t.prototype.atSpace=function(){return"V "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Každou minutu mezi %s a %s"},t.prototype.at=function(){return"V"},t.prototype.spaceAnd=function(){return" a"},t.prototype.everySecond=function(){return"každou sekundu"},t.prototype.everyX0Seconds=function(){return"každých %s sekund"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekundy od %s do %s"},t.prototype.atX0SecondsPastTheMinute=function(){return"v %s sekund"},t.prototype.everyX0Minutes=function(){return"každých %s minut"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minuty od %s do %s"},t.prototype.atX0MinutesPastTheHour=function(){return"v %s minut"},t.prototype.everyX0Hours=function(){return"každých %s hodin"},t.prototype.betweenX0AndX1=function(){return"mezi %s a %s"},t.prototype.atX0=function(){return"v %s"},t.prototype.commaEveryDay=function(){return", každý den"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", každých %s dní v týdnu"},t.prototype.commaX0ThroughX1=function(){return", od %s do %s"},t.prototype.commaAndX0ThroughX1=function(){return", a od %s do %s"},t.prototype.first=function(){return"první"},t.prototype.second=function(){return"druhý"},t.prototype.third=function(){return"třetí"},t.prototype.fourth=function(){return"čtvrtý"},t.prototype.fifth=function(){return"pátý"},t.prototype.commaOnThe=function(){return", "},t.prototype.spaceX0OfTheMonth=function(){return" %s v měsíci"},t.prototype.lastDay=function(){return"poslední den"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", poslední %s v měsíci"},t.prototype.commaOnlyOnX0=function(){return", pouze v %s"},t.prototype.commaAndOnX0=function(){return", a v %s"},t.prototype.commaEveryX0Months=function(){return", každých %s měsíců"},t.prototype.commaOnlyInX0=function(){return", pouze v %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", poslední den v měsíci"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", poslední pracovní den v měsíci"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dní před posledním dnem v měsíci"},t.prototype.firstWeekday=function(){return"první pracovní den"},t.prototype.weekdayNearestDayX0=function(){return"pracovní den nejblíže %s. dni"},t.prototype.commaOnTheX0OfTheMonth=function(){return", v %s v měsíci"},t.prototype.commaEveryX0Days=function(){return", každých %s dnů"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", mezi dny %s a %s v měsíci"},t.prototype.commaOnDayX0OfTheMonth=function(){return", %s. den v měsíci"},t.prototype.commaEveryX0Years=function(){return", každých %s roků"},t.prototype.commaStartingX0=function(){return", začínající %s"},t.prototype.daysOfTheWeek=function(){return["Neděle","Pondělí","Úterý","Středa","Čtvrtek","Pátek","Sobota"]},t.prototype.monthsOfTheYear=function(){return["Leden","Únor","Březen","Duben","Květen","Červen","Červenec","Srpen","Září","Říjen","Listopad","Prosinec"]},t.prototype.onTheHour=function(){return"v celou hodinu"},t}();s.cs=p},506(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.da=void 0;var p=function(){function t(){}return t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Der opstod en fejl ved generering af udtryksbeskrivelsen. Tjek cron-ekspressionssyntaxen."},t.prototype.at=function(){return"kl"},t.prototype.atSpace=function(){return"kl "},t.prototype.atX0=function(){return"kl %s"},t.prototype.atX0MinutesPastTheHour=function(){return"%s minutter efter timeskift"},t.prototype.atX0SecondsPastTheMinute=function(){return"%s sekunder efter minutskift"},t.prototype.betweenX0AndX1=function(){return"mellem %s og %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", mellem dag %s og %s i måneden"},t.prototype.commaEveryDay=function(){return", hver dag"},t.prototype.commaEveryX0Days=function(){return", hver %s. dag"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", hver %s. ugedag"},t.prototype.commaEveryX0Months=function(){return", hver %s. måned"},t.prototype.commaEveryX0Years=function(){return", hvert %s. år"},t.prototype.commaOnDayX0OfTheMonth=function(){return", på dag %s i måneden"},t.prototype.commaOnlyInX0=function(){return", kun i %s"},t.prototype.commaOnlyOnX0=function(x){return", på enhver %s"},t.prototype.commaAndOnX0=function(){return", og på %s"},t.prototype.commaOnThe=function(){return", på den "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", på den sidste dag i måneden"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", på den sidste hverdag i måneden"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dage før den sidste dag i måneden"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", på den sidste %s i måneden"},t.prototype.commaOnTheX0OfTheMonth=function(){return", på den %s i måneden"},t.prototype.commaX0ThroughX1=function(){return", %s til og med %s"},t.prototype.commaAndX0ThroughX1=function(){return", og %s til og med %s"},t.prototype.everyHour=function(){return"hver time"},t.prototype.everyMinute=function(){return"hvert minut"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"hvert minut mellem %s og %s"},t.prototype.everySecond=function(){return"hvert sekund"},t.prototype.everyX0Hours=function(){return"hver %s. time"},t.prototype.everyX0Minutes=function(){return"hvert %s. minut"},t.prototype.everyX0Seconds=function(){return"hvert %s. sekund"},t.prototype.fifth=function(){return"femte"},t.prototype.first=function(){return"første"},t.prototype.firstWeekday=function(){return"første hverdag"},t.prototype.fourth=function(){return"fjerde"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutterne fra %s til og med %s hver time"},t.prototype.second=function(){return"anden"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekunderne fra %s til og med %s hvert minut"},t.prototype.spaceAnd=function(){return" og"},t.prototype.spaceX0OfTheMonth=function(){return" %s i måneden"},t.prototype.lastDay=function(){return"sidste dag"},t.prototype.third=function(){return"tredje"},t.prototype.weekdayNearestDayX0=function(){return"hverdag nærmest dag %s"},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.commaStartingX0=function(){return", startende %s"},t.prototype.daysOfTheWeek=function(){return["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"]},t.prototype.monthsOfTheYear=function(){return["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"]},t.prototype.onTheHour=function(){return"på timen"},t}();s.da=p},230(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.de=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.everyMinute=function(){return"jede Minute"},t.prototype.everyHour=function(){return"jede Stunde"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Beim Generieren der Ausdrucksbeschreibung ist ein Fehler aufgetreten. Überprüfen Sie die Syntax des Cron-Ausdrucks."},t.prototype.atSpace=function(){return"Um "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Jede Minute zwischen %s und %s"},t.prototype.at=function(){return"Um"},t.prototype.spaceAnd=function(){return" und"},t.prototype.everySecond=function(){return"Jede Sekunde"},t.prototype.everyX0Seconds=function(){return"alle %s Sekunden"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"Sekunden %s bis %s"},t.prototype.atX0SecondsPastTheMinute=function(){return"bei Sekunde %s"},t.prototype.everyX0Minutes=function(){return"alle %s Minuten"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"Minuten %s bis %s"},t.prototype.atX0MinutesPastTheHour=function(){return"bei Minute %s"},t.prototype.everyX0Hours=function(){return"alle %s Stunden"},t.prototype.betweenX0AndX1=function(){return"zwischen %s und %s"},t.prototype.atX0=function(){return"um %s"},t.prototype.commaEveryDay=function(){return", jeden Tag"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", alle %s Tage der Woche"},t.prototype.commaX0ThroughX1=function(){return", %s bis %s"},t.prototype.commaAndX0ThroughX1=function(){return", und %s bis %s"},t.prototype.first=function(){return"ersten"},t.prototype.second=function(){return"zweiten"},t.prototype.third=function(){return"dritten"},t.prototype.fourth=function(){return"vierten"},t.prototype.fifth=function(){return"fünften"},t.prototype.commaOnThe=function(){return", am "},t.prototype.spaceX0OfTheMonth=function(){return" %s des Monats"},t.prototype.lastDay=function(){return"der letzte Tag"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", am letzten %s des Monats"},t.prototype.commaOnlyOnX0=function(){return", nur jeden %s"},t.prototype.commaAndOnX0=function(){return", und jeden %s"},t.prototype.commaEveryX0Months=function(){return", alle %s Monate"},t.prototype.commaOnlyInX0=function(){return", nur im %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", am letzten Tag des Monats"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", am letzten Werktag des Monats"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s tage vor dem letzten Tag des Monats"},t.prototype.firstWeekday=function(){return"ersten Werktag"},t.prototype.weekdayNearestDayX0=function(){return"Werktag am nächsten zum %s Tag"},t.prototype.commaOnTheX0OfTheMonth=function(){return", am %s des Monats"},t.prototype.commaEveryX0Days=function(){return", alle %s Tage"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", zwischen Tag %s und %s des Monats"},t.prototype.commaOnDayX0OfTheMonth=function(){return", an Tag %s des Monats"},t.prototype.commaEveryX0Years=function(){return", alle %s Jahre"},t.prototype.commaStartingX0=function(){return", beginnend %s"},t.prototype.daysOfTheWeek=function(){return["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},t.prototype.monthsOfTheYear=function(){return["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},t.prototype.onTheHour=function(){return"zur vollen Stunde"},t}();s.de=p},486(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.en=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!1},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occurred when generating the expression description. Check the cron expression syntax."},t.prototype.everyMinute=function(){return"every minute"},t.prototype.everyHour=function(){return"every hour"},t.prototype.atSpace=function(){return"At "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Every minute between %s and %s"},t.prototype.at=function(){return"At"},t.prototype.spaceAnd=function(){return" and"},t.prototype.everySecond=function(){return"every second"},t.prototype.everyX0Seconds=function(){return"every %s seconds"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},t.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},t.prototype.everyX0Minutes=function(){return"every %s minutes"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},t.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},t.prototype.everyX0Hours=function(){return"every %s hours"},t.prototype.betweenX0AndX1=function(){return"between %s and %s"},t.prototype.atX0=function(){return"at %s"},t.prototype.commaEveryDay=function(){return", every day"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", every %s days of the week"},t.prototype.commaX0ThroughX1=function(){return", %s through %s"},t.prototype.commaAndX0ThroughX1=function(){return", %s through %s"},t.prototype.first=function(){return"first"},t.prototype.second=function(){return"second"},t.prototype.third=function(){return"third"},t.prototype.fourth=function(){return"fourth"},t.prototype.fifth=function(){return"fifth"},t.prototype.commaOnThe=function(){return", on the "},t.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},t.prototype.lastDay=function(){return"the last day"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},t.prototype.commaOnlyOnX0=function(){return", only on %s"},t.prototype.commaAndOnX0=function(){return", and on %s"},t.prototype.commaEveryX0Months=function(){return", every %s months"},t.prototype.commaOnlyInX0=function(){return", only in %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s days before the last day of the month"},t.prototype.firstWeekday=function(){return"first weekday"},t.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},t.prototype.commaEveryX0Days=function(){return", every %s days in a month"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},t.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},t.prototype.commaEveryHour=function(){return", every hour"},t.prototype.commaEveryX0Years=function(){return", every %s years"},t.prototype.commaStartingX0=function(){return", starting %s"},t.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},t.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},t.prototype.atReboot=function(){return"Run once, at startup"},t.prototype.onTheHour=function(){return"on the hour"},t}();s.en=p},153(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.es=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Ocurrió un error mientras se generaba la descripción de la expresión. Revise la sintaxis de la expresión de cron."},t.prototype.at=function(){return"A las"},t.prototype.atSpace=function(){return"A las "},t.prototype.atX0=function(){return"a las %s"},t.prototype.atX0MinutesPastTheHour=function(){return"a los %s minutos de la hora"},t.prototype.atX0SecondsPastTheMinute=function(){return"a los %s segundos del minuto"},t.prototype.betweenX0AndX1=function(){return"entre las %s y las %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", entre los días %s y %s del mes"},t.prototype.commaEveryDay=function(){return", cada día"},t.prototype.commaEveryX0Days=function(){return", cada %s días"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", cada %s días de la semana"},t.prototype.commaEveryX0Months=function(){return", cada %s meses"},t.prototype.commaOnDayX0OfTheMonth=function(){return", el día %s del mes"},t.prototype.commaOnlyInX0=function(){return", sólo en %s"},t.prototype.commaOnlyOnX0=function(){return", sólo el %s"},t.prototype.commaAndOnX0=function(){return", y el %s"},t.prototype.commaOnThe=function(){return", en el "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", en el último día del mes"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", en el último día de la semana del mes"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s días antes del último día del mes"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", en el último %s del mes"},t.prototype.commaOnTheX0OfTheMonth=function(){return", en el %s del mes"},t.prototype.commaX0ThroughX1=function(){return", de %s a %s"},t.prototype.commaAndX0ThroughX1=function(){return", y de %s a %s"},t.prototype.everyHour=function(){return"cada hora"},t.prototype.everyMinute=function(){return"cada minuto"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"cada minuto entre las %s y las %s"},t.prototype.everySecond=function(){return"cada segundo"},t.prototype.everyX0Hours=function(){return"cada %s horas"},t.prototype.everyX0Minutes=function(){return"cada %s minutos"},t.prototype.everyX0Seconds=function(){return"cada %s segundos"},t.prototype.fifth=function(){return"quinto"},t.prototype.first=function(){return"primero"},t.prototype.firstWeekday=function(){return"primer día de la semana"},t.prototype.fourth=function(){return"cuarto"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"del minuto %s al %s pasada la hora"},t.prototype.second=function(){return"segundo"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"En los segundos %s al %s de cada minuto"},t.prototype.spaceAnd=function(){return" y"},t.prototype.spaceX0OfTheMonth=function(){return" %s del mes"},t.prototype.lastDay=function(){return"el último día"},t.prototype.third=function(){return"tercer"},t.prototype.weekdayNearestDayX0=function(){return"día de la semana más próximo al %s"},t.prototype.commaEveryX0Years=function(){return", cada %s años"},t.prototype.commaStartingX0=function(){return", comenzando %s"},t.prototype.daysOfTheWeek=function(){return["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},t.prototype.monthsOfTheYear=function(){return["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},t.prototype.onTheHour=function(){return"en punto"},t}();s.es=p},804(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.fa=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"خطایی در نمایش توضیحات این وظیفه رخ داد. لطفا ساختار آن را بررسی کنید."},t.prototype.everyMinute=function(){return"هر دقیقه"},t.prototype.everyHour=function(){return"هر ساعت"},t.prototype.atSpace=function(){return"در "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"هر دقیقه بین %s و %s"},t.prototype.at=function(){return"در"},t.prototype.spaceAnd=function(){return" و"},t.prototype.everySecond=function(){return"هر ثانیه"},t.prototype.everyX0Seconds=function(){return"هر %s ثانیه"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"ثانیه %s تا %s دقیقه گذشته"},t.prototype.atX0SecondsPastTheMinute=function(){return"در %s قانیه از دقیقه گذشته"},t.prototype.everyX0Minutes=function(){return"هر %s دقیقه"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"دقیقه %s تا %s ساعت گذشته"},t.prototype.atX0MinutesPastTheHour=function(){return"در %s دقیقه پس از ساعت"},t.prototype.everyX0Hours=function(){return"هر %s ساعت"},t.prototype.betweenX0AndX1=function(){return"بین %s و %s"},t.prototype.atX0=function(){return"در %s"},t.prototype.commaEveryDay=function(){return", هر روز"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", هر %s روز از هفته"},t.prototype.commaX0ThroughX1=function(){return", %s تا %s"},t.prototype.commaAndX0ThroughX1=function(){return", و %s تا %s"},t.prototype.first=function(){return"اول"},t.prototype.second=function(){return"دوم"},t.prototype.third=function(){return"سوم"},t.prototype.fourth=function(){return"چهارم"},t.prototype.fifth=function(){return"پنجم"},t.prototype.commaOnThe=function(){return", در "},t.prototype.spaceX0OfTheMonth=function(){return" %s ماه"},t.prototype.lastDay=function(){return"آخرین روز"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", در %s ماه"},t.prototype.commaOnlyOnX0=function(){return", فقط در %s"},t.prototype.commaAndOnX0=function(){return", و در %s"},t.prototype.commaEveryX0Months=function(){return", هر %s ماه"},t.prototype.commaOnlyInX0=function(){return", فقط در %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", در آخرین روز ماه"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", در آخرین روز ماه"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s روز قبل از آخرین روز ماه"},t.prototype.firstWeekday=function(){return"اولین روز"},t.prototype.weekdayNearestDayX0=function(){return"روز نزدیک به روز %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", در %s ماه"},t.prototype.commaEveryX0Days=function(){return", هر %s روز"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", بین روز %s و %s ماه"},t.prototype.commaOnDayX0OfTheMonth=function(){return", در %s ماه"},t.prototype.commaEveryMinute=function(){return", هر minute"},t.prototype.commaEveryHour=function(){return", هر ساعت"},t.prototype.commaEveryX0Years=function(){return", هر %s سال"},t.prototype.commaStartingX0=function(){return", آغاز %s"},t.prototype.daysOfTheWeek=function(){return["یک‌شنبه","دوشنبه","سه‌شنبه","چهارشنبه","پنج‌شنبه","جمعه","شنبه"]},t.prototype.monthsOfTheYear=function(){return["ژانویه","فوریه","مارس","آپریل","مه","ژوئن","ژوئیه","آگوست","سپتامبر","اکتبر","نوامبر","دسامبر"]},t.prototype.onTheHour=function(){return"سر ساعت"},t}();s.fa=p},964(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.fi=void 0;var p=function(){function t(){}return t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Virhe kuvauksen generoinnissa. Tarkista cron-syntaksi."},t.prototype.at=function(){return"Klo"},t.prototype.atSpace=function(){return"Klo "},t.prototype.atX0=function(){return"klo %s"},t.prototype.atX0MinutesPastTheHour=function(){return"%s minuuttia yli"},t.prototype.atX0MinutesPastTheHourGt20=function(){return"%s minuuttia yli"},t.prototype.atX0SecondsPastTheMinute=function(){return"%s sekunnnin jälkeen"},t.prototype.betweenX0AndX1=function(){return"%s - %s välillä"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", kuukauden päivien %s ja %s välillä"},t.prototype.commaEveryDay=function(){return", joka päivä"},t.prototype.commaEveryHour=function(){return", joka tunti"},t.prototype.commaEveryMinute=function(){return", joka minuutti"},t.prototype.commaEveryX0Days=function(){return", joka %s. päivä"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", joka %s. viikonpäivä"},t.prototype.commaEveryX0Months=function(){return", joka %s. kuukausi"},t.prototype.commaEveryX0Years=function(){return", joka %s. vuosi"},t.prototype.commaOnDayX0OfTheMonth=function(){return", kuukauden %s päivä"},t.prototype.commaOnlyInX0=function(){return", vain %s"},t.prototype.commaOnlyOnX0=function(){return", vain %s"},t.prototype.commaOnThe=function(){return","},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", kuukauden viimeisenä päivänä"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", kuukauden viimeisenä viikonpäivänä"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", kuukauden viimeinen %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", kuukauden %s"},t.prototype.commaX0ThroughX1=function(){return", %s - %s"},t.prototype.commaAndX0ThroughX1=function(){return", %s - %s"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s päivää ennen kuukauden viimeistä päivää"},t.prototype.commaStartingX0=function(){return", alkaen %s"},t.prototype.everyHour=function(){return"joka tunti"},t.prototype.everyMinute=function(){return"joka minuutti"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"joka minuutti %s - %s välillä"},t.prototype.everySecond=function(){return"joka sekunti"},t.prototype.everyX0Hours=function(){return"joka %s. tunti"},t.prototype.everyX0Minutes=function(){return"joka %s. minuutti"},t.prototype.everyX0Seconds=function(){return"joka %s. sekunti"},t.prototype.fifth=function(){return"viides"},t.prototype.first=function(){return"ensimmäinen"},t.prototype.firstWeekday=function(){return"ensimmäinen viikonpäivä"},t.prototype.fourth=function(){return"neljäs"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"joka tunti minuuttien %s - %s välillä"},t.prototype.second=function(){return"toinen"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"joka minuutti sekunttien %s - %s välillä"},t.prototype.spaceAnd=function(){return" ja"},t.prototype.spaceAndSpace=function(){return" ja "},t.prototype.spaceX0OfTheMonth=function(){return" %s kuukaudessa"},t.prototype.third=function(){return"kolmas"},t.prototype.weekdayNearestDayX0=function(){return"viikonpäivä lähintä %s päivää"},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.lastDay=function(){return"viimeinen päivä"},t.prototype.commaAndOnX0=function(){return", ja edelleen %s"},t.prototype.daysOfTheWeek=function(){return["sunnuntai","maanantai","tiistai","keskiviikko","torstai","perjantai","lauantai"]},t.prototype.monthsOfTheYear=function(){return["tammikuu","helmikuu","maaliskuu","huhtikuu","toukokuu","kesäkuu","heinäkuu","elokuu","syyskuu","lokakuu","marraskuu","joulukuu"]},t.prototype.onTheHour=function(){return"tasalta"},t}();s.fi=p},517(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.fr=void 0;var p=function(){function t(){}return t.prototype.conciseVerbosityReplacements=function(){return{"de le":"du"}},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Une erreur est survenue en générant la description de l'expression cron. Vérifiez sa syntaxe."},t.prototype.everyMinute=function(){return"toutes les minutes"},t.prototype.everyHour=function(){return"toutes les heures"},t.prototype.atSpace=function(){return"À "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Toutes les minutes entre %s et %s"},t.prototype.at=function(){return"À"},t.prototype.spaceAnd=function(){return" et"},t.prototype.everySecond=function(){return"toutes les secondes"},t.prototype.everyX0Seconds=function(){return"toutes les %s secondes"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"les secondes entre %s et %s après la minute"},t.prototype.atX0SecondsPastTheMinute=function(){return"%s secondes après la minute"},t.prototype.everyX0Minutes=function(){return"toutes les %s minutes"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"les minutes entre %s et %s après l'heure"},t.prototype.atX0MinutesPastTheHour=function(){return"%s minutes après l'heure"},t.prototype.everyX0Hours=function(){return"toutes les %s heures"},t.prototype.betweenX0AndX1=function(){return"de %s à %s"},t.prototype.atX0=function(){return"%s"},t.prototype.commaEveryDay=function(){return", tous les jours"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", tous les %s jours de la semaine"},t.prototype.commaX0ThroughX1=function(){return", de %s à %s"},t.prototype.commaAndX0ThroughX1=function(){return", et de %s à %s"},t.prototype.first=function(){return"premier"},t.prototype.second=function(){return"second"},t.prototype.third=function(){return"troisième"},t.prototype.fourth=function(){return"quatrième"},t.prototype.fifth=function(){return"cinquième"},t.prototype.commaOnThe=function(){return", le "},t.prototype.spaceX0OfTheMonth=function(){return" %s du mois"},t.prototype.lastDay=function(){return"le dernier jour"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", le dernier %s du mois"},t.prototype.commaOnlyOnX0=function(){return", uniquement le %s"},t.prototype.commaAndOnX0=function(){return", et %s"},t.prototype.commaEveryX0Months=function(){return", tous les %s mois"},t.prototype.commaOnlyInX0=function(){return", uniquement en %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", le dernier jour du mois"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", le dernier jour ouvrable du mois"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s jours avant le dernier jour du mois"},t.prototype.firstWeekday=function(){return"premier jour ouvrable"},t.prototype.weekdayNearestDayX0=function(){return"jour ouvrable le plus proche du %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", le %s du mois"},t.prototype.commaEveryX0Days=function(){return", tous les %s jours"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", du %s au %s du mois"},t.prototype.commaOnDayX0OfTheMonth=function(){return", le %s du mois"},t.prototype.commaEveryHour=function(){return", chaque heure"},t.prototype.commaEveryX0Years=function(){return", tous les %s ans"},t.prototype.commaDaysX0ThroughX1=function(){return", du %s au %s"},t.prototype.commaStartingX0=function(){return", à partir de %s"},t.prototype.daysOfTheWeek=function(){return["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},t.prototype.monthsOfTheYear=function(){return["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},t.prototype.onTheHour=function(){return"à l'heure pile"},t}();s.fr=p},82(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.he=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"אירעה שגיאה בעת יצירת תיאור הביטוי. בדוק את תחביר הביטוי cron."},t.prototype.everyMinute=function(){return"כל דקה"},t.prototype.everyHour=function(){return"כל שעה"},t.prototype.atSpace=function(){return"ב "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"כל דקה %s עד %s"},t.prototype.at=function(){return"ב"},t.prototype.spaceAnd=function(){return" ו"},t.prototype.everySecond=function(){return"כל שניה"},t.prototype.everyX0Seconds=function(){return"כל %s שניות"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"%s עד %s שניות של הדקה"},t.prototype.atX0SecondsPastTheMinute=function(){return"ב %s שניות של הדקה"},t.prototype.everyX0Minutes=function(){return"כל %s דקות"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"%s עד %s דקות של השעה"},t.prototype.atX0MinutesPastTheHour=function(){return"ב %s דקות של השעה"},t.prototype.everyX0Hours=function(){return"כל %s שעות"},t.prototype.betweenX0AndX1=function(){return"%s עד %s"},t.prototype.atX0=function(){return"ב %s"},t.prototype.commaEveryDay=function(){return", כל יום"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", כל %s ימים בשבוע"},t.prototype.commaX0ThroughX1=function(){return", %s עד %s"},t.prototype.commaAndX0ThroughX1=function(){return", ו %s עד %s"},t.prototype.first=function(){return"ראשון"},t.prototype.second=function(){return"שני"},t.prototype.third=function(){return"שלישי"},t.prototype.fourth=function(){return"רביעי"},t.prototype.fifth=function(){return"חמישי"},t.prototype.commaOnThe=function(){return", ב "},t.prototype.spaceX0OfTheMonth=function(){return" %s של החודש"},t.prototype.lastDay=function(){return"היום האחרון"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", רק ב %s של החודש"},t.prototype.commaOnlyOnX0=function(){return", רק ב %s"},t.prototype.commaAndOnX0=function(){return", וב %s"},t.prototype.commaEveryX0Months=function(){return", כל %s חודשים"},t.prototype.commaOnlyInX0=function(){return", רק ב %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", ביום האחרון של החודש"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", ביום החול האחרון של החודש"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s ימים לפני היום האחרון בחודש"},t.prototype.firstWeekday=function(){return"יום החול הראשון"},t.prototype.weekdayNearestDayX0=function(){return"יום החול הראשון הקרוב אל %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", ביום ה%s של החודש"},t.prototype.commaEveryX0Days=function(){return", כל %s ימים"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", בין היום ה%s וה%s של החודש"},t.prototype.commaOnDayX0OfTheMonth=function(){return", ביום ה%s של החודש"},t.prototype.commaEveryX0Years=function(){return", כל %s שנים"},t.prototype.commaStartingX0=function(){return", החל מ %s"},t.prototype.daysOfTheWeek=function(){return["יום ראשון","יום שני","יום שלישי","יום רביעי","יום חמישי","יום שישי","יום שבת"]},t.prototype.monthsOfTheYear=function(){return["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"]},t.prototype.onTheHour=function(){return"בשעה עגולה"},t}();s.he=p},131(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.hr=void 0;var p=function(){function t(){}return t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Došlo je do pogreške pri generiranju izraza. Provjerite sintaksu cron izraza."},t.prototype.at=function(){return"U"},t.prototype.atSpace=function(){return"U "},t.prototype.atX0=function(){return"u %s"},t.prototype.atX0MinutesPastTheHour=function(){return"u %s minuta nakon punog sata"},t.prototype.atX0SecondsPastTheMinute=function(){return"u %s sekundi nakon pune minute"},t.prototype.betweenX0AndX1=function(){return"između %s i %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", između %s. i %s. dana u mjesecu"},t.prototype.commaEveryDay=function(){return", svaki dan"},t.prototype.commaEveryX0Days=function(){return", svakih %s dana"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", svakih %s dana u tjednu"},t.prototype.commaEveryX0Months=function(){return", svakih %s mjeseci"},t.prototype.commaEveryX0Years=function(){return", svakih %s godina"},t.prototype.commaOnDayX0OfTheMonth=function(){return", %s. dan u mjesecu"},t.prototype.commaOnlyInX0=function(){return", samo u %s"},t.prototype.commaOnlyOnX0=function(){return", samo %s"},t.prototype.commaAndOnX0=function(){return", i %s"},t.prototype.commaOnThe=function(){return", "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", zadnji dan u mjesecu"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", zadnji radni dan u mjesecu"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dana prije kraja mjeseca"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", zadnji %s u mjesecu"},t.prototype.commaOnTheX0OfTheMonth=function(){return", %s u mjesecu"},t.prototype.commaX0ThroughX1=function(){return", od %s do %s"},t.prototype.commaAndX0ThroughX1=function(){return", i od %s do %s"},t.prototype.everyHour=function(){return"svaki sat"},t.prototype.everyMinute=function(){return"svaku minutu"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Svaku minutu između %s i %s"},t.prototype.everySecond=function(){return"svaku sekundu"},t.prototype.everyX0Hours=function(){return"svakih %s sati"},t.prototype.everyX0Minutes=function(){return"svakih %s minuta"},t.prototype.everyX0Seconds=function(){return"svakih %s sekundi"},t.prototype.fifth=function(){return"peti"},t.prototype.first=function(){return"prvi"},t.prototype.firstWeekday=function(){return"prvi radni dan"},t.prototype.fourth=function(){return"četvrti"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minute od %s do %s nakon punog sata"},t.prototype.second=function(){return"drugi"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekunde od %s do %s nakon pune minute"},t.prototype.spaceAnd=function(){return" i"},t.prototype.spaceX0OfTheMonth=function(){return" %s u mjesecu"},t.prototype.lastDay=function(){return"zadnji dan"},t.prototype.third=function(){return"treći"},t.prototype.weekdayNearestDayX0=function(){return"radni dan najbliži %s. danu"},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.commaStartingX0=function(){return", počevši od %s"},t.prototype.daysOfTheWeek=function(){return["Nedjelja","Ponedjeljak","Utorak","Srijeda","Četvrtak","Petak","Subota"]},t.prototype.monthsOfTheYear=function(){return["siječanj","veljača","ožujak","travanj","svibanj","lipanj","srpanj","kolovoz","rujan","listopad","studeni","prosinac"]},t.prototype.onTheHour=function(){return"u puni sat"},t}();s.hr=p},194(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.hu=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Hiba történt a kifejezésleírás generálásakor. Ellenőrizze a cron kifejezés szintaxisát."},t.prototype.everyMinute=function(){return"minden percben"},t.prototype.everyHour=function(){return"minden órában"},t.prototype.atSpace=function(){return"Ekkor: "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"percenként %s és %s között"},t.prototype.at=function(){return"Ekkor:"},t.prototype.spaceAnd=function(){return" és"},t.prototype.everySecond=function(){return"minden másodpercben"},t.prototype.everyX0Seconds=function(){return"%s másodpercenként"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"%s. másodpercben %s perc után"},t.prototype.atX0SecondsPastTheMinute=function(){return"%s. másodpercben"},t.prototype.everyX0Minutes=function(){return"minden %s. percben"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"%s. percben %s óra után"},t.prototype.atX0MinutesPastTheHour=function(){return"%s. percben"},t.prototype.everyX0Hours=function(){return"minden %s órában"},t.prototype.betweenX0AndX1=function(){return"%s és %s között"},t.prototype.atX0=function(){return"ekkor %s"},t.prototype.commaEveryDay=function(){return", minden nap"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", a hét minden %s napján"},t.prototype.commaX0ThroughX1=function(){return", %s - %s"},t.prototype.commaAndX0ThroughX1=function(){return", és %s - %s"},t.prototype.first=function(){return"első"},t.prototype.second=function(){return"második"},t.prototype.third=function(){return"harmadik"},t.prototype.fourth=function(){return"negyedik"},t.prototype.fifth=function(){return"ötödik"},t.prototype.commaOnThe=function(){return", "},t.prototype.spaceX0OfTheMonth=function(){return" %s a hónapban"},t.prototype.lastDay=function(){return"az utolsó nap"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", a hónap utolsó %s"},t.prototype.commaOnlyOnX0=function(){return", csak ekkor: %s"},t.prototype.commaAndOnX0=function(){return", és %s"},t.prototype.commaEveryX0Months=function(){return", minden %s hónapban"},t.prototype.commaOnlyInX0=function(){return", csak ekkor: %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", a hónap utolsó napján"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", a hónap utolsó hétköznapján"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s nappal a hónap utolsó napja előtt"},t.prototype.firstWeekday=function(){return"első hétköznap"},t.prototype.weekdayNearestDayX0=function(){return"hétköznap legközelebbi nap %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", a hónap %s"},t.prototype.commaEveryX0Days=function(){return", %s naponként"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", a hónap %s és %s napja között"},t.prototype.commaOnDayX0OfTheMonth=function(){return", a hónap %s napján"},t.prototype.commaEveryHour=function(){return", minden órában"},t.prototype.commaEveryX0Years=function(){return", %s évente"},t.prototype.commaStartingX0=function(){return", %s kezdettel"},t.prototype.daysOfTheWeek=function(){return["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"]},t.prototype.monthsOfTheYear=function(){return["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"]},t.prototype.onTheHour=function(){return"órakor"},t}();s.hu=p},72(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.id=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Terjadi kesalahan saat membuat deskripsi ekspresi. Periksa sintaks ekspresi cron."},t.prototype.everyMinute=function(){return"setiap menit"},t.prototype.everyHour=function(){return"setiap jam"},t.prototype.atSpace=function(){return"Pada "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Setiap menit diantara %s dan %s"},t.prototype.at=function(){return"Pada"},t.prototype.spaceAnd=function(){return" dan"},t.prototype.everySecond=function(){return"setiap detik"},t.prototype.everyX0Seconds=function(){return"setiap %s detik"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"detik ke %s sampai %s melewati menit"},t.prototype.atX0SecondsPastTheMinute=function(){return"pada %s detik lewat satu menit"},t.prototype.everyX0Minutes=function(){return"setiap %s menit"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"menit ke %s sampai %s melewati jam"},t.prototype.atX0MinutesPastTheHour=function(){return"pada %s menit melewati jam"},t.prototype.everyX0Hours=function(){return"setiap %s jam"},t.prototype.betweenX0AndX1=function(){return"diantara %s dan %s"},t.prototype.atX0=function(){return"pada %s"},t.prototype.commaEveryDay=function(){return", setiap hari"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", setiap hari %s dalam seminggu"},t.prototype.commaX0ThroughX1=function(){return", %s sampai %s"},t.prototype.commaAndX0ThroughX1=function(){return", dan %s sampai %s"},t.prototype.first=function(){return"pertama"},t.prototype.second=function(){return"kedua"},t.prototype.third=function(){return"ketiga"},t.prototype.fourth=function(){return"keempat"},t.prototype.fifth=function(){return"kelima"},t.prototype.commaOnThe=function(){return", di "},t.prototype.spaceX0OfTheMonth=function(){return" %s pada bulan"},t.prototype.lastDay=function(){return"hari terakhir"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", pada %s terakhir bulan ini"},t.prototype.commaOnlyOnX0=function(){return", hanya pada %s"},t.prototype.commaAndOnX0=function(){return", dan pada %s"},t.prototype.commaEveryX0Months=function(){return", setiap bulan %s "},t.prototype.commaOnlyInX0=function(){return", hanya pada %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", pada hari terakhir bulan ini"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", pada hari kerja terakhir setiap bulan"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s hari sebelum hari terakhir setiap bulan"},t.prototype.firstWeekday=function(){return"hari kerja pertama"},t.prototype.weekdayNearestDayX0=function(){return"hari kerja terdekat %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", pada %s bulan ini"},t.prototype.commaEveryX0Days=function(){return", setiap %s hari"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", antara hari %s dan %s dalam sebulan"},t.prototype.commaOnDayX0OfTheMonth=function(){return", pada hari %s dalam sebulan"},t.prototype.commaEveryHour=function(){return", setiap jam"},t.prototype.commaEveryX0Years=function(){return", setiap %s tahun"},t.prototype.commaStartingX0=function(){return", mulai pada %s"},t.prototype.daysOfTheWeek=function(){return["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"]},t.prototype.monthsOfTheYear=function(){return["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"]},t.prototype.onTheHour=function(){return"tepat pada jam"},t}();s.id=p},488(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.it=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"È verificato un errore durante la generazione la descrizione espressione. Controllare la sintassi delle espressioni cron."},t.prototype.at=function(){return"Alle"},t.prototype.atSpace=function(){return"Alle "},t.prototype.atX0=function(){return"alle %s"},t.prototype.atX0MinutesPastTheHour=function(){return"al %s minuto passata l'ora"},t.prototype.atX0SecondsPastTheMinute=function(){return"al %s secondo passato il minuto"},t.prototype.betweenX0AndX1=function(){return"tra le %s e le %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", tra il giorno %s e %s del mese"},t.prototype.commaEveryDay=function(){return", ogni giorno"},t.prototype.commaEveryX0Days=function(){return", ogni %s giorni"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", ogni %s giorni della settimana"},t.prototype.commaEveryX0Months=function(){return", ogni %s mesi"},t.prototype.commaEveryX0Years=function(){return", ogni %s anni"},t.prototype.commaOnDayX0OfTheMonth=function(){return", il giorno %s del mese"},t.prototype.commaOnlyInX0=function(){return", solo in %s"},t.prototype.commaOnlyOnX0=function(){return", solo il %s"},t.prototype.commaAndOnX0=function(){return", e il %s"},t.prototype.commaOnThe=function(){return", il "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", l'ultimo giorno del mese"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", nell'ultima settimana del mese"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s giorni prima dell'ultimo giorno del mese"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", l'ultimo %s del mese"},t.prototype.commaOnTheX0OfTheMonth=function(){return", il %s del mese"},t.prototype.commaX0ThroughX1=function(){return", %s al %s"},t.prototype.commaAndX0ThroughX1=function(){return", e %s al %s"},t.prototype.everyHour=function(){return"ogni ora"},t.prototype.everyMinute=function(){return"ogni minuto"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Ogni minuto tra le %s e le %s"},t.prototype.everySecond=function(){return"ogni secondo"},t.prototype.everyX0Hours=function(){return"ogni %s ore"},t.prototype.everyX0Minutes=function(){return"ogni %s minuti"},t.prototype.everyX0Seconds=function(){return"ogni %s secondi"},t.prototype.fifth=function(){return"quinto"},t.prototype.first=function(){return"primo"},t.prototype.firstWeekday=function(){return"primo giorno della settimana"},t.prototype.fourth=function(){return"quarto"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minuti %s al %s dopo l'ora"},t.prototype.second=function(){return"secondo"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"secondi %s al %s oltre il minuto"},t.prototype.spaceAnd=function(){return" e"},t.prototype.spaceX0OfTheMonth=function(){return" %s del mese"},t.prototype.lastDay=function(){return"l'ultimo giorno"},t.prototype.third=function(){return"terzo"},t.prototype.weekdayNearestDayX0=function(){return"giorno della settimana più vicino al %s"},t.prototype.commaStartingX0=function(){return", a partire %s"},t.prototype.daysOfTheWeek=function(){return["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"]},t.prototype.monthsOfTheYear=function(){return["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"]},t.prototype.onTheHour=function(){return"all'ora esatta"},t}();s.it=p},904(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ja=void 0;var p=function(){function t(){}return t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.everyMinute=function(){return"毎分"},t.prototype.everyHour=function(){return"毎時"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"式の記述を生成する際にエラーが発生しました。Cron 式の構文を確認してください。"},t.prototype.atSpace=function(){return"次において実施"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"%s から %s まで毎分"},t.prototype.at=function(){return"次において実施"},t.prototype.spaceAnd=function(){return"と"},t.prototype.everySecond=function(){return"毎秒"},t.prototype.everyX0Seconds=function(){return"%s 秒ごと"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"毎分 %s 秒から %s 秒まで"},t.prototype.atX0SecondsPastTheMinute=function(){return"毎分 %s 秒過ぎ"},t.prototype.everyX0Minutes=function(){return"%s 分ごと"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"毎時 %s 分から %s 分まで"},t.prototype.atX0MinutesPastTheHour=function(){return"毎時 %s 分過ぎ"},t.prototype.everyX0Hours=function(){return"%s 時間ごと"},t.prototype.betweenX0AndX1=function(){return"%s と %s の間"},t.prototype.atX0=function(){return"次において実施 %s"},t.prototype.commaEveryDay=function(){return"、毎日"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return"、週のうち %s 日ごと"},t.prototype.commaX0ThroughX1=function(){return"、%s から %s まで"},t.prototype.commaAndX0ThroughX1=function(){return"、%s から %s まで"},t.prototype.first=function(){return"1 番目"},t.prototype.second=function(){return"2 番目"},t.prototype.third=function(){return"3 番目"},t.prototype.fourth=function(){return"4 番目"},t.prototype.fifth=function(){return"5 番目"},t.prototype.commaOnThe=function(){return"次に"},t.prototype.spaceX0OfTheMonth=function(){return"月のうち %s"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return"月の最後の %s に"},t.prototype.commaOnlyOnX0=function(){return"%s にのみ"},t.prototype.commaEveryX0Months=function(){return"、%s か月ごと"},t.prototype.commaOnlyInX0=function(){return"%s でのみ"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return"次の最終日に"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return"月の最後の平日に"},t.prototype.firstWeekday=function(){return"最初の平日"},t.prototype.weekdayNearestDayX0=function(){return"%s 日の直近の平日"},t.prototype.commaOnTheX0OfTheMonth=function(){return"月の %s に"},t.prototype.commaEveryX0Days=function(){return"、%s 日ごと"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return"、月の %s 日から %s 日の間"},t.prototype.commaOnDayX0OfTheMonth=function(){return"、月の %s 日目"},t.prototype.spaceAndSpace=function(){return"と"},t.prototype.commaEveryMinute=function(){return"、毎分"},t.prototype.commaEveryHour=function(){return"、毎時"},t.prototype.commaEveryX0Years=function(){return"、%s 年ごと"},t.prototype.commaStartingX0=function(){return"、%s に開始"},t.prototype.aMPeriod=function(){return"AM"},t.prototype.pMPeriod=function(){return"PM"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return"月の最終日の %s 日前"},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.lastDay=function(){return"最終日"},t.prototype.commaAndOnX0=function(){return"、〜と %s"},t.prototype.daysOfTheWeek=function(){return["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},t.prototype.monthsOfTheYear=function(){return["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},t.prototype.onTheHour=function(){return"時ちょうど"},t}();s.ja=p},839(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ko=void 0;var p=function(){function t(){}return t.prototype.setPeriodBeforeTime=function(){return!0},t.prototype.pm=function(){return"오후"},t.prototype.am=function(){return"오전"},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!1},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"표현식 설명을 생성하는 중 오류가 발생했습니다. cron 표현식 구문을 확인하십시오."},t.prototype.everyMinute=function(){return"1분마다"},t.prototype.everyHour=function(){return"1시간마다"},t.prototype.atSpace=function(){return"시간 "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"매분 %s~%s"},t.prototype.at=function(){return"시간"},t.prototype.spaceAnd=function(){return" 및"},t.prototype.everySecond=function(){return"1초마다"},t.prototype.everyX0Seconds=function(){return"%s초마다"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"%s~%s초"},t.prototype.atX0SecondsPastTheMinute=function(){return"%s초"},t.prototype.everyX0Minutes=function(){return"%s분마다"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"%s~%s분"},t.prototype.atX0MinutesPastTheHour=function(){return"%s분"},t.prototype.everyX0Hours=function(){return"%s시간마다"},t.prototype.betweenX0AndX1=function(){return"%s에서 %s 사이"},t.prototype.atX0=function(){return"%s에서"},t.prototype.commaEveryDay=function(){return", 매일"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", 주 중 %s일마다"},t.prototype.commaX0ThroughX1=function(){return", %s에서 %s까지"},t.prototype.commaAndX0ThroughX1=function(){return", 및 %s에서 %s까지"},t.prototype.first=function(){return"첫 번째"},t.prototype.second=function(){return"두 번째"},t.prototype.third=function(){return"세 번째"},t.prototype.fourth=function(){return"네 번째"},t.prototype.fifth=function(){return"다섯 번째"},t.prototype.commaOnThe=function(){return", 매월 "},t.prototype.spaceX0OfTheMonth=function(){return" %s"},t.prototype.lastDay=function(){return"마지막 날"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", 해당 월의 마지막 %s"},t.prototype.commaOnlyOnX0=function(){return", %s에만"},t.prototype.commaAndOnX0=function(){return", 및 %s에"},t.prototype.commaEveryX0Months=function(){return", %s개월마다"},t.prototype.commaOnlyInX0=function(){return", %s에만"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", 해당 월의 마지막 날에"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", 매월 마지막 평일"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", 해당 월의 마지막 날 %s일 전"},t.prototype.firstWeekday=function(){return"첫 번째 평일"},t.prototype.weekdayNearestDayX0=function(){return"%s일과 가장 가까운 평일"},t.prototype.commaOnTheX0OfTheMonth=function(){return", 매월 %s"},t.prototype.commaEveryX0Days=function(){return", %s일마다"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", 해당 월의 %s일에서 %s일까지"},t.prototype.commaOnDayX0OfTheMonth=function(){return", 매월 %s일"},t.prototype.commaEveryMinute=function(){return", 1분마다"},t.prototype.commaEveryHour=function(){return", 1시간마다"},t.prototype.commaEveryX0Years=function(){return", %s년마다"},t.prototype.commaStartingX0=function(){return", %s부터"},t.prototype.daysOfTheWeek=function(){return["일요일","월요일","화요일","수요일","목요일","금요일","토요일"]},t.prototype.monthsOfTheYear=function(){return["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"]},t.prototype.onTheHour=function(){return"정각"},t}();s.ko=p},919(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.my=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!1},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Terdapat ralat semasa menjana penerangan ungkapan. Sila periksa sintaks ungkapan cron."},t.prototype.everyMinute=function(){return"setiap minit"},t.prototype.everyHour=function(){return"setiap jam"},t.prototype.atSpace=function(){return"Pada "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Setiap minit antara %s dan %s"},t.prototype.at=function(){return"Pada"},t.prototype.spaceAnd=function(){return" dan"},t.prototype.everySecond=function(){return"setiap saat"},t.prototype.everyX0Seconds=function(){return"setiap %s saat"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"saat ke %s hingga %s selepas minit"},t.prototype.atX0SecondsPastTheMinute=function(){return"pada %s saat selepas minit"},t.prototype.everyX0Minutes=function(){return"setiap %s minit"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minit ke %s hingga %s selepas jam"},t.prototype.atX0MinutesPastTheHour=function(){return"pada %s minit selepas jam"},t.prototype.everyX0Hours=function(){return"setiap %s jam"},t.prototype.betweenX0AndX1=function(){return"antara %s dan %s"},t.prototype.atX0=function(){return"pada %s"},t.prototype.commaEveryDay=function(){return", setiap hari"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", setiap %s hari dalam minggu"},t.prototype.commaX0ThroughX1=function(){return", %s hingga %s"},t.prototype.commaAndX0ThroughX1=function(){return", dan %s hingga %s"},t.prototype.first=function(){return"pertama"},t.prototype.second=function(){return"kedua"},t.prototype.third=function(){return"ketiga"},t.prototype.fourth=function(){return"keempat"},t.prototype.fifth=function(){return"kelima"},t.prototype.commaOnThe=function(){return", pada "},t.prototype.spaceX0OfTheMonth=function(){return" %s pada bulan"},t.prototype.lastDay=function(){return"hari terakhir"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", pada %s terakhir bulan"},t.prototype.commaOnlyOnX0=function(){return", hanya pada %s"},t.prototype.commaAndOnX0=function(){return", dan pada %s"},t.prototype.commaEveryX0Months=function(){return", setiap bulan %s"},t.prototype.commaOnlyInX0=function(){return", hanya pada %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", pada hari terakhir bulan"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", pada minggu terakhir bulan"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s hari sebelum hari terakhir bulan"},t.prototype.firstWeekday=function(){return"hari pertama minggu bekerja"},t.prototype.weekdayNearestDayX0=function(){return"hari bekerja yang terdekat dengan %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", pada %s bulan"},t.prototype.commaEveryX0Days=function(){return", setiap %s hari"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", antara hari %s dan %s dalam bulan"},t.prototype.commaOnDayX0OfTheMonth=function(){return", pada hari %s dalam bulan"},t.prototype.commaEveryHour=function(){return", setiap jam"},t.prototype.commaEveryX0Years=function(){return", setiap %s tahun"},t.prototype.commaStartingX0=function(){return", bermula %s"},t.prototype.daysOfTheWeek=function(){return["Ahad","Isnin","Selasa","Rabu","Khamis","Jumaat","Sabtu"]},t.prototype.monthsOfTheYear=function(){return["Januari","Februari","Mac","April","Mei","Jun","Julai","Ogos","September","Oktober","November","Disember"]},t.prototype.onTheHour=function(){return"pada waktu yang tepat"},t}();s.my=p},957(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.nb=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"En feil inntraff ved generering av uttrykksbeskrivelse. Sjekk cron syntaks."},t.prototype.at=function(){return"Kl."},t.prototype.atSpace=function(){return"Kl."},t.prototype.atX0=function(){return"på %s"},t.prototype.atX0MinutesPastTheHour=function(){return"på %s minutter etter timen"},t.prototype.atX0SecondsPastTheMinute=function(){return"på %s sekunder etter minuttet"},t.prototype.betweenX0AndX1=function(){return"mellom %s og %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", mellom dag %s og %s av måneden"},t.prototype.commaEveryDay=function(){return", hver dag"},t.prototype.commaEveryX0Days=function(){return", hver %s dag"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", hver %s ukedag"},t.prototype.commaEveryX0Months=function(){return", hver %s måned"},t.prototype.commaEveryX0Years=function(){return", hvert %s år"},t.prototype.commaOnDayX0OfTheMonth=function(){return", på dag %s av måneden"},t.prototype.commaOnlyInX0=function(){return", bare i %s"},t.prototype.commaOnlyOnX0=function(){return", på %s"},t.prototype.commaAndOnX0=function(){return", og på %s"},t.prototype.commaOnThe=function(){return", på "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", på den siste dagen i måneden"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", den siste ukedagen i måneden"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dager før den siste dagen i måneden"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", på den siste %s av måneden"},t.prototype.commaOnTheX0OfTheMonth=function(){return", på den %s av måneden"},t.prototype.commaX0ThroughX1=function(){return", %s til og med %s"},t.prototype.commaAndX0ThroughX1=function(){return", og %s til og med %s"},t.prototype.everyHour=function(){return"hver time"},t.prototype.everyMinute=function(){return"hvert minutt"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Hvert minutt mellom %s og %s"},t.prototype.everySecond=function(){return"hvert sekund"},t.prototype.everyX0Hours=function(){return"hver %s time"},t.prototype.everyX0Minutes=function(){return"hvert %s minutt"},t.prototype.everyX0Seconds=function(){return"hvert %s sekund"},t.prototype.fifth=function(){return"femte"},t.prototype.first=function(){return"første"},t.prototype.firstWeekday=function(){return"første ukedag"},t.prototype.fourth=function(){return"fjerde"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minuttene fra %s til og med %s etter timen"},t.prototype.second=function(){return"andre"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekundene fra %s til og med %s etter minuttet"},t.prototype.spaceAnd=function(){return" og"},t.prototype.spaceX0OfTheMonth=function(){return" %s i måneden"},t.prototype.lastDay=function(){return"den siste dagen"},t.prototype.third=function(){return"tredje"},t.prototype.weekdayNearestDayX0=function(){return"ukedag nærmest dag %s"},t.prototype.commaStartingX0=function(){return", starter %s"},t.prototype.daysOfTheWeek=function(){return["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"]},t.prototype.monthsOfTheYear=function(){return["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"]},t.prototype.onTheHour=function(){return"på timen"},t}();s.nb=p},647(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.nl=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.everyMinute=function(){return"elke minuut"},t.prototype.everyHour=function(){return"elk uur"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Er is een fout opgetreden bij het vertalen van de gegevens. Controleer de gegevens."},t.prototype.atSpace=function(){return"Om "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Elke minuut tussen %s en %s"},t.prototype.at=function(){return"Om"},t.prototype.spaceAnd=function(){return" en"},t.prototype.everySecond=function(){return"elke seconde"},t.prototype.everyX0Seconds=function(){return"elke %s seconden"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconden %s t/m %s na de minuut"},t.prototype.atX0SecondsPastTheMinute=function(){return"op %s seconden na de minuut"},t.prototype.everyX0Minutes=function(){return"elke %s minuten"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minuut %s t/m %s na het uur"},t.prototype.atX0MinutesPastTheHour=function(){return"op %s minuten na het uur"},t.prototype.everyX0Hours=function(){return"elke %s uur"},t.prototype.betweenX0AndX1=function(){return"tussen %s en %s"},t.prototype.atX0=function(){return"om %s"},t.prototype.commaEveryDay=function(){return", elke dag"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", elke %s dagen van de week"},t.prototype.commaX0ThroughX1=function(){return", %s t/m %s"},t.prototype.commaAndX0ThroughX1=function(){return", en %s t/m %s"},t.prototype.first=function(){return"eerste"},t.prototype.second=function(){return"tweede"},t.prototype.third=function(){return"derde"},t.prototype.fourth=function(){return"vierde"},t.prototype.fifth=function(){return"vijfde"},t.prototype.commaOnThe=function(){return", op de "},t.prototype.spaceX0OfTheMonth=function(){return" %s van de maand"},t.prototype.lastDay=function(){return"de laatste dag"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", op de laatste %s van de maand"},t.prototype.commaOnlyOnX0=function(){return", alleen op %s"},t.prototype.commaAndOnX0=function(){return", en op %s"},t.prototype.commaEveryX0Months=function(){return", elke %s maanden"},t.prototype.commaOnlyInX0=function(){return", alleen in %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", op de laatste dag van de maand"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", op de laatste werkdag van de maand"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dagen vóór de laatste dag van de maand"},t.prototype.firstWeekday=function(){return"eerste werkdag"},t.prototype.weekdayNearestDayX0=function(){return"werkdag dichtst bij dag %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", op de %s van de maand"},t.prototype.commaEveryX0Days=function(){return", elke %s dagen"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", tussen dag %s en %s van de maand"},t.prototype.commaOnDayX0OfTheMonth=function(){return", op dag %s van de maand"},t.prototype.commaEveryX0Years=function(){return", elke %s jaren"},t.prototype.commaStartingX0=function(){return", beginnend %s"},t.prototype.daysOfTheWeek=function(){return["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"]},t.prototype.monthsOfTheYear=function(){return["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"]},t.prototype.onTheHour=function(){return"op het hele uur"},t}();s.nl=p},905(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.pl=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Wystąpił błąd podczas generowania opisu wyrażenia cron. Sprawdź składnię wyrażenia cron."},t.prototype.at=function(){return"O"},t.prototype.atSpace=function(){return"O "},t.prototype.atX0=function(){return"o %s"},t.prototype.atX0MinutesPastTheHour=function(){return"w %s minucie"},t.prototype.atX0SecondsPastTheMinute=function(){return"w %s sekundzie"},t.prototype.betweenX0AndX1=function(){return"od %s do %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", od %s-ego do %s-ego dnia miesiąca"},t.prototype.commaEveryDay=function(){return", co dzień"},t.prototype.commaEveryX0Days=function(){return", co %s dni"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", co %s dni tygodnia"},t.prototype.commaEveryX0Months=function(){return", co %s miesięcy"},t.prototype.commaEveryX0Years=function(){return", co %s lat"},t.prototype.commaOnDayX0OfTheMonth=function(){return", %s-ego dnia miesiąca"},t.prototype.commaOnlyInX0=function(){return", tylko %s"},t.prototype.commaOnlyOnX0=function(){return", tylko %s"},t.prototype.commaAndOnX0=function(){return", i %s"},t.prototype.commaOnThe=function(){return", "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", ostatni dzień miesiąca"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", ostatni dzień roboczy miesiąca"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dni przed ostatnim dniem miesiąca"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", ostatni %s miesiąca"},t.prototype.commaOnTheX0OfTheMonth=function(){return", %s miesiąca"},t.prototype.commaX0ThroughX1=function(){return", od %s do %s"},t.prototype.commaAndX0ThroughX1=function(){return", i od %s do %s"},t.prototype.everyHour=function(){return"co godzinę"},t.prototype.everyMinute=function(){return"co minutę"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Co minutę od %s do %s"},t.prototype.everySecond=function(){return"co sekundę"},t.prototype.everyX0Hours=function(){return"co %s godzin"},t.prototype.everyX0Minutes=function(){return"co %s minut"},t.prototype.everyX0Seconds=function(){return"co %s sekund"},t.prototype.fifth=function(){return"piąty"},t.prototype.first=function(){return"pierwszy"},t.prototype.firstWeekday=function(){return"pierwszy dzień roboczy"},t.prototype.fourth=function(){return"czwarty"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minuty od %s do %s"},t.prototype.second=function(){return"drugi"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekundy od %s do %s"},t.prototype.spaceAnd=function(){return" i"},t.prototype.spaceX0OfTheMonth=function(){return" %s miesiąca"},t.prototype.lastDay=function(){return"ostatni dzień"},t.prototype.third=function(){return"trzeci"},t.prototype.weekdayNearestDayX0=function(){return"dzień roboczy najbliższy %s-ego dnia"},t.prototype.commaStartingX0=function(){return", startowy %s"},t.prototype.daysOfTheWeek=function(){return["niedziela","poniedziałek","wtorek","środa","czwartek","piątek","sobota"]},t.prototype.monthsOfTheYear=function(){return["styczeń","luty","marzec","kwiecień","maj","czerwiec","lipiec","sierpień","wrzesień","październik","listopad","grudzień"]},t.prototype.onTheHour=function(){return"o pełnej godzinie"},t}();s.pl=p},556(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.pt_BR=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Ocorreu um erro ao gerar a descrição da expressão Cron."},t.prototype.at=function(){return"às"},t.prototype.atSpace=function(){return"às "},t.prototype.atX0=function(){return"Às %s"},t.prototype.atX0MinutesPastTheHour=function(){return"aos %s minutos da hora"},t.prototype.atX0SecondsPastTheMinute=function(){return"aos %s segundos do minuto"},t.prototype.betweenX0AndX1=function(){return"entre %s e %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", entre os dias %s e %s do mês"},t.prototype.commaEveryDay=function(){return", a cada dia"},t.prototype.commaEveryX0Days=function(){return", a cada %s dias"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", a cada %s dias de semana"},t.prototype.commaEveryX0Months=function(){return", a cada %s meses"},t.prototype.commaOnDayX0OfTheMonth=function(){return", no dia %s do mês"},t.prototype.commaOnlyInX0=function(x){return x&&x.length>1&&x[1]==="-"?"somente %s":", somente em %s"},t.prototype.commaOnlyOnX0=function(x){return x&&x.length>1&&x[1]==="-"?", somente %s":", somente de %s"},t.prototype.commaAndOnX0=function(){return", e de %s"},t.prototype.commaOnThe=function(x,h){return h==="6"||h==="0"?", no":", na "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", no último dia do mês"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", no último dia da semana do mês"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dias antes do último dia do mês"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", na última %s do mês"},t.prototype.commaOnTheX0OfTheMonth=function(){return", no %s do mês"},t.prototype.commaX0ThroughX1=function(){return", de %s a %s"},t.prototype.commaAndX0ThroughX1=function(){return", e de %s a %s"},t.prototype.everyHour=function(){return"a cada hora"},t.prototype.everyMinute=function(){return"a cada minuto"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"a cada minuto entre %s e %s"},t.prototype.everySecond=function(){return"a cada segundo"},t.prototype.everyX0Hours=function(){return"a cada %s horas"},t.prototype.everyX0Minutes=function(){return"a cada %s minutos"},t.prototype.everyX0Seconds=function(){return"a cada %s segundos"},t.prototype.fifth=function(x){return x==="6"||x==="0"?"quinto":"quinta"},t.prototype.first=function(x){return x==="6"||x==="0"?"primeiro":"primeira"},t.prototype.firstWeekday=function(){return"primeiro dia da semana"},t.prototype.fourth=function(x){return x==="6"||x==="0"?"quarto":"quarta"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"do minuto %s até %s de cada hora"},t.prototype.second=function(x){return x==="6"||x==="0"?"segundo":"segunda"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"No segundo %s até %s de cada minuto"},t.prototype.spaceAnd=function(){return" e"},t.prototype.spaceX0OfTheMonth=function(){return" %s do mês"},t.prototype.lastDay=function(){return"o último dia"},t.prototype.third=function(x){return x==="6"||x==="0"?"terceiro":"terceira"},t.prototype.weekdayNearestDayX0=function(){return"dia da semana mais próximo do dia %s"},t.prototype.commaEveryX0Years=function(){return", a cada %s anos"},t.prototype.commaStartingX0=function(){return", iniciando %s"},t.prototype.daysOfTheWeek=function(){return["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},t.prototype.monthsOfTheYear=function(){return["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},t.prototype.onTheHour=function(){return"na hora certa"},t}();s.pt_BR=p},163(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.pt_PT=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Ocorreu um erro ao gerar a descrição da expressão Cron."},t.prototype.at=function(){return"às"},t.prototype.atSpace=function(){return"às "},t.prototype.atX0=function(){return"Às %s"},t.prototype.atX0MinutesPastTheHour=function(){return"aos %s minutos da hora"},t.prototype.atX0SecondsPastTheMinute=function(){return"aos %s segundos do minuto"},t.prototype.betweenX0AndX1=function(){return"entre %s e %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", entre os dias %s e %s do mês"},t.prototype.commaEveryDay=function(){return", a cada dia"},t.prototype.commaEveryX0Days=function(){return", a cada %s dias"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", a cada %s dias de semana"},t.prototype.commaEveryX0Months=function(){return", a cada %s meses"},t.prototype.commaOnDayX0OfTheMonth=function(){return", no dia %s do mês"},t.prototype.commaOnlyInX0=function(){return", somente em %s"},t.prototype.commaOnlyOnX0=function(){return", somente de %s"},t.prototype.commaAndOnX0=function(){return", e de %s"},t.prototype.commaOnThe=function(x,h){return h==="6"||h==="0"?", no":", na "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", no último dia do mês"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", no último dia da semana do mês"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dias antes do último dia do mês"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", na última %s do mês"},t.prototype.commaOnTheX0OfTheMonth=function(){return", no %s do mês"},t.prototype.commaX0ThroughX1=function(){return", de %s a %s"},t.prototype.commaAndX0ThroughX1=function(){return", e de %s a %s"},t.prototype.everyHour=function(){return"a cada hora"},t.prototype.everyMinute=function(){return"a cada minuto"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"a cada minuto entre %s e %s"},t.prototype.everySecond=function(){return"a cada segundo"},t.prototype.everyX0Hours=function(){return"a cada %s horas"},t.prototype.everyX0Minutes=function(){return"a cada %s minutos"},t.prototype.everyX0Seconds=function(){return"a cada %s segundos"},t.prototype.fifth=function(x){return x==="6"||x==="0"?"quinto":"quinta"},t.prototype.first=function(x){return x==="6"||x==="0"?"primeiro":"primeira"},t.prototype.firstWeekday=function(){return"primeiro dia da semana"},t.prototype.fourth=function(x){return x==="6"||x==="0"?"quarto":"quarta"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"do minuto %s até %s de cada hora"},t.prototype.second=function(x){return x==="6"||x==="0"?"segundo":"segunda"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"No segundo %s até %s de cada minuto"},t.prototype.spaceAnd=function(){return" e"},t.prototype.spaceX0OfTheMonth=function(){return" %s do mês"},t.prototype.lastDay=function(){return"o último dia"},t.prototype.third=function(x){return x==="6"||x==="0"?"terceiro":"terceira"},t.prototype.weekdayNearestDayX0=function(){return"dia da semana mais próximo do dia %s"},t.prototype.commaEveryX0Years=function(){return", a cada %s anos"},t.prototype.commaStartingX0=function(){return", iniciando %s"},t.prototype.daysOfTheWeek=function(){return["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},t.prototype.monthsOfTheYear=function(){return["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},t.prototype.onTheHour=function(){return"à hora certa"},t}();s.pt_PT=p},614(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ro=void 0;var p=function(){function t(){}return t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Eroare la generarea descrierii. Verificați sintaxa."},t.prototype.at=function(){return"La"},t.prototype.atSpace=function(){return"La "},t.prototype.atX0=function(){return"la %s"},t.prototype.atX0MinutesPastTheHour=function(){return"la și %s minute"},t.prototype.atX0SecondsPastTheMinute=function(){return"la și %s secunde"},t.prototype.betweenX0AndX1=function(){return"între %s și %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", între zilele %s și %s ale lunii"},t.prototype.commaEveryDay=function(){return", în fiecare zi"},t.prototype.commaEveryX0Days=function(){return", la fiecare %s zile"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", la fiecare a %s-a zi a săptămânii"},t.prototype.commaEveryX0Months=function(){return", la fiecare %s luni"},t.prototype.commaEveryX0Years=function(){return", o dată la %s ani"},t.prototype.commaOnDayX0OfTheMonth=function(){return", în ziua %s a lunii"},t.prototype.commaOnlyInX0=function(){return", doar în %s"},t.prototype.commaOnlyOnX0=function(){return", doar %s"},t.prototype.commaAndOnX0=function(){return", și %s"},t.prototype.commaOnThe=function(){return", în "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", în ultima zi a lunii"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", în ultima zi lucrătoare a lunii"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s zile înainte de ultima zi a lunii"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", în ultima %s a lunii"},t.prototype.commaOnTheX0OfTheMonth=function(){return", în %s a lunii"},t.prototype.commaX0ThroughX1=function(){return", de %s până %s"},t.prototype.commaAndX0ThroughX1=function(){return", și de %s până %s"},t.prototype.everyHour=function(){return"în fiecare oră"},t.prototype.everyMinute=function(){return"în fiecare minut"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"În fiecare minut între %s și %s"},t.prototype.everySecond=function(){return"în fiecare secundă"},t.prototype.everyX0Hours=function(){return"la fiecare %s ore"},t.prototype.everyX0Minutes=function(){return"la fiecare %s minute"},t.prototype.everyX0Seconds=function(){return"la fiecare %s secunde"},t.prototype.fifth=function(){return"a cincea"},t.prototype.first=function(){return"prima"},t.prototype.firstWeekday=function(){return"prima zi a săptămânii"},t.prototype.fourth=function(){return"a patra"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"între minutele %s și %s"},t.prototype.second=function(){return"a doua"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"între secunda %s și secunda %s"},t.prototype.spaceAnd=function(){return" și"},t.prototype.spaceX0OfTheMonth=function(){return" %s a lunii"},t.prototype.lastDay=function(){return"ultima zi"},t.prototype.third=function(){return"a treia"},t.prototype.weekdayNearestDayX0=function(){return"cea mai apropiată zi a săptămânii de ziua %s"},t.prototype.commaMonthX0ThroughMonthX1=function(){return", din %s până în %s"},t.prototype.commaYearX0ThroughYearX1=function(){return", din %s până în %s"},t.prototype.atX0MinutesPastTheHourGt20=function(){return"la și %s de minute"},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return"la și %s de secunde"},t.prototype.commaStartingX0=function(){return", pornire %s"},t.prototype.daysOfTheWeek=function(){return["duminică","luni","marți","miercuri","joi","vineri","sâmbătă"]},t.prototype.monthsOfTheYear=function(){return["ianuarie","februarie","martie","aprilie","mai","iunie","iulie","august","septembrie","octombrie","noiembrie","decembrie"]},t.prototype.onTheHour=function(){return"fix la oră"},t}();s.ro=p},892(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.ru=void 0;var p=function(h,a){var i=Number(h);return i!==void 0?a[i%100>4&&i%100<20?2:[2,0,1,1,1,2][i%10<5?Math.abs(i)%10:5]]:a[2]},t=function(h,a){var i=Number(h);return i!==void 0?a[i===0?0:i===1||i===2||i===4?1:2]:a[1]},x=function(){function h(){}return h.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},h.prototype.atX0MinutesPastTheHourGt20=function(){return null},h.prototype.commaMonthX0ThroughMonthX1=function(){return null},h.prototype.commaYearX0ThroughYearX1=function(){return null},h.prototype.use24HourTimeFormatByDefault=function(){return!0},h.prototype.everyMinute=function(){return"каждую минуту"},h.prototype.everyHour=function(){return"каждый час"},h.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Произошла ошибка во время генерации описания выражения. Проверьте синтаксис крон-выражения."},h.prototype.atSpace=function(){return"В "},h.prototype.everyMinuteBetweenX0AndX1=function(){return"Каждую минуту с %s по %s"},h.prototype.at=function(){return"В"},h.prototype.spaceAnd=function(){return" и"},h.prototype.everySecond=function(){return"каждую секунду"},h.prototype.everyX0Seconds=function(a){return p(a,["каждую %s секунду","каждые %s секунды","каждые %s секунд"])},h.prototype.secondsX0ThroughX1PastTheMinute=function(){return"секунды с %s по %s"},h.prototype.atX0SecondsPastTheMinute=function(a){return p(a,["в %s секунду","в %s секунды","в %s секунд"])},h.prototype.everyX0Minutes=function(a){return p(a,["каждую %s минуту","каждые %s минуты","каждые %s минут"])},h.prototype.minutesX0ThroughX1PastTheHour=function(){return"минуты с %s по %s"},h.prototype.atX0MinutesPastTheHour=function(a){return p(a,["в %s минуту","в %s минуты","в %s минут"])},h.prototype.everyX0Hours=function(a){return p(a,["каждый %s час","каждые %s часа","каждые %s часов"])},h.prototype.betweenX0AndX1=function(){return"с %s по %s"},h.prototype.atX0=function(){return"в %s"},h.prototype.commaEveryDay=function(){return", каждый день"},h.prototype.commaEveryX0DaysOfTheWeek=function(a){return p(a,[", каждый %s день недели",", каждые %s дня недели",", каждые %s дней недели"])},h.prototype.commaX0ThroughX1=function(a){return a&&(a[0]=="2"||a[0]=="3")?", со %s по %s":", с %s по %s"},h.prototype.commaAndX0ThroughX1=function(a){return a&&(a[0]=="2"||a[0]=="3")?" и со %s по %s":" и с %s по %s"},h.prototype.first=function(a){return t(a,["первое","первый","первую"])},h.prototype.second=function(a){return t(a,["второе","второй","вторую"])},h.prototype.third=function(a){return t(a,["третье","третий","третью"])},h.prototype.fourth=function(a){return t(a,["четвертое","четвертый","четвертую"])},h.prototype.fifth=function(a){return t(a,["пятое","пятый","пятую"])},h.prototype.commaOnThe=function(a){return a==="2"?", во ":", в "},h.prototype.spaceX0OfTheMonth=function(){return" %s месяца"},h.prototype.lastDay=function(){return"последний день"},h.prototype.commaOnTheLastX0OfTheMonth=function(a){return t(a,[", в последнее %s месяца",", в последний %s месяца",", в последнюю %s месяца"])},h.prototype.commaOnlyOnX0=function(a){return a&&a[0]==="2"?", только во %s":", только в %s"},h.prototype.commaAndOnX0=function(){return", и %s"},h.prototype.commaEveryX0Months=function(a){return p(a,[""," каждые %s месяца"," каждые %s месяцев"])},h.prototype.commaOnlyInMonthX0=function(){return", только %s"},h.prototype.commaOnlyInX0=function(){return", только в %s"},h.prototype.commaOnTheLastDayOfTheMonth=function(){return", в последний день месяца"},h.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", в последний будний день месяца"},h.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(a){return p(a,[", за %s день до конца месяца",", за %s дня до конца месяца",", за %s дней до конца месяца"])},h.prototype.firstWeekday=function(){return"первый будний день"},h.prototype.weekdayNearestDayX0=function(){return"ближайший будний день к %s числу"},h.prototype.commaOnTheX0OfTheMonth=function(){return", в %s месяца"},h.prototype.commaEveryX0Days=function(a){return p(a,[", каждый %s день",", каждые %s дня",", каждые %s дней"])},h.prototype.commaBetweenDayX0AndX1OfTheMonth=function(a){return a&&a.substring(0,a.indexOf("-"))=="2"?", со %s по %s число месяца":", с %s по %s число месяца"},h.prototype.commaOnDayX0OfTheMonth=function(a){return a&&a[0]=="2"?", во %s число месяца":", в %s число месяца"},h.prototype.commaEveryX0Years=function(a){return p(a,[", каждый %s год",", каждые %s года",", каждые %s лет"])},h.prototype.commaStartingX0=function(){return", начало %s"},h.prototype.daysOfTheWeek=function(){return["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"]},h.prototype.daysOfTheWeekInCase=function(a){return a===void 0&&(a=2),a==1?["воскресенья","понедельника","вторника","среды","четверга","пятницы","субботы"]:["воскресенье","понедельник","вторник","среду","четверг","пятницу","субботу"]},h.prototype.monthsOfTheYear=function(){return["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"]},h.prototype.monthsOfTheYearInCase=function(a){return a==1?["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"]:this.monthsOfTheYear()},h.prototype.onTheHour=function(){return"ровно в час"},h}();s.ru=x},923(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sk=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Pri vytváraní popisu došlo k chybe. Skontrolujte prosím správnosť syntaxe cronu."},t.prototype.everyMinute=function(){return"každú minútu"},t.prototype.everyHour=function(){return"každú hodinu"},t.prototype.atSpace=function(){return"V "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Každú minútu medzi %s a %s"},t.prototype.at=function(){return"V"},t.prototype.spaceAnd=function(){return" a"},t.prototype.everySecond=function(){return"každú sekundu"},t.prototype.everyX0Seconds=function(){return"každých %s sekúnd"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekundy od %s do %s"},t.prototype.atX0SecondsPastTheMinute=function(){return"v %s sekúnd"},t.prototype.everyX0Minutes=function(){return"každých %s minút"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minúty od %s do %s"},t.prototype.atX0MinutesPastTheHour=function(){return"v %s minút"},t.prototype.everyX0Hours=function(){return"každých %s hodín"},t.prototype.betweenX0AndX1=function(){return"medzi %s a %s"},t.prototype.atX0=function(){return"v %s"},t.prototype.commaEveryDay=function(){return", každý deň"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", každých %s dní v týždni"},t.prototype.commaX0ThroughX1=function(){return", od %s do %s"},t.prototype.commaAndX0ThroughX1=function(){return", a od %s do %s"},t.prototype.first=function(){return"prvý"},t.prototype.second=function(){return"druhý"},t.prototype.third=function(){return"tretí"},t.prototype.fourth=function(){return"štvrtý"},t.prototype.fifth=function(){return"piaty"},t.prototype.commaOnThe=function(){return", "},t.prototype.spaceX0OfTheMonth=function(){return" %s v mesiaci"},t.prototype.lastDay=function(){return"posledný deň"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", posledný %s v mesiaci"},t.prototype.commaOnlyOnX0=function(){return", iba v %s"},t.prototype.commaAndOnX0=function(){return", a v %s"},t.prototype.commaEveryX0Months=function(){return", každých %s mesiacov"},t.prototype.commaOnlyInX0=function(){return", iba v %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", posledný deň v mesiaci"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", posledný pracovný deň v mesiaci"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dní pred posledným dňom v mesiaci"},t.prototype.firstWeekday=function(){return"prvý pracovný deň"},t.prototype.weekdayNearestDayX0=function(){return"pracovný deň najbližšie %s. dňu"},t.prototype.commaOnTheX0OfTheMonth=function(){return", v %s v mesiaci"},t.prototype.commaEveryX0Days=function(){return", každých %s dní"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", medzi dňami %s a %s v mesiaci"},t.prototype.commaOnDayX0OfTheMonth=function(){return", %s. deň v mesiaci"},t.prototype.commaEveryX0Years=function(){return", každých %s rokov"},t.prototype.commaStartingX0=function(){return", začínajúcich %s"},t.prototype.daysOfTheWeek=function(){return["Nedeľa","Pondelok","Utorok","Streda","Štvrtok","Piatok","Sobota"]},t.prototype.monthsOfTheYear=function(){return["Január","Február","Marec","Apríl","Máj","Jún","Júl","August","September","Október","November","December"]},t.prototype.onTheHour=function(){return"o celú hodinu"},t}();s.sk=p},474(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sl=void 0;var p=function(){function t(){}return t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Pri generiranju opisa izraza je prišlo do napake. Preverite sintakso izraza cron."},t.prototype.at=function(){return"Ob"},t.prototype.atSpace=function(){return"Ob "},t.prototype.atX0=function(){return"ob %s"},t.prototype.atX0MinutesPastTheHour=function(){return"ob %s."},t.prototype.atX0SecondsPastTheMinute=function(){return"ob %s."},t.prototype.betweenX0AndX1=function(){return"od %s do %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", od %s. do %s. dne v mesecu"},t.prototype.commaEveryDay=function(){return", vsak dan"},t.prototype.commaEveryX0Days=function(){return", vsakih %s dni"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", vsakih %s dni v tednu"},t.prototype.commaEveryX0Months=function(){return", vsakih %s mesecev"},t.prototype.commaEveryX0Years=function(){return", vsakih %s let"},t.prototype.commaOnDayX0OfTheMonth=function(){return", %s. dan v mesecu"},t.prototype.commaOnlyInX0=function(){return", samo v %s"},t.prototype.commaOnlyOnX0=function(){return", samo v %s"},t.prototype.commaAndOnX0=function(){return"in naprej %s"},t.prototype.commaOnThe=function(){return", "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", zadnji %s v mesecu"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", zadnji delovni dan v mesecu"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dni pred koncem meseca"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", zadnji %s v mesecu"},t.prototype.commaOnTheX0OfTheMonth=function(){return", %s v mesecu"},t.prototype.commaX0ThroughX1=function(){return", od %s do %s"},t.prototype.commaAndX0ThroughX1=function(){return", in od %s do %s"},t.prototype.everyHour=function(){return"vsako uro"},t.prototype.everyMinute=function(){return"vsako minuto"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Vsako minuto od %s do %s"},t.prototype.everySecond=function(){return"vsako sekundo"},t.prototype.everyX0Hours=function(){return"vsakih %s ur"},t.prototype.everyX0Minutes=function(){return"vsakih %s minut"},t.prototype.everyX0Seconds=function(){return"vsakih %s sekund"},t.prototype.fifth=function(){return"peti"},t.prototype.first=function(){return"prvi"},t.prototype.firstWeekday=function(){return"prvi delovni dan"},t.prototype.fourth=function(){return"četrti"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minute od %s do %s"},t.prototype.second=function(){return"drugi"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekunde od %s do %s"},t.prototype.spaceAnd=function(){return" in"},t.prototype.spaceX0OfTheMonth=function(){return" %s v mesecu"},t.prototype.lastDay=function(){return"zadnjič"},t.prototype.third=function(){return"tretji"},t.prototype.weekdayNearestDayX0=function(){return"delovni dan, najbližji %s. dnevu"},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.commaStartingX0=function(){return", začenši %s"},t.prototype.daysOfTheWeek=function(){return["Nedelja","Ponedeljek","Torek","Sreda","Četrtek","Petek","Sobota"]},t.prototype.monthsOfTheYear=function(){return["januar","februar","marec","april","maj","junij","julij","avgust","september","oktober","november","december"]},t.prototype.onTheHour=function(){return"ob točni uri"},t}();s.sl=p},716(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sr=void 0;var p=function(){function t(){}return t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Došlo je do greške pri generisanju izraza. Proverite sintaksu cron izraza."},t.prototype.at=function(){return"U"},t.prototype.atSpace=function(){return"U "},t.prototype.atX0=function(){return"u %s"},t.prototype.atX0MinutesPastTheHour=function(){return"u %s minuta posle punog sata"},t.prototype.atX0SecondsPastTheMinute=function(){return"u %s sekundi posle pune minute"},t.prototype.betweenX0AndX1=function(){return"između %s i %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", između %s. i %s. dana u mesecu"},t.prototype.commaEveryDay=function(){return", svaki dan"},t.prototype.commaEveryX0Days=function(){return", svakih %s dana"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", svakih %s dana u nedelji"},t.prototype.commaEveryX0Months=function(){return", svakih %s meseci"},t.prototype.commaEveryX0Years=function(){return", svakih %s godina"},t.prototype.commaOnDayX0OfTheMonth=function(){return", %s. dan u mesecu"},t.prototype.commaOnlyInX0=function(){return", samo u %s"},t.prototype.commaOnlyOnX0=function(){return", samo %s"},t.prototype.commaAndOnX0=function(){return", i %s"},t.prototype.commaOnThe=function(){return", "},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", poslednjeg dana u mesecu"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", poslednjeg radnog dana u mesecu"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dana pre kraja meseca"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", poslednji %s u mesecu"},t.prototype.commaOnTheX0OfTheMonth=function(){return", %s u mesecu"},t.prototype.commaX0ThroughX1=function(){return", od %s do %s"},t.prototype.commaAndX0ThroughX1=function(){return", i od %s do %s"},t.prototype.everyHour=function(){return"svaki sat"},t.prototype.everyMinute=function(){return"svakog minuta"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Svakog minuta između %s i %s"},t.prototype.everySecond=function(){return"svake sekunde"},t.prototype.everyX0Hours=function(){return"svakih %s sati"},t.prototype.everyX0Minutes=function(){return"svakih %s minuta"},t.prototype.everyX0Seconds=function(){return"svakih %s sekundi"},t.prototype.fifth=function(){return"peti"},t.prototype.first=function(){return"prvi"},t.prototype.firstWeekday=function(){return"prvi radni dan"},t.prototype.fourth=function(){return"četvrti"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minute od %s do %s posle punog sata"},t.prototype.second=function(){return"drugi"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekunde od %s do %s posle pune minute"},t.prototype.spaceAnd=function(){return" i"},t.prototype.spaceX0OfTheMonth=function(){return" %s u mesecu"},t.prototype.lastDay=function(){return"poslednji dan"},t.prototype.third=function(){return"treći"},t.prototype.weekdayNearestDayX0=function(){return"radni dan najbliži %s. danu"},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.commaStartingX0=function(){return", počevši od %s"},t.prototype.daysOfTheWeek=function(){return["Nedelja","Ponedeljak","Utorak","Sreda","Četvrtak","Petak","Subota"]},t.prototype.monthsOfTheYear=function(){return["januar","februar","mart","april","maj","jun","jul","avgust","septembar","oktobar","novembar","decembar"]},t.prototype.onTheHour=function(){return"u pun sat"},t}();s.sr=p},544(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sv=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Ett fel inträffade vid generering av uttryckets beskrivning. Kontrollera cron-uttryckets syntax."},t.prototype.everyMinute=function(){return"varje minut"},t.prototype.everyHour=function(){return"varje timme"},t.prototype.atSpace=function(){return"Kl "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Varje minut mellan %s och %s"},t.prototype.at=function(){return"Kl"},t.prototype.spaceAnd=function(){return" och"},t.prototype.everySecond=function(){return"varje sekund"},t.prototype.everyX0Seconds=function(){return"varje %s sekund"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekunderna från %s till och med %s efter minuten"},t.prototype.atX0SecondsPastTheMinute=function(){return"på %s sekunder efter minuten"},t.prototype.everyX0Minutes=function(){return"var %s minut"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minuterna från %s till och med %s efter timmen"},t.prototype.atX0MinutesPastTheHour=function(){return"på %s minuten efter timmen"},t.prototype.everyX0Hours=function(){return"var %s timme"},t.prototype.betweenX0AndX1=function(){return"mellan %s och %s"},t.prototype.atX0=function(){return"kl %s"},t.prototype.commaEveryDay=function(){return", varje dag"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", var %s dag i veckan"},t.prototype.commaX0ThroughX1=function(){return", %s till %s"},t.prototype.commaAndX0ThroughX1=function(){return", och %s till %s"},t.prototype.first=function(){return"första"},t.prototype.second=function(){return"andra"},t.prototype.third=function(){return"tredje"},t.prototype.fourth=function(){return"fjärde"},t.prototype.fifth=function(){return"femte"},t.prototype.commaOnThe=function(){return", den "},t.prototype.spaceX0OfTheMonth=function(){return" %sen av månaden"},t.prototype.lastDay=function(){return"den sista dagen"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", på sista %s av månaden"},t.prototype.commaOnlyOnX0=function(){return", varje %s"},t.prototype.commaAndOnX0=function(){return", och på %s"},t.prototype.commaEveryX0Months=function(){return", var %s månad"},t.prototype.commaOnlyInX0=function(){return", bara på %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", på sista dagen av månaden"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", på sista veckodag av månaden"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s dagar före den sista dagen i månaden"},t.prototype.firstWeekday=function(){return"första veckodag"},t.prototype.weekdayNearestDayX0=function(){return"veckodagen närmast dag %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", på den %s av månaden"},t.prototype.commaEveryX0Days=function(){return", var %s dag"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", mellan dag %s och %s av månaden"},t.prototype.commaOnDayX0OfTheMonth=function(){return", på dag %s av månaden"},t.prototype.commaEveryX0Years=function(){return", var %s år"},t.prototype.commaStartingX0=function(){return", startar %s"},t.prototype.daysOfTheWeek=function(){return["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"]},t.prototype.monthsOfTheYear=function(){return["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"]},t.prototype.onTheHour=function(){return"på heltimmen"},t}();s.sv=p},799(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.sw=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Kuna tatizo wakati wa kutunga msemo. Angalia cron expression syntax."},t.prototype.everyMinute=function(){return"kila dakika"},t.prototype.everyHour=function(){return"kila saa"},t.prototype.atSpace=function(){return"Kwa "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Kila dakika kwanzia %s hadi %s"},t.prototype.at=function(){return"Kwa"},t.prototype.spaceAnd=function(){return" na"},t.prototype.everySecond=function(){return"kila sekunde"},t.prototype.everyX0Seconds=function(){return"kila sekunde %s"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"sekunde ya %s hadi %s baada ya dakika"},t.prototype.atX0SecondsPastTheMinute=function(){return"sekunde %s baada ya dakika"},t.prototype.everyX0Minutes=function(){return"kila dakika %s"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},t.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},t.prototype.everyX0Hours=function(){return"every %s hours"},t.prototype.betweenX0AndX1=function(){return"kati ya %s na %s"},t.prototype.atX0=function(){return"kwenye %s"},t.prototype.commaEveryDay=function(){return", kila siku"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", kila siku %s ya wiki"},t.prototype.commaX0ThroughX1=function(){return", %s hadi %s"},t.prototype.commaAndX0ThroughX1=function(){return", na %s hadi %s"},t.prototype.first=function(){return"ya kwanza"},t.prototype.second=function(){return"ya pili"},t.prototype.third=function(){return"ya tatu"},t.prototype.fourth=function(){return"ya nne"},t.prototype.fifth=function(){return"ya tano"},t.prototype.commaOnThe=function(){return", kwenye "},t.prototype.spaceX0OfTheMonth=function(){return" siku %s ya mwezi"},t.prototype.lastDay=function(){return"siku ya mwisho"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", siku ya %s ya mwezi"},t.prototype.commaOnlyOnX0=function(){return", kwa %s tu"},t.prototype.commaAndOnX0=function(){return", na pia %s"},t.prototype.commaEveryX0Months=function(){return", kila mwezi wa %s"},t.prototype.commaOnlyInX0=function(){return", kwa %s tu"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", siku ya mwisho wa mwezi"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", wikendi ya mwisho wa mwezi"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", siku ya %s kabla ya siku ya mwisho wa mwezi"},t.prototype.firstWeekday=function(){return"siku za kazi ya kwanza"},t.prototype.weekdayNearestDayX0=function(){return"siku ya kazi karibu na siku ya %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", siku ya %s ya mwezi"},t.prototype.commaEveryX0Days=function(){return", kila siku %s"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", kati ya siku %s na %s ya mwezi"},t.prototype.commaOnDayX0OfTheMonth=function(){return", siku ya %s ya mwezi"},t.prototype.commaEveryX0Years=function(){return", kila miaka %s"},t.prototype.commaStartingX0=function(){return", kwanzia %s"},t.prototype.daysOfTheWeek=function(){return["Jumapili","Jumatatu","Jumanne","Jumatano","Alhamisi","Ijumaa","Jumamosi"]},t.prototype.monthsOfTheYear=function(){return["Januari","Februari","Machi","Aprili","Mei","Juni","Julai","Agosti","Septemba","Oktoba","Novemba","Desemba"]},t.prototype.onTheHour=function(){return"saa kamili"},t}();s.sw=p},33(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.th=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!1},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"เกิดข้อผิดพลาดขณะสร้างคำอธิบายนิพจน์ ตรวจสอบไวยากรณ์นิพจน์ครอน"},t.prototype.everyMinute=function(){return"ทุกๆ นาที"},t.prototype.everyHour=function(){return"ทุกๆ ชั่วโมง"},t.prototype.atSpace=function(){return"เมื่อ "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"ทุกๆ นาที %s และ %s"},t.prototype.at=function(){return"เมื่อ"},t.prototype.spaceAnd=function(){return" และ"},t.prototype.everySecond=function(){return"ทุกๆ วินาที"},t.prototype.everyX0Seconds=function(){return"ทุกๆ %s วินาที"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"วินาที %s ถึง %s นาทีที่ผ่านมา"},t.prototype.atX0SecondsPastTheMinute=function(){return"เมื่อ %s วินาที นาทีที่ผ่านมา"},t.prototype.everyX0Minutes=function(){return"ทุกๆ %s นาที"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"นาที %s ถึง %s ชั่วโมงที่ผ่านมา"},t.prototype.atX0MinutesPastTheHour=function(){return"เมื่อ %s นาที ชั่วโมงที่ผ่านมา"},t.prototype.everyX0Hours=function(){return"ทุกๆ %s ชั่วโมง"},t.prototype.betweenX0AndX1=function(){return"ระหว่าง %s ถึง %s"},t.prototype.atX0=function(){return"เมื่อ %s"},t.prototype.commaEveryDay=function(){return", ทุกๆ วัน"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", ทุกๆ %s วันของสัปดาห์"},t.prototype.commaX0ThroughX1=function(){return", %s ถึง %s"},t.prototype.commaAndX0ThroughX1=function(){return", %s ถึง %s"},t.prototype.first=function(){return"แรก"},t.prototype.second=function(){return"ที่สอง"},t.prototype.third=function(){return"ที่สาม"},t.prototype.fourth=function(){return"ที่สี่"},t.prototype.fifth=function(){return"ที่ห้า"},t.prototype.commaOnThe=function(){return", ในวัน "},t.prototype.spaceX0OfTheMonth=function(){return" %s ของเดือน"},t.prototype.lastDay=function(){return"วันสุดท้าย"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", ณ สุดท้าย %s ของเดือน"},t.prototype.commaOnlyOnX0=function(){return", เท่านั้น %s"},t.prototype.commaAndOnX0=function(){return", และใน %s"},t.prototype.commaEveryX0Months=function(){return", ทุกๆ %s เดือน"},t.prototype.commaOnlyInX0=function(){return", เท่านั้น %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", ในวันสิ้นเดือน"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", ในวันธรรมดาสุดท้ายของเดือน"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s วันก่อนวันสุดท้ายของเดือน"},t.prototype.firstWeekday=function(){return"วันธรรมดาวันแรก"},t.prototype.weekdayNearestDayX0=function(){return"วันธรรมดาที่ใกล้ที่สุด %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", ในวัน %s ของเดือน"},t.prototype.commaEveryX0Days=function(){return", ทุกๆ %s วัน"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", ระหว่างวัน %s และ %s ของเดือน"},t.prototype.commaOnDayX0OfTheMonth=function(){return", ในวัน %s ของเดือน"},t.prototype.commaEveryHour=function(){return", ทุกๆ ชั่วโมง"},t.prototype.commaEveryX0Years=function(){return", ทุกๆ %s ปี"},t.prototype.commaStartingX0=function(){return", เริ่ม %s"},t.prototype.daysOfTheWeek=function(){return["วันอาทิตย์","วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัสบดี","วันศุกร์","วันเสาร์"]},t.prototype.monthsOfTheYear=function(){return["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"]},t.prototype.onTheHour=function(){return"ตรงชั่วโมง"},t}();s.th=p},631(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.tr=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.everyMinute=function(){return"her dakika"},t.prototype.everyHour=function(){return"her saat"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"İfade açıklamasını oluştururken bir hata oluştu. Cron ifadesini gözden geçirin."},t.prototype.atSpace=function(){return"Saat "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Saat %s ve %s arasındaki her dakika"},t.prototype.at=function(){return"Saat"},t.prototype.spaceAnd=function(){return" ve"},t.prototype.everySecond=function(){return"her saniye"},t.prototype.everyX0Seconds=function(){return"her %s saniyede bir"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"dakikaların %s. ve %s. saniyeleri arası"},t.prototype.atX0SecondsPastTheMinute=function(){return"dakikaların %s. saniyesinde"},t.prototype.everyX0Minutes=function(){return"her %s dakikada bir"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"saatlerin %s. ve %s. dakikaları arası"},t.prototype.atX0MinutesPastTheHour=function(){return"saatlerin %s. dakikasında"},t.prototype.everyX0Hours=function(){return"her %s saatte"},t.prototype.betweenX0AndX1=function(){return"%s ile %s arasında"},t.prototype.atX0=function(){return"saat %s"},t.prototype.commaEveryDay=function(){return", her gün"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", ayın her %s günü"},t.prototype.commaX0ThroughX1=function(){return", %s ile %s arasında"},t.prototype.commaAndX0ThroughX1=function(){return", ve %s ile %s arasında"},t.prototype.first=function(){return"ilk"},t.prototype.second=function(){return"ikinci"},t.prototype.third=function(){return"üçüncü"},t.prototype.fourth=function(){return"dördüncü"},t.prototype.fifth=function(){return"beşinci"},t.prototype.commaOnThe=function(){return", ayın "},t.prototype.spaceX0OfTheMonth=function(){return" %s günü"},t.prototype.lastDay=function(){return"son gün"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", ayın son %s günü"},t.prototype.commaOnlyOnX0=function(){return", sadece %s günü"},t.prototype.commaAndOnX0=function(){return", ve %s"},t.prototype.commaEveryX0Months=function(){return", %s ayda bir"},t.prototype.commaOnlyInX0=function(){return", sadece %s için"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", ayın son günü"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", ayın son iş günü"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s ayın son gününden önceki günler"},t.prototype.firstWeekday=function(){return"ilk iş günü"},t.prototype.weekdayNearestDayX0=function(){return"%s. günü sonrasındaki ilk iş günü"},t.prototype.commaOnTheX0OfTheMonth=function(){return", ayın %s"},t.prototype.commaEveryX0Days=function(){return", %s günde bir"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", ayın %s. ve %s. günleri arası"},t.prototype.commaOnDayX0OfTheMonth=function(){return", ayın %s. günü"},t.prototype.commaEveryX0Years=function(){return", %s yılda bir"},t.prototype.commaStartingX0=function(){return", başlangıç %s"},t.prototype.daysOfTheWeek=function(){return["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"]},t.prototype.monthsOfTheYear=function(){return["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"]},t.prototype.onTheHour=function(){return"saatin başında"},t}();s.tr=p},225(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.uk=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.everyMinute=function(){return"щохвилини"},t.prototype.everyHour=function(){return"щогодини"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"ВІдбулася помилка підчас генерації опису. Перевірта правильність написання cron виразу."},t.prototype.atSpace=function(){return"О "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Щохвилини між %s та %s"},t.prototype.at=function(){return"О"},t.prototype.spaceAnd=function(){return" та"},t.prototype.everySecond=function(){return"Щосекунди"},t.prototype.everyX0Seconds=function(){return"кожні %s секунд"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"з %s по %s секунду"},t.prototype.atX0SecondsPastTheMinute=function(){return"о %s секунді"},t.prototype.everyX0Minutes=function(){return"кожні %s хвилин"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"з %s по %s хвилину"},t.prototype.atX0MinutesPastTheHour=function(){return"о %s хвилині"},t.prototype.everyX0Hours=function(){return"кожні %s годин"},t.prototype.betweenX0AndX1=function(){return"між %s та %s"},t.prototype.atX0=function(){return"о %s"},t.prototype.commaEveryDay=function(){return", щоденно"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", кожен %s день тижня"},t.prototype.commaX0ThroughX1=function(){return", %s по %s"},t.prototype.commaAndX0ThroughX1=function(){return", та %s по %s"},t.prototype.first=function(){return"перший"},t.prototype.second=function(){return"другий"},t.prototype.third=function(){return"третій"},t.prototype.fourth=function(){return"четвертий"},t.prototype.fifth=function(){return"п'ятий"},t.prototype.commaOnThe=function(){return", в "},t.prototype.spaceX0OfTheMonth=function(){return" %s місяця"},t.prototype.lastDay=function(){return"останній день"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", в останній %s місяця"},t.prototype.commaOnlyOnX0=function(){return", тільки в %s"},t.prototype.commaAndOnX0=function(){return", і в %s"},t.prototype.commaEveryX0Months=function(){return", кожен %s місяць"},t.prototype.commaOnlyInX0=function(){return", тільки в %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", в останній день місяця"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", в останній будень місяця"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s днів до останнього дня місяця"},t.prototype.firstWeekday=function(){return"перший будень"},t.prototype.weekdayNearestDayX0=function(){return"будень найближчий до %s дня"},t.prototype.commaOnTheX0OfTheMonth=function(){return", в %s місяця"},t.prototype.commaEveryX0Days=function(){return", кожен %s день"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", між %s та %s днями місяця"},t.prototype.commaOnDayX0OfTheMonth=function(){return", на %s день місяця"},t.prototype.commaEveryX0Years=function(){return", кожні %s роки"},t.prototype.commaStartingX0=function(){return", початок %s"},t.prototype.daysOfTheWeek=function(){return["неділя","понеділок","вівторок","середа","четвер","п'ятниця","субота"]},t.prototype.monthsOfTheYear=function(){return["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"]},t.prototype.onTheHour=function(){return"рівно о годині"},t}();s.uk=p},292(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.vi=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return null},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"Đã xảy ra lỗi khi tạo mô tả biểu thức. Vui lòng kiểm tra cú pháp biểu thức cron."},t.prototype.everyMinute=function(){return"mỗi phút"},t.prototype.everyHour=function(){return"mỗi giờ"},t.prototype.atSpace=function(){return"Vào "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"Mỗi phút giữa %s and %s"},t.prototype.at=function(){return"Vào"},t.prototype.spaceAnd=function(){return" và"},t.prototype.everySecond=function(){return"mỗi giây"},t.prototype.everyX0Seconds=function(){return"mỗi %s giây"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"giây thứ %s qua phút thứ %s"},t.prototype.atX0SecondsPastTheMinute=function(){return"tại giây thứ %s của mỗi phút"},t.prototype.everyX0Minutes=function(){return"mỗi %s phút"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"phút thứ %s qua %s tiếng"},t.prototype.atX0MinutesPastTheHour=function(){return"vào %s phút của mỗi tiếng"},t.prototype.everyX0Hours=function(){return"mỗi %s tiếng"},t.prototype.betweenX0AndX1=function(){return"giữa %s và %s"},t.prototype.atX0=function(){return"vào %s"},t.prototype.commaEveryDay=function(){return", mỗi ngày"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", mỗi %s ngày trong tuần"},t.prototype.commaX0ThroughX1=function(){return", %s đến %s"},t.prototype.commaAndX0ThroughX1=function(){return", %s đến %s"},t.prototype.first=function(){return"đầu tiên"},t.prototype.second=function(){return"thứ 2"},t.prototype.third=function(){return"thứ 3"},t.prototype.fourth=function(){return"thứ 4"},t.prototype.fifth=function(){return"thứ 5"},t.prototype.commaOnThe=function(){return", trên "},t.prototype.spaceX0OfTheMonth=function(){return" %s của tháng"},t.prototype.lastDay=function(){return"ngày cuối cùng"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", vào ngày %s cuối cùng của tháng"},t.prototype.commaOnlyOnX0=function(){return", chỉ trên %s"},t.prototype.commaAndOnX0=function(){return", và hơn %s"},t.prototype.commaEveryX0Months=function(){return", mỗi ngày %s tháng"},t.prototype.commaOnlyInX0=function(){return", chỉ trong %s"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", vào ngày cuối cùng của tháng"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", vào ngày cuối tuần của tháng"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s ngày trước ngày cuối cùng của tháng"},t.prototype.firstWeekday=function(){return"ngày đầu tuần"},t.prototype.weekdayNearestDayX0=function(){return"ngày trong tuần ngày gần nhất %s"},t.prototype.commaOnTheX0OfTheMonth=function(){return", vào ngày %s của tháng"},t.prototype.commaEveryX0Days=function(){return", mỗi %s ngày"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", giữa ngày %s và %s trong tháng"},t.prototype.commaOnDayX0OfTheMonth=function(){return", vào %s ngày trong tháng"},t.prototype.commaEveryHour=function(){return", mỗi tiếng"},t.prototype.commaEveryX0Years=function(){return", mỗi %s năm"},t.prototype.commaStartingX0=function(){return", bắt đầu %s"},t.prototype.daysOfTheWeek=function(){return["Chủ nhật","Thứ 2","Thứ 3","Thứ 4","Thứ 5","Thứ 6","Thứ 7"]},t.prototype.monthsOfTheYear=function(){return["Tháng 1","Tháng 2","Tháng 3","Tháng 4","Tháng 5","Tháng 6","Tháng 7","Tháng 8","Tháng 9","Tháng 10","Tháng 11","Tháng 12"]},t.prototype.onTheHour=function(){return"đúng giờ"},t}();s.vi=p},571(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.zh_CN=void 0;var p=function(){function t(){}return t.prototype.setPeriodBeforeTime=function(){return!0},t.prototype.pm=function(){return"下午"},t.prototype.am=function(){return"上午"},t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return", 从%s年至%s年"},t.prototype.use24HourTimeFormatByDefault=function(){return!1},t.prototype.everyMinute=function(){return"每分钟"},t.prototype.everyHour=function(){return"每小时"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"生成表达式描述时发生了错误,请检查cron表达式语法。"},t.prototype.atSpace=function(){return"在"},t.prototype.everyMinuteBetweenX0AndX1=function(){return"在 %s 至 %s 之间的每分钟"},t.prototype.at=function(){return"在"},t.prototype.spaceAnd=function(){return" 和"},t.prototype.everySecond=function(){return"每秒"},t.prototype.everyX0Seconds=function(){return"每隔 %s 秒"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"在一分钟后的第 %s 到 %s 秒"},t.prototype.atX0SecondsPastTheMinute=function(){return"在一分钟后的第 %s 秒"},t.prototype.everyX0Minutes=function(){return"每隔 %s 分钟"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"在整点后的第 %s 到 %s 分钟"},t.prototype.atX0MinutesPastTheHour=function(){return"在整点后的第 %s 分钟"},t.prototype.everyX0Hours=function(){return"每隔 %s 小时"},t.prototype.betweenX0AndX1=function(){return"在 %s 和 %s 之间"},t.prototype.atX0=function(){return"在%s"},t.prototype.commaEveryDay=function(){return", 每天"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", 每周的每 %s 天"},t.prototype.commaX0ThroughX1=function(){return", %s至%s"},t.prototype.commaAndX0ThroughX1=function(){return", 和%s至%s"},t.prototype.first=function(){return"第一个"},t.prototype.second=function(){return"第二个"},t.prototype.third=function(){return"第三个"},t.prototype.fourth=function(){return"第四个"},t.prototype.fifth=function(){return"第五个"},t.prototype.commaOnThe=function(){return", 限每月的"},t.prototype.spaceX0OfTheMonth=function(){return"%s"},t.prototype.lastDay=function(){return"本月最后一天"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", 限每月的最后一个%s"},t.prototype.commaOnlyOnX0=function(){return", 仅%s"},t.prototype.commaAndOnX0=function(){return", 或者为%s"},t.prototype.commaEveryX0Months=function(){return", 每隔 %s 个月"},t.prototype.commaOnlyInX0=function(){return", 仅限%s"},t.prototype.commaOnlyInMonthX0=function(){return", 仅于%s份"},t.prototype.commaOnlyInYearX0=function(){return", 仅于 %s 年"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", 限每月的最后一天"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", 限每月的最后一个工作日"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", 限每月最后%s天"},t.prototype.firstWeekday=function(){return"第一个工作日"},t.prototype.weekdayNearestDayX0=function(){return"最接近 %s 号的工作日"},t.prototype.commaOnTheX0OfTheMonth=function(){return", 限每月的%s"},t.prototype.commaEveryX0Days=function(){return", 每隔 %s 天"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", 限每月的 %s 至 %s 之间"},t.prototype.commaOnDayX0OfTheMonth=function(){return", 限每月%s"},t.prototype.commaEveryX0Years=function(){return", 每隔 %s 年"},t.prototype.commaStartingX0=function(){return", %s开始"},t.prototype.dayX0=function(){return" %s 号"},t.prototype.daysOfTheWeek=function(){return["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},t.prototype.monthsOfTheYear=function(){return["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},t.prototype.onTheHour=function(){return"整点"},t}();s.zh_CN=p},983(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.zh_TW=void 0;var p=function(){function t(){}return t.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},t.prototype.atX0MinutesPastTheHourGt20=function(){return null},t.prototype.commaMonthX0ThroughMonthX1=function(){return null},t.prototype.commaYearX0ThroughYearX1=function(){return", 從 %s 年至 %s 年"},t.prototype.use24HourTimeFormatByDefault=function(){return!0},t.prototype.everyMinute=function(){return"每分鐘"},t.prototype.everyHour=function(){return"每小時"},t.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"產生表達式描述時發生了錯誤,請檢查 cron 表達式語法。"},t.prototype.atSpace=function(){return"在 "},t.prototype.everyMinuteBetweenX0AndX1=function(){return"在 %s 和 %s 之間的每分鐘"},t.prototype.at=function(){return"在"},t.prototype.spaceAnd=function(){return" 和"},t.prototype.everySecond=function(){return"每秒"},t.prototype.everyX0Seconds=function(){return"每 %s 秒"},t.prototype.secondsX0ThroughX1PastTheMinute=function(){return"在一分鐘後的 %s 到 %s 秒"},t.prototype.atX0SecondsPastTheMinute=function(){return"在一分鐘後的 %s 秒"},t.prototype.everyX0Minutes=function(){return"每 %s 分鐘"},t.prototype.minutesX0ThroughX1PastTheHour=function(){return"在整點後的 %s 到 %s 分鐘"},t.prototype.atX0MinutesPastTheHour=function(){return"在整點後的 %s 分"},t.prototype.everyX0Hours=function(){return"每 %s 小時"},t.prototype.betweenX0AndX1=function(){return"在 %s 和 %s 之間"},t.prototype.atX0=function(){return"在 %s"},t.prototype.commaEveryDay=function(){return", 每天"},t.prototype.commaEveryX0DaysOfTheWeek=function(){return", 每週的每 %s 天"},t.prototype.commaX0ThroughX1=function(){return", %s 到 %s"},t.prototype.commaAndX0ThroughX1=function(){return", 和 %s 到 %s"},t.prototype.first=function(){return"第一個"},t.prototype.second=function(){return"第二個"},t.prototype.third=function(){return"第三個"},t.prototype.fourth=function(){return"第四個"},t.prototype.fifth=function(){return"第五個"},t.prototype.commaOnThe=function(){return", 在每月 "},t.prototype.spaceX0OfTheMonth=function(){return"%s "},t.prototype.lastDay=function(){return"最後一天"},t.prototype.commaOnTheLastX0OfTheMonth=function(){return", 每月的最後一個 %s "},t.prototype.commaOnlyOnX0=function(){return", 僅在 %s"},t.prototype.commaAndOnX0=function(){return", 或 %s"},t.prototype.commaEveryX0Months=function(){return", 每 %s 月"},t.prototype.commaOnlyInX0=function(){return", 僅在 %s"},t.prototype.commaOnlyInMonthX0=function(){return", 僅在 %s"},t.prototype.commaOnlyInYearX0=function(){return", 僅在 %s 年"},t.prototype.commaOnTheLastDayOfTheMonth=function(){return", 每月的最後一天"},t.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", 每月的最後一個工作日"},t.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s 這個月的最後一天的前幾天"},t.prototype.firstWeekday=function(){return"第一個工作日"},t.prototype.weekdayNearestDayX0=function(){return"最接近 %s 號的工作日"},t.prototype.commaOnTheX0OfTheMonth=function(){return", 每月的 %s "},t.prototype.commaEveryX0Days=function(){return", 每 %s 天"},t.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", 在每月的 %s 和 %s 之間"},t.prototype.commaOnDayX0OfTheMonth=function(){return", 每月的 %s"},t.prototype.commaEveryX0Years=function(){return", 每 %s 年"},t.prototype.commaStartingX0=function(){return", %s 開始"},t.prototype.dayX0=function(){return" %s 號"},t.prototype.daysOfTheWeek=function(){return["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},t.prototype.monthsOfTheYear=function(){return["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},t.prototype.onTheHour=function(){return"整點"},t}();s.zh_TW=p},515(d,s){Object.defineProperty(s,"__esModule",{value:!0});function p(x,h){if(!x)throw new Error(h)}var t=function(){function x(){}return x.secondRange=function(h){for(var a=h.split(","),i=0;i<a.length;i++)if(!isNaN(parseInt(a[i],10))){var g=parseInt(a[i],10);p(g>=0&&g<=59,"seconds part must be >= 0 and <= 59")}},x.minuteRange=function(h){for(var a=h.split(","),i=0;i<a.length;i++)if(!isNaN(parseInt(a[i],10))){var g=parseInt(a[i],10);p(g>=0&&g<=59,"minutes part must be >= 0 and <= 59")}},x.hourRange=function(h){for(var a=h.split(","),i=0;i<a.length;i++)if(!isNaN(parseInt(a[i],10))){var g=parseInt(a[i],10);p(g>=0&&g<=23,"hours part must be >= 0 and <= 23")}},x.dayOfMonthRange=function(h){for(var a=h.split(","),i=0;i<a.length;i++)if(!isNaN(parseInt(a[i],10))){var g=parseInt(a[i],10);p(g>=1&&g<=31,"DOM part must be >= 1 and <= 31")}},x.monthRange=function(h,a){for(var i=h.split(","),g=0;g<i.length;g++)if(!isNaN(parseInt(i[g],10))){var v=parseInt(i[g],10);p(v>=1&&v<=12,a?"month part must be >= 0 and <= 11":"month part must be >= 1 and <= 12")}},x.dayOfWeekRange=function(h,a){for(var i=h.split(","),g=0;g<i.length;g++)if(!isNaN(parseInt(i[g],10))){var v=parseInt(i[g],10);p(v>=0&&v<=6,a?"DOW part must be >= 0 and <= 6":"DOW part must be >= 1 and <= 7")}},x}();s.default=t},823(d,s){Object.defineProperty(s,"__esModule",{value:!0}),s.StringUtilities=void 0;var p=function(){function t(){}return t.format=function(x){for(var h=[],a=1;a<arguments.length;a++)h[a-1]=arguments[a];return x.replace(/%s/g,function(i){return h.shift()})},t.containsAny=function(x,h){return h.some(function(a){return x.indexOf(a)>-1})},t}();s.StringUtilities=p}},u={};function c(d){var s=u[d];if(s!==void 0)return s.exports;var p=u[d]={exports:{}};return l[d](p,p.exports,c),p.exports}var m={};return(()=>{var d=m;Object.defineProperty(d,"__esModule",{value:!0}),d.toString=void 0;var s=c(333),p=c(420);s.ExpressionDescriptor.initialize(new p.allLocalesLoader),d.default=s.ExpressionDescriptor;var t=s.ExpressionDescriptor.toString;d.toString=t})(),m})())}(Sn)),Sn.exports}var Tn,Uo;function sc(){if(Uo)return Tn;Uo=1;var r=oc();return Tn=r,Tn}var ac=sc();const ic=Zr(ac);function Ls(r){try{const o=r.trim().split(/\s+/);if(o.length!==5)return r;const[l,u,c,m,d]=o,s=ic.toString(r,{locale:"zh_CN",use24HourTimeFormat:!0}),p=c==="*"&&m==="*"&&d==="*",t=!u.includes("*")&&!u.includes("/")&&!l.includes("*")&&!l.includes("/");return p&&t&&!s.includes("每")?"每天 "+s.replace(/^在\s*/,""):s}catch{return r}}function Go(r){return r?new Date(r).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"从未"}function lc({mode:r,intervalMin:o,hour:l,minute:u,dow:c,dom:m}){switch(r){case"interval":return`*/${o} * * * *`;case"hourly":return`${u} * * * *`;case"daily":return`${u} ${l} * * *`;case"weekly":return`${u} ${l} * * ${c}`;case"monthly":return`${u} ${l} ${m} * *`;default:return`${u} ${l} * * *`}}function cc(r){const o={mode:"daily",intervalMin:10,hour:9,minute:0,dow:1,dom:1};if(!r)return o;try{const[l,u,c,m,d]=r.trim().split(/\s+/);if(l.startsWith("*/")&&u==="*"&&c==="*"&&m==="*"&&d==="*")return{...o,mode:"interval",intervalMin:parseInt(l.slice(2))||10};if(!l.includes("*")&&!l.includes("/")&&u==="*"&&c==="*"&&m==="*"&&d==="*")return{...o,mode:"hourly",minute:parseInt(l)};if(!l.includes("*")&&!l.includes("/")&&!u.includes("*")&&!u.includes("/")&&c==="*"&&m==="*"&&d==="*")return{...o,mode:"daily",hour:parseInt(u),minute:parseInt(l)};if(!l.includes("*")&&!l.includes("/")&&!u.includes("*")&&!u.includes("/")&&c==="*"&&m==="*"&&!d.includes("*")&&!d.includes("/"))return{...o,mode:"weekly",hour:parseInt(u),minute:parseInt(l),dow:parseInt(d)};if(!l.includes("*")&&!l.includes("/")&&!u.includes("*")&&!u.includes("/")&&!c.includes("*")&&!c.includes("/")&&m==="*"&&d==="*")return{...o,mode:"monthly",hour:parseInt(u),minute:parseInt(l),dom:parseInt(c)}}catch{}return o}const dc=["周日","周一","周二","周三","周四","周五","周六"],uc=[5,10,15,20,30,45,60],pc=[{value:"interval",label:"每隔N分钟"},{value:"hourly",label:"每小时"},{value:"daily",label:"每天"},{value:"weekly",label:"每周"},{value:"monthly",label:"每月"}],Kt="rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 text-sm px-2 pr-7 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500";function Xn({hour:r,minute:o,onChange:l}){const u=Array.from({length:24},(m,d)=>d),c=Array.from({length:60},(m,d)=>d);return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("select",{value:r,onChange:m=>l({hour:parseInt(m.target.value),minute:o}),className:Kt,children:u.map(m=>e.jsx("option",{value:m,children:String(m).padStart(2,"0")},m))}),e.jsx("span",{className:"text-gray-500 dark:text-gray-400 font-medium",children:":"}),e.jsx("select",{value:o,onChange:m=>l({hour:r,minute:parseInt(m.target.value)}),className:Kt,children:c.map(m=>e.jsx("option",{value:m,children:String(m).padStart(2,"0")},m))})]})}function mc({value:r,onChange:o}){const{mode:l,intervalMin:u,hour:c,minute:m,dow:d,dom:s}=r,p=t=>o({...r,...t});return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"频率"}),e.jsx("select",{value:l,onChange:t=>p({mode:t.target.value}),className:Kt,children:pc.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))})]}),l==="interval"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"间隔"}),e.jsx("select",{value:u,onChange:t=>p({intervalMin:parseInt(t.target.value)}),className:Kt,children:uc.map(t=>e.jsxs("option",{value:t,children:["每 ",t," 分钟"]},t))})]}),l==="hourly"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"分钟"}),e.jsx("select",{value:m,onChange:t=>p({minute:parseInt(t.target.value)}),className:Kt,children:Array.from({length:60},(t,x)=>x).map(t=>e.jsxs("option",{value:t,children:["每小时第 ",String(t).padStart(2,"0")," 分"]},t))})]}),l==="daily"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"时间"}),e.jsx(Xn,{hour:c,minute:m,onChange:p})]}),l==="weekly"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"星期"}),e.jsx("div",{className:"flex gap-1 flex-wrap",children:dc.map((t,x)=>e.jsx("button",{type:"button",onClick:()=>p({dow:x}),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${d===x?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600"}`,children:t},x))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"时间"}),e.jsx(Xn,{hour:c,minute:m,onChange:p})]})]}),l==="monthly"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"几号"}),e.jsx("select",{value:s,onChange:t=>p({dom:parseInt(t.target.value)}),className:Kt,children:Array.from({length:31},(t,x)=>x+1).map(t=>e.jsxs("option",{value:t,children:["每月 ",t," 号"]},t))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-gray-600 dark:text-gray-400 w-16 shrink-0",children:"时间"}),e.jsx(Xn,{hour:c,minute:m,onChange:p})]})]})]})}const fc={mode:"daily",intervalMin:10,hour:9,minute:0,dow:1,dom:1};function hc({editTask:r,onClose:o,onSave:l}){const[u,c]=n.useState(r?.prompt||""),[m,d]=n.useState(r?cc(r.cronExpr):fc),[s,p]=n.useState(r?.channel||""),[t,x]=n.useState(r?.webhookUrl||""),[h,a]=n.useState(r?r.recurring:!0),[i,g]=n.useState(r?.projectPath||""),[v,k]=n.useState([]),[b,j]=n.useState(!1),[f,w]=n.useState(!1),[N,L]=n.useState("");n.useEffect(()=>{me.auth.feishuStatus().then(D=>D.json()).then(D=>j(!!D.bound)).catch(()=>{}),me.projects().then(D=>D.json()).then(D=>{const $=Array.isArray(D)?D:D.projects||[];k($),!r&&$.length>0&&!i&&g($[0].fullPath)}).catch(()=>{})},[]);const E=lc(m),S=Ls(E),R=!!r,M=async()=>{if(!u.trim()){L("请填写执行内容");return}if(s==="webhook"&&!t.trim()){L("Webhook 渠道需要填写 URL");return}w(!0),L("");try{const D={cronExpr:E,prompt:u.trim(),recurring:h,channel:s,webhookUrl:t.trim()||void 0,projectPath:i||void 0},$=R?`/api/cron-tasks/${r.id}`:"/api/cron-tasks",T=await J($,{method:R?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)}),X=await T.json();if(!T.ok){L(X.error||"保存失败");return}l(X.task)}catch{L("网络错误,请重试")}finally{w(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",onClick:D=>D.target===D.currentTarget&&o(),children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl w-full max-w-lg max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:R?"编辑定时任务":"新建定时任务"}),e.jsx("button",{onClick:o,className:"p-1 rounded-md text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700",children:e.jsx(Ge,{size:18})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-5",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"执行项目"}),v.length===0?e.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500",children:"加载中…"}):e.jsx("select",{value:i,onChange:D=>g(D.target.value),className:`w-full ${Kt}`,children:v.map(D=>e.jsx("option",{value:D.fullPath,children:D.displayName},D.fullPath))})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"执行内容"}),e.jsx("textarea",{value:u,onChange:D=>c(D.target.value),rows:3,placeholder:"例:帮我总结今天的待办事项,以简洁清单形式呈现",className:"w-full rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 text-sm px-3 py-2 resize-none focus:outline-none focus:ring-2 focus:ring-blue-500 placeholder-gray-400 dark:placeholder-gray-500"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"执行频率"}),e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700/50 rounded-lg p-3 space-y-3",children:[e.jsx(mc,{value:m,onChange:d}),e.jsxs("div",{className:"pt-2 border-t border-gray-200 dark:border-gray-600 flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-blue-600 dark:text-blue-400",children:S}),e.jsx("code",{className:"text-xs font-mono text-gray-400 dark:text-gray-500",children:E})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:"投递渠道"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{value:"",icon:e.jsx(Cr,{size:14}),label:"网页端"},{value:"feishu",icon:e.jsx(Er,{size:14}),label:"飞书",disabled:!b,tip:"未绑定飞书"},{value:"webhook",icon:e.jsx(mr,{size:14}),label:"Webhook"}].map(D=>e.jsxs("button",{type:"button",disabled:D.disabled,onClick:()=>!D.disabled&&p(D.value),title:D.disabled?D.tip:void 0,className:`flex items-center justify-center gap-1.5 py-2 rounded-lg border text-sm font-medium transition-colors ${D.disabled?"opacity-40 cursor-not-allowed border-gray-200 dark:border-gray-700 text-gray-400":s===D.value?"border-blue-500 bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400":"border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700"}`,children:[D.icon,D.label]},D.value))}),s==="webhook"&&e.jsx("input",{type:"url",value:t,onChange:D=>x(D.target.value),placeholder:"https://your-webhook-url.com/...",className:"w-full rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 text-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 placeholder-gray-400 dark:placeholder-gray-500"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"单次执行"}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"开启后触发一次即自动删除"})]}),e.jsx("button",{type:"button",onClick:()=>a(D=>!D),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${h?"bg-gray-300 dark:bg-gray-600":"bg-blue-600"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform ${h?"translate-x-1":"translate-x-6"}`})})]}),N&&e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:N})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("button",{onClick:o,className:"px-4 py-2 text-sm text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100 transition-colors",children:"取消"}),e.jsx("button",{onClick:M,disabled:f,className:"px-4 py-2 text-sm font-medium rounded-lg bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-60 transition-colors",children:f?"保存中…":"保存"})]})]})})}function xc({channel:r}){return r==="feishu"?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300",children:[e.jsx(Er,{size:10})," 飞书"]}):r==="webhook"?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300",children:[e.jsx(mr,{size:10})," Webhook"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300",children:[e.jsx(Cr,{size:10})," 网页"]})}function gc(){const[r,o]=n.useState([]),[l,u]=n.useState(!0),[c,m]=n.useState(null),[d,s]=n.useState(null),{showConfirm:p}=lt(),t=n.useCallback(async()=>{u(!0);try{const i=await J("/api/cron-tasks");if(i.ok){const g=await i.json();o(g.tasks||[])}}catch(i){console.error("Failed to fetch cron tasks",i)}finally{u(!1)}},[]);n.useEffect(()=>{t()},[t]);const x=async i=>{m(i.id);try{const g=await J(`/api/cron-tasks/${i.id}/pause`,{method:"PATCH"});if(g.ok){const v=await g.json();o(k=>k.map(b=>b.id===i.id?{...b,isPaused:v.isPaused}:b))}}catch(g){console.error("Toggle pause failed",g)}finally{m(null)}},h=async i=>{if(await p(`确定要删除定时任务吗?
161
161
 
162
- ${i.cronExpr} — ${i.prompt.slice(0,60)}${i.prompt.length>60?"…":""}`,{title:"删除定时任务",variant:"danger",confirmText:"删除",cancelText:"取消"})){m(i.id);try{(await J(`/api/cron-tasks/${i.id}`,{method:"DELETE"})).ok&&o(k=>k.filter(b=>b.id!==i.id))}catch(v){console.error("Delete failed",v)}finally{m(null)}}},a=i=>{o(d==="create"?g=>[...g,i]:g=>g.map(v=>v.id===i.id?i:v)),s(null)};return l?e.jsxs("div",{className:"flex items-center justify-center py-16 text-gray-400 dark:text-gray-500",children:[e.jsx(st,{size:18,className:"animate-spin mr-2"})," 加载中…"]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"管理定时任务,可新建、编辑、暂停或删除。"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(U,{variant:"outline",size:"sm",onClick:t,className:"flex items-center gap-1.5",children:[e.jsx(st,{size:14})," 刷新"]}),e.jsxs(U,{variant:"outline",size:"sm",onClick:()=>s("create"),className:"flex items-center gap-1.5",children:[e.jsx(zt,{size:14})," 新建任务"]})]})]}),r.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-gray-400 dark:text-gray-500 gap-3",children:[e.jsx(Mr,{size:32,className:"opacity-40"}),e.jsx("p",{className:"text-sm",children:"暂无定时任务"}),e.jsx("button",{onClick:()=>s("create"),className:"text-xs text-blue-500 hover:text-blue-600 dark:text-blue-400",children:"+ 创建第一个定时任务"})]}):e.jsx("div",{className:"space-y-2",children:r.map(i=>e.jsx("div",{className:`rounded-lg border p-4 transition-colors ${i.isPaused?"border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800/50 opacity-70":"border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800"}`,children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-200",title:i.cronExpr,children:Ls(i.cronExpr)}),e.jsx("code",{className:"text-xs font-mono text-gray-400 dark:text-gray-500",children:i.cronExpr}),e.jsx(xc,{channel:i.channel}),!i.recurring&&e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",children:"单次"}),i.isPaused&&e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-gray-200 text-gray-600 dark:bg-gray-600 dark:text-gray-300",children:"已暂停"})]}),e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 truncate",title:i.prompt,children:i.prompt.length>80?i.prompt.slice(0,80)+"…":i.prompt}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-400 dark:text-gray-500 flex-wrap",children:[e.jsxs("span",{children:["最近触发:",Go(i.lastFiredAt)]}),e.jsxs("span",{children:["创建:",Go(i.createdAt)]}),i.sessionMode==="resume_session"&&e.jsx("span",{children:"复用会话"})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:()=>x(i),disabled:c===i.id,title:i.isPaused?"恢复":"暂停",className:"p-1.5 rounded-md text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:hover:text-gray-200 dark:hover:bg-gray-700 disabled:opacity-40 transition-colors",children:i.isPaused?e.jsx(Aa,{size:15}):e.jsx(La,{size:15})}),e.jsx("button",{onClick:()=>s(i),disabled:c===i.id,title:"编辑",className:"p-1.5 rounded-md text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:hover:text-gray-200 dark:hover:bg-gray-700 disabled:opacity-40 transition-colors",children:e.jsx(_a,{size:15})}),e.jsx("button",{onClick:()=>h(i),disabled:c===i.id,title:"删除",className:"p-1.5 rounded-md text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 disabled:opacity-40 transition-colors",children:e.jsx(vt,{size:15})})]})]})},i.id))})]}),d!==null&&e.jsx(hc,{editTask:d==="create"?null:d,onClose:()=>s(null),onSave:a})]})}function yc({onClose:r,onChanged:o}){const{showAlert:l,showConfirm:u}=lt(),[c,m]=n.useState([]),[d,s]=n.useState(!0),[p,t]=n.useState(null),[x,h]=n.useState(""),[a,i]=n.useState(!1),[g,v]=n.useState(null);n.useEffect(()=>{k()},[]);const k=async()=>{try{s(!0),t(null);const f=await J("/api/mcp-repos");if(f.ok){const w=await f.json();m(w.repos||[])}else{const w=await f.json();t(w.error||"Failed to fetch repos")}}catch(f){t(f.message)}finally{s(!1)}},b=async f=>{if(f.preventDefault(),!x.trim()){t("请输入仓库 URL");return}try{i(!0),t(null);const w=await J("/api/mcp-repos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:x.trim()})});if(w.ok)h(""),k(),o?.();else{const S=await w.json();t(S.error||"Failed to add repo")}}catch(w){t(w.message)}finally{i(!1)}},j=async(f,w)=>{if(await u(`确定要移除仓库 "${f}/${w}" 吗?`,{title:"移除仓库",variant:"danger",confirmText:"确认移除"}))try{v(`${f}/${w}`);const S=await J(`/api/mcp-repos/${f}/${w}`,{method:"DELETE"});if(S.ok)k(),o?.();else{const z=await S.json();l(z.error||"移除仓库失败",{variant:"error"})}}catch(S){l(S.message,{variant:"error"})}finally{v(null)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[10000] p-4",children:e.jsxs("div",{className:"bg-background rounded-xl shadow-xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 p-4 border-b border-border",children:[e.jsx(U,{variant:"ghost",size:"icon",onClick:r,children:e.jsx(Qt,{className:"w-5 h-5"})}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"管理 MCP 仓库"})]}),e.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-6",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4 space-y-4",children:[e.jsx("h3",{className:"font-medium text-foreground",children:"添加 MCP 仓库"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["仓库中每个文件夹代表一个 MCP 服务,需包含 ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded",children:"mcp.json"}),"(配置)和 ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded",children:"mcp.yaml"}),"(说明)。"]}),e.jsxs("form",{onSubmit:b,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-muted-foreground mb-1",children:"仓库 URL"}),e.jsx(ct,{type:"text",placeholder:"owner/name 或 https://github.com/owner/name",value:x,onChange:f=>h(f.target.value),disabled:a})]}),e.jsxs(U,{type:"submit",disabled:a||!x.trim(),className:"bg-purple-600 hover:bg-purple-700 text-white",children:[e.jsx(zt,{className:"w-4 h-4 mr-2"}),a?"添加中...":"添加仓库"]})]})]}),p&&e.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-800 dark:text-red-200 text-sm",children:p}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-medium text-foreground",children:"已添加的仓库"}),d?e.jsx("div",{className:"text-center py-4 text-muted-foreground",children:"加载中..."}):c.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(ns,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"还没有添加任何 MCP 仓库"})]}):c.map(f=>e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-medium text-foreground",children:[f.owner,"/",f.repo]}),f.isSystem&&e.jsx(nt,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300",children:"内置"})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(rn,{className:"w-3 h-3"}),"分支: main"]}),e.jsxs(nt,{variant:"outline",className:"text-xs",children:[f.serviceCount," 个 MCP 服务"]})]})]}),e.jsx("div",{className:"flex items-center gap-2 ml-4",children:!f.isSystem&&e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>j(f.owner,f.repo),disabled:g===`${f.owner}/${f.repo}`,className:"text-red-500 hover:text-red-600",children:e.jsx(vt,{className:"w-4 h-4"})})})]})},`${f.owner}/${f.repo}`))]})]})]})})}const bc=r=>{switch(r){case"stdio":return e.jsx(Gn,{className:"w-3 h-3"});case"sse":return e.jsx(Cr,{className:"w-3 h-3"});case"http":return e.jsx(mr,{className:"w-3 h-3"});default:return e.jsx(tn,{className:"w-3 h-3"})}};function vc({onClose:r,onInstalled:o,onOpenRepoManager:l,projects:u=[]}){const{showAlert:c,showConfirm:m}=lt(),[d,s]=n.useState([]),[p,t]=n.useState([]),[x,h]=n.useState(!0),[a,i]=n.useState(null),[g,v]=n.useState(""),[k,b]=n.useState("all"),[j,f]=n.useState(null),[w,S]=n.useState(null),[z,D]=n.useState(null),[N,R]=n.useState("user"),[M,E]=n.useState("");n.useEffect(()=>{$()},[]);const $=async(G=!1)=>{try{h(!0),i(null),G&&await J("/api/mcp-repos/refresh",{method:"POST"});const[le,de]=await Promise.all([J("/api/mcp-repos/available"),J("/api/mcp-repos")]);if(le.ok){const fe=await le.json();s(fe.services||[])}if(de.ok){const fe=await de.json();t(fe.repos||[])}}catch(le){i(le.message)}finally{h(!1)}},T=G=>{D(G),R("user"),E("")},X=()=>{D(null),R("user"),E("")},_=async()=>{const G=z;if(G){if(N==="local"&&!M){c("请选择要安装到的项目",{variant:"warning"});return}try{D(null),f(G.dirName+G.repository);const le={servicePath:G.path,scope:N};N==="local"&&M&&(le.projectPath=M);const de=await J("/api/mcp-repos/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(le)});if(de.ok)$(),o?.();else{const fe=await de.json();c(fe.error||"安装 MCP 服务失败",{variant:"error"})}}catch(le){c(le.message,{variant:"error"})}finally{f(null),R("user"),E("")}}},te=async G=>{if(!(!G.serverNames||G.serverNames.length===0)&&await m(`确定要卸载 "${G.name}" 吗?这将移除 ${G.serverNames.join(", ")} 的配置。`,{title:"卸载 MCP 服务",variant:"danger",confirmText:"确认卸载"}))try{S(G.dirName+G.repository);for(const le of G.serverNames)await J(`/api/mcp-repos/uninstall/${encodeURIComponent(le)}`,{method:"DELETE"});$(),o?.()}catch(le){c(le.message,{variant:"error"})}finally{S(null)}},ne=d.filter(G=>{if(g){const le=g.toLowerCase();if(!G.dirName?.toLowerCase().includes(le)&&!G.name?.toLowerCase().includes(le)&&!G.description?.toLowerCase().includes(le))return!1}return!(k!=="all"&&G.repository!==k)});return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[10000] p-4",children:e.jsxs("div",{className:"bg-background rounded-xl shadow-xl w-full max-w-4xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"MCP 仓库"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(U,{variant:"ghost",size:"sm",onClick:()=>$(!0),disabled:x,children:[e.jsx(st,{className:`w-4 h-4 ${x?"animate-spin":""}`}),e.jsx("span",{className:"ml-1 hidden sm:inline",children:"刷新"})]}),e.jsxs(U,{variant:"ghost",size:"sm",onClick:l,children:[e.jsx(Ut,{className:"w-4 h-4"}),e.jsx("span",{className:"ml-1 hidden sm:inline",children:"仓库管理"})]}),e.jsx(U,{variant:"ghost",size:"icon",onClick:r,children:e.jsx(Ge,{className:"w-5 h-5"})})]})]}),e.jsx("div",{className:"px-4 pt-4 pb-2"}),e.jsxs("div",{className:"px-4 pb-4 flex flex-wrap gap-3",children:[e.jsx("div",{className:"flex-1 min-w-[200px]",children:e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(ct,{type:"text",placeholder:"搜索 MCP 服务名称或描述...",value:g,onChange:G=>v(G.target.value),className:"pl-10"})]})}),e.jsxs("select",{value:k,onChange:G=>b(G.target.value),className:"px-3 py-2 rounded-md border border-border bg-background text-foreground text-sm min-w-[120px]",children:[e.jsx("option",{value:"all",children:"全部仓库"}),p.map(G=>e.jsxs("option",{value:`${G.owner}/${G.repo}`,children:[G.owner,"/",G.repo]},`${G.owner}/${G.repo}`))]})]}),e.jsxs("div",{className:"flex-1 overflow-auto px-4 pb-4",children:[a&&e.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-800 dark:text-red-200 text-sm mb-4",children:a}),x?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):ne.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:d.length===0?e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"没有可用的 MCP 服务"}),e.jsx("p",{className:"text-xs mt-2",children:"请先添加 MCP 仓库"}),e.jsxs(U,{variant:"outline",size:"sm",className:"mt-4",onClick:l,children:[e.jsx(Ut,{className:"w-4 h-4 mr-2"}),"管理仓库"]})]}):e.jsx("p",{children:"没有找到匹配的 MCP 服务"})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:ne.map(G=>{const le=`${G.repository}-${G.dirName}`,de=j===G.dirName+G.repository,fe=w===G.dirName+G.repository,Ee=z&&z.dirName+z.repository===G.dirName+G.repository;return e.jsx("div",{className:"border border-border rounded-lg p-4 hover:border-purple-500/50 transition-colors",children:e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-medium text-foreground",children:G.name||G.dirName}),e.jsxs(nt,{variant:"outline",className:"text-xs flex items-center gap-1",children:[bc(G.type),G.type]})]}),e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:G.repository}),G.serverNames?.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["· ",G.serverNames.join(", ")]})]})]}),G.description&&e.jsx("p",{className:"text-sm text-muted-foreground flex-1 line-clamp-3 mb-3",children:G.description}),Ee&&e.jsxs("div",{className:"mt-2 mb-3 p-3 rounded-lg bg-muted/50 border border-border text-sm",children:[e.jsx("p",{className:"font-medium text-foreground mb-2",children:"选择安装位置"}),e.jsxs("label",{className:"flex items-center gap-2 mb-1 cursor-pointer",children:[e.jsx("input",{type:"radio",name:`scope-${le}`,value:"user",checked:N==="user",onChange:()=>{R("user"),E("")},className:"accent-purple-600"}),e.jsx("span",{className:"text-foreground",children:"全局(所有项目可用)"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"radio",name:`scope-${le}`,value:"local",checked:N==="local",onChange:()=>R("local"),className:"accent-purple-600"}),e.jsx("span",{className:"text-foreground",children:"安装到指定项目"})]}),N==="local"&&e.jsxs("select",{value:M,onChange:ge=>E(ge.target.value),className:"mt-2 w-full px-2 py-1.5 rounded-md border border-border bg-background text-foreground text-xs",children:[e.jsx("option",{value:"",children:"选择项目..."}),u.map(ge=>e.jsx("option",{value:ge.path||ge.fullPath,children:ge.displayName||ge.name},ge.name))]}),e.jsxs("div",{className:"flex gap-2 mt-3",children:[e.jsx(U,{size:"sm",variant:"outline",onClick:X,className:"flex-1",children:"取消"}),e.jsx(U,{size:"sm",className:"bg-purple-600 hover:bg-purple-700 text-white flex-1",onClick:_,children:"确认安装"})]})]}),e.jsx("div",{className:"flex items-center gap-2 mt-auto pt-2",children:G.installed?e.jsxs(U,{size:"sm",variant:"outline",className:"ml-auto text-red-600 hover:text-red-700 border-red-200 hover:border-red-300",onClick:()=>te(G),disabled:fe,children:[e.jsx(vt,{className:"w-4 h-4 mr-1"}),fe?"卸载中...":"卸载"]}):!Ee&&e.jsxs(U,{size:"sm",className:"bg-purple-600 hover:bg-purple-700 text-white ml-auto",onClick:()=>T(G),disabled:de||!!z,children:[e.jsx(It,{className:"w-4 h-4 mr-1"}),de?"安装中...":"安装"]})})]})},le)})})]})]})})}function jc({isOpen:r,onClose:o,projects:l=[],initialTab:u="shared_projects",autoScrollToBottom:c,onAutoScrollChange:m,sendByCtrlEnter:d,onSendByCtrlEnterChange:s}){const p=Qr(),{isDarkMode:t,toggleDarkMode:x}=no(),{user:h,logout:a,hasPermission:i}=Ot(),{showAlert:g,showConfirm:v}=lt(),[k,b]=n.useState([]),[j,f]=n.useState([]),[w,S]=n.useState(""),[z,D]=n.useState(""),[N,R]=n.useState(!1),[M,E]=n.useState(!1),[$,T]=n.useState(null),[X,_]=n.useState("name"),[te,ne]=n.useState([]),[G,le]=n.useState(!1),[de,fe]=n.useState(null),[Ee,ge]=n.useState(!1),[Me,Fe]=n.useState(!1),[ae,Ne]=n.useState({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),[He,Be]=n.useState(!1),[he,Oe]=n.useState({}),[De,Ye]=n.useState({}),[Te,Je]=n.useState({}),[Ce,Re]=n.useState(u),[$e,Ie]=n.useState(""),[ze,Ze]=n.useState("permissions"),Qe=i("tab_permissions")||i("tab_mcp")||i("tab_skills")||i("tab_models");n.useEffect(()=>{const W={permissions:"tab_permissions",mcp:"tab_mcp",skills:"tab_skills",models:"tab_models"},ee=W[ze];if(ee&&!i(ee)){const _e=["permissions","mcp","skills","models"].find(ut=>{const Ke=W[ut];return!Ke||i(Ke)});_e&&Ze(_e)}},[i,ze]),n.useEffect(()=>{Ce==="agents"&&!Qe&&Re("shared_projects")},[Ce,Qe]);const K=n.useRef(null),[B,C]=n.useState({saving:!1,hasChanges:!1}),V=n.useCallback(W=>C(W),[]),[I,re]=n.useState(""),[Y,ie]=n.useState(""),[ce,Ae]=n.useState(""),[Xe,Le]=n.useState(""),[oe,ye]=n.useState(""),[at,Pe]=n.useState(!1),[dt,gt]=n.useState(""),[F,Se]=n.useState(!1),[O,se]=n.useState(""),[je,ke]=n.useState(!1),[Z,We]=n.useState(null),[tt,ft]=n.useState(()=>localStorage.getItem("codeEditorTheme")||"dark"),[ht,hr]=n.useState(()=>localStorage.getItem("codeEditorWordWrap")==="true"),[jt,et]=n.useState(()=>localStorage.getItem("codeEditorShowMinimap")!=="false"),[kt,Dr]=n.useState(()=>localStorage.getItem("codeEditorLineNumbers")!=="false"),[xr,Ct]=n.useState(()=>localStorage.getItem("codeEditorFontSize")||"14"),Dt=async()=>{try{const W=await J("/api/mcp/config/read");if(W.ok){const _e=await W.json();if(_e.success&&_e.servers){ne(_e.servers);return}}const ee=await J("/api/mcp/cli/list");if(ee.ok){const _e=await ee.json();if(_e.success&&_e.servers){const ut=_e.servers.map(Ke=>({id:Ke.name,name:Ke.name,type:Ke.type,scope:"user",config:{command:Ke.command||"",args:Ke.args||[],env:Ke.env||{},url:Ke.url||"",headers:Ke.headers||{},timeout:3e4},created:new Date().toISOString(),updated:new Date().toISOString()}));ne(ut);return}}const pe=await J("/api/mcp/servers?scope=user");if(pe.ok){const _e=await pe.json();ne(_e.servers||[])}else console.error("Failed to fetch MCP servers")}catch(W){console.error("Error fetching MCP servers:",W)}},gr=async W=>{try{de&&await tr(de.id,"user");const ee=await J("/api/mcp/cli/add",{method:"POST",body:JSON.stringify({name:W.name,type:W.type,scope:W.scope,projectPath:W.projectPath,command:W.config?.command,args:W.config?.args||[],url:W.config?.url,headers:W.config?.headers||{},env:W.config?.env||{}})});if(ee.ok){const pe=await ee.json();if(pe.success)return await Dt(),!0;throw new Error(pe.error||"Failed to save server via Claude CLI")}else{const pe=await ee.json();throw new Error(pe.error||"Failed to save server")}}catch(ee){throw console.error("Error saving MCP server:",ee),ee}},tr=async(W,ee="user",pe="")=>{try{let _e=`/api/mcp/cli/remove/${encodeURIComponent(W)}?scope=${ee}`;ee==="local"&&pe&&(_e+=`&projectPath=${encodeURIComponent(pe)}`);const ut=await J(_e,{method:"DELETE"});if(ut.ok){const Ke=await ut.json();if(Ke.success)return await Dt(),!0;throw new Error(Ke.error||"Failed to delete server via Claude CLI")}else{const Ke=await ut.json();throw new Error(Ke.error||"Failed to delete server")}}catch(_e){throw console.error("Error deleting MCP server:",_e),_e}},Pr=async(W,ee="user")=>{try{const pe=await J(`/api/mcp/servers/${W}/test?scope=${ee}`,{method:"POST"});if(pe.ok)return(await pe.json()).testResult;{const _e=await pe.json();throw new Error(_e.error||"Failed to test server")}}catch(pe){throw console.error("Error testing MCP server:",pe),pe}},rr=async(W,ee="user")=>{try{const pe=await J(`/api/mcp/servers/${W}/tools?scope=${ee}`,{method:"POST"});if(pe.ok)return(await pe.json()).toolsResult;{const _e=await pe.json();throw new Error(_e.error||"Failed to discover tools")}}catch(pe){throw console.error("Error discovering MCP tools:",pe),pe}};n.useEffect(()=>{r&&(Ar(),Re(u),me.auth.feishuStatus().then(W=>W.json()).then(W=>{We(W.bound?W:!1)}).catch(()=>We(!1)))},[r,u]),n.useEffect(()=>(window.refreshMcpServers=Dt,()=>{delete window.refreshMcpServers}),[Dt]),n.useEffect(()=>{localStorage.setItem("codeEditorTheme",tt),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[tt]),n.useEffect(()=>{localStorage.setItem("codeEditorWordWrap",ht.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[ht]),n.useEffect(()=>{localStorage.setItem("codeEditorShowMinimap",jt.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[jt]),n.useEffect(()=>{localStorage.setItem("codeEditorLineNumbers",kt.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[kt]),n.useEffect(()=>{localStorage.setItem("codeEditorFontSize",xr),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[xr]);const Ar=async()=>{try{let W=null;try{const ee=await me.settings.getAgentPermissions();ee.ok&&(W=(await ee.json()).agentPermissions)}catch{}if(W)b(W.allowedTools||[]),f(W.disallowedTools||[]),R(W.skipPermissions||!1),_(W.projectSortOrder||"name"),localStorage.setItem("claude-settings",JSON.stringify(W));else{const ee=localStorage.getItem("claude-settings");if(ee){const pe=JSON.parse(ee);b(pe.allowedTools||[]),f(pe.disallowedTools||[]),R(pe.skipPermissions||!1),_(pe.projectSortOrder||"name")}else b([]),f([]),R(!1),_("name")}await Dt()}catch(W){console.error("Error loading tool settings:",W),b([]),f([]),R(!1),_("name")}},nr=async()=>{E(!0),T(null);try{const W={allowedTools:k,disallowedTools:j,skipPermissions:N,projectSortOrder:X,lastUpdated:new Date().toISOString()};localStorage.setItem("claude-settings",JSON.stringify(W));try{await me.settings.saveAgentPermissions(W)}catch(ee){console.warn("Failed to sync agent permissions to server:",ee)}T("success"),setTimeout(()=>{o()},1e3)}catch(W){console.error("Error saving tool settings:",W),T("error")}finally{E(!1)}},nn=async W=>{if(W.preventDefault(),Le(""),ye(""),!I){Le("请输入当前密码");return}if(!Y){Le("请输入新密码");return}if(Y.length<6){Le("新密码至少需要6个字符");return}if(Y!==ce){Le("两次输入的新密码不一致");return}Pe(!0);try{const ee=await me.auth.changePassword(I,Y),pe=await ee.json();ee.ok?(ye("密码修改成功"),re(""),ie(""),Ae("")):Le(pe.error||"修改密码失败")}catch(ee){console.error("Error changing password:",ee),Le("网络错误,请稍后再试")}finally{Pe(!1)}},xt=h?.username&&!h.username.includes("@"),Rt=async()=>{Se(!0),se(""),gt(""),ke(!1);try{const W=await me.auth.feishuBindToken(),ee=await W.json();W.ok&&ee.token?gt(ee.token):se(ee.error||"生成失败,请重试")}catch{se("网络错误,请稍后再试")}finally{Se(!1)}},or=()=>{if(!dt)return;const W=`/auth ${dt}`;if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(W).then(()=>{ke(!0),setTimeout(()=>ke(!1),2e3)});else{const ee=document.createElement("textarea");ee.value=W,ee.style.position="fixed",ee.style.opacity="0",document.body.appendChild(ee),ee.focus(),ee.select();try{document.execCommand("copy"),ke(!0),setTimeout(()=>ke(!1),2e3)}finally{document.body.removeChild(ee)}}},Pt=()=>{Ne({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),fe(null),le(!1),Ie("")},sr=(W=null)=>{W?(fe(W),Ne({name:W.name,type:W.type,scope:W.scope,projectPath:W.projectPath||"",config:{...W.config},raw:W.raw,importMode:"form",jsonInput:""})):Pt(),le(!0)},wt=async W=>{W.preventDefault(),Be(!0);try{if(ae.importMode==="json"){const ee=await J("/api/mcp/cli/add-json",{method:"POST",body:JSON.stringify({name:ae.name,jsonConfig:ae.jsonInput,scope:ae.scope,projectPath:ae.projectPath})});if(ee.ok){const pe=await ee.json();if(pe.success)await Dt(),Pt(),T("success");else throw new Error(pe.error||"Failed to add server via JSON")}else{const pe=await ee.json();throw new Error(pe.error||"Failed to add server")}}else await gr(ae),Pt(),T("success")}catch(ee){g(`错误: ${ee.message}`,{variant:"error"}),T("error")}finally{Be(!1)}},ar=async(W,ee,pe)=>{if(await v("确定要删除此 MCP 服务器吗?",{title:"删除 MCP 服务器",variant:"danger",confirmText:"确认删除"}))try{await tr(W,ee,pe),T("success")}catch(_e){g(`错误: ${_e.message}`,{variant:"error"}),T("error")}},yr=async(W,ee)=>{try{Oe({...he,[W]:{loading:!0}});const pe=await Pr(W,ee);Oe({...he,[W]:pe})}catch(pe){Oe({...he,[W]:{success:!1,message:pe.message,details:[]}})}},br=async(W,ee)=>{try{Je({...Te,[W]:!0});const pe=await rr(W,ee);Ye({...De,[W]:pe})}catch{Ye({...De,[W]:{success:!1,tools:[],resources:[],prompts:[]}})}finally{Je({...Te,[W]:!1})}},yt=(W,ee)=>{Ne(pe=>({...pe,config:{...pe.config,[W]:ee}}))};return r?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[9999] md:p-4 bg-background/95",children:e.jsxs("div",{className:"bg-background border border-border md:rounded-lg shadow-xl w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-border flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ut,{className:"w-5 h-5 md:w-6 md:h-6 text-blue-600"}),e.jsx("h2",{className:"text-lg md:text-xl font-semibold text-foreground",children:"设置"})]}),e.jsx(U,{variant:"ghost",size:"sm",onClick:o,className:"text-muted-foreground hover:text-foreground touch-manipulation",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsx("div",{className:"border-b border-border",children:e.jsxs("div",{className:"flex px-4 md:px-6",children:[Qe&&e.jsx("button",{onClick:()=>Re("agents"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Ce==="agents"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Agent"}),e.jsx("button",{onClick:()=>Re("shared_projects"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Ce==="shared_projects"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"共享项目模板"}),e.jsx("button",{onClick:()=>Re("cron_tasks"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Ce==="cron_tasks"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"定时任务"}),e.jsx("button",{onClick:()=>Re("appearance"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Ce==="appearance"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"外观"}),e.jsx("button",{onClick:()=>Re("account"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Ce==="account"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"账户"})]})}),e.jsxs("div",{className:"p-4 md:p-6 space-y-6 md:space-y-8 pb-safe-area-inset-bottom",children:[Ce==="appearance"&&e.jsx("div",{className:"space-y-6 md:space-y-8",children:Ce==="appearance"&&e.jsxs("div",{className:"space-y-6 md:space-y-8",children:[e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"深色模式"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"切换浅色和深色主题"})]}),e.jsxs("button",{onClick:x,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":t,"aria-label":"Toggle dark mode",children:[e.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),e.jsx("span",{className:`${t?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:t?e.jsx(Ur,{className:"w-3.5 h-3.5 text-gray-700"}):e.jsx(Gr,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"视图选项"}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:[e.jsx(Ia,{className:"h-4 w-4 text-muted-foreground"}),"自动滚动到底部"]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"有新消息时自动滚动到底部"})]}),e.jsxs("button",{onClick:()=>m&&m(!c),className:`relative inline-flex h-8 w-14 items-center rounded-full transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900 ${c?"bg-blue-600":"bg-gray-200 dark:bg-gray-700"}`,role:"switch","aria-checked":c,"aria-label":"Toggle auto scroll",children:[e.jsx("span",{className:"sr-only",children:"Toggle auto scroll"}),e.jsx("span",{className:`${c?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"输入设置"}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:[e.jsx(za,{className:"h-4 w-4 text-muted-foreground"}),"使用 Ctrl+Enter 发送"]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"启用后,按 Ctrl+Enter 发送消息而不是 Enter。这对于输入法用户很有用,可以避免误发送。"})]}),e.jsxs("button",{onClick:()=>s&&s(!d),className:`relative inline-flex h-8 w-14 items-center rounded-full transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900 ${d?"bg-blue-600":"bg-gray-200 dark:bg-gray-700"}`,role:"switch","aria-checked":d,"aria-label":"Toggle ctrl enter",children:[e.jsx("span",{className:"sr-only",children:"Toggle ctrl enter"}),e.jsx("span",{className:`${d?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})})]}),e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"项目排序"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"侧边栏中项目的排序方式"})]}),e.jsxs("select",{value:X,onChange:W=>_(W.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-32",children:[e.jsx("option",{value:"name",children:"按字母顺序"}),e.jsx("option",{value:"date",children:"按最近活动"})]})]})})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"文件编辑器"}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"编辑器主题"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"文件编辑器的默认主题"})]}),e.jsxs("button",{onClick:()=>ft(tt==="dark"?"light":"dark"),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":tt==="dark","aria-label":"Toggle editor theme",children:[e.jsx("span",{className:"sr-only",children:"Toggle editor theme"}),e.jsx("span",{className:`${tt==="dark"?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:tt==="dark"?e.jsx(Ur,{className:"w-3.5 h-3.5 text-gray-700"}):e.jsx(Gr,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"自动换行"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"在编辑器中默认启用自动换行"})]}),e.jsxs("button",{onClick:()=>hr(!ht),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":ht,"aria-label":"Toggle word wrap",children:[e.jsx("span",{className:"sr-only",children:"Toggle word wrap"}),e.jsx("span",{className:`${ht?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"显示小地图"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"在差异视图中显示小地图以便于导航"})]}),e.jsxs("button",{onClick:()=>et(!jt),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":jt,"aria-label":"Toggle minimap",children:[e.jsx("span",{className:"sr-only",children:"Toggle minimap"}),e.jsx("span",{className:`${jt?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"显示行号"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"在编辑器中显示行号"})]}),e.jsxs("button",{onClick:()=>Dr(!kt),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":kt,"aria-label":"Toggle line numbers",children:[e.jsx("span",{className:"sr-only",children:"Toggle line numbers"}),e.jsx("span",{className:`${kt?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"字体大小"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"编辑器字体大小(像素)"})]}),e.jsxs("select",{value:xr,onChange:W=>Ct(W.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-24",children:[e.jsx("option",{value:"10",children:"10px"}),e.jsx("option",{value:"11",children:"11px"}),e.jsx("option",{value:"12",children:"12px"}),e.jsx("option",{value:"13",children:"13px"}),e.jsx("option",{value:"14",children:"14px"}),e.jsx("option",{value:"15",children:"15px"}),e.jsx("option",{value:"16",children:"16px"}),e.jsx("option",{value:"18",children:"18px"}),e.jsx("option",{value:"20",children:"20px"})]})]})})]})]})}),Ce==="agents"&&e.jsx("div",{className:"flex flex-col h-full min-h-[400px] md:min-h-[500px]",children:e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:e.jsxs("div",{className:"flex px-2 md:px-4 overflow-x-auto",children:[i("tab_permissions")&&e.jsx("button",{onClick:()=>Ze("permissions"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ze==="permissions"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"权限"}),i("tab_mcp")&&e.jsx("button",{onClick:()=>Ze("mcp"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ze==="mcp"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"MCP 服务器"}),i("tab_skills")&&e.jsx("button",{onClick:()=>Ze("skills"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ze==="skills"?"border-amber-600 text-amber-600 dark:text-amber-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"技能"}),i("tab_models")&&e.jsx("button",{onClick:()=>Ze("models"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ze==="models"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"模型"})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-3 md:p-4",children:[ze==="permissions"&&e.jsx(Jl,{agent:"claude",skipPermissions:N,setSkipPermissions:R,allowedTools:k,setAllowedTools:b,disallowedTools:j,setDisallowedTools:f,newAllowedTool:w,setNewAllowedTool:S,newDisallowedTool:z,setNewDisallowedTool:D}),ze==="mcp"&&e.jsx(Vl,{agent:"claude",servers:te,onAdd:()=>sr(),onEdit:W=>sr(W),onDelete:(W,ee,pe)=>ar(W,ee,pe),onTest:(W,ee)=>yr(W,ee),onDiscoverTools:(W,ee)=>br(W,ee),testResults:he,serverTools:De,toolsLoading:Te,onDiscoverRepo:()=>ge(!0)}),ze==="skills"&&e.jsx(rc,{projects:l}),ze==="models"&&e.jsx(Ql,{ref:K,onStatusChange:V})]})]})}),Ce==="shared_projects"&&e.jsx(nc,{projects:l}),Ce==="cron_tasks"&&e.jsx(gc,{}),Ce==="account"&&e.jsx("div",{className:"space-y-6 md:space-y-8",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"账户"}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-primary/10 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-lg font-semibold text-primary",children:h?.username?.charAt(0).toUpperCase()})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:h?.username}),e.jsx("div",{className:"text-sm text-muted-foreground",children:h?.role==="super_admin"?"超级管理员":h?.role==="admin"?"管理员":"用户"})]})]})}),xt&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(Pn,{className:"w-5 h-5 text-blue-600"}),e.jsx("div",{className:"font-medium text-foreground",children:"修改密码"})]}),e.jsxs("form",{onSubmit:nn,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"currentPassword",className:"block text-sm font-medium text-foreground mb-1",children:"当前密码"}),e.jsx("input",{type:"password",id:"currentPassword",value:I,onChange:W=>re(W.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入当前密码",disabled:at})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"newPassword",className:"block text-sm font-medium text-foreground mb-1",children:"新密码"}),e.jsx("input",{type:"password",id:"newPassword",value:Y,onChange:W=>ie(W.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入新密码(至少6个字符)",disabled:at})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirmNewPassword",className:"block text-sm font-medium text-foreground mb-1",children:"确认新密码"}),e.jsx("input",{type:"password",id:"confirmNewPassword",value:ce,onChange:W=>Ae(W.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请再次输入新密码",disabled:at})]}),Xe&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:Xe})}),oe&&e.jsx("div",{className:"p-3 bg-green-100 dark:bg-green-900/20 border border-green-300 dark:border-green-800 rounded-md",children:e.jsx("p",{className:"text-sm text-green-700 dark:text-green-400",children:oe})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(U,{type:"submit",disabled:at,className:"bg-blue-600 hover:bg-blue-700",children:at?"修改中...":"修改密码"})})]})]}),i("feishu_binding")&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("img",{src:"/feishu-logo.svg",alt:"飞书",className:"h-4"}),e.jsx("div",{className:"font-medium text-foreground",children:"飞书账号绑定"})]}),Z?e.jsxs("div",{className:"flex items-center gap-2 mb-3 px-3 py-2 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-md",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500 shrink-0"}),e.jsxs("div",{className:"text-sm text-green-700 dark:text-green-400",children:["已绑定",e.jsx("span",{className:"ml-2 text-xs text-green-600/70 dark:text-green-500/70 font-mono",children:Z.feishuOpenId}),Z.createdAt&&e.jsxs("span",{className:"ml-2 text-xs text-green-600/70 dark:text-green-500/70",children:["· ",new Date(Z.createdAt).toLocaleDateString("zh-CN")]})]})]}):Z===!1?e.jsxs("div",{className:"flex items-center gap-2 mb-3 px-3 py-2 bg-gray-100 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700 rounded-md",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-400 shrink-0"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"未绑定飞书账号"})]}):null,e.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["生成绑定 Token,在飞书中向机器人发送 ",e.jsx("code",{className:"bg-gray-200 dark:bg-gray-700 px-1 rounded text-xs",children:"/auth <token>"})," 即可完成绑定,Token 有效期 24 小时。"]}),dt?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-background border border-border rounded-md",children:[e.jsxs("code",{className:"flex-1 text-xs text-foreground font-mono break-all select-all",children:["/auth ",dt]}),e.jsx("button",{onClick:or,className:"shrink-0 p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-800 text-muted-foreground hover:text-foreground transition-colors",title:"复制命令",children:je?e.jsx(pr,{className:"w-4 h-4 text-green-500"}):e.jsx(Bn,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"复制上方命令,在飞书私聊机器人中发送"}),e.jsxs("button",{onClick:Rt,disabled:F,className:"flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-50",children:[e.jsx(st,{className:"w-3 h-3"}),"重新生成"]})]})]}):e.jsxs("div",{className:"space-y-2",children:[O&&e.jsx("p",{className:"text-sm text-red-500",children:O}),e.jsxs(U,{onClick:Rt,disabled:F,variant:"outline",className:"gap-2",children:[F?e.jsx(st,{className:"w-4 h-4 animate-spin"}):e.jsx(Pn,{className:"w-4 h-4"}),F?"生成中...":"生成绑定 Token"]})]})]}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"退出登录"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"结束当前会话"})]}),e.jsxs(U,{variant:"outline",className:"gap-2 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800 hover:bg-red-50 dark:hover:bg-red-900/20",onClick:async()=>{await v("确定要退出登录吗?",{title:"退出登录",variant:"warning",confirmText:"退出"})&&(o(),p("/app"),a())},children:[e.jsx(Ra,{className:"w-4 h-4"}),"退出"]})]})})]})}),G&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[110] p-4",children:e.jsxs("div",{className:"bg-background border border-border rounded-lg w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[e.jsx("h3",{className:"text-lg font-medium text-foreground",children:de?"编辑 MCP 服务器":"添加 MCP 服务器"}),e.jsx(U,{variant:"ghost",size:"sm",onClick:Pt,children:e.jsx(Ge,{className:"w-4 h-4"})})]}),e.jsxs("form",{onSubmit:wt,className:"p-4 space-y-4",children:[!de&&e.jsxs("div",{className:"flex gap-2 mb-4",children:[e.jsx("button",{type:"button",onClick:()=>Ne(W=>({...W,importMode:"form"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${ae.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:"表单输入"}),e.jsx("button",{type:"button",onClick:()=>Ne(W=>({...W,importMode:"json"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${ae.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:"JSON 导入"})]}),ae.importMode==="form"&&de&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"作用域"}),e.jsxs("div",{className:"flex items-center gap-2",children:[ae.scope==="user"?e.jsx(mr,{className:"w-4 h-4"}):e.jsx(Xr,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:ae.scope==="user"?"用户(全局)":"项目(本地)"}),ae.scope==="local"&&ae.projectPath&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",Ue(ae.projectPath)]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"编辑现有服务器时无法更改作用域"})]}),ae.importMode==="form"&&!de&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"作用域 *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>Ne(W=>({...W,scope:"user",projectPath:""})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${ae.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(mr,{className:"w-4 h-4"}),e.jsx("span",{children:"用户(全局)"})]})}),e.jsx("button",{type:"button",onClick:()=>Ne(W=>({...W,scope:"local"})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${ae.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(Xr,{className:"w-4 h-4"}),e.jsx("span",{children:"项目(本地)"})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:ae.scope==="user"?"用户作用域:在您机器上的所有项目中可用":"本地作用域:仅在选定的项目中可用"})]}),ae.scope==="local"&&!de&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"项目 *"}),e.jsxs("select",{value:ae.projectPath,onChange:W=>Ne(ee=>({...ee,projectPath:W.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",required:ae.scope==="local",children:[e.jsx("option",{value:"",children:"选择项目..."}),l.map(W=>e.jsx("option",{value:W.path||W.fullPath,children:W.displayName||W.name},W.name))]}),ae.projectPath&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Path: ",Ue(ae.projectPath)]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:ae.importMode==="json"?"md:col-span-2":"",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"服务器名称 *"}),e.jsx(ct,{value:ae.name,onChange:W=>{Ne(ee=>({...ee,name:W.target.value}))},placeholder:"my-server",required:!0})]}),ae.importMode==="form"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"传输类型 *"}),e.jsxs("select",{value:ae.type,onChange:W=>{Ne(ee=>({...ee,type:W.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",children:[e.jsx("option",{value:"stdio",children:"stdio"}),e.jsx("option",{value:"sse",children:"SSE"}),e.jsx("option",{value:"http",children:"HTTP"})]})]})]}),de&&ae.raw&&ae.importMode==="form"&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("h4",{className:"text-sm font-medium text-foreground mb-2",children:["配置详情 (from ",de.scope==="global"?"~/.claude.json":"project config",")"]}),e.jsx("pre",{className:"text-xs bg-gray-100 dark:bg-gray-800 p-3 rounded overflow-x-auto",children:JSON.stringify(ae.raw,null,2)})]}),ae.importMode==="json"&&e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"JSON 配置 *"}),e.jsx("textarea",{value:ae.jsonInput,onChange:W=>{Ne(ee=>({...ee,jsonInput:W.target.value}));try{if(W.target.value.trim()){const ee=JSON.parse(W.target.value);ee.type?ee.type==="stdio"&&!ee.command?Ie("stdio 类型需要 command 字段"):(ee.type==="http"||ee.type==="sse")&&!ee.url?Ie(`${ee.type} 类型需要 url 字段`):Ie(""):Ie("缺少必填字段:type")}}catch{W.target.value.trim()?Ie("无效的 JSON 格式"):Ie("")}},className:`w-full px-3 py-2 border ${$e?"border-red-500":"border-gray-300 dark:border-gray-600"} bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 font-mono text-sm`,rows:"8",placeholder:`{
162
+ ${i.cronExpr} — ${i.prompt.slice(0,60)}${i.prompt.length>60?"…":""}`,{title:"删除定时任务",variant:"danger",confirmText:"删除",cancelText:"取消"})){m(i.id);try{(await J(`/api/cron-tasks/${i.id}`,{method:"DELETE"})).ok&&o(k=>k.filter(b=>b.id!==i.id))}catch(v){console.error("Delete failed",v)}finally{m(null)}}},a=i=>{o(d==="create"?g=>[...g,i]:g=>g.map(v=>v.id===i.id?i:v)),s(null)};return l?e.jsxs("div",{className:"flex items-center justify-center py-16 text-gray-400 dark:text-gray-500",children:[e.jsx(st,{size:18,className:"animate-spin mr-2"})," 加载中…"]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"管理定时任务,可新建、编辑、暂停或删除。"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(U,{variant:"outline",size:"sm",onClick:t,className:"flex items-center gap-1.5",children:[e.jsx(st,{size:14})," 刷新"]}),e.jsxs(U,{variant:"outline",size:"sm",onClick:()=>s("create"),className:"flex items-center gap-1.5",children:[e.jsx(zt,{size:14})," 新建任务"]})]})]}),r.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-gray-400 dark:text-gray-500 gap-3",children:[e.jsx(Mr,{size:32,className:"opacity-40"}),e.jsx("p",{className:"text-sm",children:"暂无定时任务"}),e.jsx("button",{onClick:()=>s("create"),className:"text-xs text-blue-500 hover:text-blue-600 dark:text-blue-400",children:"+ 创建第一个定时任务"})]}):e.jsx("div",{className:"space-y-2",children:r.map(i=>e.jsx("div",{className:`rounded-lg border p-4 transition-colors ${i.isPaused?"border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800/50 opacity-70":"border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800"}`,children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-200",title:i.cronExpr,children:Ls(i.cronExpr)}),e.jsx("code",{className:"text-xs font-mono text-gray-400 dark:text-gray-500",children:i.cronExpr}),e.jsx(xc,{channel:i.channel}),!i.recurring&&e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",children:"单次"}),i.isPaused&&e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-gray-200 text-gray-600 dark:bg-gray-600 dark:text-gray-300",children:"已暂停"})]}),e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 truncate",title:i.prompt,children:i.prompt.length>80?i.prompt.slice(0,80)+"…":i.prompt}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-400 dark:text-gray-500 flex-wrap",children:[e.jsxs("span",{children:["最近触发:",Go(i.lastFiredAt)]}),e.jsxs("span",{children:["创建:",Go(i.createdAt)]}),i.sessionMode==="resume_session"&&e.jsx("span",{children:"复用会话"})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:()=>x(i),disabled:c===i.id,title:i.isPaused?"恢复":"暂停",className:"p-1.5 rounded-md text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:hover:text-gray-200 dark:hover:bg-gray-700 disabled:opacity-40 transition-colors",children:i.isPaused?e.jsx(Aa,{size:15}):e.jsx(La,{size:15})}),e.jsx("button",{onClick:()=>s(i),disabled:c===i.id,title:"编辑",className:"p-1.5 rounded-md text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:hover:text-gray-200 dark:hover:bg-gray-700 disabled:opacity-40 transition-colors",children:e.jsx(Ia,{size:15})}),e.jsx("button",{onClick:()=>h(i),disabled:c===i.id,title:"删除",className:"p-1.5 rounded-md text-gray-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 disabled:opacity-40 transition-colors",children:e.jsx(vt,{size:15})})]})]})},i.id))})]}),d!==null&&e.jsx(hc,{editTask:d==="create"?null:d,onClose:()=>s(null),onSave:a})]})}function yc({onClose:r,onChanged:o}){const{showAlert:l,showConfirm:u}=lt(),[c,m]=n.useState([]),[d,s]=n.useState(!0),[p,t]=n.useState(null),[x,h]=n.useState(""),[a,i]=n.useState(!1),[g,v]=n.useState(null);n.useEffect(()=>{k()},[]);const k=async()=>{try{s(!0),t(null);const f=await J("/api/mcp-repos");if(f.ok){const w=await f.json();m(w.repos||[])}else{const w=await f.json();t(w.error||"Failed to fetch repos")}}catch(f){t(f.message)}finally{s(!1)}},b=async f=>{if(f.preventDefault(),!x.trim()){t("请输入仓库 URL");return}try{i(!0),t(null);const w=await J("/api/mcp-repos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:x.trim()})});if(w.ok)h(""),k(),o?.();else{const N=await w.json();t(N.error||"Failed to add repo")}}catch(w){t(w.message)}finally{i(!1)}},j=async(f,w)=>{if(await u(`确定要移除仓库 "${f}/${w}" 吗?`,{title:"移除仓库",variant:"danger",confirmText:"确认移除"}))try{v(`${f}/${w}`);const N=await J(`/api/mcp-repos/${f}/${w}`,{method:"DELETE"});if(N.ok)k(),o?.();else{const L=await N.json();l(L.error||"移除仓库失败",{variant:"error"})}}catch(N){l(N.message,{variant:"error"})}finally{v(null)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[10000] p-4",children:e.jsxs("div",{className:"bg-background rounded-xl shadow-xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 p-4 border-b border-border",children:[e.jsx(U,{variant:"ghost",size:"icon",onClick:r,children:e.jsx(Qt,{className:"w-5 h-5"})}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"管理 MCP 仓库"})]}),e.jsxs("div",{className:"flex-1 overflow-auto p-4 space-y-6",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4 space-y-4",children:[e.jsx("h3",{className:"font-medium text-foreground",children:"添加 MCP 仓库"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["仓库中每个文件夹代表一个 MCP 服务,需包含 ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded",children:"mcp.json"}),"(配置)和 ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded",children:"mcp.yaml"}),"(说明)。"]}),e.jsxs("form",{onSubmit:b,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-muted-foreground mb-1",children:"仓库 URL"}),e.jsx(ct,{type:"text",placeholder:"owner/name 或 https://github.com/owner/name",value:x,onChange:f=>h(f.target.value),disabled:a})]}),e.jsxs(U,{type:"submit",disabled:a||!x.trim(),className:"bg-purple-600 hover:bg-purple-700 text-white",children:[e.jsx(zt,{className:"w-4 h-4 mr-2"}),a?"添加中...":"添加仓库"]})]})]}),p&&e.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-800 dark:text-red-200 text-sm",children:p}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-medium text-foreground",children:"已添加的仓库"}),d?e.jsx("div",{className:"text-center py-4 text-muted-foreground",children:"加载中..."}):c.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(ns,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"还没有添加任何 MCP 仓库"})]}):c.map(f=>e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-medium text-foreground",children:[f.owner,"/",f.repo]}),f.isSystem&&e.jsx(nt,{variant:"outline",className:"text-xs bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300",children:"内置"})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(rn,{className:"w-3 h-3"}),"分支: main"]}),e.jsxs(nt,{variant:"outline",className:"text-xs",children:[f.serviceCount," 个 MCP 服务"]})]})]}),e.jsx("div",{className:"flex items-center gap-2 ml-4",children:!f.isSystem&&e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>j(f.owner,f.repo),disabled:g===`${f.owner}/${f.repo}`,className:"text-red-500 hover:text-red-600",children:e.jsx(vt,{className:"w-4 h-4"})})})]})},`${f.owner}/${f.repo}`))]})]})]})})}const bc=r=>{switch(r){case"stdio":return e.jsx(Gn,{className:"w-3 h-3"});case"sse":return e.jsx(Cr,{className:"w-3 h-3"});case"http":return e.jsx(mr,{className:"w-3 h-3"});default:return e.jsx(tn,{className:"w-3 h-3"})}};function vc({onClose:r,onInstalled:o,onOpenRepoManager:l,projects:u=[]}){const{showAlert:c,showConfirm:m}=lt(),[d,s]=n.useState([]),[p,t]=n.useState([]),[x,h]=n.useState(!0),[a,i]=n.useState(null),[g,v]=n.useState(""),[k,b]=n.useState("all"),[j,f]=n.useState(null),[w,N]=n.useState(null),[L,E]=n.useState(null),[S,R]=n.useState("user"),[M,D]=n.useState("");n.useEffect(()=>{$()},[]);const $=async(Y=!1)=>{try{h(!0),i(null),Y&&await J("/api/mcp-repos/refresh",{method:"POST"});const[le,de]=await Promise.all([J("/api/mcp-repos/available"),J("/api/mcp-repos")]);if(le.ok){const fe=await le.json();s(fe.services||[])}if(de.ok){const fe=await de.json();t(fe.repos||[])}}catch(le){i(le.message)}finally{h(!1)}},T=Y=>{E(Y),R("user"),D("")},X=()=>{E(null),R("user"),D("")},_=async()=>{const Y=L;if(Y){if(S==="local"&&!M){c("请选择要安装到的项目",{variant:"warning"});return}try{E(null),f(Y.dirName+Y.repository);const le={servicePath:Y.path,scope:S};S==="local"&&M&&(le.projectPath=M);const de=await J("/api/mcp-repos/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(le)});if(de.ok)$(),o?.();else{const fe=await de.json();c(fe.error||"安装 MCP 服务失败",{variant:"error"})}}catch(le){c(le.message,{variant:"error"})}finally{f(null),R("user"),D("")}}},te=async Y=>{if(!(!Y.serverNames||Y.serverNames.length===0)&&await m(`确定要卸载 "${Y.name}" 吗?这将移除 ${Y.serverNames.join(", ")} 的配置。`,{title:"卸载 MCP 服务",variant:"danger",confirmText:"确认卸载"}))try{N(Y.dirName+Y.repository);for(const le of Y.serverNames)await J(`/api/mcp-repos/uninstall/${encodeURIComponent(le)}`,{method:"DELETE"});$(),o?.()}catch(le){c(le.message,{variant:"error"})}finally{N(null)}},ne=d.filter(Y=>{if(g){const le=g.toLowerCase();if(!Y.dirName?.toLowerCase().includes(le)&&!Y.name?.toLowerCase().includes(le)&&!Y.description?.toLowerCase().includes(le))return!1}return!(k!=="all"&&Y.repository!==k)});return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[10000] p-4",children:e.jsxs("div",{className:"bg-background rounded-xl shadow-xl w-full max-w-4xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"MCP 仓库"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(U,{variant:"ghost",size:"sm",onClick:()=>$(!0),disabled:x,children:[e.jsx(st,{className:`w-4 h-4 ${x?"animate-spin":""}`}),e.jsx("span",{className:"ml-1 hidden sm:inline",children:"刷新"})]}),e.jsxs(U,{variant:"ghost",size:"sm",onClick:l,children:[e.jsx(Ut,{className:"w-4 h-4"}),e.jsx("span",{className:"ml-1 hidden sm:inline",children:"仓库管理"})]}),e.jsx(U,{variant:"ghost",size:"icon",onClick:r,children:e.jsx(Ge,{className:"w-5 h-5"})})]})]}),e.jsx("div",{className:"px-4 pt-4 pb-2"}),e.jsxs("div",{className:"px-4 pb-4 flex flex-wrap gap-3",children:[e.jsx("div",{className:"flex-1 min-w-[200px]",children:e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(ct,{type:"text",placeholder:"搜索 MCP 服务名称或描述...",value:g,onChange:Y=>v(Y.target.value),className:"pl-10"})]})}),e.jsxs("select",{value:k,onChange:Y=>b(Y.target.value),className:"px-3 py-2 rounded-md border border-border bg-background text-foreground text-sm min-w-[120px]",children:[e.jsx("option",{value:"all",children:"全部仓库"}),p.map(Y=>e.jsxs("option",{value:`${Y.owner}/${Y.repo}`,children:[Y.owner,"/",Y.repo]},`${Y.owner}/${Y.repo}`))]})]}),e.jsxs("div",{className:"flex-1 overflow-auto px-4 pb-4",children:[a&&e.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 text-red-800 dark:text-red-200 text-sm mb-4",children:a}),x?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):ne.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:d.length===0?e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"没有可用的 MCP 服务"}),e.jsx("p",{className:"text-xs mt-2",children:"请先添加 MCP 仓库"}),e.jsxs(U,{variant:"outline",size:"sm",className:"mt-4",onClick:l,children:[e.jsx(Ut,{className:"w-4 h-4 mr-2"}),"管理仓库"]})]}):e.jsx("p",{children:"没有找到匹配的 MCP 服务"})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:ne.map(Y=>{const le=`${Y.repository}-${Y.dirName}`,de=j===Y.dirName+Y.repository,fe=w===Y.dirName+Y.repository,Ee=L&&L.dirName+L.repository===Y.dirName+Y.repository;return e.jsx("div",{className:"border border-border rounded-lg p-4 hover:border-purple-500/50 transition-colors",children:e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-medium text-foreground",children:Y.name||Y.dirName}),e.jsxs(nt,{variant:"outline",className:"text-xs flex items-center gap-1",children:[bc(Y.type),Y.type]})]}),e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:Y.repository}),Y.serverNames?.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["· ",Y.serverNames.join(", ")]})]})]}),Y.description&&e.jsx("p",{className:"text-sm text-muted-foreground flex-1 line-clamp-3 mb-3",children:Y.description}),Ee&&e.jsxs("div",{className:"mt-2 mb-3 p-3 rounded-lg bg-muted/50 border border-border text-sm",children:[e.jsx("p",{className:"font-medium text-foreground mb-2",children:"选择安装位置"}),e.jsxs("label",{className:"flex items-center gap-2 mb-1 cursor-pointer",children:[e.jsx("input",{type:"radio",name:`scope-${le}`,value:"user",checked:S==="user",onChange:()=>{R("user"),D("")},className:"accent-purple-600"}),e.jsx("span",{className:"text-foreground",children:"全局(所有项目可用)"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"radio",name:`scope-${le}`,value:"local",checked:S==="local",onChange:()=>R("local"),className:"accent-purple-600"}),e.jsx("span",{className:"text-foreground",children:"安装到指定项目"})]}),S==="local"&&e.jsxs("select",{value:M,onChange:ye=>D(ye.target.value),className:"mt-2 w-full px-2 py-1.5 rounded-md border border-border bg-background text-foreground text-xs",children:[e.jsx("option",{value:"",children:"选择项目..."}),u.map(ye=>e.jsx("option",{value:ye.path||ye.fullPath,children:ye.displayName||ye.name},ye.name))]}),e.jsxs("div",{className:"flex gap-2 mt-3",children:[e.jsx(U,{size:"sm",variant:"outline",onClick:X,className:"flex-1",children:"取消"}),e.jsx(U,{size:"sm",className:"bg-purple-600 hover:bg-purple-700 text-white flex-1",onClick:_,children:"确认安装"})]})]}),e.jsx("div",{className:"flex items-center gap-2 mt-auto pt-2",children:Y.installed?e.jsxs(U,{size:"sm",variant:"outline",className:"ml-auto text-red-600 hover:text-red-700 border-red-200 hover:border-red-300",onClick:()=>te(Y),disabled:fe,children:[e.jsx(vt,{className:"w-4 h-4 mr-1"}),fe?"卸载中...":"卸载"]}):!Ee&&e.jsxs(U,{size:"sm",className:"bg-purple-600 hover:bg-purple-700 text-white ml-auto",onClick:()=>T(Y),disabled:de||!!L,children:[e.jsx(_t,{className:"w-4 h-4 mr-1"}),de?"安装中...":"安装"]})})]})},le)})})]})]})})}function jc({isOpen:r,onClose:o,projects:l=[],initialTab:u="shared_projects",autoScrollToBottom:c,onAutoScrollChange:m,sendByCtrlEnter:d,onSendByCtrlEnterChange:s}){const p=Qr(),{isDarkMode:t,toggleDarkMode:x}=no(),{user:h,logout:a,hasPermission:i}=Ot(),{showAlert:g,showConfirm:v}=lt(),[k,b]=n.useState([]),[j,f]=n.useState([]),[w,N]=n.useState(""),[L,E]=n.useState(""),[S,R]=n.useState(!1),[M,D]=n.useState(!1),[$,T]=n.useState(null),[X,_]=n.useState("name"),[te,ne]=n.useState([]),[Y,le]=n.useState(!1),[de,fe]=n.useState(null),[Ee,ye]=n.useState(!1),[Me,Fe]=n.useState(!1),[ie,Se]=n.useState({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),[He,Be]=n.useState(!1),[he,Oe]=n.useState({}),[De,Ye]=n.useState({}),[Xe,Je]=n.useState({}),[Ce,_e]=n.useState(u),[$e,ze]=n.useState(""),[Re,Ze]=n.useState("permissions"),Qe=i("tab_permissions")||i("tab_mcp")||i("tab_skills")||i("tab_models");n.useEffect(()=>{const W={permissions:"tab_permissions",mcp:"tab_mcp",skills:"tab_skills",models:"tab_models"},ee=W[Re];if(ee&&!i(ee)){const Ie=["permissions","mcp","skills","models"].find(ut=>{const Ke=W[ut];return!Ke||i(Ke)});Ie&&Ze(Ie)}},[i,Re]),n.useEffect(()=>{Ce==="agents"&&!Qe&&_e("shared_projects")},[Ce,Qe]);const K=n.useRef(null),[B,C]=n.useState({saving:!1,hasChanges:!1}),V=n.useCallback(W=>C(W),[]),[z,re]=n.useState(""),[G,ae]=n.useState(""),[ce,Pe]=n.useState(""),[xe,Le]=n.useState(""),[oe,be]=n.useState(""),[at,Ae]=n.useState(!1),[dt,gt]=n.useState(""),[F,Te]=n.useState(!1),[O,se]=n.useState(""),[ke,we]=n.useState(!1),[Z,We]=n.useState(null),[tt,ft]=n.useState(()=>localStorage.getItem("codeEditorTheme")||"dark"),[ht,hr]=n.useState(()=>localStorage.getItem("codeEditorWordWrap")==="true"),[jt,et]=n.useState(()=>localStorage.getItem("codeEditorShowMinimap")!=="false"),[kt,Dr]=n.useState(()=>localStorage.getItem("codeEditorLineNumbers")!=="false"),[xr,Ct]=n.useState(()=>localStorage.getItem("codeEditorFontSize")||"14"),Dt=async()=>{try{const W=await J("/api/mcp/config/read");if(W.ok){const Ie=await W.json();if(Ie.success&&Ie.servers){ne(Ie.servers);return}}const ee=await J("/api/mcp/cli/list");if(ee.ok){const Ie=await ee.json();if(Ie.success&&Ie.servers){const ut=Ie.servers.map(Ke=>({id:Ke.name,name:Ke.name,type:Ke.type,scope:"user",config:{command:Ke.command||"",args:Ke.args||[],env:Ke.env||{},url:Ke.url||"",headers:Ke.headers||{},timeout:3e4},created:new Date().toISOString(),updated:new Date().toISOString()}));ne(ut);return}}const pe=await J("/api/mcp/servers?scope=user");if(pe.ok){const Ie=await pe.json();ne(Ie.servers||[])}else console.error("Failed to fetch MCP servers")}catch(W){console.error("Error fetching MCP servers:",W)}},gr=async W=>{try{de&&await tr(de.id,"user");const ee=await J("/api/mcp/cli/add",{method:"POST",body:JSON.stringify({name:W.name,type:W.type,scope:W.scope,projectPath:W.projectPath,command:W.config?.command,args:W.config?.args||[],url:W.config?.url,headers:W.config?.headers||{},env:W.config?.env||{}})});if(ee.ok){const pe=await ee.json();if(pe.success)return await Dt(),!0;throw new Error(pe.error||"Failed to save server via Claude CLI")}else{const pe=await ee.json();throw new Error(pe.error||"Failed to save server")}}catch(ee){throw console.error("Error saving MCP server:",ee),ee}},tr=async(W,ee="user",pe="")=>{try{let Ie=`/api/mcp/cli/remove/${encodeURIComponent(W)}?scope=${ee}`;ee==="local"&&pe&&(Ie+=`&projectPath=${encodeURIComponent(pe)}`);const ut=await J(Ie,{method:"DELETE"});if(ut.ok){const Ke=await ut.json();if(Ke.success)return await Dt(),!0;throw new Error(Ke.error||"Failed to delete server via Claude CLI")}else{const Ke=await ut.json();throw new Error(Ke.error||"Failed to delete server")}}catch(Ie){throw console.error("Error deleting MCP server:",Ie),Ie}},Pr=async(W,ee="user")=>{try{const pe=await J(`/api/mcp/servers/${W}/test?scope=${ee}`,{method:"POST"});if(pe.ok)return(await pe.json()).testResult;{const Ie=await pe.json();throw new Error(Ie.error||"Failed to test server")}}catch(pe){throw console.error("Error testing MCP server:",pe),pe}},rr=async(W,ee="user")=>{try{const pe=await J(`/api/mcp/servers/${W}/tools?scope=${ee}`,{method:"POST"});if(pe.ok)return(await pe.json()).toolsResult;{const Ie=await pe.json();throw new Error(Ie.error||"Failed to discover tools")}}catch(pe){throw console.error("Error discovering MCP tools:",pe),pe}};n.useEffect(()=>{r&&(Ar(),_e(u),me.auth.feishuStatus().then(W=>W.json()).then(W=>{We(W.bound?W:!1)}).catch(()=>We(!1)))},[r,u]),n.useEffect(()=>(window.refreshMcpServers=Dt,()=>{delete window.refreshMcpServers}),[Dt]),n.useEffect(()=>{localStorage.setItem("codeEditorTheme",tt),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[tt]),n.useEffect(()=>{localStorage.setItem("codeEditorWordWrap",ht.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[ht]),n.useEffect(()=>{localStorage.setItem("codeEditorShowMinimap",jt.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[jt]),n.useEffect(()=>{localStorage.setItem("codeEditorLineNumbers",kt.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[kt]),n.useEffect(()=>{localStorage.setItem("codeEditorFontSize",xr),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[xr]);const Ar=async()=>{try{let W=null;try{const ee=await me.settings.getAgentPermissions();ee.ok&&(W=(await ee.json()).agentPermissions)}catch{}if(W)b(W.allowedTools||[]),f(W.disallowedTools||[]),R(W.skipPermissions||!1),_(W.projectSortOrder||"name"),localStorage.setItem("claude-settings",JSON.stringify(W));else{const ee=localStorage.getItem("claude-settings");if(ee){const pe=JSON.parse(ee);b(pe.allowedTools||[]),f(pe.disallowedTools||[]),R(pe.skipPermissions||!1),_(pe.projectSortOrder||"name")}else b([]),f([]),R(!1),_("name")}await Dt()}catch(W){console.error("Error loading tool settings:",W),b([]),f([]),R(!1),_("name")}},nr=async()=>{D(!0),T(null);try{const W={allowedTools:k,disallowedTools:j,skipPermissions:S,projectSortOrder:X,lastUpdated:new Date().toISOString()};localStorage.setItem("claude-settings",JSON.stringify(W));try{await me.settings.saveAgentPermissions(W)}catch(ee){console.warn("Failed to sync agent permissions to server:",ee)}T("success"),setTimeout(()=>{o()},1e3)}catch(W){console.error("Error saving tool settings:",W),T("error")}finally{D(!1)}},nn=async W=>{if(W.preventDefault(),Le(""),be(""),!z){Le("请输入当前密码");return}if(!G){Le("请输入新密码");return}if(G.length<6){Le("新密码至少需要6个字符");return}if(G!==ce){Le("两次输入的新密码不一致");return}Ae(!0);try{const ee=await me.auth.changePassword(z,G),pe=await ee.json();ee.ok?(be("密码修改成功"),re(""),ae(""),Pe("")):Le(pe.error||"修改密码失败")}catch(ee){console.error("Error changing password:",ee),Le("网络错误,请稍后再试")}finally{Ae(!1)}},xt=h?.username&&!h.username.includes("@"),Rt=async()=>{Te(!0),se(""),gt(""),we(!1);try{const W=await me.auth.feishuBindToken(),ee=await W.json();W.ok&&ee.token?gt(ee.token):se(ee.error||"生成失败,请重试")}catch{se("网络错误,请稍后再试")}finally{Te(!1)}},or=()=>{if(!dt)return;const W=`/auth ${dt}`;if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(W).then(()=>{we(!0),setTimeout(()=>we(!1),2e3)});else{const ee=document.createElement("textarea");ee.value=W,ee.style.position="fixed",ee.style.opacity="0",document.body.appendChild(ee),ee.focus(),ee.select();try{document.execCommand("copy"),we(!0),setTimeout(()=>we(!1),2e3)}finally{document.body.removeChild(ee)}}},Pt=()=>{Se({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),fe(null),le(!1),ze("")},sr=(W=null)=>{W?(fe(W),Se({name:W.name,type:W.type,scope:W.scope,projectPath:W.projectPath||"",config:{...W.config},raw:W.raw,importMode:"form",jsonInput:""})):Pt(),le(!0)},wt=async W=>{W.preventDefault(),Be(!0);try{if(ie.importMode==="json"){const ee=await J("/api/mcp/cli/add-json",{method:"POST",body:JSON.stringify({name:ie.name,jsonConfig:ie.jsonInput,scope:ie.scope,projectPath:ie.projectPath})});if(ee.ok){const pe=await ee.json();if(pe.success)await Dt(),Pt(),T("success");else throw new Error(pe.error||"Failed to add server via JSON")}else{const pe=await ee.json();throw new Error(pe.error||"Failed to add server")}}else await gr(ie),Pt(),T("success")}catch(ee){g(`错误: ${ee.message}`,{variant:"error"}),T("error")}finally{Be(!1)}},ar=async(W,ee,pe)=>{if(await v("确定要删除此 MCP 服务器吗?",{title:"删除 MCP 服务器",variant:"danger",confirmText:"确认删除"}))try{await tr(W,ee,pe),T("success")}catch(Ie){g(`错误: ${Ie.message}`,{variant:"error"}),T("error")}},yr=async(W,ee)=>{try{Oe({...he,[W]:{loading:!0}});const pe=await Pr(W,ee);Oe({...he,[W]:pe})}catch(pe){Oe({...he,[W]:{success:!1,message:pe.message,details:[]}})}},br=async(W,ee)=>{try{Je({...Xe,[W]:!0});const pe=await rr(W,ee);Ye({...De,[W]:pe})}catch{Ye({...De,[W]:{success:!1,tools:[],resources:[],prompts:[]}})}finally{Je({...Xe,[W]:!1})}},yt=(W,ee)=>{Se(pe=>({...pe,config:{...pe.config,[W]:ee}}))};return r?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[9999] md:p-4 bg-background/95",children:e.jsxs("div",{className:"bg-background border border-border md:rounded-lg shadow-xl w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-border flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ut,{className:"w-5 h-5 md:w-6 md:h-6 text-blue-600"}),e.jsx("h2",{className:"text-lg md:text-xl font-semibold text-foreground",children:"设置"})]}),e.jsx(U,{variant:"ghost",size:"sm",onClick:o,className:"text-muted-foreground hover:text-foreground touch-manipulation",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsx("div",{className:"border-b border-border",children:e.jsxs("div",{className:"flex px-4 md:px-6",children:[Qe&&e.jsx("button",{onClick:()=>_e("agents"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Ce==="agents"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Agent"}),e.jsx("button",{onClick:()=>_e("shared_projects"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Ce==="shared_projects"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"共享项目模板"}),e.jsx("button",{onClick:()=>_e("cron_tasks"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Ce==="cron_tasks"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"定时任务"}),e.jsx("button",{onClick:()=>_e("appearance"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Ce==="appearance"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"外观"}),e.jsx("button",{onClick:()=>_e("account"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${Ce==="account"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"账户"})]})}),e.jsxs("div",{className:"p-4 md:p-6 space-y-6 md:space-y-8 pb-safe-area-inset-bottom",children:[Ce==="appearance"&&e.jsx("div",{className:"space-y-6 md:space-y-8",children:Ce==="appearance"&&e.jsxs("div",{className:"space-y-6 md:space-y-8",children:[e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"深色模式"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"切换浅色和深色主题"})]}),e.jsxs("button",{onClick:x,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":t,"aria-label":"Toggle dark mode",children:[e.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),e.jsx("span",{className:`${t?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:t?e.jsx(Ur,{className:"w-3.5 h-3.5 text-gray-700"}):e.jsx(Gr,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"视图选项"}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:[e.jsx(_a,{className:"h-4 w-4 text-muted-foreground"}),"自动滚动到底部"]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"有新消息时自动滚动到底部"})]}),e.jsxs("button",{onClick:()=>m&&m(!c),className:`relative inline-flex h-8 w-14 items-center rounded-full transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900 ${c?"bg-blue-600":"bg-gray-200 dark:bg-gray-700"}`,role:"switch","aria-checked":c,"aria-label":"Toggle auto scroll",children:[e.jsx("span",{className:"sr-only",children:"Toggle auto scroll"}),e.jsx("span",{className:`${c?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"输入设置"}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-foreground flex items-center gap-2",children:[e.jsx(za,{className:"h-4 w-4 text-muted-foreground"}),"使用 Ctrl+Enter 发送"]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"启用后,按 Ctrl+Enter 发送消息而不是 Enter。这对于输入法用户很有用,可以避免误发送。"})]}),e.jsxs("button",{onClick:()=>s&&s(!d),className:`relative inline-flex h-8 w-14 items-center rounded-full transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900 ${d?"bg-blue-600":"bg-gray-200 dark:bg-gray-700"}`,role:"switch","aria-checked":d,"aria-label":"Toggle ctrl enter",children:[e.jsx("span",{className:"sr-only",children:"Toggle ctrl enter"}),e.jsx("span",{className:`${d?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})})]}),e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"项目排序"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"侧边栏中项目的排序方式"})]}),e.jsxs("select",{value:X,onChange:W=>_(W.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-32",children:[e.jsx("option",{value:"name",children:"按字母顺序"}),e.jsx("option",{value:"date",children:"按最近活动"})]})]})})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"文件编辑器"}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"编辑器主题"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"文件编辑器的默认主题"})]}),e.jsxs("button",{onClick:()=>ft(tt==="dark"?"light":"dark"),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":tt==="dark","aria-label":"Toggle editor theme",children:[e.jsx("span",{className:"sr-only",children:"Toggle editor theme"}),e.jsx("span",{className:`${tt==="dark"?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:tt==="dark"?e.jsx(Ur,{className:"w-3.5 h-3.5 text-gray-700"}):e.jsx(Gr,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"自动换行"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"在编辑器中默认启用自动换行"})]}),e.jsxs("button",{onClick:()=>hr(!ht),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":ht,"aria-label":"Toggle word wrap",children:[e.jsx("span",{className:"sr-only",children:"Toggle word wrap"}),e.jsx("span",{className:`${ht?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"显示小地图"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"在差异视图中显示小地图以便于导航"})]}),e.jsxs("button",{onClick:()=>et(!jt),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":jt,"aria-label":"Toggle minimap",children:[e.jsx("span",{className:"sr-only",children:"Toggle minimap"}),e.jsx("span",{className:`${jt?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"显示行号"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"在编辑器中显示行号"})]}),e.jsxs("button",{onClick:()=>Dr(!kt),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":kt,"aria-label":"Toggle line numbers",children:[e.jsx("span",{className:"sr-only",children:"Toggle line numbers"}),e.jsx("span",{className:`${kt?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"字体大小"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"编辑器字体大小(像素)"})]}),e.jsxs("select",{value:xr,onChange:W=>Ct(W.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-24",children:[e.jsx("option",{value:"10",children:"10px"}),e.jsx("option",{value:"11",children:"11px"}),e.jsx("option",{value:"12",children:"12px"}),e.jsx("option",{value:"13",children:"13px"}),e.jsx("option",{value:"14",children:"14px"}),e.jsx("option",{value:"15",children:"15px"}),e.jsx("option",{value:"16",children:"16px"}),e.jsx("option",{value:"18",children:"18px"}),e.jsx("option",{value:"20",children:"20px"})]})]})})]})]})}),Ce==="agents"&&e.jsx("div",{className:"flex flex-col h-full min-h-[400px] md:min-h-[500px]",children:e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:e.jsxs("div",{className:"flex px-2 md:px-4 overflow-x-auto",children:[i("tab_permissions")&&e.jsx("button",{onClick:()=>Ze("permissions"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${Re==="permissions"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"权限"}),i("tab_mcp")&&e.jsx("button",{onClick:()=>Ze("mcp"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${Re==="mcp"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"MCP 服务器"}),i("tab_skills")&&e.jsx("button",{onClick:()=>Ze("skills"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${Re==="skills"?"border-amber-600 text-amber-600 dark:text-amber-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"技能"}),i("tab_models")&&e.jsx("button",{onClick:()=>Ze("models"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${Re==="models"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"模型"})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-3 md:p-4",children:[Re==="permissions"&&e.jsx(Jl,{agent:"claude",skipPermissions:S,setSkipPermissions:R,allowedTools:k,setAllowedTools:b,disallowedTools:j,setDisallowedTools:f,newAllowedTool:w,setNewAllowedTool:N,newDisallowedTool:L,setNewDisallowedTool:E}),Re==="mcp"&&e.jsx(Vl,{agent:"claude",servers:te,onAdd:()=>sr(),onEdit:W=>sr(W),onDelete:(W,ee,pe)=>ar(W,ee,pe),onTest:(W,ee)=>yr(W,ee),onDiscoverTools:(W,ee)=>br(W,ee),testResults:he,serverTools:De,toolsLoading:Xe,onDiscoverRepo:()=>ye(!0)}),Re==="skills"&&e.jsx(rc,{projects:l}),Re==="models"&&e.jsx(Ql,{ref:K,onStatusChange:V})]})]})}),Ce==="shared_projects"&&e.jsx(nc,{projects:l}),Ce==="cron_tasks"&&e.jsx(gc,{}),Ce==="account"&&e.jsx("div",{className:"space-y-6 md:space-y-8",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"账户"}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-primary/10 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-lg font-semibold text-primary",children:h?.username?.charAt(0).toUpperCase()})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:h?.username}),e.jsx("div",{className:"text-sm text-muted-foreground",children:h?.role==="super_admin"?"超级管理员":h?.role==="admin"?"管理员":"用户"})]})]})}),xt&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(Pn,{className:"w-5 h-5 text-blue-600"}),e.jsx("div",{className:"font-medium text-foreground",children:"修改密码"})]}),e.jsxs("form",{onSubmit:nn,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"currentPassword",className:"block text-sm font-medium text-foreground mb-1",children:"当前密码"}),e.jsx("input",{type:"password",id:"currentPassword",value:z,onChange:W=>re(W.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入当前密码",disabled:at})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"newPassword",className:"block text-sm font-medium text-foreground mb-1",children:"新密码"}),e.jsx("input",{type:"password",id:"newPassword",value:G,onChange:W=>ae(W.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入新密码(至少6个字符)",disabled:at})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirmNewPassword",className:"block text-sm font-medium text-foreground mb-1",children:"确认新密码"}),e.jsx("input",{type:"password",id:"confirmNewPassword",value:ce,onChange:W=>Pe(W.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请再次输入新密码",disabled:at})]}),xe&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:xe})}),oe&&e.jsx("div",{className:"p-3 bg-green-100 dark:bg-green-900/20 border border-green-300 dark:border-green-800 rounded-md",children:e.jsx("p",{className:"text-sm text-green-700 dark:text-green-400",children:oe})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(U,{type:"submit",disabled:at,className:"bg-blue-600 hover:bg-blue-700",children:at?"修改中...":"修改密码"})})]})]}),i("feishu_binding")&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("img",{src:"/feishu-logo.svg",alt:"飞书",className:"h-4"}),e.jsx("div",{className:"font-medium text-foreground",children:"飞书账号绑定"})]}),Z?e.jsxs("div",{className:"flex items-center gap-2 mb-3 px-3 py-2 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-md",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500 shrink-0"}),e.jsxs("div",{className:"text-sm text-green-700 dark:text-green-400",children:["已绑定",e.jsx("span",{className:"ml-2 text-xs text-green-600/70 dark:text-green-500/70 font-mono",children:Z.feishuOpenId}),Z.createdAt&&e.jsxs("span",{className:"ml-2 text-xs text-green-600/70 dark:text-green-500/70",children:["· ",new Date(Z.createdAt).toLocaleDateString("zh-CN")]})]})]}):Z===!1?e.jsxs("div",{className:"flex items-center gap-2 mb-3 px-3 py-2 bg-gray-100 dark:bg-gray-800/50 border border-gray-200 dark:border-gray-700 rounded-md",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-400 shrink-0"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"未绑定飞书账号"})]}):null,e.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["生成绑定 Token,在飞书中向机器人发送 ",e.jsx("code",{className:"bg-gray-200 dark:bg-gray-700 px-1 rounded text-xs",children:"/auth <token>"})," 即可完成绑定,Token 有效期 24 小时。"]}),dt?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-background border border-border rounded-md",children:[e.jsxs("code",{className:"flex-1 text-xs text-foreground font-mono break-all select-all",children:["/auth ",dt]}),e.jsx("button",{onClick:or,className:"shrink-0 p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-800 text-muted-foreground hover:text-foreground transition-colors",title:"复制命令",children:ke?e.jsx(pr,{className:"w-4 h-4 text-green-500"}):e.jsx(Bn,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"复制上方命令,在飞书私聊机器人中发送"}),e.jsxs("button",{onClick:Rt,disabled:F,className:"flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-50",children:[e.jsx(st,{className:"w-3 h-3"}),"重新生成"]})]})]}):e.jsxs("div",{className:"space-y-2",children:[O&&e.jsx("p",{className:"text-sm text-red-500",children:O}),e.jsxs(U,{onClick:Rt,disabled:F,variant:"outline",className:"gap-2",children:[F?e.jsx(st,{className:"w-4 h-4 animate-spin"}):e.jsx(Pn,{className:"w-4 h-4"}),F?"生成中...":"生成绑定 Token"]})]})]}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:"退出登录"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"结束当前会话"})]}),e.jsxs(U,{variant:"outline",className:"gap-2 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800 hover:bg-red-50 dark:hover:bg-red-900/20",onClick:async()=>{await v("确定要退出登录吗?",{title:"退出登录",variant:"warning",confirmText:"退出"})&&(o(),p("/app"),a())},children:[e.jsx(Ra,{className:"w-4 h-4"}),"退出"]})]})})]})}),Y&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[110] p-4",children:e.jsxs("div",{className:"bg-background border border-border rounded-lg w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[e.jsx("h3",{className:"text-lg font-medium text-foreground",children:de?"编辑 MCP 服务器":"添加 MCP 服务器"}),e.jsx(U,{variant:"ghost",size:"sm",onClick:Pt,children:e.jsx(Ge,{className:"w-4 h-4"})})]}),e.jsxs("form",{onSubmit:wt,className:"p-4 space-y-4",children:[!de&&e.jsxs("div",{className:"flex gap-2 mb-4",children:[e.jsx("button",{type:"button",onClick:()=>Se(W=>({...W,importMode:"form"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${ie.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:"表单输入"}),e.jsx("button",{type:"button",onClick:()=>Se(W=>({...W,importMode:"json"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${ie.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:"JSON 导入"})]}),ie.importMode==="form"&&de&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"作用域"}),e.jsxs("div",{className:"flex items-center gap-2",children:[ie.scope==="user"?e.jsx(mr,{className:"w-4 h-4"}):e.jsx(Xr,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:ie.scope==="user"?"用户(全局)":"项目(本地)"}),ie.scope==="local"&&ie.projectPath&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",Ue(ie.projectPath)]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"编辑现有服务器时无法更改作用域"})]}),ie.importMode==="form"&&!de&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"作用域 *"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>Se(W=>({...W,scope:"user",projectPath:""})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${ie.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(mr,{className:"w-4 h-4"}),e.jsx("span",{children:"用户(全局)"})]})}),e.jsx("button",{type:"button",onClick:()=>Se(W=>({...W,scope:"local"})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${ie.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(Xr,{className:"w-4 h-4"}),e.jsx("span",{children:"项目(本地)"})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:ie.scope==="user"?"用户作用域:在您机器上的所有项目中可用":"本地作用域:仅在选定的项目中可用"})]}),ie.scope==="local"&&!de&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"项目 *"}),e.jsxs("select",{value:ie.projectPath,onChange:W=>Se(ee=>({...ee,projectPath:W.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",required:ie.scope==="local",children:[e.jsx("option",{value:"",children:"选择项目..."}),l.map(W=>e.jsx("option",{value:W.path||W.fullPath,children:W.displayName||W.name},W.name))]}),ie.projectPath&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Path: ",Ue(ie.projectPath)]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:ie.importMode==="json"?"md:col-span-2":"",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"服务器名称 *"}),e.jsx(ct,{value:ie.name,onChange:W=>{Se(ee=>({...ee,name:W.target.value}))},placeholder:"my-server",required:!0})]}),ie.importMode==="form"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"传输类型 *"}),e.jsxs("select",{value:ie.type,onChange:W=>{Se(ee=>({...ee,type:W.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",children:[e.jsx("option",{value:"stdio",children:"stdio"}),e.jsx("option",{value:"sse",children:"SSE"}),e.jsx("option",{value:"http",children:"HTTP"})]})]})]}),de&&ie.raw&&ie.importMode==="form"&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsxs("h4",{className:"text-sm font-medium text-foreground mb-2",children:["配置详情 (from ",de.scope==="global"?"~/.claude.json":"project config",")"]}),e.jsx("pre",{className:"text-xs bg-gray-100 dark:bg-gray-800 p-3 rounded overflow-x-auto",children:JSON.stringify(ie.raw,null,2)})]}),ie.importMode==="json"&&e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"JSON 配置 *"}),e.jsx("textarea",{value:ie.jsonInput,onChange:W=>{Se(ee=>({...ee,jsonInput:W.target.value}));try{if(W.target.value.trim()){const ee=JSON.parse(W.target.value);ee.type?ee.type==="stdio"&&!ee.command?ze("stdio 类型需要 command 字段"):(ee.type==="http"||ee.type==="sse")&&!ee.url?ze(`${ee.type} 类型需要 url 字段`):ze(""):ze("缺少必填字段:type")}}catch{W.target.value.trim()?ze("无效的 JSON 格式"):ze("")}},className:`w-full px-3 py-2 border ${$e?"border-red-500":"border-gray-300 dark:border-gray-600"} bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 font-mono text-sm`,rows:"8",placeholder:`{
163
163
  "type": "stdio",
164
164
  "command": "/path/to/server",
165
165
  "args": ["--api-key", "abc123"],
166
166
  "env": {
167
167
  "CACHE_DIR": "/tmp"
168
168
  }
169
- }`,required:!0}),$e&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:$e}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["以 JSON 格式粘贴您的 MCP 服务器配置。示例格式:",e.jsx("br",{}),"• stdio: ",'{"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',e.jsx("br",{}),"• http/sse: ",'{"type":"http","url":"https://api.example.com/mcp"}']})]})}),ae.importMode==="form"&&ae.type==="stdio"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"命令 *"}),e.jsx(ct,{value:ae.config.command,onChange:W=>yt("command",W.target.value),placeholder:"/path/to/mcp-server",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"参数(每行一个)"}),e.jsx("textarea",{value:Array.isArray(ae.config.args)?ae.config.args.join(`
169
+ }`,required:!0}),$e&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:$e}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["以 JSON 格式粘贴您的 MCP 服务器配置。示例格式:",e.jsx("br",{}),"• stdio: ",'{"type":"stdio","command":"npx","args":["@upstash/context7-mcp"]}',e.jsx("br",{}),"• http/sse: ",'{"type":"http","url":"https://api.example.com/mcp"}']})]})}),ie.importMode==="form"&&ie.type==="stdio"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"命令 *"}),e.jsx(ct,{value:ie.config.command,onChange:W=>yt("command",W.target.value),placeholder:"/path/to/mcp-server",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"参数(每行一个)"}),e.jsx("textarea",{value:Array.isArray(ie.config.args)?ie.config.args.join(`
170
170
  `):"",onChange:W=>yt("args",W.target.value.split(`
171
171
  `).filter(ee=>ee.trim())),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`--api-key
172
- abc123`})]})]}),ae.importMode==="form"&&(ae.type==="sse"||ae.type==="http")&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"URL *"}),e.jsx(ct,{value:ae.config.url,onChange:W=>yt("url",W.target.value),placeholder:"https://api.example.com/mcp",type:"url",required:!0})]}),ae.importMode==="form"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"环境变量(KEY=value,每行一个)"}),e.jsx("textarea",{value:Object.entries(ae.config.env||{}).map(([W,ee])=>`${W}=${ee}`).join(`
172
+ abc123`})]})]}),ie.importMode==="form"&&(ie.type==="sse"||ie.type==="http")&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"URL *"}),e.jsx(ct,{value:ie.config.url,onChange:W=>yt("url",W.target.value),placeholder:"https://api.example.com/mcp",type:"url",required:!0})]}),ie.importMode==="form"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"环境变量(KEY=value,每行一个)"}),e.jsx("textarea",{value:Object.entries(ie.config.env||{}).map(([W,ee])=>`${W}=${ee}`).join(`
173
173
  `),onChange:W=>{const ee={};W.target.value.split(`
174
- `).forEach(pe=>{const[_e,...ut]=pe.split("=");_e&&_e.trim()&&(ee[_e.trim()]=ut.join("=").trim())}),yt("env",ee)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`API_KEY=your-key
175
- DEBUG=true`})]}),ae.importMode==="form"&&(ae.type==="sse"||ae.type==="http")&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"请求头(KEY=value,每行一个)"}),e.jsx("textarea",{value:Object.entries(ae.config.headers||{}).map(([W,ee])=>`${W}=${ee}`).join(`
174
+ `).forEach(pe=>{const[Ie,...ut]=pe.split("=");Ie&&Ie.trim()&&(ee[Ie.trim()]=ut.join("=").trim())}),yt("env",ee)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`API_KEY=your-key
175
+ DEBUG=true`})]}),ie.importMode==="form"&&(ie.type==="sse"||ie.type==="http")&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"请求头(KEY=value,每行一个)"}),e.jsx("textarea",{value:Object.entries(ie.config.headers||{}).map(([W,ee])=>`${W}=${ee}`).join(`
176
176
  `),onChange:W=>{const ee={};W.target.value.split(`
177
- `).forEach(pe=>{const[_e,...ut]=pe.split("=");_e&&_e.trim()&&(ee[_e.trim()]=ut.join("=").trim())}),yt("headers",ee)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`Authorization=Bearer token
178
- X-API-Key=your-key`})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(U,{type:"button",variant:"outline",onClick:Pt,children:"取消"}),e.jsx(U,{type:"submit",disabled:He,className:"bg-purple-600 hover:bg-purple-700 disabled:opacity-50",children:He?"保存中...":de?"更新服务器":"添加服务器"})]})]})]})})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-4 md:p-6 border-t border-border flex-shrink-0 gap-3 pb-safe-area-inset-bottom",children:[e.jsx("div",{className:"flex items-center justify-center sm:justify-start gap-2 order-2 sm:order-1",children:Ce==="agents"&&ze==="models"?B.saving?e.jsx("span",{className:"text-sm text-muted-foreground",children:"保存中..."}):null:e.jsxs(e.Fragment,{children:[$==="success"&&e.jsxs("div",{className:"text-green-600 dark:text-green-400 text-sm flex items-center gap-1",children:[e.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"设置保存成功!"]}),$==="error"&&e.jsxs("div",{className:"text-red-600 dark:text-red-400 text-sm flex items-center gap-1",children:[e.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),"保存设置失败"]})]})}),e.jsxs("div",{className:"flex items-center gap-3 order-1 sm:order-2",children:[Ce==="agents"&&ze==="models"&&B.hasChanges&&e.jsx(U,{variant:"outline",onClick:()=>K.current?.reset(),disabled:B.saving,className:"flex-1 sm:flex-none h-10 touch-manipulation",children:"重置"}),e.jsx(U,{variant:"outline",onClick:o,disabled:M||B.saving,className:"flex-1 sm:flex-none h-10 touch-manipulation",children:"取消"}),e.jsx(U,{onClick:Ce==="agents"&&ze==="models"?()=>K.current?.save():nr,disabled:Ce==="agents"&&ze==="models"?B.saving||!B.hasChanges:M,className:"flex-1 sm:flex-none h-10 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 touch-manipulation",children:M||B.saving?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 animate-spin rounded-full border-2 border-white border-t-transparent"}),"保存中..."]}):"保存设置"})]})]})]})}),Ee&&e.jsx(vc,{onClose:()=>ge(!1),onInstalled:()=>Dt(),onOpenRepoManager:()=>{ge(!1),Fe(!0)},projects:l}),Me&&e.jsx(yc,{onClose:()=>Fe(!1),onChanged:()=>{}})]}):null}const kc=[{key:"claude_shell",label:"Claude Code Shell",desc:"访问 Claude Code 终端"},{key:"codex_shell",label:"Codex Shell",desc:"访问 Codex 终端"},{key:"gemini_shell",label:"Gemini CLI Shell",desc:"访问 Gemini CLI 终端"},{key:"submit_agent",label:"提交 Agent",desc:"在 Agent 商店中提交新 Agent"},{key:"tab_models",label:"模型设置",desc:"设置 > Agent > 模型 tab"},{key:"tab_skills",label:"技能设置",desc:"设置 > Agent > 技能 tab"},{key:"tab_mcp",label:"MCP 服务器设置",desc:"设置 > Agent > MCP 服务器 tab"},{key:"tab_permissions",label:"权限设置",desc:"设置 > Agent > 权限 tab"},{key:"feishu_binding",label:"绑定飞书账号",desc:"设置 > 账户 > 飞书绑定"},{key:"create_project",label:"新建项目",desc:"侧边栏 > 新建项目按钮"}];function wc({user:r,onClose:o,onSaved:l}){const[u,c]=n.useState({}),[m,d]=n.useState(!0),[s,p]=n.useState(!1),[t,x]=n.useState(""),[h,a]=n.useState(!1);n.useEffect(()=>{i()},[r.id]);const i=async()=>{d(!0);try{const j=await(await me.admin.getUserPermissions(r.id)).json();if(j.permissions)c(j.permissions),a(!0);else{const w=await(await me.admin.getDefaultPermissions()).json();c(w.permissions||{}),a(!1)}}catch(b){console.error("Error fetching permissions:",b),x("加载权限失败")}finally{d(!1)}},g=b=>{c(j=>({...j,[b]:!j[b]})),a(!0)},v=async b=>{b.preventDefault(),x(""),p(!0);try{const j=await me.admin.updateUserPermissions(r.id,u),f=await j.json();j.ok?(l?.(),o()):x(f.error||"保存失败")}catch(j){console.error("Error saving permissions:",j),x("网络错误,请稍后再试")}finally{p(!1)}},k=async()=>{x(""),p(!0);try{if((await me.admin.updateUserPermissions(r.id,null)).ok){const f=await(await me.admin.getDefaultPermissions()).json();c(f.permissions||{}),a(!1)}}catch(b){console.error("Error resetting permissions:",b),x("重置失败")}finally{p(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-lg w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"text-lg font-semibold text-foreground",children:["功能权限 - ",r.username||r.email]}),h?e.jsx("p",{className:"text-xs text-blue-500 mt-0.5",children:"已设置个性化权限"}):e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"使用系统默认权限"})]}),e.jsx("button",{onClick:o,className:"text-muted-foreground hover:text-foreground",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),m?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):e.jsxs("form",{onSubmit:v,className:"space-y-3",children:[e.jsx("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:kc.map(b=>e.jsxs("label",{className:"flex items-center justify-between p-2.5 rounded-md hover:bg-accent/50 cursor-pointer transition-colors",children:[e.jsxs("div",{className:"min-w-0 mr-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:b.label}),e.jsx("div",{className:"text-xs text-muted-foreground",children:b.desc})]}),e.jsx("button",{type:"button",role:"switch","aria-checked":u[b.key]!==!1,onClick:()=>g(b.key),className:`relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${u[b.key]!==!1?"bg-blue-600":"bg-gray-300 dark:bg-gray-600"}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${u[b.key]!==!1?"translate-x-4":"translate-x-0"}`})})]},b.key))}),t&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:t})}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(U,{type:"button",variant:"ghost",size:"sm",onClick:k,disabled:s||!h,className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(as,{className:"w-3.5 h-3.5"}),"重置为默认"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(U,{type:"button",variant:"outline",onClick:o,disabled:s,children:"取消"}),e.jsx(U,{type:"submit",disabled:s,children:s?"保存中...":"保存"})]})]})]})]})})}function Nc({user:r,onClose:o,onSaved:l}){const[u,c]=n.useState(new Set),[m,d]=n.useState([]),[s,p]=n.useState(""),[t,x]=n.useState(!0),[h,a]=n.useState(!1),[i,g]=n.useState(""),[v,k]=n.useState(!1);n.useEffect(()=>{b()},[r.id]);const b=async()=>{x(!0);try{const[N,R]=await Promise.all([J("/api/agents"),me.admin.getUserVisibleAgents(r.id)]),M=await N.json(),E=await R.json();d(M.agents||[]),E.agents&&Array.isArray(E.agents)?(c(new Set(E.agents)),k(!0)):(c(new Set),k(!1))}catch(N){console.error("Error fetching agent visibility data:",N),g("加载数据失败")}finally{x(!1)}},j=n.useMemo(()=>{if(!s.trim())return m;const N=s.toLowerCase();return m.filter(R=>(R.display_name||R.name||"").toLowerCase().includes(N)||(R.description||"").toLowerCase().includes(N)||(R.dirName||"").toLowerCase().includes(N))},[m,s]),f=j.length>0&&j.every(N=>u.has(N.dirName||N.name)),w=N=>{c(R=>{const M=new Set(R);return M.has(N)?M.delete(N):M.add(N),M}),k(!0)},S=()=>{c(N=>{const R=new Set(N);return f?j.forEach(M=>R.delete(M.dirName||M.name)):j.forEach(M=>R.add(M.dirName||M.name)),R}),k(!0)},z=async N=>{N.preventDefault(),g(""),a(!0);try{const R=[...u],M=await me.admin.updateUserVisibleAgents(r.id,R),E=await M.json();M.ok?(l?.(),o()):g(E.error||"保存失败")}catch(R){console.error("Error saving agent visibility:",R),g("网络错误,请稍后再试")}finally{a(!1)}},D=async()=>{g(""),a(!0);try{(await me.admin.updateUserVisibleAgents(r.id,null)).ok&&(c(new Set),k(!1))}catch(N){console.error("Error resetting agent visibility:",N),g("重置失败")}finally{a(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-lg w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"text-lg font-semibold text-foreground",children:["共享项目可见性 - ",r.username||r.email]}),v?e.jsxs("p",{className:"text-xs text-blue-500 mt-0.5",children:["已设置个性化配置(已选 ",u.size," 个)"]}):e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"使用默认配置(不可见任何 Agent)"})]}),e.jsx("button",{onClick:o,className:"text-muted-foreground hover:text-foreground",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),t?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):m.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx($a,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"仓库中暂无 Agent"})]}):e.jsxs("form",{onSubmit:z,className:"space-y-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx("input",{type:"text",value:s,onChange:N=>p(N.target.value),placeholder:"搜索 Agent...",className:"w-full pl-8 pr-3 py-1.5 text-sm bg-background border border-border rounded-md focus:outline-none focus:ring-1 focus:ring-blue-500"})]}),e.jsxs("label",{className:"flex items-center gap-2 px-2.5 py-1.5 text-sm text-muted-foreground cursor-pointer hover:text-foreground",children:[e.jsx("input",{type:"checkbox",checked:f,onChange:S,className:"w-3.5 h-3.5 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),s?`全选搜索结果(${j.length})`:`全选(${m.length})`]}),e.jsx("div",{className:"space-y-0.5 max-h-[400px] overflow-y-auto border border-border rounded-md",children:j.length===0?e.jsx("div",{className:"text-center py-6 text-muted-foreground text-sm",children:"未找到匹配的 Agent"}):j.map(N=>{const R=N.dirName||N.name,M=u.has(R);return e.jsxs("label",{className:`flex items-start gap-2.5 px-3 py-2 cursor-pointer transition-colors hover:bg-accent/50 ${M?"bg-blue-50/50 dark:bg-blue-900/10":""}`,children:[e.jsx("input",{type:"checkbox",checked:M,onChange:()=>w(R),className:"w-3.5 h-3.5 mt-0.5 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:N.display_name||N.name}),N.version&&e.jsxs("span",{className:"text-xs px-1.5 py-0.5 bg-gray-100 dark:bg-gray-800 text-muted-foreground rounded flex-shrink-0",children:["v",N.version]})]}),N.description&&e.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:N.description})]})]},R)})}),e.jsxs("div",{className:"text-xs text-muted-foreground px-1",children:["已选 ",u.size," / 共 ",m.length," 个 Agent"]}),i&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:i})}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(U,{type:"button",variant:"ghost",size:"sm",onClick:D,disabled:h||!v,className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(as,{className:"w-3.5 h-3.5"}),"重置为默认"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(U,{type:"button",variant:"outline",onClick:o,disabled:h,children:"取消"}),e.jsx(U,{type:"submit",disabled:h,children:h?"保存中...":"保存"})]})]})]})]})})}function Sc({isSuperAdmin:r,onNavigateToUsage:o,onViewUser:l}){const{user:u}=Ot(),{showConfirm:c}=lt(),[m,d]=n.useState([]),[s,p]=n.useState({}),[t,x]=n.useState(!0),[h,a]=n.useState(null),[i,g]=n.useState(!1),[v,k]=n.useState(""),[b,j]=n.useState(""),[f,w]=n.useState(""),[S,z]=n.useState(!1),[D,N]=n.useState(null),[R,M]=n.useState({total_limit_usd:"",daily_limit_usd:""}),[E,$]=n.useState(""),[T,X]=n.useState(!1),[_,te]=n.useState(null),[ne,G]=n.useState(""),[le,de]=n.useState(""),[fe,Ee]=n.useState(""),[ge,Me]=n.useState(!1),[Fe,ae]=n.useState(null),[Ne,He]=n.useState(""),[Be,he]=n.useState(""),[Oe,De]=n.useState(!1),[Ye,Te]=n.useState(null),[Je,Ce]=n.useState(null),[Re,$e]=n.useState(null),Ie=async()=>{try{const F=await J("/api/admin/users");if(F.ok){const Se=await F.json();d(Se.users)}}catch(F){console.error("Error fetching users:",F)}finally{x(!1)}},ze=async()=>{try{const F=await J("/api/admin/usage/summary");if(F.ok){const Se=await F.json(),O={};for(const se of Se.users)O[se.user_uuid]={total_cost:se.total_cost||0,total_requests:se.total_requests||0,last_active:se.last_active};p(O)}}catch(F){console.error("Error fetching usage data:",F)}};n.useEffect(()=>{Ie(),ze()},[]);const Ze=F=>!F||F===0?"$0.00":F<.01?`$${F.toFixed(4)}`:`$${F.toFixed(2)}`,Qe=F=>F.role==="super_admin"?!1:r||F.id===u?.id?!0:F.role==="user",K=F=>F.id===u?.id?!1:r?F.role!=="super_admin":!["admin","super_admin"].includes(F.role),B=async(F,Se)=>{const O=Se==="active"?"disabled":"active";a(F);try{(await J(`/api/admin/users/${F}`,{method:"PATCH",body:JSON.stringify({status:O})})).ok&&d(m.map(je=>je.id===F?{...je,status:O}:je))}catch(se){console.error("Error updating user status:",se)}finally{a(null)}},C=async(F,Se)=>{if(await c(`确定要删除用户 "${Se}"?这将删除其所有数据。`,{title:"删除用户",variant:"danger",confirmText:"确认删除"})){a(F);try{(await J(`/api/admin/users/${F}`,{method:"DELETE"})).ok&&d(m.filter(se=>se.id!==F))}catch(O){console.error("Error deleting user:",O)}finally{a(null)}}},V=async F=>{if(F.preventDefault(),w(""),!v||!b){w("用户名和密码不能为空");return}if(v.length<3){w("用户名至少3个字符");return}if(b.length<6){w("密码至少6个字符");return}z(!0);try{const Se=await me.admin.createUser(v,b),O=await Se.json();Se.ok?(await Ie(),g(!1),k(""),j("")):w(O.error||"创建用户失败")}catch(Se){console.error("Error creating user:",Se),w("网络错误,请稍后再试")}finally{z(!1)}},I=()=>{g(!1),k(""),j(""),w("")},re=F=>{N(F),M({total_limit_usd:F.total_limit_usd!==null&&F.total_limit_usd!==void 0?String(F.total_limit_usd):"",daily_limit_usd:F.daily_limit_usd!==null&&F.daily_limit_usd!==void 0?String(F.daily_limit_usd):""}),$("")},Y=()=>{N(null),M({total_limit_usd:"",daily_limit_usd:""}),$("")},ie=async F=>{F.preventDefault(),$("");const Se=R.total_limit_usd.trim()===""?null:parseFloat(R.total_limit_usd),O=R.daily_limit_usd.trim()===""?null:parseFloat(R.daily_limit_usd);if(Se!==null&&(isNaN(Se)||Se<0)){$("总额度限制必须是正数或留空");return}if(O!==null&&(isNaN(O)||O<0)){$("每日额度限制必须是正数或留空");return}X(!0);try{const se=await me.admin.updateUserLimits(D.id,{total_limit_usd:Se,daily_limit_usd:O}),je=await se.json();se.ok?(d(m.map(ke=>ke.id===D.id?{...ke,total_limit_usd:Se,daily_limit_usd:O}:ke)),Y()):$(je.error||"更新限制失败")}catch(se){console.error("Error updating limits:",se),$("网络错误,请稍后再试")}finally{X(!1)}},ce=F=>F==null?"无限制":`$${F.toFixed(2)}`,Ae=F=>{te(F),G(""),de(""),Ee("")},Xe=()=>{te(null),G(""),de(""),Ee("")},Le=async F=>{if(F.preventDefault(),Ee(""),!ne){Ee("请输入新密码");return}if(ne.length<6){Ee("密码至少需要6个字符");return}if(ne!==le){Ee("两次输入的密码不一致");return}Me(!0);try{const Se=await me.admin.resetUserPassword(_.id,ne),O=await Se.json();Se.ok?Xe():Ee(O.error||"重置密码失败")}catch(Se){console.error("Error resetting password:",Se),Ee("网络错误,请稍后再试")}finally{Me(!1)}},oe=F=>{ae(F),He(F.role==="admin"?"admin":"user"),he("")},ye=()=>{ae(null),He(""),he("")},at=async F=>{F.preventDefault(),he(""),De(!0);try{const Se=await me.admin.updateUserRole(Fe.id,Ne),O=await Se.json();Se.ok?(d(m.map(se=>se.id===Fe.id?{...se,role:Ne}:se)),ye()):he(O.error||"更新角色失败")}catch(Se){console.error("Error updating role:",Se),he("网络错误,请稍后再试")}finally{De(!1)}},Pe=F=>F==="super_admin"?e.jsx(Ja,{className:"w-4 h-4 text-amber-500 flex-shrink-0"}):F==="admin"?e.jsx(Gt,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):e.jsx(An,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),dt=F=>F==="super_admin"?e.jsx("span",{className:"inline-block px-1.5 py-0.5 text-xs rounded whitespace-nowrap bg-amber-500/20 text-amber-500",children:"超级管理员"}):F==="admin"?e.jsx("span",{className:"inline-block px-1.5 py-0.5 text-xs rounded whitespace-nowrap bg-blue-500/20 text-blue-400",children:"管理员"}):e.jsx("span",{className:"inline-block px-1.5 py-0.5 text-xs rounded whitespace-nowrap bg-gray-500/20 text-gray-400",children:"用户"}),gt=F=>{const Se=()=>{$e(F),setTimeout(()=>$e(null),2e3)};if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(F).then(Se);else{const O=document.createElement("textarea");O.value=F,O.style.position="fixed",O.style.opacity="0",document.body.appendChild(O),O.select(),document.execCommand("copy"),document.body.removeChild(O),Se()}};return t?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"正在加载用户..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"用户管理"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(U,{variant:"default",size:"sm",onClick:()=>g(!0),className:"flex items-center gap-2",children:[e.jsx(Wa,{className:"w-4 h-4"}),"创建用户"]}),o&&e.jsxs(U,{variant:"outline",size:"sm",onClick:o,className:"flex items-center gap-2",children:[e.jsx(Fa,{className:"w-4 h-4"}),"使用量统计"]})]})]}),e.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[580px] table-fixed",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-muted-foreground w-44",children:"用户"}),e.jsx("th",{className:"px-3 py-2 text-center text-xs font-medium text-muted-foreground w-20",children:"角色"}),e.jsx("th",{className:"px-3 py-2 text-center text-xs font-medium text-muted-foreground w-10",children:"状"}),e.jsx("th",{className:"px-3 py-2 text-right text-xs font-medium text-muted-foreground w-36",children:"费用 / 额度"}),e.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-muted-foreground w-20",children:"创建"}),e.jsx("th",{className:"px-3 py-2 text-right text-xs font-medium text-muted-foreground",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:m.map(F=>e.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-900/30",children:[e.jsx("td",{className:"px-3 py-2 w-44",children:e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[Pe(F.role),e.jsx("span",{className:"font-medium text-foreground text-sm truncate block min-w-0",title:F.username||F.email,children:F.username||(F.email?.includes("@")?F.email.split("@")[0]:F.email)})]})}),e.jsx("td",{className:"px-3 py-2 text-center",children:dt(F.role)}),e.jsx("td",{className:"px-3 py-2 text-center",children:e.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${F.status==="active"?"bg-green-500":"bg-red-500"}`,title:F.status==="active"?"活跃":"已禁用"})}),e.jsx("td",{className:"px-3 py-2 text-right",children:e.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[e.jsx("span",{className:"font-mono text-xs text-foreground whitespace-nowrap",children:Ze(s[F.uuid]?.total_cost)}),Qe(F)?e.jsx("button",{onClick:()=>re(F),className:"text-[11px] text-blue-600 dark:text-blue-400 hover:underline font-mono whitespace-nowrap leading-tight",title:"点击编辑额度限制",children:F.total_limit_usd!==null||F.daily_limit_usd!==null?e.jsxs("span",{children:["总:",ce(F.total_limit_usd)," 日:",ce(F.daily_limit_usd)]}):e.jsxs("span",{className:"flex items-center gap-0.5 justify-end text-muted-foreground",children:[e.jsx(Yn,{className:"w-3 h-3"}),"设置限额"]})}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})]})}),e.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground whitespace-nowrap",children:new Date(F.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-end gap-0.5",children:[e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>gt(F.uuid),title:`复制用户 UID: ${F.uuid}`,children:Re===F.uuid?e.jsx(pr,{className:"w-4 h-4 text-green-500"}):e.jsx(Bn,{className:"w-4 h-4 text-gray-400"})}),l&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>l(F.uuid,F.username||F.email),title:"查看使用详情",children:e.jsx(Ha,{className:"w-4 h-4 text-indigo-500"})}),r&&F.role!=="super_admin"&&F.id!==u?.id&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>oe(F),title:"修改角色",children:e.jsx(Ba,{className:"w-4 h-4 text-purple-500"})}),F.role==="user"&&K(F)&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>Te(F),title:"功能权限",children:e.jsx(Ua,{className:"w-4 h-4 text-green-500"})}),F.role==="user"&&K(F)&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>Ce(F),title:"共享项目可见性",children:e.jsx(ts,{className:"w-4 h-4 text-cyan-500"})}),K(F)&&e.jsxs(e.Fragment,{children:[F.username&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>Ae(F),disabled:h===F.id,title:"重置密码",children:e.jsx(Pn,{className:"w-4 h-4 text-blue-500"})}),e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>B(F.id,F.status),disabled:h===F.id,title:F.status==="active"?"禁用用户":"启用用户",children:F.status==="active"?e.jsx(Ga,{className:"w-4 h-4 text-orange-500"}):e.jsx(Ya,{className:"w-4 h-4 text-green-500"})}),e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>C(F.id,F.username||F.email),disabled:h===F.id,title:"删除用户",children:h===F.id?e.jsx(bt,{className:"w-4 h-4 text-red-500 animate-spin"}):e.jsx(vt,{className:"w-4 h-4 text-red-500"})})]})]})})]},F.id))})]})}),i&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-lg w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h4",{className:"text-lg font-semibold text-foreground",children:"创建用户"}),e.jsx("button",{onClick:I,className:"text-muted-foreground hover:text-foreground",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("form",{onSubmit:V,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"newUsername",className:"block text-sm font-medium text-foreground mb-1",children:"用户名"}),e.jsx("input",{type:"text",id:"newUsername",value:v,onChange:F=>k(F.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入用户名",disabled:S})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"newPassword",className:"block text-sm font-medium text-foreground mb-1",children:"密码"}),e.jsx("input",{type:"password",id:"newPassword",value:b,onChange:F=>j(F.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入密码",disabled:S})]}),f&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:f})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(U,{type:"button",variant:"outline",onClick:I,disabled:S,children:"取消"}),e.jsx(U,{type:"submit",disabled:S,children:S?"创建中...":"创建"})]})]})]})}),D&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-lg w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h4",{className:"text-lg font-semibold text-foreground",children:["设置额度限制 - ",D.username||D.email]}),e.jsx("button",{onClick:Y,className:"text-muted-foreground hover:text-foreground",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("form",{onSubmit:ie,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"totalLimit",className:"block text-sm font-medium text-foreground mb-1",children:"总额度上限 (USD)"}),e.jsx("input",{type:"number",id:"totalLimit",step:"0.01",min:"0",value:R.total_limit_usd,onChange:F=>M(Se=>({...Se,total_limit_usd:F.target.value})),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"留空表示不限制",disabled:T}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"用户累计使用金额达到此限制后,将无法继续使用"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"dailyLimit",className:"block text-sm font-medium text-foreground mb-1",children:"每日额度上限 (USD)"}),e.jsx("input",{type:"number",id:"dailyLimit",step:"0.01",min:"0",value:R.daily_limit_usd,onChange:F=>M(Se=>({...Se,daily_limit_usd:F.target.value})),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"留空表示不限制",disabled:T}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"用户每日使用金额达到此限制后,需等待次日重置"})]}),s[D.uuid]&&e.jsx("div",{className:"p-3 bg-gray-100 dark:bg-gray-800 rounded-md",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["当前已使用:",e.jsx("span",{className:"font-mono text-foreground",children:Ze(s[D.uuid]?.total_cost)})]})}),E&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:E})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(U,{type:"button",variant:"outline",onClick:Y,disabled:T,children:"取消"}),e.jsx(U,{type:"submit",disabled:T,children:T?"保存中...":"保存"})]})]})]})}),_&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-lg w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h4",{className:"text-lg font-semibold text-foreground",children:["重置密码 - ",_.username]}),e.jsx("button",{onClick:Xe,className:"text-muted-foreground hover:text-foreground",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("form",{onSubmit:Le,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"resetNewPassword",className:"block text-sm font-medium text-foreground mb-1",children:"新密码"}),e.jsx("input",{type:"password",id:"resetNewPassword",value:ne,onChange:F=>G(F.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入新密码(至少6个字符)",disabled:ge})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"resetConfirmPassword",className:"block text-sm font-medium text-foreground mb-1",children:"确认新密码"}),e.jsx("input",{type:"password",id:"resetConfirmPassword",value:le,onChange:F=>de(F.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请再次输入新密码",disabled:ge})]}),fe&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:fe})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(U,{type:"button",variant:"outline",onClick:Xe,disabled:ge,children:"取消"}),e.jsx(U,{type:"submit",disabled:ge,children:ge?"重置中...":"重置密码"})]})]})]})}),Fe&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-lg w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h4",{className:"text-lg font-semibold text-foreground",children:["修改角色 - ",Fe.username||Fe.email]}),e.jsx("button",{onClick:ye,className:"text-muted-foreground hover:text-foreground",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("form",{onSubmit:at,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"选择角色"}),e.jsxs("label",{className:"flex items-center gap-3 p-3 border border-border rounded-md cursor-pointer hover:bg-accent/50 transition-colors",children:[e.jsx("input",{type:"radio",name:"role",value:"admin",checked:Ne==="admin",onChange:F=>He(F.target.value),className:"text-blue-600",disabled:Oe}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Gt,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"管理员"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"可管理普通用户,但不能操作其他管理员"})]})]}),e.jsxs("label",{className:"flex items-center gap-3 p-3 border border-border rounded-md cursor-pointer hover:bg-accent/50 transition-colors",children:[e.jsx("input",{type:"radio",name:"role",value:"user",checked:Ne==="user",onChange:F=>He(F.target.value),className:"text-blue-600",disabled:Oe}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(An,{className:"w-4 h-4 text-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"普通用户"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"受额度限制,无管理权限"})]})]})]}),Be&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:Be})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(U,{type:"button",variant:"outline",onClick:ye,disabled:Oe,children:"取消"}),e.jsx(U,{type:"submit",disabled:Oe,children:Oe?"保存中...":"保存"})]})]})]})}),Ye&&e.jsx(wc,{user:Ye,onClose:()=>Te(null),onSaved:()=>Ie()}),Je&&e.jsx(Nc,{user:Je,onClose:()=>Ce(null),onSaved:()=>Ie()})]})}function Tc(){const[r,o]=n.useState(""),[l,u]=n.useState(""),[c,m]=n.useState(!0),[d,s]=n.useState(!1),[p,t]=n.useState(null);n.useEffect(()=>{x()},[]);const x=async()=>{try{const a=await me.admin.getDefaultLimits();if(a.ok){const i=await a.json();o(i.default_total_limit_usd!==null?String(i.default_total_limit_usd):""),u(i.default_daily_limit_usd!==null?String(i.default_daily_limit_usd):"")}}catch(a){console.error("Error fetching default limits:",a)}finally{m(!1)}},h=async a=>{a.preventDefault(),s(!0),t(null);const i=r.trim()===""?null:parseFloat(r),g=l.trim()===""?null:parseFloat(l);if(i!==null&&(isNaN(i)||i<0)){t("error"),s(!1);return}if(g!==null&&(isNaN(g)||g<0)){t("error"),s(!1);return}try{(await me.admin.updateDefaultLimits({default_total_limit_usd:i,default_daily_limit_usd:g})).ok?(t("success"),setTimeout(()=>t(null),2e3)):t("error")}catch(v){console.error("Error updating default limits:",v),t("error")}finally{s(!1)}};return c?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"正在加载..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"新用户默认额度"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"新注册用户将自动应用此总额度限制,留空表示不限制。管理员账户不受此限制。"})]}),e.jsx("form",{onSubmit:h,className:"space-y-3",children:e.jsxs("div",{className:"flex items-end gap-3",children:[e.jsxs("div",{className:"flex-1 max-w-xs",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-1",children:"默认总额度上限 (USD)"}),e.jsx("input",{type:"number",step:"0.01",min:"0",value:r,onChange:a=>o(a.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"留空表示不限制",disabled:d})]}),e.jsxs("div",{className:"flex-1 max-w-xs",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-1",children:"默认日限制 (USD)"}),e.jsx("input",{type:"number",step:"0.01",min:"0",value:l,onChange:a=>u(a.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"留空表示不限制",disabled:d})]}),e.jsxs(U,{type:"submit",variant:"default",size:"sm",disabled:d,className:"flex items-center gap-2",children:[e.jsx(Un,{className:"w-4 h-4"}),d?"保存中...":"保存"]}),p==="success"&&e.jsx("span",{className:"text-sm text-green-600",children:"已保存"}),p==="error"&&e.jsx("span",{className:"text-sm text-red-600",children:"请输入有效的正数"})]})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"此设置仅影响新注册的用户,不会修改已有用户的额度。"})]})}const Xc=[{key:"claude_shell",label:"Claude Code Shell"},{key:"codex_shell",label:"Codex Shell"},{key:"gemini_shell",label:"Gemini CLI Shell"},{key:"submit_agent",label:"提交 Agent"},{key:"tab_models",label:"模型设置"},{key:"tab_skills",label:"技能设置"},{key:"tab_mcp",label:"MCP 服务器设置"},{key:"tab_permissions",label:"权限设置"},{key:"feishu_binding",label:"绑定飞书账号"},{key:"create_project",label:"新建项目"}];function Mc(){const[r,o]=n.useState({}),[l,u]=n.useState(!0),[c,m]=n.useState(!1),[d,s]=n.useState(null);n.useEffect(()=>{p()},[]);const p=async()=>{try{const h=await me.admin.getDefaultPermissions();if(h.ok){const a=await h.json();o(a.permissions||{})}}catch(h){console.error("Error fetching default permissions:",h)}finally{u(!1)}},t=h=>{o(a=>({...a,[h]:!a[h]}))},x=async h=>{h.preventDefault(),m(!0),s(null);try{(await me.admin.updateDefaultPermissions(r)).ok?(s("success"),setTimeout(()=>s(null),2e3)):s("error")}catch(a){console.error("Error updating default permissions:",a),s("error")}finally{m(!1)}};return l?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"正在加载..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"新用户默认功能权限"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置新注册用户的默认功能权限。已设置个性化权限的用户不受此影响。管理员始终拥有全部权限。"})]}),e.jsxs("form",{onSubmit:x,className:"space-y-3",children:[e.jsx("div",{className:"space-y-1",children:Xc.map(h=>e.jsxs("label",{className:"flex items-center justify-between p-2.5 rounded-md hover:bg-accent/50 cursor-pointer transition-colors",children:[e.jsx("span",{className:"text-sm font-medium text-foreground",children:h.label}),e.jsx("button",{type:"button",role:"switch","aria-checked":r[h.key]!==!1,onClick:()=>t(h.key),className:`relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${r[h.key]!==!1?"bg-blue-600":"bg-gray-300 dark:bg-gray-600"}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${r[h.key]!==!1?"translate-x-4":"translate-x-0"}`})})]},h.key))}),e.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[e.jsxs(U,{type:"submit",variant:"default",size:"sm",disabled:c,className:"flex items-center gap-2",children:[e.jsx(Un,{className:"w-4 h-4"}),c?"保存中...":"保存"]}),d==="success"&&e.jsx("span",{className:"text-sm text-green-600",children:"已保存"}),d==="error"&&e.jsx("span",{className:"text-sm text-red-600",children:"保存失败"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"此设置仅影响未设置个性化权限的用户和新注册用户。"})]})}function Oc(){const{showConfirm:r}=lt(),[o,l]=n.useState([]),[u,c]=n.useState(!0),[m,d]=n.useState(null),[s,p]=n.useState(!1),[t,x]=n.useState(""),[h,a]=n.useState(""),[i,g]=n.useState(!1),v=async()=>{try{const f=await me.admin.getEmailDomains();if(f.ok){const w=await f.json();l(w.domains)}}catch(f){console.error("Error fetching email domains:",f)}finally{c(!1)}};n.useEffect(()=>{v()},[]);const k=async f=>{if(f.preventDefault(),a(""),!t){a("域名不能为空");return}if(!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}$/.test(t)){a("域名格式无效,例如: example.com");return}g(!0);try{const S=await me.admin.addEmailDomain(t.toLowerCase()),z=await S.json();S.ok?(await v(),p(!1),x("")):a(z.error||"添加域名失败")}catch(S){console.error("Error adding domain:",S),a("网络错误,请稍后再试")}finally{g(!1)}},b=async(f,w)=>{if(await r(`确定要删除域名 "${w}"?删除后该域名的邮箱将无法注册。`,{title:"删除域名",variant:"danger",confirmText:"确认删除"})){d(f);try{(await me.admin.removeEmailDomain(f)).ok&&l(o.filter(z=>z.id!==f))}catch(S){console.error("Error removing domain:",S)}finally{d(null)}}},j=()=>{p(!1),x(""),a("")};return u?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"正在加载..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"邮箱域名白名单"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:o.length===0?"未设置白名单,所有邮箱域名均可注册":"只有白名单内的域名邮箱可以注册"})]}),e.jsxs(U,{variant:"default",size:"sm",onClick:()=>p(!0),className:"flex items-center gap-2",children:[e.jsx(zt,{className:"w-4 h-4"}),"添加域名"]})]}),o.length>0?e.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium text-muted-foreground",children:"域名"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium text-muted-foreground",children:"添加时间"}),e.jsx("th",{className:"px-4 py-3 text-right text-sm font-medium text-muted-foreground",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:o.map(f=>e.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-900/30",children:[e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Yr,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"font-medium text-foreground",children:f.domain})]})}),e.jsx("td",{className:"px-4 py-3 text-sm text-muted-foreground",children:new Date(f.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("div",{className:"flex items-center justify-end",children:e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>b(f.id,f.domain),disabled:m===f.id,title:"删除域名",children:e.jsx(vt,{className:"w-4 h-4 text-red-500"})})})})]},f.id))})]})}):e.jsxs("div",{className:"border border-dashed border-gray-300 dark:border-gray-600 rounded-lg p-8 text-center",children:[e.jsx(Yr,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"暂无域名白名单,所有邮箱域名均可注册"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"添加域名后,只有白名单内的域名邮箱可以注册"})]}),s&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-lg w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h4",{className:"text-lg font-semibold text-foreground",children:"添加域名"}),e.jsx("button",{onClick:j,className:"text-muted-foreground hover:text-foreground",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("form",{onSubmit:k,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"newDomain",className:"block text-sm font-medium text-foreground mb-1",children:"邮箱域名"}),e.jsx("input",{type:"text",id:"newDomain",value:t,onChange:f=>x(f.target.value.toLowerCase()),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"例如: example.com",disabled:i}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入域名后,该域名下的所有邮箱(如 user@example.com)都可以注册"})]}),h&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:h})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(U,{type:"button",variant:"outline",onClick:j,disabled:i,children:"取消"}),e.jsx(U,{type:"submit",disabled:i,children:i?"添加中...":"添加"})]})]})]})})]})}const Fr={pending:{label:"待审核",className:"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",icon:Mr},approved:{label:"已通过",className:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",icon:ss},rejected:{label:"已拒绝",className:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",icon:os}};function Yo(r){return r?new Date(r).toLocaleString("zh-CN",{dateStyle:"short",timeStyle:"short"}):"-"}function Cc({submissionId:r}){const[o,l]=n.useState(null),[u,c]=n.useState(!0),[m,d]=n.useState(0);if(n.useEffect(()=>{J(`/api/agents/submissions/${r}/contents`).then(p=>p.json()).then(p=>{l(p.files||[]),d(0)}).catch(()=>l([])).finally(()=>c(!1))},[r]),u)return e.jsxs("div",{className:"flex items-center gap-1.5 py-3 text-xs text-gray-400",children:[e.jsx(st,{className:"w-3 h-3 animate-spin"})," 加载文件内容..."]});if(!o||o.length===0)return e.jsx("p",{className:"text-xs text-gray-400 py-2",children:"无法读取文件内容"});const s=o[m];return e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"flex items-center gap-1 mb-2 flex-wrap",children:o.map((p,t)=>e.jsxs("button",{onClick:()=>d(t),className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded border transition-colors ${t===m?"bg-blue-50 dark:bg-blue-900/20 border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300":"border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 hover:border-gray-300"}`,children:[e.jsx(ur,{className:"w-3 h-3"}),p.name]},p.name))}),e.jsx("pre",{className:"text-[11px] leading-relaxed bg-gray-900 dark:bg-gray-950 text-gray-100 rounded-lg p-3 overflow-auto max-h-72 whitespace-pre-wrap break-words",children:s?.content||""})]})}function Ec(){const{showAlert:r}=lt(),[o,l]=n.useState([]),[u,c]=n.useState(!0),[m,d]=n.useState("pending"),[s,p]=n.useState(null),[t,x]=n.useState(null),[h,a]=n.useState(""),[i,g]=n.useState(null),[v,k]=n.useState(null),[b,j]=n.useState(!1);n.useEffect(()=>{f()},[m]);const f=async()=>{try{c(!0);const N=m?`/api/agents/submissions?status=${m}`:"/api/agents/submissions",R=await J(N);if(R.ok){const M=await R.json();l(M.submissions||[])}else r("加载提交列表失败",{variant:"error"})}catch(N){r(N.message,{variant:"error"})}finally{c(!1)}},w=N=>{k(N.id),j(!1)},S=async(N,R)=>{x(N.id);try{const M=await J(`/api/agents/submissions/${N.id}/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updateAllUsers:R})}),E=await M.json();if(M.ok){let $=`已通过审核,版本 v${E.version} 已发布到仓库。`;E.updatedUsersCount>0&&($+=`
179
- 另已强制更新 ${E.updatedUsersCount} 个已使用用户。`),r($,{title:"审核通过"}),k(null),f()}else r(E.error||"操作失败",{variant:"error"})}catch(M){r(M.message,{variant:"error"})}finally{x(null)}},z=N=>{g(N.id),a("")},D=async N=>{x(N.id);try{const R=await J(`/api/agents/submissions/${N.id}/reject`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:h})});if(R.ok)r("已拒绝该提交。",{title:"审核拒绝"}),g(null),f();else{const M=await R.json();r(M.error||"操作失败",{variant:"error"})}}catch(R){r(R.message,{variant:"error"})}finally{x(null)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-2",children:["pending","approved","rejected",""].map(N=>e.jsx("button",{onClick:()=>d(N),className:`px-3 py-1 text-xs rounded-full border transition-colors ${m===N?"bg-blue-500 text-white border-blue-500":"border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:border-blue-300"}`,children:N===""?"全部":Fr[N]?.label},N||"all"))}),e.jsxs(U,{variant:"outline",size:"sm",onClick:f,className:"flex items-center gap-1.5",children:[e.jsx(st,{className:`w-3.5 h-3.5 ${u?"animate-spin":""}`}),"刷新"]})]}),u?e.jsx("div",{className:"text-center py-8 text-gray-400 text-sm",children:"加载中..."}):o.length===0?e.jsxs("div",{className:"text-center py-8 text-gray-400 text-sm border border-dashed border-gray-200 dark:border-gray-700 rounded-lg",children:["暂无",m?Fr[m]?.label:"","提交记录"]}):e.jsx("div",{className:"space-y-2",children:o.map(N=>{const R=Fr[N.status]||Fr.pending,M=R.icon,E=s===N.id,$=t===N.id,T=i===N.id,X=v===N.id;return e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-3 p-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium text-sm text-gray-900 dark:text-gray-100",children:N.display_name}),e.jsx("span",{className:"text-xs text-gray-400 font-mono",children:N.agent_name}),e.jsxs(nt,{className:`text-xs ${R.className} flex items-center gap-1`,children:[e.jsx(M,{className:"w-3 h-3"}),R.label]}),N.version&&e.jsxs("span",{className:"text-xs text-green-600 dark:text-green-400",children:["v",N.version]})]}),e.jsxs("div",{className:"flex items-center gap-4 mt-0.5 text-xs text-gray-400",children:[e.jsxs("span",{children:["提交人: ",N.username||N.email||`uid-${N.user_id}`]}),e.jsxs("span",{children:["提交时间: ",Yo(N.submitted_at)]}),N.reviewed_at&&e.jsxs("span",{children:["审核时间: ",Yo(N.reviewed_at)]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[N.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsx(U,{size:"sm",className:"text-xs h-7 px-2.5 bg-green-600 hover:bg-green-700 text-white",onClick:()=>w(N),disabled:$,children:"通过"}),e.jsx(U,{size:"sm",variant:"outline",className:"text-xs h-7 px-2.5 text-red-600 border-red-200 hover:bg-red-50 dark:border-red-800 dark:hover:bg-red-900/20",onClick:()=>z(N),disabled:$,children:"拒绝"})]}),e.jsx("button",{onClick:()=>p(E?null:N.id),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:E?e.jsx(Dn,{className:"w-4 h-4"}):e.jsx(Vt,{className:"w-4 h-4"})})]})]}),E&&e.jsxs("div",{className:"border-t border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 p-3 space-y-2",children:[N.description&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-1",children:"描述"}),e.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300",children:N.description})]}),N.update_notes&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-blue-500 dark:text-blue-400 mb-1",children:"更新说明"}),e.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300",children:N.update_notes})]}),N.status==="rejected"&&N.reject_reason&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-red-500 mb-1",children:"拒绝原因"}),e.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:N.reject_reason})]}),e.jsx(Cc,{submissionId:N.id})]}),T&&e.jsxs("div",{className:"border-t border-red-100 dark:border-red-900/30 bg-red-50 dark:bg-red-900/10 p-3",children:[e.jsx("p",{className:"text-xs font-medium text-red-600 dark:text-red-400 mb-2",children:"填写拒绝原因"}),e.jsx("textarea",{value:h,onChange:_=>a(_.target.value),placeholder:"可选:填写拒绝原因告知提交者",rows:2,className:"w-full border border-red-200 dark:border-red-800 rounded px-2 py-1.5 text-xs bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none resize-none mb-2"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(U,{size:"sm",className:"text-xs h-7 px-2.5 bg-red-600 hover:bg-red-700 text-white",onClick:()=>D(N),disabled:$,children:$?"处理中...":"确认拒绝"}),e.jsx(U,{size:"sm",variant:"outline",className:"text-xs h-7 px-2.5",onClick:()=>g(null),disabled:$,children:"取消"})]})]}),X&&e.jsxs("div",{className:"border-t border-green-100 dark:border-green-900/30 bg-green-50 dark:bg-green-900/10 p-3",children:[e.jsx("p",{className:"text-xs font-medium text-green-700 dark:text-green-400 mb-2",children:"确认通过审核?系统将自动递增版本并发布到仓库。"}),e.jsxs("label",{className:"flex items-start gap-2 mb-2 cursor-pointer select-none",children:[e.jsx("input",{type:"checkbox",checked:b,onChange:_=>j(_.target.checked),disabled:$,className:"mt-0.5 cursor-pointer"}),e.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300",children:"同时强制更新所有已使用该项目模板的用户(将覆盖本地修改)"})]}),b&&e.jsxs("p",{className:"text-xs text-amber-600 dark:text-amber-400 mb-2 flex items-start gap-1",children:[e.jsx("span",{children:"⚠"}),e.jsx("span",{children:"此操作将强制覆盖所有用户对该项目模板文件的本地修改,不可撤销。"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{size:"sm",className:"text-xs h-7 px-2.5 bg-green-600 hover:bg-green-700 text-white flex items-center gap-1.5",onClick:()=>S(N,b),disabled:$,children:$?e.jsxs(e.Fragment,{children:[e.jsx(st,{className:"w-3 h-3 animate-spin"}),b?"更新中,请稍候...":"处理中..."]}):"确认通过"}),e.jsx(U,{size:"sm",variant:"outline",className:"text-xs h-7 px-2.5",onClick:()=>k(null),disabled:$,children:"取消"})]})]})]},N.id)})})]})}function Dc({days:r,formatCost:o,formatNumber:l}){const[u,c]=n.useState(null),m=Math.max(...r.map(d=>d.cost||0),.001);return e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"flex items-end justify-between gap-1.5 h-40",children:r.map(d=>{const s=(d.cost||0)/m*100,p=new Date(d.date+"T12:00:00").toLocaleDateString("zh-CN",{month:"numeric",day:"numeric"});return e.jsxs("div",{className:"flex-1 flex flex-col items-center gap-1 h-full",onMouseEnter:()=>c(d),onMouseLeave:()=>c(null),children:[e.jsx("div",{className:"flex-1 w-full flex items-end",children:e.jsx("div",{className:"w-full rounded-t bg-gradient-to-t from-blue-500 to-blue-400 transition-all duration-300",style:{height:`${Math.max(s,d.cost>0?2:0)}%`}})}),e.jsx("span",{className:"text-[10px] text-muted-foreground whitespace-nowrap",children:p})]},d.date)})}),u&&e.jsxs("div",{className:"absolute -top-16 left-1/2 -translate-x-1/2 bg-popover border border-border rounded-lg px-3 py-2 text-xs shadow-lg z-10 whitespace-nowrap pointer-events-none",children:[e.jsx("div",{className:"font-medium text-foreground",children:u.date}),e.jsxs("div",{className:"text-muted-foreground",children:["费用:",o(u.cost)]}),e.jsxs("div",{className:"text-muted-foreground",children:["请求:",l(u.requests)]})]})]})}function Pc({onBack:r}){const[o,l]=n.useState("week"),[u,c]=n.useState(null),[m,d]=n.useState(!0),[s,p]=n.useState(!1),t=async()=>{try{const b=await J(`/api/admin/usage/dashboard?period=${o}`);if(b.ok){const j=await b.json();c(j)}}catch(b){console.error("Error fetching dashboard data:",b)}finally{d(!1),p(!1)}};n.useEffect(()=>{d(!0),t()},[o]);const x=async()=>{try{p(!0),await J("/api/admin/usage/scan",{method:"POST"}),await t()}catch(b){console.error("Error triggering scan:",b),p(!1)}},h=b=>!b||b===0?"$0.00":b<.01?`$${b.toFixed(4)}`:`$${b.toFixed(2)}`,a=b=>b?b>=1e6?`${(b/1e6).toFixed(1)}M`:b>=1e3?`${(b/1e3).toFixed(1)}K`:b.toString():"0";if(m)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"text-muted-foreground",children:"加载仪表板中..."})});const{totals:i,dailyTrend:g,modelDistribution:v,topUsers:k}=u||{};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[r&&e.jsxs(U,{variant:"ghost",size:"sm",onClick:r,children:[e.jsx(Qt,{className:"w-4 h-4 mr-2"}),"返回"]}),e.jsx("h2",{className:"text-2xl font-bold text-foreground",children:"使用情况仪表板"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:["week","month"].map(b=>e.jsx("button",{onClick:()=>l(b),className:`px-4 py-2 text-sm font-medium transition-colors ${o===b?"bg-primary text-primary-foreground":"bg-background text-foreground hover:bg-muted"}`,children:b==="week"?"周":"月"},b))}),e.jsx(U,{variant:"outline",size:"sm",onClick:x,disabled:s,title:"扫描新的使用数据",children:e.jsx(st,{className:`w-4 h-4 ${s?"animate-spin":""}`})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-green-100 dark:bg-green-900/30 rounded-lg",children:e.jsx(Yn,{className:"w-5 h-5 text-green-600 dark:text-green-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"总成本"}),e.jsx("p",{className:"text-2xl font-bold text-foreground",children:h(i?.totalCost)})]})]})}),e.jsx("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-900/30 rounded-lg",children:e.jsx(is,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"活跃用户"}),e.jsxs("p",{className:"text-2xl font-bold text-foreground",children:[i?.activeUsers||0," / ",i?.totalUsers||0]})]})]})}),e.jsx("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-purple-100 dark:bg-purple-900/30 rounded-lg",children:e.jsx(Er,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"总请求数"}),e.jsx("p",{className:"text-2xl font-bold text-foreground",children:a(i?.totalRequests)})]})]})}),e.jsx("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-orange-100 dark:bg-orange-900/30 rounded-lg",children:e.jsx(ls,{className:"w-5 h-5 text-orange-600 dark:text-orange-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"会话数"}),e.jsx("p",{className:"text-2xl font-bold text-foreground",children:a(i?.totalSessions)})]})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-4",children:"每日成本趋势"}),g&&g.length>0?e.jsx(Dc,{days:g,formatCost:h,formatNumber:a}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"无可用的使用数据"})]}),e.jsxs("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-4",children:"模型成本"}),v&&v.length>0?e.jsx("div",{className:"space-y-3",children:v.map(b=>{const j=v.reduce((D,N)=>D+(N.cost||0),0)||1,f=(b.cost||0)/j*100,w=(b.normalized_model||b.model||"").toLowerCase(),z=(D=>D.includes("codex")?"bg-orange-500":D.includes("opus")?"bg-purple-500":D.includes("sonnet")?"bg-blue-500":D.includes("haiku")?"bg-green-500":"bg-gray-500")(w);return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(nt,{variant:"secondary",className:"truncate max-w-[200px]",title:b.model,children:b.model}),e.jsxs("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:[a(b.requests)," 请求"]})]}),e.jsx("span",{className:"text-sm font-mono text-foreground whitespace-nowrap ml-2",children:h(b.cost)})]}),e.jsx("div",{className:"h-2 bg-gray-100 dark:bg-gray-800 rounded overflow-hidden",children:e.jsx("div",{className:`h-full ${z} rounded`,style:{width:`${f}%`}})})]},b.model)})}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"无可用的使用数据"})]})]}),e.jsxs("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-4",children:"用户成本"}),k&&k.length>0?e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:[e.jsx("th",{className:"text-left py-2 text-sm font-medium text-muted-foreground",children:"排名"}),e.jsx("th",{className:"text-left py-2 text-sm font-medium text-muted-foreground",children:"用户名"}),e.jsx("th",{className:"text-right py-2 text-sm font-medium text-muted-foreground",children:"请求数"}),e.jsx("th",{className:"text-right py-2 text-sm font-medium text-muted-foreground",children:"成本"})]})}),e.jsx("tbody",{children:k.map((b,j)=>e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 last:border-0",children:[e.jsxs("td",{className:"py-2 text-sm text-muted-foreground",children:["#",j+1]}),e.jsx("td",{className:"py-2 text-sm font-medium text-foreground",children:b.username}),e.jsx("td",{className:"py-2 text-sm text-right text-muted-foreground",children:a(b.total_requests)}),e.jsx("td",{className:"py-2 text-sm text-right font-mono text-foreground",children:h(b.total_cost)})]},b.user_uuid))})]})}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"无可用的使用数据"})]})]})}const Jo={hex:{opus:"#a855f7",sonnet:"#3b82f6",haiku:"#22c55e",codex:"#f97316",default:"#6b7280"},tailwind:{opus:"bg-purple-500",sonnet:"bg-blue-500",haiku:"bg-green-500",codex:"bg-orange-500",default:"bg-gray-500"}};function qo(r=""){const o=r.toLowerCase();return o.includes("codex")?"codex":o.includes("opus")?"opus":o.includes("sonnet")?"sonnet":o.includes("haiku")?"haiku":"default"}function oo(r){return!r||r===0?"$0.00":r<.01?`$${r.toFixed(4)}`:`$${r.toFixed(2)}`}function Hn(r){return r?r>=1e6?`${(r/1e6).toFixed(1)}M`:r>=1e3?`${(r/1e3).toFixed(1)}K`:r.toString():"0"}function Ac(r){const o=[];for(let l=r-1;l>=0;l--){const u=new Date;u.setDate(u.getDate()-l),o.push(u.toISOString().split("T")[0])}return o}function Lc({data:r}){const[o,l]=n.useState(null),u=140,c=u/2,m=u/2,d=56,s=r.reduce((x,h)=>x+(h.cost||0),0)||1;let p=-Math.PI/2;const t=r.map(x=>{const h=(x.cost||0)/s,a=h*2*Math.PI,i=p+a,g=c+d*Math.cos(p),v=m+d*Math.sin(p),k=c+d*Math.cos(i),b=m+d*Math.sin(i),j=a>Math.PI?1:0,f=h<.001?"":`M ${c} ${m} L ${g} ${v} A ${d} ${d} 0 ${j} 1 ${k} ${b} Z`,w=p+a/2,S={...x,pathD:f,ratio:h,midAngle:w,key:x.model};return p=i,S});return e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("svg",{width:u,height:u,className:"flex-shrink-0",children:[t.map(x=>e.jsx("path",{d:x.pathD,fill:Jo.hex[qo(x.model)],opacity:o===null||o===x.key?1:.4,stroke:"white",strokeWidth:"1.5",onMouseEnter:()=>l(x.key),onMouseLeave:()=>l(null),className:"cursor-pointer transition-opacity duration-150"},x.key)),r.length===0&&e.jsx("circle",{cx:c,cy:m,r:d,fill:"#e5e7eb"})]}),e.jsx("div",{className:"flex-1 space-y-1.5 min-w-0",children:t.map(x=>{const h=(x.ratio*100).toFixed(1),a=qo(x.model);return e.jsxs("div",{className:"flex items-center gap-2 min-w-0",onMouseEnter:()=>l(x.key),onMouseLeave:()=>l(null),children:[e.jsx("div",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${Jo.tailwind[a]}`}),e.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",title:x.model,children:x.model}),e.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:[h,"%"]}),e.jsx("span",{className:"text-xs font-mono text-foreground flex-shrink-0 w-14 text-right",children:oo(x.cost)})]},x.key)})})]})}function _c({days:r}){const[o,l]=n.useState(null),u=Math.max(...r.map(c=>c.cost||0),.001);return e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"flex items-end justify-between gap-1.5 h-40",children:r.map(c=>{const m=(c.cost||0)/u*100,d=new Date(c.date+"T12:00:00").toLocaleDateString("zh-CN",{month:"numeric",day:"numeric"});return e.jsxs("div",{className:"flex-1 flex flex-col items-center gap-1 h-full",onMouseEnter:()=>l(c),onMouseLeave:()=>l(null),children:[e.jsx("div",{className:"flex-1 w-full flex items-end relative",children:e.jsx("div",{className:"w-full rounded-t bg-gradient-to-t from-blue-500 to-blue-400 transition-all duration-300 min-h-[2px]",style:{height:`${Math.max(m,c.cost>0?2:0)}%`}})}),e.jsx("span",{className:"text-[10px] text-muted-foreground whitespace-nowrap",children:d})]},c.date)})}),o&&e.jsxs("div",{className:"absolute -top-16 left-1/2 -translate-x-1/2 bg-popover border border-border rounded-lg px-3 py-2 text-xs shadow-lg z-10 whitespace-nowrap pointer-events-none",children:[e.jsx("div",{className:"font-medium text-foreground",children:o.date}),e.jsxs("div",{className:"text-muted-foreground",children:["费用:",oo(o.cost)]}),e.jsxs("div",{className:"text-muted-foreground",children:["请求:",Hn(o.requests)]})]})]})}function Ic({userUuid:r,username:o,onBack:l}){const[u,c]=n.useState(null),[m,d]=n.useState(!0);n.useEffect(()=>{(async()=>{try{const h=await J(`/api/admin/usage/users/${r}?period=week`);h.ok&&c(await h.json())}catch(h){console.error("Error fetching user usage:",h)}finally{d(!1)}})()},[r]);const s=Ac(7),p={};(u?.dailyTrend||[]).forEach(x=>{p[x.date]=x});const t=s.map(x=>({date:x,cost:p[x]?.cost||0,requests:p[x]?.requests||0}));return m?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"text-muted-foreground",children:"加载用户数据中..."})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(U,{variant:"ghost",size:"sm",onClick:l,children:[e.jsx(Qt,{className:"w-4 h-4 mr-2"}),"返回"]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:o}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"最近 7 天使用情况"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-green-100 dark:bg-green-900/30 rounded-lg",children:e.jsx(Yn,{className:"w-5 h-5 text-green-600 dark:text-green-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"累计成本"}),e.jsx("p",{className:"text-xl font-bold text-foreground",children:oo(u?.totalCost)})]})]})}),e.jsx("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-purple-100 dark:bg-purple-900/30 rounded-lg",children:e.jsx(Er,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"累计请求数"}),e.jsx("p",{className:"text-xl font-bold text-foreground",children:Hn(u?.totalRequests)})]})]})}),e.jsx("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-orange-100 dark:bg-orange-900/30 rounded-lg",children:e.jsx(ls,{className:"w-5 h-5 text-orange-600 dark:text-orange-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"累计会话数"}),e.jsx("p",{className:"text-xl font-bold text-foreground",children:Hn(u?.totalSessions)})]})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground mb-4",children:"最近 7 天每日消耗"}),e.jsx(_c,{days:t})]}),e.jsxs("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground mb-4",children:"模型分布"}),u?.modelDistribution&&u.modelDistribution.length>0?e.jsx(Lc,{data:u.modelDistribution}):e.jsx("div",{className:"flex items-center justify-center h-36 text-muted-foreground text-sm",children:"暂无使用数据"})]})]})]})}function zc({isOpen:r,onClose:o}){const{isAdmin:l,isSuperAdmin:u}=Ot(),[c,m]=n.useState("users"),[d,s]=n.useState(!1),[p,t]=n.useState(null);if(!r||!l)return null;const x=[{id:"users",label:"用户管理",icon:is},{id:"system",label:"系统设置",icon:qa},{id:"agents",label:"共享项目审核",icon:_t}],h=a=>{m(a),s(!1),t(null)};return e.jsx("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[9999] md:p-4 bg-background/95",children:e.jsxs("div",{className:"bg-background border border-border md:rounded-lg shadow-xl w-full md:max-w-5xl h-full md:h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-border flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Gt,{className:"w-5 h-5 md:w-6 md:h-6 text-blue-600"}),e.jsx("h2",{className:"text-lg md:text-xl font-semibold text-foreground",children:"管理"})]}),e.jsx(U,{variant:"ghost",size:"sm",onClick:o,className:"text-muted-foreground hover:text-foreground touch-manipulation",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex-1 flex flex-col md:flex-row overflow-hidden",children:[e.jsx("div",{className:"md:hidden border-b border-border",children:e.jsx("div",{className:"flex px-4",children:x.map(a=>e.jsx("button",{onClick:()=>h(a.id),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${c===a.id?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:a.label},a.id))})}),e.jsx("div",{className:"hidden md:flex flex-col w-48 border-r border-border p-3 gap-1 flex-shrink-0",children:x.map(a=>{const i=a.icon;return e.jsxs("button",{onClick:()=>h(a.id),className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors ${c===a.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground hover:bg-accent/50"}`,children:[e.jsx(i,{className:"w-4 h-4"}),a.label]},a.id)})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 md:p-6",children:[c==="users"&&e.jsx("div",{className:"space-y-6 md:space-y-8",children:d?e.jsx(Pc,{onBack:()=>s(!1)}):p?e.jsx(Ic,{userUuid:p.uuid,username:p.username,onBack:()=>t(null)}):e.jsx(Sc,{isSuperAdmin:u,onNavigateToUsage:()=>s(!0),onViewUser:(a,i)=>t({uuid:a,username:i})})}),c==="system"&&e.jsxs("div",{className:"space-y-6 md:space-y-8",children:[e.jsx(Tc,{}),e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-6 md:pt-8",children:e.jsx(Mc,{})}),e.jsx(Oc,{})]}),c==="agents"&&e.jsx(Ec,{})]})]})]})})}function Rc({isOpen:r,limitType:o,onClose:l}){if(!r)return null;const u=o==="total_limit_exceeded";return e.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-[100]",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-xl w-full max-w-md p-6 mx-4 animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 bg-red-100 dark:bg-red-900/30 rounded-full flex items-center justify-center flex-shrink-0",children:e.jsx(Bt,{className:"w-6 h-6 text-red-600 dark:text-red-400"})}),e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:u?"使用上限已达到":"今日使用上限已达到"})})]}),e.jsx("button",{onClick:l,className:"p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"mb-6 text-muted-foreground space-y-3",children:u?e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"您的账户已达到使用总额度上限。"}),e.jsx("p",{className:"text-sm",children:"请联系管理员提升您的额度限制,以继续使用 Claude 服务。"})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"您已达到今日使用额度上限。"}),e.jsx("p",{className:"text-sm",children:"您可以等待明日额度重置后继续使用,或联系管理员提升您的每日额度限制。"})]})}),e.jsx("div",{className:"mb-6 p-3 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg",children:e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:u?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"提示:"}),"请联系您的管理员,申请提升使用额度。"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"提示:"}),"每日额度将在次日 00:00 自动重置,您也可以联系管理员调整限额。"]})})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(U,{variant:"default",onClick:l,children:"我知道了"})})]})})}const $c=[{type:"user",content:"为什么上周的活跃用户数突然下降了 12%?",delay:1500},{type:"system",content:null,temporary:!0,delay:2e3},{type:"system",content:`正在分析最近 7 天的用户行为数据与服务端日志...
177
+ `).forEach(pe=>{const[Ie,...ut]=pe.split("=");Ie&&Ie.trim()&&(ee[Ie.trim()]=ut.join("=").trim())}),yt("headers",ee)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`Authorization=Bearer token
178
+ X-API-Key=your-key`})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(U,{type:"button",variant:"outline",onClick:Pt,children:"取消"}),e.jsx(U,{type:"submit",disabled:He,className:"bg-purple-600 hover:bg-purple-700 disabled:opacity-50",children:He?"保存中...":de?"更新服务器":"添加服务器"})]})]})]})})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-4 md:p-6 border-t border-border flex-shrink-0 gap-3 pb-safe-area-inset-bottom",children:[e.jsx("div",{className:"flex items-center justify-center sm:justify-start gap-2 order-2 sm:order-1",children:Ce==="agents"&&Re==="models"?B.saving?e.jsx("span",{className:"text-sm text-muted-foreground",children:"保存中..."}):null:e.jsxs(e.Fragment,{children:[$==="success"&&e.jsxs("div",{className:"text-green-600 dark:text-green-400 text-sm flex items-center gap-1",children:[e.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"设置保存成功!"]}),$==="error"&&e.jsxs("div",{className:"text-red-600 dark:text-red-400 text-sm flex items-center gap-1",children:[e.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),"保存设置失败"]})]})}),e.jsxs("div",{className:"flex items-center gap-3 order-1 sm:order-2",children:[Ce==="agents"&&Re==="models"&&B.hasChanges&&e.jsx(U,{variant:"outline",onClick:()=>K.current?.reset(),disabled:B.saving,className:"flex-1 sm:flex-none h-10 touch-manipulation",children:"重置"}),e.jsx(U,{variant:"outline",onClick:o,disabled:M||B.saving,className:"flex-1 sm:flex-none h-10 touch-manipulation",children:"取消"}),e.jsx(U,{onClick:Ce==="agents"&&Re==="models"?()=>K.current?.save():nr,disabled:Ce==="agents"&&Re==="models"?B.saving||!B.hasChanges:M,className:"flex-1 sm:flex-none h-10 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 touch-manipulation",children:M||B.saving?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 animate-spin rounded-full border-2 border-white border-t-transparent"}),"保存中..."]}):"保存设置"})]})]})]})}),Ee&&e.jsx(vc,{onClose:()=>ye(!1),onInstalled:()=>Dt(),onOpenRepoManager:()=>{ye(!1),Fe(!0)},projects:l}),Me&&e.jsx(yc,{onClose:()=>Fe(!1),onChanged:()=>{}})]}):null}const kc=[{key:"claude_shell",label:"Claude Code Shell",desc:"访问 Claude Code 终端"},{key:"codex_shell",label:"Codex Shell",desc:"访问 Codex 终端"},{key:"gemini_shell",label:"Gemini CLI Shell",desc:"访问 Gemini CLI 终端"},{key:"submit_agent",label:"提交 Agent",desc:"在 Agent 商店中提交新 Agent"},{key:"tab_models",label:"模型设置",desc:"设置 > Agent > 模型 tab"},{key:"tab_skills",label:"技能设置",desc:"设置 > Agent > 技能 tab"},{key:"tab_mcp",label:"MCP 服务器设置",desc:"设置 > Agent > MCP 服务器 tab"},{key:"tab_permissions",label:"权限设置",desc:"设置 > Agent > 权限 tab"},{key:"feishu_binding",label:"绑定飞书账号",desc:"设置 > 账户 > 飞书绑定"},{key:"create_project",label:"新建项目",desc:"侧边栏 > 新建项目按钮"}];function wc({user:r,onClose:o,onSaved:l}){const[u,c]=n.useState({}),[m,d]=n.useState(!0),[s,p]=n.useState(!1),[t,x]=n.useState(""),[h,a]=n.useState(!1);n.useEffect(()=>{i()},[r.id]);const i=async()=>{d(!0);try{const j=await(await me.admin.getUserPermissions(r.id)).json();if(j.permissions)c(j.permissions),a(!0);else{const w=await(await me.admin.getDefaultPermissions()).json();c(w.permissions||{}),a(!1)}}catch(b){console.error("Error fetching permissions:",b),x("加载权限失败")}finally{d(!1)}},g=b=>{c(j=>({...j,[b]:!j[b]})),a(!0)},v=async b=>{b.preventDefault(),x(""),p(!0);try{const j=await me.admin.updateUserPermissions(r.id,u),f=await j.json();j.ok?(l?.(),o()):x(f.error||"保存失败")}catch(j){console.error("Error saving permissions:",j),x("网络错误,请稍后再试")}finally{p(!1)}},k=async()=>{x(""),p(!0);try{if((await me.admin.updateUserPermissions(r.id,null)).ok){const f=await(await me.admin.getDefaultPermissions()).json();c(f.permissions||{}),a(!1)}}catch(b){console.error("Error resetting permissions:",b),x("重置失败")}finally{p(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-lg w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"text-lg font-semibold text-foreground",children:["功能权限 - ",r.username||r.email]}),h?e.jsx("p",{className:"text-xs text-blue-500 mt-0.5",children:"已设置个性化权限"}):e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"使用系统默认权限"})]}),e.jsx("button",{onClick:o,className:"text-muted-foreground hover:text-foreground",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),m?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):e.jsxs("form",{onSubmit:v,className:"space-y-3",children:[e.jsx("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:kc.map(b=>e.jsxs("label",{className:"flex items-center justify-between p-2.5 rounded-md hover:bg-accent/50 cursor-pointer transition-colors",children:[e.jsxs("div",{className:"min-w-0 mr-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:b.label}),e.jsx("div",{className:"text-xs text-muted-foreground",children:b.desc})]}),e.jsx("button",{type:"button",role:"switch","aria-checked":u[b.key]!==!1,onClick:()=>g(b.key),className:`relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${u[b.key]!==!1?"bg-blue-600":"bg-gray-300 dark:bg-gray-600"}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${u[b.key]!==!1?"translate-x-4":"translate-x-0"}`})})]},b.key))}),t&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:t})}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(U,{type:"button",variant:"ghost",size:"sm",onClick:k,disabled:s||!h,className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(as,{className:"w-3.5 h-3.5"}),"重置为默认"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(U,{type:"button",variant:"outline",onClick:o,disabled:s,children:"取消"}),e.jsx(U,{type:"submit",disabled:s,children:s?"保存中...":"保存"})]})]})]})]})})}function Nc({user:r,onClose:o,onSaved:l}){const[u,c]=n.useState(new Set),[m,d]=n.useState([]),[s,p]=n.useState(""),[t,x]=n.useState(!0),[h,a]=n.useState(!1),[i,g]=n.useState(""),[v,k]=n.useState(!1);n.useEffect(()=>{b()},[r.id]);const b=async()=>{x(!0);try{const[S,R]=await Promise.all([J("/api/agents"),me.admin.getUserVisibleAgents(r.id)]),M=await S.json(),D=await R.json();d(M.agents||[]),D.agents&&Array.isArray(D.agents)?(c(new Set(D.agents)),k(!0)):(c(new Set),k(!1))}catch(S){console.error("Error fetching agent visibility data:",S),g("加载数据失败")}finally{x(!1)}},j=n.useMemo(()=>{if(!s.trim())return m;const S=s.toLowerCase();return m.filter(R=>(R.display_name||R.name||"").toLowerCase().includes(S)||(R.description||"").toLowerCase().includes(S)||(R.dirName||"").toLowerCase().includes(S))},[m,s]),f=j.length>0&&j.every(S=>u.has(S.dirName||S.name)),w=S=>{c(R=>{const M=new Set(R);return M.has(S)?M.delete(S):M.add(S),M}),k(!0)},N=()=>{c(S=>{const R=new Set(S);return f?j.forEach(M=>R.delete(M.dirName||M.name)):j.forEach(M=>R.add(M.dirName||M.name)),R}),k(!0)},L=async S=>{S.preventDefault(),g(""),a(!0);try{const R=[...u],M=await me.admin.updateUserVisibleAgents(r.id,R),D=await M.json();M.ok?(l?.(),o()):g(D.error||"保存失败")}catch(R){console.error("Error saving agent visibility:",R),g("网络错误,请稍后再试")}finally{a(!1)}},E=async()=>{g(""),a(!0);try{(await me.admin.updateUserVisibleAgents(r.id,null)).ok&&(c(new Set),k(!1))}catch(S){console.error("Error resetting agent visibility:",S),g("重置失败")}finally{a(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-lg w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"text-lg font-semibold text-foreground",children:["共享项目可见性 - ",r.username||r.email]}),v?e.jsxs("p",{className:"text-xs text-blue-500 mt-0.5",children:["已设置个性化配置(已选 ",u.size," 个)"]}):e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"使用默认配置(不可见任何 Agent)"})]}),e.jsx("button",{onClick:o,className:"text-muted-foreground hover:text-foreground",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),t?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):m.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx($a,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"仓库中暂无 Agent"})]}):e.jsxs("form",{onSubmit:L,className:"space-y-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Mt,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx("input",{type:"text",value:s,onChange:S=>p(S.target.value),placeholder:"搜索 Agent...",className:"w-full pl-8 pr-3 py-1.5 text-sm bg-background border border-border rounded-md focus:outline-none focus:ring-1 focus:ring-blue-500"})]}),e.jsxs("label",{className:"flex items-center gap-2 px-2.5 py-1.5 text-sm text-muted-foreground cursor-pointer hover:text-foreground",children:[e.jsx("input",{type:"checkbox",checked:f,onChange:N,className:"w-3.5 h-3.5 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),s?`全选搜索结果(${j.length})`:`全选(${m.length})`]}),e.jsx("div",{className:"space-y-0.5 max-h-[400px] overflow-y-auto border border-border rounded-md",children:j.length===0?e.jsx("div",{className:"text-center py-6 text-muted-foreground text-sm",children:"未找到匹配的 Agent"}):j.map(S=>{const R=S.dirName||S.name,M=u.has(R);return e.jsxs("label",{className:`flex items-start gap-2.5 px-3 py-2 cursor-pointer transition-colors hover:bg-accent/50 ${M?"bg-blue-50/50 dark:bg-blue-900/10":""}`,children:[e.jsx("input",{type:"checkbox",checked:M,onChange:()=>w(R),className:"w-3.5 h-3.5 mt-0.5 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:S.display_name||S.name}),S.version&&e.jsxs("span",{className:"text-xs px-1.5 py-0.5 bg-gray-100 dark:bg-gray-800 text-muted-foreground rounded flex-shrink-0",children:["v",S.version]})]}),S.description&&e.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:S.description})]})]},R)})}),e.jsxs("div",{className:"text-xs text-muted-foreground px-1",children:["已选 ",u.size," / 共 ",m.length," 个 Agent"]}),i&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:i})}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(U,{type:"button",variant:"ghost",size:"sm",onClick:E,disabled:h||!v,className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(as,{className:"w-3.5 h-3.5"}),"重置为默认"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(U,{type:"button",variant:"outline",onClick:o,disabled:h,children:"取消"}),e.jsx(U,{type:"submit",disabled:h,children:h?"保存中...":"保存"})]})]})]})]})})}function Sc({isSuperAdmin:r,onNavigateToUsage:o,onViewUser:l}){const{user:u}=Ot(),{showConfirm:c}=lt(),[m,d]=n.useState([]),[s,p]=n.useState({}),[t,x]=n.useState(!0),[h,a]=n.useState(null),[i,g]=n.useState(!1),[v,k]=n.useState(""),[b,j]=n.useState(""),[f,w]=n.useState(""),[N,L]=n.useState(!1),[E,S]=n.useState(null),[R,M]=n.useState({total_limit_usd:"",daily_limit_usd:""}),[D,$]=n.useState(""),[T,X]=n.useState(!1),[_,te]=n.useState(null),[ne,Y]=n.useState(""),[le,de]=n.useState(""),[fe,Ee]=n.useState(""),[ye,Me]=n.useState(!1),[Fe,ie]=n.useState(null),[Se,He]=n.useState(""),[Be,he]=n.useState(""),[Oe,De]=n.useState(!1),[Ye,Xe]=n.useState(null),[Je,Ce]=n.useState(null),[_e,$e]=n.useState(null),ze=async()=>{try{const F=await J("/api/admin/users");if(F.ok){const Te=await F.json();d(Te.users)}}catch(F){console.error("Error fetching users:",F)}finally{x(!1)}},Re=async()=>{try{const F=await J("/api/admin/usage/summary");if(F.ok){const Te=await F.json(),O={};for(const se of Te.users)O[se.user_uuid]={total_cost:se.total_cost||0,total_requests:se.total_requests||0,last_active:se.last_active};p(O)}}catch(F){console.error("Error fetching usage data:",F)}};n.useEffect(()=>{ze(),Re()},[]);const Ze=F=>!F||F===0?"$0.00":F<.01?`$${F.toFixed(4)}`:`$${F.toFixed(2)}`,Qe=F=>F.role==="super_admin"?!1:r||F.id===u?.id?!0:F.role==="user",K=F=>F.id===u?.id?!1:r?F.role!=="super_admin":!["admin","super_admin"].includes(F.role),B=async(F,Te)=>{const O=Te==="active"?"disabled":"active";a(F);try{(await J(`/api/admin/users/${F}`,{method:"PATCH",body:JSON.stringify({status:O})})).ok&&d(m.map(ke=>ke.id===F?{...ke,status:O}:ke))}catch(se){console.error("Error updating user status:",se)}finally{a(null)}},C=async(F,Te)=>{if(await c(`确定要删除用户 "${Te}"?这将删除其所有数据。`,{title:"删除用户",variant:"danger",confirmText:"确认删除"})){a(F);try{(await J(`/api/admin/users/${F}`,{method:"DELETE"})).ok&&d(m.filter(se=>se.id!==F))}catch(O){console.error("Error deleting user:",O)}finally{a(null)}}},V=async F=>{if(F.preventDefault(),w(""),!v||!b){w("用户名和密码不能为空");return}if(v.length<3){w("用户名至少3个字符");return}if(b.length<6){w("密码至少6个字符");return}L(!0);try{const Te=await me.admin.createUser(v,b),O=await Te.json();Te.ok?(await ze(),g(!1),k(""),j("")):w(O.error||"创建用户失败")}catch(Te){console.error("Error creating user:",Te),w("网络错误,请稍后再试")}finally{L(!1)}},z=()=>{g(!1),k(""),j(""),w("")},re=F=>{S(F),M({total_limit_usd:F.total_limit_usd!==null&&F.total_limit_usd!==void 0?String(F.total_limit_usd):"",daily_limit_usd:F.daily_limit_usd!==null&&F.daily_limit_usd!==void 0?String(F.daily_limit_usd):""}),$("")},G=()=>{S(null),M({total_limit_usd:"",daily_limit_usd:""}),$("")},ae=async F=>{F.preventDefault(),$("");const Te=R.total_limit_usd.trim()===""?null:parseFloat(R.total_limit_usd),O=R.daily_limit_usd.trim()===""?null:parseFloat(R.daily_limit_usd);if(Te!==null&&(isNaN(Te)||Te<0)){$("总额度限制必须是正数或留空");return}if(O!==null&&(isNaN(O)||O<0)){$("每日额度限制必须是正数或留空");return}X(!0);try{const se=await me.admin.updateUserLimits(E.id,{total_limit_usd:Te,daily_limit_usd:O}),ke=await se.json();se.ok?(d(m.map(we=>we.id===E.id?{...we,total_limit_usd:Te,daily_limit_usd:O}:we)),G()):$(ke.error||"更新限制失败")}catch(se){console.error("Error updating limits:",se),$("网络错误,请稍后再试")}finally{X(!1)}},ce=F=>F==null?"无限制":`$${F.toFixed(2)}`,Pe=F=>{te(F),Y(""),de(""),Ee("")},xe=()=>{te(null),Y(""),de(""),Ee("")},Le=async F=>{if(F.preventDefault(),Ee(""),!ne){Ee("请输入新密码");return}if(ne.length<6){Ee("密码至少需要6个字符");return}if(ne!==le){Ee("两次输入的密码不一致");return}Me(!0);try{const Te=await me.admin.resetUserPassword(_.id,ne),O=await Te.json();Te.ok?xe():Ee(O.error||"重置密码失败")}catch(Te){console.error("Error resetting password:",Te),Ee("网络错误,请稍后再试")}finally{Me(!1)}},oe=F=>{ie(F),He(F.role==="admin"?"admin":"user"),he("")},be=()=>{ie(null),He(""),he("")},at=async F=>{F.preventDefault(),he(""),De(!0);try{const Te=await me.admin.updateUserRole(Fe.id,Se),O=await Te.json();Te.ok?(d(m.map(se=>se.id===Fe.id?{...se,role:Se}:se)),be()):he(O.error||"更新角色失败")}catch(Te){console.error("Error updating role:",Te),he("网络错误,请稍后再试")}finally{De(!1)}},Ae=F=>F==="super_admin"?e.jsx(Ja,{className:"w-4 h-4 text-amber-500 flex-shrink-0"}):F==="admin"?e.jsx(Gt,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):e.jsx(An,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),dt=F=>F==="super_admin"?e.jsx("span",{className:"inline-block px-1.5 py-0.5 text-xs rounded whitespace-nowrap bg-amber-500/20 text-amber-500",children:"超级管理员"}):F==="admin"?e.jsx("span",{className:"inline-block px-1.5 py-0.5 text-xs rounded whitespace-nowrap bg-blue-500/20 text-blue-400",children:"管理员"}):e.jsx("span",{className:"inline-block px-1.5 py-0.5 text-xs rounded whitespace-nowrap bg-gray-500/20 text-gray-400",children:"用户"}),gt=F=>{const Te=()=>{$e(F),setTimeout(()=>$e(null),2e3)};if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(F).then(Te);else{const O=document.createElement("textarea");O.value=F,O.style.position="fixed",O.style.opacity="0",document.body.appendChild(O),O.select(),document.execCommand("copy"),document.body.removeChild(O),Te()}};return t?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"正在加载用户..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"用户管理"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(U,{variant:"default",size:"sm",onClick:()=>g(!0),className:"flex items-center gap-2",children:[e.jsx(Wa,{className:"w-4 h-4"}),"创建用户"]}),o&&e.jsxs(U,{variant:"outline",size:"sm",onClick:o,className:"flex items-center gap-2",children:[e.jsx(Fa,{className:"w-4 h-4"}),"使用量统计"]})]})]}),e.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[580px] table-fixed",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-muted-foreground w-44",children:"用户"}),e.jsx("th",{className:"px-3 py-2 text-center text-xs font-medium text-muted-foreground w-20",children:"角色"}),e.jsx("th",{className:"px-3 py-2 text-center text-xs font-medium text-muted-foreground w-10",children:"状"}),e.jsx("th",{className:"px-3 py-2 text-right text-xs font-medium text-muted-foreground w-36",children:"费用 / 额度"}),e.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-muted-foreground w-20",children:"创建"}),e.jsx("th",{className:"px-3 py-2 text-right text-xs font-medium text-muted-foreground",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:m.map(F=>e.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-900/30",children:[e.jsx("td",{className:"px-3 py-2 w-44",children:e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[Ae(F.role),e.jsx("span",{className:"font-medium text-foreground text-sm truncate block min-w-0",title:F.username||F.email,children:F.username||(F.email?.includes("@")?F.email.split("@")[0]:F.email)})]})}),e.jsx("td",{className:"px-3 py-2 text-center",children:dt(F.role)}),e.jsx("td",{className:"px-3 py-2 text-center",children:e.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${F.status==="active"?"bg-green-500":"bg-red-500"}`,title:F.status==="active"?"活跃":"已禁用"})}),e.jsx("td",{className:"px-3 py-2 text-right",children:e.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[e.jsx("span",{className:"font-mono text-xs text-foreground whitespace-nowrap",children:Ze(s[F.uuid]?.total_cost)}),Qe(F)?e.jsx("button",{onClick:()=>re(F),className:"text-[11px] text-blue-600 dark:text-blue-400 hover:underline font-mono whitespace-nowrap leading-tight",title:"点击编辑额度限制",children:F.total_limit_usd!==null||F.daily_limit_usd!==null?e.jsxs("span",{children:["总:",ce(F.total_limit_usd)," 日:",ce(F.daily_limit_usd)]}):e.jsxs("span",{className:"flex items-center gap-0.5 justify-end text-muted-foreground",children:[e.jsx(Yn,{className:"w-3 h-3"}),"设置限额"]})}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})]})}),e.jsx("td",{className:"px-3 py-2 text-xs text-muted-foreground whitespace-nowrap",children:new Date(F.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-end gap-0.5",children:[e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>gt(F.uuid),title:`复制用户 UID: ${F.uuid}`,children:_e===F.uuid?e.jsx(pr,{className:"w-4 h-4 text-green-500"}):e.jsx(Bn,{className:"w-4 h-4 text-gray-400"})}),l&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>l(F.uuid,F.username||F.email),title:"查看使用详情",children:e.jsx(Ha,{className:"w-4 h-4 text-indigo-500"})}),r&&F.role!=="super_admin"&&F.id!==u?.id&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>oe(F),title:"修改角色",children:e.jsx(Ba,{className:"w-4 h-4 text-purple-500"})}),F.role==="user"&&K(F)&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>Xe(F),title:"功能权限",children:e.jsx(Ua,{className:"w-4 h-4 text-green-500"})}),F.role==="user"&&K(F)&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>Ce(F),title:"共享项目可见性",children:e.jsx(ts,{className:"w-4 h-4 text-cyan-500"})}),K(F)&&e.jsxs(e.Fragment,{children:[F.username&&e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>Pe(F),disabled:h===F.id,title:"重置密码",children:e.jsx(Pn,{className:"w-4 h-4 text-blue-500"})}),e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>B(F.id,F.status),disabled:h===F.id,title:F.status==="active"?"禁用用户":"启用用户",children:F.status==="active"?e.jsx(Ga,{className:"w-4 h-4 text-orange-500"}):e.jsx(Ya,{className:"w-4 h-4 text-green-500"})}),e.jsx(U,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>C(F.id,F.username||F.email),disabled:h===F.id,title:"删除用户",children:h===F.id?e.jsx(bt,{className:"w-4 h-4 text-red-500 animate-spin"}):e.jsx(vt,{className:"w-4 h-4 text-red-500"})})]})]})})]},F.id))})]})}),i&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-lg w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h4",{className:"text-lg font-semibold text-foreground",children:"创建用户"}),e.jsx("button",{onClick:z,className:"text-muted-foreground hover:text-foreground",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("form",{onSubmit:V,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"newUsername",className:"block text-sm font-medium text-foreground mb-1",children:"用户名"}),e.jsx("input",{type:"text",id:"newUsername",value:v,onChange:F=>k(F.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入用户名",disabled:N})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"newPassword",className:"block text-sm font-medium text-foreground mb-1",children:"密码"}),e.jsx("input",{type:"password",id:"newPassword",value:b,onChange:F=>j(F.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入密码",disabled:N})]}),f&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:f})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(U,{type:"button",variant:"outline",onClick:z,disabled:N,children:"取消"}),e.jsx(U,{type:"submit",disabled:N,children:N?"创建中...":"创建"})]})]})]})}),E&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-lg w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h4",{className:"text-lg font-semibold text-foreground",children:["设置额度限制 - ",E.username||E.email]}),e.jsx("button",{onClick:G,className:"text-muted-foreground hover:text-foreground",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("form",{onSubmit:ae,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"totalLimit",className:"block text-sm font-medium text-foreground mb-1",children:"总额度上限 (USD)"}),e.jsx("input",{type:"number",id:"totalLimit",step:"0.01",min:"0",value:R.total_limit_usd,onChange:F=>M(Te=>({...Te,total_limit_usd:F.target.value})),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"留空表示不限制",disabled:T}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"用户累计使用金额达到此限制后,将无法继续使用"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"dailyLimit",className:"block text-sm font-medium text-foreground mb-1",children:"每日额度上限 (USD)"}),e.jsx("input",{type:"number",id:"dailyLimit",step:"0.01",min:"0",value:R.daily_limit_usd,onChange:F=>M(Te=>({...Te,daily_limit_usd:F.target.value})),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"留空表示不限制",disabled:T}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"用户每日使用金额达到此限制后,需等待次日重置"})]}),s[E.uuid]&&e.jsx("div",{className:"p-3 bg-gray-100 dark:bg-gray-800 rounded-md",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["当前已使用:",e.jsx("span",{className:"font-mono text-foreground",children:Ze(s[E.uuid]?.total_cost)})]})}),D&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:D})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(U,{type:"button",variant:"outline",onClick:G,disabled:T,children:"取消"}),e.jsx(U,{type:"submit",disabled:T,children:T?"保存中...":"保存"})]})]})]})}),_&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-lg w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h4",{className:"text-lg font-semibold text-foreground",children:["重置密码 - ",_.username]}),e.jsx("button",{onClick:xe,className:"text-muted-foreground hover:text-foreground",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("form",{onSubmit:Le,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"resetNewPassword",className:"block text-sm font-medium text-foreground mb-1",children:"新密码"}),e.jsx("input",{type:"password",id:"resetNewPassword",value:ne,onChange:F=>Y(F.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入新密码(至少6个字符)",disabled:ye})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"resetConfirmPassword",className:"block text-sm font-medium text-foreground mb-1",children:"确认新密码"}),e.jsx("input",{type:"password",id:"resetConfirmPassword",value:le,onChange:F=>de(F.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请再次输入新密码",disabled:ye})]}),fe&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:fe})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(U,{type:"button",variant:"outline",onClick:xe,disabled:ye,children:"取消"}),e.jsx(U,{type:"submit",disabled:ye,children:ye?"重置中...":"重置密码"})]})]})]})}),Fe&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-lg w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h4",{className:"text-lg font-semibold text-foreground",children:["修改角色 - ",Fe.username||Fe.email]}),e.jsx("button",{onClick:be,className:"text-muted-foreground hover:text-foreground",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("form",{onSubmit:at,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"选择角色"}),e.jsxs("label",{className:"flex items-center gap-3 p-3 border border-border rounded-md cursor-pointer hover:bg-accent/50 transition-colors",children:[e.jsx("input",{type:"radio",name:"role",value:"admin",checked:Se==="admin",onChange:F=>He(F.target.value),className:"text-blue-600",disabled:Oe}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Gt,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"管理员"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"可管理普通用户,但不能操作其他管理员"})]})]}),e.jsxs("label",{className:"flex items-center gap-3 p-3 border border-border rounded-md cursor-pointer hover:bg-accent/50 transition-colors",children:[e.jsx("input",{type:"radio",name:"role",value:"user",checked:Se==="user",onChange:F=>He(F.target.value),className:"text-blue-600",disabled:Oe}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(An,{className:"w-4 h-4 text-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"普通用户"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"受额度限制,无管理权限"})]})]})]}),Be&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:Be})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(U,{type:"button",variant:"outline",onClick:be,disabled:Oe,children:"取消"}),e.jsx(U,{type:"submit",disabled:Oe,children:Oe?"保存中...":"保存"})]})]})]})}),Ye&&e.jsx(wc,{user:Ye,onClose:()=>Xe(null),onSaved:()=>ze()}),Je&&e.jsx(Nc,{user:Je,onClose:()=>Ce(null),onSaved:()=>ze()})]})}function Tc(){const[r,o]=n.useState(""),[l,u]=n.useState(""),[c,m]=n.useState(!0),[d,s]=n.useState(!1),[p,t]=n.useState(null);n.useEffect(()=>{x()},[]);const x=async()=>{try{const a=await me.admin.getDefaultLimits();if(a.ok){const i=await a.json();o(i.default_total_limit_usd!==null?String(i.default_total_limit_usd):""),u(i.default_daily_limit_usd!==null?String(i.default_daily_limit_usd):"")}}catch(a){console.error("Error fetching default limits:",a)}finally{m(!1)}},h=async a=>{a.preventDefault(),s(!0),t(null);const i=r.trim()===""?null:parseFloat(r),g=l.trim()===""?null:parseFloat(l);if(i!==null&&(isNaN(i)||i<0)){t("error"),s(!1);return}if(g!==null&&(isNaN(g)||g<0)){t("error"),s(!1);return}try{(await me.admin.updateDefaultLimits({default_total_limit_usd:i,default_daily_limit_usd:g})).ok?(t("success"),setTimeout(()=>t(null),2e3)):t("error")}catch(v){console.error("Error updating default limits:",v),t("error")}finally{s(!1)}};return c?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"正在加载..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"新用户默认额度"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"新注册用户将自动应用此总额度限制,留空表示不限制。管理员账户不受此限制。"})]}),e.jsx("form",{onSubmit:h,className:"space-y-3",children:e.jsxs("div",{className:"flex items-end gap-3",children:[e.jsxs("div",{className:"flex-1 max-w-xs",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-1",children:"默认总额度上限 (USD)"}),e.jsx("input",{type:"number",step:"0.01",min:"0",value:r,onChange:a=>o(a.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"留空表示不限制",disabled:d})]}),e.jsxs("div",{className:"flex-1 max-w-xs",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-1",children:"默认日限制 (USD)"}),e.jsx("input",{type:"number",step:"0.01",min:"0",value:l,onChange:a=>u(a.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"留空表示不限制",disabled:d})]}),e.jsxs(U,{type:"submit",variant:"default",size:"sm",disabled:d,className:"flex items-center gap-2",children:[e.jsx(Un,{className:"w-4 h-4"}),d?"保存中...":"保存"]}),p==="success"&&e.jsx("span",{className:"text-sm text-green-600",children:"已保存"}),p==="error"&&e.jsx("span",{className:"text-sm text-red-600",children:"请输入有效的正数"})]})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"此设置仅影响新注册的用户,不会修改已有用户的额度。"})]})}const Xc=[{key:"claude_shell",label:"Claude Code Shell"},{key:"codex_shell",label:"Codex Shell"},{key:"gemini_shell",label:"Gemini CLI Shell"},{key:"submit_agent",label:"提交 Agent"},{key:"tab_models",label:"模型设置"},{key:"tab_skills",label:"技能设置"},{key:"tab_mcp",label:"MCP 服务器设置"},{key:"tab_permissions",label:"权限设置"},{key:"feishu_binding",label:"绑定飞书账号"},{key:"create_project",label:"新建项目"}];function Mc(){const[r,o]=n.useState({}),[l,u]=n.useState(!0),[c,m]=n.useState(!1),[d,s]=n.useState(null);n.useEffect(()=>{p()},[]);const p=async()=>{try{const h=await me.admin.getDefaultPermissions();if(h.ok){const a=await h.json();o(a.permissions||{})}}catch(h){console.error("Error fetching default permissions:",h)}finally{u(!1)}},t=h=>{o(a=>({...a,[h]:!a[h]}))},x=async h=>{h.preventDefault(),m(!0),s(null);try{(await me.admin.updateDefaultPermissions(r)).ok?(s("success"),setTimeout(()=>s(null),2e3)):s("error")}catch(a){console.error("Error updating default permissions:",a),s("error")}finally{m(!1)}};return l?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"正在加载..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"新用户默认功能权限"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置新注册用户的默认功能权限。已设置个性化权限的用户不受此影响。管理员始终拥有全部权限。"})]}),e.jsxs("form",{onSubmit:x,className:"space-y-3",children:[e.jsx("div",{className:"space-y-1",children:Xc.map(h=>e.jsxs("label",{className:"flex items-center justify-between p-2.5 rounded-md hover:bg-accent/50 cursor-pointer transition-colors",children:[e.jsx("span",{className:"text-sm font-medium text-foreground",children:h.label}),e.jsx("button",{type:"button",role:"switch","aria-checked":r[h.key]!==!1,onClick:()=>t(h.key),className:`relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${r[h.key]!==!1?"bg-blue-600":"bg-gray-300 dark:bg-gray-600"}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${r[h.key]!==!1?"translate-x-4":"translate-x-0"}`})})]},h.key))}),e.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[e.jsxs(U,{type:"submit",variant:"default",size:"sm",disabled:c,className:"flex items-center gap-2",children:[e.jsx(Un,{className:"w-4 h-4"}),c?"保存中...":"保存"]}),d==="success"&&e.jsx("span",{className:"text-sm text-green-600",children:"已保存"}),d==="error"&&e.jsx("span",{className:"text-sm text-red-600",children:"保存失败"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"此设置仅影响未设置个性化权限的用户和新注册用户。"})]})}function Oc(){const{showConfirm:r}=lt(),[o,l]=n.useState([]),[u,c]=n.useState(!0),[m,d]=n.useState(null),[s,p]=n.useState(!1),[t,x]=n.useState(""),[h,a]=n.useState(""),[i,g]=n.useState(!1),v=async()=>{try{const f=await me.admin.getEmailDomains();if(f.ok){const w=await f.json();l(w.domains)}}catch(f){console.error("Error fetching email domains:",f)}finally{c(!1)}};n.useEffect(()=>{v()},[]);const k=async f=>{if(f.preventDefault(),a(""),!t){a("域名不能为空");return}if(!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}$/.test(t)){a("域名格式无效,例如: example.com");return}g(!0);try{const N=await me.admin.addEmailDomain(t.toLowerCase()),L=await N.json();N.ok?(await v(),p(!1),x("")):a(L.error||"添加域名失败")}catch(N){console.error("Error adding domain:",N),a("网络错误,请稍后再试")}finally{g(!1)}},b=async(f,w)=>{if(await r(`确定要删除域名 "${w}"?删除后该域名的邮箱将无法注册。`,{title:"删除域名",variant:"danger",confirmText:"确认删除"})){d(f);try{(await me.admin.removeEmailDomain(f)).ok&&l(o.filter(L=>L.id!==f))}catch(N){console.error("Error removing domain:",N)}finally{d(null)}}},j=()=>{p(!1),x(""),a("")};return u?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"正在加载..."}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"邮箱域名白名单"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:o.length===0?"未设置白名单,所有邮箱域名均可注册":"只有白名单内的域名邮箱可以注册"})]}),e.jsxs(U,{variant:"default",size:"sm",onClick:()=>p(!0),className:"flex items-center gap-2",children:[e.jsx(zt,{className:"w-4 h-4"}),"添加域名"]})]}),o.length>0?e.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium text-muted-foreground",children:"域名"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium text-muted-foreground",children:"添加时间"}),e.jsx("th",{className:"px-4 py-3 text-right text-sm font-medium text-muted-foreground",children:"操作"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-gray-700",children:o.map(f=>e.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-900/30",children:[e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Yr,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"font-medium text-foreground",children:f.domain})]})}),e.jsx("td",{className:"px-4 py-3 text-sm text-muted-foreground",children:new Date(f.created_at).toLocaleDateString()}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("div",{className:"flex items-center justify-end",children:e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>b(f.id,f.domain),disabled:m===f.id,title:"删除域名",children:e.jsx(vt,{className:"w-4 h-4 text-red-500"})})})})]},f.id))})]})}):e.jsxs("div",{className:"border border-dashed border-gray-300 dark:border-gray-600 rounded-lg p-8 text-center",children:[e.jsx(Yr,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"暂无域名白名单,所有邮箱域名均可注册"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"添加域名后,只有白名单内的域名邮箱可以注册"})]}),s&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-lg w-full max-w-md p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h4",{className:"text-lg font-semibold text-foreground",children:"添加域名"}),e.jsx("button",{onClick:j,className:"text-muted-foreground hover:text-foreground",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("form",{onSubmit:k,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"newDomain",className:"block text-sm font-medium text-foreground mb-1",children:"邮箱域名"}),e.jsx("input",{type:"text",id:"newDomain",value:t,onChange:f=>x(f.target.value.toLowerCase()),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"例如: example.com",disabled:i}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入域名后,该域名下的所有邮箱(如 user@example.com)都可以注册"})]}),h&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:h})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(U,{type:"button",variant:"outline",onClick:j,disabled:i,children:"取消"}),e.jsx(U,{type:"submit",disabled:i,children:i?"添加中...":"添加"})]})]})]})})]})}const Fr={pending:{label:"待审核",className:"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",icon:Mr},approved:{label:"已通过",className:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",icon:ss},rejected:{label:"已拒绝",className:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",icon:os}};function Yo(r){return r?new Date(r).toLocaleString("zh-CN",{dateStyle:"short",timeStyle:"short"}):"-"}function Cc({submissionId:r}){const[o,l]=n.useState(null),[u,c]=n.useState(!0),[m,d]=n.useState(0);if(n.useEffect(()=>{J(`/api/agents/submissions/${r}/contents`).then(p=>p.json()).then(p=>{l(p.files||[]),d(0)}).catch(()=>l([])).finally(()=>c(!1))},[r]),u)return e.jsxs("div",{className:"flex items-center gap-1.5 py-3 text-xs text-gray-400",children:[e.jsx(st,{className:"w-3 h-3 animate-spin"})," 加载文件内容..."]});if(!o||o.length===0)return e.jsx("p",{className:"text-xs text-gray-400 py-2",children:"无法读取文件内容"});const s=o[m];return e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"flex items-center gap-1 mb-2 flex-wrap",children:o.map((p,t)=>e.jsxs("button",{onClick:()=>d(t),className:`flex items-center gap-1 px-2 py-1 text-[11px] rounded border transition-colors ${t===m?"bg-blue-50 dark:bg-blue-900/20 border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300":"border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 hover:border-gray-300"}`,children:[e.jsx(ur,{className:"w-3 h-3"}),p.name]},p.name))}),e.jsx("pre",{className:"text-[11px] leading-relaxed bg-gray-900 dark:bg-gray-950 text-gray-100 rounded-lg p-3 overflow-auto max-h-72 whitespace-pre-wrap break-words",children:s?.content||""})]})}function Ec(){const{showAlert:r}=lt(),[o,l]=n.useState([]),[u,c]=n.useState(!0),[m,d]=n.useState("pending"),[s,p]=n.useState(null),[t,x]=n.useState(null),[h,a]=n.useState(""),[i,g]=n.useState(null),[v,k]=n.useState(null),[b,j]=n.useState(!1);n.useEffect(()=>{f()},[m]);const f=async()=>{try{c(!0);const S=m?`/api/agents/submissions?status=${m}`:"/api/agents/submissions",R=await J(S);if(R.ok){const M=await R.json();l(M.submissions||[])}else r("加载提交列表失败",{variant:"error"})}catch(S){r(S.message,{variant:"error"})}finally{c(!1)}},w=S=>{k(S.id),j(!1)},N=async(S,R)=>{x(S.id);try{const M=await J(`/api/agents/submissions/${S.id}/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updateAllUsers:R})}),D=await M.json();if(M.ok){let $=`已通过审核,版本 v${D.version} 已发布到仓库。`;D.updatedUsersCount>0&&($+=`
179
+ 另已强制更新 ${D.updatedUsersCount} 个已使用用户。`),r($,{title:"审核通过"}),k(null),f()}else r(D.error||"操作失败",{variant:"error"})}catch(M){r(M.message,{variant:"error"})}finally{x(null)}},L=S=>{g(S.id),a("")},E=async S=>{x(S.id);try{const R=await J(`/api/agents/submissions/${S.id}/reject`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:h})});if(R.ok)r("已拒绝该提交。",{title:"审核拒绝"}),g(null),f();else{const M=await R.json();r(M.error||"操作失败",{variant:"error"})}}catch(R){r(R.message,{variant:"error"})}finally{x(null)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-2",children:["pending","approved","rejected",""].map(S=>e.jsx("button",{onClick:()=>d(S),className:`px-3 py-1 text-xs rounded-full border transition-colors ${m===S?"bg-blue-500 text-white border-blue-500":"border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:border-blue-300"}`,children:S===""?"全部":Fr[S]?.label},S||"all"))}),e.jsxs(U,{variant:"outline",size:"sm",onClick:f,className:"flex items-center gap-1.5",children:[e.jsx(st,{className:`w-3.5 h-3.5 ${u?"animate-spin":""}`}),"刷新"]})]}),u?e.jsx("div",{className:"text-center py-8 text-gray-400 text-sm",children:"加载中..."}):o.length===0?e.jsxs("div",{className:"text-center py-8 text-gray-400 text-sm border border-dashed border-gray-200 dark:border-gray-700 rounded-lg",children:["暂无",m?Fr[m]?.label:"","提交记录"]}):e.jsx("div",{className:"space-y-2",children:o.map(S=>{const R=Fr[S.status]||Fr.pending,M=R.icon,D=s===S.id,$=t===S.id,T=i===S.id,X=v===S.id;return e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-3 p-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium text-sm text-gray-900 dark:text-gray-100",children:S.display_name}),e.jsx("span",{className:"text-xs text-gray-400 font-mono",children:S.agent_name}),e.jsxs(nt,{className:`text-xs ${R.className} flex items-center gap-1`,children:[e.jsx(M,{className:"w-3 h-3"}),R.label]}),S.version&&e.jsxs("span",{className:"text-xs text-green-600 dark:text-green-400",children:["v",S.version]})]}),e.jsxs("div",{className:"flex items-center gap-4 mt-0.5 text-xs text-gray-400",children:[e.jsxs("span",{children:["提交人: ",S.username||S.email||`uid-${S.user_id}`]}),e.jsxs("span",{children:["提交时间: ",Yo(S.submitted_at)]}),S.reviewed_at&&e.jsxs("span",{children:["审核时间: ",Yo(S.reviewed_at)]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[S.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsx(U,{size:"sm",className:"text-xs h-7 px-2.5 bg-green-600 hover:bg-green-700 text-white",onClick:()=>w(S),disabled:$,children:"通过"}),e.jsx(U,{size:"sm",variant:"outline",className:"text-xs h-7 px-2.5 text-red-600 border-red-200 hover:bg-red-50 dark:border-red-800 dark:hover:bg-red-900/20",onClick:()=>L(S),disabled:$,children:"拒绝"})]}),e.jsx("button",{onClick:()=>p(D?null:S.id),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:D?e.jsx(Dn,{className:"w-4 h-4"}):e.jsx(Vt,{className:"w-4 h-4"})})]})]}),D&&e.jsxs("div",{className:"border-t border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 p-3 space-y-2",children:[S.description&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-1",children:"描述"}),e.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300",children:S.description})]}),S.update_notes&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-blue-500 dark:text-blue-400 mb-1",children:"更新说明"}),e.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300",children:S.update_notes})]}),S.status==="rejected"&&S.reject_reason&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-red-500 mb-1",children:"拒绝原因"}),e.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:S.reject_reason})]}),e.jsx(Cc,{submissionId:S.id})]}),T&&e.jsxs("div",{className:"border-t border-red-100 dark:border-red-900/30 bg-red-50 dark:bg-red-900/10 p-3",children:[e.jsx("p",{className:"text-xs font-medium text-red-600 dark:text-red-400 mb-2",children:"填写拒绝原因"}),e.jsx("textarea",{value:h,onChange:_=>a(_.target.value),placeholder:"可选:填写拒绝原因告知提交者",rows:2,className:"w-full border border-red-200 dark:border-red-800 rounded px-2 py-1.5 text-xs bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none resize-none mb-2"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(U,{size:"sm",className:"text-xs h-7 px-2.5 bg-red-600 hover:bg-red-700 text-white",onClick:()=>E(S),disabled:$,children:$?"处理中...":"确认拒绝"}),e.jsx(U,{size:"sm",variant:"outline",className:"text-xs h-7 px-2.5",onClick:()=>g(null),disabled:$,children:"取消"})]})]}),X&&e.jsxs("div",{className:"border-t border-green-100 dark:border-green-900/30 bg-green-50 dark:bg-green-900/10 p-3",children:[e.jsx("p",{className:"text-xs font-medium text-green-700 dark:text-green-400 mb-2",children:"确认通过审核?系统将自动递增版本并发布到仓库。"}),e.jsxs("label",{className:"flex items-start gap-2 mb-2 cursor-pointer select-none",children:[e.jsx("input",{type:"checkbox",checked:b,onChange:_=>j(_.target.checked),disabled:$,className:"mt-0.5 cursor-pointer"}),e.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300",children:"同时强制更新所有已使用该项目模板的用户(将覆盖本地修改)"})]}),b&&e.jsxs("p",{className:"text-xs text-amber-600 dark:text-amber-400 mb-2 flex items-start gap-1",children:[e.jsx("span",{children:"⚠"}),e.jsx("span",{children:"此操作将强制覆盖所有用户对该项目模板文件的本地修改,不可撤销。"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{size:"sm",className:"text-xs h-7 px-2.5 bg-green-600 hover:bg-green-700 text-white flex items-center gap-1.5",onClick:()=>N(S,b),disabled:$,children:$?e.jsxs(e.Fragment,{children:[e.jsx(st,{className:"w-3 h-3 animate-spin"}),b?"更新中,请稍候...":"处理中..."]}):"确认通过"}),e.jsx(U,{size:"sm",variant:"outline",className:"text-xs h-7 px-2.5",onClick:()=>k(null),disabled:$,children:"取消"})]})]})]},S.id)})})]})}function Dc({days:r,formatCost:o,formatNumber:l}){const[u,c]=n.useState(null),m=Math.max(...r.map(d=>d.cost||0),.001);return e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"flex items-end justify-between gap-1.5 h-40",children:r.map(d=>{const s=(d.cost||0)/m*100,p=new Date(d.date+"T12:00:00").toLocaleDateString("zh-CN",{month:"numeric",day:"numeric"});return e.jsxs("div",{className:"flex-1 flex flex-col items-center gap-1 h-full",onMouseEnter:()=>c(d),onMouseLeave:()=>c(null),children:[e.jsx("div",{className:"flex-1 w-full flex items-end",children:e.jsx("div",{className:"w-full rounded-t bg-gradient-to-t from-blue-500 to-blue-400 transition-all duration-300",style:{height:`${Math.max(s,d.cost>0?2:0)}%`}})}),e.jsx("span",{className:"text-[10px] text-muted-foreground whitespace-nowrap",children:p})]},d.date)})}),u&&e.jsxs("div",{className:"absolute -top-16 left-1/2 -translate-x-1/2 bg-popover border border-border rounded-lg px-3 py-2 text-xs shadow-lg z-10 whitespace-nowrap pointer-events-none",children:[e.jsx("div",{className:"font-medium text-foreground",children:u.date}),e.jsxs("div",{className:"text-muted-foreground",children:["费用:",o(u.cost)]}),e.jsxs("div",{className:"text-muted-foreground",children:["请求:",l(u.requests)]})]})]})}function Pc({onBack:r}){const[o,l]=n.useState("week"),[u,c]=n.useState(null),[m,d]=n.useState(!0),[s,p]=n.useState(!1),t=async()=>{try{const b=await J(`/api/admin/usage/dashboard?period=${o}`);if(b.ok){const j=await b.json();c(j)}}catch(b){console.error("Error fetching dashboard data:",b)}finally{d(!1),p(!1)}};n.useEffect(()=>{d(!0),t()},[o]);const x=async()=>{try{p(!0),await J("/api/admin/usage/scan",{method:"POST"}),await t()}catch(b){console.error("Error triggering scan:",b),p(!1)}},h=b=>!b||b===0?"$0.00":b<.01?`$${b.toFixed(4)}`:`$${b.toFixed(2)}`,a=b=>b?b>=1e6?`${(b/1e6).toFixed(1)}M`:b>=1e3?`${(b/1e3).toFixed(1)}K`:b.toString():"0";if(m)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"text-muted-foreground",children:"加载仪表板中..."})});const{totals:i,dailyTrend:g,modelDistribution:v,topUsers:k}=u||{};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[r&&e.jsxs(U,{variant:"ghost",size:"sm",onClick:r,children:[e.jsx(Qt,{className:"w-4 h-4 mr-2"}),"返回"]}),e.jsx("h2",{className:"text-2xl font-bold text-foreground",children:"使用情况仪表板"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:["week","month"].map(b=>e.jsx("button",{onClick:()=>l(b),className:`px-4 py-2 text-sm font-medium transition-colors ${o===b?"bg-primary text-primary-foreground":"bg-background text-foreground hover:bg-muted"}`,children:b==="week"?"周":"月"},b))}),e.jsx(U,{variant:"outline",size:"sm",onClick:x,disabled:s,title:"扫描新的使用数据",children:e.jsx(st,{className:`w-4 h-4 ${s?"animate-spin":""}`})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-green-100 dark:bg-green-900/30 rounded-lg",children:e.jsx(Yn,{className:"w-5 h-5 text-green-600 dark:text-green-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"总成本"}),e.jsx("p",{className:"text-2xl font-bold text-foreground",children:h(i?.totalCost)})]})]})}),e.jsx("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-blue-100 dark:bg-blue-900/30 rounded-lg",children:e.jsx(is,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"活跃用户"}),e.jsxs("p",{className:"text-2xl font-bold text-foreground",children:[i?.activeUsers||0," / ",i?.totalUsers||0]})]})]})}),e.jsx("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-purple-100 dark:bg-purple-900/30 rounded-lg",children:e.jsx(Er,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"总请求数"}),e.jsx("p",{className:"text-2xl font-bold text-foreground",children:a(i?.totalRequests)})]})]})}),e.jsx("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-orange-100 dark:bg-orange-900/30 rounded-lg",children:e.jsx(ls,{className:"w-5 h-5 text-orange-600 dark:text-orange-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"会话数"}),e.jsx("p",{className:"text-2xl font-bold text-foreground",children:a(i?.totalSessions)})]})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-4",children:"每日成本趋势"}),g&&g.length>0?e.jsx(Dc,{days:g,formatCost:h,formatNumber:a}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"无可用的使用数据"})]}),e.jsxs("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-4",children:"模型成本"}),v&&v.length>0?e.jsx("div",{className:"space-y-3",children:v.map(b=>{const j=v.reduce((E,S)=>E+(S.cost||0),0)||1,f=(b.cost||0)/j*100,w=(b.normalized_model||b.model||"").toLowerCase(),L=(E=>E.includes("codex")?"bg-orange-500":E.includes("opus")?"bg-purple-500":E.includes("sonnet")?"bg-blue-500":E.includes("haiku")?"bg-green-500":"bg-gray-500")(w);return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(nt,{variant:"secondary",className:"truncate max-w-[200px]",title:b.model,children:b.model}),e.jsxs("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:[a(b.requests)," 请求"]})]}),e.jsx("span",{className:"text-sm font-mono text-foreground whitespace-nowrap ml-2",children:h(b.cost)})]}),e.jsx("div",{className:"h-2 bg-gray-100 dark:bg-gray-800 rounded overflow-hidden",children:e.jsx("div",{className:`h-full ${L} rounded`,style:{width:`${f}%`}})})]},b.model)})}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"无可用的使用数据"})]})]}),e.jsxs("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-4",children:"用户成本"}),k&&k.length>0?e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:[e.jsx("th",{className:"text-left py-2 text-sm font-medium text-muted-foreground",children:"排名"}),e.jsx("th",{className:"text-left py-2 text-sm font-medium text-muted-foreground",children:"用户名"}),e.jsx("th",{className:"text-right py-2 text-sm font-medium text-muted-foreground",children:"请求数"}),e.jsx("th",{className:"text-right py-2 text-sm font-medium text-muted-foreground",children:"成本"})]})}),e.jsx("tbody",{children:k.map((b,j)=>e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800 last:border-0",children:[e.jsxs("td",{className:"py-2 text-sm text-muted-foreground",children:["#",j+1]}),e.jsx("td",{className:"py-2 text-sm font-medium text-foreground",children:b.username}),e.jsx("td",{className:"py-2 text-sm text-right text-muted-foreground",children:a(b.total_requests)}),e.jsx("td",{className:"py-2 text-sm text-right font-mono text-foreground",children:h(b.total_cost)})]},b.user_uuid))})]})}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"无可用的使用数据"})]})]})}const Jo={hex:{opus:"#a855f7",sonnet:"#3b82f6",haiku:"#22c55e",codex:"#f97316",default:"#6b7280"},tailwind:{opus:"bg-purple-500",sonnet:"bg-blue-500",haiku:"bg-green-500",codex:"bg-orange-500",default:"bg-gray-500"}};function qo(r=""){const o=r.toLowerCase();return o.includes("codex")?"codex":o.includes("opus")?"opus":o.includes("sonnet")?"sonnet":o.includes("haiku")?"haiku":"default"}function oo(r){return!r||r===0?"$0.00":r<.01?`$${r.toFixed(4)}`:`$${r.toFixed(2)}`}function Hn(r){return r?r>=1e6?`${(r/1e6).toFixed(1)}M`:r>=1e3?`${(r/1e3).toFixed(1)}K`:r.toString():"0"}function Ac(r){const o=[];for(let l=r-1;l>=0;l--){const u=new Date;u.setDate(u.getDate()-l),o.push(u.toISOString().split("T")[0])}return o}function Lc({data:r}){const[o,l]=n.useState(null),u=140,c=u/2,m=u/2,d=56,s=r.reduce((x,h)=>x+(h.cost||0),0)||1;let p=-Math.PI/2;const t=r.map(x=>{const h=(x.cost||0)/s,a=h*2*Math.PI,i=p+a,g=c+d*Math.cos(p),v=m+d*Math.sin(p),k=c+d*Math.cos(i),b=m+d*Math.sin(i),j=a>Math.PI?1:0,f=h<.001?"":`M ${c} ${m} L ${g} ${v} A ${d} ${d} 0 ${j} 1 ${k} ${b} Z`,w=p+a/2,N={...x,pathD:f,ratio:h,midAngle:w,key:x.model};return p=i,N});return e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("svg",{width:u,height:u,className:"flex-shrink-0",children:[t.map(x=>e.jsx("path",{d:x.pathD,fill:Jo.hex[qo(x.model)],opacity:o===null||o===x.key?1:.4,stroke:"white",strokeWidth:"1.5",onMouseEnter:()=>l(x.key),onMouseLeave:()=>l(null),className:"cursor-pointer transition-opacity duration-150"},x.key)),r.length===0&&e.jsx("circle",{cx:c,cy:m,r:d,fill:"#e5e7eb"})]}),e.jsx("div",{className:"flex-1 space-y-1.5 min-w-0",children:t.map(x=>{const h=(x.ratio*100).toFixed(1),a=qo(x.model);return e.jsxs("div",{className:"flex items-center gap-2 min-w-0",onMouseEnter:()=>l(x.key),onMouseLeave:()=>l(null),children:[e.jsx("div",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${Jo.tailwind[a]}`}),e.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",title:x.model,children:x.model}),e.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:[h,"%"]}),e.jsx("span",{className:"text-xs font-mono text-foreground flex-shrink-0 w-14 text-right",children:oo(x.cost)})]},x.key)})})]})}function Ic({days:r}){const[o,l]=n.useState(null),u=Math.max(...r.map(c=>c.cost||0),.001);return e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"flex items-end justify-between gap-1.5 h-40",children:r.map(c=>{const m=(c.cost||0)/u*100,d=new Date(c.date+"T12:00:00").toLocaleDateString("zh-CN",{month:"numeric",day:"numeric"});return e.jsxs("div",{className:"flex-1 flex flex-col items-center gap-1 h-full",onMouseEnter:()=>l(c),onMouseLeave:()=>l(null),children:[e.jsx("div",{className:"flex-1 w-full flex items-end relative",children:e.jsx("div",{className:"w-full rounded-t bg-gradient-to-t from-blue-500 to-blue-400 transition-all duration-300 min-h-[2px]",style:{height:`${Math.max(m,c.cost>0?2:0)}%`}})}),e.jsx("span",{className:"text-[10px] text-muted-foreground whitespace-nowrap",children:d})]},c.date)})}),o&&e.jsxs("div",{className:"absolute -top-16 left-1/2 -translate-x-1/2 bg-popover border border-border rounded-lg px-3 py-2 text-xs shadow-lg z-10 whitespace-nowrap pointer-events-none",children:[e.jsx("div",{className:"font-medium text-foreground",children:o.date}),e.jsxs("div",{className:"text-muted-foreground",children:["费用:",oo(o.cost)]}),e.jsxs("div",{className:"text-muted-foreground",children:["请求:",Hn(o.requests)]})]})]})}function _c({userUuid:r,username:o,onBack:l}){const[u,c]=n.useState(null),[m,d]=n.useState(!0);n.useEffect(()=>{(async()=>{try{const h=await J(`/api/admin/usage/users/${r}?period=week`);h.ok&&c(await h.json())}catch(h){console.error("Error fetching user usage:",h)}finally{d(!1)}})()},[r]);const s=Ac(7),p={};(u?.dailyTrend||[]).forEach(x=>{p[x.date]=x});const t=s.map(x=>({date:x,cost:p[x]?.cost||0,requests:p[x]?.requests||0}));return m?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"text-muted-foreground",children:"加载用户数据中..."})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(U,{variant:"ghost",size:"sm",onClick:l,children:[e.jsx(Qt,{className:"w-4 h-4 mr-2"}),"返回"]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:o}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"最近 7 天使用情况"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-green-100 dark:bg-green-900/30 rounded-lg",children:e.jsx(Yn,{className:"w-5 h-5 text-green-600 dark:text-green-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"累计成本"}),e.jsx("p",{className:"text-xl font-bold text-foreground",children:oo(u?.totalCost)})]})]})}),e.jsx("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-purple-100 dark:bg-purple-900/30 rounded-lg",children:e.jsx(Er,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"累计请求数"}),e.jsx("p",{className:"text-xl font-bold text-foreground",children:Hn(u?.totalRequests)})]})]})}),e.jsx("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-orange-100 dark:bg-orange-900/30 rounded-lg",children:e.jsx(ls,{className:"w-5 h-5 text-orange-600 dark:text-orange-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"累计会话数"}),e.jsx("p",{className:"text-xl font-bold text-foreground",children:Hn(u?.totalSessions)})]})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground mb-4",children:"最近 7 天每日消耗"}),e.jsx(Ic,{days:t})]}),e.jsxs("div",{className:"bg-card border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground mb-4",children:"模型分布"}),u?.modelDistribution&&u.modelDistribution.length>0?e.jsx(Lc,{data:u.modelDistribution}):e.jsx("div",{className:"flex items-center justify-center h-36 text-muted-foreground text-sm",children:"暂无使用数据"})]})]})]})}function zc({isOpen:r,onClose:o}){const{isAdmin:l,isSuperAdmin:u}=Ot(),[c,m]=n.useState("users"),[d,s]=n.useState(!1),[p,t]=n.useState(null);if(!r||!l)return null;const x=[{id:"users",label:"用户管理",icon:is},{id:"system",label:"系统设置",icon:qa},{id:"agents",label:"共享项目审核",icon:It}],h=a=>{m(a),s(!1),t(null)};return e.jsx("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[9999] md:p-4 bg-background/95",children:e.jsxs("div",{className:"bg-background border border-border md:rounded-lg shadow-xl w-full md:max-w-5xl h-full md:h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-border flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Gt,{className:"w-5 h-5 md:w-6 md:h-6 text-blue-600"}),e.jsx("h2",{className:"text-lg md:text-xl font-semibold text-foreground",children:"管理"})]}),e.jsx(U,{variant:"ghost",size:"sm",onClick:o,className:"text-muted-foreground hover:text-foreground touch-manipulation",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex-1 flex flex-col md:flex-row overflow-hidden",children:[e.jsx("div",{className:"md:hidden border-b border-border",children:e.jsx("div",{className:"flex px-4",children:x.map(a=>e.jsx("button",{onClick:()=>h(a.id),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${c===a.id?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:a.label},a.id))})}),e.jsx("div",{className:"hidden md:flex flex-col w-48 border-r border-border p-3 gap-1 flex-shrink-0",children:x.map(a=>{const i=a.icon;return e.jsxs("button",{onClick:()=>h(a.id),className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors ${c===a.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground hover:bg-accent/50"}`,children:[e.jsx(i,{className:"w-4 h-4"}),a.label]},a.id)})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 md:p-6",children:[c==="users"&&e.jsx("div",{className:"space-y-6 md:space-y-8",children:d?e.jsx(Pc,{onBack:()=>s(!1)}):p?e.jsx(_c,{userUuid:p.uuid,username:p.username,onBack:()=>t(null)}):e.jsx(Sc,{isSuperAdmin:u,onNavigateToUsage:()=>s(!0),onViewUser:(a,i)=>t({uuid:a,username:i})})}),c==="system"&&e.jsxs("div",{className:"space-y-6 md:space-y-8",children:[e.jsx(Tc,{}),e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-6 md:pt-8",children:e.jsx(Mc,{})}),e.jsx(Oc,{})]}),c==="agents"&&e.jsx(Ec,{})]})]})]})})}function Rc({isOpen:r,limitType:o,onClose:l}){if(!r)return null;const u=o==="total_limit_exceeded";return e.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-[100]",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-xl w-full max-w-md p-6 mx-4 animate-in fade-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 bg-red-100 dark:bg-red-900/30 rounded-full flex items-center justify-center flex-shrink-0",children:e.jsx(Bt,{className:"w-6 h-6 text-red-600 dark:text-red-400"})}),e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:u?"使用上限已达到":"今日使用上限已达到"})})]}),e.jsx("button",{onClick:l,className:"p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:e.jsx(Ge,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"mb-6 text-muted-foreground space-y-3",children:u?e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"您的账户已达到使用总额度上限。"}),e.jsx("p",{className:"text-sm",children:"请联系管理员提升您的额度限制,以继续使用 Claude 服务。"})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"您已达到今日使用额度上限。"}),e.jsx("p",{className:"text-sm",children:"您可以等待明日额度重置后继续使用,或联系管理员提升您的每日额度限制。"})]})}),e.jsx("div",{className:"mb-6 p-3 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg",children:e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:u?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"提示:"}),"请联系您的管理员,申请提升使用额度。"]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:"提示:"}),"每日额度将在次日 00:00 自动重置,您也可以联系管理员调整限额。"]})})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(U,{variant:"default",onClick:l,children:"我知道了"})})]})})}const $c=[{type:"user",content:"为什么上周的活跃用户数突然下降了 12%?",delay:1500},{type:"system",content:null,temporary:!0,delay:2e3},{type:"system",content:`正在分析最近 7 天的用户行为数据与服务端日志...
180
180
 
181
181
  经排查,主要原因如下:
182
182
  1. 上周四发布的 v3.2.1 版本引入了一个登录态校验 Bug,导致约 18% 的 iOS 用户被强制登出。
@@ -196,5 +196,5 @@ X-API-Key=your-key`})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",c
196
196
  1. 数据库查询未使用索引(耗时占 45%)
197
197
  2. JSON 序列化存在冗余字段(内存多占 30%)
198
198
  3. 日志写入为同步 I/O(P99 延迟 +200ms)`}]}];function Uc({messages:r}){return e.jsxs("div",{className:"demo-chat-mockup glass-panel",children:[e.jsxs("div",{className:"lp-chat-header",children:[e.jsxs("div",{className:"lp-window-controls",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]}),e.jsx("div",{className:"lp-chat-title",children:"AgentHub"})]}),e.jsx("div",{className:"lp-chat-body",children:r.map((o,l)=>e.jsxs("div",{className:`lp-message ${o.type==="user"?"lp-user-msg":"lp-system-msg"}`,children:[e.jsx("div",{className:"lp-avatar",children:o.type==="user"?"U":e.jsx("img",{src:"/logo.svg",alt:"AgentHub"})}),e.jsx("div",{className:"lp-msg-content",children:o.content.split(`
199
- `).map((u,c)=>e.jsxs(mt.Fragment,{children:[c>0&&e.jsx("br",{}),u]},c))})]},l))})]})}function Gc(){const r=Qr(),{isDarkMode:o,toggleDarkMode:l}=no(),[u,c]=n.useState(!1);return n.useEffect(()=>{const m=()=>c(window.scrollY>50);return window.addEventListener("scroll",m,{passive:!0}),()=>window.removeEventListener("scroll",m)},[]),n.useEffect(()=>{window.scrollTo(0,0)},[]),n.useEffect(()=>{const m=new IntersectionObserver(d=>{d.forEach(s=>{s.isIntersecting&&(s.target.classList.add("visible"),m.unobserve(s.target))})},{threshold:.1});return document.querySelectorAll(".lp-fade-up").forEach(d=>m.observe(d)),()=>m.disconnect()},[]),e.jsxs("div",{className:"landing-page",children:[e.jsx("div",{className:"bg-orb orb-1"}),e.jsx("div",{className:"bg-orb orb-2"}),e.jsx("div",{className:"bg-grid"}),e.jsxs("nav",{className:`lp-navbar${u?" scrolled":""}`,children:[e.jsxs(qt,{to:"/",className:"lp-logo",children:[e.jsx("img",{className:"lp-logo-icon",src:"/logo.svg",alt:"AgentHub"}),e.jsx("span",{children:"AgentHub"})]}),e.jsx("ul",{className:"lp-nav-links",children:e.jsx("li",{children:e.jsxs(qt,{to:"/",style:{display:"inline-flex",alignItems:"center",gap:"0.4rem"},children:[e.jsx(Qt,{size:16})," 返回首页"]})})}),e.jsxs("div",{className:"lp-nav-right",children:[e.jsx("button",{className:"lp-theme-toggle",onClick:l,title:o?"切换到亮色":"切换到暗色",children:o?e.jsx(Gr,{size:18}):e.jsx(Ur,{size:18})}),e.jsx("button",{className:"lp-btn lp-btn-primary",onClick:()=>r("/app"),children:"开始使用"})]})]}),e.jsxs("main",{children:[e.jsxs("section",{className:"demo-hero",children:[e.jsxs("h1",{children:["看看 ",e.jsx("span",{className:"gradient-text",children:"AgentHub"})," 能做什么"]}),e.jsx("p",{children:"以下是几个真实的使用场景,展示 AI Agent 如何帮你解决工作中的实际问题。"})]}),e.jsx("section",{className:"demo-scenarios",children:Bc.map((m,d)=>e.jsxs("div",{className:"demo-scenario lp-fade-up",children:[e.jsxs("div",{className:"demo-scenario-info",children:[e.jsx("span",{className:`demo-scenario-tag ${m.tagClass}`,children:m.tag}),e.jsx("h2",{children:m.title}),e.jsx("p",{children:m.description}),e.jsx("ul",{className:"demo-highlights",children:m.highlights.map((s,p)=>e.jsx("li",{children:s},p))})]}),e.jsx(Uc,{messages:m.messages})]},d))}),e.jsxs("section",{className:"demo-cta",children:[e.jsx("h2",{children:"准备好开始了吗?"}),e.jsx("p",{children:"立即体验 AgentHub,让 AI 成为你的超级助手。"}),e.jsx("button",{className:"lp-btn lp-btn-primary lp-btn-large",onClick:()=>r("/app"),children:"开始使用"})]})]}),e.jsx("footer",{className:"lp-footer",children:e.jsxs("div",{className:"lp-footer-content",children:[e.jsxs(qt,{to:"/",className:"lp-logo",children:[e.jsx("img",{className:"lp-logo-icon",src:"/logo.svg",alt:"AgentHub"}),e.jsx("span",{children:"AgentHub"})]}),e.jsxs("p",{className:"lp-copyright",children:["© ",new Date().getFullYear()," AgentHub. All rights reserved."]})]})})]})}function Yc(){const{userUuid:r,sessionId:o}=Vo(),[l,u]=n.useState(null),[c,m]=n.useState(null),[d,s]=n.useState(!0);if(n.useEffect(()=>{fetch(`/api/share/${r}/${o}`).then(g=>g.ok?g.json():Promise.reject(g.status)).then(g=>{u(g),document.title=`${g.title||"对话分享"} - ${Ve}`}).catch(g=>{m(g===404?"not_found":"error")}).finally(()=>s(!1))},[r,o]),d)return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin mx-auto mb-3"}),e.jsx("p",{className:"text-gray-500 text-sm",children:"加载中..."})]})});if(c)return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center px-6 max-w-sm",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})})}),e.jsx("h1",{className:"text-lg font-semibold text-gray-900 mb-2",children:c==="not_found"?"分享已关闭或不存在":"加载失败"}),e.jsx("p",{className:"text-sm text-gray-500",children:c==="not_found"?"该对话分享链接已失效或被关闭。":"加载分享内容时发生错误,请稍后重试。"}),e.jsxs("a",{href:jo,className:"mt-6 inline-block text-sm text-blue-600 hover:underline",children:["前往 ",Ve]})]})});const{mode:p,title:t,projectName:x,messages:h=[],sharerName:a,generatedAt:i}=l;return e.jsxs("div",{className:"min-h-screen bg-gray-50 font-sans",children:[e.jsx("div",{className:"bg-white border-b border-gray-200 sticky top-0 z-10",children:e.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-3 flex items-center justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[x&&e.jsx("p",{className:"text-xs text-gray-400 mb-0.5 truncate",children:x}),e.jsx("h1",{className:"text-base font-semibold text-gray-900 truncate",children:t||"对话分享"}),p==="static"&&i&&e.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:["静态快照 · ",new Date(i).toLocaleString("zh-CN")]})]}),e.jsxs("span",{className:`ml-3 flex-shrink-0 inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium ${p==="realtime"?"bg-green-100 text-green-700":"bg-blue-100 text-blue-700"}`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current"}),p==="realtime"?"实时":"快照"]})]})}),e.jsx("div",{className:"max-w-3xl mx-auto px-4 py-6 space-y-4",children:h.length===0?e.jsx("div",{className:"text-center text-gray-400 py-16 text-sm",children:"暂无消息"}):h.map((g,v)=>e.jsx(Kc,{message:g,userUuid:r,sessionId:o},g.uuid||v))}),e.jsx("div",{className:"text-center pb-10 pt-4",children:e.jsxs("p",{className:"text-xs text-gray-400",children:[a?`由 ${a} 分享 · `:"","Powered by"," ",e.jsx("a",{href:jo,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline",children:Ve})]})})]})}function Jc(r){if(!r||!r.startsWith("<command-name>")&&!r.startsWith("<command-message>"))return r;const o=r.match(/<command-message>([\s\S]*?)<\/command-message>/);return o?`/${o[1].trim()}`:r}function qc({src:r,alt:o}){const[l,u]=n.useState(!1);return l?e.jsx("div",{className:"rounded-lg bg-blue-500 flex items-center justify-center text-blue-200 text-xs p-4 min-h-[60px]",children:"图片已过期"}):e.jsx("img",{src:r,alt:o,className:"rounded-lg max-w-full max-h-64 object-contain cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>window.open(r,"_blank"),onError:()=>u(!0)})}function Kc({message:r,userUuid:o,sessionId:l}){const u=r.role==="user",c=u?Jc(r.content):r.content,m=r.timestamp?new Date(r.timestamp).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):null;return e.jsx("div",{className:`flex ${u?"justify-end":"justify-start"}`,children:e.jsxs("div",{className:`max-w-[98%] ${u?"order-2":"order-1"}`,children:[e.jsxs("div",{className:`flex items-center gap-2 mb-1 ${u?"justify-end":"justify-start"}`,children:[e.jsx("span",{className:`text-xs font-medium ${u?"text-gray-500":"text-blue-600"}`,children:u?"用户":Ve}),m&&e.jsx("span",{className:"text-xs text-gray-400",children:m})]}),e.jsx("div",{className:`rounded-2xl px-4 py-3 ${u?"bg-blue-600 text-white rounded-tr-sm":"bg-white border border-gray-200 text-gray-900 rounded-tl-sm shadow-sm"}`,children:u?e.jsxs(e.Fragment,{children:[c&&e.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:c}),r.images&&r.images.length>0&&e.jsx("div",{className:`grid gap-2 ${r.images.length>1?"grid-cols-2":"grid-cols-1"} ${c?"mt-2":""}`,children:r.images.map(d=>e.jsx(qc,{src:`/api/share/${o}/${l}/images/${d.id}`,alt:d.name||"image"},d.id))})]}):e.jsx("div",{className:"prose prose-sm max-w-none prose-p:my-1 prose-headings:my-2 prose-pre:my-2 prose-ul:my-1 prose-ol:my-1 prose-li:my-0 prose-table:my-2",children:e.jsx(ds,{remarkPlugins:[cs],components:{code({node:d,className:s,children:p,...t}){if(d?.position?.start?.line!==d?.position?.end?.line||String(p).includes(`
200
- `)){const h=s?.replace("language-","")||"";return e.jsxs("div",{className:"my-2",children:[h&&h!=="text"&&e.jsx("span",{className:"inline-block text-[11px] text-gray-400 font-medium uppercase tracking-wide mb-1 px-1",children:h}),e.jsx(us,{language:h||"text",style:ys,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.8125rem",padding:"1rem"},codeTagProps:{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"}},children:String(p).replace(/\n$/,"")})]})}return e.jsx("code",{className:"bg-gray-100 text-gray-800 rounded px-1 py-0.5 text-xs font-mono",...t,children:p})},a({children:d,href:s,...p}){return e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline",...p,children:d})},table({children:d}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"min-w-full border-collapse text-xs",children:d})})},th({children:d}){return e.jsx("th",{className:"border border-gray-300 px-2 py-1 bg-gray-50 font-semibold text-left",children:d})},td({children:d}){return e.jsx("td",{className:"border border-gray-300 px-2 py-1",children:d})}},children:r.content})})})]})})}const Vc=()=>{const[r,o]=n.useState("email"),[l,u]=n.useState(""),[c,m]=n.useState(""),[d,s]=n.useState(!1),[p,t]=n.useState(""),[x,h]=n.useState(0),{sendCode:a,verifyCode:i,smtpConfigured:g}=Ot();n.useEffect(()=>{if(x>0){const f=setTimeout(()=>h(x-1),1e3);return()=>clearTimeout(f)}},[x]);const v=async f=>{if(f.preventDefault(),t(""),!l||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(l)){t("请输入有效的邮箱地址");return}s(!0);const S=await a(l);S.success?(o("code"),h(60)):(t(S.error),S.waitSeconds&&h(S.waitSeconds)),s(!1)},k=async f=>{if(f.preventDefault(),t(""),!c||c.length!==6){t("请输入6位验证码");return}s(!0);const w=await i(l,c);w.success||t(w.error),s(!1)},b=async()=>{if(x>0)return;t(""),s(!0);const f=await a(l);f.success?h(60):t(f.error),s(!1)},j=()=>{o("email"),m(""),t("")};return g?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(Vr,{size:64})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:r==="email"?`欢迎使用 ${Ve}`:"创建管理员账户"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:r==="email"?"输入邮箱创建管理员账户":`验证码已发送至 ${l}`})]}),r==="email"&&e.jsxs("form",{onSubmit:v,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-foreground mb-1",children:"邮箱地址"}),e.jsxs("div",{className:"relative",children:[e.jsx(Yr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-muted-foreground"}),e.jsx("input",{type:"email",id:"email",value:l,onChange:f=>u(f.target.value),className:"w-full pl-10 pr-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入邮箱地址",required:!0,disabled:d,autoComplete:"email"})]})]}),p&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:p})}),e.jsx("button",{type:"submit",disabled:d||x>0,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:d?"发送中...":x>0?`${x}秒后可重新发送`:"获取验证码"})]}),r==="code"&&e.jsxs("form",{onSubmit:k,className:"space-y-4",children:[e.jsxs("button",{type:"button",onClick:j,className:"flex items-center text-sm text-muted-foreground hover:text-foreground",children:[e.jsx(Qt,{className:"w-4 h-4 mr-1"}),"返回修改邮箱"]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"code",className:"block text-sm font-medium text-foreground mb-1",children:"验证码"}),e.jsx("input",{type:"text",id:"code",value:c,onChange:f=>m(f.target.value.replace(/\D/g,"").slice(0,6)),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground text-center text-2xl tracking-widest focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"000000",required:!0,disabled:d,maxLength:6,autoComplete:"one-time-code"})]}),p&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:p})}),e.jsx("button",{type:"submit",disabled:d||c.length!==6,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:d?"创建中...":"创建管理员账户"}),e.jsx("div",{className:"text-center",children:e.jsx("button",{type:"button",onClick:b,disabled:x>0||d,className:"text-sm text-blue-500 hover:text-blue-600 disabled:text-muted-foreground",children:x>0?`${x}秒后可重新发送`:"重新发送验证码"})})]}),e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"首个注册的用户将成为管理员"})})]})})}):e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(Vr,{size:64})}),e.jsxs("h1",{className:"text-2xl font-bold text-foreground",children:["欢迎使用 ",Ve]}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"系统初始化"})]}),e.jsxs("div",{className:"p-4 bg-yellow-100 dark:bg-yellow-900/20 border border-yellow-300 dark:border-yellow-800 rounded-md",children:[e.jsx("p",{className:"text-sm text-yellow-700 dark:text-yellow-400",children:"SMTP 邮件服务未配置。请联系管理员配置以下环境变量后重启服务:"}),e.jsxs("ul",{className:"mt-2 text-sm text-yellow-700 dark:text-yellow-400 list-disc list-inside",children:[e.jsx("li",{children:"SMTP_SERVER"}),e.jsx("li",{children:"SMTP_PORT"}),e.jsx("li",{children:"SMTP_USERNAME"}),e.jsx("li",{children:"SMTP_PASSWORD"})]})]})]})})})},Zc=()=>{const[r,o]=n.useState("email"),[l,u]=n.useState("email"),[c,m]=n.useState(""),[d,s]=n.useState(""),[p,t]=n.useState(""),[x,h]=n.useState(""),[a,i]=n.useState(!1),[g,v]=n.useState(""),[k,b]=n.useState(0),[j,f]=n.useState(!1),{login:w,sendCode:S,verifyCode:z,smtpConfigured:D}=Ot();n.useEffect(()=>{if(k>0){const _=setTimeout(()=>b(k-1),1e3);return()=>clearTimeout(_)}},[k]),n.useEffect(()=>{D||o("password")},[D]);const N=async _=>{if(_.preventDefault(),v(""),!c||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c)){v("请输入有效的邮箱地址");return}i(!0);const ne=await S(c);ne.success?(u("code"),b(60),f(ne.type==="register")):(v(ne.error),ne.waitSeconds&&b(ne.waitSeconds)),i(!1)},R=async _=>{if(_.preventDefault(),v(""),!d||d.length!==6){v("请输入6位验证码");return}i(!0);const te=await z(c,d);te.success||v(te.error),i(!1)},M=async()=>{if(k>0)return;v(""),i(!0);const _=await S(c);_.success?b(60):v(_.error),i(!1)},E=async _=>{if(_.preventDefault(),v(""),!p||!x){v("请输入用户名和密码");return}i(!0);const te=await w(p,x);te.success||v(te.error),i(!1)},$=()=>{u("email"),s(""),v("")},T=()=>{o("email"),u("email"),v("")},X=()=>{o("password"),v("")};return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:"/logo.svg",className:"w-16 h-16",alt:Ve})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:r==="email"?l==="email"?`欢迎使用 ${Ve}`:j?"创建您的账户":"验证您的身份":"欢迎回来"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:r==="email"?l==="email"?"输入邮箱以接收验证码":`验证码已发送至 ${c}`:"使用账号密码登录"})]}),r==="email"&&l==="email"&&e.jsxs("form",{onSubmit:N,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-foreground mb-1",children:"邮箱地址"}),e.jsxs("div",{className:"relative",children:[e.jsx(Yr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-muted-foreground"}),e.jsx("input",{type:"email",id:"email",value:c,onChange:_=>m(_.target.value),className:"w-full pl-10 pr-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入邮箱地址",required:!0,disabled:a,autoComplete:"email"})]})]}),g&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:g})}),e.jsx("button",{type:"submit",disabled:a||k>0,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:a?"发送中...":k>0?`${k}秒后可重新发送`:"获取验证码"})]}),r==="email"&&l==="code"&&e.jsxs("form",{onSubmit:R,className:"space-y-4",children:[e.jsxs("button",{type:"button",onClick:$,className:"flex items-center text-sm text-muted-foreground hover:text-foreground",children:[e.jsx(Qt,{className:"w-4 h-4 mr-1"}),"返回修改邮箱"]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"code",className:"block text-sm font-medium text-foreground mb-1",children:"验证码"}),e.jsx("input",{type:"text",id:"code",value:d,onChange:_=>s(_.target.value.replace(/\D/g,"").slice(0,6)),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground text-center text-2xl tracking-widest focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"000000",required:!0,disabled:a,maxLength:6,autoComplete:"one-time-code"})]}),g&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:g})}),e.jsx("button",{type:"submit",disabled:a||d.length!==6,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:a?"验证中...":j?"创建账户并登录":"登录"}),e.jsx("div",{className:"text-center",children:e.jsx("button",{type:"button",onClick:M,disabled:k>0||a,className:"text-sm text-blue-500 hover:text-blue-600 disabled:text-muted-foreground",children:k>0?`${k}秒后可重新发送`:"重新发送验证码"})})]}),r==="password"&&e.jsxs("form",{onSubmit:E,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"用户名"}),e.jsxs("div",{className:"relative",children:[e.jsx(An,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-muted-foreground"}),e.jsx("input",{type:"text",id:"username",value:p,onChange:_=>t(_.target.value),className:"w-full pl-10 pr-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入用户名",required:!0,disabled:a})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"密码"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ka,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-muted-foreground"}),e.jsx("input",{type:"password",id:"password",value:x,onChange:_=>h(_.target.value),className:"w-full pl-10 pr-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入密码",required:!0,disabled:a})]})]}),g&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:g})}),e.jsx("button",{type:"submit",disabled:a,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:a?"登录中...":"登录"})]}),e.jsx("div",{className:"text-center pt-4 border-t border-border",children:r==="email"&&D?e.jsx("button",{type:"button",onClick:X,className:"text-sm text-muted-foreground hover:text-foreground",children:"使用账号密码登录"}):r==="password"&&D?e.jsx("button",{type:"button",onClick:T,className:"text-sm text-muted-foreground hover:text-foreground",children:"使用邮箱验证码登录"}):null})]})})})},Qc=()=>e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:"/logo.svg",alt:Ve,className:"w-16 h-16"})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:Ve}),e.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"加载中..."})]})}),ed=({children:r})=>{const{user:o,isLoading:l,needsSetup:u}=Ot();return l?e.jsx(Qc,{}):u?e.jsx(Vc,{}):o?r:e.jsx(Zc,{})};function Mn(r,o){const[l,u]=n.useState(()=>{if(typeof window>"u")return o;try{const m=window.localStorage.getItem(r);return m?JSON.parse(m):o}catch(m){return console.log(m),o}});return[l,m=>{if(!(typeof window>"u"))try{const d=m instanceof Function?m(l):m;window.localStorage.setItem(r,JSON.stringify(d)),u(d)}catch(d){console.log(d)}}]}function Ko(){const r=Qr(),{sessionId:o}=Vo(),{limitStatus:l,setLimitStatus:u,checkLimitStatus:c,user:m,isAdmin:d}=Ot(),[s,p]=n.useState([]),[t,x]=n.useState(null),[h,a]=n.useState(null),[i,g]=n.useState("chat"),[v,k]=n.useState(!1),[b,j]=n.useState(!1),[f,w]=n.useState(!0),[S,z]=n.useState(!1),[D,N]=n.useState(!1),[R,M]=n.useState(!1),[E,$]=n.useState("shared_projects"),[T,X]=Mn("autoScrollToBottom",!0),[_,te]=Mn("sendByCtrlEnter",!1),[ne,G]=Mn("sidebarVisible",!0),[le,de]=n.useState(!1),[fe,Ee]=n.useState(null),ge=mt.useRef(null),[Me,Fe]=n.useState(new Set),[ae,Ne]=n.useState(new Set),[He,Be]=n.useState(0),{ws:he,sendMessage:Oe,messages:De}=Ps(),Ye=n.useCallback(Y=>{Ee(Y),de(!0)},[]),[Te,Je]=n.useState(!1);n.useEffect(()=>{const Y=()=>{const ie=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone||document.referrer.includes("android-app://");Je(ie),document.addEventListener("touchstart",{}),ie?(document.documentElement.classList.add("pwa-mode"),document.body.classList.add("pwa-mode")):(document.documentElement.classList.remove("pwa-mode"),document.body.classList.remove("pwa-mode"))};return Y(),window.matchMedia("(display-mode: standalone)").addEventListener("change",Y),()=>{window.matchMedia("(display-mode: standalone)").removeEventListener("change",Y)}},[]),n.useEffect(()=>{const Y=()=>{k(window.innerWidth<768)};return Y(),window.addEventListener("resize",Y),()=>window.removeEventListener("resize",Y)},[]),n.useEffect(()=>{Re()},[]);const Ce=(Y,ie,ce,Ae)=>{if(!ce||!Ae)return!0;const Xe=Y?.find(Pe=>Pe.name===ce.name),Le=ie?.find(Pe=>Pe.name===ce.name);if(!Xe||!Le)return!1;const oe=Xe.sessions?.find(Pe=>Pe.id===Ae.id),ye=Le.sessions?.find(Pe=>Pe.id===Ae.id);return!oe||!ye?!1:oe.id===ye.id&&oe.title===ye.title&&oe.created_at===ye.created_at&&oe.updated_at===ye.updated_at};n.useEffect(()=>{if(De.length>0){const Y=De[De.length-1];if(Y.type==="projects_updated"){const ie=Y.timestamp;if(ie&&ie===ge.current)return;if(ge.current=ie||null,Y.changedFile&&h&&t){const Le=Y.changedFile.replace(/\\/g,"/").split("/");Le.length>=2&&Le[Le.length-1].replace(".jsonl","")===h.id&&(Me.has(h.id)||Be(Pe=>Pe+1))}if(h&&Me.has(h.id)||Me.size>0&&Array.from(Me).some(Xe=>Xe.startsWith("new-session-"))){const Xe=Y.projects;if(!Ce(s,Xe,t,h))return}const Ae=Y.projects;if(p(Ae),t){const Xe=Ae.find(Le=>Le.name===t.name);Xe&&(JSON.stringify(Xe)!==JSON.stringify(t)&&x(Xe),h&&([...Xe.sessions||[]].find(ye=>ye.id===h.id)||a(null)))}}}},[De,t,h,Me]);const Re=async()=>{try{w(!0);const ie=await(await me.projects()).json();p(ce=>ce.length===0||ie.some((Xe,Le)=>{const oe=ce[Le];return oe?Xe.name!==oe.name||Xe.displayName!==oe.displayName||Xe.fullPath!==oe.fullPath||JSON.stringify(Xe.sessionMeta)!==JSON.stringify(oe.sessionMeta)||JSON.stringify(Xe.sessions)!==JSON.stringify(oe.sessions)||JSON.stringify(Xe.agentInfo)!==JSON.stringify(oe.agentInfo):!0})||ie.length!==ce.length?ie:ce)}catch(Y){console.error("Error fetching projects:",Y)}finally{w(!1)}};window.refreshProjects=Re,window.openSettings=n.useCallback((Y="tools")=>{$(Y),N(!0)},[]),window.openAdminPanel=n.useCallback(()=>{M(!0)},[]),n.useEffect(()=>{if(o&&s.length>0){const Y=!h||h.id!==o;for(const ie of s){let ce=ie.sessions?.find(Ae=>Ae.id===o);if(ce){x(ie),a({...ce,__provider:"claude"}),Y&&g("chat");return}}}},[o,s,r]);const $e=Y=>{x(Y),a(null),r("/app"),v&&j(!1)},Ie=Y=>{if(a(Y),i!=="git"&&i!=="preview"&&g("chat"),v){const ie=Y.__projectName,ce=t?.name;ie!==ce&&j(!1)}r(`/app/session/${Y.id}`)},ze=Y=>{x(Y),a(null),g("chat"),r("/app"),v&&j(!1)},Ze=Y=>{h?.id===Y&&(a(null),r("/app")),p(ie=>ie.map(ce=>({...ce,sessions:ce.sessions?.filter(Ae=>Ae.id!==Y)||[],sessionMeta:{...ce.sessionMeta,total:Math.max(0,(ce.sessionMeta?.total||0)-1)}})))},Qe=async()=>{try{const ie=await(await me.projects()).json();if(p(ce=>ie.some((Xe,Le)=>{const oe=ce[Le];return oe?Xe.name!==oe.name||Xe.displayName!==oe.displayName||Xe.fullPath!==oe.fullPath||JSON.stringify(Xe.sessionMeta)!==JSON.stringify(oe.sessionMeta)||JSON.stringify(Xe.sessions)!==JSON.stringify(oe.sessions):!0})||ie.length!==ce.length?ie:ce),t){const ce=ie.find(Ae=>Ae.name===t.name);if(ce&&(JSON.stringify(ce)!==JSON.stringify(t)&&x(ce),h)){const Ae=ce.sessions?.find(Xe=>Xe.id===h.id);Ae&&JSON.stringify(Ae)!==JSON.stringify(h)&&a(Ae)}}}catch(Y){console.error("Error refreshing sidebar:",Y)}},K=Y=>{t?.name===Y&&(x(null),a(null),r("/app")),p(ie=>ie.filter(ce=>ce.name!==Y))},B=n.useCallback(Y=>{Y&&Fe(ie=>new Set([...ie,Y]))},[]),C=n.useCallback(Y=>{Y&&Fe(ie=>{const ce=new Set(ie);return ce.delete(Y),ce})},[]),V=n.useCallback(Y=>{Y&&Ne(ie=>new Set([...ie,Y]))},[]),I=n.useCallback(Y=>{Y&&Ne(ie=>{const ce=new Set(ie);return ce.delete(Y),ce})},[]),re=n.useCallback(Y=>{Y&&Fe(ie=>{const ce=new Set;for(const Ae of ie)Ae.startsWith("new-session-")||ce.add(Ae);return ce.add(Y),ce})},[]);return e.jsxs("div",{className:"fixed inset-0 flex bg-background",children:[!v&&e.jsx("div",{className:`h-full flex-shrink-0 border-r border-border bg-card transition-all duration-300 ${ne?"w-80":"w-14"}`,children:e.jsx("div",{className:"h-full overflow-hidden",children:ne?e.jsx(So,{projects:s,selectedProject:t,selectedSession:h,onProjectSelect:$e,onSessionSelect:Ie,onNewSession:ze,onSessionDelete:Ze,onProjectDelete:K,isLoading:f,onRefresh:Qe,onShowSettings:()=>N(!0),onShowAdmin:()=>M(!0),isPWA:Te,isMobile:v,onToggleSidebar:()=>G(!1)}):e.jsxs("div",{className:"h-full flex flex-col items-center py-4 gap-4",children:[e.jsx("button",{onClick:()=>G(!0),className:"p-2 hover:bg-accent rounded-md transition-colors duration-200 group","aria-label":"Show sidebar",title:"Show sidebar",children:e.jsx("svg",{className:"w-5 h-5 text-foreground group-hover:scale-110 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M5 5l7 7-7 7"})})}),e.jsx("button",{onClick:()=>N(!0),className:"p-2 hover:bg-accent rounded-md transition-colors duration-200","aria-label":"Settings",title:"Settings",children:e.jsx(Ut,{className:"w-5 h-5 text-muted-foreground hover:text-foreground transition-colors"})}),d&&e.jsx("button",{onClick:()=>M(!0),className:"p-2 hover:bg-accent rounded-md transition-colors duration-200","aria-label":"Admin",title:"管理",children:e.jsx(Gt,{className:"w-5 h-5 text-muted-foreground hover:text-foreground transition-colors"})})]})})}),v&&e.jsxs("div",{className:`fixed inset-0 z-50 flex transition-all duration-150 ease-out ${b?"opacity-100 visible":"opacity-0 invisible"}`,children:[e.jsx("button",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-150 ease-out",onClick:Y=>{Y.stopPropagation(),j(!1)},onTouchStart:Y=>{Y.preventDefault(),Y.stopPropagation(),j(!1)},"aria-label":"Close sidebar"}),e.jsx("div",{className:`relative w-[85vw] max-w-sm sm:w-80 h-full bg-card border-r border-border transform transition-transform duration-150 ease-out ${b?"translate-x-0":"-translate-x-full"}`,onClick:Y=>Y.stopPropagation(),onTouchStart:Y=>Y.stopPropagation(),children:e.jsx(So,{projects:s,selectedProject:t,selectedSession:h,onProjectSelect:$e,onSessionSelect:Ie,onNewSession:ze,onSessionDelete:Ze,onProjectDelete:K,isLoading:f,onRefresh:Qe,onShowSettings:()=>N(!0),onShowAdmin:()=>M(!0),isPWA:Te,isMobile:v,onToggleSidebar:()=>G(!1)})})]}),e.jsx("div",{className:`flex-1 flex flex-col min-w-0 ${v&&!S?"pb-mobile-nav":""}`,children:e.jsx(Fl,{selectedProject:t,selectedSession:h,activeTab:i,setActiveTab:g,ws:he,sendMessage:Oe,messages:De,isMobile:v,isPWA:Te,onMenuClick:()=>j(!0),isLoading:f,onInputFocusChange:z,onSessionActive:B,onSessionInactive:C,onSessionProcessing:V,onSessionNotProcessing:I,processingSessions:ae,onReplaceTemporarySession:re,onNavigateToSession:Y=>r(`/app/session/${Y}`),onShowSettings:()=>N(!0),autoScrollToBottom:T,sendByCtrlEnter:_,externalMessageUpdate:He,limitStatus:l,onLimitBlocked:Ye,checkLimitStatus:c})}),v&&e.jsx(Hl,{activeTab:i,setActiveTab:g,isInputFocused:S}),e.jsx(jc,{isOpen:D,onClose:()=>N(!1),projects:s,initialTab:E,autoScrollToBottom:T,onAutoScrollChange:X,sendByCtrlEnter:_,onSendByCtrlEnterChange:te}),e.jsx(zc,{isOpen:R,onClose:()=>M(!1)}),e.jsx(Rc,{isOpen:le,limitType:fe,onClose:()=>de(!1)})]})}function td(){return e.jsx(fi,{children:e.jsx($l,{children:e.jsx(pi,{children:e.jsx(ed,{children:e.jsxs(Zo,{children:[e.jsx(dr,{index:!0,element:e.jsx(Ko,{})}),e.jsx(dr,{path:"session/:sessionId",element:e.jsx(Ko,{})})]})})})})})}function rd(){return e.jsx(Bl,{children:e.jsx(ka,{children:e.jsxs(Zo,{children:[e.jsx(dr,{path:"/",element:e.jsx(Hc,{})}),e.jsx(dr,{path:"/demo",element:e.jsx(Gc,{})}),e.jsx(dr,{path:"/share/:userUuid/:sessionId",element:e.jsx(Yc,{})}),e.jsx(dr,{path:"/app/*",element:e.jsx(td,{})})]})})})}si.createRoot(document.getElementById("root")).render(e.jsx(mt.StrictMode,{children:e.jsx(rd,{})}));
199
+ `).map((u,c)=>e.jsxs(mt.Fragment,{children:[c>0&&e.jsx("br",{}),u]},c))})]},l))})]})}function Gc(){const r=Qr(),{isDarkMode:o,toggleDarkMode:l}=no(),[u,c]=n.useState(!1);return n.useEffect(()=>{const m=()=>c(window.scrollY>50);return window.addEventListener("scroll",m,{passive:!0}),()=>window.removeEventListener("scroll",m)},[]),n.useEffect(()=>{window.scrollTo(0,0)},[]),n.useEffect(()=>{const m=new IntersectionObserver(d=>{d.forEach(s=>{s.isIntersecting&&(s.target.classList.add("visible"),m.unobserve(s.target))})},{threshold:.1});return document.querySelectorAll(".lp-fade-up").forEach(d=>m.observe(d)),()=>m.disconnect()},[]),e.jsxs("div",{className:"landing-page",children:[e.jsx("div",{className:"bg-orb orb-1"}),e.jsx("div",{className:"bg-orb orb-2"}),e.jsx("div",{className:"bg-grid"}),e.jsxs("nav",{className:`lp-navbar${u?" scrolled":""}`,children:[e.jsxs(qt,{to:"/",className:"lp-logo",children:[e.jsx("img",{className:"lp-logo-icon",src:"/logo.svg",alt:"AgentHub"}),e.jsx("span",{children:"AgentHub"})]}),e.jsx("ul",{className:"lp-nav-links",children:e.jsx("li",{children:e.jsxs(qt,{to:"/",style:{display:"inline-flex",alignItems:"center",gap:"0.4rem"},children:[e.jsx(Qt,{size:16})," 返回首页"]})})}),e.jsxs("div",{className:"lp-nav-right",children:[e.jsx("button",{className:"lp-theme-toggle",onClick:l,title:o?"切换到亮色":"切换到暗色",children:o?e.jsx(Gr,{size:18}):e.jsx(Ur,{size:18})}),e.jsx("button",{className:"lp-btn lp-btn-primary",onClick:()=>r("/app"),children:"开始使用"})]})]}),e.jsxs("main",{children:[e.jsxs("section",{className:"demo-hero",children:[e.jsxs("h1",{children:["看看 ",e.jsx("span",{className:"gradient-text",children:"AgentHub"})," 能做什么"]}),e.jsx("p",{children:"以下是几个真实的使用场景,展示 AI Agent 如何帮你解决工作中的实际问题。"})]}),e.jsx("section",{className:"demo-scenarios",children:Bc.map((m,d)=>e.jsxs("div",{className:"demo-scenario lp-fade-up",children:[e.jsxs("div",{className:"demo-scenario-info",children:[e.jsx("span",{className:`demo-scenario-tag ${m.tagClass}`,children:m.tag}),e.jsx("h2",{children:m.title}),e.jsx("p",{children:m.description}),e.jsx("ul",{className:"demo-highlights",children:m.highlights.map((s,p)=>e.jsx("li",{children:s},p))})]}),e.jsx(Uc,{messages:m.messages})]},d))}),e.jsxs("section",{className:"demo-cta",children:[e.jsx("h2",{children:"准备好开始了吗?"}),e.jsx("p",{children:"立即体验 AgentHub,让 AI 成为你的超级助手。"}),e.jsx("button",{className:"lp-btn lp-btn-primary lp-btn-large",onClick:()=>r("/app"),children:"开始使用"})]})]}),e.jsx("footer",{className:"lp-footer",children:e.jsxs("div",{className:"lp-footer-content",children:[e.jsxs(qt,{to:"/",className:"lp-logo",children:[e.jsx("img",{className:"lp-logo-icon",src:"/logo.svg",alt:"AgentHub"}),e.jsx("span",{children:"AgentHub"})]}),e.jsxs("p",{className:"lp-copyright",children:["© ",new Date().getFullYear()," AgentHub. All rights reserved."]})]})})]})}function Yc(){const{userUuid:r,sessionId:o}=Vo(),[l,u]=n.useState(null),[c,m]=n.useState(null),[d,s]=n.useState(!0),[p,t]=n.useState(!1),[x,h]=n.useState(null),[a,i]=n.useState(!1);if(n.useEffect(()=>{fetch(`/api/share/${r}/${o}`).then(N=>N.ok?N.json():Promise.reject(N.status)).then(N=>{u(N),document.title=`${N.title||"对话分享"} - ${Ve}`}).catch(N=>{m(N===404?"not_found":"error")}).finally(()=>s(!1))},[r,o]),d)return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin mx-auto mb-3"}),e.jsx("p",{className:"text-gray-500 text-sm",children:"加载中..."})]})});if(c)return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center px-6 max-w-sm",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"})})}),e.jsx("h1",{className:"text-lg font-semibold text-gray-900 mb-2",children:c==="not_found"?"分享已关闭或不存在":"加载失败"}),e.jsx("p",{className:"text-sm text-gray-500",children:c==="not_found"?"该对话分享链接已失效或被关闭。":"加载分享内容时发生错误,请稍后重试。"}),e.jsxs("a",{href:jo,className:"mt-6 inline-block text-sm text-blue-600 hover:underline",children:["前往 ",Ve]})]})});const{mode:g,title:v,projectName:k,messages:b=[],sharerName:j,generatedAt:f}=l,w=async()=>{const N=localStorage.getItem("auth-token");if(!N){sessionStorage.setItem("pendingClone",JSON.stringify({shareUserUuid:r,sessionId:o})),window.location.href="/app";return}t(!0),h(null);try{const L=await fetch(`/api/share/${r}/${o}/clone`,{method:"POST",headers:{Authorization:`Bearer ${N}`}}),E=await L.json();if(!L.ok)throw new Error(E.error||"克隆失败");i(!0),window.location.href=`/app/session/${E.sessionId}`}catch(L){h(L.message)}finally{t(!1)}};return e.jsxs("div",{className:"min-h-screen bg-gray-50 font-sans",children:[e.jsx("div",{className:"bg-white border-b border-gray-200 sticky top-0 z-10",children:e.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-3 flex items-center justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[k&&e.jsx("p",{className:"text-xs text-gray-400 mb-0.5 truncate",children:k}),e.jsx("h1",{className:"text-base font-semibold text-gray-900 truncate",children:v||"对话分享"}),g==="static"&&f&&e.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:["静态快照 · ",new Date(f).toLocaleString("zh-CN")]})]}),e.jsxs("span",{className:`ml-3 flex-shrink-0 inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium ${g==="realtime"?"bg-green-100 text-green-700":"bg-blue-100 text-blue-700"}`,children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current"}),g==="realtime"?"实时":"快照"]})]})}),e.jsx("div",{className:"max-w-3xl mx-auto px-4 py-6 space-y-4",children:b.length===0?e.jsx("div",{className:"text-center text-gray-400 py-16 text-sm",children:"暂无消息"}):b.map((N,L)=>e.jsx(Kc,{message:N,userUuid:r,sessionId:o},N.uuid||L))}),e.jsx("div",{className:"max-w-3xl mx-auto px-4 pb-6",children:e.jsxs("div",{className:"border border-blue-100 bg-blue-50 rounded-2xl px-6 py-5 text-center",children:[e.jsx("p",{className:"text-sm text-gray-700 mb-3",children:"觉得这段对话有用?克隆它并继续探索"}),x&&e.jsx("p",{className:"text-xs text-red-500 mb-2",children:x}),e.jsx("button",{onClick:w,disabled:p,className:"inline-flex items-center gap-2 px-5 py-2.5 bg-blue-600 hover:bg-blue-700 disabled:opacity-60 text-white text-sm font-medium rounded-xl transition-colors",children:p?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),"克隆中..."]}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"克隆此会话并继续对话"]})})]})}),e.jsx("div",{className:"text-center pb-10 pt-2",children:e.jsxs("p",{className:"text-xs text-gray-400",children:[j?`由 ${j} 分享 · `:"","Powered by"," ",e.jsx("a",{href:jo,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline",children:Ve})]})})]})}function Jc(r){if(!r||!r.startsWith("<command-name>")&&!r.startsWith("<command-message>"))return r;const o=r.match(/<command-message>([\s\S]*?)<\/command-message>/);return o?`/${o[1].trim()}`:r}function qc({src:r,alt:o}){const[l,u]=n.useState(!1);return l?e.jsx("div",{className:"rounded-lg bg-blue-500 flex items-center justify-center text-blue-200 text-xs p-4 min-h-[60px]",children:"图片已过期"}):e.jsx("img",{src:r,alt:o,className:"rounded-lg max-w-full max-h-64 object-contain cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>window.open(r,"_blank"),onError:()=>u(!0)})}function Kc({message:r,userUuid:o,sessionId:l}){const u=r.role==="user",c=u?Jc(r.content):r.content,m=r.timestamp?new Date(r.timestamp).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):null;return e.jsx("div",{className:`flex ${u?"justify-end":"justify-start"}`,children:e.jsxs("div",{className:`max-w-[98%] ${u?"order-2":"order-1"}`,children:[e.jsxs("div",{className:`flex items-center gap-2 mb-1 ${u?"justify-end":"justify-start"}`,children:[e.jsx("span",{className:`text-xs font-medium ${u?"text-gray-500":"text-blue-600"}`,children:u?"用户":Ve}),m&&e.jsx("span",{className:"text-xs text-gray-400",children:m})]}),e.jsx("div",{className:`rounded-2xl px-4 py-3 ${u?"bg-blue-600 text-white rounded-tr-sm":"bg-white border border-gray-200 text-gray-900 rounded-tl-sm shadow-sm"}`,children:u?e.jsxs(e.Fragment,{children:[c&&e.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:c}),r.images&&r.images.length>0&&e.jsx("div",{className:`grid gap-2 ${r.images.length>1?"grid-cols-2":"grid-cols-1"} ${c?"mt-2":""}`,children:r.images.map(d=>e.jsx(qc,{src:`/api/share/${o}/${l}/images/${d.id}`,alt:d.name||"image"},d.id))})]}):e.jsx("div",{className:"prose prose-sm max-w-none prose-p:my-1 prose-headings:my-2 prose-pre:my-2 prose-ul:my-1 prose-ol:my-1 prose-li:my-0 prose-table:my-2",children:e.jsx(ds,{remarkPlugins:[cs],components:{code({node:d,className:s,children:p,...t}){if(d?.position?.start?.line!==d?.position?.end?.line||String(p).includes(`
200
+ `)){const h=s?.replace("language-","")||"";return e.jsxs("div",{className:"my-2",children:[h&&h!=="text"&&e.jsx("span",{className:"inline-block text-[11px] text-gray-400 font-medium uppercase tracking-wide mb-1 px-1",children:h}),e.jsx(us,{language:h||"text",style:ys,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.8125rem",padding:"1rem"},codeTagProps:{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"}},children:String(p).replace(/\n$/,"")})]})}return e.jsx("code",{className:"bg-gray-100 text-gray-800 rounded px-1 py-0.5 text-xs font-mono",...t,children:p})},a({children:d,href:s,...p}){return e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline",...p,children:d})},table({children:d}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsx("table",{className:"min-w-full border-collapse text-xs",children:d})})},th({children:d}){return e.jsx("th",{className:"border border-gray-300 px-2 py-1 bg-gray-50 font-semibold text-left",children:d})},td({children:d}){return e.jsx("td",{className:"border border-gray-300 px-2 py-1",children:d})}},children:r.content})})})]})})}const Vc=()=>{const[r,o]=n.useState("email"),[l,u]=n.useState(""),[c,m]=n.useState(""),[d,s]=n.useState(!1),[p,t]=n.useState(""),[x,h]=n.useState(0),{sendCode:a,verifyCode:i,smtpConfigured:g}=Ot();n.useEffect(()=>{if(x>0){const f=setTimeout(()=>h(x-1),1e3);return()=>clearTimeout(f)}},[x]);const v=async f=>{if(f.preventDefault(),t(""),!l||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(l)){t("请输入有效的邮箱地址");return}s(!0);const N=await a(l);N.success?(o("code"),h(60)):(t(N.error),N.waitSeconds&&h(N.waitSeconds)),s(!1)},k=async f=>{if(f.preventDefault(),t(""),!c||c.length!==6){t("请输入6位验证码");return}s(!0);const w=await i(l,c);w.success||t(w.error),s(!1)},b=async()=>{if(x>0)return;t(""),s(!0);const f=await a(l);f.success?h(60):t(f.error),s(!1)},j=()=>{o("email"),m(""),t("")};return g?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(Vr,{size:64})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:r==="email"?`欢迎使用 ${Ve}`:"创建管理员账户"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:r==="email"?"输入邮箱创建管理员账户":`验证码已发送至 ${l}`})]}),r==="email"&&e.jsxs("form",{onSubmit:v,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-foreground mb-1",children:"邮箱地址"}),e.jsxs("div",{className:"relative",children:[e.jsx(Yr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-muted-foreground"}),e.jsx("input",{type:"email",id:"email",value:l,onChange:f=>u(f.target.value),className:"w-full pl-10 pr-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入邮箱地址",required:!0,disabled:d,autoComplete:"email"})]})]}),p&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:p})}),e.jsx("button",{type:"submit",disabled:d||x>0,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:d?"发送中...":x>0?`${x}秒后可重新发送`:"获取验证码"})]}),r==="code"&&e.jsxs("form",{onSubmit:k,className:"space-y-4",children:[e.jsxs("button",{type:"button",onClick:j,className:"flex items-center text-sm text-muted-foreground hover:text-foreground",children:[e.jsx(Qt,{className:"w-4 h-4 mr-1"}),"返回修改邮箱"]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"code",className:"block text-sm font-medium text-foreground mb-1",children:"验证码"}),e.jsx("input",{type:"text",id:"code",value:c,onChange:f=>m(f.target.value.replace(/\D/g,"").slice(0,6)),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground text-center text-2xl tracking-widest focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"000000",required:!0,disabled:d,maxLength:6,autoComplete:"one-time-code"})]}),p&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:p})}),e.jsx("button",{type:"submit",disabled:d||c.length!==6,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:d?"创建中...":"创建管理员账户"}),e.jsx("div",{className:"text-center",children:e.jsx("button",{type:"button",onClick:b,disabled:x>0||d,className:"text-sm text-blue-500 hover:text-blue-600 disabled:text-muted-foreground",children:x>0?`${x}秒后可重新发送`:"重新发送验证码"})})]}),e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"首个注册的用户将成为管理员"})})]})})}):e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(Vr,{size:64})}),e.jsxs("h1",{className:"text-2xl font-bold text-foreground",children:["欢迎使用 ",Ve]}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"系统初始化"})]}),e.jsxs("div",{className:"p-4 bg-yellow-100 dark:bg-yellow-900/20 border border-yellow-300 dark:border-yellow-800 rounded-md",children:[e.jsx("p",{className:"text-sm text-yellow-700 dark:text-yellow-400",children:"SMTP 邮件服务未配置。请联系管理员配置以下环境变量后重启服务:"}),e.jsxs("ul",{className:"mt-2 text-sm text-yellow-700 dark:text-yellow-400 list-disc list-inside",children:[e.jsx("li",{children:"SMTP_SERVER"}),e.jsx("li",{children:"SMTP_PORT"}),e.jsx("li",{children:"SMTP_USERNAME"}),e.jsx("li",{children:"SMTP_PASSWORD"})]})]})]})})})},Zc=()=>{const[r,o]=n.useState("email"),[l,u]=n.useState("email"),[c,m]=n.useState(""),[d,s]=n.useState(""),[p,t]=n.useState(""),[x,h]=n.useState(""),[a,i]=n.useState(!1),[g,v]=n.useState(""),[k,b]=n.useState(0),[j,f]=n.useState(!1),{login:w,sendCode:N,verifyCode:L,smtpConfigured:E}=Ot();n.useEffect(()=>{if(k>0){const _=setTimeout(()=>b(k-1),1e3);return()=>clearTimeout(_)}},[k]),n.useEffect(()=>{E||o("password")},[E]);const S=async _=>{if(_.preventDefault(),v(""),!c||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c)){v("请输入有效的邮箱地址");return}i(!0);const ne=await N(c);ne.success?(u("code"),b(60),f(ne.type==="register")):(v(ne.error),ne.waitSeconds&&b(ne.waitSeconds)),i(!1)},R=async _=>{if(_.preventDefault(),v(""),!d||d.length!==6){v("请输入6位验证码");return}i(!0);const te=await L(c,d);te.success||v(te.error),i(!1)},M=async()=>{if(k>0)return;v(""),i(!0);const _=await N(c);_.success?b(60):v(_.error),i(!1)},D=async _=>{if(_.preventDefault(),v(""),!p||!x){v("请输入用户名和密码");return}i(!0);const te=await w(p,x);te.success||v(te.error),i(!1)},$=()=>{u("email"),s(""),v("")},T=()=>{o("email"),u("email"),v("")},X=()=>{o("password"),v("")};return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:"/logo.svg",className:"w-16 h-16",alt:Ve})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:r==="email"?l==="email"?`欢迎使用 ${Ve}`:j?"创建您的账户":"验证您的身份":"欢迎回来"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:r==="email"?l==="email"?"输入邮箱以接收验证码":`验证码已发送至 ${c}`:"使用账号密码登录"})]}),r==="email"&&l==="email"&&e.jsxs("form",{onSubmit:S,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-foreground mb-1",children:"邮箱地址"}),e.jsxs("div",{className:"relative",children:[e.jsx(Yr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-muted-foreground"}),e.jsx("input",{type:"email",id:"email",value:c,onChange:_=>m(_.target.value),className:"w-full pl-10 pr-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入邮箱地址",required:!0,disabled:a,autoComplete:"email"})]})]}),g&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:g})}),e.jsx("button",{type:"submit",disabled:a||k>0,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:a?"发送中...":k>0?`${k}秒后可重新发送`:"获取验证码"})]}),r==="email"&&l==="code"&&e.jsxs("form",{onSubmit:R,className:"space-y-4",children:[e.jsxs("button",{type:"button",onClick:$,className:"flex items-center text-sm text-muted-foreground hover:text-foreground",children:[e.jsx(Qt,{className:"w-4 h-4 mr-1"}),"返回修改邮箱"]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"code",className:"block text-sm font-medium text-foreground mb-1",children:"验证码"}),e.jsx("input",{type:"text",id:"code",value:d,onChange:_=>s(_.target.value.replace(/\D/g,"").slice(0,6)),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground text-center text-2xl tracking-widest focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"000000",required:!0,disabled:a,maxLength:6,autoComplete:"one-time-code"})]}),g&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:g})}),e.jsx("button",{type:"submit",disabled:a||d.length!==6,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:a?"验证中...":j?"创建账户并登录":"登录"}),e.jsx("div",{className:"text-center",children:e.jsx("button",{type:"button",onClick:M,disabled:k>0||a,className:"text-sm text-blue-500 hover:text-blue-600 disabled:text-muted-foreground",children:k>0?`${k}秒后可重新发送`:"重新发送验证码"})})]}),r==="password"&&e.jsxs("form",{onSubmit:D,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"用户名"}),e.jsxs("div",{className:"relative",children:[e.jsx(An,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-muted-foreground"}),e.jsx("input",{type:"text",id:"username",value:p,onChange:_=>t(_.target.value),className:"w-full pl-10 pr-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入用户名",required:!0,disabled:a})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"密码"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ka,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-muted-foreground"}),e.jsx("input",{type:"password",id:"password",value:x,onChange:_=>h(_.target.value),className:"w-full pl-10 pr-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"请输入密码",required:!0,disabled:a})]})]}),g&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:g})}),e.jsx("button",{type:"submit",disabled:a,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:a?"登录中...":"登录"})]}),e.jsx("div",{className:"text-center pt-4 border-t border-border",children:r==="email"&&E?e.jsx("button",{type:"button",onClick:X,className:"text-sm text-muted-foreground hover:text-foreground",children:"使用账号密码登录"}):r==="password"&&E?e.jsx("button",{type:"button",onClick:T,className:"text-sm text-muted-foreground hover:text-foreground",children:"使用邮箱验证码登录"}):null})]})})})},Qc=()=>e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:"/logo.svg",alt:Ve,className:"w-16 h-16"})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:Ve}),e.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"加载中..."})]})}),ed=({children:r})=>{const{user:o,isLoading:l,needsSetup:u}=Ot();return l?e.jsx(Qc,{}):u?e.jsx(Vc,{}):o?r:e.jsx(Zc,{})};function Mn(r,o){const[l,u]=n.useState(()=>{if(typeof window>"u")return o;try{const m=window.localStorage.getItem(r);return m?JSON.parse(m):o}catch(m){return console.log(m),o}});return[l,m=>{if(!(typeof window>"u"))try{const d=m instanceof Function?m(l):m;window.localStorage.setItem(r,JSON.stringify(d)),u(d)}catch(d){console.log(d)}}]}function Ko(){const r=Qr(),{sessionId:o}=Vo(),{limitStatus:l,setLimitStatus:u,checkLimitStatus:c,user:m,isAdmin:d}=Ot(),[s,p]=n.useState([]),[t,x]=n.useState(null),[h,a]=n.useState(null),[i,g]=n.useState("chat"),[v,k]=n.useState(!1),[b,j]=n.useState(!1),[f,w]=n.useState(!0),[N,L]=n.useState(!1),[E,S]=n.useState(!1),[R,M]=n.useState(!1),[D,$]=n.useState("shared_projects"),[T,X]=Mn("autoScrollToBottom",!0),[_,te]=Mn("sendByCtrlEnter",!1),[ne,Y]=Mn("sidebarVisible",!0),[le,de]=n.useState(!1),[fe,Ee]=n.useState(null),ye=mt.useRef(null),[Me,Fe]=n.useState(new Set),[ie,Se]=n.useState(new Set),[He,Be]=n.useState(0),{ws:he,sendMessage:Oe,messages:De}=Ps(),Ye=n.useCallback(G=>{Ee(G),de(!0)},[]),[Xe,Je]=n.useState(!1);n.useEffect(()=>{const G=()=>{const ae=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone||document.referrer.includes("android-app://");Je(ae),document.addEventListener("touchstart",{}),ae?(document.documentElement.classList.add("pwa-mode"),document.body.classList.add("pwa-mode")):(document.documentElement.classList.remove("pwa-mode"),document.body.classList.remove("pwa-mode"))};return G(),window.matchMedia("(display-mode: standalone)").addEventListener("change",G),()=>{window.matchMedia("(display-mode: standalone)").removeEventListener("change",G)}},[]),n.useEffect(()=>{const G=()=>{k(window.innerWidth<768)};return G(),window.addEventListener("resize",G),()=>window.removeEventListener("resize",G)},[]),n.useEffect(()=>{_e()},[]),n.useEffect(()=>{const G=sessionStorage.getItem("pendingClone");if(!G)return;sessionStorage.removeItem("pendingClone");const ae=localStorage.getItem("auth-token");if(ae)try{const{shareUserUuid:ce,sessionId:Pe}=JSON.parse(G);fetch(`/api/share/${ce}/${Pe}/clone`,{method:"POST",headers:{Authorization:`Bearer ${ae}`}}).then(xe=>xe.json()).then(xe=>{xe.success&&(_e(),r(`/app/session/${xe.sessionId}`))}).catch(xe=>console.error("[pendingClone] Clone failed:",xe))}catch{}},[]);const Ce=(G,ae,ce,Pe)=>{if(!ce||!Pe)return!0;const xe=G?.find(Ae=>Ae.name===ce.name),Le=ae?.find(Ae=>Ae.name===ce.name);if(!xe||!Le)return!1;const oe=xe.sessions?.find(Ae=>Ae.id===Pe.id),be=Le.sessions?.find(Ae=>Ae.id===Pe.id);return!oe||!be?!1:oe.id===be.id&&oe.title===be.title&&oe.created_at===be.created_at&&oe.updated_at===be.updated_at};n.useEffect(()=>{if(De.length>0){const G=De[De.length-1];if(G.type==="projects_updated"){const ae=G.timestamp;if(ae&&ae===ye.current)return;if(ye.current=ae||null,G.changedFile&&h&&t){const Le=G.changedFile.replace(/\\/g,"/").split("/");Le.length>=2&&Le[Le.length-1].replace(".jsonl","")===h.id&&(Me.has(h.id)||Be(Ae=>Ae+1))}if(h&&Me.has(h.id)||Me.size>0&&Array.from(Me).some(xe=>xe.startsWith("new-session-"))){const xe=G.projects;if(!Ce(s,xe,t,h))return}const Pe=G.projects;if(p(Pe),t){const xe=Pe.find(Le=>Le.name===t.name);xe&&(JSON.stringify(xe)!==JSON.stringify(t)&&x(xe),h&&([...xe.sessions||[]].find(be=>be.id===h.id)||a(null)))}}}},[De,t,h,Me]);const _e=async()=>{try{w(!0);const ae=await(await me.projects()).json();p(ce=>ce.length===0||ae.some((xe,Le)=>{const oe=ce[Le];return oe?xe.name!==oe.name||xe.displayName!==oe.displayName||xe.fullPath!==oe.fullPath||JSON.stringify(xe.sessionMeta)!==JSON.stringify(oe.sessionMeta)||JSON.stringify(xe.sessions)!==JSON.stringify(oe.sessions)||JSON.stringify(xe.agentInfo)!==JSON.stringify(oe.agentInfo):!0})||ae.length!==ce.length?ae:ce)}catch(G){console.error("Error fetching projects:",G)}finally{w(!1)}};window.refreshProjects=_e,window.openSettings=n.useCallback((G="tools")=>{$(G),S(!0)},[]),window.openAdminPanel=n.useCallback(()=>{M(!0)},[]),n.useEffect(()=>{if(o&&s.length>0){const G=!h||h.id!==o;for(const ae of s){let ce=ae.sessions?.find(Pe=>Pe.id===o);if(ce){x(ae),a({...ce,__provider:"claude"}),G&&g("chat");return}}}},[o,s,r]);const $e=G=>{x(G),a(null),r("/app"),v&&j(!1)},ze=G=>{if(a(G),i!=="git"&&i!=="preview"&&g("chat"),v){const ae=G.__projectName,ce=t?.name;ae!==ce&&j(!1)}r(`/app/session/${G.id}`)},Re=G=>{x(G),a(null),g("chat"),r("/app"),v&&j(!1)},Ze=G=>{h?.id===G&&(a(null),r("/app")),p(ae=>ae.map(ce=>({...ce,sessions:ce.sessions?.filter(Pe=>Pe.id!==G)||[],sessionMeta:{...ce.sessionMeta,total:Math.max(0,(ce.sessionMeta?.total||0)-1)}})))},Qe=async()=>{try{const ae=await(await me.projects()).json();if(p(ce=>ae.some((xe,Le)=>{const oe=ce[Le];return oe?xe.name!==oe.name||xe.displayName!==oe.displayName||xe.fullPath!==oe.fullPath||JSON.stringify(xe.sessionMeta)!==JSON.stringify(oe.sessionMeta)||JSON.stringify(xe.sessions)!==JSON.stringify(oe.sessions):!0})||ae.length!==ce.length?ae:ce),t){const ce=ae.find(Pe=>Pe.name===t.name);if(ce&&(JSON.stringify(ce)!==JSON.stringify(t)&&x(ce),h)){const Pe=ce.sessions?.find(xe=>xe.id===h.id);Pe&&JSON.stringify(Pe)!==JSON.stringify(h)&&a(Pe)}}}catch(G){console.error("Error refreshing sidebar:",G)}},K=G=>{t?.name===G&&(x(null),a(null),r("/app")),p(ae=>ae.filter(ce=>ce.name!==G))},B=n.useCallback(G=>{G&&Fe(ae=>new Set([...ae,G]))},[]),C=n.useCallback(G=>{G&&Fe(ae=>{const ce=new Set(ae);return ce.delete(G),ce})},[]),V=n.useCallback(G=>{G&&Se(ae=>new Set([...ae,G]))},[]),z=n.useCallback(G=>{G&&Se(ae=>{const ce=new Set(ae);return ce.delete(G),ce})},[]),re=n.useCallback(G=>{G&&Fe(ae=>{const ce=new Set;for(const Pe of ae)Pe.startsWith("new-session-")||ce.add(Pe);return ce.add(G),ce})},[]);return e.jsxs("div",{className:"fixed inset-0 flex bg-background",children:[!v&&e.jsx("div",{className:`h-full flex-shrink-0 border-r border-border bg-card transition-all duration-300 ${ne?"w-80":"w-14"}`,children:e.jsx("div",{className:"h-full overflow-hidden",children:ne?e.jsx(So,{projects:s,selectedProject:t,selectedSession:h,onProjectSelect:$e,onSessionSelect:ze,onNewSession:Re,onSessionDelete:Ze,onProjectDelete:K,isLoading:f,onRefresh:Qe,onShowSettings:()=>S(!0),onShowAdmin:()=>M(!0),isPWA:Xe,isMobile:v,onToggleSidebar:()=>Y(!1)}):e.jsxs("div",{className:"h-full flex flex-col items-center py-4 gap-4",children:[e.jsx("button",{onClick:()=>Y(!0),className:"p-2 hover:bg-accent rounded-md transition-colors duration-200 group","aria-label":"Show sidebar",title:"Show sidebar",children:e.jsx("svg",{className:"w-5 h-5 text-foreground group-hover:scale-110 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M5 5l7 7-7 7"})})}),e.jsx("button",{onClick:()=>S(!0),className:"p-2 hover:bg-accent rounded-md transition-colors duration-200","aria-label":"Settings",title:"Settings",children:e.jsx(Ut,{className:"w-5 h-5 text-muted-foreground hover:text-foreground transition-colors"})}),d&&e.jsx("button",{onClick:()=>M(!0),className:"p-2 hover:bg-accent rounded-md transition-colors duration-200","aria-label":"Admin",title:"管理",children:e.jsx(Gt,{className:"w-5 h-5 text-muted-foreground hover:text-foreground transition-colors"})})]})})}),v&&e.jsxs("div",{className:`fixed inset-0 z-50 flex transition-all duration-150 ease-out ${b?"opacity-100 visible":"opacity-0 invisible"}`,children:[e.jsx("button",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-150 ease-out",onClick:G=>{G.stopPropagation(),j(!1)},onTouchStart:G=>{G.preventDefault(),G.stopPropagation(),j(!1)},"aria-label":"Close sidebar"}),e.jsx("div",{className:`relative w-[85vw] max-w-sm sm:w-80 h-full bg-card border-r border-border transform transition-transform duration-150 ease-out ${b?"translate-x-0":"-translate-x-full"}`,onClick:G=>G.stopPropagation(),onTouchStart:G=>G.stopPropagation(),children:e.jsx(So,{projects:s,selectedProject:t,selectedSession:h,onProjectSelect:$e,onSessionSelect:ze,onNewSession:Re,onSessionDelete:Ze,onProjectDelete:K,isLoading:f,onRefresh:Qe,onShowSettings:()=>S(!0),onShowAdmin:()=>M(!0),isPWA:Xe,isMobile:v,onToggleSidebar:()=>Y(!1)})})]}),e.jsx("div",{className:`flex-1 flex flex-col min-w-0 ${v&&!N?"pb-mobile-nav":""}`,children:e.jsx(Fl,{selectedProject:t,selectedSession:h,activeTab:i,setActiveTab:g,ws:he,sendMessage:Oe,messages:De,isMobile:v,isPWA:Xe,onMenuClick:()=>j(!0),isLoading:f,onInputFocusChange:L,onSessionActive:B,onSessionInactive:C,onSessionProcessing:V,onSessionNotProcessing:z,processingSessions:ie,onReplaceTemporarySession:re,onNavigateToSession:G=>r(`/app/session/${G}`),onShowSettings:()=>S(!0),autoScrollToBottom:T,sendByCtrlEnter:_,externalMessageUpdate:He,limitStatus:l,onLimitBlocked:Ye,checkLimitStatus:c})}),v&&e.jsx(Hl,{activeTab:i,setActiveTab:g,isInputFocused:N}),e.jsx(jc,{isOpen:E,onClose:()=>S(!1),projects:s,initialTab:D,autoScrollToBottom:T,onAutoScrollChange:X,sendByCtrlEnter:_,onSendByCtrlEnterChange:te}),e.jsx(zc,{isOpen:R,onClose:()=>M(!1)}),e.jsx(Rc,{isOpen:le,limitType:fe,onClose:()=>de(!1)})]})}function td(){return e.jsx(fi,{children:e.jsx($l,{children:e.jsx(pi,{children:e.jsx(ed,{children:e.jsxs(Zo,{children:[e.jsx(dr,{index:!0,element:e.jsx(Ko,{})}),e.jsx(dr,{path:"session/:sessionId",element:e.jsx(Ko,{})})]})})})})})}function rd(){return e.jsx(Bl,{children:e.jsx(ka,{children:e.jsxs(Zo,{children:[e.jsx(dr,{path:"/",element:e.jsx(Hc,{})}),e.jsx(dr,{path:"/demo",element:e.jsx(Gc,{})}),e.jsx(dr,{path:"/share/:userUuid/:sessionId",element:e.jsx(Yc,{})}),e.jsx(dr,{path:"/app/*",element:e.jsx(td,{})})]})})})}si.createRoot(document.getElementById("root")).render(e.jsx(mt.StrictMode,{children:e.jsx(rd,{})}));