diff --git a/ui/dist/assets/index-B-WSkv0U.js b/ui/dist/assets/index-B-WSkv0U.js index e37eb20e..ebc4d713 100644 --- a/ui/dist/assets/index-B-WSkv0U.js +++ b/ui/dist/assets/index-B-WSkv0U.js @@ -305,4 +305,4 @@ https://github.com/nodeca/pako/blob/main/LICENSE key=val; key2=val2;`,..._,className:"placeholder:whitespace-pre-wrap"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"nameservers",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance",children:[l.jsx(je,{children:"域名服务器"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:`自定义域名服务器,多个用分号隔开,如: 8.8.8.8; -8.8.4.4;`,..._,className:"placeholder:whitespace-pre-wrap"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})})},eN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));eN.displayName="Card";const tN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("flex flex-col space-y-1.5 p-6",e),...t}));tN.displayName="CardHeader";const rN=v.forwardRef(({className:e,...t},r)=>l.jsx("h3",{ref:r,className:ae("text-2xl font-semibold leading-none tracking-tight",e),...t}));rN.displayName="CardTitle";const nN=v.forwardRef(({className:e,...t},r)=>l.jsx("p",{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));nN.displayName="CardDescription";const sN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("p-6 pt-0",e),...t}));sN.displayName="CardContent";const oN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("flex items-center p-6 pt-0",e),...t}));oN.displayName="CardFooter";const _o=e=>e instanceof Error?e.message:typeof e=="object"&&e!==null&&"message"in e?String(e.message):typeof e=="string"?e:"Something went wrong",NU=()=>{const{config:{accessGroups:e},reloadAccessGroups:t}=Kr(),{toast:r}=qn(),n=Nr(),s=async i=>{try{await b3(i),t()}catch(a){r({title:"删除失败",description:_o(a),variant:"destructive"});return}},o=()=>{n("/access")};return l.jsxs("div",{className:"mt-10",children:[l.jsx(na,{when:e.length==0,children:l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(v0,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),l.jsx(_y,{trigger:l.jsx(He,{children:"新增授权组"}),className:"mt-3"})]})})}),l.jsx(ih,{className:"h-[75vh] overflow-hidden",children:l.jsx("div",{className:"flex gap-5 flex-wrap",children:e.map(i=>l.jsxs(eN,{className:"w-full md:w-[350px]",children:[l.jsxs(tN,{children:[l.jsx(rN,{children:i.name}),l.jsxs(nN,{children:["共有",i.expand?i.expand.access.length:0,"个部署授权配置"]})]}),l.jsx(sN,{className:"min-h-[180px]",children:i.expand?l.jsx(l.Fragment,{children:i.expand.access.slice(0,3).map(a=>l.jsx("div",{className:"flex flex-col mb-3",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"",children:l.jsx("img",{src:xw(a.configType)[1],alt:"provider",className:"w-8 h-8"})}),l.jsxs("div",{className:"ml-3",children:[l.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:a.name}),l.jsx("div",{className:"text-xs text-muted-foreground",children:xw(a.configType)[0]})]})]})},a.id))}):l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex text-gray-700 dark:text-gray-200 items-center",children:[l.jsx("div",{children:l.jsx(v0,{size:40})}),l.jsx("div",{className:"ml-2",children:"暂无部署授权配置,请添加后开始使用吧"})]})})}),l.jsx(oN,{children:l.jsxs("div",{className:"flex justify-end w-full",children:[l.jsx(na,{when:!!(i.expand&&i.expand.access.length>0),children:l.jsx("div",{children:l.jsx(He,{size:"sm",variant:"link",onClick:()=>{n(`/access?accessGroupId=${i.id}&tab=access`,{replace:!0})},children:"所有授权"})})}),l.jsx(na,{when:!i.expand||i.expand.access.length==0,children:l.jsx("div",{children:l.jsx(He,{size:"sm",onClick:o,children:"新增授权"})})}),l.jsx("div",{className:"ml-3",children:l.jsxs(WC,{children:[l.jsx(BC,{asChild:!0,children:l.jsx(He,{variant:"destructive",size:"sm",children:"删除"})}),l.jsxs(qv,{children:[l.jsxs(Xv,{children:[l.jsx(Jv,{className:"dark:text-gray-200",children:"删除组"}),l.jsx(ey,{children:"确定要删除部署授权组吗?"})]}),l.jsxs(Qv,{children:[l.jsx(ry,{className:"dark:text-gray-200",children:"取消"}),l.jsx(ty,{onClick:()=>{s(i.id?i.id:"")},children:"确认"})]})]})]})})]})})]}))})})]})};var by="Tabs",[TU,T$]=xr(by,[kf]),iN=kf(),[RU,Sy]=TU(by),aN=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Ea(a),[f,m]=on({prop:n,onChange:s,defaultProp:o});return l.jsx(RU,{scope:r,baseId:Ur(),value:f,onValueChange:m,orientation:i,dir:d,activationMode:c,children:l.jsx(Re.div,{dir:d,"data-orientation":i,...u,ref:t})})});aN.displayName=by;var lN="TabsList",cN=v.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...s}=e,o=Sy(lN,r),i=iN(r);return l.jsx(Fb,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:n,children:l.jsx(Re.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});cN.displayName=lN;var uN="TabsTrigger",dN=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...o}=e,i=Sy(uN,r),a=iN(r),c=pN(i.baseId,n),u=mN(i.baseId,n),d=n===i.value;return l.jsx(zb,{asChild:!0,...a,focusable:!s,active:d,children:l.jsx(Re.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...o,ref:t,onMouseDown:ce(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?i.onValueChange(n):f.preventDefault()}),onKeyDown:ce(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(n)}),onFocus:ce(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!s&&f&&i.onValueChange(n)})})})});dN.displayName=uN;var fN="TabsContent",hN=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:s,children:o,...i}=e,a=Sy(fN,r),c=pN(a.baseId,n),u=mN(a.baseId,n),d=n===a.value,f=v.useRef(d);return v.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(ur,{present:s||d,children:({present:m})=>l.jsx(Re.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&o})})});hN.displayName=fN;function pN(e,t){return`${e}-trigger-${t}`}function mN(e,t){return`${e}-content-${t}`}var PU=aN,gN=cN,vN=dN,yN=hN;const xN=PU,ky=v.forwardRef(({className:e,...t},r)=>l.jsx(gN,{ref:r,className:ae("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));ky.displayName=gN.displayName;const ia=v.forwardRef(({className:e,...t},r)=>l.jsx(vN,{ref:r,className:ae("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));ia.displayName=vN.displayName;const Gd=v.forwardRef(({className:e,...t},r)=>l.jsx(yN,{ref:r,className:ae("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Gd.displayName=yN.displayName;const AU=()=>{const{config:e,deleteAccess:t}=Kr(),{accesses:r}=e,n=10,s=Math.ceil(r.length/n),o=Nr(),i=Nn(),a=new URLSearchParams(i.search),c=a.get("page"),u=c?Number(c):1,d=a.get("tab"),f=a.get("accessGroupId"),m=(u-1)*n,y=m+n,x=async _=>{const p=await _3(_);t(p.id)},g=_=>{a.set("tab",_),o({search:a.toString()})};return l.jsxs("div",{className:"",children:[l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:"授权管理"}),d!="access_group"?l.jsx(jl,{trigger:l.jsx(He,{children:"添加授权"}),op:"add"}):l.jsx(_y,{trigger:l.jsx(He,{children:"添加授权组"})})]}),l.jsxs(xN,{defaultValue:d||"access",value:d||"access",className:"w-full mt-5",children:[l.jsxs(ky,{className:"space-x-5 px-3",children:[l.jsx(ia,{value:"access",onClick:()=>{g("access")},children:"授权管理"}),l.jsx(ia,{value:"access_group",onClick:()=>{g("access_group")},children:"授权组管理"})]}),l.jsx(Gd,{value:"access",children:r.length===0?l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(hA,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加授权开始部署证书吧。"}),l.jsx(jl,{trigger:l.jsx(He,{children:"添加授权"}),op:"add",className:"mt-3"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:"名称"}),l.jsx("div",{className:"w-48",children:"服务商"}),l.jsx("div",{className:"w-52",children:"创建时间"}),l.jsx("div",{className:"w-52",children:"更新时间"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"授权列表"}),r.filter(_=>f?_.group==f:!0).slice(m,y).map(_=>{var p,h;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:_.name}),l.jsxs("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center space-x-2",children:[l.jsx("img",{src:(p=uo.get(_.configType))==null?void 0:p[1],className:"w-6"}),l.jsx("div",{children:(h=uo.get(_.configType))==null?void 0:h[0]})]}),l.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["创建于"," ",_.created&&ga(_.created)]}),l.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["更新于"," ",_.updated&&ga(_.updated)]}),l.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[l.jsx(jl,{trigger:l.jsx(He,{variant:"link",className:"p-0",children:"编辑"}),op:"edit",data:_}),l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>{x(_)},children:"删除"})]})]},_.id)}),l.jsx(SC,{totalPages:s,currentPage:u,onPageChange:_=>{a.set("page",_.toString()),o({search:a.toString()})}})]})}),l.jsx(Gd,{value:"access_group",children:l.jsx(NU,{})})]})]})},DU=_c("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Cy=v.forwardRef(({className:e,variant:t,...r},n)=>l.jsx("div",{ref:n,role:"alert",className:ae(DU({variant:t}),e),...r}));Cy.displayName="Alert";const jy=v.forwardRef(({className:e,...t},r)=>l.jsx("h5",{ref:r,className:ae("mb-1 font-medium leading-none tracking-tight",e),...t}));jy.displayName="AlertTitle";const Ey=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("text-sm [&_p]:leading-relaxed",e),...t}));Ey.displayName="AlertDescription";const wN=async e=>{let t=1;e.page&&(t=e.page);let r=50;e.perPage&&(r=e.perPage);let n="domain!=null";return e.domain&&(n=`domain="${e.domain}"`),await st().collection("deployments").getList(t,r,{filter:n,sort:"-deployedAt",expand:"domain"})},OU=()=>{const e=Nr(),[t,r]=v.useState(),[n]=JP(),s=n.get("domain");return v.useEffect(()=>{(async()=>{const i={};s&&(i.domain=s);const a=await wN(i);r(a.items)})()},[s]),l.jsxs(ih,{className:"h-[80vh] overflow-hidden",children:[l.jsx("div",{className:"text-muted-foreground",children:"部署历史"}),t!=null&&t.length?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:"域名"}),l.jsx("div",{className:"w-24",children:"状态"}),l.jsx("div",{className:"w-56",children:"阶段"}),l.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),t==null?void 0:t.map(o=>{var i,a;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(i=o.expand.domain)==null?void 0:i.domain}),l.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Gv,{deployment:o})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Hv,{phase:o.phase,phaseSuccess:o.phaseSuccess})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:ga(o.deployedAt)}),l.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:l.jsxs(yv,{children:[l.jsx(xv,{asChild:!0,children:l.jsx(He,{variant:"link",className:"p-0",children:"日志"})}),l.jsxs(Rf,{className:"sm:max-w-5xl",children:[l.jsx(wv,{children:l.jsxs(_v,{children:[(a=o.expand.domain)==null?void 0:a.domain,"-",o.id,"部署详情"]})}),l.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[o.log.check&&l.jsx(l.Fragment,{children:o.log.check.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.apply&&l.jsx(l.Fragment,{children:o.log.apply.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.info&&c.info.map(u=>l.jsx("div",{className:"mt-1 text-green-600",children:u})),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.deploy&&l.jsx(l.Fragment,{children:o.log.deploy.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))})]})]})]})})]},o.id)})]}):l.jsx(l.Fragment,{children:l.jsxs(Cy,{className:"max-w-[40em] mx-auto mt-20",children:[l.jsx(jy,{children:"暂无数据"}),l.jsxs(Ey,{children:[l.jsxs("div",{className:"flex items-center mt-5",children:[l.jsx("div",{children:l.jsx(tb,{className:"text-yellow-400",size:36})}),l.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),l.jsx("div",{className:"mt-2 flex justify-end",children:l.jsx(He,{onClick:()=>{e("/")},children:"添加域名"})})]})]})})]})},MU=pe.object({username:pe.string().email({message:"请输入正确的邮箱地址"}),password:pe.string().min(10,{message:"密码至少10个字符"})}),IU=()=>{const e=Tr({resolver:Rr(MU),defaultValues:{username:"",password:""}}),t=async n=>{try{await st().admins.authWithPassword(n.username,n.password),r("/")}catch(s){const o=_o(s);e.setError("username",{message:o}),e.setError("password",{message:o})}},r=Nr();return l.jsxs("div",{className:"max-w-[35em] border dark:border-stone-500 mx-auto mt-32 p-10 rounded-md shadow-md",children:[l.jsx("div",{className:"flex justify-center mb-10",children:l.jsx("img",{src:"/vite.svg",className:"w-16"})}),l.jsx(Pr,{...e,children:l.jsxs("form",{onSubmit:e.handleSubmit(t),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:e.control,name:"username",render:({field:n})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"用户名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"email",...n})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:e.control,name:"password",render:({field:n})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"shadcn",...n,type:"password"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"登录"})})]})})]})},LU=()=>st().authStore.isValid&&st().authStore.isAdmin?l.jsx(Q1,{to:"/"}):l.jsxs("div",{className:"container",children:[l.jsx(Ig,{}),l.jsx(cC,{})]}),FU=pe.object({oldPassword:pe.string().min(10,{message:"密码至少10个字符"}),newPassword:pe.string().min(10,{message:"密码至少10个字符"}),confirmPassword:pe.string().min(10,{message:"密码至少10个字符"})}).refine(e=>e.newPassword===e.confirmPassword,{message:"两次密码不一致",path:["confirmPassword"]}),zU=()=>{const{toast:e}=qn(),t=Nr(),r=Tr({resolver:Rr(FU),defaultValues:{oldPassword:"",newPassword:"",confirmPassword:""}}),n=async s=>{var o,i;try{await st().admins.authWithPassword((o=st().authStore.model)==null?void 0:o.email,s.oldPassword)}catch(a){const c=_o(a);r.setError("oldPassword",{message:c})}try{await st().admins.update((i=st().authStore.model)==null?void 0:i.id,{password:s.newPassword,passwordConfirm:s.confirmPassword}),st().authStore.clear(),e({title:"修改密码成功",description:"请重新登录"}),setTimeout(()=>{t("/login")},500)}catch(a){const c=_o(a);e({title:"修改密码失败",description:c,variant:"destructive"})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"w-full md:max-w-[35em]",children:l.jsx(Pr,{...r,children:l.jsxs("form",{onSubmit:r.handleSubmit(n),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:r.control,name:"oldPassword",render:({field:s})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"当前密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"当前密码",...s,type:"password"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:r.control,name:"newPassword",render:({field:s})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"新密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"newPassword",...s,type:"password"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:r.control,name:"confirmPassword",render:({field:s})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"确认密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"confirmPassword",...s,type:"password"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"确认修改"})})]})})})})},UU=()=>{const e=Nn(),[t,r]=v.useState("account"),n=Nr();return v.useEffect(()=>{const o=e.pathname.split("/")[2];r(o)},[e]),l.jsxs("div",{children:[l.jsx(ay,{}),l.jsx("div",{className:"text-muted-foreground border-b dark:border-stone-500 py-5",children:"偏好设置"}),l.jsx("div",{className:"w-full mt-5 p-0 md:p-3 flex justify-center",children:l.jsxs(xN,{defaultValue:"account",className:"w-full",value:t,children:[l.jsxs(ky,{className:"mx-auto",children:[l.jsxs(ia,{value:"account",onClick:()=>{n("/setting/account")},className:"px-5",children:[l.jsx(wA,{size:14}),l.jsx("div",{className:"ml-1",children:"账户"})]}),l.jsxs(ia,{value:"password",onClick:()=>{n("/setting/password")},className:"px-5",children:[l.jsx(fA,{size:14}),l.jsx("div",{className:"ml-1",children:"密码"})]}),l.jsxs(ia,{value:"notify",onClick:()=>{n("/setting/notify")},className:"px-5",children:[l.jsx(mA,{size:14}),l.jsx("div",{className:"ml-1",children:"消息推送"})]})]}),l.jsx(Gd,{value:t,children:l.jsx("div",{className:"mt-5 w-full md:w-[45em]",children:l.jsx(Ig,{})})})]})})]})},$U=()=>{const[e,t]=v.useState(),[r,n]=v.useState(),s=Nr();return v.useEffect(()=>{(async()=>{const i=await Q6();t(i)})()},[]),v.useEffect(()=>{(async()=>{const a=await wN({perPage:8});n(a.items)})()},[]),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("div",{className:"flex justify-between items-center",children:l.jsx("div",{className:"text-muted-foreground",children:"控制面板"})}),l.jsxs("div",{className:"flex mt-10 gap-5 flex-col flex-wrap md:flex-row",children:[l.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[l.jsx("div",{className:"p-3",children:l.jsx(yA,{size:48,strokeWidth:1,className:"text-blue-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"所有"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.total?l.jsx(fr,{to:"/domains",className:"hover:underline",children:e==null?void 0:e.total}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),l.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[l.jsx("div",{className:"p-3",children:l.jsx(oA,{size:48,strokeWidth:1,className:"text-red-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"即将过期"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.expired?l.jsx(fr,{to:"/domains?state=expired",className:"hover:underline",children:e==null?void 0:e.expired}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),l.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[l.jsx("div",{className:"p-3",children:l.jsx(pA,{size:48,strokeWidth:1,className:"text-green-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"启用中"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.enabled?l.jsx(fr,{to:"/domains?state=enabled",className:"hover:underline",children:e==null?void 0:e.enabled}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),l.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[l.jsx("div",{className:"p-3",children:l.jsx(nA,{size:48,strokeWidth:1,className:"text-gray-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"未启用"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.disabled?l.jsx(fr,{to:"/domains?state=disabled",className:"hover:underline",children:e==null?void 0:e.disabled}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground mt-5 text-sm",children:"部署历史"}),(r==null?void 0:r.length)==0?l.jsx(l.Fragment,{children:l.jsxs(Cy,{className:"max-w-[40em] mt-10",children:[l.jsx(jy,{children:"暂无数据"}),l.jsxs(Ey,{children:[l.jsxs("div",{className:"flex items-center mt-5",children:[l.jsx("div",{children:l.jsx(tb,{className:"text-yellow-400",size:36})}),l.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),l.jsx("div",{className:"mt-2 flex justify-end",children:l.jsx(He,{onClick:()=>{s("/edit")},children:"添加域名"})})]})]})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:"域名"}),l.jsx("div",{className:"w-24",children:"状态"}),l.jsx("div",{className:"w-56",children:"阶段"}),l.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),r==null?void 0:r.map(o=>{var i,a;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(i=o.expand.domain)==null?void 0:i.domain}),l.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Gv,{deployment:o})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Hv,{phase:o.phase,phaseSuccess:o.phaseSuccess})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:ga(o.deployedAt)}),l.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:l.jsxs(yv,{children:[l.jsx(xv,{asChild:!0,children:l.jsx(He,{variant:"link",className:"p-0",children:"日志"})}),l.jsxs(Rf,{className:"sm:max-w-5xl",children:[l.jsx(wv,{children:l.jsxs(_v,{children:[(a=o.expand.domain)==null?void 0:a.domain,"-",o.id,"部署详情"]})}),l.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[o.log.check&&l.jsx(l.Fragment,{children:o.log.check.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.apply&&l.jsx(l.Fragment,{children:o.log.apply.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.info&&c.info.map(u=>l.jsx("div",{className:"mt-1 text-green-600",children:u})),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.deploy&&l.jsx(l.Fragment,{children:o.log.deploy.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))})]})]})]})})]},o.id)})]})]})]})},VU=pe.object({email:pe.string().email("请输入正确的邮箱")}),WU=()=>{var i;const{toast:e}=qn(),t=Nr(),[r,n]=v.useState(!1),s=Tr({resolver:Rr(VU),defaultValues:{email:(i=st().authStore.model)==null?void 0:i.email}}),o=async a=>{var c;try{await st().admins.update((c=st().authStore.model)==null?void 0:c.id,{email:a.email}),st().authStore.clear(),e({title:"修改账户邮箱功",description:"请重新登录"}),setTimeout(()=>{t("/login")},500)}catch(u){const d=_o(u);e({title:"修改账户邮箱失败",description:d,variant:"destructive"})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"w-full md:max-w-[35em]",children:l.jsx(Pr,{...s,children:l.jsxs("form",{onSubmit:s.handleSubmit(o),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:s.control,name:"email",render:({field:a})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"邮箱"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入邮箱",...a,type:"email",onChange:c=>{n(!0),s.setValue("email",c.target.value)}})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:r?l.jsx(He,{type:"submit",children:"确认修改"}):l.jsx(He,{type:"submit",disabled:!0,variant:"secondary",children:"确认修改"})})]})})})})},BU=(e,t)=>{switch(t.type){case"SET_CHANNEL":{const r=t.payload.channel;return{...e,content:{...e.content,[r]:t.payload.data}}}case"SET_CHANNELS":return{...t.payload};default:return e}},_N=v.createContext({}),Ny=()=>v.useContext(_N),HU=({children:e})=>{const[t,r]=v.useReducer(BU,{});v.useEffect(()=>{(async()=>{const i=await sC("notifyChannels");r({type:"SET_CHANNELS",payload:i})})()},[]);const n=v.useCallback(o=>{r({type:"SET_CHANNEL",payload:o})},[]),s=v.useCallback(o=>{r({type:"SET_CHANNELS",payload:o})},[]);return l.jsx(_N.Provider,{value:{config:t,setChannel:n,setChannels:s},children:e})},YU=()=>{const{config:e,setChannels:t}=Ny(),[r,n]=v.useState({id:e.id??"",name:"notifyChannels",data:{accessToken:"",secret:"",enabled:!1}});v.useEffect(()=>{const a=(()=>{const c={accessToken:"",secret:"",enabled:!1};if(!e.content)return c;const u=e.content;return u.dingtalk?u.dingtalk:c})();n({id:e.id??"",name:"dingtalk",data:a})},[e]);const{toast:s}=qn(),o=async()=>{try{const i=await Mc({...e,name:"notifyChannels",content:{...e.content,dingtalk:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const a=_o(i);s({title:"保存失败",description:"配置保存失败:"+a,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(Te,{placeholder:"AccessToken",value:r.data.accessToken,onChange:i=>{n({...r,data:{...r.data,accessToken:i.target.value}})}}),l.jsx(Te,{placeholder:"加签的签名",className:"mt-2",value:r.data.secret,onChange:i=>{n({...r,data:{...r.data,secret:i.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(Lc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Ma,{htmlFor:"airplane-mode",children:"是否启用"})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:()=>{o()},children:"保存"})})]})},ZU={title:"您有{COUNT}张证书即将过期",content:"有{COUNT}张证书即将过期,域名分别为{DOMAINS},请保持关注!"},KU=()=>{const[e,t]=v.useState(""),[r,n]=v.useState([ZU]),{toast:s}=qn();v.useEffect(()=>{(async()=>{const u=await sC("templates");u.content&&(n(u.content.notifyTemplates),t(u.id?u.id:""))})()},[]);const o=c=>{const u=r[0];n([{...u,title:c}])},i=c=>{const u=r[0];n([{...u,content:c}])},a=async()=>{const c=await Mc({id:e,content:{notifyTemplates:r},name:"templates"});c.id&&t(c.id),s({title:"保存成功",description:"通知模板保存成功"})};return l.jsxs("div",{children:[l.jsx(Te,{value:r[0].title,onChange:c=>{o(c.target.value)}}),l.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:"可选的变量, COUNT:即将过期张数"}),l.jsx(mc,{className:"mt-2",value:r[0].content,onChange:c=>{i(c.target.value)}}),l.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:"可选的变量, COUNT:即将过期张数,DOMAINS:域名列表"}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:a,children:"保存"})})]})},GU=()=>{const{config:e,setChannels:t}=Ny(),[r,n]=v.useState({id:e.id??"",name:"notifyChannels",data:{apiToken:"",chatId:"",enabled:!1}});v.useEffect(()=>{const a=(()=>{const c={apiToken:"",chatId:"",enabled:!1};if(!e.content)return c;const u=e.content;return u.telegram?u.telegram:c})();n({id:e.id??"",name:"telegram",data:a})},[e]);const{toast:s}=qn(),o=async()=>{try{const i=await Mc({...e,name:"notifyChannels",content:{...e.content,telegram:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const a=_o(i);s({title:"保存失败",description:"配置保存失败:"+a,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(Te,{placeholder:"ApiToken",value:r.data.apiToken,onChange:i=>{n({...r,data:{...r.data,apiToken:i.target.value}})}}),l.jsx(Te,{placeholder:"ChatId",value:r.data.chatId,onChange:i=>{n({...r,data:{...r.data,chatId:i.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(Lc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Ma,{htmlFor:"airplane-mode",children:"是否启用"})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:()=>{o()},children:"保存"})})]})};function qU(e){try{return new URL(e),!0}catch{return!1}}const XU=()=>{const{config:e,setChannels:t}=Ny(),[r,n]=v.useState({id:e.id??"",name:"notifyChannels",data:{url:"",enabled:!1}});v.useEffect(()=>{const a=(()=>{const c={url:"",enabled:!1};if(!e.content)return c;const u=e.content;return u.webhook?u.webhook:c})();n({id:e.id??"",name:"webhook",data:a})},[e]);const{toast:s}=qn(),o=async()=>{try{if(r.data.url=r.data.url.trim(),!qU(r.data.url)){s({title:"保存失败",description:"Url格式不正确",variant:"destructive"});return}const i=await Mc({...e,name:"notifyChannels",content:{...e.content,webhook:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const a=_o(i);s({title:"保存失败",description:"配置保存失败:"+a,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(Te,{placeholder:"Url",value:r.data.url,onChange:i=>{n({...r,data:{...r.data,url:i.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(Lc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Ma,{htmlFor:"airplane-mode",children:"是否启用"})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:()=>{o()},children:"保存"})})]})};var Ty="Collapsible",[QU,bN]=xr(Ty),[JU,Ry]=QU(Ty),SN=v.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:o,onOpenChange:i,...a}=e,[c=!1,u]=on({prop:n,defaultProp:s,onChange:i});return l.jsx(JU,{scope:r,disabled:o,contentId:Ur(),open:c,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:l.jsx(Re.div,{"data-state":Ay(c),"data-disabled":o?"":void 0,...a,ref:t})})});SN.displayName=Ty;var kN="CollapsibleTrigger",CN=v.forwardRef((e,t)=>{const{__scopeCollapsible:r,...n}=e,s=Ry(kN,r);return l.jsx(Re.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Ay(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:t,onClick:ce(e.onClick,s.onOpenToggle)})});CN.displayName=kN;var Py="CollapsibleContent",jN=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Ry(Py,e.__scopeCollapsible);return l.jsx(ur,{present:r||s.open,children:({present:o})=>l.jsx(e$,{...n,ref:t,present:o})})});jN.displayName=Py;var e$=v.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:n,children:s,...o}=e,i=Ry(Py,r),[a,c]=v.useState(n),u=v.useRef(null),d=Ke(t,u),f=v.useRef(0),m=f.current,y=v.useRef(0),x=y.current,g=i.open||a,_=v.useRef(g),p=v.useRef();return v.useEffect(()=>{const h=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(h)},[]),Jt(()=>{const h=u.current;if(h){p.current=p.current||{transitionDuration:h.style.transitionDuration,animationName:h.style.animationName},h.style.transitionDuration="0s",h.style.animationName="none";const w=h.getBoundingClientRect();f.current=w.height,y.current=w.width,_.current||(h.style.transitionDuration=p.current.transitionDuration,h.style.animationName=p.current.animationName),c(n)}},[i.open,n]),l.jsx(Re.div,{"data-state":Ay(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!g,...o,ref:d,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:g&&s})});function Ay(e){return e?"open":"closed"}var t$=SN,r$=CN,n$=jN,Ms="Accordion",s$=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Dy,o$,i$]=bc(Ms),[ah,R$]=xr(Ms,[i$,bN]),Oy=bN(),EN=We.forwardRef((e,t)=>{const{type:r,...n}=e,s=n,o=n;return l.jsx(Dy.Provider,{scope:e.__scopeAccordion,children:r==="multiple"?l.jsx(u$,{...o,ref:t}):l.jsx(c$,{...s,ref:t})})});EN.displayName=Ms;var[NN,a$]=ah(Ms),[TN,l$]=ah(Ms,{collapsible:!1}),c$=We.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},collapsible:o=!1,...i}=e,[a,c]=on({prop:r,defaultProp:n,onChange:s});return l.jsx(NN,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:c,onItemClose:We.useCallback(()=>o&&c(""),[o,c]),children:l.jsx(TN,{scope:e.__scopeAccordion,collapsible:o,children:l.jsx(RN,{...i,ref:t})})})}),u$=We.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...o}=e,[i=[],a]=on({prop:r,defaultProp:n,onChange:s}),c=We.useCallback(d=>a((f=[])=>[...f,d]),[a]),u=We.useCallback(d=>a((f=[])=>f.filter(m=>m!==d)),[a]);return l.jsx(NN,{scope:e.__scopeAccordion,value:i,onItemOpen:c,onItemClose:u,children:l.jsx(TN,{scope:e.__scopeAccordion,collapsible:!0,children:l.jsx(RN,{...o,ref:t})})})}),[d$,lh]=ah(Ms),RN=We.forwardRef((e,t)=>{const{__scopeAccordion:r,disabled:n,dir:s,orientation:o="vertical",...i}=e,a=We.useRef(null),c=Ke(a,t),u=o$(r),f=Ea(s)==="ltr",m=ce(e.onKeyDown,y=>{var P;if(!s$.includes(y.key))return;const x=y.target,g=u().filter(A=>{var L;return!((L=A.ref.current)!=null&&L.disabled)}),_=g.findIndex(A=>A.ref.current===x),p=g.length;if(_===-1)return;y.preventDefault();let h=_;const w=0,C=p-1,j=()=>{h=_+1,h>C&&(h=w)},E=()=>{h=_-1,h{const{__scopeAccordion:r,value:n,...s}=e,o=lh(qd,r),i=a$(qd,r),a=Oy(r),c=Ur(),u=n&&i.value.includes(n)||!1,d=o.disabled||e.disabled;return l.jsx(f$,{scope:r,open:u,disabled:d,triggerId:c,children:l.jsx(t$,{"data-orientation":o.orientation,"data-state":LN(u),...a,...s,ref:t,disabled:d,open:u,onOpenChange:f=>{f?i.onItemOpen(n):i.onItemClose(n)}})})});PN.displayName=qd;var AN="AccordionHeader",DN=We.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(Ms,r),o=My(AN,r);return l.jsx(Re.h3,{"data-orientation":s.orientation,"data-state":LN(o.open),"data-disabled":o.disabled?"":void 0,...n,ref:t})});DN.displayName=AN;var Im="AccordionTrigger",ON=We.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(Ms,r),o=My(Im,r),i=l$(Im,r),a=Oy(r);return l.jsx(Dy.ItemSlot,{scope:r,children:l.jsx(r$,{"aria-disabled":o.open&&!i.collapsible||void 0,"data-orientation":s.orientation,id:o.triggerId,...a,...n,ref:t})})});ON.displayName=Im;var MN="AccordionContent",IN=We.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(Ms,r),o=My(MN,r),i=Oy(r);return l.jsx(n$,{role:"region","aria-labelledby":o.triggerId,"data-orientation":s.orientation,...i,...n,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});IN.displayName=MN;function LN(e){return e?"open":"closed"}var h$=EN,p$=PN,m$=DN,FN=ON,zN=IN;const ww=h$,ul=v.forwardRef(({className:e,...t},r)=>l.jsx(p$,{ref:r,className:ae("border-b",e),...t}));ul.displayName="AccordionItem";const dl=v.forwardRef(({className:e,children:t,...r},n)=>l.jsx(m$,{className:"flex",children:l.jsxs(FN,{ref:n,className:ae("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...r,children:[t,l.jsx(Lg,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));dl.displayName=FN.displayName;const fl=v.forwardRef(({className:e,children:t,...r},n)=>l.jsx(zN,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:l.jsx("div",{className:ae("pb-4 pt-0",e),children:t})}));fl.displayName=zN.displayName;const g$=()=>l.jsx(l.Fragment,{children:l.jsxs(HU,{children:[l.jsx("div",{className:"border rounded-sm p-5 shadow-lg",children:l.jsx(ww,{type:"multiple",className:"dark:text-stone-200",children:l.jsxs(ul,{value:"item-1",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"模板"}),l.jsx(fl,{children:l.jsx(KU,{})})]})})}),l.jsx("div",{className:"border rounded-md p-5 mt-7 shadow-lg",children:l.jsxs(ww,{type:"single",className:"dark:text-stone-200",children:[l.jsxs(ul,{value:"item-2",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"钉钉"}),l.jsx(fl,{children:l.jsx(YU,{})})]}),l.jsxs(ul,{value:"item-4",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"Telegram"}),l.jsx(fl,{children:l.jsx(GU,{})})]}),l.jsxs(ul,{value:"item-5",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"Webhook"}),l.jsx(fl,{children:l.jsx(XU,{})})]})]})})]})}),v$=FP([{path:"/",element:l.jsx(M3,{}),children:[{path:"/",element:l.jsx($U,{})},{path:"/domains",element:l.jsx(nz,{})},{path:"/edit",element:l.jsx(EU,{})},{path:"/access",element:l.jsx(AU,{})},{path:"/history",element:l.jsx(OU,{})},{path:"/setting",element:l.jsx(UU,{}),children:[{path:"/setting/password",element:l.jsx(zU,{})},{path:"/setting/account",element:l.jsx(WU,{})},{path:"/setting/notify",element:l.jsx(g$,{})}]}]},{path:"/login",element:l.jsx(LU,{}),children:[{path:"/login",element:l.jsx(IU,{})}]},{path:"/about",element:l.jsx("div",{children:"About"})}]);ip.createRoot(document.getElementById("root")).render(l.jsx(We.StrictMode,{children:l.jsx(N3,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(ZP,{router:v$})})}))});export default y$(); +8.8.4.4;`,..._,className:"placeholder:whitespace-pre-wrap"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})})},eN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));eN.displayName="Card";const tN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("flex flex-col space-y-1.5 p-6",e),...t}));tN.displayName="CardHeader";const rN=v.forwardRef(({className:e,...t},r)=>l.jsx("h3",{ref:r,className:ae("text-2xl font-semibold leading-none tracking-tight",e),...t}));rN.displayName="CardTitle";const nN=v.forwardRef(({className:e,...t},r)=>l.jsx("p",{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));nN.displayName="CardDescription";const sN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("p-6 pt-0",e),...t}));sN.displayName="CardContent";const oN=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("flex items-center p-6 pt-0",e),...t}));oN.displayName="CardFooter";const _o=e=>e instanceof Error?e.message:typeof e=="object"&&e!==null&&"message"in e?String(e.message):typeof e=="string"?e:"Something went wrong",NU=()=>{const{config:{accessGroups:e},reloadAccessGroups:t}=Kr(),{toast:r}=qn(),n=Nr(),s=async i=>{try{await b3(i),t()}catch(a){r({title:"删除失败",description:_o(a),variant:"destructive"});return}},o=()=>{n("/access")};return l.jsxs("div",{className:"mt-10",children:[l.jsx(na,{when:e.length==0,children:l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(v0,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),l.jsx(_y,{trigger:l.jsx(He,{children:"新增授权组"}),className:"mt-3"})]})})}),l.jsx(ih,{className:"h-[75vh] overflow-hidden",children:l.jsx("div",{className:"flex gap-5 flex-wrap",children:e.map(i=>l.jsxs(eN,{className:"w-full md:w-[350px]",children:[l.jsxs(tN,{children:[l.jsx(rN,{children:i.name}),l.jsxs(nN,{children:["共有",i.expand?i.expand.access.length:0,"个部署授权配置"]})]}),l.jsx(sN,{className:"min-h-[180px]",children:i.expand?l.jsx(l.Fragment,{children:i.expand.access.slice(0,3).map(a=>l.jsx("div",{className:"flex flex-col mb-3",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"",children:l.jsx("img",{src:xw(a.configType)[1],alt:"provider",className:"w-8 h-8"})}),l.jsxs("div",{className:"ml-3",children:[l.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:a.name}),l.jsx("div",{className:"text-xs text-muted-foreground",children:xw(a.configType)[0]})]})]})},a.id))}):l.jsx(l.Fragment,{children:l.jsxs("div",{className:"flex text-gray-700 dark:text-gray-200 items-center",children:[l.jsx("div",{children:l.jsx(v0,{size:40})}),l.jsx("div",{className:"ml-2",children:"暂无部署授权配置,请添加后开始使用吧"})]})})}),l.jsx(oN,{children:l.jsxs("div",{className:"flex justify-end w-full",children:[l.jsx(na,{when:!!(i.expand&&i.expand.access.length>0),children:l.jsx("div",{children:l.jsx(He,{size:"sm",variant:"link",onClick:()=>{n(`/access?accessGroupId=${i.id}&tab=access`,{replace:!0})},children:"所有授权"})})}),l.jsx(na,{when:!i.expand||i.expand.access.length==0,children:l.jsx("div",{children:l.jsx(He,{size:"sm",onClick:o,children:"新增授权"})})}),l.jsx("div",{className:"ml-3",children:l.jsxs(WC,{children:[l.jsx(BC,{asChild:!0,children:l.jsx(He,{variant:"destructive",size:"sm",children:"删除"})}),l.jsxs(qv,{children:[l.jsxs(Xv,{children:[l.jsx(Jv,{className:"dark:text-gray-200",children:"删除组"}),l.jsx(ey,{children:"确定要删除部署授权组吗?"})]}),l.jsxs(Qv,{children:[l.jsx(ry,{className:"dark:text-gray-200",children:"取消"}),l.jsx(ty,{onClick:()=>{s(i.id?i.id:"")},children:"确认"})]})]})]})})]})})]}))})})]})};var by="Tabs",[TU,T$]=xr(by,[kf]),iN=kf(),[RU,Sy]=TU(by),aN=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Ea(a),[f,m]=on({prop:n,onChange:s,defaultProp:o});return l.jsx(RU,{scope:r,baseId:Ur(),value:f,onValueChange:m,orientation:i,dir:d,activationMode:c,children:l.jsx(Re.div,{dir:d,"data-orientation":i,...u,ref:t})})});aN.displayName=by;var lN="TabsList",cN=v.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...s}=e,o=Sy(lN,r),i=iN(r);return l.jsx(Fb,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:n,children:l.jsx(Re.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});cN.displayName=lN;var uN="TabsTrigger",dN=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...o}=e,i=Sy(uN,r),a=iN(r),c=pN(i.baseId,n),u=mN(i.baseId,n),d=n===i.value;return l.jsx(zb,{asChild:!0,...a,focusable:!s,active:d,children:l.jsx(Re.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...o,ref:t,onMouseDown:ce(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?i.onValueChange(n):f.preventDefault()}),onKeyDown:ce(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(n)}),onFocus:ce(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!s&&f&&i.onValueChange(n)})})})});dN.displayName=uN;var fN="TabsContent",hN=v.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:s,children:o,...i}=e,a=Sy(fN,r),c=pN(a.baseId,n),u=mN(a.baseId,n),d=n===a.value,f=v.useRef(d);return v.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(ur,{present:s||d,children:({present:m})=>l.jsx(Re.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&o})})});hN.displayName=fN;function pN(e,t){return`${e}-trigger-${t}`}function mN(e,t){return`${e}-content-${t}`}var PU=aN,gN=cN,vN=dN,yN=hN;const xN=PU,ky=v.forwardRef(({className:e,...t},r)=>l.jsx(gN,{ref:r,className:ae("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));ky.displayName=gN.displayName;const ia=v.forwardRef(({className:e,...t},r)=>l.jsx(vN,{ref:r,className:ae("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));ia.displayName=vN.displayName;const Gd=v.forwardRef(({className:e,...t},r)=>l.jsx(yN,{ref:r,className:ae("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Gd.displayName=yN.displayName;const AU=()=>{const{config:e,deleteAccess:t}=Kr(),{accesses:r}=e,n=10,s=Math.ceil(r.length/n),o=Nr(),i=Nn(),a=new URLSearchParams(i.search),c=a.get("page"),u=c?Number(c):1,d=a.get("tab"),f=a.get("accessGroupId"),m=(u-1)*n,y=m+n,x=async _=>{const p=await _3(_);t(p.id)},g=_=>{a.set("tab",_),o({search:a.toString()})};return l.jsxs("div",{className:"",children:[l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:"授权管理"}),d!="access_group"?l.jsx(jl,{trigger:l.jsx(He,{children:"添加授权"}),op:"add"}):l.jsx(_y,{trigger:l.jsx(He,{children:"添加授权组"})})]}),l.jsxs(xN,{defaultValue:d||"access",value:d||"access",className:"w-full mt-5",children:[l.jsxs(ky,{className:"space-x-5 px-3",children:[l.jsx(ia,{value:"access",onClick:()=>{g("access")},children:"授权管理"}),l.jsx(ia,{value:"access_group",onClick:()=>{g("access_group")},children:"授权组管理"})]}),l.jsx(Gd,{value:"access",children:r.length===0?l.jsxs("div",{className:"flex flex-col items-center mt-10",children:[l.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:l.jsx(hA,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加授权开始部署证书吧。"}),l.jsx(jl,{trigger:l.jsx(He,{children:"添加授权"}),op:"add",className:"mt-3"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:"名称"}),l.jsx("div",{className:"w-48",children:"服务商"}),l.jsx("div",{className:"w-52",children:"创建时间"}),l.jsx("div",{className:"w-52",children:"更新时间"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"授权列表"}),r.filter(_=>f?_.group==f:!0).slice(m,y).map(_=>{var p,h;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:_.name}),l.jsxs("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center space-x-2",children:[l.jsx("img",{src:(p=uo.get(_.configType))==null?void 0:p[1],className:"w-6"}),l.jsx("div",{children:(h=uo.get(_.configType))==null?void 0:h[0]})]}),l.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["创建于"," ",_.created&&ga(_.created)]}),l.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["更新于"," ",_.updated&&ga(_.updated)]}),l.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[l.jsx(jl,{trigger:l.jsx(He,{variant:"link",className:"p-0",children:"编辑"}),op:"edit",data:_}),l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>{x(_)},children:"删除"})]})]},_.id)}),l.jsx(SC,{totalPages:s,currentPage:u,onPageChange:_=>{a.set("page",_.toString()),o({search:a.toString()})}})]})}),l.jsx(Gd,{value:"access_group",children:l.jsx(NU,{})})]})]})},DU=_c("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Cy=v.forwardRef(({className:e,variant:t,...r},n)=>l.jsx("div",{ref:n,role:"alert",className:ae(DU({variant:t}),e),...r}));Cy.displayName="Alert";const jy=v.forwardRef(({className:e,...t},r)=>l.jsx("h5",{ref:r,className:ae("mb-1 font-medium leading-none tracking-tight",e),...t}));jy.displayName="AlertTitle";const Ey=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:ae("text-sm [&_p]:leading-relaxed",e),...t}));Ey.displayName="AlertDescription";const wN=async e=>{let t=1;e.page&&(t=e.page);let r=50;e.perPage&&(r=e.perPage);let n="domain!=null";return e.domain&&(n=`domain="${e.domain}"`),await st().collection("deployments").getList(t,r,{filter:n,sort:"-deployedAt",expand:"domain"})},OU=()=>{const e=Nr(),[t,r]=v.useState(),[n]=JP(),s=n.get("domain");return v.useEffect(()=>{(async()=>{const i={};s&&(i.domain=s);const a=await wN(i);r(a.items)})()},[s]),l.jsxs(ih,{className:"h-[80vh] overflow-hidden",children:[l.jsx("div",{className:"text-muted-foreground",children:"部署历史"}),t!=null&&t.length?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:"域名"}),l.jsx("div",{className:"w-24",children:"状态"}),l.jsx("div",{className:"w-56",children:"阶段"}),l.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),t==null?void 0:t.map(o=>{var i,a;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(i=o.expand.domain)==null?void 0:i.domain}),l.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Gv,{deployment:o})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Hv,{phase:o.phase,phaseSuccess:o.phaseSuccess})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:ga(o.deployedAt)}),l.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:l.jsxs(yv,{children:[l.jsx(xv,{asChild:!0,children:l.jsx(He,{variant:"link",className:"p-0",children:"日志"})}),l.jsxs(Rf,{className:"sm:max-w-5xl",children:[l.jsx(wv,{children:l.jsxs(_v,{children:[(a=o.expand.domain)==null?void 0:a.domain,"-",o.id,"部署详情"]})}),l.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[o.log.check&&l.jsx(l.Fragment,{children:o.log.check.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.apply&&l.jsx(l.Fragment,{children:o.log.apply.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.info&&c.info.map(u=>l.jsx("div",{className:"mt-1 text-green-600",children:u})),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.deploy&&l.jsx(l.Fragment,{children:o.log.deploy.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))})]})]})]})})]},o.id)})]}):l.jsx(l.Fragment,{children:l.jsxs(Cy,{className:"max-w-[40em] mx-auto mt-20",children:[l.jsx(jy,{children:"暂无数据"}),l.jsxs(Ey,{children:[l.jsxs("div",{className:"flex items-center mt-5",children:[l.jsx("div",{children:l.jsx(tb,{className:"text-yellow-400",size:36})}),l.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),l.jsx("div",{className:"mt-2 flex justify-end",children:l.jsx(He,{onClick:()=>{e("/")},children:"添加域名"})})]})]})})]})},MU=pe.object({username:pe.string().email({message:"请输入正确的邮箱地址"}),password:pe.string().min(10,{message:"密码至少10个字符"})}),IU=()=>{const e=Tr({resolver:Rr(MU),defaultValues:{username:"",password:""}}),t=async n=>{try{await st().admins.authWithPassword(n.username,n.password),r("/")}catch(s){const o=_o(s);e.setError("username",{message:o}),e.setError("password",{message:o})}},r=Nr();return l.jsxs("div",{className:"max-w-[35em] border dark:border-stone-500 mx-auto mt-32 p-10 rounded-md shadow-md",children:[l.jsx("div",{className:"flex justify-center mb-10",children:l.jsx("img",{src:"/vite.svg",className:"w-16"})}),l.jsx(Pr,{...e,children:l.jsxs("form",{onSubmit:e.handleSubmit(t),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:e.control,name:"username",render:({field:n})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"用户名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"email",...n})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:e.control,name:"password",render:({field:n})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"password",...n,type:"password"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"登录"})})]})})]})},LU=()=>st().authStore.isValid&&st().authStore.isAdmin?l.jsx(Q1,{to:"/"}):l.jsxs("div",{className:"container",children:[l.jsx(Ig,{}),l.jsx(cC,{})]}),FU=pe.object({oldPassword:pe.string().min(10,{message:"密码至少10个字符"}),newPassword:pe.string().min(10,{message:"密码至少10个字符"}),confirmPassword:pe.string().min(10,{message:"密码至少10个字符"})}).refine(e=>e.newPassword===e.confirmPassword,{message:"两次密码不一致",path:["confirmPassword"]}),zU=()=>{const{toast:e}=qn(),t=Nr(),r=Tr({resolver:Rr(FU),defaultValues:{oldPassword:"",newPassword:"",confirmPassword:""}}),n=async s=>{var o,i;try{await st().admins.authWithPassword((o=st().authStore.model)==null?void 0:o.email,s.oldPassword)}catch(a){const c=_o(a);r.setError("oldPassword",{message:c})}try{await st().admins.update((i=st().authStore.model)==null?void 0:i.id,{password:s.newPassword,passwordConfirm:s.confirmPassword}),st().authStore.clear(),e({title:"修改密码成功",description:"请重新登录"}),setTimeout(()=>{t("/login")},500)}catch(a){const c=_o(a);e({title:"修改密码失败",description:c,variant:"destructive"})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"w-full md:max-w-[35em]",children:l.jsx(Pr,{...r,children:l.jsxs("form",{onSubmit:r.handleSubmit(n),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:r.control,name:"oldPassword",render:({field:s})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"当前密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"当前密码",...s,type:"password"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:r.control,name:"newPassword",render:({field:s})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"新密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"newPassword",...s,type:"password"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:r.control,name:"confirmPassword",render:({field:s})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"确认密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"confirmPassword",...s,type:"password"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"确认修改"})})]})})})})},UU=()=>{const e=Nn(),[t,r]=v.useState("account"),n=Nr();return v.useEffect(()=>{const o=e.pathname.split("/")[2];r(o)},[e]),l.jsxs("div",{children:[l.jsx(ay,{}),l.jsx("div",{className:"text-muted-foreground border-b dark:border-stone-500 py-5",children:"偏好设置"}),l.jsx("div",{className:"w-full mt-5 p-0 md:p-3 flex justify-center",children:l.jsxs(xN,{defaultValue:"account",className:"w-full",value:t,children:[l.jsxs(ky,{className:"mx-auto",children:[l.jsxs(ia,{value:"account",onClick:()=>{n("/setting/account")},className:"px-5",children:[l.jsx(wA,{size:14}),l.jsx("div",{className:"ml-1",children:"账户"})]}),l.jsxs(ia,{value:"password",onClick:()=>{n("/setting/password")},className:"px-5",children:[l.jsx(fA,{size:14}),l.jsx("div",{className:"ml-1",children:"密码"})]}),l.jsxs(ia,{value:"notify",onClick:()=>{n("/setting/notify")},className:"px-5",children:[l.jsx(mA,{size:14}),l.jsx("div",{className:"ml-1",children:"消息推送"})]})]}),l.jsx(Gd,{value:t,children:l.jsx("div",{className:"mt-5 w-full md:w-[45em]",children:l.jsx(Ig,{})})})]})})]})},$U=()=>{const[e,t]=v.useState(),[r,n]=v.useState(),s=Nr();return v.useEffect(()=>{(async()=>{const i=await Q6();t(i)})()},[]),v.useEffect(()=>{(async()=>{const a=await wN({perPage:8});n(a.items)})()},[]),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("div",{className:"flex justify-between items-center",children:l.jsx("div",{className:"text-muted-foreground",children:"控制面板"})}),l.jsxs("div",{className:"flex mt-10 gap-5 flex-col flex-wrap md:flex-row",children:[l.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[l.jsx("div",{className:"p-3",children:l.jsx(yA,{size:48,strokeWidth:1,className:"text-blue-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"所有"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.total?l.jsx(fr,{to:"/domains",className:"hover:underline",children:e==null?void 0:e.total}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),l.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[l.jsx("div",{className:"p-3",children:l.jsx(oA,{size:48,strokeWidth:1,className:"text-red-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"即将过期"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.expired?l.jsx(fr,{to:"/domains?state=expired",className:"hover:underline",children:e==null?void 0:e.expired}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),l.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[l.jsx("div",{className:"p-3",children:l.jsx(pA,{size:48,strokeWidth:1,className:"text-green-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"启用中"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.enabled?l.jsx(fr,{to:"/domains?state=enabled",className:"hover:underline",children:e==null?void 0:e.enabled}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),l.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[l.jsx("div",{className:"p-3",children:l.jsx(nA,{size:48,strokeWidth:1,className:"text-gray-400"})}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground font-semibold",children:"未启用"}),l.jsxs("div",{className:"flex items-baseline",children:[l.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.disabled?l.jsx(fr,{to:"/domains?state=disabled",className:"hover:underline",children:e==null?void 0:e.disabled}):0}),l.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground mt-5 text-sm",children:"部署历史"}),(r==null?void 0:r.length)==0?l.jsx(l.Fragment,{children:l.jsxs(Cy,{className:"max-w-[40em] mt-10",children:[l.jsx(jy,{children:"暂无数据"}),l.jsxs(Ey,{children:[l.jsxs("div",{className:"flex items-center mt-5",children:[l.jsx("div",{children:l.jsx(tb,{className:"text-yellow-400",size:36})}),l.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),l.jsx("div",{className:"mt-2 flex justify-end",children:l.jsx(He,{onClick:()=>{s("/edit")},children:"添加域名"})})]})]})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b dark:border-stone-500 sm:p-2 mt-5",children:[l.jsx("div",{className:"w-48",children:"域名"}),l.jsx("div",{className:"w-24",children:"状态"}),l.jsx("div",{className:"w-56",children:"阶段"}),l.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),r==null?void 0:r.map(o=>{var i,a;return l.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b dark:border-stone-500 sm:p-2 hover:bg-muted/50 text-sm",children:[l.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(i=o.expand.domain)==null?void 0:i.domain}),l.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Gv,{deployment:o})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx(Hv,{phase:o.phase,phaseSuccess:o.phaseSuccess})}),l.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:ga(o.deployedAt)}),l.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:l.jsxs(yv,{children:[l.jsx(xv,{asChild:!0,children:l.jsx(He,{variant:"link",className:"p-0",children:"日志"})}),l.jsxs(Rf,{className:"sm:max-w-5xl",children:[l.jsx(wv,{children:l.jsxs(_v,{children:[(a=o.expand.domain)==null?void 0:a.domain,"-",o.id,"部署详情"]})}),l.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[o.log.check&&l.jsx(l.Fragment,{children:o.log.check.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.apply&&l.jsx(l.Fragment,{children:o.log.apply.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.info&&c.info.map(u=>l.jsx("div",{className:"mt-1 text-green-600",children:u})),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.deploy&&l.jsx(l.Fragment,{children:o.log.deploy.map(c=>l.jsxs("div",{className:"flex flex-col mt-2",children:[l.jsxs("div",{className:"flex",children:[l.jsxs("div",{children:["[",c.time,"]"]}),l.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&l.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))})]})]})]})})]},o.id)})]})]})]})},VU=pe.object({email:pe.string().email("请输入正确的邮箱")}),WU=()=>{var i;const{toast:e}=qn(),t=Nr(),[r,n]=v.useState(!1),s=Tr({resolver:Rr(VU),defaultValues:{email:(i=st().authStore.model)==null?void 0:i.email}}),o=async a=>{var c;try{await st().admins.update((c=st().authStore.model)==null?void 0:c.id,{email:a.email}),st().authStore.clear(),e({title:"修改账户邮箱功",description:"请重新登录"}),setTimeout(()=>{t("/login")},500)}catch(u){const d=_o(u);e({title:"修改账户邮箱失败",description:d,variant:"destructive"})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"w-full md:max-w-[35em]",children:l.jsx(Pr,{...s,children:l.jsxs("form",{onSubmit:s.handleSubmit(o),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:s.control,name:"email",render:({field:a})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"邮箱"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入邮箱",...a,type:"email",onChange:c=>{n(!0),s.setValue("email",c.target.value)}})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:r?l.jsx(He,{type:"submit",children:"确认修改"}):l.jsx(He,{type:"submit",disabled:!0,variant:"secondary",children:"确认修改"})})]})})})})},BU=(e,t)=>{switch(t.type){case"SET_CHANNEL":{const r=t.payload.channel;return{...e,content:{...e.content,[r]:t.payload.data}}}case"SET_CHANNELS":return{...t.payload};default:return e}},_N=v.createContext({}),Ny=()=>v.useContext(_N),HU=({children:e})=>{const[t,r]=v.useReducer(BU,{});v.useEffect(()=>{(async()=>{const i=await sC("notifyChannels");r({type:"SET_CHANNELS",payload:i})})()},[]);const n=v.useCallback(o=>{r({type:"SET_CHANNEL",payload:o})},[]),s=v.useCallback(o=>{r({type:"SET_CHANNELS",payload:o})},[]);return l.jsx(_N.Provider,{value:{config:t,setChannel:n,setChannels:s},children:e})},YU=()=>{const{config:e,setChannels:t}=Ny(),[r,n]=v.useState({id:e.id??"",name:"notifyChannels",data:{accessToken:"",secret:"",enabled:!1}});v.useEffect(()=>{const a=(()=>{const c={accessToken:"",secret:"",enabled:!1};if(!e.content)return c;const u=e.content;return u.dingtalk?u.dingtalk:c})();n({id:e.id??"",name:"dingtalk",data:a})},[e]);const{toast:s}=qn(),o=async()=>{try{const i=await Mc({...e,name:"notifyChannels",content:{...e.content,dingtalk:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const a=_o(i);s({title:"保存失败",description:"配置保存失败:"+a,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(Te,{placeholder:"AccessToken",value:r.data.accessToken,onChange:i=>{n({...r,data:{...r.data,accessToken:i.target.value}})}}),l.jsx(Te,{placeholder:"加签的签名",className:"mt-2",value:r.data.secret,onChange:i=>{n({...r,data:{...r.data,secret:i.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(Lc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Ma,{htmlFor:"airplane-mode",children:"是否启用"})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:()=>{o()},children:"保存"})})]})},ZU={title:"您有{COUNT}张证书即将过期",content:"有{COUNT}张证书即将过期,域名分别为{DOMAINS},请保持关注!"},KU=()=>{const[e,t]=v.useState(""),[r,n]=v.useState([ZU]),{toast:s}=qn();v.useEffect(()=>{(async()=>{const u=await sC("templates");u.content&&(n(u.content.notifyTemplates),t(u.id?u.id:""))})()},[]);const o=c=>{const u=r[0];n([{...u,title:c}])},i=c=>{const u=r[0];n([{...u,content:c}])},a=async()=>{const c=await Mc({id:e,content:{notifyTemplates:r},name:"templates"});c.id&&t(c.id),s({title:"保存成功",description:"通知模板保存成功"})};return l.jsxs("div",{children:[l.jsx(Te,{value:r[0].title,onChange:c=>{o(c.target.value)}}),l.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:"可选的变量, COUNT:即将过期张数"}),l.jsx(mc,{className:"mt-2",value:r[0].content,onChange:c=>{i(c.target.value)}}),l.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:"可选的变量, COUNT:即将过期张数,DOMAINS:域名列表"}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:a,children:"保存"})})]})},GU=()=>{const{config:e,setChannels:t}=Ny(),[r,n]=v.useState({id:e.id??"",name:"notifyChannels",data:{apiToken:"",chatId:"",enabled:!1}});v.useEffect(()=>{const a=(()=>{const c={apiToken:"",chatId:"",enabled:!1};if(!e.content)return c;const u=e.content;return u.telegram?u.telegram:c})();n({id:e.id??"",name:"telegram",data:a})},[e]);const{toast:s}=qn(),o=async()=>{try{const i=await Mc({...e,name:"notifyChannels",content:{...e.content,telegram:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const a=_o(i);s({title:"保存失败",description:"配置保存失败:"+a,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(Te,{placeholder:"ApiToken",value:r.data.apiToken,onChange:i=>{n({...r,data:{...r.data,apiToken:i.target.value}})}}),l.jsx(Te,{placeholder:"ChatId",value:r.data.chatId,onChange:i=>{n({...r,data:{...r.data,chatId:i.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(Lc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Ma,{htmlFor:"airplane-mode",children:"是否启用"})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:()=>{o()},children:"保存"})})]})};function qU(e){try{return new URL(e),!0}catch{return!1}}const XU=()=>{const{config:e,setChannels:t}=Ny(),[r,n]=v.useState({id:e.id??"",name:"notifyChannels",data:{url:"",enabled:!1}});v.useEffect(()=>{const a=(()=>{const c={url:"",enabled:!1};if(!e.content)return c;const u=e.content;return u.webhook?u.webhook:c})();n({id:e.id??"",name:"webhook",data:a})},[e]);const{toast:s}=qn(),o=async()=>{try{if(r.data.url=r.data.url.trim(),!qU(r.data.url)){s({title:"保存失败",description:"Url格式不正确",variant:"destructive"});return}const i=await Mc({...e,name:"notifyChannels",content:{...e.content,webhook:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const a=_o(i);s({title:"保存失败",description:"配置保存失败:"+a,variant:"destructive"})}};return l.jsxs("div",{children:[l.jsx(Te,{placeholder:"Url",value:r.data.url,onChange:i=>{n({...r,data:{...r.data,url:i.target.value}})}}),l.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[l.jsx(Lc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),l.jsx(Ma,{htmlFor:"airplane-mode",children:"是否启用"})]}),l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx(He,{onClick:()=>{o()},children:"保存"})})]})};var Ty="Collapsible",[QU,bN]=xr(Ty),[JU,Ry]=QU(Ty),SN=v.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:o,onOpenChange:i,...a}=e,[c=!1,u]=on({prop:n,defaultProp:s,onChange:i});return l.jsx(JU,{scope:r,disabled:o,contentId:Ur(),open:c,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:l.jsx(Re.div,{"data-state":Ay(c),"data-disabled":o?"":void 0,...a,ref:t})})});SN.displayName=Ty;var kN="CollapsibleTrigger",CN=v.forwardRef((e,t)=>{const{__scopeCollapsible:r,...n}=e,s=Ry(kN,r);return l.jsx(Re.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Ay(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:t,onClick:ce(e.onClick,s.onOpenToggle)})});CN.displayName=kN;var Py="CollapsibleContent",jN=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Ry(Py,e.__scopeCollapsible);return l.jsx(ur,{present:r||s.open,children:({present:o})=>l.jsx(e$,{...n,ref:t,present:o})})});jN.displayName=Py;var e$=v.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:n,children:s,...o}=e,i=Ry(Py,r),[a,c]=v.useState(n),u=v.useRef(null),d=Ke(t,u),f=v.useRef(0),m=f.current,y=v.useRef(0),x=y.current,g=i.open||a,_=v.useRef(g),p=v.useRef();return v.useEffect(()=>{const h=requestAnimationFrame(()=>_.current=!1);return()=>cancelAnimationFrame(h)},[]),Jt(()=>{const h=u.current;if(h){p.current=p.current||{transitionDuration:h.style.transitionDuration,animationName:h.style.animationName},h.style.transitionDuration="0s",h.style.animationName="none";const w=h.getBoundingClientRect();f.current=w.height,y.current=w.width,_.current||(h.style.transitionDuration=p.current.transitionDuration,h.style.animationName=p.current.animationName),c(n)}},[i.open,n]),l.jsx(Re.div,{"data-state":Ay(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!g,...o,ref:d,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:g&&s})});function Ay(e){return e?"open":"closed"}var t$=SN,r$=CN,n$=jN,Ms="Accordion",s$=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Dy,o$,i$]=bc(Ms),[ah,R$]=xr(Ms,[i$,bN]),Oy=bN(),EN=We.forwardRef((e,t)=>{const{type:r,...n}=e,s=n,o=n;return l.jsx(Dy.Provider,{scope:e.__scopeAccordion,children:r==="multiple"?l.jsx(u$,{...o,ref:t}):l.jsx(c$,{...s,ref:t})})});EN.displayName=Ms;var[NN,a$]=ah(Ms),[TN,l$]=ah(Ms,{collapsible:!1}),c$=We.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},collapsible:o=!1,...i}=e,[a,c]=on({prop:r,defaultProp:n,onChange:s});return l.jsx(NN,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:c,onItemClose:We.useCallback(()=>o&&c(""),[o,c]),children:l.jsx(TN,{scope:e.__scopeAccordion,collapsible:o,children:l.jsx(RN,{...i,ref:t})})})}),u$=We.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...o}=e,[i=[],a]=on({prop:r,defaultProp:n,onChange:s}),c=We.useCallback(d=>a((f=[])=>[...f,d]),[a]),u=We.useCallback(d=>a((f=[])=>f.filter(m=>m!==d)),[a]);return l.jsx(NN,{scope:e.__scopeAccordion,value:i,onItemOpen:c,onItemClose:u,children:l.jsx(TN,{scope:e.__scopeAccordion,collapsible:!0,children:l.jsx(RN,{...o,ref:t})})})}),[d$,lh]=ah(Ms),RN=We.forwardRef((e,t)=>{const{__scopeAccordion:r,disabled:n,dir:s,orientation:o="vertical",...i}=e,a=We.useRef(null),c=Ke(a,t),u=o$(r),f=Ea(s)==="ltr",m=ce(e.onKeyDown,y=>{var P;if(!s$.includes(y.key))return;const x=y.target,g=u().filter(A=>{var L;return!((L=A.ref.current)!=null&&L.disabled)}),_=g.findIndex(A=>A.ref.current===x),p=g.length;if(_===-1)return;y.preventDefault();let h=_;const w=0,C=p-1,j=()=>{h=_+1,h>C&&(h=w)},E=()=>{h=_-1,h{const{__scopeAccordion:r,value:n,...s}=e,o=lh(qd,r),i=a$(qd,r),a=Oy(r),c=Ur(),u=n&&i.value.includes(n)||!1,d=o.disabled||e.disabled;return l.jsx(f$,{scope:r,open:u,disabled:d,triggerId:c,children:l.jsx(t$,{"data-orientation":o.orientation,"data-state":LN(u),...a,...s,ref:t,disabled:d,open:u,onOpenChange:f=>{f?i.onItemOpen(n):i.onItemClose(n)}})})});PN.displayName=qd;var AN="AccordionHeader",DN=We.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(Ms,r),o=My(AN,r);return l.jsx(Re.h3,{"data-orientation":s.orientation,"data-state":LN(o.open),"data-disabled":o.disabled?"":void 0,...n,ref:t})});DN.displayName=AN;var Im="AccordionTrigger",ON=We.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(Ms,r),o=My(Im,r),i=l$(Im,r),a=Oy(r);return l.jsx(Dy.ItemSlot,{scope:r,children:l.jsx(r$,{"aria-disabled":o.open&&!i.collapsible||void 0,"data-orientation":s.orientation,id:o.triggerId,...a,...n,ref:t})})});ON.displayName=Im;var MN="AccordionContent",IN=We.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(Ms,r),o=My(MN,r),i=Oy(r);return l.jsx(n$,{role:"region","aria-labelledby":o.triggerId,"data-orientation":s.orientation,...i,...n,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});IN.displayName=MN;function LN(e){return e?"open":"closed"}var h$=EN,p$=PN,m$=DN,FN=ON,zN=IN;const ww=h$,ul=v.forwardRef(({className:e,...t},r)=>l.jsx(p$,{ref:r,className:ae("border-b",e),...t}));ul.displayName="AccordionItem";const dl=v.forwardRef(({className:e,children:t,...r},n)=>l.jsx(m$,{className:"flex",children:l.jsxs(FN,{ref:n,className:ae("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...r,children:[t,l.jsx(Lg,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));dl.displayName=FN.displayName;const fl=v.forwardRef(({className:e,children:t,...r},n)=>l.jsx(zN,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:l.jsx("div",{className:ae("pb-4 pt-0",e),children:t})}));fl.displayName=zN.displayName;const g$=()=>l.jsx(l.Fragment,{children:l.jsxs(HU,{children:[l.jsx("div",{className:"border rounded-sm p-5 shadow-lg",children:l.jsx(ww,{type:"multiple",className:"dark:text-stone-200",children:l.jsxs(ul,{value:"item-1",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"模板"}),l.jsx(fl,{children:l.jsx(KU,{})})]})})}),l.jsx("div",{className:"border rounded-md p-5 mt-7 shadow-lg",children:l.jsxs(ww,{type:"single",className:"dark:text-stone-200",children:[l.jsxs(ul,{value:"item-2",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"钉钉"}),l.jsx(fl,{children:l.jsx(YU,{})})]}),l.jsxs(ul,{value:"item-4",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"Telegram"}),l.jsx(fl,{children:l.jsx(GU,{})})]}),l.jsxs(ul,{value:"item-5",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"Webhook"}),l.jsx(fl,{children:l.jsx(XU,{})})]})]})})]})}),v$=FP([{path:"/",element:l.jsx(M3,{}),children:[{path:"/",element:l.jsx($U,{})},{path:"/domains",element:l.jsx(nz,{})},{path:"/edit",element:l.jsx(EU,{})},{path:"/access",element:l.jsx(AU,{})},{path:"/history",element:l.jsx(OU,{})},{path:"/setting",element:l.jsx(UU,{}),children:[{path:"/setting/password",element:l.jsx(zU,{})},{path:"/setting/account",element:l.jsx(WU,{})},{path:"/setting/notify",element:l.jsx(g$,{})}]}]},{path:"/login",element:l.jsx(LU,{}),children:[{path:"/login",element:l.jsx(IU,{})}]},{path:"/about",element:l.jsx("div",{children:"About"})}]);ip.createRoot(document.getElementById("root")).render(l.jsx(We.StrictMode,{children:l.jsx(N3,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(ZP,{router:v$})})}))});export default y$(); diff --git a/ui/src/pages/login/Login.tsx b/ui/src/pages/login/Login.tsx index d023a9b9..23e2f9d2 100644 --- a/ui/src/pages/login/Login.tsx +++ b/ui/src/pages/login/Login.tsx @@ -78,7 +78,7 @@ const Login = () => { 密码 - +