From 45e218dd5b8d36d22b7cdf5dda57cc2c39258a7e Mon Sep 17 00:00:00 2001 From: liburdi Date: Thu, 26 Sep 2024 18:50:50 +0800 Subject: [PATCH 1/5] feat: optimize placeholder --- ui/dist/assets/index-B-WSkv0U.js | 2 +- ui/src/pages/login/Login.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 = () => { 密码 - + From 5be1139c1abfe2c41a66db2cfe39db094fa2d286 Mon Sep 17 00:00:00 2001 From: liburdi Date: Thu, 26 Sep 2024 18:55:19 +0800 Subject: [PATCH 2/5] docs: update readme --- README.md | 1 + README_EN.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index f99c5a74..e94c2d5f 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ git clone git@github.com:usual2970/certimate.git && cd certimate/docker && docke ```bash git clone EMAIL:usual2970/certimate.git cd certimate +go mod vendor go run main.go serve ``` diff --git a/README_EN.md b/README_EN.md index 6dd766af..5a0cc551 100644 --- a/README_EN.md +++ b/README_EN.md @@ -56,6 +56,7 @@ git clone git@github.com:usual2970/certimate.git && cd certimate/docker && docke ```bash git clone EMAIL:usual2970/certimate.git cd certimate +go mod vendor go run main.go serve ``` From ead8e1fec571dc0f63076ed10f4a2928c9119eb1 Mon Sep 17 00:00:00 2001 From: liburdi Date: Thu, 26 Sep 2024 19:13:48 +0800 Subject: [PATCH 3/5] feat: npm run build --- .../{index-B-WSkv0U.js => index-GtUlLYeZ.js} | 18 +- ui/dist/index.html | 2 +- ui/package-lock.json | 186 +++++++++--------- ui/package.json | 2 +- 4 files changed, 106 insertions(+), 102 deletions(-) rename ui/dist/assets/{index-B-WSkv0U.js => index-GtUlLYeZ.js} (94%) diff --git a/ui/dist/assets/index-B-WSkv0U.js b/ui/dist/assets/index-GtUlLYeZ.js similarity index 94% rename from ui/dist/assets/index-B-WSkv0U.js rename to ui/dist/assets/index-GtUlLYeZ.js index ebc4d713..ec7953f5 100644 --- a/ui/dist/assets/index-B-WSkv0U.js +++ b/ui/dist/assets/index-GtUlLYeZ.js @@ -1,4 +1,4 @@ -var HN=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var y$=HN((P$,Gu)=>{function _w(e,t){for(var r=0;rn[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();var Kc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bw={exports:{}},Xd={},Sw={exports:{}},tt={};/** +var HN=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var v$=HN((R$,Gu)=>{function _w(e,t){for(var r=0;rn[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();var Kc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bw={exports:{}},Xd={},Sw={exports:{}},tt={};/** * @license React * react.production.min.js * @@ -271,26 +271,26 @@ Error generating stack: `+o.message+` `)},V0=function(){var e=parseInt(document.body.getAttribute(Xi)||"0",10);return isFinite(e)?e:0},vM=function(){v.useEffect(function(){return document.body.setAttribute(Xi,(V0()+1).toString()),function(){var e=V0()-1;e<=0?document.body.removeAttribute(Xi):document.body.setAttribute(Xi,e.toString())}},[])},yM=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;vM();var o=v.useMemo(function(){return pM(s)},[s]);return v.createElement(mM,{styles:gM(o,!t,s,r?"":"!important")})},cm=!1;if(typeof window<"u")try{var vu=Object.defineProperty({},"passive",{get:function(){return cm=!0,!0}});window.addEventListener("test",vu,vu),window.removeEventListener("test",vu,vu)}catch{cm=!1}var _i=cm?{passive:!1}:!1,xM=function(e){return e.tagName==="TEXTAREA"},Hb=function(e,t){var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!xM(e)&&r[t]==="visible")},wM=function(e){return Hb(e,"overflowY")},_M=function(e){return Hb(e,"overflowX")},W0=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=Yb(e,n);if(s){var o=Zb(e,n),i=o[1],a=o[2];if(i>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},bM=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},SM=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Yb=function(e,t){return e==="v"?wM(t):_M(t)},Zb=function(e,t){return e==="v"?bM(t):SM(t)},kM=function(e,t){return e==="h"&&t==="rtl"?-1:1},CM=function(e,t,r,n,s){var o=kM(e,window.getComputedStyle(t).direction),i=o*n,a=r.target,c=t.contains(a),u=!1,d=i>0,f=0,m=0;do{var y=Zb(e,a),x=y[0],g=y[1],_=y[2],p=g-_-o*x;(x||p)&&Yb(e,a)&&(f+=p,m+=x),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&(Math.abs(f)<1||!s)||!d&&(Math.abs(m)<1||!s))&&(u=!0),u},yu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},B0=function(e){return[e.deltaX,e.deltaY]},H0=function(e){return e&&"current"in e?e.current:e},jM=function(e,t){return e[0]===t[0]&&e[1]===t[1]},EM=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},NM=0,bi=[];function TM(e){var t=v.useRef([]),r=v.useRef([0,0]),n=v.useRef(),s=v.useState(NM++)[0],o=v.useState(Bb)[0],i=v.useRef(e);v.useEffect(function(){i.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=qO([e.lockRef.current],(e.shards||[]).map(H0),!0).filter(Boolean);return g.forEach(function(_){return _.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(g,_){if("touches"in g&&g.touches.length===2)return!i.current.allowPinchZoom;var p=yu(g),h=r.current,w="deltaX"in g?g.deltaX:h[0]-p[0],C="deltaY"in g?g.deltaY:h[1]-p[1],j,E=g.target,R=Math.abs(w)>Math.abs(C)?"h":"v";if("touches"in g&&R==="h"&&E.type==="range")return!1;var P=W0(R,E);if(!P)return!0;if(P?j=R:(j=R==="v"?"h":"v",P=W0(R,E)),!P)return!1;if(!n.current&&"changedTouches"in g&&(w||C)&&(n.current=j),!j)return!0;var A=n.current||j;return CM(A,_,g,A==="h"?w:C,!0)},[]),c=v.useCallback(function(g){var _=g;if(!(!bi.length||bi[bi.length-1]!==o)){var p="deltaY"in _?B0(_):yu(_),h=t.current.filter(function(j){return j.name===_.type&&(j.target===_.target||_.target===j.shadowParent)&&jM(j.delta,p)})[0];if(h&&h.should){_.cancelable&&_.preventDefault();return}if(!h){var w=(i.current.shards||[]).map(H0).filter(Boolean).filter(function(j){return j.contains(_.target)}),C=w.length>0?a(_,w[0]):!i.current.noIsolation;C&&_.cancelable&&_.preventDefault()}}},[]),u=v.useCallback(function(g,_,p,h){var w={name:g,delta:_,target:p,should:h,shadowParent:RM(p)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(C){return C!==w})},1)},[]),d=v.useCallback(function(g){r.current=yu(g),n.current=void 0},[]),f=v.useCallback(function(g){u(g.type,B0(g),g.target,a(g,e.lockRef.current))},[]),m=v.useCallback(function(g){u(g.type,yu(g),g.target,a(g,e.lockRef.current))},[]);v.useEffect(function(){return bi.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,_i),document.addEventListener("touchmove",c,_i),document.addEventListener("touchstart",d,_i),function(){bi=bi.filter(function(g){return g!==o}),document.removeEventListener("wheel",c,_i),document.removeEventListener("touchmove",c,_i),document.removeEventListener("touchstart",d,_i)}},[]);var y=e.removeScrollBar,x=e.inert;return v.createElement(v.Fragment,null,x?v.createElement(o,{styles:EM(s)}):null,y?v.createElement(yM,{gapMode:e.gapMode}):null)}function RM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const PM=oM(Wb,TM);var jf=v.forwardRef(function(e,t){return v.createElement(Cf,In({},e,{ref:t,sideCar:PM}))});jf.classNames=Cf.classNames;var um=["Enter"," "],AM=["ArrowDown","PageUp","Home"],Kb=["ArrowUp","PageDown","End"],DM=[...AM,...Kb],OM={ltr:[...um,"ArrowRight"],rtl:[...um,"ArrowLeft"]},MM={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Cc="Menu",[Gl,IM,LM]=bc(Cc),[ci,Gb]=xr(Cc,[LM,Pa,kf]),Ef=Pa(),qb=kf(),[FM,ui]=ci(Cc),[zM,jc]=ci(Cc),Xb=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:s,onOpenChange:o,modal:i=!0}=e,a=Ef(t),[c,u]=v.useState(null),d=v.useRef(!1),f=Dt(o),m=Ea(s);return v.useEffect(()=>{const y=()=>{d.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>d.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),l.jsx(Xg,{...a,children:l.jsx(FM,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:l.jsx(zM,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:i,children:n})})})};Xb.displayName=Cc;var UM="MenuAnchor",rv=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Ef(r);return l.jsx(Qg,{...s,...n,ref:t})});rv.displayName=UM;var nv="MenuPortal",[$M,Qb]=ci(nv,{forceMount:void 0}),Jb=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:s}=e,o=ui(nv,t);return l.jsx($M,{scope:t,forceMount:r,children:l.jsx(ur,{present:r||o.open,children:l.jsx(kc,{asChild:!0,container:s,children:n})})})};Jb.displayName=nv;var rn="MenuContent",[VM,sv]=ci(rn),eS=v.forwardRef((e,t)=>{const r=Qb(rn,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=ui(rn,e.__scopeMenu),i=jc(rn,e.__scopeMenu);return l.jsx(Gl.Provider,{scope:e.__scopeMenu,children:l.jsx(ur,{present:n||o.open,children:l.jsx(Gl.Slot,{scope:e.__scopeMenu,children:i.modal?l.jsx(WM,{...s,ref:t}):l.jsx(BM,{...s,ref:t})})})})}),WM=v.forwardRef((e,t)=>{const r=ui(rn,e.__scopeMenu),n=v.useRef(null),s=Ke(t,n);return v.useEffect(()=>{const o=n.current;if(o)return tv(o)},[]),l.jsx(ov,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ce(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),BM=v.forwardRef((e,t)=>{const r=ui(rn,e.__scopeMenu);return l.jsx(ov,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),ov=v.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:y,disableOutsideScroll:x,...g}=e,_=ui(rn,r),p=jc(rn,r),h=Ef(r),w=qb(r),C=IM(r),[j,E]=v.useState(null),R=v.useRef(null),P=Ke(t,R,_.onContentChange),A=v.useRef(0),L=v.useRef(""),q=v.useRef(0),N=v.useRef(null),F=v.useRef("right"),b=v.useRef(0),V=x?jf:v.Fragment,te=x?{as:bs,allowPinchZoom:!0}:void 0,W=I=>{var he,ye;const Q=L.current+I,z=C().filter(ke=>!ke.disabled),$=document.activeElement,fe=(he=z.find(ke=>ke.ref.current===$))==null?void 0:he.textValue,ne=z.map(ke=>ke.textValue),se=rI(ne,Q,fe),Oe=(ye=z.find(ke=>ke.textValue===se))==null?void 0:ye.ref.current;(function ke(Fe){L.current=Fe,window.clearTimeout(A.current),Fe!==""&&(A.current=window.setTimeout(()=>ke(""),1e3))})(Q),Oe&&setTimeout(()=>Oe.focus())};v.useEffect(()=>()=>window.clearTimeout(A.current),[]),Vg();const Z=v.useCallback(I=>{var z,$;return F.current===((z=N.current)==null?void 0:z.side)&&sI(I,($=N.current)==null?void 0:$.area)},[]);return l.jsx(VM,{scope:r,searchRef:L,onItemEnter:v.useCallback(I=>{Z(I)&&I.preventDefault()},[Z]),onItemLeave:v.useCallback(I=>{var Q;Z(I)||((Q=R.current)==null||Q.focus(),E(null))},[Z]),onTriggerLeave:v.useCallback(I=>{Z(I)&&I.preventDefault()},[Z]),pointerGraceTimerRef:q,onPointerGraceIntentChange:v.useCallback(I=>{N.current=I},[]),children:l.jsx(V,{...te,children:l.jsx(wf,{asChild:!0,trapped:s,onMountAutoFocus:ce(o,I=>{var Q;I.preventDefault(),(Q=R.current)==null||Q.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:y,children:l.jsx(Fb,{asChild:!0,...w,dir:p.dir,orientation:"vertical",loop:n,currentTabStopId:j,onCurrentTabStopIdChange:E,onEntryFocus:ce(c,I=>{p.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(Jg,{role:"menu","aria-orientation":"vertical","data-state":gS(_.open),"data-radix-menu-content":"",dir:p.dir,...h,...g,ref:P,style:{outline:"none",...g.style},onKeyDown:ce(g.onKeyDown,I=>{const z=I.target.closest("[data-radix-menu-content]")===I.currentTarget,$=I.ctrlKey||I.altKey||I.metaKey,fe=I.key.length===1;z&&(I.key==="Tab"&&I.preventDefault(),!$&&fe&&W(I.key));const ne=R.current;if(I.target!==ne||!DM.includes(I.key))return;I.preventDefault();const Oe=C().filter(he=>!he.disabled).map(he=>he.ref.current);Kb.includes(I.key)&&Oe.reverse(),eI(Oe)}),onBlur:ce(e.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(A.current),L.current="")}),onPointerMove:ce(e.onPointerMove,ql(I=>{const Q=I.target,z=b.current!==I.clientX;if(I.currentTarget.contains(Q)&&z){const $=I.clientX>b.current?"right":"left";F.current=$,b.current=I.clientX}}))})})})})})})});eS.displayName=rn;var HM="MenuGroup",iv=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{role:"group",...n,ref:t})});iv.displayName=HM;var YM="MenuLabel",tS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});tS.displayName=YM;var jd="MenuItem",Y0="menu.itemSelect",Nf=v.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...s}=e,o=v.useRef(null),i=jc(jd,e.__scopeMenu),a=sv(jd,e.__scopeMenu),c=Ke(t,o),u=v.useRef(!1),d=()=>{const f=o.current;if(!r&&f){const m=new CustomEvent(Y0,{bubbles:!0,cancelable:!0});f.addEventListener(Y0,y=>n==null?void 0:n(y),{once:!0}),$g(f,m),m.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx(rS,{...s,ref:c,disabled:r,onClick:ce(e.onClick,d),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),u.current=!0},onPointerUp:ce(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:ce(e.onKeyDown,f=>{const m=a.searchRef.current!=="";r||m&&f.key===" "||um.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Nf.displayName=jd;var rS=v.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...o}=e,i=sv(jd,r),a=qb(r),c=v.useRef(null),u=Ke(t,c),[d,f]=v.useState(!1),[m,y]=v.useState("");return v.useEffect(()=>{const x=c.current;x&&y((x.textContent??"").trim())},[o.children]),l.jsx(Gl.ItemSlot,{scope:r,disabled:n,textValue:s??m,children:l.jsx(zb,{asChild:!0,...a,focusable:!n,children:l.jsx(Re.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:u,onPointerMove:ce(e.onPointerMove,ql(x=>{n?i.onItemLeave(x):(i.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ce(e.onPointerLeave,ql(x=>i.onItemLeave(x))),onFocus:ce(e.onFocus,()=>f(!0)),onBlur:ce(e.onBlur,()=>f(!1))})})})}),ZM="MenuCheckboxItem",nS=v.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...s}=e;return l.jsx(lS,{scope:e.__scopeMenu,checked:r,children:l.jsx(Nf,{role:"menuitemcheckbox","aria-checked":Ed(r)?"mixed":r,...s,ref:t,"data-state":lv(r),onSelect:ce(s.onSelect,()=>n==null?void 0:n(Ed(r)?!0:!r),{checkForDefaultPrevented:!1})})})});nS.displayName=ZM;var sS="MenuRadioGroup",[KM,GM]=ci(sS,{value:void 0,onValueChange:()=>{}}),oS=v.forwardRef((e,t)=>{const{value:r,onValueChange:n,...s}=e,o=Dt(n);return l.jsx(KM,{scope:e.__scopeMenu,value:r,onValueChange:o,children:l.jsx(iv,{...s,ref:t})})});oS.displayName=sS;var iS="MenuRadioItem",aS=v.forwardRef((e,t)=>{const{value:r,...n}=e,s=GM(iS,e.__scopeMenu),o=r===s.value;return l.jsx(lS,{scope:e.__scopeMenu,checked:o,children:l.jsx(Nf,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":lv(o),onSelect:ce(n.onSelect,()=>{var i;return(i=s.onValueChange)==null?void 0:i.call(s,r)},{checkForDefaultPrevented:!1})})})});aS.displayName=iS;var av="MenuItemIndicator",[lS,qM]=ci(av,{checked:!1}),cS=v.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...s}=e,o=qM(av,r);return l.jsx(ur,{present:n||Ed(o.checked)||o.checked===!0,children:l.jsx(Re.span,{...s,ref:t,"data-state":lv(o.checked)})})});cS.displayName=av;var XM="MenuSeparator",uS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});uS.displayName=XM;var QM="MenuArrow",dS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Ef(r);return l.jsx(ev,{...s,...n,ref:t})});dS.displayName=QM;var JM="MenuSub",[w$,fS]=ci(JM),ol="MenuSubTrigger",hS=v.forwardRef((e,t)=>{const r=ui(ol,e.__scopeMenu),n=jc(ol,e.__scopeMenu),s=fS(ol,e.__scopeMenu),o=sv(ol,e.__scopeMenu),i=v.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=o,u={__scopeMenu:e.__scopeMenu},d=v.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),l.jsx(rv,{asChild:!0,...u,children:l.jsx(rS,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":gS(r.open),...e,ref:yf(t,s.onTriggerChange),onClick:f=>{var m;(m=e.onClick)==null||m.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ce(e.onPointerMove,ql(f=>{o.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:ce(e.onPointerLeave,ql(f=>{var y,x;d();const m=(y=r.content)==null?void 0:y.getBoundingClientRect();if(m){const g=(x=r.content)==null?void 0:x.dataset.side,_=g==="right",p=_?-5:5,h=m[_?"left":"right"],w=m[_?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+p,y:f.clientY},{x:h,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x:h,y:m.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:ce(e.onKeyDown,f=>{var y;const m=o.searchRef.current!=="";e.disabled||m&&f.key===" "||OM[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});hS.displayName=ol;var pS="MenuSubContent",mS=v.forwardRef((e,t)=>{const r=Qb(rn,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=ui(rn,e.__scopeMenu),i=jc(rn,e.__scopeMenu),a=fS(pS,e.__scopeMenu),c=v.useRef(null),u=Ke(t,c);return l.jsx(Gl.Provider,{scope:e.__scopeMenu,children:l.jsx(ur,{present:n||o.open,children:l.jsx(Gl.Slot,{scope:e.__scopeMenu,children:l.jsx(ov,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;i.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:ce(e.onFocusOutside,d=>{d.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:ce(e.onEscapeKeyDown,d=>{i.onClose(),d.preventDefault()}),onKeyDown:ce(e.onKeyDown,d=>{var y;const f=d.currentTarget.contains(d.target),m=MM[i.dir].includes(d.key);f&&m&&(o.onOpenChange(!1),(y=a.trigger)==null||y.focus(),d.preventDefault())})})})})})});mS.displayName=pS;function gS(e){return e?"open":"closed"}function Ed(e){return e==="indeterminate"}function lv(e){return Ed(e)?"indeterminate":e?"checked":"unchecked"}function eI(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function tI(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function rI(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=tI(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function nI(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;on!=d>n&&r<(u-a)*(n-c)/(d-c)+a&&(s=!s)}return s}function sI(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return nI(r,t)}function ql(e){return t=>t.pointerType==="mouse"?e(t):void 0}var oI=Xb,iI=rv,aI=Jb,lI=eS,cI=iv,uI=tS,dI=Nf,fI=nS,hI=oS,pI=aS,mI=cS,gI=uS,vI=dS,yI=hS,xI=mS,cv="DropdownMenu",[wI,_$]=xr(cv,[Gb]),wr=Gb(),[_I,vS]=wI(cv),yS=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:s,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,c=wr(t),u=v.useRef(null),[d=!1,f]=on({prop:s,defaultProp:o,onChange:i});return l.jsx(_I,{scope:t,triggerId:Ur(),triggerRef:u,contentId:Ur(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(m=>!m),[f]),modal:a,children:l.jsx(oI,{...c,open:d,onOpenChange:f,dir:n,modal:a,children:r})})};yS.displayName=cv;var xS="DropdownMenuTrigger",wS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=e,o=vS(xS,r),i=wr(r);return l.jsx(iI,{asChild:!0,...i,children:l.jsx(Re.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:yf(t,o.triggerRef),onPointerDown:ce(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:ce(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});wS.displayName=xS;var bI="DropdownMenuPortal",_S=e=>{const{__scopeDropdownMenu:t,...r}=e,n=wr(t);return l.jsx(aI,{...n,...r})};_S.displayName=bI;var bS="DropdownMenuContent",SS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=vS(bS,r),o=wr(r),i=v.useRef(!1);return l.jsx(lI,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...n,ref:t,onCloseAutoFocus:ce(e.onCloseAutoFocus,a=>{var c;i.current||(c=s.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:ce(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});SS.displayName=bS;var SI="DropdownMenuGroup",kI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(cI,{...s,...n,ref:t})});kI.displayName=SI;var CI="DropdownMenuLabel",kS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(uI,{...s,...n,ref:t})});kS.displayName=CI;var jI="DropdownMenuItem",CS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(dI,{...s,...n,ref:t})});CS.displayName=jI;var EI="DropdownMenuCheckboxItem",jS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(fI,{...s,...n,ref:t})});jS.displayName=EI;var NI="DropdownMenuRadioGroup",TI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(hI,{...s,...n,ref:t})});TI.displayName=NI;var RI="DropdownMenuRadioItem",ES=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(pI,{...s,...n,ref:t})});ES.displayName=RI;var PI="DropdownMenuItemIndicator",NS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(mI,{...s,...n,ref:t})});NS.displayName=PI;var AI="DropdownMenuSeparator",TS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(gI,{...s,...n,ref:t})});TS.displayName=AI;var DI="DropdownMenuArrow",OI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(vI,{...s,...n,ref:t})});OI.displayName=DI;var MI="DropdownMenuSubTrigger",RS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(yI,{...s,...n,ref:t})});RS.displayName=MI;var II="DropdownMenuSubContent",PS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(xI,{...s,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});PS.displayName=II;var LI=yS,FI=wS,zI=_S,AS=SS,DS=kS,OS=CS,MS=jS,IS=ES,LS=NS,FS=TS,zS=RS,US=PS;const $S=LI,VS=FI,UI=v.forwardRef(({className:e,inset:t,children:r,...n},s)=>l.jsxs(zS,{ref:s,className:ae("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...n,children:[r,l.jsx(iA,{className:"ml-auto h-4 w-4"})]}));UI.displayName=zS.displayName;const $I=v.forwardRef(({className:e,...t},r)=>l.jsx(US,{ref:r,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));$I.displayName=US.displayName;const uv=v.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(zI,{children:l.jsx(AS,{ref:n,sideOffset:t,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));uv.displayName=AS.displayName;const Qi=v.forwardRef(({className:e,inset:t,...r},n)=>l.jsx(OS,{ref:n,className:ae("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));Qi.displayName=OS.displayName;const VI=v.forwardRef(({className:e,children:t,checked:r,...n},s)=>l.jsxs(MS,{ref:s,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(LS,{children:l.jsx(eb,{className:"h-4 w-4"})})}),t]}));VI.displayName=MS.displayName;const WI=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(IS,{ref:n,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(LS,{children:l.jsx(uA,{className:"h-2 w-2 fill-current"})})}),t]}));WI.displayName=IS.displayName;const WS=v.forwardRef(({className:e,inset:t,...r},n)=>l.jsx(DS,{ref:n,className:ae("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));WS.displayName=DS.displayName;const BS=v.forwardRef(({className:e,...t},r)=>l.jsx(FS,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));BS.displayName=FS.displayName;var dv="Dialog",[HS,YS]=xr(dv),[BI,Tn]=HS(dv),ZS=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,a=v.useRef(null),c=v.useRef(null),[u=!1,d]=on({prop:n,defaultProp:s,onChange:o});return l.jsx(BI,{scope:t,triggerRef:a,contentRef:c,contentId:Ur(),titleId:Ur(),descriptionId:Ur(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:i,children:r})};ZS.displayName=dv;var KS="DialogTrigger",GS=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(KS,r),o=Ke(t,s.triggerRef);return l.jsx(Re.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":pv(s.open),...n,ref:o,onClick:ce(e.onClick,s.onOpenToggle)})});GS.displayName=KS;var fv="DialogPortal",[HI,qS]=HS(fv,{forceMount:void 0}),XS=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,o=Tn(fv,t);return l.jsx(HI,{scope:t,forceMount:r,children:v.Children.map(n,i=>l.jsx(ur,{present:r||o.open,children:l.jsx(kc,{asChild:!0,container:s,children:i})}))})};XS.displayName=fv;var Nd="DialogOverlay",QS=v.forwardRef((e,t)=>{const r=qS(Nd,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=Tn(Nd,e.__scopeDialog);return o.modal?l.jsx(ur,{present:n||o.open,children:l.jsx(YI,{...s,ref:t})}):null});QS.displayName=Nd;var YI=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(Nd,r);return l.jsx(jf,{as:bs,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(Re.div,{"data-state":pv(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),ni="DialogContent",JS=v.forwardRef((e,t)=>{const r=qS(ni,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=Tn(ni,e.__scopeDialog);return l.jsx(ur,{present:n||o.open,children:o.modal?l.jsx(ZI,{...s,ref:t}):l.jsx(KI,{...s,ref:t})})});JS.displayName=ni;var ZI=v.forwardRef((e,t)=>{const r=Tn(ni,e.__scopeDialog),n=v.useRef(null),s=Ke(t,r.contentRef,n);return v.useEffect(()=>{const o=n.current;if(o)return tv(o)},[]),l.jsx(ek,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ce(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ce(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&o.preventDefault()}),onFocusOutside:ce(e.onFocusOutside,o=>o.preventDefault())})}),KI=v.forwardRef((e,t)=>{const r=Tn(ni,e.__scopeDialog),n=v.useRef(!1),s=v.useRef(!1);return l.jsx(ek,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;((u=r.triggerRef.current)==null?void 0:u.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),ek=v.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,a=Tn(ni,r),c=v.useRef(null),u=Ke(t,c);return Vg(),l.jsxs(l.Fragment,{children:[l.jsx(wf,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(Na,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":pv(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(qI,{titleId:a.titleId}),l.jsx(QI,{contentRef:c,descriptionId:a.descriptionId})]})]})}),hv="DialogTitle",tk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(hv,r);return l.jsx(Re.h2,{id:s.titleId,...n,ref:t})});tk.displayName=hv;var rk="DialogDescription",nk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(rk,r);return l.jsx(Re.p,{id:s.descriptionId,...n,ref:t})});nk.displayName=rk;var sk="DialogClose",ok=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(sk,r);return l.jsx(Re.button,{type:"button",...n,ref:t,onClick:ce(e.onClick,()=>s.onOpenChange(!1))})});ok.displayName=sk;function pv(e){return e?"open":"closed"}var ik="DialogTitleWarning",[GI,ak]=oD(ik,{contentName:ni,titleName:hv,docsSlug:"dialog"}),qI=({titleId:e})=>{const t=ak(ik),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. +`)},NM=0,bi=[];function TM(e){var t=v.useRef([]),r=v.useRef([0,0]),n=v.useRef(),s=v.useState(NM++)[0],o=v.useState(Bb)[0],i=v.useRef(e);v.useEffect(function(){i.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=qO([e.lockRef.current],(e.shards||[]).map(H0),!0).filter(Boolean);return g.forEach(function(_){return _.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(g,_){if("touches"in g&&g.touches.length===2)return!i.current.allowPinchZoom;var p=yu(g),h=r.current,w="deltaX"in g?g.deltaX:h[0]-p[0],C="deltaY"in g?g.deltaY:h[1]-p[1],j,E=g.target,R=Math.abs(w)>Math.abs(C)?"h":"v";if("touches"in g&&R==="h"&&E.type==="range")return!1;var P=W0(R,E);if(!P)return!0;if(P?j=R:(j=R==="v"?"h":"v",P=W0(R,E)),!P)return!1;if(!n.current&&"changedTouches"in g&&(w||C)&&(n.current=j),!j)return!0;var A=n.current||j;return CM(A,_,g,A==="h"?w:C,!0)},[]),c=v.useCallback(function(g){var _=g;if(!(!bi.length||bi[bi.length-1]!==o)){var p="deltaY"in _?B0(_):yu(_),h=t.current.filter(function(j){return j.name===_.type&&(j.target===_.target||_.target===j.shadowParent)&&jM(j.delta,p)})[0];if(h&&h.should){_.cancelable&&_.preventDefault();return}if(!h){var w=(i.current.shards||[]).map(H0).filter(Boolean).filter(function(j){return j.contains(_.target)}),C=w.length>0?a(_,w[0]):!i.current.noIsolation;C&&_.cancelable&&_.preventDefault()}}},[]),u=v.useCallback(function(g,_,p,h){var w={name:g,delta:_,target:p,should:h,shadowParent:RM(p)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(C){return C!==w})},1)},[]),d=v.useCallback(function(g){r.current=yu(g),n.current=void 0},[]),f=v.useCallback(function(g){u(g.type,B0(g),g.target,a(g,e.lockRef.current))},[]),m=v.useCallback(function(g){u(g.type,yu(g),g.target,a(g,e.lockRef.current))},[]);v.useEffect(function(){return bi.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,_i),document.addEventListener("touchmove",c,_i),document.addEventListener("touchstart",d,_i),function(){bi=bi.filter(function(g){return g!==o}),document.removeEventListener("wheel",c,_i),document.removeEventListener("touchmove",c,_i),document.removeEventListener("touchstart",d,_i)}},[]);var y=e.removeScrollBar,x=e.inert;return v.createElement(v.Fragment,null,x?v.createElement(o,{styles:EM(s)}):null,y?v.createElement(yM,{gapMode:e.gapMode}):null)}function RM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const PM=oM(Wb,TM);var jf=v.forwardRef(function(e,t){return v.createElement(Cf,In({},e,{ref:t,sideCar:PM}))});jf.classNames=Cf.classNames;var um=["Enter"," "],AM=["ArrowDown","PageUp","Home"],Kb=["ArrowUp","PageDown","End"],DM=[...AM,...Kb],OM={ltr:[...um,"ArrowRight"],rtl:[...um,"ArrowLeft"]},MM={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Cc="Menu",[Gl,IM,LM]=bc(Cc),[ci,Gb]=xr(Cc,[LM,Pa,kf]),Ef=Pa(),qb=kf(),[FM,ui]=ci(Cc),[zM,jc]=ci(Cc),Xb=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:s,onOpenChange:o,modal:i=!0}=e,a=Ef(t),[c,u]=v.useState(null),d=v.useRef(!1),f=Dt(o),m=Ea(s);return v.useEffect(()=>{const y=()=>{d.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>d.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),l.jsx(Xg,{...a,children:l.jsx(FM,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:l.jsx(zM,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:i,children:n})})})};Xb.displayName=Cc;var UM="MenuAnchor",rv=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Ef(r);return l.jsx(Qg,{...s,...n,ref:t})});rv.displayName=UM;var nv="MenuPortal",[$M,Qb]=ci(nv,{forceMount:void 0}),Jb=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:s}=e,o=ui(nv,t);return l.jsx($M,{scope:t,forceMount:r,children:l.jsx(ur,{present:r||o.open,children:l.jsx(kc,{asChild:!0,container:s,children:n})})})};Jb.displayName=nv;var rn="MenuContent",[VM,sv]=ci(rn),eS=v.forwardRef((e,t)=>{const r=Qb(rn,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=ui(rn,e.__scopeMenu),i=jc(rn,e.__scopeMenu);return l.jsx(Gl.Provider,{scope:e.__scopeMenu,children:l.jsx(ur,{present:n||o.open,children:l.jsx(Gl.Slot,{scope:e.__scopeMenu,children:i.modal?l.jsx(WM,{...s,ref:t}):l.jsx(BM,{...s,ref:t})})})})}),WM=v.forwardRef((e,t)=>{const r=ui(rn,e.__scopeMenu),n=v.useRef(null),s=Ke(t,n);return v.useEffect(()=>{const o=n.current;if(o)return tv(o)},[]),l.jsx(ov,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ce(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),BM=v.forwardRef((e,t)=>{const r=ui(rn,e.__scopeMenu);return l.jsx(ov,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),ov=v.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:y,disableOutsideScroll:x,...g}=e,_=ui(rn,r),p=jc(rn,r),h=Ef(r),w=qb(r),C=IM(r),[j,E]=v.useState(null),R=v.useRef(null),P=Ke(t,R,_.onContentChange),A=v.useRef(0),L=v.useRef(""),q=v.useRef(0),N=v.useRef(null),F=v.useRef("right"),b=v.useRef(0),V=x?jf:v.Fragment,te=x?{as:bs,allowPinchZoom:!0}:void 0,W=I=>{var he,ye;const Q=L.current+I,z=C().filter(ke=>!ke.disabled),$=document.activeElement,fe=(he=z.find(ke=>ke.ref.current===$))==null?void 0:he.textValue,ne=z.map(ke=>ke.textValue),se=rI(ne,Q,fe),Oe=(ye=z.find(ke=>ke.textValue===se))==null?void 0:ye.ref.current;(function ke(Fe){L.current=Fe,window.clearTimeout(A.current),Fe!==""&&(A.current=window.setTimeout(()=>ke(""),1e3))})(Q),Oe&&setTimeout(()=>Oe.focus())};v.useEffect(()=>()=>window.clearTimeout(A.current),[]),Vg();const Z=v.useCallback(I=>{var z,$;return F.current===((z=N.current)==null?void 0:z.side)&&sI(I,($=N.current)==null?void 0:$.area)},[]);return l.jsx(VM,{scope:r,searchRef:L,onItemEnter:v.useCallback(I=>{Z(I)&&I.preventDefault()},[Z]),onItemLeave:v.useCallback(I=>{var Q;Z(I)||((Q=R.current)==null||Q.focus(),E(null))},[Z]),onTriggerLeave:v.useCallback(I=>{Z(I)&&I.preventDefault()},[Z]),pointerGraceTimerRef:q,onPointerGraceIntentChange:v.useCallback(I=>{N.current=I},[]),children:l.jsx(V,{...te,children:l.jsx(wf,{asChild:!0,trapped:s,onMountAutoFocus:ce(o,I=>{var Q;I.preventDefault(),(Q=R.current)==null||Q.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:y,children:l.jsx(Fb,{asChild:!0,...w,dir:p.dir,orientation:"vertical",loop:n,currentTabStopId:j,onCurrentTabStopIdChange:E,onEntryFocus:ce(c,I=>{p.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(Jg,{role:"menu","aria-orientation":"vertical","data-state":gS(_.open),"data-radix-menu-content":"",dir:p.dir,...h,...g,ref:P,style:{outline:"none",...g.style},onKeyDown:ce(g.onKeyDown,I=>{const z=I.target.closest("[data-radix-menu-content]")===I.currentTarget,$=I.ctrlKey||I.altKey||I.metaKey,fe=I.key.length===1;z&&(I.key==="Tab"&&I.preventDefault(),!$&&fe&&W(I.key));const ne=R.current;if(I.target!==ne||!DM.includes(I.key))return;I.preventDefault();const Oe=C().filter(he=>!he.disabled).map(he=>he.ref.current);Kb.includes(I.key)&&Oe.reverse(),eI(Oe)}),onBlur:ce(e.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(A.current),L.current="")}),onPointerMove:ce(e.onPointerMove,ql(I=>{const Q=I.target,z=b.current!==I.clientX;if(I.currentTarget.contains(Q)&&z){const $=I.clientX>b.current?"right":"left";F.current=$,b.current=I.clientX}}))})})})})})})});eS.displayName=rn;var HM="MenuGroup",iv=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{role:"group",...n,ref:t})});iv.displayName=HM;var YM="MenuLabel",tS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});tS.displayName=YM;var jd="MenuItem",Y0="menu.itemSelect",Nf=v.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...s}=e,o=v.useRef(null),i=jc(jd,e.__scopeMenu),a=sv(jd,e.__scopeMenu),c=Ke(t,o),u=v.useRef(!1),d=()=>{const f=o.current;if(!r&&f){const m=new CustomEvent(Y0,{bubbles:!0,cancelable:!0});f.addEventListener(Y0,y=>n==null?void 0:n(y),{once:!0}),$g(f,m),m.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx(rS,{...s,ref:c,disabled:r,onClick:ce(e.onClick,d),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),u.current=!0},onPointerUp:ce(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:ce(e.onKeyDown,f=>{const m=a.searchRef.current!=="";r||m&&f.key===" "||um.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Nf.displayName=jd;var rS=v.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...o}=e,i=sv(jd,r),a=qb(r),c=v.useRef(null),u=Ke(t,c),[d,f]=v.useState(!1),[m,y]=v.useState("");return v.useEffect(()=>{const x=c.current;x&&y((x.textContent??"").trim())},[o.children]),l.jsx(Gl.ItemSlot,{scope:r,disabled:n,textValue:s??m,children:l.jsx(zb,{asChild:!0,...a,focusable:!n,children:l.jsx(Re.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:u,onPointerMove:ce(e.onPointerMove,ql(x=>{n?i.onItemLeave(x):(i.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ce(e.onPointerLeave,ql(x=>i.onItemLeave(x))),onFocus:ce(e.onFocus,()=>f(!0)),onBlur:ce(e.onBlur,()=>f(!1))})})})}),ZM="MenuCheckboxItem",nS=v.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...s}=e;return l.jsx(lS,{scope:e.__scopeMenu,checked:r,children:l.jsx(Nf,{role:"menuitemcheckbox","aria-checked":Ed(r)?"mixed":r,...s,ref:t,"data-state":lv(r),onSelect:ce(s.onSelect,()=>n==null?void 0:n(Ed(r)?!0:!r),{checkForDefaultPrevented:!1})})})});nS.displayName=ZM;var sS="MenuRadioGroup",[KM,GM]=ci(sS,{value:void 0,onValueChange:()=>{}}),oS=v.forwardRef((e,t)=>{const{value:r,onValueChange:n,...s}=e,o=Dt(n);return l.jsx(KM,{scope:e.__scopeMenu,value:r,onValueChange:o,children:l.jsx(iv,{...s,ref:t})})});oS.displayName=sS;var iS="MenuRadioItem",aS=v.forwardRef((e,t)=>{const{value:r,...n}=e,s=GM(iS,e.__scopeMenu),o=r===s.value;return l.jsx(lS,{scope:e.__scopeMenu,checked:o,children:l.jsx(Nf,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":lv(o),onSelect:ce(n.onSelect,()=>{var i;return(i=s.onValueChange)==null?void 0:i.call(s,r)},{checkForDefaultPrevented:!1})})})});aS.displayName=iS;var av="MenuItemIndicator",[lS,qM]=ci(av,{checked:!1}),cS=v.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...s}=e,o=qM(av,r);return l.jsx(ur,{present:n||Ed(o.checked)||o.checked===!0,children:l.jsx(Re.span,{...s,ref:t,"data-state":lv(o.checked)})})});cS.displayName=av;var XM="MenuSeparator",uS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});uS.displayName=XM;var QM="MenuArrow",dS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Ef(r);return l.jsx(ev,{...s,...n,ref:t})});dS.displayName=QM;var JM="MenuSub",[x$,fS]=ci(JM),ol="MenuSubTrigger",hS=v.forwardRef((e,t)=>{const r=ui(ol,e.__scopeMenu),n=jc(ol,e.__scopeMenu),s=fS(ol,e.__scopeMenu),o=sv(ol,e.__scopeMenu),i=v.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=o,u={__scopeMenu:e.__scopeMenu},d=v.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),l.jsx(rv,{asChild:!0,...u,children:l.jsx(rS,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":gS(r.open),...e,ref:yf(t,s.onTriggerChange),onClick:f=>{var m;(m=e.onClick)==null||m.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ce(e.onPointerMove,ql(f=>{o.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:ce(e.onPointerLeave,ql(f=>{var y,x;d();const m=(y=r.content)==null?void 0:y.getBoundingClientRect();if(m){const g=(x=r.content)==null?void 0:x.dataset.side,_=g==="right",p=_?-5:5,h=m[_?"left":"right"],w=m[_?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+p,y:f.clientY},{x:h,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x:h,y:m.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:ce(e.onKeyDown,f=>{var y;const m=o.searchRef.current!=="";e.disabled||m&&f.key===" "||OM[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});hS.displayName=ol;var pS="MenuSubContent",mS=v.forwardRef((e,t)=>{const r=Qb(rn,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=ui(rn,e.__scopeMenu),i=jc(rn,e.__scopeMenu),a=fS(pS,e.__scopeMenu),c=v.useRef(null),u=Ke(t,c);return l.jsx(Gl.Provider,{scope:e.__scopeMenu,children:l.jsx(ur,{present:n||o.open,children:l.jsx(Gl.Slot,{scope:e.__scopeMenu,children:l.jsx(ov,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;i.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:ce(e.onFocusOutside,d=>{d.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:ce(e.onEscapeKeyDown,d=>{i.onClose(),d.preventDefault()}),onKeyDown:ce(e.onKeyDown,d=>{var y;const f=d.currentTarget.contains(d.target),m=MM[i.dir].includes(d.key);f&&m&&(o.onOpenChange(!1),(y=a.trigger)==null||y.focus(),d.preventDefault())})})})})})});mS.displayName=pS;function gS(e){return e?"open":"closed"}function Ed(e){return e==="indeterminate"}function lv(e){return Ed(e)?"indeterminate":e?"checked":"unchecked"}function eI(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function tI(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function rI(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=tI(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function nI(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;on!=d>n&&r<(u-a)*(n-c)/(d-c)+a&&(s=!s)}return s}function sI(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return nI(r,t)}function ql(e){return t=>t.pointerType==="mouse"?e(t):void 0}var oI=Xb,iI=rv,aI=Jb,lI=eS,cI=iv,uI=tS,dI=Nf,fI=nS,hI=oS,pI=aS,mI=cS,gI=uS,vI=dS,yI=hS,xI=mS,cv="DropdownMenu",[wI,w$]=xr(cv,[Gb]),wr=Gb(),[_I,vS]=wI(cv),yS=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:s,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,c=wr(t),u=v.useRef(null),[d=!1,f]=on({prop:s,defaultProp:o,onChange:i});return l.jsx(_I,{scope:t,triggerId:Ur(),triggerRef:u,contentId:Ur(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(m=>!m),[f]),modal:a,children:l.jsx(oI,{...c,open:d,onOpenChange:f,dir:n,modal:a,children:r})})};yS.displayName=cv;var xS="DropdownMenuTrigger",wS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=e,o=vS(xS,r),i=wr(r);return l.jsx(iI,{asChild:!0,...i,children:l.jsx(Re.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:yf(t,o.triggerRef),onPointerDown:ce(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:ce(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});wS.displayName=xS;var bI="DropdownMenuPortal",_S=e=>{const{__scopeDropdownMenu:t,...r}=e,n=wr(t);return l.jsx(aI,{...n,...r})};_S.displayName=bI;var bS="DropdownMenuContent",SS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=vS(bS,r),o=wr(r),i=v.useRef(!1);return l.jsx(lI,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...n,ref:t,onCloseAutoFocus:ce(e.onCloseAutoFocus,a=>{var c;i.current||(c=s.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:ce(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});SS.displayName=bS;var SI="DropdownMenuGroup",kI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(cI,{...s,...n,ref:t})});kI.displayName=SI;var CI="DropdownMenuLabel",kS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(uI,{...s,...n,ref:t})});kS.displayName=CI;var jI="DropdownMenuItem",CS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(dI,{...s,...n,ref:t})});CS.displayName=jI;var EI="DropdownMenuCheckboxItem",jS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(fI,{...s,...n,ref:t})});jS.displayName=EI;var NI="DropdownMenuRadioGroup",TI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(hI,{...s,...n,ref:t})});TI.displayName=NI;var RI="DropdownMenuRadioItem",ES=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(pI,{...s,...n,ref:t})});ES.displayName=RI;var PI="DropdownMenuItemIndicator",NS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(mI,{...s,...n,ref:t})});NS.displayName=PI;var AI="DropdownMenuSeparator",TS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(gI,{...s,...n,ref:t})});TS.displayName=AI;var DI="DropdownMenuArrow",OI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(vI,{...s,...n,ref:t})});OI.displayName=DI;var MI="DropdownMenuSubTrigger",RS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(yI,{...s,...n,ref:t})});RS.displayName=MI;var II="DropdownMenuSubContent",PS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(xI,{...s,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});PS.displayName=II;var LI=yS,FI=wS,zI=_S,AS=SS,DS=kS,OS=CS,MS=jS,IS=ES,LS=NS,FS=TS,zS=RS,US=PS;const $S=LI,VS=FI,UI=v.forwardRef(({className:e,inset:t,children:r,...n},s)=>l.jsxs(zS,{ref:s,className:ae("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...n,children:[r,l.jsx(iA,{className:"ml-auto h-4 w-4"})]}));UI.displayName=zS.displayName;const $I=v.forwardRef(({className:e,...t},r)=>l.jsx(US,{ref:r,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));$I.displayName=US.displayName;const uv=v.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(zI,{children:l.jsx(AS,{ref:n,sideOffset:t,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));uv.displayName=AS.displayName;const Qi=v.forwardRef(({className:e,inset:t,...r},n)=>l.jsx(OS,{ref:n,className:ae("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));Qi.displayName=OS.displayName;const VI=v.forwardRef(({className:e,children:t,checked:r,...n},s)=>l.jsxs(MS,{ref:s,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(LS,{children:l.jsx(eb,{className:"h-4 w-4"})})}),t]}));VI.displayName=MS.displayName;const WI=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(IS,{ref:n,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(LS,{children:l.jsx(uA,{className:"h-2 w-2 fill-current"})})}),t]}));WI.displayName=IS.displayName;const WS=v.forwardRef(({className:e,inset:t,...r},n)=>l.jsx(DS,{ref:n,className:ae("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));WS.displayName=DS.displayName;const BS=v.forwardRef(({className:e,...t},r)=>l.jsx(FS,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));BS.displayName=FS.displayName;var dv="Dialog",[HS,YS]=xr(dv),[BI,Tn]=HS(dv),ZS=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,a=v.useRef(null),c=v.useRef(null),[u=!1,d]=on({prop:n,defaultProp:s,onChange:o});return l.jsx(BI,{scope:t,triggerRef:a,contentRef:c,contentId:Ur(),titleId:Ur(),descriptionId:Ur(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:i,children:r})};ZS.displayName=dv;var KS="DialogTrigger",GS=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(KS,r),o=Ke(t,s.triggerRef);return l.jsx(Re.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":pv(s.open),...n,ref:o,onClick:ce(e.onClick,s.onOpenToggle)})});GS.displayName=KS;var fv="DialogPortal",[HI,qS]=HS(fv,{forceMount:void 0}),XS=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,o=Tn(fv,t);return l.jsx(HI,{scope:t,forceMount:r,children:v.Children.map(n,i=>l.jsx(ur,{present:r||o.open,children:l.jsx(kc,{asChild:!0,container:s,children:i})}))})};XS.displayName=fv;var Nd="DialogOverlay",QS=v.forwardRef((e,t)=>{const r=qS(Nd,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=Tn(Nd,e.__scopeDialog);return o.modal?l.jsx(ur,{present:n||o.open,children:l.jsx(YI,{...s,ref:t})}):null});QS.displayName=Nd;var YI=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(Nd,r);return l.jsx(jf,{as:bs,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(Re.div,{"data-state":pv(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),ni="DialogContent",JS=v.forwardRef((e,t)=>{const r=qS(ni,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=Tn(ni,e.__scopeDialog);return l.jsx(ur,{present:n||o.open,children:o.modal?l.jsx(ZI,{...s,ref:t}):l.jsx(KI,{...s,ref:t})})});JS.displayName=ni;var ZI=v.forwardRef((e,t)=>{const r=Tn(ni,e.__scopeDialog),n=v.useRef(null),s=Ke(t,r.contentRef,n);return v.useEffect(()=>{const o=n.current;if(o)return tv(o)},[]),l.jsx(ek,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ce(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ce(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&o.preventDefault()}),onFocusOutside:ce(e.onFocusOutside,o=>o.preventDefault())})}),KI=v.forwardRef((e,t)=>{const r=Tn(ni,e.__scopeDialog),n=v.useRef(!1),s=v.useRef(!1);return l.jsx(ek,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;((u=r.triggerRef.current)==null?void 0:u.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),ek=v.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,a=Tn(ni,r),c=v.useRef(null),u=Ke(t,c);return Vg(),l.jsxs(l.Fragment,{children:[l.jsx(wf,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(Na,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":pv(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(qI,{titleId:a.titleId}),l.jsx(QI,{contentRef:c,descriptionId:a.descriptionId})]})]})}),hv="DialogTitle",tk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(hv,r);return l.jsx(Re.h2,{id:s.titleId,...n,ref:t})});tk.displayName=hv;var rk="DialogDescription",nk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(rk,r);return l.jsx(Re.p,{id:s.descriptionId,...n,ref:t})});nk.displayName=rk;var sk="DialogClose",ok=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(sk,r);return l.jsx(Re.button,{type:"button",...n,ref:t,onClick:ce(e.onClick,()=>s.onOpenChange(!1))})});ok.displayName=sk;function pv(e){return e?"open":"closed"}var ik="DialogTitleWarning",[GI,ak]=oD(ik,{contentName:ni,titleName:hv,docsSlug:"dialog"}),qI=({titleId:e})=>{const t=ak(ik),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},XI="DialogDescriptionWarning",QI=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ak(XI).contentName}}.`;return v.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},mv=ZS,gv=GS,vv=XS,Ec=QS,Nc=JS,Tc=tk,Rc=nk,Tf=ok;const yv=mv,xv=gv,JI=vv,lk=v.forwardRef(({className:e,...t},r)=>l.jsx(Ec,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));lk.displayName=Ec.displayName;const eL=_c("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Rf=v.forwardRef(({side:e="right",className:t,children:r,...n},s)=>l.jsxs(JI,{children:[l.jsx(lk,{}),l.jsxs(Nc,{ref:s,className:ae(eL({side:e}),t),...n,children:[r,l.jsxs(Tf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[l.jsx(Fg,{className:"h-4 w-4 dark:text-stone-200"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rf.displayName=Nc.displayName;const wv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});wv.displayName="SheetHeader";const _v=v.forwardRef(({className:e,...t},r)=>l.jsx(Tc,{ref:r,className:ae("text-lg font-semibold text-foreground",e),...t}));_v.displayName=Tc.displayName;const tL=v.forwardRef(({className:e,...t},r)=>l.jsx(Rc,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));tL.displayName=Rc.displayName;class Vr extends Error{constructor(t){var r,n,s,o;super("ClientResponseError"),this.url="",this.status=0,this.response={},this.isAbort=!1,this.originalError=null,Object.setPrototypeOf(this,Vr.prototype),t!==null&&typeof t=="object"&&(this.url=typeof t.url=="string"?t.url:"",this.status=typeof t.status=="number"?t.status:0,this.isAbort=!!t.isAbort,this.originalError=t.originalError,t.response!==null&&typeof t.response=="object"?this.response=t.response:t.data!==null&&typeof t.data=="object"?this.response=t.data:this.response={}),this.originalError||t instanceof Vr||(this.originalError=t),typeof DOMException<"u"&&t instanceof DOMException&&(this.isAbort=!0),this.name="ClientResponseError "+this.status,this.message=(r=this.response)==null?void 0:r.message,this.message||(this.isAbort?this.message="The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.":(o=(s=(n=this.originalError)==null?void 0:n.cause)==null?void 0:s.message)!=null&&o.includes("ECONNREFUSED ::1")?this.message="Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).":this.message="Something went wrong while processing your request.")}get data(){return this.response}toJSON(){return{...this}}}const xu=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function rL(e,t){const r={};if(typeof e!="string")return r;const n=Object.assign({},{}).decode||nL;let s=0;for(;s0&&(!r.exp||r.exp-t>Date.now()/1e3))}ck=typeof atob!="function"||oL?e=>{let t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,s=0,o=0,i="";n=t.charAt(o++);~n&&(r=s%4?64*r+n:n,s++%4)?i+=String.fromCharCode(255&r>>(-2*s&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return i}:atob;const K0="pb_auth";class iL{constructor(){this.baseToken="",this.baseModel=null,this._onChangeCallbacks=[]}get token(){return this.baseToken}get model(){return this.baseModel}get isValid(){return!uk(this.token)}get isAdmin(){return Ji(this.token).type==="admin"}get isAuthRecord(){return Ji(this.token).type==="authRecord"}save(t,r){this.baseToken=t||"",this.baseModel=r||null,this.triggerChange()}clear(){this.baseToken="",this.baseModel=null,this.triggerChange()}loadFromCookie(t,r=K0){const n=rL(t||"")[r]||"";let s={};try{s=JSON.parse(n),(typeof s===null||typeof s!="object"||Array.isArray(s))&&(s={})}catch{}this.save(s.token||"",s.model||null)}exportToCookie(t,r=K0){var c,u;const n={secure:!0,sameSite:!0,httpOnly:!0,path:"/"},s=Ji(this.token);n.expires=s!=null&&s.exp?new Date(1e3*s.exp):new Date("1970-01-01"),t=Object.assign({},n,t);const o={token:this.token,model:this.model?JSON.parse(JSON.stringify(this.model)):null};let i=Z0(r,JSON.stringify(o),t);const a=typeof Blob<"u"?new Blob([i]).size:i.length;if(o.model&&a>4096){o.model={id:(c=o==null?void 0:o.model)==null?void 0:c.id,email:(u=o==null?void 0:o.model)==null?void 0:u.email};const d=["collectionId","username","verified"];for(const f in this.model)d.includes(f)&&(o.model[f]=this.model[f]);i=Z0(r,JSON.stringify(o),t)}return i}onChange(t,r=!1){return this._onChangeCallbacks.push(t),r&&t(this.token,this.model),()=>{for(let n=this._onChangeCallbacks.length-1;n>=0;n--)if(this._onChangeCallbacks[n]==t)return delete this._onChangeCallbacks[n],void this._onChangeCallbacks.splice(n,1)}}triggerChange(){for(const t of this._onChangeCallbacks)t&&t(this.token,this.model)}}class aL extends iL{constructor(t="pocketbase_auth"){super(),this.storageFallback={},this.storageKey=t,this._bindStorageEvent()}get token(){return(this._storageGet(this.storageKey)||{}).token||""}get model(){return(this._storageGet(this.storageKey)||{}).model||null}save(t,r){this._storageSet(this.storageKey,{token:t,model:r}),super.save(t,r)}clear(){this._storageRemove(this.storageKey),super.clear()}_storageGet(t){if(typeof window<"u"&&(window!=null&&window.localStorage)){const r=window.localStorage.getItem(t)||"";try{return JSON.parse(r)}catch{return r}}return this.storageFallback[t]}_storageSet(t,r){if(typeof window<"u"&&(window!=null&&window.localStorage)){let n=r;typeof r!="string"&&(n=JSON.stringify(r)),window.localStorage.setItem(t,n)}else this.storageFallback[t]=r}_storageRemove(t){var r;typeof window<"u"&&(window!=null&&window.localStorage)&&((r=window.localStorage)==null||r.removeItem(t)),delete this.storageFallback[t]}_bindStorageEvent(){typeof window<"u"&&(window!=null&&window.localStorage)&&window.addEventListener&&window.addEventListener("storage",t=>{if(t.key!=this.storageKey)return;const r=this._storageGet(this.storageKey)||{};super.save(r.token||"",r.model||null)})}}class di{constructor(t){this.client=t}}class lL extends di{async getAll(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/settings",t)}async update(t,r){return r=Object.assign({method:"PATCH",body:t},r),this.client.send("/api/settings",r)}async testS3(t="storage",r){return r=Object.assign({method:"POST",body:{filesystem:t}},r),this.client.send("/api/settings/test/s3",r).then(()=>!0)}async testEmail(t,r,n){return n=Object.assign({method:"POST",body:{email:t,template:r}},n),this.client.send("/api/settings/test/email",n).then(()=>!0)}async generateAppleClientSecret(t,r,n,s,o,i){return i=Object.assign({method:"POST",body:{clientId:t,teamId:r,keyId:n,privateKey:s,duration:o}},i),this.client.send("/api/settings/apple/generate-client-secret",i)}}class bv extends di{decode(t){return t}async getFullList(t,r){if(typeof t=="number")return this._getFullList(t,r);let n=500;return(r=Object.assign({},t,r)).batch&&(n=r.batch,delete r.batch),this._getFullList(n,r)}async getList(t=1,r=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:t,perPage:r},n.query),this.client.send(this.baseCrudPath,n).then(s=>{var o;return s.items=((o=s.items)==null?void 0:o.map(i=>this.decode(i)))||[],s})}async getFirstListItem(t,r){return(r=Object.assign({requestKey:"one_by_filter_"+this.baseCrudPath+"_"+t},r)).query=Object.assign({filter:t,skipTotal:1},r.query),this.getList(1,1,r).then(n=>{var s;if(!((s=n==null?void 0:n.items)!=null&&s.length))throw new Vr({status:404,response:{code:404,message:"The requested resource wasn't found.",data:{}}});return n.items[0]})}async getOne(t,r){if(!t)throw new Vr({url:this.client.buildUrl(this.baseCrudPath+"/"),status:404,response:{code:404,message:"Missing required record id.",data:{}}});return r=Object.assign({method:"GET"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),r).then(n=>this.decode(n))}async create(t,r){return r=Object.assign({method:"POST",body:t},r),this.client.send(this.baseCrudPath,r).then(n=>this.decode(n))}async update(t,r,n){return n=Object.assign({method:"PATCH",body:r},n),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),n).then(s=>this.decode(s))}async delete(t,r){return r=Object.assign({method:"DELETE"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),r).then(()=>!0)}_getFullList(t=500,r){(r=r||{}).query=Object.assign({skipTotal:1},r.query);let n=[],s=async o=>this.getList(o,t||500,r).then(i=>{const a=i.items;return n=n.concat(a),a.length==i.perPage?s(o+1):n});return s(1)}}function Dr(e,t,r,n){const s=n!==void 0;return s||r!==void 0?s?(console.warn(e),t.body=Object.assign({},t.body,r),t.query=Object.assign({},t.query,n),t):Object.assign(t,r):t}function Kh(e){var t;(t=e._resetAutoRefresh)==null||t.call(e)}class cL extends bv{get baseCrudPath(){return"/api/admins"}async update(t,r,n){return super.update(t,r,n).then(s=>{var o,i;return((o=this.client.authStore.model)==null?void 0:o.id)===s.id&&((i=this.client.authStore.model)==null?void 0:i.collectionId)===void 0&&this.client.authStore.save(this.client.authStore.token,s),s})}async delete(t,r){return super.delete(t,r).then(n=>{var s,o;return n&&((s=this.client.authStore.model)==null?void 0:s.id)===t&&((o=this.client.authStore.model)==null?void 0:o.collectionId)===void 0&&this.client.authStore.clear(),n})}authResponse(t){const r=this.decode((t==null?void 0:t.admin)||{});return t!=null&&t.token&&(t!=null&&t.admin)&&this.client.authStore.save(t.token,r),Object.assign({},t,{token:(t==null?void 0:t.token)||"",admin:r})}async authWithPassword(t,r,n,s){let o={method:"POST",body:{identity:t,password:r}};o=Dr("This form of authWithPassword(email, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(email, pass, options?).",o,n,s);const i=o.autoRefreshThreshold;delete o.autoRefreshThreshold,o.autoRefresh||Kh(this.client);let a=await this.client.send(this.baseCrudPath+"/auth-with-password",o);return a=this.authResponse(a),i&&function(u,d,f,m){Kh(u);const y=u.beforeSend,x=u.authStore.model,g=u.authStore.onChange((_,p)=>{(!_||(p==null?void 0:p.id)!=(x==null?void 0:x.id)||(p!=null&&p.collectionId||x!=null&&x.collectionId)&&(p==null?void 0:p.collectionId)!=(x==null?void 0:x.collectionId))&&Kh(u)});u._resetAutoRefresh=function(){g(),u.beforeSend=y,delete u._resetAutoRefresh},u.beforeSend=async(_,p)=>{var j;const h=u.authStore.token;if((j=p.query)!=null&&j.autoRefresh)return y?y(_,p):{url:_,sendOptions:p};let w=u.authStore.isValid;if(w&&uk(u.authStore.token,d))try{await f()}catch{w=!1}w||await m();const C=p.headers||{};for(let E in C)if(E.toLowerCase()=="authorization"&&h==C[E]&&u.authStore.token){C[E]=u.authStore.token;break}return p.headers=C,y?y(_,p):{url:_,sendOptions:p}}}(this.client,i,()=>this.authRefresh({autoRefresh:!0}),()=>this.authWithPassword(t,r,Object.assign({autoRefresh:!0},o))),a}async authRefresh(t,r){let n={method:"POST"};return n=Dr("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",n,t,r),this.client.send(this.baseCrudPath+"/auth-refresh",n).then(this.authResponse.bind(this))}async requestPasswordReset(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",s,r,n),this.client.send(this.baseCrudPath+"/request-password-reset",s).then(()=>!0)}async confirmPasswordReset(t,r,n,s,o){let i={method:"POST",body:{token:t,password:r,passwordConfirm:n}};return i=Dr("This form of confirmPasswordReset(resetToken, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(resetToken, password, passwordConfirm, options?).",i,s,o),this.client.send(this.baseCrudPath+"/confirm-password-reset",i).then(()=>!0)}}const uL=["requestKey","$cancelKey","$autoCancel","fetch","headers","body","query","params","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy","signal","window"];function dk(e){if(e){e.query=e.query||{};for(let t in e)uL.includes(t)||(e.query[t]=e[t],delete e[t])}}class fk extends di{constructor(){super(...arguments),this.clientId="",this.eventSource=null,this.subscriptions={},this.lastSentSubscriptions=[],this.maxConnectTimeout=15e3,this.reconnectAttempts=0,this.maxReconnectAttempts=1/0,this.predefinedReconnectIntervals=[200,300,500,1e3,1200,1500,2e3],this.pendingConnects=[]}get isConnected(){return!!this.eventSource&&!!this.clientId&&!this.pendingConnects.length}async subscribe(t,r,n){var i;if(!t)throw new Error("topic must be set.");let s=t;if(n){dk(n);const a="options="+encodeURIComponent(JSON.stringify({query:n.query,headers:n.headers}));s+=(s.includes("?")?"&":"?")+a}const o=function(a){const c=a;let u;try{u=JSON.parse(c==null?void 0:c.data)}catch{}r(u||{})};return this.subscriptions[s]||(this.subscriptions[s]=[]),this.subscriptions[s].push(o),this.isConnected?this.subscriptions[s].length===1?await this.submitSubscriptions():(i=this.eventSource)==null||i.addEventListener(s,o):await this.connect(),async()=>this.unsubscribeByTopicAndListener(t,o)}async unsubscribe(t){var n;let r=!1;if(t){const s=this.getSubscriptionsByTopic(t);for(let o in s)if(this.hasSubscriptionListeners(o)){for(let i of this.subscriptions[o])(n=this.eventSource)==null||n.removeEventListener(o,i);delete this.subscriptions[o],r||(r=!0)}}else this.subscriptions={};this.hasSubscriptionListeners()?r&&await this.submitSubscriptions():this.disconnect()}async unsubscribeByPrefix(t){var n;let r=!1;for(let s in this.subscriptions)if((s+"?").startsWith(t)){r=!0;for(let o of this.subscriptions[s])(n=this.eventSource)==null||n.removeEventListener(s,o);delete this.subscriptions[s]}r&&(this.hasSubscriptionListeners()?await this.submitSubscriptions():this.disconnect())}async unsubscribeByTopicAndListener(t,r){var o;let n=!1;const s=this.getSubscriptionsByTopic(t);for(let i in s){if(!Array.isArray(this.subscriptions[i])||!this.subscriptions[i].length)continue;let a=!1;for(let c=this.subscriptions[i].length-1;c>=0;c--)this.subscriptions[i][c]===r&&(a=!0,delete this.subscriptions[i][c],this.subscriptions[i].splice(c,1),(o=this.eventSource)==null||o.removeEventListener(i,r));a&&(this.subscriptions[i].length||delete this.subscriptions[i],n||this.hasSubscriptionListeners(i)||(n=!0))}this.hasSubscriptionListeners()?n&&await this.submitSubscriptions():this.disconnect()}hasSubscriptionListeners(t){var r,n;if(this.subscriptions=this.subscriptions||{},t)return!!((r=this.subscriptions[t])!=null&&r.length);for(let s in this.subscriptions)if((n=this.subscriptions[s])!=null&&n.length)return!0;return!1}async submitSubscriptions(){if(this.clientId)return this.addAllSubscriptionListeners(),this.lastSentSubscriptions=this.getNonEmptySubscriptionKeys(),this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentSubscriptions},requestKey:this.getSubscriptionsCancelKey()}).catch(t=>{if(!(t!=null&&t.isAbort))throw t})}getSubscriptionsCancelKey(){return"realtime_"+this.clientId}getSubscriptionsByTopic(t){const r={};t=t.includes("?")?t:t+"?";for(let n in this.subscriptions)(n+"?").startsWith(t)&&(r[n]=this.subscriptions[n]);return r}getNonEmptySubscriptionKeys(){const t=[];for(let r in this.subscriptions)this.subscriptions[r].length&&t.push(r);return t}addAllSubscriptionListeners(){if(this.eventSource){this.removeAllSubscriptionListeners();for(let t in this.subscriptions)for(let r of this.subscriptions[t])this.eventSource.addEventListener(t,r)}}removeAllSubscriptionListeners(){if(this.eventSource)for(let t in this.subscriptions)for(let r of this.subscriptions[t])this.eventSource.removeEventListener(t,r)}async connect(){if(!(this.reconnectAttempts>0))return new Promise((t,r)=>{this.pendingConnects.push({resolve:t,reject:r}),this.pendingConnects.length>1||this.initConnect()})}initConnect(){this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout(()=>{this.connectErrorHandler(new Error("EventSource connect took too long."))},this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=t=>{this.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",t=>{const r=t;this.clientId=r==null?void 0:r.lastEventId,this.submitSubscriptions().then(async()=>{let n=3;for(;this.hasUnsentSubscriptions()&&n>0;)n--,await this.submitSubscriptions()}).then(()=>{for(let s of this.pendingConnects)s.resolve();this.pendingConnects=[],this.reconnectAttempts=0,clearTimeout(this.reconnectTimeoutId),clearTimeout(this.connectTimeoutId);const n=this.getSubscriptionsByTopic("PB_CONNECT");for(let s in n)for(let o of n[s])o(t)}).catch(n=>{this.clientId="",this.connectErrorHandler(n)})})}hasUnsentSubscriptions(){const t=this.getNonEmptySubscriptionKeys();if(t.length!=this.lastSentSubscriptions.length)return!0;for(const r of t)if(!this.lastSentSubscriptions.includes(r))return!0;return!1}connectErrorHandler(t){if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),!this.clientId&&!this.reconnectAttempts||this.reconnectAttempts>this.maxReconnectAttempts){for(let n of this.pendingConnects)n.reject(new Vr(t));return this.pendingConnects=[],void this.disconnect()}this.disconnect(!0);const r=this.predefinedReconnectIntervals[this.reconnectAttempts]||this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length-1];this.reconnectAttempts++,this.reconnectTimeoutId=setTimeout(()=>{this.initConnect()},r)}disconnect(t=!1){var r;if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),this.removeAllSubscriptionListeners(),this.client.cancelRequest(this.getSubscriptionsCancelKey()),(r=this.eventSource)==null||r.close(),this.eventSource=null,this.clientId="",!t){this.reconnectAttempts=0;for(let n of this.pendingConnects)n.resolve();this.pendingConnects=[]}}}class dL extends bv{constructor(t,r){super(t),this.collectionIdOrName=r}get baseCrudPath(){return this.baseCollectionPath+"/records"}get baseCollectionPath(){return"/api/collections/"+encodeURIComponent(this.collectionIdOrName)}async subscribe(t,r,n){if(!t)throw new Error("Missing topic.");if(!r)throw new Error("Missing subscription callback.");return this.client.realtime.subscribe(this.collectionIdOrName+"/"+t,r,n)}async unsubscribe(t){return t?this.client.realtime.unsubscribe(this.collectionIdOrName+"/"+t):this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName)}async getFullList(t,r){if(typeof t=="number")return super.getFullList(t,r);const n=Object.assign({},t,r);return super.getFullList(n)}async getList(t=1,r=30,n){return super.getList(t,r,n)}async getFirstListItem(t,r){return super.getFirstListItem(t,r)}async getOne(t,r){return super.getOne(t,r)}async create(t,r){return super.create(t,r)}async update(t,r,n){return super.update(t,r,n).then(s=>{var o,i,a;return((o=this.client.authStore.model)==null?void 0:o.id)!==(s==null?void 0:s.id)||((i=this.client.authStore.model)==null?void 0:i.collectionId)!==this.collectionIdOrName&&((a=this.client.authStore.model)==null?void 0:a.collectionName)!==this.collectionIdOrName||this.client.authStore.save(this.client.authStore.token,s),s})}async delete(t,r){return super.delete(t,r).then(n=>{var s,o,i;return!n||((s=this.client.authStore.model)==null?void 0:s.id)!==t||((o=this.client.authStore.model)==null?void 0:o.collectionId)!==this.collectionIdOrName&&((i=this.client.authStore.model)==null?void 0:i.collectionName)!==this.collectionIdOrName||this.client.authStore.clear(),n})}authResponse(t){const r=this.decode((t==null?void 0:t.record)||{});return this.client.authStore.save(t==null?void 0:t.token,r),Object.assign({},t,{token:(t==null?void 0:t.token)||"",record:r})}async listAuthMethods(t){return t=Object.assign({method:"GET"},t),this.client.send(this.baseCollectionPath+"/auth-methods",t).then(r=>Object.assign({},r,{usernamePassword:!!(r!=null&&r.usernamePassword),emailPassword:!!(r!=null&&r.emailPassword),authProviders:Array.isArray(r==null?void 0:r.authProviders)?r==null?void 0:r.authProviders:[]}))}async authWithPassword(t,r,n,s){let o={method:"POST",body:{identity:t,password:r}};return o=Dr("This form of authWithPassword(usernameOrEmail, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(usernameOrEmail, pass, options?).",o,n,s),this.client.send(this.baseCollectionPath+"/auth-with-password",o).then(i=>this.authResponse(i))}async authWithOAuth2Code(t,r,n,s,o,i,a){let c={method:"POST",body:{provider:t,code:r,codeVerifier:n,redirectUrl:s,createData:o}};return c=Dr("This form of authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, body?, query?) is deprecated. Consider replacing it with authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, options?).",c,i,a),this.client.send(this.baseCollectionPath+"/auth-with-oauth2",c).then(u=>this.authResponse(u))}authWithOAuth2(...t){if(t.length>1||typeof(t==null?void 0:t[0])=="string")return console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),this.authWithOAuth2Code((t==null?void 0:t[0])||"",(t==null?void 0:t[1])||"",(t==null?void 0:t[2])||"",(t==null?void 0:t[3])||"",(t==null?void 0:t[4])||{},(t==null?void 0:t[5])||{},(t==null?void 0:t[6])||{});const r=(t==null?void 0:t[0])||{};let n=null;r.urlCallback||(n=G0(void 0));const s=new fk(this.client);function o(){n==null||n.close(),s.unsubscribe()}const i={},a=r.requestKey;return a&&(i.requestKey=a),this.listAuthMethods(i).then(c=>{var m;const u=c.authProviders.find(y=>y.name===r.provider);if(!u)throw new Vr(new Error(`Missing or invalid provider "${r.provider}".`));const d=this.client.buildUrl("/api/oauth2-redirect"),f=a?(m=this.client.cancelControllers)==null?void 0:m[a]:void 0;return f&&(f.signal.onabort=()=>{o()}),new Promise(async(y,x)=>{var g;try{await s.subscribe("@oauth2",async w=>{var j;const C=s.clientId;try{if(!w.state||C!==w.state)throw new Error("State parameters don't match.");if(w.error||!w.code)throw new Error("OAuth2 redirect error or missing code: "+w.error);const E=Object.assign({},r);delete E.provider,delete E.scopes,delete E.createData,delete E.urlCallback,(j=f==null?void 0:f.signal)!=null&&j.onabort&&(f.signal.onabort=null);const R=await this.authWithOAuth2Code(u.name,w.code,u.codeVerifier,d,r.createData,E);y(R)}catch(E){x(new Vr(E))}o()});const _={state:s.clientId};(g=r.scopes)!=null&&g.length&&(_.scope=r.scopes.join(" "));const p=this._replaceQueryParams(u.authUrl+d,_);await(r.urlCallback||function(w){n?n.location.href=w:n=G0(w)})(p)}catch(_){o(),x(new Vr(_))}})}).catch(c=>{throw o(),c})}async authRefresh(t,r){let n={method:"POST"};return n=Dr("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",n,t,r),this.client.send(this.baseCollectionPath+"/auth-refresh",n).then(s=>this.authResponse(s))}async requestPasswordReset(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-password-reset",s).then(()=>!0)}async confirmPasswordReset(t,r,n,s,o){let i={method:"POST",body:{token:t,password:r,passwordConfirm:n}};return i=Dr("This form of confirmPasswordReset(token, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(token, password, passwordConfirm, options?).",i,s,o),this.client.send(this.baseCollectionPath+"/confirm-password-reset",i).then(()=>!0)}async requestVerification(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestVerification(email, body?, query?) is deprecated. Consider replacing it with requestVerification(email, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-verification",s).then(()=>!0)}async confirmVerification(t,r,n){let s={method:"POST",body:{token:t}};return s=Dr("This form of confirmVerification(token, body?, query?) is deprecated. Consider replacing it with confirmVerification(token, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/confirm-verification",s).then(()=>{const o=Ji(t),i=this.client.authStore.model;return i&&!i.verified&&i.id===o.id&&i.collectionId===o.collectionId&&(i.verified=!0,this.client.authStore.save(this.client.authStore.token,i)),!0})}async requestEmailChange(t,r,n){let s={method:"POST",body:{newEmail:t}};return s=Dr("This form of requestEmailChange(newEmail, body?, query?) is deprecated. Consider replacing it with requestEmailChange(newEmail, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-email-change",s).then(()=>!0)}async confirmEmailChange(t,r,n,s){let o={method:"POST",body:{token:t,password:r}};return o=Dr("This form of confirmEmailChange(token, password, body?, query?) is deprecated. Consider replacing it with confirmEmailChange(token, password, options?).",o,n,s),this.client.send(this.baseCollectionPath+"/confirm-email-change",o).then(()=>{const i=Ji(t),a=this.client.authStore.model;return a&&a.id===i.id&&a.collectionId===i.collectionId&&this.client.authStore.clear(),!0})}async listExternalAuths(t,r){return r=Object.assign({method:"GET"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t)+"/external-auths",r)}async unlinkExternalAuth(t,r,n){return n=Object.assign({method:"DELETE"},n),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t)+"/external-auths/"+encodeURIComponent(r),n).then(()=>!0)}_replaceQueryParams(t,r={}){let n=t,s="";t.indexOf("?")>=0&&(n=t.substring(0,t.indexOf("?")),s=t.substring(t.indexOf("?")+1));const o={},i=s.split("&");for(const a of i){if(a=="")continue;const c=a.split("=");o[decodeURIComponent(c[0].replace(/\+/g," "))]=decodeURIComponent((c[1]||"").replace(/\+/g," "))}for(let a in r)r.hasOwnProperty(a)&&(r[a]==null?delete o[a]:o[a]=r[a]);s="";for(let a in o)o.hasOwnProperty(a)&&(s!=""&&(s+="&"),s+=encodeURIComponent(a.replace(/%20/g,"+"))+"="+encodeURIComponent(o[a].replace(/%20/g,"+")));return s!=""?n+"?"+s:n}}function G0(e){if(typeof window>"u"||!(window!=null&&window.open))throw new Vr(new Error("Not in a browser context - please pass a custom urlCallback function."));let t=1024,r=768,n=window.innerWidth,s=window.innerHeight;t=t>n?n:t,r=r>s?s:r;let o=n/2-t/2,i=s/2-r/2;return window.open(e,"popup_window","width="+t+",height="+r+",top="+i+",left="+o+",resizable,menubar=no")}class fL extends bv{get baseCrudPath(){return"/api/collections"}async import(t,r=!1,n){return n=Object.assign({method:"PUT",body:{collections:t,deleteMissing:r}},n),this.client.send(this.baseCrudPath+"/import",n).then(()=>!0)}}class hL extends di{async getList(t=1,r=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:t,perPage:r},n.query),this.client.send("/api/logs",n)}async getOne(t,r){if(!t)throw new Vr({url:this.client.buildUrl("/api/logs/"),status:404,response:{code:404,message:"Missing required log id.",data:{}}});return r=Object.assign({method:"GET"},r),this.client.send("/api/logs/"+encodeURIComponent(t),r)}async getStats(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/logs/stats",t)}}class pL extends di{async check(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/health",t)}}class mL extends di{getUrl(t,r,n={}){if(!r||!(t!=null&&t.id)||!(t!=null&&t.collectionId)&&!(t!=null&&t.collectionName))return"";const s=[];s.push("api"),s.push("files"),s.push(encodeURIComponent(t.collectionId||t.collectionName)),s.push(encodeURIComponent(t.id)),s.push(encodeURIComponent(r));let o=this.client.buildUrl(s.join("/"));if(Object.keys(n).length){n.download===!1&&delete n.download;const i=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+i}return o}async getToken(t){return t=Object.assign({method:"POST"},t),this.client.send("/api/files/token",t).then(r=>(r==null?void 0:r.token)||"")}}class gL extends di{async getFullList(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/backups",t)}async create(t,r){return r=Object.assign({method:"POST",body:{name:t}},r),this.client.send("/api/backups",r).then(()=>!0)}async upload(t,r){return r=Object.assign({method:"POST",body:t},r),this.client.send("/api/backups/upload",r).then(()=>!0)}async delete(t,r){return r=Object.assign({method:"DELETE"},r),this.client.send(`/api/backups/${encodeURIComponent(t)}`,r).then(()=>!0)}async restore(t,r){return r=Object.assign({method:"POST"},r),this.client.send(`/api/backups/${encodeURIComponent(t)}/restore`,r).then(()=>!0)}getDownloadUrl(t,r){return this.client.buildUrl(`/api/backups/${encodeURIComponent(r)}?token=${encodeURIComponent(t)}`)}}class vL{constructor(t="/",r,n="en-US"){this.cancelControllers={},this.recordServices={},this.enableAutoCancellation=!0,this.baseUrl=t,this.lang=n,this.authStore=r||new aL,this.admins=new cL(this),this.collections=new fL(this),this.files=new mL(this),this.logs=new hL(this),this.settings=new lL(this),this.realtime=new fk(this),this.health=new pL(this),this.backups=new gL(this)}collection(t){return this.recordServices[t]||(this.recordServices[t]=new dL(this,t)),this.recordServices[t]}autoCancellation(t){return this.enableAutoCancellation=!!t,this}cancelRequest(t){return this.cancelControllers[t]&&(this.cancelControllers[t].abort(),delete this.cancelControllers[t]),this}cancelAllRequests(){for(let t in this.cancelControllers)this.cancelControllers[t].abort();return this.cancelControllers={},this}filter(t,r){if(!r)return t;for(let n in r){let s=r[n];switch(typeof s){case"boolean":case"number":s=""+s;break;case"string":s="'"+s.replace(/'/g,"\\'")+"'";break;default:s=s===null?"null":s instanceof Date?"'"+s.toISOString().replace("T"," ")+"'":"'"+JSON.stringify(s).replace(/'/g,"\\'")+"'"}t=t.replaceAll("{:"+n+"}",s)}return t}getFileUrl(t,r,n={}){return this.files.getUrl(t,r,n)}buildUrl(t){var n;let r=this.baseUrl;return typeof window>"u"||!window.location||r.startsWith("https://")||r.startsWith("http://")||(r=(n=window.location.origin)!=null&&n.endsWith("/")?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(r+=window.location.pathname||"/",r+=r.endsWith("/")?"":"/"),r+=this.baseUrl),t&&(r+=r.endsWith("/")?"":"/",r+=t.startsWith("/")?t.substring(1):t),r}async send(t,r){r=this.initSendOptions(t,r);let n=this.buildUrl(t);if(this.beforeSend){const s=Object.assign({},await this.beforeSend(n,r));s.url!==void 0||s.options!==void 0?(n=s.url||n,r=s.options||r):Object.keys(s).length&&(r=s,console!=null&&console.warn&&console.warn("Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`."))}if(r.query!==void 0){const s=this.serializeQueryParams(r.query);s&&(n+=(n.includes("?")?"&":"?")+s),delete r.query}return this.getHeader(r.headers,"Content-Type")=="application/json"&&r.body&&typeof r.body!="string"&&(r.body=JSON.stringify(r.body)),(r.fetch||fetch)(n,r).then(async s=>{let o={};try{o=await s.json()}catch{}if(this.afterSend&&(o=await this.afterSend(s,o)),s.status>=400)throw new Vr({url:s.url,status:s.status,data:o});return o}).catch(s=>{throw new Vr(s)})}initSendOptions(t,r){if((r=Object.assign({method:"GET"},r)).body=this.convertToFormDataIfNeeded(r.body),dk(r),r.query=Object.assign({},r.params,r.query),r.requestKey===void 0&&(r.$autoCancel===!1||r.query.$autoCancel===!1?r.requestKey=null:(r.$cancelKey||r.query.$cancelKey)&&(r.requestKey=r.$cancelKey||r.query.$cancelKey)),delete r.$autoCancel,delete r.query.$autoCancel,delete r.$cancelKey,delete r.query.$cancelKey,this.getHeader(r.headers,"Content-Type")!==null||this.isFormData(r.body)||(r.headers=Object.assign({},r.headers,{"Content-Type":"application/json"})),this.getHeader(r.headers,"Accept-Language")===null&&(r.headers=Object.assign({},r.headers,{"Accept-Language":this.lang})),this.authStore.token&&this.getHeader(r.headers,"Authorization")===null&&(r.headers=Object.assign({},r.headers,{Authorization:this.authStore.token})),this.enableAutoCancellation&&r.requestKey!==null){const n=r.requestKey||(r.method||"GET")+t;delete r.requestKey,this.cancelRequest(n);const s=new AbortController;this.cancelControllers[n]=s,r.signal=s.signal}return r}convertToFormDataIfNeeded(t){if(typeof FormData>"u"||t===void 0||typeof t!="object"||t===null||this.isFormData(t)||!this.hasBlobField(t))return t;const r=new FormData;for(const n in t){const s=t[n];if(typeof s!="object"||this.hasBlobField({data:s})){const o=Array.isArray(s)?s:[s];for(let i of o)r.append(n,i)}else{let o={};o[n]=s,r.append("@jsonPayload",JSON.stringify(o))}}return r}hasBlobField(t){for(const r in t){const n=Array.isArray(t[r])?t[r]:[t[r]];for(const s of n)if(typeof Blob<"u"&&s instanceof Blob||typeof File<"u"&&s instanceof File)return!0}return!1}getHeader(t,r){t=t||{},r=r.toLowerCase();for(let n in t)if(n.toLowerCase()==r)return t[n];return null}isFormData(t){return t&&(t.constructor.name==="FormData"||typeof FormData<"u"&&t instanceof FormData)}serializeQueryParams(t){const r=[];for(const n in t){if(t[n]===null)continue;const s=t[n],o=encodeURIComponent(n);if(Array.isArray(s))for(const i of s)r.push(o+"="+encodeURIComponent(i));else s instanceof Date?r.push(o+"="+encodeURIComponent(s.toISOString())):typeof s!==null&&typeof s=="object"?r.push(o+"="+encodeURIComponent(JSON.stringify(s))):r.push(o+"="+encodeURIComponent(s))}return r.join("&")}}var yL={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const xL=yL.VITE_API_DOMAIN;console.log(xL);let wu;const st=()=>wu||(wu=new vL("/"),wu);//! moment.js +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},XI="DialogDescriptionWarning",QI=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ak(XI).contentName}}.`;return v.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},mv=ZS,gv=GS,vv=XS,Ec=QS,Nc=JS,Tc=tk,Rc=nk,Tf=ok;const yv=mv,xv=gv,JI=vv,lk=v.forwardRef(({className:e,...t},r)=>l.jsx(Ec,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));lk.displayName=Ec.displayName;const eL=_c("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Rf=v.forwardRef(({side:e="right",className:t,children:r,...n},s)=>l.jsxs(JI,{children:[l.jsx(lk,{}),l.jsxs(Nc,{ref:s,className:ae(eL({side:e}),t),...n,children:[r,l.jsxs(Tf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[l.jsx(Fg,{className:"h-4 w-4 dark:text-stone-200"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rf.displayName=Nc.displayName;const wv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});wv.displayName="SheetHeader";const _v=v.forwardRef(({className:e,...t},r)=>l.jsx(Tc,{ref:r,className:ae("text-lg font-semibold text-foreground",e),...t}));_v.displayName=Tc.displayName;const tL=v.forwardRef(({className:e,...t},r)=>l.jsx(Rc,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));tL.displayName=Rc.displayName;class Vr extends Error{constructor(t){var r,n,s,o;super("ClientResponseError"),this.url="",this.status=0,this.response={},this.isAbort=!1,this.originalError=null,Object.setPrototypeOf(this,Vr.prototype),t!==null&&typeof t=="object"&&(this.url=typeof t.url=="string"?t.url:"",this.status=typeof t.status=="number"?t.status:0,this.isAbort=!!t.isAbort,this.originalError=t.originalError,t.response!==null&&typeof t.response=="object"?this.response=t.response:t.data!==null&&typeof t.data=="object"?this.response=t.data:this.response={}),this.originalError||t instanceof Vr||(this.originalError=t),typeof DOMException<"u"&&t instanceof DOMException&&(this.isAbort=!0),this.name="ClientResponseError "+this.status,this.message=(r=this.response)==null?void 0:r.message,this.message||(this.isAbort?this.message="The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.":(o=(s=(n=this.originalError)==null?void 0:n.cause)==null?void 0:s.message)!=null&&o.includes("ECONNREFUSED ::1")?this.message="Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).":this.message="Something went wrong while processing your request.")}get data(){return this.response}toJSON(){return{...this}}}const xu=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function rL(e,t){const r={};if(typeof e!="string")return r;const n=Object.assign({},{}).decode||nL;let s=0;for(;s0&&(!r.exp||r.exp-t>Date.now()/1e3))}ck=typeof atob!="function"||oL?e=>{let t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,s=0,o=0,i="";n=t.charAt(o++);~n&&(r=s%4?64*r+n:n,s++%4)?i+=String.fromCharCode(255&r>>(-2*s&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return i}:atob;const K0="pb_auth";class iL{constructor(){this.baseToken="",this.baseModel=null,this._onChangeCallbacks=[]}get token(){return this.baseToken}get model(){return this.baseModel}get isValid(){return!uk(this.token)}get isAdmin(){return Ji(this.token).type==="admin"}get isAuthRecord(){return Ji(this.token).type==="authRecord"}save(t,r){this.baseToken=t||"",this.baseModel=r||null,this.triggerChange()}clear(){this.baseToken="",this.baseModel=null,this.triggerChange()}loadFromCookie(t,r=K0){const n=rL(t||"")[r]||"";let s={};try{s=JSON.parse(n),(typeof s===null||typeof s!="object"||Array.isArray(s))&&(s={})}catch{}this.save(s.token||"",s.model||null)}exportToCookie(t,r=K0){var c,u;const n={secure:!0,sameSite:!0,httpOnly:!0,path:"/"},s=Ji(this.token);n.expires=s!=null&&s.exp?new Date(1e3*s.exp):new Date("1970-01-01"),t=Object.assign({},n,t);const o={token:this.token,model:this.model?JSON.parse(JSON.stringify(this.model)):null};let i=Z0(r,JSON.stringify(o),t);const a=typeof Blob<"u"?new Blob([i]).size:i.length;if(o.model&&a>4096){o.model={id:(c=o==null?void 0:o.model)==null?void 0:c.id,email:(u=o==null?void 0:o.model)==null?void 0:u.email};const d=["collectionId","username","verified"];for(const f in this.model)d.includes(f)&&(o.model[f]=this.model[f]);i=Z0(r,JSON.stringify(o),t)}return i}onChange(t,r=!1){return this._onChangeCallbacks.push(t),r&&t(this.token,this.model),()=>{for(let n=this._onChangeCallbacks.length-1;n>=0;n--)if(this._onChangeCallbacks[n]==t)return delete this._onChangeCallbacks[n],void this._onChangeCallbacks.splice(n,1)}}triggerChange(){for(const t of this._onChangeCallbacks)t&&t(this.token,this.model)}}class aL extends iL{constructor(t="pocketbase_auth"){super(),this.storageFallback={},this.storageKey=t,this._bindStorageEvent()}get token(){return(this._storageGet(this.storageKey)||{}).token||""}get model(){return(this._storageGet(this.storageKey)||{}).model||null}save(t,r){this._storageSet(this.storageKey,{token:t,model:r}),super.save(t,r)}clear(){this._storageRemove(this.storageKey),super.clear()}_storageGet(t){if(typeof window<"u"&&(window!=null&&window.localStorage)){const r=window.localStorage.getItem(t)||"";try{return JSON.parse(r)}catch{return r}}return this.storageFallback[t]}_storageSet(t,r){if(typeof window<"u"&&(window!=null&&window.localStorage)){let n=r;typeof r!="string"&&(n=JSON.stringify(r)),window.localStorage.setItem(t,n)}else this.storageFallback[t]=r}_storageRemove(t){var r;typeof window<"u"&&(window!=null&&window.localStorage)&&((r=window.localStorage)==null||r.removeItem(t)),delete this.storageFallback[t]}_bindStorageEvent(){typeof window<"u"&&(window!=null&&window.localStorage)&&window.addEventListener&&window.addEventListener("storage",t=>{if(t.key!=this.storageKey)return;const r=this._storageGet(this.storageKey)||{};super.save(r.token||"",r.model||null)})}}class di{constructor(t){this.client=t}}class lL extends di{async getAll(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/settings",t)}async update(t,r){return r=Object.assign({method:"PATCH",body:t},r),this.client.send("/api/settings",r)}async testS3(t="storage",r){return r=Object.assign({method:"POST",body:{filesystem:t}},r),this.client.send("/api/settings/test/s3",r).then(()=>!0)}async testEmail(t,r,n){return n=Object.assign({method:"POST",body:{email:t,template:r}},n),this.client.send("/api/settings/test/email",n).then(()=>!0)}async generateAppleClientSecret(t,r,n,s,o,i){return i=Object.assign({method:"POST",body:{clientId:t,teamId:r,keyId:n,privateKey:s,duration:o}},i),this.client.send("/api/settings/apple/generate-client-secret",i)}}class bv extends di{decode(t){return t}async getFullList(t,r){if(typeof t=="number")return this._getFullList(t,r);let n=500;return(r=Object.assign({},t,r)).batch&&(n=r.batch,delete r.batch),this._getFullList(n,r)}async getList(t=1,r=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:t,perPage:r},n.query),this.client.send(this.baseCrudPath,n).then(s=>{var o;return s.items=((o=s.items)==null?void 0:o.map(i=>this.decode(i)))||[],s})}async getFirstListItem(t,r){return(r=Object.assign({requestKey:"one_by_filter_"+this.baseCrudPath+"_"+t},r)).query=Object.assign({filter:t,skipTotal:1},r.query),this.getList(1,1,r).then(n=>{var s;if(!((s=n==null?void 0:n.items)!=null&&s.length))throw new Vr({status:404,response:{code:404,message:"The requested resource wasn't found.",data:{}}});return n.items[0]})}async getOne(t,r){if(!t)throw new Vr({url:this.client.buildUrl(this.baseCrudPath+"/"),status:404,response:{code:404,message:"Missing required record id.",data:{}}});return r=Object.assign({method:"GET"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),r).then(n=>this.decode(n))}async create(t,r){return r=Object.assign({method:"POST",body:t},r),this.client.send(this.baseCrudPath,r).then(n=>this.decode(n))}async update(t,r,n){return n=Object.assign({method:"PATCH",body:r},n),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),n).then(s=>this.decode(s))}async delete(t,r){return r=Object.assign({method:"DELETE"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),r).then(()=>!0)}_getFullList(t=500,r){(r=r||{}).query=Object.assign({skipTotal:1},r.query);let n=[],s=async o=>this.getList(o,t||500,r).then(i=>{const a=i.items;return n=n.concat(a),a.length==i.perPage?s(o+1):n});return s(1)}}function Dr(e,t,r,n){const s=n!==void 0;return s||r!==void 0?s?(console.warn(e),t.body=Object.assign({},t.body,r),t.query=Object.assign({},t.query,n),t):Object.assign(t,r):t}function Kh(e){var t;(t=e._resetAutoRefresh)==null||t.call(e)}class cL extends bv{get baseCrudPath(){return"/api/admins"}async update(t,r,n){return super.update(t,r,n).then(s=>{var o,i;return((o=this.client.authStore.model)==null?void 0:o.id)===s.id&&((i=this.client.authStore.model)==null?void 0:i.collectionId)===void 0&&this.client.authStore.save(this.client.authStore.token,s),s})}async delete(t,r){return super.delete(t,r).then(n=>{var s,o;return n&&((s=this.client.authStore.model)==null?void 0:s.id)===t&&((o=this.client.authStore.model)==null?void 0:o.collectionId)===void 0&&this.client.authStore.clear(),n})}authResponse(t){const r=this.decode((t==null?void 0:t.admin)||{});return t!=null&&t.token&&(t!=null&&t.admin)&&this.client.authStore.save(t.token,r),Object.assign({},t,{token:(t==null?void 0:t.token)||"",admin:r})}async authWithPassword(t,r,n,s){let o={method:"POST",body:{identity:t,password:r}};o=Dr("This form of authWithPassword(email, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(email, pass, options?).",o,n,s);const i=o.autoRefreshThreshold;delete o.autoRefreshThreshold,o.autoRefresh||Kh(this.client);let a=await this.client.send(this.baseCrudPath+"/auth-with-password",o);return a=this.authResponse(a),i&&function(u,d,f,m){Kh(u);const y=u.beforeSend,x=u.authStore.model,g=u.authStore.onChange((_,p)=>{(!_||(p==null?void 0:p.id)!=(x==null?void 0:x.id)||(p!=null&&p.collectionId||x!=null&&x.collectionId)&&(p==null?void 0:p.collectionId)!=(x==null?void 0:x.collectionId))&&Kh(u)});u._resetAutoRefresh=function(){g(),u.beforeSend=y,delete u._resetAutoRefresh},u.beforeSend=async(_,p)=>{var j;const h=u.authStore.token;if((j=p.query)!=null&&j.autoRefresh)return y?y(_,p):{url:_,sendOptions:p};let w=u.authStore.isValid;if(w&&uk(u.authStore.token,d))try{await f()}catch{w=!1}w||await m();const C=p.headers||{};for(let E in C)if(E.toLowerCase()=="authorization"&&h==C[E]&&u.authStore.token){C[E]=u.authStore.token;break}return p.headers=C,y?y(_,p):{url:_,sendOptions:p}}}(this.client,i,()=>this.authRefresh({autoRefresh:!0}),()=>this.authWithPassword(t,r,Object.assign({autoRefresh:!0},o))),a}async authRefresh(t,r){let n={method:"POST"};return n=Dr("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",n,t,r),this.client.send(this.baseCrudPath+"/auth-refresh",n).then(this.authResponse.bind(this))}async requestPasswordReset(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",s,r,n),this.client.send(this.baseCrudPath+"/request-password-reset",s).then(()=>!0)}async confirmPasswordReset(t,r,n,s,o){let i={method:"POST",body:{token:t,password:r,passwordConfirm:n}};return i=Dr("This form of confirmPasswordReset(resetToken, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(resetToken, password, passwordConfirm, options?).",i,s,o),this.client.send(this.baseCrudPath+"/confirm-password-reset",i).then(()=>!0)}}const uL=["requestKey","$cancelKey","$autoCancel","fetch","headers","body","query","params","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy","signal","window"];function dk(e){if(e){e.query=e.query||{};for(let t in e)uL.includes(t)||(e.query[t]=e[t],delete e[t])}}class fk extends di{constructor(){super(...arguments),this.clientId="",this.eventSource=null,this.subscriptions={},this.lastSentSubscriptions=[],this.maxConnectTimeout=15e3,this.reconnectAttempts=0,this.maxReconnectAttempts=1/0,this.predefinedReconnectIntervals=[200,300,500,1e3,1200,1500,2e3],this.pendingConnects=[]}get isConnected(){return!!this.eventSource&&!!this.clientId&&!this.pendingConnects.length}async subscribe(t,r,n){var i;if(!t)throw new Error("topic must be set.");let s=t;if(n){dk(n);const a="options="+encodeURIComponent(JSON.stringify({query:n.query,headers:n.headers}));s+=(s.includes("?")?"&":"?")+a}const o=function(a){const c=a;let u;try{u=JSON.parse(c==null?void 0:c.data)}catch{}r(u||{})};return this.subscriptions[s]||(this.subscriptions[s]=[]),this.subscriptions[s].push(o),this.isConnected?this.subscriptions[s].length===1?await this.submitSubscriptions():(i=this.eventSource)==null||i.addEventListener(s,o):await this.connect(),async()=>this.unsubscribeByTopicAndListener(t,o)}async unsubscribe(t){var n;let r=!1;if(t){const s=this.getSubscriptionsByTopic(t);for(let o in s)if(this.hasSubscriptionListeners(o)){for(let i of this.subscriptions[o])(n=this.eventSource)==null||n.removeEventListener(o,i);delete this.subscriptions[o],r||(r=!0)}}else this.subscriptions={};this.hasSubscriptionListeners()?r&&await this.submitSubscriptions():this.disconnect()}async unsubscribeByPrefix(t){var n;let r=!1;for(let s in this.subscriptions)if((s+"?").startsWith(t)){r=!0;for(let o of this.subscriptions[s])(n=this.eventSource)==null||n.removeEventListener(s,o);delete this.subscriptions[s]}r&&(this.hasSubscriptionListeners()?await this.submitSubscriptions():this.disconnect())}async unsubscribeByTopicAndListener(t,r){var o;let n=!1;const s=this.getSubscriptionsByTopic(t);for(let i in s){if(!Array.isArray(this.subscriptions[i])||!this.subscriptions[i].length)continue;let a=!1;for(let c=this.subscriptions[i].length-1;c>=0;c--)this.subscriptions[i][c]===r&&(a=!0,delete this.subscriptions[i][c],this.subscriptions[i].splice(c,1),(o=this.eventSource)==null||o.removeEventListener(i,r));a&&(this.subscriptions[i].length||delete this.subscriptions[i],n||this.hasSubscriptionListeners(i)||(n=!0))}this.hasSubscriptionListeners()?n&&await this.submitSubscriptions():this.disconnect()}hasSubscriptionListeners(t){var r,n;if(this.subscriptions=this.subscriptions||{},t)return!!((r=this.subscriptions[t])!=null&&r.length);for(let s in this.subscriptions)if((n=this.subscriptions[s])!=null&&n.length)return!0;return!1}async submitSubscriptions(){if(this.clientId)return this.addAllSubscriptionListeners(),this.lastSentSubscriptions=this.getNonEmptySubscriptionKeys(),this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentSubscriptions},requestKey:this.getSubscriptionsCancelKey()}).catch(t=>{if(!(t!=null&&t.isAbort))throw t})}getSubscriptionsCancelKey(){return"realtime_"+this.clientId}getSubscriptionsByTopic(t){const r={};t=t.includes("?")?t:t+"?";for(let n in this.subscriptions)(n+"?").startsWith(t)&&(r[n]=this.subscriptions[n]);return r}getNonEmptySubscriptionKeys(){const t=[];for(let r in this.subscriptions)this.subscriptions[r].length&&t.push(r);return t}addAllSubscriptionListeners(){if(this.eventSource){this.removeAllSubscriptionListeners();for(let t in this.subscriptions)for(let r of this.subscriptions[t])this.eventSource.addEventListener(t,r)}}removeAllSubscriptionListeners(){if(this.eventSource)for(let t in this.subscriptions)for(let r of this.subscriptions[t])this.eventSource.removeEventListener(t,r)}async connect(){if(!(this.reconnectAttempts>0))return new Promise((t,r)=>{this.pendingConnects.push({resolve:t,reject:r}),this.pendingConnects.length>1||this.initConnect()})}initConnect(){this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout(()=>{this.connectErrorHandler(new Error("EventSource connect took too long."))},this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=t=>{this.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",t=>{const r=t;this.clientId=r==null?void 0:r.lastEventId,this.submitSubscriptions().then(async()=>{let n=3;for(;this.hasUnsentSubscriptions()&&n>0;)n--,await this.submitSubscriptions()}).then(()=>{for(let s of this.pendingConnects)s.resolve();this.pendingConnects=[],this.reconnectAttempts=0,clearTimeout(this.reconnectTimeoutId),clearTimeout(this.connectTimeoutId);const n=this.getSubscriptionsByTopic("PB_CONNECT");for(let s in n)for(let o of n[s])o(t)}).catch(n=>{this.clientId="",this.connectErrorHandler(n)})})}hasUnsentSubscriptions(){const t=this.getNonEmptySubscriptionKeys();if(t.length!=this.lastSentSubscriptions.length)return!0;for(const r of t)if(!this.lastSentSubscriptions.includes(r))return!0;return!1}connectErrorHandler(t){if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),!this.clientId&&!this.reconnectAttempts||this.reconnectAttempts>this.maxReconnectAttempts){for(let n of this.pendingConnects)n.reject(new Vr(t));return this.pendingConnects=[],void this.disconnect()}this.disconnect(!0);const r=this.predefinedReconnectIntervals[this.reconnectAttempts]||this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length-1];this.reconnectAttempts++,this.reconnectTimeoutId=setTimeout(()=>{this.initConnect()},r)}disconnect(t=!1){var r;if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),this.removeAllSubscriptionListeners(),this.client.cancelRequest(this.getSubscriptionsCancelKey()),(r=this.eventSource)==null||r.close(),this.eventSource=null,this.clientId="",!t){this.reconnectAttempts=0;for(let n of this.pendingConnects)n.resolve();this.pendingConnects=[]}}}class dL extends bv{constructor(t,r){super(t),this.collectionIdOrName=r}get baseCrudPath(){return this.baseCollectionPath+"/records"}get baseCollectionPath(){return"/api/collections/"+encodeURIComponent(this.collectionIdOrName)}async subscribe(t,r,n){if(!t)throw new Error("Missing topic.");if(!r)throw new Error("Missing subscription callback.");return this.client.realtime.subscribe(this.collectionIdOrName+"/"+t,r,n)}async unsubscribe(t){return t?this.client.realtime.unsubscribe(this.collectionIdOrName+"/"+t):this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName)}async getFullList(t,r){if(typeof t=="number")return super.getFullList(t,r);const n=Object.assign({},t,r);return super.getFullList(n)}async getList(t=1,r=30,n){return super.getList(t,r,n)}async getFirstListItem(t,r){return super.getFirstListItem(t,r)}async getOne(t,r){return super.getOne(t,r)}async create(t,r){return super.create(t,r)}async update(t,r,n){return super.update(t,r,n).then(s=>{var o,i,a;return((o=this.client.authStore.model)==null?void 0:o.id)!==(s==null?void 0:s.id)||((i=this.client.authStore.model)==null?void 0:i.collectionId)!==this.collectionIdOrName&&((a=this.client.authStore.model)==null?void 0:a.collectionName)!==this.collectionIdOrName||this.client.authStore.save(this.client.authStore.token,s),s})}async delete(t,r){return super.delete(t,r).then(n=>{var s,o,i;return!n||((s=this.client.authStore.model)==null?void 0:s.id)!==t||((o=this.client.authStore.model)==null?void 0:o.collectionId)!==this.collectionIdOrName&&((i=this.client.authStore.model)==null?void 0:i.collectionName)!==this.collectionIdOrName||this.client.authStore.clear(),n})}authResponse(t){const r=this.decode((t==null?void 0:t.record)||{});return this.client.authStore.save(t==null?void 0:t.token,r),Object.assign({},t,{token:(t==null?void 0:t.token)||"",record:r})}async listAuthMethods(t){return t=Object.assign({method:"GET"},t),this.client.send(this.baseCollectionPath+"/auth-methods",t).then(r=>Object.assign({},r,{usernamePassword:!!(r!=null&&r.usernamePassword),emailPassword:!!(r!=null&&r.emailPassword),authProviders:Array.isArray(r==null?void 0:r.authProviders)?r==null?void 0:r.authProviders:[]}))}async authWithPassword(t,r,n,s){let o={method:"POST",body:{identity:t,password:r}};return o=Dr("This form of authWithPassword(usernameOrEmail, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(usernameOrEmail, pass, options?).",o,n,s),this.client.send(this.baseCollectionPath+"/auth-with-password",o).then(i=>this.authResponse(i))}async authWithOAuth2Code(t,r,n,s,o,i,a){let c={method:"POST",body:{provider:t,code:r,codeVerifier:n,redirectUrl:s,createData:o}};return c=Dr("This form of authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, body?, query?) is deprecated. Consider replacing it with authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, options?).",c,i,a),this.client.send(this.baseCollectionPath+"/auth-with-oauth2",c).then(u=>this.authResponse(u))}authWithOAuth2(...t){if(t.length>1||typeof(t==null?void 0:t[0])=="string")return console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),this.authWithOAuth2Code((t==null?void 0:t[0])||"",(t==null?void 0:t[1])||"",(t==null?void 0:t[2])||"",(t==null?void 0:t[3])||"",(t==null?void 0:t[4])||{},(t==null?void 0:t[5])||{},(t==null?void 0:t[6])||{});const r=(t==null?void 0:t[0])||{};let n=null;r.urlCallback||(n=G0(void 0));const s=new fk(this.client);function o(){n==null||n.close(),s.unsubscribe()}const i={},a=r.requestKey;return a&&(i.requestKey=a),this.listAuthMethods(i).then(c=>{var m;const u=c.authProviders.find(y=>y.name===r.provider);if(!u)throw new Vr(new Error(`Missing or invalid provider "${r.provider}".`));const d=this.client.buildUrl("/api/oauth2-redirect"),f=a?(m=this.client.cancelControllers)==null?void 0:m[a]:void 0;return f&&(f.signal.onabort=()=>{o()}),new Promise(async(y,x)=>{var g;try{await s.subscribe("@oauth2",async w=>{var j;const C=s.clientId;try{if(!w.state||C!==w.state)throw new Error("State parameters don't match.");if(w.error||!w.code)throw new Error("OAuth2 redirect error or missing code: "+w.error);const E=Object.assign({},r);delete E.provider,delete E.scopes,delete E.createData,delete E.urlCallback,(j=f==null?void 0:f.signal)!=null&&j.onabort&&(f.signal.onabort=null);const R=await this.authWithOAuth2Code(u.name,w.code,u.codeVerifier,d,r.createData,E);y(R)}catch(E){x(new Vr(E))}o()});const _={state:s.clientId};(g=r.scopes)!=null&&g.length&&(_.scope=r.scopes.join(" "));const p=this._replaceQueryParams(u.authUrl+d,_);await(r.urlCallback||function(w){n?n.location.href=w:n=G0(w)})(p)}catch(_){o(),x(new Vr(_))}})}).catch(c=>{throw o(),c})}async authRefresh(t,r){let n={method:"POST"};return n=Dr("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",n,t,r),this.client.send(this.baseCollectionPath+"/auth-refresh",n).then(s=>this.authResponse(s))}async requestPasswordReset(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-password-reset",s).then(()=>!0)}async confirmPasswordReset(t,r,n,s,o){let i={method:"POST",body:{token:t,password:r,passwordConfirm:n}};return i=Dr("This form of confirmPasswordReset(token, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(token, password, passwordConfirm, options?).",i,s,o),this.client.send(this.baseCollectionPath+"/confirm-password-reset",i).then(()=>!0)}async requestVerification(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestVerification(email, body?, query?) is deprecated. Consider replacing it with requestVerification(email, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-verification",s).then(()=>!0)}async confirmVerification(t,r,n){let s={method:"POST",body:{token:t}};return s=Dr("This form of confirmVerification(token, body?, query?) is deprecated. Consider replacing it with confirmVerification(token, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/confirm-verification",s).then(()=>{const o=Ji(t),i=this.client.authStore.model;return i&&!i.verified&&i.id===o.id&&i.collectionId===o.collectionId&&(i.verified=!0,this.client.authStore.save(this.client.authStore.token,i)),!0})}async requestEmailChange(t,r,n){let s={method:"POST",body:{newEmail:t}};return s=Dr("This form of requestEmailChange(newEmail, body?, query?) is deprecated. Consider replacing it with requestEmailChange(newEmail, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-email-change",s).then(()=>!0)}async confirmEmailChange(t,r,n,s){let o={method:"POST",body:{token:t,password:r}};return o=Dr("This form of confirmEmailChange(token, password, body?, query?) is deprecated. Consider replacing it with confirmEmailChange(token, password, options?).",o,n,s),this.client.send(this.baseCollectionPath+"/confirm-email-change",o).then(()=>{const i=Ji(t),a=this.client.authStore.model;return a&&a.id===i.id&&a.collectionId===i.collectionId&&this.client.authStore.clear(),!0})}async listExternalAuths(t,r){return r=Object.assign({method:"GET"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t)+"/external-auths",r)}async unlinkExternalAuth(t,r,n){return n=Object.assign({method:"DELETE"},n),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t)+"/external-auths/"+encodeURIComponent(r),n).then(()=>!0)}_replaceQueryParams(t,r={}){let n=t,s="";t.indexOf("?")>=0&&(n=t.substring(0,t.indexOf("?")),s=t.substring(t.indexOf("?")+1));const o={},i=s.split("&");for(const a of i){if(a=="")continue;const c=a.split("=");o[decodeURIComponent(c[0].replace(/\+/g," "))]=decodeURIComponent((c[1]||"").replace(/\+/g," "))}for(let a in r)r.hasOwnProperty(a)&&(r[a]==null?delete o[a]:o[a]=r[a]);s="";for(let a in o)o.hasOwnProperty(a)&&(s!=""&&(s+="&"),s+=encodeURIComponent(a.replace(/%20/g,"+"))+"="+encodeURIComponent(o[a].replace(/%20/g,"+")));return s!=""?n+"?"+s:n}}function G0(e){if(typeof window>"u"||!(window!=null&&window.open))throw new Vr(new Error("Not in a browser context - please pass a custom urlCallback function."));let t=1024,r=768,n=window.innerWidth,s=window.innerHeight;t=t>n?n:t,r=r>s?s:r;let o=n/2-t/2,i=s/2-r/2;return window.open(e,"popup_window","width="+t+",height="+r+",top="+i+",left="+o+",resizable,menubar=no")}class fL extends bv{get baseCrudPath(){return"/api/collections"}async import(t,r=!1,n){return n=Object.assign({method:"PUT",body:{collections:t,deleteMissing:r}},n),this.client.send(this.baseCrudPath+"/import",n).then(()=>!0)}}class hL extends di{async getList(t=1,r=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:t,perPage:r},n.query),this.client.send("/api/logs",n)}async getOne(t,r){if(!t)throw new Vr({url:this.client.buildUrl("/api/logs/"),status:404,response:{code:404,message:"Missing required log id.",data:{}}});return r=Object.assign({method:"GET"},r),this.client.send("/api/logs/"+encodeURIComponent(t),r)}async getStats(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/logs/stats",t)}}class pL extends di{async check(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/health",t)}}class mL extends di{getUrl(t,r,n={}){if(!r||!(t!=null&&t.id)||!(t!=null&&t.collectionId)&&!(t!=null&&t.collectionName))return"";const s=[];s.push("api"),s.push("files"),s.push(encodeURIComponent(t.collectionId||t.collectionName)),s.push(encodeURIComponent(t.id)),s.push(encodeURIComponent(r));let o=this.client.buildUrl(s.join("/"));if(Object.keys(n).length){n.download===!1&&delete n.download;const i=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+i}return o}async getToken(t){return t=Object.assign({method:"POST"},t),this.client.send("/api/files/token",t).then(r=>(r==null?void 0:r.token)||"")}}class gL extends di{async getFullList(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/backups",t)}async create(t,r){return r=Object.assign({method:"POST",body:{name:t}},r),this.client.send("/api/backups",r).then(()=>!0)}async upload(t,r){return r=Object.assign({method:"POST",body:t},r),this.client.send("/api/backups/upload",r).then(()=>!0)}async delete(t,r){return r=Object.assign({method:"DELETE"},r),this.client.send(`/api/backups/${encodeURIComponent(t)}`,r).then(()=>!0)}async restore(t,r){return r=Object.assign({method:"POST"},r),this.client.send(`/api/backups/${encodeURIComponent(t)}/restore`,r).then(()=>!0)}getDownloadUrl(t,r){return this.client.buildUrl(`/api/backups/${encodeURIComponent(r)}?token=${encodeURIComponent(t)}`)}}class vL{constructor(t="/",r,n="en-US"){this.cancelControllers={},this.recordServices={},this.enableAutoCancellation=!0,this.baseUrl=t,this.lang=n,this.authStore=r||new aL,this.admins=new cL(this),this.collections=new fL(this),this.files=new mL(this),this.logs=new hL(this),this.settings=new lL(this),this.realtime=new fk(this),this.health=new pL(this),this.backups=new gL(this)}collection(t){return this.recordServices[t]||(this.recordServices[t]=new dL(this,t)),this.recordServices[t]}autoCancellation(t){return this.enableAutoCancellation=!!t,this}cancelRequest(t){return this.cancelControllers[t]&&(this.cancelControllers[t].abort(),delete this.cancelControllers[t]),this}cancelAllRequests(){for(let t in this.cancelControllers)this.cancelControllers[t].abort();return this.cancelControllers={},this}filter(t,r){if(!r)return t;for(let n in r){let s=r[n];switch(typeof s){case"boolean":case"number":s=""+s;break;case"string":s="'"+s.replace(/'/g,"\\'")+"'";break;default:s=s===null?"null":s instanceof Date?"'"+s.toISOString().replace("T"," ")+"'":"'"+JSON.stringify(s).replace(/'/g,"\\'")+"'"}t=t.replaceAll("{:"+n+"}",s)}return t}getFileUrl(t,r,n={}){return this.files.getUrl(t,r,n)}buildUrl(t){var n;let r=this.baseUrl;return typeof window>"u"||!window.location||r.startsWith("https://")||r.startsWith("http://")||(r=(n=window.location.origin)!=null&&n.endsWith("/")?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(r+=window.location.pathname||"/",r+=r.endsWith("/")?"":"/"),r+=this.baseUrl),t&&(r+=r.endsWith("/")?"":"/",r+=t.startsWith("/")?t.substring(1):t),r}async send(t,r){r=this.initSendOptions(t,r);let n=this.buildUrl(t);if(this.beforeSend){const s=Object.assign({},await this.beforeSend(n,r));s.url!==void 0||s.options!==void 0?(n=s.url||n,r=s.options||r):Object.keys(s).length&&(r=s,console!=null&&console.warn&&console.warn("Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`."))}if(r.query!==void 0){const s=this.serializeQueryParams(r.query);s&&(n+=(n.includes("?")?"&":"?")+s),delete r.query}return this.getHeader(r.headers,"Content-Type")=="application/json"&&r.body&&typeof r.body!="string"&&(r.body=JSON.stringify(r.body)),(r.fetch||fetch)(n,r).then(async s=>{let o={};try{o=await s.json()}catch{}if(this.afterSend&&(o=await this.afterSend(s,o)),s.status>=400)throw new Vr({url:s.url,status:s.status,data:o});return o}).catch(s=>{throw new Vr(s)})}initSendOptions(t,r){if((r=Object.assign({method:"GET"},r)).body=this.convertToFormDataIfNeeded(r.body),dk(r),r.query=Object.assign({},r.params,r.query),r.requestKey===void 0&&(r.$autoCancel===!1||r.query.$autoCancel===!1?r.requestKey=null:(r.$cancelKey||r.query.$cancelKey)&&(r.requestKey=r.$cancelKey||r.query.$cancelKey)),delete r.$autoCancel,delete r.query.$autoCancel,delete r.$cancelKey,delete r.query.$cancelKey,this.getHeader(r.headers,"Content-Type")!==null||this.isFormData(r.body)||(r.headers=Object.assign({},r.headers,{"Content-Type":"application/json"})),this.getHeader(r.headers,"Accept-Language")===null&&(r.headers=Object.assign({},r.headers,{"Accept-Language":this.lang})),this.authStore.token&&this.getHeader(r.headers,"Authorization")===null&&(r.headers=Object.assign({},r.headers,{Authorization:this.authStore.token})),this.enableAutoCancellation&&r.requestKey!==null){const n=r.requestKey||(r.method||"GET")+t;delete r.requestKey,this.cancelRequest(n);const s=new AbortController;this.cancelControllers[n]=s,r.signal=s.signal}return r}convertToFormDataIfNeeded(t){if(typeof FormData>"u"||t===void 0||typeof t!="object"||t===null||this.isFormData(t)||!this.hasBlobField(t))return t;const r=new FormData;for(const n in t){const s=t[n];if(typeof s!="object"||this.hasBlobField({data:s})){const o=Array.isArray(s)?s:[s];for(let i of o)r.append(n,i)}else{let o={};o[n]=s,r.append("@jsonPayload",JSON.stringify(o))}}return r}hasBlobField(t){for(const r in t){const n=Array.isArray(t[r])?t[r]:[t[r]];for(const s of n)if(typeof Blob<"u"&&s instanceof Blob||typeof File<"u"&&s instanceof File)return!0}return!1}getHeader(t,r){t=t||{},r=r.toLowerCase();for(let n in t)if(n.toLowerCase()==r)return t[n];return null}isFormData(t){return t&&(t.constructor.name==="FormData"||typeof FormData<"u"&&t instanceof FormData)}serializeQueryParams(t){const r=[];for(const n in t){if(t[n]===null)continue;const s=t[n],o=encodeURIComponent(n);if(Array.isArray(s))for(const i of s)r.push(o+"="+encodeURIComponent(i));else s instanceof Date?r.push(o+"="+encodeURIComponent(s.toISOString())):typeof s!==null&&typeof s=="object"?r.push(o+"="+encodeURIComponent(JSON.stringify(s))):r.push(o+"="+encodeURIComponent(s))}return r.join("&")}}const yL=void 0;console.log(yL);let wu;const st=()=>wu||(wu=new vL("/"),wu);//! moment.js //! version : 2.30.1 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com -var hk;function ve(){return hk.apply(null,arguments)}function wL(e){hk=e}function Cn(e){return e instanceof Array||Object.prototype.toString.call(e)==="[object Array]"}function Zo(e){return e!=null&&Object.prototype.toString.call(e)==="[object Object]"}function ct(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Sv(e){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(e).length===0;var t;for(t in e)if(ct(e,t))return!1;return!0}function _r(e){return e===void 0}function Cs(e){return typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]"}function Pc(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function pk(e,t){var r=[],n,s=e.length;for(n=0;n>>0,n;for(n=0;n0)for(r=0;r>>0,n;for(n=0;n0)for(r=0;r=0;return(o?r?"+":"":"-")+Math.pow(10,Math.max(0,s)).toString().substr(1)+n}var Ev=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,_u=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,qh={},ea={};function Ie(e,t,r,n){var s=n;typeof n=="string"&&(s=function(){return this[n]()}),e&&(ea[e]=s),t&&(ea[t[0]]=function(){return Hn(s.apply(this,arguments),t[1],t[2])}),r&&(ea[r]=function(){return this.localeData().ordinal(s.apply(this,arguments),e)})}function CL(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function jL(e){var t=e.match(Ev),r,n;for(r=0,n=t.length;r=0&&_u.test(e);)e=e.replace(_u,n),_u.lastIndex=0,r-=1;return e}var EL={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function NL(e){var t=this._longDateFormat[e],r=this._longDateFormat[e.toUpperCase()];return t||!r?t:(this._longDateFormat[e]=r.match(Ev).map(function(n){return n==="MMMM"||n==="MM"||n==="DD"||n==="dddd"?n.slice(1):n}).join(""),this._longDateFormat[e])}var TL="Invalid date";function RL(){return this._invalidDate}var PL="%d",AL=/\d{1,2}/;function DL(e){return this._ordinal.replace("%d",e)}var OL={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function ML(e,t,r,n){var s=this._relativeTime[r];return Gn(s)?s(e,t,r,n):s.replace(/%d/i,e)}function IL(e,t){var r=this._relativeTime[e>0?"future":"past"];return Gn(r)?r(t):r.replace(/%s/i,t)}var Q0={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ln(e){return typeof e=="string"?Q0[e]||Q0[e.toLowerCase()]:void 0}function Nv(e){var t={},r,n;for(n in e)ct(e,n)&&(r=ln(n),r&&(t[r]=e[n]));return t}var LL={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function FL(e){var t=[],r;for(r in e)ct(e,r)&&t.push({unit:r,priority:LL[r]});return t.sort(function(n,s){return n.priority-s.priority}),t}var yk=/\d/,Zr=/\d\d/,xk=/\d{3}/,Tv=/\d{4}/,Af=/[+-]?\d{6}/,Ct=/\d\d?/,wk=/\d\d\d\d?/,_k=/\d\d\d\d\d\d?/,Df=/\d{1,3}/,Rv=/\d{1,4}/,Of=/[+-]?\d{1,6}/,Aa=/\d+/,Mf=/[+-]?\d+/,zL=/Z|[+-]\d\d:?\d\d/gi,If=/Z|[+-]\d\d(?::?\d\d)?/gi,UL=/[+-]?\d+(\.\d{1,3})?/,Dc=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Da=/^[1-9]\d?/,Pv=/^([1-9]\d|\d)/,Td;Td={};function _e(e,t,r){Td[e]=Gn(t)?t:function(n,s){return n&&r?r:t}}function $L(e,t){return ct(Td,e)?Td[e](t._strict,t._locale):new RegExp(VL(e))}function VL(e){return gs(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,r,n,s,o){return r||n||s||o}))}function gs(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Jr(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function rt(e){var t=+e,r=0;return t!==0&&isFinite(t)&&(r=Jr(t)),r}var pm={};function vt(e,t){var r,n=t,s;for(typeof e=="string"&&(e=[e]),Cs(t)&&(n=function(o,i){i[t]=rt(o)}),s=e.length,r=0;r68?1900:2e3)};var bk=Oa("FullYear",!0);function YL(){return Lf(this.year())}function Oa(e,t){return function(r){return r!=null?(Sk(this,e,r),ve.updateOffset(this,t),this):Xl(this,e)}}function Xl(e,t){if(!e.isValid())return NaN;var r=e._d,n=e._isUTC;switch(t){case"Milliseconds":return n?r.getUTCMilliseconds():r.getMilliseconds();case"Seconds":return n?r.getUTCSeconds():r.getSeconds();case"Minutes":return n?r.getUTCMinutes():r.getMinutes();case"Hours":return n?r.getUTCHours():r.getHours();case"Date":return n?r.getUTCDate():r.getDate();case"Day":return n?r.getUTCDay():r.getDay();case"Month":return n?r.getUTCMonth():r.getMonth();case"FullYear":return n?r.getUTCFullYear():r.getFullYear();default:return NaN}}function Sk(e,t,r){var n,s,o,i,a;if(!(!e.isValid()||isNaN(r))){switch(n=e._d,s=e._isUTC,t){case"Milliseconds":return void(s?n.setUTCMilliseconds(r):n.setMilliseconds(r));case"Seconds":return void(s?n.setUTCSeconds(r):n.setSeconds(r));case"Minutes":return void(s?n.setUTCMinutes(r):n.setMinutes(r));case"Hours":return void(s?n.setUTCHours(r):n.setHours(r));case"Date":return void(s?n.setUTCDate(r):n.setDate(r));case"FullYear":break;default:return}o=r,i=e.month(),a=e.date(),a=a===29&&i===1&&!Lf(o)?28:a,s?n.setUTCFullYear(o,i,a):n.setFullYear(o,i,a)}}function ZL(e){return e=ln(e),Gn(this[e])?this[e]():this}function KL(e,t){if(typeof e=="object"){e=Nv(e);var r=FL(e),n,s=r.length;for(n=0;n=0?(a=new Date(e+400,t,r,n,s,o,i),isFinite(a.getFullYear())&&a.setFullYear(e)):a=new Date(e,t,r,n,s,o,i),a}function Ql(e){var t,r;return e<100&&e>=0?(r=Array.prototype.slice.call(arguments),r[0]=e+400,t=new Date(Date.UTC.apply(null,r)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Rd(e,t,r){var n=7+t-r,s=(7+Ql(e,0,n).getUTCDay()-t)%7;return-s+n-1}function Tk(e,t,r,n,s){var o=(7+r-n)%7,i=Rd(e,n,s),a=1+7*(t-1)+o+i,c,u;return a<=0?(c=e-1,u=bl(c)+a):a>bl(e)?(c=e+1,u=a-bl(e)):(c=e,u=a),{year:c,dayOfYear:u}}function Jl(e,t,r){var n=Rd(e.year(),t,r),s=Math.floor((e.dayOfYear()-n-1)/7)+1,o,i;return s<1?(i=e.year()-1,o=s+vs(i,t,r)):s>vs(e.year(),t,r)?(o=s-vs(e.year(),t,r),i=e.year()+1):(i=e.year(),o=s),{week:o,year:i}}function vs(e,t,r){var n=Rd(e,t,r),s=Rd(e+1,t,r);return(bl(e)-n+s)/7}Ie("w",["ww",2],"wo","week");Ie("W",["WW",2],"Wo","isoWeek");_e("w",Ct,Da);_e("ww",Ct,Zr);_e("W",Ct,Da);_e("WW",Ct,Zr);Oc(["w","ww","W","WW"],function(e,t,r,n){t[n.substr(0,1)]=rt(e)});function a4(e){return Jl(e,this._week.dow,this._week.doy).week}var l4={dow:0,doy:6};function c4(){return this._week.dow}function u4(){return this._week.doy}function d4(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function f4(e){var t=Jl(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}Ie("d",0,"do","day");Ie("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)});Ie("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)});Ie("dddd",0,0,function(e){return this.localeData().weekdays(this,e)});Ie("e",0,0,"weekday");Ie("E",0,0,"isoWeekday");_e("d",Ct);_e("e",Ct);_e("E",Ct);_e("dd",function(e,t){return t.weekdaysMinRegex(e)});_e("ddd",function(e,t){return t.weekdaysShortRegex(e)});_e("dddd",function(e,t){return t.weekdaysRegex(e)});Oc(["dd","ddd","dddd"],function(e,t,r,n){var s=r._locale.weekdaysParse(e,n,r._strict);s!=null?t.d=s:Xe(r).invalidWeekday=e});Oc(["d","e","E"],function(e,t,r,n){t[n]=rt(e)});function h4(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function p4(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Dv(e,t){return e.slice(t,7).concat(e.slice(0,t))}var m4="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Rk="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),g4="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),v4=Dc,y4=Dc,x4=Dc;function w4(e,t){var r=Cn(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?Dv(r,this._week.dow):e?r[e.day()]:r}function _4(e){return e===!0?Dv(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function b4(e){return e===!0?Dv(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function S4(e,t,r){var n,s,o,i=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)o=Kn([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(o,"").toLocaleLowerCase();return r?t==="dddd"?(s=zt.call(this._weekdaysParse,i),s!==-1?s:null):t==="ddd"?(s=zt.call(this._shortWeekdaysParse,i),s!==-1?s:null):(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null):t==="dddd"?(s=zt.call(this._weekdaysParse,i),s!==-1||(s=zt.call(this._shortWeekdaysParse,i),s!==-1)?s:(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null)):t==="ddd"?(s=zt.call(this._shortWeekdaysParse,i),s!==-1||(s=zt.call(this._weekdaysParse,i),s!==-1)?s:(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null)):(s=zt.call(this._minWeekdaysParse,i),s!==-1||(s=zt.call(this._weekdaysParse,i),s!==-1)?s:(s=zt.call(this._shortWeekdaysParse,i),s!==-1?s:null))}function k4(e,t,r){var n,s,o;if(this._weekdaysParseExact)return S4.call(this,e,t,r);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(s=Kn([2e3,1]).day(n),r&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(s,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(s,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(s,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(o="^"+this.weekdays(s,"")+"|^"+this.weekdaysShort(s,"")+"|^"+this.weekdaysMin(s,""),this._weekdaysParse[n]=new RegExp(o.replace(".",""),"i")),r&&t==="dddd"&&this._fullWeekdaysParse[n].test(e))return n;if(r&&t==="ddd"&&this._shortWeekdaysParse[n].test(e))return n;if(r&&t==="dd"&&this._minWeekdaysParse[n].test(e))return n;if(!r&&this._weekdaysParse[n].test(e))return n}}function C4(e){if(!this.isValid())return e!=null?this:NaN;var t=Xl(this,"Day");return e!=null?(e=h4(e,this.localeData()),this.add(e-t,"d")):t}function j4(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function E4(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=p4(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function N4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(ct(this,"_weekdaysRegex")||(this._weekdaysRegex=v4),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function T4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(ct(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=y4),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function R4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(ct(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=x4),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ov(){function e(d,f){return f.length-d.length}var t=[],r=[],n=[],s=[],o,i,a,c,u;for(o=0;o<7;o++)i=Kn([2e3,1]).day(o),a=gs(this.weekdaysMin(i,"")),c=gs(this.weekdaysShort(i,"")),u=gs(this.weekdays(i,"")),t.push(a),r.push(c),n.push(u),s.push(a),s.push(c),s.push(u);t.sort(e),r.sort(e),n.sort(e),s.sort(e),this._weekdaysRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function Mv(){return this.hours()%12||12}function P4(){return this.hours()||24}Ie("H",["HH",2],0,"hour");Ie("h",["hh",2],0,Mv);Ie("k",["kk",2],0,P4);Ie("hmm",0,0,function(){return""+Mv.apply(this)+Hn(this.minutes(),2)});Ie("hmmss",0,0,function(){return""+Mv.apply(this)+Hn(this.minutes(),2)+Hn(this.seconds(),2)});Ie("Hmm",0,0,function(){return""+this.hours()+Hn(this.minutes(),2)});Ie("Hmmss",0,0,function(){return""+this.hours()+Hn(this.minutes(),2)+Hn(this.seconds(),2)});function Pk(e,t){Ie(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}Pk("a",!0);Pk("A",!1);function Ak(e,t){return t._meridiemParse}_e("a",Ak);_e("A",Ak);_e("H",Ct,Pv);_e("h",Ct,Da);_e("k",Ct,Da);_e("HH",Ct,Zr);_e("hh",Ct,Zr);_e("kk",Ct,Zr);_e("hmm",wk);_e("hmmss",_k);_e("Hmm",wk);_e("Hmmss",_k);vt(["H","HH"],Gt);vt(["k","kk"],function(e,t,r){var n=rt(e);t[Gt]=n===24?0:n});vt(["a","A"],function(e,t,r){r._isPm=r._locale.isPM(e),r._meridiem=e});vt(["h","hh"],function(e,t,r){t[Gt]=rt(e),Xe(r).bigHour=!0});vt("hmm",function(e,t,r){var n=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n)),Xe(r).bigHour=!0});vt("hmmss",function(e,t,r){var n=e.length-4,s=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n,2)),t[hs]=rt(e.substr(s)),Xe(r).bigHour=!0});vt("Hmm",function(e,t,r){var n=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n))});vt("Hmmss",function(e,t,r){var n=e.length-4,s=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n,2)),t[hs]=rt(e.substr(s))});function A4(e){return(e+"").toLowerCase().charAt(0)==="p"}var D4=/[ap]\.?m?\.?/i,O4=Oa("Hours",!0);function M4(e,t,r){return e>11?r?"pm":"PM":r?"am":"AM"}var Dk={calendar:SL,longDateFormat:EL,invalidDate:TL,ordinal:PL,dayOfMonthOrdinalParse:AL,relativeTime:OL,months:qL,monthsShort:kk,week:l4,weekdays:m4,weekdaysMin:g4,weekdaysShort:Rk,meridiemParse:D4},Nt={},Xa={},ec;function I4(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r0;){if(s=Ff(o.slice(0,r).join("-")),s)return s;if(n&&n.length>=r&&I4(o,n)>=r-1)break;r--}t++}return ec}function F4(e){return!!(e&&e.match("^[^/\\\\]*$"))}function Ff(e){var t=null,r;if(Nt[e]===void 0&&typeof Gu<"u"&&Gu&&Gu.exports&&F4(e))try{t=ec._abbr,r=require,r("./locale/"+e),co(t)}catch{Nt[e]=null}return Nt[e]}function co(e,t){var r;return e&&(_r(t)?r=As(e):r=Iv(e,t),r?ec=r:typeof console<"u"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),ec._abbr}function Iv(e,t){if(t!==null){var r,n=Dk;if(t.abbr=e,Nt[e]!=null)gk("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=Nt[e]._config;else if(t.parentLocale!=null)if(Nt[t.parentLocale]!=null)n=Nt[t.parentLocale]._config;else if(r=Ff(t.parentLocale),r!=null)n=r._config;else return Xa[t.parentLocale]||(Xa[t.parentLocale]=[]),Xa[t.parentLocale].push({name:e,config:t}),null;return Nt[e]=new jv(fm(n,t)),Xa[e]&&Xa[e].forEach(function(s){Iv(s.name,s.config)}),co(e),Nt[e]}else return delete Nt[e],null}function z4(e,t){if(t!=null){var r,n,s=Dk;Nt[e]!=null&&Nt[e].parentLocale!=null?Nt[e].set(fm(Nt[e]._config,t)):(n=Ff(e),n!=null&&(s=n._config),t=fm(s,t),n==null&&(t.abbr=e),r=new jv(t),r.parentLocale=Nt[e],Nt[e]=r),co(e)}else Nt[e]!=null&&(Nt[e].parentLocale!=null?(Nt[e]=Nt[e].parentLocale,e===co()&&co(e)):Nt[e]!=null&&delete Nt[e]);return Nt[e]}function As(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return ec;if(!Cn(e)){if(t=Ff(e),t)return t;e=[e]}return L4(e)}function U4(){return hm(Nt)}function Lv(e){var t,r=e._a;return r&&Xe(e).overflow===-2&&(t=r[fs]<0||r[fs]>11?fs:r[Ln]<1||r[Ln]>Av(r[ar],r[fs])?Ln:r[Gt]<0||r[Gt]>24||r[Gt]===24&&(r[vn]!==0||r[hs]!==0||r[Wo]!==0)?Gt:r[vn]<0||r[vn]>59?vn:r[hs]<0||r[hs]>59?hs:r[Wo]<0||r[Wo]>999?Wo:-1,Xe(e)._overflowDayOfYear&&(tLn)&&(t=Ln),Xe(e)._overflowWeeks&&t===-1&&(t=BL),Xe(e)._overflowWeekday&&t===-1&&(t=HL),Xe(e).overflow=t),e}var $4=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,V4=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,W4=/Z|[+-]\d\d(?::?\d\d)?/,bu=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Xh=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],B4=/^\/?Date\((-?\d+)/i,H4=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Y4={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Ok(e){var t,r,n=e._i,s=$4.exec(n)||V4.exec(n),o,i,a,c,u=bu.length,d=Xh.length;if(s){for(Xe(e).iso=!0,t=0,r=u;tbl(i)||e._dayOfYear===0)&&(Xe(e)._overflowDayOfYear=!0),r=Ql(i,0,e._dayOfYear),e._a[fs]=r.getUTCMonth(),e._a[Ln]=r.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=n[t]=s[t];for(;t<7;t++)e._a[t]=n[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[Gt]===24&&e._a[vn]===0&&e._a[hs]===0&&e._a[Wo]===0&&(e._nextDay=!0,e._a[Gt]=0),e._d=(e._useUTC?Ql:i4).apply(null,n),o=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Gt]=24),e._w&&typeof e._w.d<"u"&&e._w.d!==o&&(Xe(e).weekdayMismatch=!0)}}function e5(e){var t,r,n,s,o,i,a,c,u;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(o=1,i=4,r=Ci(t.GG,e._a[ar],Jl(kt(),1,4).year),n=Ci(t.W,1),s=Ci(t.E,1),(s<1||s>7)&&(c=!0)):(o=e._locale._week.dow,i=e._locale._week.doy,u=Jl(kt(),o,i),r=Ci(t.gg,e._a[ar],u.year),n=Ci(t.w,u.week),t.d!=null?(s=t.d,(s<0||s>6)&&(c=!0)):t.e!=null?(s=t.e+o,(t.e<0||t.e>6)&&(c=!0)):s=o),n<1||n>vs(r,o,i)?Xe(e)._overflowWeeks=!0:c!=null?Xe(e)._overflowWeekday=!0:(a=Tk(r,n,s,o,i),e._a[ar]=a.year,e._dayOfYear=a.dayOfYear)}ve.ISO_8601=function(){};ve.RFC_2822=function(){};function zv(e){if(e._f===ve.ISO_8601){Ok(e);return}if(e._f===ve.RFC_2822){Mk(e);return}e._a=[],Xe(e).empty=!0;var t=""+e._i,r,n,s,o,i,a=t.length,c=0,u,d;for(s=vk(e._f,e._locale).match(Ev)||[],d=s.length,r=0;r0&&Xe(e).unusedInput.push(i),t=t.slice(t.indexOf(n)+n.length),c+=n.length),ea[o]?(n?Xe(e).empty=!1:Xe(e).unusedTokens.push(o),WL(o,n,e)):e._strict&&!n&&Xe(e).unusedTokens.push(o);Xe(e).charsLeftOver=a-c,t.length>0&&Xe(e).unusedInput.push(t),e._a[Gt]<=12&&Xe(e).bigHour===!0&&e._a[Gt]>0&&(Xe(e).bigHour=void 0),Xe(e).parsedDateParts=e._a.slice(0),Xe(e).meridiem=e._meridiem,e._a[Gt]=t5(e._locale,e._a[Gt],e._meridiem),u=Xe(e).era,u!==null&&(e._a[ar]=e._locale.erasConvertYear(u,e._a[ar])),Fv(e),Lv(e)}function t5(e,t,r){var n;return r==null?t:e.meridiemHour!=null?e.meridiemHour(t,r):(e.isPM!=null&&(n=e.isPM(r),n&&t<12&&(t+=12),!n&&t===12&&(t=0)),t)}function r5(e){var t,r,n,s,o,i,a=!1,c=e._f.length;if(c===0){Xe(e).invalidFormat=!0,e._d=new Date(NaN);return}for(s=0;sthis?this:e:Pf()});function Fk(e,t){var r,n;if(t.length===1&&Cn(t[0])&&(t=t[0]),!t.length)return kt();for(r=t[0],n=1;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function S5(){if(!_r(this._isDSTShifted))return this._isDSTShifted;var e={},t;return Cv(e,this),e=Ik(e),e._a?(t=e._isUTC?Kn(e._a):kt(e._a),this._isDSTShifted=this.isValid()&&p5(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function k5(){return this.isValid()?!this._isUTC:!1}function C5(){return this.isValid()?this._isUTC:!1}function Uk(){return this.isValid()?this._isUTC&&this._offset===0:!1}var j5=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,E5=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Rn(e,t){var r=e,n=null,s,o,i;return Bu(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:Cs(e)||!isNaN(+e)?(r={},t?r[t]=+e:r.milliseconds=+e):(n=j5.exec(e))?(s=n[1]==="-"?-1:1,r={y:0,d:rt(n[Ln])*s,h:rt(n[Gt])*s,m:rt(n[vn])*s,s:rt(n[hs])*s,ms:rt(mm(n[Wo]*1e3))*s}):(n=E5.exec(e))?(s=n[1]==="-"?-1:1,r={y:Po(n[2],s),M:Po(n[3],s),w:Po(n[4],s),d:Po(n[5],s),h:Po(n[6],s),m:Po(n[7],s),s:Po(n[8],s)}):r==null?r={}:typeof r=="object"&&("from"in r||"to"in r)&&(i=N5(kt(r.from),kt(r.to)),r={},r.ms=i.milliseconds,r.M=i.months),o=new zf(r),Bu(e)&&ct(e,"_locale")&&(o._locale=e._locale),Bu(e)&&ct(e,"_isValid")&&(o._isValid=e._isValid),o}Rn.fn=zf.prototype;Rn.invalid=h5;function Po(e,t){var r=e&&parseFloat(e.replace(",","."));return(isNaN(r)?0:r)*t}function ew(e,t){var r={};return r.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(r.months,"M").isAfter(t)&&--r.months,r.milliseconds=+t-+e.clone().add(r.months,"M"),r}function N5(e,t){var r;return e.isValid()&&t.isValid()?(t=$v(t,e),e.isBefore(t)?r=ew(e,t):(r=ew(t,e),r.milliseconds=-r.milliseconds,r.months=-r.months),r):{milliseconds:0,months:0}}function $k(e,t){return function(r,n){var s,o;return n!==null&&!isNaN(+n)&&(gk(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=r,r=n,n=o),s=Rn(r,n),Vk(this,s,e),this}}function Vk(e,t,r,n){var s=t._milliseconds,o=mm(t._days),i=mm(t._months);e.isValid()&&(n=n??!0,i&&jk(e,Xl(e,"Month")+i*r),o&&Sk(e,"Date",Xl(e,"Date")+o*r),s&&e._d.setTime(e._d.valueOf()+s*r),n&&ve.updateOffset(e,o||i))}var T5=$k(1,"add"),R5=$k(-1,"subtract");function Wk(e){return typeof e=="string"||e instanceof String}function P5(e){return jn(e)||Pc(e)||Wk(e)||Cs(e)||D5(e)||A5(e)||e===null||e===void 0}function A5(e){var t=Zo(e)&&!Sv(e),r=!1,n=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],s,o,i=n.length;for(s=0;sr.valueOf():r.valueOf()9999?Wu(r,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Gn(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Wu(r,"Z")):Wu(r,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Z5(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",r,n,s,o;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),r="["+e+'("]',n=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",s="-MM-DD[T]HH:mm:ss.SSS",o=t+'[")]',this.format(r+n+s+o)}function K5(e){e||(e=this.isUtc()?ve.defaultFormatUtc:ve.defaultFormat);var t=Wu(this,e);return this.localeData().postformat(t)}function G5(e,t){return this.isValid()&&(jn(e)&&e.isValid()||kt(e).isValid())?Rn({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function q5(e){return this.from(kt(),e)}function X5(e,t){return this.isValid()&&(jn(e)&&e.isValid()||kt(e).isValid())?Rn({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function Q5(e){return this.to(kt(),e)}function Bk(e){var t;return e===void 0?this._locale._abbr:(t=As(e),t!=null&&(this._locale=t),this)}var Hk=an("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return e===void 0?this.localeData():this.locale(e)});function Yk(){return this._locale}var Pd=1e3,ta=60*Pd,Ad=60*ta,Zk=(365*400+97)*24*Ad;function ra(e,t){return(e%t+t)%t}function Kk(e,t,r){return e<100&&e>=0?new Date(e+400,t,r)-Zk:new Date(e,t,r).valueOf()}function Gk(e,t,r){return e<100&&e>=0?Date.UTC(e+400,t,r)-Zk:Date.UTC(e,t,r)}function J5(e){var t,r;if(e=ln(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(r=this._isUTC?Gk:Kk,e){case"year":t=r(this.year(),0,1);break;case"quarter":t=r(this.year(),this.month()-this.month()%3,1);break;case"month":t=r(this.year(),this.month(),1);break;case"week":t=r(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=r(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=ra(t+(this._isUTC?0:this.utcOffset()*ta),Ad);break;case"minute":t=this._d.valueOf(),t-=ra(t,ta);break;case"second":t=this._d.valueOf(),t-=ra(t,Pd);break}return this._d.setTime(t),ve.updateOffset(this,!0),this}function eF(e){var t,r;if(e=ln(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(r=this._isUTC?Gk:Kk,e){case"year":t=r(this.year()+1,0,1)-1;break;case"quarter":t=r(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=r(this.year(),this.month()+1,1)-1;break;case"week":t=r(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=r(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=Ad-ra(t+(this._isUTC?0:this.utcOffset()*ta),Ad)-1;break;case"minute":t=this._d.valueOf(),t+=ta-ra(t,ta)-1;break;case"second":t=this._d.valueOf(),t+=Pd-ra(t,Pd)-1;break}return this._d.setTime(t),ve.updateOffset(this,!0),this}function tF(){return this._d.valueOf()-(this._offset||0)*6e4}function rF(){return Math.floor(this.valueOf()/1e3)}function nF(){return new Date(this.valueOf())}function sF(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function oF(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function iF(){return this.isValid()?this.toISOString():null}function aF(){return kv(this)}function lF(){return Qs({},Xe(this))}function cF(){return Xe(this).overflow}function uF(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Ie("N",0,0,"eraAbbr");Ie("NN",0,0,"eraAbbr");Ie("NNN",0,0,"eraAbbr");Ie("NNNN",0,0,"eraName");Ie("NNNNN",0,0,"eraNarrow");Ie("y",["y",1],"yo","eraYear");Ie("y",["yy",2],0,"eraYear");Ie("y",["yyy",3],0,"eraYear");Ie("y",["yyyy",4],0,"eraYear");_e("N",Vv);_e("NN",Vv);_e("NNN",Vv);_e("NNNN",_F);_e("NNNNN",bF);vt(["N","NN","NNN","NNNN","NNNNN"],function(e,t,r,n){var s=r._locale.erasParse(e,n,r._strict);s?Xe(r).era=s:Xe(r).invalidEra=e});_e("y",Aa);_e("yy",Aa);_e("yyy",Aa);_e("yyyy",Aa);_e("yo",SF);vt(["y","yy","yyy","yyyy"],ar);vt(["yo"],function(e,t,r,n){var s;r._locale._eraYearOrdinalRegex&&(s=e.match(r._locale._eraYearOrdinalRegex)),r._locale.eraYearOrdinalParse?t[ar]=r._locale.eraYearOrdinalParse(e,s):t[ar]=parseInt(e,10)});function dF(e,t){var r,n,s,o=this._eras||As("en")._eras;for(r=0,n=o.length;r=0)return o[n]}function hF(e,t){var r=e.since<=e.until?1:-1;return t===void 0?ve(e.since).year():ve(e.since).year()+(t-e.offset)*r}function pF(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;eo&&(t=o),RF.call(this,e,t,r,n,s))}function RF(e,t,r,n,s){var o=Tk(e,t,r,n,s),i=Ql(o.year,0,o.dayOfYear);return this.year(i.getUTCFullYear()),this.month(i.getUTCMonth()),this.date(i.getUTCDate()),this}Ie("Q",0,"Qo","quarter");_e("Q",yk);vt("Q",function(e,t){t[fs]=(rt(e)-1)*3});function PF(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}Ie("D",["DD",2],"Do","date");_e("D",Ct,Da);_e("DD",Ct,Zr);_e("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient});vt(["D","DD"],Ln);vt("Do",function(e,t){t[Ln]=rt(e.match(Ct)[0])});var Xk=Oa("Date",!0);Ie("DDD",["DDDD",3],"DDDo","dayOfYear");_e("DDD",Df);_e("DDDD",xk);vt(["DDD","DDDD"],function(e,t,r){r._dayOfYear=rt(e)});function AF(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}Ie("m",["mm",2],0,"minute");_e("m",Ct,Pv);_e("mm",Ct,Zr);vt(["m","mm"],vn);var DF=Oa("Minutes",!1);Ie("s",["ss",2],0,"second");_e("s",Ct,Pv);_e("ss",Ct,Zr);vt(["s","ss"],hs);var OF=Oa("Seconds",!1);Ie("S",0,0,function(){return~~(this.millisecond()/100)});Ie(0,["SS",2],0,function(){return~~(this.millisecond()/10)});Ie(0,["SSS",3],0,"millisecond");Ie(0,["SSSS",4],0,function(){return this.millisecond()*10});Ie(0,["SSSSS",5],0,function(){return this.millisecond()*100});Ie(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3});Ie(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4});Ie(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5});Ie(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6});_e("S",Df,yk);_e("SS",Df,Zr);_e("SSS",Df,xk);var Js,Qk;for(Js="SSSS";Js.length<=9;Js+="S")_e(Js,Aa);function MF(e,t){t[Wo]=rt(("0."+e)*1e3)}for(Js="S";Js.length<=9;Js+="S")vt(Js,MF);Qk=Oa("Milliseconds",!1);Ie("z",0,0,"zoneAbbr");Ie("zz",0,0,"zoneName");function IF(){return this._isUTC?"UTC":""}function LF(){return this._isUTC?"Coordinated Universal Time":""}var le=Ac.prototype;le.add=T5;le.calendar=I5;le.clone=L5;le.diff=B5;le.endOf=eF;le.format=K5;le.from=G5;le.fromNow=q5;le.to=X5;le.toNow=Q5;le.get=ZL;le.invalidAt=cF;le.isAfter=F5;le.isBefore=z5;le.isBetween=U5;le.isSame=$5;le.isSameOrAfter=V5;le.isSameOrBefore=W5;le.isValid=aF;le.lang=Hk;le.locale=Bk;le.localeData=Yk;le.max=a5;le.min=i5;le.parsingFlags=lF;le.set=KL;le.startOf=J5;le.subtract=R5;le.toArray=sF;le.toObject=oF;le.toDate=nF;le.toISOString=Y5;le.inspect=Z5;typeof Symbol<"u"&&Symbol.for!=null&&(le[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"});le.toJSON=iF;le.toString=H5;le.unix=rF;le.valueOf=tF;le.creationData=uF;le.eraName=pF;le.eraNarrow=mF;le.eraAbbr=gF;le.eraYear=vF;le.year=bk;le.isLeapYear=YL;le.weekYear=kF;le.isoWeekYear=CF;le.quarter=le.quarters=PF;le.month=Ek;le.daysInMonth=n4;le.week=le.weeks=d4;le.isoWeek=le.isoWeeks=f4;le.weeksInYear=NF;le.weeksInWeekYear=TF;le.isoWeeksInYear=jF;le.isoWeeksInISOWeekYear=EF;le.date=Xk;le.day=le.days=C4;le.weekday=j4;le.isoWeekday=E4;le.dayOfYear=AF;le.hour=le.hours=O4;le.minute=le.minutes=DF;le.second=le.seconds=OF;le.millisecond=le.milliseconds=Qk;le.utcOffset=g5;le.utc=y5;le.local=x5;le.parseZone=w5;le.hasAlignedHourOffset=_5;le.isDST=b5;le.isLocal=k5;le.isUtcOffset=C5;le.isUtc=Uk;le.isUTC=Uk;le.zoneAbbr=IF;le.zoneName=LF;le.dates=an("dates accessor is deprecated. Use date instead.",Xk);le.months=an("months accessor is deprecated. Use month instead",Ek);le.years=an("years accessor is deprecated. Use year instead",bk);le.zone=an("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",v5);le.isDSTShifted=an("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",S5);function FF(e){return kt(e*1e3)}function zF(){return kt.apply(null,arguments).parseZone()}function Jk(e){return e}var ut=jv.prototype;ut.calendar=kL;ut.longDateFormat=NL;ut.invalidDate=RL;ut.ordinal=DL;ut.preparse=Jk;ut.postformat=Jk;ut.relativeTime=ML;ut.pastFuture=IL;ut.set=bL;ut.eras=dF;ut.erasParse=fF;ut.erasConvertYear=hF;ut.erasAbbrRegex=xF;ut.erasNameRegex=yF;ut.erasNarrowRegex=wF;ut.months=JL;ut.monthsShort=e4;ut.monthsParse=r4;ut.monthsRegex=o4;ut.monthsShortRegex=s4;ut.week=a4;ut.firstDayOfYear=u4;ut.firstDayOfWeek=c4;ut.weekdays=w4;ut.weekdaysMin=b4;ut.weekdaysShort=_4;ut.weekdaysParse=k4;ut.weekdaysRegex=N4;ut.weekdaysShortRegex=T4;ut.weekdaysMinRegex=R4;ut.isPM=A4;ut.meridiem=M4;function Dd(e,t,r,n){var s=As(),o=Kn().set(n,t);return s[r](o,e)}function eC(e,t,r){if(Cs(e)&&(t=e,e=void 0),e=e||"",t!=null)return Dd(e,t,r,"month");var n,s=[];for(n=0;n<12;n++)s[n]=Dd(e,n,r,"month");return s}function Bv(e,t,r,n){typeof e=="boolean"?(Cs(t)&&(r=t,t=void 0),t=t||""):(t=e,r=t,e=!1,Cs(t)&&(r=t,t=void 0),t=t||"");var s=As(),o=e?s._week.dow:0,i,a=[];if(r!=null)return Dd(t,(r+o)%7,n,"day");for(i=0;i<7;i++)a[i]=Dd(t,(i+o)%7,n,"day");return a}function UF(e,t){return eC(e,t,"months")}function $F(e,t){return eC(e,t,"monthsShort")}function VF(e,t,r){return Bv(e,t,r,"weekdays")}function WF(e,t,r){return Bv(e,t,r,"weekdaysShort")}function BF(e,t,r){return Bv(e,t,r,"weekdaysMin")}co("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,r=rt(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+r}});ve.lang=an("moment.lang is deprecated. Use moment.locale instead.",co);ve.langData=an("moment.langData is deprecated. Use moment.localeData instead.",As);var ns=Math.abs;function HF(){var e=this._data;return this._milliseconds=ns(this._milliseconds),this._days=ns(this._days),this._months=ns(this._months),e.milliseconds=ns(e.milliseconds),e.seconds=ns(e.seconds),e.minutes=ns(e.minutes),e.hours=ns(e.hours),e.months=ns(e.months),e.years=ns(e.years),this}function tC(e,t,r,n){var s=Rn(t,r);return e._milliseconds+=n*s._milliseconds,e._days+=n*s._days,e._months+=n*s._months,e._bubble()}function YF(e,t){return tC(this,e,t,1)}function ZF(e,t){return tC(this,e,t,-1)}function tw(e){return e<0?Math.floor(e):Math.ceil(e)}function KF(){var e=this._milliseconds,t=this._days,r=this._months,n=this._data,s,o,i,a,c;return e>=0&&t>=0&&r>=0||e<=0&&t<=0&&r<=0||(e+=tw(vm(r)+t)*864e5,t=0,r=0),n.milliseconds=e%1e3,s=Jr(e/1e3),n.seconds=s%60,o=Jr(s/60),n.minutes=o%60,i=Jr(o/60),n.hours=i%24,t+=Jr(i/24),c=Jr(rC(t)),r+=c,t-=tw(vm(c)),a=Jr(r/12),r%=12,n.days=t,n.months=r,n.years=a,this}function rC(e){return e*4800/146097}function vm(e){return e*146097/4800}function GF(e){if(!this.isValid())return NaN;var t,r,n=this._milliseconds;if(e=ln(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+n/864e5,r=this._months+rC(t),e){case"month":return r;case"quarter":return r/3;case"year":return r/12}else switch(t=this._days+Math.round(vm(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return t*24+n/36e5;case"minute":return t*1440+n/6e4;case"second":return t*86400+n/1e3;case"millisecond":return Math.floor(t*864e5)+n;default:throw new Error("Unknown unit "+e)}}function Ds(e){return function(){return this.as(e)}}var nC=Ds("ms"),qF=Ds("s"),XF=Ds("m"),QF=Ds("h"),JF=Ds("d"),e3=Ds("w"),t3=Ds("M"),r3=Ds("Q"),n3=Ds("y"),s3=nC;function o3(){return Rn(this)}function i3(e){return e=ln(e),this.isValid()?this[e+"s"]():NaN}function fi(e){return function(){return this.isValid()?this._data[e]:NaN}}var a3=fi("milliseconds"),l3=fi("seconds"),c3=fi("minutes"),u3=fi("hours"),d3=fi("days"),f3=fi("months"),h3=fi("years");function p3(){return Jr(this.days()/7)}var as=Math.round,Ui={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function m3(e,t,r,n,s){return s.relativeTime(t||1,!!r,e,n)}function g3(e,t,r,n){var s=Rn(e).abs(),o=as(s.as("s")),i=as(s.as("m")),a=as(s.as("h")),c=as(s.as("d")),u=as(s.as("M")),d=as(s.as("w")),f=as(s.as("y")),m=o<=r.ss&&["s",o]||o0,m[4]=n,m3.apply(null,m)}function v3(e){return e===void 0?as:typeof e=="function"?(as=e,!0):!1}function y3(e,t){return Ui[e]===void 0?!1:t===void 0?Ui[e]:(Ui[e]=t,e==="s"&&(Ui.ss=t-1),!0)}function x3(e,t){if(!this.isValid())return this.localeData().invalidDate();var r=!1,n=Ui,s,o;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(r=e),typeof t=="object"&&(n=Object.assign({},Ui,t),t.s!=null&&t.ss==null&&(n.ss=t.s-1)),s=this.localeData(),o=g3(this,!r,n,s),r&&(o=s.pastFuture(+this,o)),s.postformat(o)}var Qh=Math.abs;function Si(e){return(e>0)-(e<0)||+e}function $f(){if(!this.isValid())return this.localeData().invalidDate();var e=Qh(this._milliseconds)/1e3,t=Qh(this._days),r=Qh(this._months),n,s,o,i,a=this.asSeconds(),c,u,d,f;return a?(n=Jr(e/60),s=Jr(n/60),e%=60,n%=60,o=Jr(r/12),r%=12,i=e?e.toFixed(3).replace(/\.?0+$/,""):"",c=a<0?"-":"",u=Si(this._months)!==Si(a)?"-":"",d=Si(this._days)!==Si(a)?"-":"",f=Si(this._milliseconds)!==Si(a)?"-":"",c+"P"+(o?u+o+"Y":"")+(r?u+r+"M":"")+(t?d+t+"D":"")+(s||n||e?"T":"")+(s?f+s+"H":"")+(n?f+n+"M":"")+(e?f+i+"S":"")):"P0D"}var it=zf.prototype;it.isValid=f5;it.abs=HF;it.add=YF;it.subtract=ZF;it.as=GF;it.asMilliseconds=nC;it.asSeconds=qF;it.asMinutes=XF;it.asHours=QF;it.asDays=JF;it.asWeeks=e3;it.asMonths=t3;it.asQuarters=r3;it.asYears=n3;it.valueOf=s3;it._bubble=KF;it.clone=o3;it.get=i3;it.milliseconds=a3;it.seconds=l3;it.minutes=c3;it.hours=u3;it.days=d3;it.weeks=p3;it.months=f3;it.years=h3;it.humanize=x3;it.toISOString=$f;it.toString=$f;it.toJSON=$f;it.locale=Bk;it.localeData=Yk;it.toIsoString=an("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$f);it.lang=Hk;Ie("X",0,0,"unix");Ie("x",0,0,"valueOf");_e("x",Mf);_e("X",UL);vt("X",function(e,t,r){r._d=new Date(parseFloat(e)*1e3)});vt("x",function(e,t,r){r._d=new Date(rt(e))});//! moment.js -ve.version="2.30.1";wL(kt);ve.fn=le;ve.min=l5;ve.max=c5;ve.now=u5;ve.utc=Kn;ve.unix=FF;ve.months=UF;ve.isDate=Pc;ve.locale=co;ve.invalid=Pf;ve.duration=Rn;ve.isMoment=jn;ve.weekdays=VF;ve.parseZone=zF;ve.localeData=As;ve.isDuration=Bu;ve.monthsShort=$F;ve.weekdaysMin=BF;ve.defineLocale=Iv;ve.updateLocale=z4;ve.locales=U4;ve.weekdaysShort=WF;ve.normalizeUnits=ln;ve.relativeTimeRounding=v3;ve.relativeTimeThreshold=y3;ve.calendarFormat=M5;ve.prototype=le;ve.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const w3=async()=>await st().collection("access").getFullList({sort:"-created",filter:"deleted = null"}),jo=async e=>e.id?await st().collection("access").update(e.id,e):await st().collection("access").create(e),_3=async e=>(e.deleted=ve.utc().format("YYYY-MM-DD HH:mm:ss"),await st().collection("access").update(e.id,e)),rw=async()=>await st().collection("access_groups").getFullList({sort:"-created",expand:"access"}),b3=async e=>{const t=st();if((await t.collection("access").getList(1,1,{filter:`group='${e}' && deleted=null`})).items.length>0)throw new Error("该分组下有授权配置,无法删除");await t.collection("access_groups").delete(e)},S3=async e=>{const t=st();return e.id?await t.collection("access_groups").update(e.id,e):await t.collection("access_groups").create(e)},nw=async e=>await st().collection("access_groups").update(e.id,e),k3=(e,t)=>{switch(t.type){case"SET_ACCESSES":return{...e,accesses:t.payload};case"ADD_ACCESS":return{...e,accesses:[t.payload,...e.accesses]};case"DELETE_ACCESS":return{...e,accesses:e.accesses.filter(r=>r.id!==t.payload)};case"UPDATE_ACCESS":return{...e,accesses:e.accesses.map(r=>r.id===t.payload.id?t.payload:r)};case"SET_EMAILS":return{...e,emails:t.payload};case"ADD_EMAIL":return{...e,emails:{...e.emails,content:{emails:[...e.emails.content.emails,t.payload]}}};case"SET_ACCESS_GROUPS":return{...e,accessGroups:t.payload};default:return e}},C3=async()=>{try{return await st().collection("settings").getFirstListItem("name='emails'")}catch{return{content:{emails:[]}}}},sC=async e=>{try{return await st().collection("settings").getFirstListItem(`name='${e}'`)}catch{return{name:e}}},Mc=async e=>{const t=st();let r;return e.id?r=await t.collection("settings").update(e.id,e):r=await t.collection("settings").create(e),r},oC=v.createContext({}),Kr=()=>v.useContext(oC),j3=({children:e})=>{const[t,r]=v.useReducer(k3,{accesses:[],emails:{content:{emails:[]}},accessGroups:[]});v.useEffect(()=>{(async()=>{const d=await w3();r({type:"SET_ACCESSES",payload:d})})()},[]),v.useEffect(()=>{(async()=>{const d=await C3();r({type:"SET_EMAILS",payload:d})})()},[]),v.useEffect(()=>{(async()=>{const d=await rw();r({type:"SET_ACCESS_GROUPS",payload:d})})()},[]);const n=v.useCallback(async()=>{const u=await rw();r({type:"SET_ACCESS_GROUPS",payload:u})},[]),s=v.useCallback(u=>{r({type:"SET_EMAILS",payload:u})},[]),o=v.useCallback(u=>{r({type:"DELETE_ACCESS",payload:u})},[]),i=v.useCallback(u=>{r({type:"ADD_ACCESS",payload:u})},[]),a=v.useCallback(u=>{r({type:"UPDATE_ACCESS",payload:u})},[]),c=v.useCallback(u=>{r({type:"SET_ACCESS_GROUPS",payload:u})},[]);return l.jsx(oC.Provider,{value:{config:{accesses:t.accesses,emails:t.emails,accessGroups:t.accessGroups},deleteAccess:o,addAccess:i,setEmails:s,updateAccess:a,setAccessGroups:c,reloadAccessGroups:n},children:e&&e})},E3={theme:"system",setTheme:()=>null},iC=v.createContext(E3);function N3({children:e,defaultTheme:t="system",storageKey:r="vite-ui-theme",...n}){const[s,o]=v.useState(()=>localStorage.getItem(r)||t);v.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(c);return}a.classList.add(s)},[s]);const i={theme:s,setTheme:a=>{localStorage.setItem(r,a),o(a)}};return l.jsx(iC.Provider,{...n,value:i,children:e})}const T3=()=>{const e=v.useContext(iC);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};function R3(){const{setTheme:e}=T3();return l.jsxs($S,{children:[l.jsx(VS,{asChild:!0,children:l.jsxs(He,{variant:"outline",size:"icon",children:[l.jsx(xA,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),l.jsx(vA,{className:"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100 dark:text-white"}),l.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),l.jsxs(uv,{align:"end",children:[l.jsx(Qi,{onClick:()=>e("light"),children:"浅色"}),l.jsx(Qi,{onClick:()=>e("dark"),children:"暗黑"}),l.jsx(Qi,{onClick:()=>e("system"),children:"系统"})]})]})}var P3="Separator",sw="horizontal",A3=["horizontal","vertical"],aC=v.forwardRef((e,t)=>{const{decorative:r,orientation:n=sw,...s}=e,o=D3(n)?n:sw,a=r?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return l.jsx(Re.div,{"data-orientation":o,...a,...s,ref:t})});aC.displayName=P3;function D3(e){return A3.includes(e)}var lC=aC;const Wt=v.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},s)=>l.jsx(lC,{ref:s,decorative:r,orientation:t,className:ae("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Wt.displayName=lC.displayName;const O3="Certimate v0.1.11",cC=()=>l.jsxs("div",{className:"fixed right-0 bottom-0 w-full flex justify-between p-5",children:[l.jsx("div",{className:""}),l.jsxs("div",{className:"text-muted-foreground text-sm hover:text-stone-900 dark:hover:text-stone-200 flex",children:[l.jsxs("a",{href:"https://docs.certimate.me",target:"_blank",className:"flex items-center",children:[l.jsx(sA,{size:16}),l.jsx("div",{className:"ml-1",children:"文档"})]}),l.jsx(Wt,{orientation:"vertical",className:"mx-2"}),l.jsx("a",{href:"https://github.com/usual2970/certimate/releases",target:"_blank",children:O3})]})]});function M3(){const e=Nr(),t=Nn();if(!st().authStore.isValid||!st().authStore.isAdmin)return l.jsx(Q1,{to:"/login"});const r=t.pathname,n=i=>(console.log(r),i==r?"bg-muted text-primary":"text-muted-foreground"),s=()=>{st().authStore.clear(),e("/login")},o=()=>{e("/setting/account")};return l.jsx(l.Fragment,{children:l.jsx(j3,{children:l.jsxs("div",{className:"grid min-h-screen w-full md:grid-cols-[180px_1fr] lg:grid-cols-[200px_1fr] 2xl:md:grid-cols-[280px_1fr] ",children:[l.jsx("div",{className:"hidden border-r dark:border-stone-500 bg-muted/40 md:block",children:l.jsxs("div",{className:"flex h-full max-h-screen flex-col gap-2",children:[l.jsx("div",{className:"flex h-14 items-center border-b dark:border-stone-500 px-4 lg:h-[60px] lg:px-6",children:l.jsxs(fr,{to:"/",className:"flex items-center gap-2 font-semibold",children:[l.jsx("img",{src:"/vite.svg",className:"w-[36px] h-[36px]"}),l.jsx("span",{className:"dark:text-white",children:"Certimate"})]})}),l.jsx("div",{className:"flex-1",children:l.jsxs("nav",{className:"grid items-start px-2 text-sm font-medium lg:px-4",children:[l.jsxs(fr,{to:"/",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/")),children:[l.jsx(x0,{className:"h-4 w-4"}),"控制面板"]}),l.jsxs(fr,{to:"/domains",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/domains")),children:[l.jsx(rm,{className:"h-4 w-4"}),"域名列表"]}),l.jsxs(fr,{to:"/access",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/access")),children:[l.jsx(w0,{className:"h-4 w-4"}),"授权管理"]}),l.jsxs(fr,{to:"/history",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/history")),children:[l.jsx(y0,{className:"h-4 w-4"}),"部署历史"]})]})})]})}),l.jsxs("div",{className:"flex flex-col",children:[l.jsxs("header",{className:"flex h-14 items-center gap-4 border-b dark:border-stone-500 bg-muted/40 px-4 lg:h-[60px] lg:px-6",children:[l.jsxs(yv,{children:[l.jsx(xv,{asChild:!0,children:l.jsxs(He,{variant:"outline",size:"icon",className:"shrink-0 md:hidden",children:[l.jsx(gA,{className:"h-5 w-5 dark:text-white"}),l.jsx("span",{className:"sr-only",children:"Toggle navigation menu"})]})}),l.jsx(Rf,{side:"left",className:"flex flex-col",children:l.jsxs("nav",{className:"grid gap-2 text-lg font-medium",children:[l.jsxs(fr,{to:"/",className:"flex items-center gap-2 text-lg font-semibold",children:[l.jsx("img",{src:"/vite.svg",className:"w-[36px] h-[36px]"}),l.jsx("span",{className:"dark:text-white",children:"Certimate"}),l.jsx("span",{className:"sr-only",children:"Certimate"})]}),l.jsxs(fr,{to:"/",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/")),children:[l.jsx(x0,{className:"h-5 w-5"}),"控制面板"]}),l.jsxs(fr,{to:"/domains",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/domains")),children:[l.jsx(rm,{className:"h-5 w-5"}),"域名列表"]}),l.jsxs(fr,{to:"/access",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/access")),children:[l.jsx(w0,{className:"h-5 w-5"}),"授权管理"]}),l.jsxs(fr,{to:"/history",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/history")),children:[l.jsx(y0,{className:"h-5 w-5"}),"部署历史"]})]})})]}),l.jsx("div",{className:"w-full flex-1"}),l.jsx(R3,{}),l.jsxs($S,{children:[l.jsx(VS,{asChild:!0,children:l.jsxs(He,{variant:"secondary",size:"icon",className:"rounded-full",children:[l.jsx(cA,{className:"h-5 w-5"}),l.jsx("span",{className:"sr-only",children:"Toggle user menu"})]})}),l.jsxs(uv,{align:"end",children:[l.jsx(WS,{children:"账户"}),l.jsx(BS,{}),l.jsx(Qi,{onClick:o,children:"偏好设置"}),l.jsx(Qi,{onClick:s,children:"退出"})]})]})]}),l.jsxs("main",{className:"flex flex-1 flex-col gap-4 p-4 lg:gap-6 lg:p-6 relative",children:[l.jsx(Ig,{}),l.jsx(cC,{})]})]})]})})})}const Hv=({phase:e,phaseSuccess:t})=>{let r=l.jsx(l.Fragment,{children:" "});return e==="check"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]})),e==="apply"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]})),e==="deploy"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"部署"})]})),r};var I3="VisuallyHidden",Ic=v.forwardRef((e,t)=>l.jsx(Re.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));Ic.displayName=I3;var L3=Ic,[Vf,b$]=xr("Tooltip",[Pa]),Wf=Pa(),uC="TooltipProvider",F3=700,ym="tooltip.open",[z3,Yv]=Vf(uC),Zv=e=>{const{__scopeTooltip:t,delayDuration:r=F3,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:o}=e,[i,a]=v.useState(!0),c=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),l.jsx(z3,{scope:t,isOpenDelayed:i,delayDuration:r,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(d=>{c.current=d},[]),disableHoverableContent:s,children:o})};Zv.displayName=uC;var Bf="Tooltip",[U3,Hf]=Vf(Bf),dC=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:s=!1,onOpenChange:o,disableHoverableContent:i,delayDuration:a}=e,c=Yv(Bf,e.__scopeTooltip),u=Wf(t),[d,f]=v.useState(null),m=Ur(),y=v.useRef(0),x=i??c.disableHoverableContent,g=a??c.delayDuration,_=v.useRef(!1),[p=!1,h]=on({prop:n,defaultProp:s,onChange:R=>{R?(c.onOpen(),document.dispatchEvent(new CustomEvent(ym))):c.onClose(),o==null||o(R)}}),w=v.useMemo(()=>p?_.current?"delayed-open":"instant-open":"closed",[p]),C=v.useCallback(()=>{window.clearTimeout(y.current),_.current=!1,h(!0)},[h]),j=v.useCallback(()=>{window.clearTimeout(y.current),h(!1)},[h]),E=v.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{_.current=!0,h(!0)},g)},[g,h]);return v.useEffect(()=>()=>window.clearTimeout(y.current),[]),l.jsx(Xg,{...u,children:l.jsx(U3,{scope:t,contentId:m,open:p,stateAttribute:w,trigger:d,onTriggerChange:f,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayed?E():C()},[c.isOpenDelayed,E,C]),onTriggerLeave:v.useCallback(()=>{x?j():window.clearTimeout(y.current)},[j,x]),onOpen:C,onClose:j,disableHoverableContent:x,children:r})})};dC.displayName=Bf;var xm="TooltipTrigger",fC=v.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Hf(xm,r),o=Yv(xm,r),i=Wf(r),a=v.useRef(null),c=Ke(t,a,s.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),f=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l.jsx(Qg,{asChild:!0,...i,children:l.jsx(Re.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:ce(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:ce(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:ce(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ce(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:ce(e.onBlur,s.onClose),onClick:ce(e.onClick,s.onClose)})})});fC.displayName=xm;var $3="TooltipPortal",[S$,V3]=Vf($3,{forceMount:void 0}),ma="TooltipContent",Kv=v.forwardRef((e,t)=>{const r=V3(ma,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...o}=e,i=Hf(ma,e.__scopeTooltip);return l.jsx(ur,{present:n||i.open,children:i.disableHoverableContent?l.jsx(hC,{side:s,...o,ref:t}):l.jsx(W3,{side:s,...o,ref:t})})}),W3=v.forwardRef((e,t)=>{const r=Hf(ma,e.__scopeTooltip),n=Yv(ma,e.__scopeTooltip),s=v.useRef(null),o=Ke(t,s),[i,a]=v.useState(null),{trigger:c,onClose:u}=r,d=s.current,{onPointerInTransitChange:f}=n,m=v.useCallback(()=>{a(null),f(!1)},[f]),y=v.useCallback((x,g)=>{const _=x.currentTarget,p={x:x.clientX,y:x.clientY},h=Z3(p,_.getBoundingClientRect()),w=K3(p,h),C=G3(g.getBoundingClientRect()),j=X3([...w,...C]);a(j),f(!0)},[f]);return v.useEffect(()=>()=>m(),[m]),v.useEffect(()=>{if(c&&d){const x=_=>y(_,d),g=_=>y(_,c);return c.addEventListener("pointerleave",x),d.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",x),d.removeEventListener("pointerleave",g)}}},[c,d,y,m]),v.useEffect(()=>{if(i){const x=g=>{const _=g.target,p={x:g.clientX,y:g.clientY},h=(c==null?void 0:c.contains(_))||(d==null?void 0:d.contains(_)),w=!q3(p,i);h?m():w&&(m(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,d,i,u,m]),l.jsx(hC,{...e,ref:o})}),[B3,H3]=Vf(Bf,{isInside:!1}),hC=v.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...a}=e,c=Hf(ma,r),u=Wf(r),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(ym,d),()=>document.removeEventListener(ym,d)),[d]),v.useEffect(()=>{if(c.trigger){const f=m=>{const y=m.target;y!=null&&y.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:l.jsxs(Jg,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[l.jsx(zg,{children:n}),l.jsx(B3,{scope:r,isInside:!0,children:l.jsx(L3,{id:c.contentId,role:"tooltip",children:s||n})})]})})});Kv.displayName=ma;var pC="TooltipArrow",Y3=v.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Wf(r);return H3(pC,r).isInside?null:l.jsx(ev,{...s,...n,ref:t})});Y3.displayName=pC;function Z3(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,s,o)){case o:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function K3(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function G3(e){const{top:t,right:r,bottom:n,left:s}=e;return[{x:s,y:t},{x:r,y:t},{x:r,y:n},{x:s,y:n}]}function q3(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;on!=d>n&&r<(u-a)*(n-c)/(d-c)+a&&(s=!s)}return s}function X3(e){const t=e.slice();return t.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),Q3(t)}function Q3(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const s=e[n];for(;r.length>=2;){const o=r[r.length-1],i=r[r.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))r.pop();else break}r.push(s)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var J3=Zv,e6=dC,t6=fC,mC=Kv;const r6=J3,gC=e6,vC=t6,yC=v.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(mC,{ref:n,sideOffset:t,className:ae("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));yC.displayName=mC.displayName;const Gv=({deployment:e})=>{const t=r=>e.log[r]?e.log[r][e.log[r].length-1].error:"";return l.jsx(l.Fragment,{children:e.phase==="deploy"&&e.phaseSuccess||e.wholeSuccess?l.jsx(lA,{size:16,className:"text-green-700"}):l.jsx(l.Fragment,{children:t(e.phase).length?l.jsx(r6,{children:l.jsxs(gC,{children:[l.jsx(vC,{asChild:!0,className:"cursor-pointer",children:l.jsx(g0,{size:16,className:"text-red-700"})}),l.jsx(yC,{className:"max-w-[35em]",children:t(e.phase)})]})}):l.jsx(g0,{size:16,className:"text-red-700"})})})},xC=({className:e,...t})=>l.jsx("nav",{role:"navigation","aria-label":"pagination",className:ae("mx-auto flex w-full justify-center",e),...t});xC.displayName="Pagination";const wC=v.forwardRef(({className:e,...t},r)=>l.jsx("ul",{ref:r,className:ae("flex flex-row items-center gap-1",e),...t}));wC.displayName="PaginationContent";const wm=v.forwardRef(({className:e,...t},r)=>l.jsx("li",{ref:r,className:ae("",e),...t}));wm.displayName="PaginationItem";const _C=({className:e,isActive:t,size:r="icon",...n})=>l.jsx("a",{"aria-current":t?"page":void 0,className:ae(xf({variant:t?"outline":"ghost",size:r}),e),...n});_C.displayName="PaginationLink";const bC=({className:e,...t})=>l.jsxs("span",{"aria-hidden":!0,className:ae("flex h-9 w-9 items-center justify-center",e),...t,children:[l.jsx(dA,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"More pages"})]});bC.displayName="PaginationEllipsis";const SC=({totalPages:e,currentPage:t,onPageChange:r})=>{const s=()=>{if(e>7){let u=[];const d=Math.max(2,t-1),f=Math.min(e-1,t+1),m=e-1;return u=o(d,f),t>3&&u.unshift("..."),t{let d=a;const f=[];for(;d<=c;)f.push(d),d+=u;return f},i=s();return l.jsx(l.Fragment,{children:l.jsx(xC,{className:"dark:text-stone-200 justify-end mt-3",children:l.jsx(wC,{children:i.map((a,c)=>a==="..."?l.jsx(wm,{children:l.jsx(bC,{})},c):l.jsx(wm,{children:l.jsx(_C,{href:"#",isActive:t==a,onClick:u=>{u.preventDefault(),r(a)},children:a})},c))})})})},na=({when:e,children:t,fallback:r})=>e?t:r;var kC="AlertDialog",[n6,k$]=xr(kC,[YS]),Os=YS(),CC=e=>{const{__scopeAlertDialog:t,...r}=e,n=Os(t);return l.jsx(mv,{...n,...r,modal:!0})};CC.displayName=kC;var s6="AlertDialogTrigger",jC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(gv,{...s,...n,ref:t})});jC.displayName=s6;var o6="AlertDialogPortal",EC=e=>{const{__scopeAlertDialog:t,...r}=e,n=Os(t);return l.jsx(vv,{...n,...r})};EC.displayName=o6;var i6="AlertDialogOverlay",NC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Ec,{...s,...n,ref:t})});NC.displayName=i6;var sa="AlertDialogContent",[a6,l6]=n6(sa),TC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...s}=e,o=Os(r),i=v.useRef(null),a=Ke(t,i),c=v.useRef(null);return l.jsx(GI,{contentName:sa,titleName:RC,docsSlug:"alert-dialog",children:l.jsx(a6,{scope:r,cancelRef:c,children:l.jsxs(Nc,{role:"alertdialog",...o,...s,ref:a,onOpenAutoFocus:ce(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[l.jsx(zg,{children:n}),l.jsx(u6,{contentRef:i})]})})})});TC.displayName=sa;var RC="AlertDialogTitle",PC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Tc,{...s,...n,ref:t})});PC.displayName=RC;var AC="AlertDialogDescription",DC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Rc,{...s,...n,ref:t})});DC.displayName=AC;var c6="AlertDialogAction",OC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Tf,{...s,...n,ref:t})});OC.displayName=c6;var MC="AlertDialogCancel",IC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:s}=l6(MC,r),o=Os(r),i=Ke(t,s);return l.jsx(Tf,{...o,...n,ref:i})});IC.displayName=MC;var u6=({contentRef:e})=>{const t=`\`${sa}\` requires a description for the component to be accessible for screen reader users. +`+new Error().stack),r=!1}return t.apply(this,arguments)},t)}var X0={};function gk(e,t){ve.deprecationHandler!=null&&ve.deprecationHandler(e,t),X0[e]||(mk(t),X0[e]=!0)}ve.suppressDeprecationWarnings=!1;ve.deprecationHandler=null;function Gn(e){return typeof Function<"u"&&e instanceof Function||Object.prototype.toString.call(e)==="[object Function]"}function _L(e){var t,r;for(r in e)ct(e,r)&&(t=e[r],Gn(t)?this[r]=t:this["_"+r]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function fm(e,t){var r=Qs({},e),n;for(n in t)ct(t,n)&&(Zo(e[n])&&Zo(t[n])?(r[n]={},Qs(r[n],e[n]),Qs(r[n],t[n])):t[n]!=null?r[n]=t[n]:delete r[n]);for(n in e)ct(e,n)&&!ct(t,n)&&Zo(e[n])&&(r[n]=Qs({},r[n]));return r}function jv(e){e!=null&&this.set(e)}var hm;Object.keys?hm=Object.keys:hm=function(e){var t,r=[];for(t in e)ct(e,t)&&r.push(t);return r};var bL={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function SL(e,t,r){var n=this._calendar[e]||this._calendar.sameElse;return Gn(n)?n.call(t,r):n}function Hn(e,t,r){var n=""+Math.abs(e),s=t-n.length,o=e>=0;return(o?r?"+":"":"-")+Math.pow(10,Math.max(0,s)).toString().substr(1)+n}var Ev=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,_u=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,qh={},ea={};function Ie(e,t,r,n){var s=n;typeof n=="string"&&(s=function(){return this[n]()}),e&&(ea[e]=s),t&&(ea[t[0]]=function(){return Hn(s.apply(this,arguments),t[1],t[2])}),r&&(ea[r]=function(){return this.localeData().ordinal(s.apply(this,arguments),e)})}function kL(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function CL(e){var t=e.match(Ev),r,n;for(r=0,n=t.length;r=0&&_u.test(e);)e=e.replace(_u,n),_u.lastIndex=0,r-=1;return e}var jL={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function EL(e){var t=this._longDateFormat[e],r=this._longDateFormat[e.toUpperCase()];return t||!r?t:(this._longDateFormat[e]=r.match(Ev).map(function(n){return n==="MMMM"||n==="MM"||n==="DD"||n==="dddd"?n.slice(1):n}).join(""),this._longDateFormat[e])}var NL="Invalid date";function TL(){return this._invalidDate}var RL="%d",PL=/\d{1,2}/;function AL(e){return this._ordinal.replace("%d",e)}var DL={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function OL(e,t,r,n){var s=this._relativeTime[r];return Gn(s)?s(e,t,r,n):s.replace(/%d/i,e)}function ML(e,t){var r=this._relativeTime[e>0?"future":"past"];return Gn(r)?r(t):r.replace(/%s/i,t)}var Q0={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ln(e){return typeof e=="string"?Q0[e]||Q0[e.toLowerCase()]:void 0}function Nv(e){var t={},r,n;for(n in e)ct(e,n)&&(r=ln(n),r&&(t[r]=e[n]));return t}var IL={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function LL(e){var t=[],r;for(r in e)ct(e,r)&&t.push({unit:r,priority:IL[r]});return t.sort(function(n,s){return n.priority-s.priority}),t}var yk=/\d/,Zr=/\d\d/,xk=/\d{3}/,Tv=/\d{4}/,Af=/[+-]?\d{6}/,Ct=/\d\d?/,wk=/\d\d\d\d?/,_k=/\d\d\d\d\d\d?/,Df=/\d{1,3}/,Rv=/\d{1,4}/,Of=/[+-]?\d{1,6}/,Aa=/\d+/,Mf=/[+-]?\d+/,FL=/Z|[+-]\d\d:?\d\d/gi,If=/Z|[+-]\d\d(?::?\d\d)?/gi,zL=/[+-]?\d+(\.\d{1,3})?/,Dc=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Da=/^[1-9]\d?/,Pv=/^([1-9]\d|\d)/,Td;Td={};function _e(e,t,r){Td[e]=Gn(t)?t:function(n,s){return n&&r?r:t}}function UL(e,t){return ct(Td,e)?Td[e](t._strict,t._locale):new RegExp($L(e))}function $L(e){return gs(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,r,n,s,o){return r||n||s||o}))}function gs(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Jr(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function rt(e){var t=+e,r=0;return t!==0&&isFinite(t)&&(r=Jr(t)),r}var pm={};function vt(e,t){var r,n=t,s;for(typeof e=="string"&&(e=[e]),Cs(t)&&(n=function(o,i){i[t]=rt(o)}),s=e.length,r=0;r68?1900:2e3)};var bk=Oa("FullYear",!0);function HL(){return Lf(this.year())}function Oa(e,t){return function(r){return r!=null?(Sk(this,e,r),ve.updateOffset(this,t),this):Xl(this,e)}}function Xl(e,t){if(!e.isValid())return NaN;var r=e._d,n=e._isUTC;switch(t){case"Milliseconds":return n?r.getUTCMilliseconds():r.getMilliseconds();case"Seconds":return n?r.getUTCSeconds():r.getSeconds();case"Minutes":return n?r.getUTCMinutes():r.getMinutes();case"Hours":return n?r.getUTCHours():r.getHours();case"Date":return n?r.getUTCDate():r.getDate();case"Day":return n?r.getUTCDay():r.getDay();case"Month":return n?r.getUTCMonth():r.getMonth();case"FullYear":return n?r.getUTCFullYear():r.getFullYear();default:return NaN}}function Sk(e,t,r){var n,s,o,i,a;if(!(!e.isValid()||isNaN(r))){switch(n=e._d,s=e._isUTC,t){case"Milliseconds":return void(s?n.setUTCMilliseconds(r):n.setMilliseconds(r));case"Seconds":return void(s?n.setUTCSeconds(r):n.setSeconds(r));case"Minutes":return void(s?n.setUTCMinutes(r):n.setMinutes(r));case"Hours":return void(s?n.setUTCHours(r):n.setHours(r));case"Date":return void(s?n.setUTCDate(r):n.setDate(r));case"FullYear":break;default:return}o=r,i=e.month(),a=e.date(),a=a===29&&i===1&&!Lf(o)?28:a,s?n.setUTCFullYear(o,i,a):n.setFullYear(o,i,a)}}function YL(e){return e=ln(e),Gn(this[e])?this[e]():this}function ZL(e,t){if(typeof e=="object"){e=Nv(e);var r=LL(e),n,s=r.length;for(n=0;n=0?(a=new Date(e+400,t,r,n,s,o,i),isFinite(a.getFullYear())&&a.setFullYear(e)):a=new Date(e,t,r,n,s,o,i),a}function Ql(e){var t,r;return e<100&&e>=0?(r=Array.prototype.slice.call(arguments),r[0]=e+400,t=new Date(Date.UTC.apply(null,r)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Rd(e,t,r){var n=7+t-r,s=(7+Ql(e,0,n).getUTCDay()-t)%7;return-s+n-1}function Tk(e,t,r,n,s){var o=(7+r-n)%7,i=Rd(e,n,s),a=1+7*(t-1)+o+i,c,u;return a<=0?(c=e-1,u=bl(c)+a):a>bl(e)?(c=e+1,u=a-bl(e)):(c=e,u=a),{year:c,dayOfYear:u}}function Jl(e,t,r){var n=Rd(e.year(),t,r),s=Math.floor((e.dayOfYear()-n-1)/7)+1,o,i;return s<1?(i=e.year()-1,o=s+vs(i,t,r)):s>vs(e.year(),t,r)?(o=s-vs(e.year(),t,r),i=e.year()+1):(i=e.year(),o=s),{week:o,year:i}}function vs(e,t,r){var n=Rd(e,t,r),s=Rd(e+1,t,r);return(bl(e)-n+s)/7}Ie("w",["ww",2],"wo","week");Ie("W",["WW",2],"Wo","isoWeek");_e("w",Ct,Da);_e("ww",Ct,Zr);_e("W",Ct,Da);_e("WW",Ct,Zr);Oc(["w","ww","W","WW"],function(e,t,r,n){t[n.substr(0,1)]=rt(e)});function i4(e){return Jl(e,this._week.dow,this._week.doy).week}var a4={dow:0,doy:6};function l4(){return this._week.dow}function c4(){return this._week.doy}function u4(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function d4(e){var t=Jl(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}Ie("d",0,"do","day");Ie("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)});Ie("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)});Ie("dddd",0,0,function(e){return this.localeData().weekdays(this,e)});Ie("e",0,0,"weekday");Ie("E",0,0,"isoWeekday");_e("d",Ct);_e("e",Ct);_e("E",Ct);_e("dd",function(e,t){return t.weekdaysMinRegex(e)});_e("ddd",function(e,t){return t.weekdaysShortRegex(e)});_e("dddd",function(e,t){return t.weekdaysRegex(e)});Oc(["dd","ddd","dddd"],function(e,t,r,n){var s=r._locale.weekdaysParse(e,n,r._strict);s!=null?t.d=s:Xe(r).invalidWeekday=e});Oc(["d","e","E"],function(e,t,r,n){t[n]=rt(e)});function f4(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function h4(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Dv(e,t){return e.slice(t,7).concat(e.slice(0,t))}var p4="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Rk="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),m4="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),g4=Dc,v4=Dc,y4=Dc;function x4(e,t){var r=Cn(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?Dv(r,this._week.dow):e?r[e.day()]:r}function w4(e){return e===!0?Dv(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function _4(e){return e===!0?Dv(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function b4(e,t,r){var n,s,o,i=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)o=Kn([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(o,"").toLocaleLowerCase();return r?t==="dddd"?(s=zt.call(this._weekdaysParse,i),s!==-1?s:null):t==="ddd"?(s=zt.call(this._shortWeekdaysParse,i),s!==-1?s:null):(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null):t==="dddd"?(s=zt.call(this._weekdaysParse,i),s!==-1||(s=zt.call(this._shortWeekdaysParse,i),s!==-1)?s:(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null)):t==="ddd"?(s=zt.call(this._shortWeekdaysParse,i),s!==-1||(s=zt.call(this._weekdaysParse,i),s!==-1)?s:(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null)):(s=zt.call(this._minWeekdaysParse,i),s!==-1||(s=zt.call(this._weekdaysParse,i),s!==-1)?s:(s=zt.call(this._shortWeekdaysParse,i),s!==-1?s:null))}function S4(e,t,r){var n,s,o;if(this._weekdaysParseExact)return b4.call(this,e,t,r);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(s=Kn([2e3,1]).day(n),r&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(s,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(s,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(s,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(o="^"+this.weekdays(s,"")+"|^"+this.weekdaysShort(s,"")+"|^"+this.weekdaysMin(s,""),this._weekdaysParse[n]=new RegExp(o.replace(".",""),"i")),r&&t==="dddd"&&this._fullWeekdaysParse[n].test(e))return n;if(r&&t==="ddd"&&this._shortWeekdaysParse[n].test(e))return n;if(r&&t==="dd"&&this._minWeekdaysParse[n].test(e))return n;if(!r&&this._weekdaysParse[n].test(e))return n}}function k4(e){if(!this.isValid())return e!=null?this:NaN;var t=Xl(this,"Day");return e!=null?(e=f4(e,this.localeData()),this.add(e-t,"d")):t}function C4(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function j4(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=h4(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function E4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(ct(this,"_weekdaysRegex")||(this._weekdaysRegex=g4),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function N4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(ct(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=v4),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function T4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(ct(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=y4),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ov(){function e(d,f){return f.length-d.length}var t=[],r=[],n=[],s=[],o,i,a,c,u;for(o=0;o<7;o++)i=Kn([2e3,1]).day(o),a=gs(this.weekdaysMin(i,"")),c=gs(this.weekdaysShort(i,"")),u=gs(this.weekdays(i,"")),t.push(a),r.push(c),n.push(u),s.push(a),s.push(c),s.push(u);t.sort(e),r.sort(e),n.sort(e),s.sort(e),this._weekdaysRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function Mv(){return this.hours()%12||12}function R4(){return this.hours()||24}Ie("H",["HH",2],0,"hour");Ie("h",["hh",2],0,Mv);Ie("k",["kk",2],0,R4);Ie("hmm",0,0,function(){return""+Mv.apply(this)+Hn(this.minutes(),2)});Ie("hmmss",0,0,function(){return""+Mv.apply(this)+Hn(this.minutes(),2)+Hn(this.seconds(),2)});Ie("Hmm",0,0,function(){return""+this.hours()+Hn(this.minutes(),2)});Ie("Hmmss",0,0,function(){return""+this.hours()+Hn(this.minutes(),2)+Hn(this.seconds(),2)});function Pk(e,t){Ie(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}Pk("a",!0);Pk("A",!1);function Ak(e,t){return t._meridiemParse}_e("a",Ak);_e("A",Ak);_e("H",Ct,Pv);_e("h",Ct,Da);_e("k",Ct,Da);_e("HH",Ct,Zr);_e("hh",Ct,Zr);_e("kk",Ct,Zr);_e("hmm",wk);_e("hmmss",_k);_e("Hmm",wk);_e("Hmmss",_k);vt(["H","HH"],Gt);vt(["k","kk"],function(e,t,r){var n=rt(e);t[Gt]=n===24?0:n});vt(["a","A"],function(e,t,r){r._isPm=r._locale.isPM(e),r._meridiem=e});vt(["h","hh"],function(e,t,r){t[Gt]=rt(e),Xe(r).bigHour=!0});vt("hmm",function(e,t,r){var n=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n)),Xe(r).bigHour=!0});vt("hmmss",function(e,t,r){var n=e.length-4,s=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n,2)),t[hs]=rt(e.substr(s)),Xe(r).bigHour=!0});vt("Hmm",function(e,t,r){var n=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n))});vt("Hmmss",function(e,t,r){var n=e.length-4,s=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n,2)),t[hs]=rt(e.substr(s))});function P4(e){return(e+"").toLowerCase().charAt(0)==="p"}var A4=/[ap]\.?m?\.?/i,D4=Oa("Hours",!0);function O4(e,t,r){return e>11?r?"pm":"PM":r?"am":"AM"}var Dk={calendar:bL,longDateFormat:jL,invalidDate:NL,ordinal:RL,dayOfMonthOrdinalParse:PL,relativeTime:DL,months:GL,monthsShort:kk,week:a4,weekdays:p4,weekdaysMin:m4,weekdaysShort:Rk,meridiemParse:A4},Nt={},Xa={},ec;function M4(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r0;){if(s=Ff(o.slice(0,r).join("-")),s)return s;if(n&&n.length>=r&&M4(o,n)>=r-1)break;r--}t++}return ec}function L4(e){return!!(e&&e.match("^[^/\\\\]*$"))}function Ff(e){var t=null,r;if(Nt[e]===void 0&&typeof Gu<"u"&&Gu&&Gu.exports&&L4(e))try{t=ec._abbr,r=require,r("./locale/"+e),co(t)}catch{Nt[e]=null}return Nt[e]}function co(e,t){var r;return e&&(_r(t)?r=As(e):r=Iv(e,t),r?ec=r:typeof console<"u"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),ec._abbr}function Iv(e,t){if(t!==null){var r,n=Dk;if(t.abbr=e,Nt[e]!=null)gk("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=Nt[e]._config;else if(t.parentLocale!=null)if(Nt[t.parentLocale]!=null)n=Nt[t.parentLocale]._config;else if(r=Ff(t.parentLocale),r!=null)n=r._config;else return Xa[t.parentLocale]||(Xa[t.parentLocale]=[]),Xa[t.parentLocale].push({name:e,config:t}),null;return Nt[e]=new jv(fm(n,t)),Xa[e]&&Xa[e].forEach(function(s){Iv(s.name,s.config)}),co(e),Nt[e]}else return delete Nt[e],null}function F4(e,t){if(t!=null){var r,n,s=Dk;Nt[e]!=null&&Nt[e].parentLocale!=null?Nt[e].set(fm(Nt[e]._config,t)):(n=Ff(e),n!=null&&(s=n._config),t=fm(s,t),n==null&&(t.abbr=e),r=new jv(t),r.parentLocale=Nt[e],Nt[e]=r),co(e)}else Nt[e]!=null&&(Nt[e].parentLocale!=null?(Nt[e]=Nt[e].parentLocale,e===co()&&co(e)):Nt[e]!=null&&delete Nt[e]);return Nt[e]}function As(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return ec;if(!Cn(e)){if(t=Ff(e),t)return t;e=[e]}return I4(e)}function z4(){return hm(Nt)}function Lv(e){var t,r=e._a;return r&&Xe(e).overflow===-2&&(t=r[fs]<0||r[fs]>11?fs:r[Ln]<1||r[Ln]>Av(r[ar],r[fs])?Ln:r[Gt]<0||r[Gt]>24||r[Gt]===24&&(r[vn]!==0||r[hs]!==0||r[Wo]!==0)?Gt:r[vn]<0||r[vn]>59?vn:r[hs]<0||r[hs]>59?hs:r[Wo]<0||r[Wo]>999?Wo:-1,Xe(e)._overflowDayOfYear&&(tLn)&&(t=Ln),Xe(e)._overflowWeeks&&t===-1&&(t=WL),Xe(e)._overflowWeekday&&t===-1&&(t=BL),Xe(e).overflow=t),e}var U4=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,$4=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,V4=/Z|[+-]\d\d(?::?\d\d)?/,bu=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Xh=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],W4=/^\/?Date\((-?\d+)/i,B4=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,H4={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Ok(e){var t,r,n=e._i,s=U4.exec(n)||$4.exec(n),o,i,a,c,u=bu.length,d=Xh.length;if(s){for(Xe(e).iso=!0,t=0,r=u;tbl(i)||e._dayOfYear===0)&&(Xe(e)._overflowDayOfYear=!0),r=Ql(i,0,e._dayOfYear),e._a[fs]=r.getUTCMonth(),e._a[Ln]=r.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=n[t]=s[t];for(;t<7;t++)e._a[t]=n[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[Gt]===24&&e._a[vn]===0&&e._a[hs]===0&&e._a[Wo]===0&&(e._nextDay=!0,e._a[Gt]=0),e._d=(e._useUTC?Ql:o4).apply(null,n),o=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Gt]=24),e._w&&typeof e._w.d<"u"&&e._w.d!==o&&(Xe(e).weekdayMismatch=!0)}}function J4(e){var t,r,n,s,o,i,a,c,u;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(o=1,i=4,r=Ci(t.GG,e._a[ar],Jl(kt(),1,4).year),n=Ci(t.W,1),s=Ci(t.E,1),(s<1||s>7)&&(c=!0)):(o=e._locale._week.dow,i=e._locale._week.doy,u=Jl(kt(),o,i),r=Ci(t.gg,e._a[ar],u.year),n=Ci(t.w,u.week),t.d!=null?(s=t.d,(s<0||s>6)&&(c=!0)):t.e!=null?(s=t.e+o,(t.e<0||t.e>6)&&(c=!0)):s=o),n<1||n>vs(r,o,i)?Xe(e)._overflowWeeks=!0:c!=null?Xe(e)._overflowWeekday=!0:(a=Tk(r,n,s,o,i),e._a[ar]=a.year,e._dayOfYear=a.dayOfYear)}ve.ISO_8601=function(){};ve.RFC_2822=function(){};function zv(e){if(e._f===ve.ISO_8601){Ok(e);return}if(e._f===ve.RFC_2822){Mk(e);return}e._a=[],Xe(e).empty=!0;var t=""+e._i,r,n,s,o,i,a=t.length,c=0,u,d;for(s=vk(e._f,e._locale).match(Ev)||[],d=s.length,r=0;r0&&Xe(e).unusedInput.push(i),t=t.slice(t.indexOf(n)+n.length),c+=n.length),ea[o]?(n?Xe(e).empty=!1:Xe(e).unusedTokens.push(o),VL(o,n,e)):e._strict&&!n&&Xe(e).unusedTokens.push(o);Xe(e).charsLeftOver=a-c,t.length>0&&Xe(e).unusedInput.push(t),e._a[Gt]<=12&&Xe(e).bigHour===!0&&e._a[Gt]>0&&(Xe(e).bigHour=void 0),Xe(e).parsedDateParts=e._a.slice(0),Xe(e).meridiem=e._meridiem,e._a[Gt]=e5(e._locale,e._a[Gt],e._meridiem),u=Xe(e).era,u!==null&&(e._a[ar]=e._locale.erasConvertYear(u,e._a[ar])),Fv(e),Lv(e)}function e5(e,t,r){var n;return r==null?t:e.meridiemHour!=null?e.meridiemHour(t,r):(e.isPM!=null&&(n=e.isPM(r),n&&t<12&&(t+=12),!n&&t===12&&(t=0)),t)}function t5(e){var t,r,n,s,o,i,a=!1,c=e._f.length;if(c===0){Xe(e).invalidFormat=!0,e._d=new Date(NaN);return}for(s=0;sthis?this:e:Pf()});function Fk(e,t){var r,n;if(t.length===1&&Cn(t[0])&&(t=t[0]),!t.length)return kt();for(r=t[0],n=1;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function b5(){if(!_r(this._isDSTShifted))return this._isDSTShifted;var e={},t;return Cv(e,this),e=Ik(e),e._a?(t=e._isUTC?Kn(e._a):kt(e._a),this._isDSTShifted=this.isValid()&&h5(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function S5(){return this.isValid()?!this._isUTC:!1}function k5(){return this.isValid()?this._isUTC:!1}function Uk(){return this.isValid()?this._isUTC&&this._offset===0:!1}var C5=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,j5=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Rn(e,t){var r=e,n=null,s,o,i;return Bu(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:Cs(e)||!isNaN(+e)?(r={},t?r[t]=+e:r.milliseconds=+e):(n=C5.exec(e))?(s=n[1]==="-"?-1:1,r={y:0,d:rt(n[Ln])*s,h:rt(n[Gt])*s,m:rt(n[vn])*s,s:rt(n[hs])*s,ms:rt(mm(n[Wo]*1e3))*s}):(n=j5.exec(e))?(s=n[1]==="-"?-1:1,r={y:Po(n[2],s),M:Po(n[3],s),w:Po(n[4],s),d:Po(n[5],s),h:Po(n[6],s),m:Po(n[7],s),s:Po(n[8],s)}):r==null?r={}:typeof r=="object"&&("from"in r||"to"in r)&&(i=E5(kt(r.from),kt(r.to)),r={},r.ms=i.milliseconds,r.M=i.months),o=new zf(r),Bu(e)&&ct(e,"_locale")&&(o._locale=e._locale),Bu(e)&&ct(e,"_isValid")&&(o._isValid=e._isValid),o}Rn.fn=zf.prototype;Rn.invalid=f5;function Po(e,t){var r=e&&parseFloat(e.replace(",","."));return(isNaN(r)?0:r)*t}function ew(e,t){var r={};return r.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(r.months,"M").isAfter(t)&&--r.months,r.milliseconds=+t-+e.clone().add(r.months,"M"),r}function E5(e,t){var r;return e.isValid()&&t.isValid()?(t=$v(t,e),e.isBefore(t)?r=ew(e,t):(r=ew(t,e),r.milliseconds=-r.milliseconds,r.months=-r.months),r):{milliseconds:0,months:0}}function $k(e,t){return function(r,n){var s,o;return n!==null&&!isNaN(+n)&&(gk(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=r,r=n,n=o),s=Rn(r,n),Vk(this,s,e),this}}function Vk(e,t,r,n){var s=t._milliseconds,o=mm(t._days),i=mm(t._months);e.isValid()&&(n=n??!0,i&&jk(e,Xl(e,"Month")+i*r),o&&Sk(e,"Date",Xl(e,"Date")+o*r),s&&e._d.setTime(e._d.valueOf()+s*r),n&&ve.updateOffset(e,o||i))}var N5=$k(1,"add"),T5=$k(-1,"subtract");function Wk(e){return typeof e=="string"||e instanceof String}function R5(e){return jn(e)||Pc(e)||Wk(e)||Cs(e)||A5(e)||P5(e)||e===null||e===void 0}function P5(e){var t=Zo(e)&&!Sv(e),r=!1,n=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],s,o,i=n.length;for(s=0;sr.valueOf():r.valueOf()9999?Wu(r,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Gn(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Wu(r,"Z")):Wu(r,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Y5(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",r,n,s,o;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),r="["+e+'("]',n=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",s="-MM-DD[T]HH:mm:ss.SSS",o=t+'[")]',this.format(r+n+s+o)}function Z5(e){e||(e=this.isUtc()?ve.defaultFormatUtc:ve.defaultFormat);var t=Wu(this,e);return this.localeData().postformat(t)}function K5(e,t){return this.isValid()&&(jn(e)&&e.isValid()||kt(e).isValid())?Rn({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function G5(e){return this.from(kt(),e)}function q5(e,t){return this.isValid()&&(jn(e)&&e.isValid()||kt(e).isValid())?Rn({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function X5(e){return this.to(kt(),e)}function Bk(e){var t;return e===void 0?this._locale._abbr:(t=As(e),t!=null&&(this._locale=t),this)}var Hk=an("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return e===void 0?this.localeData():this.locale(e)});function Yk(){return this._locale}var Pd=1e3,ta=60*Pd,Ad=60*ta,Zk=(365*400+97)*24*Ad;function ra(e,t){return(e%t+t)%t}function Kk(e,t,r){return e<100&&e>=0?new Date(e+400,t,r)-Zk:new Date(e,t,r).valueOf()}function Gk(e,t,r){return e<100&&e>=0?Date.UTC(e+400,t,r)-Zk:Date.UTC(e,t,r)}function Q5(e){var t,r;if(e=ln(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(r=this._isUTC?Gk:Kk,e){case"year":t=r(this.year(),0,1);break;case"quarter":t=r(this.year(),this.month()-this.month()%3,1);break;case"month":t=r(this.year(),this.month(),1);break;case"week":t=r(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=r(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=ra(t+(this._isUTC?0:this.utcOffset()*ta),Ad);break;case"minute":t=this._d.valueOf(),t-=ra(t,ta);break;case"second":t=this._d.valueOf(),t-=ra(t,Pd);break}return this._d.setTime(t),ve.updateOffset(this,!0),this}function J5(e){var t,r;if(e=ln(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(r=this._isUTC?Gk:Kk,e){case"year":t=r(this.year()+1,0,1)-1;break;case"quarter":t=r(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=r(this.year(),this.month()+1,1)-1;break;case"week":t=r(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=r(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=Ad-ra(t+(this._isUTC?0:this.utcOffset()*ta),Ad)-1;break;case"minute":t=this._d.valueOf(),t+=ta-ra(t,ta)-1;break;case"second":t=this._d.valueOf(),t+=Pd-ra(t,Pd)-1;break}return this._d.setTime(t),ve.updateOffset(this,!0),this}function eF(){return this._d.valueOf()-(this._offset||0)*6e4}function tF(){return Math.floor(this.valueOf()/1e3)}function rF(){return new Date(this.valueOf())}function nF(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function sF(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function oF(){return this.isValid()?this.toISOString():null}function iF(){return kv(this)}function aF(){return Qs({},Xe(this))}function lF(){return Xe(this).overflow}function cF(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Ie("N",0,0,"eraAbbr");Ie("NN",0,0,"eraAbbr");Ie("NNN",0,0,"eraAbbr");Ie("NNNN",0,0,"eraName");Ie("NNNNN",0,0,"eraNarrow");Ie("y",["y",1],"yo","eraYear");Ie("y",["yy",2],0,"eraYear");Ie("y",["yyy",3],0,"eraYear");Ie("y",["yyyy",4],0,"eraYear");_e("N",Vv);_e("NN",Vv);_e("NNN",Vv);_e("NNNN",wF);_e("NNNNN",_F);vt(["N","NN","NNN","NNNN","NNNNN"],function(e,t,r,n){var s=r._locale.erasParse(e,n,r._strict);s?Xe(r).era=s:Xe(r).invalidEra=e});_e("y",Aa);_e("yy",Aa);_e("yyy",Aa);_e("yyyy",Aa);_e("yo",bF);vt(["y","yy","yyy","yyyy"],ar);vt(["yo"],function(e,t,r,n){var s;r._locale._eraYearOrdinalRegex&&(s=e.match(r._locale._eraYearOrdinalRegex)),r._locale.eraYearOrdinalParse?t[ar]=r._locale.eraYearOrdinalParse(e,s):t[ar]=parseInt(e,10)});function uF(e,t){var r,n,s,o=this._eras||As("en")._eras;for(r=0,n=o.length;r=0)return o[n]}function fF(e,t){var r=e.since<=e.until?1:-1;return t===void 0?ve(e.since).year():ve(e.since).year()+(t-e.offset)*r}function hF(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;eo&&(t=o),TF.call(this,e,t,r,n,s))}function TF(e,t,r,n,s){var o=Tk(e,t,r,n,s),i=Ql(o.year,0,o.dayOfYear);return this.year(i.getUTCFullYear()),this.month(i.getUTCMonth()),this.date(i.getUTCDate()),this}Ie("Q",0,"Qo","quarter");_e("Q",yk);vt("Q",function(e,t){t[fs]=(rt(e)-1)*3});function RF(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}Ie("D",["DD",2],"Do","date");_e("D",Ct,Da);_e("DD",Ct,Zr);_e("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient});vt(["D","DD"],Ln);vt("Do",function(e,t){t[Ln]=rt(e.match(Ct)[0])});var Xk=Oa("Date",!0);Ie("DDD",["DDDD",3],"DDDo","dayOfYear");_e("DDD",Df);_e("DDDD",xk);vt(["DDD","DDDD"],function(e,t,r){r._dayOfYear=rt(e)});function PF(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}Ie("m",["mm",2],0,"minute");_e("m",Ct,Pv);_e("mm",Ct,Zr);vt(["m","mm"],vn);var AF=Oa("Minutes",!1);Ie("s",["ss",2],0,"second");_e("s",Ct,Pv);_e("ss",Ct,Zr);vt(["s","ss"],hs);var DF=Oa("Seconds",!1);Ie("S",0,0,function(){return~~(this.millisecond()/100)});Ie(0,["SS",2],0,function(){return~~(this.millisecond()/10)});Ie(0,["SSS",3],0,"millisecond");Ie(0,["SSSS",4],0,function(){return this.millisecond()*10});Ie(0,["SSSSS",5],0,function(){return this.millisecond()*100});Ie(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3});Ie(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4});Ie(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5});Ie(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6});_e("S",Df,yk);_e("SS",Df,Zr);_e("SSS",Df,xk);var Js,Qk;for(Js="SSSS";Js.length<=9;Js+="S")_e(Js,Aa);function OF(e,t){t[Wo]=rt(("0."+e)*1e3)}for(Js="S";Js.length<=9;Js+="S")vt(Js,OF);Qk=Oa("Milliseconds",!1);Ie("z",0,0,"zoneAbbr");Ie("zz",0,0,"zoneName");function MF(){return this._isUTC?"UTC":""}function IF(){return this._isUTC?"Coordinated Universal Time":""}var le=Ac.prototype;le.add=N5;le.calendar=M5;le.clone=I5;le.diff=W5;le.endOf=J5;le.format=Z5;le.from=K5;le.fromNow=G5;le.to=q5;le.toNow=X5;le.get=YL;le.invalidAt=lF;le.isAfter=L5;le.isBefore=F5;le.isBetween=z5;le.isSame=U5;le.isSameOrAfter=$5;le.isSameOrBefore=V5;le.isValid=iF;le.lang=Hk;le.locale=Bk;le.localeData=Yk;le.max=i5;le.min=o5;le.parsingFlags=aF;le.set=ZL;le.startOf=Q5;le.subtract=T5;le.toArray=nF;le.toObject=sF;le.toDate=rF;le.toISOString=H5;le.inspect=Y5;typeof Symbol<"u"&&Symbol.for!=null&&(le[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"});le.toJSON=oF;le.toString=B5;le.unix=tF;le.valueOf=eF;le.creationData=cF;le.eraName=hF;le.eraNarrow=pF;le.eraAbbr=mF;le.eraYear=gF;le.year=bk;le.isLeapYear=HL;le.weekYear=SF;le.isoWeekYear=kF;le.quarter=le.quarters=RF;le.month=Ek;le.daysInMonth=r4;le.week=le.weeks=u4;le.isoWeek=le.isoWeeks=d4;le.weeksInYear=EF;le.weeksInWeekYear=NF;le.isoWeeksInYear=CF;le.isoWeeksInISOWeekYear=jF;le.date=Xk;le.day=le.days=k4;le.weekday=C4;le.isoWeekday=j4;le.dayOfYear=PF;le.hour=le.hours=D4;le.minute=le.minutes=AF;le.second=le.seconds=DF;le.millisecond=le.milliseconds=Qk;le.utcOffset=m5;le.utc=v5;le.local=y5;le.parseZone=x5;le.hasAlignedHourOffset=w5;le.isDST=_5;le.isLocal=S5;le.isUtcOffset=k5;le.isUtc=Uk;le.isUTC=Uk;le.zoneAbbr=MF;le.zoneName=IF;le.dates=an("dates accessor is deprecated. Use date instead.",Xk);le.months=an("months accessor is deprecated. Use month instead",Ek);le.years=an("years accessor is deprecated. Use year instead",bk);le.zone=an("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",g5);le.isDSTShifted=an("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",b5);function LF(e){return kt(e*1e3)}function FF(){return kt.apply(null,arguments).parseZone()}function Jk(e){return e}var ut=jv.prototype;ut.calendar=SL;ut.longDateFormat=EL;ut.invalidDate=TL;ut.ordinal=AL;ut.preparse=Jk;ut.postformat=Jk;ut.relativeTime=OL;ut.pastFuture=ML;ut.set=_L;ut.eras=uF;ut.erasParse=dF;ut.erasConvertYear=fF;ut.erasAbbrRegex=yF;ut.erasNameRegex=vF;ut.erasNarrowRegex=xF;ut.months=QL;ut.monthsShort=JL;ut.monthsParse=t4;ut.monthsRegex=s4;ut.monthsShortRegex=n4;ut.week=i4;ut.firstDayOfYear=c4;ut.firstDayOfWeek=l4;ut.weekdays=x4;ut.weekdaysMin=_4;ut.weekdaysShort=w4;ut.weekdaysParse=S4;ut.weekdaysRegex=E4;ut.weekdaysShortRegex=N4;ut.weekdaysMinRegex=T4;ut.isPM=P4;ut.meridiem=O4;function Dd(e,t,r,n){var s=As(),o=Kn().set(n,t);return s[r](o,e)}function eC(e,t,r){if(Cs(e)&&(t=e,e=void 0),e=e||"",t!=null)return Dd(e,t,r,"month");var n,s=[];for(n=0;n<12;n++)s[n]=Dd(e,n,r,"month");return s}function Bv(e,t,r,n){typeof e=="boolean"?(Cs(t)&&(r=t,t=void 0),t=t||""):(t=e,r=t,e=!1,Cs(t)&&(r=t,t=void 0),t=t||"");var s=As(),o=e?s._week.dow:0,i,a=[];if(r!=null)return Dd(t,(r+o)%7,n,"day");for(i=0;i<7;i++)a[i]=Dd(t,(i+o)%7,n,"day");return a}function zF(e,t){return eC(e,t,"months")}function UF(e,t){return eC(e,t,"monthsShort")}function $F(e,t,r){return Bv(e,t,r,"weekdays")}function VF(e,t,r){return Bv(e,t,r,"weekdaysShort")}function WF(e,t,r){return Bv(e,t,r,"weekdaysMin")}co("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,r=rt(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+r}});ve.lang=an("moment.lang is deprecated. Use moment.locale instead.",co);ve.langData=an("moment.langData is deprecated. Use moment.localeData instead.",As);var ns=Math.abs;function BF(){var e=this._data;return this._milliseconds=ns(this._milliseconds),this._days=ns(this._days),this._months=ns(this._months),e.milliseconds=ns(e.milliseconds),e.seconds=ns(e.seconds),e.minutes=ns(e.minutes),e.hours=ns(e.hours),e.months=ns(e.months),e.years=ns(e.years),this}function tC(e,t,r,n){var s=Rn(t,r);return e._milliseconds+=n*s._milliseconds,e._days+=n*s._days,e._months+=n*s._months,e._bubble()}function HF(e,t){return tC(this,e,t,1)}function YF(e,t){return tC(this,e,t,-1)}function tw(e){return e<0?Math.floor(e):Math.ceil(e)}function ZF(){var e=this._milliseconds,t=this._days,r=this._months,n=this._data,s,o,i,a,c;return e>=0&&t>=0&&r>=0||e<=0&&t<=0&&r<=0||(e+=tw(vm(r)+t)*864e5,t=0,r=0),n.milliseconds=e%1e3,s=Jr(e/1e3),n.seconds=s%60,o=Jr(s/60),n.minutes=o%60,i=Jr(o/60),n.hours=i%24,t+=Jr(i/24),c=Jr(rC(t)),r+=c,t-=tw(vm(c)),a=Jr(r/12),r%=12,n.days=t,n.months=r,n.years=a,this}function rC(e){return e*4800/146097}function vm(e){return e*146097/4800}function KF(e){if(!this.isValid())return NaN;var t,r,n=this._milliseconds;if(e=ln(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+n/864e5,r=this._months+rC(t),e){case"month":return r;case"quarter":return r/3;case"year":return r/12}else switch(t=this._days+Math.round(vm(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return t*24+n/36e5;case"minute":return t*1440+n/6e4;case"second":return t*86400+n/1e3;case"millisecond":return Math.floor(t*864e5)+n;default:throw new Error("Unknown unit "+e)}}function Ds(e){return function(){return this.as(e)}}var nC=Ds("ms"),GF=Ds("s"),qF=Ds("m"),XF=Ds("h"),QF=Ds("d"),JF=Ds("w"),e3=Ds("M"),t3=Ds("Q"),r3=Ds("y"),n3=nC;function s3(){return Rn(this)}function o3(e){return e=ln(e),this.isValid()?this[e+"s"]():NaN}function fi(e){return function(){return this.isValid()?this._data[e]:NaN}}var i3=fi("milliseconds"),a3=fi("seconds"),l3=fi("minutes"),c3=fi("hours"),u3=fi("days"),d3=fi("months"),f3=fi("years");function h3(){return Jr(this.days()/7)}var as=Math.round,Ui={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function p3(e,t,r,n,s){return s.relativeTime(t||1,!!r,e,n)}function m3(e,t,r,n){var s=Rn(e).abs(),o=as(s.as("s")),i=as(s.as("m")),a=as(s.as("h")),c=as(s.as("d")),u=as(s.as("M")),d=as(s.as("w")),f=as(s.as("y")),m=o<=r.ss&&["s",o]||o0,m[4]=n,p3.apply(null,m)}function g3(e){return e===void 0?as:typeof e=="function"?(as=e,!0):!1}function v3(e,t){return Ui[e]===void 0?!1:t===void 0?Ui[e]:(Ui[e]=t,e==="s"&&(Ui.ss=t-1),!0)}function y3(e,t){if(!this.isValid())return this.localeData().invalidDate();var r=!1,n=Ui,s,o;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(r=e),typeof t=="object"&&(n=Object.assign({},Ui,t),t.s!=null&&t.ss==null&&(n.ss=t.s-1)),s=this.localeData(),o=m3(this,!r,n,s),r&&(o=s.pastFuture(+this,o)),s.postformat(o)}var Qh=Math.abs;function Si(e){return(e>0)-(e<0)||+e}function $f(){if(!this.isValid())return this.localeData().invalidDate();var e=Qh(this._milliseconds)/1e3,t=Qh(this._days),r=Qh(this._months),n,s,o,i,a=this.asSeconds(),c,u,d,f;return a?(n=Jr(e/60),s=Jr(n/60),e%=60,n%=60,o=Jr(r/12),r%=12,i=e?e.toFixed(3).replace(/\.?0+$/,""):"",c=a<0?"-":"",u=Si(this._months)!==Si(a)?"-":"",d=Si(this._days)!==Si(a)?"-":"",f=Si(this._milliseconds)!==Si(a)?"-":"",c+"P"+(o?u+o+"Y":"")+(r?u+r+"M":"")+(t?d+t+"D":"")+(s||n||e?"T":"")+(s?f+s+"H":"")+(n?f+n+"M":"")+(e?f+i+"S":"")):"P0D"}var it=zf.prototype;it.isValid=d5;it.abs=BF;it.add=HF;it.subtract=YF;it.as=KF;it.asMilliseconds=nC;it.asSeconds=GF;it.asMinutes=qF;it.asHours=XF;it.asDays=QF;it.asWeeks=JF;it.asMonths=e3;it.asQuarters=t3;it.asYears=r3;it.valueOf=n3;it._bubble=ZF;it.clone=s3;it.get=o3;it.milliseconds=i3;it.seconds=a3;it.minutes=l3;it.hours=c3;it.days=u3;it.weeks=h3;it.months=d3;it.years=f3;it.humanize=y3;it.toISOString=$f;it.toString=$f;it.toJSON=$f;it.locale=Bk;it.localeData=Yk;it.toIsoString=an("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$f);it.lang=Hk;Ie("X",0,0,"unix");Ie("x",0,0,"valueOf");_e("x",Mf);_e("X",zL);vt("X",function(e,t,r){r._d=new Date(parseFloat(e)*1e3)});vt("x",function(e,t,r){r._d=new Date(rt(e))});//! moment.js +ve.version="2.30.1";xL(kt);ve.fn=le;ve.min=a5;ve.max=l5;ve.now=c5;ve.utc=Kn;ve.unix=LF;ve.months=zF;ve.isDate=Pc;ve.locale=co;ve.invalid=Pf;ve.duration=Rn;ve.isMoment=jn;ve.weekdays=$F;ve.parseZone=FF;ve.localeData=As;ve.isDuration=Bu;ve.monthsShort=UF;ve.weekdaysMin=WF;ve.defineLocale=Iv;ve.updateLocale=F4;ve.locales=z4;ve.weekdaysShort=VF;ve.normalizeUnits=ln;ve.relativeTimeRounding=g3;ve.relativeTimeThreshold=v3;ve.calendarFormat=O5;ve.prototype=le;ve.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const x3=async()=>await st().collection("access").getFullList({sort:"-created",filter:"deleted = null"}),jo=async e=>e.id?await st().collection("access").update(e.id,e):await st().collection("access").create(e),w3=async e=>(e.deleted=ve.utc().format("YYYY-MM-DD HH:mm:ss"),await st().collection("access").update(e.id,e)),rw=async()=>await st().collection("access_groups").getFullList({sort:"-created",expand:"access"}),_3=async e=>{const t=st();if((await t.collection("access").getList(1,1,{filter:`group='${e}' && deleted=null`})).items.length>0)throw new Error("该分组下有授权配置,无法删除");await t.collection("access_groups").delete(e)},b3=async e=>{const t=st();return e.id?await t.collection("access_groups").update(e.id,e):await t.collection("access_groups").create(e)},nw=async e=>await st().collection("access_groups").update(e.id,e),S3=(e,t)=>{switch(t.type){case"SET_ACCESSES":return{...e,accesses:t.payload};case"ADD_ACCESS":return{...e,accesses:[t.payload,...e.accesses]};case"DELETE_ACCESS":return{...e,accesses:e.accesses.filter(r=>r.id!==t.payload)};case"UPDATE_ACCESS":return{...e,accesses:e.accesses.map(r=>r.id===t.payload.id?t.payload:r)};case"SET_EMAILS":return{...e,emails:t.payload};case"ADD_EMAIL":return{...e,emails:{...e.emails,content:{emails:[...e.emails.content.emails,t.payload]}}};case"SET_ACCESS_GROUPS":return{...e,accessGroups:t.payload};default:return e}},k3=async()=>{try{return await st().collection("settings").getFirstListItem("name='emails'")}catch{return{content:{emails:[]}}}},sC=async e=>{try{return await st().collection("settings").getFirstListItem(`name='${e}'`)}catch{return{name:e}}},Mc=async e=>{const t=st();let r;return e.id?r=await t.collection("settings").update(e.id,e):r=await t.collection("settings").create(e),r},oC=v.createContext({}),Kr=()=>v.useContext(oC),C3=({children:e})=>{const[t,r]=v.useReducer(S3,{accesses:[],emails:{content:{emails:[]}},accessGroups:[]});v.useEffect(()=>{(async()=>{const d=await x3();r({type:"SET_ACCESSES",payload:d})})()},[]),v.useEffect(()=>{(async()=>{const d=await k3();r({type:"SET_EMAILS",payload:d})})()},[]),v.useEffect(()=>{(async()=>{const d=await rw();r({type:"SET_ACCESS_GROUPS",payload:d})})()},[]);const n=v.useCallback(async()=>{const u=await rw();r({type:"SET_ACCESS_GROUPS",payload:u})},[]),s=v.useCallback(u=>{r({type:"SET_EMAILS",payload:u})},[]),o=v.useCallback(u=>{r({type:"DELETE_ACCESS",payload:u})},[]),i=v.useCallback(u=>{r({type:"ADD_ACCESS",payload:u})},[]),a=v.useCallback(u=>{r({type:"UPDATE_ACCESS",payload:u})},[]),c=v.useCallback(u=>{r({type:"SET_ACCESS_GROUPS",payload:u})},[]);return l.jsx(oC.Provider,{value:{config:{accesses:t.accesses,emails:t.emails,accessGroups:t.accessGroups},deleteAccess:o,addAccess:i,setEmails:s,updateAccess:a,setAccessGroups:c,reloadAccessGroups:n},children:e&&e})},j3={theme:"system",setTheme:()=>null},iC=v.createContext(j3);function E3({children:e,defaultTheme:t="system",storageKey:r="vite-ui-theme",...n}){const[s,o]=v.useState(()=>localStorage.getItem(r)||t);v.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(c);return}a.classList.add(s)},[s]);const i={theme:s,setTheme:a=>{localStorage.setItem(r,a),o(a)}};return l.jsx(iC.Provider,{...n,value:i,children:e})}const N3=()=>{const e=v.useContext(iC);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};function T3(){const{setTheme:e}=N3();return l.jsxs($S,{children:[l.jsx(VS,{asChild:!0,children:l.jsxs(He,{variant:"outline",size:"icon",children:[l.jsx(xA,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),l.jsx(vA,{className:"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100 dark:text-white"}),l.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),l.jsxs(uv,{align:"end",children:[l.jsx(Qi,{onClick:()=>e("light"),children:"浅色"}),l.jsx(Qi,{onClick:()=>e("dark"),children:"暗黑"}),l.jsx(Qi,{onClick:()=>e("system"),children:"系统"})]})]})}var R3="Separator",sw="horizontal",P3=["horizontal","vertical"],aC=v.forwardRef((e,t)=>{const{decorative:r,orientation:n=sw,...s}=e,o=A3(n)?n:sw,a=r?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return l.jsx(Re.div,{"data-orientation":o,...a,...s,ref:t})});aC.displayName=R3;function A3(e){return P3.includes(e)}var lC=aC;const Wt=v.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},s)=>l.jsx(lC,{ref:s,decorative:r,orientation:t,className:ae("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Wt.displayName=lC.displayName;const D3="Certimate v0.1.11",cC=()=>l.jsxs("div",{className:"fixed right-0 bottom-0 w-full flex justify-between p-5",children:[l.jsx("div",{className:""}),l.jsxs("div",{className:"text-muted-foreground text-sm hover:text-stone-900 dark:hover:text-stone-200 flex",children:[l.jsxs("a",{href:"https://docs.certimate.me",target:"_blank",className:"flex items-center",children:[l.jsx(sA,{size:16}),l.jsx("div",{className:"ml-1",children:"文档"})]}),l.jsx(Wt,{orientation:"vertical",className:"mx-2"}),l.jsx("a",{href:"https://github.com/usual2970/certimate/releases",target:"_blank",children:D3})]})]});function O3(){const e=Nr(),t=Nn();if(!st().authStore.isValid||!st().authStore.isAdmin)return l.jsx(Q1,{to:"/login"});const r=t.pathname,n=i=>(console.log(r),i==r?"bg-muted text-primary":"text-muted-foreground"),s=()=>{st().authStore.clear(),e("/login")},o=()=>{e("/setting/account")};return l.jsx(l.Fragment,{children:l.jsx(C3,{children:l.jsxs("div",{className:"grid min-h-screen w-full md:grid-cols-[180px_1fr] lg:grid-cols-[200px_1fr] 2xl:md:grid-cols-[280px_1fr] ",children:[l.jsx("div",{className:"hidden border-r dark:border-stone-500 bg-muted/40 md:block",children:l.jsxs("div",{className:"flex h-full max-h-screen flex-col gap-2",children:[l.jsx("div",{className:"flex h-14 items-center border-b dark:border-stone-500 px-4 lg:h-[60px] lg:px-6",children:l.jsxs(fr,{to:"/",className:"flex items-center gap-2 font-semibold",children:[l.jsx("img",{src:"/vite.svg",className:"w-[36px] h-[36px]"}),l.jsx("span",{className:"dark:text-white",children:"Certimate"})]})}),l.jsx("div",{className:"flex-1",children:l.jsxs("nav",{className:"grid items-start px-2 text-sm font-medium lg:px-4",children:[l.jsxs(fr,{to:"/",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/")),children:[l.jsx(x0,{className:"h-4 w-4"}),"控制面板"]}),l.jsxs(fr,{to:"/domains",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/domains")),children:[l.jsx(rm,{className:"h-4 w-4"}),"域名列表"]}),l.jsxs(fr,{to:"/access",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/access")),children:[l.jsx(w0,{className:"h-4 w-4"}),"授权管理"]}),l.jsxs(fr,{to:"/history",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/history")),children:[l.jsx(y0,{className:"h-4 w-4"}),"部署历史"]})]})})]})}),l.jsxs("div",{className:"flex flex-col",children:[l.jsxs("header",{className:"flex h-14 items-center gap-4 border-b dark:border-stone-500 bg-muted/40 px-4 lg:h-[60px] lg:px-6",children:[l.jsxs(yv,{children:[l.jsx(xv,{asChild:!0,children:l.jsxs(He,{variant:"outline",size:"icon",className:"shrink-0 md:hidden",children:[l.jsx(gA,{className:"h-5 w-5 dark:text-white"}),l.jsx("span",{className:"sr-only",children:"Toggle navigation menu"})]})}),l.jsx(Rf,{side:"left",className:"flex flex-col",children:l.jsxs("nav",{className:"grid gap-2 text-lg font-medium",children:[l.jsxs(fr,{to:"/",className:"flex items-center gap-2 text-lg font-semibold",children:[l.jsx("img",{src:"/vite.svg",className:"w-[36px] h-[36px]"}),l.jsx("span",{className:"dark:text-white",children:"Certimate"}),l.jsx("span",{className:"sr-only",children:"Certimate"})]}),l.jsxs(fr,{to:"/",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/")),children:[l.jsx(x0,{className:"h-5 w-5"}),"控制面板"]}),l.jsxs(fr,{to:"/domains",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/domains")),children:[l.jsx(rm,{className:"h-5 w-5"}),"域名列表"]}),l.jsxs(fr,{to:"/access",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/access")),children:[l.jsx(w0,{className:"h-5 w-5"}),"授权管理"]}),l.jsxs(fr,{to:"/history",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/history")),children:[l.jsx(y0,{className:"h-5 w-5"}),"部署历史"]})]})})]}),l.jsx("div",{className:"w-full flex-1"}),l.jsx(T3,{}),l.jsxs($S,{children:[l.jsx(VS,{asChild:!0,children:l.jsxs(He,{variant:"secondary",size:"icon",className:"rounded-full",children:[l.jsx(cA,{className:"h-5 w-5"}),l.jsx("span",{className:"sr-only",children:"Toggle user menu"})]})}),l.jsxs(uv,{align:"end",children:[l.jsx(WS,{children:"账户"}),l.jsx(BS,{}),l.jsx(Qi,{onClick:o,children:"偏好设置"}),l.jsx(Qi,{onClick:s,children:"退出"})]})]})]}),l.jsxs("main",{className:"flex flex-1 flex-col gap-4 p-4 lg:gap-6 lg:p-6 relative",children:[l.jsx(Ig,{}),l.jsx(cC,{})]})]})]})})})}const Hv=({phase:e,phaseSuccess:t})=>{let r=l.jsx(l.Fragment,{children:" "});return e==="check"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]})),e==="apply"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]})),e==="deploy"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"部署"})]})),r};var M3="VisuallyHidden",Ic=v.forwardRef((e,t)=>l.jsx(Re.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));Ic.displayName=M3;var I3=Ic,[Vf,_$]=xr("Tooltip",[Pa]),Wf=Pa(),uC="TooltipProvider",L3=700,ym="tooltip.open",[F3,Yv]=Vf(uC),Zv=e=>{const{__scopeTooltip:t,delayDuration:r=L3,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:o}=e,[i,a]=v.useState(!0),c=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),l.jsx(F3,{scope:t,isOpenDelayed:i,delayDuration:r,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(d=>{c.current=d},[]),disableHoverableContent:s,children:o})};Zv.displayName=uC;var Bf="Tooltip",[z3,Hf]=Vf(Bf),dC=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:s=!1,onOpenChange:o,disableHoverableContent:i,delayDuration:a}=e,c=Yv(Bf,e.__scopeTooltip),u=Wf(t),[d,f]=v.useState(null),m=Ur(),y=v.useRef(0),x=i??c.disableHoverableContent,g=a??c.delayDuration,_=v.useRef(!1),[p=!1,h]=on({prop:n,defaultProp:s,onChange:R=>{R?(c.onOpen(),document.dispatchEvent(new CustomEvent(ym))):c.onClose(),o==null||o(R)}}),w=v.useMemo(()=>p?_.current?"delayed-open":"instant-open":"closed",[p]),C=v.useCallback(()=>{window.clearTimeout(y.current),_.current=!1,h(!0)},[h]),j=v.useCallback(()=>{window.clearTimeout(y.current),h(!1)},[h]),E=v.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{_.current=!0,h(!0)},g)},[g,h]);return v.useEffect(()=>()=>window.clearTimeout(y.current),[]),l.jsx(Xg,{...u,children:l.jsx(z3,{scope:t,contentId:m,open:p,stateAttribute:w,trigger:d,onTriggerChange:f,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayed?E():C()},[c.isOpenDelayed,E,C]),onTriggerLeave:v.useCallback(()=>{x?j():window.clearTimeout(y.current)},[j,x]),onOpen:C,onClose:j,disableHoverableContent:x,children:r})})};dC.displayName=Bf;var xm="TooltipTrigger",fC=v.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Hf(xm,r),o=Yv(xm,r),i=Wf(r),a=v.useRef(null),c=Ke(t,a,s.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),f=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l.jsx(Qg,{asChild:!0,...i,children:l.jsx(Re.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:ce(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:ce(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:ce(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ce(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:ce(e.onBlur,s.onClose),onClick:ce(e.onClick,s.onClose)})})});fC.displayName=xm;var U3="TooltipPortal",[b$,$3]=Vf(U3,{forceMount:void 0}),ma="TooltipContent",Kv=v.forwardRef((e,t)=>{const r=$3(ma,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...o}=e,i=Hf(ma,e.__scopeTooltip);return l.jsx(ur,{present:n||i.open,children:i.disableHoverableContent?l.jsx(hC,{side:s,...o,ref:t}):l.jsx(V3,{side:s,...o,ref:t})})}),V3=v.forwardRef((e,t)=>{const r=Hf(ma,e.__scopeTooltip),n=Yv(ma,e.__scopeTooltip),s=v.useRef(null),o=Ke(t,s),[i,a]=v.useState(null),{trigger:c,onClose:u}=r,d=s.current,{onPointerInTransitChange:f}=n,m=v.useCallback(()=>{a(null),f(!1)},[f]),y=v.useCallback((x,g)=>{const _=x.currentTarget,p={x:x.clientX,y:x.clientY},h=Y3(p,_.getBoundingClientRect()),w=Z3(p,h),C=K3(g.getBoundingClientRect()),j=q3([...w,...C]);a(j),f(!0)},[f]);return v.useEffect(()=>()=>m(),[m]),v.useEffect(()=>{if(c&&d){const x=_=>y(_,d),g=_=>y(_,c);return c.addEventListener("pointerleave",x),d.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",x),d.removeEventListener("pointerleave",g)}}},[c,d,y,m]),v.useEffect(()=>{if(i){const x=g=>{const _=g.target,p={x:g.clientX,y:g.clientY},h=(c==null?void 0:c.contains(_))||(d==null?void 0:d.contains(_)),w=!G3(p,i);h?m():w&&(m(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,d,i,u,m]),l.jsx(hC,{...e,ref:o})}),[W3,B3]=Vf(Bf,{isInside:!1}),hC=v.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...a}=e,c=Hf(ma,r),u=Wf(r),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(ym,d),()=>document.removeEventListener(ym,d)),[d]),v.useEffect(()=>{if(c.trigger){const f=m=>{const y=m.target;y!=null&&y.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:l.jsxs(Jg,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[l.jsx(zg,{children:n}),l.jsx(W3,{scope:r,isInside:!0,children:l.jsx(I3,{id:c.contentId,role:"tooltip",children:s||n})})]})})});Kv.displayName=ma;var pC="TooltipArrow",H3=v.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Wf(r);return B3(pC,r).isInside?null:l.jsx(ev,{...s,...n,ref:t})});H3.displayName=pC;function Y3(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,s,o)){case o:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function Z3(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function K3(e){const{top:t,right:r,bottom:n,left:s}=e;return[{x:s,y:t},{x:r,y:t},{x:r,y:n},{x:s,y:n}]}function G3(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;on!=d>n&&r<(u-a)*(n-c)/(d-c)+a&&(s=!s)}return s}function q3(e){const t=e.slice();return t.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),X3(t)}function X3(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const s=e[n];for(;r.length>=2;){const o=r[r.length-1],i=r[r.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))r.pop();else break}r.push(s)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var Q3=Zv,J3=dC,e6=fC,mC=Kv;const t6=Q3,gC=J3,vC=e6,yC=v.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(mC,{ref:n,sideOffset:t,className:ae("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));yC.displayName=mC.displayName;const Gv=({deployment:e})=>{const t=r=>e.log[r]?e.log[r][e.log[r].length-1].error:"";return l.jsx(l.Fragment,{children:e.phase==="deploy"&&e.phaseSuccess||e.wholeSuccess?l.jsx(lA,{size:16,className:"text-green-700"}):l.jsx(l.Fragment,{children:t(e.phase).length?l.jsx(t6,{children:l.jsxs(gC,{children:[l.jsx(vC,{asChild:!0,className:"cursor-pointer",children:l.jsx(g0,{size:16,className:"text-red-700"})}),l.jsx(yC,{className:"max-w-[35em]",children:t(e.phase)})]})}):l.jsx(g0,{size:16,className:"text-red-700"})})})},xC=({className:e,...t})=>l.jsx("nav",{role:"navigation","aria-label":"pagination",className:ae("mx-auto flex w-full justify-center",e),...t});xC.displayName="Pagination";const wC=v.forwardRef(({className:e,...t},r)=>l.jsx("ul",{ref:r,className:ae("flex flex-row items-center gap-1",e),...t}));wC.displayName="PaginationContent";const wm=v.forwardRef(({className:e,...t},r)=>l.jsx("li",{ref:r,className:ae("",e),...t}));wm.displayName="PaginationItem";const _C=({className:e,isActive:t,size:r="icon",...n})=>l.jsx("a",{"aria-current":t?"page":void 0,className:ae(xf({variant:t?"outline":"ghost",size:r}),e),...n});_C.displayName="PaginationLink";const bC=({className:e,...t})=>l.jsxs("span",{"aria-hidden":!0,className:ae("flex h-9 w-9 items-center justify-center",e),...t,children:[l.jsx(dA,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"More pages"})]});bC.displayName="PaginationEllipsis";const SC=({totalPages:e,currentPage:t,onPageChange:r})=>{const s=()=>{if(e>7){let u=[];const d=Math.max(2,t-1),f=Math.min(e-1,t+1),m=e-1;return u=o(d,f),t>3&&u.unshift("..."),t{let d=a;const f=[];for(;d<=c;)f.push(d),d+=u;return f},i=s();return l.jsx(l.Fragment,{children:l.jsx(xC,{className:"dark:text-stone-200 justify-end mt-3",children:l.jsx(wC,{children:i.map((a,c)=>a==="..."?l.jsx(wm,{children:l.jsx(bC,{})},c):l.jsx(wm,{children:l.jsx(_C,{href:"#",isActive:t==a,onClick:u=>{u.preventDefault(),r(a)},children:a})},c))})})})},na=({when:e,children:t,fallback:r})=>e?t:r;var kC="AlertDialog",[r6,S$]=xr(kC,[YS]),Os=YS(),CC=e=>{const{__scopeAlertDialog:t,...r}=e,n=Os(t);return l.jsx(mv,{...n,...r,modal:!0})};CC.displayName=kC;var n6="AlertDialogTrigger",jC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(gv,{...s,...n,ref:t})});jC.displayName=n6;var s6="AlertDialogPortal",EC=e=>{const{__scopeAlertDialog:t,...r}=e,n=Os(t);return l.jsx(vv,{...n,...r})};EC.displayName=s6;var o6="AlertDialogOverlay",NC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Ec,{...s,...n,ref:t})});NC.displayName=o6;var sa="AlertDialogContent",[i6,a6]=r6(sa),TC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...s}=e,o=Os(r),i=v.useRef(null),a=Ke(t,i),c=v.useRef(null);return l.jsx(GI,{contentName:sa,titleName:RC,docsSlug:"alert-dialog",children:l.jsx(i6,{scope:r,cancelRef:c,children:l.jsxs(Nc,{role:"alertdialog",...o,...s,ref:a,onOpenAutoFocus:ce(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[l.jsx(zg,{children:n}),l.jsx(c6,{contentRef:i})]})})})});TC.displayName=sa;var RC="AlertDialogTitle",PC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Tc,{...s,...n,ref:t})});PC.displayName=RC;var AC="AlertDialogDescription",DC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Rc,{...s,...n,ref:t})});DC.displayName=AC;var l6="AlertDialogAction",OC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Tf,{...s,...n,ref:t})});OC.displayName=l6;var MC="AlertDialogCancel",IC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:s}=a6(MC,r),o=Os(r),i=Ke(t,s);return l.jsx(Tf,{...o,...n,ref:i})});IC.displayName=MC;var c6=({contentRef:e})=>{const t=`\`${sa}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${sa}\` by passing a \`${AC}\` component as a child, which also benefits sighted users by adding visible context to the dialog. Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${sa}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},d6=CC,f6=jC,h6=EC,LC=NC,FC=TC,zC=OC,UC=IC,$C=PC,VC=DC;const WC=d6,BC=f6,p6=h6,HC=v.forwardRef(({className:e,...t},r)=>l.jsx(LC,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));HC.displayName=LC.displayName;const qv=v.forwardRef(({className:e,...t},r)=>l.jsxs(p6,{children:[l.jsx(HC,{}),l.jsx(FC,{ref:r,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));qv.displayName=FC.displayName;const Xv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});Xv.displayName="AlertDialogHeader";const Qv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Qv.displayName="AlertDialogFooter";const Jv=v.forwardRef(({className:e,...t},r)=>l.jsx($C,{ref:r,className:ae("text-lg font-semibold",e),...t}));Jv.displayName=$C.displayName;const ey=v.forwardRef(({className:e,...t},r)=>l.jsx(VC,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));ey.displayName=VC.displayName;const ty=v.forwardRef(({className:e,...t},r)=>l.jsx(zC,{ref:r,className:ae(xf(),e),...t}));ty.displayName=zC.displayName;const ry=v.forwardRef(({className:e,...t},r)=>l.jsx(UC,{ref:r,className:ae(xf({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));ry.displayName=UC.displayName;function YC(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ny="Switch",[m6,C$]=xr(ny),[g6,v6]=m6(ny),ZC=v.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:o,required:i,disabled:a,value:c="on",onCheckedChange:u,...d}=e,[f,m]=v.useState(null),y=Ke(t,h=>m(h)),x=v.useRef(!1),g=f?!!f.closest("form"):!0,[_=!1,p]=on({prop:s,defaultProp:o,onChange:u});return l.jsxs(g6,{scope:r,checked:_,disabled:a,children:[l.jsx(Re.button,{type:"button",role:"switch","aria-checked":_,"aria-required":i,"data-state":qC(_),"data-disabled":a?"":void 0,disabled:a,value:c,...d,ref:y,onClick:ce(e.onClick,h=>{p(w=>!w),g&&(x.current=h.isPropagationStopped(),x.current||h.stopPropagation())})}),g&&l.jsx(y6,{control:f,bubbles:!x.current,name:n,value:c,checked:_,required:i,disabled:a,style:{transform:"translateX(-100%)"}})]})});ZC.displayName=ny;var KC="SwitchThumb",GC=v.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,s=v6(KC,r);return l.jsx(Re.span,{"data-state":qC(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t})});GC.displayName=KC;var y6=e=>{const{control:t,checked:r,bubbles:n=!0,...s}=e,o=v.useRef(null),i=YC(r),a=Sb(t);return v.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(i!==r&&f){const m=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(m)}},[i,r,n]),l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function qC(e){return e?"checked":"unchecked"}var XC=ZC,x6=GC;const Lc=v.forwardRef(({className:e,...t},r)=>l.jsx(XC,{className:ae("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:l.jsx(x6,{className:ae("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Lc.displayName=XC.displayName;var sy="ToastProvider",[oy,w6,_6]=bc("Toast"),[QC,j$]=xr("Toast",[_6]),[b6,Yf]=QC(sy),JC=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:i}=e,[a,c]=v.useState(null),[u,d]=v.useState(0),f=v.useRef(!1),m=v.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${sy}\`. Expected non-empty \`string\`.`),l.jsx(oy.Provider,{scope:t,children:l.jsx(b6,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:o,toastCount:u,viewport:a,onViewportChange:c,onToastAdd:v.useCallback(()=>d(y=>y+1),[]),onToastRemove:v.useCallback(()=>d(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:m,children:i})})};JC.displayName=sy;var ej="ToastViewport",S6=["F8"],_m="toast.viewportPause",bm="toast.viewportResume",tj=v.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=S6,label:s="Notifications ({hotkey})",...o}=e,i=Yf(ej,r),a=w6(r),c=v.useRef(null),u=v.useRef(null),d=v.useRef(null),f=v.useRef(null),m=Ke(t,f,i.onViewportChange),y=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=i.toastCount>0;v.useEffect(()=>{const _=p=>{var w;n.every(C=>p[C]||p.code===C)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[n]),v.useEffect(()=>{const _=c.current,p=f.current;if(x&&_&&p){const h=()=>{if(!i.isClosePausedRef.current){const E=new CustomEvent(_m);p.dispatchEvent(E),i.isClosePausedRef.current=!0}},w=()=>{if(i.isClosePausedRef.current){const E=new CustomEvent(bm);p.dispatchEvent(E),i.isClosePausedRef.current=!1}},C=E=>{!_.contains(E.relatedTarget)&&w()},j=()=>{_.contains(document.activeElement)||w()};return _.addEventListener("focusin",h),_.addEventListener("focusout",C),_.addEventListener("pointermove",h),_.addEventListener("pointerleave",j),window.addEventListener("blur",h),window.addEventListener("focus",w),()=>{_.removeEventListener("focusin",h),_.removeEventListener("focusout",C),_.removeEventListener("pointermove",h),_.removeEventListener("pointerleave",j),window.removeEventListener("blur",h),window.removeEventListener("focus",w)}}},[x,i.isClosePausedRef]);const g=v.useCallback(({tabbingDirection:_})=>{const h=a().map(w=>{const C=w.ref.current,j=[C,...I6(C)];return _==="forwards"?j:j.reverse()});return(_==="forwards"?h.reverse():h).flat()},[a]);return v.useEffect(()=>{const _=f.current;if(_){const p=h=>{var j,E,R;const w=h.altKey||h.ctrlKey||h.metaKey;if(h.key==="Tab"&&!w){const P=document.activeElement,A=h.shiftKey;if(h.target===_&&A){(j=u.current)==null||j.focus();return}const N=g({tabbingDirection:A?"backwards":"forwards"}),F=N.findIndex(b=>b===P);Jh(N.slice(F+1))?h.preventDefault():A?(E=u.current)==null||E.focus():(R=d.current)==null||R.focus()}};return _.addEventListener("keydown",p),()=>_.removeEventListener("keydown",p)}},[a,g]),l.jsxs(yD,{ref:c,role:"region","aria-label":s.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&l.jsx(Sm,{ref:u,onFocusFromOutsideViewport:()=>{const _=g({tabbingDirection:"forwards"});Jh(_)}}),l.jsx(oy.Slot,{scope:r,children:l.jsx(Re.ol,{tabIndex:-1,...o,ref:m})}),x&&l.jsx(Sm,{ref:d,onFocusFromOutsideViewport:()=>{const _=g({tabbingDirection:"backwards"});Jh(_)}})]})});tj.displayName=ej;var rj="ToastFocusProxy",Sm=v.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,o=Yf(rj,r);return l.jsx(Ic,{"aria-hidden":!0,tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const a=i.relatedTarget;!((u=o.viewport)!=null&&u.contains(a))&&n()}})});Sm.displayName=rj;var Zf="Toast",k6="toast.swipeStart",C6="toast.swipeMove",j6="toast.swipeCancel",E6="toast.swipeEnd",nj=v.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:o,...i}=e,[a=!0,c]=on({prop:n,defaultProp:s,onChange:o});return l.jsx(ur,{present:r||a,children:l.jsx(R6,{open:a,...i,ref:t,onClose:()=>c(!1),onPause:Dt(e.onPause),onResume:Dt(e.onResume),onSwipeStart:ce(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ce(e.onSwipeMove,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:ce(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ce(e.onSwipeEnd,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});nj.displayName=Zf;var[N6,T6]=QC(Zf,{onClose(){}}),R6=v.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:o,onClose:i,onEscapeKeyDown:a,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:m,onSwipeEnd:y,...x}=e,g=Yf(Zf,r),[_,p]=v.useState(null),h=Ke(t,b=>p(b)),w=v.useRef(null),C=v.useRef(null),j=s||g.duration,E=v.useRef(0),R=v.useRef(j),P=v.useRef(0),{onToastAdd:A,onToastRemove:L}=g,q=Dt(()=>{var V;(_==null?void 0:_.contains(document.activeElement))&&((V=g.viewport)==null||V.focus()),i()}),N=v.useCallback(b=>{!b||b===1/0||(window.clearTimeout(P.current),E.current=new Date().getTime(),P.current=window.setTimeout(q,b))},[q]);v.useEffect(()=>{const b=g.viewport;if(b){const V=()=>{N(R.current),u==null||u()},te=()=>{const W=new Date().getTime()-E.current;R.current=R.current-W,window.clearTimeout(P.current),c==null||c()};return b.addEventListener(_m,te),b.addEventListener(bm,V),()=>{b.removeEventListener(_m,te),b.removeEventListener(bm,V)}}},[g.viewport,j,c,u,N]),v.useEffect(()=>{o&&!g.isClosePausedRef.current&&N(j)},[o,j,g.isClosePausedRef,N]),v.useEffect(()=>(A(),()=>L()),[A,L]);const F=v.useMemo(()=>_?uj(_):null,[_]);return g.viewport?l.jsxs(l.Fragment,{children:[F&&l.jsx(P6,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:F}),l.jsx(N6,{scope:r,onClose:q,children:Ns.createPortal(l.jsx(oy.ItemSlot,{scope:r,children:l.jsx(vD,{asChild:!0,onEscapeKeyDown:ce(a,()=>{g.isFocusedToastEscapeKeyDownRef.current||q(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(Re.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":g.swipeDirection,...x,ref:h,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ce(e.onKeyDown,b=>{b.key==="Escape"&&(a==null||a(b.nativeEvent),b.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,q()))}),onPointerDown:ce(e.onPointerDown,b=>{b.button===0&&(w.current={x:b.clientX,y:b.clientY})}),onPointerMove:ce(e.onPointerMove,b=>{if(!w.current)return;const V=b.clientX-w.current.x,te=b.clientY-w.current.y,W=!!C.current,Z=["left","right"].includes(g.swipeDirection),I=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,Q=Z?I(0,V):0,z=Z?0:I(0,te),$=b.pointerType==="touch"?10:2,fe={x:Q,y:z},ne={originalEvent:b,delta:fe};W?(C.current=fe,Su(C6,f,ne,{discrete:!1})):ow(fe,g.swipeDirection,$)?(C.current=fe,Su(k6,d,ne,{discrete:!1}),b.target.setPointerCapture(b.pointerId)):(Math.abs(V)>$||Math.abs(te)>$)&&(w.current=null)}),onPointerUp:ce(e.onPointerUp,b=>{const V=C.current,te=b.target;if(te.hasPointerCapture(b.pointerId)&&te.releasePointerCapture(b.pointerId),C.current=null,w.current=null,V){const W=b.currentTarget,Z={originalEvent:b,delta:V};ow(V,g.swipeDirection,g.swipeThreshold)?Su(E6,y,Z,{discrete:!0}):Su(j6,m,Z,{discrete:!0}),W.addEventListener("click",I=>I.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),P6=e=>{const{__scopeToast:t,children:r,...n}=e,s=Yf(Zf,t),[o,i]=v.useState(!1),[a,c]=v.useState(!1);return O6(()=>i(!0)),v.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:l.jsx(kc,{asChild:!0,children:l.jsx(Ic,{...n,children:o&&l.jsxs(l.Fragment,{children:[s.label," ",r]})})})},A6="ToastTitle",sj=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});sj.displayName=A6;var D6="ToastDescription",oj=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});oj.displayName=D6;var ij="ToastAction",aj=v.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?l.jsx(cj,{altText:r,asChild:!0,children:l.jsx(iy,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${ij}\`. Expected non-empty \`string\`.`),null)});aj.displayName=ij;var lj="ToastClose",iy=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,s=T6(lj,r);return l.jsx(cj,{asChild:!0,children:l.jsx(Re.button,{type:"button",...n,ref:t,onClick:ce(e.onClick,s.onClose)})})});iy.displayName=lj;var cj=v.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...s}=e;return l.jsx(Re.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:t})});function uj(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),M6(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",o=n.dataset.radixToastAnnounceExclude==="";if(!s)if(o){const i=n.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...uj(n))}}),t}function Su(e,t,r,{discrete:n}){const s=r.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?$g(s,o):s.dispatchEvent(o)}var ow=(e,t,r=0)=>{const n=Math.abs(e.x),s=Math.abs(e.y),o=n>s;return t==="left"||t==="right"?o&&n>r:!o&&s>r};function O6(e=()=>{}){const t=Dt(e);Jt(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function M6(e){return e.nodeType===e.ELEMENT_NODE}function I6(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Jh(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var L6=JC,dj=tj,fj=nj,hj=sj,pj=oj,mj=aj,gj=iy;const F6=L6,vj=v.forwardRef(({className:e,...t},r)=>l.jsx(dj,{ref:r,className:ae("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));vj.displayName=dj.displayName;const z6=_c("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),yj=v.forwardRef(({className:e,variant:t,...r},n)=>l.jsx(fj,{ref:n,className:ae(z6({variant:t}),e),...r}));yj.displayName=fj.displayName;const U6=v.forwardRef(({className:e,...t},r)=>l.jsx(mj,{ref:r,className:ae("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));U6.displayName=mj.displayName;const xj=v.forwardRef(({className:e,...t},r)=>l.jsx(gj,{ref:r,className:ae("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:l.jsx(Fg,{className:"h-4 w-4"})}));xj.displayName=gj.displayName;const wj=v.forwardRef(({className:e,...t},r)=>l.jsx(hj,{ref:r,className:ae("text-sm font-semibold",e),...t}));wj.displayName=hj.displayName;const _j=v.forwardRef(({className:e,...t},r)=>l.jsx(pj,{ref:r,className:ae("text-sm opacity-90",e),...t}));_j.displayName=pj.displayName;const $6=1,V6=1e6;let ep=0;function W6(){return ep=(ep+1)%Number.MAX_SAFE_INTEGER,ep.toString()}const tp=new Map,iw=e=>{if(tp.has(e))return;const t=setTimeout(()=>{tp.delete(e),Sl({type:"REMOVE_TOAST",toastId:e})},V6);tp.set(e,t)},B6=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,$6)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?iw(r):e.toasts.forEach(n=>{iw(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Yu=[];let Zu={toasts:[]};function Sl(e){Zu=B6(Zu,e),Yu.forEach(t=>{t(Zu)})}function H6({...e}){const t=W6(),r=s=>Sl({type:"UPDATE_TOAST",toast:{...s,id:t}}),n=()=>Sl({type:"DISMISS_TOAST",toastId:t});return Sl({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||n()}}}),{id:t,dismiss:n,update:r}}function qn(){const[e,t]=v.useState(Zu);return v.useEffect(()=>(Yu.push(t),()=>{const r=Yu.indexOf(t);r>-1&&Yu.splice(r,1)}),[e]),{...e,toast:H6,dismiss:r=>Sl({type:"DISMISS_TOAST",toastId:r})}}function ay(){const{toasts:e}=qn();return l.jsxs(F6,{children:[e.map(function({id:t,title:r,description:n,action:s,...o}){return l.jsxs(yj,{...o,children:[l.jsxs("div",{className:"grid gap-1",children:[r&&l.jsx(wj,{children:r}),n&&l.jsx(_j,{children:n})]}),s,l.jsx(xj,{})]},t)}),l.jsx(vj,{})]})}function ku(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var bj={exports:{}};/*! +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},u6=CC,d6=jC,f6=EC,LC=NC,FC=TC,zC=OC,UC=IC,$C=PC,VC=DC;const WC=u6,BC=d6,h6=f6,HC=v.forwardRef(({className:e,...t},r)=>l.jsx(LC,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));HC.displayName=LC.displayName;const qv=v.forwardRef(({className:e,...t},r)=>l.jsxs(h6,{children:[l.jsx(HC,{}),l.jsx(FC,{ref:r,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));qv.displayName=FC.displayName;const Xv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});Xv.displayName="AlertDialogHeader";const Qv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Qv.displayName="AlertDialogFooter";const Jv=v.forwardRef(({className:e,...t},r)=>l.jsx($C,{ref:r,className:ae("text-lg font-semibold",e),...t}));Jv.displayName=$C.displayName;const ey=v.forwardRef(({className:e,...t},r)=>l.jsx(VC,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));ey.displayName=VC.displayName;const ty=v.forwardRef(({className:e,...t},r)=>l.jsx(zC,{ref:r,className:ae(xf(),e),...t}));ty.displayName=zC.displayName;const ry=v.forwardRef(({className:e,...t},r)=>l.jsx(UC,{ref:r,className:ae(xf({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));ry.displayName=UC.displayName;function YC(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ny="Switch",[p6,k$]=xr(ny),[m6,g6]=p6(ny),ZC=v.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:o,required:i,disabled:a,value:c="on",onCheckedChange:u,...d}=e,[f,m]=v.useState(null),y=Ke(t,h=>m(h)),x=v.useRef(!1),g=f?!!f.closest("form"):!0,[_=!1,p]=on({prop:s,defaultProp:o,onChange:u});return l.jsxs(m6,{scope:r,checked:_,disabled:a,children:[l.jsx(Re.button,{type:"button",role:"switch","aria-checked":_,"aria-required":i,"data-state":qC(_),"data-disabled":a?"":void 0,disabled:a,value:c,...d,ref:y,onClick:ce(e.onClick,h=>{p(w=>!w),g&&(x.current=h.isPropagationStopped(),x.current||h.stopPropagation())})}),g&&l.jsx(v6,{control:f,bubbles:!x.current,name:n,value:c,checked:_,required:i,disabled:a,style:{transform:"translateX(-100%)"}})]})});ZC.displayName=ny;var KC="SwitchThumb",GC=v.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,s=g6(KC,r);return l.jsx(Re.span,{"data-state":qC(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t})});GC.displayName=KC;var v6=e=>{const{control:t,checked:r,bubbles:n=!0,...s}=e,o=v.useRef(null),i=YC(r),a=Sb(t);return v.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(i!==r&&f){const m=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(m)}},[i,r,n]),l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function qC(e){return e?"checked":"unchecked"}var XC=ZC,y6=GC;const Lc=v.forwardRef(({className:e,...t},r)=>l.jsx(XC,{className:ae("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:l.jsx(y6,{className:ae("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Lc.displayName=XC.displayName;var sy="ToastProvider",[oy,x6,w6]=bc("Toast"),[QC,C$]=xr("Toast",[w6]),[_6,Yf]=QC(sy),JC=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:i}=e,[a,c]=v.useState(null),[u,d]=v.useState(0),f=v.useRef(!1),m=v.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${sy}\`. Expected non-empty \`string\`.`),l.jsx(oy.Provider,{scope:t,children:l.jsx(_6,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:o,toastCount:u,viewport:a,onViewportChange:c,onToastAdd:v.useCallback(()=>d(y=>y+1),[]),onToastRemove:v.useCallback(()=>d(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:m,children:i})})};JC.displayName=sy;var ej="ToastViewport",b6=["F8"],_m="toast.viewportPause",bm="toast.viewportResume",tj=v.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=b6,label:s="Notifications ({hotkey})",...o}=e,i=Yf(ej,r),a=x6(r),c=v.useRef(null),u=v.useRef(null),d=v.useRef(null),f=v.useRef(null),m=Ke(t,f,i.onViewportChange),y=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=i.toastCount>0;v.useEffect(()=>{const _=p=>{var w;n.every(C=>p[C]||p.code===C)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[n]),v.useEffect(()=>{const _=c.current,p=f.current;if(x&&_&&p){const h=()=>{if(!i.isClosePausedRef.current){const E=new CustomEvent(_m);p.dispatchEvent(E),i.isClosePausedRef.current=!0}},w=()=>{if(i.isClosePausedRef.current){const E=new CustomEvent(bm);p.dispatchEvent(E),i.isClosePausedRef.current=!1}},C=E=>{!_.contains(E.relatedTarget)&&w()},j=()=>{_.contains(document.activeElement)||w()};return _.addEventListener("focusin",h),_.addEventListener("focusout",C),_.addEventListener("pointermove",h),_.addEventListener("pointerleave",j),window.addEventListener("blur",h),window.addEventListener("focus",w),()=>{_.removeEventListener("focusin",h),_.removeEventListener("focusout",C),_.removeEventListener("pointermove",h),_.removeEventListener("pointerleave",j),window.removeEventListener("blur",h),window.removeEventListener("focus",w)}}},[x,i.isClosePausedRef]);const g=v.useCallback(({tabbingDirection:_})=>{const h=a().map(w=>{const C=w.ref.current,j=[C,...M6(C)];return _==="forwards"?j:j.reverse()});return(_==="forwards"?h.reverse():h).flat()},[a]);return v.useEffect(()=>{const _=f.current;if(_){const p=h=>{var j,E,R;const w=h.altKey||h.ctrlKey||h.metaKey;if(h.key==="Tab"&&!w){const P=document.activeElement,A=h.shiftKey;if(h.target===_&&A){(j=u.current)==null||j.focus();return}const N=g({tabbingDirection:A?"backwards":"forwards"}),F=N.findIndex(b=>b===P);Jh(N.slice(F+1))?h.preventDefault():A?(E=u.current)==null||E.focus():(R=d.current)==null||R.focus()}};return _.addEventListener("keydown",p),()=>_.removeEventListener("keydown",p)}},[a,g]),l.jsxs(yD,{ref:c,role:"region","aria-label":s.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&l.jsx(Sm,{ref:u,onFocusFromOutsideViewport:()=>{const _=g({tabbingDirection:"forwards"});Jh(_)}}),l.jsx(oy.Slot,{scope:r,children:l.jsx(Re.ol,{tabIndex:-1,...o,ref:m})}),x&&l.jsx(Sm,{ref:d,onFocusFromOutsideViewport:()=>{const _=g({tabbingDirection:"backwards"});Jh(_)}})]})});tj.displayName=ej;var rj="ToastFocusProxy",Sm=v.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,o=Yf(rj,r);return l.jsx(Ic,{"aria-hidden":!0,tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const a=i.relatedTarget;!((u=o.viewport)!=null&&u.contains(a))&&n()}})});Sm.displayName=rj;var Zf="Toast",S6="toast.swipeStart",k6="toast.swipeMove",C6="toast.swipeCancel",j6="toast.swipeEnd",nj=v.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:o,...i}=e,[a=!0,c]=on({prop:n,defaultProp:s,onChange:o});return l.jsx(ur,{present:r||a,children:l.jsx(T6,{open:a,...i,ref:t,onClose:()=>c(!1),onPause:Dt(e.onPause),onResume:Dt(e.onResume),onSwipeStart:ce(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ce(e.onSwipeMove,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:ce(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ce(e.onSwipeEnd,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});nj.displayName=Zf;var[E6,N6]=QC(Zf,{onClose(){}}),T6=v.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:o,onClose:i,onEscapeKeyDown:a,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:m,onSwipeEnd:y,...x}=e,g=Yf(Zf,r),[_,p]=v.useState(null),h=Ke(t,b=>p(b)),w=v.useRef(null),C=v.useRef(null),j=s||g.duration,E=v.useRef(0),R=v.useRef(j),P=v.useRef(0),{onToastAdd:A,onToastRemove:L}=g,q=Dt(()=>{var V;(_==null?void 0:_.contains(document.activeElement))&&((V=g.viewport)==null||V.focus()),i()}),N=v.useCallback(b=>{!b||b===1/0||(window.clearTimeout(P.current),E.current=new Date().getTime(),P.current=window.setTimeout(q,b))},[q]);v.useEffect(()=>{const b=g.viewport;if(b){const V=()=>{N(R.current),u==null||u()},te=()=>{const W=new Date().getTime()-E.current;R.current=R.current-W,window.clearTimeout(P.current),c==null||c()};return b.addEventListener(_m,te),b.addEventListener(bm,V),()=>{b.removeEventListener(_m,te),b.removeEventListener(bm,V)}}},[g.viewport,j,c,u,N]),v.useEffect(()=>{o&&!g.isClosePausedRef.current&&N(j)},[o,j,g.isClosePausedRef,N]),v.useEffect(()=>(A(),()=>L()),[A,L]);const F=v.useMemo(()=>_?uj(_):null,[_]);return g.viewport?l.jsxs(l.Fragment,{children:[F&&l.jsx(R6,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:F}),l.jsx(E6,{scope:r,onClose:q,children:Ns.createPortal(l.jsx(oy.ItemSlot,{scope:r,children:l.jsx(vD,{asChild:!0,onEscapeKeyDown:ce(a,()=>{g.isFocusedToastEscapeKeyDownRef.current||q(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(Re.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":g.swipeDirection,...x,ref:h,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ce(e.onKeyDown,b=>{b.key==="Escape"&&(a==null||a(b.nativeEvent),b.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,q()))}),onPointerDown:ce(e.onPointerDown,b=>{b.button===0&&(w.current={x:b.clientX,y:b.clientY})}),onPointerMove:ce(e.onPointerMove,b=>{if(!w.current)return;const V=b.clientX-w.current.x,te=b.clientY-w.current.y,W=!!C.current,Z=["left","right"].includes(g.swipeDirection),I=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,Q=Z?I(0,V):0,z=Z?0:I(0,te),$=b.pointerType==="touch"?10:2,fe={x:Q,y:z},ne={originalEvent:b,delta:fe};W?(C.current=fe,Su(k6,f,ne,{discrete:!1})):ow(fe,g.swipeDirection,$)?(C.current=fe,Su(S6,d,ne,{discrete:!1}),b.target.setPointerCapture(b.pointerId)):(Math.abs(V)>$||Math.abs(te)>$)&&(w.current=null)}),onPointerUp:ce(e.onPointerUp,b=>{const V=C.current,te=b.target;if(te.hasPointerCapture(b.pointerId)&&te.releasePointerCapture(b.pointerId),C.current=null,w.current=null,V){const W=b.currentTarget,Z={originalEvent:b,delta:V};ow(V,g.swipeDirection,g.swipeThreshold)?Su(j6,y,Z,{discrete:!0}):Su(C6,m,Z,{discrete:!0}),W.addEventListener("click",I=>I.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),R6=e=>{const{__scopeToast:t,children:r,...n}=e,s=Yf(Zf,t),[o,i]=v.useState(!1),[a,c]=v.useState(!1);return D6(()=>i(!0)),v.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:l.jsx(kc,{asChild:!0,children:l.jsx(Ic,{...n,children:o&&l.jsxs(l.Fragment,{children:[s.label," ",r]})})})},P6="ToastTitle",sj=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});sj.displayName=P6;var A6="ToastDescription",oj=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});oj.displayName=A6;var ij="ToastAction",aj=v.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?l.jsx(cj,{altText:r,asChild:!0,children:l.jsx(iy,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${ij}\`. Expected non-empty \`string\`.`),null)});aj.displayName=ij;var lj="ToastClose",iy=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,s=N6(lj,r);return l.jsx(cj,{asChild:!0,children:l.jsx(Re.button,{type:"button",...n,ref:t,onClick:ce(e.onClick,s.onClose)})})});iy.displayName=lj;var cj=v.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...s}=e;return l.jsx(Re.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:t})});function uj(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),O6(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",o=n.dataset.radixToastAnnounceExclude==="";if(!s)if(o){const i=n.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...uj(n))}}),t}function Su(e,t,r,{discrete:n}){const s=r.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?$g(s,o):s.dispatchEvent(o)}var ow=(e,t,r=0)=>{const n=Math.abs(e.x),s=Math.abs(e.y),o=n>s;return t==="left"||t==="right"?o&&n>r:!o&&s>r};function D6(e=()=>{}){const t=Dt(e);Jt(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function O6(e){return e.nodeType===e.ELEMENT_NODE}function M6(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Jh(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var I6=JC,dj=tj,fj=nj,hj=sj,pj=oj,mj=aj,gj=iy;const L6=I6,vj=v.forwardRef(({className:e,...t},r)=>l.jsx(dj,{ref:r,className:ae("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));vj.displayName=dj.displayName;const F6=_c("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),yj=v.forwardRef(({className:e,variant:t,...r},n)=>l.jsx(fj,{ref:n,className:ae(F6({variant:t}),e),...r}));yj.displayName=fj.displayName;const z6=v.forwardRef(({className:e,...t},r)=>l.jsx(mj,{ref:r,className:ae("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));z6.displayName=mj.displayName;const xj=v.forwardRef(({className:e,...t},r)=>l.jsx(gj,{ref:r,className:ae("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:l.jsx(Fg,{className:"h-4 w-4"})}));xj.displayName=gj.displayName;const wj=v.forwardRef(({className:e,...t},r)=>l.jsx(hj,{ref:r,className:ae("text-sm font-semibold",e),...t}));wj.displayName=hj.displayName;const _j=v.forwardRef(({className:e,...t},r)=>l.jsx(pj,{ref:r,className:ae("text-sm opacity-90",e),...t}));_j.displayName=pj.displayName;const U6=1,$6=1e6;let ep=0;function V6(){return ep=(ep+1)%Number.MAX_SAFE_INTEGER,ep.toString()}const tp=new Map,iw=e=>{if(tp.has(e))return;const t=setTimeout(()=>{tp.delete(e),Sl({type:"REMOVE_TOAST",toastId:e})},$6);tp.set(e,t)},W6=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,U6)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?iw(r):e.toasts.forEach(n=>{iw(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Yu=[];let Zu={toasts:[]};function Sl(e){Zu=W6(Zu,e),Yu.forEach(t=>{t(Zu)})}function B6({...e}){const t=V6(),r=s=>Sl({type:"UPDATE_TOAST",toast:{...s,id:t}}),n=()=>Sl({type:"DISMISS_TOAST",toastId:t});return Sl({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||n()}}}),{id:t,dismiss:n,update:r}}function qn(){const[e,t]=v.useState(Zu);return v.useEffect(()=>(Yu.push(t),()=>{const r=Yu.indexOf(t);r>-1&&Yu.splice(r,1)}),[e]),{...e,toast:B6,dismiss:r=>Sl({type:"DISMISS_TOAST",toastId:r})}}function ay(){const{toasts:e}=qn();return l.jsxs(L6,{children:[e.map(function({id:t,title:r,description:n,action:s,...o}){return l.jsxs(yj,{...o,children:[l.jsxs("div",{className:"grid gap-1",children:[r&&l.jsx(wj,{children:r}),n&&l.jsx(_j,{children:n})]}),s,l.jsx(xj,{})]},t)}),l.jsx(vj,{})]})}function ku(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var bj={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -301,8 +301,8 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(e,t){(function(r){e.exports=r()})(function(){return function r(n,s,o){function i(u,d){if(!s[u]){if(!n[u]){var f=typeof ku=="function"&&ku;if(!d&&f)return f(u,!0);if(a)return a(u,!0);var m=new Error("Cannot find module '"+u+"'");throw m.code="MODULE_NOT_FOUND",m}var y=s[u]={exports:{}};n[u][0].call(y.exports,function(x){var g=n[u][1][x];return i(g||x)},y,y.exports,r,n,s,o)}return s[u].exports}for(var a=typeof ku=="function"&&ku,c=0;c>2,y=(3&u)<<4|d>>4,x=1>6:64,g=2>4,d=(15&m)<<4|(y=a.indexOf(c.charAt(g++)))>>2,f=(3&y)<<6|(x=a.indexOf(c.charAt(g++))),h[_++]=u,y!==64&&(h[_++]=d),x!==64&&(h[_++]=f);return h}},{"./support":30,"./utils":32}],2:[function(r,n,s){var o=r("./external"),i=r("./stream/DataWorker"),a=r("./stream/Crc32Probe"),c=r("./stream/DataLengthProbe");function u(d,f,m,y,x){this.compressedSize=d,this.uncompressedSize=f,this.crc32=m,this.compression=y,this.compressedContent=x}u.prototype={getContentWorker:function(){var d=new i(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new i(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,m){return d.pipe(new a).pipe(new c("uncompressedSize")).pipe(f.compressWorker(m)).pipe(new c("compressedSize")).withStreamInfo("compression",f)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,s){var o=r("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},s.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,s){var o=r("./utils"),i=function(){for(var a,c=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;c[u]=a}return c}();n.exports=function(a,c){return a!==void 0&&a.length?o.getTypeOf(a)!=="string"?function(u,d,f,m){var y=i,x=m+f;u^=-1;for(var g=m;g>>8^y[255&(u^d[g])];return-1^u}(0|c,a,a.length,0):function(u,d,f,m){var y=i,x=m+f;u^=-1;for(var g=m;g>>8^y[255&(u^d.charCodeAt(g))];return-1^u}(0|c,a,a.length,0):0}},{"./utils":32}],5:[function(r,n,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(r,n,s){var o=null;o=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:o}},{lie:37}],7:[function(r,n,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=r("pako"),a=r("./utils"),c=r("./stream/GenericWorker"),u=o?"uint8array":"array";function d(f,m){c.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=m,this.meta={}}s.magic="\b\0",a.inherits(d,c),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,f.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(m){f.push({data:m,meta:f.meta})}},s.compressWorker=function(f){return new d("Deflate",f)},s.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,s){function o(y,x){var g,_="";for(g=0;g>>=8;return _}function i(y,x,g,_,p,h){var w,C,j=y.file,E=y.compression,R=h!==u.utf8encode,P=a.transformTo("string",h(j.name)),A=a.transformTo("string",u.utf8encode(j.name)),L=j.comment,q=a.transformTo("string",h(L)),N=a.transformTo("string",u.utf8encode(L)),F=A.length!==j.name.length,b=N.length!==L.length,V="",te="",W="",Z=j.dir,I=j.date,Q={crc32:0,compressedSize:0,uncompressedSize:0};x&&!g||(Q.crc32=y.crc32,Q.compressedSize=y.compressedSize,Q.uncompressedSize=y.uncompressedSize);var z=0;x&&(z|=8),R||!F&&!b||(z|=2048);var $=0,fe=0;Z&&($|=16),p==="UNIX"?(fe=798,$|=function(se,Oe){var he=se;return se||(he=Oe?16893:33204),(65535&he)<<16}(j.unixPermissions,Z)):(fe=20,$|=function(se){return 63&(se||0)}(j.dosPermissions)),w=I.getUTCHours(),w<<=6,w|=I.getUTCMinutes(),w<<=5,w|=I.getUTCSeconds()/2,C=I.getUTCFullYear()-1980,C<<=4,C|=I.getUTCMonth()+1,C<<=5,C|=I.getUTCDate(),F&&(te=o(1,1)+o(d(P),4)+A,V+="up"+o(te.length,2)+te),b&&(W=o(1,1)+o(d(q),4)+N,V+="uc"+o(W.length,2)+W);var ne="";return ne+=` -\0`,ne+=o(z,2),ne+=E.magic,ne+=o(w,2),ne+=o(C,2),ne+=o(Q.crc32,4),ne+=o(Q.compressedSize,4),ne+=o(Q.uncompressedSize,4),ne+=o(P.length,2),ne+=o(V.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ne+P+V,dirRecord:f.CENTRAL_FILE_HEADER+o(fe,2)+ne+o(q.length,2)+"\0\0\0\0"+o($,4)+o(_,4)+P+V+q}}var a=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),d=r("../crc32"),f=r("../signature");function m(y,x,g,_){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=g,this.encodeFileName=_,this.streamFiles=y,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(m,c),m.prototype.push=function(y){var x=y.meta.percent||0,g=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(y):(this.bytesWritten+=y.data.length,c.prototype.push.call(this,{data:y.data,meta:{currentFile:this.currentFile,percent:g?(x+100*(g-_-1))/g:100}}))},m.prototype.openedSource=function(y){this.currentSourceOffset=this.bytesWritten,this.currentFile=y.file.name;var x=this.streamFiles&&!y.file.dir;if(x){var g=i(y,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(y){this.accumulate=!1;var x=this.streamFiles&&!y.file.dir,g=i(y,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),x)this.push({data:function(_){return f.DATA_DESCRIPTOR+o(_.crc32,4)+o(_.compressedSize,4)+o(_.uncompressedSize,4)}(y),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var y=this.bytesWritten,x=0;x=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=a,u},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=i},{"../utils":32}],19:[function(r,n,s){var o=r("./Uint8ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var o=r("./DataReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var o=r("./ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var o=r("../utils"),i=r("../support"),a=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),d=r("./Uint8ArrayReader");n.exports=function(f){var m=o.getTypeOf(f);return o.checkSupport(m),m!=="string"||i.uint8array?m==="nodebuffer"?new u(f):i.uint8array?new d(o.transformTo("uint8array",f)):new a(o.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,s){var o=r("./GenericWorker"),i=r("../utils");function a(c){o.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(a,o),a.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var o=r("./GenericWorker"),i=r("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(a,o),a.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}o.inherits(a,i),a.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}i.prototype.processChunk.call(this,c)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(c){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=o.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}o.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,s){function o(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var c=0;c "+i:i}},n.exports=o},{}],29:[function(r,n,s){var o=r("../utils"),i=r("./ConvertWorker"),a=r("./GenericWorker"),c=r("../base64"),u=r("../support"),d=r("../external"),f=null;if(u.nodestream)try{f=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(x,g){return new d.Promise(function(_,p){var h=[],w=x._internalType,C=x._outputType,j=x._mimeType;x.on("data",function(E,R){h.push(E),g&&g(R)}).on("error",function(E){h=[],p(E)}).on("end",function(){try{var E=function(R,P,A){switch(R){case"blob":return o.newBlob(o.transformTo("arraybuffer",P),A);case"base64":return c.encode(P);default:return o.transformTo(R,P)}}(C,function(R,P){var A,L=0,q=null,N=0;for(A=0;A"u")s.blob=!1;else{var o=new ArrayBuffer(0);try{s.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(o),s.blob=i.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var o=r("./utils"),i=r("./support"),a=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function m(){c.call(this,"utf-8 encode")}s.utf8encode=function(y){return i.nodebuffer?a.newBufferFrom(y,"utf-8"):function(x){var g,_,p,h,w,C=x.length,j=0;for(h=0;h>>6:(_<65536?g[w++]=224|_>>>12:(g[w++]=240|_>>>18,g[w++]=128|_>>>12&63),g[w++]=128|_>>>6&63),g[w++]=128|63&_);return g}(y)},s.utf8decode=function(y){return i.nodebuffer?o.transformTo("nodebuffer",y).toString("utf-8"):function(x){var g,_,p,h,w=x.length,C=new Array(2*w);for(g=_=0;g>10&1023,C[_++]=56320|1023&p)}return C.length!==_&&(C.subarray?C=C.subarray(0,_):C.length=_),o.applyFromCharCode(C)}(y=o.transformTo(i.uint8array?"uint8array":"array",y))},o.inherits(f,c),f.prototype.processChunk=function(y){var x=o.transformTo(i.uint8array?"uint8array":"array",y.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var g=x;(x=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),x.set(g,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var _=function(h,w){var C;for((w=w||h.length)>h.length&&(w=h.length),C=w-1;0<=C&&(192&h[C])==128;)C--;return C<0||C===0?w:C+u[h[C]]>w?C:w}(x),p=x;_!==x.length&&(i.uint8array?(p=x.subarray(0,_),this.leftOver=x.subarray(_,x.length)):(p=x.slice(0,_),this.leftOver=x.slice(_,x.length))),this.push({data:s.utf8decode(p),meta:y.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=f,o.inherits(m,c),m.prototype.processChunk=function(y){this.push({data:s.utf8encode(y.data),meta:y.meta})},s.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var o=r("./support"),i=r("./base64"),a=r("./nodejsUtils"),c=r("./external");function u(g){return g}function d(g,_){for(var p=0;p>8;this.dir=!!(16&this.externalFileAttributes),y==0&&(this.dosPermissions=63&this.externalFileAttributes),y==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var y=o(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=y.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=y.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=y.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=y.readInt(4))}},readExtraFields:function(y){var x,g,_,p=y.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});y.index+4>>6:(y<65536?m[_++]=224|y>>>12:(m[_++]=240|y>>>18,m[_++]=128|y>>>12&63),m[_++]=128|y>>>6&63),m[_++]=128|63&y);return m},s.buf2binstring=function(f){return d(f,f.length)},s.binstring2buf=function(f){for(var m=new o.Buf8(f.length),y=0,x=m.length;y>10&1023,h[x++]=56320|1023&g)}return d(h,x)},s.utf8border=function(f,m){var y;for((m=m||f.length)>f.length&&(m=f.length),y=m-1;0<=y&&(192&f[y])==128;)y--;return y<0||y===0?m:y+c[f[y]]>m?y:m}},{"./common":41}],43:[function(r,n,s){n.exports=function(o,i,a,c){for(var u=65535&o|0,d=o>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3>>1:i>>>1;a[c]=i}return a}();n.exports=function(i,a,c,u){var d=o,f=u+c;i^=-1;for(var m=u;m>>8^d[255&(i^a[m])];return-1^i}},{}],46:[function(r,n,s){var o,i=r("../utils/common"),a=r("./trees"),c=r("./adler32"),u=r("./crc32"),d=r("./messages"),f=0,m=4,y=0,x=-2,g=-1,_=4,p=2,h=8,w=9,C=286,j=30,E=19,R=2*C+1,P=15,A=3,L=258,q=L+A+1,N=42,F=113,b=1,V=2,te=3,W=4;function Z(k,J){return k.msg=d[J],J}function I(k){return(k<<1)-(4k.avail_out&&(K=k.avail_out),K!==0&&(i.arraySet(k.output,J.pending_buf,J.pending_out,K,k.next_out),k.next_out+=K,J.pending_out+=K,k.total_out+=K,k.avail_out-=K,J.pending-=K,J.pending===0&&(J.pending_out=0))}function $(k,J){a._tr_flush_block(k,0<=k.block_start?k.block_start:-1,k.strstart-k.block_start,J),k.block_start=k.strstart,z(k.strm)}function fe(k,J){k.pending_buf[k.pending++]=J}function ne(k,J){k.pending_buf[k.pending++]=J>>>8&255,k.pending_buf[k.pending++]=255&J}function se(k,J){var K,D,S=k.max_chain_length,T=k.strstart,O=k.prev_length,Y=k.nice_match,M=k.strstart>k.w_size-q?k.strstart-(k.w_size-q):0,H=k.window,X=k.w_mask,ee=k.prev,me=k.strstart+L,Ye=H[T+O-1],Ue=H[T+O];k.prev_length>=k.good_match&&(S>>=2),Y>k.lookahead&&(Y=k.lookahead);do if(H[(K=J)+O]===Ue&&H[K+O-1]===Ye&&H[K]===H[T]&&H[++K]===H[T+1]){T+=2,K++;do;while(H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&TM&&--S!=0);return O<=k.lookahead?O:k.lookahead}function Oe(k){var J,K,D,S,T,O,Y,M,H,X,ee=k.w_size;do{if(S=k.window_size-k.lookahead-k.strstart,k.strstart>=ee+(ee-q)){for(i.arraySet(k.window,k.window,ee,ee,0),k.match_start-=ee,k.strstart-=ee,k.block_start-=ee,J=K=k.hash_size;D=k.head[--J],k.head[J]=ee<=D?D-ee:0,--K;);for(J=K=ee;D=k.prev[--J],k.prev[J]=ee<=D?D-ee:0,--K;);S+=ee}if(k.strm.avail_in===0)break;if(O=k.strm,Y=k.window,M=k.strstart+k.lookahead,H=S,X=void 0,X=O.avail_in,H=A)for(T=k.strstart-k.insert,k.ins_h=k.window[T],k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A)if(D=a._tr_tally(k,k.strstart-k.match_start,k.match_length-A),k.lookahead-=k.match_length,k.match_length<=k.max_lazy_match&&k.lookahead>=A){for(k.match_length--;k.strstart++,k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A&&k.match_length<=k.prev_length){for(S=k.strstart+k.lookahead-A,D=a._tr_tally(k,k.strstart-1-k.prev_match,k.prev_length-A),k.lookahead-=k.prev_length-1,k.prev_length-=2;++k.strstart<=S&&(k.ins_h=(k.ins_h<k.pending_buf_size-5&&(K=k.pending_buf_size-5);;){if(k.lookahead<=1){if(Oe(k),k.lookahead===0&&J===f)return b;if(k.lookahead===0)break}k.strstart+=k.lookahead,k.lookahead=0;var D=k.block_start+K;if((k.strstart===0||k.strstart>=D)&&(k.lookahead=k.strstart-D,k.strstart=D,$(k,!1),k.strm.avail_out===0)||k.strstart-k.block_start>=k.w_size-q&&($(k,!1),k.strm.avail_out===0))return b}return k.insert=0,J===m?($(k,!0),k.strm.avail_out===0?te:W):(k.strstart>k.block_start&&($(k,!1),k.strm.avail_out),b)}),new ke(4,4,8,4,he),new ke(4,5,16,8,he),new ke(4,6,32,32,he),new ke(4,4,16,16,ye),new ke(8,16,32,32,ye),new ke(8,16,128,128,ye),new ke(8,32,128,256,ye),new ke(32,128,258,1024,ye),new ke(32,258,258,4096,ye)],s.deflateInit=function(k,J){return nt(k,J,h,15,8,0)},s.deflateInit2=nt,s.deflateReset=Pe,s.deflateResetKeep=Me,s.deflateSetHeader=function(k,J){return k&&k.state?k.state.wrap!==2?x:(k.state.gzhead=J,y):x},s.deflate=function(k,J){var K,D,S,T;if(!k||!k.state||5>8&255),fe(D,D.gzhead.time>>16&255),fe(D,D.gzhead.time>>24&255),fe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),fe(D,255&D.gzhead.os),D.gzhead.extra&&D.gzhead.extra.length&&(fe(D,255&D.gzhead.extra.length),fe(D,D.gzhead.extra.length>>8&255)),D.gzhead.hcrc&&(k.adler=u(k.adler,D.pending_buf,D.pending,0)),D.gzindex=0,D.status=69):(fe(D,0),fe(D,0),fe(D,0),fe(D,0),fe(D,0),fe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),fe(D,3),D.status=F);else{var O=h+(D.w_bits-8<<4)<<8;O|=(2<=D.strategy||D.level<2?0:D.level<6?1:D.level===6?2:3)<<6,D.strstart!==0&&(O|=32),O+=31-O%31,D.status=F,ne(D,O),D.strstart!==0&&(ne(D,k.adler>>>16),ne(D,65535&k.adler)),k.adler=1}if(D.status===69)if(D.gzhead.extra){for(S=D.pending;D.gzindex<(65535&D.gzhead.extra.length)&&(D.pending!==D.pending_buf_size||(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending!==D.pending_buf_size));)fe(D,255&D.gzhead.extra[D.gzindex]),D.gzindex++;D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),D.gzindex===D.gzhead.extra.length&&(D.gzindex=0,D.status=73)}else D.status=73;if(D.status===73)if(D.gzhead.name){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){T=1;break}T=D.gzindexS&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),T===0&&(D.gzindex=0,D.status=91)}else D.status=91;if(D.status===91)if(D.gzhead.comment){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){T=1;break}T=D.gzindexS&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),T===0&&(D.status=103)}else D.status=103;if(D.status===103&&(D.gzhead.hcrc?(D.pending+2>D.pending_buf_size&&z(k),D.pending+2<=D.pending_buf_size&&(fe(D,255&k.adler),fe(D,k.adler>>8&255),k.adler=0,D.status=F)):D.status=F),D.pending!==0){if(z(k),k.avail_out===0)return D.last_flush=-1,y}else if(k.avail_in===0&&I(J)<=I(K)&&J!==m)return Z(k,-5);if(D.status===666&&k.avail_in!==0)return Z(k,-5);if(k.avail_in!==0||D.lookahead!==0||J!==f&&D.status!==666){var Y=D.strategy===2?function(M,H){for(var X;;){if(M.lookahead===0&&(Oe(M),M.lookahead===0)){if(H===f)return b;break}if(M.match_length=0,X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===m?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):D.strategy===3?function(M,H){for(var X,ee,me,Ye,Ue=M.window;;){if(M.lookahead<=L){if(Oe(M),M.lookahead<=L&&H===f)return b;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=A&&0M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=A?(X=a._tr_tally(M,1,M.match_length-A),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===m?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):o[D.level].func(D,J);if(Y!==te&&Y!==W||(D.status=666),Y===b||Y===te)return k.avail_out===0&&(D.last_flush=-1),y;if(Y===V&&(J===1?a._tr_align(D):J!==5&&(a._tr_stored_block(D,0,0,!1),J===3&&(Q(D.head),D.lookahead===0&&(D.strstart=0,D.block_start=0,D.insert=0))),z(k),k.avail_out===0))return D.last_flush=-1,y}return J!==m?y:D.wrap<=0?1:(D.wrap===2?(fe(D,255&k.adler),fe(D,k.adler>>8&255),fe(D,k.adler>>16&255),fe(D,k.adler>>24&255),fe(D,255&k.total_in),fe(D,k.total_in>>8&255),fe(D,k.total_in>>16&255),fe(D,k.total_in>>24&255)):(ne(D,k.adler>>>16),ne(D,65535&k.adler)),z(k),0=K.w_size&&(T===0&&(Q(K.head),K.strstart=0,K.block_start=0,K.insert=0),H=new i.Buf8(K.w_size),i.arraySet(H,J,X-K.w_size,K.w_size,0),J=H,X=K.w_size),O=k.avail_in,Y=k.next_in,M=k.input,k.avail_in=X,k.next_in=0,k.input=J,Oe(K);K.lookahead>=A;){for(D=K.strstart,S=K.lookahead-(A-1);K.ins_h=(K.ins_h<>>=A=P>>>24,w-=A,(A=P>>>16&255)===0)V[d++]=65535&P;else{if(!(16&A)){if(!(64&A)){P=C[(65535&P)+(h&(1<>>=A,w-=A),w<15&&(h+=b[c++]<>>=A=P>>>24,w-=A,!(16&(A=P>>>16&255))){if(!(64&A)){P=j[(65535&P)+(h&(1<>>=A,w-=A,(A=d-f)>3,h&=(1<<(w-=L<<3))-1,o.next_in=c,o.next_out=d,o.avail_in=c>>24&255)+(N>>>8&65280)+((65280&N)<<8)+((255&N)<<24)}function h(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(N){var F;return N&&N.state?(F=N.state,N.total_in=N.total_out=F.total=0,N.msg="",F.wrap&&(N.adler=1&F.wrap),F.mode=x,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new o.Buf32(g),F.distcode=F.distdyn=new o.Buf32(_),F.sane=1,F.back=-1,m):y}function C(N){var F;return N&&N.state?((F=N.state).wsize=0,F.whave=0,F.wnext=0,w(N)):y}function j(N,F){var b,V;return N&&N.state?(V=N.state,F<0?(b=0,F=-F):(b=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15=W.wsize?(o.arraySet(W.window,F,b-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(V<(te=W.wsize-W.wnext)&&(te=V),o.arraySet(W.window,F,b-V,te,W.wnext),(V-=te)?(o.arraySet(W.window,F,b-V,V,0),W.wnext=V,W.whave=W.wsize):(W.wnext+=te,W.wnext===W.wsize&&(W.wnext=0),W.whave>>8&255,b.check=a(b.check,T,2,0),$=z=0,b.mode=2;break}if(b.flags=0,b.head&&(b.head.done=!1),!(1&b.wrap)||(((255&z)<<8)+(z>>8))%31){N.msg="incorrect header check",b.mode=30;break}if((15&z)!=8){N.msg="unknown compression method",b.mode=30;break}if($-=4,k=8+(15&(z>>>=4)),b.wbits===0)b.wbits=k;else if(k>b.wbits){N.msg="invalid window size",b.mode=30;break}b.dmax=1<>8&1),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0,b.mode=3;case 3:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.time=z),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,T[2]=z>>>16&255,T[3]=z>>>24&255,b.check=a(b.check,T,4,0)),$=z=0,b.mode=4;case 4:for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.xflags=255&z,b.head.os=z>>8),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0,b.mode=5;case 5:if(1024&b.flags){for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.length=z,b.head&&(b.head.extra_len=z),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0}else b.head&&(b.head.extra=null);b.mode=6;case 6:if(1024&b.flags&&(I<(se=b.length)&&(se=I),se&&(b.head&&(k=b.head.extra_len-b.length,b.head.extra||(b.head.extra=new Array(b.head.extra_len)),o.arraySet(b.head.extra,V,W,se,k)),512&b.flags&&(b.check=a(b.check,V,se,W)),I-=se,W+=se,b.length-=se),b.length))break e;b.length=0,b.mode=7;case 7:if(2048&b.flags){if(I===0)break e;for(se=0;k=V[W+se++],b.head&&k&&b.length<65536&&(b.head.name+=String.fromCharCode(k)),k&&se>9&1,b.head.done=!0),N.adler=b.check=0,b.mode=12;break;case 10:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}N.adler=b.check=p(z),$=z=0,b.mode=11;case 11:if(b.havedict===0)return N.next_out=Z,N.avail_out=Q,N.next_in=W,N.avail_in=I,b.hold=z,b.bits=$,2;N.adler=b.check=1,b.mode=12;case 12:if(F===5||F===6)break e;case 13:if(b.last){z>>>=7&$,$-=7&$,b.mode=27;break}for(;$<3;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}switch(b.last=1&z,$-=1,3&(z>>>=1)){case 0:b.mode=14;break;case 1:if(L(b),b.mode=20,F!==6)break;z>>>=2,$-=2;break e;case 2:b.mode=17;break;case 3:N.msg="invalid block type",b.mode=30}z>>>=2,$-=2;break;case 14:for(z>>>=7&$,$-=7&$;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if((65535&z)!=(z>>>16^65535)){N.msg="invalid stored block lengths",b.mode=30;break}if(b.length=65535&z,$=z=0,b.mode=15,F===6)break e;case 15:b.mode=16;case 16:if(se=b.length){if(I>>=5,$-=5,b.ndist=1+(31&z),z>>>=5,$-=5,b.ncode=4+(15&z),z>>>=4,$-=4,286>>=3,$-=3}for(;b.have<19;)b.lens[O[b.have++]]=0;if(b.lencode=b.lendyn,b.lenbits=7,K={bits:b.lenbits},J=u(0,b.lens,0,19,b.lencode,0,b.work,K),b.lenbits=K.bits,J){N.msg="invalid code lengths set",b.mode=30;break}b.have=0,b.mode=19;case 19:for(;b.have>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(Fe<16)z>>>=ye,$-=ye,b.lens[b.have++]=Fe;else{if(Fe===16){for(D=ye+2;$>>=ye,$-=ye,b.have===0){N.msg="invalid bit length repeat",b.mode=30;break}k=b.lens[b.have-1],se=3+(3&z),z>>>=2,$-=2}else if(Fe===17){for(D=ye+3;$>>=ye)),z>>>=3,$-=3}else{for(D=ye+7;$>>=ye)),z>>>=7,$-=7}if(b.have+se>b.nlen+b.ndist){N.msg="invalid bit length repeat",b.mode=30;break}for(;se--;)b.lens[b.have++]=k}}if(b.mode===30)break;if(b.lens[256]===0){N.msg="invalid code -- missing end-of-block",b.mode=30;break}if(b.lenbits=9,K={bits:b.lenbits},J=u(d,b.lens,0,b.nlen,b.lencode,0,b.work,K),b.lenbits=K.bits,J){N.msg="invalid literal/lengths set",b.mode=30;break}if(b.distbits=6,b.distcode=b.distdyn,K={bits:b.distbits},J=u(f,b.lens,b.nlen,b.ndist,b.distcode,0,b.work,K),b.distbits=K.bits,J){N.msg="invalid distances set",b.mode=30;break}if(b.mode=20,F===6)break e;case 20:b.mode=21;case 21:if(6<=I&&258<=Q){N.next_out=Z,N.avail_out=Q,N.next_in=W,N.avail_in=I,b.hold=z,b.bits=$,c(N,ne),Z=N.next_out,te=N.output,Q=N.avail_out,W=N.next_in,V=N.input,I=N.avail_in,z=b.hold,$=b.bits,b.mode===12&&(b.back=-1);break}for(b.back=0;ke=(S=b.lencode[z&(1<>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(ke&&!(240&ke)){for(Me=ye,Pe=ke,nt=Fe;ke=(S=b.lencode[nt+((z&(1<>Me)])>>>16&255,Fe=65535&S,!(Me+(ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Me,$-=Me,b.back+=Me}if(z>>>=ye,$-=ye,b.back+=ye,b.length=Fe,ke===0){b.mode=26;break}if(32&ke){b.back=-1,b.mode=12;break}if(64&ke){N.msg="invalid literal/length code",b.mode=30;break}b.extra=15&ke,b.mode=22;case 22:if(b.extra){for(D=b.extra;$>>=b.extra,$-=b.extra,b.back+=b.extra}b.was=b.length,b.mode=23;case 23:for(;ke=(S=b.distcode[z&(1<>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(!(240&ke)){for(Me=ye,Pe=ke,nt=Fe;ke=(S=b.distcode[nt+((z&(1<>Me)])>>>16&255,Fe=65535&S,!(Me+(ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Me,$-=Me,b.back+=Me}if(z>>>=ye,$-=ye,b.back+=ye,64&ke){N.msg="invalid distance code",b.mode=30;break}b.offset=Fe,b.extra=15&ke,b.mode=24;case 24:if(b.extra){for(D=b.extra;$>>=b.extra,$-=b.extra,b.back+=b.extra}if(b.offset>b.dmax){N.msg="invalid distance too far back",b.mode=30;break}b.mode=25;case 25:if(Q===0)break e;if(se=ne-Q,b.offset>se){if((se=b.offset-se)>b.whave&&b.sane){N.msg="invalid distance too far back",b.mode=30;break}Oe=se>b.wnext?(se-=b.wnext,b.wsize-se):b.wnext-se,se>b.length&&(se=b.length),he=b.window}else he=te,Oe=Z-b.offset,se=b.length;for(QR?(A=Oe[he+_[F]],$[fe+_[F]]):(A=96,0),h=1<>Z)+(w-=h)]=P<<24|A<<16|L|0,w!==0;);for(h=1<>=1;if(h!==0?(z&=h-1,z+=h):z=0,F++,--ne[N]==0){if(N===V)break;N=f[m+_[F]]}if(te>>7)]}function fe(S,T){S.pending_buf[S.pending++]=255&T,S.pending_buf[S.pending++]=T>>>8&255}function ne(S,T,O){S.bi_valid>p-O?(S.bi_buf|=T<>p-S.bi_valid,S.bi_valid+=O-p):(S.bi_buf|=T<>>=1,O<<=1,0<--T;);return O>>>1}function he(S,T,O){var Y,M,H=new Array(_+1),X=0;for(Y=1;Y<=_;Y++)H[Y]=X=X+O[Y-1]<<1;for(M=0;M<=T;M++){var ee=S[2*M+1];ee!==0&&(S[2*M]=Oe(H[ee]++,ee))}}function ye(S){var T;for(T=0;T>1;1<=O;O--)Me(S,H,O);for(M=me;O=S.heap[1],S.heap[1]=S.heap[S.heap_len--],Me(S,H,1),Y=S.heap[1],S.heap[--S.heap_max]=O,S.heap[--S.heap_max]=Y,H[2*M]=H[2*O]+H[2*Y],S.depth[M]=(S.depth[O]>=S.depth[Y]?S.depth[O]:S.depth[Y])+1,H[2*O+1]=H[2*Y+1]=M,S.heap[1]=M++,Me(S,H,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(Ue,jt){var Gr,Ht,Qn,at,Jn,es,qr=jt.dyn_tree,$c=jt.max_code,Vc=jt.stat_desc.static_tree,hi=jt.stat_desc.has_stree,Wc=jt.stat_desc.extra_bits,pi=jt.stat_desc.extra_base,Pn=jt.stat_desc.max_length,Is=0;for(at=0;at<=_;at++)Ue.bl_count[at]=0;for(qr[2*Ue.heap[Ue.heap_max]+1]=0,Gr=Ue.heap_max+1;Gr>=7;M>>=1)if(1&Ye&&ee.dyn_ltree[2*me]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return a;for(me=32;me>>3,(H=S.static_len+3+7>>>3)<=M&&(M=H)):M=H=O+5,O+4<=M&&T!==-1?D(S,T,O,Y):S.strategy===4||H===M?(ne(S,2+(Y?1:0),3),Pe(S,q,N)):(ne(S,4+(Y?1:0),3),function(ee,me,Ye,Ue){var jt;for(ne(ee,me-257,5),ne(ee,Ye-1,5),ne(ee,Ue-4,4),jt=0;jt>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&T,S.pending_buf[S.l_buf+S.last_lit]=255&O,S.last_lit++,T===0?S.dyn_ltree[2*O]++:(S.matches++,T--,S.dyn_ltree[2*(b[O]+f+1)]++,S.dyn_dtree[2*$(T)]++),S.last_lit===S.lit_bufsize-1},s._tr_align=function(S){ne(S,2,3),se(S,w,q),function(T){T.bi_valid===16?(fe(T,T.bi_buf),T.bi_buf=0,T.bi_valid=0):8<=T.bi_valid&&(T.pending_buf[T.pending++]=255&T.bi_buf,T.bi_buf>>=8,T.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(r,n,s){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,n,s){(function(o){(function(i,a){if(!i.setImmediate){var c,u,d,f,m=1,y={},x=!1,g=i.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(i);_=_&&_.setTimeout?_:i,c={}.toString.call(i.process)==="[object process]"?function(C){process.nextTick(function(){h(C)})}:function(){if(i.postMessage&&!i.importScripts){var C=!0,j=i.onmessage;return i.onmessage=function(){C=!1},i.postMessage("","*"),i.onmessage=j,C}}()?(f="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",w,!1):i.attachEvent("onmessage",w),function(C){i.postMessage(f+C,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){h(C.data)},function(C){d.port2.postMessage(C)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(C){var j=g.createElement("script");j.onreadystatechange=function(){h(C),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(C){setTimeout(h,0,C)},_.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var j=new Array(arguments.length-1),E=0;E"u"?o===void 0?this:o:self)}).call(this,typeof Kc<"u"?Kc:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(bj);var Y6=bj.exports;const Z6=Lm(Y6);function K6(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{n.result?t(n.result.toString()):r("No content found")},n.onerror=()=>r(n.error),n.readAsText(e)})}const G6=async(e,t)=>{const r=new Z6;t.forEach(o=>{r.file(o.name,o.content)});const n=await r.generateAsync({type:"blob"}),s=document.createElement("a");s.href=URL.createObjectURL(n),s.download=e,s.click()},ga=e=>{const t=new Date(e);return new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"Asia/Shanghai"}).format(t)},q6=e=>ga(e).split(" ")[0];function Sj(e){const t=new Date;t.setUTCDate(t.getUTCDate()+e);const r=t.getUTCFullYear(),n=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0"),o=String(t.getUTCHours()).padStart(2,"0"),i=String(t.getUTCMinutes()).padStart(2,"0"),a=String(t.getUTCSeconds()).padStart(2,"0");return`${r}-${n}-${s} ${o}:${i}:${a}`}const X6=async e=>{let t=1;e.page&&(t=e.page);let r=2;e.perPage&&(r=e.perPage);const n=st();let s="";return e.state==="enabled"?s="enabled=true":e.state==="disabled"?s="enabled=false":e.state==="expired"&&(s=n.filter("expiredAt<{:expiredAt}",{expiredAt:Sj(15)})),n.collection("domains").getList(t,r,{sort:"-created",expand:"lastDeployment",filter:s})},Q6=async()=>{const e=st(),t=await e.collection("domains").getList(1,1,{}),r=await e.collection("domains").getList(1,1,{filter:e.filter("expiredAt<{:expiredAt}",{expiredAt:Sj(15)})}),n=await e.collection("domains").getList(1,1,{filter:"enabled=true"}),s=await e.collection("domains").getList(1,1,{filter:"enabled=false"});return{total:t.totalItems,expired:r.totalItems,enabled:n.totalItems,disabled:s.totalItems}},J6=async e=>await st().collection("domains").getOne(e),km=async e=>e.id?await st().collection("domains").update(e.id,e):await st().collection("domains").create(e),ez=async e=>await st().collection("domains").delete(e),tz=(e,t)=>st().collection("domains").subscribe(e,r=>{r.action==="update"&&t(r.record)},{expand:"lastDeployment"}),rz=e=>{st().collection("domains").unsubscribe(e)},nz=()=>{const e=qn(),t=Nr(),r=Nn(),n=new URLSearchParams(r.search),s=n.get("page"),o=n.get("state"),[i,a]=v.useState(0),c=()=>{t("/edit")},u=w=>{n.set("page",w.toString()),t(`?${n.toString()}`)},d=w=>{t(`/edit?id=${w}`)},f=w=>{t(`/history?domain=${w}`)},m=async w=>{try{await ez(w),x(y.filter(C=>C.id!==w))}catch(C){console.error("Error deleting domain:",C)}},[y,x]=v.useState([]);v.useEffect(()=>{(async()=>{const C=await X6({page:s?Number(s):1,perPage:10,state:o||""});x(C.items),a(C.totalPages)})()},[s,o]);const g=async w=>{const C=y.filter(P=>P.id===w),j=C[0].enabled,E=C[0];E.enabled=!j,await km(E);const R=y.map(P=>P.id===w?{...P,checked:!j}:P);x(R)},_=async w=>{try{rz(w.id),tz(w.id,C=>{console.log(C);const j=y.map(E=>E.id===C.id?{...C}:E);x(j)}),w.rightnow=!0,await km(w),e.toast({title:"操作成功",description:"已发起部署,请稍后查看部署日志。"})}catch{e.toast({title:"执行失败",description:l.jsxs(l.Fragment,{children:["执行失败,请查看",l.jsx(fr,{to:`/history?domain=${w.id}`,className:"underline text-blue-500",children:"部署日志"}),"查看详情。"]}),variant:"destructive"})}},p=async w=>{await _({...w,deployed:!1})},h=async w=>{const C=`${w.id}-${w.domain}.zip`,j=[{name:`${w.domain}.pem`,content:w.certificate?w.certificate:""},{name:`${w.domain}.key`,content:w.privateKey?w.privateKey:""}];await G6(C,j)};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(ay,{}),l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:"域名列表"}),l.jsx(He,{onClick:c,children:"新增域名"})]}),y.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-36",children:"域名"}),l.jsx("div",{className:"w-40",children:"有效期限"}),l.jsx("div",{className:"w-32",children:"最近执行状态"}),l.jsx("div",{className:"w-64",children:"最近执行阶段"}),l.jsx("div",{className:"w-40 sm:ml-2",children:"最近执行时间"}),l.jsx("div",{className:"w-24",children:"是否启用"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"域名"}),y.map(w=>{var C,j,E,R;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-36 w-full pt-1 sm:pt-0 flex items-center",children:w.domain}),l.jsx("div",{className:"sm:w-40 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx("div",{children:w.expiredAt?l.jsxs(l.Fragment,{children:[l.jsx("div",{children:"有效期90天"}),l.jsxs("div",{children:[q6(w.expiredAt),"到期"]})]}):"---"})}),l.jsx("div",{className:"sm:w-32 w-full pt-1 sm:pt-0 flex items-center",children:w.lastDeployedAt&&((C=w.expand)!=null&&C.lastDeployment)?l.jsx(l.Fragment,{children:l.jsx(Gv,{deployment:w.expand.lastDeployment})}):"---"}),l.jsx("div",{className:"sm:w-64 w-full pt-1 sm:pt-0 flex items-center",children:w.lastDeployedAt&&((j=w.expand)!=null&&j.lastDeployment)?l.jsx(Hv,{phase:(E=w.expand.lastDeployment)==null?void 0:E.phase,phaseSuccess:(R=w.expand.lastDeployment)==null?void 0:R.phaseSuccess}):"---"}),l.jsx("div",{className:"sm:w-40 pt-1 sm:pt-0 sm:ml-2 flex items-center",children:w.lastDeployedAt?ga(w.lastDeployedAt):"---"}),l.jsx("div",{className:"sm:w-24 flex items-center",children:l.jsx(Zv,{children:l.jsxs(gC,{children:[l.jsx(vC,{children:l.jsx(Lc,{checked:w.enabled,onCheckedChange:()=>{g(w.id)}})}),l.jsx(Kv,{children:l.jsx("div",{className:"border rounded-sm px-3 bg-background text-muted-foreground text-xs",children:w.enabled?"禁用":"启用"})})]})})}),l.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[l.jsx(He,{variant:"link",className:"p-0",onClick:()=>f(w.id),children:"部署历史"}),l.jsxs(na,{when:!!w.enabled,children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>_(w),children:"立即部署"})]}),l.jsxs(na,{when:!!(w.enabled&&w.deployed),children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>p(w),children:"强行部署"})]}),l.jsxs(na,{when:!!w.expiredAt,children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>h(w),children:"下载"})]}),!w.enabled&&l.jsxs(l.Fragment,{children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsxs(WC,{children:[l.jsx(BC,{asChild:!0,children:l.jsx(He,{variant:"link",className:"p-0",children:"删除"})}),l.jsxs(qv,{children:[l.jsxs(Xv,{children:[l.jsx(Jv,{children:"删除域名"}),l.jsx(ey,{children:"确定要删除域名吗?"})]}),l.jsxs(Qv,{children:[l.jsx(ry,{children:"取消"}),l.jsx(ty,{onClick:()=>{m(w.id)},children:"确认"})]})]})]}),l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>d(w.id),children:"编辑"})]})]})]},w.id)}),l.jsx(SC,{totalPages:i,currentPage:s?Number(s):1,onPageChange:w=>{u(w)}})]}):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(rm,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),l.jsx(He,{onClick:c,className:"mt-3",children:"添加域名"})]})})]})})},Te=v.forwardRef(({className:e,type:t,...r},n)=>l.jsx("input",{type:t,className:ae("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));Te.displayName="Input";var Fc=e=>e.type==="checkbox",$i=e=>e instanceof Date,pr=e=>e==null;const kj=e=>typeof e=="object";var qt=e=>!pr(e)&&!Array.isArray(e)&&kj(e)&&!$i(e),Cj=e=>qt(e)&&e.target?Fc(e.target)?e.target.checked:e.target.value:e,sz=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,jj=(e,t)=>e.has(sz(t)),oz=e=>{const t=e.constructor&&e.constructor.prototype;return qt(t)&&t.hasOwnProperty("isPrototypeOf")},ly=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function br(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(ly&&(e instanceof Blob||e instanceof FileList))&&(r||qt(e)))if(t=r?[]:{},!r&&!oz(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=br(e[n]));else return e;return t}var Kf=e=>Array.isArray(e)?e.filter(Boolean):[],Ft=e=>e===void 0,ue=(e,t,r)=>{if(!t||!qt(e))return r;const n=Kf(t.split(/[,[\].]+?/)).reduce((s,o)=>pr(s)?s:s[o],e);return Ft(n)||n===e?Ft(e[t])?r:e[t]:n},Fn=e=>typeof e=="boolean",cy=e=>/^\w*$/.test(e),Ej=e=>Kf(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ft=(e,t,r)=>{let n=-1;const s=cy(t)?[t]:Ej(t),o=s.length,i=o-1;for(;++nWe.useContext(Nj),iz=e=>{const{children:t,...r}=e;return We.createElement(Nj.Provider,{value:r},t)};var Tj=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==gn.all&&(t._proxyFormState[i]=!n||gn.all),r&&(r[i]=!0),e[i]}});return s},Or=e=>qt(e)&&!Object.keys(e).length,Rj=(e,t,r,n)=>{r(e);const{name:s,...o}=e;return Or(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!n||gn.all))},kl=e=>Array.isArray(e)?e:[e],Pj=(e,t,r)=>!e||!t||e===t||kl(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n)));function uy(e){const t=We.useRef(e);t.current=e,We.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}function az(e){const t=Gf(),{control:r=t.control,disabled:n,name:s,exact:o}=e||{},[i,a]=We.useState(r._formState),c=We.useRef(!0),u=We.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=We.useRef(s);return d.current=s,uy({disabled:n,next:f=>c.current&&Pj(d.current,f.name,o)&&Rj(f,u.current,r._updateFormState)&&a({...r._formState,...f}),subject:r._subjects.state}),We.useEffect(()=>(c.current=!0,u.current.isValid&&r._updateValid(!0),()=>{c.current=!1}),[r]),Tj(i,r,u.current,!1)}var Un=e=>typeof e=="string",Aj=(e,t,r,n,s)=>Un(e)?(n&&t.watch.add(e),ue(r,e,s)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),ue(r,o))):(n&&(t.watchAll=!0),r);function lz(e){const t=Gf(),{control:r=t.control,name:n,defaultValue:s,disabled:o,exact:i}=e||{},a=We.useRef(n);a.current=n,uy({disabled:o,subject:r._subjects.values,next:d=>{Pj(a.current,d.name,i)&&u(br(Aj(a.current,r._names,d.values||r._formValues,!1,s)))}});const[c,u]=We.useState(r._getWatch(n,s));return We.useEffect(()=>r._removeUnmounted()),c}function cz(e){const t=Gf(),{name:r,disabled:n,control:s=t.control,shouldUnregister:o}=e,i=jj(s._names.array,r),a=lz({control:s,name:r,defaultValue:ue(s._formValues,r,ue(s._defaultValues,r,e.defaultValue)),exact:!0}),c=az({control:s,name:r}),u=We.useRef(s.register(r,{...e.rules,value:a,...Fn(e.disabled)?{disabled:e.disabled}:{}}));return We.useEffect(()=>{const d=s._options.shouldUnregister||o,f=(m,y)=>{const x=ue(s._fields,m);x&&x._f&&(x._f.mount=y)};if(f(r,!0),d){const m=br(ue(s._options.defaultValues,r));ft(s._defaultValues,r,m),Ft(ue(s._formValues,r))&&ft(s._formValues,r,m)}return()=>{(i?d&&!s._state.action:d)?s.unregister(r):f(r,!1)}},[r,s,i,o]),We.useEffect(()=>{ue(s._fields,r)&&s._updateDisabledField({disabled:n,fields:s._fields,name:r,value:ue(s._fields,r)._f.value})},[n,r,s]),{field:{name:r,value:a,...Fn(n)||c.disabled?{disabled:c.disabled||n}:{},onChange:We.useCallback(d=>u.current.onChange({target:{value:Cj(d),name:r},type:Od.CHANGE}),[r]),onBlur:We.useCallback(()=>u.current.onBlur({target:{value:ue(s._formValues,r),name:r},type:Od.BLUR}),[r,s]),ref:d=>{const f=ue(s._fields,r);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:m=>d.setCustomValidity(m),reportValidity:()=>d.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ue(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!ue(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ue(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ue(c.validatingFields,r)},error:{enumerable:!0,get:()=>ue(c.errors,r)}})}}const uz=e=>e.render(cz(e));var Dj=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},aw=e=>({isOnSubmit:!e||e===gn.onSubmit,isOnBlur:e===gn.onBlur,isOnChange:e===gn.onChange,isOnAll:e===gn.all,isOnTouch:e===gn.onTouched}),lw=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Cl=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const o=ue(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!n)break;if(i.ref&&t(i.ref,i.name)&&!n)break;Cl(a,t)}else qt(a)&&Cl(a,t)}}};var dz=(e,t,r)=>{const n=kl(ue(e,r));return ft(n,"root",t[r]),ft(e,r,n),e},dy=e=>e.type==="file",eo=e=>typeof e=="function",Md=e=>{if(!ly)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ku=e=>Un(e),fy=e=>e.type==="radio",Id=e=>e instanceof RegExp;const cw={value:!1,isValid:!1},uw={value:!0,isValid:!0};var Oj=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ft(e[0].attributes.value)?Ft(e[0].value)||e[0].value===""?uw:{value:e[0].value,isValid:!0}:uw:cw}return cw};const dw={isValid:!1,value:null};var Mj=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,dw):dw;function fw(e,t,r="validate"){if(Ku(e)||Array.isArray(e)&&e.every(Ku)||Fn(e)&&!e)return{type:r,message:Ku(e)?e:"",ref:t}}var ki=e=>qt(e)&&!Id(e)?e:{value:e,message:""},hw=async(e,t,r,n,s)=>{const{ref:o,refs:i,required:a,maxLength:c,minLength:u,min:d,max:f,pattern:m,validate:y,name:x,valueAsNumber:g,mount:_,disabled:p}=e._f,h=ue(t,x);if(!_||p)return{};const w=i?i[0]:o,C=N=>{n&&w.reportValidity&&(w.setCustomValidity(Fn(N)?"":N||""),w.reportValidity())},j={},E=fy(o),R=Fc(o),P=E||R,A=(g||dy(o))&&Ft(o.value)&&Ft(h)||Md(o)&&o.value===""||h===""||Array.isArray(h)&&!h.length,L=Dj.bind(null,x,r,j),q=(N,F,b,V=ss.maxLength,te=ss.minLength)=>{const W=N?F:b;j[x]={type:N?V:te,message:W,ref:o,...L(N?V:te,W)}};if(s?!Array.isArray(h)||!h.length:a&&(!P&&(A||pr(h))||Fn(h)&&!h||R&&!Oj(i).isValid||E&&!Mj(i).isValid)){const{value:N,message:F}=Ku(a)?{value:!!a,message:a}:ki(a);if(N&&(j[x]={type:ss.required,message:F,ref:w,...L(ss.required,F)},!r))return C(F),j}if(!A&&(!pr(d)||!pr(f))){let N,F;const b=ki(f),V=ki(d);if(!pr(h)&&!isNaN(h)){const te=o.valueAsNumber||h&&+h;pr(b.value)||(N=te>b.value),pr(V.value)||(F=tenew Date(new Date().toDateString()+" "+Q),Z=o.type=="time",I=o.type=="week";Un(b.value)&&h&&(N=Z?W(h)>W(b.value):I?h>b.value:te>new Date(b.value)),Un(V.value)&&h&&(F=Z?W(h)+N.value,V=!pr(F.value)&&h.length<+F.value;if((b||V)&&(q(b,N.message,F.message),!r))return C(j[x].message),j}if(m&&!A&&Un(h)){const{value:N,message:F}=ki(m);if(Id(N)&&!h.match(N)&&(j[x]={type:ss.pattern,message:F,ref:o,...L(ss.pattern,F)},!r))return C(F),j}if(y){if(eo(y)){const N=await y(h,t),F=fw(N,w);if(F&&(j[x]={...F,...L(ss.validate,F.message)},!r))return C(F.message),j}else if(qt(y)){let N={};for(const F in y){if(!Or(N)&&!r)break;const b=fw(await y[F](h,t),w,F);b&&(N={...b,...L(F,b.message)},C(b.message),r&&(j[x]=N))}if(!Or(N)&&(j[x]={ref:w,...N},!r))return j}}return C(!0),j};function fz(e,t){const r=t.slice(0,-1).length;let n=0;for(;n{let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}},Ld=e=>pr(e)||!kj(e);function Bo(e,t){if(Ld(e)||Ld(t))return e===t;if($i(e)&&$i(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const s of r){const o=e[s];if(!n.includes(s))return!1;if(s!=="ref"){const i=t[s];if($i(o)&&$i(i)||qt(o)&&qt(i)||Array.isArray(o)&&Array.isArray(i)?!Bo(o,i):o!==i)return!1}}return!0}var Ij=e=>e.type==="select-multiple",pz=e=>fy(e)||Fc(e),np=e=>Md(e)&&e.isConnected,Lj=e=>{for(const t in e)if(eo(e[t]))return!0;return!1};function Fd(e,t={}){const r=Array.isArray(e);if(qt(e)||r)for(const n in e)Array.isArray(e[n])||qt(e[n])&&!Lj(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Fd(e[n],t[n])):pr(e[n])||(t[n]=!0);return t}function Fj(e,t,r){const n=Array.isArray(e);if(qt(e)||n)for(const s in e)Array.isArray(e[s])||qt(e[s])&&!Lj(e[s])?Ft(t)||Ld(r[s])?r[s]=Array.isArray(e[s])?Fd(e[s],[]):{...Fd(e[s])}:Fj(e[s],pr(t)?{}:t[s],r[s]):r[s]=!Bo(e[s],t[s]);return r}var Cu=(e,t)=>Fj(e,t,Fd(t)),zj=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ft(e)?e:t?e===""?NaN:e&&+e:r&&Un(e)?new Date(e):n?n(e):e;function sp(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return dy(t)?t.files:fy(t)?Mj(e.refs).value:Ij(t)?[...t.selectedOptions].map(({value:r})=>r):Fc(t)?Oj(e.refs).value:zj(Ft(t.value)?e.ref.value:t.value,e)}var mz=(e,t,r,n)=>{const s={};for(const o of e){const i=ue(t,o);i&&ft(s,o,i._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Ja=e=>Ft(e)?e:Id(e)?e.source:qt(e)?Id(e.value)?e.value.source:e.value:e,gz=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function pw(e,t,r){const n=ue(e,r);if(n||cy(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),i=ue(t,o),a=ue(e,o);if(i&&!Array.isArray(i)&&r!==o)return{name:r};if(a&&a.type)return{name:o,error:a};s.pop()}return{name:r}}var vz=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,yz=(e,t)=>!Kf(ue(e,t)).length&&Yt(e,t);const xz={mode:gn.onSubmit,reValidateMode:gn.onChange,shouldFocusError:!0};function wz(e={}){let t={...xz,...e},r={submitCount:0,isDirty:!1,isLoading:eo(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=qt(t.defaultValues)||qt(t.values)?br(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:br(s),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:rp(),array:rp(),state:rp()},m=aw(t.mode),y=aw(t.reValidateMode),x=t.criteriaMode===gn.all,g=S=>T=>{clearTimeout(u),u=setTimeout(S,T)},_=async S=>{if(d.isValid||S){const T=t.resolver?Or((await P()).errors):await L(n,!0);T!==r.isValid&&f.state.next({isValid:T})}},p=(S,T)=>{(d.isValidating||d.validatingFields)&&((S||Array.from(a.mount)).forEach(O=>{O&&(T?ft(r.validatingFields,O,T):Yt(r.validatingFields,O))}),f.state.next({validatingFields:r.validatingFields,isValidating:!Or(r.validatingFields)}))},h=(S,T=[],O,Y,M=!0,H=!0)=>{if(Y&&O){if(i.action=!0,H&&Array.isArray(ue(n,S))){const X=O(ue(n,S),Y.argA,Y.argB);M&&ft(n,S,X)}if(H&&Array.isArray(ue(r.errors,S))){const X=O(ue(r.errors,S),Y.argA,Y.argB);M&&ft(r.errors,S,X),yz(r.errors,S)}if(d.touchedFields&&H&&Array.isArray(ue(r.touchedFields,S))){const X=O(ue(r.touchedFields,S),Y.argA,Y.argB);M&&ft(r.touchedFields,S,X)}d.dirtyFields&&(r.dirtyFields=Cu(s,o)),f.state.next({name:S,isDirty:N(S,T),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ft(o,S,T)},w=(S,T)=>{ft(r.errors,S,T),f.state.next({errors:r.errors})},C=S=>{r.errors=S,f.state.next({errors:r.errors,isValid:!1})},j=(S,T,O,Y)=>{const M=ue(n,S);if(M){const H=ue(o,S,Ft(O)?ue(s,S):O);Ft(H)||Y&&Y.defaultChecked||T?ft(o,S,T?H:sp(M._f)):V(S,H),i.mount&&_()}},E=(S,T,O,Y,M)=>{let H=!1,X=!1;const ee={name:S},me=!!(ue(n,S)&&ue(n,S)._f&&ue(n,S)._f.disabled);if(!O||Y){d.isDirty&&(X=r.isDirty,r.isDirty=ee.isDirty=N(),H=X!==ee.isDirty);const Ye=me||Bo(ue(s,S),T);X=!!(!me&&ue(r.dirtyFields,S)),Ye||me?Yt(r.dirtyFields,S):ft(r.dirtyFields,S,!0),ee.dirtyFields=r.dirtyFields,H=H||d.dirtyFields&&X!==!Ye}if(O){const Ye=ue(r.touchedFields,S);Ye||(ft(r.touchedFields,S,O),ee.touchedFields=r.touchedFields,H=H||d.touchedFields&&Ye!==O)}return H&&M&&f.state.next(ee),H?ee:{}},R=(S,T,O,Y)=>{const M=ue(r.errors,S),H=d.isValid&&Fn(T)&&r.isValid!==T;if(e.delayError&&O?(c=g(()=>w(S,O)),c(e.delayError)):(clearTimeout(u),c=null,O?ft(r.errors,S,O):Yt(r.errors,S)),(O?!Bo(M,O):M)||!Or(Y)||H){const X={...Y,...H&&Fn(T)?{isValid:T}:{},errors:r.errors,name:S};r={...r,...X},f.state.next(X)}},P=async S=>{p(S,!0);const T=await t.resolver(o,t.context,mz(S||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return p(S),T},A=async S=>{const{errors:T}=await P(S);if(S)for(const O of S){const Y=ue(T,O);Y?ft(r.errors,O,Y):Yt(r.errors,O)}else r.errors=T;return T},L=async(S,T,O={valid:!0})=>{for(const Y in S){const M=S[Y];if(M){const{_f:H,...X}=M;if(H){const ee=a.array.has(H.name);p([Y],!0);const me=await hw(M,o,x,t.shouldUseNativeValidation&&!T,ee);if(p([Y]),me[H.name]&&(O.valid=!1,T))break;!T&&(ue(me,H.name)?ee?dz(r.errors,me,H.name):ft(r.errors,H.name,me[H.name]):Yt(r.errors,H.name))}X&&await L(X,T,O)}}return O.valid},q=()=>{for(const S of a.unMount){const T=ue(n,S);T&&(T._f.refs?T._f.refs.every(O=>!np(O)):!np(T._f.ref))&&Oe(S)}a.unMount=new Set},N=(S,T)=>(S&&T&&ft(o,S,T),!Bo(z(),s)),F=(S,T,O)=>Aj(S,a,{...i.mount?o:Ft(T)?s:Un(S)?{[S]:T}:T},O,T),b=S=>Kf(ue(i.mount?o:s,S,e.shouldUnregister?ue(s,S,[]):[])),V=(S,T,O={})=>{const Y=ue(n,S);let M=T;if(Y){const H=Y._f;H&&(!H.disabled&&ft(o,S,zj(T,H)),M=Md(H.ref)&&pr(T)?"":T,Ij(H.ref)?[...H.ref.options].forEach(X=>X.selected=M.includes(X.value)):H.refs?Fc(H.ref)?H.refs.length>1?H.refs.forEach(X=>(!X.defaultChecked||!X.disabled)&&(X.checked=Array.isArray(M)?!!M.find(ee=>ee===X.value):M===X.value)):H.refs[0]&&(H.refs[0].checked=!!M):H.refs.forEach(X=>X.checked=X.value===M):dy(H.ref)?H.ref.value="":(H.ref.value=M,H.ref.type||f.values.next({name:S,values:{...o}})))}(O.shouldDirty||O.shouldTouch)&&E(S,M,O.shouldTouch,O.shouldDirty,!0),O.shouldValidate&&Q(S)},te=(S,T,O)=>{for(const Y in T){const M=T[Y],H=`${S}.${Y}`,X=ue(n,H);(a.array.has(S)||!Ld(M)||X&&!X._f)&&!$i(M)?te(H,M,O):V(H,M,O)}},W=(S,T,O={})=>{const Y=ue(n,S),M=a.array.has(S),H=br(T);ft(o,S,H),M?(f.array.next({name:S,values:{...o}}),(d.isDirty||d.dirtyFields)&&O.shouldDirty&&f.state.next({name:S,dirtyFields:Cu(s,o),isDirty:N(S,H)})):Y&&!Y._f&&!pr(H)?te(S,H,O):V(S,H,O),lw(S,a)&&f.state.next({...r}),f.values.next({name:i.mount?S:void 0,values:{...o}})},Z=async S=>{i.mount=!0;const T=S.target;let O=T.name,Y=!0;const M=ue(n,O),H=()=>T.type?sp(M._f):Cj(S),X=ee=>{Y=Number.isNaN(ee)||ee===ue(o,O,ee)};if(M){let ee,me;const Ye=H(),Ue=S.type===Od.BLUR||S.type===Od.FOCUS_OUT,jt=!gz(M._f)&&!t.resolver&&!ue(r.errors,O)&&!M._f.deps||vz(Ue,ue(r.touchedFields,O),r.isSubmitted,y,m),Gr=lw(O,a,Ue);ft(o,O,Ye),Ue?(M._f.onBlur&&M._f.onBlur(S),c&&c(0)):M._f.onChange&&M._f.onChange(S);const Ht=E(O,Ye,Ue,!1),Qn=!Or(Ht)||Gr;if(!Ue&&f.values.next({name:O,type:S.type,values:{...o}}),jt)return d.isValid&&_(),Qn&&f.state.next({name:O,...Gr?{}:Ht});if(!Ue&&Gr&&f.state.next({...r}),t.resolver){const{errors:at}=await P([O]);if(X(Ye),Y){const Jn=pw(r.errors,n,O),es=pw(at,n,Jn.name||O);ee=es.error,O=es.name,me=Or(at)}}else p([O],!0),ee=(await hw(M,o,x,t.shouldUseNativeValidation))[O],p([O]),X(Ye),Y&&(ee?me=!1:d.isValid&&(me=await L(n,!0)));Y&&(M._f.deps&&Q(M._f.deps),R(O,me,ee,Ht))}},I=(S,T)=>{if(ue(r.errors,T)&&S.focus)return S.focus(),1},Q=async(S,T={})=>{let O,Y;const M=kl(S);if(t.resolver){const H=await A(Ft(S)?S:M);O=Or(H),Y=S?!M.some(X=>ue(H,X)):O}else S?(Y=(await Promise.all(M.map(async H=>{const X=ue(n,H);return await L(X&&X._f?{[H]:X}:X)}))).every(Boolean),!(!Y&&!r.isValid)&&_()):Y=O=await L(n);return f.state.next({...!Un(S)||d.isValid&&O!==r.isValid?{}:{name:S},...t.resolver||!S?{isValid:O}:{},errors:r.errors}),T.shouldFocus&&!Y&&Cl(n,I,S?M:a.mount),Y},z=S=>{const T={...i.mount?o:s};return Ft(S)?T:Un(S)?ue(T,S):S.map(O=>ue(T,O))},$=(S,T)=>({invalid:!!ue((T||r).errors,S),isDirty:!!ue((T||r).dirtyFields,S),error:ue((T||r).errors,S),isValidating:!!ue(r.validatingFields,S),isTouched:!!ue((T||r).touchedFields,S)}),fe=S=>{S&&kl(S).forEach(T=>Yt(r.errors,T)),f.state.next({errors:S?r.errors:{}})},ne=(S,T,O)=>{const Y=(ue(n,S,{_f:{}})._f||{}).ref,M=ue(r.errors,S)||{},{ref:H,message:X,type:ee,...me}=M;ft(r.errors,S,{...me,...T,ref:Y}),f.state.next({name:S,errors:r.errors,isValid:!1}),O&&O.shouldFocus&&Y&&Y.focus&&Y.focus()},se=(S,T)=>eo(S)?f.values.subscribe({next:O=>S(F(void 0,T),O)}):F(S,T,!0),Oe=(S,T={})=>{for(const O of S?kl(S):a.mount)a.mount.delete(O),a.array.delete(O),T.keepValue||(Yt(n,O),Yt(o,O)),!T.keepError&&Yt(r.errors,O),!T.keepDirty&&Yt(r.dirtyFields,O),!T.keepTouched&&Yt(r.touchedFields,O),!T.keepIsValidating&&Yt(r.validatingFields,O),!t.shouldUnregister&&!T.keepDefaultValue&&Yt(s,O);f.values.next({values:{...o}}),f.state.next({...r,...T.keepDirty?{isDirty:N()}:{}}),!T.keepIsValid&&_()},he=({disabled:S,name:T,field:O,fields:Y,value:M})=>{if(Fn(S)&&i.mount||S){const H=S?void 0:Ft(M)?sp(O?O._f:ue(Y,T)._f):M;ft(o,T,H),E(T,H,!1,!1,!0)}},ye=(S,T={})=>{let O=ue(n,S);const Y=Fn(T.disabled);return ft(n,S,{...O||{},_f:{...O&&O._f?O._f:{ref:{name:S}},name:S,mount:!0,...T}}),a.mount.add(S),O?he({field:O,disabled:T.disabled,name:S,value:T.value}):j(S,!0,T.value),{...Y?{disabled:T.disabled}:{},...t.progressive?{required:!!T.required,min:Ja(T.min),max:Ja(T.max),minLength:Ja(T.minLength),maxLength:Ja(T.maxLength),pattern:Ja(T.pattern)}:{},name:S,onChange:Z,onBlur:Z,ref:M=>{if(M){ye(S,T),O=ue(n,S);const H=Ft(M.value)&&M.querySelectorAll&&M.querySelectorAll("input,select,textarea")[0]||M,X=pz(H),ee=O._f.refs||[];if(X?ee.find(me=>me===H):H===O._f.ref)return;ft(n,S,{_f:{...O._f,...X?{refs:[...ee.filter(np),H,...Array.isArray(ue(s,S))?[{}]:[]],ref:{type:H.type,name:S}}:{ref:H}}}),j(S,!1,void 0,H)}else O=ue(n,S,{}),O._f&&(O._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(jj(a.array,S)&&i.action)&&a.unMount.add(S)}}},ke=()=>t.shouldFocusError&&Cl(n,I,a.mount),Fe=S=>{Fn(S)&&(f.state.next({disabled:S}),Cl(n,(T,O)=>{const Y=ue(n,O);Y&&(T.disabled=Y._f.disabled||S,Array.isArray(Y._f.refs)&&Y._f.refs.forEach(M=>{M.disabled=Y._f.disabled||S}))},0,!1))},Me=(S,T)=>async O=>{let Y;O&&(O.preventDefault&&O.preventDefault(),O.persist&&O.persist());let M=br(o);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:H,values:X}=await P();r.errors=H,M=X}else await L(n);if(Yt(r.errors,"root"),Or(r.errors)){f.state.next({errors:{}});try{await S(M,O)}catch(H){Y=H}}else T&&await T({...r.errors},O),ke(),setTimeout(ke);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Or(r.errors)&&!Y,submitCount:r.submitCount+1,errors:r.errors}),Y)throw Y},Pe=(S,T={})=>{ue(n,S)&&(Ft(T.defaultValue)?W(S,br(ue(s,S))):(W(S,T.defaultValue),ft(s,S,br(T.defaultValue))),T.keepTouched||Yt(r.touchedFields,S),T.keepDirty||(Yt(r.dirtyFields,S),r.isDirty=T.defaultValue?N(S,br(ue(s,S))):N()),T.keepError||(Yt(r.errors,S),d.isValid&&_()),f.state.next({...r}))},nt=(S,T={})=>{const O=S?br(S):s,Y=br(O),M=Or(S),H=M?s:Y;if(T.keepDefaultValues||(s=O),!T.keepValues){if(T.keepDirtyValues)for(const X of a.mount)ue(r.dirtyFields,X)?ft(H,X,ue(o,X)):W(X,ue(H,X));else{if(ly&&Ft(S))for(const X of a.mount){const ee=ue(n,X);if(ee&&ee._f){const me=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(Md(me)){const Ye=me.closest("form");if(Ye){Ye.reset();break}}}}n={}}o=e.shouldUnregister?T.keepDefaultValues?br(s):{}:br(H),f.array.next({values:{...H}}),f.values.next({values:{...H}})}a={mount:T.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!T.keepIsValid||!!T.keepDirtyValues,i.watch=!!e.shouldUnregister,f.state.next({submitCount:T.keepSubmitCount?r.submitCount:0,isDirty:M?!1:T.keepDirty?r.isDirty:!!(T.keepDefaultValues&&!Bo(S,s)),isSubmitted:T.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:M?{}:T.keepDirtyValues?T.keepDefaultValues&&o?Cu(s,o):r.dirtyFields:T.keepDefaultValues&&S?Cu(s,S):T.keepDirty?r.dirtyFields:{},touchedFields:T.keepTouched?r.touchedFields:{},errors:T.keepErrors?r.errors:{},isSubmitSuccessful:T.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},k=(S,T)=>nt(eo(S)?S(o):S,T);return{control:{register:ye,unregister:Oe,getFieldState:$,handleSubmit:Me,setError:ne,_executeSchema:P,_getWatch:F,_getDirty:N,_updateValid:_,_removeUnmounted:q,_updateFieldArray:h,_updateDisabledField:he,_getFieldArray:b,_reset:nt,_resetDefaultValues:()=>eo(t.defaultValues)&&t.defaultValues().then(S=>{k(S,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:S=>{r={...r,...S}},_disableForm:Fe,_subjects:f,_proxyFormState:d,_setErrors:C,get _fields(){return n},get _formValues(){return o},get _state(){return i},set _state(S){i=S},get _defaultValues(){return s},get _names(){return a},set _names(S){a=S},get _formState(){return r},set _formState(S){r=S},get _options(){return t},set _options(S){t={...t,...S}}},trigger:Q,register:ye,handleSubmit:Me,watch:se,setValue:W,getValues:z,reset:k,resetField:Pe,clearErrors:fe,unregister:Oe,setError:ne,setFocus:(S,T={})=>{const O=ue(n,S),Y=O&&O._f;if(Y){const M=Y.refs?Y.refs[0]:Y.ref;M.focus&&(M.focus(),T.shouldSelect&&M.select())}},getFieldState:$}}function Tr(e={}){const t=We.useRef(),r=We.useRef(),[n,s]=We.useState({isDirty:!1,isValidating:!1,isLoading:eo(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:eo(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...wz(e),formState:n});const o=t.current.control;return o._options=e,uy({subject:o._subjects.state,next:i=>{Rj(i,o._proxyFormState,o._updateFormState,!0)&&s({...o._formState})}}),We.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),We.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==n.isDirty&&o._subjects.state.next({isDirty:i})}},[o,n.isDirty]),We.useEffect(()=>{e.values&&!Bo(e.values,r.current)?(o._reset(e.values,o._options.resetOptions),r.current=e.values,s(i=>({...i}))):o._resetDefaultValues()},[e.values,o]),We.useEffect(()=>{e.errors&&o._setErrors(e.errors)},[e.errors,o]),We.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),We.useEffect(()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[e.shouldUnregister,o]),t.current.formState=Tj(n,o),t.current}const mw=(e,t,r)=>{if(e&&"reportValidity"in e){const n=ue(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Uj=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?mw(n.ref,r,e):n.refs&&n.refs.forEach(s=>mw(s,r,e))}},_z=(e,t)=>{t.shouldUseNativeValidation&&Uj(e,t);const r={};for(const n in e){const s=ue(t.fields,n),o=Object.assign(e[n]||{},{ref:s&&s.ref});if(bz(t.names||Object.keys(e),n)){const i=Object.assign({},ue(r,n));ft(i,"root",o),ft(r,n,i)}else ft(r,n,o)}return r},bz=(e,t)=>e.some(r=>r.startsWith(t+"."));var Sz=function(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=r[i].types,u=c&&c[n.code];r[i]=Dj(i,t,r,s,u?[].concat(u,n.message):n.message)}e.shift()}return r},Rr=function(e,t,r){return r===void 0&&(r={}),function(n,s,o){try{return Promise.resolve(function(i,a){try{var c=Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(u){return o.shouldUseNativeValidation&&Uj({},o),{errors:{},values:r.raw?n:u}})}catch(u){return a(u)}return c&&c.then?c.then(void 0,a):c}(0,function(i){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(i))return{values:{},errors:_z(Sz(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}}},ot;(function(e){e.assertEqual=s=>s;function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,e.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(const a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},e.find=(s,o)=>{for(const i of s)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(ot||(ot={}));var Cm;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Cm||(Cm={}));const we=ot.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zs=e=>{switch(typeof e){case"undefined":return we.undefined;case"string":return we.string;case"number":return isNaN(e)?we.nan:we.number;case"boolean":return we.boolean;case"function":return we.function;case"bigint":return we.bigint;case"symbol":return we.symbol;case"object":return Array.isArray(e)?we.array:e===null?we.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?we.promise:typeof Map<"u"&&e instanceof Map?we.map:typeof Set<"u"&&e instanceof Set?we.set:typeof Date<"u"&&e instanceof Date?we.date:we.object;default:return we.unknown}},ie=ot.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),kz=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Wr extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const r=t||function(o){return o.message},n={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;cr.message){const r={},n=[];for(const s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Wr.create=e=>new Wr(e);const va=(e,t)=>{let r;switch(e.code){case ie.invalid_type:e.received===we.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ot.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${ot.joinValues(e.keys,", ")}`;break;case ie.invalid_union:r="Invalid input";break;case ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ot.joinValues(e.options)}`;break;case ie.invalid_enum_value:r=`Invalid enum value. Expected ${ot.joinValues(e.options)}, received '${e.received}'`;break;case ie.invalid_arguments:r="Invalid function arguments";break;case ie.invalid_return_type:r="Invalid function return type";break;case ie.invalid_date:r="Invalid date";break;case ie.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ot.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case ie.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case ie.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case ie.custom:r="Invalid input";break;case ie.invalid_intersection_types:r="Intersection results could not be merged";break;case ie.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ie.not_finite:r="Number must be finite";break;default:r=t.defaultError,ot.assertNever(e)}return{message:r}};let $j=va;function Cz(e){$j=e}function zd(){return $j}const Ud=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)a=u(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}},jz=[];function ge(e,t){const r=zd(),n=Ud({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===va?void 0:va].filter(s=>!!s)});e.common.issues.push(n)}class cr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return Be;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const o=await s.key,i=await s.value;n.push({key:o,value:i})}return cr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return Be;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:t.value,value:n}}}const Be=Object.freeze({status:"aborted"}),Vi=e=>({status:"dirty",value:e}),gr=e=>({status:"valid",value:e}),jm=e=>e.status==="aborted",Em=e=>e.status==="dirty",tc=e=>e.status==="valid",rc=e=>typeof Promise<"u"&&e instanceof Promise;function $d(e,t,r,n){if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function Vj(e,t,r,n,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var De;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(De||(De={}));var il,al;class Yn{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const gw=(e,t)=>{if(tc(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new Wr(e.common.issues);return this._error=r,this._error}}};function Ze(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(i,a)=>{var c,u;const{message:d}=e;return i.code==="invalid_enum_value"?{message:d??a.defaultError}:typeof a.data>"u"?{message:(c=d??n)!==null&&c!==void 0?c:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(u=d??r)!==null&&u!==void 0?u:a.defaultError}},description:s}}class Je{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Zs(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new cr,ctx:{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(rc(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;const s={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},o=this._parseSync({data:t,path:s.path,parent:s});return gw(s,o)}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},s=this._parse({data:t,path:n.path,parent:n}),o=await(rc(s)?s:Promise.resolve(s));return gw(n,o)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{const i=t(s),a=()=>o.addIssue({code:ie.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new En({schema:this,typeName:$e.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Wn.create(this,this._def)}nullable(){return wo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _n.create(this,this._def)}promise(){return xa.create(this,this._def)}or(t){return ic.create([this,t],this._def)}and(t){return ac.create(this,t,this._def)}transform(t){return new En({...Ze(this._def),schema:this,typeName:$e.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new fc({...Ze(this._def),innerType:this,defaultValue:r,typeName:$e.ZodDefault})}brand(){return new hy({typeName:$e.ZodBranded,type:this,...Ze(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new hc({...Ze(this._def),innerType:this,catchValue:r,typeName:$e.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return zc.create(this,t)}readonly(){return pc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ez=/^c[^\s-]{8,}$/i,Nz=/^[0-9a-z]+$/,Tz=/^[0-9A-HJKMNP-TV-Z]{26}$/,Rz=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Pz=/^[a-z0-9_-]{21}$/i,Az=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Dz=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Oz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let op;const Mz=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Iz=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Lz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wj="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Fz=new RegExp(`^${Wj}$`);function Bj(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function zz(e){return new RegExp(`^${Bj(e)}$`)}function Hj(e){let t=`${Wj}T${Bj(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Uz(e,t){return!!((t==="v4"||!t)&&Mz.test(e)||(t==="v6"||!t)&&Iz.test(e))}class yn extends Je{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==we.string){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.string,received:o.parsedType}),Be}const n=new cr;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(s=this._getOrReturnCtx(t,s),ge(s,{code:ie.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,a=t.data.lengtht.test(s),{validation:r,code:ie.invalid_string,...De.errToObj(n)})}_addCheck(t){return new yn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...De.errToObj(t)})}url(t){return this._addCheck({kind:"url",...De.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...De.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...De.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...De.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...De.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...De.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...De.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...De.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...De.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(r=t==null?void 0:t.offset)!==null&&r!==void 0?r:!1,local:(n=t==null?void 0:t.local)!==null&&n!==void 0?n:!1,...De.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...De.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...De.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...De.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...De.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...De.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...De.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...De.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...De.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...De.errToObj(r)})}nonempty(t){return this.min(1,De.errToObj(t))}trim(){return new yn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new yn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new yn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value{var t;return new yn({checks:[],typeName:$e.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};function $z(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=parseInt(e.toFixed(s).replace(".","")),i=parseInt(t.toFixed(s).replace(".",""));return o%i/Math.pow(10,s)}class vo extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==we.number){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.number,received:o.parsedType}),Be}let n;const s=new cr;for(const o of this._def.checks)o.kind==="int"?ot.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?$z(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_finite,message:o.message}),s.dirty()):ot.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,De.toString(r))}gt(t,r){return this.setLimit("min",t,!1,De.toString(r))}lte(t,r){return this.setLimit("max",t,!0,De.toString(r))}lt(t,r){return this.setLimit("max",t,!1,De.toString(r))}setLimit(t,r,n,s){return new vo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:De.toString(s)}]})}_addCheck(t){return new vo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:De.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:De.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:De.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:De.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:De.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.valuet.kind==="int"||t.kind==="multipleOf"&&ot.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.valuenew vo({checks:[],typeName:$e.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class yo extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==we.bigint){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.bigint,received:o.parsedType}),Be}let n;const s=new cr;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):ot.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,De.toString(r))}gt(t,r){return this.setLimit("min",t,!1,De.toString(r))}lte(t,r){return this.setLimit("max",t,!0,De.toString(r))}lt(t,r){return this.setLimit("max",t,!1,De.toString(r))}setLimit(t,r,n,s){return new yo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:De.toString(s)}]})}_addCheck(t){return new yo({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:De.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value{var t;return new yo({checks:[],typeName:$e.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};class nc extends Je{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==we.boolean){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.boolean,received:n.parsedType}),Be}return gr(t.data)}}nc.create=e=>new nc({typeName:$e.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class si extends Je{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==we.date){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.date,received:o.parsedType}),Be}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_date}),Be}const n=new cr;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(s=this._getOrReturnCtx(t,s),ge(s,{code:ie.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ot.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new si({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:De.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:De.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew si({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:$e.ZodDate,...Ze(e)});class Vd extends Je{_parse(t){if(this._getType(t)!==we.symbol){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.symbol,received:n.parsedType}),Be}return gr(t.data)}}Vd.create=e=>new Vd({typeName:$e.ZodSymbol,...Ze(e)});class sc extends Je{_parse(t){if(this._getType(t)!==we.undefined){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.undefined,received:n.parsedType}),Be}return gr(t.data)}}sc.create=e=>new sc({typeName:$e.ZodUndefined,...Ze(e)});class oc extends Je{_parse(t){if(this._getType(t)!==we.null){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.null,received:n.parsedType}),Be}return gr(t.data)}}oc.create=e=>new oc({typeName:$e.ZodNull,...Ze(e)});class ya extends Je{constructor(){super(...arguments),this._any=!0}_parse(t){return gr(t.data)}}ya.create=e=>new ya({typeName:$e.ZodAny,...Ze(e)});class Ko extends Je{constructor(){super(...arguments),this._unknown=!0}_parse(t){return gr(t.data)}}Ko.create=e=>new Ko({typeName:$e.ZodUnknown,...Ze(e)});class js extends Je{_parse(t){const r=this._getOrReturnCtx(t);return ge(r,{code:ie.invalid_type,expected:we.never,received:r.parsedType}),Be}}js.create=e=>new js({typeName:$e.ZodNever,...Ze(e)});class Wd extends Je{_parse(t){if(this._getType(t)!==we.undefined){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.void,received:n.parsedType}),Be}return gr(t.data)}}Wd.create=e=>new Wd({typeName:$e.ZodVoid,...Ze(e)});class _n extends Je{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==we.array)return ge(r,{code:ie.invalid_type,expected:we.array,received:r.parsedType}),Be;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,a=r.data.lengths.maxLength.value&&(ge(r,{code:ie.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>s.type._parseAsync(new Yn(r,i,r.path,a)))).then(i=>cr.mergeArray(n,i));const o=[...r.data].map((i,a)=>s.type._parseSync(new Yn(r,i,r.path,a)));return cr.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new _n({...this._def,minLength:{value:t,message:De.toString(r)}})}max(t,r){return new _n({...this._def,maxLength:{value:t,message:De.toString(r)}})}length(t,r){return new _n({...this._def,exactLength:{value:t,message:De.toString(r)}})}nonempty(t){return this.min(1,t)}}_n.create=(e,t)=>new _n({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$e.ZodArray,...Ze(t)});function ji(e){if(e instanceof Rt){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Wn.create(ji(n))}return new Rt({...e._def,shape:()=>t})}else return e instanceof _n?new _n({...e._def,type:ji(e.element)}):e instanceof Wn?Wn.create(ji(e.unwrap())):e instanceof wo?wo.create(ji(e.unwrap())):e instanceof Zn?Zn.create(e.items.map(t=>ji(t))):e}class Rt extends Je{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),r=ot.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==we.object){const u=this._getOrReturnCtx(t);return ge(u,{code:ie.invalid_type,expected:we.object,received:u.parsedType}),Be}const{status:n,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof js&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const d=o[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Yn(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof js){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")a.length>0&&(ge(s,{code:ie.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of a){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Yn(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,m=await d.value;u.push({key:f,value:m,alwaysSet:d.alwaysSet})}return u}).then(u=>cr.mergeObjectSync(n,u)):cr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return De.errToObj,new Rt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var s,o,i,a;const c=(i=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,r,n).message)!==null&&i!==void 0?i:n.defaultError;return r.code==="unrecognized_keys"?{message:(a=De.errToObj(t).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new Rt({...this._def,unknownKeys:"strip"})}passthrough(){return new Rt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Rt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Rt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:$e.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Rt({...this._def,catchall:t})}pick(t){const r={};return ot.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Rt({...this._def,shape:()=>r})}omit(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new Rt({...this._def,shape:()=>r})}deepPartial(){return ji(this)}partial(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}),new Rt({...this._def,shape:()=>r})}required(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Wn;)o=o._def.innerType;r[n]=o}}),new Rt({...this._def,shape:()=>r})}keyof(){return Yj(ot.objectKeys(this.shape))}}Rt.create=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strip",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});Rt.strictCreate=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strict",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});Rt.lazycreate=(e,t)=>new Rt({shape:e,unknownKeys:"strip",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});class ic extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function s(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new Wr(a.ctx.common.issues));return ge(r,{code:ie.invalid_union,unionErrors:i}),Be}if(r.common.async)return Promise.all(n.map(async o=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(c=>new Wr(c));return ge(r,{code:ie.invalid_union,unionErrors:a}),Be}}get options(){return this._def.options}}ic.create=(e,t)=>new ic({options:e,typeName:$e.ZodUnion,...Ze(t)});const os=e=>e instanceof cc?os(e.schema):e instanceof En?os(e.innerType()):e instanceof uc?[e.value]:e instanceof xo?e.options:e instanceof dc?ot.objectValues(e.enum):e instanceof fc?os(e._def.innerType):e instanceof sc?[void 0]:e instanceof oc?[null]:e instanceof Wn?[void 0,...os(e.unwrap())]:e instanceof wo?[null,...os(e.unwrap())]:e instanceof hy||e instanceof pc?os(e.unwrap()):e instanceof hc?os(e._def.innerType):[];class qf extends Je{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.object)return ge(r,{code:ie.invalid_type,expected:we.object,received:r.parsedType}),Be;const n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(ge(r,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const s=new Map;for(const o of r){const i=os(o.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of i){if(s.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);s.set(a,o)}}return new qf({typeName:$e.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:s,...Ze(n)})}}function Nm(e,t){const r=Zs(e),n=Zs(t);if(e===t)return{valid:!0,data:e};if(r===we.object&&n===we.object){const s=ot.objectKeys(t),o=ot.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(const a of o){const c=Nm(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===we.array&&n===we.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o{if(jm(o)||jm(i))return Be;const a=Nm(o.value,i.value);return a.valid?((Em(o)||Em(i))&&r.dirty(),{status:r.value,value:a.data}):(ge(n,{code:ie.invalid_intersection_types}),Be)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ac.create=(e,t,r)=>new ac({left:e,right:t,typeName:$e.ZodIntersection,...Ze(r)});class Zn extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.array)return ge(n,{code:ie.invalid_type,expected:we.array,received:n.parsedType}),Be;if(n.data.lengththis._def.items.length&&(ge(n,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const o=[...n.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Yn(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>cr.mergeArray(r,i)):cr.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new Zn({...this._def,rest:t})}}Zn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zn({items:e,typeName:$e.ZodTuple,rest:null,...Ze(t)})};class lc extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.object)return ge(n,{code:ie.invalid_type,expected:we.object,received:n.parsedType}),Be;const s=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)s.push({key:o._parse(new Yn(n,a,n.path,a)),value:i._parse(new Yn(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?cr.mergeObjectAsync(r,s):cr.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Je?new lc({keyType:t,valueType:r,typeName:$e.ZodRecord,...Ze(n)}):new lc({keyType:yn.create(),valueType:t,typeName:$e.ZodRecord,...Ze(r)})}}class Bd extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.map)return ge(n,{code:ie.invalid_type,expected:we.map,received:n.parsedType}),Be;const s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new Yn(n,a,n.path,[u,"key"])),value:o._parse(new Yn(n,c,n.path,[u,"value"]))}));if(n.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}}Bd.create=(e,t,r)=>new Bd({valueType:t,keyType:e,typeName:$e.ZodMap,...Ze(r)});class oi extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.set)return ge(n,{code:ie.invalid_type,expected:we.set,received:n.parsedType}),Be;const s=this._def;s.minSize!==null&&n.data.sizes.maxSize.value&&(ge(n,{code:ie.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const o=this._def.valueType;function i(c){const u=new Set;for(const d of c){if(d.status==="aborted")return Be;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}const a=[...n.data.values()].map((c,u)=>o._parse(new Yn(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,r){return new oi({...this._def,minSize:{value:t,message:De.toString(r)}})}max(t,r){return new oi({...this._def,maxSize:{value:t,message:De.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}oi.create=(e,t)=>new oi({valueType:e,minSize:null,maxSize:null,typeName:$e.ZodSet,...Ze(t)});class oa extends Je{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.function)return ge(r,{code:ie.invalid_type,expected:we.function,received:r.parsedType}),Be;function n(a,c){return Ud({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zd(),va].filter(u=>!!u),issueData:{code:ie.invalid_arguments,argumentsError:c}})}function s(a,c){return Ud({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zd(),va].filter(u=>!!u),issueData:{code:ie.invalid_return_type,returnTypeError:c}})}const o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof xa){const a=this;return gr(async function(...c){const u=new Wr([]),d=await a._def.args.parseAsync(c,o).catch(y=>{throw u.addIssue(n(c,y)),u}),f=await Reflect.apply(i,this,d);return await a._def.returns._def.type.parseAsync(f,o).catch(y=>{throw u.addIssue(s(f,y)),u})})}else{const a=this;return gr(function(...c){const u=a._def.args.safeParse(c,o);if(!u.success)throw new Wr([n(c,u.error)]);const d=Reflect.apply(i,this,u.data),f=a._def.returns.safeParse(d,o);if(!f.success)throw new Wr([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new oa({...this._def,args:Zn.create(t).rest(Ko.create())})}returns(t){return new oa({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new oa({args:t||Zn.create([]).rest(Ko.create()),returns:r||Ko.create(),typeName:$e.ZodFunction,...Ze(n)})}}class cc extends Je{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}cc.create=(e,t)=>new cc({getter:e,typeName:$e.ZodLazy,...Ze(t)});class uc extends Je{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return ge(r,{received:r.data,code:ie.invalid_literal,expected:this._def.value}),Be}return{status:"valid",value:t.data}}get value(){return this._def.value}}uc.create=(e,t)=>new uc({value:e,typeName:$e.ZodLiteral,...Ze(t)});function Yj(e,t){return new xo({values:e,typeName:$e.ZodEnum,...Ze(t)})}class xo extends Je{constructor(){super(...arguments),il.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return ge(r,{expected:ot.joinValues(n),received:r.parsedType,code:ie.invalid_type}),Be}if($d(this,il)||Vj(this,il,new Set(this._def.values)),!$d(this,il).has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return ge(r,{received:r.data,code:ie.invalid_enum_value,options:n}),Be}return gr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return xo.create(t,{...this._def,...r})}exclude(t,r=this._def){return xo.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}il=new WeakMap;xo.create=Yj;class dc extends Je{constructor(){super(...arguments),al.set(this,void 0)}_parse(t){const r=ot.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==we.string&&n.parsedType!==we.number){const s=ot.objectValues(r);return ge(n,{expected:ot.joinValues(s),received:n.parsedType,code:ie.invalid_type}),Be}if($d(this,al)||Vj(this,al,new Set(ot.getValidEnumValues(this._def.values))),!$d(this,al).has(t.data)){const s=ot.objectValues(r);return ge(n,{received:n.data,code:ie.invalid_enum_value,options:s}),Be}return gr(t.data)}get enum(){return this._def.values}}al=new WeakMap;dc.create=(e,t)=>new dc({values:e,typeName:$e.ZodNativeEnum,...Ze(t)});class xa extends Je{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.promise&&r.common.async===!1)return ge(r,{code:ie.invalid_type,expected:we.promise,received:r.parsedType}),Be;const n=r.parsedType===we.promise?r.data:Promise.resolve(r.data);return gr(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}xa.create=(e,t)=>new xa({type:e,typeName:$e.ZodPromise,...Ze(t)});class En extends Je{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$e.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:i=>{ge(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return Be;const c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Be:c.status==="dirty"||r.value==="dirty"?Vi(c.value):c});{if(r.value==="aborted")return Be;const a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?Be:a.status==="dirty"||r.value==="dirty"?Vi(a.value):a}}if(s.type==="refinement"){const i=a=>{const c=s.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Be:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Be:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!tc(i))return i;const a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>tc(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):i);ot.assertNever(s)}}En.create=(e,t,r)=>new En({schema:e,typeName:$e.ZodEffects,effect:t,...Ze(r)});En.createWithPreprocess=(e,t,r)=>new En({schema:t,effect:{type:"preprocess",transform:e},typeName:$e.ZodEffects,...Ze(r)});class Wn extends Je{_parse(t){return this._getType(t)===we.undefined?gr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Wn.create=(e,t)=>new Wn({innerType:e,typeName:$e.ZodOptional,...Ze(t)});class wo extends Je{_parse(t){return this._getType(t)===we.null?gr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}wo.create=(e,t)=>new wo({innerType:e,typeName:$e.ZodNullable,...Ze(t)});class fc extends Je{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===we.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}fc.create=(e,t)=>new fc({innerType:e,typeName:$e.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ze(t)});class hc extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rc(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Wr(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Wr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}hc.create=(e,t)=>new hc({innerType:e,typeName:$e.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ze(t)});class Hd extends Je{_parse(t){if(this._getType(t)!==we.nan){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.nan,received:n.parsedType}),Be}return{status:"valid",value:t.data}}}Hd.create=e=>new Hd({typeName:$e.ZodNaN,...Ze(e)});const Vz=Symbol("zod_brand");class hy extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class zc extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Be:o.status==="dirty"?(r.dirty(),Vi(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Be:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new zc({in:t,out:r,typeName:$e.ZodPipeline})}}class pc extends Je{_parse(t){const r=this._def.innerType._parse(t),n=s=>(tc(s)&&(s.value=Object.freeze(s.value)),s);return rc(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}pc.create=(e,t)=>new pc({innerType:e,typeName:$e.ZodReadonly,...Ze(t)});function Zj(e,t={},r){return e?ya.create().superRefine((n,s)=>{var o,i;if(!e(n)){const a=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,c=(i=(o=a.fatal)!==null&&o!==void 0?o:r)!==null&&i!==void 0?i:!0,u=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...u,fatal:c})}}):ya.create()}const Wz={object:Rt.lazycreate};var $e;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})($e||($e={}));const Bz=(e,t={message:`Input not instance of ${e.name}`})=>Zj(r=>r instanceof e,t),Kj=yn.create,Gj=vo.create,Hz=Hd.create,Yz=yo.create,qj=nc.create,Zz=si.create,Kz=Vd.create,Gz=sc.create,qz=oc.create,Xz=ya.create,Qz=Ko.create,Jz=js.create,e8=Wd.create,t8=_n.create,r8=Rt.create,n8=Rt.strictCreate,s8=ic.create,o8=qf.create,i8=ac.create,a8=Zn.create,l8=lc.create,c8=Bd.create,u8=oi.create,d8=oa.create,f8=cc.create,h8=uc.create,p8=xo.create,m8=dc.create,g8=xa.create,vw=En.create,v8=Wn.create,y8=wo.create,x8=En.createWithPreprocess,w8=zc.create,_8=()=>Kj().optional(),b8=()=>Gj().optional(),S8=()=>qj().optional(),k8={string:e=>yn.create({...e,coerce:!0}),number:e=>vo.create({...e,coerce:!0}),boolean:e=>nc.create({...e,coerce:!0}),bigint:e=>yo.create({...e,coerce:!0}),date:e=>si.create({...e,coerce:!0})},C8=Be;var pe=Object.freeze({__proto__:null,defaultErrorMap:va,setErrorMap:Cz,getErrorMap:zd,makeIssue:Ud,EMPTY_PATH:jz,addIssueToContext:ge,ParseStatus:cr,INVALID:Be,DIRTY:Vi,OK:gr,isAborted:jm,isDirty:Em,isValid:tc,isAsync:rc,get util(){return ot},get objectUtil(){return Cm},ZodParsedType:we,getParsedType:Zs,ZodType:Je,datetimeRegex:Hj,ZodString:yn,ZodNumber:vo,ZodBigInt:yo,ZodBoolean:nc,ZodDate:si,ZodSymbol:Vd,ZodUndefined:sc,ZodNull:oc,ZodAny:ya,ZodUnknown:Ko,ZodNever:js,ZodVoid:Wd,ZodArray:_n,ZodObject:Rt,ZodUnion:ic,ZodDiscriminatedUnion:qf,ZodIntersection:ac,ZodTuple:Zn,ZodRecord:lc,ZodMap:Bd,ZodSet:oi,ZodFunction:oa,ZodLazy:cc,ZodLiteral:uc,ZodEnum:xo,ZodNativeEnum:dc,ZodPromise:xa,ZodEffects:En,ZodTransformer:En,ZodOptional:Wn,ZodNullable:wo,ZodDefault:fc,ZodCatch:hc,ZodNaN:Hd,BRAND:Vz,ZodBranded:hy,ZodPipeline:zc,ZodReadonly:pc,custom:Zj,Schema:Je,ZodSchema:Je,late:Wz,get ZodFirstPartyTypeKind(){return $e},coerce:k8,any:Xz,array:t8,bigint:Yz,boolean:qj,date:Zz,discriminatedUnion:o8,effect:vw,enum:p8,function:d8,instanceof:Bz,intersection:i8,lazy:f8,literal:h8,map:c8,nan:Hz,nativeEnum:m8,never:Jz,null:qz,nullable:y8,number:Gj,object:r8,oboolean:S8,onumber:b8,optional:v8,ostring:_8,pipeline:w8,preprocess:x8,promise:g8,record:l8,set:u8,strictObject:n8,string:Kj,symbol:Kz,transformer:vw,tuple:a8,undefined:Gz,union:s8,unknown:Qz,void:e8,NEVER:C8,ZodIssueCode:ie,quotelessJson:kz,ZodError:Wr}),j8="Label",Xj=v.forwardRef((e,t)=>l.jsx(Re.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Xj.displayName=j8;var Qj=Xj;const E8=_c("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ma=v.forwardRef(({className:e,...t},r)=>l.jsx(Qj,{ref:r,className:ae(E8(),e),...t}));Ma.displayName=Qj.displayName;const Pr=iz,Jj=v.createContext({}),Ne=({...e})=>l.jsx(Jj.Provider,{value:{name:e.name},children:l.jsx(uz,{...e})}),Xf=()=>{const e=v.useContext(Jj),t=v.useContext(eE),{getFieldState:r,formState:n}=Gf(),s=r(e.name,n);if(!e)throw new Error("useFormField should be used within ");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...s}},eE=v.createContext({}),Ce=v.forwardRef(({className:e,...t},r)=>{const n=v.useId();return l.jsx(eE.Provider,{value:{id:n},children:l.jsx("div",{ref:r,className:ae("space-y-2",e),...t})})});Ce.displayName="FormItem";const je=v.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:s}=Xf();return l.jsx(Ma,{ref:r,className:ae(n&&"text-destructive",e),htmlFor:s,...t})});je.displayName="FormLabel";const Ee=v.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:s,formMessageId:o}=Xf();return l.jsx(bs,{ref:t,id:n,"aria-describedby":r?`${s} ${o}`:`${s}`,"aria-invalid":!!r,...e})});Ee.displayName="FormControl";const N8=v.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=Xf();return l.jsx("p",{ref:r,id:n,className:ae("text-sm text-muted-foreground",e),...t})});N8.displayName="FormDescription";const Se=v.forwardRef(({className:e,children:t,...r},n)=>{const{error:s,formMessageId:o}=Xf(),i=s?String(s==null?void 0:s.message):t;return i?l.jsx("p",{ref:n,id:o,className:ae("text-sm font-medium text-destructive",e),...r,children:i}):null});Se.displayName="FormMessage";function Tm(e,[t,r]){return Math.min(r,Math.max(t,e))}var T8=[" ","Enter","ArrowUp","ArrowDown"],R8=[" ","Enter"],Uc="Select",[Qf,Jf,P8]=bc(Uc),[Ia,E$]=xr(Uc,[P8,Pa]),eh=Pa(),[A8,Eo]=Ia(Uc),[D8,O8]=Ia(Uc),tE=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:m,required:y}=e,x=eh(t),[g,_]=v.useState(null),[p,h]=v.useState(null),[w,C]=v.useState(!1),j=Ea(u),[E=!1,R]=on({prop:n,defaultProp:s,onChange:o}),[P,A]=on({prop:i,defaultProp:a,onChange:c}),L=v.useRef(null),q=g?!!g.closest("form"):!0,[N,F]=v.useState(new Set),b=Array.from(N).map(V=>V.props.value).join(";");return l.jsx(Xg,{...x,children:l.jsxs(A8,{required:y,scope:t,trigger:g,onTriggerChange:_,valueNode:p,onValueNodeChange:h,valueNodeHasChildren:w,onValueNodeHasChildrenChange:C,contentId:Ur(),value:P,onValueChange:A,open:E,onOpenChange:R,dir:j,triggerPointerDownPosRef:L,disabled:m,children:[l.jsx(Qf.Provider,{scope:t,children:l.jsx(D8,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(V=>{F(te=>new Set(te).add(V))},[]),onNativeOptionRemove:v.useCallback(V=>{F(te=>{const W=new Set(te);return W.delete(V),W})},[]),children:r})}),q?l.jsxs(EE,{"aria-hidden":!0,required:y,tabIndex:-1,name:d,autoComplete:f,value:P,onChange:V=>A(V.target.value),disabled:m,children:[P===void 0?l.jsx("option",{value:""}):null,Array.from(N)]},b):null]})})};tE.displayName=Uc;var rE="SelectTrigger",nE=v.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,o=eh(r),i=Eo(rE,r),a=i.disabled||n,c=Ke(t,i.onTriggerChange),u=Jf(r),[d,f,m]=NE(x=>{const g=u().filter(h=>!h.disabled),_=g.find(h=>h.value===i.value),p=TE(g,x,_);p!==void 0&&i.onValueChange(p.value)}),y=()=>{a||(i.onOpenChange(!0),m())};return l.jsx(Qg,{asChild:!0,...o,children:l.jsx(Re.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":jE(i.value)?"":void 0,...s,ref:c,onClick:ce(s.onClick,x=>{x.currentTarget.focus()}),onPointerDown:ce(s.onPointerDown,x=>{const g=x.target;g.hasPointerCapture(x.pointerId)&&g.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&(y(),i.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)},x.preventDefault())}),onKeyDown:ce(s.onKeyDown,x=>{const g=d.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&f(x.key),!(g&&x.key===" ")&&T8.includes(x.key)&&(y(),x.preventDefault())})})})});nE.displayName=rE;var sE="SelectValue",oE=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:i="",...a}=e,c=Eo(sE,r),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,f=Ke(t,c.onValueNodeChange);return Jt(()=>{u(d)},[u,d]),l.jsx(Re.span,{...a,ref:f,style:{pointerEvents:"none"},children:jE(c.value)?l.jsx(l.Fragment,{children:i}):o})});oE.displayName=sE;var M8="SelectIcon",iE=v.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return l.jsx(Re.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});iE.displayName=M8;var I8="SelectPortal",aE=e=>l.jsx(kc,{asChild:!0,...e});aE.displayName=I8;var ii="SelectContent",lE=v.forwardRef((e,t)=>{const r=Eo(ii,e.__scopeSelect),[n,s]=v.useState();if(Jt(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?Ns.createPortal(l.jsx(cE,{scope:e.__scopeSelect,children:l.jsx(Qf.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),o):null}return l.jsx(uE,{...e,ref:t})});lE.displayName=ii;var ls=10,[cE,No]=Ia(ii),L8="SelectContentImpl",uE=v.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:g,avoidCollisions:_,...p}=e,h=Eo(ii,r),[w,C]=v.useState(null),[j,E]=v.useState(null),R=Ke(t,he=>C(he)),[P,A]=v.useState(null),[L,q]=v.useState(null),N=Jf(r),[F,b]=v.useState(!1),V=v.useRef(!1);v.useEffect(()=>{if(w)return tv(w)},[w]),Vg();const te=v.useCallback(he=>{const[ye,...ke]=N().map(Pe=>Pe.ref.current),[Fe]=ke.slice(-1),Me=document.activeElement;for(const Pe of he)if(Pe===Me||(Pe==null||Pe.scrollIntoView({block:"nearest"}),Pe===ye&&j&&(j.scrollTop=0),Pe===Fe&&j&&(j.scrollTop=j.scrollHeight),Pe==null||Pe.focus(),document.activeElement!==Me))return},[N,j]),W=v.useCallback(()=>te([P,w]),[te,P,w]);v.useEffect(()=>{F&&W()},[F,W]);const{onOpenChange:Z,triggerPointerDownPosRef:I}=h;v.useEffect(()=>{if(w){let he={x:0,y:0};const ye=Fe=>{var Me,Pe;he={x:Math.abs(Math.round(Fe.pageX)-(((Me=I.current)==null?void 0:Me.x)??0)),y:Math.abs(Math.round(Fe.pageY)-(((Pe=I.current)==null?void 0:Pe.y)??0))}},ke=Fe=>{he.x<=10&&he.y<=10?Fe.preventDefault():w.contains(Fe.target)||Z(!1),document.removeEventListener("pointermove",ye),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",ke,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",ke,{capture:!0})}}},[w,Z,I]),v.useEffect(()=>{const he=()=>Z(!1);return window.addEventListener("blur",he),window.addEventListener("resize",he),()=>{window.removeEventListener("blur",he),window.removeEventListener("resize",he)}},[Z]);const[Q,z]=NE(he=>{const ye=N().filter(Me=>!Me.disabled),ke=ye.find(Me=>Me.ref.current===document.activeElement),Fe=TE(ye,he,ke);Fe&&setTimeout(()=>Fe.ref.current.focus())}),$=v.useCallback((he,ye,ke)=>{const Fe=!V.current&&!ke;(h.value!==void 0&&h.value===ye||Fe)&&(A(he),Fe&&(V.current=!0))},[h.value]),fe=v.useCallback(()=>w==null?void 0:w.focus(),[w]),ne=v.useCallback((he,ye,ke)=>{const Fe=!V.current&&!ke;(h.value!==void 0&&h.value===ye||Fe)&&q(he)},[h.value]),se=n==="popper"?Rm:dE,Oe=se===Rm?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:g,avoidCollisions:_}:{};return l.jsx(cE,{scope:r,content:w,viewport:j,onViewportChange:E,itemRefCallback:$,selectedItem:P,onItemLeave:fe,itemTextRefCallback:ne,focusSelectedItem:W,selectedItemText:L,position:n,isPositioned:F,searchRef:Q,children:l.jsx(jf,{as:bs,allowPinchZoom:!0,children:l.jsx(wf,{asChild:!0,trapped:h.open,onMountAutoFocus:he=>{he.preventDefault()},onUnmountAutoFocus:ce(s,he=>{var ye;(ye=h.trigger)==null||ye.focus({preventScroll:!0}),he.preventDefault()}),children:l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:he=>he.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:l.jsx(se,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:he=>he.preventDefault(),...p,...Oe,onPlaced:()=>b(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...p.style},onKeyDown:ce(p.onKeyDown,he=>{const ye=he.ctrlKey||he.altKey||he.metaKey;if(he.key==="Tab"&&he.preventDefault(),!ye&&he.key.length===1&&z(he.key),["ArrowUp","ArrowDown","Home","End"].includes(he.key)){let Fe=N().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);if(["ArrowUp","End"].includes(he.key)&&(Fe=Fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(he.key)){const Me=he.target,Pe=Fe.indexOf(Me);Fe=Fe.slice(Pe+1)}setTimeout(()=>te(Fe)),he.preventDefault()}})})})})})})});uE.displayName=L8;var F8="SelectItemAlignedPosition",dE=v.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,o=Eo(ii,r),i=No(ii,r),[a,c]=v.useState(null),[u,d]=v.useState(null),f=Ke(t,R=>d(R)),m=Jf(r),y=v.useRef(!1),x=v.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:p,focusSelectedItem:h}=i,w=v.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&u&&g&&_&&p){const R=o.trigger.getBoundingClientRect(),P=u.getBoundingClientRect(),A=o.valueNode.getBoundingClientRect(),L=p.getBoundingClientRect();if(o.dir!=="rtl"){const Me=L.left-P.left,Pe=A.left-Me,nt=R.left-Pe,k=R.width+nt,J=Math.max(k,P.width),K=window.innerWidth-ls,D=Tm(Pe,[ls,K-J]);a.style.minWidth=k+"px",a.style.left=D+"px"}else{const Me=P.right-L.right,Pe=window.innerWidth-A.right-Me,nt=window.innerWidth-R.right-Pe,k=R.width+nt,J=Math.max(k,P.width),K=window.innerWidth-ls,D=Tm(Pe,[ls,K-J]);a.style.minWidth=k+"px",a.style.right=D+"px"}const q=m(),N=window.innerHeight-ls*2,F=g.scrollHeight,b=window.getComputedStyle(u),V=parseInt(b.borderTopWidth,10),te=parseInt(b.paddingTop,10),W=parseInt(b.borderBottomWidth,10),Z=parseInt(b.paddingBottom,10),I=V+te+F+Z+W,Q=Math.min(_.offsetHeight*5,I),z=window.getComputedStyle(g),$=parseInt(z.paddingTop,10),fe=parseInt(z.paddingBottom,10),ne=R.top+R.height/2-ls,se=N-ne,Oe=_.offsetHeight/2,he=_.offsetTop+Oe,ye=V+te+he,ke=I-ye;if(ye<=ne){const Me=_===q[q.length-1].ref.current;a.style.bottom="0px";const Pe=u.clientHeight-g.offsetTop-g.offsetHeight,nt=Math.max(se,Oe+(Me?fe:0)+Pe+W),k=ye+nt;a.style.height=k+"px"}else{const Me=_===q[0].ref.current;a.style.top="0px";const nt=Math.max(ne,V+g.offsetTop+(Me?$:0)+Oe)+ke;a.style.height=nt+"px",g.scrollTop=ye-ne+g.offsetTop}a.style.margin=`${ls}px 0`,a.style.minHeight=Q+"px",a.style.maxHeight=N+"px",n==null||n(),requestAnimationFrame(()=>y.current=!0)}},[m,o.trigger,o.valueNode,a,u,g,_,p,o.dir,n]);Jt(()=>w(),[w]);const[C,j]=v.useState();Jt(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const E=v.useCallback(R=>{R&&x.current===!0&&(w(),h==null||h(),x.current=!1)},[w,h]);return l.jsx(U8,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:y,onScrollButtonChange:E,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:l.jsx(Re.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});dE.displayName=F8;var z8="SelectPopperPosition",Rm=v.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=ls,...o}=e,i=eh(r);return l.jsx(Jg,{...i,...o,ref:t,align:n,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Rm.displayName=z8;var[U8,py]=Ia(ii,{}),Pm="SelectViewport",fE=v.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,o=No(Pm,r),i=py(Pm,r),a=Ke(t,o.onViewportChange),c=v.useRef(0);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),l.jsx(Qf.Slot,{scope:r,children:l.jsx(Re.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"auto",...s.style},onScroll:ce(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&f){const y=Math.abs(c.current-d.scrollTop);if(y>0){const x=window.innerHeight-ls*2,g=parseFloat(f.style.minHeight),_=parseFloat(f.style.height),p=Math.max(g,_);if(p0?C:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});fE.displayName=Pm;var hE="SelectGroup",[$8,V8]=Ia(hE),pE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Ur();return l.jsx($8,{scope:r,id:s,children:l.jsx(Re.div,{role:"group","aria-labelledby":s,...n,ref:t})})});pE.displayName=hE;var mE="SelectLabel",gE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=V8(mE,r);return l.jsx(Re.div,{id:s.id,...n,ref:t})});gE.displayName=mE;var Yd="SelectItem",[W8,vE]=Ia(Yd),yE=v.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...i}=e,a=Eo(Yd,r),c=No(Yd,r),u=a.value===n,[d,f]=v.useState(o??""),[m,y]=v.useState(!1),x=Ke(t,p=>{var h;return(h=c.itemRefCallback)==null?void 0:h.call(c,p,n,s)}),g=Ur(),_=()=>{s||(a.onValueChange(n),a.onOpenChange(!1))};if(n==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l.jsx(W8,{scope:r,value:n,disabled:s,textId:g,isSelected:u,onItemTextChange:v.useCallback(p=>{f(h=>h||((p==null?void 0:p.textContent)??"").trim())},[]),children:l.jsx(Qf.ItemSlot,{scope:r,value:n,disabled:s,textValue:d,children:l.jsx(Re.div,{role:"option","aria-labelledby":g,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:x,onFocus:ce(i.onFocus,()=>y(!0)),onBlur:ce(i.onBlur,()=>y(!1)),onPointerUp:ce(i.onPointerUp,_),onPointerMove:ce(i.onPointerMove,p=>{var h;s?(h=c.onItemLeave)==null||h.call(c):p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ce(i.onPointerLeave,p=>{var h;p.currentTarget===document.activeElement&&((h=c.onItemLeave)==null||h.call(c))}),onKeyDown:ce(i.onKeyDown,p=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&p.key===" "||(R8.includes(p.key)&&_(),p.key===" "&&p.preventDefault())})})})})});yE.displayName=Yd;var ll="SelectItemText",xE=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...o}=e,i=Eo(ll,r),a=No(ll,r),c=vE(ll,r),u=O8(ll,r),[d,f]=v.useState(null),m=Ke(t,p=>f(p),c.onItemTextChange,p=>{var h;return(h=a.itemTextRefCallback)==null?void 0:h.call(a,p,c.value,c.disabled)}),y=d==null?void 0:d.textContent,x=v.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:y},c.value),[c.disabled,c.value,y]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return Jt(()=>(g(x),()=>_(x)),[g,_,x]),l.jsxs(l.Fragment,{children:[l.jsx(Re.span,{id:c.textId,...o,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ns.createPortal(o.children,i.valueNode):null]})});xE.displayName=ll;var wE="SelectItemIndicator",_E=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return vE(wE,r).isSelected?l.jsx(Re.span,{"aria-hidden":!0,...n,ref:t}):null});_E.displayName=wE;var Am="SelectScrollUpButton",bE=v.forwardRef((e,t)=>{const r=No(Am,e.__scopeSelect),n=py(Am,e.__scopeSelect),[s,o]=v.useState(!1),i=Ke(t,n.onScrollButtonChange);return Jt(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollTop>0;o(u)};const c=r.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(kE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});bE.displayName=Am;var Dm="SelectScrollDownButton",SE=v.forwardRef((e,t)=>{const r=No(Dm,e.__scopeSelect),n=py(Dm,e.__scopeSelect),[s,o]=v.useState(!1),i=Ke(t,n.onScrollButtonChange);return Jt(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(kE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});SE.displayName=Dm;var kE=v.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,o=No("SelectScrollButton",r),i=v.useRef(null),a=Jf(r),c=v.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Jt(()=>{var d;const u=a().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),l.jsx(Re.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ce(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:ce(s.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:ce(s.onPointerLeave,()=>{c()})})}),B8="SelectSeparator",CE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return l.jsx(Re.div,{"aria-hidden":!0,...n,ref:t})});CE.displayName=B8;var Om="SelectArrow",H8=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=eh(r),o=Eo(Om,r),i=No(Om,r);return o.open&&i.position==="popper"?l.jsx(ev,{...s,...n,ref:t}):null});H8.displayName=Om;function jE(e){return e===""||e===void 0}var EE=v.forwardRef((e,t)=>{const{value:r,...n}=e,s=v.useRef(null),o=Ke(t,s),i=YC(r);return v.useEffect(()=>{const a=s.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==r&&d){const f=new Event("change",{bubbles:!0});d.call(a,r),a.dispatchEvent(f)}},[i,r]),l.jsx(Ic,{asChild:!0,children:l.jsx("select",{...n,ref:o,defaultValue:r})})});EE.displayName="BubbleSelect";function NE(e){const t=Dt(e),r=v.useRef(""),n=v.useRef(0),s=v.useCallback(i=>{const a=r.current+i;t(a),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(a)},[t]),o=v.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function TE(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=Y8(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function Y8(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Z8=tE,RE=nE,K8=oE,G8=iE,q8=aE,PE=lE,X8=fE,Q8=pE,AE=gE,DE=yE,J8=xE,eU=_E,OE=bE,ME=SE,IE=CE;const Mo=Z8,cl=Q8,Io=K8,Ks=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(RE,{ref:n,className:ae("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,l.jsx(G8,{asChild:!0,children:l.jsx(Lg,{className:"h-4 w-4 opacity-50"})})]}));Ks.displayName=RE.displayName;const LE=v.forwardRef(({className:e,...t},r)=>l.jsx(OE,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(aA,{className:"h-4 w-4"})}));LE.displayName=OE.displayName;const FE=v.forwardRef(({className:e,...t},r)=>l.jsx(ME,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Lg,{className:"h-4 w-4"})}));FE.displayName=ME.displayName;const Gs=v.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>l.jsx(q8,{children:l.jsxs(PE,{ref:s,className:ae("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[l.jsx(LE,{}),l.jsx(X8,{className:ae("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(FE,{})]})}));Gs.displayName=PE.displayName;const Wi=v.forwardRef(({className:e,...t},r)=>l.jsx(AE,{ref:r,className:ae("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Wi.displayName=AE.displayName;const pn=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(DE,{ref:n,className:ae("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(eU,{children:l.jsx(eb,{className:"h-4 w-4"})})}),l.jsx(J8,{children:t})]}));pn.displayName=DE.displayName;const tU=v.forwardRef(({className:e,...t},r)=>l.jsx(IE,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));tU.displayName=IE.displayName;const Mm=new Map([["aliyun-cdn",["阿里云-CDN","/imgs/providers/aliyun.svg"]],["aliyun-oss",["阿里云-OSS","/imgs/providers/aliyun.svg"]],["aliyun-dcdn",["阿里云-DCDN","/imgs/providers/aliyun.svg"]],["tencent-cdn",["腾讯云-CDN","/imgs/providers/tencent.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.svg"]],["qiniu-cdn",["七牛云-CDN","/imgs/providers/qiniu.svg"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),rU=Array.from(Mm.keys()),my=mv,gy=gv,nU=vv,zE=v.forwardRef(({className:e,...t},r)=>l.jsx(Ec,{ref:r,className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));zE.displayName=Ec.displayName;const th=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(nU,{children:[l.jsx(zE,{}),l.jsxs(Nc,{ref:n,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,l.jsxs(Tf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(Fg,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));th.displayName=Nc.displayName;const rh=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});rh.displayName="DialogHeader";const nh=v.forwardRef(({className:e,...t},r)=>l.jsx(Tc,{ref:r,className:ae("text-lg font-semibold leading-none tracking-tight",e),...t}));nh.displayName=Tc.displayName;const sU=v.forwardRef(({className:e,...t},r)=>l.jsx(Rc,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));sU.displayName=Rc.displayName;function oU(e,t){return v.useReducer((r,n)=>t[r][n]??r,e)}var vy="ScrollArea",[UE,N$]=xr(vy),[iU,cn]=UE(vy),$E=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:o=600,...i}=e,[a,c]=v.useState(null),[u,d]=v.useState(null),[f,m]=v.useState(null),[y,x]=v.useState(null),[g,_]=v.useState(null),[p,h]=v.useState(0),[w,C]=v.useState(0),[j,E]=v.useState(!1),[R,P]=v.useState(!1),A=Ke(t,q=>c(q)),L=Ea(s);return l.jsx(iU,{scope:r,type:n,dir:L,scrollHideDelay:o,scrollArea:a,viewport:u,onViewportChange:d,content:f,onContentChange:m,scrollbarX:y,onScrollbarXChange:x,scrollbarXEnabled:j,onScrollbarXEnabledChange:E,scrollbarY:g,onScrollbarYChange:_,scrollbarYEnabled:R,onScrollbarYEnabledChange:P,onCornerWidthChange:h,onCornerHeightChange:C,children:l.jsx(Re.div,{dir:L,...i,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":p+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});$E.displayName=vy;var VE="ScrollAreaViewport",WE=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...o}=e,i=cn(VE,r),a=v.useRef(null),c=Ke(t,a,i.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(Re.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});WE.displayName=VE;var Xn="ScrollAreaScrollbar",yy=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,a=e.orientation==="horizontal";return v.useEffect(()=>(a?o(!0):i(!0),()=>{a?o(!1):i(!1)}),[a,o,i]),s.type==="hover"?l.jsx(aU,{...n,ref:t,forceMount:r}):s.type==="scroll"?l.jsx(lU,{...n,ref:t,forceMount:r}):s.type==="auto"?l.jsx(BE,{...n,ref:t,forceMount:r}):s.type==="always"?l.jsx(xy,{...n,ref:t}):null});yy.displayName=Xn;var aU=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),[o,i]=v.useState(!1);return v.useEffect(()=>{const a=s.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),l.jsx(ur,{present:r||o,children:l.jsx(BE,{"data-state":o?"visible":"hidden",...n,ref:t})})}),lU=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),o=e.orientation==="horizontal",i=oh(()=>c("SCROLL_END"),100),[a,c]=oU("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,s.scrollHideDelay,c]),v.useEffect(()=>{const u=s.viewport,d=o?"scrollLeft":"scrollTop";if(u){let f=u[d];const m=()=>{const y=u[d];f!==y&&(c("SCROLL"),i()),f=y};return u.addEventListener("scroll",m),()=>u.removeEventListener("scroll",m)}},[s.viewport,o,c,i]),l.jsx(ur,{present:r||a!=="hidden",children:l.jsx(xy,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:ce(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ce(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),BE=v.forwardRef((e,t)=>{const r=cn(Xn,e.__scopeScrollArea),{forceMount:n,...s}=e,[o,i]=v.useState(!1),a=e.orientation==="horizontal",c=oh(()=>{if(r.viewport){const u=r.viewport.offsetWidth{const{orientation:r="vertical",...n}=e,s=cn(Xn,e.__scopeScrollArea),o=v.useRef(null),i=v.useRef(0),[a,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=GE(a.viewport,a.content),d={...n,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:m=>o.current=m,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:m=>i.current=m};function f(m,y){return pU(m,i.current,a,y)}return r==="horizontal"?l.jsx(cU,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollLeft,y=yw(m,a,s.dir);o.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollLeft=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollLeft=f(m,s.dir))}}):r==="vertical"?l.jsx(uU,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollTop,y=yw(m,a);o.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollTop=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollTop=f(m))}}):null}),cU=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=cn(Xn,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Ke(t,c,o.onScrollbarXChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(YE,{"data-orientation":"horizontal",...s,ref:u,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":sh(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const m=o.viewport.scrollLeft+d.deltaX;e.onWheelScroll(m),XE(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Kd(i.paddingLeft),paddingEnd:Kd(i.paddingRight)}})}})}),uU=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=cn(Xn,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Ke(t,c,o.onScrollbarYChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(YE,{"data-orientation":"vertical",...s,ref:u,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":sh(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const m=o.viewport.scrollTop+d.deltaY;e.onWheelScroll(m),XE(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Kd(i.paddingTop),paddingEnd:Kd(i.paddingBottom)}})}})}),[dU,HE]=UE(Xn),YE=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...m}=e,y=cn(Xn,r),[x,g]=v.useState(null),_=Ke(t,A=>g(A)),p=v.useRef(null),h=v.useRef(""),w=y.viewport,C=n.content-n.viewport,j=Dt(d),E=Dt(c),R=oh(f,10);function P(A){if(p.current){const L=A.clientX-p.current.left,q=A.clientY-p.current.top;u({x:L,y:q})}}return v.useEffect(()=>{const A=L=>{const q=L.target;(x==null?void 0:x.contains(q))&&j(L,C)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[w,x,C,j]),v.useEffect(E,[n,E]),wa(x,R),wa(y.content,R),l.jsx(dU,{scope:r,scrollbar:x,hasThumb:s,onThumbChange:Dt(o),onThumbPointerUp:Dt(i),onThumbPositionChange:E,onThumbPointerDown:Dt(a),children:l.jsx(Re.div,{...m,ref:_,style:{position:"absolute",...m.style},onPointerDown:ce(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),p.current=x.getBoundingClientRect(),h.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),P(A))}),onPointerMove:ce(e.onPointerMove,P),onPointerUp:ce(e.onPointerUp,A=>{const L=A.target;L.hasPointerCapture(A.pointerId)&&L.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=h.current,y.viewport&&(y.viewport.style.scrollBehavior=""),p.current=null})})})}),Zd="ScrollAreaThumb",ZE=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=HE(Zd,e.__scopeScrollArea);return l.jsx(ur,{present:r||s.hasThumb,children:l.jsx(fU,{ref:t,...n})})}),fU=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,o=cn(Zd,r),i=HE(Zd,r),{onThumbPositionChange:a}=i,c=Ke(t,f=>i.onThumbChange(f)),u=v.useRef(),d=oh(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const f=o.viewport;if(f){const m=()=>{if(d(),!u.current){const y=mU(f,a);u.current=y,a()}};return a(),f.addEventListener("scroll",m),()=>f.removeEventListener("scroll",m)}},[o.viewport,d,a]),l.jsx(Re.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ce(e.onPointerDownCapture,f=>{const y=f.target.getBoundingClientRect(),x=f.clientX-y.left,g=f.clientY-y.top;i.onThumbPointerDown({x,y:g})}),onPointerUp:ce(e.onPointerUp,i.onThumbPointerUp)})});ZE.displayName=Zd;var wy="ScrollAreaCorner",KE=v.forwardRef((e,t)=>{const r=cn(wy,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?l.jsx(hU,{...e,ref:t}):null});KE.displayName=wy;var hU=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=cn(wy,r),[o,i]=v.useState(0),[a,c]=v.useState(0),u=!!(o&&a);return wa(s.scrollbarX,()=>{var f;const d=((f=s.scrollbarX)==null?void 0:f.offsetHeight)||0;s.onCornerHeightChange(d),c(d)}),wa(s.scrollbarY,()=>{var f;const d=((f=s.scrollbarY)==null?void 0:f.offsetWidth)||0;s.onCornerWidthChange(d),i(d)}),u?l.jsx(Re.div,{...n,ref:t,style:{width:o,height:a,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Kd(e){return e?parseInt(e,10):0}function GE(e,t){const r=e/t;return isNaN(r)?0:r}function sh(e){const t=GE(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function pU(e,t,r,n="ltr"){const s=sh(r),o=s/2,i=t||o,a=s-i,c=r.scrollbar.paddingStart+i,u=r.scrollbar.size-r.scrollbar.paddingEnd-a,d=r.content-r.viewport,f=n==="ltr"?[0,d]:[d*-1,0];return qE([c,u],f)(e)}function yw(e,t,r="ltr"){const n=sh(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,i=t.content-t.viewport,a=o-n,c=r==="ltr"?[0,i]:[i*-1,0],u=Tm(e,c);return qE([0,i],[0,a])(u)}function qE(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function XE(e,t){return e>0&&e{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function s(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,a=r.top!==o.top;(i||a)&&t(),r=o,n=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(n)};function oh(e,t){const r=Dt(e),n=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),v.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function wa(e,t){const r=Dt(t);Jt(()=>{let n=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(n),s.unobserve(e)}}},[e,r])}var QE=$E,gU=WE,vU=KE;const ih=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(QE,{ref:n,className:ae("relative overflow-hidden",e),...r,children:[l.jsx(gU,{className:"h-full w-full rounded-[inherit]",children:t}),l.jsx(JE,{}),l.jsx(vU,{})]}));ih.displayName=QE.displayName;const JE=v.forwardRef(({className:e,orientation:t="vertical",...r},n)=>l.jsx(yy,{ref:n,orientation:t,className:ae("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:l.jsx(ZE,{className:"relative flex-1 rounded-full bg-border"})}));JE.displayName=yy.displayName;const uo=new Map([["tencent",["腾讯云","/imgs/providers/tencent.svg"]],["aliyun",["阿里云","/imgs/providers/aliyun.svg"]],["cloudflare",["Cloudflare","/imgs/providers/cloudflare.svg"]],["namesilo",["Namesilo","/imgs/providers/namesilo.svg"]],["godaddy",["GoDaddy","/imgs/providers/godaddy.svg"]],["qiniu",["七牛云","/imgs/providers/qiniu.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.svg"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),xw=e=>uo.get(e),To=pe.union([pe.literal("aliyun"),pe.literal("tencent"),pe.literal("ssh"),pe.literal("webhook"),pe.literal("cloudflare"),pe.literal("qiniu"),pe.literal("namesilo"),pe.literal("godaddy")],{message:"请选择云服务商"}),Ro=e=>{switch(e){case"aliyun":case"tencent":return"all";case"ssh":case"webhook":case"qiniu":return"deploy";case"cloudflare":case"namesilo":case"godaddy":return"apply";default:return"all"}},yU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,secretId:pe.string().min(1).max(64),secretKey:pe.string().min(1).max(64)});let o={secretId:"",secretKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"tencent",secretId:o.secretId,secretKey:o.secretKey}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{secretId:c.secretId,secretKey:c.secretKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretId"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretId",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretKey",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},xU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,accessKeyId:pe.string().min(1).max(64),accessSecretId:pe.string().min(1).max(64)});let o={accessKeyId:"",accessKeySecret:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"aliyun",accessKeyId:o.accessKeyId,accessSecretId:o.accessKeySecret}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{accessKeyId:c.accessKeyId,accessKeySecret:c.accessSecretId}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessKeyId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKeyId"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKeyId",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessSecretId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKeySecret"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKeySecret",...c})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},mc=v.forwardRef(({className:e,...t},r)=>l.jsx("textarea",{className:ae("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));mc.displayName="Textarea";const _y=({className:e,trigger:t})=>{const{reloadAccessGroups:r}=Kr(),[n,s]=v.useState(!1),o=pe.object({name:pe.string().min(1).max(64)}),i=Tr({resolver:Rr(o),defaultValues:{name:""}}),a=async c=>{try{await S3({name:c.name}),r(),s(!1)}catch(u){Object.entries(u.response.data).forEach(([f,m])=>{i.setError(f,{type:"manual",message:m.message})})}};return l.jsxs(my,{onOpenChange:s,open:n,children:[l.jsx(gy,{asChild:!0,className:ae(e),children:t}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsx(nh,{children:"添加分组"})}),l.jsx("div",{className:"container py-3",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"组名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入组名",...c,type:"text"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})},wU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n,reloadAccessGroups:s,config:{accessGroups:o}}=Kr(),i=v.useRef(null),[a,c]=v.useState(""),u=e&&e.group?e.group:"",d=/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,f=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,m=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,host:pe.string().refine(h=>f.test(h)||d.test(h),{message:"请输入正确的域名或IP"}),group:pe.string().optional(),port:pe.string().min(1).max(5),username:pe.string().min(1).max(64),password:pe.string().min(0).max(64),key:pe.string().min(0).max(20480),keyFile:pe.any().optional(),command:pe.string().min(1).max(2048),certPath:pe.string().min(0).max(2048),keyPath:pe.string().min(0).max(2048)});let y={host:"127.0.0.1",port:"22",username:"root",password:"",key:"",keyFile:"",command:"sudo service nginx restart",certPath:"/etc/nginx/ssl/certificate.crt",keyPath:"/etc/nginx/ssl/private.key"};e&&(y=e.config);const x=Tr({resolver:Rr(m),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"ssh",group:e==null?void 0:e.group,host:y.host,port:y.port,username:y.username,password:y.password,key:y.key,keyFile:y.keyFile,certPath:y.certPath,keyPath:y.keyPath,command:y.command}}),g=async h=>{console.log(h);let w=h.group;w=="emptyId"&&(w="");const C={id:h.id,name:h.name,configType:h.configType,usage:Ro(h.configType),group:w,config:{host:h.host,port:h.port,username:h.username,password:h.password,key:h.key,command:h.command,certPath:h.certPath,keyPath:h.keyPath}};try{const j=await jo(C);t(),C.id=j.id,C.created=j.created,C.updated=j.updated,h.id?n(C):r(C),w!=u&&(u&&await nw({id:u,"access-":C.id}),w&&await nw({id:w,"access+":C.id})),s()}catch(j){Object.entries(j.response.data).forEach(([R,P])=>{x.setError(R,{type:"manual",message:P.message})});return}},_=async h=>{var E;const w=(E=h.target.files)==null?void 0:E[0];if(!w)return;const C=w;c(C.name);const j=await K6(C);x.setValue("key",j)},p=()=>{var h;console.log(i.current),(h=i.current)==null||h.click()};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...x,children:l.jsxs("form",{onSubmit:h=>{h.stopPropagation(),x.handleSubmit(g)(h)},className:"space-y-3",children:[l.jsx(Ne,{control:x.control,name:"name",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"group",render:({field:h})=>l.jsxs(Ce,{children:[l.jsxs(je,{className:"w-full flex justify-between",children:[l.jsx("div",{children:"授权配置组(用于将一个域名证书部署到多个 ssh 主机)"}),l.jsx(_y,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]})})]}),l.jsx(Ee,{children:l.jsxs(Mo,{...h,value:h.value,defaultValue:"emptyId",onValueChange:w=>{x.setValue("group",w)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择分组"})}),l.jsxs(Gs,{children:[l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),o.map(w=>l.jsx(pn,{value:w.id?w.id:"",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:w.name})},w.id))]})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"id",render:({field:h})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"configType",render:({field:h})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...h})}),l.jsx(Se,{})]})}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(Ne,{control:x.control,name:"host",render:({field:h})=>l.jsxs(Ce,{className:"grow",children:[l.jsx(je,{children:"服务器HOST"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Host",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"port",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SSH端口"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Port",...h,type:"number"})}),l.jsx(Se,{})]})})]}),l.jsx(Ne,{control:x.control,name:"username",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"用户名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入用户名",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"password",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入密码",...h,type:"password"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"key",render:({field:h})=>l.jsxs(Ce,{hidden:!0,children:[l.jsx(je,{children:"Key(使用证书登录)"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Key",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"keyFile",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Key(使用证书登录)"}),l.jsx(Ee,{children:l.jsxs("div",{children:[l.jsx(He,{type:"button",variant:"secondary",size:"sm",className:"w-48",onClick:p,children:a||"请选择文件"}),l.jsx(Te,{placeholder:"请输入Key",...h,ref:i,className:"hidden",hidden:!0,type:"file",onChange:_})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"certPath",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"证书上传路径"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入证书上传路径",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"keyPath",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"私钥上传路径"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入私钥上传路径",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"command",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Command"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:"请输入要执行的命令",...h})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},_U=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,url:pe.string().url()});let o={url:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"webhook",url:o.url}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{url:c.url}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"url",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Webhook Url"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Webhook Url",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},bU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,dnsApiToken:pe.string().min(1).max(64)});let o={dnsApiToken:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"cloudflare",dnsApiToken:o.dnsApiToken}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{dnsApiToken:c.dnsApiToken}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"dnsApiToken",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"CLOUD_DNS_API_TOKEN"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入CLOUD_DNS_API_TOKEN",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},SU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,accessKey:pe.string().min(1).max(64),secretKey:pe.string().min(1).max(64)});let o={accessKey:"",secretKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"qiniu",accessKey:o.accessKey,secretKey:o.secretKey}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{accessKey:c.accessKey,secretKey:c.secretKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKey",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretKey",...c})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},kU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,apiKey:pe.string().min(1).max(64)});let o={apiKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"namesilo",apiKey:o.apiKey}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{apiKey:c.apiKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"NAMESILO_API_KEY"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入NAMESILO_API_KEY",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},CU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,apiKey:pe.string().min(1).max(64),apiSecret:pe.string().min(1).max(64)});let o={apiKey:"",apiSecret:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"godaddy",apiKey:o.apiKey,apiSecret:o.apiSecret}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{apiKey:c.apiKey,apiSecret:c.apiSecret}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"GODADDY_API_KEY"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入GODADDY_API_KEY",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiSecret",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"GODADDY_API_SECRET"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入GODADDY_API_SECRET",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})};function jl({trigger:e,op:t,data:r,className:n}){const[s,o]=v.useState(!1),i=Array.from(uo.keys()),[a,c]=v.useState((r==null?void 0:r.configType)||"");let u=l.jsx(l.Fragment,{children:" "});switch(a){case"tencent":u=l.jsx(yU,{data:r,onAfterReq:()=>{o(!1)}});break;case"aliyun":u=l.jsx(xU,{data:r,onAfterReq:()=>{o(!1)}});break;case"ssh":u=l.jsx(wU,{data:r,onAfterReq:()=>{o(!1)}});break;case"webhook":u=l.jsx(_U,{data:r,onAfterReq:()=>{o(!1)}});break;case"cloudflare":u=l.jsx(bU,{data:r,onAfterReq:()=>{o(!1)}});break;case"qiniu":u=l.jsx(SU,{data:r,onAfterReq:()=>{o(!1)}});break;case"namesilo":u=l.jsx(kU,{data:r,onAfterReq:()=>{o(!1)}});break;case"godaddy":u=l.jsx(CU,{data:r,onAfterReq:()=>{o(!1)}});break}const d=f=>f==a?"border-primary":"";return l.jsxs(my,{onOpenChange:o,open:s,children:[l.jsx(gy,{asChild:!0,className:ae(n),children:e}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsxs(nh,{children:[t=="add"?"添加":"编辑","授权"]})}),l.jsx(ih,{className:"max-h-[80vh]",children:l.jsxs("div",{className:"container py-3",children:[l.jsx(Ma,{children:"服务商"}),l.jsxs(Mo,{onValueChange:f=>{console.log(f),c(f)},defaultValue:a,children:[l.jsx(Ks,{className:"mt-3",children:l.jsx(Io,{placeholder:"请选择服务商"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"服务商"}),i.map(f=>{var m,y;return l.jsx(pn,{value:f,children:l.jsxs("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer",d(f)),children:[l.jsx("img",{src:(m=uo.get(f))==null?void 0:m[1],className:"h-6 w-6"}),l.jsx("div",{children:(y=uo.get(f))==null?void 0:y[0]})]})},f)})]})})]}),u]})})]})]})}const jU=({className:e,trigger:t})=>{const{config:{emails:r},setEmails:n}=Kr(),[s,o]=v.useState(!1),i=pe.object({email:pe.string().email()}),a=Tr({resolver:Rr(i),defaultValues:{email:""}}),c=async u=>{if(r.content.emails.includes(u.email)){a.setError("email",{message:"邮箱已存在"});return}const d=[...r.content.emails,u.email];try{const f=await Mc({...r,name:"emails",content:{emails:d}});n(f),a.reset(),a.clearErrors(),o(!1)}catch(f){Object.entries(f.response.data).forEach(([y,x])=>{a.setError(y,{type:"manual",message:x.message})})}};return l.jsxs(my,{onOpenChange:o,open:s,children:[l.jsx(gy,{asChild:!0,className:ae(e),children:t}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsx(nh,{children:"添加邮箱"})}),l.jsx("div",{className:"container py-3",children:l.jsx(Pr,{...a,children:l.jsxs("form",{onSubmit:u=>{console.log(u),u.stopPropagation(),a.handleSubmit(c)(u)},className:"space-y-8",children:[l.jsx(Ne,{control:a.control,name:"email",render:({field:u})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"邮箱"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入邮箱",...u,type:"email"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})},EU=()=>{const{config:{accesses:e,emails:t,accessGroups:r}}=Kr(),[n,s]=v.useState(),o=Nn(),[i,a]=v.useState("base"),[c,u]=v.useState(n?n.targetType:"");v.useEffect(()=>{const p=new URLSearchParams(o.search).get("id");p&&(async()=>{const w=await J6(p);s(w),u(w.targetType)})()},[o.search]);const d=pe.object({id:pe.string().optional(),domain:pe.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,{message:"请输入正确的域名"}),email:pe.string().email().optional(),access:pe.string().regex(/^[a-zA-Z0-9]+$/,{message:"请选择DNS服务商授权配置"}),targetAccess:pe.string().optional(),targetType:pe.string().regex(/^[a-zA-Z0-9-]+$/,{message:"请选择部署服务类型"}),variables:pe.string().optional(),group:pe.string().optional(),nameservers:pe.string().optional()}),f=Tr({resolver:Rr(d),defaultValues:{id:"",domain:"",email:"",access:"",targetAccess:"",targetType:"",variables:"",group:"",nameservers:""}});v.useEffect(()=>{n&&f.reset({id:n.id,domain:n.domain,email:n.email,access:n.access,targetAccess:n.targetAccess,targetType:n.targetType,variables:n.variables,group:n.group,nameservers:n.nameservers})},[n,f]);const m=e.filter(_=>{if(_.usage=="apply")return!1;if(c=="")return!0;const p=c.split("-");return _.configType===p[0]}),{toast:y}=qn(),x=Nr(),g=async _=>{const p=_.group=="emptyId"?"":_.group,h=_.targetAccess==="emptyId"?"":_.targetAccess;if(p==""&&h==""){f.setError("group",{type:"manual",message:"部署授权和部署授权组至少选一个"}),f.setError("targetAccess",{type:"manual",message:"部署授权和部署授权组至少选一个"});return}const w={id:_.id,crontab:"0 0 * * *",domain:_.domain,email:_.email,access:_.access,group:p,targetAccess:h,targetType:_.targetType,variables:_.variables,nameservers:_.nameservers};try{await km(w);let C="域名编辑成功";w.id==""&&(C="域名添加成功"),y({title:"成功",description:C}),x("/domains")}catch(C){Object.entries(C.response.data).forEach(([E,R])=>{f.setError(E,{type:"manual",message:R.message})});return}};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(ay,{}),l.jsxs("div",{className:" h-5 text-muted-foreground",children:[n!=null&&n.id?"编辑":"新增","域名"]}),l.jsxs("div",{className:"mt-5 flex w-full justify-center md:space-x-10 flex-col md:flex-row",children:[l.jsxs("div",{className:"w-full md:w-[200px] text-muted-foreground space-x-3 md:space-y-3 flex-row md:flex-col flex",children:[l.jsx("div",{className:ae("cursor-pointer text-right",i==="base"?"text-primary":""),onClick:()=>{a("base")},children:"基础设置"}),l.jsx("div",{className:ae("cursor-pointer text-right",i==="advance"?"text-primary":""),onClick:()=>{a("advance")},children:"高级设置"})]}),l.jsx("div",{className:"w-full md:w-[35em] bg-gray-100 dark:bg-gray-900 p-5 rounded mt-3 md:mt-0",children:l.jsx(Pr,{...f,children:l.jsxs("form",{onSubmit:f.handleSubmit(g),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:f.control,name:"domain",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsx(je,{children:"域名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入域名",..._})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"email",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"flex w-full justify-between",children:[l.jsx("div",{children:"Email(申请证书需要提供邮箱)"}),l.jsx(jU,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]})})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,onValueChange:p=>{f.setValue("email",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择邮箱"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"邮箱列表"}),t.content.emails.map(p=>l.jsx(pn,{value:p,children:l.jsx("div",{children:p})},p))]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"access",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"flex w-full justify-between",children:[l.jsx("div",{children:"DNS 服务商授权配置"}),l.jsx(jl,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]}),op:"add"})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,onValueChange:p=>{f.setValue("access",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择授权配置"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"服务商授权配置"}),e.filter(p=>p.usage!="deploy").map(p=>{var h;return l.jsx(pn,{value:p.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=uo.get(p.configType))==null?void 0:h[1]}),l.jsx("div",{children:p.name})]})},p.id)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"targetType",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsx(je,{children:"部署服务类型"}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,onValueChange:p=>{u(p),f.setValue("targetType",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择部署服务类型"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"部署服务类型"}),rU.map(p=>{var h,w;return l.jsx(pn,{value:p,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=Mm.get(p))==null?void 0:h[1]}),l.jsx("div",{children:(w=Mm.get(p))==null?void 0:w[0]})]})},p)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"targetAccess",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"w-full flex justify-between",children:[l.jsx("div",{children:"部署服务商授权配置"}),l.jsx(jl,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]}),op:"add"})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,onValueChange:p=>{f.setValue("targetAccess",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择授权配置"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsxs(Wi,{children:["服务商授权配置",f.getValues().targetAccess]}),l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:"flex items-center space-x-2",children:"--"})}),m.map(p=>{var h;return l.jsx(pn,{value:p.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=uo.get(p.configType))==null?void 0:h[1]}),l.jsx("div",{children:p.name})]})},p.id)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"group",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance"||c!="ssh",children:[l.jsx(je,{className:"w-full flex justify-between",children:l.jsx("div",{children:"部署配置组(用于将一个域名证书部署到多个 ssh 主机)"})}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,defaultValue:"emptyId",onValueChange:p=>{f.setValue("group",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择分组"})}),l.jsxs(Gs,{children:[l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),r.filter(p=>{var h;return p.expand&&((h=p.expand)==null?void 0:h.access.length)>0}).map(p=>l.jsx(pn,{value:p.id?p.id:"",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:p.name})},p.id))]})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"variables",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance",children:[l.jsx(je,{children:"变量"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:`可在SSH部署中使用,形如: +\0`,ne+=o(z,2),ne+=E.magic,ne+=o(w,2),ne+=o(C,2),ne+=o(Q.crc32,4),ne+=o(Q.compressedSize,4),ne+=o(Q.uncompressedSize,4),ne+=o(P.length,2),ne+=o(V.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ne+P+V,dirRecord:f.CENTRAL_FILE_HEADER+o(fe,2)+ne+o(q.length,2)+"\0\0\0\0"+o($,4)+o(_,4)+P+V+q}}var a=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),d=r("../crc32"),f=r("../signature");function m(y,x,g,_){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=g,this.encodeFileName=_,this.streamFiles=y,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(m,c),m.prototype.push=function(y){var x=y.meta.percent||0,g=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(y):(this.bytesWritten+=y.data.length,c.prototype.push.call(this,{data:y.data,meta:{currentFile:this.currentFile,percent:g?(x+100*(g-_-1))/g:100}}))},m.prototype.openedSource=function(y){this.currentSourceOffset=this.bytesWritten,this.currentFile=y.file.name;var x=this.streamFiles&&!y.file.dir;if(x){var g=i(y,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(y){this.accumulate=!1;var x=this.streamFiles&&!y.file.dir,g=i(y,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),x)this.push({data:function(_){return f.DATA_DESCRIPTOR+o(_.crc32,4)+o(_.compressedSize,4)+o(_.uncompressedSize,4)}(y),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var y=this.bytesWritten,x=0;x=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=a,u},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=i},{"../utils":32}],19:[function(r,n,s){var o=r("./Uint8ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var o=r("./DataReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var o=r("./ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var o=r("../utils"),i=r("../support"),a=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),d=r("./Uint8ArrayReader");n.exports=function(f){var m=o.getTypeOf(f);return o.checkSupport(m),m!=="string"||i.uint8array?m==="nodebuffer"?new u(f):i.uint8array?new d(o.transformTo("uint8array",f)):new a(o.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,s){var o=r("./GenericWorker"),i=r("../utils");function a(c){o.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(a,o),a.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var o=r("./GenericWorker"),i=r("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(a,o),a.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}o.inherits(a,i),a.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}i.prototype.processChunk.call(this,c)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(c){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=o.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}o.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,s){function o(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var c=0;c "+i:i}},n.exports=o},{}],29:[function(r,n,s){var o=r("../utils"),i=r("./ConvertWorker"),a=r("./GenericWorker"),c=r("../base64"),u=r("../support"),d=r("../external"),f=null;if(u.nodestream)try{f=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(x,g){return new d.Promise(function(_,p){var h=[],w=x._internalType,C=x._outputType,j=x._mimeType;x.on("data",function(E,R){h.push(E),g&&g(R)}).on("error",function(E){h=[],p(E)}).on("end",function(){try{var E=function(R,P,A){switch(R){case"blob":return o.newBlob(o.transformTo("arraybuffer",P),A);case"base64":return c.encode(P);default:return o.transformTo(R,P)}}(C,function(R,P){var A,L=0,q=null,N=0;for(A=0;A"u")s.blob=!1;else{var o=new ArrayBuffer(0);try{s.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(o),s.blob=i.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var o=r("./utils"),i=r("./support"),a=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function m(){c.call(this,"utf-8 encode")}s.utf8encode=function(y){return i.nodebuffer?a.newBufferFrom(y,"utf-8"):function(x){var g,_,p,h,w,C=x.length,j=0;for(h=0;h>>6:(_<65536?g[w++]=224|_>>>12:(g[w++]=240|_>>>18,g[w++]=128|_>>>12&63),g[w++]=128|_>>>6&63),g[w++]=128|63&_);return g}(y)},s.utf8decode=function(y){return i.nodebuffer?o.transformTo("nodebuffer",y).toString("utf-8"):function(x){var g,_,p,h,w=x.length,C=new Array(2*w);for(g=_=0;g>10&1023,C[_++]=56320|1023&p)}return C.length!==_&&(C.subarray?C=C.subarray(0,_):C.length=_),o.applyFromCharCode(C)}(y=o.transformTo(i.uint8array?"uint8array":"array",y))},o.inherits(f,c),f.prototype.processChunk=function(y){var x=o.transformTo(i.uint8array?"uint8array":"array",y.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var g=x;(x=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),x.set(g,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var _=function(h,w){var C;for((w=w||h.length)>h.length&&(w=h.length),C=w-1;0<=C&&(192&h[C])==128;)C--;return C<0||C===0?w:C+u[h[C]]>w?C:w}(x),p=x;_!==x.length&&(i.uint8array?(p=x.subarray(0,_),this.leftOver=x.subarray(_,x.length)):(p=x.slice(0,_),this.leftOver=x.slice(_,x.length))),this.push({data:s.utf8decode(p),meta:y.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=f,o.inherits(m,c),m.prototype.processChunk=function(y){this.push({data:s.utf8encode(y.data),meta:y.meta})},s.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var o=r("./support"),i=r("./base64"),a=r("./nodejsUtils"),c=r("./external");function u(g){return g}function d(g,_){for(var p=0;p>8;this.dir=!!(16&this.externalFileAttributes),y==0&&(this.dosPermissions=63&this.externalFileAttributes),y==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var y=o(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=y.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=y.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=y.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=y.readInt(4))}},readExtraFields:function(y){var x,g,_,p=y.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});y.index+4>>6:(y<65536?m[_++]=224|y>>>12:(m[_++]=240|y>>>18,m[_++]=128|y>>>12&63),m[_++]=128|y>>>6&63),m[_++]=128|63&y);return m},s.buf2binstring=function(f){return d(f,f.length)},s.binstring2buf=function(f){for(var m=new o.Buf8(f.length),y=0,x=m.length;y>10&1023,h[x++]=56320|1023&g)}return d(h,x)},s.utf8border=function(f,m){var y;for((m=m||f.length)>f.length&&(m=f.length),y=m-1;0<=y&&(192&f[y])==128;)y--;return y<0||y===0?m:y+c[f[y]]>m?y:m}},{"./common":41}],43:[function(r,n,s){n.exports=function(o,i,a,c){for(var u=65535&o|0,d=o>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3>>1:i>>>1;a[c]=i}return a}();n.exports=function(i,a,c,u){var d=o,f=u+c;i^=-1;for(var m=u;m>>8^d[255&(i^a[m])];return-1^i}},{}],46:[function(r,n,s){var o,i=r("../utils/common"),a=r("./trees"),c=r("./adler32"),u=r("./crc32"),d=r("./messages"),f=0,m=4,y=0,x=-2,g=-1,_=4,p=2,h=8,w=9,C=286,j=30,E=19,R=2*C+1,P=15,A=3,L=258,q=L+A+1,N=42,F=113,b=1,V=2,te=3,W=4;function Z(k,J){return k.msg=d[J],J}function I(k){return(k<<1)-(4k.avail_out&&(K=k.avail_out),K!==0&&(i.arraySet(k.output,J.pending_buf,J.pending_out,K,k.next_out),k.next_out+=K,J.pending_out+=K,k.total_out+=K,k.avail_out-=K,J.pending-=K,J.pending===0&&(J.pending_out=0))}function $(k,J){a._tr_flush_block(k,0<=k.block_start?k.block_start:-1,k.strstart-k.block_start,J),k.block_start=k.strstart,z(k.strm)}function fe(k,J){k.pending_buf[k.pending++]=J}function ne(k,J){k.pending_buf[k.pending++]=J>>>8&255,k.pending_buf[k.pending++]=255&J}function se(k,J){var K,D,S=k.max_chain_length,T=k.strstart,O=k.prev_length,Y=k.nice_match,M=k.strstart>k.w_size-q?k.strstart-(k.w_size-q):0,H=k.window,X=k.w_mask,ee=k.prev,me=k.strstart+L,Ye=H[T+O-1],Ue=H[T+O];k.prev_length>=k.good_match&&(S>>=2),Y>k.lookahead&&(Y=k.lookahead);do if(H[(K=J)+O]===Ue&&H[K+O-1]===Ye&&H[K]===H[T]&&H[++K]===H[T+1]){T+=2,K++;do;while(H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&TM&&--S!=0);return O<=k.lookahead?O:k.lookahead}function Oe(k){var J,K,D,S,T,O,Y,M,H,X,ee=k.w_size;do{if(S=k.window_size-k.lookahead-k.strstart,k.strstart>=ee+(ee-q)){for(i.arraySet(k.window,k.window,ee,ee,0),k.match_start-=ee,k.strstart-=ee,k.block_start-=ee,J=K=k.hash_size;D=k.head[--J],k.head[J]=ee<=D?D-ee:0,--K;);for(J=K=ee;D=k.prev[--J],k.prev[J]=ee<=D?D-ee:0,--K;);S+=ee}if(k.strm.avail_in===0)break;if(O=k.strm,Y=k.window,M=k.strstart+k.lookahead,H=S,X=void 0,X=O.avail_in,H=A)for(T=k.strstart-k.insert,k.ins_h=k.window[T],k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A)if(D=a._tr_tally(k,k.strstart-k.match_start,k.match_length-A),k.lookahead-=k.match_length,k.match_length<=k.max_lazy_match&&k.lookahead>=A){for(k.match_length--;k.strstart++,k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A&&k.match_length<=k.prev_length){for(S=k.strstart+k.lookahead-A,D=a._tr_tally(k,k.strstart-1-k.prev_match,k.prev_length-A),k.lookahead-=k.prev_length-1,k.prev_length-=2;++k.strstart<=S&&(k.ins_h=(k.ins_h<k.pending_buf_size-5&&(K=k.pending_buf_size-5);;){if(k.lookahead<=1){if(Oe(k),k.lookahead===0&&J===f)return b;if(k.lookahead===0)break}k.strstart+=k.lookahead,k.lookahead=0;var D=k.block_start+K;if((k.strstart===0||k.strstart>=D)&&(k.lookahead=k.strstart-D,k.strstart=D,$(k,!1),k.strm.avail_out===0)||k.strstart-k.block_start>=k.w_size-q&&($(k,!1),k.strm.avail_out===0))return b}return k.insert=0,J===m?($(k,!0),k.strm.avail_out===0?te:W):(k.strstart>k.block_start&&($(k,!1),k.strm.avail_out),b)}),new ke(4,4,8,4,he),new ke(4,5,16,8,he),new ke(4,6,32,32,he),new ke(4,4,16,16,ye),new ke(8,16,32,32,ye),new ke(8,16,128,128,ye),new ke(8,32,128,256,ye),new ke(32,128,258,1024,ye),new ke(32,258,258,4096,ye)],s.deflateInit=function(k,J){return nt(k,J,h,15,8,0)},s.deflateInit2=nt,s.deflateReset=Pe,s.deflateResetKeep=Me,s.deflateSetHeader=function(k,J){return k&&k.state?k.state.wrap!==2?x:(k.state.gzhead=J,y):x},s.deflate=function(k,J){var K,D,S,T;if(!k||!k.state||5>8&255),fe(D,D.gzhead.time>>16&255),fe(D,D.gzhead.time>>24&255),fe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),fe(D,255&D.gzhead.os),D.gzhead.extra&&D.gzhead.extra.length&&(fe(D,255&D.gzhead.extra.length),fe(D,D.gzhead.extra.length>>8&255)),D.gzhead.hcrc&&(k.adler=u(k.adler,D.pending_buf,D.pending,0)),D.gzindex=0,D.status=69):(fe(D,0),fe(D,0),fe(D,0),fe(D,0),fe(D,0),fe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),fe(D,3),D.status=F);else{var O=h+(D.w_bits-8<<4)<<8;O|=(2<=D.strategy||D.level<2?0:D.level<6?1:D.level===6?2:3)<<6,D.strstart!==0&&(O|=32),O+=31-O%31,D.status=F,ne(D,O),D.strstart!==0&&(ne(D,k.adler>>>16),ne(D,65535&k.adler)),k.adler=1}if(D.status===69)if(D.gzhead.extra){for(S=D.pending;D.gzindex<(65535&D.gzhead.extra.length)&&(D.pending!==D.pending_buf_size||(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending!==D.pending_buf_size));)fe(D,255&D.gzhead.extra[D.gzindex]),D.gzindex++;D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),D.gzindex===D.gzhead.extra.length&&(D.gzindex=0,D.status=73)}else D.status=73;if(D.status===73)if(D.gzhead.name){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){T=1;break}T=D.gzindexS&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),T===0&&(D.gzindex=0,D.status=91)}else D.status=91;if(D.status===91)if(D.gzhead.comment){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){T=1;break}T=D.gzindexS&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),T===0&&(D.status=103)}else D.status=103;if(D.status===103&&(D.gzhead.hcrc?(D.pending+2>D.pending_buf_size&&z(k),D.pending+2<=D.pending_buf_size&&(fe(D,255&k.adler),fe(D,k.adler>>8&255),k.adler=0,D.status=F)):D.status=F),D.pending!==0){if(z(k),k.avail_out===0)return D.last_flush=-1,y}else if(k.avail_in===0&&I(J)<=I(K)&&J!==m)return Z(k,-5);if(D.status===666&&k.avail_in!==0)return Z(k,-5);if(k.avail_in!==0||D.lookahead!==0||J!==f&&D.status!==666){var Y=D.strategy===2?function(M,H){for(var X;;){if(M.lookahead===0&&(Oe(M),M.lookahead===0)){if(H===f)return b;break}if(M.match_length=0,X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===m?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):D.strategy===3?function(M,H){for(var X,ee,me,Ye,Ue=M.window;;){if(M.lookahead<=L){if(Oe(M),M.lookahead<=L&&H===f)return b;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=A&&0M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=A?(X=a._tr_tally(M,1,M.match_length-A),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===m?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):o[D.level].func(D,J);if(Y!==te&&Y!==W||(D.status=666),Y===b||Y===te)return k.avail_out===0&&(D.last_flush=-1),y;if(Y===V&&(J===1?a._tr_align(D):J!==5&&(a._tr_stored_block(D,0,0,!1),J===3&&(Q(D.head),D.lookahead===0&&(D.strstart=0,D.block_start=0,D.insert=0))),z(k),k.avail_out===0))return D.last_flush=-1,y}return J!==m?y:D.wrap<=0?1:(D.wrap===2?(fe(D,255&k.adler),fe(D,k.adler>>8&255),fe(D,k.adler>>16&255),fe(D,k.adler>>24&255),fe(D,255&k.total_in),fe(D,k.total_in>>8&255),fe(D,k.total_in>>16&255),fe(D,k.total_in>>24&255)):(ne(D,k.adler>>>16),ne(D,65535&k.adler)),z(k),0=K.w_size&&(T===0&&(Q(K.head),K.strstart=0,K.block_start=0,K.insert=0),H=new i.Buf8(K.w_size),i.arraySet(H,J,X-K.w_size,K.w_size,0),J=H,X=K.w_size),O=k.avail_in,Y=k.next_in,M=k.input,k.avail_in=X,k.next_in=0,k.input=J,Oe(K);K.lookahead>=A;){for(D=K.strstart,S=K.lookahead-(A-1);K.ins_h=(K.ins_h<>>=A=P>>>24,w-=A,(A=P>>>16&255)===0)V[d++]=65535&P;else{if(!(16&A)){if(!(64&A)){P=C[(65535&P)+(h&(1<>>=A,w-=A),w<15&&(h+=b[c++]<>>=A=P>>>24,w-=A,!(16&(A=P>>>16&255))){if(!(64&A)){P=j[(65535&P)+(h&(1<>>=A,w-=A,(A=d-f)>3,h&=(1<<(w-=L<<3))-1,o.next_in=c,o.next_out=d,o.avail_in=c>>24&255)+(N>>>8&65280)+((65280&N)<<8)+((255&N)<<24)}function h(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(N){var F;return N&&N.state?(F=N.state,N.total_in=N.total_out=F.total=0,N.msg="",F.wrap&&(N.adler=1&F.wrap),F.mode=x,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new o.Buf32(g),F.distcode=F.distdyn=new o.Buf32(_),F.sane=1,F.back=-1,m):y}function C(N){var F;return N&&N.state?((F=N.state).wsize=0,F.whave=0,F.wnext=0,w(N)):y}function j(N,F){var b,V;return N&&N.state?(V=N.state,F<0?(b=0,F=-F):(b=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15=W.wsize?(o.arraySet(W.window,F,b-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(V<(te=W.wsize-W.wnext)&&(te=V),o.arraySet(W.window,F,b-V,te,W.wnext),(V-=te)?(o.arraySet(W.window,F,b-V,V,0),W.wnext=V,W.whave=W.wsize):(W.wnext+=te,W.wnext===W.wsize&&(W.wnext=0),W.whave>>8&255,b.check=a(b.check,T,2,0),$=z=0,b.mode=2;break}if(b.flags=0,b.head&&(b.head.done=!1),!(1&b.wrap)||(((255&z)<<8)+(z>>8))%31){N.msg="incorrect header check",b.mode=30;break}if((15&z)!=8){N.msg="unknown compression method",b.mode=30;break}if($-=4,k=8+(15&(z>>>=4)),b.wbits===0)b.wbits=k;else if(k>b.wbits){N.msg="invalid window size",b.mode=30;break}b.dmax=1<>8&1),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0,b.mode=3;case 3:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.time=z),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,T[2]=z>>>16&255,T[3]=z>>>24&255,b.check=a(b.check,T,4,0)),$=z=0,b.mode=4;case 4:for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.xflags=255&z,b.head.os=z>>8),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0,b.mode=5;case 5:if(1024&b.flags){for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.length=z,b.head&&(b.head.extra_len=z),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0}else b.head&&(b.head.extra=null);b.mode=6;case 6:if(1024&b.flags&&(I<(se=b.length)&&(se=I),se&&(b.head&&(k=b.head.extra_len-b.length,b.head.extra||(b.head.extra=new Array(b.head.extra_len)),o.arraySet(b.head.extra,V,W,se,k)),512&b.flags&&(b.check=a(b.check,V,se,W)),I-=se,W+=se,b.length-=se),b.length))break e;b.length=0,b.mode=7;case 7:if(2048&b.flags){if(I===0)break e;for(se=0;k=V[W+se++],b.head&&k&&b.length<65536&&(b.head.name+=String.fromCharCode(k)),k&&se>9&1,b.head.done=!0),N.adler=b.check=0,b.mode=12;break;case 10:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}N.adler=b.check=p(z),$=z=0,b.mode=11;case 11:if(b.havedict===0)return N.next_out=Z,N.avail_out=Q,N.next_in=W,N.avail_in=I,b.hold=z,b.bits=$,2;N.adler=b.check=1,b.mode=12;case 12:if(F===5||F===6)break e;case 13:if(b.last){z>>>=7&$,$-=7&$,b.mode=27;break}for(;$<3;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}switch(b.last=1&z,$-=1,3&(z>>>=1)){case 0:b.mode=14;break;case 1:if(L(b),b.mode=20,F!==6)break;z>>>=2,$-=2;break e;case 2:b.mode=17;break;case 3:N.msg="invalid block type",b.mode=30}z>>>=2,$-=2;break;case 14:for(z>>>=7&$,$-=7&$;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if((65535&z)!=(z>>>16^65535)){N.msg="invalid stored block lengths",b.mode=30;break}if(b.length=65535&z,$=z=0,b.mode=15,F===6)break e;case 15:b.mode=16;case 16:if(se=b.length){if(I>>=5,$-=5,b.ndist=1+(31&z),z>>>=5,$-=5,b.ncode=4+(15&z),z>>>=4,$-=4,286>>=3,$-=3}for(;b.have<19;)b.lens[O[b.have++]]=0;if(b.lencode=b.lendyn,b.lenbits=7,K={bits:b.lenbits},J=u(0,b.lens,0,19,b.lencode,0,b.work,K),b.lenbits=K.bits,J){N.msg="invalid code lengths set",b.mode=30;break}b.have=0,b.mode=19;case 19:for(;b.have>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(Fe<16)z>>>=ye,$-=ye,b.lens[b.have++]=Fe;else{if(Fe===16){for(D=ye+2;$>>=ye,$-=ye,b.have===0){N.msg="invalid bit length repeat",b.mode=30;break}k=b.lens[b.have-1],se=3+(3&z),z>>>=2,$-=2}else if(Fe===17){for(D=ye+3;$>>=ye)),z>>>=3,$-=3}else{for(D=ye+7;$>>=ye)),z>>>=7,$-=7}if(b.have+se>b.nlen+b.ndist){N.msg="invalid bit length repeat",b.mode=30;break}for(;se--;)b.lens[b.have++]=k}}if(b.mode===30)break;if(b.lens[256]===0){N.msg="invalid code -- missing end-of-block",b.mode=30;break}if(b.lenbits=9,K={bits:b.lenbits},J=u(d,b.lens,0,b.nlen,b.lencode,0,b.work,K),b.lenbits=K.bits,J){N.msg="invalid literal/lengths set",b.mode=30;break}if(b.distbits=6,b.distcode=b.distdyn,K={bits:b.distbits},J=u(f,b.lens,b.nlen,b.ndist,b.distcode,0,b.work,K),b.distbits=K.bits,J){N.msg="invalid distances set",b.mode=30;break}if(b.mode=20,F===6)break e;case 20:b.mode=21;case 21:if(6<=I&&258<=Q){N.next_out=Z,N.avail_out=Q,N.next_in=W,N.avail_in=I,b.hold=z,b.bits=$,c(N,ne),Z=N.next_out,te=N.output,Q=N.avail_out,W=N.next_in,V=N.input,I=N.avail_in,z=b.hold,$=b.bits,b.mode===12&&(b.back=-1);break}for(b.back=0;ke=(S=b.lencode[z&(1<>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(ke&&!(240&ke)){for(Me=ye,Pe=ke,nt=Fe;ke=(S=b.lencode[nt+((z&(1<>Me)])>>>16&255,Fe=65535&S,!(Me+(ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Me,$-=Me,b.back+=Me}if(z>>>=ye,$-=ye,b.back+=ye,b.length=Fe,ke===0){b.mode=26;break}if(32&ke){b.back=-1,b.mode=12;break}if(64&ke){N.msg="invalid literal/length code",b.mode=30;break}b.extra=15&ke,b.mode=22;case 22:if(b.extra){for(D=b.extra;$>>=b.extra,$-=b.extra,b.back+=b.extra}b.was=b.length,b.mode=23;case 23:for(;ke=(S=b.distcode[z&(1<>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(!(240&ke)){for(Me=ye,Pe=ke,nt=Fe;ke=(S=b.distcode[nt+((z&(1<>Me)])>>>16&255,Fe=65535&S,!(Me+(ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Me,$-=Me,b.back+=Me}if(z>>>=ye,$-=ye,b.back+=ye,64&ke){N.msg="invalid distance code",b.mode=30;break}b.offset=Fe,b.extra=15&ke,b.mode=24;case 24:if(b.extra){for(D=b.extra;$>>=b.extra,$-=b.extra,b.back+=b.extra}if(b.offset>b.dmax){N.msg="invalid distance too far back",b.mode=30;break}b.mode=25;case 25:if(Q===0)break e;if(se=ne-Q,b.offset>se){if((se=b.offset-se)>b.whave&&b.sane){N.msg="invalid distance too far back",b.mode=30;break}Oe=se>b.wnext?(se-=b.wnext,b.wsize-se):b.wnext-se,se>b.length&&(se=b.length),he=b.window}else he=te,Oe=Z-b.offset,se=b.length;for(QR?(A=Oe[he+_[F]],$[fe+_[F]]):(A=96,0),h=1<>Z)+(w-=h)]=P<<24|A<<16|L|0,w!==0;);for(h=1<>=1;if(h!==0?(z&=h-1,z+=h):z=0,F++,--ne[N]==0){if(N===V)break;N=f[m+_[F]]}if(te>>7)]}function fe(S,T){S.pending_buf[S.pending++]=255&T,S.pending_buf[S.pending++]=T>>>8&255}function ne(S,T,O){S.bi_valid>p-O?(S.bi_buf|=T<>p-S.bi_valid,S.bi_valid+=O-p):(S.bi_buf|=T<>>=1,O<<=1,0<--T;);return O>>>1}function he(S,T,O){var Y,M,H=new Array(_+1),X=0;for(Y=1;Y<=_;Y++)H[Y]=X=X+O[Y-1]<<1;for(M=0;M<=T;M++){var ee=S[2*M+1];ee!==0&&(S[2*M]=Oe(H[ee]++,ee))}}function ye(S){var T;for(T=0;T>1;1<=O;O--)Me(S,H,O);for(M=me;O=S.heap[1],S.heap[1]=S.heap[S.heap_len--],Me(S,H,1),Y=S.heap[1],S.heap[--S.heap_max]=O,S.heap[--S.heap_max]=Y,H[2*M]=H[2*O]+H[2*Y],S.depth[M]=(S.depth[O]>=S.depth[Y]?S.depth[O]:S.depth[Y])+1,H[2*O+1]=H[2*Y+1]=M,S.heap[1]=M++,Me(S,H,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(Ue,jt){var Gr,Ht,Qn,at,Jn,es,qr=jt.dyn_tree,$c=jt.max_code,Vc=jt.stat_desc.static_tree,hi=jt.stat_desc.has_stree,Wc=jt.stat_desc.extra_bits,pi=jt.stat_desc.extra_base,Pn=jt.stat_desc.max_length,Is=0;for(at=0;at<=_;at++)Ue.bl_count[at]=0;for(qr[2*Ue.heap[Ue.heap_max]+1]=0,Gr=Ue.heap_max+1;Gr>=7;M>>=1)if(1&Ye&&ee.dyn_ltree[2*me]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return a;for(me=32;me>>3,(H=S.static_len+3+7>>>3)<=M&&(M=H)):M=H=O+5,O+4<=M&&T!==-1?D(S,T,O,Y):S.strategy===4||H===M?(ne(S,2+(Y?1:0),3),Pe(S,q,N)):(ne(S,4+(Y?1:0),3),function(ee,me,Ye,Ue){var jt;for(ne(ee,me-257,5),ne(ee,Ye-1,5),ne(ee,Ue-4,4),jt=0;jt>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&T,S.pending_buf[S.l_buf+S.last_lit]=255&O,S.last_lit++,T===0?S.dyn_ltree[2*O]++:(S.matches++,T--,S.dyn_ltree[2*(b[O]+f+1)]++,S.dyn_dtree[2*$(T)]++),S.last_lit===S.lit_bufsize-1},s._tr_align=function(S){ne(S,2,3),se(S,w,q),function(T){T.bi_valid===16?(fe(T,T.bi_buf),T.bi_buf=0,T.bi_valid=0):8<=T.bi_valid&&(T.pending_buf[T.pending++]=255&T.bi_buf,T.bi_buf>>=8,T.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(r,n,s){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,n,s){(function(o){(function(i,a){if(!i.setImmediate){var c,u,d,f,m=1,y={},x=!1,g=i.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(i);_=_&&_.setTimeout?_:i,c={}.toString.call(i.process)==="[object process]"?function(C){process.nextTick(function(){h(C)})}:function(){if(i.postMessage&&!i.importScripts){var C=!0,j=i.onmessage;return i.onmessage=function(){C=!1},i.postMessage("","*"),i.onmessage=j,C}}()?(f="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",w,!1):i.attachEvent("onmessage",w),function(C){i.postMessage(f+C,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){h(C.data)},function(C){d.port2.postMessage(C)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(C){var j=g.createElement("script");j.onreadystatechange=function(){h(C),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(C){setTimeout(h,0,C)},_.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var j=new Array(arguments.length-1),E=0;E"u"?o===void 0?this:o:self)}).call(this,typeof Kc<"u"?Kc:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(bj);var H6=bj.exports;const Y6=Lm(H6);function Z6(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{n.result?t(n.result.toString()):r("No content found")},n.onerror=()=>r(n.error),n.readAsText(e)})}const K6=async(e,t)=>{const r=new Y6;t.forEach(o=>{r.file(o.name,o.content)});const n=await r.generateAsync({type:"blob"}),s=document.createElement("a");s.href=URL.createObjectURL(n),s.download=e,s.click()},ga=e=>{const t=new Date(e);return new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"Asia/Shanghai"}).format(t)},G6=e=>ga(e).split(" ")[0];function Sj(e){const t=new Date;t.setUTCDate(t.getUTCDate()+e);const r=t.getUTCFullYear(),n=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0"),o=String(t.getUTCHours()).padStart(2,"0"),i=String(t.getUTCMinutes()).padStart(2,"0"),a=String(t.getUTCSeconds()).padStart(2,"0");return`${r}-${n}-${s} ${o}:${i}:${a}`}const q6=async e=>{let t=1;e.page&&(t=e.page);let r=2;e.perPage&&(r=e.perPage);const n=st();let s="";return e.state==="enabled"?s="enabled=true":e.state==="disabled"?s="enabled=false":e.state==="expired"&&(s=n.filter("expiredAt<{:expiredAt}",{expiredAt:Sj(15)})),n.collection("domains").getList(t,r,{sort:"-created",expand:"lastDeployment",filter:s})},X6=async()=>{const e=st(),t=await e.collection("domains").getList(1,1,{}),r=await e.collection("domains").getList(1,1,{filter:e.filter("expiredAt<{:expiredAt}",{expiredAt:Sj(15)})}),n=await e.collection("domains").getList(1,1,{filter:"enabled=true"}),s=await e.collection("domains").getList(1,1,{filter:"enabled=false"});return{total:t.totalItems,expired:r.totalItems,enabled:n.totalItems,disabled:s.totalItems}},Q6=async e=>await st().collection("domains").getOne(e),km=async e=>e.id?await st().collection("domains").update(e.id,e):await st().collection("domains").create(e),J6=async e=>await st().collection("domains").delete(e),ez=(e,t)=>st().collection("domains").subscribe(e,r=>{r.action==="update"&&t(r.record)},{expand:"lastDeployment"}),tz=e=>{st().collection("domains").unsubscribe(e)},rz=()=>{const e=qn(),t=Nr(),r=Nn(),n=new URLSearchParams(r.search),s=n.get("page"),o=n.get("state"),[i,a]=v.useState(0),c=()=>{t("/edit")},u=w=>{n.set("page",w.toString()),t(`?${n.toString()}`)},d=w=>{t(`/edit?id=${w}`)},f=w=>{t(`/history?domain=${w}`)},m=async w=>{try{await J6(w),x(y.filter(C=>C.id!==w))}catch(C){console.error("Error deleting domain:",C)}},[y,x]=v.useState([]);v.useEffect(()=>{(async()=>{const C=await q6({page:s?Number(s):1,perPage:10,state:o||""});x(C.items),a(C.totalPages)})()},[s,o]);const g=async w=>{const C=y.filter(P=>P.id===w),j=C[0].enabled,E=C[0];E.enabled=!j,await km(E);const R=y.map(P=>P.id===w?{...P,checked:!j}:P);x(R)},_=async w=>{try{tz(w.id),ez(w.id,C=>{console.log(C);const j=y.map(E=>E.id===C.id?{...C}:E);x(j)}),w.rightnow=!0,await km(w),e.toast({title:"操作成功",description:"已发起部署,请稍后查看部署日志。"})}catch{e.toast({title:"执行失败",description:l.jsxs(l.Fragment,{children:["执行失败,请查看",l.jsx(fr,{to:`/history?domain=${w.id}`,className:"underline text-blue-500",children:"部署日志"}),"查看详情。"]}),variant:"destructive"})}},p=async w=>{await _({...w,deployed:!1})},h=async w=>{const C=`${w.id}-${w.domain}.zip`,j=[{name:`${w.domain}.pem`,content:w.certificate?w.certificate:""},{name:`${w.domain}.key`,content:w.privateKey?w.privateKey:""}];await K6(C,j)};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(ay,{}),l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:"域名列表"}),l.jsx(He,{onClick:c,children:"新增域名"})]}),y.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-36",children:"域名"}),l.jsx("div",{className:"w-40",children:"有效期限"}),l.jsx("div",{className:"w-32",children:"最近执行状态"}),l.jsx("div",{className:"w-64",children:"最近执行阶段"}),l.jsx("div",{className:"w-40 sm:ml-2",children:"最近执行时间"}),l.jsx("div",{className:"w-24",children:"是否启用"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"域名"}),y.map(w=>{var C,j,E,R;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-36 w-full pt-1 sm:pt-0 flex items-center",children:w.domain}),l.jsx("div",{className:"sm:w-40 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx("div",{children:w.expiredAt?l.jsxs(l.Fragment,{children:[l.jsx("div",{children:"有效期90天"}),l.jsxs("div",{children:[G6(w.expiredAt),"到期"]})]}):"---"})}),l.jsx("div",{className:"sm:w-32 w-full pt-1 sm:pt-0 flex items-center",children:w.lastDeployedAt&&((C=w.expand)!=null&&C.lastDeployment)?l.jsx(l.Fragment,{children:l.jsx(Gv,{deployment:w.expand.lastDeployment})}):"---"}),l.jsx("div",{className:"sm:w-64 w-full pt-1 sm:pt-0 flex items-center",children:w.lastDeployedAt&&((j=w.expand)!=null&&j.lastDeployment)?l.jsx(Hv,{phase:(E=w.expand.lastDeployment)==null?void 0:E.phase,phaseSuccess:(R=w.expand.lastDeployment)==null?void 0:R.phaseSuccess}):"---"}),l.jsx("div",{className:"sm:w-40 pt-1 sm:pt-0 sm:ml-2 flex items-center",children:w.lastDeployedAt?ga(w.lastDeployedAt):"---"}),l.jsx("div",{className:"sm:w-24 flex items-center",children:l.jsx(Zv,{children:l.jsxs(gC,{children:[l.jsx(vC,{children:l.jsx(Lc,{checked:w.enabled,onCheckedChange:()=>{g(w.id)}})}),l.jsx(Kv,{children:l.jsx("div",{className:"border rounded-sm px-3 bg-background text-muted-foreground text-xs",children:w.enabled?"禁用":"启用"})})]})})}),l.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[l.jsx(He,{variant:"link",className:"p-0",onClick:()=>f(w.id),children:"部署历史"}),l.jsxs(na,{when:!!w.enabled,children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>_(w),children:"立即部署"})]}),l.jsxs(na,{when:!!(w.enabled&&w.deployed),children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>p(w),children:"强行部署"})]}),l.jsxs(na,{when:!!w.expiredAt,children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>h(w),children:"下载"})]}),!w.enabled&&l.jsxs(l.Fragment,{children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsxs(WC,{children:[l.jsx(BC,{asChild:!0,children:l.jsx(He,{variant:"link",className:"p-0",children:"删除"})}),l.jsxs(qv,{children:[l.jsxs(Xv,{children:[l.jsx(Jv,{children:"删除域名"}),l.jsx(ey,{children:"确定要删除域名吗?"})]}),l.jsxs(Qv,{children:[l.jsx(ry,{children:"取消"}),l.jsx(ty,{onClick:()=>{m(w.id)},children:"确认"})]})]})]}),l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>d(w.id),children:"编辑"})]})]})]},w.id)}),l.jsx(SC,{totalPages:i,currentPage:s?Number(s):1,onPageChange:w=>{u(w)}})]}):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(rm,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),l.jsx(He,{onClick:c,className:"mt-3",children:"添加域名"})]})})]})})},Te=v.forwardRef(({className:e,type:t,...r},n)=>l.jsx("input",{type:t,className:ae("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));Te.displayName="Input";var Fc=e=>e.type==="checkbox",$i=e=>e instanceof Date,pr=e=>e==null;const kj=e=>typeof e=="object";var qt=e=>!pr(e)&&!Array.isArray(e)&&kj(e)&&!$i(e),Cj=e=>qt(e)&&e.target?Fc(e.target)?e.target.checked:e.target.value:e,nz=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,jj=(e,t)=>e.has(nz(t)),sz=e=>{const t=e.constructor&&e.constructor.prototype;return qt(t)&&t.hasOwnProperty("isPrototypeOf")},ly=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function br(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(ly&&(e instanceof Blob||e instanceof FileList))&&(r||qt(e)))if(t=r?[]:{},!r&&!sz(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=br(e[n]));else return e;return t}var Kf=e=>Array.isArray(e)?e.filter(Boolean):[],Ft=e=>e===void 0,ue=(e,t,r)=>{if(!t||!qt(e))return r;const n=Kf(t.split(/[,[\].]+?/)).reduce((s,o)=>pr(s)?s:s[o],e);return Ft(n)||n===e?Ft(e[t])?r:e[t]:n},Fn=e=>typeof e=="boolean",cy=e=>/^\w*$/.test(e),Ej=e=>Kf(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ft=(e,t,r)=>{let n=-1;const s=cy(t)?[t]:Ej(t),o=s.length,i=o-1;for(;++nWe.useContext(Nj),oz=e=>{const{children:t,...r}=e;return We.createElement(Nj.Provider,{value:r},t)};var Tj=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==gn.all&&(t._proxyFormState[i]=!n||gn.all),r&&(r[i]=!0),e[i]}});return s},Or=e=>qt(e)&&!Object.keys(e).length,Rj=(e,t,r,n)=>{r(e);const{name:s,...o}=e;return Or(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!n||gn.all))},kl=e=>Array.isArray(e)?e:[e],Pj=(e,t,r)=>!e||!t||e===t||kl(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n)));function uy(e){const t=We.useRef(e);t.current=e,We.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}function iz(e){const t=Gf(),{control:r=t.control,disabled:n,name:s,exact:o}=e||{},[i,a]=We.useState(r._formState),c=We.useRef(!0),u=We.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=We.useRef(s);return d.current=s,uy({disabled:n,next:f=>c.current&&Pj(d.current,f.name,o)&&Rj(f,u.current,r._updateFormState)&&a({...r._formState,...f}),subject:r._subjects.state}),We.useEffect(()=>(c.current=!0,u.current.isValid&&r._updateValid(!0),()=>{c.current=!1}),[r]),Tj(i,r,u.current,!1)}var Un=e=>typeof e=="string",Aj=(e,t,r,n,s)=>Un(e)?(n&&t.watch.add(e),ue(r,e,s)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),ue(r,o))):(n&&(t.watchAll=!0),r);function az(e){const t=Gf(),{control:r=t.control,name:n,defaultValue:s,disabled:o,exact:i}=e||{},a=We.useRef(n);a.current=n,uy({disabled:o,subject:r._subjects.values,next:d=>{Pj(a.current,d.name,i)&&u(br(Aj(a.current,r._names,d.values||r._formValues,!1,s)))}});const[c,u]=We.useState(r._getWatch(n,s));return We.useEffect(()=>r._removeUnmounted()),c}function lz(e){const t=Gf(),{name:r,disabled:n,control:s=t.control,shouldUnregister:o}=e,i=jj(s._names.array,r),a=az({control:s,name:r,defaultValue:ue(s._formValues,r,ue(s._defaultValues,r,e.defaultValue)),exact:!0}),c=iz({control:s,name:r}),u=We.useRef(s.register(r,{...e.rules,value:a,...Fn(e.disabled)?{disabled:e.disabled}:{}}));return We.useEffect(()=>{const d=s._options.shouldUnregister||o,f=(m,y)=>{const x=ue(s._fields,m);x&&x._f&&(x._f.mount=y)};if(f(r,!0),d){const m=br(ue(s._options.defaultValues,r));ft(s._defaultValues,r,m),Ft(ue(s._formValues,r))&&ft(s._formValues,r,m)}return()=>{(i?d&&!s._state.action:d)?s.unregister(r):f(r,!1)}},[r,s,i,o]),We.useEffect(()=>{ue(s._fields,r)&&s._updateDisabledField({disabled:n,fields:s._fields,name:r,value:ue(s._fields,r)._f.value})},[n,r,s]),{field:{name:r,value:a,...Fn(n)||c.disabled?{disabled:c.disabled||n}:{},onChange:We.useCallback(d=>u.current.onChange({target:{value:Cj(d),name:r},type:Od.CHANGE}),[r]),onBlur:We.useCallback(()=>u.current.onBlur({target:{value:ue(s._formValues,r),name:r},type:Od.BLUR}),[r,s]),ref:d=>{const f=ue(s._fields,r);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:m=>d.setCustomValidity(m),reportValidity:()=>d.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ue(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!ue(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ue(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ue(c.validatingFields,r)},error:{enumerable:!0,get:()=>ue(c.errors,r)}})}}const cz=e=>e.render(lz(e));var Dj=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},aw=e=>({isOnSubmit:!e||e===gn.onSubmit,isOnBlur:e===gn.onBlur,isOnChange:e===gn.onChange,isOnAll:e===gn.all,isOnTouch:e===gn.onTouched}),lw=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Cl=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const o=ue(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!n)break;if(i.ref&&t(i.ref,i.name)&&!n)break;Cl(a,t)}else qt(a)&&Cl(a,t)}}};var uz=(e,t,r)=>{const n=kl(ue(e,r));return ft(n,"root",t[r]),ft(e,r,n),e},dy=e=>e.type==="file",eo=e=>typeof e=="function",Md=e=>{if(!ly)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ku=e=>Un(e),fy=e=>e.type==="radio",Id=e=>e instanceof RegExp;const cw={value:!1,isValid:!1},uw={value:!0,isValid:!0};var Oj=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ft(e[0].attributes.value)?Ft(e[0].value)||e[0].value===""?uw:{value:e[0].value,isValid:!0}:uw:cw}return cw};const dw={isValid:!1,value:null};var Mj=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,dw):dw;function fw(e,t,r="validate"){if(Ku(e)||Array.isArray(e)&&e.every(Ku)||Fn(e)&&!e)return{type:r,message:Ku(e)?e:"",ref:t}}var ki=e=>qt(e)&&!Id(e)?e:{value:e,message:""},hw=async(e,t,r,n,s)=>{const{ref:o,refs:i,required:a,maxLength:c,minLength:u,min:d,max:f,pattern:m,validate:y,name:x,valueAsNumber:g,mount:_,disabled:p}=e._f,h=ue(t,x);if(!_||p)return{};const w=i?i[0]:o,C=N=>{n&&w.reportValidity&&(w.setCustomValidity(Fn(N)?"":N||""),w.reportValidity())},j={},E=fy(o),R=Fc(o),P=E||R,A=(g||dy(o))&&Ft(o.value)&&Ft(h)||Md(o)&&o.value===""||h===""||Array.isArray(h)&&!h.length,L=Dj.bind(null,x,r,j),q=(N,F,b,V=ss.maxLength,te=ss.minLength)=>{const W=N?F:b;j[x]={type:N?V:te,message:W,ref:o,...L(N?V:te,W)}};if(s?!Array.isArray(h)||!h.length:a&&(!P&&(A||pr(h))||Fn(h)&&!h||R&&!Oj(i).isValid||E&&!Mj(i).isValid)){const{value:N,message:F}=Ku(a)?{value:!!a,message:a}:ki(a);if(N&&(j[x]={type:ss.required,message:F,ref:w,...L(ss.required,F)},!r))return C(F),j}if(!A&&(!pr(d)||!pr(f))){let N,F;const b=ki(f),V=ki(d);if(!pr(h)&&!isNaN(h)){const te=o.valueAsNumber||h&&+h;pr(b.value)||(N=te>b.value),pr(V.value)||(F=tenew Date(new Date().toDateString()+" "+Q),Z=o.type=="time",I=o.type=="week";Un(b.value)&&h&&(N=Z?W(h)>W(b.value):I?h>b.value:te>new Date(b.value)),Un(V.value)&&h&&(F=Z?W(h)+N.value,V=!pr(F.value)&&h.length<+F.value;if((b||V)&&(q(b,N.message,F.message),!r))return C(j[x].message),j}if(m&&!A&&Un(h)){const{value:N,message:F}=ki(m);if(Id(N)&&!h.match(N)&&(j[x]={type:ss.pattern,message:F,ref:o,...L(ss.pattern,F)},!r))return C(F),j}if(y){if(eo(y)){const N=await y(h,t),F=fw(N,w);if(F&&(j[x]={...F,...L(ss.validate,F.message)},!r))return C(F.message),j}else if(qt(y)){let N={};for(const F in y){if(!Or(N)&&!r)break;const b=fw(await y[F](h,t),w,F);b&&(N={...b,...L(F,b.message)},C(b.message),r&&(j[x]=N))}if(!Or(N)&&(j[x]={ref:w,...N},!r))return j}}return C(!0),j};function dz(e,t){const r=t.slice(0,-1).length;let n=0;for(;n{let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}},Ld=e=>pr(e)||!kj(e);function Bo(e,t){if(Ld(e)||Ld(t))return e===t;if($i(e)&&$i(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const s of r){const o=e[s];if(!n.includes(s))return!1;if(s!=="ref"){const i=t[s];if($i(o)&&$i(i)||qt(o)&&qt(i)||Array.isArray(o)&&Array.isArray(i)?!Bo(o,i):o!==i)return!1}}return!0}var Ij=e=>e.type==="select-multiple",hz=e=>fy(e)||Fc(e),np=e=>Md(e)&&e.isConnected,Lj=e=>{for(const t in e)if(eo(e[t]))return!0;return!1};function Fd(e,t={}){const r=Array.isArray(e);if(qt(e)||r)for(const n in e)Array.isArray(e[n])||qt(e[n])&&!Lj(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Fd(e[n],t[n])):pr(e[n])||(t[n]=!0);return t}function Fj(e,t,r){const n=Array.isArray(e);if(qt(e)||n)for(const s in e)Array.isArray(e[s])||qt(e[s])&&!Lj(e[s])?Ft(t)||Ld(r[s])?r[s]=Array.isArray(e[s])?Fd(e[s],[]):{...Fd(e[s])}:Fj(e[s],pr(t)?{}:t[s],r[s]):r[s]=!Bo(e[s],t[s]);return r}var Cu=(e,t)=>Fj(e,t,Fd(t)),zj=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ft(e)?e:t?e===""?NaN:e&&+e:r&&Un(e)?new Date(e):n?n(e):e;function sp(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return dy(t)?t.files:fy(t)?Mj(e.refs).value:Ij(t)?[...t.selectedOptions].map(({value:r})=>r):Fc(t)?Oj(e.refs).value:zj(Ft(t.value)?e.ref.value:t.value,e)}var pz=(e,t,r,n)=>{const s={};for(const o of e){const i=ue(t,o);i&&ft(s,o,i._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Ja=e=>Ft(e)?e:Id(e)?e.source:qt(e)?Id(e.value)?e.value.source:e.value:e,mz=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function pw(e,t,r){const n=ue(e,r);if(n||cy(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),i=ue(t,o),a=ue(e,o);if(i&&!Array.isArray(i)&&r!==o)return{name:r};if(a&&a.type)return{name:o,error:a};s.pop()}return{name:r}}var gz=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,vz=(e,t)=>!Kf(ue(e,t)).length&&Yt(e,t);const yz={mode:gn.onSubmit,reValidateMode:gn.onChange,shouldFocusError:!0};function xz(e={}){let t={...yz,...e},r={submitCount:0,isDirty:!1,isLoading:eo(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=qt(t.defaultValues)||qt(t.values)?br(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:br(s),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:rp(),array:rp(),state:rp()},m=aw(t.mode),y=aw(t.reValidateMode),x=t.criteriaMode===gn.all,g=S=>T=>{clearTimeout(u),u=setTimeout(S,T)},_=async S=>{if(d.isValid||S){const T=t.resolver?Or((await P()).errors):await L(n,!0);T!==r.isValid&&f.state.next({isValid:T})}},p=(S,T)=>{(d.isValidating||d.validatingFields)&&((S||Array.from(a.mount)).forEach(O=>{O&&(T?ft(r.validatingFields,O,T):Yt(r.validatingFields,O))}),f.state.next({validatingFields:r.validatingFields,isValidating:!Or(r.validatingFields)}))},h=(S,T=[],O,Y,M=!0,H=!0)=>{if(Y&&O){if(i.action=!0,H&&Array.isArray(ue(n,S))){const X=O(ue(n,S),Y.argA,Y.argB);M&&ft(n,S,X)}if(H&&Array.isArray(ue(r.errors,S))){const X=O(ue(r.errors,S),Y.argA,Y.argB);M&&ft(r.errors,S,X),vz(r.errors,S)}if(d.touchedFields&&H&&Array.isArray(ue(r.touchedFields,S))){const X=O(ue(r.touchedFields,S),Y.argA,Y.argB);M&&ft(r.touchedFields,S,X)}d.dirtyFields&&(r.dirtyFields=Cu(s,o)),f.state.next({name:S,isDirty:N(S,T),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ft(o,S,T)},w=(S,T)=>{ft(r.errors,S,T),f.state.next({errors:r.errors})},C=S=>{r.errors=S,f.state.next({errors:r.errors,isValid:!1})},j=(S,T,O,Y)=>{const M=ue(n,S);if(M){const H=ue(o,S,Ft(O)?ue(s,S):O);Ft(H)||Y&&Y.defaultChecked||T?ft(o,S,T?H:sp(M._f)):V(S,H),i.mount&&_()}},E=(S,T,O,Y,M)=>{let H=!1,X=!1;const ee={name:S},me=!!(ue(n,S)&&ue(n,S)._f&&ue(n,S)._f.disabled);if(!O||Y){d.isDirty&&(X=r.isDirty,r.isDirty=ee.isDirty=N(),H=X!==ee.isDirty);const Ye=me||Bo(ue(s,S),T);X=!!(!me&&ue(r.dirtyFields,S)),Ye||me?Yt(r.dirtyFields,S):ft(r.dirtyFields,S,!0),ee.dirtyFields=r.dirtyFields,H=H||d.dirtyFields&&X!==!Ye}if(O){const Ye=ue(r.touchedFields,S);Ye||(ft(r.touchedFields,S,O),ee.touchedFields=r.touchedFields,H=H||d.touchedFields&&Ye!==O)}return H&&M&&f.state.next(ee),H?ee:{}},R=(S,T,O,Y)=>{const M=ue(r.errors,S),H=d.isValid&&Fn(T)&&r.isValid!==T;if(e.delayError&&O?(c=g(()=>w(S,O)),c(e.delayError)):(clearTimeout(u),c=null,O?ft(r.errors,S,O):Yt(r.errors,S)),(O?!Bo(M,O):M)||!Or(Y)||H){const X={...Y,...H&&Fn(T)?{isValid:T}:{},errors:r.errors,name:S};r={...r,...X},f.state.next(X)}},P=async S=>{p(S,!0);const T=await t.resolver(o,t.context,pz(S||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return p(S),T},A=async S=>{const{errors:T}=await P(S);if(S)for(const O of S){const Y=ue(T,O);Y?ft(r.errors,O,Y):Yt(r.errors,O)}else r.errors=T;return T},L=async(S,T,O={valid:!0})=>{for(const Y in S){const M=S[Y];if(M){const{_f:H,...X}=M;if(H){const ee=a.array.has(H.name);p([Y],!0);const me=await hw(M,o,x,t.shouldUseNativeValidation&&!T,ee);if(p([Y]),me[H.name]&&(O.valid=!1,T))break;!T&&(ue(me,H.name)?ee?uz(r.errors,me,H.name):ft(r.errors,H.name,me[H.name]):Yt(r.errors,H.name))}X&&await L(X,T,O)}}return O.valid},q=()=>{for(const S of a.unMount){const T=ue(n,S);T&&(T._f.refs?T._f.refs.every(O=>!np(O)):!np(T._f.ref))&&Oe(S)}a.unMount=new Set},N=(S,T)=>(S&&T&&ft(o,S,T),!Bo(z(),s)),F=(S,T,O)=>Aj(S,a,{...i.mount?o:Ft(T)?s:Un(S)?{[S]:T}:T},O,T),b=S=>Kf(ue(i.mount?o:s,S,e.shouldUnregister?ue(s,S,[]):[])),V=(S,T,O={})=>{const Y=ue(n,S);let M=T;if(Y){const H=Y._f;H&&(!H.disabled&&ft(o,S,zj(T,H)),M=Md(H.ref)&&pr(T)?"":T,Ij(H.ref)?[...H.ref.options].forEach(X=>X.selected=M.includes(X.value)):H.refs?Fc(H.ref)?H.refs.length>1?H.refs.forEach(X=>(!X.defaultChecked||!X.disabled)&&(X.checked=Array.isArray(M)?!!M.find(ee=>ee===X.value):M===X.value)):H.refs[0]&&(H.refs[0].checked=!!M):H.refs.forEach(X=>X.checked=X.value===M):dy(H.ref)?H.ref.value="":(H.ref.value=M,H.ref.type||f.values.next({name:S,values:{...o}})))}(O.shouldDirty||O.shouldTouch)&&E(S,M,O.shouldTouch,O.shouldDirty,!0),O.shouldValidate&&Q(S)},te=(S,T,O)=>{for(const Y in T){const M=T[Y],H=`${S}.${Y}`,X=ue(n,H);(a.array.has(S)||!Ld(M)||X&&!X._f)&&!$i(M)?te(H,M,O):V(H,M,O)}},W=(S,T,O={})=>{const Y=ue(n,S),M=a.array.has(S),H=br(T);ft(o,S,H),M?(f.array.next({name:S,values:{...o}}),(d.isDirty||d.dirtyFields)&&O.shouldDirty&&f.state.next({name:S,dirtyFields:Cu(s,o),isDirty:N(S,H)})):Y&&!Y._f&&!pr(H)?te(S,H,O):V(S,H,O),lw(S,a)&&f.state.next({...r}),f.values.next({name:i.mount?S:void 0,values:{...o}})},Z=async S=>{i.mount=!0;const T=S.target;let O=T.name,Y=!0;const M=ue(n,O),H=()=>T.type?sp(M._f):Cj(S),X=ee=>{Y=Number.isNaN(ee)||ee===ue(o,O,ee)};if(M){let ee,me;const Ye=H(),Ue=S.type===Od.BLUR||S.type===Od.FOCUS_OUT,jt=!mz(M._f)&&!t.resolver&&!ue(r.errors,O)&&!M._f.deps||gz(Ue,ue(r.touchedFields,O),r.isSubmitted,y,m),Gr=lw(O,a,Ue);ft(o,O,Ye),Ue?(M._f.onBlur&&M._f.onBlur(S),c&&c(0)):M._f.onChange&&M._f.onChange(S);const Ht=E(O,Ye,Ue,!1),Qn=!Or(Ht)||Gr;if(!Ue&&f.values.next({name:O,type:S.type,values:{...o}}),jt)return d.isValid&&_(),Qn&&f.state.next({name:O,...Gr?{}:Ht});if(!Ue&&Gr&&f.state.next({...r}),t.resolver){const{errors:at}=await P([O]);if(X(Ye),Y){const Jn=pw(r.errors,n,O),es=pw(at,n,Jn.name||O);ee=es.error,O=es.name,me=Or(at)}}else p([O],!0),ee=(await hw(M,o,x,t.shouldUseNativeValidation))[O],p([O]),X(Ye),Y&&(ee?me=!1:d.isValid&&(me=await L(n,!0)));Y&&(M._f.deps&&Q(M._f.deps),R(O,me,ee,Ht))}},I=(S,T)=>{if(ue(r.errors,T)&&S.focus)return S.focus(),1},Q=async(S,T={})=>{let O,Y;const M=kl(S);if(t.resolver){const H=await A(Ft(S)?S:M);O=Or(H),Y=S?!M.some(X=>ue(H,X)):O}else S?(Y=(await Promise.all(M.map(async H=>{const X=ue(n,H);return await L(X&&X._f?{[H]:X}:X)}))).every(Boolean),!(!Y&&!r.isValid)&&_()):Y=O=await L(n);return f.state.next({...!Un(S)||d.isValid&&O!==r.isValid?{}:{name:S},...t.resolver||!S?{isValid:O}:{},errors:r.errors}),T.shouldFocus&&!Y&&Cl(n,I,S?M:a.mount),Y},z=S=>{const T={...i.mount?o:s};return Ft(S)?T:Un(S)?ue(T,S):S.map(O=>ue(T,O))},$=(S,T)=>({invalid:!!ue((T||r).errors,S),isDirty:!!ue((T||r).dirtyFields,S),error:ue((T||r).errors,S),isValidating:!!ue(r.validatingFields,S),isTouched:!!ue((T||r).touchedFields,S)}),fe=S=>{S&&kl(S).forEach(T=>Yt(r.errors,T)),f.state.next({errors:S?r.errors:{}})},ne=(S,T,O)=>{const Y=(ue(n,S,{_f:{}})._f||{}).ref,M=ue(r.errors,S)||{},{ref:H,message:X,type:ee,...me}=M;ft(r.errors,S,{...me,...T,ref:Y}),f.state.next({name:S,errors:r.errors,isValid:!1}),O&&O.shouldFocus&&Y&&Y.focus&&Y.focus()},se=(S,T)=>eo(S)?f.values.subscribe({next:O=>S(F(void 0,T),O)}):F(S,T,!0),Oe=(S,T={})=>{for(const O of S?kl(S):a.mount)a.mount.delete(O),a.array.delete(O),T.keepValue||(Yt(n,O),Yt(o,O)),!T.keepError&&Yt(r.errors,O),!T.keepDirty&&Yt(r.dirtyFields,O),!T.keepTouched&&Yt(r.touchedFields,O),!T.keepIsValidating&&Yt(r.validatingFields,O),!t.shouldUnregister&&!T.keepDefaultValue&&Yt(s,O);f.values.next({values:{...o}}),f.state.next({...r,...T.keepDirty?{isDirty:N()}:{}}),!T.keepIsValid&&_()},he=({disabled:S,name:T,field:O,fields:Y,value:M})=>{if(Fn(S)&&i.mount||S){const H=S?void 0:Ft(M)?sp(O?O._f:ue(Y,T)._f):M;ft(o,T,H),E(T,H,!1,!1,!0)}},ye=(S,T={})=>{let O=ue(n,S);const Y=Fn(T.disabled);return ft(n,S,{...O||{},_f:{...O&&O._f?O._f:{ref:{name:S}},name:S,mount:!0,...T}}),a.mount.add(S),O?he({field:O,disabled:T.disabled,name:S,value:T.value}):j(S,!0,T.value),{...Y?{disabled:T.disabled}:{},...t.progressive?{required:!!T.required,min:Ja(T.min),max:Ja(T.max),minLength:Ja(T.minLength),maxLength:Ja(T.maxLength),pattern:Ja(T.pattern)}:{},name:S,onChange:Z,onBlur:Z,ref:M=>{if(M){ye(S,T),O=ue(n,S);const H=Ft(M.value)&&M.querySelectorAll&&M.querySelectorAll("input,select,textarea")[0]||M,X=hz(H),ee=O._f.refs||[];if(X?ee.find(me=>me===H):H===O._f.ref)return;ft(n,S,{_f:{...O._f,...X?{refs:[...ee.filter(np),H,...Array.isArray(ue(s,S))?[{}]:[]],ref:{type:H.type,name:S}}:{ref:H}}}),j(S,!1,void 0,H)}else O=ue(n,S,{}),O._f&&(O._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(jj(a.array,S)&&i.action)&&a.unMount.add(S)}}},ke=()=>t.shouldFocusError&&Cl(n,I,a.mount),Fe=S=>{Fn(S)&&(f.state.next({disabled:S}),Cl(n,(T,O)=>{const Y=ue(n,O);Y&&(T.disabled=Y._f.disabled||S,Array.isArray(Y._f.refs)&&Y._f.refs.forEach(M=>{M.disabled=Y._f.disabled||S}))},0,!1))},Me=(S,T)=>async O=>{let Y;O&&(O.preventDefault&&O.preventDefault(),O.persist&&O.persist());let M=br(o);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:H,values:X}=await P();r.errors=H,M=X}else await L(n);if(Yt(r.errors,"root"),Or(r.errors)){f.state.next({errors:{}});try{await S(M,O)}catch(H){Y=H}}else T&&await T({...r.errors},O),ke(),setTimeout(ke);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Or(r.errors)&&!Y,submitCount:r.submitCount+1,errors:r.errors}),Y)throw Y},Pe=(S,T={})=>{ue(n,S)&&(Ft(T.defaultValue)?W(S,br(ue(s,S))):(W(S,T.defaultValue),ft(s,S,br(T.defaultValue))),T.keepTouched||Yt(r.touchedFields,S),T.keepDirty||(Yt(r.dirtyFields,S),r.isDirty=T.defaultValue?N(S,br(ue(s,S))):N()),T.keepError||(Yt(r.errors,S),d.isValid&&_()),f.state.next({...r}))},nt=(S,T={})=>{const O=S?br(S):s,Y=br(O),M=Or(S),H=M?s:Y;if(T.keepDefaultValues||(s=O),!T.keepValues){if(T.keepDirtyValues)for(const X of a.mount)ue(r.dirtyFields,X)?ft(H,X,ue(o,X)):W(X,ue(H,X));else{if(ly&&Ft(S))for(const X of a.mount){const ee=ue(n,X);if(ee&&ee._f){const me=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(Md(me)){const Ye=me.closest("form");if(Ye){Ye.reset();break}}}}n={}}o=e.shouldUnregister?T.keepDefaultValues?br(s):{}:br(H),f.array.next({values:{...H}}),f.values.next({values:{...H}})}a={mount:T.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!T.keepIsValid||!!T.keepDirtyValues,i.watch=!!e.shouldUnregister,f.state.next({submitCount:T.keepSubmitCount?r.submitCount:0,isDirty:M?!1:T.keepDirty?r.isDirty:!!(T.keepDefaultValues&&!Bo(S,s)),isSubmitted:T.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:M?{}:T.keepDirtyValues?T.keepDefaultValues&&o?Cu(s,o):r.dirtyFields:T.keepDefaultValues&&S?Cu(s,S):T.keepDirty?r.dirtyFields:{},touchedFields:T.keepTouched?r.touchedFields:{},errors:T.keepErrors?r.errors:{},isSubmitSuccessful:T.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},k=(S,T)=>nt(eo(S)?S(o):S,T);return{control:{register:ye,unregister:Oe,getFieldState:$,handleSubmit:Me,setError:ne,_executeSchema:P,_getWatch:F,_getDirty:N,_updateValid:_,_removeUnmounted:q,_updateFieldArray:h,_updateDisabledField:he,_getFieldArray:b,_reset:nt,_resetDefaultValues:()=>eo(t.defaultValues)&&t.defaultValues().then(S=>{k(S,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:S=>{r={...r,...S}},_disableForm:Fe,_subjects:f,_proxyFormState:d,_setErrors:C,get _fields(){return n},get _formValues(){return o},get _state(){return i},set _state(S){i=S},get _defaultValues(){return s},get _names(){return a},set _names(S){a=S},get _formState(){return r},set _formState(S){r=S},get _options(){return t},set _options(S){t={...t,...S}}},trigger:Q,register:ye,handleSubmit:Me,watch:se,setValue:W,getValues:z,reset:k,resetField:Pe,clearErrors:fe,unregister:Oe,setError:ne,setFocus:(S,T={})=>{const O=ue(n,S),Y=O&&O._f;if(Y){const M=Y.refs?Y.refs[0]:Y.ref;M.focus&&(M.focus(),T.shouldSelect&&M.select())}},getFieldState:$}}function Tr(e={}){const t=We.useRef(),r=We.useRef(),[n,s]=We.useState({isDirty:!1,isValidating:!1,isLoading:eo(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:eo(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...xz(e),formState:n});const o=t.current.control;return o._options=e,uy({subject:o._subjects.state,next:i=>{Rj(i,o._proxyFormState,o._updateFormState,!0)&&s({...o._formState})}}),We.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),We.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==n.isDirty&&o._subjects.state.next({isDirty:i})}},[o,n.isDirty]),We.useEffect(()=>{e.values&&!Bo(e.values,r.current)?(o._reset(e.values,o._options.resetOptions),r.current=e.values,s(i=>({...i}))):o._resetDefaultValues()},[e.values,o]),We.useEffect(()=>{e.errors&&o._setErrors(e.errors)},[e.errors,o]),We.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),We.useEffect(()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[e.shouldUnregister,o]),t.current.formState=Tj(n,o),t.current}const mw=(e,t,r)=>{if(e&&"reportValidity"in e){const n=ue(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Uj=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?mw(n.ref,r,e):n.refs&&n.refs.forEach(s=>mw(s,r,e))}},wz=(e,t)=>{t.shouldUseNativeValidation&&Uj(e,t);const r={};for(const n in e){const s=ue(t.fields,n),o=Object.assign(e[n]||{},{ref:s&&s.ref});if(_z(t.names||Object.keys(e),n)){const i=Object.assign({},ue(r,n));ft(i,"root",o),ft(r,n,i)}else ft(r,n,o)}return r},_z=(e,t)=>e.some(r=>r.startsWith(t+"."));var bz=function(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=r[i].types,u=c&&c[n.code];r[i]=Dj(i,t,r,s,u?[].concat(u,n.message):n.message)}e.shift()}return r},Rr=function(e,t,r){return r===void 0&&(r={}),function(n,s,o){try{return Promise.resolve(function(i,a){try{var c=Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(u){return o.shouldUseNativeValidation&&Uj({},o),{errors:{},values:r.raw?n:u}})}catch(u){return a(u)}return c&&c.then?c.then(void 0,a):c}(0,function(i){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(i))return{values:{},errors:wz(bz(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}}},ot;(function(e){e.assertEqual=s=>s;function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,e.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(const a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},e.find=(s,o)=>{for(const i of s)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(ot||(ot={}));var Cm;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Cm||(Cm={}));const we=ot.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zs=e=>{switch(typeof e){case"undefined":return we.undefined;case"string":return we.string;case"number":return isNaN(e)?we.nan:we.number;case"boolean":return we.boolean;case"function":return we.function;case"bigint":return we.bigint;case"symbol":return we.symbol;case"object":return Array.isArray(e)?we.array:e===null?we.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?we.promise:typeof Map<"u"&&e instanceof Map?we.map:typeof Set<"u"&&e instanceof Set?we.set:typeof Date<"u"&&e instanceof Date?we.date:we.object;default:return we.unknown}},ie=ot.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Sz=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Wr extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const r=t||function(o){return o.message},n={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;cr.message){const r={},n=[];for(const s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Wr.create=e=>new Wr(e);const va=(e,t)=>{let r;switch(e.code){case ie.invalid_type:e.received===we.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ot.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${ot.joinValues(e.keys,", ")}`;break;case ie.invalid_union:r="Invalid input";break;case ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ot.joinValues(e.options)}`;break;case ie.invalid_enum_value:r=`Invalid enum value. Expected ${ot.joinValues(e.options)}, received '${e.received}'`;break;case ie.invalid_arguments:r="Invalid function arguments";break;case ie.invalid_return_type:r="Invalid function return type";break;case ie.invalid_date:r="Invalid date";break;case ie.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ot.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case ie.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case ie.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case ie.custom:r="Invalid input";break;case ie.invalid_intersection_types:r="Intersection results could not be merged";break;case ie.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ie.not_finite:r="Number must be finite";break;default:r=t.defaultError,ot.assertNever(e)}return{message:r}};let $j=va;function kz(e){$j=e}function zd(){return $j}const Ud=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)a=u(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}},Cz=[];function ge(e,t){const r=zd(),n=Ud({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===va?void 0:va].filter(s=>!!s)});e.common.issues.push(n)}class cr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return Be;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const o=await s.key,i=await s.value;n.push({key:o,value:i})}return cr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return Be;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:t.value,value:n}}}const Be=Object.freeze({status:"aborted"}),Vi=e=>({status:"dirty",value:e}),gr=e=>({status:"valid",value:e}),jm=e=>e.status==="aborted",Em=e=>e.status==="dirty",tc=e=>e.status==="valid",rc=e=>typeof Promise<"u"&&e instanceof Promise;function $d(e,t,r,n){if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function Vj(e,t,r,n,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var De;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(De||(De={}));var il,al;class Yn{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const gw=(e,t)=>{if(tc(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new Wr(e.common.issues);return this._error=r,this._error}}};function Ze(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(i,a)=>{var c,u;const{message:d}=e;return i.code==="invalid_enum_value"?{message:d??a.defaultError}:typeof a.data>"u"?{message:(c=d??n)!==null&&c!==void 0?c:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(u=d??r)!==null&&u!==void 0?u:a.defaultError}},description:s}}class Je{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Zs(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new cr,ctx:{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(rc(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;const s={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},o=this._parseSync({data:t,path:s.path,parent:s});return gw(s,o)}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},s=this._parse({data:t,path:n.path,parent:n}),o=await(rc(s)?s:Promise.resolve(s));return gw(n,o)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{const i=t(s),a=()=>o.addIssue({code:ie.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new En({schema:this,typeName:$e.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Wn.create(this,this._def)}nullable(){return wo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _n.create(this,this._def)}promise(){return xa.create(this,this._def)}or(t){return ic.create([this,t],this._def)}and(t){return ac.create(this,t,this._def)}transform(t){return new En({...Ze(this._def),schema:this,typeName:$e.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new fc({...Ze(this._def),innerType:this,defaultValue:r,typeName:$e.ZodDefault})}brand(){return new hy({typeName:$e.ZodBranded,type:this,...Ze(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new hc({...Ze(this._def),innerType:this,catchValue:r,typeName:$e.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return zc.create(this,t)}readonly(){return pc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const jz=/^c[^\s-]{8,}$/i,Ez=/^[0-9a-z]+$/,Nz=/^[0-9A-HJKMNP-TV-Z]{26}$/,Tz=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Rz=/^[a-z0-9_-]{21}$/i,Pz=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Az=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Dz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let op;const Oz=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Mz=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Iz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wj="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Lz=new RegExp(`^${Wj}$`);function Bj(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function Fz(e){return new RegExp(`^${Bj(e)}$`)}function Hj(e){let t=`${Wj}T${Bj(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function zz(e,t){return!!((t==="v4"||!t)&&Oz.test(e)||(t==="v6"||!t)&&Mz.test(e))}class yn extends Je{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==we.string){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.string,received:o.parsedType}),Be}const n=new cr;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(s=this._getOrReturnCtx(t,s),ge(s,{code:ie.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,a=t.data.lengtht.test(s),{validation:r,code:ie.invalid_string,...De.errToObj(n)})}_addCheck(t){return new yn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...De.errToObj(t)})}url(t){return this._addCheck({kind:"url",...De.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...De.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...De.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...De.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...De.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...De.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...De.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...De.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...De.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(r=t==null?void 0:t.offset)!==null&&r!==void 0?r:!1,local:(n=t==null?void 0:t.local)!==null&&n!==void 0?n:!1,...De.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...De.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...De.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...De.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...De.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...De.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...De.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...De.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...De.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...De.errToObj(r)})}nonempty(t){return this.min(1,De.errToObj(t))}trim(){return new yn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new yn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new yn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value{var t;return new yn({checks:[],typeName:$e.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};function Uz(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=parseInt(e.toFixed(s).replace(".","")),i=parseInt(t.toFixed(s).replace(".",""));return o%i/Math.pow(10,s)}class vo extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==we.number){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.number,received:o.parsedType}),Be}let n;const s=new cr;for(const o of this._def.checks)o.kind==="int"?ot.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?Uz(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_finite,message:o.message}),s.dirty()):ot.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,De.toString(r))}gt(t,r){return this.setLimit("min",t,!1,De.toString(r))}lte(t,r){return this.setLimit("max",t,!0,De.toString(r))}lt(t,r){return this.setLimit("max",t,!1,De.toString(r))}setLimit(t,r,n,s){return new vo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:De.toString(s)}]})}_addCheck(t){return new vo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:De.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:De.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:De.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:De.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:De.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.valuet.kind==="int"||t.kind==="multipleOf"&&ot.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.valuenew vo({checks:[],typeName:$e.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class yo extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==we.bigint){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.bigint,received:o.parsedType}),Be}let n;const s=new cr;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):ot.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,De.toString(r))}gt(t,r){return this.setLimit("min",t,!1,De.toString(r))}lte(t,r){return this.setLimit("max",t,!0,De.toString(r))}lt(t,r){return this.setLimit("max",t,!1,De.toString(r))}setLimit(t,r,n,s){return new yo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:De.toString(s)}]})}_addCheck(t){return new yo({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:De.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value{var t;return new yo({checks:[],typeName:$e.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};class nc extends Je{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==we.boolean){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.boolean,received:n.parsedType}),Be}return gr(t.data)}}nc.create=e=>new nc({typeName:$e.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class si extends Je{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==we.date){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.date,received:o.parsedType}),Be}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_date}),Be}const n=new cr;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(s=this._getOrReturnCtx(t,s),ge(s,{code:ie.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ot.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new si({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:De.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:De.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew si({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:$e.ZodDate,...Ze(e)});class Vd extends Je{_parse(t){if(this._getType(t)!==we.symbol){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.symbol,received:n.parsedType}),Be}return gr(t.data)}}Vd.create=e=>new Vd({typeName:$e.ZodSymbol,...Ze(e)});class sc extends Je{_parse(t){if(this._getType(t)!==we.undefined){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.undefined,received:n.parsedType}),Be}return gr(t.data)}}sc.create=e=>new sc({typeName:$e.ZodUndefined,...Ze(e)});class oc extends Je{_parse(t){if(this._getType(t)!==we.null){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.null,received:n.parsedType}),Be}return gr(t.data)}}oc.create=e=>new oc({typeName:$e.ZodNull,...Ze(e)});class ya extends Je{constructor(){super(...arguments),this._any=!0}_parse(t){return gr(t.data)}}ya.create=e=>new ya({typeName:$e.ZodAny,...Ze(e)});class Ko extends Je{constructor(){super(...arguments),this._unknown=!0}_parse(t){return gr(t.data)}}Ko.create=e=>new Ko({typeName:$e.ZodUnknown,...Ze(e)});class js extends Je{_parse(t){const r=this._getOrReturnCtx(t);return ge(r,{code:ie.invalid_type,expected:we.never,received:r.parsedType}),Be}}js.create=e=>new js({typeName:$e.ZodNever,...Ze(e)});class Wd extends Je{_parse(t){if(this._getType(t)!==we.undefined){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.void,received:n.parsedType}),Be}return gr(t.data)}}Wd.create=e=>new Wd({typeName:$e.ZodVoid,...Ze(e)});class _n extends Je{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==we.array)return ge(r,{code:ie.invalid_type,expected:we.array,received:r.parsedType}),Be;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,a=r.data.lengths.maxLength.value&&(ge(r,{code:ie.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>s.type._parseAsync(new Yn(r,i,r.path,a)))).then(i=>cr.mergeArray(n,i));const o=[...r.data].map((i,a)=>s.type._parseSync(new Yn(r,i,r.path,a)));return cr.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new _n({...this._def,minLength:{value:t,message:De.toString(r)}})}max(t,r){return new _n({...this._def,maxLength:{value:t,message:De.toString(r)}})}length(t,r){return new _n({...this._def,exactLength:{value:t,message:De.toString(r)}})}nonempty(t){return this.min(1,t)}}_n.create=(e,t)=>new _n({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$e.ZodArray,...Ze(t)});function ji(e){if(e instanceof Rt){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Wn.create(ji(n))}return new Rt({...e._def,shape:()=>t})}else return e instanceof _n?new _n({...e._def,type:ji(e.element)}):e instanceof Wn?Wn.create(ji(e.unwrap())):e instanceof wo?wo.create(ji(e.unwrap())):e instanceof Zn?Zn.create(e.items.map(t=>ji(t))):e}class Rt extends Je{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),r=ot.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==we.object){const u=this._getOrReturnCtx(t);return ge(u,{code:ie.invalid_type,expected:we.object,received:u.parsedType}),Be}const{status:n,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof js&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const d=o[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Yn(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof js){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")a.length>0&&(ge(s,{code:ie.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of a){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Yn(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,m=await d.value;u.push({key:f,value:m,alwaysSet:d.alwaysSet})}return u}).then(u=>cr.mergeObjectSync(n,u)):cr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return De.errToObj,new Rt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var s,o,i,a;const c=(i=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,r,n).message)!==null&&i!==void 0?i:n.defaultError;return r.code==="unrecognized_keys"?{message:(a=De.errToObj(t).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new Rt({...this._def,unknownKeys:"strip"})}passthrough(){return new Rt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Rt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Rt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:$e.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Rt({...this._def,catchall:t})}pick(t){const r={};return ot.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Rt({...this._def,shape:()=>r})}omit(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new Rt({...this._def,shape:()=>r})}deepPartial(){return ji(this)}partial(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}),new Rt({...this._def,shape:()=>r})}required(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Wn;)o=o._def.innerType;r[n]=o}}),new Rt({...this._def,shape:()=>r})}keyof(){return Yj(ot.objectKeys(this.shape))}}Rt.create=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strip",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});Rt.strictCreate=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strict",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});Rt.lazycreate=(e,t)=>new Rt({shape:e,unknownKeys:"strip",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});class ic extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function s(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new Wr(a.ctx.common.issues));return ge(r,{code:ie.invalid_union,unionErrors:i}),Be}if(r.common.async)return Promise.all(n.map(async o=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(c=>new Wr(c));return ge(r,{code:ie.invalid_union,unionErrors:a}),Be}}get options(){return this._def.options}}ic.create=(e,t)=>new ic({options:e,typeName:$e.ZodUnion,...Ze(t)});const os=e=>e instanceof cc?os(e.schema):e instanceof En?os(e.innerType()):e instanceof uc?[e.value]:e instanceof xo?e.options:e instanceof dc?ot.objectValues(e.enum):e instanceof fc?os(e._def.innerType):e instanceof sc?[void 0]:e instanceof oc?[null]:e instanceof Wn?[void 0,...os(e.unwrap())]:e instanceof wo?[null,...os(e.unwrap())]:e instanceof hy||e instanceof pc?os(e.unwrap()):e instanceof hc?os(e._def.innerType):[];class qf extends Je{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.object)return ge(r,{code:ie.invalid_type,expected:we.object,received:r.parsedType}),Be;const n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(ge(r,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const s=new Map;for(const o of r){const i=os(o.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of i){if(s.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);s.set(a,o)}}return new qf({typeName:$e.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:s,...Ze(n)})}}function Nm(e,t){const r=Zs(e),n=Zs(t);if(e===t)return{valid:!0,data:e};if(r===we.object&&n===we.object){const s=ot.objectKeys(t),o=ot.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(const a of o){const c=Nm(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===we.array&&n===we.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o{if(jm(o)||jm(i))return Be;const a=Nm(o.value,i.value);return a.valid?((Em(o)||Em(i))&&r.dirty(),{status:r.value,value:a.data}):(ge(n,{code:ie.invalid_intersection_types}),Be)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ac.create=(e,t,r)=>new ac({left:e,right:t,typeName:$e.ZodIntersection,...Ze(r)});class Zn extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.array)return ge(n,{code:ie.invalid_type,expected:we.array,received:n.parsedType}),Be;if(n.data.lengththis._def.items.length&&(ge(n,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const o=[...n.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Yn(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>cr.mergeArray(r,i)):cr.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new Zn({...this._def,rest:t})}}Zn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zn({items:e,typeName:$e.ZodTuple,rest:null,...Ze(t)})};class lc extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.object)return ge(n,{code:ie.invalid_type,expected:we.object,received:n.parsedType}),Be;const s=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)s.push({key:o._parse(new Yn(n,a,n.path,a)),value:i._parse(new Yn(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?cr.mergeObjectAsync(r,s):cr.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Je?new lc({keyType:t,valueType:r,typeName:$e.ZodRecord,...Ze(n)}):new lc({keyType:yn.create(),valueType:t,typeName:$e.ZodRecord,...Ze(r)})}}class Bd extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.map)return ge(n,{code:ie.invalid_type,expected:we.map,received:n.parsedType}),Be;const s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new Yn(n,a,n.path,[u,"key"])),value:o._parse(new Yn(n,c,n.path,[u,"value"]))}));if(n.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}}Bd.create=(e,t,r)=>new Bd({valueType:t,keyType:e,typeName:$e.ZodMap,...Ze(r)});class oi extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.set)return ge(n,{code:ie.invalid_type,expected:we.set,received:n.parsedType}),Be;const s=this._def;s.minSize!==null&&n.data.sizes.maxSize.value&&(ge(n,{code:ie.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const o=this._def.valueType;function i(c){const u=new Set;for(const d of c){if(d.status==="aborted")return Be;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}const a=[...n.data.values()].map((c,u)=>o._parse(new Yn(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,r){return new oi({...this._def,minSize:{value:t,message:De.toString(r)}})}max(t,r){return new oi({...this._def,maxSize:{value:t,message:De.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}oi.create=(e,t)=>new oi({valueType:e,minSize:null,maxSize:null,typeName:$e.ZodSet,...Ze(t)});class oa extends Je{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.function)return ge(r,{code:ie.invalid_type,expected:we.function,received:r.parsedType}),Be;function n(a,c){return Ud({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zd(),va].filter(u=>!!u),issueData:{code:ie.invalid_arguments,argumentsError:c}})}function s(a,c){return Ud({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zd(),va].filter(u=>!!u),issueData:{code:ie.invalid_return_type,returnTypeError:c}})}const o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof xa){const a=this;return gr(async function(...c){const u=new Wr([]),d=await a._def.args.parseAsync(c,o).catch(y=>{throw u.addIssue(n(c,y)),u}),f=await Reflect.apply(i,this,d);return await a._def.returns._def.type.parseAsync(f,o).catch(y=>{throw u.addIssue(s(f,y)),u})})}else{const a=this;return gr(function(...c){const u=a._def.args.safeParse(c,o);if(!u.success)throw new Wr([n(c,u.error)]);const d=Reflect.apply(i,this,u.data),f=a._def.returns.safeParse(d,o);if(!f.success)throw new Wr([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new oa({...this._def,args:Zn.create(t).rest(Ko.create())})}returns(t){return new oa({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new oa({args:t||Zn.create([]).rest(Ko.create()),returns:r||Ko.create(),typeName:$e.ZodFunction,...Ze(n)})}}class cc extends Je{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}cc.create=(e,t)=>new cc({getter:e,typeName:$e.ZodLazy,...Ze(t)});class uc extends Je{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return ge(r,{received:r.data,code:ie.invalid_literal,expected:this._def.value}),Be}return{status:"valid",value:t.data}}get value(){return this._def.value}}uc.create=(e,t)=>new uc({value:e,typeName:$e.ZodLiteral,...Ze(t)});function Yj(e,t){return new xo({values:e,typeName:$e.ZodEnum,...Ze(t)})}class xo extends Je{constructor(){super(...arguments),il.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return ge(r,{expected:ot.joinValues(n),received:r.parsedType,code:ie.invalid_type}),Be}if($d(this,il)||Vj(this,il,new Set(this._def.values)),!$d(this,il).has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return ge(r,{received:r.data,code:ie.invalid_enum_value,options:n}),Be}return gr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return xo.create(t,{...this._def,...r})}exclude(t,r=this._def){return xo.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}il=new WeakMap;xo.create=Yj;class dc extends Je{constructor(){super(...arguments),al.set(this,void 0)}_parse(t){const r=ot.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==we.string&&n.parsedType!==we.number){const s=ot.objectValues(r);return ge(n,{expected:ot.joinValues(s),received:n.parsedType,code:ie.invalid_type}),Be}if($d(this,al)||Vj(this,al,new Set(ot.getValidEnumValues(this._def.values))),!$d(this,al).has(t.data)){const s=ot.objectValues(r);return ge(n,{received:n.data,code:ie.invalid_enum_value,options:s}),Be}return gr(t.data)}get enum(){return this._def.values}}al=new WeakMap;dc.create=(e,t)=>new dc({values:e,typeName:$e.ZodNativeEnum,...Ze(t)});class xa extends Je{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.promise&&r.common.async===!1)return ge(r,{code:ie.invalid_type,expected:we.promise,received:r.parsedType}),Be;const n=r.parsedType===we.promise?r.data:Promise.resolve(r.data);return gr(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}xa.create=(e,t)=>new xa({type:e,typeName:$e.ZodPromise,...Ze(t)});class En extends Je{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$e.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:i=>{ge(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return Be;const c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Be:c.status==="dirty"||r.value==="dirty"?Vi(c.value):c});{if(r.value==="aborted")return Be;const a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?Be:a.status==="dirty"||r.value==="dirty"?Vi(a.value):a}}if(s.type==="refinement"){const i=a=>{const c=s.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Be:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Be:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!tc(i))return i;const a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>tc(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):i);ot.assertNever(s)}}En.create=(e,t,r)=>new En({schema:e,typeName:$e.ZodEffects,effect:t,...Ze(r)});En.createWithPreprocess=(e,t,r)=>new En({schema:t,effect:{type:"preprocess",transform:e},typeName:$e.ZodEffects,...Ze(r)});class Wn extends Je{_parse(t){return this._getType(t)===we.undefined?gr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Wn.create=(e,t)=>new Wn({innerType:e,typeName:$e.ZodOptional,...Ze(t)});class wo extends Je{_parse(t){return this._getType(t)===we.null?gr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}wo.create=(e,t)=>new wo({innerType:e,typeName:$e.ZodNullable,...Ze(t)});class fc extends Je{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===we.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}fc.create=(e,t)=>new fc({innerType:e,typeName:$e.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ze(t)});class hc extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rc(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Wr(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Wr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}hc.create=(e,t)=>new hc({innerType:e,typeName:$e.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ze(t)});class Hd extends Je{_parse(t){if(this._getType(t)!==we.nan){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.nan,received:n.parsedType}),Be}return{status:"valid",value:t.data}}}Hd.create=e=>new Hd({typeName:$e.ZodNaN,...Ze(e)});const $z=Symbol("zod_brand");class hy extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class zc extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Be:o.status==="dirty"?(r.dirty(),Vi(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Be:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new zc({in:t,out:r,typeName:$e.ZodPipeline})}}class pc extends Je{_parse(t){const r=this._def.innerType._parse(t),n=s=>(tc(s)&&(s.value=Object.freeze(s.value)),s);return rc(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}pc.create=(e,t)=>new pc({innerType:e,typeName:$e.ZodReadonly,...Ze(t)});function Zj(e,t={},r){return e?ya.create().superRefine((n,s)=>{var o,i;if(!e(n)){const a=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,c=(i=(o=a.fatal)!==null&&o!==void 0?o:r)!==null&&i!==void 0?i:!0,u=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...u,fatal:c})}}):ya.create()}const Vz={object:Rt.lazycreate};var $e;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})($e||($e={}));const Wz=(e,t={message:`Input not instance of ${e.name}`})=>Zj(r=>r instanceof e,t),Kj=yn.create,Gj=vo.create,Bz=Hd.create,Hz=yo.create,qj=nc.create,Yz=si.create,Zz=Vd.create,Kz=sc.create,Gz=oc.create,qz=ya.create,Xz=Ko.create,Qz=js.create,Jz=Wd.create,e8=_n.create,t8=Rt.create,r8=Rt.strictCreate,n8=ic.create,s8=qf.create,o8=ac.create,i8=Zn.create,a8=lc.create,l8=Bd.create,c8=oi.create,u8=oa.create,d8=cc.create,f8=uc.create,h8=xo.create,p8=dc.create,m8=xa.create,vw=En.create,g8=Wn.create,v8=wo.create,y8=En.createWithPreprocess,x8=zc.create,w8=()=>Kj().optional(),_8=()=>Gj().optional(),b8=()=>qj().optional(),S8={string:e=>yn.create({...e,coerce:!0}),number:e=>vo.create({...e,coerce:!0}),boolean:e=>nc.create({...e,coerce:!0}),bigint:e=>yo.create({...e,coerce:!0}),date:e=>si.create({...e,coerce:!0})},k8=Be;var pe=Object.freeze({__proto__:null,defaultErrorMap:va,setErrorMap:kz,getErrorMap:zd,makeIssue:Ud,EMPTY_PATH:Cz,addIssueToContext:ge,ParseStatus:cr,INVALID:Be,DIRTY:Vi,OK:gr,isAborted:jm,isDirty:Em,isValid:tc,isAsync:rc,get util(){return ot},get objectUtil(){return Cm},ZodParsedType:we,getParsedType:Zs,ZodType:Je,datetimeRegex:Hj,ZodString:yn,ZodNumber:vo,ZodBigInt:yo,ZodBoolean:nc,ZodDate:si,ZodSymbol:Vd,ZodUndefined:sc,ZodNull:oc,ZodAny:ya,ZodUnknown:Ko,ZodNever:js,ZodVoid:Wd,ZodArray:_n,ZodObject:Rt,ZodUnion:ic,ZodDiscriminatedUnion:qf,ZodIntersection:ac,ZodTuple:Zn,ZodRecord:lc,ZodMap:Bd,ZodSet:oi,ZodFunction:oa,ZodLazy:cc,ZodLiteral:uc,ZodEnum:xo,ZodNativeEnum:dc,ZodPromise:xa,ZodEffects:En,ZodTransformer:En,ZodOptional:Wn,ZodNullable:wo,ZodDefault:fc,ZodCatch:hc,ZodNaN:Hd,BRAND:$z,ZodBranded:hy,ZodPipeline:zc,ZodReadonly:pc,custom:Zj,Schema:Je,ZodSchema:Je,late:Vz,get ZodFirstPartyTypeKind(){return $e},coerce:S8,any:qz,array:e8,bigint:Hz,boolean:qj,date:Yz,discriminatedUnion:s8,effect:vw,enum:h8,function:u8,instanceof:Wz,intersection:o8,lazy:d8,literal:f8,map:l8,nan:Bz,nativeEnum:p8,never:Qz,null:Gz,nullable:v8,number:Gj,object:t8,oboolean:b8,onumber:_8,optional:g8,ostring:w8,pipeline:x8,preprocess:y8,promise:m8,record:a8,set:c8,strictObject:r8,string:Kj,symbol:Zz,transformer:vw,tuple:i8,undefined:Kz,union:n8,unknown:Xz,void:Jz,NEVER:k8,ZodIssueCode:ie,quotelessJson:Sz,ZodError:Wr}),C8="Label",Xj=v.forwardRef((e,t)=>l.jsx(Re.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Xj.displayName=C8;var Qj=Xj;const j8=_c("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ma=v.forwardRef(({className:e,...t},r)=>l.jsx(Qj,{ref:r,className:ae(j8(),e),...t}));Ma.displayName=Qj.displayName;const Pr=oz,Jj=v.createContext({}),Ne=({...e})=>l.jsx(Jj.Provider,{value:{name:e.name},children:l.jsx(cz,{...e})}),Xf=()=>{const e=v.useContext(Jj),t=v.useContext(eE),{getFieldState:r,formState:n}=Gf(),s=r(e.name,n);if(!e)throw new Error("useFormField should be used within ");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...s}},eE=v.createContext({}),Ce=v.forwardRef(({className:e,...t},r)=>{const n=v.useId();return l.jsx(eE.Provider,{value:{id:n},children:l.jsx("div",{ref:r,className:ae("space-y-2",e),...t})})});Ce.displayName="FormItem";const je=v.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:s}=Xf();return l.jsx(Ma,{ref:r,className:ae(n&&"text-destructive",e),htmlFor:s,...t})});je.displayName="FormLabel";const Ee=v.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:s,formMessageId:o}=Xf();return l.jsx(bs,{ref:t,id:n,"aria-describedby":r?`${s} ${o}`:`${s}`,"aria-invalid":!!r,...e})});Ee.displayName="FormControl";const E8=v.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=Xf();return l.jsx("p",{ref:r,id:n,className:ae("text-sm text-muted-foreground",e),...t})});E8.displayName="FormDescription";const Se=v.forwardRef(({className:e,children:t,...r},n)=>{const{error:s,formMessageId:o}=Xf(),i=s?String(s==null?void 0:s.message):t;return i?l.jsx("p",{ref:n,id:o,className:ae("text-sm font-medium text-destructive",e),...r,children:i}):null});Se.displayName="FormMessage";function Tm(e,[t,r]){return Math.min(r,Math.max(t,e))}var N8=[" ","Enter","ArrowUp","ArrowDown"],T8=[" ","Enter"],Uc="Select",[Qf,Jf,R8]=bc(Uc),[Ia,j$]=xr(Uc,[R8,Pa]),eh=Pa(),[P8,Eo]=Ia(Uc),[A8,D8]=Ia(Uc),tE=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:m,required:y}=e,x=eh(t),[g,_]=v.useState(null),[p,h]=v.useState(null),[w,C]=v.useState(!1),j=Ea(u),[E=!1,R]=on({prop:n,defaultProp:s,onChange:o}),[P,A]=on({prop:i,defaultProp:a,onChange:c}),L=v.useRef(null),q=g?!!g.closest("form"):!0,[N,F]=v.useState(new Set),b=Array.from(N).map(V=>V.props.value).join(";");return l.jsx(Xg,{...x,children:l.jsxs(P8,{required:y,scope:t,trigger:g,onTriggerChange:_,valueNode:p,onValueNodeChange:h,valueNodeHasChildren:w,onValueNodeHasChildrenChange:C,contentId:Ur(),value:P,onValueChange:A,open:E,onOpenChange:R,dir:j,triggerPointerDownPosRef:L,disabled:m,children:[l.jsx(Qf.Provider,{scope:t,children:l.jsx(A8,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(V=>{F(te=>new Set(te).add(V))},[]),onNativeOptionRemove:v.useCallback(V=>{F(te=>{const W=new Set(te);return W.delete(V),W})},[]),children:r})}),q?l.jsxs(EE,{"aria-hidden":!0,required:y,tabIndex:-1,name:d,autoComplete:f,value:P,onChange:V=>A(V.target.value),disabled:m,children:[P===void 0?l.jsx("option",{value:""}):null,Array.from(N)]},b):null]})})};tE.displayName=Uc;var rE="SelectTrigger",nE=v.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,o=eh(r),i=Eo(rE,r),a=i.disabled||n,c=Ke(t,i.onTriggerChange),u=Jf(r),[d,f,m]=NE(x=>{const g=u().filter(h=>!h.disabled),_=g.find(h=>h.value===i.value),p=TE(g,x,_);p!==void 0&&i.onValueChange(p.value)}),y=()=>{a||(i.onOpenChange(!0),m())};return l.jsx(Qg,{asChild:!0,...o,children:l.jsx(Re.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":jE(i.value)?"":void 0,...s,ref:c,onClick:ce(s.onClick,x=>{x.currentTarget.focus()}),onPointerDown:ce(s.onPointerDown,x=>{const g=x.target;g.hasPointerCapture(x.pointerId)&&g.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&(y(),i.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)},x.preventDefault())}),onKeyDown:ce(s.onKeyDown,x=>{const g=d.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&f(x.key),!(g&&x.key===" ")&&N8.includes(x.key)&&(y(),x.preventDefault())})})})});nE.displayName=rE;var sE="SelectValue",oE=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:i="",...a}=e,c=Eo(sE,r),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,f=Ke(t,c.onValueNodeChange);return Jt(()=>{u(d)},[u,d]),l.jsx(Re.span,{...a,ref:f,style:{pointerEvents:"none"},children:jE(c.value)?l.jsx(l.Fragment,{children:i}):o})});oE.displayName=sE;var O8="SelectIcon",iE=v.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return l.jsx(Re.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});iE.displayName=O8;var M8="SelectPortal",aE=e=>l.jsx(kc,{asChild:!0,...e});aE.displayName=M8;var ii="SelectContent",lE=v.forwardRef((e,t)=>{const r=Eo(ii,e.__scopeSelect),[n,s]=v.useState();if(Jt(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?Ns.createPortal(l.jsx(cE,{scope:e.__scopeSelect,children:l.jsx(Qf.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),o):null}return l.jsx(uE,{...e,ref:t})});lE.displayName=ii;var ls=10,[cE,No]=Ia(ii),I8="SelectContentImpl",uE=v.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:g,avoidCollisions:_,...p}=e,h=Eo(ii,r),[w,C]=v.useState(null),[j,E]=v.useState(null),R=Ke(t,he=>C(he)),[P,A]=v.useState(null),[L,q]=v.useState(null),N=Jf(r),[F,b]=v.useState(!1),V=v.useRef(!1);v.useEffect(()=>{if(w)return tv(w)},[w]),Vg();const te=v.useCallback(he=>{const[ye,...ke]=N().map(Pe=>Pe.ref.current),[Fe]=ke.slice(-1),Me=document.activeElement;for(const Pe of he)if(Pe===Me||(Pe==null||Pe.scrollIntoView({block:"nearest"}),Pe===ye&&j&&(j.scrollTop=0),Pe===Fe&&j&&(j.scrollTop=j.scrollHeight),Pe==null||Pe.focus(),document.activeElement!==Me))return},[N,j]),W=v.useCallback(()=>te([P,w]),[te,P,w]);v.useEffect(()=>{F&&W()},[F,W]);const{onOpenChange:Z,triggerPointerDownPosRef:I}=h;v.useEffect(()=>{if(w){let he={x:0,y:0};const ye=Fe=>{var Me,Pe;he={x:Math.abs(Math.round(Fe.pageX)-(((Me=I.current)==null?void 0:Me.x)??0)),y:Math.abs(Math.round(Fe.pageY)-(((Pe=I.current)==null?void 0:Pe.y)??0))}},ke=Fe=>{he.x<=10&&he.y<=10?Fe.preventDefault():w.contains(Fe.target)||Z(!1),document.removeEventListener("pointermove",ye),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",ke,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",ke,{capture:!0})}}},[w,Z,I]),v.useEffect(()=>{const he=()=>Z(!1);return window.addEventListener("blur",he),window.addEventListener("resize",he),()=>{window.removeEventListener("blur",he),window.removeEventListener("resize",he)}},[Z]);const[Q,z]=NE(he=>{const ye=N().filter(Me=>!Me.disabled),ke=ye.find(Me=>Me.ref.current===document.activeElement),Fe=TE(ye,he,ke);Fe&&setTimeout(()=>Fe.ref.current.focus())}),$=v.useCallback((he,ye,ke)=>{const Fe=!V.current&&!ke;(h.value!==void 0&&h.value===ye||Fe)&&(A(he),Fe&&(V.current=!0))},[h.value]),fe=v.useCallback(()=>w==null?void 0:w.focus(),[w]),ne=v.useCallback((he,ye,ke)=>{const Fe=!V.current&&!ke;(h.value!==void 0&&h.value===ye||Fe)&&q(he)},[h.value]),se=n==="popper"?Rm:dE,Oe=se===Rm?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:g,avoidCollisions:_}:{};return l.jsx(cE,{scope:r,content:w,viewport:j,onViewportChange:E,itemRefCallback:$,selectedItem:P,onItemLeave:fe,itemTextRefCallback:ne,focusSelectedItem:W,selectedItemText:L,position:n,isPositioned:F,searchRef:Q,children:l.jsx(jf,{as:bs,allowPinchZoom:!0,children:l.jsx(wf,{asChild:!0,trapped:h.open,onMountAutoFocus:he=>{he.preventDefault()},onUnmountAutoFocus:ce(s,he=>{var ye;(ye=h.trigger)==null||ye.focus({preventScroll:!0}),he.preventDefault()}),children:l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:he=>he.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:l.jsx(se,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:he=>he.preventDefault(),...p,...Oe,onPlaced:()=>b(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...p.style},onKeyDown:ce(p.onKeyDown,he=>{const ye=he.ctrlKey||he.altKey||he.metaKey;if(he.key==="Tab"&&he.preventDefault(),!ye&&he.key.length===1&&z(he.key),["ArrowUp","ArrowDown","Home","End"].includes(he.key)){let Fe=N().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);if(["ArrowUp","End"].includes(he.key)&&(Fe=Fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(he.key)){const Me=he.target,Pe=Fe.indexOf(Me);Fe=Fe.slice(Pe+1)}setTimeout(()=>te(Fe)),he.preventDefault()}})})})})})})});uE.displayName=I8;var L8="SelectItemAlignedPosition",dE=v.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,o=Eo(ii,r),i=No(ii,r),[a,c]=v.useState(null),[u,d]=v.useState(null),f=Ke(t,R=>d(R)),m=Jf(r),y=v.useRef(!1),x=v.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:p,focusSelectedItem:h}=i,w=v.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&u&&g&&_&&p){const R=o.trigger.getBoundingClientRect(),P=u.getBoundingClientRect(),A=o.valueNode.getBoundingClientRect(),L=p.getBoundingClientRect();if(o.dir!=="rtl"){const Me=L.left-P.left,Pe=A.left-Me,nt=R.left-Pe,k=R.width+nt,J=Math.max(k,P.width),K=window.innerWidth-ls,D=Tm(Pe,[ls,K-J]);a.style.minWidth=k+"px",a.style.left=D+"px"}else{const Me=P.right-L.right,Pe=window.innerWidth-A.right-Me,nt=window.innerWidth-R.right-Pe,k=R.width+nt,J=Math.max(k,P.width),K=window.innerWidth-ls,D=Tm(Pe,[ls,K-J]);a.style.minWidth=k+"px",a.style.right=D+"px"}const q=m(),N=window.innerHeight-ls*2,F=g.scrollHeight,b=window.getComputedStyle(u),V=parseInt(b.borderTopWidth,10),te=parseInt(b.paddingTop,10),W=parseInt(b.borderBottomWidth,10),Z=parseInt(b.paddingBottom,10),I=V+te+F+Z+W,Q=Math.min(_.offsetHeight*5,I),z=window.getComputedStyle(g),$=parseInt(z.paddingTop,10),fe=parseInt(z.paddingBottom,10),ne=R.top+R.height/2-ls,se=N-ne,Oe=_.offsetHeight/2,he=_.offsetTop+Oe,ye=V+te+he,ke=I-ye;if(ye<=ne){const Me=_===q[q.length-1].ref.current;a.style.bottom="0px";const Pe=u.clientHeight-g.offsetTop-g.offsetHeight,nt=Math.max(se,Oe+(Me?fe:0)+Pe+W),k=ye+nt;a.style.height=k+"px"}else{const Me=_===q[0].ref.current;a.style.top="0px";const nt=Math.max(ne,V+g.offsetTop+(Me?$:0)+Oe)+ke;a.style.height=nt+"px",g.scrollTop=ye-ne+g.offsetTop}a.style.margin=`${ls}px 0`,a.style.minHeight=Q+"px",a.style.maxHeight=N+"px",n==null||n(),requestAnimationFrame(()=>y.current=!0)}},[m,o.trigger,o.valueNode,a,u,g,_,p,o.dir,n]);Jt(()=>w(),[w]);const[C,j]=v.useState();Jt(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const E=v.useCallback(R=>{R&&x.current===!0&&(w(),h==null||h(),x.current=!1)},[w,h]);return l.jsx(z8,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:y,onScrollButtonChange:E,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:l.jsx(Re.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});dE.displayName=L8;var F8="SelectPopperPosition",Rm=v.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=ls,...o}=e,i=eh(r);return l.jsx(Jg,{...i,...o,ref:t,align:n,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Rm.displayName=F8;var[z8,py]=Ia(ii,{}),Pm="SelectViewport",fE=v.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,o=No(Pm,r),i=py(Pm,r),a=Ke(t,o.onViewportChange),c=v.useRef(0);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),l.jsx(Qf.Slot,{scope:r,children:l.jsx(Re.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"auto",...s.style},onScroll:ce(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&f){const y=Math.abs(c.current-d.scrollTop);if(y>0){const x=window.innerHeight-ls*2,g=parseFloat(f.style.minHeight),_=parseFloat(f.style.height),p=Math.max(g,_);if(p0?C:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});fE.displayName=Pm;var hE="SelectGroup",[U8,$8]=Ia(hE),pE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Ur();return l.jsx(U8,{scope:r,id:s,children:l.jsx(Re.div,{role:"group","aria-labelledby":s,...n,ref:t})})});pE.displayName=hE;var mE="SelectLabel",gE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=$8(mE,r);return l.jsx(Re.div,{id:s.id,...n,ref:t})});gE.displayName=mE;var Yd="SelectItem",[V8,vE]=Ia(Yd),yE=v.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...i}=e,a=Eo(Yd,r),c=No(Yd,r),u=a.value===n,[d,f]=v.useState(o??""),[m,y]=v.useState(!1),x=Ke(t,p=>{var h;return(h=c.itemRefCallback)==null?void 0:h.call(c,p,n,s)}),g=Ur(),_=()=>{s||(a.onValueChange(n),a.onOpenChange(!1))};if(n==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l.jsx(V8,{scope:r,value:n,disabled:s,textId:g,isSelected:u,onItemTextChange:v.useCallback(p=>{f(h=>h||((p==null?void 0:p.textContent)??"").trim())},[]),children:l.jsx(Qf.ItemSlot,{scope:r,value:n,disabled:s,textValue:d,children:l.jsx(Re.div,{role:"option","aria-labelledby":g,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:x,onFocus:ce(i.onFocus,()=>y(!0)),onBlur:ce(i.onBlur,()=>y(!1)),onPointerUp:ce(i.onPointerUp,_),onPointerMove:ce(i.onPointerMove,p=>{var h;s?(h=c.onItemLeave)==null||h.call(c):p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ce(i.onPointerLeave,p=>{var h;p.currentTarget===document.activeElement&&((h=c.onItemLeave)==null||h.call(c))}),onKeyDown:ce(i.onKeyDown,p=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&p.key===" "||(T8.includes(p.key)&&_(),p.key===" "&&p.preventDefault())})})})})});yE.displayName=Yd;var ll="SelectItemText",xE=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...o}=e,i=Eo(ll,r),a=No(ll,r),c=vE(ll,r),u=D8(ll,r),[d,f]=v.useState(null),m=Ke(t,p=>f(p),c.onItemTextChange,p=>{var h;return(h=a.itemTextRefCallback)==null?void 0:h.call(a,p,c.value,c.disabled)}),y=d==null?void 0:d.textContent,x=v.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:y},c.value),[c.disabled,c.value,y]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return Jt(()=>(g(x),()=>_(x)),[g,_,x]),l.jsxs(l.Fragment,{children:[l.jsx(Re.span,{id:c.textId,...o,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ns.createPortal(o.children,i.valueNode):null]})});xE.displayName=ll;var wE="SelectItemIndicator",_E=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return vE(wE,r).isSelected?l.jsx(Re.span,{"aria-hidden":!0,...n,ref:t}):null});_E.displayName=wE;var Am="SelectScrollUpButton",bE=v.forwardRef((e,t)=>{const r=No(Am,e.__scopeSelect),n=py(Am,e.__scopeSelect),[s,o]=v.useState(!1),i=Ke(t,n.onScrollButtonChange);return Jt(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollTop>0;o(u)};const c=r.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(kE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});bE.displayName=Am;var Dm="SelectScrollDownButton",SE=v.forwardRef((e,t)=>{const r=No(Dm,e.__scopeSelect),n=py(Dm,e.__scopeSelect),[s,o]=v.useState(!1),i=Ke(t,n.onScrollButtonChange);return Jt(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(kE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});SE.displayName=Dm;var kE=v.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,o=No("SelectScrollButton",r),i=v.useRef(null),a=Jf(r),c=v.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Jt(()=>{var d;const u=a().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),l.jsx(Re.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ce(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:ce(s.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:ce(s.onPointerLeave,()=>{c()})})}),W8="SelectSeparator",CE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return l.jsx(Re.div,{"aria-hidden":!0,...n,ref:t})});CE.displayName=W8;var Om="SelectArrow",B8=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=eh(r),o=Eo(Om,r),i=No(Om,r);return o.open&&i.position==="popper"?l.jsx(ev,{...s,...n,ref:t}):null});B8.displayName=Om;function jE(e){return e===""||e===void 0}var EE=v.forwardRef((e,t)=>{const{value:r,...n}=e,s=v.useRef(null),o=Ke(t,s),i=YC(r);return v.useEffect(()=>{const a=s.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==r&&d){const f=new Event("change",{bubbles:!0});d.call(a,r),a.dispatchEvent(f)}},[i,r]),l.jsx(Ic,{asChild:!0,children:l.jsx("select",{...n,ref:o,defaultValue:r})})});EE.displayName="BubbleSelect";function NE(e){const t=Dt(e),r=v.useRef(""),n=v.useRef(0),s=v.useCallback(i=>{const a=r.current+i;t(a),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(a)},[t]),o=v.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function TE(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=H8(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function H8(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Y8=tE,RE=nE,Z8=oE,K8=iE,G8=aE,PE=lE,q8=fE,X8=pE,AE=gE,DE=yE,Q8=xE,J8=_E,OE=bE,ME=SE,IE=CE;const Mo=Y8,cl=X8,Io=Z8,Ks=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(RE,{ref:n,className:ae("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,l.jsx(K8,{asChild:!0,children:l.jsx(Lg,{className:"h-4 w-4 opacity-50"})})]}));Ks.displayName=RE.displayName;const LE=v.forwardRef(({className:e,...t},r)=>l.jsx(OE,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(aA,{className:"h-4 w-4"})}));LE.displayName=OE.displayName;const FE=v.forwardRef(({className:e,...t},r)=>l.jsx(ME,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Lg,{className:"h-4 w-4"})}));FE.displayName=ME.displayName;const Gs=v.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>l.jsx(G8,{children:l.jsxs(PE,{ref:s,className:ae("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[l.jsx(LE,{}),l.jsx(q8,{className:ae("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(FE,{})]})}));Gs.displayName=PE.displayName;const Wi=v.forwardRef(({className:e,...t},r)=>l.jsx(AE,{ref:r,className:ae("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Wi.displayName=AE.displayName;const pn=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(DE,{ref:n,className:ae("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(J8,{children:l.jsx(eb,{className:"h-4 w-4"})})}),l.jsx(Q8,{children:t})]}));pn.displayName=DE.displayName;const eU=v.forwardRef(({className:e,...t},r)=>l.jsx(IE,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));eU.displayName=IE.displayName;const Mm=new Map([["aliyun-cdn",["阿里云-CDN","/imgs/providers/aliyun.svg"]],["aliyun-oss",["阿里云-OSS","/imgs/providers/aliyun.svg"]],["aliyun-dcdn",["阿里云-DCDN","/imgs/providers/aliyun.svg"]],["tencent-cdn",["腾讯云-CDN","/imgs/providers/tencent.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.svg"]],["qiniu-cdn",["七牛云-CDN","/imgs/providers/qiniu.svg"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),tU=Array.from(Mm.keys()),my=mv,gy=gv,rU=vv,zE=v.forwardRef(({className:e,...t},r)=>l.jsx(Ec,{ref:r,className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));zE.displayName=Ec.displayName;const th=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(rU,{children:[l.jsx(zE,{}),l.jsxs(Nc,{ref:n,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,l.jsxs(Tf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(Fg,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));th.displayName=Nc.displayName;const rh=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});rh.displayName="DialogHeader";const nh=v.forwardRef(({className:e,...t},r)=>l.jsx(Tc,{ref:r,className:ae("text-lg font-semibold leading-none tracking-tight",e),...t}));nh.displayName=Tc.displayName;const nU=v.forwardRef(({className:e,...t},r)=>l.jsx(Rc,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));nU.displayName=Rc.displayName;function sU(e,t){return v.useReducer((r,n)=>t[r][n]??r,e)}var vy="ScrollArea",[UE,E$]=xr(vy),[oU,cn]=UE(vy),$E=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:o=600,...i}=e,[a,c]=v.useState(null),[u,d]=v.useState(null),[f,m]=v.useState(null),[y,x]=v.useState(null),[g,_]=v.useState(null),[p,h]=v.useState(0),[w,C]=v.useState(0),[j,E]=v.useState(!1),[R,P]=v.useState(!1),A=Ke(t,q=>c(q)),L=Ea(s);return l.jsx(oU,{scope:r,type:n,dir:L,scrollHideDelay:o,scrollArea:a,viewport:u,onViewportChange:d,content:f,onContentChange:m,scrollbarX:y,onScrollbarXChange:x,scrollbarXEnabled:j,onScrollbarXEnabledChange:E,scrollbarY:g,onScrollbarYChange:_,scrollbarYEnabled:R,onScrollbarYEnabledChange:P,onCornerWidthChange:h,onCornerHeightChange:C,children:l.jsx(Re.div,{dir:L,...i,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":p+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});$E.displayName=vy;var VE="ScrollAreaViewport",WE=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...o}=e,i=cn(VE,r),a=v.useRef(null),c=Ke(t,a,i.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(Re.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});WE.displayName=VE;var Xn="ScrollAreaScrollbar",yy=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,a=e.orientation==="horizontal";return v.useEffect(()=>(a?o(!0):i(!0),()=>{a?o(!1):i(!1)}),[a,o,i]),s.type==="hover"?l.jsx(iU,{...n,ref:t,forceMount:r}):s.type==="scroll"?l.jsx(aU,{...n,ref:t,forceMount:r}):s.type==="auto"?l.jsx(BE,{...n,ref:t,forceMount:r}):s.type==="always"?l.jsx(xy,{...n,ref:t}):null});yy.displayName=Xn;var iU=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),[o,i]=v.useState(!1);return v.useEffect(()=>{const a=s.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),l.jsx(ur,{present:r||o,children:l.jsx(BE,{"data-state":o?"visible":"hidden",...n,ref:t})})}),aU=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),o=e.orientation==="horizontal",i=oh(()=>c("SCROLL_END"),100),[a,c]=sU("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,s.scrollHideDelay,c]),v.useEffect(()=>{const u=s.viewport,d=o?"scrollLeft":"scrollTop";if(u){let f=u[d];const m=()=>{const y=u[d];f!==y&&(c("SCROLL"),i()),f=y};return u.addEventListener("scroll",m),()=>u.removeEventListener("scroll",m)}},[s.viewport,o,c,i]),l.jsx(ur,{present:r||a!=="hidden",children:l.jsx(xy,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:ce(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ce(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),BE=v.forwardRef((e,t)=>{const r=cn(Xn,e.__scopeScrollArea),{forceMount:n,...s}=e,[o,i]=v.useState(!1),a=e.orientation==="horizontal",c=oh(()=>{if(r.viewport){const u=r.viewport.offsetWidth{const{orientation:r="vertical",...n}=e,s=cn(Xn,e.__scopeScrollArea),o=v.useRef(null),i=v.useRef(0),[a,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=GE(a.viewport,a.content),d={...n,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:m=>o.current=m,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:m=>i.current=m};function f(m,y){return hU(m,i.current,a,y)}return r==="horizontal"?l.jsx(lU,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollLeft,y=yw(m,a,s.dir);o.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollLeft=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollLeft=f(m,s.dir))}}):r==="vertical"?l.jsx(cU,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollTop,y=yw(m,a);o.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollTop=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollTop=f(m))}}):null}),lU=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=cn(Xn,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Ke(t,c,o.onScrollbarXChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(YE,{"data-orientation":"horizontal",...s,ref:u,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":sh(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const m=o.viewport.scrollLeft+d.deltaX;e.onWheelScroll(m),XE(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Kd(i.paddingLeft),paddingEnd:Kd(i.paddingRight)}})}})}),cU=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=cn(Xn,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Ke(t,c,o.onScrollbarYChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(YE,{"data-orientation":"vertical",...s,ref:u,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":sh(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const m=o.viewport.scrollTop+d.deltaY;e.onWheelScroll(m),XE(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Kd(i.paddingTop),paddingEnd:Kd(i.paddingBottom)}})}})}),[uU,HE]=UE(Xn),YE=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...m}=e,y=cn(Xn,r),[x,g]=v.useState(null),_=Ke(t,A=>g(A)),p=v.useRef(null),h=v.useRef(""),w=y.viewport,C=n.content-n.viewport,j=Dt(d),E=Dt(c),R=oh(f,10);function P(A){if(p.current){const L=A.clientX-p.current.left,q=A.clientY-p.current.top;u({x:L,y:q})}}return v.useEffect(()=>{const A=L=>{const q=L.target;(x==null?void 0:x.contains(q))&&j(L,C)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[w,x,C,j]),v.useEffect(E,[n,E]),wa(x,R),wa(y.content,R),l.jsx(uU,{scope:r,scrollbar:x,hasThumb:s,onThumbChange:Dt(o),onThumbPointerUp:Dt(i),onThumbPositionChange:E,onThumbPointerDown:Dt(a),children:l.jsx(Re.div,{...m,ref:_,style:{position:"absolute",...m.style},onPointerDown:ce(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),p.current=x.getBoundingClientRect(),h.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),P(A))}),onPointerMove:ce(e.onPointerMove,P),onPointerUp:ce(e.onPointerUp,A=>{const L=A.target;L.hasPointerCapture(A.pointerId)&&L.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=h.current,y.viewport&&(y.viewport.style.scrollBehavior=""),p.current=null})})})}),Zd="ScrollAreaThumb",ZE=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=HE(Zd,e.__scopeScrollArea);return l.jsx(ur,{present:r||s.hasThumb,children:l.jsx(dU,{ref:t,...n})})}),dU=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,o=cn(Zd,r),i=HE(Zd,r),{onThumbPositionChange:a}=i,c=Ke(t,f=>i.onThumbChange(f)),u=v.useRef(),d=oh(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const f=o.viewport;if(f){const m=()=>{if(d(),!u.current){const y=pU(f,a);u.current=y,a()}};return a(),f.addEventListener("scroll",m),()=>f.removeEventListener("scroll",m)}},[o.viewport,d,a]),l.jsx(Re.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ce(e.onPointerDownCapture,f=>{const y=f.target.getBoundingClientRect(),x=f.clientX-y.left,g=f.clientY-y.top;i.onThumbPointerDown({x,y:g})}),onPointerUp:ce(e.onPointerUp,i.onThumbPointerUp)})});ZE.displayName=Zd;var wy="ScrollAreaCorner",KE=v.forwardRef((e,t)=>{const r=cn(wy,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?l.jsx(fU,{...e,ref:t}):null});KE.displayName=wy;var fU=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=cn(wy,r),[o,i]=v.useState(0),[a,c]=v.useState(0),u=!!(o&&a);return wa(s.scrollbarX,()=>{var f;const d=((f=s.scrollbarX)==null?void 0:f.offsetHeight)||0;s.onCornerHeightChange(d),c(d)}),wa(s.scrollbarY,()=>{var f;const d=((f=s.scrollbarY)==null?void 0:f.offsetWidth)||0;s.onCornerWidthChange(d),i(d)}),u?l.jsx(Re.div,{...n,ref:t,style:{width:o,height:a,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Kd(e){return e?parseInt(e,10):0}function GE(e,t){const r=e/t;return isNaN(r)?0:r}function sh(e){const t=GE(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function hU(e,t,r,n="ltr"){const s=sh(r),o=s/2,i=t||o,a=s-i,c=r.scrollbar.paddingStart+i,u=r.scrollbar.size-r.scrollbar.paddingEnd-a,d=r.content-r.viewport,f=n==="ltr"?[0,d]:[d*-1,0];return qE([c,u],f)(e)}function yw(e,t,r="ltr"){const n=sh(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,i=t.content-t.viewport,a=o-n,c=r==="ltr"?[0,i]:[i*-1,0],u=Tm(e,c);return qE([0,i],[0,a])(u)}function qE(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function XE(e,t){return e>0&&e{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function s(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,a=r.top!==o.top;(i||a)&&t(),r=o,n=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(n)};function oh(e,t){const r=Dt(e),n=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),v.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function wa(e,t){const r=Dt(t);Jt(()=>{let n=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(n),s.unobserve(e)}}},[e,r])}var QE=$E,mU=WE,gU=KE;const ih=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(QE,{ref:n,className:ae("relative overflow-hidden",e),...r,children:[l.jsx(mU,{className:"h-full w-full rounded-[inherit]",children:t}),l.jsx(JE,{}),l.jsx(gU,{})]}));ih.displayName=QE.displayName;const JE=v.forwardRef(({className:e,orientation:t="vertical",...r},n)=>l.jsx(yy,{ref:n,orientation:t,className:ae("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:l.jsx(ZE,{className:"relative flex-1 rounded-full bg-border"})}));JE.displayName=yy.displayName;const uo=new Map([["tencent",["腾讯云","/imgs/providers/tencent.svg"]],["aliyun",["阿里云","/imgs/providers/aliyun.svg"]],["cloudflare",["Cloudflare","/imgs/providers/cloudflare.svg"]],["namesilo",["Namesilo","/imgs/providers/namesilo.svg"]],["godaddy",["GoDaddy","/imgs/providers/godaddy.svg"]],["qiniu",["七牛云","/imgs/providers/qiniu.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.svg"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),xw=e=>uo.get(e),To=pe.union([pe.literal("aliyun"),pe.literal("tencent"),pe.literal("ssh"),pe.literal("webhook"),pe.literal("cloudflare"),pe.literal("qiniu"),pe.literal("namesilo"),pe.literal("godaddy")],{message:"请选择云服务商"}),Ro=e=>{switch(e){case"aliyun":case"tencent":return"all";case"ssh":case"webhook":case"qiniu":return"deploy";case"cloudflare":case"namesilo":case"godaddy":return"apply";default:return"all"}},vU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,secretId:pe.string().min(1).max(64),secretKey:pe.string().min(1).max(64)});let o={secretId:"",secretKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"tencent",secretId:o.secretId,secretKey:o.secretKey}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{secretId:c.secretId,secretKey:c.secretKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretId"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretId",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretKey",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},yU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,accessKeyId:pe.string().min(1).max(64),accessSecretId:pe.string().min(1).max(64)});let o={accessKeyId:"",accessKeySecret:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"aliyun",accessKeyId:o.accessKeyId,accessSecretId:o.accessKeySecret}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{accessKeyId:c.accessKeyId,accessKeySecret:c.accessSecretId}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessKeyId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKeyId"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKeyId",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessSecretId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKeySecret"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKeySecret",...c})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},mc=v.forwardRef(({className:e,...t},r)=>l.jsx("textarea",{className:ae("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));mc.displayName="Textarea";const _y=({className:e,trigger:t})=>{const{reloadAccessGroups:r}=Kr(),[n,s]=v.useState(!1),o=pe.object({name:pe.string().min(1).max(64)}),i=Tr({resolver:Rr(o),defaultValues:{name:""}}),a=async c=>{try{await b3({name:c.name}),r(),s(!1)}catch(u){Object.entries(u.response.data).forEach(([f,m])=>{i.setError(f,{type:"manual",message:m.message})})}};return l.jsxs(my,{onOpenChange:s,open:n,children:[l.jsx(gy,{asChild:!0,className:ae(e),children:t}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsx(nh,{children:"添加分组"})}),l.jsx("div",{className:"container py-3",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"组名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入组名",...c,type:"text"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})},xU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n,reloadAccessGroups:s,config:{accessGroups:o}}=Kr(),i=v.useRef(null),[a,c]=v.useState(""),u=e&&e.group?e.group:"",d=/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,f=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,m=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,host:pe.string().refine(h=>f.test(h)||d.test(h),{message:"请输入正确的域名或IP"}),group:pe.string().optional(),port:pe.string().min(1).max(5),username:pe.string().min(1).max(64),password:pe.string().min(0).max(64),key:pe.string().min(0).max(20480),keyFile:pe.any().optional(),command:pe.string().min(1).max(2048),certPath:pe.string().min(0).max(2048),keyPath:pe.string().min(0).max(2048)});let y={host:"127.0.0.1",port:"22",username:"root",password:"",key:"",keyFile:"",command:"sudo service nginx restart",certPath:"/etc/nginx/ssl/certificate.crt",keyPath:"/etc/nginx/ssl/private.key"};e&&(y=e.config);const x=Tr({resolver:Rr(m),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"ssh",group:e==null?void 0:e.group,host:y.host,port:y.port,username:y.username,password:y.password,key:y.key,keyFile:y.keyFile,certPath:y.certPath,keyPath:y.keyPath,command:y.command}}),g=async h=>{console.log(h);let w=h.group;w=="emptyId"&&(w="");const C={id:h.id,name:h.name,configType:h.configType,usage:Ro(h.configType),group:w,config:{host:h.host,port:h.port,username:h.username,password:h.password,key:h.key,command:h.command,certPath:h.certPath,keyPath:h.keyPath}};try{const j=await jo(C);t(),C.id=j.id,C.created=j.created,C.updated=j.updated,h.id?n(C):r(C),w!=u&&(u&&await nw({id:u,"access-":C.id}),w&&await nw({id:w,"access+":C.id})),s()}catch(j){Object.entries(j.response.data).forEach(([R,P])=>{x.setError(R,{type:"manual",message:P.message})});return}},_=async h=>{var E;const w=(E=h.target.files)==null?void 0:E[0];if(!w)return;const C=w;c(C.name);const j=await Z6(C);x.setValue("key",j)},p=()=>{var h;console.log(i.current),(h=i.current)==null||h.click()};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...x,children:l.jsxs("form",{onSubmit:h=>{h.stopPropagation(),x.handleSubmit(g)(h)},className:"space-y-3",children:[l.jsx(Ne,{control:x.control,name:"name",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"group",render:({field:h})=>l.jsxs(Ce,{children:[l.jsxs(je,{className:"w-full flex justify-between",children:[l.jsx("div",{children:"授权配置组(用于将一个域名证书部署到多个 ssh 主机)"}),l.jsx(_y,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]})})]}),l.jsx(Ee,{children:l.jsxs(Mo,{...h,value:h.value,defaultValue:"emptyId",onValueChange:w=>{x.setValue("group",w)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择分组"})}),l.jsxs(Gs,{children:[l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),o.map(w=>l.jsx(pn,{value:w.id?w.id:"",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:w.name})},w.id))]})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"id",render:({field:h})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"configType",render:({field:h})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...h})}),l.jsx(Se,{})]})}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(Ne,{control:x.control,name:"host",render:({field:h})=>l.jsxs(Ce,{className:"grow",children:[l.jsx(je,{children:"服务器HOST"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Host",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"port",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SSH端口"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Port",...h,type:"number"})}),l.jsx(Se,{})]})})]}),l.jsx(Ne,{control:x.control,name:"username",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"用户名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入用户名",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"password",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入密码",...h,type:"password"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"key",render:({field:h})=>l.jsxs(Ce,{hidden:!0,children:[l.jsx(je,{children:"Key(使用证书登录)"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Key",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"keyFile",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Key(使用证书登录)"}),l.jsx(Ee,{children:l.jsxs("div",{children:[l.jsx(He,{type:"button",variant:"secondary",size:"sm",className:"w-48",onClick:p,children:a||"请选择文件"}),l.jsx(Te,{placeholder:"请输入Key",...h,ref:i,className:"hidden",hidden:!0,type:"file",onChange:_})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"certPath",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"证书上传路径"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入证书上传路径",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"keyPath",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"私钥上传路径"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入私钥上传路径",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"command",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Command"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:"请输入要执行的命令",...h})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},wU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,url:pe.string().url()});let o={url:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"webhook",url:o.url}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{url:c.url}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"url",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Webhook Url"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Webhook Url",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},_U=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,dnsApiToken:pe.string().min(1).max(64)});let o={dnsApiToken:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"cloudflare",dnsApiToken:o.dnsApiToken}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{dnsApiToken:c.dnsApiToken}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"dnsApiToken",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"CLOUD_DNS_API_TOKEN"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入CLOUD_DNS_API_TOKEN",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},bU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,accessKey:pe.string().min(1).max(64),secretKey:pe.string().min(1).max(64)});let o={accessKey:"",secretKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"qiniu",accessKey:o.accessKey,secretKey:o.secretKey}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{accessKey:c.accessKey,secretKey:c.secretKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKey",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretKey",...c})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},SU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,apiKey:pe.string().min(1).max(64)});let o={apiKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"namesilo",apiKey:o.apiKey}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{apiKey:c.apiKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"NAMESILO_API_KEY"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入NAMESILO_API_KEY",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},kU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,apiKey:pe.string().min(1).max(64),apiSecret:pe.string().min(1).max(64)});let o={apiKey:"",apiSecret:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"godaddy",apiKey:o.apiKey,apiSecret:o.apiSecret}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{apiKey:c.apiKey,apiSecret:c.apiSecret}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"GODADDY_API_KEY"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入GODADDY_API_KEY",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiSecret",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"GODADDY_API_SECRET"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入GODADDY_API_SECRET",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})};function jl({trigger:e,op:t,data:r,className:n}){const[s,o]=v.useState(!1),i=Array.from(uo.keys()),[a,c]=v.useState((r==null?void 0:r.configType)||"");let u=l.jsx(l.Fragment,{children:" "});switch(a){case"tencent":u=l.jsx(vU,{data:r,onAfterReq:()=>{o(!1)}});break;case"aliyun":u=l.jsx(yU,{data:r,onAfterReq:()=>{o(!1)}});break;case"ssh":u=l.jsx(xU,{data:r,onAfterReq:()=>{o(!1)}});break;case"webhook":u=l.jsx(wU,{data:r,onAfterReq:()=>{o(!1)}});break;case"cloudflare":u=l.jsx(_U,{data:r,onAfterReq:()=>{o(!1)}});break;case"qiniu":u=l.jsx(bU,{data:r,onAfterReq:()=>{o(!1)}});break;case"namesilo":u=l.jsx(SU,{data:r,onAfterReq:()=>{o(!1)}});break;case"godaddy":u=l.jsx(kU,{data:r,onAfterReq:()=>{o(!1)}});break}const d=f=>f==a?"border-primary":"";return l.jsxs(my,{onOpenChange:o,open:s,children:[l.jsx(gy,{asChild:!0,className:ae(n),children:e}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsxs(nh,{children:[t=="add"?"添加":"编辑","授权"]})}),l.jsx(ih,{className:"max-h-[80vh]",children:l.jsxs("div",{className:"container py-3",children:[l.jsx(Ma,{children:"服务商"}),l.jsxs(Mo,{onValueChange:f=>{console.log(f),c(f)},defaultValue:a,children:[l.jsx(Ks,{className:"mt-3",children:l.jsx(Io,{placeholder:"请选择服务商"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"服务商"}),i.map(f=>{var m,y;return l.jsx(pn,{value:f,children:l.jsxs("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer",d(f)),children:[l.jsx("img",{src:(m=uo.get(f))==null?void 0:m[1],className:"h-6 w-6"}),l.jsx("div",{children:(y=uo.get(f))==null?void 0:y[0]})]})},f)})]})})]}),u]})})]})]})}const CU=({className:e,trigger:t})=>{const{config:{emails:r},setEmails:n}=Kr(),[s,o]=v.useState(!1),i=pe.object({email:pe.string().email()}),a=Tr({resolver:Rr(i),defaultValues:{email:""}}),c=async u=>{if(r.content.emails.includes(u.email)){a.setError("email",{message:"邮箱已存在"});return}const d=[...r.content.emails,u.email];try{const f=await Mc({...r,name:"emails",content:{emails:d}});n(f),a.reset(),a.clearErrors(),o(!1)}catch(f){Object.entries(f.response.data).forEach(([y,x])=>{a.setError(y,{type:"manual",message:x.message})})}};return l.jsxs(my,{onOpenChange:o,open:s,children:[l.jsx(gy,{asChild:!0,className:ae(e),children:t}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsx(nh,{children:"添加邮箱"})}),l.jsx("div",{className:"container py-3",children:l.jsx(Pr,{...a,children:l.jsxs("form",{onSubmit:u=>{console.log(u),u.stopPropagation(),a.handleSubmit(c)(u)},className:"space-y-8",children:[l.jsx(Ne,{control:a.control,name:"email",render:({field:u})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"邮箱"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入邮箱",...u,type:"email"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})},jU=()=>{const{config:{accesses:e,emails:t,accessGroups:r}}=Kr(),[n,s]=v.useState(),o=Nn(),[i,a]=v.useState("base"),[c,u]=v.useState(n?n.targetType:"");v.useEffect(()=>{const p=new URLSearchParams(o.search).get("id");p&&(async()=>{const w=await Q6(p);s(w),u(w.targetType)})()},[o.search]);const d=pe.object({id:pe.string().optional(),domain:pe.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,{message:"请输入正确的域名"}),email:pe.string().email().optional(),access:pe.string().regex(/^[a-zA-Z0-9]+$/,{message:"请选择DNS服务商授权配置"}),targetAccess:pe.string().optional(),targetType:pe.string().regex(/^[a-zA-Z0-9-]+$/,{message:"请选择部署服务类型"}),variables:pe.string().optional(),group:pe.string().optional(),nameservers:pe.string().optional()}),f=Tr({resolver:Rr(d),defaultValues:{id:"",domain:"",email:"",access:"",targetAccess:"",targetType:"",variables:"",group:"",nameservers:""}});v.useEffect(()=>{n&&f.reset({id:n.id,domain:n.domain,email:n.email,access:n.access,targetAccess:n.targetAccess,targetType:n.targetType,variables:n.variables,group:n.group,nameservers:n.nameservers})},[n,f]);const m=e.filter(_=>{if(_.usage=="apply")return!1;if(c=="")return!0;const p=c.split("-");return _.configType===p[0]}),{toast:y}=qn(),x=Nr(),g=async _=>{const p=_.group=="emptyId"?"":_.group,h=_.targetAccess==="emptyId"?"":_.targetAccess;if(p==""&&h==""){f.setError("group",{type:"manual",message:"部署授权和部署授权组至少选一个"}),f.setError("targetAccess",{type:"manual",message:"部署授权和部署授权组至少选一个"});return}const w={id:_.id,crontab:"0 0 * * *",domain:_.domain,email:_.email,access:_.access,group:p,targetAccess:h,targetType:_.targetType,variables:_.variables,nameservers:_.nameservers};try{await km(w);let C="域名编辑成功";w.id==""&&(C="域名添加成功"),y({title:"成功",description:C}),x("/domains")}catch(C){Object.entries(C.response.data).forEach(([E,R])=>{f.setError(E,{type:"manual",message:R.message})});return}};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(ay,{}),l.jsxs("div",{className:" h-5 text-muted-foreground",children:[n!=null&&n.id?"编辑":"新增","域名"]}),l.jsxs("div",{className:"mt-5 flex w-full justify-center md:space-x-10 flex-col md:flex-row",children:[l.jsxs("div",{className:"w-full md:w-[200px] text-muted-foreground space-x-3 md:space-y-3 flex-row md:flex-col flex",children:[l.jsx("div",{className:ae("cursor-pointer text-right",i==="base"?"text-primary":""),onClick:()=>{a("base")},children:"基础设置"}),l.jsx("div",{className:ae("cursor-pointer text-right",i==="advance"?"text-primary":""),onClick:()=>{a("advance")},children:"高级设置"})]}),l.jsx("div",{className:"w-full md:w-[35em] bg-gray-100 dark:bg-gray-900 p-5 rounded mt-3 md:mt-0",children:l.jsx(Pr,{...f,children:l.jsxs("form",{onSubmit:f.handleSubmit(g),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:f.control,name:"domain",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsx(je,{children:"域名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入域名",..._})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"email",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"flex w-full justify-between",children:[l.jsx("div",{children:"Email(申请证书需要提供邮箱)"}),l.jsx(CU,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]})})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,onValueChange:p=>{f.setValue("email",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择邮箱"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"邮箱列表"}),t.content.emails.map(p=>l.jsx(pn,{value:p,children:l.jsx("div",{children:p})},p))]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"access",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"flex w-full justify-between",children:[l.jsx("div",{children:"DNS 服务商授权配置"}),l.jsx(jl,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]}),op:"add"})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,onValueChange:p=>{f.setValue("access",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择授权配置"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"服务商授权配置"}),e.filter(p=>p.usage!="deploy").map(p=>{var h;return l.jsx(pn,{value:p.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=uo.get(p.configType))==null?void 0:h[1]}),l.jsx("div",{children:p.name})]})},p.id)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"targetType",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsx(je,{children:"部署服务类型"}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,onValueChange:p=>{u(p),f.setValue("targetType",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择部署服务类型"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"部署服务类型"}),tU.map(p=>{var h,w;return l.jsx(pn,{value:p,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=Mm.get(p))==null?void 0:h[1]}),l.jsx("div",{children:(w=Mm.get(p))==null?void 0:w[0]})]})},p)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"targetAccess",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"w-full flex justify-between",children:[l.jsx("div",{children:"部署服务商授权配置"}),l.jsx(jl,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]}),op:"add"})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,onValueChange:p=>{f.setValue("targetAccess",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择授权配置"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsxs(Wi,{children:["服务商授权配置",f.getValues().targetAccess]}),l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:"flex items-center space-x-2",children:"--"})}),m.map(p=>{var h;return l.jsx(pn,{value:p.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=uo.get(p.configType))==null?void 0:h[1]}),l.jsx("div",{children:p.name})]})},p.id)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"group",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance"||c!="ssh",children:[l.jsx(je,{className:"w-full flex justify-between",children:l.jsx("div",{children:"部署配置组(用于将一个域名证书部署到多个 ssh 主机)"})}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,defaultValue:"emptyId",onValueChange:p=>{f.setValue("group",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择分组"})}),l.jsxs(Gs,{children:[l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),r.filter(p=>{var h;return p.expand&&((h=p.expand)==null?void 0:h.access.length)>0}).map(p=>l.jsx(pn,{value:p.id?p.id:"",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:p.name})},p.id))]})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"variables",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance",children:[l.jsx(je,{children:"变量"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:`可在SSH部署中使用,形如: 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:"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$(); +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",EU=()=>{const{config:{accessGroups:e},reloadAccessGroups:t}=Kr(),{toast:r}=qn(),n=Nr(),s=async i=>{try{await _3(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",[NU,N$]=xr(by,[kf]),iN=kf(),[TU,Sy]=NU(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(TU,{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 RU=aN,gN=cN,vN=dN,yN=hN;const xN=RU,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 PU=()=>{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 w3(_);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(EU,{})})]})]})},AU=_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(AU({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"})},DU=()=>{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:"添加域名"})})]})]})})]})},OU=pe.object({username:pe.string().email({message:"请输入正确的邮箱地址"}),password:pe.string().min(10,{message:"密码至少10个字符"})}),MU=()=>{const e=Tr({resolver:Rr(OU),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:"登录"})})]})})]})},IU=()=>st().authStore.isValid&&st().authStore.isAdmin?l.jsx(Q1,{to:"/"}):l.jsxs("div",{className:"container",children:[l.jsx(Ig,{}),l.jsx(cC,{})]}),LU=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"]}),FU=()=>{const{toast:e}=qn(),t=Nr(),r=Tr({resolver:Rr(LU),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:"确认修改"})})]})})})})},zU=()=>{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,{})})})]})})]})},UU=()=>{const[e,t]=v.useState(),[r,n]=v.useState(),s=Nr();return v.useEffect(()=>{(async()=>{const i=await X6();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)})]})]})]})},$U=pe.object({email:pe.string().email("请输入正确的邮箱")}),VU=()=>{var i;const{toast:e}=qn(),t=Nr(),[r,n]=v.useState(!1),s=Tr({resolver:Rr($U),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:"确认修改"})})]})})})})},WU=(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),BU=({children:e})=>{const[t,r]=v.useReducer(WU,{});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})},HU=()=>{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:"保存"})})]})},YU={title:"您有{COUNT}张证书即将过期",content:"有{COUNT}张证书即将过期,域名分别为{DOMAINS},请保持关注!"},ZU=()=>{const[e,t]=v.useState(""),[r,n]=v.useState([YU]),{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:"保存"})})]})},KU=()=>{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 GU(e){try{return new URL(e),!0}catch{return!1}}const qU=()=>{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(),!GU(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",[XU,bN]=xr(Ty),[QU,Ry]=XU(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(QU,{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(JU,{...n,ref:t,present:o})})});jN.displayName=Py;var JU=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 e$=SN,t$=CN,r$=jN,Ms="Accordion",n$=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Dy,s$,o$]=bc(Ms),[ah,T$]=xr(Ms,[o$,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(c$,{...o,ref:t}):l.jsx(l$,{...s,ref:t})})});EN.displayName=Ms;var[NN,i$]=ah(Ms),[TN,a$]=ah(Ms,{collapsible:!1}),l$=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})})})}),c$=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})})})}),[u$,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=s$(r),f=Ea(s)==="ltr",m=ce(e.onKeyDown,y=>{var P;if(!n$.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=i$(qd,r),a=Oy(r),c=Ur(),u=n&&i.value.includes(n)||!1,d=o.disabled||e.disabled;return l.jsx(d$,{scope:r,open:u,disabled:d,triggerId:c,children:l.jsx(e$,{"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=a$(Im,r),a=Oy(r);return l.jsx(Dy.ItemSlot,{scope:r,children:l.jsx(t$,{"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(r$,{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 f$=EN,h$=PN,p$=DN,FN=ON,zN=IN;const ww=f$,ul=v.forwardRef(({className:e,...t},r)=>l.jsx(h$,{ref:r,className:ae("border-b",e),...t}));ul.displayName="AccordionItem";const dl=v.forwardRef(({className:e,children:t,...r},n)=>l.jsx(p$,{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 m$=()=>l.jsx(l.Fragment,{children:l.jsxs(BU,{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(ZU,{})})]})})}),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(HU,{})})]}),l.jsxs(ul,{value:"item-4",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"Telegram"}),l.jsx(fl,{children:l.jsx(KU,{})})]}),l.jsxs(ul,{value:"item-5",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"Webhook"}),l.jsx(fl,{children:l.jsx(qU,{})})]})]})})]})}),g$=FP([{path:"/",element:l.jsx(O3,{}),children:[{path:"/",element:l.jsx(UU,{})},{path:"/domains",element:l.jsx(rz,{})},{path:"/edit",element:l.jsx(jU,{})},{path:"/access",element:l.jsx(PU,{})},{path:"/history",element:l.jsx(DU,{})},{path:"/setting",element:l.jsx(zU,{}),children:[{path:"/setting/password",element:l.jsx(FU,{})},{path:"/setting/account",element:l.jsx(VU,{})},{path:"/setting/notify",element:l.jsx(m$,{})}]}]},{path:"/login",element:l.jsx(IU,{}),children:[{path:"/login",element:l.jsx(MU,{})}]},{path:"/about",element:l.jsx("div",{children:"About"})}]);ip.createRoot(document.getElementById("root")).render(l.jsx(We.StrictMode,{children:l.jsx(E3,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(ZP,{router:g$})})}))});export default v$(); diff --git a/ui/dist/index.html b/ui/dist/index.html index 0635c061..89f70228 100644 --- a/ui/dist/index.html +++ b/ui/dist/index.html @@ -5,7 +5,7 @@ Certimate - Your Trusted SSL Automation Partner - + diff --git a/ui/package-lock.json b/ui/package-lock.json index 12c292c6..408326c3 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -53,7 +53,7 @@ "eslint-plugin-react-refresh": "^0.4.7", "postcss": "^8.4.40", "tailwindcss": "^3.4.7", - "typescript": "^5.2.2", + "typescript": "^5.6.2", "vite": "^5.3.4" } }, @@ -2100,9 +2100,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.19.0.tgz", - "integrity": "sha512-JlPfZ/C7yn5S5p0yKk7uhHTTnFlvTgLetl2VxqE518QgyM7C9bSfFTYvB/Q/ftkq0RIPY4ySxTz+/wKJ/dXC0w==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.4.tgz", + "integrity": "sha512-Fxamp4aEZnfPOcGA8KSNEohV8hX7zVHOemC8jVBoBUHu5zpJK/Eu3uJwt6BMgy9fkvzxDaurgj96F/NiLukF2w==", "cpu": [ "arm" ], @@ -2113,9 +2113,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.19.0.tgz", - "integrity": "sha512-RDxUSY8D1tWYfn00DDi5myxKgOk6RvWPxhmWexcICt/MEC6yEMr4HNCu1sXXYLw8iAsg0D44NuU+qNq7zVWCrw==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.22.4.tgz", + "integrity": "sha512-VXoK5UMrgECLYaMuGuVTOx5kcuap1Jm8g/M83RnCHBKOqvPPmROFJGQaZhGccnsFtfXQ3XYa4/jMCJvZnbJBdA==", "cpu": [ "arm64" ], @@ -2126,9 +2126,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.19.0.tgz", - "integrity": "sha512-emvKHL4B15x6nlNTBMtIaC9tLPRpeA5jMvRLXVbl/W9Ie7HhkrE7KQjvgS9uxgatL1HmHWDXk5TTS4IaNJxbAA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.22.4.tgz", + "integrity": "sha512-xMM9ORBqu81jyMKCDP+SZDhnX2QEVQzTcC6G18KlTQEzWK8r/oNZtKuZaCcHhnsa6fEeOBionoyl5JsAbE/36Q==", "cpu": [ "arm64" ], @@ -2139,9 +2139,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.19.0.tgz", - "integrity": "sha512-fO28cWA1dC57qCd+D0rfLC4VPbh6EOJXrreBmFLWPGI9dpMlER2YwSPZzSGfq11XgcEpPukPTfEVFtw2q2nYJg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.22.4.tgz", + "integrity": "sha512-aJJyYKQwbHuhTUrjWjxEvGnNNBCnmpHDvrb8JFDbeSH3m2XdHcxDd3jthAzvmoI8w/kSjd2y0udT+4okADsZIw==", "cpu": [ "x64" ], @@ -2152,9 +2152,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.19.0.tgz", - "integrity": "sha512-2Rn36Ubxdv32NUcfm0wB1tgKqkQuft00PtM23VqLuCUR4N5jcNWDoV5iBC9jeGdgS38WK66ElncprqgMUOyomw==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.22.4.tgz", + "integrity": "sha512-j63YtCIRAzbO+gC2L9dWXRh5BFetsv0j0va0Wi9epXDgU/XUi5dJKo4USTttVyK7fGw2nPWK0PbAvyliz50SCQ==", "cpu": [ "arm" ], @@ -2165,9 +2165,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.19.0.tgz", - "integrity": "sha512-gJuzIVdq/X1ZA2bHeCGCISe0VWqCoNT8BvkQ+BfsixXwTOndhtLUpOg0A1Fcx/+eA6ei6rMBzlOz4JzmiDw7JQ==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.22.4.tgz", + "integrity": "sha512-dJnWUgwWBX1YBRsuKKMOlXCzh2Wu1mlHzv20TpqEsfdZLb3WoJW2kIEsGwLkroYf24IrPAvOT/ZQ2OYMV6vlrg==", "cpu": [ "arm" ], @@ -2178,9 +2178,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.19.0.tgz", - "integrity": "sha512-0EkX2HYPkSADo9cfeGFoQ7R0/wTKb7q6DdwI4Yn/ULFE1wuRRCHybxpl2goQrx4c/yzK3I8OlgtBu4xvted0ug==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.22.4.tgz", + "integrity": "sha512-AdPRoNi3NKVLolCN/Sp4F4N1d98c4SBnHMKoLuiG6RXgoZ4sllseuGioszumnPGmPM2O7qaAX/IJdeDU8f26Aw==", "cpu": [ "arm64" ], @@ -2191,9 +2191,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.19.0.tgz", - "integrity": "sha512-GlIQRj9px52ISomIOEUq/IojLZqzkvRpdP3cLgIE1wUWaiU5Takwlzpz002q0Nxxr1y2ZgxC2obWxjr13lvxNQ==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.22.4.tgz", + "integrity": "sha512-Gl0AxBtDg8uoAn5CCqQDMqAx22Wx22pjDOjBdmG0VIWX3qUBHzYmOKh8KXHL4UpogfJ14G4wk16EQogF+v8hmA==", "cpu": [ "arm64" ], @@ -2204,9 +2204,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.19.0.tgz", - "integrity": "sha512-N6cFJzssruDLUOKfEKeovCKiHcdwVYOT1Hs6dovDQ61+Y9n3Ek4zXvtghPPelt6U0AH4aDGnDLb83uiJMkWYzQ==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.22.4.tgz", + "integrity": "sha512-3aVCK9xfWW1oGQpTsYJJPF6bfpWfhbRnhdlyhak2ZiyFLDaayz0EP5j9V1RVLAAxlmWKTDfS9wyRyY3hvhPoOg==", "cpu": [ "ppc64" ], @@ -2217,9 +2217,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.19.0.tgz", - "integrity": "sha512-2DnD3mkS2uuam/alF+I7M84koGwvn3ZVD7uG+LEWpyzo/bq8+kKnus2EVCkcvh6PlNB8QPNFOz6fWd5N8o1CYg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.22.4.tgz", + "integrity": "sha512-ePYIir6VYnhgv2C5Xe9u+ico4t8sZWXschR6fMgoPUK31yQu7hTEJb7bCqivHECwIClJfKgE7zYsh1qTP3WHUA==", "cpu": [ "riscv64" ], @@ -2230,9 +2230,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.19.0.tgz", - "integrity": "sha512-D6pkaF7OpE7lzlTOFCB2m3Ngzu2ykw40Nka9WmKGUOTS3xcIieHe82slQlNq69sVB04ch73thKYIWz/Ian8DUA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.22.4.tgz", + "integrity": "sha512-GqFJ9wLlbB9daxhVlrTe61vJtEY99/xB3C8e4ULVsVfflcpmR6c8UZXjtkMA6FhNONhj2eA5Tk9uAVw5orEs4Q==", "cpu": [ "s390x" ], @@ -2243,9 +2243,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.19.0.tgz", - "integrity": "sha512-HBndjQLP8OsdJNSxpNIN0einbDmRFg9+UQeZV1eiYupIRuZsDEoeGU43NQsS34Pp166DtwQOnpcbV/zQxM+rWA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.22.4.tgz", + "integrity": "sha512-87v0ol2sH9GE3cLQLNEy0K/R0pz1nvg76o8M5nhMR0+Q+BBGLnb35P0fVz4CQxHYXaAOhE8HhlkaZfsdUOlHwg==", "cpu": [ "x64" ], @@ -2256,9 +2256,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.19.0.tgz", - "integrity": "sha512-HxfbvfCKJe/RMYJJn0a12eiOI9OOtAUF4G6ozrFUK95BNyoJaSiBjIOHjZskTUffUrB84IPKkFG9H9nEvJGW6A==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.22.4.tgz", + "integrity": "sha512-UV6FZMUgePDZrFjrNGIWzDo/vABebuXBhJEqrHxrGiU6HikPy0Z3LfdtciIttEUQfuDdCn8fqh7wiFJjCNwO+g==", "cpu": [ "x64" ], @@ -2269,9 +2269,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.19.0.tgz", - "integrity": "sha512-HxDMKIhmcguGTiP5TsLNolwBUK3nGGUEoV/BO9ldUBoMLBssvh4J0X8pf11i1fTV7WShWItB1bKAKjX4RQeYmg==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.22.4.tgz", + "integrity": "sha512-BjI+NVVEGAXjGWYHz/vv0pBqfGoUH0IGZ0cICTn7kB9PyjrATSkX+8WkguNjWoj2qSr1im/+tTGRaY+4/PdcQw==", "cpu": [ "arm64" ], @@ -2282,9 +2282,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.19.0.tgz", - "integrity": "sha512-xItlIAZZaiG/u0wooGzRsx11rokP4qyc/79LkAOdznGRAbOFc+SfEdfUOszG1odsHNgwippUJavag/+W/Etc6Q==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.22.4.tgz", + "integrity": "sha512-SiWG/1TuUdPvYmzmYnmd3IEifzR61Tragkbx9D3+R8mzQqDBz8v+BvZNDlkiTtI9T15KYZhP0ehn3Dld4n9J5g==", "cpu": [ "ia32" ], @@ -2295,9 +2295,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.19.0.tgz", - "integrity": "sha512-xNo5fV5ycvCCKqiZcpB65VMR11NJB+StnxHz20jdqRAktfdfzhgjTiJ2doTDQE/7dqGaV5I7ZGqKpgph6lCIag==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.22.4.tgz", + "integrity": "sha512-j8pPKp53/lq9lMXN57S8cFz0MynJk8OWNuUnXct/9KCpKU7DgU3bYMJhwWmcqC0UU29p8Lr0/7KEVcaM6bf47Q==", "cpu": [ "x64" ], @@ -2350,7 +2350,7 @@ }, "node_modules/@types/estree": { "version": "1.0.5", - "resolved": "https://registry.npmmirror.com/@types/estree/-/estree-1.0.5.tgz", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, @@ -4032,9 +4032,9 @@ } }, "node_modules/micromatch": { - "version": "4.0.7", - "resolved": "https://registry.npmmirror.com/micromatch/-/micromatch-4.0.7.tgz", - "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" @@ -4290,9 +4290,9 @@ } }, "node_modules/picocolors": { - "version": "1.0.1", - "resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-1.0.1.tgz", - "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", + "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==" }, "node_modules/picomatch": { "version": "2.3.1", @@ -4327,9 +4327,9 @@ "integrity": "sha512-WJHyaqdAt95JgZ1OCRD099+DST4IIG0M/jMrCckWYDSN/6ocp61qsz7m6h0xI0J2N79ScBljceEC0fFAaQrrAw==" }, "node_modules/postcss": { - "version": "8.4.40", - "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.40.tgz", - "integrity": "sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==", + "version": "8.4.47", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz", + "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==", "funding": [ { "type": "opencollective", @@ -4346,8 +4346,8 @@ ], "dependencies": { "nanoid": "^3.3.7", - "picocolors": "^1.0.1", - "source-map-js": "^1.2.0" + "picocolors": "^1.1.0", + "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12 || >=14" @@ -4743,9 +4743,9 @@ } }, "node_modules/rollup": { - "version": "4.19.0", - "resolved": "https://registry.npmmirror.com/rollup/-/rollup-4.19.0.tgz", - "integrity": "sha512-5r7EYSQIowHsK4eTZ0Y81qpZuJz+MUuYeqmmYmRMl1nwhdmbiYqt5jwzf6u7wyOzJgYqtCRMtVRKOtHANBz7rA==", + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.22.4.tgz", + "integrity": "sha512-vD8HJ5raRcWOyymsR6Z3o6+RzfEPCnVLMFJ6vRslO1jt4LO6dUo5Qnpg7y4RkZFM2DMe3WUirkI5c16onjrc6A==", "dev": true, "dependencies": { "@types/estree": "1.0.5" @@ -4758,22 +4758,22 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.19.0", - "@rollup/rollup-android-arm64": "4.19.0", - "@rollup/rollup-darwin-arm64": "4.19.0", - "@rollup/rollup-darwin-x64": "4.19.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.19.0", - "@rollup/rollup-linux-arm-musleabihf": "4.19.0", - "@rollup/rollup-linux-arm64-gnu": "4.19.0", - "@rollup/rollup-linux-arm64-musl": "4.19.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.19.0", - "@rollup/rollup-linux-riscv64-gnu": "4.19.0", - "@rollup/rollup-linux-s390x-gnu": "4.19.0", - "@rollup/rollup-linux-x64-gnu": "4.19.0", - "@rollup/rollup-linux-x64-musl": "4.19.0", - "@rollup/rollup-win32-arm64-msvc": "4.19.0", - "@rollup/rollup-win32-ia32-msvc": "4.19.0", - "@rollup/rollup-win32-x64-msvc": "4.19.0", + "@rollup/rollup-android-arm-eabi": "4.22.4", + "@rollup/rollup-android-arm64": "4.22.4", + "@rollup/rollup-darwin-arm64": "4.22.4", + "@rollup/rollup-darwin-x64": "4.22.4", + "@rollup/rollup-linux-arm-gnueabihf": "4.22.4", + "@rollup/rollup-linux-arm-musleabihf": "4.22.4", + "@rollup/rollup-linux-arm64-gnu": "4.22.4", + "@rollup/rollup-linux-arm64-musl": "4.22.4", + "@rollup/rollup-linux-powerpc64le-gnu": "4.22.4", + "@rollup/rollup-linux-riscv64-gnu": "4.22.4", + "@rollup/rollup-linux-s390x-gnu": "4.22.4", + "@rollup/rollup-linux-x64-gnu": "4.22.4", + "@rollup/rollup-linux-x64-musl": "4.22.4", + "@rollup/rollup-win32-arm64-msvc": "4.22.4", + "@rollup/rollup-win32-ia32-msvc": "4.22.4", + "@rollup/rollup-win32-x64-msvc": "4.22.4", "fsevents": "~2.3.2" } }, @@ -4869,9 +4869,9 @@ } }, "node_modules/source-map-js": { - "version": "1.2.0", - "resolved": "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.2.0.tgz", - "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "engines": { "node": ">=0.10.0" } @@ -5187,9 +5187,9 @@ } }, "node_modules/typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmmirror.com/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", + "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -5303,14 +5303,14 @@ } }, "node_modules/vite": { - "version": "5.3.5", - "resolved": "https://registry.npmmirror.com/vite/-/vite-5.3.5.tgz", - "integrity": "sha512-MdjglKR6AQXQb9JGiS7Rc2wC6uMjcm7Go/NHNO63EwiJXfuk9PgqiP/n5IDJCziMkfw9n4Ubp7lttNwz+8ZVKA==", + "version": "5.4.8", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.8.tgz", + "integrity": "sha512-FqrItQ4DT1NC4zCUqMB4c4AZORMKIa0m8/URVCZ77OZ/QSNeJ54bU1vrFADbDsuwfIPcgknRkmqakQcgnL4GiQ==", "dev": true, "dependencies": { "esbuild": "^0.21.3", - "postcss": "^8.4.39", - "rollup": "^4.13.0" + "postcss": "^8.4.43", + "rollup": "^4.20.0" }, "bin": { "vite": "bin/vite.js" @@ -5329,6 +5329,7 @@ "less": "*", "lightningcss": "^1.21.0", "sass": "*", + "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.4.0" @@ -5346,6 +5347,9 @@ "sass": { "optional": true }, + "sass-embedded": { + "optional": true + }, "stylus": { "optional": true }, diff --git a/ui/package.json b/ui/package.json index 1c954e65..d151ae32 100644 --- a/ui/package.json +++ b/ui/package.json @@ -55,7 +55,7 @@ "eslint-plugin-react-refresh": "^0.4.7", "postcss": "^8.4.40", "tailwindcss": "^3.4.7", - "typescript": "^5.2.2", + "typescript": "^5.6.2", "vite": "^5.3.4" } } From 077b3654580fbbcf9ac2c637eb443d3208f36b5f Mon Sep 17 00:00:00 2001 From: yoan <536464346@qq.com> Date: Thu, 26 Sep 2024 20:25:31 +0800 Subject: [PATCH 4/5] fix conflict --- .../{index-GtUlLYeZ.js => index-DusjrPWT.js} | 18 +++++++++--------- ui/dist/index.html | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) rename ui/dist/assets/{index-GtUlLYeZ.js => index-DusjrPWT.js} (94%) diff --git a/ui/dist/assets/index-GtUlLYeZ.js b/ui/dist/assets/index-DusjrPWT.js similarity index 94% rename from ui/dist/assets/index-GtUlLYeZ.js rename to ui/dist/assets/index-DusjrPWT.js index ec7953f5..ebc4d713 100644 --- a/ui/dist/assets/index-GtUlLYeZ.js +++ b/ui/dist/assets/index-DusjrPWT.js @@ -1,4 +1,4 @@ -var HN=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var v$=HN((R$,Gu)=>{function _w(e,t){for(var r=0;rn[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();var Kc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bw={exports:{}},Xd={},Sw={exports:{}},tt={};/** +var HN=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var y$=HN((P$,Gu)=>{function _w(e,t){for(var r=0;rn[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();var Kc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bw={exports:{}},Xd={},Sw={exports:{}},tt={};/** * @license React * react.production.min.js * @@ -271,26 +271,26 @@ Error generating stack: `+o.message+` `)},V0=function(){var e=parseInt(document.body.getAttribute(Xi)||"0",10);return isFinite(e)?e:0},vM=function(){v.useEffect(function(){return document.body.setAttribute(Xi,(V0()+1).toString()),function(){var e=V0()-1;e<=0?document.body.removeAttribute(Xi):document.body.setAttribute(Xi,e.toString())}},[])},yM=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;vM();var o=v.useMemo(function(){return pM(s)},[s]);return v.createElement(mM,{styles:gM(o,!t,s,r?"":"!important")})},cm=!1;if(typeof window<"u")try{var vu=Object.defineProperty({},"passive",{get:function(){return cm=!0,!0}});window.addEventListener("test",vu,vu),window.removeEventListener("test",vu,vu)}catch{cm=!1}var _i=cm?{passive:!1}:!1,xM=function(e){return e.tagName==="TEXTAREA"},Hb=function(e,t){var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!xM(e)&&r[t]==="visible")},wM=function(e){return Hb(e,"overflowY")},_M=function(e){return Hb(e,"overflowX")},W0=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=Yb(e,n);if(s){var o=Zb(e,n),i=o[1],a=o[2];if(i>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},bM=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},SM=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Yb=function(e,t){return e==="v"?wM(t):_M(t)},Zb=function(e,t){return e==="v"?bM(t):SM(t)},kM=function(e,t){return e==="h"&&t==="rtl"?-1:1},CM=function(e,t,r,n,s){var o=kM(e,window.getComputedStyle(t).direction),i=o*n,a=r.target,c=t.contains(a),u=!1,d=i>0,f=0,m=0;do{var y=Zb(e,a),x=y[0],g=y[1],_=y[2],p=g-_-o*x;(x||p)&&Yb(e,a)&&(f+=p,m+=x),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&(Math.abs(f)<1||!s)||!d&&(Math.abs(m)<1||!s))&&(u=!0),u},yu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},B0=function(e){return[e.deltaX,e.deltaY]},H0=function(e){return e&&"current"in e?e.current:e},jM=function(e,t){return e[0]===t[0]&&e[1]===t[1]},EM=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},NM=0,bi=[];function TM(e){var t=v.useRef([]),r=v.useRef([0,0]),n=v.useRef(),s=v.useState(NM++)[0],o=v.useState(Bb)[0],i=v.useRef(e);v.useEffect(function(){i.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=qO([e.lockRef.current],(e.shards||[]).map(H0),!0).filter(Boolean);return g.forEach(function(_){return _.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(g,_){if("touches"in g&&g.touches.length===2)return!i.current.allowPinchZoom;var p=yu(g),h=r.current,w="deltaX"in g?g.deltaX:h[0]-p[0],C="deltaY"in g?g.deltaY:h[1]-p[1],j,E=g.target,R=Math.abs(w)>Math.abs(C)?"h":"v";if("touches"in g&&R==="h"&&E.type==="range")return!1;var P=W0(R,E);if(!P)return!0;if(P?j=R:(j=R==="v"?"h":"v",P=W0(R,E)),!P)return!1;if(!n.current&&"changedTouches"in g&&(w||C)&&(n.current=j),!j)return!0;var A=n.current||j;return CM(A,_,g,A==="h"?w:C,!0)},[]),c=v.useCallback(function(g){var _=g;if(!(!bi.length||bi[bi.length-1]!==o)){var p="deltaY"in _?B0(_):yu(_),h=t.current.filter(function(j){return j.name===_.type&&(j.target===_.target||_.target===j.shadowParent)&&jM(j.delta,p)})[0];if(h&&h.should){_.cancelable&&_.preventDefault();return}if(!h){var w=(i.current.shards||[]).map(H0).filter(Boolean).filter(function(j){return j.contains(_.target)}),C=w.length>0?a(_,w[0]):!i.current.noIsolation;C&&_.cancelable&&_.preventDefault()}}},[]),u=v.useCallback(function(g,_,p,h){var w={name:g,delta:_,target:p,should:h,shadowParent:RM(p)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(C){return C!==w})},1)},[]),d=v.useCallback(function(g){r.current=yu(g),n.current=void 0},[]),f=v.useCallback(function(g){u(g.type,B0(g),g.target,a(g,e.lockRef.current))},[]),m=v.useCallback(function(g){u(g.type,yu(g),g.target,a(g,e.lockRef.current))},[]);v.useEffect(function(){return bi.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,_i),document.addEventListener("touchmove",c,_i),document.addEventListener("touchstart",d,_i),function(){bi=bi.filter(function(g){return g!==o}),document.removeEventListener("wheel",c,_i),document.removeEventListener("touchmove",c,_i),document.removeEventListener("touchstart",d,_i)}},[]);var y=e.removeScrollBar,x=e.inert;return v.createElement(v.Fragment,null,x?v.createElement(o,{styles:EM(s)}):null,y?v.createElement(yM,{gapMode:e.gapMode}):null)}function RM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const PM=oM(Wb,TM);var jf=v.forwardRef(function(e,t){return v.createElement(Cf,In({},e,{ref:t,sideCar:PM}))});jf.classNames=Cf.classNames;var um=["Enter"," "],AM=["ArrowDown","PageUp","Home"],Kb=["ArrowUp","PageDown","End"],DM=[...AM,...Kb],OM={ltr:[...um,"ArrowRight"],rtl:[...um,"ArrowLeft"]},MM={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Cc="Menu",[Gl,IM,LM]=bc(Cc),[ci,Gb]=xr(Cc,[LM,Pa,kf]),Ef=Pa(),qb=kf(),[FM,ui]=ci(Cc),[zM,jc]=ci(Cc),Xb=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:s,onOpenChange:o,modal:i=!0}=e,a=Ef(t),[c,u]=v.useState(null),d=v.useRef(!1),f=Dt(o),m=Ea(s);return v.useEffect(()=>{const y=()=>{d.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>d.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),l.jsx(Xg,{...a,children:l.jsx(FM,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:l.jsx(zM,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:i,children:n})})})};Xb.displayName=Cc;var UM="MenuAnchor",rv=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Ef(r);return l.jsx(Qg,{...s,...n,ref:t})});rv.displayName=UM;var nv="MenuPortal",[$M,Qb]=ci(nv,{forceMount:void 0}),Jb=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:s}=e,o=ui(nv,t);return l.jsx($M,{scope:t,forceMount:r,children:l.jsx(ur,{present:r||o.open,children:l.jsx(kc,{asChild:!0,container:s,children:n})})})};Jb.displayName=nv;var rn="MenuContent",[VM,sv]=ci(rn),eS=v.forwardRef((e,t)=>{const r=Qb(rn,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=ui(rn,e.__scopeMenu),i=jc(rn,e.__scopeMenu);return l.jsx(Gl.Provider,{scope:e.__scopeMenu,children:l.jsx(ur,{present:n||o.open,children:l.jsx(Gl.Slot,{scope:e.__scopeMenu,children:i.modal?l.jsx(WM,{...s,ref:t}):l.jsx(BM,{...s,ref:t})})})})}),WM=v.forwardRef((e,t)=>{const r=ui(rn,e.__scopeMenu),n=v.useRef(null),s=Ke(t,n);return v.useEffect(()=>{const o=n.current;if(o)return tv(o)},[]),l.jsx(ov,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ce(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),BM=v.forwardRef((e,t)=>{const r=ui(rn,e.__scopeMenu);return l.jsx(ov,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),ov=v.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:y,disableOutsideScroll:x,...g}=e,_=ui(rn,r),p=jc(rn,r),h=Ef(r),w=qb(r),C=IM(r),[j,E]=v.useState(null),R=v.useRef(null),P=Ke(t,R,_.onContentChange),A=v.useRef(0),L=v.useRef(""),q=v.useRef(0),N=v.useRef(null),F=v.useRef("right"),b=v.useRef(0),V=x?jf:v.Fragment,te=x?{as:bs,allowPinchZoom:!0}:void 0,W=I=>{var he,ye;const Q=L.current+I,z=C().filter(ke=>!ke.disabled),$=document.activeElement,fe=(he=z.find(ke=>ke.ref.current===$))==null?void 0:he.textValue,ne=z.map(ke=>ke.textValue),se=rI(ne,Q,fe),Oe=(ye=z.find(ke=>ke.textValue===se))==null?void 0:ye.ref.current;(function ke(Fe){L.current=Fe,window.clearTimeout(A.current),Fe!==""&&(A.current=window.setTimeout(()=>ke(""),1e3))})(Q),Oe&&setTimeout(()=>Oe.focus())};v.useEffect(()=>()=>window.clearTimeout(A.current),[]),Vg();const Z=v.useCallback(I=>{var z,$;return F.current===((z=N.current)==null?void 0:z.side)&&sI(I,($=N.current)==null?void 0:$.area)},[]);return l.jsx(VM,{scope:r,searchRef:L,onItemEnter:v.useCallback(I=>{Z(I)&&I.preventDefault()},[Z]),onItemLeave:v.useCallback(I=>{var Q;Z(I)||((Q=R.current)==null||Q.focus(),E(null))},[Z]),onTriggerLeave:v.useCallback(I=>{Z(I)&&I.preventDefault()},[Z]),pointerGraceTimerRef:q,onPointerGraceIntentChange:v.useCallback(I=>{N.current=I},[]),children:l.jsx(V,{...te,children:l.jsx(wf,{asChild:!0,trapped:s,onMountAutoFocus:ce(o,I=>{var Q;I.preventDefault(),(Q=R.current)==null||Q.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:y,children:l.jsx(Fb,{asChild:!0,...w,dir:p.dir,orientation:"vertical",loop:n,currentTabStopId:j,onCurrentTabStopIdChange:E,onEntryFocus:ce(c,I=>{p.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(Jg,{role:"menu","aria-orientation":"vertical","data-state":gS(_.open),"data-radix-menu-content":"",dir:p.dir,...h,...g,ref:P,style:{outline:"none",...g.style},onKeyDown:ce(g.onKeyDown,I=>{const z=I.target.closest("[data-radix-menu-content]")===I.currentTarget,$=I.ctrlKey||I.altKey||I.metaKey,fe=I.key.length===1;z&&(I.key==="Tab"&&I.preventDefault(),!$&&fe&&W(I.key));const ne=R.current;if(I.target!==ne||!DM.includes(I.key))return;I.preventDefault();const Oe=C().filter(he=>!he.disabled).map(he=>he.ref.current);Kb.includes(I.key)&&Oe.reverse(),eI(Oe)}),onBlur:ce(e.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(A.current),L.current="")}),onPointerMove:ce(e.onPointerMove,ql(I=>{const Q=I.target,z=b.current!==I.clientX;if(I.currentTarget.contains(Q)&&z){const $=I.clientX>b.current?"right":"left";F.current=$,b.current=I.clientX}}))})})})})})})});eS.displayName=rn;var HM="MenuGroup",iv=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{role:"group",...n,ref:t})});iv.displayName=HM;var YM="MenuLabel",tS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});tS.displayName=YM;var jd="MenuItem",Y0="menu.itemSelect",Nf=v.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...s}=e,o=v.useRef(null),i=jc(jd,e.__scopeMenu),a=sv(jd,e.__scopeMenu),c=Ke(t,o),u=v.useRef(!1),d=()=>{const f=o.current;if(!r&&f){const m=new CustomEvent(Y0,{bubbles:!0,cancelable:!0});f.addEventListener(Y0,y=>n==null?void 0:n(y),{once:!0}),$g(f,m),m.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx(rS,{...s,ref:c,disabled:r,onClick:ce(e.onClick,d),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),u.current=!0},onPointerUp:ce(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:ce(e.onKeyDown,f=>{const m=a.searchRef.current!=="";r||m&&f.key===" "||um.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Nf.displayName=jd;var rS=v.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...o}=e,i=sv(jd,r),a=qb(r),c=v.useRef(null),u=Ke(t,c),[d,f]=v.useState(!1),[m,y]=v.useState("");return v.useEffect(()=>{const x=c.current;x&&y((x.textContent??"").trim())},[o.children]),l.jsx(Gl.ItemSlot,{scope:r,disabled:n,textValue:s??m,children:l.jsx(zb,{asChild:!0,...a,focusable:!n,children:l.jsx(Re.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:u,onPointerMove:ce(e.onPointerMove,ql(x=>{n?i.onItemLeave(x):(i.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ce(e.onPointerLeave,ql(x=>i.onItemLeave(x))),onFocus:ce(e.onFocus,()=>f(!0)),onBlur:ce(e.onBlur,()=>f(!1))})})})}),ZM="MenuCheckboxItem",nS=v.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...s}=e;return l.jsx(lS,{scope:e.__scopeMenu,checked:r,children:l.jsx(Nf,{role:"menuitemcheckbox","aria-checked":Ed(r)?"mixed":r,...s,ref:t,"data-state":lv(r),onSelect:ce(s.onSelect,()=>n==null?void 0:n(Ed(r)?!0:!r),{checkForDefaultPrevented:!1})})})});nS.displayName=ZM;var sS="MenuRadioGroup",[KM,GM]=ci(sS,{value:void 0,onValueChange:()=>{}}),oS=v.forwardRef((e,t)=>{const{value:r,onValueChange:n,...s}=e,o=Dt(n);return l.jsx(KM,{scope:e.__scopeMenu,value:r,onValueChange:o,children:l.jsx(iv,{...s,ref:t})})});oS.displayName=sS;var iS="MenuRadioItem",aS=v.forwardRef((e,t)=>{const{value:r,...n}=e,s=GM(iS,e.__scopeMenu),o=r===s.value;return l.jsx(lS,{scope:e.__scopeMenu,checked:o,children:l.jsx(Nf,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":lv(o),onSelect:ce(n.onSelect,()=>{var i;return(i=s.onValueChange)==null?void 0:i.call(s,r)},{checkForDefaultPrevented:!1})})})});aS.displayName=iS;var av="MenuItemIndicator",[lS,qM]=ci(av,{checked:!1}),cS=v.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...s}=e,o=qM(av,r);return l.jsx(ur,{present:n||Ed(o.checked)||o.checked===!0,children:l.jsx(Re.span,{...s,ref:t,"data-state":lv(o.checked)})})});cS.displayName=av;var XM="MenuSeparator",uS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});uS.displayName=XM;var QM="MenuArrow",dS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Ef(r);return l.jsx(ev,{...s,...n,ref:t})});dS.displayName=QM;var JM="MenuSub",[x$,fS]=ci(JM),ol="MenuSubTrigger",hS=v.forwardRef((e,t)=>{const r=ui(ol,e.__scopeMenu),n=jc(ol,e.__scopeMenu),s=fS(ol,e.__scopeMenu),o=sv(ol,e.__scopeMenu),i=v.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=o,u={__scopeMenu:e.__scopeMenu},d=v.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),l.jsx(rv,{asChild:!0,...u,children:l.jsx(rS,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":gS(r.open),...e,ref:yf(t,s.onTriggerChange),onClick:f=>{var m;(m=e.onClick)==null||m.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ce(e.onPointerMove,ql(f=>{o.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:ce(e.onPointerLeave,ql(f=>{var y,x;d();const m=(y=r.content)==null?void 0:y.getBoundingClientRect();if(m){const g=(x=r.content)==null?void 0:x.dataset.side,_=g==="right",p=_?-5:5,h=m[_?"left":"right"],w=m[_?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+p,y:f.clientY},{x:h,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x:h,y:m.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:ce(e.onKeyDown,f=>{var y;const m=o.searchRef.current!=="";e.disabled||m&&f.key===" "||OM[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});hS.displayName=ol;var pS="MenuSubContent",mS=v.forwardRef((e,t)=>{const r=Qb(rn,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=ui(rn,e.__scopeMenu),i=jc(rn,e.__scopeMenu),a=fS(pS,e.__scopeMenu),c=v.useRef(null),u=Ke(t,c);return l.jsx(Gl.Provider,{scope:e.__scopeMenu,children:l.jsx(ur,{present:n||o.open,children:l.jsx(Gl.Slot,{scope:e.__scopeMenu,children:l.jsx(ov,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;i.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:ce(e.onFocusOutside,d=>{d.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:ce(e.onEscapeKeyDown,d=>{i.onClose(),d.preventDefault()}),onKeyDown:ce(e.onKeyDown,d=>{var y;const f=d.currentTarget.contains(d.target),m=MM[i.dir].includes(d.key);f&&m&&(o.onOpenChange(!1),(y=a.trigger)==null||y.focus(),d.preventDefault())})})})})})});mS.displayName=pS;function gS(e){return e?"open":"closed"}function Ed(e){return e==="indeterminate"}function lv(e){return Ed(e)?"indeterminate":e?"checked":"unchecked"}function eI(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function tI(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function rI(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=tI(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function nI(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;on!=d>n&&r<(u-a)*(n-c)/(d-c)+a&&(s=!s)}return s}function sI(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return nI(r,t)}function ql(e){return t=>t.pointerType==="mouse"?e(t):void 0}var oI=Xb,iI=rv,aI=Jb,lI=eS,cI=iv,uI=tS,dI=Nf,fI=nS,hI=oS,pI=aS,mI=cS,gI=uS,vI=dS,yI=hS,xI=mS,cv="DropdownMenu",[wI,w$]=xr(cv,[Gb]),wr=Gb(),[_I,vS]=wI(cv),yS=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:s,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,c=wr(t),u=v.useRef(null),[d=!1,f]=on({prop:s,defaultProp:o,onChange:i});return l.jsx(_I,{scope:t,triggerId:Ur(),triggerRef:u,contentId:Ur(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(m=>!m),[f]),modal:a,children:l.jsx(oI,{...c,open:d,onOpenChange:f,dir:n,modal:a,children:r})})};yS.displayName=cv;var xS="DropdownMenuTrigger",wS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=e,o=vS(xS,r),i=wr(r);return l.jsx(iI,{asChild:!0,...i,children:l.jsx(Re.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:yf(t,o.triggerRef),onPointerDown:ce(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:ce(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});wS.displayName=xS;var bI="DropdownMenuPortal",_S=e=>{const{__scopeDropdownMenu:t,...r}=e,n=wr(t);return l.jsx(aI,{...n,...r})};_S.displayName=bI;var bS="DropdownMenuContent",SS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=vS(bS,r),o=wr(r),i=v.useRef(!1);return l.jsx(lI,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...n,ref:t,onCloseAutoFocus:ce(e.onCloseAutoFocus,a=>{var c;i.current||(c=s.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:ce(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});SS.displayName=bS;var SI="DropdownMenuGroup",kI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(cI,{...s,...n,ref:t})});kI.displayName=SI;var CI="DropdownMenuLabel",kS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(uI,{...s,...n,ref:t})});kS.displayName=CI;var jI="DropdownMenuItem",CS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(dI,{...s,...n,ref:t})});CS.displayName=jI;var EI="DropdownMenuCheckboxItem",jS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(fI,{...s,...n,ref:t})});jS.displayName=EI;var NI="DropdownMenuRadioGroup",TI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(hI,{...s,...n,ref:t})});TI.displayName=NI;var RI="DropdownMenuRadioItem",ES=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(pI,{...s,...n,ref:t})});ES.displayName=RI;var PI="DropdownMenuItemIndicator",NS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(mI,{...s,...n,ref:t})});NS.displayName=PI;var AI="DropdownMenuSeparator",TS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(gI,{...s,...n,ref:t})});TS.displayName=AI;var DI="DropdownMenuArrow",OI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(vI,{...s,...n,ref:t})});OI.displayName=DI;var MI="DropdownMenuSubTrigger",RS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(yI,{...s,...n,ref:t})});RS.displayName=MI;var II="DropdownMenuSubContent",PS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(xI,{...s,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});PS.displayName=II;var LI=yS,FI=wS,zI=_S,AS=SS,DS=kS,OS=CS,MS=jS,IS=ES,LS=NS,FS=TS,zS=RS,US=PS;const $S=LI,VS=FI,UI=v.forwardRef(({className:e,inset:t,children:r,...n},s)=>l.jsxs(zS,{ref:s,className:ae("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...n,children:[r,l.jsx(iA,{className:"ml-auto h-4 w-4"})]}));UI.displayName=zS.displayName;const $I=v.forwardRef(({className:e,...t},r)=>l.jsx(US,{ref:r,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));$I.displayName=US.displayName;const uv=v.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(zI,{children:l.jsx(AS,{ref:n,sideOffset:t,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));uv.displayName=AS.displayName;const Qi=v.forwardRef(({className:e,inset:t,...r},n)=>l.jsx(OS,{ref:n,className:ae("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));Qi.displayName=OS.displayName;const VI=v.forwardRef(({className:e,children:t,checked:r,...n},s)=>l.jsxs(MS,{ref:s,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(LS,{children:l.jsx(eb,{className:"h-4 w-4"})})}),t]}));VI.displayName=MS.displayName;const WI=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(IS,{ref:n,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(LS,{children:l.jsx(uA,{className:"h-2 w-2 fill-current"})})}),t]}));WI.displayName=IS.displayName;const WS=v.forwardRef(({className:e,inset:t,...r},n)=>l.jsx(DS,{ref:n,className:ae("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));WS.displayName=DS.displayName;const BS=v.forwardRef(({className:e,...t},r)=>l.jsx(FS,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));BS.displayName=FS.displayName;var dv="Dialog",[HS,YS]=xr(dv),[BI,Tn]=HS(dv),ZS=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,a=v.useRef(null),c=v.useRef(null),[u=!1,d]=on({prop:n,defaultProp:s,onChange:o});return l.jsx(BI,{scope:t,triggerRef:a,contentRef:c,contentId:Ur(),titleId:Ur(),descriptionId:Ur(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:i,children:r})};ZS.displayName=dv;var KS="DialogTrigger",GS=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(KS,r),o=Ke(t,s.triggerRef);return l.jsx(Re.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":pv(s.open),...n,ref:o,onClick:ce(e.onClick,s.onOpenToggle)})});GS.displayName=KS;var fv="DialogPortal",[HI,qS]=HS(fv,{forceMount:void 0}),XS=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,o=Tn(fv,t);return l.jsx(HI,{scope:t,forceMount:r,children:v.Children.map(n,i=>l.jsx(ur,{present:r||o.open,children:l.jsx(kc,{asChild:!0,container:s,children:i})}))})};XS.displayName=fv;var Nd="DialogOverlay",QS=v.forwardRef((e,t)=>{const r=qS(Nd,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=Tn(Nd,e.__scopeDialog);return o.modal?l.jsx(ur,{present:n||o.open,children:l.jsx(YI,{...s,ref:t})}):null});QS.displayName=Nd;var YI=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(Nd,r);return l.jsx(jf,{as:bs,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(Re.div,{"data-state":pv(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),ni="DialogContent",JS=v.forwardRef((e,t)=>{const r=qS(ni,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=Tn(ni,e.__scopeDialog);return l.jsx(ur,{present:n||o.open,children:o.modal?l.jsx(ZI,{...s,ref:t}):l.jsx(KI,{...s,ref:t})})});JS.displayName=ni;var ZI=v.forwardRef((e,t)=>{const r=Tn(ni,e.__scopeDialog),n=v.useRef(null),s=Ke(t,r.contentRef,n);return v.useEffect(()=>{const o=n.current;if(o)return tv(o)},[]),l.jsx(ek,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ce(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ce(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&o.preventDefault()}),onFocusOutside:ce(e.onFocusOutside,o=>o.preventDefault())})}),KI=v.forwardRef((e,t)=>{const r=Tn(ni,e.__scopeDialog),n=v.useRef(!1),s=v.useRef(!1);return l.jsx(ek,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;((u=r.triggerRef.current)==null?void 0:u.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),ek=v.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,a=Tn(ni,r),c=v.useRef(null),u=Ke(t,c);return Vg(),l.jsxs(l.Fragment,{children:[l.jsx(wf,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(Na,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":pv(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(qI,{titleId:a.titleId}),l.jsx(QI,{contentRef:c,descriptionId:a.descriptionId})]})]})}),hv="DialogTitle",tk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(hv,r);return l.jsx(Re.h2,{id:s.titleId,...n,ref:t})});tk.displayName=hv;var rk="DialogDescription",nk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(rk,r);return l.jsx(Re.p,{id:s.descriptionId,...n,ref:t})});nk.displayName=rk;var sk="DialogClose",ok=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(sk,r);return l.jsx(Re.button,{type:"button",...n,ref:t,onClick:ce(e.onClick,()=>s.onOpenChange(!1))})});ok.displayName=sk;function pv(e){return e?"open":"closed"}var ik="DialogTitleWarning",[GI,ak]=oD(ik,{contentName:ni,titleName:hv,docsSlug:"dialog"}),qI=({titleId:e})=>{const t=ak(ik),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. +`)},NM=0,bi=[];function TM(e){var t=v.useRef([]),r=v.useRef([0,0]),n=v.useRef(),s=v.useState(NM++)[0],o=v.useState(Bb)[0],i=v.useRef(e);v.useEffect(function(){i.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=qO([e.lockRef.current],(e.shards||[]).map(H0),!0).filter(Boolean);return g.forEach(function(_){return _.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(g,_){if("touches"in g&&g.touches.length===2)return!i.current.allowPinchZoom;var p=yu(g),h=r.current,w="deltaX"in g?g.deltaX:h[0]-p[0],C="deltaY"in g?g.deltaY:h[1]-p[1],j,E=g.target,R=Math.abs(w)>Math.abs(C)?"h":"v";if("touches"in g&&R==="h"&&E.type==="range")return!1;var P=W0(R,E);if(!P)return!0;if(P?j=R:(j=R==="v"?"h":"v",P=W0(R,E)),!P)return!1;if(!n.current&&"changedTouches"in g&&(w||C)&&(n.current=j),!j)return!0;var A=n.current||j;return CM(A,_,g,A==="h"?w:C,!0)},[]),c=v.useCallback(function(g){var _=g;if(!(!bi.length||bi[bi.length-1]!==o)){var p="deltaY"in _?B0(_):yu(_),h=t.current.filter(function(j){return j.name===_.type&&(j.target===_.target||_.target===j.shadowParent)&&jM(j.delta,p)})[0];if(h&&h.should){_.cancelable&&_.preventDefault();return}if(!h){var w=(i.current.shards||[]).map(H0).filter(Boolean).filter(function(j){return j.contains(_.target)}),C=w.length>0?a(_,w[0]):!i.current.noIsolation;C&&_.cancelable&&_.preventDefault()}}},[]),u=v.useCallback(function(g,_,p,h){var w={name:g,delta:_,target:p,should:h,shadowParent:RM(p)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(C){return C!==w})},1)},[]),d=v.useCallback(function(g){r.current=yu(g),n.current=void 0},[]),f=v.useCallback(function(g){u(g.type,B0(g),g.target,a(g,e.lockRef.current))},[]),m=v.useCallback(function(g){u(g.type,yu(g),g.target,a(g,e.lockRef.current))},[]);v.useEffect(function(){return bi.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,_i),document.addEventListener("touchmove",c,_i),document.addEventListener("touchstart",d,_i),function(){bi=bi.filter(function(g){return g!==o}),document.removeEventListener("wheel",c,_i),document.removeEventListener("touchmove",c,_i),document.removeEventListener("touchstart",d,_i)}},[]);var y=e.removeScrollBar,x=e.inert;return v.createElement(v.Fragment,null,x?v.createElement(o,{styles:EM(s)}):null,y?v.createElement(yM,{gapMode:e.gapMode}):null)}function RM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const PM=oM(Wb,TM);var jf=v.forwardRef(function(e,t){return v.createElement(Cf,In({},e,{ref:t,sideCar:PM}))});jf.classNames=Cf.classNames;var um=["Enter"," "],AM=["ArrowDown","PageUp","Home"],Kb=["ArrowUp","PageDown","End"],DM=[...AM,...Kb],OM={ltr:[...um,"ArrowRight"],rtl:[...um,"ArrowLeft"]},MM={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Cc="Menu",[Gl,IM,LM]=bc(Cc),[ci,Gb]=xr(Cc,[LM,Pa,kf]),Ef=Pa(),qb=kf(),[FM,ui]=ci(Cc),[zM,jc]=ci(Cc),Xb=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:s,onOpenChange:o,modal:i=!0}=e,a=Ef(t),[c,u]=v.useState(null),d=v.useRef(!1),f=Dt(o),m=Ea(s);return v.useEffect(()=>{const y=()=>{d.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>d.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),l.jsx(Xg,{...a,children:l.jsx(FM,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:l.jsx(zM,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:i,children:n})})})};Xb.displayName=Cc;var UM="MenuAnchor",rv=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Ef(r);return l.jsx(Qg,{...s,...n,ref:t})});rv.displayName=UM;var nv="MenuPortal",[$M,Qb]=ci(nv,{forceMount:void 0}),Jb=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:s}=e,o=ui(nv,t);return l.jsx($M,{scope:t,forceMount:r,children:l.jsx(ur,{present:r||o.open,children:l.jsx(kc,{asChild:!0,container:s,children:n})})})};Jb.displayName=nv;var rn="MenuContent",[VM,sv]=ci(rn),eS=v.forwardRef((e,t)=>{const r=Qb(rn,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=ui(rn,e.__scopeMenu),i=jc(rn,e.__scopeMenu);return l.jsx(Gl.Provider,{scope:e.__scopeMenu,children:l.jsx(ur,{present:n||o.open,children:l.jsx(Gl.Slot,{scope:e.__scopeMenu,children:i.modal?l.jsx(WM,{...s,ref:t}):l.jsx(BM,{...s,ref:t})})})})}),WM=v.forwardRef((e,t)=>{const r=ui(rn,e.__scopeMenu),n=v.useRef(null),s=Ke(t,n);return v.useEffect(()=>{const o=n.current;if(o)return tv(o)},[]),l.jsx(ov,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ce(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),BM=v.forwardRef((e,t)=>{const r=ui(rn,e.__scopeMenu);return l.jsx(ov,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),ov=v.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:y,disableOutsideScroll:x,...g}=e,_=ui(rn,r),p=jc(rn,r),h=Ef(r),w=qb(r),C=IM(r),[j,E]=v.useState(null),R=v.useRef(null),P=Ke(t,R,_.onContentChange),A=v.useRef(0),L=v.useRef(""),q=v.useRef(0),N=v.useRef(null),F=v.useRef("right"),b=v.useRef(0),V=x?jf:v.Fragment,te=x?{as:bs,allowPinchZoom:!0}:void 0,W=I=>{var he,ye;const Q=L.current+I,z=C().filter(ke=>!ke.disabled),$=document.activeElement,fe=(he=z.find(ke=>ke.ref.current===$))==null?void 0:he.textValue,ne=z.map(ke=>ke.textValue),se=rI(ne,Q,fe),Oe=(ye=z.find(ke=>ke.textValue===se))==null?void 0:ye.ref.current;(function ke(Fe){L.current=Fe,window.clearTimeout(A.current),Fe!==""&&(A.current=window.setTimeout(()=>ke(""),1e3))})(Q),Oe&&setTimeout(()=>Oe.focus())};v.useEffect(()=>()=>window.clearTimeout(A.current),[]),Vg();const Z=v.useCallback(I=>{var z,$;return F.current===((z=N.current)==null?void 0:z.side)&&sI(I,($=N.current)==null?void 0:$.area)},[]);return l.jsx(VM,{scope:r,searchRef:L,onItemEnter:v.useCallback(I=>{Z(I)&&I.preventDefault()},[Z]),onItemLeave:v.useCallback(I=>{var Q;Z(I)||((Q=R.current)==null||Q.focus(),E(null))},[Z]),onTriggerLeave:v.useCallback(I=>{Z(I)&&I.preventDefault()},[Z]),pointerGraceTimerRef:q,onPointerGraceIntentChange:v.useCallback(I=>{N.current=I},[]),children:l.jsx(V,{...te,children:l.jsx(wf,{asChild:!0,trapped:s,onMountAutoFocus:ce(o,I=>{var Q;I.preventDefault(),(Q=R.current)==null||Q.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:y,children:l.jsx(Fb,{asChild:!0,...w,dir:p.dir,orientation:"vertical",loop:n,currentTabStopId:j,onCurrentTabStopIdChange:E,onEntryFocus:ce(c,I=>{p.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(Jg,{role:"menu","aria-orientation":"vertical","data-state":gS(_.open),"data-radix-menu-content":"",dir:p.dir,...h,...g,ref:P,style:{outline:"none",...g.style},onKeyDown:ce(g.onKeyDown,I=>{const z=I.target.closest("[data-radix-menu-content]")===I.currentTarget,$=I.ctrlKey||I.altKey||I.metaKey,fe=I.key.length===1;z&&(I.key==="Tab"&&I.preventDefault(),!$&&fe&&W(I.key));const ne=R.current;if(I.target!==ne||!DM.includes(I.key))return;I.preventDefault();const Oe=C().filter(he=>!he.disabled).map(he=>he.ref.current);Kb.includes(I.key)&&Oe.reverse(),eI(Oe)}),onBlur:ce(e.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(A.current),L.current="")}),onPointerMove:ce(e.onPointerMove,ql(I=>{const Q=I.target,z=b.current!==I.clientX;if(I.currentTarget.contains(Q)&&z){const $=I.clientX>b.current?"right":"left";F.current=$,b.current=I.clientX}}))})})})})})})});eS.displayName=rn;var HM="MenuGroup",iv=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{role:"group",...n,ref:t})});iv.displayName=HM;var YM="MenuLabel",tS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});tS.displayName=YM;var jd="MenuItem",Y0="menu.itemSelect",Nf=v.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...s}=e,o=v.useRef(null),i=jc(jd,e.__scopeMenu),a=sv(jd,e.__scopeMenu),c=Ke(t,o),u=v.useRef(!1),d=()=>{const f=o.current;if(!r&&f){const m=new CustomEvent(Y0,{bubbles:!0,cancelable:!0});f.addEventListener(Y0,y=>n==null?void 0:n(y),{once:!0}),$g(f,m),m.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx(rS,{...s,ref:c,disabled:r,onClick:ce(e.onClick,d),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),u.current=!0},onPointerUp:ce(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:ce(e.onKeyDown,f=>{const m=a.searchRef.current!=="";r||m&&f.key===" "||um.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Nf.displayName=jd;var rS=v.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...o}=e,i=sv(jd,r),a=qb(r),c=v.useRef(null),u=Ke(t,c),[d,f]=v.useState(!1),[m,y]=v.useState("");return v.useEffect(()=>{const x=c.current;x&&y((x.textContent??"").trim())},[o.children]),l.jsx(Gl.ItemSlot,{scope:r,disabled:n,textValue:s??m,children:l.jsx(zb,{asChild:!0,...a,focusable:!n,children:l.jsx(Re.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:u,onPointerMove:ce(e.onPointerMove,ql(x=>{n?i.onItemLeave(x):(i.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ce(e.onPointerLeave,ql(x=>i.onItemLeave(x))),onFocus:ce(e.onFocus,()=>f(!0)),onBlur:ce(e.onBlur,()=>f(!1))})})})}),ZM="MenuCheckboxItem",nS=v.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...s}=e;return l.jsx(lS,{scope:e.__scopeMenu,checked:r,children:l.jsx(Nf,{role:"menuitemcheckbox","aria-checked":Ed(r)?"mixed":r,...s,ref:t,"data-state":lv(r),onSelect:ce(s.onSelect,()=>n==null?void 0:n(Ed(r)?!0:!r),{checkForDefaultPrevented:!1})})})});nS.displayName=ZM;var sS="MenuRadioGroup",[KM,GM]=ci(sS,{value:void 0,onValueChange:()=>{}}),oS=v.forwardRef((e,t)=>{const{value:r,onValueChange:n,...s}=e,o=Dt(n);return l.jsx(KM,{scope:e.__scopeMenu,value:r,onValueChange:o,children:l.jsx(iv,{...s,ref:t})})});oS.displayName=sS;var iS="MenuRadioItem",aS=v.forwardRef((e,t)=>{const{value:r,...n}=e,s=GM(iS,e.__scopeMenu),o=r===s.value;return l.jsx(lS,{scope:e.__scopeMenu,checked:o,children:l.jsx(Nf,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":lv(o),onSelect:ce(n.onSelect,()=>{var i;return(i=s.onValueChange)==null?void 0:i.call(s,r)},{checkForDefaultPrevented:!1})})})});aS.displayName=iS;var av="MenuItemIndicator",[lS,qM]=ci(av,{checked:!1}),cS=v.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...s}=e,o=qM(av,r);return l.jsx(ur,{present:n||Ed(o.checked)||o.checked===!0,children:l.jsx(Re.span,{...s,ref:t,"data-state":lv(o.checked)})})});cS.displayName=av;var XM="MenuSeparator",uS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});uS.displayName=XM;var QM="MenuArrow",dS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Ef(r);return l.jsx(ev,{...s,...n,ref:t})});dS.displayName=QM;var JM="MenuSub",[w$,fS]=ci(JM),ol="MenuSubTrigger",hS=v.forwardRef((e,t)=>{const r=ui(ol,e.__scopeMenu),n=jc(ol,e.__scopeMenu),s=fS(ol,e.__scopeMenu),o=sv(ol,e.__scopeMenu),i=v.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=o,u={__scopeMenu:e.__scopeMenu},d=v.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),l.jsx(rv,{asChild:!0,...u,children:l.jsx(rS,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":gS(r.open),...e,ref:yf(t,s.onTriggerChange),onClick:f=>{var m;(m=e.onClick)==null||m.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ce(e.onPointerMove,ql(f=>{o.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:ce(e.onPointerLeave,ql(f=>{var y,x;d();const m=(y=r.content)==null?void 0:y.getBoundingClientRect();if(m){const g=(x=r.content)==null?void 0:x.dataset.side,_=g==="right",p=_?-5:5,h=m[_?"left":"right"],w=m[_?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+p,y:f.clientY},{x:h,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x:h,y:m.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:ce(e.onKeyDown,f=>{var y;const m=o.searchRef.current!=="";e.disabled||m&&f.key===" "||OM[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});hS.displayName=ol;var pS="MenuSubContent",mS=v.forwardRef((e,t)=>{const r=Qb(rn,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=ui(rn,e.__scopeMenu),i=jc(rn,e.__scopeMenu),a=fS(pS,e.__scopeMenu),c=v.useRef(null),u=Ke(t,c);return l.jsx(Gl.Provider,{scope:e.__scopeMenu,children:l.jsx(ur,{present:n||o.open,children:l.jsx(Gl.Slot,{scope:e.__scopeMenu,children:l.jsx(ov,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;i.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:ce(e.onFocusOutside,d=>{d.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:ce(e.onEscapeKeyDown,d=>{i.onClose(),d.preventDefault()}),onKeyDown:ce(e.onKeyDown,d=>{var y;const f=d.currentTarget.contains(d.target),m=MM[i.dir].includes(d.key);f&&m&&(o.onOpenChange(!1),(y=a.trigger)==null||y.focus(),d.preventDefault())})})})})})});mS.displayName=pS;function gS(e){return e?"open":"closed"}function Ed(e){return e==="indeterminate"}function lv(e){return Ed(e)?"indeterminate":e?"checked":"unchecked"}function eI(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function tI(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function rI(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=tI(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function nI(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;on!=d>n&&r<(u-a)*(n-c)/(d-c)+a&&(s=!s)}return s}function sI(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return nI(r,t)}function ql(e){return t=>t.pointerType==="mouse"?e(t):void 0}var oI=Xb,iI=rv,aI=Jb,lI=eS,cI=iv,uI=tS,dI=Nf,fI=nS,hI=oS,pI=aS,mI=cS,gI=uS,vI=dS,yI=hS,xI=mS,cv="DropdownMenu",[wI,_$]=xr(cv,[Gb]),wr=Gb(),[_I,vS]=wI(cv),yS=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:s,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,c=wr(t),u=v.useRef(null),[d=!1,f]=on({prop:s,defaultProp:o,onChange:i});return l.jsx(_I,{scope:t,triggerId:Ur(),triggerRef:u,contentId:Ur(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(m=>!m),[f]),modal:a,children:l.jsx(oI,{...c,open:d,onOpenChange:f,dir:n,modal:a,children:r})})};yS.displayName=cv;var xS="DropdownMenuTrigger",wS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=e,o=vS(xS,r),i=wr(r);return l.jsx(iI,{asChild:!0,...i,children:l.jsx(Re.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:yf(t,o.triggerRef),onPointerDown:ce(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:ce(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});wS.displayName=xS;var bI="DropdownMenuPortal",_S=e=>{const{__scopeDropdownMenu:t,...r}=e,n=wr(t);return l.jsx(aI,{...n,...r})};_S.displayName=bI;var bS="DropdownMenuContent",SS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=vS(bS,r),o=wr(r),i=v.useRef(!1);return l.jsx(lI,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...n,ref:t,onCloseAutoFocus:ce(e.onCloseAutoFocus,a=>{var c;i.current||(c=s.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:ce(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});SS.displayName=bS;var SI="DropdownMenuGroup",kI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(cI,{...s,...n,ref:t})});kI.displayName=SI;var CI="DropdownMenuLabel",kS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(uI,{...s,...n,ref:t})});kS.displayName=CI;var jI="DropdownMenuItem",CS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(dI,{...s,...n,ref:t})});CS.displayName=jI;var EI="DropdownMenuCheckboxItem",jS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(fI,{...s,...n,ref:t})});jS.displayName=EI;var NI="DropdownMenuRadioGroup",TI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(hI,{...s,...n,ref:t})});TI.displayName=NI;var RI="DropdownMenuRadioItem",ES=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(pI,{...s,...n,ref:t})});ES.displayName=RI;var PI="DropdownMenuItemIndicator",NS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(mI,{...s,...n,ref:t})});NS.displayName=PI;var AI="DropdownMenuSeparator",TS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(gI,{...s,...n,ref:t})});TS.displayName=AI;var DI="DropdownMenuArrow",OI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(vI,{...s,...n,ref:t})});OI.displayName=DI;var MI="DropdownMenuSubTrigger",RS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(yI,{...s,...n,ref:t})});RS.displayName=MI;var II="DropdownMenuSubContent",PS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(xI,{...s,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});PS.displayName=II;var LI=yS,FI=wS,zI=_S,AS=SS,DS=kS,OS=CS,MS=jS,IS=ES,LS=NS,FS=TS,zS=RS,US=PS;const $S=LI,VS=FI,UI=v.forwardRef(({className:e,inset:t,children:r,...n},s)=>l.jsxs(zS,{ref:s,className:ae("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...n,children:[r,l.jsx(iA,{className:"ml-auto h-4 w-4"})]}));UI.displayName=zS.displayName;const $I=v.forwardRef(({className:e,...t},r)=>l.jsx(US,{ref:r,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));$I.displayName=US.displayName;const uv=v.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(zI,{children:l.jsx(AS,{ref:n,sideOffset:t,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));uv.displayName=AS.displayName;const Qi=v.forwardRef(({className:e,inset:t,...r},n)=>l.jsx(OS,{ref:n,className:ae("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));Qi.displayName=OS.displayName;const VI=v.forwardRef(({className:e,children:t,checked:r,...n},s)=>l.jsxs(MS,{ref:s,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(LS,{children:l.jsx(eb,{className:"h-4 w-4"})})}),t]}));VI.displayName=MS.displayName;const WI=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(IS,{ref:n,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(LS,{children:l.jsx(uA,{className:"h-2 w-2 fill-current"})})}),t]}));WI.displayName=IS.displayName;const WS=v.forwardRef(({className:e,inset:t,...r},n)=>l.jsx(DS,{ref:n,className:ae("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));WS.displayName=DS.displayName;const BS=v.forwardRef(({className:e,...t},r)=>l.jsx(FS,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));BS.displayName=FS.displayName;var dv="Dialog",[HS,YS]=xr(dv),[BI,Tn]=HS(dv),ZS=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,a=v.useRef(null),c=v.useRef(null),[u=!1,d]=on({prop:n,defaultProp:s,onChange:o});return l.jsx(BI,{scope:t,triggerRef:a,contentRef:c,contentId:Ur(),titleId:Ur(),descriptionId:Ur(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:i,children:r})};ZS.displayName=dv;var KS="DialogTrigger",GS=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(KS,r),o=Ke(t,s.triggerRef);return l.jsx(Re.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":pv(s.open),...n,ref:o,onClick:ce(e.onClick,s.onOpenToggle)})});GS.displayName=KS;var fv="DialogPortal",[HI,qS]=HS(fv,{forceMount:void 0}),XS=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,o=Tn(fv,t);return l.jsx(HI,{scope:t,forceMount:r,children:v.Children.map(n,i=>l.jsx(ur,{present:r||o.open,children:l.jsx(kc,{asChild:!0,container:s,children:i})}))})};XS.displayName=fv;var Nd="DialogOverlay",QS=v.forwardRef((e,t)=>{const r=qS(Nd,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=Tn(Nd,e.__scopeDialog);return o.modal?l.jsx(ur,{present:n||o.open,children:l.jsx(YI,{...s,ref:t})}):null});QS.displayName=Nd;var YI=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(Nd,r);return l.jsx(jf,{as:bs,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(Re.div,{"data-state":pv(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),ni="DialogContent",JS=v.forwardRef((e,t)=>{const r=qS(ni,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=Tn(ni,e.__scopeDialog);return l.jsx(ur,{present:n||o.open,children:o.modal?l.jsx(ZI,{...s,ref:t}):l.jsx(KI,{...s,ref:t})})});JS.displayName=ni;var ZI=v.forwardRef((e,t)=>{const r=Tn(ni,e.__scopeDialog),n=v.useRef(null),s=Ke(t,r.contentRef,n);return v.useEffect(()=>{const o=n.current;if(o)return tv(o)},[]),l.jsx(ek,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ce(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ce(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&o.preventDefault()}),onFocusOutside:ce(e.onFocusOutside,o=>o.preventDefault())})}),KI=v.forwardRef((e,t)=>{const r=Tn(ni,e.__scopeDialog),n=v.useRef(!1),s=v.useRef(!1);return l.jsx(ek,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;((u=r.triggerRef.current)==null?void 0:u.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),ek=v.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,a=Tn(ni,r),c=v.useRef(null),u=Ke(t,c);return Vg(),l.jsxs(l.Fragment,{children:[l.jsx(wf,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(Na,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":pv(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(qI,{titleId:a.titleId}),l.jsx(QI,{contentRef:c,descriptionId:a.descriptionId})]})]})}),hv="DialogTitle",tk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(hv,r);return l.jsx(Re.h2,{id:s.titleId,...n,ref:t})});tk.displayName=hv;var rk="DialogDescription",nk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(rk,r);return l.jsx(Re.p,{id:s.descriptionId,...n,ref:t})});nk.displayName=rk;var sk="DialogClose",ok=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(sk,r);return l.jsx(Re.button,{type:"button",...n,ref:t,onClick:ce(e.onClick,()=>s.onOpenChange(!1))})});ok.displayName=sk;function pv(e){return e?"open":"closed"}var ik="DialogTitleWarning",[GI,ak]=oD(ik,{contentName:ni,titleName:hv,docsSlug:"dialog"}),qI=({titleId:e})=>{const t=ak(ik),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},XI="DialogDescriptionWarning",QI=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ak(XI).contentName}}.`;return v.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},mv=ZS,gv=GS,vv=XS,Ec=QS,Nc=JS,Tc=tk,Rc=nk,Tf=ok;const yv=mv,xv=gv,JI=vv,lk=v.forwardRef(({className:e,...t},r)=>l.jsx(Ec,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));lk.displayName=Ec.displayName;const eL=_c("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Rf=v.forwardRef(({side:e="right",className:t,children:r,...n},s)=>l.jsxs(JI,{children:[l.jsx(lk,{}),l.jsxs(Nc,{ref:s,className:ae(eL({side:e}),t),...n,children:[r,l.jsxs(Tf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[l.jsx(Fg,{className:"h-4 w-4 dark:text-stone-200"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rf.displayName=Nc.displayName;const wv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});wv.displayName="SheetHeader";const _v=v.forwardRef(({className:e,...t},r)=>l.jsx(Tc,{ref:r,className:ae("text-lg font-semibold text-foreground",e),...t}));_v.displayName=Tc.displayName;const tL=v.forwardRef(({className:e,...t},r)=>l.jsx(Rc,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));tL.displayName=Rc.displayName;class Vr extends Error{constructor(t){var r,n,s,o;super("ClientResponseError"),this.url="",this.status=0,this.response={},this.isAbort=!1,this.originalError=null,Object.setPrototypeOf(this,Vr.prototype),t!==null&&typeof t=="object"&&(this.url=typeof t.url=="string"?t.url:"",this.status=typeof t.status=="number"?t.status:0,this.isAbort=!!t.isAbort,this.originalError=t.originalError,t.response!==null&&typeof t.response=="object"?this.response=t.response:t.data!==null&&typeof t.data=="object"?this.response=t.data:this.response={}),this.originalError||t instanceof Vr||(this.originalError=t),typeof DOMException<"u"&&t instanceof DOMException&&(this.isAbort=!0),this.name="ClientResponseError "+this.status,this.message=(r=this.response)==null?void 0:r.message,this.message||(this.isAbort?this.message="The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.":(o=(s=(n=this.originalError)==null?void 0:n.cause)==null?void 0:s.message)!=null&&o.includes("ECONNREFUSED ::1")?this.message="Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).":this.message="Something went wrong while processing your request.")}get data(){return this.response}toJSON(){return{...this}}}const xu=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function rL(e,t){const r={};if(typeof e!="string")return r;const n=Object.assign({},{}).decode||nL;let s=0;for(;s0&&(!r.exp||r.exp-t>Date.now()/1e3))}ck=typeof atob!="function"||oL?e=>{let t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,s=0,o=0,i="";n=t.charAt(o++);~n&&(r=s%4?64*r+n:n,s++%4)?i+=String.fromCharCode(255&r>>(-2*s&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return i}:atob;const K0="pb_auth";class iL{constructor(){this.baseToken="",this.baseModel=null,this._onChangeCallbacks=[]}get token(){return this.baseToken}get model(){return this.baseModel}get isValid(){return!uk(this.token)}get isAdmin(){return Ji(this.token).type==="admin"}get isAuthRecord(){return Ji(this.token).type==="authRecord"}save(t,r){this.baseToken=t||"",this.baseModel=r||null,this.triggerChange()}clear(){this.baseToken="",this.baseModel=null,this.triggerChange()}loadFromCookie(t,r=K0){const n=rL(t||"")[r]||"";let s={};try{s=JSON.parse(n),(typeof s===null||typeof s!="object"||Array.isArray(s))&&(s={})}catch{}this.save(s.token||"",s.model||null)}exportToCookie(t,r=K0){var c,u;const n={secure:!0,sameSite:!0,httpOnly:!0,path:"/"},s=Ji(this.token);n.expires=s!=null&&s.exp?new Date(1e3*s.exp):new Date("1970-01-01"),t=Object.assign({},n,t);const o={token:this.token,model:this.model?JSON.parse(JSON.stringify(this.model)):null};let i=Z0(r,JSON.stringify(o),t);const a=typeof Blob<"u"?new Blob([i]).size:i.length;if(o.model&&a>4096){o.model={id:(c=o==null?void 0:o.model)==null?void 0:c.id,email:(u=o==null?void 0:o.model)==null?void 0:u.email};const d=["collectionId","username","verified"];for(const f in this.model)d.includes(f)&&(o.model[f]=this.model[f]);i=Z0(r,JSON.stringify(o),t)}return i}onChange(t,r=!1){return this._onChangeCallbacks.push(t),r&&t(this.token,this.model),()=>{for(let n=this._onChangeCallbacks.length-1;n>=0;n--)if(this._onChangeCallbacks[n]==t)return delete this._onChangeCallbacks[n],void this._onChangeCallbacks.splice(n,1)}}triggerChange(){for(const t of this._onChangeCallbacks)t&&t(this.token,this.model)}}class aL extends iL{constructor(t="pocketbase_auth"){super(),this.storageFallback={},this.storageKey=t,this._bindStorageEvent()}get token(){return(this._storageGet(this.storageKey)||{}).token||""}get model(){return(this._storageGet(this.storageKey)||{}).model||null}save(t,r){this._storageSet(this.storageKey,{token:t,model:r}),super.save(t,r)}clear(){this._storageRemove(this.storageKey),super.clear()}_storageGet(t){if(typeof window<"u"&&(window!=null&&window.localStorage)){const r=window.localStorage.getItem(t)||"";try{return JSON.parse(r)}catch{return r}}return this.storageFallback[t]}_storageSet(t,r){if(typeof window<"u"&&(window!=null&&window.localStorage)){let n=r;typeof r!="string"&&(n=JSON.stringify(r)),window.localStorage.setItem(t,n)}else this.storageFallback[t]=r}_storageRemove(t){var r;typeof window<"u"&&(window!=null&&window.localStorage)&&((r=window.localStorage)==null||r.removeItem(t)),delete this.storageFallback[t]}_bindStorageEvent(){typeof window<"u"&&(window!=null&&window.localStorage)&&window.addEventListener&&window.addEventListener("storage",t=>{if(t.key!=this.storageKey)return;const r=this._storageGet(this.storageKey)||{};super.save(r.token||"",r.model||null)})}}class di{constructor(t){this.client=t}}class lL extends di{async getAll(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/settings",t)}async update(t,r){return r=Object.assign({method:"PATCH",body:t},r),this.client.send("/api/settings",r)}async testS3(t="storage",r){return r=Object.assign({method:"POST",body:{filesystem:t}},r),this.client.send("/api/settings/test/s3",r).then(()=>!0)}async testEmail(t,r,n){return n=Object.assign({method:"POST",body:{email:t,template:r}},n),this.client.send("/api/settings/test/email",n).then(()=>!0)}async generateAppleClientSecret(t,r,n,s,o,i){return i=Object.assign({method:"POST",body:{clientId:t,teamId:r,keyId:n,privateKey:s,duration:o}},i),this.client.send("/api/settings/apple/generate-client-secret",i)}}class bv extends di{decode(t){return t}async getFullList(t,r){if(typeof t=="number")return this._getFullList(t,r);let n=500;return(r=Object.assign({},t,r)).batch&&(n=r.batch,delete r.batch),this._getFullList(n,r)}async getList(t=1,r=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:t,perPage:r},n.query),this.client.send(this.baseCrudPath,n).then(s=>{var o;return s.items=((o=s.items)==null?void 0:o.map(i=>this.decode(i)))||[],s})}async getFirstListItem(t,r){return(r=Object.assign({requestKey:"one_by_filter_"+this.baseCrudPath+"_"+t},r)).query=Object.assign({filter:t,skipTotal:1},r.query),this.getList(1,1,r).then(n=>{var s;if(!((s=n==null?void 0:n.items)!=null&&s.length))throw new Vr({status:404,response:{code:404,message:"The requested resource wasn't found.",data:{}}});return n.items[0]})}async getOne(t,r){if(!t)throw new Vr({url:this.client.buildUrl(this.baseCrudPath+"/"),status:404,response:{code:404,message:"Missing required record id.",data:{}}});return r=Object.assign({method:"GET"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),r).then(n=>this.decode(n))}async create(t,r){return r=Object.assign({method:"POST",body:t},r),this.client.send(this.baseCrudPath,r).then(n=>this.decode(n))}async update(t,r,n){return n=Object.assign({method:"PATCH",body:r},n),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),n).then(s=>this.decode(s))}async delete(t,r){return r=Object.assign({method:"DELETE"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),r).then(()=>!0)}_getFullList(t=500,r){(r=r||{}).query=Object.assign({skipTotal:1},r.query);let n=[],s=async o=>this.getList(o,t||500,r).then(i=>{const a=i.items;return n=n.concat(a),a.length==i.perPage?s(o+1):n});return s(1)}}function Dr(e,t,r,n){const s=n!==void 0;return s||r!==void 0?s?(console.warn(e),t.body=Object.assign({},t.body,r),t.query=Object.assign({},t.query,n),t):Object.assign(t,r):t}function Kh(e){var t;(t=e._resetAutoRefresh)==null||t.call(e)}class cL extends bv{get baseCrudPath(){return"/api/admins"}async update(t,r,n){return super.update(t,r,n).then(s=>{var o,i;return((o=this.client.authStore.model)==null?void 0:o.id)===s.id&&((i=this.client.authStore.model)==null?void 0:i.collectionId)===void 0&&this.client.authStore.save(this.client.authStore.token,s),s})}async delete(t,r){return super.delete(t,r).then(n=>{var s,o;return n&&((s=this.client.authStore.model)==null?void 0:s.id)===t&&((o=this.client.authStore.model)==null?void 0:o.collectionId)===void 0&&this.client.authStore.clear(),n})}authResponse(t){const r=this.decode((t==null?void 0:t.admin)||{});return t!=null&&t.token&&(t!=null&&t.admin)&&this.client.authStore.save(t.token,r),Object.assign({},t,{token:(t==null?void 0:t.token)||"",admin:r})}async authWithPassword(t,r,n,s){let o={method:"POST",body:{identity:t,password:r}};o=Dr("This form of authWithPassword(email, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(email, pass, options?).",o,n,s);const i=o.autoRefreshThreshold;delete o.autoRefreshThreshold,o.autoRefresh||Kh(this.client);let a=await this.client.send(this.baseCrudPath+"/auth-with-password",o);return a=this.authResponse(a),i&&function(u,d,f,m){Kh(u);const y=u.beforeSend,x=u.authStore.model,g=u.authStore.onChange((_,p)=>{(!_||(p==null?void 0:p.id)!=(x==null?void 0:x.id)||(p!=null&&p.collectionId||x!=null&&x.collectionId)&&(p==null?void 0:p.collectionId)!=(x==null?void 0:x.collectionId))&&Kh(u)});u._resetAutoRefresh=function(){g(),u.beforeSend=y,delete u._resetAutoRefresh},u.beforeSend=async(_,p)=>{var j;const h=u.authStore.token;if((j=p.query)!=null&&j.autoRefresh)return y?y(_,p):{url:_,sendOptions:p};let w=u.authStore.isValid;if(w&&uk(u.authStore.token,d))try{await f()}catch{w=!1}w||await m();const C=p.headers||{};for(let E in C)if(E.toLowerCase()=="authorization"&&h==C[E]&&u.authStore.token){C[E]=u.authStore.token;break}return p.headers=C,y?y(_,p):{url:_,sendOptions:p}}}(this.client,i,()=>this.authRefresh({autoRefresh:!0}),()=>this.authWithPassword(t,r,Object.assign({autoRefresh:!0},o))),a}async authRefresh(t,r){let n={method:"POST"};return n=Dr("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",n,t,r),this.client.send(this.baseCrudPath+"/auth-refresh",n).then(this.authResponse.bind(this))}async requestPasswordReset(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",s,r,n),this.client.send(this.baseCrudPath+"/request-password-reset",s).then(()=>!0)}async confirmPasswordReset(t,r,n,s,o){let i={method:"POST",body:{token:t,password:r,passwordConfirm:n}};return i=Dr("This form of confirmPasswordReset(resetToken, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(resetToken, password, passwordConfirm, options?).",i,s,o),this.client.send(this.baseCrudPath+"/confirm-password-reset",i).then(()=>!0)}}const uL=["requestKey","$cancelKey","$autoCancel","fetch","headers","body","query","params","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy","signal","window"];function dk(e){if(e){e.query=e.query||{};for(let t in e)uL.includes(t)||(e.query[t]=e[t],delete e[t])}}class fk extends di{constructor(){super(...arguments),this.clientId="",this.eventSource=null,this.subscriptions={},this.lastSentSubscriptions=[],this.maxConnectTimeout=15e3,this.reconnectAttempts=0,this.maxReconnectAttempts=1/0,this.predefinedReconnectIntervals=[200,300,500,1e3,1200,1500,2e3],this.pendingConnects=[]}get isConnected(){return!!this.eventSource&&!!this.clientId&&!this.pendingConnects.length}async subscribe(t,r,n){var i;if(!t)throw new Error("topic must be set.");let s=t;if(n){dk(n);const a="options="+encodeURIComponent(JSON.stringify({query:n.query,headers:n.headers}));s+=(s.includes("?")?"&":"?")+a}const o=function(a){const c=a;let u;try{u=JSON.parse(c==null?void 0:c.data)}catch{}r(u||{})};return this.subscriptions[s]||(this.subscriptions[s]=[]),this.subscriptions[s].push(o),this.isConnected?this.subscriptions[s].length===1?await this.submitSubscriptions():(i=this.eventSource)==null||i.addEventListener(s,o):await this.connect(),async()=>this.unsubscribeByTopicAndListener(t,o)}async unsubscribe(t){var n;let r=!1;if(t){const s=this.getSubscriptionsByTopic(t);for(let o in s)if(this.hasSubscriptionListeners(o)){for(let i of this.subscriptions[o])(n=this.eventSource)==null||n.removeEventListener(o,i);delete this.subscriptions[o],r||(r=!0)}}else this.subscriptions={};this.hasSubscriptionListeners()?r&&await this.submitSubscriptions():this.disconnect()}async unsubscribeByPrefix(t){var n;let r=!1;for(let s in this.subscriptions)if((s+"?").startsWith(t)){r=!0;for(let o of this.subscriptions[s])(n=this.eventSource)==null||n.removeEventListener(s,o);delete this.subscriptions[s]}r&&(this.hasSubscriptionListeners()?await this.submitSubscriptions():this.disconnect())}async unsubscribeByTopicAndListener(t,r){var o;let n=!1;const s=this.getSubscriptionsByTopic(t);for(let i in s){if(!Array.isArray(this.subscriptions[i])||!this.subscriptions[i].length)continue;let a=!1;for(let c=this.subscriptions[i].length-1;c>=0;c--)this.subscriptions[i][c]===r&&(a=!0,delete this.subscriptions[i][c],this.subscriptions[i].splice(c,1),(o=this.eventSource)==null||o.removeEventListener(i,r));a&&(this.subscriptions[i].length||delete this.subscriptions[i],n||this.hasSubscriptionListeners(i)||(n=!0))}this.hasSubscriptionListeners()?n&&await this.submitSubscriptions():this.disconnect()}hasSubscriptionListeners(t){var r,n;if(this.subscriptions=this.subscriptions||{},t)return!!((r=this.subscriptions[t])!=null&&r.length);for(let s in this.subscriptions)if((n=this.subscriptions[s])!=null&&n.length)return!0;return!1}async submitSubscriptions(){if(this.clientId)return this.addAllSubscriptionListeners(),this.lastSentSubscriptions=this.getNonEmptySubscriptionKeys(),this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentSubscriptions},requestKey:this.getSubscriptionsCancelKey()}).catch(t=>{if(!(t!=null&&t.isAbort))throw t})}getSubscriptionsCancelKey(){return"realtime_"+this.clientId}getSubscriptionsByTopic(t){const r={};t=t.includes("?")?t:t+"?";for(let n in this.subscriptions)(n+"?").startsWith(t)&&(r[n]=this.subscriptions[n]);return r}getNonEmptySubscriptionKeys(){const t=[];for(let r in this.subscriptions)this.subscriptions[r].length&&t.push(r);return t}addAllSubscriptionListeners(){if(this.eventSource){this.removeAllSubscriptionListeners();for(let t in this.subscriptions)for(let r of this.subscriptions[t])this.eventSource.addEventListener(t,r)}}removeAllSubscriptionListeners(){if(this.eventSource)for(let t in this.subscriptions)for(let r of this.subscriptions[t])this.eventSource.removeEventListener(t,r)}async connect(){if(!(this.reconnectAttempts>0))return new Promise((t,r)=>{this.pendingConnects.push({resolve:t,reject:r}),this.pendingConnects.length>1||this.initConnect()})}initConnect(){this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout(()=>{this.connectErrorHandler(new Error("EventSource connect took too long."))},this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=t=>{this.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",t=>{const r=t;this.clientId=r==null?void 0:r.lastEventId,this.submitSubscriptions().then(async()=>{let n=3;for(;this.hasUnsentSubscriptions()&&n>0;)n--,await this.submitSubscriptions()}).then(()=>{for(let s of this.pendingConnects)s.resolve();this.pendingConnects=[],this.reconnectAttempts=0,clearTimeout(this.reconnectTimeoutId),clearTimeout(this.connectTimeoutId);const n=this.getSubscriptionsByTopic("PB_CONNECT");for(let s in n)for(let o of n[s])o(t)}).catch(n=>{this.clientId="",this.connectErrorHandler(n)})})}hasUnsentSubscriptions(){const t=this.getNonEmptySubscriptionKeys();if(t.length!=this.lastSentSubscriptions.length)return!0;for(const r of t)if(!this.lastSentSubscriptions.includes(r))return!0;return!1}connectErrorHandler(t){if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),!this.clientId&&!this.reconnectAttempts||this.reconnectAttempts>this.maxReconnectAttempts){for(let n of this.pendingConnects)n.reject(new Vr(t));return this.pendingConnects=[],void this.disconnect()}this.disconnect(!0);const r=this.predefinedReconnectIntervals[this.reconnectAttempts]||this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length-1];this.reconnectAttempts++,this.reconnectTimeoutId=setTimeout(()=>{this.initConnect()},r)}disconnect(t=!1){var r;if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),this.removeAllSubscriptionListeners(),this.client.cancelRequest(this.getSubscriptionsCancelKey()),(r=this.eventSource)==null||r.close(),this.eventSource=null,this.clientId="",!t){this.reconnectAttempts=0;for(let n of this.pendingConnects)n.resolve();this.pendingConnects=[]}}}class dL extends bv{constructor(t,r){super(t),this.collectionIdOrName=r}get baseCrudPath(){return this.baseCollectionPath+"/records"}get baseCollectionPath(){return"/api/collections/"+encodeURIComponent(this.collectionIdOrName)}async subscribe(t,r,n){if(!t)throw new Error("Missing topic.");if(!r)throw new Error("Missing subscription callback.");return this.client.realtime.subscribe(this.collectionIdOrName+"/"+t,r,n)}async unsubscribe(t){return t?this.client.realtime.unsubscribe(this.collectionIdOrName+"/"+t):this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName)}async getFullList(t,r){if(typeof t=="number")return super.getFullList(t,r);const n=Object.assign({},t,r);return super.getFullList(n)}async getList(t=1,r=30,n){return super.getList(t,r,n)}async getFirstListItem(t,r){return super.getFirstListItem(t,r)}async getOne(t,r){return super.getOne(t,r)}async create(t,r){return super.create(t,r)}async update(t,r,n){return super.update(t,r,n).then(s=>{var o,i,a;return((o=this.client.authStore.model)==null?void 0:o.id)!==(s==null?void 0:s.id)||((i=this.client.authStore.model)==null?void 0:i.collectionId)!==this.collectionIdOrName&&((a=this.client.authStore.model)==null?void 0:a.collectionName)!==this.collectionIdOrName||this.client.authStore.save(this.client.authStore.token,s),s})}async delete(t,r){return super.delete(t,r).then(n=>{var s,o,i;return!n||((s=this.client.authStore.model)==null?void 0:s.id)!==t||((o=this.client.authStore.model)==null?void 0:o.collectionId)!==this.collectionIdOrName&&((i=this.client.authStore.model)==null?void 0:i.collectionName)!==this.collectionIdOrName||this.client.authStore.clear(),n})}authResponse(t){const r=this.decode((t==null?void 0:t.record)||{});return this.client.authStore.save(t==null?void 0:t.token,r),Object.assign({},t,{token:(t==null?void 0:t.token)||"",record:r})}async listAuthMethods(t){return t=Object.assign({method:"GET"},t),this.client.send(this.baseCollectionPath+"/auth-methods",t).then(r=>Object.assign({},r,{usernamePassword:!!(r!=null&&r.usernamePassword),emailPassword:!!(r!=null&&r.emailPassword),authProviders:Array.isArray(r==null?void 0:r.authProviders)?r==null?void 0:r.authProviders:[]}))}async authWithPassword(t,r,n,s){let o={method:"POST",body:{identity:t,password:r}};return o=Dr("This form of authWithPassword(usernameOrEmail, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(usernameOrEmail, pass, options?).",o,n,s),this.client.send(this.baseCollectionPath+"/auth-with-password",o).then(i=>this.authResponse(i))}async authWithOAuth2Code(t,r,n,s,o,i,a){let c={method:"POST",body:{provider:t,code:r,codeVerifier:n,redirectUrl:s,createData:o}};return c=Dr("This form of authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, body?, query?) is deprecated. Consider replacing it with authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, options?).",c,i,a),this.client.send(this.baseCollectionPath+"/auth-with-oauth2",c).then(u=>this.authResponse(u))}authWithOAuth2(...t){if(t.length>1||typeof(t==null?void 0:t[0])=="string")return console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),this.authWithOAuth2Code((t==null?void 0:t[0])||"",(t==null?void 0:t[1])||"",(t==null?void 0:t[2])||"",(t==null?void 0:t[3])||"",(t==null?void 0:t[4])||{},(t==null?void 0:t[5])||{},(t==null?void 0:t[6])||{});const r=(t==null?void 0:t[0])||{};let n=null;r.urlCallback||(n=G0(void 0));const s=new fk(this.client);function o(){n==null||n.close(),s.unsubscribe()}const i={},a=r.requestKey;return a&&(i.requestKey=a),this.listAuthMethods(i).then(c=>{var m;const u=c.authProviders.find(y=>y.name===r.provider);if(!u)throw new Vr(new Error(`Missing or invalid provider "${r.provider}".`));const d=this.client.buildUrl("/api/oauth2-redirect"),f=a?(m=this.client.cancelControllers)==null?void 0:m[a]:void 0;return f&&(f.signal.onabort=()=>{o()}),new Promise(async(y,x)=>{var g;try{await s.subscribe("@oauth2",async w=>{var j;const C=s.clientId;try{if(!w.state||C!==w.state)throw new Error("State parameters don't match.");if(w.error||!w.code)throw new Error("OAuth2 redirect error or missing code: "+w.error);const E=Object.assign({},r);delete E.provider,delete E.scopes,delete E.createData,delete E.urlCallback,(j=f==null?void 0:f.signal)!=null&&j.onabort&&(f.signal.onabort=null);const R=await this.authWithOAuth2Code(u.name,w.code,u.codeVerifier,d,r.createData,E);y(R)}catch(E){x(new Vr(E))}o()});const _={state:s.clientId};(g=r.scopes)!=null&&g.length&&(_.scope=r.scopes.join(" "));const p=this._replaceQueryParams(u.authUrl+d,_);await(r.urlCallback||function(w){n?n.location.href=w:n=G0(w)})(p)}catch(_){o(),x(new Vr(_))}})}).catch(c=>{throw o(),c})}async authRefresh(t,r){let n={method:"POST"};return n=Dr("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",n,t,r),this.client.send(this.baseCollectionPath+"/auth-refresh",n).then(s=>this.authResponse(s))}async requestPasswordReset(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-password-reset",s).then(()=>!0)}async confirmPasswordReset(t,r,n,s,o){let i={method:"POST",body:{token:t,password:r,passwordConfirm:n}};return i=Dr("This form of confirmPasswordReset(token, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(token, password, passwordConfirm, options?).",i,s,o),this.client.send(this.baseCollectionPath+"/confirm-password-reset",i).then(()=>!0)}async requestVerification(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestVerification(email, body?, query?) is deprecated. Consider replacing it with requestVerification(email, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-verification",s).then(()=>!0)}async confirmVerification(t,r,n){let s={method:"POST",body:{token:t}};return s=Dr("This form of confirmVerification(token, body?, query?) is deprecated. Consider replacing it with confirmVerification(token, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/confirm-verification",s).then(()=>{const o=Ji(t),i=this.client.authStore.model;return i&&!i.verified&&i.id===o.id&&i.collectionId===o.collectionId&&(i.verified=!0,this.client.authStore.save(this.client.authStore.token,i)),!0})}async requestEmailChange(t,r,n){let s={method:"POST",body:{newEmail:t}};return s=Dr("This form of requestEmailChange(newEmail, body?, query?) is deprecated. Consider replacing it with requestEmailChange(newEmail, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-email-change",s).then(()=>!0)}async confirmEmailChange(t,r,n,s){let o={method:"POST",body:{token:t,password:r}};return o=Dr("This form of confirmEmailChange(token, password, body?, query?) is deprecated. Consider replacing it with confirmEmailChange(token, password, options?).",o,n,s),this.client.send(this.baseCollectionPath+"/confirm-email-change",o).then(()=>{const i=Ji(t),a=this.client.authStore.model;return a&&a.id===i.id&&a.collectionId===i.collectionId&&this.client.authStore.clear(),!0})}async listExternalAuths(t,r){return r=Object.assign({method:"GET"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t)+"/external-auths",r)}async unlinkExternalAuth(t,r,n){return n=Object.assign({method:"DELETE"},n),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t)+"/external-auths/"+encodeURIComponent(r),n).then(()=>!0)}_replaceQueryParams(t,r={}){let n=t,s="";t.indexOf("?")>=0&&(n=t.substring(0,t.indexOf("?")),s=t.substring(t.indexOf("?")+1));const o={},i=s.split("&");for(const a of i){if(a=="")continue;const c=a.split("=");o[decodeURIComponent(c[0].replace(/\+/g," "))]=decodeURIComponent((c[1]||"").replace(/\+/g," "))}for(let a in r)r.hasOwnProperty(a)&&(r[a]==null?delete o[a]:o[a]=r[a]);s="";for(let a in o)o.hasOwnProperty(a)&&(s!=""&&(s+="&"),s+=encodeURIComponent(a.replace(/%20/g,"+"))+"="+encodeURIComponent(o[a].replace(/%20/g,"+")));return s!=""?n+"?"+s:n}}function G0(e){if(typeof window>"u"||!(window!=null&&window.open))throw new Vr(new Error("Not in a browser context - please pass a custom urlCallback function."));let t=1024,r=768,n=window.innerWidth,s=window.innerHeight;t=t>n?n:t,r=r>s?s:r;let o=n/2-t/2,i=s/2-r/2;return window.open(e,"popup_window","width="+t+",height="+r+",top="+i+",left="+o+",resizable,menubar=no")}class fL extends bv{get baseCrudPath(){return"/api/collections"}async import(t,r=!1,n){return n=Object.assign({method:"PUT",body:{collections:t,deleteMissing:r}},n),this.client.send(this.baseCrudPath+"/import",n).then(()=>!0)}}class hL extends di{async getList(t=1,r=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:t,perPage:r},n.query),this.client.send("/api/logs",n)}async getOne(t,r){if(!t)throw new Vr({url:this.client.buildUrl("/api/logs/"),status:404,response:{code:404,message:"Missing required log id.",data:{}}});return r=Object.assign({method:"GET"},r),this.client.send("/api/logs/"+encodeURIComponent(t),r)}async getStats(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/logs/stats",t)}}class pL extends di{async check(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/health",t)}}class mL extends di{getUrl(t,r,n={}){if(!r||!(t!=null&&t.id)||!(t!=null&&t.collectionId)&&!(t!=null&&t.collectionName))return"";const s=[];s.push("api"),s.push("files"),s.push(encodeURIComponent(t.collectionId||t.collectionName)),s.push(encodeURIComponent(t.id)),s.push(encodeURIComponent(r));let o=this.client.buildUrl(s.join("/"));if(Object.keys(n).length){n.download===!1&&delete n.download;const i=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+i}return o}async getToken(t){return t=Object.assign({method:"POST"},t),this.client.send("/api/files/token",t).then(r=>(r==null?void 0:r.token)||"")}}class gL extends di{async getFullList(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/backups",t)}async create(t,r){return r=Object.assign({method:"POST",body:{name:t}},r),this.client.send("/api/backups",r).then(()=>!0)}async upload(t,r){return r=Object.assign({method:"POST",body:t},r),this.client.send("/api/backups/upload",r).then(()=>!0)}async delete(t,r){return r=Object.assign({method:"DELETE"},r),this.client.send(`/api/backups/${encodeURIComponent(t)}`,r).then(()=>!0)}async restore(t,r){return r=Object.assign({method:"POST"},r),this.client.send(`/api/backups/${encodeURIComponent(t)}/restore`,r).then(()=>!0)}getDownloadUrl(t,r){return this.client.buildUrl(`/api/backups/${encodeURIComponent(r)}?token=${encodeURIComponent(t)}`)}}class vL{constructor(t="/",r,n="en-US"){this.cancelControllers={},this.recordServices={},this.enableAutoCancellation=!0,this.baseUrl=t,this.lang=n,this.authStore=r||new aL,this.admins=new cL(this),this.collections=new fL(this),this.files=new mL(this),this.logs=new hL(this),this.settings=new lL(this),this.realtime=new fk(this),this.health=new pL(this),this.backups=new gL(this)}collection(t){return this.recordServices[t]||(this.recordServices[t]=new dL(this,t)),this.recordServices[t]}autoCancellation(t){return this.enableAutoCancellation=!!t,this}cancelRequest(t){return this.cancelControllers[t]&&(this.cancelControllers[t].abort(),delete this.cancelControllers[t]),this}cancelAllRequests(){for(let t in this.cancelControllers)this.cancelControllers[t].abort();return this.cancelControllers={},this}filter(t,r){if(!r)return t;for(let n in r){let s=r[n];switch(typeof s){case"boolean":case"number":s=""+s;break;case"string":s="'"+s.replace(/'/g,"\\'")+"'";break;default:s=s===null?"null":s instanceof Date?"'"+s.toISOString().replace("T"," ")+"'":"'"+JSON.stringify(s).replace(/'/g,"\\'")+"'"}t=t.replaceAll("{:"+n+"}",s)}return t}getFileUrl(t,r,n={}){return this.files.getUrl(t,r,n)}buildUrl(t){var n;let r=this.baseUrl;return typeof window>"u"||!window.location||r.startsWith("https://")||r.startsWith("http://")||(r=(n=window.location.origin)!=null&&n.endsWith("/")?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(r+=window.location.pathname||"/",r+=r.endsWith("/")?"":"/"),r+=this.baseUrl),t&&(r+=r.endsWith("/")?"":"/",r+=t.startsWith("/")?t.substring(1):t),r}async send(t,r){r=this.initSendOptions(t,r);let n=this.buildUrl(t);if(this.beforeSend){const s=Object.assign({},await this.beforeSend(n,r));s.url!==void 0||s.options!==void 0?(n=s.url||n,r=s.options||r):Object.keys(s).length&&(r=s,console!=null&&console.warn&&console.warn("Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`."))}if(r.query!==void 0){const s=this.serializeQueryParams(r.query);s&&(n+=(n.includes("?")?"&":"?")+s),delete r.query}return this.getHeader(r.headers,"Content-Type")=="application/json"&&r.body&&typeof r.body!="string"&&(r.body=JSON.stringify(r.body)),(r.fetch||fetch)(n,r).then(async s=>{let o={};try{o=await s.json()}catch{}if(this.afterSend&&(o=await this.afterSend(s,o)),s.status>=400)throw new Vr({url:s.url,status:s.status,data:o});return o}).catch(s=>{throw new Vr(s)})}initSendOptions(t,r){if((r=Object.assign({method:"GET"},r)).body=this.convertToFormDataIfNeeded(r.body),dk(r),r.query=Object.assign({},r.params,r.query),r.requestKey===void 0&&(r.$autoCancel===!1||r.query.$autoCancel===!1?r.requestKey=null:(r.$cancelKey||r.query.$cancelKey)&&(r.requestKey=r.$cancelKey||r.query.$cancelKey)),delete r.$autoCancel,delete r.query.$autoCancel,delete r.$cancelKey,delete r.query.$cancelKey,this.getHeader(r.headers,"Content-Type")!==null||this.isFormData(r.body)||(r.headers=Object.assign({},r.headers,{"Content-Type":"application/json"})),this.getHeader(r.headers,"Accept-Language")===null&&(r.headers=Object.assign({},r.headers,{"Accept-Language":this.lang})),this.authStore.token&&this.getHeader(r.headers,"Authorization")===null&&(r.headers=Object.assign({},r.headers,{Authorization:this.authStore.token})),this.enableAutoCancellation&&r.requestKey!==null){const n=r.requestKey||(r.method||"GET")+t;delete r.requestKey,this.cancelRequest(n);const s=new AbortController;this.cancelControllers[n]=s,r.signal=s.signal}return r}convertToFormDataIfNeeded(t){if(typeof FormData>"u"||t===void 0||typeof t!="object"||t===null||this.isFormData(t)||!this.hasBlobField(t))return t;const r=new FormData;for(const n in t){const s=t[n];if(typeof s!="object"||this.hasBlobField({data:s})){const o=Array.isArray(s)?s:[s];for(let i of o)r.append(n,i)}else{let o={};o[n]=s,r.append("@jsonPayload",JSON.stringify(o))}}return r}hasBlobField(t){for(const r in t){const n=Array.isArray(t[r])?t[r]:[t[r]];for(const s of n)if(typeof Blob<"u"&&s instanceof Blob||typeof File<"u"&&s instanceof File)return!0}return!1}getHeader(t,r){t=t||{},r=r.toLowerCase();for(let n in t)if(n.toLowerCase()==r)return t[n];return null}isFormData(t){return t&&(t.constructor.name==="FormData"||typeof FormData<"u"&&t instanceof FormData)}serializeQueryParams(t){const r=[];for(const n in t){if(t[n]===null)continue;const s=t[n],o=encodeURIComponent(n);if(Array.isArray(s))for(const i of s)r.push(o+"="+encodeURIComponent(i));else s instanceof Date?r.push(o+"="+encodeURIComponent(s.toISOString())):typeof s!==null&&typeof s=="object"?r.push(o+"="+encodeURIComponent(JSON.stringify(s))):r.push(o+"="+encodeURIComponent(s))}return r.join("&")}}const yL=void 0;console.log(yL);let wu;const st=()=>wu||(wu=new vL("/"),wu);//! moment.js +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},XI="DialogDescriptionWarning",QI=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ak(XI).contentName}}.`;return v.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},mv=ZS,gv=GS,vv=XS,Ec=QS,Nc=JS,Tc=tk,Rc=nk,Tf=ok;const yv=mv,xv=gv,JI=vv,lk=v.forwardRef(({className:e,...t},r)=>l.jsx(Ec,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));lk.displayName=Ec.displayName;const eL=_c("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Rf=v.forwardRef(({side:e="right",className:t,children:r,...n},s)=>l.jsxs(JI,{children:[l.jsx(lk,{}),l.jsxs(Nc,{ref:s,className:ae(eL({side:e}),t),...n,children:[r,l.jsxs(Tf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[l.jsx(Fg,{className:"h-4 w-4 dark:text-stone-200"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rf.displayName=Nc.displayName;const wv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});wv.displayName="SheetHeader";const _v=v.forwardRef(({className:e,...t},r)=>l.jsx(Tc,{ref:r,className:ae("text-lg font-semibold text-foreground",e),...t}));_v.displayName=Tc.displayName;const tL=v.forwardRef(({className:e,...t},r)=>l.jsx(Rc,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));tL.displayName=Rc.displayName;class Vr extends Error{constructor(t){var r,n,s,o;super("ClientResponseError"),this.url="",this.status=0,this.response={},this.isAbort=!1,this.originalError=null,Object.setPrototypeOf(this,Vr.prototype),t!==null&&typeof t=="object"&&(this.url=typeof t.url=="string"?t.url:"",this.status=typeof t.status=="number"?t.status:0,this.isAbort=!!t.isAbort,this.originalError=t.originalError,t.response!==null&&typeof t.response=="object"?this.response=t.response:t.data!==null&&typeof t.data=="object"?this.response=t.data:this.response={}),this.originalError||t instanceof Vr||(this.originalError=t),typeof DOMException<"u"&&t instanceof DOMException&&(this.isAbort=!0),this.name="ClientResponseError "+this.status,this.message=(r=this.response)==null?void 0:r.message,this.message||(this.isAbort?this.message="The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.":(o=(s=(n=this.originalError)==null?void 0:n.cause)==null?void 0:s.message)!=null&&o.includes("ECONNREFUSED ::1")?this.message="Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).":this.message="Something went wrong while processing your request.")}get data(){return this.response}toJSON(){return{...this}}}const xu=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function rL(e,t){const r={};if(typeof e!="string")return r;const n=Object.assign({},{}).decode||nL;let s=0;for(;s0&&(!r.exp||r.exp-t>Date.now()/1e3))}ck=typeof atob!="function"||oL?e=>{let t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,s=0,o=0,i="";n=t.charAt(o++);~n&&(r=s%4?64*r+n:n,s++%4)?i+=String.fromCharCode(255&r>>(-2*s&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return i}:atob;const K0="pb_auth";class iL{constructor(){this.baseToken="",this.baseModel=null,this._onChangeCallbacks=[]}get token(){return this.baseToken}get model(){return this.baseModel}get isValid(){return!uk(this.token)}get isAdmin(){return Ji(this.token).type==="admin"}get isAuthRecord(){return Ji(this.token).type==="authRecord"}save(t,r){this.baseToken=t||"",this.baseModel=r||null,this.triggerChange()}clear(){this.baseToken="",this.baseModel=null,this.triggerChange()}loadFromCookie(t,r=K0){const n=rL(t||"")[r]||"";let s={};try{s=JSON.parse(n),(typeof s===null||typeof s!="object"||Array.isArray(s))&&(s={})}catch{}this.save(s.token||"",s.model||null)}exportToCookie(t,r=K0){var c,u;const n={secure:!0,sameSite:!0,httpOnly:!0,path:"/"},s=Ji(this.token);n.expires=s!=null&&s.exp?new Date(1e3*s.exp):new Date("1970-01-01"),t=Object.assign({},n,t);const o={token:this.token,model:this.model?JSON.parse(JSON.stringify(this.model)):null};let i=Z0(r,JSON.stringify(o),t);const a=typeof Blob<"u"?new Blob([i]).size:i.length;if(o.model&&a>4096){o.model={id:(c=o==null?void 0:o.model)==null?void 0:c.id,email:(u=o==null?void 0:o.model)==null?void 0:u.email};const d=["collectionId","username","verified"];for(const f in this.model)d.includes(f)&&(o.model[f]=this.model[f]);i=Z0(r,JSON.stringify(o),t)}return i}onChange(t,r=!1){return this._onChangeCallbacks.push(t),r&&t(this.token,this.model),()=>{for(let n=this._onChangeCallbacks.length-1;n>=0;n--)if(this._onChangeCallbacks[n]==t)return delete this._onChangeCallbacks[n],void this._onChangeCallbacks.splice(n,1)}}triggerChange(){for(const t of this._onChangeCallbacks)t&&t(this.token,this.model)}}class aL extends iL{constructor(t="pocketbase_auth"){super(),this.storageFallback={},this.storageKey=t,this._bindStorageEvent()}get token(){return(this._storageGet(this.storageKey)||{}).token||""}get model(){return(this._storageGet(this.storageKey)||{}).model||null}save(t,r){this._storageSet(this.storageKey,{token:t,model:r}),super.save(t,r)}clear(){this._storageRemove(this.storageKey),super.clear()}_storageGet(t){if(typeof window<"u"&&(window!=null&&window.localStorage)){const r=window.localStorage.getItem(t)||"";try{return JSON.parse(r)}catch{return r}}return this.storageFallback[t]}_storageSet(t,r){if(typeof window<"u"&&(window!=null&&window.localStorage)){let n=r;typeof r!="string"&&(n=JSON.stringify(r)),window.localStorage.setItem(t,n)}else this.storageFallback[t]=r}_storageRemove(t){var r;typeof window<"u"&&(window!=null&&window.localStorage)&&((r=window.localStorage)==null||r.removeItem(t)),delete this.storageFallback[t]}_bindStorageEvent(){typeof window<"u"&&(window!=null&&window.localStorage)&&window.addEventListener&&window.addEventListener("storage",t=>{if(t.key!=this.storageKey)return;const r=this._storageGet(this.storageKey)||{};super.save(r.token||"",r.model||null)})}}class di{constructor(t){this.client=t}}class lL extends di{async getAll(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/settings",t)}async update(t,r){return r=Object.assign({method:"PATCH",body:t},r),this.client.send("/api/settings",r)}async testS3(t="storage",r){return r=Object.assign({method:"POST",body:{filesystem:t}},r),this.client.send("/api/settings/test/s3",r).then(()=>!0)}async testEmail(t,r,n){return n=Object.assign({method:"POST",body:{email:t,template:r}},n),this.client.send("/api/settings/test/email",n).then(()=>!0)}async generateAppleClientSecret(t,r,n,s,o,i){return i=Object.assign({method:"POST",body:{clientId:t,teamId:r,keyId:n,privateKey:s,duration:o}},i),this.client.send("/api/settings/apple/generate-client-secret",i)}}class bv extends di{decode(t){return t}async getFullList(t,r){if(typeof t=="number")return this._getFullList(t,r);let n=500;return(r=Object.assign({},t,r)).batch&&(n=r.batch,delete r.batch),this._getFullList(n,r)}async getList(t=1,r=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:t,perPage:r},n.query),this.client.send(this.baseCrudPath,n).then(s=>{var o;return s.items=((o=s.items)==null?void 0:o.map(i=>this.decode(i)))||[],s})}async getFirstListItem(t,r){return(r=Object.assign({requestKey:"one_by_filter_"+this.baseCrudPath+"_"+t},r)).query=Object.assign({filter:t,skipTotal:1},r.query),this.getList(1,1,r).then(n=>{var s;if(!((s=n==null?void 0:n.items)!=null&&s.length))throw new Vr({status:404,response:{code:404,message:"The requested resource wasn't found.",data:{}}});return n.items[0]})}async getOne(t,r){if(!t)throw new Vr({url:this.client.buildUrl(this.baseCrudPath+"/"),status:404,response:{code:404,message:"Missing required record id.",data:{}}});return r=Object.assign({method:"GET"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),r).then(n=>this.decode(n))}async create(t,r){return r=Object.assign({method:"POST",body:t},r),this.client.send(this.baseCrudPath,r).then(n=>this.decode(n))}async update(t,r,n){return n=Object.assign({method:"PATCH",body:r},n),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),n).then(s=>this.decode(s))}async delete(t,r){return r=Object.assign({method:"DELETE"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),r).then(()=>!0)}_getFullList(t=500,r){(r=r||{}).query=Object.assign({skipTotal:1},r.query);let n=[],s=async o=>this.getList(o,t||500,r).then(i=>{const a=i.items;return n=n.concat(a),a.length==i.perPage?s(o+1):n});return s(1)}}function Dr(e,t,r,n){const s=n!==void 0;return s||r!==void 0?s?(console.warn(e),t.body=Object.assign({},t.body,r),t.query=Object.assign({},t.query,n),t):Object.assign(t,r):t}function Kh(e){var t;(t=e._resetAutoRefresh)==null||t.call(e)}class cL extends bv{get baseCrudPath(){return"/api/admins"}async update(t,r,n){return super.update(t,r,n).then(s=>{var o,i;return((o=this.client.authStore.model)==null?void 0:o.id)===s.id&&((i=this.client.authStore.model)==null?void 0:i.collectionId)===void 0&&this.client.authStore.save(this.client.authStore.token,s),s})}async delete(t,r){return super.delete(t,r).then(n=>{var s,o;return n&&((s=this.client.authStore.model)==null?void 0:s.id)===t&&((o=this.client.authStore.model)==null?void 0:o.collectionId)===void 0&&this.client.authStore.clear(),n})}authResponse(t){const r=this.decode((t==null?void 0:t.admin)||{});return t!=null&&t.token&&(t!=null&&t.admin)&&this.client.authStore.save(t.token,r),Object.assign({},t,{token:(t==null?void 0:t.token)||"",admin:r})}async authWithPassword(t,r,n,s){let o={method:"POST",body:{identity:t,password:r}};o=Dr("This form of authWithPassword(email, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(email, pass, options?).",o,n,s);const i=o.autoRefreshThreshold;delete o.autoRefreshThreshold,o.autoRefresh||Kh(this.client);let a=await this.client.send(this.baseCrudPath+"/auth-with-password",o);return a=this.authResponse(a),i&&function(u,d,f,m){Kh(u);const y=u.beforeSend,x=u.authStore.model,g=u.authStore.onChange((_,p)=>{(!_||(p==null?void 0:p.id)!=(x==null?void 0:x.id)||(p!=null&&p.collectionId||x!=null&&x.collectionId)&&(p==null?void 0:p.collectionId)!=(x==null?void 0:x.collectionId))&&Kh(u)});u._resetAutoRefresh=function(){g(),u.beforeSend=y,delete u._resetAutoRefresh},u.beforeSend=async(_,p)=>{var j;const h=u.authStore.token;if((j=p.query)!=null&&j.autoRefresh)return y?y(_,p):{url:_,sendOptions:p};let w=u.authStore.isValid;if(w&&uk(u.authStore.token,d))try{await f()}catch{w=!1}w||await m();const C=p.headers||{};for(let E in C)if(E.toLowerCase()=="authorization"&&h==C[E]&&u.authStore.token){C[E]=u.authStore.token;break}return p.headers=C,y?y(_,p):{url:_,sendOptions:p}}}(this.client,i,()=>this.authRefresh({autoRefresh:!0}),()=>this.authWithPassword(t,r,Object.assign({autoRefresh:!0},o))),a}async authRefresh(t,r){let n={method:"POST"};return n=Dr("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",n,t,r),this.client.send(this.baseCrudPath+"/auth-refresh",n).then(this.authResponse.bind(this))}async requestPasswordReset(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",s,r,n),this.client.send(this.baseCrudPath+"/request-password-reset",s).then(()=>!0)}async confirmPasswordReset(t,r,n,s,o){let i={method:"POST",body:{token:t,password:r,passwordConfirm:n}};return i=Dr("This form of confirmPasswordReset(resetToken, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(resetToken, password, passwordConfirm, options?).",i,s,o),this.client.send(this.baseCrudPath+"/confirm-password-reset",i).then(()=>!0)}}const uL=["requestKey","$cancelKey","$autoCancel","fetch","headers","body","query","params","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy","signal","window"];function dk(e){if(e){e.query=e.query||{};for(let t in e)uL.includes(t)||(e.query[t]=e[t],delete e[t])}}class fk extends di{constructor(){super(...arguments),this.clientId="",this.eventSource=null,this.subscriptions={},this.lastSentSubscriptions=[],this.maxConnectTimeout=15e3,this.reconnectAttempts=0,this.maxReconnectAttempts=1/0,this.predefinedReconnectIntervals=[200,300,500,1e3,1200,1500,2e3],this.pendingConnects=[]}get isConnected(){return!!this.eventSource&&!!this.clientId&&!this.pendingConnects.length}async subscribe(t,r,n){var i;if(!t)throw new Error("topic must be set.");let s=t;if(n){dk(n);const a="options="+encodeURIComponent(JSON.stringify({query:n.query,headers:n.headers}));s+=(s.includes("?")?"&":"?")+a}const o=function(a){const c=a;let u;try{u=JSON.parse(c==null?void 0:c.data)}catch{}r(u||{})};return this.subscriptions[s]||(this.subscriptions[s]=[]),this.subscriptions[s].push(o),this.isConnected?this.subscriptions[s].length===1?await this.submitSubscriptions():(i=this.eventSource)==null||i.addEventListener(s,o):await this.connect(),async()=>this.unsubscribeByTopicAndListener(t,o)}async unsubscribe(t){var n;let r=!1;if(t){const s=this.getSubscriptionsByTopic(t);for(let o in s)if(this.hasSubscriptionListeners(o)){for(let i of this.subscriptions[o])(n=this.eventSource)==null||n.removeEventListener(o,i);delete this.subscriptions[o],r||(r=!0)}}else this.subscriptions={};this.hasSubscriptionListeners()?r&&await this.submitSubscriptions():this.disconnect()}async unsubscribeByPrefix(t){var n;let r=!1;for(let s in this.subscriptions)if((s+"?").startsWith(t)){r=!0;for(let o of this.subscriptions[s])(n=this.eventSource)==null||n.removeEventListener(s,o);delete this.subscriptions[s]}r&&(this.hasSubscriptionListeners()?await this.submitSubscriptions():this.disconnect())}async unsubscribeByTopicAndListener(t,r){var o;let n=!1;const s=this.getSubscriptionsByTopic(t);for(let i in s){if(!Array.isArray(this.subscriptions[i])||!this.subscriptions[i].length)continue;let a=!1;for(let c=this.subscriptions[i].length-1;c>=0;c--)this.subscriptions[i][c]===r&&(a=!0,delete this.subscriptions[i][c],this.subscriptions[i].splice(c,1),(o=this.eventSource)==null||o.removeEventListener(i,r));a&&(this.subscriptions[i].length||delete this.subscriptions[i],n||this.hasSubscriptionListeners(i)||(n=!0))}this.hasSubscriptionListeners()?n&&await this.submitSubscriptions():this.disconnect()}hasSubscriptionListeners(t){var r,n;if(this.subscriptions=this.subscriptions||{},t)return!!((r=this.subscriptions[t])!=null&&r.length);for(let s in this.subscriptions)if((n=this.subscriptions[s])!=null&&n.length)return!0;return!1}async submitSubscriptions(){if(this.clientId)return this.addAllSubscriptionListeners(),this.lastSentSubscriptions=this.getNonEmptySubscriptionKeys(),this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentSubscriptions},requestKey:this.getSubscriptionsCancelKey()}).catch(t=>{if(!(t!=null&&t.isAbort))throw t})}getSubscriptionsCancelKey(){return"realtime_"+this.clientId}getSubscriptionsByTopic(t){const r={};t=t.includes("?")?t:t+"?";for(let n in this.subscriptions)(n+"?").startsWith(t)&&(r[n]=this.subscriptions[n]);return r}getNonEmptySubscriptionKeys(){const t=[];for(let r in this.subscriptions)this.subscriptions[r].length&&t.push(r);return t}addAllSubscriptionListeners(){if(this.eventSource){this.removeAllSubscriptionListeners();for(let t in this.subscriptions)for(let r of this.subscriptions[t])this.eventSource.addEventListener(t,r)}}removeAllSubscriptionListeners(){if(this.eventSource)for(let t in this.subscriptions)for(let r of this.subscriptions[t])this.eventSource.removeEventListener(t,r)}async connect(){if(!(this.reconnectAttempts>0))return new Promise((t,r)=>{this.pendingConnects.push({resolve:t,reject:r}),this.pendingConnects.length>1||this.initConnect()})}initConnect(){this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout(()=>{this.connectErrorHandler(new Error("EventSource connect took too long."))},this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=t=>{this.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",t=>{const r=t;this.clientId=r==null?void 0:r.lastEventId,this.submitSubscriptions().then(async()=>{let n=3;for(;this.hasUnsentSubscriptions()&&n>0;)n--,await this.submitSubscriptions()}).then(()=>{for(let s of this.pendingConnects)s.resolve();this.pendingConnects=[],this.reconnectAttempts=0,clearTimeout(this.reconnectTimeoutId),clearTimeout(this.connectTimeoutId);const n=this.getSubscriptionsByTopic("PB_CONNECT");for(let s in n)for(let o of n[s])o(t)}).catch(n=>{this.clientId="",this.connectErrorHandler(n)})})}hasUnsentSubscriptions(){const t=this.getNonEmptySubscriptionKeys();if(t.length!=this.lastSentSubscriptions.length)return!0;for(const r of t)if(!this.lastSentSubscriptions.includes(r))return!0;return!1}connectErrorHandler(t){if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),!this.clientId&&!this.reconnectAttempts||this.reconnectAttempts>this.maxReconnectAttempts){for(let n of this.pendingConnects)n.reject(new Vr(t));return this.pendingConnects=[],void this.disconnect()}this.disconnect(!0);const r=this.predefinedReconnectIntervals[this.reconnectAttempts]||this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length-1];this.reconnectAttempts++,this.reconnectTimeoutId=setTimeout(()=>{this.initConnect()},r)}disconnect(t=!1){var r;if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),this.removeAllSubscriptionListeners(),this.client.cancelRequest(this.getSubscriptionsCancelKey()),(r=this.eventSource)==null||r.close(),this.eventSource=null,this.clientId="",!t){this.reconnectAttempts=0;for(let n of this.pendingConnects)n.resolve();this.pendingConnects=[]}}}class dL extends bv{constructor(t,r){super(t),this.collectionIdOrName=r}get baseCrudPath(){return this.baseCollectionPath+"/records"}get baseCollectionPath(){return"/api/collections/"+encodeURIComponent(this.collectionIdOrName)}async subscribe(t,r,n){if(!t)throw new Error("Missing topic.");if(!r)throw new Error("Missing subscription callback.");return this.client.realtime.subscribe(this.collectionIdOrName+"/"+t,r,n)}async unsubscribe(t){return t?this.client.realtime.unsubscribe(this.collectionIdOrName+"/"+t):this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName)}async getFullList(t,r){if(typeof t=="number")return super.getFullList(t,r);const n=Object.assign({},t,r);return super.getFullList(n)}async getList(t=1,r=30,n){return super.getList(t,r,n)}async getFirstListItem(t,r){return super.getFirstListItem(t,r)}async getOne(t,r){return super.getOne(t,r)}async create(t,r){return super.create(t,r)}async update(t,r,n){return super.update(t,r,n).then(s=>{var o,i,a;return((o=this.client.authStore.model)==null?void 0:o.id)!==(s==null?void 0:s.id)||((i=this.client.authStore.model)==null?void 0:i.collectionId)!==this.collectionIdOrName&&((a=this.client.authStore.model)==null?void 0:a.collectionName)!==this.collectionIdOrName||this.client.authStore.save(this.client.authStore.token,s),s})}async delete(t,r){return super.delete(t,r).then(n=>{var s,o,i;return!n||((s=this.client.authStore.model)==null?void 0:s.id)!==t||((o=this.client.authStore.model)==null?void 0:o.collectionId)!==this.collectionIdOrName&&((i=this.client.authStore.model)==null?void 0:i.collectionName)!==this.collectionIdOrName||this.client.authStore.clear(),n})}authResponse(t){const r=this.decode((t==null?void 0:t.record)||{});return this.client.authStore.save(t==null?void 0:t.token,r),Object.assign({},t,{token:(t==null?void 0:t.token)||"",record:r})}async listAuthMethods(t){return t=Object.assign({method:"GET"},t),this.client.send(this.baseCollectionPath+"/auth-methods",t).then(r=>Object.assign({},r,{usernamePassword:!!(r!=null&&r.usernamePassword),emailPassword:!!(r!=null&&r.emailPassword),authProviders:Array.isArray(r==null?void 0:r.authProviders)?r==null?void 0:r.authProviders:[]}))}async authWithPassword(t,r,n,s){let o={method:"POST",body:{identity:t,password:r}};return o=Dr("This form of authWithPassword(usernameOrEmail, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(usernameOrEmail, pass, options?).",o,n,s),this.client.send(this.baseCollectionPath+"/auth-with-password",o).then(i=>this.authResponse(i))}async authWithOAuth2Code(t,r,n,s,o,i,a){let c={method:"POST",body:{provider:t,code:r,codeVerifier:n,redirectUrl:s,createData:o}};return c=Dr("This form of authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, body?, query?) is deprecated. Consider replacing it with authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, options?).",c,i,a),this.client.send(this.baseCollectionPath+"/auth-with-oauth2",c).then(u=>this.authResponse(u))}authWithOAuth2(...t){if(t.length>1||typeof(t==null?void 0:t[0])=="string")return console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),this.authWithOAuth2Code((t==null?void 0:t[0])||"",(t==null?void 0:t[1])||"",(t==null?void 0:t[2])||"",(t==null?void 0:t[3])||"",(t==null?void 0:t[4])||{},(t==null?void 0:t[5])||{},(t==null?void 0:t[6])||{});const r=(t==null?void 0:t[0])||{};let n=null;r.urlCallback||(n=G0(void 0));const s=new fk(this.client);function o(){n==null||n.close(),s.unsubscribe()}const i={},a=r.requestKey;return a&&(i.requestKey=a),this.listAuthMethods(i).then(c=>{var m;const u=c.authProviders.find(y=>y.name===r.provider);if(!u)throw new Vr(new Error(`Missing or invalid provider "${r.provider}".`));const d=this.client.buildUrl("/api/oauth2-redirect"),f=a?(m=this.client.cancelControllers)==null?void 0:m[a]:void 0;return f&&(f.signal.onabort=()=>{o()}),new Promise(async(y,x)=>{var g;try{await s.subscribe("@oauth2",async w=>{var j;const C=s.clientId;try{if(!w.state||C!==w.state)throw new Error("State parameters don't match.");if(w.error||!w.code)throw new Error("OAuth2 redirect error or missing code: "+w.error);const E=Object.assign({},r);delete E.provider,delete E.scopes,delete E.createData,delete E.urlCallback,(j=f==null?void 0:f.signal)!=null&&j.onabort&&(f.signal.onabort=null);const R=await this.authWithOAuth2Code(u.name,w.code,u.codeVerifier,d,r.createData,E);y(R)}catch(E){x(new Vr(E))}o()});const _={state:s.clientId};(g=r.scopes)!=null&&g.length&&(_.scope=r.scopes.join(" "));const p=this._replaceQueryParams(u.authUrl+d,_);await(r.urlCallback||function(w){n?n.location.href=w:n=G0(w)})(p)}catch(_){o(),x(new Vr(_))}})}).catch(c=>{throw o(),c})}async authRefresh(t,r){let n={method:"POST"};return n=Dr("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",n,t,r),this.client.send(this.baseCollectionPath+"/auth-refresh",n).then(s=>this.authResponse(s))}async requestPasswordReset(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-password-reset",s).then(()=>!0)}async confirmPasswordReset(t,r,n,s,o){let i={method:"POST",body:{token:t,password:r,passwordConfirm:n}};return i=Dr("This form of confirmPasswordReset(token, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(token, password, passwordConfirm, options?).",i,s,o),this.client.send(this.baseCollectionPath+"/confirm-password-reset",i).then(()=>!0)}async requestVerification(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestVerification(email, body?, query?) is deprecated. Consider replacing it with requestVerification(email, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-verification",s).then(()=>!0)}async confirmVerification(t,r,n){let s={method:"POST",body:{token:t}};return s=Dr("This form of confirmVerification(token, body?, query?) is deprecated. Consider replacing it with confirmVerification(token, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/confirm-verification",s).then(()=>{const o=Ji(t),i=this.client.authStore.model;return i&&!i.verified&&i.id===o.id&&i.collectionId===o.collectionId&&(i.verified=!0,this.client.authStore.save(this.client.authStore.token,i)),!0})}async requestEmailChange(t,r,n){let s={method:"POST",body:{newEmail:t}};return s=Dr("This form of requestEmailChange(newEmail, body?, query?) is deprecated. Consider replacing it with requestEmailChange(newEmail, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-email-change",s).then(()=>!0)}async confirmEmailChange(t,r,n,s){let o={method:"POST",body:{token:t,password:r}};return o=Dr("This form of confirmEmailChange(token, password, body?, query?) is deprecated. Consider replacing it with confirmEmailChange(token, password, options?).",o,n,s),this.client.send(this.baseCollectionPath+"/confirm-email-change",o).then(()=>{const i=Ji(t),a=this.client.authStore.model;return a&&a.id===i.id&&a.collectionId===i.collectionId&&this.client.authStore.clear(),!0})}async listExternalAuths(t,r){return r=Object.assign({method:"GET"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t)+"/external-auths",r)}async unlinkExternalAuth(t,r,n){return n=Object.assign({method:"DELETE"},n),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t)+"/external-auths/"+encodeURIComponent(r),n).then(()=>!0)}_replaceQueryParams(t,r={}){let n=t,s="";t.indexOf("?")>=0&&(n=t.substring(0,t.indexOf("?")),s=t.substring(t.indexOf("?")+1));const o={},i=s.split("&");for(const a of i){if(a=="")continue;const c=a.split("=");o[decodeURIComponent(c[0].replace(/\+/g," "))]=decodeURIComponent((c[1]||"").replace(/\+/g," "))}for(let a in r)r.hasOwnProperty(a)&&(r[a]==null?delete o[a]:o[a]=r[a]);s="";for(let a in o)o.hasOwnProperty(a)&&(s!=""&&(s+="&"),s+=encodeURIComponent(a.replace(/%20/g,"+"))+"="+encodeURIComponent(o[a].replace(/%20/g,"+")));return s!=""?n+"?"+s:n}}function G0(e){if(typeof window>"u"||!(window!=null&&window.open))throw new Vr(new Error("Not in a browser context - please pass a custom urlCallback function."));let t=1024,r=768,n=window.innerWidth,s=window.innerHeight;t=t>n?n:t,r=r>s?s:r;let o=n/2-t/2,i=s/2-r/2;return window.open(e,"popup_window","width="+t+",height="+r+",top="+i+",left="+o+",resizable,menubar=no")}class fL extends bv{get baseCrudPath(){return"/api/collections"}async import(t,r=!1,n){return n=Object.assign({method:"PUT",body:{collections:t,deleteMissing:r}},n),this.client.send(this.baseCrudPath+"/import",n).then(()=>!0)}}class hL extends di{async getList(t=1,r=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:t,perPage:r},n.query),this.client.send("/api/logs",n)}async getOne(t,r){if(!t)throw new Vr({url:this.client.buildUrl("/api/logs/"),status:404,response:{code:404,message:"Missing required log id.",data:{}}});return r=Object.assign({method:"GET"},r),this.client.send("/api/logs/"+encodeURIComponent(t),r)}async getStats(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/logs/stats",t)}}class pL extends di{async check(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/health",t)}}class mL extends di{getUrl(t,r,n={}){if(!r||!(t!=null&&t.id)||!(t!=null&&t.collectionId)&&!(t!=null&&t.collectionName))return"";const s=[];s.push("api"),s.push("files"),s.push(encodeURIComponent(t.collectionId||t.collectionName)),s.push(encodeURIComponent(t.id)),s.push(encodeURIComponent(r));let o=this.client.buildUrl(s.join("/"));if(Object.keys(n).length){n.download===!1&&delete n.download;const i=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+i}return o}async getToken(t){return t=Object.assign({method:"POST"},t),this.client.send("/api/files/token",t).then(r=>(r==null?void 0:r.token)||"")}}class gL extends di{async getFullList(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/backups",t)}async create(t,r){return r=Object.assign({method:"POST",body:{name:t}},r),this.client.send("/api/backups",r).then(()=>!0)}async upload(t,r){return r=Object.assign({method:"POST",body:t},r),this.client.send("/api/backups/upload",r).then(()=>!0)}async delete(t,r){return r=Object.assign({method:"DELETE"},r),this.client.send(`/api/backups/${encodeURIComponent(t)}`,r).then(()=>!0)}async restore(t,r){return r=Object.assign({method:"POST"},r),this.client.send(`/api/backups/${encodeURIComponent(t)}/restore`,r).then(()=>!0)}getDownloadUrl(t,r){return this.client.buildUrl(`/api/backups/${encodeURIComponent(r)}?token=${encodeURIComponent(t)}`)}}class vL{constructor(t="/",r,n="en-US"){this.cancelControllers={},this.recordServices={},this.enableAutoCancellation=!0,this.baseUrl=t,this.lang=n,this.authStore=r||new aL,this.admins=new cL(this),this.collections=new fL(this),this.files=new mL(this),this.logs=new hL(this),this.settings=new lL(this),this.realtime=new fk(this),this.health=new pL(this),this.backups=new gL(this)}collection(t){return this.recordServices[t]||(this.recordServices[t]=new dL(this,t)),this.recordServices[t]}autoCancellation(t){return this.enableAutoCancellation=!!t,this}cancelRequest(t){return this.cancelControllers[t]&&(this.cancelControllers[t].abort(),delete this.cancelControllers[t]),this}cancelAllRequests(){for(let t in this.cancelControllers)this.cancelControllers[t].abort();return this.cancelControllers={},this}filter(t,r){if(!r)return t;for(let n in r){let s=r[n];switch(typeof s){case"boolean":case"number":s=""+s;break;case"string":s="'"+s.replace(/'/g,"\\'")+"'";break;default:s=s===null?"null":s instanceof Date?"'"+s.toISOString().replace("T"," ")+"'":"'"+JSON.stringify(s).replace(/'/g,"\\'")+"'"}t=t.replaceAll("{:"+n+"}",s)}return t}getFileUrl(t,r,n={}){return this.files.getUrl(t,r,n)}buildUrl(t){var n;let r=this.baseUrl;return typeof window>"u"||!window.location||r.startsWith("https://")||r.startsWith("http://")||(r=(n=window.location.origin)!=null&&n.endsWith("/")?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(r+=window.location.pathname||"/",r+=r.endsWith("/")?"":"/"),r+=this.baseUrl),t&&(r+=r.endsWith("/")?"":"/",r+=t.startsWith("/")?t.substring(1):t),r}async send(t,r){r=this.initSendOptions(t,r);let n=this.buildUrl(t);if(this.beforeSend){const s=Object.assign({},await this.beforeSend(n,r));s.url!==void 0||s.options!==void 0?(n=s.url||n,r=s.options||r):Object.keys(s).length&&(r=s,console!=null&&console.warn&&console.warn("Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`."))}if(r.query!==void 0){const s=this.serializeQueryParams(r.query);s&&(n+=(n.includes("?")?"&":"?")+s),delete r.query}return this.getHeader(r.headers,"Content-Type")=="application/json"&&r.body&&typeof r.body!="string"&&(r.body=JSON.stringify(r.body)),(r.fetch||fetch)(n,r).then(async s=>{let o={};try{o=await s.json()}catch{}if(this.afterSend&&(o=await this.afterSend(s,o)),s.status>=400)throw new Vr({url:s.url,status:s.status,data:o});return o}).catch(s=>{throw new Vr(s)})}initSendOptions(t,r){if((r=Object.assign({method:"GET"},r)).body=this.convertToFormDataIfNeeded(r.body),dk(r),r.query=Object.assign({},r.params,r.query),r.requestKey===void 0&&(r.$autoCancel===!1||r.query.$autoCancel===!1?r.requestKey=null:(r.$cancelKey||r.query.$cancelKey)&&(r.requestKey=r.$cancelKey||r.query.$cancelKey)),delete r.$autoCancel,delete r.query.$autoCancel,delete r.$cancelKey,delete r.query.$cancelKey,this.getHeader(r.headers,"Content-Type")!==null||this.isFormData(r.body)||(r.headers=Object.assign({},r.headers,{"Content-Type":"application/json"})),this.getHeader(r.headers,"Accept-Language")===null&&(r.headers=Object.assign({},r.headers,{"Accept-Language":this.lang})),this.authStore.token&&this.getHeader(r.headers,"Authorization")===null&&(r.headers=Object.assign({},r.headers,{Authorization:this.authStore.token})),this.enableAutoCancellation&&r.requestKey!==null){const n=r.requestKey||(r.method||"GET")+t;delete r.requestKey,this.cancelRequest(n);const s=new AbortController;this.cancelControllers[n]=s,r.signal=s.signal}return r}convertToFormDataIfNeeded(t){if(typeof FormData>"u"||t===void 0||typeof t!="object"||t===null||this.isFormData(t)||!this.hasBlobField(t))return t;const r=new FormData;for(const n in t){const s=t[n];if(typeof s!="object"||this.hasBlobField({data:s})){const o=Array.isArray(s)?s:[s];for(let i of o)r.append(n,i)}else{let o={};o[n]=s,r.append("@jsonPayload",JSON.stringify(o))}}return r}hasBlobField(t){for(const r in t){const n=Array.isArray(t[r])?t[r]:[t[r]];for(const s of n)if(typeof Blob<"u"&&s instanceof Blob||typeof File<"u"&&s instanceof File)return!0}return!1}getHeader(t,r){t=t||{},r=r.toLowerCase();for(let n in t)if(n.toLowerCase()==r)return t[n];return null}isFormData(t){return t&&(t.constructor.name==="FormData"||typeof FormData<"u"&&t instanceof FormData)}serializeQueryParams(t){const r=[];for(const n in t){if(t[n]===null)continue;const s=t[n],o=encodeURIComponent(n);if(Array.isArray(s))for(const i of s)r.push(o+"="+encodeURIComponent(i));else s instanceof Date?r.push(o+"="+encodeURIComponent(s.toISOString())):typeof s!==null&&typeof s=="object"?r.push(o+"="+encodeURIComponent(JSON.stringify(s))):r.push(o+"="+encodeURIComponent(s))}return r.join("&")}}var yL={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const xL=yL.VITE_API_DOMAIN;console.log(xL);let wu;const st=()=>wu||(wu=new vL("/"),wu);//! moment.js //! version : 2.30.1 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com -var hk;function ve(){return hk.apply(null,arguments)}function xL(e){hk=e}function Cn(e){return e instanceof Array||Object.prototype.toString.call(e)==="[object Array]"}function Zo(e){return e!=null&&Object.prototype.toString.call(e)==="[object Object]"}function ct(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Sv(e){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(e).length===0;var t;for(t in e)if(ct(e,t))return!1;return!0}function _r(e){return e===void 0}function Cs(e){return typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]"}function Pc(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function pk(e,t){var r=[],n,s=e.length;for(n=0;n>>0,n;for(n=0;n0)for(r=0;r>>0,n;for(n=0;n0)for(r=0;r=0;return(o?r?"+":"":"-")+Math.pow(10,Math.max(0,s)).toString().substr(1)+n}var Ev=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,_u=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,qh={},ea={};function Ie(e,t,r,n){var s=n;typeof n=="string"&&(s=function(){return this[n]()}),e&&(ea[e]=s),t&&(ea[t[0]]=function(){return Hn(s.apply(this,arguments),t[1],t[2])}),r&&(ea[r]=function(){return this.localeData().ordinal(s.apply(this,arguments),e)})}function kL(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function CL(e){var t=e.match(Ev),r,n;for(r=0,n=t.length;r=0&&_u.test(e);)e=e.replace(_u,n),_u.lastIndex=0,r-=1;return e}var jL={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function EL(e){var t=this._longDateFormat[e],r=this._longDateFormat[e.toUpperCase()];return t||!r?t:(this._longDateFormat[e]=r.match(Ev).map(function(n){return n==="MMMM"||n==="MM"||n==="DD"||n==="dddd"?n.slice(1):n}).join(""),this._longDateFormat[e])}var NL="Invalid date";function TL(){return this._invalidDate}var RL="%d",PL=/\d{1,2}/;function AL(e){return this._ordinal.replace("%d",e)}var DL={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function OL(e,t,r,n){var s=this._relativeTime[r];return Gn(s)?s(e,t,r,n):s.replace(/%d/i,e)}function ML(e,t){var r=this._relativeTime[e>0?"future":"past"];return Gn(r)?r(t):r.replace(/%s/i,t)}var Q0={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ln(e){return typeof e=="string"?Q0[e]||Q0[e.toLowerCase()]:void 0}function Nv(e){var t={},r,n;for(n in e)ct(e,n)&&(r=ln(n),r&&(t[r]=e[n]));return t}var IL={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function LL(e){var t=[],r;for(r in e)ct(e,r)&&t.push({unit:r,priority:IL[r]});return t.sort(function(n,s){return n.priority-s.priority}),t}var yk=/\d/,Zr=/\d\d/,xk=/\d{3}/,Tv=/\d{4}/,Af=/[+-]?\d{6}/,Ct=/\d\d?/,wk=/\d\d\d\d?/,_k=/\d\d\d\d\d\d?/,Df=/\d{1,3}/,Rv=/\d{1,4}/,Of=/[+-]?\d{1,6}/,Aa=/\d+/,Mf=/[+-]?\d+/,FL=/Z|[+-]\d\d:?\d\d/gi,If=/Z|[+-]\d\d(?::?\d\d)?/gi,zL=/[+-]?\d+(\.\d{1,3})?/,Dc=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Da=/^[1-9]\d?/,Pv=/^([1-9]\d|\d)/,Td;Td={};function _e(e,t,r){Td[e]=Gn(t)?t:function(n,s){return n&&r?r:t}}function UL(e,t){return ct(Td,e)?Td[e](t._strict,t._locale):new RegExp($L(e))}function $L(e){return gs(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,r,n,s,o){return r||n||s||o}))}function gs(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Jr(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function rt(e){var t=+e,r=0;return t!==0&&isFinite(t)&&(r=Jr(t)),r}var pm={};function vt(e,t){var r,n=t,s;for(typeof e=="string"&&(e=[e]),Cs(t)&&(n=function(o,i){i[t]=rt(o)}),s=e.length,r=0;r68?1900:2e3)};var bk=Oa("FullYear",!0);function HL(){return Lf(this.year())}function Oa(e,t){return function(r){return r!=null?(Sk(this,e,r),ve.updateOffset(this,t),this):Xl(this,e)}}function Xl(e,t){if(!e.isValid())return NaN;var r=e._d,n=e._isUTC;switch(t){case"Milliseconds":return n?r.getUTCMilliseconds():r.getMilliseconds();case"Seconds":return n?r.getUTCSeconds():r.getSeconds();case"Minutes":return n?r.getUTCMinutes():r.getMinutes();case"Hours":return n?r.getUTCHours():r.getHours();case"Date":return n?r.getUTCDate():r.getDate();case"Day":return n?r.getUTCDay():r.getDay();case"Month":return n?r.getUTCMonth():r.getMonth();case"FullYear":return n?r.getUTCFullYear():r.getFullYear();default:return NaN}}function Sk(e,t,r){var n,s,o,i,a;if(!(!e.isValid()||isNaN(r))){switch(n=e._d,s=e._isUTC,t){case"Milliseconds":return void(s?n.setUTCMilliseconds(r):n.setMilliseconds(r));case"Seconds":return void(s?n.setUTCSeconds(r):n.setSeconds(r));case"Minutes":return void(s?n.setUTCMinutes(r):n.setMinutes(r));case"Hours":return void(s?n.setUTCHours(r):n.setHours(r));case"Date":return void(s?n.setUTCDate(r):n.setDate(r));case"FullYear":break;default:return}o=r,i=e.month(),a=e.date(),a=a===29&&i===1&&!Lf(o)?28:a,s?n.setUTCFullYear(o,i,a):n.setFullYear(o,i,a)}}function YL(e){return e=ln(e),Gn(this[e])?this[e]():this}function ZL(e,t){if(typeof e=="object"){e=Nv(e);var r=LL(e),n,s=r.length;for(n=0;n=0?(a=new Date(e+400,t,r,n,s,o,i),isFinite(a.getFullYear())&&a.setFullYear(e)):a=new Date(e,t,r,n,s,o,i),a}function Ql(e){var t,r;return e<100&&e>=0?(r=Array.prototype.slice.call(arguments),r[0]=e+400,t=new Date(Date.UTC.apply(null,r)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Rd(e,t,r){var n=7+t-r,s=(7+Ql(e,0,n).getUTCDay()-t)%7;return-s+n-1}function Tk(e,t,r,n,s){var o=(7+r-n)%7,i=Rd(e,n,s),a=1+7*(t-1)+o+i,c,u;return a<=0?(c=e-1,u=bl(c)+a):a>bl(e)?(c=e+1,u=a-bl(e)):(c=e,u=a),{year:c,dayOfYear:u}}function Jl(e,t,r){var n=Rd(e.year(),t,r),s=Math.floor((e.dayOfYear()-n-1)/7)+1,o,i;return s<1?(i=e.year()-1,o=s+vs(i,t,r)):s>vs(e.year(),t,r)?(o=s-vs(e.year(),t,r),i=e.year()+1):(i=e.year(),o=s),{week:o,year:i}}function vs(e,t,r){var n=Rd(e,t,r),s=Rd(e+1,t,r);return(bl(e)-n+s)/7}Ie("w",["ww",2],"wo","week");Ie("W",["WW",2],"Wo","isoWeek");_e("w",Ct,Da);_e("ww",Ct,Zr);_e("W",Ct,Da);_e("WW",Ct,Zr);Oc(["w","ww","W","WW"],function(e,t,r,n){t[n.substr(0,1)]=rt(e)});function i4(e){return Jl(e,this._week.dow,this._week.doy).week}var a4={dow:0,doy:6};function l4(){return this._week.dow}function c4(){return this._week.doy}function u4(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function d4(e){var t=Jl(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}Ie("d",0,"do","day");Ie("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)});Ie("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)});Ie("dddd",0,0,function(e){return this.localeData().weekdays(this,e)});Ie("e",0,0,"weekday");Ie("E",0,0,"isoWeekday");_e("d",Ct);_e("e",Ct);_e("E",Ct);_e("dd",function(e,t){return t.weekdaysMinRegex(e)});_e("ddd",function(e,t){return t.weekdaysShortRegex(e)});_e("dddd",function(e,t){return t.weekdaysRegex(e)});Oc(["dd","ddd","dddd"],function(e,t,r,n){var s=r._locale.weekdaysParse(e,n,r._strict);s!=null?t.d=s:Xe(r).invalidWeekday=e});Oc(["d","e","E"],function(e,t,r,n){t[n]=rt(e)});function f4(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function h4(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Dv(e,t){return e.slice(t,7).concat(e.slice(0,t))}var p4="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Rk="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),m4="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),g4=Dc,v4=Dc,y4=Dc;function x4(e,t){var r=Cn(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?Dv(r,this._week.dow):e?r[e.day()]:r}function w4(e){return e===!0?Dv(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function _4(e){return e===!0?Dv(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function b4(e,t,r){var n,s,o,i=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)o=Kn([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(o,"").toLocaleLowerCase();return r?t==="dddd"?(s=zt.call(this._weekdaysParse,i),s!==-1?s:null):t==="ddd"?(s=zt.call(this._shortWeekdaysParse,i),s!==-1?s:null):(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null):t==="dddd"?(s=zt.call(this._weekdaysParse,i),s!==-1||(s=zt.call(this._shortWeekdaysParse,i),s!==-1)?s:(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null)):t==="ddd"?(s=zt.call(this._shortWeekdaysParse,i),s!==-1||(s=zt.call(this._weekdaysParse,i),s!==-1)?s:(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null)):(s=zt.call(this._minWeekdaysParse,i),s!==-1||(s=zt.call(this._weekdaysParse,i),s!==-1)?s:(s=zt.call(this._shortWeekdaysParse,i),s!==-1?s:null))}function S4(e,t,r){var n,s,o;if(this._weekdaysParseExact)return b4.call(this,e,t,r);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(s=Kn([2e3,1]).day(n),r&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(s,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(s,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(s,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(o="^"+this.weekdays(s,"")+"|^"+this.weekdaysShort(s,"")+"|^"+this.weekdaysMin(s,""),this._weekdaysParse[n]=new RegExp(o.replace(".",""),"i")),r&&t==="dddd"&&this._fullWeekdaysParse[n].test(e))return n;if(r&&t==="ddd"&&this._shortWeekdaysParse[n].test(e))return n;if(r&&t==="dd"&&this._minWeekdaysParse[n].test(e))return n;if(!r&&this._weekdaysParse[n].test(e))return n}}function k4(e){if(!this.isValid())return e!=null?this:NaN;var t=Xl(this,"Day");return e!=null?(e=f4(e,this.localeData()),this.add(e-t,"d")):t}function C4(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function j4(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=h4(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function E4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(ct(this,"_weekdaysRegex")||(this._weekdaysRegex=g4),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function N4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(ct(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=v4),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function T4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(ct(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=y4),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ov(){function e(d,f){return f.length-d.length}var t=[],r=[],n=[],s=[],o,i,a,c,u;for(o=0;o<7;o++)i=Kn([2e3,1]).day(o),a=gs(this.weekdaysMin(i,"")),c=gs(this.weekdaysShort(i,"")),u=gs(this.weekdays(i,"")),t.push(a),r.push(c),n.push(u),s.push(a),s.push(c),s.push(u);t.sort(e),r.sort(e),n.sort(e),s.sort(e),this._weekdaysRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function Mv(){return this.hours()%12||12}function R4(){return this.hours()||24}Ie("H",["HH",2],0,"hour");Ie("h",["hh",2],0,Mv);Ie("k",["kk",2],0,R4);Ie("hmm",0,0,function(){return""+Mv.apply(this)+Hn(this.minutes(),2)});Ie("hmmss",0,0,function(){return""+Mv.apply(this)+Hn(this.minutes(),2)+Hn(this.seconds(),2)});Ie("Hmm",0,0,function(){return""+this.hours()+Hn(this.minutes(),2)});Ie("Hmmss",0,0,function(){return""+this.hours()+Hn(this.minutes(),2)+Hn(this.seconds(),2)});function Pk(e,t){Ie(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}Pk("a",!0);Pk("A",!1);function Ak(e,t){return t._meridiemParse}_e("a",Ak);_e("A",Ak);_e("H",Ct,Pv);_e("h",Ct,Da);_e("k",Ct,Da);_e("HH",Ct,Zr);_e("hh",Ct,Zr);_e("kk",Ct,Zr);_e("hmm",wk);_e("hmmss",_k);_e("Hmm",wk);_e("Hmmss",_k);vt(["H","HH"],Gt);vt(["k","kk"],function(e,t,r){var n=rt(e);t[Gt]=n===24?0:n});vt(["a","A"],function(e,t,r){r._isPm=r._locale.isPM(e),r._meridiem=e});vt(["h","hh"],function(e,t,r){t[Gt]=rt(e),Xe(r).bigHour=!0});vt("hmm",function(e,t,r){var n=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n)),Xe(r).bigHour=!0});vt("hmmss",function(e,t,r){var n=e.length-4,s=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n,2)),t[hs]=rt(e.substr(s)),Xe(r).bigHour=!0});vt("Hmm",function(e,t,r){var n=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n))});vt("Hmmss",function(e,t,r){var n=e.length-4,s=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n,2)),t[hs]=rt(e.substr(s))});function P4(e){return(e+"").toLowerCase().charAt(0)==="p"}var A4=/[ap]\.?m?\.?/i,D4=Oa("Hours",!0);function O4(e,t,r){return e>11?r?"pm":"PM":r?"am":"AM"}var Dk={calendar:bL,longDateFormat:jL,invalidDate:NL,ordinal:RL,dayOfMonthOrdinalParse:PL,relativeTime:DL,months:GL,monthsShort:kk,week:a4,weekdays:p4,weekdaysMin:m4,weekdaysShort:Rk,meridiemParse:A4},Nt={},Xa={},ec;function M4(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r0;){if(s=Ff(o.slice(0,r).join("-")),s)return s;if(n&&n.length>=r&&M4(o,n)>=r-1)break;r--}t++}return ec}function L4(e){return!!(e&&e.match("^[^/\\\\]*$"))}function Ff(e){var t=null,r;if(Nt[e]===void 0&&typeof Gu<"u"&&Gu&&Gu.exports&&L4(e))try{t=ec._abbr,r=require,r("./locale/"+e),co(t)}catch{Nt[e]=null}return Nt[e]}function co(e,t){var r;return e&&(_r(t)?r=As(e):r=Iv(e,t),r?ec=r:typeof console<"u"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),ec._abbr}function Iv(e,t){if(t!==null){var r,n=Dk;if(t.abbr=e,Nt[e]!=null)gk("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=Nt[e]._config;else if(t.parentLocale!=null)if(Nt[t.parentLocale]!=null)n=Nt[t.parentLocale]._config;else if(r=Ff(t.parentLocale),r!=null)n=r._config;else return Xa[t.parentLocale]||(Xa[t.parentLocale]=[]),Xa[t.parentLocale].push({name:e,config:t}),null;return Nt[e]=new jv(fm(n,t)),Xa[e]&&Xa[e].forEach(function(s){Iv(s.name,s.config)}),co(e),Nt[e]}else return delete Nt[e],null}function F4(e,t){if(t!=null){var r,n,s=Dk;Nt[e]!=null&&Nt[e].parentLocale!=null?Nt[e].set(fm(Nt[e]._config,t)):(n=Ff(e),n!=null&&(s=n._config),t=fm(s,t),n==null&&(t.abbr=e),r=new jv(t),r.parentLocale=Nt[e],Nt[e]=r),co(e)}else Nt[e]!=null&&(Nt[e].parentLocale!=null?(Nt[e]=Nt[e].parentLocale,e===co()&&co(e)):Nt[e]!=null&&delete Nt[e]);return Nt[e]}function As(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return ec;if(!Cn(e)){if(t=Ff(e),t)return t;e=[e]}return I4(e)}function z4(){return hm(Nt)}function Lv(e){var t,r=e._a;return r&&Xe(e).overflow===-2&&(t=r[fs]<0||r[fs]>11?fs:r[Ln]<1||r[Ln]>Av(r[ar],r[fs])?Ln:r[Gt]<0||r[Gt]>24||r[Gt]===24&&(r[vn]!==0||r[hs]!==0||r[Wo]!==0)?Gt:r[vn]<0||r[vn]>59?vn:r[hs]<0||r[hs]>59?hs:r[Wo]<0||r[Wo]>999?Wo:-1,Xe(e)._overflowDayOfYear&&(tLn)&&(t=Ln),Xe(e)._overflowWeeks&&t===-1&&(t=WL),Xe(e)._overflowWeekday&&t===-1&&(t=BL),Xe(e).overflow=t),e}var U4=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,$4=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,V4=/Z|[+-]\d\d(?::?\d\d)?/,bu=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Xh=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],W4=/^\/?Date\((-?\d+)/i,B4=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,H4={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Ok(e){var t,r,n=e._i,s=U4.exec(n)||$4.exec(n),o,i,a,c,u=bu.length,d=Xh.length;if(s){for(Xe(e).iso=!0,t=0,r=u;tbl(i)||e._dayOfYear===0)&&(Xe(e)._overflowDayOfYear=!0),r=Ql(i,0,e._dayOfYear),e._a[fs]=r.getUTCMonth(),e._a[Ln]=r.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=n[t]=s[t];for(;t<7;t++)e._a[t]=n[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[Gt]===24&&e._a[vn]===0&&e._a[hs]===0&&e._a[Wo]===0&&(e._nextDay=!0,e._a[Gt]=0),e._d=(e._useUTC?Ql:o4).apply(null,n),o=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Gt]=24),e._w&&typeof e._w.d<"u"&&e._w.d!==o&&(Xe(e).weekdayMismatch=!0)}}function J4(e){var t,r,n,s,o,i,a,c,u;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(o=1,i=4,r=Ci(t.GG,e._a[ar],Jl(kt(),1,4).year),n=Ci(t.W,1),s=Ci(t.E,1),(s<1||s>7)&&(c=!0)):(o=e._locale._week.dow,i=e._locale._week.doy,u=Jl(kt(),o,i),r=Ci(t.gg,e._a[ar],u.year),n=Ci(t.w,u.week),t.d!=null?(s=t.d,(s<0||s>6)&&(c=!0)):t.e!=null?(s=t.e+o,(t.e<0||t.e>6)&&(c=!0)):s=o),n<1||n>vs(r,o,i)?Xe(e)._overflowWeeks=!0:c!=null?Xe(e)._overflowWeekday=!0:(a=Tk(r,n,s,o,i),e._a[ar]=a.year,e._dayOfYear=a.dayOfYear)}ve.ISO_8601=function(){};ve.RFC_2822=function(){};function zv(e){if(e._f===ve.ISO_8601){Ok(e);return}if(e._f===ve.RFC_2822){Mk(e);return}e._a=[],Xe(e).empty=!0;var t=""+e._i,r,n,s,o,i,a=t.length,c=0,u,d;for(s=vk(e._f,e._locale).match(Ev)||[],d=s.length,r=0;r0&&Xe(e).unusedInput.push(i),t=t.slice(t.indexOf(n)+n.length),c+=n.length),ea[o]?(n?Xe(e).empty=!1:Xe(e).unusedTokens.push(o),VL(o,n,e)):e._strict&&!n&&Xe(e).unusedTokens.push(o);Xe(e).charsLeftOver=a-c,t.length>0&&Xe(e).unusedInput.push(t),e._a[Gt]<=12&&Xe(e).bigHour===!0&&e._a[Gt]>0&&(Xe(e).bigHour=void 0),Xe(e).parsedDateParts=e._a.slice(0),Xe(e).meridiem=e._meridiem,e._a[Gt]=e5(e._locale,e._a[Gt],e._meridiem),u=Xe(e).era,u!==null&&(e._a[ar]=e._locale.erasConvertYear(u,e._a[ar])),Fv(e),Lv(e)}function e5(e,t,r){var n;return r==null?t:e.meridiemHour!=null?e.meridiemHour(t,r):(e.isPM!=null&&(n=e.isPM(r),n&&t<12&&(t+=12),!n&&t===12&&(t=0)),t)}function t5(e){var t,r,n,s,o,i,a=!1,c=e._f.length;if(c===0){Xe(e).invalidFormat=!0,e._d=new Date(NaN);return}for(s=0;sthis?this:e:Pf()});function Fk(e,t){var r,n;if(t.length===1&&Cn(t[0])&&(t=t[0]),!t.length)return kt();for(r=t[0],n=1;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function b5(){if(!_r(this._isDSTShifted))return this._isDSTShifted;var e={},t;return Cv(e,this),e=Ik(e),e._a?(t=e._isUTC?Kn(e._a):kt(e._a),this._isDSTShifted=this.isValid()&&h5(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function S5(){return this.isValid()?!this._isUTC:!1}function k5(){return this.isValid()?this._isUTC:!1}function Uk(){return this.isValid()?this._isUTC&&this._offset===0:!1}var C5=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,j5=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Rn(e,t){var r=e,n=null,s,o,i;return Bu(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:Cs(e)||!isNaN(+e)?(r={},t?r[t]=+e:r.milliseconds=+e):(n=C5.exec(e))?(s=n[1]==="-"?-1:1,r={y:0,d:rt(n[Ln])*s,h:rt(n[Gt])*s,m:rt(n[vn])*s,s:rt(n[hs])*s,ms:rt(mm(n[Wo]*1e3))*s}):(n=j5.exec(e))?(s=n[1]==="-"?-1:1,r={y:Po(n[2],s),M:Po(n[3],s),w:Po(n[4],s),d:Po(n[5],s),h:Po(n[6],s),m:Po(n[7],s),s:Po(n[8],s)}):r==null?r={}:typeof r=="object"&&("from"in r||"to"in r)&&(i=E5(kt(r.from),kt(r.to)),r={},r.ms=i.milliseconds,r.M=i.months),o=new zf(r),Bu(e)&&ct(e,"_locale")&&(o._locale=e._locale),Bu(e)&&ct(e,"_isValid")&&(o._isValid=e._isValid),o}Rn.fn=zf.prototype;Rn.invalid=f5;function Po(e,t){var r=e&&parseFloat(e.replace(",","."));return(isNaN(r)?0:r)*t}function ew(e,t){var r={};return r.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(r.months,"M").isAfter(t)&&--r.months,r.milliseconds=+t-+e.clone().add(r.months,"M"),r}function E5(e,t){var r;return e.isValid()&&t.isValid()?(t=$v(t,e),e.isBefore(t)?r=ew(e,t):(r=ew(t,e),r.milliseconds=-r.milliseconds,r.months=-r.months),r):{milliseconds:0,months:0}}function $k(e,t){return function(r,n){var s,o;return n!==null&&!isNaN(+n)&&(gk(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=r,r=n,n=o),s=Rn(r,n),Vk(this,s,e),this}}function Vk(e,t,r,n){var s=t._milliseconds,o=mm(t._days),i=mm(t._months);e.isValid()&&(n=n??!0,i&&jk(e,Xl(e,"Month")+i*r),o&&Sk(e,"Date",Xl(e,"Date")+o*r),s&&e._d.setTime(e._d.valueOf()+s*r),n&&ve.updateOffset(e,o||i))}var N5=$k(1,"add"),T5=$k(-1,"subtract");function Wk(e){return typeof e=="string"||e instanceof String}function R5(e){return jn(e)||Pc(e)||Wk(e)||Cs(e)||A5(e)||P5(e)||e===null||e===void 0}function P5(e){var t=Zo(e)&&!Sv(e),r=!1,n=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],s,o,i=n.length;for(s=0;sr.valueOf():r.valueOf()9999?Wu(r,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Gn(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Wu(r,"Z")):Wu(r,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Y5(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",r,n,s,o;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),r="["+e+'("]',n=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",s="-MM-DD[T]HH:mm:ss.SSS",o=t+'[")]',this.format(r+n+s+o)}function Z5(e){e||(e=this.isUtc()?ve.defaultFormatUtc:ve.defaultFormat);var t=Wu(this,e);return this.localeData().postformat(t)}function K5(e,t){return this.isValid()&&(jn(e)&&e.isValid()||kt(e).isValid())?Rn({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function G5(e){return this.from(kt(),e)}function q5(e,t){return this.isValid()&&(jn(e)&&e.isValid()||kt(e).isValid())?Rn({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function X5(e){return this.to(kt(),e)}function Bk(e){var t;return e===void 0?this._locale._abbr:(t=As(e),t!=null&&(this._locale=t),this)}var Hk=an("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return e===void 0?this.localeData():this.locale(e)});function Yk(){return this._locale}var Pd=1e3,ta=60*Pd,Ad=60*ta,Zk=(365*400+97)*24*Ad;function ra(e,t){return(e%t+t)%t}function Kk(e,t,r){return e<100&&e>=0?new Date(e+400,t,r)-Zk:new Date(e,t,r).valueOf()}function Gk(e,t,r){return e<100&&e>=0?Date.UTC(e+400,t,r)-Zk:Date.UTC(e,t,r)}function Q5(e){var t,r;if(e=ln(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(r=this._isUTC?Gk:Kk,e){case"year":t=r(this.year(),0,1);break;case"quarter":t=r(this.year(),this.month()-this.month()%3,1);break;case"month":t=r(this.year(),this.month(),1);break;case"week":t=r(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=r(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=ra(t+(this._isUTC?0:this.utcOffset()*ta),Ad);break;case"minute":t=this._d.valueOf(),t-=ra(t,ta);break;case"second":t=this._d.valueOf(),t-=ra(t,Pd);break}return this._d.setTime(t),ve.updateOffset(this,!0),this}function J5(e){var t,r;if(e=ln(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(r=this._isUTC?Gk:Kk,e){case"year":t=r(this.year()+1,0,1)-1;break;case"quarter":t=r(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=r(this.year(),this.month()+1,1)-1;break;case"week":t=r(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=r(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=Ad-ra(t+(this._isUTC?0:this.utcOffset()*ta),Ad)-1;break;case"minute":t=this._d.valueOf(),t+=ta-ra(t,ta)-1;break;case"second":t=this._d.valueOf(),t+=Pd-ra(t,Pd)-1;break}return this._d.setTime(t),ve.updateOffset(this,!0),this}function eF(){return this._d.valueOf()-(this._offset||0)*6e4}function tF(){return Math.floor(this.valueOf()/1e3)}function rF(){return new Date(this.valueOf())}function nF(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function sF(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function oF(){return this.isValid()?this.toISOString():null}function iF(){return kv(this)}function aF(){return Qs({},Xe(this))}function lF(){return Xe(this).overflow}function cF(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Ie("N",0,0,"eraAbbr");Ie("NN",0,0,"eraAbbr");Ie("NNN",0,0,"eraAbbr");Ie("NNNN",0,0,"eraName");Ie("NNNNN",0,0,"eraNarrow");Ie("y",["y",1],"yo","eraYear");Ie("y",["yy",2],0,"eraYear");Ie("y",["yyy",3],0,"eraYear");Ie("y",["yyyy",4],0,"eraYear");_e("N",Vv);_e("NN",Vv);_e("NNN",Vv);_e("NNNN",wF);_e("NNNNN",_F);vt(["N","NN","NNN","NNNN","NNNNN"],function(e,t,r,n){var s=r._locale.erasParse(e,n,r._strict);s?Xe(r).era=s:Xe(r).invalidEra=e});_e("y",Aa);_e("yy",Aa);_e("yyy",Aa);_e("yyyy",Aa);_e("yo",bF);vt(["y","yy","yyy","yyyy"],ar);vt(["yo"],function(e,t,r,n){var s;r._locale._eraYearOrdinalRegex&&(s=e.match(r._locale._eraYearOrdinalRegex)),r._locale.eraYearOrdinalParse?t[ar]=r._locale.eraYearOrdinalParse(e,s):t[ar]=parseInt(e,10)});function uF(e,t){var r,n,s,o=this._eras||As("en")._eras;for(r=0,n=o.length;r=0)return o[n]}function fF(e,t){var r=e.since<=e.until?1:-1;return t===void 0?ve(e.since).year():ve(e.since).year()+(t-e.offset)*r}function hF(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;eo&&(t=o),TF.call(this,e,t,r,n,s))}function TF(e,t,r,n,s){var o=Tk(e,t,r,n,s),i=Ql(o.year,0,o.dayOfYear);return this.year(i.getUTCFullYear()),this.month(i.getUTCMonth()),this.date(i.getUTCDate()),this}Ie("Q",0,"Qo","quarter");_e("Q",yk);vt("Q",function(e,t){t[fs]=(rt(e)-1)*3});function RF(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}Ie("D",["DD",2],"Do","date");_e("D",Ct,Da);_e("DD",Ct,Zr);_e("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient});vt(["D","DD"],Ln);vt("Do",function(e,t){t[Ln]=rt(e.match(Ct)[0])});var Xk=Oa("Date",!0);Ie("DDD",["DDDD",3],"DDDo","dayOfYear");_e("DDD",Df);_e("DDDD",xk);vt(["DDD","DDDD"],function(e,t,r){r._dayOfYear=rt(e)});function PF(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}Ie("m",["mm",2],0,"minute");_e("m",Ct,Pv);_e("mm",Ct,Zr);vt(["m","mm"],vn);var AF=Oa("Minutes",!1);Ie("s",["ss",2],0,"second");_e("s",Ct,Pv);_e("ss",Ct,Zr);vt(["s","ss"],hs);var DF=Oa("Seconds",!1);Ie("S",0,0,function(){return~~(this.millisecond()/100)});Ie(0,["SS",2],0,function(){return~~(this.millisecond()/10)});Ie(0,["SSS",3],0,"millisecond");Ie(0,["SSSS",4],0,function(){return this.millisecond()*10});Ie(0,["SSSSS",5],0,function(){return this.millisecond()*100});Ie(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3});Ie(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4});Ie(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5});Ie(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6});_e("S",Df,yk);_e("SS",Df,Zr);_e("SSS",Df,xk);var Js,Qk;for(Js="SSSS";Js.length<=9;Js+="S")_e(Js,Aa);function OF(e,t){t[Wo]=rt(("0."+e)*1e3)}for(Js="S";Js.length<=9;Js+="S")vt(Js,OF);Qk=Oa("Milliseconds",!1);Ie("z",0,0,"zoneAbbr");Ie("zz",0,0,"zoneName");function MF(){return this._isUTC?"UTC":""}function IF(){return this._isUTC?"Coordinated Universal Time":""}var le=Ac.prototype;le.add=N5;le.calendar=M5;le.clone=I5;le.diff=W5;le.endOf=J5;le.format=Z5;le.from=K5;le.fromNow=G5;le.to=q5;le.toNow=X5;le.get=YL;le.invalidAt=lF;le.isAfter=L5;le.isBefore=F5;le.isBetween=z5;le.isSame=U5;le.isSameOrAfter=$5;le.isSameOrBefore=V5;le.isValid=iF;le.lang=Hk;le.locale=Bk;le.localeData=Yk;le.max=i5;le.min=o5;le.parsingFlags=aF;le.set=ZL;le.startOf=Q5;le.subtract=T5;le.toArray=nF;le.toObject=sF;le.toDate=rF;le.toISOString=H5;le.inspect=Y5;typeof Symbol<"u"&&Symbol.for!=null&&(le[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"});le.toJSON=oF;le.toString=B5;le.unix=tF;le.valueOf=eF;le.creationData=cF;le.eraName=hF;le.eraNarrow=pF;le.eraAbbr=mF;le.eraYear=gF;le.year=bk;le.isLeapYear=HL;le.weekYear=SF;le.isoWeekYear=kF;le.quarter=le.quarters=RF;le.month=Ek;le.daysInMonth=r4;le.week=le.weeks=u4;le.isoWeek=le.isoWeeks=d4;le.weeksInYear=EF;le.weeksInWeekYear=NF;le.isoWeeksInYear=CF;le.isoWeeksInISOWeekYear=jF;le.date=Xk;le.day=le.days=k4;le.weekday=C4;le.isoWeekday=j4;le.dayOfYear=PF;le.hour=le.hours=D4;le.minute=le.minutes=AF;le.second=le.seconds=DF;le.millisecond=le.milliseconds=Qk;le.utcOffset=m5;le.utc=v5;le.local=y5;le.parseZone=x5;le.hasAlignedHourOffset=w5;le.isDST=_5;le.isLocal=S5;le.isUtcOffset=k5;le.isUtc=Uk;le.isUTC=Uk;le.zoneAbbr=MF;le.zoneName=IF;le.dates=an("dates accessor is deprecated. Use date instead.",Xk);le.months=an("months accessor is deprecated. Use month instead",Ek);le.years=an("years accessor is deprecated. Use year instead",bk);le.zone=an("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",g5);le.isDSTShifted=an("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",b5);function LF(e){return kt(e*1e3)}function FF(){return kt.apply(null,arguments).parseZone()}function Jk(e){return e}var ut=jv.prototype;ut.calendar=SL;ut.longDateFormat=EL;ut.invalidDate=TL;ut.ordinal=AL;ut.preparse=Jk;ut.postformat=Jk;ut.relativeTime=OL;ut.pastFuture=ML;ut.set=_L;ut.eras=uF;ut.erasParse=dF;ut.erasConvertYear=fF;ut.erasAbbrRegex=yF;ut.erasNameRegex=vF;ut.erasNarrowRegex=xF;ut.months=QL;ut.monthsShort=JL;ut.monthsParse=t4;ut.monthsRegex=s4;ut.monthsShortRegex=n4;ut.week=i4;ut.firstDayOfYear=c4;ut.firstDayOfWeek=l4;ut.weekdays=x4;ut.weekdaysMin=_4;ut.weekdaysShort=w4;ut.weekdaysParse=S4;ut.weekdaysRegex=E4;ut.weekdaysShortRegex=N4;ut.weekdaysMinRegex=T4;ut.isPM=P4;ut.meridiem=O4;function Dd(e,t,r,n){var s=As(),o=Kn().set(n,t);return s[r](o,e)}function eC(e,t,r){if(Cs(e)&&(t=e,e=void 0),e=e||"",t!=null)return Dd(e,t,r,"month");var n,s=[];for(n=0;n<12;n++)s[n]=Dd(e,n,r,"month");return s}function Bv(e,t,r,n){typeof e=="boolean"?(Cs(t)&&(r=t,t=void 0),t=t||""):(t=e,r=t,e=!1,Cs(t)&&(r=t,t=void 0),t=t||"");var s=As(),o=e?s._week.dow:0,i,a=[];if(r!=null)return Dd(t,(r+o)%7,n,"day");for(i=0;i<7;i++)a[i]=Dd(t,(i+o)%7,n,"day");return a}function zF(e,t){return eC(e,t,"months")}function UF(e,t){return eC(e,t,"monthsShort")}function $F(e,t,r){return Bv(e,t,r,"weekdays")}function VF(e,t,r){return Bv(e,t,r,"weekdaysShort")}function WF(e,t,r){return Bv(e,t,r,"weekdaysMin")}co("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,r=rt(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+r}});ve.lang=an("moment.lang is deprecated. Use moment.locale instead.",co);ve.langData=an("moment.langData is deprecated. Use moment.localeData instead.",As);var ns=Math.abs;function BF(){var e=this._data;return this._milliseconds=ns(this._milliseconds),this._days=ns(this._days),this._months=ns(this._months),e.milliseconds=ns(e.milliseconds),e.seconds=ns(e.seconds),e.minutes=ns(e.minutes),e.hours=ns(e.hours),e.months=ns(e.months),e.years=ns(e.years),this}function tC(e,t,r,n){var s=Rn(t,r);return e._milliseconds+=n*s._milliseconds,e._days+=n*s._days,e._months+=n*s._months,e._bubble()}function HF(e,t){return tC(this,e,t,1)}function YF(e,t){return tC(this,e,t,-1)}function tw(e){return e<0?Math.floor(e):Math.ceil(e)}function ZF(){var e=this._milliseconds,t=this._days,r=this._months,n=this._data,s,o,i,a,c;return e>=0&&t>=0&&r>=0||e<=0&&t<=0&&r<=0||(e+=tw(vm(r)+t)*864e5,t=0,r=0),n.milliseconds=e%1e3,s=Jr(e/1e3),n.seconds=s%60,o=Jr(s/60),n.minutes=o%60,i=Jr(o/60),n.hours=i%24,t+=Jr(i/24),c=Jr(rC(t)),r+=c,t-=tw(vm(c)),a=Jr(r/12),r%=12,n.days=t,n.months=r,n.years=a,this}function rC(e){return e*4800/146097}function vm(e){return e*146097/4800}function KF(e){if(!this.isValid())return NaN;var t,r,n=this._milliseconds;if(e=ln(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+n/864e5,r=this._months+rC(t),e){case"month":return r;case"quarter":return r/3;case"year":return r/12}else switch(t=this._days+Math.round(vm(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return t*24+n/36e5;case"minute":return t*1440+n/6e4;case"second":return t*86400+n/1e3;case"millisecond":return Math.floor(t*864e5)+n;default:throw new Error("Unknown unit "+e)}}function Ds(e){return function(){return this.as(e)}}var nC=Ds("ms"),GF=Ds("s"),qF=Ds("m"),XF=Ds("h"),QF=Ds("d"),JF=Ds("w"),e3=Ds("M"),t3=Ds("Q"),r3=Ds("y"),n3=nC;function s3(){return Rn(this)}function o3(e){return e=ln(e),this.isValid()?this[e+"s"]():NaN}function fi(e){return function(){return this.isValid()?this._data[e]:NaN}}var i3=fi("milliseconds"),a3=fi("seconds"),l3=fi("minutes"),c3=fi("hours"),u3=fi("days"),d3=fi("months"),f3=fi("years");function h3(){return Jr(this.days()/7)}var as=Math.round,Ui={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function p3(e,t,r,n,s){return s.relativeTime(t||1,!!r,e,n)}function m3(e,t,r,n){var s=Rn(e).abs(),o=as(s.as("s")),i=as(s.as("m")),a=as(s.as("h")),c=as(s.as("d")),u=as(s.as("M")),d=as(s.as("w")),f=as(s.as("y")),m=o<=r.ss&&["s",o]||o0,m[4]=n,p3.apply(null,m)}function g3(e){return e===void 0?as:typeof e=="function"?(as=e,!0):!1}function v3(e,t){return Ui[e]===void 0?!1:t===void 0?Ui[e]:(Ui[e]=t,e==="s"&&(Ui.ss=t-1),!0)}function y3(e,t){if(!this.isValid())return this.localeData().invalidDate();var r=!1,n=Ui,s,o;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(r=e),typeof t=="object"&&(n=Object.assign({},Ui,t),t.s!=null&&t.ss==null&&(n.ss=t.s-1)),s=this.localeData(),o=m3(this,!r,n,s),r&&(o=s.pastFuture(+this,o)),s.postformat(o)}var Qh=Math.abs;function Si(e){return(e>0)-(e<0)||+e}function $f(){if(!this.isValid())return this.localeData().invalidDate();var e=Qh(this._milliseconds)/1e3,t=Qh(this._days),r=Qh(this._months),n,s,o,i,a=this.asSeconds(),c,u,d,f;return a?(n=Jr(e/60),s=Jr(n/60),e%=60,n%=60,o=Jr(r/12),r%=12,i=e?e.toFixed(3).replace(/\.?0+$/,""):"",c=a<0?"-":"",u=Si(this._months)!==Si(a)?"-":"",d=Si(this._days)!==Si(a)?"-":"",f=Si(this._milliseconds)!==Si(a)?"-":"",c+"P"+(o?u+o+"Y":"")+(r?u+r+"M":"")+(t?d+t+"D":"")+(s||n||e?"T":"")+(s?f+s+"H":"")+(n?f+n+"M":"")+(e?f+i+"S":"")):"P0D"}var it=zf.prototype;it.isValid=d5;it.abs=BF;it.add=HF;it.subtract=YF;it.as=KF;it.asMilliseconds=nC;it.asSeconds=GF;it.asMinutes=qF;it.asHours=XF;it.asDays=QF;it.asWeeks=JF;it.asMonths=e3;it.asQuarters=t3;it.asYears=r3;it.valueOf=n3;it._bubble=ZF;it.clone=s3;it.get=o3;it.milliseconds=i3;it.seconds=a3;it.minutes=l3;it.hours=c3;it.days=u3;it.weeks=h3;it.months=d3;it.years=f3;it.humanize=y3;it.toISOString=$f;it.toString=$f;it.toJSON=$f;it.locale=Bk;it.localeData=Yk;it.toIsoString=an("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$f);it.lang=Hk;Ie("X",0,0,"unix");Ie("x",0,0,"valueOf");_e("x",Mf);_e("X",zL);vt("X",function(e,t,r){r._d=new Date(parseFloat(e)*1e3)});vt("x",function(e,t,r){r._d=new Date(rt(e))});//! moment.js -ve.version="2.30.1";xL(kt);ve.fn=le;ve.min=a5;ve.max=l5;ve.now=c5;ve.utc=Kn;ve.unix=LF;ve.months=zF;ve.isDate=Pc;ve.locale=co;ve.invalid=Pf;ve.duration=Rn;ve.isMoment=jn;ve.weekdays=$F;ve.parseZone=FF;ve.localeData=As;ve.isDuration=Bu;ve.monthsShort=UF;ve.weekdaysMin=WF;ve.defineLocale=Iv;ve.updateLocale=F4;ve.locales=z4;ve.weekdaysShort=VF;ve.normalizeUnits=ln;ve.relativeTimeRounding=g3;ve.relativeTimeThreshold=v3;ve.calendarFormat=O5;ve.prototype=le;ve.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const x3=async()=>await st().collection("access").getFullList({sort:"-created",filter:"deleted = null"}),jo=async e=>e.id?await st().collection("access").update(e.id,e):await st().collection("access").create(e),w3=async e=>(e.deleted=ve.utc().format("YYYY-MM-DD HH:mm:ss"),await st().collection("access").update(e.id,e)),rw=async()=>await st().collection("access_groups").getFullList({sort:"-created",expand:"access"}),_3=async e=>{const t=st();if((await t.collection("access").getList(1,1,{filter:`group='${e}' && deleted=null`})).items.length>0)throw new Error("该分组下有授权配置,无法删除");await t.collection("access_groups").delete(e)},b3=async e=>{const t=st();return e.id?await t.collection("access_groups").update(e.id,e):await t.collection("access_groups").create(e)},nw=async e=>await st().collection("access_groups").update(e.id,e),S3=(e,t)=>{switch(t.type){case"SET_ACCESSES":return{...e,accesses:t.payload};case"ADD_ACCESS":return{...e,accesses:[t.payload,...e.accesses]};case"DELETE_ACCESS":return{...e,accesses:e.accesses.filter(r=>r.id!==t.payload)};case"UPDATE_ACCESS":return{...e,accesses:e.accesses.map(r=>r.id===t.payload.id?t.payload:r)};case"SET_EMAILS":return{...e,emails:t.payload};case"ADD_EMAIL":return{...e,emails:{...e.emails,content:{emails:[...e.emails.content.emails,t.payload]}}};case"SET_ACCESS_GROUPS":return{...e,accessGroups:t.payload};default:return e}},k3=async()=>{try{return await st().collection("settings").getFirstListItem("name='emails'")}catch{return{content:{emails:[]}}}},sC=async e=>{try{return await st().collection("settings").getFirstListItem(`name='${e}'`)}catch{return{name:e}}},Mc=async e=>{const t=st();let r;return e.id?r=await t.collection("settings").update(e.id,e):r=await t.collection("settings").create(e),r},oC=v.createContext({}),Kr=()=>v.useContext(oC),C3=({children:e})=>{const[t,r]=v.useReducer(S3,{accesses:[],emails:{content:{emails:[]}},accessGroups:[]});v.useEffect(()=>{(async()=>{const d=await x3();r({type:"SET_ACCESSES",payload:d})})()},[]),v.useEffect(()=>{(async()=>{const d=await k3();r({type:"SET_EMAILS",payload:d})})()},[]),v.useEffect(()=>{(async()=>{const d=await rw();r({type:"SET_ACCESS_GROUPS",payload:d})})()},[]);const n=v.useCallback(async()=>{const u=await rw();r({type:"SET_ACCESS_GROUPS",payload:u})},[]),s=v.useCallback(u=>{r({type:"SET_EMAILS",payload:u})},[]),o=v.useCallback(u=>{r({type:"DELETE_ACCESS",payload:u})},[]),i=v.useCallback(u=>{r({type:"ADD_ACCESS",payload:u})},[]),a=v.useCallback(u=>{r({type:"UPDATE_ACCESS",payload:u})},[]),c=v.useCallback(u=>{r({type:"SET_ACCESS_GROUPS",payload:u})},[]);return l.jsx(oC.Provider,{value:{config:{accesses:t.accesses,emails:t.emails,accessGroups:t.accessGroups},deleteAccess:o,addAccess:i,setEmails:s,updateAccess:a,setAccessGroups:c,reloadAccessGroups:n},children:e&&e})},j3={theme:"system",setTheme:()=>null},iC=v.createContext(j3);function E3({children:e,defaultTheme:t="system",storageKey:r="vite-ui-theme",...n}){const[s,o]=v.useState(()=>localStorage.getItem(r)||t);v.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(c);return}a.classList.add(s)},[s]);const i={theme:s,setTheme:a=>{localStorage.setItem(r,a),o(a)}};return l.jsx(iC.Provider,{...n,value:i,children:e})}const N3=()=>{const e=v.useContext(iC);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};function T3(){const{setTheme:e}=N3();return l.jsxs($S,{children:[l.jsx(VS,{asChild:!0,children:l.jsxs(He,{variant:"outline",size:"icon",children:[l.jsx(xA,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),l.jsx(vA,{className:"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100 dark:text-white"}),l.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),l.jsxs(uv,{align:"end",children:[l.jsx(Qi,{onClick:()=>e("light"),children:"浅色"}),l.jsx(Qi,{onClick:()=>e("dark"),children:"暗黑"}),l.jsx(Qi,{onClick:()=>e("system"),children:"系统"})]})]})}var R3="Separator",sw="horizontal",P3=["horizontal","vertical"],aC=v.forwardRef((e,t)=>{const{decorative:r,orientation:n=sw,...s}=e,o=A3(n)?n:sw,a=r?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return l.jsx(Re.div,{"data-orientation":o,...a,...s,ref:t})});aC.displayName=R3;function A3(e){return P3.includes(e)}var lC=aC;const Wt=v.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},s)=>l.jsx(lC,{ref:s,decorative:r,orientation:t,className:ae("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Wt.displayName=lC.displayName;const D3="Certimate v0.1.11",cC=()=>l.jsxs("div",{className:"fixed right-0 bottom-0 w-full flex justify-between p-5",children:[l.jsx("div",{className:""}),l.jsxs("div",{className:"text-muted-foreground text-sm hover:text-stone-900 dark:hover:text-stone-200 flex",children:[l.jsxs("a",{href:"https://docs.certimate.me",target:"_blank",className:"flex items-center",children:[l.jsx(sA,{size:16}),l.jsx("div",{className:"ml-1",children:"文档"})]}),l.jsx(Wt,{orientation:"vertical",className:"mx-2"}),l.jsx("a",{href:"https://github.com/usual2970/certimate/releases",target:"_blank",children:D3})]})]});function O3(){const e=Nr(),t=Nn();if(!st().authStore.isValid||!st().authStore.isAdmin)return l.jsx(Q1,{to:"/login"});const r=t.pathname,n=i=>(console.log(r),i==r?"bg-muted text-primary":"text-muted-foreground"),s=()=>{st().authStore.clear(),e("/login")},o=()=>{e("/setting/account")};return l.jsx(l.Fragment,{children:l.jsx(C3,{children:l.jsxs("div",{className:"grid min-h-screen w-full md:grid-cols-[180px_1fr] lg:grid-cols-[200px_1fr] 2xl:md:grid-cols-[280px_1fr] ",children:[l.jsx("div",{className:"hidden border-r dark:border-stone-500 bg-muted/40 md:block",children:l.jsxs("div",{className:"flex h-full max-h-screen flex-col gap-2",children:[l.jsx("div",{className:"flex h-14 items-center border-b dark:border-stone-500 px-4 lg:h-[60px] lg:px-6",children:l.jsxs(fr,{to:"/",className:"flex items-center gap-2 font-semibold",children:[l.jsx("img",{src:"/vite.svg",className:"w-[36px] h-[36px]"}),l.jsx("span",{className:"dark:text-white",children:"Certimate"})]})}),l.jsx("div",{className:"flex-1",children:l.jsxs("nav",{className:"grid items-start px-2 text-sm font-medium lg:px-4",children:[l.jsxs(fr,{to:"/",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/")),children:[l.jsx(x0,{className:"h-4 w-4"}),"控制面板"]}),l.jsxs(fr,{to:"/domains",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/domains")),children:[l.jsx(rm,{className:"h-4 w-4"}),"域名列表"]}),l.jsxs(fr,{to:"/access",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/access")),children:[l.jsx(w0,{className:"h-4 w-4"}),"授权管理"]}),l.jsxs(fr,{to:"/history",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/history")),children:[l.jsx(y0,{className:"h-4 w-4"}),"部署历史"]})]})})]})}),l.jsxs("div",{className:"flex flex-col",children:[l.jsxs("header",{className:"flex h-14 items-center gap-4 border-b dark:border-stone-500 bg-muted/40 px-4 lg:h-[60px] lg:px-6",children:[l.jsxs(yv,{children:[l.jsx(xv,{asChild:!0,children:l.jsxs(He,{variant:"outline",size:"icon",className:"shrink-0 md:hidden",children:[l.jsx(gA,{className:"h-5 w-5 dark:text-white"}),l.jsx("span",{className:"sr-only",children:"Toggle navigation menu"})]})}),l.jsx(Rf,{side:"left",className:"flex flex-col",children:l.jsxs("nav",{className:"grid gap-2 text-lg font-medium",children:[l.jsxs(fr,{to:"/",className:"flex items-center gap-2 text-lg font-semibold",children:[l.jsx("img",{src:"/vite.svg",className:"w-[36px] h-[36px]"}),l.jsx("span",{className:"dark:text-white",children:"Certimate"}),l.jsx("span",{className:"sr-only",children:"Certimate"})]}),l.jsxs(fr,{to:"/",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/")),children:[l.jsx(x0,{className:"h-5 w-5"}),"控制面板"]}),l.jsxs(fr,{to:"/domains",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/domains")),children:[l.jsx(rm,{className:"h-5 w-5"}),"域名列表"]}),l.jsxs(fr,{to:"/access",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/access")),children:[l.jsx(w0,{className:"h-5 w-5"}),"授权管理"]}),l.jsxs(fr,{to:"/history",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/history")),children:[l.jsx(y0,{className:"h-5 w-5"}),"部署历史"]})]})})]}),l.jsx("div",{className:"w-full flex-1"}),l.jsx(T3,{}),l.jsxs($S,{children:[l.jsx(VS,{asChild:!0,children:l.jsxs(He,{variant:"secondary",size:"icon",className:"rounded-full",children:[l.jsx(cA,{className:"h-5 w-5"}),l.jsx("span",{className:"sr-only",children:"Toggle user menu"})]})}),l.jsxs(uv,{align:"end",children:[l.jsx(WS,{children:"账户"}),l.jsx(BS,{}),l.jsx(Qi,{onClick:o,children:"偏好设置"}),l.jsx(Qi,{onClick:s,children:"退出"})]})]})]}),l.jsxs("main",{className:"flex flex-1 flex-col gap-4 p-4 lg:gap-6 lg:p-6 relative",children:[l.jsx(Ig,{}),l.jsx(cC,{})]})]})]})})})}const Hv=({phase:e,phaseSuccess:t})=>{let r=l.jsx(l.Fragment,{children:" "});return e==="check"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]})),e==="apply"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]})),e==="deploy"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"部署"})]})),r};var M3="VisuallyHidden",Ic=v.forwardRef((e,t)=>l.jsx(Re.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));Ic.displayName=M3;var I3=Ic,[Vf,_$]=xr("Tooltip",[Pa]),Wf=Pa(),uC="TooltipProvider",L3=700,ym="tooltip.open",[F3,Yv]=Vf(uC),Zv=e=>{const{__scopeTooltip:t,delayDuration:r=L3,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:o}=e,[i,a]=v.useState(!0),c=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),l.jsx(F3,{scope:t,isOpenDelayed:i,delayDuration:r,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(d=>{c.current=d},[]),disableHoverableContent:s,children:o})};Zv.displayName=uC;var Bf="Tooltip",[z3,Hf]=Vf(Bf),dC=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:s=!1,onOpenChange:o,disableHoverableContent:i,delayDuration:a}=e,c=Yv(Bf,e.__scopeTooltip),u=Wf(t),[d,f]=v.useState(null),m=Ur(),y=v.useRef(0),x=i??c.disableHoverableContent,g=a??c.delayDuration,_=v.useRef(!1),[p=!1,h]=on({prop:n,defaultProp:s,onChange:R=>{R?(c.onOpen(),document.dispatchEvent(new CustomEvent(ym))):c.onClose(),o==null||o(R)}}),w=v.useMemo(()=>p?_.current?"delayed-open":"instant-open":"closed",[p]),C=v.useCallback(()=>{window.clearTimeout(y.current),_.current=!1,h(!0)},[h]),j=v.useCallback(()=>{window.clearTimeout(y.current),h(!1)},[h]),E=v.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{_.current=!0,h(!0)},g)},[g,h]);return v.useEffect(()=>()=>window.clearTimeout(y.current),[]),l.jsx(Xg,{...u,children:l.jsx(z3,{scope:t,contentId:m,open:p,stateAttribute:w,trigger:d,onTriggerChange:f,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayed?E():C()},[c.isOpenDelayed,E,C]),onTriggerLeave:v.useCallback(()=>{x?j():window.clearTimeout(y.current)},[j,x]),onOpen:C,onClose:j,disableHoverableContent:x,children:r})})};dC.displayName=Bf;var xm="TooltipTrigger",fC=v.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Hf(xm,r),o=Yv(xm,r),i=Wf(r),a=v.useRef(null),c=Ke(t,a,s.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),f=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l.jsx(Qg,{asChild:!0,...i,children:l.jsx(Re.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:ce(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:ce(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:ce(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ce(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:ce(e.onBlur,s.onClose),onClick:ce(e.onClick,s.onClose)})})});fC.displayName=xm;var U3="TooltipPortal",[b$,$3]=Vf(U3,{forceMount:void 0}),ma="TooltipContent",Kv=v.forwardRef((e,t)=>{const r=$3(ma,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...o}=e,i=Hf(ma,e.__scopeTooltip);return l.jsx(ur,{present:n||i.open,children:i.disableHoverableContent?l.jsx(hC,{side:s,...o,ref:t}):l.jsx(V3,{side:s,...o,ref:t})})}),V3=v.forwardRef((e,t)=>{const r=Hf(ma,e.__scopeTooltip),n=Yv(ma,e.__scopeTooltip),s=v.useRef(null),o=Ke(t,s),[i,a]=v.useState(null),{trigger:c,onClose:u}=r,d=s.current,{onPointerInTransitChange:f}=n,m=v.useCallback(()=>{a(null),f(!1)},[f]),y=v.useCallback((x,g)=>{const _=x.currentTarget,p={x:x.clientX,y:x.clientY},h=Y3(p,_.getBoundingClientRect()),w=Z3(p,h),C=K3(g.getBoundingClientRect()),j=q3([...w,...C]);a(j),f(!0)},[f]);return v.useEffect(()=>()=>m(),[m]),v.useEffect(()=>{if(c&&d){const x=_=>y(_,d),g=_=>y(_,c);return c.addEventListener("pointerleave",x),d.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",x),d.removeEventListener("pointerleave",g)}}},[c,d,y,m]),v.useEffect(()=>{if(i){const x=g=>{const _=g.target,p={x:g.clientX,y:g.clientY},h=(c==null?void 0:c.contains(_))||(d==null?void 0:d.contains(_)),w=!G3(p,i);h?m():w&&(m(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,d,i,u,m]),l.jsx(hC,{...e,ref:o})}),[W3,B3]=Vf(Bf,{isInside:!1}),hC=v.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...a}=e,c=Hf(ma,r),u=Wf(r),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(ym,d),()=>document.removeEventListener(ym,d)),[d]),v.useEffect(()=>{if(c.trigger){const f=m=>{const y=m.target;y!=null&&y.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:l.jsxs(Jg,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[l.jsx(zg,{children:n}),l.jsx(W3,{scope:r,isInside:!0,children:l.jsx(I3,{id:c.contentId,role:"tooltip",children:s||n})})]})})});Kv.displayName=ma;var pC="TooltipArrow",H3=v.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Wf(r);return B3(pC,r).isInside?null:l.jsx(ev,{...s,...n,ref:t})});H3.displayName=pC;function Y3(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,s,o)){case o:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function Z3(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function K3(e){const{top:t,right:r,bottom:n,left:s}=e;return[{x:s,y:t},{x:r,y:t},{x:r,y:n},{x:s,y:n}]}function G3(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;on!=d>n&&r<(u-a)*(n-c)/(d-c)+a&&(s=!s)}return s}function q3(e){const t=e.slice();return t.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),X3(t)}function X3(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const s=e[n];for(;r.length>=2;){const o=r[r.length-1],i=r[r.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))r.pop();else break}r.push(s)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var Q3=Zv,J3=dC,e6=fC,mC=Kv;const t6=Q3,gC=J3,vC=e6,yC=v.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(mC,{ref:n,sideOffset:t,className:ae("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));yC.displayName=mC.displayName;const Gv=({deployment:e})=>{const t=r=>e.log[r]?e.log[r][e.log[r].length-1].error:"";return l.jsx(l.Fragment,{children:e.phase==="deploy"&&e.phaseSuccess||e.wholeSuccess?l.jsx(lA,{size:16,className:"text-green-700"}):l.jsx(l.Fragment,{children:t(e.phase).length?l.jsx(t6,{children:l.jsxs(gC,{children:[l.jsx(vC,{asChild:!0,className:"cursor-pointer",children:l.jsx(g0,{size:16,className:"text-red-700"})}),l.jsx(yC,{className:"max-w-[35em]",children:t(e.phase)})]})}):l.jsx(g0,{size:16,className:"text-red-700"})})})},xC=({className:e,...t})=>l.jsx("nav",{role:"navigation","aria-label":"pagination",className:ae("mx-auto flex w-full justify-center",e),...t});xC.displayName="Pagination";const wC=v.forwardRef(({className:e,...t},r)=>l.jsx("ul",{ref:r,className:ae("flex flex-row items-center gap-1",e),...t}));wC.displayName="PaginationContent";const wm=v.forwardRef(({className:e,...t},r)=>l.jsx("li",{ref:r,className:ae("",e),...t}));wm.displayName="PaginationItem";const _C=({className:e,isActive:t,size:r="icon",...n})=>l.jsx("a",{"aria-current":t?"page":void 0,className:ae(xf({variant:t?"outline":"ghost",size:r}),e),...n});_C.displayName="PaginationLink";const bC=({className:e,...t})=>l.jsxs("span",{"aria-hidden":!0,className:ae("flex h-9 w-9 items-center justify-center",e),...t,children:[l.jsx(dA,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"More pages"})]});bC.displayName="PaginationEllipsis";const SC=({totalPages:e,currentPage:t,onPageChange:r})=>{const s=()=>{if(e>7){let u=[];const d=Math.max(2,t-1),f=Math.min(e-1,t+1),m=e-1;return u=o(d,f),t>3&&u.unshift("..."),t{let d=a;const f=[];for(;d<=c;)f.push(d),d+=u;return f},i=s();return l.jsx(l.Fragment,{children:l.jsx(xC,{className:"dark:text-stone-200 justify-end mt-3",children:l.jsx(wC,{children:i.map((a,c)=>a==="..."?l.jsx(wm,{children:l.jsx(bC,{})},c):l.jsx(wm,{children:l.jsx(_C,{href:"#",isActive:t==a,onClick:u=>{u.preventDefault(),r(a)},children:a})},c))})})})},na=({when:e,children:t,fallback:r})=>e?t:r;var kC="AlertDialog",[r6,S$]=xr(kC,[YS]),Os=YS(),CC=e=>{const{__scopeAlertDialog:t,...r}=e,n=Os(t);return l.jsx(mv,{...n,...r,modal:!0})};CC.displayName=kC;var n6="AlertDialogTrigger",jC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(gv,{...s,...n,ref:t})});jC.displayName=n6;var s6="AlertDialogPortal",EC=e=>{const{__scopeAlertDialog:t,...r}=e,n=Os(t);return l.jsx(vv,{...n,...r})};EC.displayName=s6;var o6="AlertDialogOverlay",NC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Ec,{...s,...n,ref:t})});NC.displayName=o6;var sa="AlertDialogContent",[i6,a6]=r6(sa),TC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...s}=e,o=Os(r),i=v.useRef(null),a=Ke(t,i),c=v.useRef(null);return l.jsx(GI,{contentName:sa,titleName:RC,docsSlug:"alert-dialog",children:l.jsx(i6,{scope:r,cancelRef:c,children:l.jsxs(Nc,{role:"alertdialog",...o,...s,ref:a,onOpenAutoFocus:ce(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[l.jsx(zg,{children:n}),l.jsx(c6,{contentRef:i})]})})})});TC.displayName=sa;var RC="AlertDialogTitle",PC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Tc,{...s,...n,ref:t})});PC.displayName=RC;var AC="AlertDialogDescription",DC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Rc,{...s,...n,ref:t})});DC.displayName=AC;var l6="AlertDialogAction",OC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Tf,{...s,...n,ref:t})});OC.displayName=l6;var MC="AlertDialogCancel",IC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:s}=a6(MC,r),o=Os(r),i=Ke(t,s);return l.jsx(Tf,{...o,...n,ref:i})});IC.displayName=MC;var c6=({contentRef:e})=>{const t=`\`${sa}\` requires a description for the component to be accessible for screen reader users. +`+new Error().stack),r=!1}return t.apply(this,arguments)},t)}var X0={};function gk(e,t){ve.deprecationHandler!=null&&ve.deprecationHandler(e,t),X0[e]||(mk(t),X0[e]=!0)}ve.suppressDeprecationWarnings=!1;ve.deprecationHandler=null;function Gn(e){return typeof Function<"u"&&e instanceof Function||Object.prototype.toString.call(e)==="[object Function]"}function bL(e){var t,r;for(r in e)ct(e,r)&&(t=e[r],Gn(t)?this[r]=t:this["_"+r]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function fm(e,t){var r=Qs({},e),n;for(n in t)ct(t,n)&&(Zo(e[n])&&Zo(t[n])?(r[n]={},Qs(r[n],e[n]),Qs(r[n],t[n])):t[n]!=null?r[n]=t[n]:delete r[n]);for(n in e)ct(e,n)&&!ct(t,n)&&Zo(e[n])&&(r[n]=Qs({},r[n]));return r}function jv(e){e!=null&&this.set(e)}var hm;Object.keys?hm=Object.keys:hm=function(e){var t,r=[];for(t in e)ct(e,t)&&r.push(t);return r};var SL={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function kL(e,t,r){var n=this._calendar[e]||this._calendar.sameElse;return Gn(n)?n.call(t,r):n}function Hn(e,t,r){var n=""+Math.abs(e),s=t-n.length,o=e>=0;return(o?r?"+":"":"-")+Math.pow(10,Math.max(0,s)).toString().substr(1)+n}var Ev=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,_u=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,qh={},ea={};function Ie(e,t,r,n){var s=n;typeof n=="string"&&(s=function(){return this[n]()}),e&&(ea[e]=s),t&&(ea[t[0]]=function(){return Hn(s.apply(this,arguments),t[1],t[2])}),r&&(ea[r]=function(){return this.localeData().ordinal(s.apply(this,arguments),e)})}function CL(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function jL(e){var t=e.match(Ev),r,n;for(r=0,n=t.length;r=0&&_u.test(e);)e=e.replace(_u,n),_u.lastIndex=0,r-=1;return e}var EL={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function NL(e){var t=this._longDateFormat[e],r=this._longDateFormat[e.toUpperCase()];return t||!r?t:(this._longDateFormat[e]=r.match(Ev).map(function(n){return n==="MMMM"||n==="MM"||n==="DD"||n==="dddd"?n.slice(1):n}).join(""),this._longDateFormat[e])}var TL="Invalid date";function RL(){return this._invalidDate}var PL="%d",AL=/\d{1,2}/;function DL(e){return this._ordinal.replace("%d",e)}var OL={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function ML(e,t,r,n){var s=this._relativeTime[r];return Gn(s)?s(e,t,r,n):s.replace(/%d/i,e)}function IL(e,t){var r=this._relativeTime[e>0?"future":"past"];return Gn(r)?r(t):r.replace(/%s/i,t)}var Q0={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ln(e){return typeof e=="string"?Q0[e]||Q0[e.toLowerCase()]:void 0}function Nv(e){var t={},r,n;for(n in e)ct(e,n)&&(r=ln(n),r&&(t[r]=e[n]));return t}var LL={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function FL(e){var t=[],r;for(r in e)ct(e,r)&&t.push({unit:r,priority:LL[r]});return t.sort(function(n,s){return n.priority-s.priority}),t}var yk=/\d/,Zr=/\d\d/,xk=/\d{3}/,Tv=/\d{4}/,Af=/[+-]?\d{6}/,Ct=/\d\d?/,wk=/\d\d\d\d?/,_k=/\d\d\d\d\d\d?/,Df=/\d{1,3}/,Rv=/\d{1,4}/,Of=/[+-]?\d{1,6}/,Aa=/\d+/,Mf=/[+-]?\d+/,zL=/Z|[+-]\d\d:?\d\d/gi,If=/Z|[+-]\d\d(?::?\d\d)?/gi,UL=/[+-]?\d+(\.\d{1,3})?/,Dc=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Da=/^[1-9]\d?/,Pv=/^([1-9]\d|\d)/,Td;Td={};function _e(e,t,r){Td[e]=Gn(t)?t:function(n,s){return n&&r?r:t}}function $L(e,t){return ct(Td,e)?Td[e](t._strict,t._locale):new RegExp(VL(e))}function VL(e){return gs(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,r,n,s,o){return r||n||s||o}))}function gs(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Jr(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function rt(e){var t=+e,r=0;return t!==0&&isFinite(t)&&(r=Jr(t)),r}var pm={};function vt(e,t){var r,n=t,s;for(typeof e=="string"&&(e=[e]),Cs(t)&&(n=function(o,i){i[t]=rt(o)}),s=e.length,r=0;r68?1900:2e3)};var bk=Oa("FullYear",!0);function YL(){return Lf(this.year())}function Oa(e,t){return function(r){return r!=null?(Sk(this,e,r),ve.updateOffset(this,t),this):Xl(this,e)}}function Xl(e,t){if(!e.isValid())return NaN;var r=e._d,n=e._isUTC;switch(t){case"Milliseconds":return n?r.getUTCMilliseconds():r.getMilliseconds();case"Seconds":return n?r.getUTCSeconds():r.getSeconds();case"Minutes":return n?r.getUTCMinutes():r.getMinutes();case"Hours":return n?r.getUTCHours():r.getHours();case"Date":return n?r.getUTCDate():r.getDate();case"Day":return n?r.getUTCDay():r.getDay();case"Month":return n?r.getUTCMonth():r.getMonth();case"FullYear":return n?r.getUTCFullYear():r.getFullYear();default:return NaN}}function Sk(e,t,r){var n,s,o,i,a;if(!(!e.isValid()||isNaN(r))){switch(n=e._d,s=e._isUTC,t){case"Milliseconds":return void(s?n.setUTCMilliseconds(r):n.setMilliseconds(r));case"Seconds":return void(s?n.setUTCSeconds(r):n.setSeconds(r));case"Minutes":return void(s?n.setUTCMinutes(r):n.setMinutes(r));case"Hours":return void(s?n.setUTCHours(r):n.setHours(r));case"Date":return void(s?n.setUTCDate(r):n.setDate(r));case"FullYear":break;default:return}o=r,i=e.month(),a=e.date(),a=a===29&&i===1&&!Lf(o)?28:a,s?n.setUTCFullYear(o,i,a):n.setFullYear(o,i,a)}}function ZL(e){return e=ln(e),Gn(this[e])?this[e]():this}function KL(e,t){if(typeof e=="object"){e=Nv(e);var r=FL(e),n,s=r.length;for(n=0;n=0?(a=new Date(e+400,t,r,n,s,o,i),isFinite(a.getFullYear())&&a.setFullYear(e)):a=new Date(e,t,r,n,s,o,i),a}function Ql(e){var t,r;return e<100&&e>=0?(r=Array.prototype.slice.call(arguments),r[0]=e+400,t=new Date(Date.UTC.apply(null,r)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Rd(e,t,r){var n=7+t-r,s=(7+Ql(e,0,n).getUTCDay()-t)%7;return-s+n-1}function Tk(e,t,r,n,s){var o=(7+r-n)%7,i=Rd(e,n,s),a=1+7*(t-1)+o+i,c,u;return a<=0?(c=e-1,u=bl(c)+a):a>bl(e)?(c=e+1,u=a-bl(e)):(c=e,u=a),{year:c,dayOfYear:u}}function Jl(e,t,r){var n=Rd(e.year(),t,r),s=Math.floor((e.dayOfYear()-n-1)/7)+1,o,i;return s<1?(i=e.year()-1,o=s+vs(i,t,r)):s>vs(e.year(),t,r)?(o=s-vs(e.year(),t,r),i=e.year()+1):(i=e.year(),o=s),{week:o,year:i}}function vs(e,t,r){var n=Rd(e,t,r),s=Rd(e+1,t,r);return(bl(e)-n+s)/7}Ie("w",["ww",2],"wo","week");Ie("W",["WW",2],"Wo","isoWeek");_e("w",Ct,Da);_e("ww",Ct,Zr);_e("W",Ct,Da);_e("WW",Ct,Zr);Oc(["w","ww","W","WW"],function(e,t,r,n){t[n.substr(0,1)]=rt(e)});function a4(e){return Jl(e,this._week.dow,this._week.doy).week}var l4={dow:0,doy:6};function c4(){return this._week.dow}function u4(){return this._week.doy}function d4(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function f4(e){var t=Jl(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}Ie("d",0,"do","day");Ie("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)});Ie("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)});Ie("dddd",0,0,function(e){return this.localeData().weekdays(this,e)});Ie("e",0,0,"weekday");Ie("E",0,0,"isoWeekday");_e("d",Ct);_e("e",Ct);_e("E",Ct);_e("dd",function(e,t){return t.weekdaysMinRegex(e)});_e("ddd",function(e,t){return t.weekdaysShortRegex(e)});_e("dddd",function(e,t){return t.weekdaysRegex(e)});Oc(["dd","ddd","dddd"],function(e,t,r,n){var s=r._locale.weekdaysParse(e,n,r._strict);s!=null?t.d=s:Xe(r).invalidWeekday=e});Oc(["d","e","E"],function(e,t,r,n){t[n]=rt(e)});function h4(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function p4(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Dv(e,t){return e.slice(t,7).concat(e.slice(0,t))}var m4="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Rk="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),g4="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),v4=Dc,y4=Dc,x4=Dc;function w4(e,t){var r=Cn(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?Dv(r,this._week.dow):e?r[e.day()]:r}function _4(e){return e===!0?Dv(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function b4(e){return e===!0?Dv(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function S4(e,t,r){var n,s,o,i=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)o=Kn([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(o,"").toLocaleLowerCase();return r?t==="dddd"?(s=zt.call(this._weekdaysParse,i),s!==-1?s:null):t==="ddd"?(s=zt.call(this._shortWeekdaysParse,i),s!==-1?s:null):(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null):t==="dddd"?(s=zt.call(this._weekdaysParse,i),s!==-1||(s=zt.call(this._shortWeekdaysParse,i),s!==-1)?s:(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null)):t==="ddd"?(s=zt.call(this._shortWeekdaysParse,i),s!==-1||(s=zt.call(this._weekdaysParse,i),s!==-1)?s:(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null)):(s=zt.call(this._minWeekdaysParse,i),s!==-1||(s=zt.call(this._weekdaysParse,i),s!==-1)?s:(s=zt.call(this._shortWeekdaysParse,i),s!==-1?s:null))}function k4(e,t,r){var n,s,o;if(this._weekdaysParseExact)return S4.call(this,e,t,r);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(s=Kn([2e3,1]).day(n),r&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(s,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(s,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(s,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(o="^"+this.weekdays(s,"")+"|^"+this.weekdaysShort(s,"")+"|^"+this.weekdaysMin(s,""),this._weekdaysParse[n]=new RegExp(o.replace(".",""),"i")),r&&t==="dddd"&&this._fullWeekdaysParse[n].test(e))return n;if(r&&t==="ddd"&&this._shortWeekdaysParse[n].test(e))return n;if(r&&t==="dd"&&this._minWeekdaysParse[n].test(e))return n;if(!r&&this._weekdaysParse[n].test(e))return n}}function C4(e){if(!this.isValid())return e!=null?this:NaN;var t=Xl(this,"Day");return e!=null?(e=h4(e,this.localeData()),this.add(e-t,"d")):t}function j4(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function E4(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=p4(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function N4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(ct(this,"_weekdaysRegex")||(this._weekdaysRegex=v4),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function T4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(ct(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=y4),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function R4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(ct(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=x4),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ov(){function e(d,f){return f.length-d.length}var t=[],r=[],n=[],s=[],o,i,a,c,u;for(o=0;o<7;o++)i=Kn([2e3,1]).day(o),a=gs(this.weekdaysMin(i,"")),c=gs(this.weekdaysShort(i,"")),u=gs(this.weekdays(i,"")),t.push(a),r.push(c),n.push(u),s.push(a),s.push(c),s.push(u);t.sort(e),r.sort(e),n.sort(e),s.sort(e),this._weekdaysRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function Mv(){return this.hours()%12||12}function P4(){return this.hours()||24}Ie("H",["HH",2],0,"hour");Ie("h",["hh",2],0,Mv);Ie("k",["kk",2],0,P4);Ie("hmm",0,0,function(){return""+Mv.apply(this)+Hn(this.minutes(),2)});Ie("hmmss",0,0,function(){return""+Mv.apply(this)+Hn(this.minutes(),2)+Hn(this.seconds(),2)});Ie("Hmm",0,0,function(){return""+this.hours()+Hn(this.minutes(),2)});Ie("Hmmss",0,0,function(){return""+this.hours()+Hn(this.minutes(),2)+Hn(this.seconds(),2)});function Pk(e,t){Ie(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}Pk("a",!0);Pk("A",!1);function Ak(e,t){return t._meridiemParse}_e("a",Ak);_e("A",Ak);_e("H",Ct,Pv);_e("h",Ct,Da);_e("k",Ct,Da);_e("HH",Ct,Zr);_e("hh",Ct,Zr);_e("kk",Ct,Zr);_e("hmm",wk);_e("hmmss",_k);_e("Hmm",wk);_e("Hmmss",_k);vt(["H","HH"],Gt);vt(["k","kk"],function(e,t,r){var n=rt(e);t[Gt]=n===24?0:n});vt(["a","A"],function(e,t,r){r._isPm=r._locale.isPM(e),r._meridiem=e});vt(["h","hh"],function(e,t,r){t[Gt]=rt(e),Xe(r).bigHour=!0});vt("hmm",function(e,t,r){var n=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n)),Xe(r).bigHour=!0});vt("hmmss",function(e,t,r){var n=e.length-4,s=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n,2)),t[hs]=rt(e.substr(s)),Xe(r).bigHour=!0});vt("Hmm",function(e,t,r){var n=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n))});vt("Hmmss",function(e,t,r){var n=e.length-4,s=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n,2)),t[hs]=rt(e.substr(s))});function A4(e){return(e+"").toLowerCase().charAt(0)==="p"}var D4=/[ap]\.?m?\.?/i,O4=Oa("Hours",!0);function M4(e,t,r){return e>11?r?"pm":"PM":r?"am":"AM"}var Dk={calendar:SL,longDateFormat:EL,invalidDate:TL,ordinal:PL,dayOfMonthOrdinalParse:AL,relativeTime:OL,months:qL,monthsShort:kk,week:l4,weekdays:m4,weekdaysMin:g4,weekdaysShort:Rk,meridiemParse:D4},Nt={},Xa={},ec;function I4(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r0;){if(s=Ff(o.slice(0,r).join("-")),s)return s;if(n&&n.length>=r&&I4(o,n)>=r-1)break;r--}t++}return ec}function F4(e){return!!(e&&e.match("^[^/\\\\]*$"))}function Ff(e){var t=null,r;if(Nt[e]===void 0&&typeof Gu<"u"&&Gu&&Gu.exports&&F4(e))try{t=ec._abbr,r=require,r("./locale/"+e),co(t)}catch{Nt[e]=null}return Nt[e]}function co(e,t){var r;return e&&(_r(t)?r=As(e):r=Iv(e,t),r?ec=r:typeof console<"u"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),ec._abbr}function Iv(e,t){if(t!==null){var r,n=Dk;if(t.abbr=e,Nt[e]!=null)gk("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=Nt[e]._config;else if(t.parentLocale!=null)if(Nt[t.parentLocale]!=null)n=Nt[t.parentLocale]._config;else if(r=Ff(t.parentLocale),r!=null)n=r._config;else return Xa[t.parentLocale]||(Xa[t.parentLocale]=[]),Xa[t.parentLocale].push({name:e,config:t}),null;return Nt[e]=new jv(fm(n,t)),Xa[e]&&Xa[e].forEach(function(s){Iv(s.name,s.config)}),co(e),Nt[e]}else return delete Nt[e],null}function z4(e,t){if(t!=null){var r,n,s=Dk;Nt[e]!=null&&Nt[e].parentLocale!=null?Nt[e].set(fm(Nt[e]._config,t)):(n=Ff(e),n!=null&&(s=n._config),t=fm(s,t),n==null&&(t.abbr=e),r=new jv(t),r.parentLocale=Nt[e],Nt[e]=r),co(e)}else Nt[e]!=null&&(Nt[e].parentLocale!=null?(Nt[e]=Nt[e].parentLocale,e===co()&&co(e)):Nt[e]!=null&&delete Nt[e]);return Nt[e]}function As(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return ec;if(!Cn(e)){if(t=Ff(e),t)return t;e=[e]}return L4(e)}function U4(){return hm(Nt)}function Lv(e){var t,r=e._a;return r&&Xe(e).overflow===-2&&(t=r[fs]<0||r[fs]>11?fs:r[Ln]<1||r[Ln]>Av(r[ar],r[fs])?Ln:r[Gt]<0||r[Gt]>24||r[Gt]===24&&(r[vn]!==0||r[hs]!==0||r[Wo]!==0)?Gt:r[vn]<0||r[vn]>59?vn:r[hs]<0||r[hs]>59?hs:r[Wo]<0||r[Wo]>999?Wo:-1,Xe(e)._overflowDayOfYear&&(tLn)&&(t=Ln),Xe(e)._overflowWeeks&&t===-1&&(t=BL),Xe(e)._overflowWeekday&&t===-1&&(t=HL),Xe(e).overflow=t),e}var $4=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,V4=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,W4=/Z|[+-]\d\d(?::?\d\d)?/,bu=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Xh=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],B4=/^\/?Date\((-?\d+)/i,H4=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Y4={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Ok(e){var t,r,n=e._i,s=$4.exec(n)||V4.exec(n),o,i,a,c,u=bu.length,d=Xh.length;if(s){for(Xe(e).iso=!0,t=0,r=u;tbl(i)||e._dayOfYear===0)&&(Xe(e)._overflowDayOfYear=!0),r=Ql(i,0,e._dayOfYear),e._a[fs]=r.getUTCMonth(),e._a[Ln]=r.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=n[t]=s[t];for(;t<7;t++)e._a[t]=n[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[Gt]===24&&e._a[vn]===0&&e._a[hs]===0&&e._a[Wo]===0&&(e._nextDay=!0,e._a[Gt]=0),e._d=(e._useUTC?Ql:i4).apply(null,n),o=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Gt]=24),e._w&&typeof e._w.d<"u"&&e._w.d!==o&&(Xe(e).weekdayMismatch=!0)}}function e5(e){var t,r,n,s,o,i,a,c,u;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(o=1,i=4,r=Ci(t.GG,e._a[ar],Jl(kt(),1,4).year),n=Ci(t.W,1),s=Ci(t.E,1),(s<1||s>7)&&(c=!0)):(o=e._locale._week.dow,i=e._locale._week.doy,u=Jl(kt(),o,i),r=Ci(t.gg,e._a[ar],u.year),n=Ci(t.w,u.week),t.d!=null?(s=t.d,(s<0||s>6)&&(c=!0)):t.e!=null?(s=t.e+o,(t.e<0||t.e>6)&&(c=!0)):s=o),n<1||n>vs(r,o,i)?Xe(e)._overflowWeeks=!0:c!=null?Xe(e)._overflowWeekday=!0:(a=Tk(r,n,s,o,i),e._a[ar]=a.year,e._dayOfYear=a.dayOfYear)}ve.ISO_8601=function(){};ve.RFC_2822=function(){};function zv(e){if(e._f===ve.ISO_8601){Ok(e);return}if(e._f===ve.RFC_2822){Mk(e);return}e._a=[],Xe(e).empty=!0;var t=""+e._i,r,n,s,o,i,a=t.length,c=0,u,d;for(s=vk(e._f,e._locale).match(Ev)||[],d=s.length,r=0;r0&&Xe(e).unusedInput.push(i),t=t.slice(t.indexOf(n)+n.length),c+=n.length),ea[o]?(n?Xe(e).empty=!1:Xe(e).unusedTokens.push(o),WL(o,n,e)):e._strict&&!n&&Xe(e).unusedTokens.push(o);Xe(e).charsLeftOver=a-c,t.length>0&&Xe(e).unusedInput.push(t),e._a[Gt]<=12&&Xe(e).bigHour===!0&&e._a[Gt]>0&&(Xe(e).bigHour=void 0),Xe(e).parsedDateParts=e._a.slice(0),Xe(e).meridiem=e._meridiem,e._a[Gt]=t5(e._locale,e._a[Gt],e._meridiem),u=Xe(e).era,u!==null&&(e._a[ar]=e._locale.erasConvertYear(u,e._a[ar])),Fv(e),Lv(e)}function t5(e,t,r){var n;return r==null?t:e.meridiemHour!=null?e.meridiemHour(t,r):(e.isPM!=null&&(n=e.isPM(r),n&&t<12&&(t+=12),!n&&t===12&&(t=0)),t)}function r5(e){var t,r,n,s,o,i,a=!1,c=e._f.length;if(c===0){Xe(e).invalidFormat=!0,e._d=new Date(NaN);return}for(s=0;sthis?this:e:Pf()});function Fk(e,t){var r,n;if(t.length===1&&Cn(t[0])&&(t=t[0]),!t.length)return kt();for(r=t[0],n=1;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function S5(){if(!_r(this._isDSTShifted))return this._isDSTShifted;var e={},t;return Cv(e,this),e=Ik(e),e._a?(t=e._isUTC?Kn(e._a):kt(e._a),this._isDSTShifted=this.isValid()&&p5(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function k5(){return this.isValid()?!this._isUTC:!1}function C5(){return this.isValid()?this._isUTC:!1}function Uk(){return this.isValid()?this._isUTC&&this._offset===0:!1}var j5=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,E5=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Rn(e,t){var r=e,n=null,s,o,i;return Bu(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:Cs(e)||!isNaN(+e)?(r={},t?r[t]=+e:r.milliseconds=+e):(n=j5.exec(e))?(s=n[1]==="-"?-1:1,r={y:0,d:rt(n[Ln])*s,h:rt(n[Gt])*s,m:rt(n[vn])*s,s:rt(n[hs])*s,ms:rt(mm(n[Wo]*1e3))*s}):(n=E5.exec(e))?(s=n[1]==="-"?-1:1,r={y:Po(n[2],s),M:Po(n[3],s),w:Po(n[4],s),d:Po(n[5],s),h:Po(n[6],s),m:Po(n[7],s),s:Po(n[8],s)}):r==null?r={}:typeof r=="object"&&("from"in r||"to"in r)&&(i=N5(kt(r.from),kt(r.to)),r={},r.ms=i.milliseconds,r.M=i.months),o=new zf(r),Bu(e)&&ct(e,"_locale")&&(o._locale=e._locale),Bu(e)&&ct(e,"_isValid")&&(o._isValid=e._isValid),o}Rn.fn=zf.prototype;Rn.invalid=h5;function Po(e,t){var r=e&&parseFloat(e.replace(",","."));return(isNaN(r)?0:r)*t}function ew(e,t){var r={};return r.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(r.months,"M").isAfter(t)&&--r.months,r.milliseconds=+t-+e.clone().add(r.months,"M"),r}function N5(e,t){var r;return e.isValid()&&t.isValid()?(t=$v(t,e),e.isBefore(t)?r=ew(e,t):(r=ew(t,e),r.milliseconds=-r.milliseconds,r.months=-r.months),r):{milliseconds:0,months:0}}function $k(e,t){return function(r,n){var s,o;return n!==null&&!isNaN(+n)&&(gk(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=r,r=n,n=o),s=Rn(r,n),Vk(this,s,e),this}}function Vk(e,t,r,n){var s=t._milliseconds,o=mm(t._days),i=mm(t._months);e.isValid()&&(n=n??!0,i&&jk(e,Xl(e,"Month")+i*r),o&&Sk(e,"Date",Xl(e,"Date")+o*r),s&&e._d.setTime(e._d.valueOf()+s*r),n&&ve.updateOffset(e,o||i))}var T5=$k(1,"add"),R5=$k(-1,"subtract");function Wk(e){return typeof e=="string"||e instanceof String}function P5(e){return jn(e)||Pc(e)||Wk(e)||Cs(e)||D5(e)||A5(e)||e===null||e===void 0}function A5(e){var t=Zo(e)&&!Sv(e),r=!1,n=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],s,o,i=n.length;for(s=0;sr.valueOf():r.valueOf()9999?Wu(r,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Gn(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Wu(r,"Z")):Wu(r,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Z5(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",r,n,s,o;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),r="["+e+'("]',n=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",s="-MM-DD[T]HH:mm:ss.SSS",o=t+'[")]',this.format(r+n+s+o)}function K5(e){e||(e=this.isUtc()?ve.defaultFormatUtc:ve.defaultFormat);var t=Wu(this,e);return this.localeData().postformat(t)}function G5(e,t){return this.isValid()&&(jn(e)&&e.isValid()||kt(e).isValid())?Rn({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function q5(e){return this.from(kt(),e)}function X5(e,t){return this.isValid()&&(jn(e)&&e.isValid()||kt(e).isValid())?Rn({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function Q5(e){return this.to(kt(),e)}function Bk(e){var t;return e===void 0?this._locale._abbr:(t=As(e),t!=null&&(this._locale=t),this)}var Hk=an("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return e===void 0?this.localeData():this.locale(e)});function Yk(){return this._locale}var Pd=1e3,ta=60*Pd,Ad=60*ta,Zk=(365*400+97)*24*Ad;function ra(e,t){return(e%t+t)%t}function Kk(e,t,r){return e<100&&e>=0?new Date(e+400,t,r)-Zk:new Date(e,t,r).valueOf()}function Gk(e,t,r){return e<100&&e>=0?Date.UTC(e+400,t,r)-Zk:Date.UTC(e,t,r)}function J5(e){var t,r;if(e=ln(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(r=this._isUTC?Gk:Kk,e){case"year":t=r(this.year(),0,1);break;case"quarter":t=r(this.year(),this.month()-this.month()%3,1);break;case"month":t=r(this.year(),this.month(),1);break;case"week":t=r(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=r(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=ra(t+(this._isUTC?0:this.utcOffset()*ta),Ad);break;case"minute":t=this._d.valueOf(),t-=ra(t,ta);break;case"second":t=this._d.valueOf(),t-=ra(t,Pd);break}return this._d.setTime(t),ve.updateOffset(this,!0),this}function eF(e){var t,r;if(e=ln(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(r=this._isUTC?Gk:Kk,e){case"year":t=r(this.year()+1,0,1)-1;break;case"quarter":t=r(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=r(this.year(),this.month()+1,1)-1;break;case"week":t=r(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=r(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=Ad-ra(t+(this._isUTC?0:this.utcOffset()*ta),Ad)-1;break;case"minute":t=this._d.valueOf(),t+=ta-ra(t,ta)-1;break;case"second":t=this._d.valueOf(),t+=Pd-ra(t,Pd)-1;break}return this._d.setTime(t),ve.updateOffset(this,!0),this}function tF(){return this._d.valueOf()-(this._offset||0)*6e4}function rF(){return Math.floor(this.valueOf()/1e3)}function nF(){return new Date(this.valueOf())}function sF(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function oF(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function iF(){return this.isValid()?this.toISOString():null}function aF(){return kv(this)}function lF(){return Qs({},Xe(this))}function cF(){return Xe(this).overflow}function uF(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Ie("N",0,0,"eraAbbr");Ie("NN",0,0,"eraAbbr");Ie("NNN",0,0,"eraAbbr");Ie("NNNN",0,0,"eraName");Ie("NNNNN",0,0,"eraNarrow");Ie("y",["y",1],"yo","eraYear");Ie("y",["yy",2],0,"eraYear");Ie("y",["yyy",3],0,"eraYear");Ie("y",["yyyy",4],0,"eraYear");_e("N",Vv);_e("NN",Vv);_e("NNN",Vv);_e("NNNN",_F);_e("NNNNN",bF);vt(["N","NN","NNN","NNNN","NNNNN"],function(e,t,r,n){var s=r._locale.erasParse(e,n,r._strict);s?Xe(r).era=s:Xe(r).invalidEra=e});_e("y",Aa);_e("yy",Aa);_e("yyy",Aa);_e("yyyy",Aa);_e("yo",SF);vt(["y","yy","yyy","yyyy"],ar);vt(["yo"],function(e,t,r,n){var s;r._locale._eraYearOrdinalRegex&&(s=e.match(r._locale._eraYearOrdinalRegex)),r._locale.eraYearOrdinalParse?t[ar]=r._locale.eraYearOrdinalParse(e,s):t[ar]=parseInt(e,10)});function dF(e,t){var r,n,s,o=this._eras||As("en")._eras;for(r=0,n=o.length;r=0)return o[n]}function hF(e,t){var r=e.since<=e.until?1:-1;return t===void 0?ve(e.since).year():ve(e.since).year()+(t-e.offset)*r}function pF(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;eo&&(t=o),RF.call(this,e,t,r,n,s))}function RF(e,t,r,n,s){var o=Tk(e,t,r,n,s),i=Ql(o.year,0,o.dayOfYear);return this.year(i.getUTCFullYear()),this.month(i.getUTCMonth()),this.date(i.getUTCDate()),this}Ie("Q",0,"Qo","quarter");_e("Q",yk);vt("Q",function(e,t){t[fs]=(rt(e)-1)*3});function PF(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}Ie("D",["DD",2],"Do","date");_e("D",Ct,Da);_e("DD",Ct,Zr);_e("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient});vt(["D","DD"],Ln);vt("Do",function(e,t){t[Ln]=rt(e.match(Ct)[0])});var Xk=Oa("Date",!0);Ie("DDD",["DDDD",3],"DDDo","dayOfYear");_e("DDD",Df);_e("DDDD",xk);vt(["DDD","DDDD"],function(e,t,r){r._dayOfYear=rt(e)});function AF(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}Ie("m",["mm",2],0,"minute");_e("m",Ct,Pv);_e("mm",Ct,Zr);vt(["m","mm"],vn);var DF=Oa("Minutes",!1);Ie("s",["ss",2],0,"second");_e("s",Ct,Pv);_e("ss",Ct,Zr);vt(["s","ss"],hs);var OF=Oa("Seconds",!1);Ie("S",0,0,function(){return~~(this.millisecond()/100)});Ie(0,["SS",2],0,function(){return~~(this.millisecond()/10)});Ie(0,["SSS",3],0,"millisecond");Ie(0,["SSSS",4],0,function(){return this.millisecond()*10});Ie(0,["SSSSS",5],0,function(){return this.millisecond()*100});Ie(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3});Ie(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4});Ie(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5});Ie(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6});_e("S",Df,yk);_e("SS",Df,Zr);_e("SSS",Df,xk);var Js,Qk;for(Js="SSSS";Js.length<=9;Js+="S")_e(Js,Aa);function MF(e,t){t[Wo]=rt(("0."+e)*1e3)}for(Js="S";Js.length<=9;Js+="S")vt(Js,MF);Qk=Oa("Milliseconds",!1);Ie("z",0,0,"zoneAbbr");Ie("zz",0,0,"zoneName");function IF(){return this._isUTC?"UTC":""}function LF(){return this._isUTC?"Coordinated Universal Time":""}var le=Ac.prototype;le.add=T5;le.calendar=I5;le.clone=L5;le.diff=B5;le.endOf=eF;le.format=K5;le.from=G5;le.fromNow=q5;le.to=X5;le.toNow=Q5;le.get=ZL;le.invalidAt=cF;le.isAfter=F5;le.isBefore=z5;le.isBetween=U5;le.isSame=$5;le.isSameOrAfter=V5;le.isSameOrBefore=W5;le.isValid=aF;le.lang=Hk;le.locale=Bk;le.localeData=Yk;le.max=a5;le.min=i5;le.parsingFlags=lF;le.set=KL;le.startOf=J5;le.subtract=R5;le.toArray=sF;le.toObject=oF;le.toDate=nF;le.toISOString=Y5;le.inspect=Z5;typeof Symbol<"u"&&Symbol.for!=null&&(le[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"});le.toJSON=iF;le.toString=H5;le.unix=rF;le.valueOf=tF;le.creationData=uF;le.eraName=pF;le.eraNarrow=mF;le.eraAbbr=gF;le.eraYear=vF;le.year=bk;le.isLeapYear=YL;le.weekYear=kF;le.isoWeekYear=CF;le.quarter=le.quarters=PF;le.month=Ek;le.daysInMonth=n4;le.week=le.weeks=d4;le.isoWeek=le.isoWeeks=f4;le.weeksInYear=NF;le.weeksInWeekYear=TF;le.isoWeeksInYear=jF;le.isoWeeksInISOWeekYear=EF;le.date=Xk;le.day=le.days=C4;le.weekday=j4;le.isoWeekday=E4;le.dayOfYear=AF;le.hour=le.hours=O4;le.minute=le.minutes=DF;le.second=le.seconds=OF;le.millisecond=le.milliseconds=Qk;le.utcOffset=g5;le.utc=y5;le.local=x5;le.parseZone=w5;le.hasAlignedHourOffset=_5;le.isDST=b5;le.isLocal=k5;le.isUtcOffset=C5;le.isUtc=Uk;le.isUTC=Uk;le.zoneAbbr=IF;le.zoneName=LF;le.dates=an("dates accessor is deprecated. Use date instead.",Xk);le.months=an("months accessor is deprecated. Use month instead",Ek);le.years=an("years accessor is deprecated. Use year instead",bk);le.zone=an("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",v5);le.isDSTShifted=an("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",S5);function FF(e){return kt(e*1e3)}function zF(){return kt.apply(null,arguments).parseZone()}function Jk(e){return e}var ut=jv.prototype;ut.calendar=kL;ut.longDateFormat=NL;ut.invalidDate=RL;ut.ordinal=DL;ut.preparse=Jk;ut.postformat=Jk;ut.relativeTime=ML;ut.pastFuture=IL;ut.set=bL;ut.eras=dF;ut.erasParse=fF;ut.erasConvertYear=hF;ut.erasAbbrRegex=xF;ut.erasNameRegex=yF;ut.erasNarrowRegex=wF;ut.months=JL;ut.monthsShort=e4;ut.monthsParse=r4;ut.monthsRegex=o4;ut.monthsShortRegex=s4;ut.week=a4;ut.firstDayOfYear=u4;ut.firstDayOfWeek=c4;ut.weekdays=w4;ut.weekdaysMin=b4;ut.weekdaysShort=_4;ut.weekdaysParse=k4;ut.weekdaysRegex=N4;ut.weekdaysShortRegex=T4;ut.weekdaysMinRegex=R4;ut.isPM=A4;ut.meridiem=M4;function Dd(e,t,r,n){var s=As(),o=Kn().set(n,t);return s[r](o,e)}function eC(e,t,r){if(Cs(e)&&(t=e,e=void 0),e=e||"",t!=null)return Dd(e,t,r,"month");var n,s=[];for(n=0;n<12;n++)s[n]=Dd(e,n,r,"month");return s}function Bv(e,t,r,n){typeof e=="boolean"?(Cs(t)&&(r=t,t=void 0),t=t||""):(t=e,r=t,e=!1,Cs(t)&&(r=t,t=void 0),t=t||"");var s=As(),o=e?s._week.dow:0,i,a=[];if(r!=null)return Dd(t,(r+o)%7,n,"day");for(i=0;i<7;i++)a[i]=Dd(t,(i+o)%7,n,"day");return a}function UF(e,t){return eC(e,t,"months")}function $F(e,t){return eC(e,t,"monthsShort")}function VF(e,t,r){return Bv(e,t,r,"weekdays")}function WF(e,t,r){return Bv(e,t,r,"weekdaysShort")}function BF(e,t,r){return Bv(e,t,r,"weekdaysMin")}co("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,r=rt(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+r}});ve.lang=an("moment.lang is deprecated. Use moment.locale instead.",co);ve.langData=an("moment.langData is deprecated. Use moment.localeData instead.",As);var ns=Math.abs;function HF(){var e=this._data;return this._milliseconds=ns(this._milliseconds),this._days=ns(this._days),this._months=ns(this._months),e.milliseconds=ns(e.milliseconds),e.seconds=ns(e.seconds),e.minutes=ns(e.minutes),e.hours=ns(e.hours),e.months=ns(e.months),e.years=ns(e.years),this}function tC(e,t,r,n){var s=Rn(t,r);return e._milliseconds+=n*s._milliseconds,e._days+=n*s._days,e._months+=n*s._months,e._bubble()}function YF(e,t){return tC(this,e,t,1)}function ZF(e,t){return tC(this,e,t,-1)}function tw(e){return e<0?Math.floor(e):Math.ceil(e)}function KF(){var e=this._milliseconds,t=this._days,r=this._months,n=this._data,s,o,i,a,c;return e>=0&&t>=0&&r>=0||e<=0&&t<=0&&r<=0||(e+=tw(vm(r)+t)*864e5,t=0,r=0),n.milliseconds=e%1e3,s=Jr(e/1e3),n.seconds=s%60,o=Jr(s/60),n.minutes=o%60,i=Jr(o/60),n.hours=i%24,t+=Jr(i/24),c=Jr(rC(t)),r+=c,t-=tw(vm(c)),a=Jr(r/12),r%=12,n.days=t,n.months=r,n.years=a,this}function rC(e){return e*4800/146097}function vm(e){return e*146097/4800}function GF(e){if(!this.isValid())return NaN;var t,r,n=this._milliseconds;if(e=ln(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+n/864e5,r=this._months+rC(t),e){case"month":return r;case"quarter":return r/3;case"year":return r/12}else switch(t=this._days+Math.round(vm(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return t*24+n/36e5;case"minute":return t*1440+n/6e4;case"second":return t*86400+n/1e3;case"millisecond":return Math.floor(t*864e5)+n;default:throw new Error("Unknown unit "+e)}}function Ds(e){return function(){return this.as(e)}}var nC=Ds("ms"),qF=Ds("s"),XF=Ds("m"),QF=Ds("h"),JF=Ds("d"),e3=Ds("w"),t3=Ds("M"),r3=Ds("Q"),n3=Ds("y"),s3=nC;function o3(){return Rn(this)}function i3(e){return e=ln(e),this.isValid()?this[e+"s"]():NaN}function fi(e){return function(){return this.isValid()?this._data[e]:NaN}}var a3=fi("milliseconds"),l3=fi("seconds"),c3=fi("minutes"),u3=fi("hours"),d3=fi("days"),f3=fi("months"),h3=fi("years");function p3(){return Jr(this.days()/7)}var as=Math.round,Ui={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function m3(e,t,r,n,s){return s.relativeTime(t||1,!!r,e,n)}function g3(e,t,r,n){var s=Rn(e).abs(),o=as(s.as("s")),i=as(s.as("m")),a=as(s.as("h")),c=as(s.as("d")),u=as(s.as("M")),d=as(s.as("w")),f=as(s.as("y")),m=o<=r.ss&&["s",o]||o0,m[4]=n,m3.apply(null,m)}function v3(e){return e===void 0?as:typeof e=="function"?(as=e,!0):!1}function y3(e,t){return Ui[e]===void 0?!1:t===void 0?Ui[e]:(Ui[e]=t,e==="s"&&(Ui.ss=t-1),!0)}function x3(e,t){if(!this.isValid())return this.localeData().invalidDate();var r=!1,n=Ui,s,o;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(r=e),typeof t=="object"&&(n=Object.assign({},Ui,t),t.s!=null&&t.ss==null&&(n.ss=t.s-1)),s=this.localeData(),o=g3(this,!r,n,s),r&&(o=s.pastFuture(+this,o)),s.postformat(o)}var Qh=Math.abs;function Si(e){return(e>0)-(e<0)||+e}function $f(){if(!this.isValid())return this.localeData().invalidDate();var e=Qh(this._milliseconds)/1e3,t=Qh(this._days),r=Qh(this._months),n,s,o,i,a=this.asSeconds(),c,u,d,f;return a?(n=Jr(e/60),s=Jr(n/60),e%=60,n%=60,o=Jr(r/12),r%=12,i=e?e.toFixed(3).replace(/\.?0+$/,""):"",c=a<0?"-":"",u=Si(this._months)!==Si(a)?"-":"",d=Si(this._days)!==Si(a)?"-":"",f=Si(this._milliseconds)!==Si(a)?"-":"",c+"P"+(o?u+o+"Y":"")+(r?u+r+"M":"")+(t?d+t+"D":"")+(s||n||e?"T":"")+(s?f+s+"H":"")+(n?f+n+"M":"")+(e?f+i+"S":"")):"P0D"}var it=zf.prototype;it.isValid=f5;it.abs=HF;it.add=YF;it.subtract=ZF;it.as=GF;it.asMilliseconds=nC;it.asSeconds=qF;it.asMinutes=XF;it.asHours=QF;it.asDays=JF;it.asWeeks=e3;it.asMonths=t3;it.asQuarters=r3;it.asYears=n3;it.valueOf=s3;it._bubble=KF;it.clone=o3;it.get=i3;it.milliseconds=a3;it.seconds=l3;it.minutes=c3;it.hours=u3;it.days=d3;it.weeks=p3;it.months=f3;it.years=h3;it.humanize=x3;it.toISOString=$f;it.toString=$f;it.toJSON=$f;it.locale=Bk;it.localeData=Yk;it.toIsoString=an("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$f);it.lang=Hk;Ie("X",0,0,"unix");Ie("x",0,0,"valueOf");_e("x",Mf);_e("X",UL);vt("X",function(e,t,r){r._d=new Date(parseFloat(e)*1e3)});vt("x",function(e,t,r){r._d=new Date(rt(e))});//! moment.js +ve.version="2.30.1";wL(kt);ve.fn=le;ve.min=l5;ve.max=c5;ve.now=u5;ve.utc=Kn;ve.unix=FF;ve.months=UF;ve.isDate=Pc;ve.locale=co;ve.invalid=Pf;ve.duration=Rn;ve.isMoment=jn;ve.weekdays=VF;ve.parseZone=zF;ve.localeData=As;ve.isDuration=Bu;ve.monthsShort=$F;ve.weekdaysMin=BF;ve.defineLocale=Iv;ve.updateLocale=z4;ve.locales=U4;ve.weekdaysShort=WF;ve.normalizeUnits=ln;ve.relativeTimeRounding=v3;ve.relativeTimeThreshold=y3;ve.calendarFormat=M5;ve.prototype=le;ve.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const w3=async()=>await st().collection("access").getFullList({sort:"-created",filter:"deleted = null"}),jo=async e=>e.id?await st().collection("access").update(e.id,e):await st().collection("access").create(e),_3=async e=>(e.deleted=ve.utc().format("YYYY-MM-DD HH:mm:ss"),await st().collection("access").update(e.id,e)),rw=async()=>await st().collection("access_groups").getFullList({sort:"-created",expand:"access"}),b3=async e=>{const t=st();if((await t.collection("access").getList(1,1,{filter:`group='${e}' && deleted=null`})).items.length>0)throw new Error("该分组下有授权配置,无法删除");await t.collection("access_groups").delete(e)},S3=async e=>{const t=st();return e.id?await t.collection("access_groups").update(e.id,e):await t.collection("access_groups").create(e)},nw=async e=>await st().collection("access_groups").update(e.id,e),k3=(e,t)=>{switch(t.type){case"SET_ACCESSES":return{...e,accesses:t.payload};case"ADD_ACCESS":return{...e,accesses:[t.payload,...e.accesses]};case"DELETE_ACCESS":return{...e,accesses:e.accesses.filter(r=>r.id!==t.payload)};case"UPDATE_ACCESS":return{...e,accesses:e.accesses.map(r=>r.id===t.payload.id?t.payload:r)};case"SET_EMAILS":return{...e,emails:t.payload};case"ADD_EMAIL":return{...e,emails:{...e.emails,content:{emails:[...e.emails.content.emails,t.payload]}}};case"SET_ACCESS_GROUPS":return{...e,accessGroups:t.payload};default:return e}},C3=async()=>{try{return await st().collection("settings").getFirstListItem("name='emails'")}catch{return{content:{emails:[]}}}},sC=async e=>{try{return await st().collection("settings").getFirstListItem(`name='${e}'`)}catch{return{name:e}}},Mc=async e=>{const t=st();let r;return e.id?r=await t.collection("settings").update(e.id,e):r=await t.collection("settings").create(e),r},oC=v.createContext({}),Kr=()=>v.useContext(oC),j3=({children:e})=>{const[t,r]=v.useReducer(k3,{accesses:[],emails:{content:{emails:[]}},accessGroups:[]});v.useEffect(()=>{(async()=>{const d=await w3();r({type:"SET_ACCESSES",payload:d})})()},[]),v.useEffect(()=>{(async()=>{const d=await C3();r({type:"SET_EMAILS",payload:d})})()},[]),v.useEffect(()=>{(async()=>{const d=await rw();r({type:"SET_ACCESS_GROUPS",payload:d})})()},[]);const n=v.useCallback(async()=>{const u=await rw();r({type:"SET_ACCESS_GROUPS",payload:u})},[]),s=v.useCallback(u=>{r({type:"SET_EMAILS",payload:u})},[]),o=v.useCallback(u=>{r({type:"DELETE_ACCESS",payload:u})},[]),i=v.useCallback(u=>{r({type:"ADD_ACCESS",payload:u})},[]),a=v.useCallback(u=>{r({type:"UPDATE_ACCESS",payload:u})},[]),c=v.useCallback(u=>{r({type:"SET_ACCESS_GROUPS",payload:u})},[]);return l.jsx(oC.Provider,{value:{config:{accesses:t.accesses,emails:t.emails,accessGroups:t.accessGroups},deleteAccess:o,addAccess:i,setEmails:s,updateAccess:a,setAccessGroups:c,reloadAccessGroups:n},children:e&&e})},E3={theme:"system",setTheme:()=>null},iC=v.createContext(E3);function N3({children:e,defaultTheme:t="system",storageKey:r="vite-ui-theme",...n}){const[s,o]=v.useState(()=>localStorage.getItem(r)||t);v.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(c);return}a.classList.add(s)},[s]);const i={theme:s,setTheme:a=>{localStorage.setItem(r,a),o(a)}};return l.jsx(iC.Provider,{...n,value:i,children:e})}const T3=()=>{const e=v.useContext(iC);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};function R3(){const{setTheme:e}=T3();return l.jsxs($S,{children:[l.jsx(VS,{asChild:!0,children:l.jsxs(He,{variant:"outline",size:"icon",children:[l.jsx(xA,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),l.jsx(vA,{className:"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100 dark:text-white"}),l.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),l.jsxs(uv,{align:"end",children:[l.jsx(Qi,{onClick:()=>e("light"),children:"浅色"}),l.jsx(Qi,{onClick:()=>e("dark"),children:"暗黑"}),l.jsx(Qi,{onClick:()=>e("system"),children:"系统"})]})]})}var P3="Separator",sw="horizontal",A3=["horizontal","vertical"],aC=v.forwardRef((e,t)=>{const{decorative:r,orientation:n=sw,...s}=e,o=D3(n)?n:sw,a=r?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return l.jsx(Re.div,{"data-orientation":o,...a,...s,ref:t})});aC.displayName=P3;function D3(e){return A3.includes(e)}var lC=aC;const Wt=v.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},s)=>l.jsx(lC,{ref:s,decorative:r,orientation:t,className:ae("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Wt.displayName=lC.displayName;const O3="Certimate v0.1.11",cC=()=>l.jsxs("div",{className:"fixed right-0 bottom-0 w-full flex justify-between p-5",children:[l.jsx("div",{className:""}),l.jsxs("div",{className:"text-muted-foreground text-sm hover:text-stone-900 dark:hover:text-stone-200 flex",children:[l.jsxs("a",{href:"https://docs.certimate.me",target:"_blank",className:"flex items-center",children:[l.jsx(sA,{size:16}),l.jsx("div",{className:"ml-1",children:"文档"})]}),l.jsx(Wt,{orientation:"vertical",className:"mx-2"}),l.jsx("a",{href:"https://github.com/usual2970/certimate/releases",target:"_blank",children:O3})]})]});function M3(){const e=Nr(),t=Nn();if(!st().authStore.isValid||!st().authStore.isAdmin)return l.jsx(Q1,{to:"/login"});const r=t.pathname,n=i=>(console.log(r),i==r?"bg-muted text-primary":"text-muted-foreground"),s=()=>{st().authStore.clear(),e("/login")},o=()=>{e("/setting/account")};return l.jsx(l.Fragment,{children:l.jsx(j3,{children:l.jsxs("div",{className:"grid min-h-screen w-full md:grid-cols-[180px_1fr] lg:grid-cols-[200px_1fr] 2xl:md:grid-cols-[280px_1fr] ",children:[l.jsx("div",{className:"hidden border-r dark:border-stone-500 bg-muted/40 md:block",children:l.jsxs("div",{className:"flex h-full max-h-screen flex-col gap-2",children:[l.jsx("div",{className:"flex h-14 items-center border-b dark:border-stone-500 px-4 lg:h-[60px] lg:px-6",children:l.jsxs(fr,{to:"/",className:"flex items-center gap-2 font-semibold",children:[l.jsx("img",{src:"/vite.svg",className:"w-[36px] h-[36px]"}),l.jsx("span",{className:"dark:text-white",children:"Certimate"})]})}),l.jsx("div",{className:"flex-1",children:l.jsxs("nav",{className:"grid items-start px-2 text-sm font-medium lg:px-4",children:[l.jsxs(fr,{to:"/",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/")),children:[l.jsx(x0,{className:"h-4 w-4"}),"控制面板"]}),l.jsxs(fr,{to:"/domains",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/domains")),children:[l.jsx(rm,{className:"h-4 w-4"}),"域名列表"]}),l.jsxs(fr,{to:"/access",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/access")),children:[l.jsx(w0,{className:"h-4 w-4"}),"授权管理"]}),l.jsxs(fr,{to:"/history",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/history")),children:[l.jsx(y0,{className:"h-4 w-4"}),"部署历史"]})]})})]})}),l.jsxs("div",{className:"flex flex-col",children:[l.jsxs("header",{className:"flex h-14 items-center gap-4 border-b dark:border-stone-500 bg-muted/40 px-4 lg:h-[60px] lg:px-6",children:[l.jsxs(yv,{children:[l.jsx(xv,{asChild:!0,children:l.jsxs(He,{variant:"outline",size:"icon",className:"shrink-0 md:hidden",children:[l.jsx(gA,{className:"h-5 w-5 dark:text-white"}),l.jsx("span",{className:"sr-only",children:"Toggle navigation menu"})]})}),l.jsx(Rf,{side:"left",className:"flex flex-col",children:l.jsxs("nav",{className:"grid gap-2 text-lg font-medium",children:[l.jsxs(fr,{to:"/",className:"flex items-center gap-2 text-lg font-semibold",children:[l.jsx("img",{src:"/vite.svg",className:"w-[36px] h-[36px]"}),l.jsx("span",{className:"dark:text-white",children:"Certimate"}),l.jsx("span",{className:"sr-only",children:"Certimate"})]}),l.jsxs(fr,{to:"/",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/")),children:[l.jsx(x0,{className:"h-5 w-5"}),"控制面板"]}),l.jsxs(fr,{to:"/domains",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/domains")),children:[l.jsx(rm,{className:"h-5 w-5"}),"域名列表"]}),l.jsxs(fr,{to:"/access",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/access")),children:[l.jsx(w0,{className:"h-5 w-5"}),"授权管理"]}),l.jsxs(fr,{to:"/history",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/history")),children:[l.jsx(y0,{className:"h-5 w-5"}),"部署历史"]})]})})]}),l.jsx("div",{className:"w-full flex-1"}),l.jsx(R3,{}),l.jsxs($S,{children:[l.jsx(VS,{asChild:!0,children:l.jsxs(He,{variant:"secondary",size:"icon",className:"rounded-full",children:[l.jsx(cA,{className:"h-5 w-5"}),l.jsx("span",{className:"sr-only",children:"Toggle user menu"})]})}),l.jsxs(uv,{align:"end",children:[l.jsx(WS,{children:"账户"}),l.jsx(BS,{}),l.jsx(Qi,{onClick:o,children:"偏好设置"}),l.jsx(Qi,{onClick:s,children:"退出"})]})]})]}),l.jsxs("main",{className:"flex flex-1 flex-col gap-4 p-4 lg:gap-6 lg:p-6 relative",children:[l.jsx(Ig,{}),l.jsx(cC,{})]})]})]})})})}const Hv=({phase:e,phaseSuccess:t})=>{let r=l.jsx(l.Fragment,{children:" "});return e==="check"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]})),e==="apply"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]})),e==="deploy"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"部署"})]})),r};var I3="VisuallyHidden",Ic=v.forwardRef((e,t)=>l.jsx(Re.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));Ic.displayName=I3;var L3=Ic,[Vf,b$]=xr("Tooltip",[Pa]),Wf=Pa(),uC="TooltipProvider",F3=700,ym="tooltip.open",[z3,Yv]=Vf(uC),Zv=e=>{const{__scopeTooltip:t,delayDuration:r=F3,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:o}=e,[i,a]=v.useState(!0),c=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),l.jsx(z3,{scope:t,isOpenDelayed:i,delayDuration:r,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(d=>{c.current=d},[]),disableHoverableContent:s,children:o})};Zv.displayName=uC;var Bf="Tooltip",[U3,Hf]=Vf(Bf),dC=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:s=!1,onOpenChange:o,disableHoverableContent:i,delayDuration:a}=e,c=Yv(Bf,e.__scopeTooltip),u=Wf(t),[d,f]=v.useState(null),m=Ur(),y=v.useRef(0),x=i??c.disableHoverableContent,g=a??c.delayDuration,_=v.useRef(!1),[p=!1,h]=on({prop:n,defaultProp:s,onChange:R=>{R?(c.onOpen(),document.dispatchEvent(new CustomEvent(ym))):c.onClose(),o==null||o(R)}}),w=v.useMemo(()=>p?_.current?"delayed-open":"instant-open":"closed",[p]),C=v.useCallback(()=>{window.clearTimeout(y.current),_.current=!1,h(!0)},[h]),j=v.useCallback(()=>{window.clearTimeout(y.current),h(!1)},[h]),E=v.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{_.current=!0,h(!0)},g)},[g,h]);return v.useEffect(()=>()=>window.clearTimeout(y.current),[]),l.jsx(Xg,{...u,children:l.jsx(U3,{scope:t,contentId:m,open:p,stateAttribute:w,trigger:d,onTriggerChange:f,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayed?E():C()},[c.isOpenDelayed,E,C]),onTriggerLeave:v.useCallback(()=>{x?j():window.clearTimeout(y.current)},[j,x]),onOpen:C,onClose:j,disableHoverableContent:x,children:r})})};dC.displayName=Bf;var xm="TooltipTrigger",fC=v.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Hf(xm,r),o=Yv(xm,r),i=Wf(r),a=v.useRef(null),c=Ke(t,a,s.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),f=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l.jsx(Qg,{asChild:!0,...i,children:l.jsx(Re.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:ce(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:ce(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:ce(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ce(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:ce(e.onBlur,s.onClose),onClick:ce(e.onClick,s.onClose)})})});fC.displayName=xm;var $3="TooltipPortal",[S$,V3]=Vf($3,{forceMount:void 0}),ma="TooltipContent",Kv=v.forwardRef((e,t)=>{const r=V3(ma,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...o}=e,i=Hf(ma,e.__scopeTooltip);return l.jsx(ur,{present:n||i.open,children:i.disableHoverableContent?l.jsx(hC,{side:s,...o,ref:t}):l.jsx(W3,{side:s,...o,ref:t})})}),W3=v.forwardRef((e,t)=>{const r=Hf(ma,e.__scopeTooltip),n=Yv(ma,e.__scopeTooltip),s=v.useRef(null),o=Ke(t,s),[i,a]=v.useState(null),{trigger:c,onClose:u}=r,d=s.current,{onPointerInTransitChange:f}=n,m=v.useCallback(()=>{a(null),f(!1)},[f]),y=v.useCallback((x,g)=>{const _=x.currentTarget,p={x:x.clientX,y:x.clientY},h=Z3(p,_.getBoundingClientRect()),w=K3(p,h),C=G3(g.getBoundingClientRect()),j=X3([...w,...C]);a(j),f(!0)},[f]);return v.useEffect(()=>()=>m(),[m]),v.useEffect(()=>{if(c&&d){const x=_=>y(_,d),g=_=>y(_,c);return c.addEventListener("pointerleave",x),d.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",x),d.removeEventListener("pointerleave",g)}}},[c,d,y,m]),v.useEffect(()=>{if(i){const x=g=>{const _=g.target,p={x:g.clientX,y:g.clientY},h=(c==null?void 0:c.contains(_))||(d==null?void 0:d.contains(_)),w=!q3(p,i);h?m():w&&(m(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,d,i,u,m]),l.jsx(hC,{...e,ref:o})}),[B3,H3]=Vf(Bf,{isInside:!1}),hC=v.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...a}=e,c=Hf(ma,r),u=Wf(r),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(ym,d),()=>document.removeEventListener(ym,d)),[d]),v.useEffect(()=>{if(c.trigger){const f=m=>{const y=m.target;y!=null&&y.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:l.jsxs(Jg,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[l.jsx(zg,{children:n}),l.jsx(B3,{scope:r,isInside:!0,children:l.jsx(L3,{id:c.contentId,role:"tooltip",children:s||n})})]})})});Kv.displayName=ma;var pC="TooltipArrow",Y3=v.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Wf(r);return H3(pC,r).isInside?null:l.jsx(ev,{...s,...n,ref:t})});Y3.displayName=pC;function Z3(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,s,o)){case o:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function K3(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function G3(e){const{top:t,right:r,bottom:n,left:s}=e;return[{x:s,y:t},{x:r,y:t},{x:r,y:n},{x:s,y:n}]}function q3(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;on!=d>n&&r<(u-a)*(n-c)/(d-c)+a&&(s=!s)}return s}function X3(e){const t=e.slice();return t.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),Q3(t)}function Q3(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const s=e[n];for(;r.length>=2;){const o=r[r.length-1],i=r[r.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))r.pop();else break}r.push(s)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var J3=Zv,e6=dC,t6=fC,mC=Kv;const r6=J3,gC=e6,vC=t6,yC=v.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(mC,{ref:n,sideOffset:t,className:ae("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));yC.displayName=mC.displayName;const Gv=({deployment:e})=>{const t=r=>e.log[r]?e.log[r][e.log[r].length-1].error:"";return l.jsx(l.Fragment,{children:e.phase==="deploy"&&e.phaseSuccess||e.wholeSuccess?l.jsx(lA,{size:16,className:"text-green-700"}):l.jsx(l.Fragment,{children:t(e.phase).length?l.jsx(r6,{children:l.jsxs(gC,{children:[l.jsx(vC,{asChild:!0,className:"cursor-pointer",children:l.jsx(g0,{size:16,className:"text-red-700"})}),l.jsx(yC,{className:"max-w-[35em]",children:t(e.phase)})]})}):l.jsx(g0,{size:16,className:"text-red-700"})})})},xC=({className:e,...t})=>l.jsx("nav",{role:"navigation","aria-label":"pagination",className:ae("mx-auto flex w-full justify-center",e),...t});xC.displayName="Pagination";const wC=v.forwardRef(({className:e,...t},r)=>l.jsx("ul",{ref:r,className:ae("flex flex-row items-center gap-1",e),...t}));wC.displayName="PaginationContent";const wm=v.forwardRef(({className:e,...t},r)=>l.jsx("li",{ref:r,className:ae("",e),...t}));wm.displayName="PaginationItem";const _C=({className:e,isActive:t,size:r="icon",...n})=>l.jsx("a",{"aria-current":t?"page":void 0,className:ae(xf({variant:t?"outline":"ghost",size:r}),e),...n});_C.displayName="PaginationLink";const bC=({className:e,...t})=>l.jsxs("span",{"aria-hidden":!0,className:ae("flex h-9 w-9 items-center justify-center",e),...t,children:[l.jsx(dA,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"More pages"})]});bC.displayName="PaginationEllipsis";const SC=({totalPages:e,currentPage:t,onPageChange:r})=>{const s=()=>{if(e>7){let u=[];const d=Math.max(2,t-1),f=Math.min(e-1,t+1),m=e-1;return u=o(d,f),t>3&&u.unshift("..."),t{let d=a;const f=[];for(;d<=c;)f.push(d),d+=u;return f},i=s();return l.jsx(l.Fragment,{children:l.jsx(xC,{className:"dark:text-stone-200 justify-end mt-3",children:l.jsx(wC,{children:i.map((a,c)=>a==="..."?l.jsx(wm,{children:l.jsx(bC,{})},c):l.jsx(wm,{children:l.jsx(_C,{href:"#",isActive:t==a,onClick:u=>{u.preventDefault(),r(a)},children:a})},c))})})})},na=({when:e,children:t,fallback:r})=>e?t:r;var kC="AlertDialog",[n6,k$]=xr(kC,[YS]),Os=YS(),CC=e=>{const{__scopeAlertDialog:t,...r}=e,n=Os(t);return l.jsx(mv,{...n,...r,modal:!0})};CC.displayName=kC;var s6="AlertDialogTrigger",jC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(gv,{...s,...n,ref:t})});jC.displayName=s6;var o6="AlertDialogPortal",EC=e=>{const{__scopeAlertDialog:t,...r}=e,n=Os(t);return l.jsx(vv,{...n,...r})};EC.displayName=o6;var i6="AlertDialogOverlay",NC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Ec,{...s,...n,ref:t})});NC.displayName=i6;var sa="AlertDialogContent",[a6,l6]=n6(sa),TC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...s}=e,o=Os(r),i=v.useRef(null),a=Ke(t,i),c=v.useRef(null);return l.jsx(GI,{contentName:sa,titleName:RC,docsSlug:"alert-dialog",children:l.jsx(a6,{scope:r,cancelRef:c,children:l.jsxs(Nc,{role:"alertdialog",...o,...s,ref:a,onOpenAutoFocus:ce(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[l.jsx(zg,{children:n}),l.jsx(u6,{contentRef:i})]})})})});TC.displayName=sa;var RC="AlertDialogTitle",PC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Tc,{...s,...n,ref:t})});PC.displayName=RC;var AC="AlertDialogDescription",DC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Rc,{...s,...n,ref:t})});DC.displayName=AC;var c6="AlertDialogAction",OC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Tf,{...s,...n,ref:t})});OC.displayName=c6;var MC="AlertDialogCancel",IC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:s}=l6(MC,r),o=Os(r),i=Ke(t,s);return l.jsx(Tf,{...o,...n,ref:i})});IC.displayName=MC;var u6=({contentRef:e})=>{const t=`\`${sa}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${sa}\` by passing a \`${AC}\` component as a child, which also benefits sighted users by adding visible context to the dialog. Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${sa}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},u6=CC,d6=jC,f6=EC,LC=NC,FC=TC,zC=OC,UC=IC,$C=PC,VC=DC;const WC=u6,BC=d6,h6=f6,HC=v.forwardRef(({className:e,...t},r)=>l.jsx(LC,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));HC.displayName=LC.displayName;const qv=v.forwardRef(({className:e,...t},r)=>l.jsxs(h6,{children:[l.jsx(HC,{}),l.jsx(FC,{ref:r,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));qv.displayName=FC.displayName;const Xv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});Xv.displayName="AlertDialogHeader";const Qv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Qv.displayName="AlertDialogFooter";const Jv=v.forwardRef(({className:e,...t},r)=>l.jsx($C,{ref:r,className:ae("text-lg font-semibold",e),...t}));Jv.displayName=$C.displayName;const ey=v.forwardRef(({className:e,...t},r)=>l.jsx(VC,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));ey.displayName=VC.displayName;const ty=v.forwardRef(({className:e,...t},r)=>l.jsx(zC,{ref:r,className:ae(xf(),e),...t}));ty.displayName=zC.displayName;const ry=v.forwardRef(({className:e,...t},r)=>l.jsx(UC,{ref:r,className:ae(xf({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));ry.displayName=UC.displayName;function YC(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ny="Switch",[p6,k$]=xr(ny),[m6,g6]=p6(ny),ZC=v.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:o,required:i,disabled:a,value:c="on",onCheckedChange:u,...d}=e,[f,m]=v.useState(null),y=Ke(t,h=>m(h)),x=v.useRef(!1),g=f?!!f.closest("form"):!0,[_=!1,p]=on({prop:s,defaultProp:o,onChange:u});return l.jsxs(m6,{scope:r,checked:_,disabled:a,children:[l.jsx(Re.button,{type:"button",role:"switch","aria-checked":_,"aria-required":i,"data-state":qC(_),"data-disabled":a?"":void 0,disabled:a,value:c,...d,ref:y,onClick:ce(e.onClick,h=>{p(w=>!w),g&&(x.current=h.isPropagationStopped(),x.current||h.stopPropagation())})}),g&&l.jsx(v6,{control:f,bubbles:!x.current,name:n,value:c,checked:_,required:i,disabled:a,style:{transform:"translateX(-100%)"}})]})});ZC.displayName=ny;var KC="SwitchThumb",GC=v.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,s=g6(KC,r);return l.jsx(Re.span,{"data-state":qC(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t})});GC.displayName=KC;var v6=e=>{const{control:t,checked:r,bubbles:n=!0,...s}=e,o=v.useRef(null),i=YC(r),a=Sb(t);return v.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(i!==r&&f){const m=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(m)}},[i,r,n]),l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function qC(e){return e?"checked":"unchecked"}var XC=ZC,y6=GC;const Lc=v.forwardRef(({className:e,...t},r)=>l.jsx(XC,{className:ae("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:l.jsx(y6,{className:ae("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Lc.displayName=XC.displayName;var sy="ToastProvider",[oy,x6,w6]=bc("Toast"),[QC,C$]=xr("Toast",[w6]),[_6,Yf]=QC(sy),JC=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:i}=e,[a,c]=v.useState(null),[u,d]=v.useState(0),f=v.useRef(!1),m=v.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${sy}\`. Expected non-empty \`string\`.`),l.jsx(oy.Provider,{scope:t,children:l.jsx(_6,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:o,toastCount:u,viewport:a,onViewportChange:c,onToastAdd:v.useCallback(()=>d(y=>y+1),[]),onToastRemove:v.useCallback(()=>d(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:m,children:i})})};JC.displayName=sy;var ej="ToastViewport",b6=["F8"],_m="toast.viewportPause",bm="toast.viewportResume",tj=v.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=b6,label:s="Notifications ({hotkey})",...o}=e,i=Yf(ej,r),a=x6(r),c=v.useRef(null),u=v.useRef(null),d=v.useRef(null),f=v.useRef(null),m=Ke(t,f,i.onViewportChange),y=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=i.toastCount>0;v.useEffect(()=>{const _=p=>{var w;n.every(C=>p[C]||p.code===C)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[n]),v.useEffect(()=>{const _=c.current,p=f.current;if(x&&_&&p){const h=()=>{if(!i.isClosePausedRef.current){const E=new CustomEvent(_m);p.dispatchEvent(E),i.isClosePausedRef.current=!0}},w=()=>{if(i.isClosePausedRef.current){const E=new CustomEvent(bm);p.dispatchEvent(E),i.isClosePausedRef.current=!1}},C=E=>{!_.contains(E.relatedTarget)&&w()},j=()=>{_.contains(document.activeElement)||w()};return _.addEventListener("focusin",h),_.addEventListener("focusout",C),_.addEventListener("pointermove",h),_.addEventListener("pointerleave",j),window.addEventListener("blur",h),window.addEventListener("focus",w),()=>{_.removeEventListener("focusin",h),_.removeEventListener("focusout",C),_.removeEventListener("pointermove",h),_.removeEventListener("pointerleave",j),window.removeEventListener("blur",h),window.removeEventListener("focus",w)}}},[x,i.isClosePausedRef]);const g=v.useCallback(({tabbingDirection:_})=>{const h=a().map(w=>{const C=w.ref.current,j=[C,...M6(C)];return _==="forwards"?j:j.reverse()});return(_==="forwards"?h.reverse():h).flat()},[a]);return v.useEffect(()=>{const _=f.current;if(_){const p=h=>{var j,E,R;const w=h.altKey||h.ctrlKey||h.metaKey;if(h.key==="Tab"&&!w){const P=document.activeElement,A=h.shiftKey;if(h.target===_&&A){(j=u.current)==null||j.focus();return}const N=g({tabbingDirection:A?"backwards":"forwards"}),F=N.findIndex(b=>b===P);Jh(N.slice(F+1))?h.preventDefault():A?(E=u.current)==null||E.focus():(R=d.current)==null||R.focus()}};return _.addEventListener("keydown",p),()=>_.removeEventListener("keydown",p)}},[a,g]),l.jsxs(yD,{ref:c,role:"region","aria-label":s.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&l.jsx(Sm,{ref:u,onFocusFromOutsideViewport:()=>{const _=g({tabbingDirection:"forwards"});Jh(_)}}),l.jsx(oy.Slot,{scope:r,children:l.jsx(Re.ol,{tabIndex:-1,...o,ref:m})}),x&&l.jsx(Sm,{ref:d,onFocusFromOutsideViewport:()=>{const _=g({tabbingDirection:"backwards"});Jh(_)}})]})});tj.displayName=ej;var rj="ToastFocusProxy",Sm=v.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,o=Yf(rj,r);return l.jsx(Ic,{"aria-hidden":!0,tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const a=i.relatedTarget;!((u=o.viewport)!=null&&u.contains(a))&&n()}})});Sm.displayName=rj;var Zf="Toast",S6="toast.swipeStart",k6="toast.swipeMove",C6="toast.swipeCancel",j6="toast.swipeEnd",nj=v.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:o,...i}=e,[a=!0,c]=on({prop:n,defaultProp:s,onChange:o});return l.jsx(ur,{present:r||a,children:l.jsx(T6,{open:a,...i,ref:t,onClose:()=>c(!1),onPause:Dt(e.onPause),onResume:Dt(e.onResume),onSwipeStart:ce(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ce(e.onSwipeMove,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:ce(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ce(e.onSwipeEnd,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});nj.displayName=Zf;var[E6,N6]=QC(Zf,{onClose(){}}),T6=v.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:o,onClose:i,onEscapeKeyDown:a,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:m,onSwipeEnd:y,...x}=e,g=Yf(Zf,r),[_,p]=v.useState(null),h=Ke(t,b=>p(b)),w=v.useRef(null),C=v.useRef(null),j=s||g.duration,E=v.useRef(0),R=v.useRef(j),P=v.useRef(0),{onToastAdd:A,onToastRemove:L}=g,q=Dt(()=>{var V;(_==null?void 0:_.contains(document.activeElement))&&((V=g.viewport)==null||V.focus()),i()}),N=v.useCallback(b=>{!b||b===1/0||(window.clearTimeout(P.current),E.current=new Date().getTime(),P.current=window.setTimeout(q,b))},[q]);v.useEffect(()=>{const b=g.viewport;if(b){const V=()=>{N(R.current),u==null||u()},te=()=>{const W=new Date().getTime()-E.current;R.current=R.current-W,window.clearTimeout(P.current),c==null||c()};return b.addEventListener(_m,te),b.addEventListener(bm,V),()=>{b.removeEventListener(_m,te),b.removeEventListener(bm,V)}}},[g.viewport,j,c,u,N]),v.useEffect(()=>{o&&!g.isClosePausedRef.current&&N(j)},[o,j,g.isClosePausedRef,N]),v.useEffect(()=>(A(),()=>L()),[A,L]);const F=v.useMemo(()=>_?uj(_):null,[_]);return g.viewport?l.jsxs(l.Fragment,{children:[F&&l.jsx(R6,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:F}),l.jsx(E6,{scope:r,onClose:q,children:Ns.createPortal(l.jsx(oy.ItemSlot,{scope:r,children:l.jsx(vD,{asChild:!0,onEscapeKeyDown:ce(a,()=>{g.isFocusedToastEscapeKeyDownRef.current||q(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(Re.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":g.swipeDirection,...x,ref:h,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ce(e.onKeyDown,b=>{b.key==="Escape"&&(a==null||a(b.nativeEvent),b.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,q()))}),onPointerDown:ce(e.onPointerDown,b=>{b.button===0&&(w.current={x:b.clientX,y:b.clientY})}),onPointerMove:ce(e.onPointerMove,b=>{if(!w.current)return;const V=b.clientX-w.current.x,te=b.clientY-w.current.y,W=!!C.current,Z=["left","right"].includes(g.swipeDirection),I=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,Q=Z?I(0,V):0,z=Z?0:I(0,te),$=b.pointerType==="touch"?10:2,fe={x:Q,y:z},ne={originalEvent:b,delta:fe};W?(C.current=fe,Su(k6,f,ne,{discrete:!1})):ow(fe,g.swipeDirection,$)?(C.current=fe,Su(S6,d,ne,{discrete:!1}),b.target.setPointerCapture(b.pointerId)):(Math.abs(V)>$||Math.abs(te)>$)&&(w.current=null)}),onPointerUp:ce(e.onPointerUp,b=>{const V=C.current,te=b.target;if(te.hasPointerCapture(b.pointerId)&&te.releasePointerCapture(b.pointerId),C.current=null,w.current=null,V){const W=b.currentTarget,Z={originalEvent:b,delta:V};ow(V,g.swipeDirection,g.swipeThreshold)?Su(j6,y,Z,{discrete:!0}):Su(C6,m,Z,{discrete:!0}),W.addEventListener("click",I=>I.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),R6=e=>{const{__scopeToast:t,children:r,...n}=e,s=Yf(Zf,t),[o,i]=v.useState(!1),[a,c]=v.useState(!1);return D6(()=>i(!0)),v.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:l.jsx(kc,{asChild:!0,children:l.jsx(Ic,{...n,children:o&&l.jsxs(l.Fragment,{children:[s.label," ",r]})})})},P6="ToastTitle",sj=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});sj.displayName=P6;var A6="ToastDescription",oj=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});oj.displayName=A6;var ij="ToastAction",aj=v.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?l.jsx(cj,{altText:r,asChild:!0,children:l.jsx(iy,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${ij}\`. Expected non-empty \`string\`.`),null)});aj.displayName=ij;var lj="ToastClose",iy=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,s=N6(lj,r);return l.jsx(cj,{asChild:!0,children:l.jsx(Re.button,{type:"button",...n,ref:t,onClick:ce(e.onClick,s.onClose)})})});iy.displayName=lj;var cj=v.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...s}=e;return l.jsx(Re.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:t})});function uj(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),O6(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",o=n.dataset.radixToastAnnounceExclude==="";if(!s)if(o){const i=n.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...uj(n))}}),t}function Su(e,t,r,{discrete:n}){const s=r.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?$g(s,o):s.dispatchEvent(o)}var ow=(e,t,r=0)=>{const n=Math.abs(e.x),s=Math.abs(e.y),o=n>s;return t==="left"||t==="right"?o&&n>r:!o&&s>r};function D6(e=()=>{}){const t=Dt(e);Jt(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function O6(e){return e.nodeType===e.ELEMENT_NODE}function M6(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Jh(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var I6=JC,dj=tj,fj=nj,hj=sj,pj=oj,mj=aj,gj=iy;const L6=I6,vj=v.forwardRef(({className:e,...t},r)=>l.jsx(dj,{ref:r,className:ae("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));vj.displayName=dj.displayName;const F6=_c("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),yj=v.forwardRef(({className:e,variant:t,...r},n)=>l.jsx(fj,{ref:n,className:ae(F6({variant:t}),e),...r}));yj.displayName=fj.displayName;const z6=v.forwardRef(({className:e,...t},r)=>l.jsx(mj,{ref:r,className:ae("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));z6.displayName=mj.displayName;const xj=v.forwardRef(({className:e,...t},r)=>l.jsx(gj,{ref:r,className:ae("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:l.jsx(Fg,{className:"h-4 w-4"})}));xj.displayName=gj.displayName;const wj=v.forwardRef(({className:e,...t},r)=>l.jsx(hj,{ref:r,className:ae("text-sm font-semibold",e),...t}));wj.displayName=hj.displayName;const _j=v.forwardRef(({className:e,...t},r)=>l.jsx(pj,{ref:r,className:ae("text-sm opacity-90",e),...t}));_j.displayName=pj.displayName;const U6=1,$6=1e6;let ep=0;function V6(){return ep=(ep+1)%Number.MAX_SAFE_INTEGER,ep.toString()}const tp=new Map,iw=e=>{if(tp.has(e))return;const t=setTimeout(()=>{tp.delete(e),Sl({type:"REMOVE_TOAST",toastId:e})},$6);tp.set(e,t)},W6=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,U6)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?iw(r):e.toasts.forEach(n=>{iw(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Yu=[];let Zu={toasts:[]};function Sl(e){Zu=W6(Zu,e),Yu.forEach(t=>{t(Zu)})}function B6({...e}){const t=V6(),r=s=>Sl({type:"UPDATE_TOAST",toast:{...s,id:t}}),n=()=>Sl({type:"DISMISS_TOAST",toastId:t});return Sl({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||n()}}}),{id:t,dismiss:n,update:r}}function qn(){const[e,t]=v.useState(Zu);return v.useEffect(()=>(Yu.push(t),()=>{const r=Yu.indexOf(t);r>-1&&Yu.splice(r,1)}),[e]),{...e,toast:B6,dismiss:r=>Sl({type:"DISMISS_TOAST",toastId:r})}}function ay(){const{toasts:e}=qn();return l.jsxs(L6,{children:[e.map(function({id:t,title:r,description:n,action:s,...o}){return l.jsxs(yj,{...o,children:[l.jsxs("div",{className:"grid gap-1",children:[r&&l.jsx(wj,{children:r}),n&&l.jsx(_j,{children:n})]}),s,l.jsx(xj,{})]},t)}),l.jsx(vj,{})]})}function ku(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var bj={exports:{}};/*! +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},d6=CC,f6=jC,h6=EC,LC=NC,FC=TC,zC=OC,UC=IC,$C=PC,VC=DC;const WC=d6,BC=f6,p6=h6,HC=v.forwardRef(({className:e,...t},r)=>l.jsx(LC,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));HC.displayName=LC.displayName;const qv=v.forwardRef(({className:e,...t},r)=>l.jsxs(p6,{children:[l.jsx(HC,{}),l.jsx(FC,{ref:r,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));qv.displayName=FC.displayName;const Xv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});Xv.displayName="AlertDialogHeader";const Qv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Qv.displayName="AlertDialogFooter";const Jv=v.forwardRef(({className:e,...t},r)=>l.jsx($C,{ref:r,className:ae("text-lg font-semibold",e),...t}));Jv.displayName=$C.displayName;const ey=v.forwardRef(({className:e,...t},r)=>l.jsx(VC,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));ey.displayName=VC.displayName;const ty=v.forwardRef(({className:e,...t},r)=>l.jsx(zC,{ref:r,className:ae(xf(),e),...t}));ty.displayName=zC.displayName;const ry=v.forwardRef(({className:e,...t},r)=>l.jsx(UC,{ref:r,className:ae(xf({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));ry.displayName=UC.displayName;function YC(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ny="Switch",[m6,C$]=xr(ny),[g6,v6]=m6(ny),ZC=v.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:o,required:i,disabled:a,value:c="on",onCheckedChange:u,...d}=e,[f,m]=v.useState(null),y=Ke(t,h=>m(h)),x=v.useRef(!1),g=f?!!f.closest("form"):!0,[_=!1,p]=on({prop:s,defaultProp:o,onChange:u});return l.jsxs(g6,{scope:r,checked:_,disabled:a,children:[l.jsx(Re.button,{type:"button",role:"switch","aria-checked":_,"aria-required":i,"data-state":qC(_),"data-disabled":a?"":void 0,disabled:a,value:c,...d,ref:y,onClick:ce(e.onClick,h=>{p(w=>!w),g&&(x.current=h.isPropagationStopped(),x.current||h.stopPropagation())})}),g&&l.jsx(y6,{control:f,bubbles:!x.current,name:n,value:c,checked:_,required:i,disabled:a,style:{transform:"translateX(-100%)"}})]})});ZC.displayName=ny;var KC="SwitchThumb",GC=v.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,s=v6(KC,r);return l.jsx(Re.span,{"data-state":qC(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t})});GC.displayName=KC;var y6=e=>{const{control:t,checked:r,bubbles:n=!0,...s}=e,o=v.useRef(null),i=YC(r),a=Sb(t);return v.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(i!==r&&f){const m=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(m)}},[i,r,n]),l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function qC(e){return e?"checked":"unchecked"}var XC=ZC,x6=GC;const Lc=v.forwardRef(({className:e,...t},r)=>l.jsx(XC,{className:ae("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:l.jsx(x6,{className:ae("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Lc.displayName=XC.displayName;var sy="ToastProvider",[oy,w6,_6]=bc("Toast"),[QC,j$]=xr("Toast",[_6]),[b6,Yf]=QC(sy),JC=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:i}=e,[a,c]=v.useState(null),[u,d]=v.useState(0),f=v.useRef(!1),m=v.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${sy}\`. Expected non-empty \`string\`.`),l.jsx(oy.Provider,{scope:t,children:l.jsx(b6,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:o,toastCount:u,viewport:a,onViewportChange:c,onToastAdd:v.useCallback(()=>d(y=>y+1),[]),onToastRemove:v.useCallback(()=>d(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:m,children:i})})};JC.displayName=sy;var ej="ToastViewport",S6=["F8"],_m="toast.viewportPause",bm="toast.viewportResume",tj=v.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=S6,label:s="Notifications ({hotkey})",...o}=e,i=Yf(ej,r),a=w6(r),c=v.useRef(null),u=v.useRef(null),d=v.useRef(null),f=v.useRef(null),m=Ke(t,f,i.onViewportChange),y=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=i.toastCount>0;v.useEffect(()=>{const _=p=>{var w;n.every(C=>p[C]||p.code===C)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[n]),v.useEffect(()=>{const _=c.current,p=f.current;if(x&&_&&p){const h=()=>{if(!i.isClosePausedRef.current){const E=new CustomEvent(_m);p.dispatchEvent(E),i.isClosePausedRef.current=!0}},w=()=>{if(i.isClosePausedRef.current){const E=new CustomEvent(bm);p.dispatchEvent(E),i.isClosePausedRef.current=!1}},C=E=>{!_.contains(E.relatedTarget)&&w()},j=()=>{_.contains(document.activeElement)||w()};return _.addEventListener("focusin",h),_.addEventListener("focusout",C),_.addEventListener("pointermove",h),_.addEventListener("pointerleave",j),window.addEventListener("blur",h),window.addEventListener("focus",w),()=>{_.removeEventListener("focusin",h),_.removeEventListener("focusout",C),_.removeEventListener("pointermove",h),_.removeEventListener("pointerleave",j),window.removeEventListener("blur",h),window.removeEventListener("focus",w)}}},[x,i.isClosePausedRef]);const g=v.useCallback(({tabbingDirection:_})=>{const h=a().map(w=>{const C=w.ref.current,j=[C,...I6(C)];return _==="forwards"?j:j.reverse()});return(_==="forwards"?h.reverse():h).flat()},[a]);return v.useEffect(()=>{const _=f.current;if(_){const p=h=>{var j,E,R;const w=h.altKey||h.ctrlKey||h.metaKey;if(h.key==="Tab"&&!w){const P=document.activeElement,A=h.shiftKey;if(h.target===_&&A){(j=u.current)==null||j.focus();return}const N=g({tabbingDirection:A?"backwards":"forwards"}),F=N.findIndex(b=>b===P);Jh(N.slice(F+1))?h.preventDefault():A?(E=u.current)==null||E.focus():(R=d.current)==null||R.focus()}};return _.addEventListener("keydown",p),()=>_.removeEventListener("keydown",p)}},[a,g]),l.jsxs(yD,{ref:c,role:"region","aria-label":s.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&l.jsx(Sm,{ref:u,onFocusFromOutsideViewport:()=>{const _=g({tabbingDirection:"forwards"});Jh(_)}}),l.jsx(oy.Slot,{scope:r,children:l.jsx(Re.ol,{tabIndex:-1,...o,ref:m})}),x&&l.jsx(Sm,{ref:d,onFocusFromOutsideViewport:()=>{const _=g({tabbingDirection:"backwards"});Jh(_)}})]})});tj.displayName=ej;var rj="ToastFocusProxy",Sm=v.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,o=Yf(rj,r);return l.jsx(Ic,{"aria-hidden":!0,tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const a=i.relatedTarget;!((u=o.viewport)!=null&&u.contains(a))&&n()}})});Sm.displayName=rj;var Zf="Toast",k6="toast.swipeStart",C6="toast.swipeMove",j6="toast.swipeCancel",E6="toast.swipeEnd",nj=v.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:o,...i}=e,[a=!0,c]=on({prop:n,defaultProp:s,onChange:o});return l.jsx(ur,{present:r||a,children:l.jsx(R6,{open:a,...i,ref:t,onClose:()=>c(!1),onPause:Dt(e.onPause),onResume:Dt(e.onResume),onSwipeStart:ce(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ce(e.onSwipeMove,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:ce(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ce(e.onSwipeEnd,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});nj.displayName=Zf;var[N6,T6]=QC(Zf,{onClose(){}}),R6=v.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:o,onClose:i,onEscapeKeyDown:a,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:m,onSwipeEnd:y,...x}=e,g=Yf(Zf,r),[_,p]=v.useState(null),h=Ke(t,b=>p(b)),w=v.useRef(null),C=v.useRef(null),j=s||g.duration,E=v.useRef(0),R=v.useRef(j),P=v.useRef(0),{onToastAdd:A,onToastRemove:L}=g,q=Dt(()=>{var V;(_==null?void 0:_.contains(document.activeElement))&&((V=g.viewport)==null||V.focus()),i()}),N=v.useCallback(b=>{!b||b===1/0||(window.clearTimeout(P.current),E.current=new Date().getTime(),P.current=window.setTimeout(q,b))},[q]);v.useEffect(()=>{const b=g.viewport;if(b){const V=()=>{N(R.current),u==null||u()},te=()=>{const W=new Date().getTime()-E.current;R.current=R.current-W,window.clearTimeout(P.current),c==null||c()};return b.addEventListener(_m,te),b.addEventListener(bm,V),()=>{b.removeEventListener(_m,te),b.removeEventListener(bm,V)}}},[g.viewport,j,c,u,N]),v.useEffect(()=>{o&&!g.isClosePausedRef.current&&N(j)},[o,j,g.isClosePausedRef,N]),v.useEffect(()=>(A(),()=>L()),[A,L]);const F=v.useMemo(()=>_?uj(_):null,[_]);return g.viewport?l.jsxs(l.Fragment,{children:[F&&l.jsx(P6,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:F}),l.jsx(N6,{scope:r,onClose:q,children:Ns.createPortal(l.jsx(oy.ItemSlot,{scope:r,children:l.jsx(vD,{asChild:!0,onEscapeKeyDown:ce(a,()=>{g.isFocusedToastEscapeKeyDownRef.current||q(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(Re.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":g.swipeDirection,...x,ref:h,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ce(e.onKeyDown,b=>{b.key==="Escape"&&(a==null||a(b.nativeEvent),b.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,q()))}),onPointerDown:ce(e.onPointerDown,b=>{b.button===0&&(w.current={x:b.clientX,y:b.clientY})}),onPointerMove:ce(e.onPointerMove,b=>{if(!w.current)return;const V=b.clientX-w.current.x,te=b.clientY-w.current.y,W=!!C.current,Z=["left","right"].includes(g.swipeDirection),I=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,Q=Z?I(0,V):0,z=Z?0:I(0,te),$=b.pointerType==="touch"?10:2,fe={x:Q,y:z},ne={originalEvent:b,delta:fe};W?(C.current=fe,Su(C6,f,ne,{discrete:!1})):ow(fe,g.swipeDirection,$)?(C.current=fe,Su(k6,d,ne,{discrete:!1}),b.target.setPointerCapture(b.pointerId)):(Math.abs(V)>$||Math.abs(te)>$)&&(w.current=null)}),onPointerUp:ce(e.onPointerUp,b=>{const V=C.current,te=b.target;if(te.hasPointerCapture(b.pointerId)&&te.releasePointerCapture(b.pointerId),C.current=null,w.current=null,V){const W=b.currentTarget,Z={originalEvent:b,delta:V};ow(V,g.swipeDirection,g.swipeThreshold)?Su(E6,y,Z,{discrete:!0}):Su(j6,m,Z,{discrete:!0}),W.addEventListener("click",I=>I.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),P6=e=>{const{__scopeToast:t,children:r,...n}=e,s=Yf(Zf,t),[o,i]=v.useState(!1),[a,c]=v.useState(!1);return O6(()=>i(!0)),v.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:l.jsx(kc,{asChild:!0,children:l.jsx(Ic,{...n,children:o&&l.jsxs(l.Fragment,{children:[s.label," ",r]})})})},A6="ToastTitle",sj=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});sj.displayName=A6;var D6="ToastDescription",oj=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});oj.displayName=D6;var ij="ToastAction",aj=v.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?l.jsx(cj,{altText:r,asChild:!0,children:l.jsx(iy,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${ij}\`. Expected non-empty \`string\`.`),null)});aj.displayName=ij;var lj="ToastClose",iy=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,s=T6(lj,r);return l.jsx(cj,{asChild:!0,children:l.jsx(Re.button,{type:"button",...n,ref:t,onClick:ce(e.onClick,s.onClose)})})});iy.displayName=lj;var cj=v.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...s}=e;return l.jsx(Re.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:t})});function uj(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),M6(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",o=n.dataset.radixToastAnnounceExclude==="";if(!s)if(o){const i=n.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...uj(n))}}),t}function Su(e,t,r,{discrete:n}){const s=r.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?$g(s,o):s.dispatchEvent(o)}var ow=(e,t,r=0)=>{const n=Math.abs(e.x),s=Math.abs(e.y),o=n>s;return t==="left"||t==="right"?o&&n>r:!o&&s>r};function O6(e=()=>{}){const t=Dt(e);Jt(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function M6(e){return e.nodeType===e.ELEMENT_NODE}function I6(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Jh(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var L6=JC,dj=tj,fj=nj,hj=sj,pj=oj,mj=aj,gj=iy;const F6=L6,vj=v.forwardRef(({className:e,...t},r)=>l.jsx(dj,{ref:r,className:ae("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));vj.displayName=dj.displayName;const z6=_c("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),yj=v.forwardRef(({className:e,variant:t,...r},n)=>l.jsx(fj,{ref:n,className:ae(z6({variant:t}),e),...r}));yj.displayName=fj.displayName;const U6=v.forwardRef(({className:e,...t},r)=>l.jsx(mj,{ref:r,className:ae("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));U6.displayName=mj.displayName;const xj=v.forwardRef(({className:e,...t},r)=>l.jsx(gj,{ref:r,className:ae("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:l.jsx(Fg,{className:"h-4 w-4"})}));xj.displayName=gj.displayName;const wj=v.forwardRef(({className:e,...t},r)=>l.jsx(hj,{ref:r,className:ae("text-sm font-semibold",e),...t}));wj.displayName=hj.displayName;const _j=v.forwardRef(({className:e,...t},r)=>l.jsx(pj,{ref:r,className:ae("text-sm opacity-90",e),...t}));_j.displayName=pj.displayName;const $6=1,V6=1e6;let ep=0;function W6(){return ep=(ep+1)%Number.MAX_SAFE_INTEGER,ep.toString()}const tp=new Map,iw=e=>{if(tp.has(e))return;const t=setTimeout(()=>{tp.delete(e),Sl({type:"REMOVE_TOAST",toastId:e})},V6);tp.set(e,t)},B6=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,$6)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?iw(r):e.toasts.forEach(n=>{iw(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Yu=[];let Zu={toasts:[]};function Sl(e){Zu=B6(Zu,e),Yu.forEach(t=>{t(Zu)})}function H6({...e}){const t=W6(),r=s=>Sl({type:"UPDATE_TOAST",toast:{...s,id:t}}),n=()=>Sl({type:"DISMISS_TOAST",toastId:t});return Sl({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||n()}}}),{id:t,dismiss:n,update:r}}function qn(){const[e,t]=v.useState(Zu);return v.useEffect(()=>(Yu.push(t),()=>{const r=Yu.indexOf(t);r>-1&&Yu.splice(r,1)}),[e]),{...e,toast:H6,dismiss:r=>Sl({type:"DISMISS_TOAST",toastId:r})}}function ay(){const{toasts:e}=qn();return l.jsxs(F6,{children:[e.map(function({id:t,title:r,description:n,action:s,...o}){return l.jsxs(yj,{...o,children:[l.jsxs("div",{className:"grid gap-1",children:[r&&l.jsx(wj,{children:r}),n&&l.jsx(_j,{children:n})]}),s,l.jsx(xj,{})]},t)}),l.jsx(vj,{})]})}function ku(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var bj={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -301,8 +301,8 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(e,t){(function(r){e.exports=r()})(function(){return function r(n,s,o){function i(u,d){if(!s[u]){if(!n[u]){var f=typeof ku=="function"&&ku;if(!d&&f)return f(u,!0);if(a)return a(u,!0);var m=new Error("Cannot find module '"+u+"'");throw m.code="MODULE_NOT_FOUND",m}var y=s[u]={exports:{}};n[u][0].call(y.exports,function(x){var g=n[u][1][x];return i(g||x)},y,y.exports,r,n,s,o)}return s[u].exports}for(var a=typeof ku=="function"&&ku,c=0;c>2,y=(3&u)<<4|d>>4,x=1>6:64,g=2>4,d=(15&m)<<4|(y=a.indexOf(c.charAt(g++)))>>2,f=(3&y)<<6|(x=a.indexOf(c.charAt(g++))),h[_++]=u,y!==64&&(h[_++]=d),x!==64&&(h[_++]=f);return h}},{"./support":30,"./utils":32}],2:[function(r,n,s){var o=r("./external"),i=r("./stream/DataWorker"),a=r("./stream/Crc32Probe"),c=r("./stream/DataLengthProbe");function u(d,f,m,y,x){this.compressedSize=d,this.uncompressedSize=f,this.crc32=m,this.compression=y,this.compressedContent=x}u.prototype={getContentWorker:function(){var d=new i(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new i(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,m){return d.pipe(new a).pipe(new c("uncompressedSize")).pipe(f.compressWorker(m)).pipe(new c("compressedSize")).withStreamInfo("compression",f)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,s){var o=r("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},s.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,s){var o=r("./utils"),i=function(){for(var a,c=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;c[u]=a}return c}();n.exports=function(a,c){return a!==void 0&&a.length?o.getTypeOf(a)!=="string"?function(u,d,f,m){var y=i,x=m+f;u^=-1;for(var g=m;g>>8^y[255&(u^d[g])];return-1^u}(0|c,a,a.length,0):function(u,d,f,m){var y=i,x=m+f;u^=-1;for(var g=m;g>>8^y[255&(u^d.charCodeAt(g))];return-1^u}(0|c,a,a.length,0):0}},{"./utils":32}],5:[function(r,n,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(r,n,s){var o=null;o=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:o}},{lie:37}],7:[function(r,n,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=r("pako"),a=r("./utils"),c=r("./stream/GenericWorker"),u=o?"uint8array":"array";function d(f,m){c.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=m,this.meta={}}s.magic="\b\0",a.inherits(d,c),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,f.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(m){f.push({data:m,meta:f.meta})}},s.compressWorker=function(f){return new d("Deflate",f)},s.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,s){function o(y,x){var g,_="";for(g=0;g>>=8;return _}function i(y,x,g,_,p,h){var w,C,j=y.file,E=y.compression,R=h!==u.utf8encode,P=a.transformTo("string",h(j.name)),A=a.transformTo("string",u.utf8encode(j.name)),L=j.comment,q=a.transformTo("string",h(L)),N=a.transformTo("string",u.utf8encode(L)),F=A.length!==j.name.length,b=N.length!==L.length,V="",te="",W="",Z=j.dir,I=j.date,Q={crc32:0,compressedSize:0,uncompressedSize:0};x&&!g||(Q.crc32=y.crc32,Q.compressedSize=y.compressedSize,Q.uncompressedSize=y.uncompressedSize);var z=0;x&&(z|=8),R||!F&&!b||(z|=2048);var $=0,fe=0;Z&&($|=16),p==="UNIX"?(fe=798,$|=function(se,Oe){var he=se;return se||(he=Oe?16893:33204),(65535&he)<<16}(j.unixPermissions,Z)):(fe=20,$|=function(se){return 63&(se||0)}(j.dosPermissions)),w=I.getUTCHours(),w<<=6,w|=I.getUTCMinutes(),w<<=5,w|=I.getUTCSeconds()/2,C=I.getUTCFullYear()-1980,C<<=4,C|=I.getUTCMonth()+1,C<<=5,C|=I.getUTCDate(),F&&(te=o(1,1)+o(d(P),4)+A,V+="up"+o(te.length,2)+te),b&&(W=o(1,1)+o(d(q),4)+N,V+="uc"+o(W.length,2)+W);var ne="";return ne+=` -\0`,ne+=o(z,2),ne+=E.magic,ne+=o(w,2),ne+=o(C,2),ne+=o(Q.crc32,4),ne+=o(Q.compressedSize,4),ne+=o(Q.uncompressedSize,4),ne+=o(P.length,2),ne+=o(V.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ne+P+V,dirRecord:f.CENTRAL_FILE_HEADER+o(fe,2)+ne+o(q.length,2)+"\0\0\0\0"+o($,4)+o(_,4)+P+V+q}}var a=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),d=r("../crc32"),f=r("../signature");function m(y,x,g,_){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=g,this.encodeFileName=_,this.streamFiles=y,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(m,c),m.prototype.push=function(y){var x=y.meta.percent||0,g=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(y):(this.bytesWritten+=y.data.length,c.prototype.push.call(this,{data:y.data,meta:{currentFile:this.currentFile,percent:g?(x+100*(g-_-1))/g:100}}))},m.prototype.openedSource=function(y){this.currentSourceOffset=this.bytesWritten,this.currentFile=y.file.name;var x=this.streamFiles&&!y.file.dir;if(x){var g=i(y,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(y){this.accumulate=!1;var x=this.streamFiles&&!y.file.dir,g=i(y,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),x)this.push({data:function(_){return f.DATA_DESCRIPTOR+o(_.crc32,4)+o(_.compressedSize,4)+o(_.uncompressedSize,4)}(y),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var y=this.bytesWritten,x=0;x=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=a,u},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=i},{"../utils":32}],19:[function(r,n,s){var o=r("./Uint8ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var o=r("./DataReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var o=r("./ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var o=r("../utils"),i=r("../support"),a=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),d=r("./Uint8ArrayReader");n.exports=function(f){var m=o.getTypeOf(f);return o.checkSupport(m),m!=="string"||i.uint8array?m==="nodebuffer"?new u(f):i.uint8array?new d(o.transformTo("uint8array",f)):new a(o.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,s){var o=r("./GenericWorker"),i=r("../utils");function a(c){o.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(a,o),a.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var o=r("./GenericWorker"),i=r("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(a,o),a.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}o.inherits(a,i),a.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}i.prototype.processChunk.call(this,c)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(c){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=o.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}o.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,s){function o(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var c=0;c "+i:i}},n.exports=o},{}],29:[function(r,n,s){var o=r("../utils"),i=r("./ConvertWorker"),a=r("./GenericWorker"),c=r("../base64"),u=r("../support"),d=r("../external"),f=null;if(u.nodestream)try{f=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(x,g){return new d.Promise(function(_,p){var h=[],w=x._internalType,C=x._outputType,j=x._mimeType;x.on("data",function(E,R){h.push(E),g&&g(R)}).on("error",function(E){h=[],p(E)}).on("end",function(){try{var E=function(R,P,A){switch(R){case"blob":return o.newBlob(o.transformTo("arraybuffer",P),A);case"base64":return c.encode(P);default:return o.transformTo(R,P)}}(C,function(R,P){var A,L=0,q=null,N=0;for(A=0;A"u")s.blob=!1;else{var o=new ArrayBuffer(0);try{s.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(o),s.blob=i.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var o=r("./utils"),i=r("./support"),a=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function m(){c.call(this,"utf-8 encode")}s.utf8encode=function(y){return i.nodebuffer?a.newBufferFrom(y,"utf-8"):function(x){var g,_,p,h,w,C=x.length,j=0;for(h=0;h>>6:(_<65536?g[w++]=224|_>>>12:(g[w++]=240|_>>>18,g[w++]=128|_>>>12&63),g[w++]=128|_>>>6&63),g[w++]=128|63&_);return g}(y)},s.utf8decode=function(y){return i.nodebuffer?o.transformTo("nodebuffer",y).toString("utf-8"):function(x){var g,_,p,h,w=x.length,C=new Array(2*w);for(g=_=0;g>10&1023,C[_++]=56320|1023&p)}return C.length!==_&&(C.subarray?C=C.subarray(0,_):C.length=_),o.applyFromCharCode(C)}(y=o.transformTo(i.uint8array?"uint8array":"array",y))},o.inherits(f,c),f.prototype.processChunk=function(y){var x=o.transformTo(i.uint8array?"uint8array":"array",y.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var g=x;(x=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),x.set(g,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var _=function(h,w){var C;for((w=w||h.length)>h.length&&(w=h.length),C=w-1;0<=C&&(192&h[C])==128;)C--;return C<0||C===0?w:C+u[h[C]]>w?C:w}(x),p=x;_!==x.length&&(i.uint8array?(p=x.subarray(0,_),this.leftOver=x.subarray(_,x.length)):(p=x.slice(0,_),this.leftOver=x.slice(_,x.length))),this.push({data:s.utf8decode(p),meta:y.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=f,o.inherits(m,c),m.prototype.processChunk=function(y){this.push({data:s.utf8encode(y.data),meta:y.meta})},s.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var o=r("./support"),i=r("./base64"),a=r("./nodejsUtils"),c=r("./external");function u(g){return g}function d(g,_){for(var p=0;p>8;this.dir=!!(16&this.externalFileAttributes),y==0&&(this.dosPermissions=63&this.externalFileAttributes),y==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var y=o(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=y.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=y.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=y.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=y.readInt(4))}},readExtraFields:function(y){var x,g,_,p=y.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});y.index+4>>6:(y<65536?m[_++]=224|y>>>12:(m[_++]=240|y>>>18,m[_++]=128|y>>>12&63),m[_++]=128|y>>>6&63),m[_++]=128|63&y);return m},s.buf2binstring=function(f){return d(f,f.length)},s.binstring2buf=function(f){for(var m=new o.Buf8(f.length),y=0,x=m.length;y>10&1023,h[x++]=56320|1023&g)}return d(h,x)},s.utf8border=function(f,m){var y;for((m=m||f.length)>f.length&&(m=f.length),y=m-1;0<=y&&(192&f[y])==128;)y--;return y<0||y===0?m:y+c[f[y]]>m?y:m}},{"./common":41}],43:[function(r,n,s){n.exports=function(o,i,a,c){for(var u=65535&o|0,d=o>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3>>1:i>>>1;a[c]=i}return a}();n.exports=function(i,a,c,u){var d=o,f=u+c;i^=-1;for(var m=u;m>>8^d[255&(i^a[m])];return-1^i}},{}],46:[function(r,n,s){var o,i=r("../utils/common"),a=r("./trees"),c=r("./adler32"),u=r("./crc32"),d=r("./messages"),f=0,m=4,y=0,x=-2,g=-1,_=4,p=2,h=8,w=9,C=286,j=30,E=19,R=2*C+1,P=15,A=3,L=258,q=L+A+1,N=42,F=113,b=1,V=2,te=3,W=4;function Z(k,J){return k.msg=d[J],J}function I(k){return(k<<1)-(4k.avail_out&&(K=k.avail_out),K!==0&&(i.arraySet(k.output,J.pending_buf,J.pending_out,K,k.next_out),k.next_out+=K,J.pending_out+=K,k.total_out+=K,k.avail_out-=K,J.pending-=K,J.pending===0&&(J.pending_out=0))}function $(k,J){a._tr_flush_block(k,0<=k.block_start?k.block_start:-1,k.strstart-k.block_start,J),k.block_start=k.strstart,z(k.strm)}function fe(k,J){k.pending_buf[k.pending++]=J}function ne(k,J){k.pending_buf[k.pending++]=J>>>8&255,k.pending_buf[k.pending++]=255&J}function se(k,J){var K,D,S=k.max_chain_length,T=k.strstart,O=k.prev_length,Y=k.nice_match,M=k.strstart>k.w_size-q?k.strstart-(k.w_size-q):0,H=k.window,X=k.w_mask,ee=k.prev,me=k.strstart+L,Ye=H[T+O-1],Ue=H[T+O];k.prev_length>=k.good_match&&(S>>=2),Y>k.lookahead&&(Y=k.lookahead);do if(H[(K=J)+O]===Ue&&H[K+O-1]===Ye&&H[K]===H[T]&&H[++K]===H[T+1]){T+=2,K++;do;while(H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&TM&&--S!=0);return O<=k.lookahead?O:k.lookahead}function Oe(k){var J,K,D,S,T,O,Y,M,H,X,ee=k.w_size;do{if(S=k.window_size-k.lookahead-k.strstart,k.strstart>=ee+(ee-q)){for(i.arraySet(k.window,k.window,ee,ee,0),k.match_start-=ee,k.strstart-=ee,k.block_start-=ee,J=K=k.hash_size;D=k.head[--J],k.head[J]=ee<=D?D-ee:0,--K;);for(J=K=ee;D=k.prev[--J],k.prev[J]=ee<=D?D-ee:0,--K;);S+=ee}if(k.strm.avail_in===0)break;if(O=k.strm,Y=k.window,M=k.strstart+k.lookahead,H=S,X=void 0,X=O.avail_in,H=A)for(T=k.strstart-k.insert,k.ins_h=k.window[T],k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A)if(D=a._tr_tally(k,k.strstart-k.match_start,k.match_length-A),k.lookahead-=k.match_length,k.match_length<=k.max_lazy_match&&k.lookahead>=A){for(k.match_length--;k.strstart++,k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A&&k.match_length<=k.prev_length){for(S=k.strstart+k.lookahead-A,D=a._tr_tally(k,k.strstart-1-k.prev_match,k.prev_length-A),k.lookahead-=k.prev_length-1,k.prev_length-=2;++k.strstart<=S&&(k.ins_h=(k.ins_h<k.pending_buf_size-5&&(K=k.pending_buf_size-5);;){if(k.lookahead<=1){if(Oe(k),k.lookahead===0&&J===f)return b;if(k.lookahead===0)break}k.strstart+=k.lookahead,k.lookahead=0;var D=k.block_start+K;if((k.strstart===0||k.strstart>=D)&&(k.lookahead=k.strstart-D,k.strstart=D,$(k,!1),k.strm.avail_out===0)||k.strstart-k.block_start>=k.w_size-q&&($(k,!1),k.strm.avail_out===0))return b}return k.insert=0,J===m?($(k,!0),k.strm.avail_out===0?te:W):(k.strstart>k.block_start&&($(k,!1),k.strm.avail_out),b)}),new ke(4,4,8,4,he),new ke(4,5,16,8,he),new ke(4,6,32,32,he),new ke(4,4,16,16,ye),new ke(8,16,32,32,ye),new ke(8,16,128,128,ye),new ke(8,32,128,256,ye),new ke(32,128,258,1024,ye),new ke(32,258,258,4096,ye)],s.deflateInit=function(k,J){return nt(k,J,h,15,8,0)},s.deflateInit2=nt,s.deflateReset=Pe,s.deflateResetKeep=Me,s.deflateSetHeader=function(k,J){return k&&k.state?k.state.wrap!==2?x:(k.state.gzhead=J,y):x},s.deflate=function(k,J){var K,D,S,T;if(!k||!k.state||5>8&255),fe(D,D.gzhead.time>>16&255),fe(D,D.gzhead.time>>24&255),fe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),fe(D,255&D.gzhead.os),D.gzhead.extra&&D.gzhead.extra.length&&(fe(D,255&D.gzhead.extra.length),fe(D,D.gzhead.extra.length>>8&255)),D.gzhead.hcrc&&(k.adler=u(k.adler,D.pending_buf,D.pending,0)),D.gzindex=0,D.status=69):(fe(D,0),fe(D,0),fe(D,0),fe(D,0),fe(D,0),fe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),fe(D,3),D.status=F);else{var O=h+(D.w_bits-8<<4)<<8;O|=(2<=D.strategy||D.level<2?0:D.level<6?1:D.level===6?2:3)<<6,D.strstart!==0&&(O|=32),O+=31-O%31,D.status=F,ne(D,O),D.strstart!==0&&(ne(D,k.adler>>>16),ne(D,65535&k.adler)),k.adler=1}if(D.status===69)if(D.gzhead.extra){for(S=D.pending;D.gzindex<(65535&D.gzhead.extra.length)&&(D.pending!==D.pending_buf_size||(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending!==D.pending_buf_size));)fe(D,255&D.gzhead.extra[D.gzindex]),D.gzindex++;D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),D.gzindex===D.gzhead.extra.length&&(D.gzindex=0,D.status=73)}else D.status=73;if(D.status===73)if(D.gzhead.name){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){T=1;break}T=D.gzindexS&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),T===0&&(D.gzindex=0,D.status=91)}else D.status=91;if(D.status===91)if(D.gzhead.comment){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){T=1;break}T=D.gzindexS&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),T===0&&(D.status=103)}else D.status=103;if(D.status===103&&(D.gzhead.hcrc?(D.pending+2>D.pending_buf_size&&z(k),D.pending+2<=D.pending_buf_size&&(fe(D,255&k.adler),fe(D,k.adler>>8&255),k.adler=0,D.status=F)):D.status=F),D.pending!==0){if(z(k),k.avail_out===0)return D.last_flush=-1,y}else if(k.avail_in===0&&I(J)<=I(K)&&J!==m)return Z(k,-5);if(D.status===666&&k.avail_in!==0)return Z(k,-5);if(k.avail_in!==0||D.lookahead!==0||J!==f&&D.status!==666){var Y=D.strategy===2?function(M,H){for(var X;;){if(M.lookahead===0&&(Oe(M),M.lookahead===0)){if(H===f)return b;break}if(M.match_length=0,X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===m?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):D.strategy===3?function(M,H){for(var X,ee,me,Ye,Ue=M.window;;){if(M.lookahead<=L){if(Oe(M),M.lookahead<=L&&H===f)return b;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=A&&0M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=A?(X=a._tr_tally(M,1,M.match_length-A),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===m?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):o[D.level].func(D,J);if(Y!==te&&Y!==W||(D.status=666),Y===b||Y===te)return k.avail_out===0&&(D.last_flush=-1),y;if(Y===V&&(J===1?a._tr_align(D):J!==5&&(a._tr_stored_block(D,0,0,!1),J===3&&(Q(D.head),D.lookahead===0&&(D.strstart=0,D.block_start=0,D.insert=0))),z(k),k.avail_out===0))return D.last_flush=-1,y}return J!==m?y:D.wrap<=0?1:(D.wrap===2?(fe(D,255&k.adler),fe(D,k.adler>>8&255),fe(D,k.adler>>16&255),fe(D,k.adler>>24&255),fe(D,255&k.total_in),fe(D,k.total_in>>8&255),fe(D,k.total_in>>16&255),fe(D,k.total_in>>24&255)):(ne(D,k.adler>>>16),ne(D,65535&k.adler)),z(k),0=K.w_size&&(T===0&&(Q(K.head),K.strstart=0,K.block_start=0,K.insert=0),H=new i.Buf8(K.w_size),i.arraySet(H,J,X-K.w_size,K.w_size,0),J=H,X=K.w_size),O=k.avail_in,Y=k.next_in,M=k.input,k.avail_in=X,k.next_in=0,k.input=J,Oe(K);K.lookahead>=A;){for(D=K.strstart,S=K.lookahead-(A-1);K.ins_h=(K.ins_h<>>=A=P>>>24,w-=A,(A=P>>>16&255)===0)V[d++]=65535&P;else{if(!(16&A)){if(!(64&A)){P=C[(65535&P)+(h&(1<>>=A,w-=A),w<15&&(h+=b[c++]<>>=A=P>>>24,w-=A,!(16&(A=P>>>16&255))){if(!(64&A)){P=j[(65535&P)+(h&(1<>>=A,w-=A,(A=d-f)>3,h&=(1<<(w-=L<<3))-1,o.next_in=c,o.next_out=d,o.avail_in=c>>24&255)+(N>>>8&65280)+((65280&N)<<8)+((255&N)<<24)}function h(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(N){var F;return N&&N.state?(F=N.state,N.total_in=N.total_out=F.total=0,N.msg="",F.wrap&&(N.adler=1&F.wrap),F.mode=x,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new o.Buf32(g),F.distcode=F.distdyn=new o.Buf32(_),F.sane=1,F.back=-1,m):y}function C(N){var F;return N&&N.state?((F=N.state).wsize=0,F.whave=0,F.wnext=0,w(N)):y}function j(N,F){var b,V;return N&&N.state?(V=N.state,F<0?(b=0,F=-F):(b=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15=W.wsize?(o.arraySet(W.window,F,b-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(V<(te=W.wsize-W.wnext)&&(te=V),o.arraySet(W.window,F,b-V,te,W.wnext),(V-=te)?(o.arraySet(W.window,F,b-V,V,0),W.wnext=V,W.whave=W.wsize):(W.wnext+=te,W.wnext===W.wsize&&(W.wnext=0),W.whave>>8&255,b.check=a(b.check,T,2,0),$=z=0,b.mode=2;break}if(b.flags=0,b.head&&(b.head.done=!1),!(1&b.wrap)||(((255&z)<<8)+(z>>8))%31){N.msg="incorrect header check",b.mode=30;break}if((15&z)!=8){N.msg="unknown compression method",b.mode=30;break}if($-=4,k=8+(15&(z>>>=4)),b.wbits===0)b.wbits=k;else if(k>b.wbits){N.msg="invalid window size",b.mode=30;break}b.dmax=1<>8&1),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0,b.mode=3;case 3:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.time=z),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,T[2]=z>>>16&255,T[3]=z>>>24&255,b.check=a(b.check,T,4,0)),$=z=0,b.mode=4;case 4:for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.xflags=255&z,b.head.os=z>>8),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0,b.mode=5;case 5:if(1024&b.flags){for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.length=z,b.head&&(b.head.extra_len=z),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0}else b.head&&(b.head.extra=null);b.mode=6;case 6:if(1024&b.flags&&(I<(se=b.length)&&(se=I),se&&(b.head&&(k=b.head.extra_len-b.length,b.head.extra||(b.head.extra=new Array(b.head.extra_len)),o.arraySet(b.head.extra,V,W,se,k)),512&b.flags&&(b.check=a(b.check,V,se,W)),I-=se,W+=se,b.length-=se),b.length))break e;b.length=0,b.mode=7;case 7:if(2048&b.flags){if(I===0)break e;for(se=0;k=V[W+se++],b.head&&k&&b.length<65536&&(b.head.name+=String.fromCharCode(k)),k&&se>9&1,b.head.done=!0),N.adler=b.check=0,b.mode=12;break;case 10:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}N.adler=b.check=p(z),$=z=0,b.mode=11;case 11:if(b.havedict===0)return N.next_out=Z,N.avail_out=Q,N.next_in=W,N.avail_in=I,b.hold=z,b.bits=$,2;N.adler=b.check=1,b.mode=12;case 12:if(F===5||F===6)break e;case 13:if(b.last){z>>>=7&$,$-=7&$,b.mode=27;break}for(;$<3;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}switch(b.last=1&z,$-=1,3&(z>>>=1)){case 0:b.mode=14;break;case 1:if(L(b),b.mode=20,F!==6)break;z>>>=2,$-=2;break e;case 2:b.mode=17;break;case 3:N.msg="invalid block type",b.mode=30}z>>>=2,$-=2;break;case 14:for(z>>>=7&$,$-=7&$;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if((65535&z)!=(z>>>16^65535)){N.msg="invalid stored block lengths",b.mode=30;break}if(b.length=65535&z,$=z=0,b.mode=15,F===6)break e;case 15:b.mode=16;case 16:if(se=b.length){if(I>>=5,$-=5,b.ndist=1+(31&z),z>>>=5,$-=5,b.ncode=4+(15&z),z>>>=4,$-=4,286>>=3,$-=3}for(;b.have<19;)b.lens[O[b.have++]]=0;if(b.lencode=b.lendyn,b.lenbits=7,K={bits:b.lenbits},J=u(0,b.lens,0,19,b.lencode,0,b.work,K),b.lenbits=K.bits,J){N.msg="invalid code lengths set",b.mode=30;break}b.have=0,b.mode=19;case 19:for(;b.have>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(Fe<16)z>>>=ye,$-=ye,b.lens[b.have++]=Fe;else{if(Fe===16){for(D=ye+2;$>>=ye,$-=ye,b.have===0){N.msg="invalid bit length repeat",b.mode=30;break}k=b.lens[b.have-1],se=3+(3&z),z>>>=2,$-=2}else if(Fe===17){for(D=ye+3;$>>=ye)),z>>>=3,$-=3}else{for(D=ye+7;$>>=ye)),z>>>=7,$-=7}if(b.have+se>b.nlen+b.ndist){N.msg="invalid bit length repeat",b.mode=30;break}for(;se--;)b.lens[b.have++]=k}}if(b.mode===30)break;if(b.lens[256]===0){N.msg="invalid code -- missing end-of-block",b.mode=30;break}if(b.lenbits=9,K={bits:b.lenbits},J=u(d,b.lens,0,b.nlen,b.lencode,0,b.work,K),b.lenbits=K.bits,J){N.msg="invalid literal/lengths set",b.mode=30;break}if(b.distbits=6,b.distcode=b.distdyn,K={bits:b.distbits},J=u(f,b.lens,b.nlen,b.ndist,b.distcode,0,b.work,K),b.distbits=K.bits,J){N.msg="invalid distances set",b.mode=30;break}if(b.mode=20,F===6)break e;case 20:b.mode=21;case 21:if(6<=I&&258<=Q){N.next_out=Z,N.avail_out=Q,N.next_in=W,N.avail_in=I,b.hold=z,b.bits=$,c(N,ne),Z=N.next_out,te=N.output,Q=N.avail_out,W=N.next_in,V=N.input,I=N.avail_in,z=b.hold,$=b.bits,b.mode===12&&(b.back=-1);break}for(b.back=0;ke=(S=b.lencode[z&(1<>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(ke&&!(240&ke)){for(Me=ye,Pe=ke,nt=Fe;ke=(S=b.lencode[nt+((z&(1<>Me)])>>>16&255,Fe=65535&S,!(Me+(ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Me,$-=Me,b.back+=Me}if(z>>>=ye,$-=ye,b.back+=ye,b.length=Fe,ke===0){b.mode=26;break}if(32&ke){b.back=-1,b.mode=12;break}if(64&ke){N.msg="invalid literal/length code",b.mode=30;break}b.extra=15&ke,b.mode=22;case 22:if(b.extra){for(D=b.extra;$>>=b.extra,$-=b.extra,b.back+=b.extra}b.was=b.length,b.mode=23;case 23:for(;ke=(S=b.distcode[z&(1<>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(!(240&ke)){for(Me=ye,Pe=ke,nt=Fe;ke=(S=b.distcode[nt+((z&(1<>Me)])>>>16&255,Fe=65535&S,!(Me+(ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Me,$-=Me,b.back+=Me}if(z>>>=ye,$-=ye,b.back+=ye,64&ke){N.msg="invalid distance code",b.mode=30;break}b.offset=Fe,b.extra=15&ke,b.mode=24;case 24:if(b.extra){for(D=b.extra;$>>=b.extra,$-=b.extra,b.back+=b.extra}if(b.offset>b.dmax){N.msg="invalid distance too far back",b.mode=30;break}b.mode=25;case 25:if(Q===0)break e;if(se=ne-Q,b.offset>se){if((se=b.offset-se)>b.whave&&b.sane){N.msg="invalid distance too far back",b.mode=30;break}Oe=se>b.wnext?(se-=b.wnext,b.wsize-se):b.wnext-se,se>b.length&&(se=b.length),he=b.window}else he=te,Oe=Z-b.offset,se=b.length;for(QR?(A=Oe[he+_[F]],$[fe+_[F]]):(A=96,0),h=1<>Z)+(w-=h)]=P<<24|A<<16|L|0,w!==0;);for(h=1<>=1;if(h!==0?(z&=h-1,z+=h):z=0,F++,--ne[N]==0){if(N===V)break;N=f[m+_[F]]}if(te>>7)]}function fe(S,T){S.pending_buf[S.pending++]=255&T,S.pending_buf[S.pending++]=T>>>8&255}function ne(S,T,O){S.bi_valid>p-O?(S.bi_buf|=T<>p-S.bi_valid,S.bi_valid+=O-p):(S.bi_buf|=T<>>=1,O<<=1,0<--T;);return O>>>1}function he(S,T,O){var Y,M,H=new Array(_+1),X=0;for(Y=1;Y<=_;Y++)H[Y]=X=X+O[Y-1]<<1;for(M=0;M<=T;M++){var ee=S[2*M+1];ee!==0&&(S[2*M]=Oe(H[ee]++,ee))}}function ye(S){var T;for(T=0;T>1;1<=O;O--)Me(S,H,O);for(M=me;O=S.heap[1],S.heap[1]=S.heap[S.heap_len--],Me(S,H,1),Y=S.heap[1],S.heap[--S.heap_max]=O,S.heap[--S.heap_max]=Y,H[2*M]=H[2*O]+H[2*Y],S.depth[M]=(S.depth[O]>=S.depth[Y]?S.depth[O]:S.depth[Y])+1,H[2*O+1]=H[2*Y+1]=M,S.heap[1]=M++,Me(S,H,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(Ue,jt){var Gr,Ht,Qn,at,Jn,es,qr=jt.dyn_tree,$c=jt.max_code,Vc=jt.stat_desc.static_tree,hi=jt.stat_desc.has_stree,Wc=jt.stat_desc.extra_bits,pi=jt.stat_desc.extra_base,Pn=jt.stat_desc.max_length,Is=0;for(at=0;at<=_;at++)Ue.bl_count[at]=0;for(qr[2*Ue.heap[Ue.heap_max]+1]=0,Gr=Ue.heap_max+1;Gr>=7;M>>=1)if(1&Ye&&ee.dyn_ltree[2*me]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return a;for(me=32;me>>3,(H=S.static_len+3+7>>>3)<=M&&(M=H)):M=H=O+5,O+4<=M&&T!==-1?D(S,T,O,Y):S.strategy===4||H===M?(ne(S,2+(Y?1:0),3),Pe(S,q,N)):(ne(S,4+(Y?1:0),3),function(ee,me,Ye,Ue){var jt;for(ne(ee,me-257,5),ne(ee,Ye-1,5),ne(ee,Ue-4,4),jt=0;jt>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&T,S.pending_buf[S.l_buf+S.last_lit]=255&O,S.last_lit++,T===0?S.dyn_ltree[2*O]++:(S.matches++,T--,S.dyn_ltree[2*(b[O]+f+1)]++,S.dyn_dtree[2*$(T)]++),S.last_lit===S.lit_bufsize-1},s._tr_align=function(S){ne(S,2,3),se(S,w,q),function(T){T.bi_valid===16?(fe(T,T.bi_buf),T.bi_buf=0,T.bi_valid=0):8<=T.bi_valid&&(T.pending_buf[T.pending++]=255&T.bi_buf,T.bi_buf>>=8,T.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(r,n,s){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,n,s){(function(o){(function(i,a){if(!i.setImmediate){var c,u,d,f,m=1,y={},x=!1,g=i.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(i);_=_&&_.setTimeout?_:i,c={}.toString.call(i.process)==="[object process]"?function(C){process.nextTick(function(){h(C)})}:function(){if(i.postMessage&&!i.importScripts){var C=!0,j=i.onmessage;return i.onmessage=function(){C=!1},i.postMessage("","*"),i.onmessage=j,C}}()?(f="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",w,!1):i.attachEvent("onmessage",w),function(C){i.postMessage(f+C,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){h(C.data)},function(C){d.port2.postMessage(C)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(C){var j=g.createElement("script");j.onreadystatechange=function(){h(C),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(C){setTimeout(h,0,C)},_.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var j=new Array(arguments.length-1),E=0;E"u"?o===void 0?this:o:self)}).call(this,typeof Kc<"u"?Kc:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(bj);var H6=bj.exports;const Y6=Lm(H6);function Z6(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{n.result?t(n.result.toString()):r("No content found")},n.onerror=()=>r(n.error),n.readAsText(e)})}const K6=async(e,t)=>{const r=new Y6;t.forEach(o=>{r.file(o.name,o.content)});const n=await r.generateAsync({type:"blob"}),s=document.createElement("a");s.href=URL.createObjectURL(n),s.download=e,s.click()},ga=e=>{const t=new Date(e);return new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"Asia/Shanghai"}).format(t)},G6=e=>ga(e).split(" ")[0];function Sj(e){const t=new Date;t.setUTCDate(t.getUTCDate()+e);const r=t.getUTCFullYear(),n=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0"),o=String(t.getUTCHours()).padStart(2,"0"),i=String(t.getUTCMinutes()).padStart(2,"0"),a=String(t.getUTCSeconds()).padStart(2,"0");return`${r}-${n}-${s} ${o}:${i}:${a}`}const q6=async e=>{let t=1;e.page&&(t=e.page);let r=2;e.perPage&&(r=e.perPage);const n=st();let s="";return e.state==="enabled"?s="enabled=true":e.state==="disabled"?s="enabled=false":e.state==="expired"&&(s=n.filter("expiredAt<{:expiredAt}",{expiredAt:Sj(15)})),n.collection("domains").getList(t,r,{sort:"-created",expand:"lastDeployment",filter:s})},X6=async()=>{const e=st(),t=await e.collection("domains").getList(1,1,{}),r=await e.collection("domains").getList(1,1,{filter:e.filter("expiredAt<{:expiredAt}",{expiredAt:Sj(15)})}),n=await e.collection("domains").getList(1,1,{filter:"enabled=true"}),s=await e.collection("domains").getList(1,1,{filter:"enabled=false"});return{total:t.totalItems,expired:r.totalItems,enabled:n.totalItems,disabled:s.totalItems}},Q6=async e=>await st().collection("domains").getOne(e),km=async e=>e.id?await st().collection("domains").update(e.id,e):await st().collection("domains").create(e),J6=async e=>await st().collection("domains").delete(e),ez=(e,t)=>st().collection("domains").subscribe(e,r=>{r.action==="update"&&t(r.record)},{expand:"lastDeployment"}),tz=e=>{st().collection("domains").unsubscribe(e)},rz=()=>{const e=qn(),t=Nr(),r=Nn(),n=new URLSearchParams(r.search),s=n.get("page"),o=n.get("state"),[i,a]=v.useState(0),c=()=>{t("/edit")},u=w=>{n.set("page",w.toString()),t(`?${n.toString()}`)},d=w=>{t(`/edit?id=${w}`)},f=w=>{t(`/history?domain=${w}`)},m=async w=>{try{await J6(w),x(y.filter(C=>C.id!==w))}catch(C){console.error("Error deleting domain:",C)}},[y,x]=v.useState([]);v.useEffect(()=>{(async()=>{const C=await q6({page:s?Number(s):1,perPage:10,state:o||""});x(C.items),a(C.totalPages)})()},[s,o]);const g=async w=>{const C=y.filter(P=>P.id===w),j=C[0].enabled,E=C[0];E.enabled=!j,await km(E);const R=y.map(P=>P.id===w?{...P,checked:!j}:P);x(R)},_=async w=>{try{tz(w.id),ez(w.id,C=>{console.log(C);const j=y.map(E=>E.id===C.id?{...C}:E);x(j)}),w.rightnow=!0,await km(w),e.toast({title:"操作成功",description:"已发起部署,请稍后查看部署日志。"})}catch{e.toast({title:"执行失败",description:l.jsxs(l.Fragment,{children:["执行失败,请查看",l.jsx(fr,{to:`/history?domain=${w.id}`,className:"underline text-blue-500",children:"部署日志"}),"查看详情。"]}),variant:"destructive"})}},p=async w=>{await _({...w,deployed:!1})},h=async w=>{const C=`${w.id}-${w.domain}.zip`,j=[{name:`${w.domain}.pem`,content:w.certificate?w.certificate:""},{name:`${w.domain}.key`,content:w.privateKey?w.privateKey:""}];await K6(C,j)};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(ay,{}),l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:"域名列表"}),l.jsx(He,{onClick:c,children:"新增域名"})]}),y.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-36",children:"域名"}),l.jsx("div",{className:"w-40",children:"有效期限"}),l.jsx("div",{className:"w-32",children:"最近执行状态"}),l.jsx("div",{className:"w-64",children:"最近执行阶段"}),l.jsx("div",{className:"w-40 sm:ml-2",children:"最近执行时间"}),l.jsx("div",{className:"w-24",children:"是否启用"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"域名"}),y.map(w=>{var C,j,E,R;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-36 w-full pt-1 sm:pt-0 flex items-center",children:w.domain}),l.jsx("div",{className:"sm:w-40 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx("div",{children:w.expiredAt?l.jsxs(l.Fragment,{children:[l.jsx("div",{children:"有效期90天"}),l.jsxs("div",{children:[G6(w.expiredAt),"到期"]})]}):"---"})}),l.jsx("div",{className:"sm:w-32 w-full pt-1 sm:pt-0 flex items-center",children:w.lastDeployedAt&&((C=w.expand)!=null&&C.lastDeployment)?l.jsx(l.Fragment,{children:l.jsx(Gv,{deployment:w.expand.lastDeployment})}):"---"}),l.jsx("div",{className:"sm:w-64 w-full pt-1 sm:pt-0 flex items-center",children:w.lastDeployedAt&&((j=w.expand)!=null&&j.lastDeployment)?l.jsx(Hv,{phase:(E=w.expand.lastDeployment)==null?void 0:E.phase,phaseSuccess:(R=w.expand.lastDeployment)==null?void 0:R.phaseSuccess}):"---"}),l.jsx("div",{className:"sm:w-40 pt-1 sm:pt-0 sm:ml-2 flex items-center",children:w.lastDeployedAt?ga(w.lastDeployedAt):"---"}),l.jsx("div",{className:"sm:w-24 flex items-center",children:l.jsx(Zv,{children:l.jsxs(gC,{children:[l.jsx(vC,{children:l.jsx(Lc,{checked:w.enabled,onCheckedChange:()=>{g(w.id)}})}),l.jsx(Kv,{children:l.jsx("div",{className:"border rounded-sm px-3 bg-background text-muted-foreground text-xs",children:w.enabled?"禁用":"启用"})})]})})}),l.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[l.jsx(He,{variant:"link",className:"p-0",onClick:()=>f(w.id),children:"部署历史"}),l.jsxs(na,{when:!!w.enabled,children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>_(w),children:"立即部署"})]}),l.jsxs(na,{when:!!(w.enabled&&w.deployed),children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>p(w),children:"强行部署"})]}),l.jsxs(na,{when:!!w.expiredAt,children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>h(w),children:"下载"})]}),!w.enabled&&l.jsxs(l.Fragment,{children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsxs(WC,{children:[l.jsx(BC,{asChild:!0,children:l.jsx(He,{variant:"link",className:"p-0",children:"删除"})}),l.jsxs(qv,{children:[l.jsxs(Xv,{children:[l.jsx(Jv,{children:"删除域名"}),l.jsx(ey,{children:"确定要删除域名吗?"})]}),l.jsxs(Qv,{children:[l.jsx(ry,{children:"取消"}),l.jsx(ty,{onClick:()=>{m(w.id)},children:"确认"})]})]})]}),l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>d(w.id),children:"编辑"})]})]})]},w.id)}),l.jsx(SC,{totalPages:i,currentPage:s?Number(s):1,onPageChange:w=>{u(w)}})]}):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(rm,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),l.jsx(He,{onClick:c,className:"mt-3",children:"添加域名"})]})})]})})},Te=v.forwardRef(({className:e,type:t,...r},n)=>l.jsx("input",{type:t,className:ae("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));Te.displayName="Input";var Fc=e=>e.type==="checkbox",$i=e=>e instanceof Date,pr=e=>e==null;const kj=e=>typeof e=="object";var qt=e=>!pr(e)&&!Array.isArray(e)&&kj(e)&&!$i(e),Cj=e=>qt(e)&&e.target?Fc(e.target)?e.target.checked:e.target.value:e,nz=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,jj=(e,t)=>e.has(nz(t)),sz=e=>{const t=e.constructor&&e.constructor.prototype;return qt(t)&&t.hasOwnProperty("isPrototypeOf")},ly=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function br(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(ly&&(e instanceof Blob||e instanceof FileList))&&(r||qt(e)))if(t=r?[]:{},!r&&!sz(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=br(e[n]));else return e;return t}var Kf=e=>Array.isArray(e)?e.filter(Boolean):[],Ft=e=>e===void 0,ue=(e,t,r)=>{if(!t||!qt(e))return r;const n=Kf(t.split(/[,[\].]+?/)).reduce((s,o)=>pr(s)?s:s[o],e);return Ft(n)||n===e?Ft(e[t])?r:e[t]:n},Fn=e=>typeof e=="boolean",cy=e=>/^\w*$/.test(e),Ej=e=>Kf(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ft=(e,t,r)=>{let n=-1;const s=cy(t)?[t]:Ej(t),o=s.length,i=o-1;for(;++nWe.useContext(Nj),oz=e=>{const{children:t,...r}=e;return We.createElement(Nj.Provider,{value:r},t)};var Tj=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==gn.all&&(t._proxyFormState[i]=!n||gn.all),r&&(r[i]=!0),e[i]}});return s},Or=e=>qt(e)&&!Object.keys(e).length,Rj=(e,t,r,n)=>{r(e);const{name:s,...o}=e;return Or(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!n||gn.all))},kl=e=>Array.isArray(e)?e:[e],Pj=(e,t,r)=>!e||!t||e===t||kl(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n)));function uy(e){const t=We.useRef(e);t.current=e,We.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}function iz(e){const t=Gf(),{control:r=t.control,disabled:n,name:s,exact:o}=e||{},[i,a]=We.useState(r._formState),c=We.useRef(!0),u=We.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=We.useRef(s);return d.current=s,uy({disabled:n,next:f=>c.current&&Pj(d.current,f.name,o)&&Rj(f,u.current,r._updateFormState)&&a({...r._formState,...f}),subject:r._subjects.state}),We.useEffect(()=>(c.current=!0,u.current.isValid&&r._updateValid(!0),()=>{c.current=!1}),[r]),Tj(i,r,u.current,!1)}var Un=e=>typeof e=="string",Aj=(e,t,r,n,s)=>Un(e)?(n&&t.watch.add(e),ue(r,e,s)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),ue(r,o))):(n&&(t.watchAll=!0),r);function az(e){const t=Gf(),{control:r=t.control,name:n,defaultValue:s,disabled:o,exact:i}=e||{},a=We.useRef(n);a.current=n,uy({disabled:o,subject:r._subjects.values,next:d=>{Pj(a.current,d.name,i)&&u(br(Aj(a.current,r._names,d.values||r._formValues,!1,s)))}});const[c,u]=We.useState(r._getWatch(n,s));return We.useEffect(()=>r._removeUnmounted()),c}function lz(e){const t=Gf(),{name:r,disabled:n,control:s=t.control,shouldUnregister:o}=e,i=jj(s._names.array,r),a=az({control:s,name:r,defaultValue:ue(s._formValues,r,ue(s._defaultValues,r,e.defaultValue)),exact:!0}),c=iz({control:s,name:r}),u=We.useRef(s.register(r,{...e.rules,value:a,...Fn(e.disabled)?{disabled:e.disabled}:{}}));return We.useEffect(()=>{const d=s._options.shouldUnregister||o,f=(m,y)=>{const x=ue(s._fields,m);x&&x._f&&(x._f.mount=y)};if(f(r,!0),d){const m=br(ue(s._options.defaultValues,r));ft(s._defaultValues,r,m),Ft(ue(s._formValues,r))&&ft(s._formValues,r,m)}return()=>{(i?d&&!s._state.action:d)?s.unregister(r):f(r,!1)}},[r,s,i,o]),We.useEffect(()=>{ue(s._fields,r)&&s._updateDisabledField({disabled:n,fields:s._fields,name:r,value:ue(s._fields,r)._f.value})},[n,r,s]),{field:{name:r,value:a,...Fn(n)||c.disabled?{disabled:c.disabled||n}:{},onChange:We.useCallback(d=>u.current.onChange({target:{value:Cj(d),name:r},type:Od.CHANGE}),[r]),onBlur:We.useCallback(()=>u.current.onBlur({target:{value:ue(s._formValues,r),name:r},type:Od.BLUR}),[r,s]),ref:d=>{const f=ue(s._fields,r);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:m=>d.setCustomValidity(m),reportValidity:()=>d.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ue(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!ue(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ue(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ue(c.validatingFields,r)},error:{enumerable:!0,get:()=>ue(c.errors,r)}})}}const cz=e=>e.render(lz(e));var Dj=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},aw=e=>({isOnSubmit:!e||e===gn.onSubmit,isOnBlur:e===gn.onBlur,isOnChange:e===gn.onChange,isOnAll:e===gn.all,isOnTouch:e===gn.onTouched}),lw=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Cl=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const o=ue(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!n)break;if(i.ref&&t(i.ref,i.name)&&!n)break;Cl(a,t)}else qt(a)&&Cl(a,t)}}};var uz=(e,t,r)=>{const n=kl(ue(e,r));return ft(n,"root",t[r]),ft(e,r,n),e},dy=e=>e.type==="file",eo=e=>typeof e=="function",Md=e=>{if(!ly)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ku=e=>Un(e),fy=e=>e.type==="radio",Id=e=>e instanceof RegExp;const cw={value:!1,isValid:!1},uw={value:!0,isValid:!0};var Oj=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ft(e[0].attributes.value)?Ft(e[0].value)||e[0].value===""?uw:{value:e[0].value,isValid:!0}:uw:cw}return cw};const dw={isValid:!1,value:null};var Mj=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,dw):dw;function fw(e,t,r="validate"){if(Ku(e)||Array.isArray(e)&&e.every(Ku)||Fn(e)&&!e)return{type:r,message:Ku(e)?e:"",ref:t}}var ki=e=>qt(e)&&!Id(e)?e:{value:e,message:""},hw=async(e,t,r,n,s)=>{const{ref:o,refs:i,required:a,maxLength:c,minLength:u,min:d,max:f,pattern:m,validate:y,name:x,valueAsNumber:g,mount:_,disabled:p}=e._f,h=ue(t,x);if(!_||p)return{};const w=i?i[0]:o,C=N=>{n&&w.reportValidity&&(w.setCustomValidity(Fn(N)?"":N||""),w.reportValidity())},j={},E=fy(o),R=Fc(o),P=E||R,A=(g||dy(o))&&Ft(o.value)&&Ft(h)||Md(o)&&o.value===""||h===""||Array.isArray(h)&&!h.length,L=Dj.bind(null,x,r,j),q=(N,F,b,V=ss.maxLength,te=ss.minLength)=>{const W=N?F:b;j[x]={type:N?V:te,message:W,ref:o,...L(N?V:te,W)}};if(s?!Array.isArray(h)||!h.length:a&&(!P&&(A||pr(h))||Fn(h)&&!h||R&&!Oj(i).isValid||E&&!Mj(i).isValid)){const{value:N,message:F}=Ku(a)?{value:!!a,message:a}:ki(a);if(N&&(j[x]={type:ss.required,message:F,ref:w,...L(ss.required,F)},!r))return C(F),j}if(!A&&(!pr(d)||!pr(f))){let N,F;const b=ki(f),V=ki(d);if(!pr(h)&&!isNaN(h)){const te=o.valueAsNumber||h&&+h;pr(b.value)||(N=te>b.value),pr(V.value)||(F=tenew Date(new Date().toDateString()+" "+Q),Z=o.type=="time",I=o.type=="week";Un(b.value)&&h&&(N=Z?W(h)>W(b.value):I?h>b.value:te>new Date(b.value)),Un(V.value)&&h&&(F=Z?W(h)+N.value,V=!pr(F.value)&&h.length<+F.value;if((b||V)&&(q(b,N.message,F.message),!r))return C(j[x].message),j}if(m&&!A&&Un(h)){const{value:N,message:F}=ki(m);if(Id(N)&&!h.match(N)&&(j[x]={type:ss.pattern,message:F,ref:o,...L(ss.pattern,F)},!r))return C(F),j}if(y){if(eo(y)){const N=await y(h,t),F=fw(N,w);if(F&&(j[x]={...F,...L(ss.validate,F.message)},!r))return C(F.message),j}else if(qt(y)){let N={};for(const F in y){if(!Or(N)&&!r)break;const b=fw(await y[F](h,t),w,F);b&&(N={...b,...L(F,b.message)},C(b.message),r&&(j[x]=N))}if(!Or(N)&&(j[x]={ref:w,...N},!r))return j}}return C(!0),j};function dz(e,t){const r=t.slice(0,-1).length;let n=0;for(;n{let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}},Ld=e=>pr(e)||!kj(e);function Bo(e,t){if(Ld(e)||Ld(t))return e===t;if($i(e)&&$i(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const s of r){const o=e[s];if(!n.includes(s))return!1;if(s!=="ref"){const i=t[s];if($i(o)&&$i(i)||qt(o)&&qt(i)||Array.isArray(o)&&Array.isArray(i)?!Bo(o,i):o!==i)return!1}}return!0}var Ij=e=>e.type==="select-multiple",hz=e=>fy(e)||Fc(e),np=e=>Md(e)&&e.isConnected,Lj=e=>{for(const t in e)if(eo(e[t]))return!0;return!1};function Fd(e,t={}){const r=Array.isArray(e);if(qt(e)||r)for(const n in e)Array.isArray(e[n])||qt(e[n])&&!Lj(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Fd(e[n],t[n])):pr(e[n])||(t[n]=!0);return t}function Fj(e,t,r){const n=Array.isArray(e);if(qt(e)||n)for(const s in e)Array.isArray(e[s])||qt(e[s])&&!Lj(e[s])?Ft(t)||Ld(r[s])?r[s]=Array.isArray(e[s])?Fd(e[s],[]):{...Fd(e[s])}:Fj(e[s],pr(t)?{}:t[s],r[s]):r[s]=!Bo(e[s],t[s]);return r}var Cu=(e,t)=>Fj(e,t,Fd(t)),zj=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ft(e)?e:t?e===""?NaN:e&&+e:r&&Un(e)?new Date(e):n?n(e):e;function sp(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return dy(t)?t.files:fy(t)?Mj(e.refs).value:Ij(t)?[...t.selectedOptions].map(({value:r})=>r):Fc(t)?Oj(e.refs).value:zj(Ft(t.value)?e.ref.value:t.value,e)}var pz=(e,t,r,n)=>{const s={};for(const o of e){const i=ue(t,o);i&&ft(s,o,i._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Ja=e=>Ft(e)?e:Id(e)?e.source:qt(e)?Id(e.value)?e.value.source:e.value:e,mz=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function pw(e,t,r){const n=ue(e,r);if(n||cy(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),i=ue(t,o),a=ue(e,o);if(i&&!Array.isArray(i)&&r!==o)return{name:r};if(a&&a.type)return{name:o,error:a};s.pop()}return{name:r}}var gz=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,vz=(e,t)=>!Kf(ue(e,t)).length&&Yt(e,t);const yz={mode:gn.onSubmit,reValidateMode:gn.onChange,shouldFocusError:!0};function xz(e={}){let t={...yz,...e},r={submitCount:0,isDirty:!1,isLoading:eo(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=qt(t.defaultValues)||qt(t.values)?br(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:br(s),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:rp(),array:rp(),state:rp()},m=aw(t.mode),y=aw(t.reValidateMode),x=t.criteriaMode===gn.all,g=S=>T=>{clearTimeout(u),u=setTimeout(S,T)},_=async S=>{if(d.isValid||S){const T=t.resolver?Or((await P()).errors):await L(n,!0);T!==r.isValid&&f.state.next({isValid:T})}},p=(S,T)=>{(d.isValidating||d.validatingFields)&&((S||Array.from(a.mount)).forEach(O=>{O&&(T?ft(r.validatingFields,O,T):Yt(r.validatingFields,O))}),f.state.next({validatingFields:r.validatingFields,isValidating:!Or(r.validatingFields)}))},h=(S,T=[],O,Y,M=!0,H=!0)=>{if(Y&&O){if(i.action=!0,H&&Array.isArray(ue(n,S))){const X=O(ue(n,S),Y.argA,Y.argB);M&&ft(n,S,X)}if(H&&Array.isArray(ue(r.errors,S))){const X=O(ue(r.errors,S),Y.argA,Y.argB);M&&ft(r.errors,S,X),vz(r.errors,S)}if(d.touchedFields&&H&&Array.isArray(ue(r.touchedFields,S))){const X=O(ue(r.touchedFields,S),Y.argA,Y.argB);M&&ft(r.touchedFields,S,X)}d.dirtyFields&&(r.dirtyFields=Cu(s,o)),f.state.next({name:S,isDirty:N(S,T),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ft(o,S,T)},w=(S,T)=>{ft(r.errors,S,T),f.state.next({errors:r.errors})},C=S=>{r.errors=S,f.state.next({errors:r.errors,isValid:!1})},j=(S,T,O,Y)=>{const M=ue(n,S);if(M){const H=ue(o,S,Ft(O)?ue(s,S):O);Ft(H)||Y&&Y.defaultChecked||T?ft(o,S,T?H:sp(M._f)):V(S,H),i.mount&&_()}},E=(S,T,O,Y,M)=>{let H=!1,X=!1;const ee={name:S},me=!!(ue(n,S)&&ue(n,S)._f&&ue(n,S)._f.disabled);if(!O||Y){d.isDirty&&(X=r.isDirty,r.isDirty=ee.isDirty=N(),H=X!==ee.isDirty);const Ye=me||Bo(ue(s,S),T);X=!!(!me&&ue(r.dirtyFields,S)),Ye||me?Yt(r.dirtyFields,S):ft(r.dirtyFields,S,!0),ee.dirtyFields=r.dirtyFields,H=H||d.dirtyFields&&X!==!Ye}if(O){const Ye=ue(r.touchedFields,S);Ye||(ft(r.touchedFields,S,O),ee.touchedFields=r.touchedFields,H=H||d.touchedFields&&Ye!==O)}return H&&M&&f.state.next(ee),H?ee:{}},R=(S,T,O,Y)=>{const M=ue(r.errors,S),H=d.isValid&&Fn(T)&&r.isValid!==T;if(e.delayError&&O?(c=g(()=>w(S,O)),c(e.delayError)):(clearTimeout(u),c=null,O?ft(r.errors,S,O):Yt(r.errors,S)),(O?!Bo(M,O):M)||!Or(Y)||H){const X={...Y,...H&&Fn(T)?{isValid:T}:{},errors:r.errors,name:S};r={...r,...X},f.state.next(X)}},P=async S=>{p(S,!0);const T=await t.resolver(o,t.context,pz(S||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return p(S),T},A=async S=>{const{errors:T}=await P(S);if(S)for(const O of S){const Y=ue(T,O);Y?ft(r.errors,O,Y):Yt(r.errors,O)}else r.errors=T;return T},L=async(S,T,O={valid:!0})=>{for(const Y in S){const M=S[Y];if(M){const{_f:H,...X}=M;if(H){const ee=a.array.has(H.name);p([Y],!0);const me=await hw(M,o,x,t.shouldUseNativeValidation&&!T,ee);if(p([Y]),me[H.name]&&(O.valid=!1,T))break;!T&&(ue(me,H.name)?ee?uz(r.errors,me,H.name):ft(r.errors,H.name,me[H.name]):Yt(r.errors,H.name))}X&&await L(X,T,O)}}return O.valid},q=()=>{for(const S of a.unMount){const T=ue(n,S);T&&(T._f.refs?T._f.refs.every(O=>!np(O)):!np(T._f.ref))&&Oe(S)}a.unMount=new Set},N=(S,T)=>(S&&T&&ft(o,S,T),!Bo(z(),s)),F=(S,T,O)=>Aj(S,a,{...i.mount?o:Ft(T)?s:Un(S)?{[S]:T}:T},O,T),b=S=>Kf(ue(i.mount?o:s,S,e.shouldUnregister?ue(s,S,[]):[])),V=(S,T,O={})=>{const Y=ue(n,S);let M=T;if(Y){const H=Y._f;H&&(!H.disabled&&ft(o,S,zj(T,H)),M=Md(H.ref)&&pr(T)?"":T,Ij(H.ref)?[...H.ref.options].forEach(X=>X.selected=M.includes(X.value)):H.refs?Fc(H.ref)?H.refs.length>1?H.refs.forEach(X=>(!X.defaultChecked||!X.disabled)&&(X.checked=Array.isArray(M)?!!M.find(ee=>ee===X.value):M===X.value)):H.refs[0]&&(H.refs[0].checked=!!M):H.refs.forEach(X=>X.checked=X.value===M):dy(H.ref)?H.ref.value="":(H.ref.value=M,H.ref.type||f.values.next({name:S,values:{...o}})))}(O.shouldDirty||O.shouldTouch)&&E(S,M,O.shouldTouch,O.shouldDirty,!0),O.shouldValidate&&Q(S)},te=(S,T,O)=>{for(const Y in T){const M=T[Y],H=`${S}.${Y}`,X=ue(n,H);(a.array.has(S)||!Ld(M)||X&&!X._f)&&!$i(M)?te(H,M,O):V(H,M,O)}},W=(S,T,O={})=>{const Y=ue(n,S),M=a.array.has(S),H=br(T);ft(o,S,H),M?(f.array.next({name:S,values:{...o}}),(d.isDirty||d.dirtyFields)&&O.shouldDirty&&f.state.next({name:S,dirtyFields:Cu(s,o),isDirty:N(S,H)})):Y&&!Y._f&&!pr(H)?te(S,H,O):V(S,H,O),lw(S,a)&&f.state.next({...r}),f.values.next({name:i.mount?S:void 0,values:{...o}})},Z=async S=>{i.mount=!0;const T=S.target;let O=T.name,Y=!0;const M=ue(n,O),H=()=>T.type?sp(M._f):Cj(S),X=ee=>{Y=Number.isNaN(ee)||ee===ue(o,O,ee)};if(M){let ee,me;const Ye=H(),Ue=S.type===Od.BLUR||S.type===Od.FOCUS_OUT,jt=!mz(M._f)&&!t.resolver&&!ue(r.errors,O)&&!M._f.deps||gz(Ue,ue(r.touchedFields,O),r.isSubmitted,y,m),Gr=lw(O,a,Ue);ft(o,O,Ye),Ue?(M._f.onBlur&&M._f.onBlur(S),c&&c(0)):M._f.onChange&&M._f.onChange(S);const Ht=E(O,Ye,Ue,!1),Qn=!Or(Ht)||Gr;if(!Ue&&f.values.next({name:O,type:S.type,values:{...o}}),jt)return d.isValid&&_(),Qn&&f.state.next({name:O,...Gr?{}:Ht});if(!Ue&&Gr&&f.state.next({...r}),t.resolver){const{errors:at}=await P([O]);if(X(Ye),Y){const Jn=pw(r.errors,n,O),es=pw(at,n,Jn.name||O);ee=es.error,O=es.name,me=Or(at)}}else p([O],!0),ee=(await hw(M,o,x,t.shouldUseNativeValidation))[O],p([O]),X(Ye),Y&&(ee?me=!1:d.isValid&&(me=await L(n,!0)));Y&&(M._f.deps&&Q(M._f.deps),R(O,me,ee,Ht))}},I=(S,T)=>{if(ue(r.errors,T)&&S.focus)return S.focus(),1},Q=async(S,T={})=>{let O,Y;const M=kl(S);if(t.resolver){const H=await A(Ft(S)?S:M);O=Or(H),Y=S?!M.some(X=>ue(H,X)):O}else S?(Y=(await Promise.all(M.map(async H=>{const X=ue(n,H);return await L(X&&X._f?{[H]:X}:X)}))).every(Boolean),!(!Y&&!r.isValid)&&_()):Y=O=await L(n);return f.state.next({...!Un(S)||d.isValid&&O!==r.isValid?{}:{name:S},...t.resolver||!S?{isValid:O}:{},errors:r.errors}),T.shouldFocus&&!Y&&Cl(n,I,S?M:a.mount),Y},z=S=>{const T={...i.mount?o:s};return Ft(S)?T:Un(S)?ue(T,S):S.map(O=>ue(T,O))},$=(S,T)=>({invalid:!!ue((T||r).errors,S),isDirty:!!ue((T||r).dirtyFields,S),error:ue((T||r).errors,S),isValidating:!!ue(r.validatingFields,S),isTouched:!!ue((T||r).touchedFields,S)}),fe=S=>{S&&kl(S).forEach(T=>Yt(r.errors,T)),f.state.next({errors:S?r.errors:{}})},ne=(S,T,O)=>{const Y=(ue(n,S,{_f:{}})._f||{}).ref,M=ue(r.errors,S)||{},{ref:H,message:X,type:ee,...me}=M;ft(r.errors,S,{...me,...T,ref:Y}),f.state.next({name:S,errors:r.errors,isValid:!1}),O&&O.shouldFocus&&Y&&Y.focus&&Y.focus()},se=(S,T)=>eo(S)?f.values.subscribe({next:O=>S(F(void 0,T),O)}):F(S,T,!0),Oe=(S,T={})=>{for(const O of S?kl(S):a.mount)a.mount.delete(O),a.array.delete(O),T.keepValue||(Yt(n,O),Yt(o,O)),!T.keepError&&Yt(r.errors,O),!T.keepDirty&&Yt(r.dirtyFields,O),!T.keepTouched&&Yt(r.touchedFields,O),!T.keepIsValidating&&Yt(r.validatingFields,O),!t.shouldUnregister&&!T.keepDefaultValue&&Yt(s,O);f.values.next({values:{...o}}),f.state.next({...r,...T.keepDirty?{isDirty:N()}:{}}),!T.keepIsValid&&_()},he=({disabled:S,name:T,field:O,fields:Y,value:M})=>{if(Fn(S)&&i.mount||S){const H=S?void 0:Ft(M)?sp(O?O._f:ue(Y,T)._f):M;ft(o,T,H),E(T,H,!1,!1,!0)}},ye=(S,T={})=>{let O=ue(n,S);const Y=Fn(T.disabled);return ft(n,S,{...O||{},_f:{...O&&O._f?O._f:{ref:{name:S}},name:S,mount:!0,...T}}),a.mount.add(S),O?he({field:O,disabled:T.disabled,name:S,value:T.value}):j(S,!0,T.value),{...Y?{disabled:T.disabled}:{},...t.progressive?{required:!!T.required,min:Ja(T.min),max:Ja(T.max),minLength:Ja(T.minLength),maxLength:Ja(T.maxLength),pattern:Ja(T.pattern)}:{},name:S,onChange:Z,onBlur:Z,ref:M=>{if(M){ye(S,T),O=ue(n,S);const H=Ft(M.value)&&M.querySelectorAll&&M.querySelectorAll("input,select,textarea")[0]||M,X=hz(H),ee=O._f.refs||[];if(X?ee.find(me=>me===H):H===O._f.ref)return;ft(n,S,{_f:{...O._f,...X?{refs:[...ee.filter(np),H,...Array.isArray(ue(s,S))?[{}]:[]],ref:{type:H.type,name:S}}:{ref:H}}}),j(S,!1,void 0,H)}else O=ue(n,S,{}),O._f&&(O._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(jj(a.array,S)&&i.action)&&a.unMount.add(S)}}},ke=()=>t.shouldFocusError&&Cl(n,I,a.mount),Fe=S=>{Fn(S)&&(f.state.next({disabled:S}),Cl(n,(T,O)=>{const Y=ue(n,O);Y&&(T.disabled=Y._f.disabled||S,Array.isArray(Y._f.refs)&&Y._f.refs.forEach(M=>{M.disabled=Y._f.disabled||S}))},0,!1))},Me=(S,T)=>async O=>{let Y;O&&(O.preventDefault&&O.preventDefault(),O.persist&&O.persist());let M=br(o);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:H,values:X}=await P();r.errors=H,M=X}else await L(n);if(Yt(r.errors,"root"),Or(r.errors)){f.state.next({errors:{}});try{await S(M,O)}catch(H){Y=H}}else T&&await T({...r.errors},O),ke(),setTimeout(ke);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Or(r.errors)&&!Y,submitCount:r.submitCount+1,errors:r.errors}),Y)throw Y},Pe=(S,T={})=>{ue(n,S)&&(Ft(T.defaultValue)?W(S,br(ue(s,S))):(W(S,T.defaultValue),ft(s,S,br(T.defaultValue))),T.keepTouched||Yt(r.touchedFields,S),T.keepDirty||(Yt(r.dirtyFields,S),r.isDirty=T.defaultValue?N(S,br(ue(s,S))):N()),T.keepError||(Yt(r.errors,S),d.isValid&&_()),f.state.next({...r}))},nt=(S,T={})=>{const O=S?br(S):s,Y=br(O),M=Or(S),H=M?s:Y;if(T.keepDefaultValues||(s=O),!T.keepValues){if(T.keepDirtyValues)for(const X of a.mount)ue(r.dirtyFields,X)?ft(H,X,ue(o,X)):W(X,ue(H,X));else{if(ly&&Ft(S))for(const X of a.mount){const ee=ue(n,X);if(ee&&ee._f){const me=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(Md(me)){const Ye=me.closest("form");if(Ye){Ye.reset();break}}}}n={}}o=e.shouldUnregister?T.keepDefaultValues?br(s):{}:br(H),f.array.next({values:{...H}}),f.values.next({values:{...H}})}a={mount:T.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!T.keepIsValid||!!T.keepDirtyValues,i.watch=!!e.shouldUnregister,f.state.next({submitCount:T.keepSubmitCount?r.submitCount:0,isDirty:M?!1:T.keepDirty?r.isDirty:!!(T.keepDefaultValues&&!Bo(S,s)),isSubmitted:T.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:M?{}:T.keepDirtyValues?T.keepDefaultValues&&o?Cu(s,o):r.dirtyFields:T.keepDefaultValues&&S?Cu(s,S):T.keepDirty?r.dirtyFields:{},touchedFields:T.keepTouched?r.touchedFields:{},errors:T.keepErrors?r.errors:{},isSubmitSuccessful:T.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},k=(S,T)=>nt(eo(S)?S(o):S,T);return{control:{register:ye,unregister:Oe,getFieldState:$,handleSubmit:Me,setError:ne,_executeSchema:P,_getWatch:F,_getDirty:N,_updateValid:_,_removeUnmounted:q,_updateFieldArray:h,_updateDisabledField:he,_getFieldArray:b,_reset:nt,_resetDefaultValues:()=>eo(t.defaultValues)&&t.defaultValues().then(S=>{k(S,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:S=>{r={...r,...S}},_disableForm:Fe,_subjects:f,_proxyFormState:d,_setErrors:C,get _fields(){return n},get _formValues(){return o},get _state(){return i},set _state(S){i=S},get _defaultValues(){return s},get _names(){return a},set _names(S){a=S},get _formState(){return r},set _formState(S){r=S},get _options(){return t},set _options(S){t={...t,...S}}},trigger:Q,register:ye,handleSubmit:Me,watch:se,setValue:W,getValues:z,reset:k,resetField:Pe,clearErrors:fe,unregister:Oe,setError:ne,setFocus:(S,T={})=>{const O=ue(n,S),Y=O&&O._f;if(Y){const M=Y.refs?Y.refs[0]:Y.ref;M.focus&&(M.focus(),T.shouldSelect&&M.select())}},getFieldState:$}}function Tr(e={}){const t=We.useRef(),r=We.useRef(),[n,s]=We.useState({isDirty:!1,isValidating:!1,isLoading:eo(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:eo(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...xz(e),formState:n});const o=t.current.control;return o._options=e,uy({subject:o._subjects.state,next:i=>{Rj(i,o._proxyFormState,o._updateFormState,!0)&&s({...o._formState})}}),We.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),We.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==n.isDirty&&o._subjects.state.next({isDirty:i})}},[o,n.isDirty]),We.useEffect(()=>{e.values&&!Bo(e.values,r.current)?(o._reset(e.values,o._options.resetOptions),r.current=e.values,s(i=>({...i}))):o._resetDefaultValues()},[e.values,o]),We.useEffect(()=>{e.errors&&o._setErrors(e.errors)},[e.errors,o]),We.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),We.useEffect(()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[e.shouldUnregister,o]),t.current.formState=Tj(n,o),t.current}const mw=(e,t,r)=>{if(e&&"reportValidity"in e){const n=ue(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Uj=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?mw(n.ref,r,e):n.refs&&n.refs.forEach(s=>mw(s,r,e))}},wz=(e,t)=>{t.shouldUseNativeValidation&&Uj(e,t);const r={};for(const n in e){const s=ue(t.fields,n),o=Object.assign(e[n]||{},{ref:s&&s.ref});if(_z(t.names||Object.keys(e),n)){const i=Object.assign({},ue(r,n));ft(i,"root",o),ft(r,n,i)}else ft(r,n,o)}return r},_z=(e,t)=>e.some(r=>r.startsWith(t+"."));var bz=function(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=r[i].types,u=c&&c[n.code];r[i]=Dj(i,t,r,s,u?[].concat(u,n.message):n.message)}e.shift()}return r},Rr=function(e,t,r){return r===void 0&&(r={}),function(n,s,o){try{return Promise.resolve(function(i,a){try{var c=Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(u){return o.shouldUseNativeValidation&&Uj({},o),{errors:{},values:r.raw?n:u}})}catch(u){return a(u)}return c&&c.then?c.then(void 0,a):c}(0,function(i){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(i))return{values:{},errors:wz(bz(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}}},ot;(function(e){e.assertEqual=s=>s;function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,e.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(const a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},e.find=(s,o)=>{for(const i of s)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(ot||(ot={}));var Cm;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Cm||(Cm={}));const we=ot.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zs=e=>{switch(typeof e){case"undefined":return we.undefined;case"string":return we.string;case"number":return isNaN(e)?we.nan:we.number;case"boolean":return we.boolean;case"function":return we.function;case"bigint":return we.bigint;case"symbol":return we.symbol;case"object":return Array.isArray(e)?we.array:e===null?we.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?we.promise:typeof Map<"u"&&e instanceof Map?we.map:typeof Set<"u"&&e instanceof Set?we.set:typeof Date<"u"&&e instanceof Date?we.date:we.object;default:return we.unknown}},ie=ot.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Sz=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Wr extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const r=t||function(o){return o.message},n={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;cr.message){const r={},n=[];for(const s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Wr.create=e=>new Wr(e);const va=(e,t)=>{let r;switch(e.code){case ie.invalid_type:e.received===we.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ot.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${ot.joinValues(e.keys,", ")}`;break;case ie.invalid_union:r="Invalid input";break;case ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ot.joinValues(e.options)}`;break;case ie.invalid_enum_value:r=`Invalid enum value. Expected ${ot.joinValues(e.options)}, received '${e.received}'`;break;case ie.invalid_arguments:r="Invalid function arguments";break;case ie.invalid_return_type:r="Invalid function return type";break;case ie.invalid_date:r="Invalid date";break;case ie.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ot.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case ie.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case ie.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case ie.custom:r="Invalid input";break;case ie.invalid_intersection_types:r="Intersection results could not be merged";break;case ie.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ie.not_finite:r="Number must be finite";break;default:r=t.defaultError,ot.assertNever(e)}return{message:r}};let $j=va;function kz(e){$j=e}function zd(){return $j}const Ud=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)a=u(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}},Cz=[];function ge(e,t){const r=zd(),n=Ud({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===va?void 0:va].filter(s=>!!s)});e.common.issues.push(n)}class cr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return Be;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const o=await s.key,i=await s.value;n.push({key:o,value:i})}return cr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return Be;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:t.value,value:n}}}const Be=Object.freeze({status:"aborted"}),Vi=e=>({status:"dirty",value:e}),gr=e=>({status:"valid",value:e}),jm=e=>e.status==="aborted",Em=e=>e.status==="dirty",tc=e=>e.status==="valid",rc=e=>typeof Promise<"u"&&e instanceof Promise;function $d(e,t,r,n){if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function Vj(e,t,r,n,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var De;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(De||(De={}));var il,al;class Yn{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const gw=(e,t)=>{if(tc(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new Wr(e.common.issues);return this._error=r,this._error}}};function Ze(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(i,a)=>{var c,u;const{message:d}=e;return i.code==="invalid_enum_value"?{message:d??a.defaultError}:typeof a.data>"u"?{message:(c=d??n)!==null&&c!==void 0?c:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(u=d??r)!==null&&u!==void 0?u:a.defaultError}},description:s}}class Je{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Zs(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new cr,ctx:{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(rc(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;const s={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},o=this._parseSync({data:t,path:s.path,parent:s});return gw(s,o)}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},s=this._parse({data:t,path:n.path,parent:n}),o=await(rc(s)?s:Promise.resolve(s));return gw(n,o)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{const i=t(s),a=()=>o.addIssue({code:ie.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new En({schema:this,typeName:$e.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Wn.create(this,this._def)}nullable(){return wo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _n.create(this,this._def)}promise(){return xa.create(this,this._def)}or(t){return ic.create([this,t],this._def)}and(t){return ac.create(this,t,this._def)}transform(t){return new En({...Ze(this._def),schema:this,typeName:$e.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new fc({...Ze(this._def),innerType:this,defaultValue:r,typeName:$e.ZodDefault})}brand(){return new hy({typeName:$e.ZodBranded,type:this,...Ze(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new hc({...Ze(this._def),innerType:this,catchValue:r,typeName:$e.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return zc.create(this,t)}readonly(){return pc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const jz=/^c[^\s-]{8,}$/i,Ez=/^[0-9a-z]+$/,Nz=/^[0-9A-HJKMNP-TV-Z]{26}$/,Tz=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Rz=/^[a-z0-9_-]{21}$/i,Pz=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Az=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Dz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let op;const Oz=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Mz=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Iz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wj="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Lz=new RegExp(`^${Wj}$`);function Bj(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function Fz(e){return new RegExp(`^${Bj(e)}$`)}function Hj(e){let t=`${Wj}T${Bj(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function zz(e,t){return!!((t==="v4"||!t)&&Oz.test(e)||(t==="v6"||!t)&&Mz.test(e))}class yn extends Je{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==we.string){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.string,received:o.parsedType}),Be}const n=new cr;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(s=this._getOrReturnCtx(t,s),ge(s,{code:ie.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,a=t.data.lengtht.test(s),{validation:r,code:ie.invalid_string,...De.errToObj(n)})}_addCheck(t){return new yn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...De.errToObj(t)})}url(t){return this._addCheck({kind:"url",...De.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...De.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...De.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...De.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...De.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...De.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...De.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...De.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...De.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(r=t==null?void 0:t.offset)!==null&&r!==void 0?r:!1,local:(n=t==null?void 0:t.local)!==null&&n!==void 0?n:!1,...De.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...De.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...De.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...De.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...De.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...De.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...De.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...De.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...De.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...De.errToObj(r)})}nonempty(t){return this.min(1,De.errToObj(t))}trim(){return new yn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new yn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new yn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value{var t;return new yn({checks:[],typeName:$e.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};function Uz(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=parseInt(e.toFixed(s).replace(".","")),i=parseInt(t.toFixed(s).replace(".",""));return o%i/Math.pow(10,s)}class vo extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==we.number){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.number,received:o.parsedType}),Be}let n;const s=new cr;for(const o of this._def.checks)o.kind==="int"?ot.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?Uz(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_finite,message:o.message}),s.dirty()):ot.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,De.toString(r))}gt(t,r){return this.setLimit("min",t,!1,De.toString(r))}lte(t,r){return this.setLimit("max",t,!0,De.toString(r))}lt(t,r){return this.setLimit("max",t,!1,De.toString(r))}setLimit(t,r,n,s){return new vo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:De.toString(s)}]})}_addCheck(t){return new vo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:De.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:De.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:De.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:De.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:De.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.valuet.kind==="int"||t.kind==="multipleOf"&&ot.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.valuenew vo({checks:[],typeName:$e.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class yo extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==we.bigint){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.bigint,received:o.parsedType}),Be}let n;const s=new cr;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):ot.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,De.toString(r))}gt(t,r){return this.setLimit("min",t,!1,De.toString(r))}lte(t,r){return this.setLimit("max",t,!0,De.toString(r))}lt(t,r){return this.setLimit("max",t,!1,De.toString(r))}setLimit(t,r,n,s){return new yo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:De.toString(s)}]})}_addCheck(t){return new yo({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:De.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value{var t;return new yo({checks:[],typeName:$e.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};class nc extends Je{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==we.boolean){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.boolean,received:n.parsedType}),Be}return gr(t.data)}}nc.create=e=>new nc({typeName:$e.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class si extends Je{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==we.date){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.date,received:o.parsedType}),Be}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_date}),Be}const n=new cr;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(s=this._getOrReturnCtx(t,s),ge(s,{code:ie.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ot.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new si({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:De.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:De.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew si({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:$e.ZodDate,...Ze(e)});class Vd extends Je{_parse(t){if(this._getType(t)!==we.symbol){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.symbol,received:n.parsedType}),Be}return gr(t.data)}}Vd.create=e=>new Vd({typeName:$e.ZodSymbol,...Ze(e)});class sc extends Je{_parse(t){if(this._getType(t)!==we.undefined){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.undefined,received:n.parsedType}),Be}return gr(t.data)}}sc.create=e=>new sc({typeName:$e.ZodUndefined,...Ze(e)});class oc extends Je{_parse(t){if(this._getType(t)!==we.null){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.null,received:n.parsedType}),Be}return gr(t.data)}}oc.create=e=>new oc({typeName:$e.ZodNull,...Ze(e)});class ya extends Je{constructor(){super(...arguments),this._any=!0}_parse(t){return gr(t.data)}}ya.create=e=>new ya({typeName:$e.ZodAny,...Ze(e)});class Ko extends Je{constructor(){super(...arguments),this._unknown=!0}_parse(t){return gr(t.data)}}Ko.create=e=>new Ko({typeName:$e.ZodUnknown,...Ze(e)});class js extends Je{_parse(t){const r=this._getOrReturnCtx(t);return ge(r,{code:ie.invalid_type,expected:we.never,received:r.parsedType}),Be}}js.create=e=>new js({typeName:$e.ZodNever,...Ze(e)});class Wd extends Je{_parse(t){if(this._getType(t)!==we.undefined){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.void,received:n.parsedType}),Be}return gr(t.data)}}Wd.create=e=>new Wd({typeName:$e.ZodVoid,...Ze(e)});class _n extends Je{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==we.array)return ge(r,{code:ie.invalid_type,expected:we.array,received:r.parsedType}),Be;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,a=r.data.lengths.maxLength.value&&(ge(r,{code:ie.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>s.type._parseAsync(new Yn(r,i,r.path,a)))).then(i=>cr.mergeArray(n,i));const o=[...r.data].map((i,a)=>s.type._parseSync(new Yn(r,i,r.path,a)));return cr.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new _n({...this._def,minLength:{value:t,message:De.toString(r)}})}max(t,r){return new _n({...this._def,maxLength:{value:t,message:De.toString(r)}})}length(t,r){return new _n({...this._def,exactLength:{value:t,message:De.toString(r)}})}nonempty(t){return this.min(1,t)}}_n.create=(e,t)=>new _n({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$e.ZodArray,...Ze(t)});function ji(e){if(e instanceof Rt){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Wn.create(ji(n))}return new Rt({...e._def,shape:()=>t})}else return e instanceof _n?new _n({...e._def,type:ji(e.element)}):e instanceof Wn?Wn.create(ji(e.unwrap())):e instanceof wo?wo.create(ji(e.unwrap())):e instanceof Zn?Zn.create(e.items.map(t=>ji(t))):e}class Rt extends Je{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),r=ot.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==we.object){const u=this._getOrReturnCtx(t);return ge(u,{code:ie.invalid_type,expected:we.object,received:u.parsedType}),Be}const{status:n,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof js&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const d=o[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Yn(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof js){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")a.length>0&&(ge(s,{code:ie.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of a){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Yn(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,m=await d.value;u.push({key:f,value:m,alwaysSet:d.alwaysSet})}return u}).then(u=>cr.mergeObjectSync(n,u)):cr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return De.errToObj,new Rt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var s,o,i,a;const c=(i=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,r,n).message)!==null&&i!==void 0?i:n.defaultError;return r.code==="unrecognized_keys"?{message:(a=De.errToObj(t).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new Rt({...this._def,unknownKeys:"strip"})}passthrough(){return new Rt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Rt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Rt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:$e.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Rt({...this._def,catchall:t})}pick(t){const r={};return ot.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Rt({...this._def,shape:()=>r})}omit(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new Rt({...this._def,shape:()=>r})}deepPartial(){return ji(this)}partial(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}),new Rt({...this._def,shape:()=>r})}required(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Wn;)o=o._def.innerType;r[n]=o}}),new Rt({...this._def,shape:()=>r})}keyof(){return Yj(ot.objectKeys(this.shape))}}Rt.create=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strip",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});Rt.strictCreate=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strict",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});Rt.lazycreate=(e,t)=>new Rt({shape:e,unknownKeys:"strip",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});class ic extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function s(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new Wr(a.ctx.common.issues));return ge(r,{code:ie.invalid_union,unionErrors:i}),Be}if(r.common.async)return Promise.all(n.map(async o=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(c=>new Wr(c));return ge(r,{code:ie.invalid_union,unionErrors:a}),Be}}get options(){return this._def.options}}ic.create=(e,t)=>new ic({options:e,typeName:$e.ZodUnion,...Ze(t)});const os=e=>e instanceof cc?os(e.schema):e instanceof En?os(e.innerType()):e instanceof uc?[e.value]:e instanceof xo?e.options:e instanceof dc?ot.objectValues(e.enum):e instanceof fc?os(e._def.innerType):e instanceof sc?[void 0]:e instanceof oc?[null]:e instanceof Wn?[void 0,...os(e.unwrap())]:e instanceof wo?[null,...os(e.unwrap())]:e instanceof hy||e instanceof pc?os(e.unwrap()):e instanceof hc?os(e._def.innerType):[];class qf extends Je{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.object)return ge(r,{code:ie.invalid_type,expected:we.object,received:r.parsedType}),Be;const n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(ge(r,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const s=new Map;for(const o of r){const i=os(o.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of i){if(s.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);s.set(a,o)}}return new qf({typeName:$e.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:s,...Ze(n)})}}function Nm(e,t){const r=Zs(e),n=Zs(t);if(e===t)return{valid:!0,data:e};if(r===we.object&&n===we.object){const s=ot.objectKeys(t),o=ot.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(const a of o){const c=Nm(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===we.array&&n===we.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o{if(jm(o)||jm(i))return Be;const a=Nm(o.value,i.value);return a.valid?((Em(o)||Em(i))&&r.dirty(),{status:r.value,value:a.data}):(ge(n,{code:ie.invalid_intersection_types}),Be)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ac.create=(e,t,r)=>new ac({left:e,right:t,typeName:$e.ZodIntersection,...Ze(r)});class Zn extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.array)return ge(n,{code:ie.invalid_type,expected:we.array,received:n.parsedType}),Be;if(n.data.lengththis._def.items.length&&(ge(n,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const o=[...n.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Yn(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>cr.mergeArray(r,i)):cr.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new Zn({...this._def,rest:t})}}Zn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zn({items:e,typeName:$e.ZodTuple,rest:null,...Ze(t)})};class lc extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.object)return ge(n,{code:ie.invalid_type,expected:we.object,received:n.parsedType}),Be;const s=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)s.push({key:o._parse(new Yn(n,a,n.path,a)),value:i._parse(new Yn(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?cr.mergeObjectAsync(r,s):cr.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Je?new lc({keyType:t,valueType:r,typeName:$e.ZodRecord,...Ze(n)}):new lc({keyType:yn.create(),valueType:t,typeName:$e.ZodRecord,...Ze(r)})}}class Bd extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.map)return ge(n,{code:ie.invalid_type,expected:we.map,received:n.parsedType}),Be;const s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new Yn(n,a,n.path,[u,"key"])),value:o._parse(new Yn(n,c,n.path,[u,"value"]))}));if(n.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}}Bd.create=(e,t,r)=>new Bd({valueType:t,keyType:e,typeName:$e.ZodMap,...Ze(r)});class oi extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.set)return ge(n,{code:ie.invalid_type,expected:we.set,received:n.parsedType}),Be;const s=this._def;s.minSize!==null&&n.data.sizes.maxSize.value&&(ge(n,{code:ie.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const o=this._def.valueType;function i(c){const u=new Set;for(const d of c){if(d.status==="aborted")return Be;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}const a=[...n.data.values()].map((c,u)=>o._parse(new Yn(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,r){return new oi({...this._def,minSize:{value:t,message:De.toString(r)}})}max(t,r){return new oi({...this._def,maxSize:{value:t,message:De.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}oi.create=(e,t)=>new oi({valueType:e,minSize:null,maxSize:null,typeName:$e.ZodSet,...Ze(t)});class oa extends Je{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.function)return ge(r,{code:ie.invalid_type,expected:we.function,received:r.parsedType}),Be;function n(a,c){return Ud({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zd(),va].filter(u=>!!u),issueData:{code:ie.invalid_arguments,argumentsError:c}})}function s(a,c){return Ud({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zd(),va].filter(u=>!!u),issueData:{code:ie.invalid_return_type,returnTypeError:c}})}const o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof xa){const a=this;return gr(async function(...c){const u=new Wr([]),d=await a._def.args.parseAsync(c,o).catch(y=>{throw u.addIssue(n(c,y)),u}),f=await Reflect.apply(i,this,d);return await a._def.returns._def.type.parseAsync(f,o).catch(y=>{throw u.addIssue(s(f,y)),u})})}else{const a=this;return gr(function(...c){const u=a._def.args.safeParse(c,o);if(!u.success)throw new Wr([n(c,u.error)]);const d=Reflect.apply(i,this,u.data),f=a._def.returns.safeParse(d,o);if(!f.success)throw new Wr([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new oa({...this._def,args:Zn.create(t).rest(Ko.create())})}returns(t){return new oa({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new oa({args:t||Zn.create([]).rest(Ko.create()),returns:r||Ko.create(),typeName:$e.ZodFunction,...Ze(n)})}}class cc extends Je{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}cc.create=(e,t)=>new cc({getter:e,typeName:$e.ZodLazy,...Ze(t)});class uc extends Je{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return ge(r,{received:r.data,code:ie.invalid_literal,expected:this._def.value}),Be}return{status:"valid",value:t.data}}get value(){return this._def.value}}uc.create=(e,t)=>new uc({value:e,typeName:$e.ZodLiteral,...Ze(t)});function Yj(e,t){return new xo({values:e,typeName:$e.ZodEnum,...Ze(t)})}class xo extends Je{constructor(){super(...arguments),il.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return ge(r,{expected:ot.joinValues(n),received:r.parsedType,code:ie.invalid_type}),Be}if($d(this,il)||Vj(this,il,new Set(this._def.values)),!$d(this,il).has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return ge(r,{received:r.data,code:ie.invalid_enum_value,options:n}),Be}return gr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return xo.create(t,{...this._def,...r})}exclude(t,r=this._def){return xo.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}il=new WeakMap;xo.create=Yj;class dc extends Je{constructor(){super(...arguments),al.set(this,void 0)}_parse(t){const r=ot.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==we.string&&n.parsedType!==we.number){const s=ot.objectValues(r);return ge(n,{expected:ot.joinValues(s),received:n.parsedType,code:ie.invalid_type}),Be}if($d(this,al)||Vj(this,al,new Set(ot.getValidEnumValues(this._def.values))),!$d(this,al).has(t.data)){const s=ot.objectValues(r);return ge(n,{received:n.data,code:ie.invalid_enum_value,options:s}),Be}return gr(t.data)}get enum(){return this._def.values}}al=new WeakMap;dc.create=(e,t)=>new dc({values:e,typeName:$e.ZodNativeEnum,...Ze(t)});class xa extends Je{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.promise&&r.common.async===!1)return ge(r,{code:ie.invalid_type,expected:we.promise,received:r.parsedType}),Be;const n=r.parsedType===we.promise?r.data:Promise.resolve(r.data);return gr(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}xa.create=(e,t)=>new xa({type:e,typeName:$e.ZodPromise,...Ze(t)});class En extends Je{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$e.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:i=>{ge(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return Be;const c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Be:c.status==="dirty"||r.value==="dirty"?Vi(c.value):c});{if(r.value==="aborted")return Be;const a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?Be:a.status==="dirty"||r.value==="dirty"?Vi(a.value):a}}if(s.type==="refinement"){const i=a=>{const c=s.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Be:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Be:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!tc(i))return i;const a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>tc(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):i);ot.assertNever(s)}}En.create=(e,t,r)=>new En({schema:e,typeName:$e.ZodEffects,effect:t,...Ze(r)});En.createWithPreprocess=(e,t,r)=>new En({schema:t,effect:{type:"preprocess",transform:e},typeName:$e.ZodEffects,...Ze(r)});class Wn extends Je{_parse(t){return this._getType(t)===we.undefined?gr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Wn.create=(e,t)=>new Wn({innerType:e,typeName:$e.ZodOptional,...Ze(t)});class wo extends Je{_parse(t){return this._getType(t)===we.null?gr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}wo.create=(e,t)=>new wo({innerType:e,typeName:$e.ZodNullable,...Ze(t)});class fc extends Je{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===we.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}fc.create=(e,t)=>new fc({innerType:e,typeName:$e.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ze(t)});class hc extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rc(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Wr(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Wr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}hc.create=(e,t)=>new hc({innerType:e,typeName:$e.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ze(t)});class Hd extends Je{_parse(t){if(this._getType(t)!==we.nan){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.nan,received:n.parsedType}),Be}return{status:"valid",value:t.data}}}Hd.create=e=>new Hd({typeName:$e.ZodNaN,...Ze(e)});const $z=Symbol("zod_brand");class hy extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class zc extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Be:o.status==="dirty"?(r.dirty(),Vi(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Be:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new zc({in:t,out:r,typeName:$e.ZodPipeline})}}class pc extends Je{_parse(t){const r=this._def.innerType._parse(t),n=s=>(tc(s)&&(s.value=Object.freeze(s.value)),s);return rc(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}pc.create=(e,t)=>new pc({innerType:e,typeName:$e.ZodReadonly,...Ze(t)});function Zj(e,t={},r){return e?ya.create().superRefine((n,s)=>{var o,i;if(!e(n)){const a=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,c=(i=(o=a.fatal)!==null&&o!==void 0?o:r)!==null&&i!==void 0?i:!0,u=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...u,fatal:c})}}):ya.create()}const Vz={object:Rt.lazycreate};var $e;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})($e||($e={}));const Wz=(e,t={message:`Input not instance of ${e.name}`})=>Zj(r=>r instanceof e,t),Kj=yn.create,Gj=vo.create,Bz=Hd.create,Hz=yo.create,qj=nc.create,Yz=si.create,Zz=Vd.create,Kz=sc.create,Gz=oc.create,qz=ya.create,Xz=Ko.create,Qz=js.create,Jz=Wd.create,e8=_n.create,t8=Rt.create,r8=Rt.strictCreate,n8=ic.create,s8=qf.create,o8=ac.create,i8=Zn.create,a8=lc.create,l8=Bd.create,c8=oi.create,u8=oa.create,d8=cc.create,f8=uc.create,h8=xo.create,p8=dc.create,m8=xa.create,vw=En.create,g8=Wn.create,v8=wo.create,y8=En.createWithPreprocess,x8=zc.create,w8=()=>Kj().optional(),_8=()=>Gj().optional(),b8=()=>qj().optional(),S8={string:e=>yn.create({...e,coerce:!0}),number:e=>vo.create({...e,coerce:!0}),boolean:e=>nc.create({...e,coerce:!0}),bigint:e=>yo.create({...e,coerce:!0}),date:e=>si.create({...e,coerce:!0})},k8=Be;var pe=Object.freeze({__proto__:null,defaultErrorMap:va,setErrorMap:kz,getErrorMap:zd,makeIssue:Ud,EMPTY_PATH:Cz,addIssueToContext:ge,ParseStatus:cr,INVALID:Be,DIRTY:Vi,OK:gr,isAborted:jm,isDirty:Em,isValid:tc,isAsync:rc,get util(){return ot},get objectUtil(){return Cm},ZodParsedType:we,getParsedType:Zs,ZodType:Je,datetimeRegex:Hj,ZodString:yn,ZodNumber:vo,ZodBigInt:yo,ZodBoolean:nc,ZodDate:si,ZodSymbol:Vd,ZodUndefined:sc,ZodNull:oc,ZodAny:ya,ZodUnknown:Ko,ZodNever:js,ZodVoid:Wd,ZodArray:_n,ZodObject:Rt,ZodUnion:ic,ZodDiscriminatedUnion:qf,ZodIntersection:ac,ZodTuple:Zn,ZodRecord:lc,ZodMap:Bd,ZodSet:oi,ZodFunction:oa,ZodLazy:cc,ZodLiteral:uc,ZodEnum:xo,ZodNativeEnum:dc,ZodPromise:xa,ZodEffects:En,ZodTransformer:En,ZodOptional:Wn,ZodNullable:wo,ZodDefault:fc,ZodCatch:hc,ZodNaN:Hd,BRAND:$z,ZodBranded:hy,ZodPipeline:zc,ZodReadonly:pc,custom:Zj,Schema:Je,ZodSchema:Je,late:Vz,get ZodFirstPartyTypeKind(){return $e},coerce:S8,any:qz,array:e8,bigint:Hz,boolean:qj,date:Yz,discriminatedUnion:s8,effect:vw,enum:h8,function:u8,instanceof:Wz,intersection:o8,lazy:d8,literal:f8,map:l8,nan:Bz,nativeEnum:p8,never:Qz,null:Gz,nullable:v8,number:Gj,object:t8,oboolean:b8,onumber:_8,optional:g8,ostring:w8,pipeline:x8,preprocess:y8,promise:m8,record:a8,set:c8,strictObject:r8,string:Kj,symbol:Zz,transformer:vw,tuple:i8,undefined:Kz,union:n8,unknown:Xz,void:Jz,NEVER:k8,ZodIssueCode:ie,quotelessJson:Sz,ZodError:Wr}),C8="Label",Xj=v.forwardRef((e,t)=>l.jsx(Re.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Xj.displayName=C8;var Qj=Xj;const j8=_c("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ma=v.forwardRef(({className:e,...t},r)=>l.jsx(Qj,{ref:r,className:ae(j8(),e),...t}));Ma.displayName=Qj.displayName;const Pr=oz,Jj=v.createContext({}),Ne=({...e})=>l.jsx(Jj.Provider,{value:{name:e.name},children:l.jsx(cz,{...e})}),Xf=()=>{const e=v.useContext(Jj),t=v.useContext(eE),{getFieldState:r,formState:n}=Gf(),s=r(e.name,n);if(!e)throw new Error("useFormField should be used within ");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...s}},eE=v.createContext({}),Ce=v.forwardRef(({className:e,...t},r)=>{const n=v.useId();return l.jsx(eE.Provider,{value:{id:n},children:l.jsx("div",{ref:r,className:ae("space-y-2",e),...t})})});Ce.displayName="FormItem";const je=v.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:s}=Xf();return l.jsx(Ma,{ref:r,className:ae(n&&"text-destructive",e),htmlFor:s,...t})});je.displayName="FormLabel";const Ee=v.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:s,formMessageId:o}=Xf();return l.jsx(bs,{ref:t,id:n,"aria-describedby":r?`${s} ${o}`:`${s}`,"aria-invalid":!!r,...e})});Ee.displayName="FormControl";const E8=v.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=Xf();return l.jsx("p",{ref:r,id:n,className:ae("text-sm text-muted-foreground",e),...t})});E8.displayName="FormDescription";const Se=v.forwardRef(({className:e,children:t,...r},n)=>{const{error:s,formMessageId:o}=Xf(),i=s?String(s==null?void 0:s.message):t;return i?l.jsx("p",{ref:n,id:o,className:ae("text-sm font-medium text-destructive",e),...r,children:i}):null});Se.displayName="FormMessage";function Tm(e,[t,r]){return Math.min(r,Math.max(t,e))}var N8=[" ","Enter","ArrowUp","ArrowDown"],T8=[" ","Enter"],Uc="Select",[Qf,Jf,R8]=bc(Uc),[Ia,j$]=xr(Uc,[R8,Pa]),eh=Pa(),[P8,Eo]=Ia(Uc),[A8,D8]=Ia(Uc),tE=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:m,required:y}=e,x=eh(t),[g,_]=v.useState(null),[p,h]=v.useState(null),[w,C]=v.useState(!1),j=Ea(u),[E=!1,R]=on({prop:n,defaultProp:s,onChange:o}),[P,A]=on({prop:i,defaultProp:a,onChange:c}),L=v.useRef(null),q=g?!!g.closest("form"):!0,[N,F]=v.useState(new Set),b=Array.from(N).map(V=>V.props.value).join(";");return l.jsx(Xg,{...x,children:l.jsxs(P8,{required:y,scope:t,trigger:g,onTriggerChange:_,valueNode:p,onValueNodeChange:h,valueNodeHasChildren:w,onValueNodeHasChildrenChange:C,contentId:Ur(),value:P,onValueChange:A,open:E,onOpenChange:R,dir:j,triggerPointerDownPosRef:L,disabled:m,children:[l.jsx(Qf.Provider,{scope:t,children:l.jsx(A8,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(V=>{F(te=>new Set(te).add(V))},[]),onNativeOptionRemove:v.useCallback(V=>{F(te=>{const W=new Set(te);return W.delete(V),W})},[]),children:r})}),q?l.jsxs(EE,{"aria-hidden":!0,required:y,tabIndex:-1,name:d,autoComplete:f,value:P,onChange:V=>A(V.target.value),disabled:m,children:[P===void 0?l.jsx("option",{value:""}):null,Array.from(N)]},b):null]})})};tE.displayName=Uc;var rE="SelectTrigger",nE=v.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,o=eh(r),i=Eo(rE,r),a=i.disabled||n,c=Ke(t,i.onTriggerChange),u=Jf(r),[d,f,m]=NE(x=>{const g=u().filter(h=>!h.disabled),_=g.find(h=>h.value===i.value),p=TE(g,x,_);p!==void 0&&i.onValueChange(p.value)}),y=()=>{a||(i.onOpenChange(!0),m())};return l.jsx(Qg,{asChild:!0,...o,children:l.jsx(Re.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":jE(i.value)?"":void 0,...s,ref:c,onClick:ce(s.onClick,x=>{x.currentTarget.focus()}),onPointerDown:ce(s.onPointerDown,x=>{const g=x.target;g.hasPointerCapture(x.pointerId)&&g.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&(y(),i.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)},x.preventDefault())}),onKeyDown:ce(s.onKeyDown,x=>{const g=d.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&f(x.key),!(g&&x.key===" ")&&N8.includes(x.key)&&(y(),x.preventDefault())})})})});nE.displayName=rE;var sE="SelectValue",oE=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:i="",...a}=e,c=Eo(sE,r),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,f=Ke(t,c.onValueNodeChange);return Jt(()=>{u(d)},[u,d]),l.jsx(Re.span,{...a,ref:f,style:{pointerEvents:"none"},children:jE(c.value)?l.jsx(l.Fragment,{children:i}):o})});oE.displayName=sE;var O8="SelectIcon",iE=v.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return l.jsx(Re.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});iE.displayName=O8;var M8="SelectPortal",aE=e=>l.jsx(kc,{asChild:!0,...e});aE.displayName=M8;var ii="SelectContent",lE=v.forwardRef((e,t)=>{const r=Eo(ii,e.__scopeSelect),[n,s]=v.useState();if(Jt(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?Ns.createPortal(l.jsx(cE,{scope:e.__scopeSelect,children:l.jsx(Qf.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),o):null}return l.jsx(uE,{...e,ref:t})});lE.displayName=ii;var ls=10,[cE,No]=Ia(ii),I8="SelectContentImpl",uE=v.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:g,avoidCollisions:_,...p}=e,h=Eo(ii,r),[w,C]=v.useState(null),[j,E]=v.useState(null),R=Ke(t,he=>C(he)),[P,A]=v.useState(null),[L,q]=v.useState(null),N=Jf(r),[F,b]=v.useState(!1),V=v.useRef(!1);v.useEffect(()=>{if(w)return tv(w)},[w]),Vg();const te=v.useCallback(he=>{const[ye,...ke]=N().map(Pe=>Pe.ref.current),[Fe]=ke.slice(-1),Me=document.activeElement;for(const Pe of he)if(Pe===Me||(Pe==null||Pe.scrollIntoView({block:"nearest"}),Pe===ye&&j&&(j.scrollTop=0),Pe===Fe&&j&&(j.scrollTop=j.scrollHeight),Pe==null||Pe.focus(),document.activeElement!==Me))return},[N,j]),W=v.useCallback(()=>te([P,w]),[te,P,w]);v.useEffect(()=>{F&&W()},[F,W]);const{onOpenChange:Z,triggerPointerDownPosRef:I}=h;v.useEffect(()=>{if(w){let he={x:0,y:0};const ye=Fe=>{var Me,Pe;he={x:Math.abs(Math.round(Fe.pageX)-(((Me=I.current)==null?void 0:Me.x)??0)),y:Math.abs(Math.round(Fe.pageY)-(((Pe=I.current)==null?void 0:Pe.y)??0))}},ke=Fe=>{he.x<=10&&he.y<=10?Fe.preventDefault():w.contains(Fe.target)||Z(!1),document.removeEventListener("pointermove",ye),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",ke,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",ke,{capture:!0})}}},[w,Z,I]),v.useEffect(()=>{const he=()=>Z(!1);return window.addEventListener("blur",he),window.addEventListener("resize",he),()=>{window.removeEventListener("blur",he),window.removeEventListener("resize",he)}},[Z]);const[Q,z]=NE(he=>{const ye=N().filter(Me=>!Me.disabled),ke=ye.find(Me=>Me.ref.current===document.activeElement),Fe=TE(ye,he,ke);Fe&&setTimeout(()=>Fe.ref.current.focus())}),$=v.useCallback((he,ye,ke)=>{const Fe=!V.current&&!ke;(h.value!==void 0&&h.value===ye||Fe)&&(A(he),Fe&&(V.current=!0))},[h.value]),fe=v.useCallback(()=>w==null?void 0:w.focus(),[w]),ne=v.useCallback((he,ye,ke)=>{const Fe=!V.current&&!ke;(h.value!==void 0&&h.value===ye||Fe)&&q(he)},[h.value]),se=n==="popper"?Rm:dE,Oe=se===Rm?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:g,avoidCollisions:_}:{};return l.jsx(cE,{scope:r,content:w,viewport:j,onViewportChange:E,itemRefCallback:$,selectedItem:P,onItemLeave:fe,itemTextRefCallback:ne,focusSelectedItem:W,selectedItemText:L,position:n,isPositioned:F,searchRef:Q,children:l.jsx(jf,{as:bs,allowPinchZoom:!0,children:l.jsx(wf,{asChild:!0,trapped:h.open,onMountAutoFocus:he=>{he.preventDefault()},onUnmountAutoFocus:ce(s,he=>{var ye;(ye=h.trigger)==null||ye.focus({preventScroll:!0}),he.preventDefault()}),children:l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:he=>he.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:l.jsx(se,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:he=>he.preventDefault(),...p,...Oe,onPlaced:()=>b(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...p.style},onKeyDown:ce(p.onKeyDown,he=>{const ye=he.ctrlKey||he.altKey||he.metaKey;if(he.key==="Tab"&&he.preventDefault(),!ye&&he.key.length===1&&z(he.key),["ArrowUp","ArrowDown","Home","End"].includes(he.key)){let Fe=N().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);if(["ArrowUp","End"].includes(he.key)&&(Fe=Fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(he.key)){const Me=he.target,Pe=Fe.indexOf(Me);Fe=Fe.slice(Pe+1)}setTimeout(()=>te(Fe)),he.preventDefault()}})})})})})})});uE.displayName=I8;var L8="SelectItemAlignedPosition",dE=v.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,o=Eo(ii,r),i=No(ii,r),[a,c]=v.useState(null),[u,d]=v.useState(null),f=Ke(t,R=>d(R)),m=Jf(r),y=v.useRef(!1),x=v.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:p,focusSelectedItem:h}=i,w=v.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&u&&g&&_&&p){const R=o.trigger.getBoundingClientRect(),P=u.getBoundingClientRect(),A=o.valueNode.getBoundingClientRect(),L=p.getBoundingClientRect();if(o.dir!=="rtl"){const Me=L.left-P.left,Pe=A.left-Me,nt=R.left-Pe,k=R.width+nt,J=Math.max(k,P.width),K=window.innerWidth-ls,D=Tm(Pe,[ls,K-J]);a.style.minWidth=k+"px",a.style.left=D+"px"}else{const Me=P.right-L.right,Pe=window.innerWidth-A.right-Me,nt=window.innerWidth-R.right-Pe,k=R.width+nt,J=Math.max(k,P.width),K=window.innerWidth-ls,D=Tm(Pe,[ls,K-J]);a.style.minWidth=k+"px",a.style.right=D+"px"}const q=m(),N=window.innerHeight-ls*2,F=g.scrollHeight,b=window.getComputedStyle(u),V=parseInt(b.borderTopWidth,10),te=parseInt(b.paddingTop,10),W=parseInt(b.borderBottomWidth,10),Z=parseInt(b.paddingBottom,10),I=V+te+F+Z+W,Q=Math.min(_.offsetHeight*5,I),z=window.getComputedStyle(g),$=parseInt(z.paddingTop,10),fe=parseInt(z.paddingBottom,10),ne=R.top+R.height/2-ls,se=N-ne,Oe=_.offsetHeight/2,he=_.offsetTop+Oe,ye=V+te+he,ke=I-ye;if(ye<=ne){const Me=_===q[q.length-1].ref.current;a.style.bottom="0px";const Pe=u.clientHeight-g.offsetTop-g.offsetHeight,nt=Math.max(se,Oe+(Me?fe:0)+Pe+W),k=ye+nt;a.style.height=k+"px"}else{const Me=_===q[0].ref.current;a.style.top="0px";const nt=Math.max(ne,V+g.offsetTop+(Me?$:0)+Oe)+ke;a.style.height=nt+"px",g.scrollTop=ye-ne+g.offsetTop}a.style.margin=`${ls}px 0`,a.style.minHeight=Q+"px",a.style.maxHeight=N+"px",n==null||n(),requestAnimationFrame(()=>y.current=!0)}},[m,o.trigger,o.valueNode,a,u,g,_,p,o.dir,n]);Jt(()=>w(),[w]);const[C,j]=v.useState();Jt(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const E=v.useCallback(R=>{R&&x.current===!0&&(w(),h==null||h(),x.current=!1)},[w,h]);return l.jsx(z8,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:y,onScrollButtonChange:E,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:l.jsx(Re.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});dE.displayName=L8;var F8="SelectPopperPosition",Rm=v.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=ls,...o}=e,i=eh(r);return l.jsx(Jg,{...i,...o,ref:t,align:n,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Rm.displayName=F8;var[z8,py]=Ia(ii,{}),Pm="SelectViewport",fE=v.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,o=No(Pm,r),i=py(Pm,r),a=Ke(t,o.onViewportChange),c=v.useRef(0);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),l.jsx(Qf.Slot,{scope:r,children:l.jsx(Re.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"auto",...s.style},onScroll:ce(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&f){const y=Math.abs(c.current-d.scrollTop);if(y>0){const x=window.innerHeight-ls*2,g=parseFloat(f.style.minHeight),_=parseFloat(f.style.height),p=Math.max(g,_);if(p0?C:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});fE.displayName=Pm;var hE="SelectGroup",[U8,$8]=Ia(hE),pE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Ur();return l.jsx(U8,{scope:r,id:s,children:l.jsx(Re.div,{role:"group","aria-labelledby":s,...n,ref:t})})});pE.displayName=hE;var mE="SelectLabel",gE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=$8(mE,r);return l.jsx(Re.div,{id:s.id,...n,ref:t})});gE.displayName=mE;var Yd="SelectItem",[V8,vE]=Ia(Yd),yE=v.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...i}=e,a=Eo(Yd,r),c=No(Yd,r),u=a.value===n,[d,f]=v.useState(o??""),[m,y]=v.useState(!1),x=Ke(t,p=>{var h;return(h=c.itemRefCallback)==null?void 0:h.call(c,p,n,s)}),g=Ur(),_=()=>{s||(a.onValueChange(n),a.onOpenChange(!1))};if(n==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l.jsx(V8,{scope:r,value:n,disabled:s,textId:g,isSelected:u,onItemTextChange:v.useCallback(p=>{f(h=>h||((p==null?void 0:p.textContent)??"").trim())},[]),children:l.jsx(Qf.ItemSlot,{scope:r,value:n,disabled:s,textValue:d,children:l.jsx(Re.div,{role:"option","aria-labelledby":g,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:x,onFocus:ce(i.onFocus,()=>y(!0)),onBlur:ce(i.onBlur,()=>y(!1)),onPointerUp:ce(i.onPointerUp,_),onPointerMove:ce(i.onPointerMove,p=>{var h;s?(h=c.onItemLeave)==null||h.call(c):p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ce(i.onPointerLeave,p=>{var h;p.currentTarget===document.activeElement&&((h=c.onItemLeave)==null||h.call(c))}),onKeyDown:ce(i.onKeyDown,p=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&p.key===" "||(T8.includes(p.key)&&_(),p.key===" "&&p.preventDefault())})})})})});yE.displayName=Yd;var ll="SelectItemText",xE=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...o}=e,i=Eo(ll,r),a=No(ll,r),c=vE(ll,r),u=D8(ll,r),[d,f]=v.useState(null),m=Ke(t,p=>f(p),c.onItemTextChange,p=>{var h;return(h=a.itemTextRefCallback)==null?void 0:h.call(a,p,c.value,c.disabled)}),y=d==null?void 0:d.textContent,x=v.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:y},c.value),[c.disabled,c.value,y]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return Jt(()=>(g(x),()=>_(x)),[g,_,x]),l.jsxs(l.Fragment,{children:[l.jsx(Re.span,{id:c.textId,...o,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ns.createPortal(o.children,i.valueNode):null]})});xE.displayName=ll;var wE="SelectItemIndicator",_E=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return vE(wE,r).isSelected?l.jsx(Re.span,{"aria-hidden":!0,...n,ref:t}):null});_E.displayName=wE;var Am="SelectScrollUpButton",bE=v.forwardRef((e,t)=>{const r=No(Am,e.__scopeSelect),n=py(Am,e.__scopeSelect),[s,o]=v.useState(!1),i=Ke(t,n.onScrollButtonChange);return Jt(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollTop>0;o(u)};const c=r.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(kE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});bE.displayName=Am;var Dm="SelectScrollDownButton",SE=v.forwardRef((e,t)=>{const r=No(Dm,e.__scopeSelect),n=py(Dm,e.__scopeSelect),[s,o]=v.useState(!1),i=Ke(t,n.onScrollButtonChange);return Jt(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(kE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});SE.displayName=Dm;var kE=v.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,o=No("SelectScrollButton",r),i=v.useRef(null),a=Jf(r),c=v.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Jt(()=>{var d;const u=a().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),l.jsx(Re.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ce(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:ce(s.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:ce(s.onPointerLeave,()=>{c()})})}),W8="SelectSeparator",CE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return l.jsx(Re.div,{"aria-hidden":!0,...n,ref:t})});CE.displayName=W8;var Om="SelectArrow",B8=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=eh(r),o=Eo(Om,r),i=No(Om,r);return o.open&&i.position==="popper"?l.jsx(ev,{...s,...n,ref:t}):null});B8.displayName=Om;function jE(e){return e===""||e===void 0}var EE=v.forwardRef((e,t)=>{const{value:r,...n}=e,s=v.useRef(null),o=Ke(t,s),i=YC(r);return v.useEffect(()=>{const a=s.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==r&&d){const f=new Event("change",{bubbles:!0});d.call(a,r),a.dispatchEvent(f)}},[i,r]),l.jsx(Ic,{asChild:!0,children:l.jsx("select",{...n,ref:o,defaultValue:r})})});EE.displayName="BubbleSelect";function NE(e){const t=Dt(e),r=v.useRef(""),n=v.useRef(0),s=v.useCallback(i=>{const a=r.current+i;t(a),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(a)},[t]),o=v.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function TE(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=H8(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function H8(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Y8=tE,RE=nE,Z8=oE,K8=iE,G8=aE,PE=lE,q8=fE,X8=pE,AE=gE,DE=yE,Q8=xE,J8=_E,OE=bE,ME=SE,IE=CE;const Mo=Y8,cl=X8,Io=Z8,Ks=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(RE,{ref:n,className:ae("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,l.jsx(K8,{asChild:!0,children:l.jsx(Lg,{className:"h-4 w-4 opacity-50"})})]}));Ks.displayName=RE.displayName;const LE=v.forwardRef(({className:e,...t},r)=>l.jsx(OE,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(aA,{className:"h-4 w-4"})}));LE.displayName=OE.displayName;const FE=v.forwardRef(({className:e,...t},r)=>l.jsx(ME,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Lg,{className:"h-4 w-4"})}));FE.displayName=ME.displayName;const Gs=v.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>l.jsx(G8,{children:l.jsxs(PE,{ref:s,className:ae("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[l.jsx(LE,{}),l.jsx(q8,{className:ae("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(FE,{})]})}));Gs.displayName=PE.displayName;const Wi=v.forwardRef(({className:e,...t},r)=>l.jsx(AE,{ref:r,className:ae("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Wi.displayName=AE.displayName;const pn=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(DE,{ref:n,className:ae("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(J8,{children:l.jsx(eb,{className:"h-4 w-4"})})}),l.jsx(Q8,{children:t})]}));pn.displayName=DE.displayName;const eU=v.forwardRef(({className:e,...t},r)=>l.jsx(IE,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));eU.displayName=IE.displayName;const Mm=new Map([["aliyun-cdn",["阿里云-CDN","/imgs/providers/aliyun.svg"]],["aliyun-oss",["阿里云-OSS","/imgs/providers/aliyun.svg"]],["aliyun-dcdn",["阿里云-DCDN","/imgs/providers/aliyun.svg"]],["tencent-cdn",["腾讯云-CDN","/imgs/providers/tencent.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.svg"]],["qiniu-cdn",["七牛云-CDN","/imgs/providers/qiniu.svg"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),tU=Array.from(Mm.keys()),my=mv,gy=gv,rU=vv,zE=v.forwardRef(({className:e,...t},r)=>l.jsx(Ec,{ref:r,className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));zE.displayName=Ec.displayName;const th=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(rU,{children:[l.jsx(zE,{}),l.jsxs(Nc,{ref:n,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,l.jsxs(Tf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(Fg,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));th.displayName=Nc.displayName;const rh=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});rh.displayName="DialogHeader";const nh=v.forwardRef(({className:e,...t},r)=>l.jsx(Tc,{ref:r,className:ae("text-lg font-semibold leading-none tracking-tight",e),...t}));nh.displayName=Tc.displayName;const nU=v.forwardRef(({className:e,...t},r)=>l.jsx(Rc,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));nU.displayName=Rc.displayName;function sU(e,t){return v.useReducer((r,n)=>t[r][n]??r,e)}var vy="ScrollArea",[UE,E$]=xr(vy),[oU,cn]=UE(vy),$E=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:o=600,...i}=e,[a,c]=v.useState(null),[u,d]=v.useState(null),[f,m]=v.useState(null),[y,x]=v.useState(null),[g,_]=v.useState(null),[p,h]=v.useState(0),[w,C]=v.useState(0),[j,E]=v.useState(!1),[R,P]=v.useState(!1),A=Ke(t,q=>c(q)),L=Ea(s);return l.jsx(oU,{scope:r,type:n,dir:L,scrollHideDelay:o,scrollArea:a,viewport:u,onViewportChange:d,content:f,onContentChange:m,scrollbarX:y,onScrollbarXChange:x,scrollbarXEnabled:j,onScrollbarXEnabledChange:E,scrollbarY:g,onScrollbarYChange:_,scrollbarYEnabled:R,onScrollbarYEnabledChange:P,onCornerWidthChange:h,onCornerHeightChange:C,children:l.jsx(Re.div,{dir:L,...i,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":p+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});$E.displayName=vy;var VE="ScrollAreaViewport",WE=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...o}=e,i=cn(VE,r),a=v.useRef(null),c=Ke(t,a,i.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(Re.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});WE.displayName=VE;var Xn="ScrollAreaScrollbar",yy=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,a=e.orientation==="horizontal";return v.useEffect(()=>(a?o(!0):i(!0),()=>{a?o(!1):i(!1)}),[a,o,i]),s.type==="hover"?l.jsx(iU,{...n,ref:t,forceMount:r}):s.type==="scroll"?l.jsx(aU,{...n,ref:t,forceMount:r}):s.type==="auto"?l.jsx(BE,{...n,ref:t,forceMount:r}):s.type==="always"?l.jsx(xy,{...n,ref:t}):null});yy.displayName=Xn;var iU=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),[o,i]=v.useState(!1);return v.useEffect(()=>{const a=s.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),l.jsx(ur,{present:r||o,children:l.jsx(BE,{"data-state":o?"visible":"hidden",...n,ref:t})})}),aU=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),o=e.orientation==="horizontal",i=oh(()=>c("SCROLL_END"),100),[a,c]=sU("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,s.scrollHideDelay,c]),v.useEffect(()=>{const u=s.viewport,d=o?"scrollLeft":"scrollTop";if(u){let f=u[d];const m=()=>{const y=u[d];f!==y&&(c("SCROLL"),i()),f=y};return u.addEventListener("scroll",m),()=>u.removeEventListener("scroll",m)}},[s.viewport,o,c,i]),l.jsx(ur,{present:r||a!=="hidden",children:l.jsx(xy,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:ce(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ce(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),BE=v.forwardRef((e,t)=>{const r=cn(Xn,e.__scopeScrollArea),{forceMount:n,...s}=e,[o,i]=v.useState(!1),a=e.orientation==="horizontal",c=oh(()=>{if(r.viewport){const u=r.viewport.offsetWidth{const{orientation:r="vertical",...n}=e,s=cn(Xn,e.__scopeScrollArea),o=v.useRef(null),i=v.useRef(0),[a,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=GE(a.viewport,a.content),d={...n,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:m=>o.current=m,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:m=>i.current=m};function f(m,y){return hU(m,i.current,a,y)}return r==="horizontal"?l.jsx(lU,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollLeft,y=yw(m,a,s.dir);o.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollLeft=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollLeft=f(m,s.dir))}}):r==="vertical"?l.jsx(cU,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollTop,y=yw(m,a);o.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollTop=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollTop=f(m))}}):null}),lU=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=cn(Xn,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Ke(t,c,o.onScrollbarXChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(YE,{"data-orientation":"horizontal",...s,ref:u,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":sh(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const m=o.viewport.scrollLeft+d.deltaX;e.onWheelScroll(m),XE(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Kd(i.paddingLeft),paddingEnd:Kd(i.paddingRight)}})}})}),cU=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=cn(Xn,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Ke(t,c,o.onScrollbarYChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(YE,{"data-orientation":"vertical",...s,ref:u,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":sh(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const m=o.viewport.scrollTop+d.deltaY;e.onWheelScroll(m),XE(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Kd(i.paddingTop),paddingEnd:Kd(i.paddingBottom)}})}})}),[uU,HE]=UE(Xn),YE=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...m}=e,y=cn(Xn,r),[x,g]=v.useState(null),_=Ke(t,A=>g(A)),p=v.useRef(null),h=v.useRef(""),w=y.viewport,C=n.content-n.viewport,j=Dt(d),E=Dt(c),R=oh(f,10);function P(A){if(p.current){const L=A.clientX-p.current.left,q=A.clientY-p.current.top;u({x:L,y:q})}}return v.useEffect(()=>{const A=L=>{const q=L.target;(x==null?void 0:x.contains(q))&&j(L,C)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[w,x,C,j]),v.useEffect(E,[n,E]),wa(x,R),wa(y.content,R),l.jsx(uU,{scope:r,scrollbar:x,hasThumb:s,onThumbChange:Dt(o),onThumbPointerUp:Dt(i),onThumbPositionChange:E,onThumbPointerDown:Dt(a),children:l.jsx(Re.div,{...m,ref:_,style:{position:"absolute",...m.style},onPointerDown:ce(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),p.current=x.getBoundingClientRect(),h.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),P(A))}),onPointerMove:ce(e.onPointerMove,P),onPointerUp:ce(e.onPointerUp,A=>{const L=A.target;L.hasPointerCapture(A.pointerId)&&L.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=h.current,y.viewport&&(y.viewport.style.scrollBehavior=""),p.current=null})})})}),Zd="ScrollAreaThumb",ZE=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=HE(Zd,e.__scopeScrollArea);return l.jsx(ur,{present:r||s.hasThumb,children:l.jsx(dU,{ref:t,...n})})}),dU=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,o=cn(Zd,r),i=HE(Zd,r),{onThumbPositionChange:a}=i,c=Ke(t,f=>i.onThumbChange(f)),u=v.useRef(),d=oh(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const f=o.viewport;if(f){const m=()=>{if(d(),!u.current){const y=pU(f,a);u.current=y,a()}};return a(),f.addEventListener("scroll",m),()=>f.removeEventListener("scroll",m)}},[o.viewport,d,a]),l.jsx(Re.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ce(e.onPointerDownCapture,f=>{const y=f.target.getBoundingClientRect(),x=f.clientX-y.left,g=f.clientY-y.top;i.onThumbPointerDown({x,y:g})}),onPointerUp:ce(e.onPointerUp,i.onThumbPointerUp)})});ZE.displayName=Zd;var wy="ScrollAreaCorner",KE=v.forwardRef((e,t)=>{const r=cn(wy,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?l.jsx(fU,{...e,ref:t}):null});KE.displayName=wy;var fU=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=cn(wy,r),[o,i]=v.useState(0),[a,c]=v.useState(0),u=!!(o&&a);return wa(s.scrollbarX,()=>{var f;const d=((f=s.scrollbarX)==null?void 0:f.offsetHeight)||0;s.onCornerHeightChange(d),c(d)}),wa(s.scrollbarY,()=>{var f;const d=((f=s.scrollbarY)==null?void 0:f.offsetWidth)||0;s.onCornerWidthChange(d),i(d)}),u?l.jsx(Re.div,{...n,ref:t,style:{width:o,height:a,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Kd(e){return e?parseInt(e,10):0}function GE(e,t){const r=e/t;return isNaN(r)?0:r}function sh(e){const t=GE(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function hU(e,t,r,n="ltr"){const s=sh(r),o=s/2,i=t||o,a=s-i,c=r.scrollbar.paddingStart+i,u=r.scrollbar.size-r.scrollbar.paddingEnd-a,d=r.content-r.viewport,f=n==="ltr"?[0,d]:[d*-1,0];return qE([c,u],f)(e)}function yw(e,t,r="ltr"){const n=sh(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,i=t.content-t.viewport,a=o-n,c=r==="ltr"?[0,i]:[i*-1,0],u=Tm(e,c);return qE([0,i],[0,a])(u)}function qE(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function XE(e,t){return e>0&&e{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function s(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,a=r.top!==o.top;(i||a)&&t(),r=o,n=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(n)};function oh(e,t){const r=Dt(e),n=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),v.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function wa(e,t){const r=Dt(t);Jt(()=>{let n=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(n),s.unobserve(e)}}},[e,r])}var QE=$E,mU=WE,gU=KE;const ih=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(QE,{ref:n,className:ae("relative overflow-hidden",e),...r,children:[l.jsx(mU,{className:"h-full w-full rounded-[inherit]",children:t}),l.jsx(JE,{}),l.jsx(gU,{})]}));ih.displayName=QE.displayName;const JE=v.forwardRef(({className:e,orientation:t="vertical",...r},n)=>l.jsx(yy,{ref:n,orientation:t,className:ae("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:l.jsx(ZE,{className:"relative flex-1 rounded-full bg-border"})}));JE.displayName=yy.displayName;const uo=new Map([["tencent",["腾讯云","/imgs/providers/tencent.svg"]],["aliyun",["阿里云","/imgs/providers/aliyun.svg"]],["cloudflare",["Cloudflare","/imgs/providers/cloudflare.svg"]],["namesilo",["Namesilo","/imgs/providers/namesilo.svg"]],["godaddy",["GoDaddy","/imgs/providers/godaddy.svg"]],["qiniu",["七牛云","/imgs/providers/qiniu.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.svg"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),xw=e=>uo.get(e),To=pe.union([pe.literal("aliyun"),pe.literal("tencent"),pe.literal("ssh"),pe.literal("webhook"),pe.literal("cloudflare"),pe.literal("qiniu"),pe.literal("namesilo"),pe.literal("godaddy")],{message:"请选择云服务商"}),Ro=e=>{switch(e){case"aliyun":case"tencent":return"all";case"ssh":case"webhook":case"qiniu":return"deploy";case"cloudflare":case"namesilo":case"godaddy":return"apply";default:return"all"}},vU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,secretId:pe.string().min(1).max(64),secretKey:pe.string().min(1).max(64)});let o={secretId:"",secretKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"tencent",secretId:o.secretId,secretKey:o.secretKey}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{secretId:c.secretId,secretKey:c.secretKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretId"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretId",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretKey",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},yU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,accessKeyId:pe.string().min(1).max(64),accessSecretId:pe.string().min(1).max(64)});let o={accessKeyId:"",accessKeySecret:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"aliyun",accessKeyId:o.accessKeyId,accessSecretId:o.accessKeySecret}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{accessKeyId:c.accessKeyId,accessKeySecret:c.accessSecretId}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessKeyId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKeyId"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKeyId",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessSecretId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKeySecret"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKeySecret",...c})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},mc=v.forwardRef(({className:e,...t},r)=>l.jsx("textarea",{className:ae("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));mc.displayName="Textarea";const _y=({className:e,trigger:t})=>{const{reloadAccessGroups:r}=Kr(),[n,s]=v.useState(!1),o=pe.object({name:pe.string().min(1).max(64)}),i=Tr({resolver:Rr(o),defaultValues:{name:""}}),a=async c=>{try{await b3({name:c.name}),r(),s(!1)}catch(u){Object.entries(u.response.data).forEach(([f,m])=>{i.setError(f,{type:"manual",message:m.message})})}};return l.jsxs(my,{onOpenChange:s,open:n,children:[l.jsx(gy,{asChild:!0,className:ae(e),children:t}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsx(nh,{children:"添加分组"})}),l.jsx("div",{className:"container py-3",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"组名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入组名",...c,type:"text"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})},xU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n,reloadAccessGroups:s,config:{accessGroups:o}}=Kr(),i=v.useRef(null),[a,c]=v.useState(""),u=e&&e.group?e.group:"",d=/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,f=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,m=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,host:pe.string().refine(h=>f.test(h)||d.test(h),{message:"请输入正确的域名或IP"}),group:pe.string().optional(),port:pe.string().min(1).max(5),username:pe.string().min(1).max(64),password:pe.string().min(0).max(64),key:pe.string().min(0).max(20480),keyFile:pe.any().optional(),command:pe.string().min(1).max(2048),certPath:pe.string().min(0).max(2048),keyPath:pe.string().min(0).max(2048)});let y={host:"127.0.0.1",port:"22",username:"root",password:"",key:"",keyFile:"",command:"sudo service nginx restart",certPath:"/etc/nginx/ssl/certificate.crt",keyPath:"/etc/nginx/ssl/private.key"};e&&(y=e.config);const x=Tr({resolver:Rr(m),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"ssh",group:e==null?void 0:e.group,host:y.host,port:y.port,username:y.username,password:y.password,key:y.key,keyFile:y.keyFile,certPath:y.certPath,keyPath:y.keyPath,command:y.command}}),g=async h=>{console.log(h);let w=h.group;w=="emptyId"&&(w="");const C={id:h.id,name:h.name,configType:h.configType,usage:Ro(h.configType),group:w,config:{host:h.host,port:h.port,username:h.username,password:h.password,key:h.key,command:h.command,certPath:h.certPath,keyPath:h.keyPath}};try{const j=await jo(C);t(),C.id=j.id,C.created=j.created,C.updated=j.updated,h.id?n(C):r(C),w!=u&&(u&&await nw({id:u,"access-":C.id}),w&&await nw({id:w,"access+":C.id})),s()}catch(j){Object.entries(j.response.data).forEach(([R,P])=>{x.setError(R,{type:"manual",message:P.message})});return}},_=async h=>{var E;const w=(E=h.target.files)==null?void 0:E[0];if(!w)return;const C=w;c(C.name);const j=await Z6(C);x.setValue("key",j)},p=()=>{var h;console.log(i.current),(h=i.current)==null||h.click()};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...x,children:l.jsxs("form",{onSubmit:h=>{h.stopPropagation(),x.handleSubmit(g)(h)},className:"space-y-3",children:[l.jsx(Ne,{control:x.control,name:"name",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"group",render:({field:h})=>l.jsxs(Ce,{children:[l.jsxs(je,{className:"w-full flex justify-between",children:[l.jsx("div",{children:"授权配置组(用于将一个域名证书部署到多个 ssh 主机)"}),l.jsx(_y,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]})})]}),l.jsx(Ee,{children:l.jsxs(Mo,{...h,value:h.value,defaultValue:"emptyId",onValueChange:w=>{x.setValue("group",w)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择分组"})}),l.jsxs(Gs,{children:[l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),o.map(w=>l.jsx(pn,{value:w.id?w.id:"",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:w.name})},w.id))]})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"id",render:({field:h})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"configType",render:({field:h})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...h})}),l.jsx(Se,{})]})}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(Ne,{control:x.control,name:"host",render:({field:h})=>l.jsxs(Ce,{className:"grow",children:[l.jsx(je,{children:"服务器HOST"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Host",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"port",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SSH端口"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Port",...h,type:"number"})}),l.jsx(Se,{})]})})]}),l.jsx(Ne,{control:x.control,name:"username",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"用户名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入用户名",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"password",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入密码",...h,type:"password"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"key",render:({field:h})=>l.jsxs(Ce,{hidden:!0,children:[l.jsx(je,{children:"Key(使用证书登录)"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Key",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"keyFile",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Key(使用证书登录)"}),l.jsx(Ee,{children:l.jsxs("div",{children:[l.jsx(He,{type:"button",variant:"secondary",size:"sm",className:"w-48",onClick:p,children:a||"请选择文件"}),l.jsx(Te,{placeholder:"请输入Key",...h,ref:i,className:"hidden",hidden:!0,type:"file",onChange:_})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"certPath",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"证书上传路径"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入证书上传路径",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"keyPath",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"私钥上传路径"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入私钥上传路径",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"command",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Command"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:"请输入要执行的命令",...h})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},wU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,url:pe.string().url()});let o={url:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"webhook",url:o.url}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{url:c.url}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"url",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Webhook Url"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Webhook Url",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},_U=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,dnsApiToken:pe.string().min(1).max(64)});let o={dnsApiToken:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"cloudflare",dnsApiToken:o.dnsApiToken}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{dnsApiToken:c.dnsApiToken}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"dnsApiToken",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"CLOUD_DNS_API_TOKEN"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入CLOUD_DNS_API_TOKEN",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},bU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,accessKey:pe.string().min(1).max(64),secretKey:pe.string().min(1).max(64)});let o={accessKey:"",secretKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"qiniu",accessKey:o.accessKey,secretKey:o.secretKey}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{accessKey:c.accessKey,secretKey:c.secretKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKey",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretKey",...c})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},SU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,apiKey:pe.string().min(1).max(64)});let o={apiKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"namesilo",apiKey:o.apiKey}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{apiKey:c.apiKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"NAMESILO_API_KEY"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入NAMESILO_API_KEY",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},kU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,apiKey:pe.string().min(1).max(64),apiSecret:pe.string().min(1).max(64)});let o={apiKey:"",apiSecret:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"godaddy",apiKey:o.apiKey,apiSecret:o.apiSecret}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{apiKey:c.apiKey,apiSecret:c.apiSecret}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"GODADDY_API_KEY"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入GODADDY_API_KEY",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiSecret",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"GODADDY_API_SECRET"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入GODADDY_API_SECRET",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})};function jl({trigger:e,op:t,data:r,className:n}){const[s,o]=v.useState(!1),i=Array.from(uo.keys()),[a,c]=v.useState((r==null?void 0:r.configType)||"");let u=l.jsx(l.Fragment,{children:" "});switch(a){case"tencent":u=l.jsx(vU,{data:r,onAfterReq:()=>{o(!1)}});break;case"aliyun":u=l.jsx(yU,{data:r,onAfterReq:()=>{o(!1)}});break;case"ssh":u=l.jsx(xU,{data:r,onAfterReq:()=>{o(!1)}});break;case"webhook":u=l.jsx(wU,{data:r,onAfterReq:()=>{o(!1)}});break;case"cloudflare":u=l.jsx(_U,{data:r,onAfterReq:()=>{o(!1)}});break;case"qiniu":u=l.jsx(bU,{data:r,onAfterReq:()=>{o(!1)}});break;case"namesilo":u=l.jsx(SU,{data:r,onAfterReq:()=>{o(!1)}});break;case"godaddy":u=l.jsx(kU,{data:r,onAfterReq:()=>{o(!1)}});break}const d=f=>f==a?"border-primary":"";return l.jsxs(my,{onOpenChange:o,open:s,children:[l.jsx(gy,{asChild:!0,className:ae(n),children:e}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsxs(nh,{children:[t=="add"?"添加":"编辑","授权"]})}),l.jsx(ih,{className:"max-h-[80vh]",children:l.jsxs("div",{className:"container py-3",children:[l.jsx(Ma,{children:"服务商"}),l.jsxs(Mo,{onValueChange:f=>{console.log(f),c(f)},defaultValue:a,children:[l.jsx(Ks,{className:"mt-3",children:l.jsx(Io,{placeholder:"请选择服务商"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"服务商"}),i.map(f=>{var m,y;return l.jsx(pn,{value:f,children:l.jsxs("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer",d(f)),children:[l.jsx("img",{src:(m=uo.get(f))==null?void 0:m[1],className:"h-6 w-6"}),l.jsx("div",{children:(y=uo.get(f))==null?void 0:y[0]})]})},f)})]})})]}),u]})})]})]})}const CU=({className:e,trigger:t})=>{const{config:{emails:r},setEmails:n}=Kr(),[s,o]=v.useState(!1),i=pe.object({email:pe.string().email()}),a=Tr({resolver:Rr(i),defaultValues:{email:""}}),c=async u=>{if(r.content.emails.includes(u.email)){a.setError("email",{message:"邮箱已存在"});return}const d=[...r.content.emails,u.email];try{const f=await Mc({...r,name:"emails",content:{emails:d}});n(f),a.reset(),a.clearErrors(),o(!1)}catch(f){Object.entries(f.response.data).forEach(([y,x])=>{a.setError(y,{type:"manual",message:x.message})})}};return l.jsxs(my,{onOpenChange:o,open:s,children:[l.jsx(gy,{asChild:!0,className:ae(e),children:t}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsx(nh,{children:"添加邮箱"})}),l.jsx("div",{className:"container py-3",children:l.jsx(Pr,{...a,children:l.jsxs("form",{onSubmit:u=>{console.log(u),u.stopPropagation(),a.handleSubmit(c)(u)},className:"space-y-8",children:[l.jsx(Ne,{control:a.control,name:"email",render:({field:u})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"邮箱"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入邮箱",...u,type:"email"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})},jU=()=>{const{config:{accesses:e,emails:t,accessGroups:r}}=Kr(),[n,s]=v.useState(),o=Nn(),[i,a]=v.useState("base"),[c,u]=v.useState(n?n.targetType:"");v.useEffect(()=>{const p=new URLSearchParams(o.search).get("id");p&&(async()=>{const w=await Q6(p);s(w),u(w.targetType)})()},[o.search]);const d=pe.object({id:pe.string().optional(),domain:pe.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,{message:"请输入正确的域名"}),email:pe.string().email().optional(),access:pe.string().regex(/^[a-zA-Z0-9]+$/,{message:"请选择DNS服务商授权配置"}),targetAccess:pe.string().optional(),targetType:pe.string().regex(/^[a-zA-Z0-9-]+$/,{message:"请选择部署服务类型"}),variables:pe.string().optional(),group:pe.string().optional(),nameservers:pe.string().optional()}),f=Tr({resolver:Rr(d),defaultValues:{id:"",domain:"",email:"",access:"",targetAccess:"",targetType:"",variables:"",group:"",nameservers:""}});v.useEffect(()=>{n&&f.reset({id:n.id,domain:n.domain,email:n.email,access:n.access,targetAccess:n.targetAccess,targetType:n.targetType,variables:n.variables,group:n.group,nameservers:n.nameservers})},[n,f]);const m=e.filter(_=>{if(_.usage=="apply")return!1;if(c=="")return!0;const p=c.split("-");return _.configType===p[0]}),{toast:y}=qn(),x=Nr(),g=async _=>{const p=_.group=="emptyId"?"":_.group,h=_.targetAccess==="emptyId"?"":_.targetAccess;if(p==""&&h==""){f.setError("group",{type:"manual",message:"部署授权和部署授权组至少选一个"}),f.setError("targetAccess",{type:"manual",message:"部署授权和部署授权组至少选一个"});return}const w={id:_.id,crontab:"0 0 * * *",domain:_.domain,email:_.email,access:_.access,group:p,targetAccess:h,targetType:_.targetType,variables:_.variables,nameservers:_.nameservers};try{await km(w);let C="域名编辑成功";w.id==""&&(C="域名添加成功"),y({title:"成功",description:C}),x("/domains")}catch(C){Object.entries(C.response.data).forEach(([E,R])=>{f.setError(E,{type:"manual",message:R.message})});return}};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(ay,{}),l.jsxs("div",{className:" h-5 text-muted-foreground",children:[n!=null&&n.id?"编辑":"新增","域名"]}),l.jsxs("div",{className:"mt-5 flex w-full justify-center md:space-x-10 flex-col md:flex-row",children:[l.jsxs("div",{className:"w-full md:w-[200px] text-muted-foreground space-x-3 md:space-y-3 flex-row md:flex-col flex",children:[l.jsx("div",{className:ae("cursor-pointer text-right",i==="base"?"text-primary":""),onClick:()=>{a("base")},children:"基础设置"}),l.jsx("div",{className:ae("cursor-pointer text-right",i==="advance"?"text-primary":""),onClick:()=>{a("advance")},children:"高级设置"})]}),l.jsx("div",{className:"w-full md:w-[35em] bg-gray-100 dark:bg-gray-900 p-5 rounded mt-3 md:mt-0",children:l.jsx(Pr,{...f,children:l.jsxs("form",{onSubmit:f.handleSubmit(g),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:f.control,name:"domain",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsx(je,{children:"域名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入域名",..._})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"email",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"flex w-full justify-between",children:[l.jsx("div",{children:"Email(申请证书需要提供邮箱)"}),l.jsx(CU,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]})})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,onValueChange:p=>{f.setValue("email",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择邮箱"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"邮箱列表"}),t.content.emails.map(p=>l.jsx(pn,{value:p,children:l.jsx("div",{children:p})},p))]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"access",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"flex w-full justify-between",children:[l.jsx("div",{children:"DNS 服务商授权配置"}),l.jsx(jl,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]}),op:"add"})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,onValueChange:p=>{f.setValue("access",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择授权配置"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"服务商授权配置"}),e.filter(p=>p.usage!="deploy").map(p=>{var h;return l.jsx(pn,{value:p.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=uo.get(p.configType))==null?void 0:h[1]}),l.jsx("div",{children:p.name})]})},p.id)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"targetType",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsx(je,{children:"部署服务类型"}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,onValueChange:p=>{u(p),f.setValue("targetType",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择部署服务类型"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"部署服务类型"}),tU.map(p=>{var h,w;return l.jsx(pn,{value:p,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=Mm.get(p))==null?void 0:h[1]}),l.jsx("div",{children:(w=Mm.get(p))==null?void 0:w[0]})]})},p)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"targetAccess",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"w-full flex justify-between",children:[l.jsx("div",{children:"部署服务商授权配置"}),l.jsx(jl,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]}),op:"add"})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,onValueChange:p=>{f.setValue("targetAccess",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择授权配置"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsxs(Wi,{children:["服务商授权配置",f.getValues().targetAccess]}),l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:"flex items-center space-x-2",children:"--"})}),m.map(p=>{var h;return l.jsx(pn,{value:p.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=uo.get(p.configType))==null?void 0:h[1]}),l.jsx("div",{children:p.name})]})},p.id)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"group",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance"||c!="ssh",children:[l.jsx(je,{className:"w-full flex justify-between",children:l.jsx("div",{children:"部署配置组(用于将一个域名证书部署到多个 ssh 主机)"})}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,defaultValue:"emptyId",onValueChange:p=>{f.setValue("group",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择分组"})}),l.jsxs(Gs,{children:[l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),r.filter(p=>{var h;return p.expand&&((h=p.expand)==null?void 0:h.access.length)>0}).map(p=>l.jsx(pn,{value:p.id?p.id:"",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:p.name})},p.id))]})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"variables",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance",children:[l.jsx(je,{children:"变量"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:`可在SSH部署中使用,形如: +\0`,ne+=o(z,2),ne+=E.magic,ne+=o(w,2),ne+=o(C,2),ne+=o(Q.crc32,4),ne+=o(Q.compressedSize,4),ne+=o(Q.uncompressedSize,4),ne+=o(P.length,2),ne+=o(V.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ne+P+V,dirRecord:f.CENTRAL_FILE_HEADER+o(fe,2)+ne+o(q.length,2)+"\0\0\0\0"+o($,4)+o(_,4)+P+V+q}}var a=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),d=r("../crc32"),f=r("../signature");function m(y,x,g,_){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=g,this.encodeFileName=_,this.streamFiles=y,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(m,c),m.prototype.push=function(y){var x=y.meta.percent||0,g=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(y):(this.bytesWritten+=y.data.length,c.prototype.push.call(this,{data:y.data,meta:{currentFile:this.currentFile,percent:g?(x+100*(g-_-1))/g:100}}))},m.prototype.openedSource=function(y){this.currentSourceOffset=this.bytesWritten,this.currentFile=y.file.name;var x=this.streamFiles&&!y.file.dir;if(x){var g=i(y,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(y){this.accumulate=!1;var x=this.streamFiles&&!y.file.dir,g=i(y,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),x)this.push({data:function(_){return f.DATA_DESCRIPTOR+o(_.crc32,4)+o(_.compressedSize,4)+o(_.uncompressedSize,4)}(y),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var y=this.bytesWritten,x=0;x=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=a,u},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=i},{"../utils":32}],19:[function(r,n,s){var o=r("./Uint8ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var o=r("./DataReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var o=r("./ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var o=r("../utils"),i=r("../support"),a=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),d=r("./Uint8ArrayReader");n.exports=function(f){var m=o.getTypeOf(f);return o.checkSupport(m),m!=="string"||i.uint8array?m==="nodebuffer"?new u(f):i.uint8array?new d(o.transformTo("uint8array",f)):new a(o.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,s){var o=r("./GenericWorker"),i=r("../utils");function a(c){o.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(a,o),a.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var o=r("./GenericWorker"),i=r("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(a,o),a.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}o.inherits(a,i),a.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}i.prototype.processChunk.call(this,c)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(c){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=o.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}o.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,s){function o(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var c=0;c "+i:i}},n.exports=o},{}],29:[function(r,n,s){var o=r("../utils"),i=r("./ConvertWorker"),a=r("./GenericWorker"),c=r("../base64"),u=r("../support"),d=r("../external"),f=null;if(u.nodestream)try{f=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(x,g){return new d.Promise(function(_,p){var h=[],w=x._internalType,C=x._outputType,j=x._mimeType;x.on("data",function(E,R){h.push(E),g&&g(R)}).on("error",function(E){h=[],p(E)}).on("end",function(){try{var E=function(R,P,A){switch(R){case"blob":return o.newBlob(o.transformTo("arraybuffer",P),A);case"base64":return c.encode(P);default:return o.transformTo(R,P)}}(C,function(R,P){var A,L=0,q=null,N=0;for(A=0;A"u")s.blob=!1;else{var o=new ArrayBuffer(0);try{s.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(o),s.blob=i.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var o=r("./utils"),i=r("./support"),a=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function m(){c.call(this,"utf-8 encode")}s.utf8encode=function(y){return i.nodebuffer?a.newBufferFrom(y,"utf-8"):function(x){var g,_,p,h,w,C=x.length,j=0;for(h=0;h>>6:(_<65536?g[w++]=224|_>>>12:(g[w++]=240|_>>>18,g[w++]=128|_>>>12&63),g[w++]=128|_>>>6&63),g[w++]=128|63&_);return g}(y)},s.utf8decode=function(y){return i.nodebuffer?o.transformTo("nodebuffer",y).toString("utf-8"):function(x){var g,_,p,h,w=x.length,C=new Array(2*w);for(g=_=0;g>10&1023,C[_++]=56320|1023&p)}return C.length!==_&&(C.subarray?C=C.subarray(0,_):C.length=_),o.applyFromCharCode(C)}(y=o.transformTo(i.uint8array?"uint8array":"array",y))},o.inherits(f,c),f.prototype.processChunk=function(y){var x=o.transformTo(i.uint8array?"uint8array":"array",y.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var g=x;(x=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),x.set(g,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var _=function(h,w){var C;for((w=w||h.length)>h.length&&(w=h.length),C=w-1;0<=C&&(192&h[C])==128;)C--;return C<0||C===0?w:C+u[h[C]]>w?C:w}(x),p=x;_!==x.length&&(i.uint8array?(p=x.subarray(0,_),this.leftOver=x.subarray(_,x.length)):(p=x.slice(0,_),this.leftOver=x.slice(_,x.length))),this.push({data:s.utf8decode(p),meta:y.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=f,o.inherits(m,c),m.prototype.processChunk=function(y){this.push({data:s.utf8encode(y.data),meta:y.meta})},s.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var o=r("./support"),i=r("./base64"),a=r("./nodejsUtils"),c=r("./external");function u(g){return g}function d(g,_){for(var p=0;p>8;this.dir=!!(16&this.externalFileAttributes),y==0&&(this.dosPermissions=63&this.externalFileAttributes),y==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var y=o(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=y.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=y.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=y.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=y.readInt(4))}},readExtraFields:function(y){var x,g,_,p=y.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});y.index+4>>6:(y<65536?m[_++]=224|y>>>12:(m[_++]=240|y>>>18,m[_++]=128|y>>>12&63),m[_++]=128|y>>>6&63),m[_++]=128|63&y);return m},s.buf2binstring=function(f){return d(f,f.length)},s.binstring2buf=function(f){for(var m=new o.Buf8(f.length),y=0,x=m.length;y>10&1023,h[x++]=56320|1023&g)}return d(h,x)},s.utf8border=function(f,m){var y;for((m=m||f.length)>f.length&&(m=f.length),y=m-1;0<=y&&(192&f[y])==128;)y--;return y<0||y===0?m:y+c[f[y]]>m?y:m}},{"./common":41}],43:[function(r,n,s){n.exports=function(o,i,a,c){for(var u=65535&o|0,d=o>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3>>1:i>>>1;a[c]=i}return a}();n.exports=function(i,a,c,u){var d=o,f=u+c;i^=-1;for(var m=u;m>>8^d[255&(i^a[m])];return-1^i}},{}],46:[function(r,n,s){var o,i=r("../utils/common"),a=r("./trees"),c=r("./adler32"),u=r("./crc32"),d=r("./messages"),f=0,m=4,y=0,x=-2,g=-1,_=4,p=2,h=8,w=9,C=286,j=30,E=19,R=2*C+1,P=15,A=3,L=258,q=L+A+1,N=42,F=113,b=1,V=2,te=3,W=4;function Z(k,J){return k.msg=d[J],J}function I(k){return(k<<1)-(4k.avail_out&&(K=k.avail_out),K!==0&&(i.arraySet(k.output,J.pending_buf,J.pending_out,K,k.next_out),k.next_out+=K,J.pending_out+=K,k.total_out+=K,k.avail_out-=K,J.pending-=K,J.pending===0&&(J.pending_out=0))}function $(k,J){a._tr_flush_block(k,0<=k.block_start?k.block_start:-1,k.strstart-k.block_start,J),k.block_start=k.strstart,z(k.strm)}function fe(k,J){k.pending_buf[k.pending++]=J}function ne(k,J){k.pending_buf[k.pending++]=J>>>8&255,k.pending_buf[k.pending++]=255&J}function se(k,J){var K,D,S=k.max_chain_length,T=k.strstart,O=k.prev_length,Y=k.nice_match,M=k.strstart>k.w_size-q?k.strstart-(k.w_size-q):0,H=k.window,X=k.w_mask,ee=k.prev,me=k.strstart+L,Ye=H[T+O-1],Ue=H[T+O];k.prev_length>=k.good_match&&(S>>=2),Y>k.lookahead&&(Y=k.lookahead);do if(H[(K=J)+O]===Ue&&H[K+O-1]===Ye&&H[K]===H[T]&&H[++K]===H[T+1]){T+=2,K++;do;while(H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&TM&&--S!=0);return O<=k.lookahead?O:k.lookahead}function Oe(k){var J,K,D,S,T,O,Y,M,H,X,ee=k.w_size;do{if(S=k.window_size-k.lookahead-k.strstart,k.strstart>=ee+(ee-q)){for(i.arraySet(k.window,k.window,ee,ee,0),k.match_start-=ee,k.strstart-=ee,k.block_start-=ee,J=K=k.hash_size;D=k.head[--J],k.head[J]=ee<=D?D-ee:0,--K;);for(J=K=ee;D=k.prev[--J],k.prev[J]=ee<=D?D-ee:0,--K;);S+=ee}if(k.strm.avail_in===0)break;if(O=k.strm,Y=k.window,M=k.strstart+k.lookahead,H=S,X=void 0,X=O.avail_in,H=A)for(T=k.strstart-k.insert,k.ins_h=k.window[T],k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A)if(D=a._tr_tally(k,k.strstart-k.match_start,k.match_length-A),k.lookahead-=k.match_length,k.match_length<=k.max_lazy_match&&k.lookahead>=A){for(k.match_length--;k.strstart++,k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A&&k.match_length<=k.prev_length){for(S=k.strstart+k.lookahead-A,D=a._tr_tally(k,k.strstart-1-k.prev_match,k.prev_length-A),k.lookahead-=k.prev_length-1,k.prev_length-=2;++k.strstart<=S&&(k.ins_h=(k.ins_h<k.pending_buf_size-5&&(K=k.pending_buf_size-5);;){if(k.lookahead<=1){if(Oe(k),k.lookahead===0&&J===f)return b;if(k.lookahead===0)break}k.strstart+=k.lookahead,k.lookahead=0;var D=k.block_start+K;if((k.strstart===0||k.strstart>=D)&&(k.lookahead=k.strstart-D,k.strstart=D,$(k,!1),k.strm.avail_out===0)||k.strstart-k.block_start>=k.w_size-q&&($(k,!1),k.strm.avail_out===0))return b}return k.insert=0,J===m?($(k,!0),k.strm.avail_out===0?te:W):(k.strstart>k.block_start&&($(k,!1),k.strm.avail_out),b)}),new ke(4,4,8,4,he),new ke(4,5,16,8,he),new ke(4,6,32,32,he),new ke(4,4,16,16,ye),new ke(8,16,32,32,ye),new ke(8,16,128,128,ye),new ke(8,32,128,256,ye),new ke(32,128,258,1024,ye),new ke(32,258,258,4096,ye)],s.deflateInit=function(k,J){return nt(k,J,h,15,8,0)},s.deflateInit2=nt,s.deflateReset=Pe,s.deflateResetKeep=Me,s.deflateSetHeader=function(k,J){return k&&k.state?k.state.wrap!==2?x:(k.state.gzhead=J,y):x},s.deflate=function(k,J){var K,D,S,T;if(!k||!k.state||5>8&255),fe(D,D.gzhead.time>>16&255),fe(D,D.gzhead.time>>24&255),fe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),fe(D,255&D.gzhead.os),D.gzhead.extra&&D.gzhead.extra.length&&(fe(D,255&D.gzhead.extra.length),fe(D,D.gzhead.extra.length>>8&255)),D.gzhead.hcrc&&(k.adler=u(k.adler,D.pending_buf,D.pending,0)),D.gzindex=0,D.status=69):(fe(D,0),fe(D,0),fe(D,0),fe(D,0),fe(D,0),fe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),fe(D,3),D.status=F);else{var O=h+(D.w_bits-8<<4)<<8;O|=(2<=D.strategy||D.level<2?0:D.level<6?1:D.level===6?2:3)<<6,D.strstart!==0&&(O|=32),O+=31-O%31,D.status=F,ne(D,O),D.strstart!==0&&(ne(D,k.adler>>>16),ne(D,65535&k.adler)),k.adler=1}if(D.status===69)if(D.gzhead.extra){for(S=D.pending;D.gzindex<(65535&D.gzhead.extra.length)&&(D.pending!==D.pending_buf_size||(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending!==D.pending_buf_size));)fe(D,255&D.gzhead.extra[D.gzindex]),D.gzindex++;D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),D.gzindex===D.gzhead.extra.length&&(D.gzindex=0,D.status=73)}else D.status=73;if(D.status===73)if(D.gzhead.name){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){T=1;break}T=D.gzindexS&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),T===0&&(D.gzindex=0,D.status=91)}else D.status=91;if(D.status===91)if(D.gzhead.comment){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){T=1;break}T=D.gzindexS&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),T===0&&(D.status=103)}else D.status=103;if(D.status===103&&(D.gzhead.hcrc?(D.pending+2>D.pending_buf_size&&z(k),D.pending+2<=D.pending_buf_size&&(fe(D,255&k.adler),fe(D,k.adler>>8&255),k.adler=0,D.status=F)):D.status=F),D.pending!==0){if(z(k),k.avail_out===0)return D.last_flush=-1,y}else if(k.avail_in===0&&I(J)<=I(K)&&J!==m)return Z(k,-5);if(D.status===666&&k.avail_in!==0)return Z(k,-5);if(k.avail_in!==0||D.lookahead!==0||J!==f&&D.status!==666){var Y=D.strategy===2?function(M,H){for(var X;;){if(M.lookahead===0&&(Oe(M),M.lookahead===0)){if(H===f)return b;break}if(M.match_length=0,X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===m?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):D.strategy===3?function(M,H){for(var X,ee,me,Ye,Ue=M.window;;){if(M.lookahead<=L){if(Oe(M),M.lookahead<=L&&H===f)return b;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=A&&0M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=A?(X=a._tr_tally(M,1,M.match_length-A),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===m?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):o[D.level].func(D,J);if(Y!==te&&Y!==W||(D.status=666),Y===b||Y===te)return k.avail_out===0&&(D.last_flush=-1),y;if(Y===V&&(J===1?a._tr_align(D):J!==5&&(a._tr_stored_block(D,0,0,!1),J===3&&(Q(D.head),D.lookahead===0&&(D.strstart=0,D.block_start=0,D.insert=0))),z(k),k.avail_out===0))return D.last_flush=-1,y}return J!==m?y:D.wrap<=0?1:(D.wrap===2?(fe(D,255&k.adler),fe(D,k.adler>>8&255),fe(D,k.adler>>16&255),fe(D,k.adler>>24&255),fe(D,255&k.total_in),fe(D,k.total_in>>8&255),fe(D,k.total_in>>16&255),fe(D,k.total_in>>24&255)):(ne(D,k.adler>>>16),ne(D,65535&k.adler)),z(k),0=K.w_size&&(T===0&&(Q(K.head),K.strstart=0,K.block_start=0,K.insert=0),H=new i.Buf8(K.w_size),i.arraySet(H,J,X-K.w_size,K.w_size,0),J=H,X=K.w_size),O=k.avail_in,Y=k.next_in,M=k.input,k.avail_in=X,k.next_in=0,k.input=J,Oe(K);K.lookahead>=A;){for(D=K.strstart,S=K.lookahead-(A-1);K.ins_h=(K.ins_h<>>=A=P>>>24,w-=A,(A=P>>>16&255)===0)V[d++]=65535&P;else{if(!(16&A)){if(!(64&A)){P=C[(65535&P)+(h&(1<>>=A,w-=A),w<15&&(h+=b[c++]<>>=A=P>>>24,w-=A,!(16&(A=P>>>16&255))){if(!(64&A)){P=j[(65535&P)+(h&(1<>>=A,w-=A,(A=d-f)>3,h&=(1<<(w-=L<<3))-1,o.next_in=c,o.next_out=d,o.avail_in=c>>24&255)+(N>>>8&65280)+((65280&N)<<8)+((255&N)<<24)}function h(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(N){var F;return N&&N.state?(F=N.state,N.total_in=N.total_out=F.total=0,N.msg="",F.wrap&&(N.adler=1&F.wrap),F.mode=x,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new o.Buf32(g),F.distcode=F.distdyn=new o.Buf32(_),F.sane=1,F.back=-1,m):y}function C(N){var F;return N&&N.state?((F=N.state).wsize=0,F.whave=0,F.wnext=0,w(N)):y}function j(N,F){var b,V;return N&&N.state?(V=N.state,F<0?(b=0,F=-F):(b=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15=W.wsize?(o.arraySet(W.window,F,b-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(V<(te=W.wsize-W.wnext)&&(te=V),o.arraySet(W.window,F,b-V,te,W.wnext),(V-=te)?(o.arraySet(W.window,F,b-V,V,0),W.wnext=V,W.whave=W.wsize):(W.wnext+=te,W.wnext===W.wsize&&(W.wnext=0),W.whave>>8&255,b.check=a(b.check,T,2,0),$=z=0,b.mode=2;break}if(b.flags=0,b.head&&(b.head.done=!1),!(1&b.wrap)||(((255&z)<<8)+(z>>8))%31){N.msg="incorrect header check",b.mode=30;break}if((15&z)!=8){N.msg="unknown compression method",b.mode=30;break}if($-=4,k=8+(15&(z>>>=4)),b.wbits===0)b.wbits=k;else if(k>b.wbits){N.msg="invalid window size",b.mode=30;break}b.dmax=1<>8&1),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0,b.mode=3;case 3:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.time=z),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,T[2]=z>>>16&255,T[3]=z>>>24&255,b.check=a(b.check,T,4,0)),$=z=0,b.mode=4;case 4:for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.xflags=255&z,b.head.os=z>>8),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0,b.mode=5;case 5:if(1024&b.flags){for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.length=z,b.head&&(b.head.extra_len=z),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0}else b.head&&(b.head.extra=null);b.mode=6;case 6:if(1024&b.flags&&(I<(se=b.length)&&(se=I),se&&(b.head&&(k=b.head.extra_len-b.length,b.head.extra||(b.head.extra=new Array(b.head.extra_len)),o.arraySet(b.head.extra,V,W,se,k)),512&b.flags&&(b.check=a(b.check,V,se,W)),I-=se,W+=se,b.length-=se),b.length))break e;b.length=0,b.mode=7;case 7:if(2048&b.flags){if(I===0)break e;for(se=0;k=V[W+se++],b.head&&k&&b.length<65536&&(b.head.name+=String.fromCharCode(k)),k&&se>9&1,b.head.done=!0),N.adler=b.check=0,b.mode=12;break;case 10:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}N.adler=b.check=p(z),$=z=0,b.mode=11;case 11:if(b.havedict===0)return N.next_out=Z,N.avail_out=Q,N.next_in=W,N.avail_in=I,b.hold=z,b.bits=$,2;N.adler=b.check=1,b.mode=12;case 12:if(F===5||F===6)break e;case 13:if(b.last){z>>>=7&$,$-=7&$,b.mode=27;break}for(;$<3;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}switch(b.last=1&z,$-=1,3&(z>>>=1)){case 0:b.mode=14;break;case 1:if(L(b),b.mode=20,F!==6)break;z>>>=2,$-=2;break e;case 2:b.mode=17;break;case 3:N.msg="invalid block type",b.mode=30}z>>>=2,$-=2;break;case 14:for(z>>>=7&$,$-=7&$;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if((65535&z)!=(z>>>16^65535)){N.msg="invalid stored block lengths",b.mode=30;break}if(b.length=65535&z,$=z=0,b.mode=15,F===6)break e;case 15:b.mode=16;case 16:if(se=b.length){if(I>>=5,$-=5,b.ndist=1+(31&z),z>>>=5,$-=5,b.ncode=4+(15&z),z>>>=4,$-=4,286>>=3,$-=3}for(;b.have<19;)b.lens[O[b.have++]]=0;if(b.lencode=b.lendyn,b.lenbits=7,K={bits:b.lenbits},J=u(0,b.lens,0,19,b.lencode,0,b.work,K),b.lenbits=K.bits,J){N.msg="invalid code lengths set",b.mode=30;break}b.have=0,b.mode=19;case 19:for(;b.have>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(Fe<16)z>>>=ye,$-=ye,b.lens[b.have++]=Fe;else{if(Fe===16){for(D=ye+2;$>>=ye,$-=ye,b.have===0){N.msg="invalid bit length repeat",b.mode=30;break}k=b.lens[b.have-1],se=3+(3&z),z>>>=2,$-=2}else if(Fe===17){for(D=ye+3;$>>=ye)),z>>>=3,$-=3}else{for(D=ye+7;$>>=ye)),z>>>=7,$-=7}if(b.have+se>b.nlen+b.ndist){N.msg="invalid bit length repeat",b.mode=30;break}for(;se--;)b.lens[b.have++]=k}}if(b.mode===30)break;if(b.lens[256]===0){N.msg="invalid code -- missing end-of-block",b.mode=30;break}if(b.lenbits=9,K={bits:b.lenbits},J=u(d,b.lens,0,b.nlen,b.lencode,0,b.work,K),b.lenbits=K.bits,J){N.msg="invalid literal/lengths set",b.mode=30;break}if(b.distbits=6,b.distcode=b.distdyn,K={bits:b.distbits},J=u(f,b.lens,b.nlen,b.ndist,b.distcode,0,b.work,K),b.distbits=K.bits,J){N.msg="invalid distances set",b.mode=30;break}if(b.mode=20,F===6)break e;case 20:b.mode=21;case 21:if(6<=I&&258<=Q){N.next_out=Z,N.avail_out=Q,N.next_in=W,N.avail_in=I,b.hold=z,b.bits=$,c(N,ne),Z=N.next_out,te=N.output,Q=N.avail_out,W=N.next_in,V=N.input,I=N.avail_in,z=b.hold,$=b.bits,b.mode===12&&(b.back=-1);break}for(b.back=0;ke=(S=b.lencode[z&(1<>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(ke&&!(240&ke)){for(Me=ye,Pe=ke,nt=Fe;ke=(S=b.lencode[nt+((z&(1<>Me)])>>>16&255,Fe=65535&S,!(Me+(ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Me,$-=Me,b.back+=Me}if(z>>>=ye,$-=ye,b.back+=ye,b.length=Fe,ke===0){b.mode=26;break}if(32&ke){b.back=-1,b.mode=12;break}if(64&ke){N.msg="invalid literal/length code",b.mode=30;break}b.extra=15&ke,b.mode=22;case 22:if(b.extra){for(D=b.extra;$>>=b.extra,$-=b.extra,b.back+=b.extra}b.was=b.length,b.mode=23;case 23:for(;ke=(S=b.distcode[z&(1<>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(!(240&ke)){for(Me=ye,Pe=ke,nt=Fe;ke=(S=b.distcode[nt+((z&(1<>Me)])>>>16&255,Fe=65535&S,!(Me+(ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Me,$-=Me,b.back+=Me}if(z>>>=ye,$-=ye,b.back+=ye,64&ke){N.msg="invalid distance code",b.mode=30;break}b.offset=Fe,b.extra=15&ke,b.mode=24;case 24:if(b.extra){for(D=b.extra;$>>=b.extra,$-=b.extra,b.back+=b.extra}if(b.offset>b.dmax){N.msg="invalid distance too far back",b.mode=30;break}b.mode=25;case 25:if(Q===0)break e;if(se=ne-Q,b.offset>se){if((se=b.offset-se)>b.whave&&b.sane){N.msg="invalid distance too far back",b.mode=30;break}Oe=se>b.wnext?(se-=b.wnext,b.wsize-se):b.wnext-se,se>b.length&&(se=b.length),he=b.window}else he=te,Oe=Z-b.offset,se=b.length;for(QR?(A=Oe[he+_[F]],$[fe+_[F]]):(A=96,0),h=1<>Z)+(w-=h)]=P<<24|A<<16|L|0,w!==0;);for(h=1<>=1;if(h!==0?(z&=h-1,z+=h):z=0,F++,--ne[N]==0){if(N===V)break;N=f[m+_[F]]}if(te>>7)]}function fe(S,T){S.pending_buf[S.pending++]=255&T,S.pending_buf[S.pending++]=T>>>8&255}function ne(S,T,O){S.bi_valid>p-O?(S.bi_buf|=T<>p-S.bi_valid,S.bi_valid+=O-p):(S.bi_buf|=T<>>=1,O<<=1,0<--T;);return O>>>1}function he(S,T,O){var Y,M,H=new Array(_+1),X=0;for(Y=1;Y<=_;Y++)H[Y]=X=X+O[Y-1]<<1;for(M=0;M<=T;M++){var ee=S[2*M+1];ee!==0&&(S[2*M]=Oe(H[ee]++,ee))}}function ye(S){var T;for(T=0;T>1;1<=O;O--)Me(S,H,O);for(M=me;O=S.heap[1],S.heap[1]=S.heap[S.heap_len--],Me(S,H,1),Y=S.heap[1],S.heap[--S.heap_max]=O,S.heap[--S.heap_max]=Y,H[2*M]=H[2*O]+H[2*Y],S.depth[M]=(S.depth[O]>=S.depth[Y]?S.depth[O]:S.depth[Y])+1,H[2*O+1]=H[2*Y+1]=M,S.heap[1]=M++,Me(S,H,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(Ue,jt){var Gr,Ht,Qn,at,Jn,es,qr=jt.dyn_tree,$c=jt.max_code,Vc=jt.stat_desc.static_tree,hi=jt.stat_desc.has_stree,Wc=jt.stat_desc.extra_bits,pi=jt.stat_desc.extra_base,Pn=jt.stat_desc.max_length,Is=0;for(at=0;at<=_;at++)Ue.bl_count[at]=0;for(qr[2*Ue.heap[Ue.heap_max]+1]=0,Gr=Ue.heap_max+1;Gr>=7;M>>=1)if(1&Ye&&ee.dyn_ltree[2*me]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return a;for(me=32;me>>3,(H=S.static_len+3+7>>>3)<=M&&(M=H)):M=H=O+5,O+4<=M&&T!==-1?D(S,T,O,Y):S.strategy===4||H===M?(ne(S,2+(Y?1:0),3),Pe(S,q,N)):(ne(S,4+(Y?1:0),3),function(ee,me,Ye,Ue){var jt;for(ne(ee,me-257,5),ne(ee,Ye-1,5),ne(ee,Ue-4,4),jt=0;jt>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&T,S.pending_buf[S.l_buf+S.last_lit]=255&O,S.last_lit++,T===0?S.dyn_ltree[2*O]++:(S.matches++,T--,S.dyn_ltree[2*(b[O]+f+1)]++,S.dyn_dtree[2*$(T)]++),S.last_lit===S.lit_bufsize-1},s._tr_align=function(S){ne(S,2,3),se(S,w,q),function(T){T.bi_valid===16?(fe(T,T.bi_buf),T.bi_buf=0,T.bi_valid=0):8<=T.bi_valid&&(T.pending_buf[T.pending++]=255&T.bi_buf,T.bi_buf>>=8,T.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(r,n,s){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,n,s){(function(o){(function(i,a){if(!i.setImmediate){var c,u,d,f,m=1,y={},x=!1,g=i.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(i);_=_&&_.setTimeout?_:i,c={}.toString.call(i.process)==="[object process]"?function(C){process.nextTick(function(){h(C)})}:function(){if(i.postMessage&&!i.importScripts){var C=!0,j=i.onmessage;return i.onmessage=function(){C=!1},i.postMessage("","*"),i.onmessage=j,C}}()?(f="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",w,!1):i.attachEvent("onmessage",w),function(C){i.postMessage(f+C,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){h(C.data)},function(C){d.port2.postMessage(C)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(C){var j=g.createElement("script");j.onreadystatechange=function(){h(C),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(C){setTimeout(h,0,C)},_.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var j=new Array(arguments.length-1),E=0;E"u"?o===void 0?this:o:self)}).call(this,typeof Kc<"u"?Kc:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(bj);var Y6=bj.exports;const Z6=Lm(Y6);function K6(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{n.result?t(n.result.toString()):r("No content found")},n.onerror=()=>r(n.error),n.readAsText(e)})}const G6=async(e,t)=>{const r=new Z6;t.forEach(o=>{r.file(o.name,o.content)});const n=await r.generateAsync({type:"blob"}),s=document.createElement("a");s.href=URL.createObjectURL(n),s.download=e,s.click()},ga=e=>{const t=new Date(e);return new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"Asia/Shanghai"}).format(t)},q6=e=>ga(e).split(" ")[0];function Sj(e){const t=new Date;t.setUTCDate(t.getUTCDate()+e);const r=t.getUTCFullYear(),n=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0"),o=String(t.getUTCHours()).padStart(2,"0"),i=String(t.getUTCMinutes()).padStart(2,"0"),a=String(t.getUTCSeconds()).padStart(2,"0");return`${r}-${n}-${s} ${o}:${i}:${a}`}const X6=async e=>{let t=1;e.page&&(t=e.page);let r=2;e.perPage&&(r=e.perPage);const n=st();let s="";return e.state==="enabled"?s="enabled=true":e.state==="disabled"?s="enabled=false":e.state==="expired"&&(s=n.filter("expiredAt<{:expiredAt}",{expiredAt:Sj(15)})),n.collection("domains").getList(t,r,{sort:"-created",expand:"lastDeployment",filter:s})},Q6=async()=>{const e=st(),t=await e.collection("domains").getList(1,1,{}),r=await e.collection("domains").getList(1,1,{filter:e.filter("expiredAt<{:expiredAt}",{expiredAt:Sj(15)})}),n=await e.collection("domains").getList(1,1,{filter:"enabled=true"}),s=await e.collection("domains").getList(1,1,{filter:"enabled=false"});return{total:t.totalItems,expired:r.totalItems,enabled:n.totalItems,disabled:s.totalItems}},J6=async e=>await st().collection("domains").getOne(e),km=async e=>e.id?await st().collection("domains").update(e.id,e):await st().collection("domains").create(e),ez=async e=>await st().collection("domains").delete(e),tz=(e,t)=>st().collection("domains").subscribe(e,r=>{r.action==="update"&&t(r.record)},{expand:"lastDeployment"}),rz=e=>{st().collection("domains").unsubscribe(e)},nz=()=>{const e=qn(),t=Nr(),r=Nn(),n=new URLSearchParams(r.search),s=n.get("page"),o=n.get("state"),[i,a]=v.useState(0),c=()=>{t("/edit")},u=w=>{n.set("page",w.toString()),t(`?${n.toString()}`)},d=w=>{t(`/edit?id=${w}`)},f=w=>{t(`/history?domain=${w}`)},m=async w=>{try{await ez(w),x(y.filter(C=>C.id!==w))}catch(C){console.error("Error deleting domain:",C)}},[y,x]=v.useState([]);v.useEffect(()=>{(async()=>{const C=await X6({page:s?Number(s):1,perPage:10,state:o||""});x(C.items),a(C.totalPages)})()},[s,o]);const g=async w=>{const C=y.filter(P=>P.id===w),j=C[0].enabled,E=C[0];E.enabled=!j,await km(E);const R=y.map(P=>P.id===w?{...P,checked:!j}:P);x(R)},_=async w=>{try{rz(w.id),tz(w.id,C=>{console.log(C);const j=y.map(E=>E.id===C.id?{...C}:E);x(j)}),w.rightnow=!0,await km(w),e.toast({title:"操作成功",description:"已发起部署,请稍后查看部署日志。"})}catch{e.toast({title:"执行失败",description:l.jsxs(l.Fragment,{children:["执行失败,请查看",l.jsx(fr,{to:`/history?domain=${w.id}`,className:"underline text-blue-500",children:"部署日志"}),"查看详情。"]}),variant:"destructive"})}},p=async w=>{await _({...w,deployed:!1})},h=async w=>{const C=`${w.id}-${w.domain}.zip`,j=[{name:`${w.domain}.pem`,content:w.certificate?w.certificate:""},{name:`${w.domain}.key`,content:w.privateKey?w.privateKey:""}];await G6(C,j)};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(ay,{}),l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:"域名列表"}),l.jsx(He,{onClick:c,children:"新增域名"})]}),y.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-36",children:"域名"}),l.jsx("div",{className:"w-40",children:"有效期限"}),l.jsx("div",{className:"w-32",children:"最近执行状态"}),l.jsx("div",{className:"w-64",children:"最近执行阶段"}),l.jsx("div",{className:"w-40 sm:ml-2",children:"最近执行时间"}),l.jsx("div",{className:"w-24",children:"是否启用"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"域名"}),y.map(w=>{var C,j,E,R;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-36 w-full pt-1 sm:pt-0 flex items-center",children:w.domain}),l.jsx("div",{className:"sm:w-40 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx("div",{children:w.expiredAt?l.jsxs(l.Fragment,{children:[l.jsx("div",{children:"有效期90天"}),l.jsxs("div",{children:[q6(w.expiredAt),"到期"]})]}):"---"})}),l.jsx("div",{className:"sm:w-32 w-full pt-1 sm:pt-0 flex items-center",children:w.lastDeployedAt&&((C=w.expand)!=null&&C.lastDeployment)?l.jsx(l.Fragment,{children:l.jsx(Gv,{deployment:w.expand.lastDeployment})}):"---"}),l.jsx("div",{className:"sm:w-64 w-full pt-1 sm:pt-0 flex items-center",children:w.lastDeployedAt&&((j=w.expand)!=null&&j.lastDeployment)?l.jsx(Hv,{phase:(E=w.expand.lastDeployment)==null?void 0:E.phase,phaseSuccess:(R=w.expand.lastDeployment)==null?void 0:R.phaseSuccess}):"---"}),l.jsx("div",{className:"sm:w-40 pt-1 sm:pt-0 sm:ml-2 flex items-center",children:w.lastDeployedAt?ga(w.lastDeployedAt):"---"}),l.jsx("div",{className:"sm:w-24 flex items-center",children:l.jsx(Zv,{children:l.jsxs(gC,{children:[l.jsx(vC,{children:l.jsx(Lc,{checked:w.enabled,onCheckedChange:()=>{g(w.id)}})}),l.jsx(Kv,{children:l.jsx("div",{className:"border rounded-sm px-3 bg-background text-muted-foreground text-xs",children:w.enabled?"禁用":"启用"})})]})})}),l.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[l.jsx(He,{variant:"link",className:"p-0",onClick:()=>f(w.id),children:"部署历史"}),l.jsxs(na,{when:!!w.enabled,children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>_(w),children:"立即部署"})]}),l.jsxs(na,{when:!!(w.enabled&&w.deployed),children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>p(w),children:"强行部署"})]}),l.jsxs(na,{when:!!w.expiredAt,children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>h(w),children:"下载"})]}),!w.enabled&&l.jsxs(l.Fragment,{children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsxs(WC,{children:[l.jsx(BC,{asChild:!0,children:l.jsx(He,{variant:"link",className:"p-0",children:"删除"})}),l.jsxs(qv,{children:[l.jsxs(Xv,{children:[l.jsx(Jv,{children:"删除域名"}),l.jsx(ey,{children:"确定要删除域名吗?"})]}),l.jsxs(Qv,{children:[l.jsx(ry,{children:"取消"}),l.jsx(ty,{onClick:()=>{m(w.id)},children:"确认"})]})]})]}),l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>d(w.id),children:"编辑"})]})]})]},w.id)}),l.jsx(SC,{totalPages:i,currentPage:s?Number(s):1,onPageChange:w=>{u(w)}})]}):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(rm,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),l.jsx(He,{onClick:c,className:"mt-3",children:"添加域名"})]})})]})})},Te=v.forwardRef(({className:e,type:t,...r},n)=>l.jsx("input",{type:t,className:ae("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));Te.displayName="Input";var Fc=e=>e.type==="checkbox",$i=e=>e instanceof Date,pr=e=>e==null;const kj=e=>typeof e=="object";var qt=e=>!pr(e)&&!Array.isArray(e)&&kj(e)&&!$i(e),Cj=e=>qt(e)&&e.target?Fc(e.target)?e.target.checked:e.target.value:e,sz=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,jj=(e,t)=>e.has(sz(t)),oz=e=>{const t=e.constructor&&e.constructor.prototype;return qt(t)&&t.hasOwnProperty("isPrototypeOf")},ly=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function br(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(ly&&(e instanceof Blob||e instanceof FileList))&&(r||qt(e)))if(t=r?[]:{},!r&&!oz(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=br(e[n]));else return e;return t}var Kf=e=>Array.isArray(e)?e.filter(Boolean):[],Ft=e=>e===void 0,ue=(e,t,r)=>{if(!t||!qt(e))return r;const n=Kf(t.split(/[,[\].]+?/)).reduce((s,o)=>pr(s)?s:s[o],e);return Ft(n)||n===e?Ft(e[t])?r:e[t]:n},Fn=e=>typeof e=="boolean",cy=e=>/^\w*$/.test(e),Ej=e=>Kf(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ft=(e,t,r)=>{let n=-1;const s=cy(t)?[t]:Ej(t),o=s.length,i=o-1;for(;++nWe.useContext(Nj),iz=e=>{const{children:t,...r}=e;return We.createElement(Nj.Provider,{value:r},t)};var Tj=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==gn.all&&(t._proxyFormState[i]=!n||gn.all),r&&(r[i]=!0),e[i]}});return s},Or=e=>qt(e)&&!Object.keys(e).length,Rj=(e,t,r,n)=>{r(e);const{name:s,...o}=e;return Or(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!n||gn.all))},kl=e=>Array.isArray(e)?e:[e],Pj=(e,t,r)=>!e||!t||e===t||kl(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n)));function uy(e){const t=We.useRef(e);t.current=e,We.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}function az(e){const t=Gf(),{control:r=t.control,disabled:n,name:s,exact:o}=e||{},[i,a]=We.useState(r._formState),c=We.useRef(!0),u=We.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=We.useRef(s);return d.current=s,uy({disabled:n,next:f=>c.current&&Pj(d.current,f.name,o)&&Rj(f,u.current,r._updateFormState)&&a({...r._formState,...f}),subject:r._subjects.state}),We.useEffect(()=>(c.current=!0,u.current.isValid&&r._updateValid(!0),()=>{c.current=!1}),[r]),Tj(i,r,u.current,!1)}var Un=e=>typeof e=="string",Aj=(e,t,r,n,s)=>Un(e)?(n&&t.watch.add(e),ue(r,e,s)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),ue(r,o))):(n&&(t.watchAll=!0),r);function lz(e){const t=Gf(),{control:r=t.control,name:n,defaultValue:s,disabled:o,exact:i}=e||{},a=We.useRef(n);a.current=n,uy({disabled:o,subject:r._subjects.values,next:d=>{Pj(a.current,d.name,i)&&u(br(Aj(a.current,r._names,d.values||r._formValues,!1,s)))}});const[c,u]=We.useState(r._getWatch(n,s));return We.useEffect(()=>r._removeUnmounted()),c}function cz(e){const t=Gf(),{name:r,disabled:n,control:s=t.control,shouldUnregister:o}=e,i=jj(s._names.array,r),a=lz({control:s,name:r,defaultValue:ue(s._formValues,r,ue(s._defaultValues,r,e.defaultValue)),exact:!0}),c=az({control:s,name:r}),u=We.useRef(s.register(r,{...e.rules,value:a,...Fn(e.disabled)?{disabled:e.disabled}:{}}));return We.useEffect(()=>{const d=s._options.shouldUnregister||o,f=(m,y)=>{const x=ue(s._fields,m);x&&x._f&&(x._f.mount=y)};if(f(r,!0),d){const m=br(ue(s._options.defaultValues,r));ft(s._defaultValues,r,m),Ft(ue(s._formValues,r))&&ft(s._formValues,r,m)}return()=>{(i?d&&!s._state.action:d)?s.unregister(r):f(r,!1)}},[r,s,i,o]),We.useEffect(()=>{ue(s._fields,r)&&s._updateDisabledField({disabled:n,fields:s._fields,name:r,value:ue(s._fields,r)._f.value})},[n,r,s]),{field:{name:r,value:a,...Fn(n)||c.disabled?{disabled:c.disabled||n}:{},onChange:We.useCallback(d=>u.current.onChange({target:{value:Cj(d),name:r},type:Od.CHANGE}),[r]),onBlur:We.useCallback(()=>u.current.onBlur({target:{value:ue(s._formValues,r),name:r},type:Od.BLUR}),[r,s]),ref:d=>{const f=ue(s._fields,r);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:m=>d.setCustomValidity(m),reportValidity:()=>d.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ue(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!ue(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ue(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ue(c.validatingFields,r)},error:{enumerable:!0,get:()=>ue(c.errors,r)}})}}const uz=e=>e.render(cz(e));var Dj=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},aw=e=>({isOnSubmit:!e||e===gn.onSubmit,isOnBlur:e===gn.onBlur,isOnChange:e===gn.onChange,isOnAll:e===gn.all,isOnTouch:e===gn.onTouched}),lw=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Cl=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const o=ue(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!n)break;if(i.ref&&t(i.ref,i.name)&&!n)break;Cl(a,t)}else qt(a)&&Cl(a,t)}}};var dz=(e,t,r)=>{const n=kl(ue(e,r));return ft(n,"root",t[r]),ft(e,r,n),e},dy=e=>e.type==="file",eo=e=>typeof e=="function",Md=e=>{if(!ly)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ku=e=>Un(e),fy=e=>e.type==="radio",Id=e=>e instanceof RegExp;const cw={value:!1,isValid:!1},uw={value:!0,isValid:!0};var Oj=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ft(e[0].attributes.value)?Ft(e[0].value)||e[0].value===""?uw:{value:e[0].value,isValid:!0}:uw:cw}return cw};const dw={isValid:!1,value:null};var Mj=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,dw):dw;function fw(e,t,r="validate"){if(Ku(e)||Array.isArray(e)&&e.every(Ku)||Fn(e)&&!e)return{type:r,message:Ku(e)?e:"",ref:t}}var ki=e=>qt(e)&&!Id(e)?e:{value:e,message:""},hw=async(e,t,r,n,s)=>{const{ref:o,refs:i,required:a,maxLength:c,minLength:u,min:d,max:f,pattern:m,validate:y,name:x,valueAsNumber:g,mount:_,disabled:p}=e._f,h=ue(t,x);if(!_||p)return{};const w=i?i[0]:o,C=N=>{n&&w.reportValidity&&(w.setCustomValidity(Fn(N)?"":N||""),w.reportValidity())},j={},E=fy(o),R=Fc(o),P=E||R,A=(g||dy(o))&&Ft(o.value)&&Ft(h)||Md(o)&&o.value===""||h===""||Array.isArray(h)&&!h.length,L=Dj.bind(null,x,r,j),q=(N,F,b,V=ss.maxLength,te=ss.minLength)=>{const W=N?F:b;j[x]={type:N?V:te,message:W,ref:o,...L(N?V:te,W)}};if(s?!Array.isArray(h)||!h.length:a&&(!P&&(A||pr(h))||Fn(h)&&!h||R&&!Oj(i).isValid||E&&!Mj(i).isValid)){const{value:N,message:F}=Ku(a)?{value:!!a,message:a}:ki(a);if(N&&(j[x]={type:ss.required,message:F,ref:w,...L(ss.required,F)},!r))return C(F),j}if(!A&&(!pr(d)||!pr(f))){let N,F;const b=ki(f),V=ki(d);if(!pr(h)&&!isNaN(h)){const te=o.valueAsNumber||h&&+h;pr(b.value)||(N=te>b.value),pr(V.value)||(F=tenew Date(new Date().toDateString()+" "+Q),Z=o.type=="time",I=o.type=="week";Un(b.value)&&h&&(N=Z?W(h)>W(b.value):I?h>b.value:te>new Date(b.value)),Un(V.value)&&h&&(F=Z?W(h)+N.value,V=!pr(F.value)&&h.length<+F.value;if((b||V)&&(q(b,N.message,F.message),!r))return C(j[x].message),j}if(m&&!A&&Un(h)){const{value:N,message:F}=ki(m);if(Id(N)&&!h.match(N)&&(j[x]={type:ss.pattern,message:F,ref:o,...L(ss.pattern,F)},!r))return C(F),j}if(y){if(eo(y)){const N=await y(h,t),F=fw(N,w);if(F&&(j[x]={...F,...L(ss.validate,F.message)},!r))return C(F.message),j}else if(qt(y)){let N={};for(const F in y){if(!Or(N)&&!r)break;const b=fw(await y[F](h,t),w,F);b&&(N={...b,...L(F,b.message)},C(b.message),r&&(j[x]=N))}if(!Or(N)&&(j[x]={ref:w,...N},!r))return j}}return C(!0),j};function fz(e,t){const r=t.slice(0,-1).length;let n=0;for(;n{let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}},Ld=e=>pr(e)||!kj(e);function Bo(e,t){if(Ld(e)||Ld(t))return e===t;if($i(e)&&$i(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const s of r){const o=e[s];if(!n.includes(s))return!1;if(s!=="ref"){const i=t[s];if($i(o)&&$i(i)||qt(o)&&qt(i)||Array.isArray(o)&&Array.isArray(i)?!Bo(o,i):o!==i)return!1}}return!0}var Ij=e=>e.type==="select-multiple",pz=e=>fy(e)||Fc(e),np=e=>Md(e)&&e.isConnected,Lj=e=>{for(const t in e)if(eo(e[t]))return!0;return!1};function Fd(e,t={}){const r=Array.isArray(e);if(qt(e)||r)for(const n in e)Array.isArray(e[n])||qt(e[n])&&!Lj(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Fd(e[n],t[n])):pr(e[n])||(t[n]=!0);return t}function Fj(e,t,r){const n=Array.isArray(e);if(qt(e)||n)for(const s in e)Array.isArray(e[s])||qt(e[s])&&!Lj(e[s])?Ft(t)||Ld(r[s])?r[s]=Array.isArray(e[s])?Fd(e[s],[]):{...Fd(e[s])}:Fj(e[s],pr(t)?{}:t[s],r[s]):r[s]=!Bo(e[s],t[s]);return r}var Cu=(e,t)=>Fj(e,t,Fd(t)),zj=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ft(e)?e:t?e===""?NaN:e&&+e:r&&Un(e)?new Date(e):n?n(e):e;function sp(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return dy(t)?t.files:fy(t)?Mj(e.refs).value:Ij(t)?[...t.selectedOptions].map(({value:r})=>r):Fc(t)?Oj(e.refs).value:zj(Ft(t.value)?e.ref.value:t.value,e)}var mz=(e,t,r,n)=>{const s={};for(const o of e){const i=ue(t,o);i&&ft(s,o,i._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Ja=e=>Ft(e)?e:Id(e)?e.source:qt(e)?Id(e.value)?e.value.source:e.value:e,gz=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function pw(e,t,r){const n=ue(e,r);if(n||cy(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),i=ue(t,o),a=ue(e,o);if(i&&!Array.isArray(i)&&r!==o)return{name:r};if(a&&a.type)return{name:o,error:a};s.pop()}return{name:r}}var vz=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,yz=(e,t)=>!Kf(ue(e,t)).length&&Yt(e,t);const xz={mode:gn.onSubmit,reValidateMode:gn.onChange,shouldFocusError:!0};function wz(e={}){let t={...xz,...e},r={submitCount:0,isDirty:!1,isLoading:eo(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=qt(t.defaultValues)||qt(t.values)?br(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:br(s),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:rp(),array:rp(),state:rp()},m=aw(t.mode),y=aw(t.reValidateMode),x=t.criteriaMode===gn.all,g=S=>T=>{clearTimeout(u),u=setTimeout(S,T)},_=async S=>{if(d.isValid||S){const T=t.resolver?Or((await P()).errors):await L(n,!0);T!==r.isValid&&f.state.next({isValid:T})}},p=(S,T)=>{(d.isValidating||d.validatingFields)&&((S||Array.from(a.mount)).forEach(O=>{O&&(T?ft(r.validatingFields,O,T):Yt(r.validatingFields,O))}),f.state.next({validatingFields:r.validatingFields,isValidating:!Or(r.validatingFields)}))},h=(S,T=[],O,Y,M=!0,H=!0)=>{if(Y&&O){if(i.action=!0,H&&Array.isArray(ue(n,S))){const X=O(ue(n,S),Y.argA,Y.argB);M&&ft(n,S,X)}if(H&&Array.isArray(ue(r.errors,S))){const X=O(ue(r.errors,S),Y.argA,Y.argB);M&&ft(r.errors,S,X),yz(r.errors,S)}if(d.touchedFields&&H&&Array.isArray(ue(r.touchedFields,S))){const X=O(ue(r.touchedFields,S),Y.argA,Y.argB);M&&ft(r.touchedFields,S,X)}d.dirtyFields&&(r.dirtyFields=Cu(s,o)),f.state.next({name:S,isDirty:N(S,T),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ft(o,S,T)},w=(S,T)=>{ft(r.errors,S,T),f.state.next({errors:r.errors})},C=S=>{r.errors=S,f.state.next({errors:r.errors,isValid:!1})},j=(S,T,O,Y)=>{const M=ue(n,S);if(M){const H=ue(o,S,Ft(O)?ue(s,S):O);Ft(H)||Y&&Y.defaultChecked||T?ft(o,S,T?H:sp(M._f)):V(S,H),i.mount&&_()}},E=(S,T,O,Y,M)=>{let H=!1,X=!1;const ee={name:S},me=!!(ue(n,S)&&ue(n,S)._f&&ue(n,S)._f.disabled);if(!O||Y){d.isDirty&&(X=r.isDirty,r.isDirty=ee.isDirty=N(),H=X!==ee.isDirty);const Ye=me||Bo(ue(s,S),T);X=!!(!me&&ue(r.dirtyFields,S)),Ye||me?Yt(r.dirtyFields,S):ft(r.dirtyFields,S,!0),ee.dirtyFields=r.dirtyFields,H=H||d.dirtyFields&&X!==!Ye}if(O){const Ye=ue(r.touchedFields,S);Ye||(ft(r.touchedFields,S,O),ee.touchedFields=r.touchedFields,H=H||d.touchedFields&&Ye!==O)}return H&&M&&f.state.next(ee),H?ee:{}},R=(S,T,O,Y)=>{const M=ue(r.errors,S),H=d.isValid&&Fn(T)&&r.isValid!==T;if(e.delayError&&O?(c=g(()=>w(S,O)),c(e.delayError)):(clearTimeout(u),c=null,O?ft(r.errors,S,O):Yt(r.errors,S)),(O?!Bo(M,O):M)||!Or(Y)||H){const X={...Y,...H&&Fn(T)?{isValid:T}:{},errors:r.errors,name:S};r={...r,...X},f.state.next(X)}},P=async S=>{p(S,!0);const T=await t.resolver(o,t.context,mz(S||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return p(S),T},A=async S=>{const{errors:T}=await P(S);if(S)for(const O of S){const Y=ue(T,O);Y?ft(r.errors,O,Y):Yt(r.errors,O)}else r.errors=T;return T},L=async(S,T,O={valid:!0})=>{for(const Y in S){const M=S[Y];if(M){const{_f:H,...X}=M;if(H){const ee=a.array.has(H.name);p([Y],!0);const me=await hw(M,o,x,t.shouldUseNativeValidation&&!T,ee);if(p([Y]),me[H.name]&&(O.valid=!1,T))break;!T&&(ue(me,H.name)?ee?dz(r.errors,me,H.name):ft(r.errors,H.name,me[H.name]):Yt(r.errors,H.name))}X&&await L(X,T,O)}}return O.valid},q=()=>{for(const S of a.unMount){const T=ue(n,S);T&&(T._f.refs?T._f.refs.every(O=>!np(O)):!np(T._f.ref))&&Oe(S)}a.unMount=new Set},N=(S,T)=>(S&&T&&ft(o,S,T),!Bo(z(),s)),F=(S,T,O)=>Aj(S,a,{...i.mount?o:Ft(T)?s:Un(S)?{[S]:T}:T},O,T),b=S=>Kf(ue(i.mount?o:s,S,e.shouldUnregister?ue(s,S,[]):[])),V=(S,T,O={})=>{const Y=ue(n,S);let M=T;if(Y){const H=Y._f;H&&(!H.disabled&&ft(o,S,zj(T,H)),M=Md(H.ref)&&pr(T)?"":T,Ij(H.ref)?[...H.ref.options].forEach(X=>X.selected=M.includes(X.value)):H.refs?Fc(H.ref)?H.refs.length>1?H.refs.forEach(X=>(!X.defaultChecked||!X.disabled)&&(X.checked=Array.isArray(M)?!!M.find(ee=>ee===X.value):M===X.value)):H.refs[0]&&(H.refs[0].checked=!!M):H.refs.forEach(X=>X.checked=X.value===M):dy(H.ref)?H.ref.value="":(H.ref.value=M,H.ref.type||f.values.next({name:S,values:{...o}})))}(O.shouldDirty||O.shouldTouch)&&E(S,M,O.shouldTouch,O.shouldDirty,!0),O.shouldValidate&&Q(S)},te=(S,T,O)=>{for(const Y in T){const M=T[Y],H=`${S}.${Y}`,X=ue(n,H);(a.array.has(S)||!Ld(M)||X&&!X._f)&&!$i(M)?te(H,M,O):V(H,M,O)}},W=(S,T,O={})=>{const Y=ue(n,S),M=a.array.has(S),H=br(T);ft(o,S,H),M?(f.array.next({name:S,values:{...o}}),(d.isDirty||d.dirtyFields)&&O.shouldDirty&&f.state.next({name:S,dirtyFields:Cu(s,o),isDirty:N(S,H)})):Y&&!Y._f&&!pr(H)?te(S,H,O):V(S,H,O),lw(S,a)&&f.state.next({...r}),f.values.next({name:i.mount?S:void 0,values:{...o}})},Z=async S=>{i.mount=!0;const T=S.target;let O=T.name,Y=!0;const M=ue(n,O),H=()=>T.type?sp(M._f):Cj(S),X=ee=>{Y=Number.isNaN(ee)||ee===ue(o,O,ee)};if(M){let ee,me;const Ye=H(),Ue=S.type===Od.BLUR||S.type===Od.FOCUS_OUT,jt=!gz(M._f)&&!t.resolver&&!ue(r.errors,O)&&!M._f.deps||vz(Ue,ue(r.touchedFields,O),r.isSubmitted,y,m),Gr=lw(O,a,Ue);ft(o,O,Ye),Ue?(M._f.onBlur&&M._f.onBlur(S),c&&c(0)):M._f.onChange&&M._f.onChange(S);const Ht=E(O,Ye,Ue,!1),Qn=!Or(Ht)||Gr;if(!Ue&&f.values.next({name:O,type:S.type,values:{...o}}),jt)return d.isValid&&_(),Qn&&f.state.next({name:O,...Gr?{}:Ht});if(!Ue&&Gr&&f.state.next({...r}),t.resolver){const{errors:at}=await P([O]);if(X(Ye),Y){const Jn=pw(r.errors,n,O),es=pw(at,n,Jn.name||O);ee=es.error,O=es.name,me=Or(at)}}else p([O],!0),ee=(await hw(M,o,x,t.shouldUseNativeValidation))[O],p([O]),X(Ye),Y&&(ee?me=!1:d.isValid&&(me=await L(n,!0)));Y&&(M._f.deps&&Q(M._f.deps),R(O,me,ee,Ht))}},I=(S,T)=>{if(ue(r.errors,T)&&S.focus)return S.focus(),1},Q=async(S,T={})=>{let O,Y;const M=kl(S);if(t.resolver){const H=await A(Ft(S)?S:M);O=Or(H),Y=S?!M.some(X=>ue(H,X)):O}else S?(Y=(await Promise.all(M.map(async H=>{const X=ue(n,H);return await L(X&&X._f?{[H]:X}:X)}))).every(Boolean),!(!Y&&!r.isValid)&&_()):Y=O=await L(n);return f.state.next({...!Un(S)||d.isValid&&O!==r.isValid?{}:{name:S},...t.resolver||!S?{isValid:O}:{},errors:r.errors}),T.shouldFocus&&!Y&&Cl(n,I,S?M:a.mount),Y},z=S=>{const T={...i.mount?o:s};return Ft(S)?T:Un(S)?ue(T,S):S.map(O=>ue(T,O))},$=(S,T)=>({invalid:!!ue((T||r).errors,S),isDirty:!!ue((T||r).dirtyFields,S),error:ue((T||r).errors,S),isValidating:!!ue(r.validatingFields,S),isTouched:!!ue((T||r).touchedFields,S)}),fe=S=>{S&&kl(S).forEach(T=>Yt(r.errors,T)),f.state.next({errors:S?r.errors:{}})},ne=(S,T,O)=>{const Y=(ue(n,S,{_f:{}})._f||{}).ref,M=ue(r.errors,S)||{},{ref:H,message:X,type:ee,...me}=M;ft(r.errors,S,{...me,...T,ref:Y}),f.state.next({name:S,errors:r.errors,isValid:!1}),O&&O.shouldFocus&&Y&&Y.focus&&Y.focus()},se=(S,T)=>eo(S)?f.values.subscribe({next:O=>S(F(void 0,T),O)}):F(S,T,!0),Oe=(S,T={})=>{for(const O of S?kl(S):a.mount)a.mount.delete(O),a.array.delete(O),T.keepValue||(Yt(n,O),Yt(o,O)),!T.keepError&&Yt(r.errors,O),!T.keepDirty&&Yt(r.dirtyFields,O),!T.keepTouched&&Yt(r.touchedFields,O),!T.keepIsValidating&&Yt(r.validatingFields,O),!t.shouldUnregister&&!T.keepDefaultValue&&Yt(s,O);f.values.next({values:{...o}}),f.state.next({...r,...T.keepDirty?{isDirty:N()}:{}}),!T.keepIsValid&&_()},he=({disabled:S,name:T,field:O,fields:Y,value:M})=>{if(Fn(S)&&i.mount||S){const H=S?void 0:Ft(M)?sp(O?O._f:ue(Y,T)._f):M;ft(o,T,H),E(T,H,!1,!1,!0)}},ye=(S,T={})=>{let O=ue(n,S);const Y=Fn(T.disabled);return ft(n,S,{...O||{},_f:{...O&&O._f?O._f:{ref:{name:S}},name:S,mount:!0,...T}}),a.mount.add(S),O?he({field:O,disabled:T.disabled,name:S,value:T.value}):j(S,!0,T.value),{...Y?{disabled:T.disabled}:{},...t.progressive?{required:!!T.required,min:Ja(T.min),max:Ja(T.max),minLength:Ja(T.minLength),maxLength:Ja(T.maxLength),pattern:Ja(T.pattern)}:{},name:S,onChange:Z,onBlur:Z,ref:M=>{if(M){ye(S,T),O=ue(n,S);const H=Ft(M.value)&&M.querySelectorAll&&M.querySelectorAll("input,select,textarea")[0]||M,X=pz(H),ee=O._f.refs||[];if(X?ee.find(me=>me===H):H===O._f.ref)return;ft(n,S,{_f:{...O._f,...X?{refs:[...ee.filter(np),H,...Array.isArray(ue(s,S))?[{}]:[]],ref:{type:H.type,name:S}}:{ref:H}}}),j(S,!1,void 0,H)}else O=ue(n,S,{}),O._f&&(O._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(jj(a.array,S)&&i.action)&&a.unMount.add(S)}}},ke=()=>t.shouldFocusError&&Cl(n,I,a.mount),Fe=S=>{Fn(S)&&(f.state.next({disabled:S}),Cl(n,(T,O)=>{const Y=ue(n,O);Y&&(T.disabled=Y._f.disabled||S,Array.isArray(Y._f.refs)&&Y._f.refs.forEach(M=>{M.disabled=Y._f.disabled||S}))},0,!1))},Me=(S,T)=>async O=>{let Y;O&&(O.preventDefault&&O.preventDefault(),O.persist&&O.persist());let M=br(o);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:H,values:X}=await P();r.errors=H,M=X}else await L(n);if(Yt(r.errors,"root"),Or(r.errors)){f.state.next({errors:{}});try{await S(M,O)}catch(H){Y=H}}else T&&await T({...r.errors},O),ke(),setTimeout(ke);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Or(r.errors)&&!Y,submitCount:r.submitCount+1,errors:r.errors}),Y)throw Y},Pe=(S,T={})=>{ue(n,S)&&(Ft(T.defaultValue)?W(S,br(ue(s,S))):(W(S,T.defaultValue),ft(s,S,br(T.defaultValue))),T.keepTouched||Yt(r.touchedFields,S),T.keepDirty||(Yt(r.dirtyFields,S),r.isDirty=T.defaultValue?N(S,br(ue(s,S))):N()),T.keepError||(Yt(r.errors,S),d.isValid&&_()),f.state.next({...r}))},nt=(S,T={})=>{const O=S?br(S):s,Y=br(O),M=Or(S),H=M?s:Y;if(T.keepDefaultValues||(s=O),!T.keepValues){if(T.keepDirtyValues)for(const X of a.mount)ue(r.dirtyFields,X)?ft(H,X,ue(o,X)):W(X,ue(H,X));else{if(ly&&Ft(S))for(const X of a.mount){const ee=ue(n,X);if(ee&&ee._f){const me=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(Md(me)){const Ye=me.closest("form");if(Ye){Ye.reset();break}}}}n={}}o=e.shouldUnregister?T.keepDefaultValues?br(s):{}:br(H),f.array.next({values:{...H}}),f.values.next({values:{...H}})}a={mount:T.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!T.keepIsValid||!!T.keepDirtyValues,i.watch=!!e.shouldUnregister,f.state.next({submitCount:T.keepSubmitCount?r.submitCount:0,isDirty:M?!1:T.keepDirty?r.isDirty:!!(T.keepDefaultValues&&!Bo(S,s)),isSubmitted:T.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:M?{}:T.keepDirtyValues?T.keepDefaultValues&&o?Cu(s,o):r.dirtyFields:T.keepDefaultValues&&S?Cu(s,S):T.keepDirty?r.dirtyFields:{},touchedFields:T.keepTouched?r.touchedFields:{},errors:T.keepErrors?r.errors:{},isSubmitSuccessful:T.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},k=(S,T)=>nt(eo(S)?S(o):S,T);return{control:{register:ye,unregister:Oe,getFieldState:$,handleSubmit:Me,setError:ne,_executeSchema:P,_getWatch:F,_getDirty:N,_updateValid:_,_removeUnmounted:q,_updateFieldArray:h,_updateDisabledField:he,_getFieldArray:b,_reset:nt,_resetDefaultValues:()=>eo(t.defaultValues)&&t.defaultValues().then(S=>{k(S,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:S=>{r={...r,...S}},_disableForm:Fe,_subjects:f,_proxyFormState:d,_setErrors:C,get _fields(){return n},get _formValues(){return o},get _state(){return i},set _state(S){i=S},get _defaultValues(){return s},get _names(){return a},set _names(S){a=S},get _formState(){return r},set _formState(S){r=S},get _options(){return t},set _options(S){t={...t,...S}}},trigger:Q,register:ye,handleSubmit:Me,watch:se,setValue:W,getValues:z,reset:k,resetField:Pe,clearErrors:fe,unregister:Oe,setError:ne,setFocus:(S,T={})=>{const O=ue(n,S),Y=O&&O._f;if(Y){const M=Y.refs?Y.refs[0]:Y.ref;M.focus&&(M.focus(),T.shouldSelect&&M.select())}},getFieldState:$}}function Tr(e={}){const t=We.useRef(),r=We.useRef(),[n,s]=We.useState({isDirty:!1,isValidating:!1,isLoading:eo(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:eo(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...wz(e),formState:n});const o=t.current.control;return o._options=e,uy({subject:o._subjects.state,next:i=>{Rj(i,o._proxyFormState,o._updateFormState,!0)&&s({...o._formState})}}),We.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),We.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==n.isDirty&&o._subjects.state.next({isDirty:i})}},[o,n.isDirty]),We.useEffect(()=>{e.values&&!Bo(e.values,r.current)?(o._reset(e.values,o._options.resetOptions),r.current=e.values,s(i=>({...i}))):o._resetDefaultValues()},[e.values,o]),We.useEffect(()=>{e.errors&&o._setErrors(e.errors)},[e.errors,o]),We.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),We.useEffect(()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[e.shouldUnregister,o]),t.current.formState=Tj(n,o),t.current}const mw=(e,t,r)=>{if(e&&"reportValidity"in e){const n=ue(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Uj=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?mw(n.ref,r,e):n.refs&&n.refs.forEach(s=>mw(s,r,e))}},_z=(e,t)=>{t.shouldUseNativeValidation&&Uj(e,t);const r={};for(const n in e){const s=ue(t.fields,n),o=Object.assign(e[n]||{},{ref:s&&s.ref});if(bz(t.names||Object.keys(e),n)){const i=Object.assign({},ue(r,n));ft(i,"root",o),ft(r,n,i)}else ft(r,n,o)}return r},bz=(e,t)=>e.some(r=>r.startsWith(t+"."));var Sz=function(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=r[i].types,u=c&&c[n.code];r[i]=Dj(i,t,r,s,u?[].concat(u,n.message):n.message)}e.shift()}return r},Rr=function(e,t,r){return r===void 0&&(r={}),function(n,s,o){try{return Promise.resolve(function(i,a){try{var c=Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(u){return o.shouldUseNativeValidation&&Uj({},o),{errors:{},values:r.raw?n:u}})}catch(u){return a(u)}return c&&c.then?c.then(void 0,a):c}(0,function(i){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(i))return{values:{},errors:_z(Sz(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}}},ot;(function(e){e.assertEqual=s=>s;function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,e.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(const a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},e.find=(s,o)=>{for(const i of s)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(ot||(ot={}));var Cm;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Cm||(Cm={}));const we=ot.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zs=e=>{switch(typeof e){case"undefined":return we.undefined;case"string":return we.string;case"number":return isNaN(e)?we.nan:we.number;case"boolean":return we.boolean;case"function":return we.function;case"bigint":return we.bigint;case"symbol":return we.symbol;case"object":return Array.isArray(e)?we.array:e===null?we.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?we.promise:typeof Map<"u"&&e instanceof Map?we.map:typeof Set<"u"&&e instanceof Set?we.set:typeof Date<"u"&&e instanceof Date?we.date:we.object;default:return we.unknown}},ie=ot.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),kz=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Wr extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const r=t||function(o){return o.message},n={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;cr.message){const r={},n=[];for(const s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Wr.create=e=>new Wr(e);const va=(e,t)=>{let r;switch(e.code){case ie.invalid_type:e.received===we.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ot.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${ot.joinValues(e.keys,", ")}`;break;case ie.invalid_union:r="Invalid input";break;case ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ot.joinValues(e.options)}`;break;case ie.invalid_enum_value:r=`Invalid enum value. Expected ${ot.joinValues(e.options)}, received '${e.received}'`;break;case ie.invalid_arguments:r="Invalid function arguments";break;case ie.invalid_return_type:r="Invalid function return type";break;case ie.invalid_date:r="Invalid date";break;case ie.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ot.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case ie.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case ie.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case ie.custom:r="Invalid input";break;case ie.invalid_intersection_types:r="Intersection results could not be merged";break;case ie.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ie.not_finite:r="Number must be finite";break;default:r=t.defaultError,ot.assertNever(e)}return{message:r}};let $j=va;function Cz(e){$j=e}function zd(){return $j}const Ud=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)a=u(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}},jz=[];function ge(e,t){const r=zd(),n=Ud({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===va?void 0:va].filter(s=>!!s)});e.common.issues.push(n)}class cr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return Be;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const o=await s.key,i=await s.value;n.push({key:o,value:i})}return cr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return Be;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:t.value,value:n}}}const Be=Object.freeze({status:"aborted"}),Vi=e=>({status:"dirty",value:e}),gr=e=>({status:"valid",value:e}),jm=e=>e.status==="aborted",Em=e=>e.status==="dirty",tc=e=>e.status==="valid",rc=e=>typeof Promise<"u"&&e instanceof Promise;function $d(e,t,r,n){if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function Vj(e,t,r,n,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var De;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(De||(De={}));var il,al;class Yn{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const gw=(e,t)=>{if(tc(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new Wr(e.common.issues);return this._error=r,this._error}}};function Ze(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(i,a)=>{var c,u;const{message:d}=e;return i.code==="invalid_enum_value"?{message:d??a.defaultError}:typeof a.data>"u"?{message:(c=d??n)!==null&&c!==void 0?c:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(u=d??r)!==null&&u!==void 0?u:a.defaultError}},description:s}}class Je{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Zs(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new cr,ctx:{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(rc(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;const s={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},o=this._parseSync({data:t,path:s.path,parent:s});return gw(s,o)}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},s=this._parse({data:t,path:n.path,parent:n}),o=await(rc(s)?s:Promise.resolve(s));return gw(n,o)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{const i=t(s),a=()=>o.addIssue({code:ie.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new En({schema:this,typeName:$e.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Wn.create(this,this._def)}nullable(){return wo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _n.create(this,this._def)}promise(){return xa.create(this,this._def)}or(t){return ic.create([this,t],this._def)}and(t){return ac.create(this,t,this._def)}transform(t){return new En({...Ze(this._def),schema:this,typeName:$e.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new fc({...Ze(this._def),innerType:this,defaultValue:r,typeName:$e.ZodDefault})}brand(){return new hy({typeName:$e.ZodBranded,type:this,...Ze(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new hc({...Ze(this._def),innerType:this,catchValue:r,typeName:$e.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return zc.create(this,t)}readonly(){return pc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ez=/^c[^\s-]{8,}$/i,Nz=/^[0-9a-z]+$/,Tz=/^[0-9A-HJKMNP-TV-Z]{26}$/,Rz=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Pz=/^[a-z0-9_-]{21}$/i,Az=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Dz=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Oz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let op;const Mz=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Iz=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Lz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wj="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Fz=new RegExp(`^${Wj}$`);function Bj(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function zz(e){return new RegExp(`^${Bj(e)}$`)}function Hj(e){let t=`${Wj}T${Bj(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Uz(e,t){return!!((t==="v4"||!t)&&Mz.test(e)||(t==="v6"||!t)&&Iz.test(e))}class yn extends Je{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==we.string){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.string,received:o.parsedType}),Be}const n=new cr;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(s=this._getOrReturnCtx(t,s),ge(s,{code:ie.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,a=t.data.lengtht.test(s),{validation:r,code:ie.invalid_string,...De.errToObj(n)})}_addCheck(t){return new yn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...De.errToObj(t)})}url(t){return this._addCheck({kind:"url",...De.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...De.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...De.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...De.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...De.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...De.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...De.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...De.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...De.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(r=t==null?void 0:t.offset)!==null&&r!==void 0?r:!1,local:(n=t==null?void 0:t.local)!==null&&n!==void 0?n:!1,...De.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...De.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...De.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...De.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...De.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...De.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...De.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...De.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...De.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...De.errToObj(r)})}nonempty(t){return this.min(1,De.errToObj(t))}trim(){return new yn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new yn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new yn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value{var t;return new yn({checks:[],typeName:$e.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};function $z(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=parseInt(e.toFixed(s).replace(".","")),i=parseInt(t.toFixed(s).replace(".",""));return o%i/Math.pow(10,s)}class vo extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==we.number){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.number,received:o.parsedType}),Be}let n;const s=new cr;for(const o of this._def.checks)o.kind==="int"?ot.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?$z(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_finite,message:o.message}),s.dirty()):ot.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,De.toString(r))}gt(t,r){return this.setLimit("min",t,!1,De.toString(r))}lte(t,r){return this.setLimit("max",t,!0,De.toString(r))}lt(t,r){return this.setLimit("max",t,!1,De.toString(r))}setLimit(t,r,n,s){return new vo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:De.toString(s)}]})}_addCheck(t){return new vo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:De.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:De.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:De.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:De.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:De.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.valuet.kind==="int"||t.kind==="multipleOf"&&ot.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.valuenew vo({checks:[],typeName:$e.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class yo extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==we.bigint){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.bigint,received:o.parsedType}),Be}let n;const s=new cr;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):ot.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,De.toString(r))}gt(t,r){return this.setLimit("min",t,!1,De.toString(r))}lte(t,r){return this.setLimit("max",t,!0,De.toString(r))}lt(t,r){return this.setLimit("max",t,!1,De.toString(r))}setLimit(t,r,n,s){return new yo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:De.toString(s)}]})}_addCheck(t){return new yo({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:De.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value{var t;return new yo({checks:[],typeName:$e.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};class nc extends Je{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==we.boolean){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.boolean,received:n.parsedType}),Be}return gr(t.data)}}nc.create=e=>new nc({typeName:$e.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class si extends Je{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==we.date){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.date,received:o.parsedType}),Be}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_date}),Be}const n=new cr;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(s=this._getOrReturnCtx(t,s),ge(s,{code:ie.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ot.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new si({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:De.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:De.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew si({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:$e.ZodDate,...Ze(e)});class Vd extends Je{_parse(t){if(this._getType(t)!==we.symbol){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.symbol,received:n.parsedType}),Be}return gr(t.data)}}Vd.create=e=>new Vd({typeName:$e.ZodSymbol,...Ze(e)});class sc extends Je{_parse(t){if(this._getType(t)!==we.undefined){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.undefined,received:n.parsedType}),Be}return gr(t.data)}}sc.create=e=>new sc({typeName:$e.ZodUndefined,...Ze(e)});class oc extends Je{_parse(t){if(this._getType(t)!==we.null){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.null,received:n.parsedType}),Be}return gr(t.data)}}oc.create=e=>new oc({typeName:$e.ZodNull,...Ze(e)});class ya extends Je{constructor(){super(...arguments),this._any=!0}_parse(t){return gr(t.data)}}ya.create=e=>new ya({typeName:$e.ZodAny,...Ze(e)});class Ko extends Je{constructor(){super(...arguments),this._unknown=!0}_parse(t){return gr(t.data)}}Ko.create=e=>new Ko({typeName:$e.ZodUnknown,...Ze(e)});class js extends Je{_parse(t){const r=this._getOrReturnCtx(t);return ge(r,{code:ie.invalid_type,expected:we.never,received:r.parsedType}),Be}}js.create=e=>new js({typeName:$e.ZodNever,...Ze(e)});class Wd extends Je{_parse(t){if(this._getType(t)!==we.undefined){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.void,received:n.parsedType}),Be}return gr(t.data)}}Wd.create=e=>new Wd({typeName:$e.ZodVoid,...Ze(e)});class _n extends Je{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==we.array)return ge(r,{code:ie.invalid_type,expected:we.array,received:r.parsedType}),Be;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,a=r.data.lengths.maxLength.value&&(ge(r,{code:ie.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>s.type._parseAsync(new Yn(r,i,r.path,a)))).then(i=>cr.mergeArray(n,i));const o=[...r.data].map((i,a)=>s.type._parseSync(new Yn(r,i,r.path,a)));return cr.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new _n({...this._def,minLength:{value:t,message:De.toString(r)}})}max(t,r){return new _n({...this._def,maxLength:{value:t,message:De.toString(r)}})}length(t,r){return new _n({...this._def,exactLength:{value:t,message:De.toString(r)}})}nonempty(t){return this.min(1,t)}}_n.create=(e,t)=>new _n({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$e.ZodArray,...Ze(t)});function ji(e){if(e instanceof Rt){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Wn.create(ji(n))}return new Rt({...e._def,shape:()=>t})}else return e instanceof _n?new _n({...e._def,type:ji(e.element)}):e instanceof Wn?Wn.create(ji(e.unwrap())):e instanceof wo?wo.create(ji(e.unwrap())):e instanceof Zn?Zn.create(e.items.map(t=>ji(t))):e}class Rt extends Je{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),r=ot.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==we.object){const u=this._getOrReturnCtx(t);return ge(u,{code:ie.invalid_type,expected:we.object,received:u.parsedType}),Be}const{status:n,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof js&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const d=o[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Yn(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof js){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")a.length>0&&(ge(s,{code:ie.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of a){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Yn(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,m=await d.value;u.push({key:f,value:m,alwaysSet:d.alwaysSet})}return u}).then(u=>cr.mergeObjectSync(n,u)):cr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return De.errToObj,new Rt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var s,o,i,a;const c=(i=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,r,n).message)!==null&&i!==void 0?i:n.defaultError;return r.code==="unrecognized_keys"?{message:(a=De.errToObj(t).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new Rt({...this._def,unknownKeys:"strip"})}passthrough(){return new Rt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Rt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Rt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:$e.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Rt({...this._def,catchall:t})}pick(t){const r={};return ot.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Rt({...this._def,shape:()=>r})}omit(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new Rt({...this._def,shape:()=>r})}deepPartial(){return ji(this)}partial(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}),new Rt({...this._def,shape:()=>r})}required(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Wn;)o=o._def.innerType;r[n]=o}}),new Rt({...this._def,shape:()=>r})}keyof(){return Yj(ot.objectKeys(this.shape))}}Rt.create=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strip",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});Rt.strictCreate=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strict",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});Rt.lazycreate=(e,t)=>new Rt({shape:e,unknownKeys:"strip",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});class ic extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function s(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new Wr(a.ctx.common.issues));return ge(r,{code:ie.invalid_union,unionErrors:i}),Be}if(r.common.async)return Promise.all(n.map(async o=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(c=>new Wr(c));return ge(r,{code:ie.invalid_union,unionErrors:a}),Be}}get options(){return this._def.options}}ic.create=(e,t)=>new ic({options:e,typeName:$e.ZodUnion,...Ze(t)});const os=e=>e instanceof cc?os(e.schema):e instanceof En?os(e.innerType()):e instanceof uc?[e.value]:e instanceof xo?e.options:e instanceof dc?ot.objectValues(e.enum):e instanceof fc?os(e._def.innerType):e instanceof sc?[void 0]:e instanceof oc?[null]:e instanceof Wn?[void 0,...os(e.unwrap())]:e instanceof wo?[null,...os(e.unwrap())]:e instanceof hy||e instanceof pc?os(e.unwrap()):e instanceof hc?os(e._def.innerType):[];class qf extends Je{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.object)return ge(r,{code:ie.invalid_type,expected:we.object,received:r.parsedType}),Be;const n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(ge(r,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const s=new Map;for(const o of r){const i=os(o.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of i){if(s.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);s.set(a,o)}}return new qf({typeName:$e.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:s,...Ze(n)})}}function Nm(e,t){const r=Zs(e),n=Zs(t);if(e===t)return{valid:!0,data:e};if(r===we.object&&n===we.object){const s=ot.objectKeys(t),o=ot.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(const a of o){const c=Nm(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===we.array&&n===we.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o{if(jm(o)||jm(i))return Be;const a=Nm(o.value,i.value);return a.valid?((Em(o)||Em(i))&&r.dirty(),{status:r.value,value:a.data}):(ge(n,{code:ie.invalid_intersection_types}),Be)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ac.create=(e,t,r)=>new ac({left:e,right:t,typeName:$e.ZodIntersection,...Ze(r)});class Zn extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.array)return ge(n,{code:ie.invalid_type,expected:we.array,received:n.parsedType}),Be;if(n.data.lengththis._def.items.length&&(ge(n,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const o=[...n.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Yn(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>cr.mergeArray(r,i)):cr.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new Zn({...this._def,rest:t})}}Zn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zn({items:e,typeName:$e.ZodTuple,rest:null,...Ze(t)})};class lc extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.object)return ge(n,{code:ie.invalid_type,expected:we.object,received:n.parsedType}),Be;const s=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)s.push({key:o._parse(new Yn(n,a,n.path,a)),value:i._parse(new Yn(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?cr.mergeObjectAsync(r,s):cr.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Je?new lc({keyType:t,valueType:r,typeName:$e.ZodRecord,...Ze(n)}):new lc({keyType:yn.create(),valueType:t,typeName:$e.ZodRecord,...Ze(r)})}}class Bd extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.map)return ge(n,{code:ie.invalid_type,expected:we.map,received:n.parsedType}),Be;const s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new Yn(n,a,n.path,[u,"key"])),value:o._parse(new Yn(n,c,n.path,[u,"value"]))}));if(n.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}}Bd.create=(e,t,r)=>new Bd({valueType:t,keyType:e,typeName:$e.ZodMap,...Ze(r)});class oi extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.set)return ge(n,{code:ie.invalid_type,expected:we.set,received:n.parsedType}),Be;const s=this._def;s.minSize!==null&&n.data.sizes.maxSize.value&&(ge(n,{code:ie.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const o=this._def.valueType;function i(c){const u=new Set;for(const d of c){if(d.status==="aborted")return Be;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}const a=[...n.data.values()].map((c,u)=>o._parse(new Yn(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,r){return new oi({...this._def,minSize:{value:t,message:De.toString(r)}})}max(t,r){return new oi({...this._def,maxSize:{value:t,message:De.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}oi.create=(e,t)=>new oi({valueType:e,minSize:null,maxSize:null,typeName:$e.ZodSet,...Ze(t)});class oa extends Je{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.function)return ge(r,{code:ie.invalid_type,expected:we.function,received:r.parsedType}),Be;function n(a,c){return Ud({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zd(),va].filter(u=>!!u),issueData:{code:ie.invalid_arguments,argumentsError:c}})}function s(a,c){return Ud({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zd(),va].filter(u=>!!u),issueData:{code:ie.invalid_return_type,returnTypeError:c}})}const o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof xa){const a=this;return gr(async function(...c){const u=new Wr([]),d=await a._def.args.parseAsync(c,o).catch(y=>{throw u.addIssue(n(c,y)),u}),f=await Reflect.apply(i,this,d);return await a._def.returns._def.type.parseAsync(f,o).catch(y=>{throw u.addIssue(s(f,y)),u})})}else{const a=this;return gr(function(...c){const u=a._def.args.safeParse(c,o);if(!u.success)throw new Wr([n(c,u.error)]);const d=Reflect.apply(i,this,u.data),f=a._def.returns.safeParse(d,o);if(!f.success)throw new Wr([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new oa({...this._def,args:Zn.create(t).rest(Ko.create())})}returns(t){return new oa({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new oa({args:t||Zn.create([]).rest(Ko.create()),returns:r||Ko.create(),typeName:$e.ZodFunction,...Ze(n)})}}class cc extends Je{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}cc.create=(e,t)=>new cc({getter:e,typeName:$e.ZodLazy,...Ze(t)});class uc extends Je{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return ge(r,{received:r.data,code:ie.invalid_literal,expected:this._def.value}),Be}return{status:"valid",value:t.data}}get value(){return this._def.value}}uc.create=(e,t)=>new uc({value:e,typeName:$e.ZodLiteral,...Ze(t)});function Yj(e,t){return new xo({values:e,typeName:$e.ZodEnum,...Ze(t)})}class xo extends Je{constructor(){super(...arguments),il.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return ge(r,{expected:ot.joinValues(n),received:r.parsedType,code:ie.invalid_type}),Be}if($d(this,il)||Vj(this,il,new Set(this._def.values)),!$d(this,il).has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return ge(r,{received:r.data,code:ie.invalid_enum_value,options:n}),Be}return gr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return xo.create(t,{...this._def,...r})}exclude(t,r=this._def){return xo.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}il=new WeakMap;xo.create=Yj;class dc extends Je{constructor(){super(...arguments),al.set(this,void 0)}_parse(t){const r=ot.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==we.string&&n.parsedType!==we.number){const s=ot.objectValues(r);return ge(n,{expected:ot.joinValues(s),received:n.parsedType,code:ie.invalid_type}),Be}if($d(this,al)||Vj(this,al,new Set(ot.getValidEnumValues(this._def.values))),!$d(this,al).has(t.data)){const s=ot.objectValues(r);return ge(n,{received:n.data,code:ie.invalid_enum_value,options:s}),Be}return gr(t.data)}get enum(){return this._def.values}}al=new WeakMap;dc.create=(e,t)=>new dc({values:e,typeName:$e.ZodNativeEnum,...Ze(t)});class xa extends Je{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.promise&&r.common.async===!1)return ge(r,{code:ie.invalid_type,expected:we.promise,received:r.parsedType}),Be;const n=r.parsedType===we.promise?r.data:Promise.resolve(r.data);return gr(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}xa.create=(e,t)=>new xa({type:e,typeName:$e.ZodPromise,...Ze(t)});class En extends Je{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$e.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:i=>{ge(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return Be;const c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Be:c.status==="dirty"||r.value==="dirty"?Vi(c.value):c});{if(r.value==="aborted")return Be;const a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?Be:a.status==="dirty"||r.value==="dirty"?Vi(a.value):a}}if(s.type==="refinement"){const i=a=>{const c=s.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Be:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Be:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!tc(i))return i;const a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>tc(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):i);ot.assertNever(s)}}En.create=(e,t,r)=>new En({schema:e,typeName:$e.ZodEffects,effect:t,...Ze(r)});En.createWithPreprocess=(e,t,r)=>new En({schema:t,effect:{type:"preprocess",transform:e},typeName:$e.ZodEffects,...Ze(r)});class Wn extends Je{_parse(t){return this._getType(t)===we.undefined?gr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Wn.create=(e,t)=>new Wn({innerType:e,typeName:$e.ZodOptional,...Ze(t)});class wo extends Je{_parse(t){return this._getType(t)===we.null?gr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}wo.create=(e,t)=>new wo({innerType:e,typeName:$e.ZodNullable,...Ze(t)});class fc extends Je{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===we.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}fc.create=(e,t)=>new fc({innerType:e,typeName:$e.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ze(t)});class hc extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rc(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Wr(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Wr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}hc.create=(e,t)=>new hc({innerType:e,typeName:$e.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ze(t)});class Hd extends Je{_parse(t){if(this._getType(t)!==we.nan){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.nan,received:n.parsedType}),Be}return{status:"valid",value:t.data}}}Hd.create=e=>new Hd({typeName:$e.ZodNaN,...Ze(e)});const Vz=Symbol("zod_brand");class hy extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class zc extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Be:o.status==="dirty"?(r.dirty(),Vi(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Be:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new zc({in:t,out:r,typeName:$e.ZodPipeline})}}class pc extends Je{_parse(t){const r=this._def.innerType._parse(t),n=s=>(tc(s)&&(s.value=Object.freeze(s.value)),s);return rc(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}pc.create=(e,t)=>new pc({innerType:e,typeName:$e.ZodReadonly,...Ze(t)});function Zj(e,t={},r){return e?ya.create().superRefine((n,s)=>{var o,i;if(!e(n)){const a=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,c=(i=(o=a.fatal)!==null&&o!==void 0?o:r)!==null&&i!==void 0?i:!0,u=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...u,fatal:c})}}):ya.create()}const Wz={object:Rt.lazycreate};var $e;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})($e||($e={}));const Bz=(e,t={message:`Input not instance of ${e.name}`})=>Zj(r=>r instanceof e,t),Kj=yn.create,Gj=vo.create,Hz=Hd.create,Yz=yo.create,qj=nc.create,Zz=si.create,Kz=Vd.create,Gz=sc.create,qz=oc.create,Xz=ya.create,Qz=Ko.create,Jz=js.create,e8=Wd.create,t8=_n.create,r8=Rt.create,n8=Rt.strictCreate,s8=ic.create,o8=qf.create,i8=ac.create,a8=Zn.create,l8=lc.create,c8=Bd.create,u8=oi.create,d8=oa.create,f8=cc.create,h8=uc.create,p8=xo.create,m8=dc.create,g8=xa.create,vw=En.create,v8=Wn.create,y8=wo.create,x8=En.createWithPreprocess,w8=zc.create,_8=()=>Kj().optional(),b8=()=>Gj().optional(),S8=()=>qj().optional(),k8={string:e=>yn.create({...e,coerce:!0}),number:e=>vo.create({...e,coerce:!0}),boolean:e=>nc.create({...e,coerce:!0}),bigint:e=>yo.create({...e,coerce:!0}),date:e=>si.create({...e,coerce:!0})},C8=Be;var pe=Object.freeze({__proto__:null,defaultErrorMap:va,setErrorMap:Cz,getErrorMap:zd,makeIssue:Ud,EMPTY_PATH:jz,addIssueToContext:ge,ParseStatus:cr,INVALID:Be,DIRTY:Vi,OK:gr,isAborted:jm,isDirty:Em,isValid:tc,isAsync:rc,get util(){return ot},get objectUtil(){return Cm},ZodParsedType:we,getParsedType:Zs,ZodType:Je,datetimeRegex:Hj,ZodString:yn,ZodNumber:vo,ZodBigInt:yo,ZodBoolean:nc,ZodDate:si,ZodSymbol:Vd,ZodUndefined:sc,ZodNull:oc,ZodAny:ya,ZodUnknown:Ko,ZodNever:js,ZodVoid:Wd,ZodArray:_n,ZodObject:Rt,ZodUnion:ic,ZodDiscriminatedUnion:qf,ZodIntersection:ac,ZodTuple:Zn,ZodRecord:lc,ZodMap:Bd,ZodSet:oi,ZodFunction:oa,ZodLazy:cc,ZodLiteral:uc,ZodEnum:xo,ZodNativeEnum:dc,ZodPromise:xa,ZodEffects:En,ZodTransformer:En,ZodOptional:Wn,ZodNullable:wo,ZodDefault:fc,ZodCatch:hc,ZodNaN:Hd,BRAND:Vz,ZodBranded:hy,ZodPipeline:zc,ZodReadonly:pc,custom:Zj,Schema:Je,ZodSchema:Je,late:Wz,get ZodFirstPartyTypeKind(){return $e},coerce:k8,any:Xz,array:t8,bigint:Yz,boolean:qj,date:Zz,discriminatedUnion:o8,effect:vw,enum:p8,function:d8,instanceof:Bz,intersection:i8,lazy:f8,literal:h8,map:c8,nan:Hz,nativeEnum:m8,never:Jz,null:qz,nullable:y8,number:Gj,object:r8,oboolean:S8,onumber:b8,optional:v8,ostring:_8,pipeline:w8,preprocess:x8,promise:g8,record:l8,set:u8,strictObject:n8,string:Kj,symbol:Kz,transformer:vw,tuple:a8,undefined:Gz,union:s8,unknown:Qz,void:e8,NEVER:C8,ZodIssueCode:ie,quotelessJson:kz,ZodError:Wr}),j8="Label",Xj=v.forwardRef((e,t)=>l.jsx(Re.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Xj.displayName=j8;var Qj=Xj;const E8=_c("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ma=v.forwardRef(({className:e,...t},r)=>l.jsx(Qj,{ref:r,className:ae(E8(),e),...t}));Ma.displayName=Qj.displayName;const Pr=iz,Jj=v.createContext({}),Ne=({...e})=>l.jsx(Jj.Provider,{value:{name:e.name},children:l.jsx(uz,{...e})}),Xf=()=>{const e=v.useContext(Jj),t=v.useContext(eE),{getFieldState:r,formState:n}=Gf(),s=r(e.name,n);if(!e)throw new Error("useFormField should be used within ");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...s}},eE=v.createContext({}),Ce=v.forwardRef(({className:e,...t},r)=>{const n=v.useId();return l.jsx(eE.Provider,{value:{id:n},children:l.jsx("div",{ref:r,className:ae("space-y-2",e),...t})})});Ce.displayName="FormItem";const je=v.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:s}=Xf();return l.jsx(Ma,{ref:r,className:ae(n&&"text-destructive",e),htmlFor:s,...t})});je.displayName="FormLabel";const Ee=v.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:s,formMessageId:o}=Xf();return l.jsx(bs,{ref:t,id:n,"aria-describedby":r?`${s} ${o}`:`${s}`,"aria-invalid":!!r,...e})});Ee.displayName="FormControl";const N8=v.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=Xf();return l.jsx("p",{ref:r,id:n,className:ae("text-sm text-muted-foreground",e),...t})});N8.displayName="FormDescription";const Se=v.forwardRef(({className:e,children:t,...r},n)=>{const{error:s,formMessageId:o}=Xf(),i=s?String(s==null?void 0:s.message):t;return i?l.jsx("p",{ref:n,id:o,className:ae("text-sm font-medium text-destructive",e),...r,children:i}):null});Se.displayName="FormMessage";function Tm(e,[t,r]){return Math.min(r,Math.max(t,e))}var T8=[" ","Enter","ArrowUp","ArrowDown"],R8=[" ","Enter"],Uc="Select",[Qf,Jf,P8]=bc(Uc),[Ia,E$]=xr(Uc,[P8,Pa]),eh=Pa(),[A8,Eo]=Ia(Uc),[D8,O8]=Ia(Uc),tE=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:m,required:y}=e,x=eh(t),[g,_]=v.useState(null),[p,h]=v.useState(null),[w,C]=v.useState(!1),j=Ea(u),[E=!1,R]=on({prop:n,defaultProp:s,onChange:o}),[P,A]=on({prop:i,defaultProp:a,onChange:c}),L=v.useRef(null),q=g?!!g.closest("form"):!0,[N,F]=v.useState(new Set),b=Array.from(N).map(V=>V.props.value).join(";");return l.jsx(Xg,{...x,children:l.jsxs(A8,{required:y,scope:t,trigger:g,onTriggerChange:_,valueNode:p,onValueNodeChange:h,valueNodeHasChildren:w,onValueNodeHasChildrenChange:C,contentId:Ur(),value:P,onValueChange:A,open:E,onOpenChange:R,dir:j,triggerPointerDownPosRef:L,disabled:m,children:[l.jsx(Qf.Provider,{scope:t,children:l.jsx(D8,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(V=>{F(te=>new Set(te).add(V))},[]),onNativeOptionRemove:v.useCallback(V=>{F(te=>{const W=new Set(te);return W.delete(V),W})},[]),children:r})}),q?l.jsxs(EE,{"aria-hidden":!0,required:y,tabIndex:-1,name:d,autoComplete:f,value:P,onChange:V=>A(V.target.value),disabled:m,children:[P===void 0?l.jsx("option",{value:""}):null,Array.from(N)]},b):null]})})};tE.displayName=Uc;var rE="SelectTrigger",nE=v.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,o=eh(r),i=Eo(rE,r),a=i.disabled||n,c=Ke(t,i.onTriggerChange),u=Jf(r),[d,f,m]=NE(x=>{const g=u().filter(h=>!h.disabled),_=g.find(h=>h.value===i.value),p=TE(g,x,_);p!==void 0&&i.onValueChange(p.value)}),y=()=>{a||(i.onOpenChange(!0),m())};return l.jsx(Qg,{asChild:!0,...o,children:l.jsx(Re.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":jE(i.value)?"":void 0,...s,ref:c,onClick:ce(s.onClick,x=>{x.currentTarget.focus()}),onPointerDown:ce(s.onPointerDown,x=>{const g=x.target;g.hasPointerCapture(x.pointerId)&&g.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&(y(),i.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)},x.preventDefault())}),onKeyDown:ce(s.onKeyDown,x=>{const g=d.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&f(x.key),!(g&&x.key===" ")&&T8.includes(x.key)&&(y(),x.preventDefault())})})})});nE.displayName=rE;var sE="SelectValue",oE=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:i="",...a}=e,c=Eo(sE,r),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,f=Ke(t,c.onValueNodeChange);return Jt(()=>{u(d)},[u,d]),l.jsx(Re.span,{...a,ref:f,style:{pointerEvents:"none"},children:jE(c.value)?l.jsx(l.Fragment,{children:i}):o})});oE.displayName=sE;var M8="SelectIcon",iE=v.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return l.jsx(Re.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});iE.displayName=M8;var I8="SelectPortal",aE=e=>l.jsx(kc,{asChild:!0,...e});aE.displayName=I8;var ii="SelectContent",lE=v.forwardRef((e,t)=>{const r=Eo(ii,e.__scopeSelect),[n,s]=v.useState();if(Jt(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?Ns.createPortal(l.jsx(cE,{scope:e.__scopeSelect,children:l.jsx(Qf.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),o):null}return l.jsx(uE,{...e,ref:t})});lE.displayName=ii;var ls=10,[cE,No]=Ia(ii),L8="SelectContentImpl",uE=v.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:g,avoidCollisions:_,...p}=e,h=Eo(ii,r),[w,C]=v.useState(null),[j,E]=v.useState(null),R=Ke(t,he=>C(he)),[P,A]=v.useState(null),[L,q]=v.useState(null),N=Jf(r),[F,b]=v.useState(!1),V=v.useRef(!1);v.useEffect(()=>{if(w)return tv(w)},[w]),Vg();const te=v.useCallback(he=>{const[ye,...ke]=N().map(Pe=>Pe.ref.current),[Fe]=ke.slice(-1),Me=document.activeElement;for(const Pe of he)if(Pe===Me||(Pe==null||Pe.scrollIntoView({block:"nearest"}),Pe===ye&&j&&(j.scrollTop=0),Pe===Fe&&j&&(j.scrollTop=j.scrollHeight),Pe==null||Pe.focus(),document.activeElement!==Me))return},[N,j]),W=v.useCallback(()=>te([P,w]),[te,P,w]);v.useEffect(()=>{F&&W()},[F,W]);const{onOpenChange:Z,triggerPointerDownPosRef:I}=h;v.useEffect(()=>{if(w){let he={x:0,y:0};const ye=Fe=>{var Me,Pe;he={x:Math.abs(Math.round(Fe.pageX)-(((Me=I.current)==null?void 0:Me.x)??0)),y:Math.abs(Math.round(Fe.pageY)-(((Pe=I.current)==null?void 0:Pe.y)??0))}},ke=Fe=>{he.x<=10&&he.y<=10?Fe.preventDefault():w.contains(Fe.target)||Z(!1),document.removeEventListener("pointermove",ye),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",ke,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",ke,{capture:!0})}}},[w,Z,I]),v.useEffect(()=>{const he=()=>Z(!1);return window.addEventListener("blur",he),window.addEventListener("resize",he),()=>{window.removeEventListener("blur",he),window.removeEventListener("resize",he)}},[Z]);const[Q,z]=NE(he=>{const ye=N().filter(Me=>!Me.disabled),ke=ye.find(Me=>Me.ref.current===document.activeElement),Fe=TE(ye,he,ke);Fe&&setTimeout(()=>Fe.ref.current.focus())}),$=v.useCallback((he,ye,ke)=>{const Fe=!V.current&&!ke;(h.value!==void 0&&h.value===ye||Fe)&&(A(he),Fe&&(V.current=!0))},[h.value]),fe=v.useCallback(()=>w==null?void 0:w.focus(),[w]),ne=v.useCallback((he,ye,ke)=>{const Fe=!V.current&&!ke;(h.value!==void 0&&h.value===ye||Fe)&&q(he)},[h.value]),se=n==="popper"?Rm:dE,Oe=se===Rm?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:g,avoidCollisions:_}:{};return l.jsx(cE,{scope:r,content:w,viewport:j,onViewportChange:E,itemRefCallback:$,selectedItem:P,onItemLeave:fe,itemTextRefCallback:ne,focusSelectedItem:W,selectedItemText:L,position:n,isPositioned:F,searchRef:Q,children:l.jsx(jf,{as:bs,allowPinchZoom:!0,children:l.jsx(wf,{asChild:!0,trapped:h.open,onMountAutoFocus:he=>{he.preventDefault()},onUnmountAutoFocus:ce(s,he=>{var ye;(ye=h.trigger)==null||ye.focus({preventScroll:!0}),he.preventDefault()}),children:l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:he=>he.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:l.jsx(se,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:he=>he.preventDefault(),...p,...Oe,onPlaced:()=>b(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...p.style},onKeyDown:ce(p.onKeyDown,he=>{const ye=he.ctrlKey||he.altKey||he.metaKey;if(he.key==="Tab"&&he.preventDefault(),!ye&&he.key.length===1&&z(he.key),["ArrowUp","ArrowDown","Home","End"].includes(he.key)){let Fe=N().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);if(["ArrowUp","End"].includes(he.key)&&(Fe=Fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(he.key)){const Me=he.target,Pe=Fe.indexOf(Me);Fe=Fe.slice(Pe+1)}setTimeout(()=>te(Fe)),he.preventDefault()}})})})})})})});uE.displayName=L8;var F8="SelectItemAlignedPosition",dE=v.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,o=Eo(ii,r),i=No(ii,r),[a,c]=v.useState(null),[u,d]=v.useState(null),f=Ke(t,R=>d(R)),m=Jf(r),y=v.useRef(!1),x=v.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:p,focusSelectedItem:h}=i,w=v.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&u&&g&&_&&p){const R=o.trigger.getBoundingClientRect(),P=u.getBoundingClientRect(),A=o.valueNode.getBoundingClientRect(),L=p.getBoundingClientRect();if(o.dir!=="rtl"){const Me=L.left-P.left,Pe=A.left-Me,nt=R.left-Pe,k=R.width+nt,J=Math.max(k,P.width),K=window.innerWidth-ls,D=Tm(Pe,[ls,K-J]);a.style.minWidth=k+"px",a.style.left=D+"px"}else{const Me=P.right-L.right,Pe=window.innerWidth-A.right-Me,nt=window.innerWidth-R.right-Pe,k=R.width+nt,J=Math.max(k,P.width),K=window.innerWidth-ls,D=Tm(Pe,[ls,K-J]);a.style.minWidth=k+"px",a.style.right=D+"px"}const q=m(),N=window.innerHeight-ls*2,F=g.scrollHeight,b=window.getComputedStyle(u),V=parseInt(b.borderTopWidth,10),te=parseInt(b.paddingTop,10),W=parseInt(b.borderBottomWidth,10),Z=parseInt(b.paddingBottom,10),I=V+te+F+Z+W,Q=Math.min(_.offsetHeight*5,I),z=window.getComputedStyle(g),$=parseInt(z.paddingTop,10),fe=parseInt(z.paddingBottom,10),ne=R.top+R.height/2-ls,se=N-ne,Oe=_.offsetHeight/2,he=_.offsetTop+Oe,ye=V+te+he,ke=I-ye;if(ye<=ne){const Me=_===q[q.length-1].ref.current;a.style.bottom="0px";const Pe=u.clientHeight-g.offsetTop-g.offsetHeight,nt=Math.max(se,Oe+(Me?fe:0)+Pe+W),k=ye+nt;a.style.height=k+"px"}else{const Me=_===q[0].ref.current;a.style.top="0px";const nt=Math.max(ne,V+g.offsetTop+(Me?$:0)+Oe)+ke;a.style.height=nt+"px",g.scrollTop=ye-ne+g.offsetTop}a.style.margin=`${ls}px 0`,a.style.minHeight=Q+"px",a.style.maxHeight=N+"px",n==null||n(),requestAnimationFrame(()=>y.current=!0)}},[m,o.trigger,o.valueNode,a,u,g,_,p,o.dir,n]);Jt(()=>w(),[w]);const[C,j]=v.useState();Jt(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const E=v.useCallback(R=>{R&&x.current===!0&&(w(),h==null||h(),x.current=!1)},[w,h]);return l.jsx(U8,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:y,onScrollButtonChange:E,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:l.jsx(Re.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});dE.displayName=F8;var z8="SelectPopperPosition",Rm=v.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=ls,...o}=e,i=eh(r);return l.jsx(Jg,{...i,...o,ref:t,align:n,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Rm.displayName=z8;var[U8,py]=Ia(ii,{}),Pm="SelectViewport",fE=v.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,o=No(Pm,r),i=py(Pm,r),a=Ke(t,o.onViewportChange),c=v.useRef(0);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),l.jsx(Qf.Slot,{scope:r,children:l.jsx(Re.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"auto",...s.style},onScroll:ce(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&f){const y=Math.abs(c.current-d.scrollTop);if(y>0){const x=window.innerHeight-ls*2,g=parseFloat(f.style.minHeight),_=parseFloat(f.style.height),p=Math.max(g,_);if(p0?C:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});fE.displayName=Pm;var hE="SelectGroup",[$8,V8]=Ia(hE),pE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Ur();return l.jsx($8,{scope:r,id:s,children:l.jsx(Re.div,{role:"group","aria-labelledby":s,...n,ref:t})})});pE.displayName=hE;var mE="SelectLabel",gE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=V8(mE,r);return l.jsx(Re.div,{id:s.id,...n,ref:t})});gE.displayName=mE;var Yd="SelectItem",[W8,vE]=Ia(Yd),yE=v.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...i}=e,a=Eo(Yd,r),c=No(Yd,r),u=a.value===n,[d,f]=v.useState(o??""),[m,y]=v.useState(!1),x=Ke(t,p=>{var h;return(h=c.itemRefCallback)==null?void 0:h.call(c,p,n,s)}),g=Ur(),_=()=>{s||(a.onValueChange(n),a.onOpenChange(!1))};if(n==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l.jsx(W8,{scope:r,value:n,disabled:s,textId:g,isSelected:u,onItemTextChange:v.useCallback(p=>{f(h=>h||((p==null?void 0:p.textContent)??"").trim())},[]),children:l.jsx(Qf.ItemSlot,{scope:r,value:n,disabled:s,textValue:d,children:l.jsx(Re.div,{role:"option","aria-labelledby":g,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:x,onFocus:ce(i.onFocus,()=>y(!0)),onBlur:ce(i.onBlur,()=>y(!1)),onPointerUp:ce(i.onPointerUp,_),onPointerMove:ce(i.onPointerMove,p=>{var h;s?(h=c.onItemLeave)==null||h.call(c):p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ce(i.onPointerLeave,p=>{var h;p.currentTarget===document.activeElement&&((h=c.onItemLeave)==null||h.call(c))}),onKeyDown:ce(i.onKeyDown,p=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&p.key===" "||(R8.includes(p.key)&&_(),p.key===" "&&p.preventDefault())})})})})});yE.displayName=Yd;var ll="SelectItemText",xE=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...o}=e,i=Eo(ll,r),a=No(ll,r),c=vE(ll,r),u=O8(ll,r),[d,f]=v.useState(null),m=Ke(t,p=>f(p),c.onItemTextChange,p=>{var h;return(h=a.itemTextRefCallback)==null?void 0:h.call(a,p,c.value,c.disabled)}),y=d==null?void 0:d.textContent,x=v.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:y},c.value),[c.disabled,c.value,y]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return Jt(()=>(g(x),()=>_(x)),[g,_,x]),l.jsxs(l.Fragment,{children:[l.jsx(Re.span,{id:c.textId,...o,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ns.createPortal(o.children,i.valueNode):null]})});xE.displayName=ll;var wE="SelectItemIndicator",_E=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return vE(wE,r).isSelected?l.jsx(Re.span,{"aria-hidden":!0,...n,ref:t}):null});_E.displayName=wE;var Am="SelectScrollUpButton",bE=v.forwardRef((e,t)=>{const r=No(Am,e.__scopeSelect),n=py(Am,e.__scopeSelect),[s,o]=v.useState(!1),i=Ke(t,n.onScrollButtonChange);return Jt(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollTop>0;o(u)};const c=r.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(kE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});bE.displayName=Am;var Dm="SelectScrollDownButton",SE=v.forwardRef((e,t)=>{const r=No(Dm,e.__scopeSelect),n=py(Dm,e.__scopeSelect),[s,o]=v.useState(!1),i=Ke(t,n.onScrollButtonChange);return Jt(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(kE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});SE.displayName=Dm;var kE=v.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,o=No("SelectScrollButton",r),i=v.useRef(null),a=Jf(r),c=v.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Jt(()=>{var d;const u=a().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),l.jsx(Re.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ce(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:ce(s.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:ce(s.onPointerLeave,()=>{c()})})}),B8="SelectSeparator",CE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return l.jsx(Re.div,{"aria-hidden":!0,...n,ref:t})});CE.displayName=B8;var Om="SelectArrow",H8=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=eh(r),o=Eo(Om,r),i=No(Om,r);return o.open&&i.position==="popper"?l.jsx(ev,{...s,...n,ref:t}):null});H8.displayName=Om;function jE(e){return e===""||e===void 0}var EE=v.forwardRef((e,t)=>{const{value:r,...n}=e,s=v.useRef(null),o=Ke(t,s),i=YC(r);return v.useEffect(()=>{const a=s.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==r&&d){const f=new Event("change",{bubbles:!0});d.call(a,r),a.dispatchEvent(f)}},[i,r]),l.jsx(Ic,{asChild:!0,children:l.jsx("select",{...n,ref:o,defaultValue:r})})});EE.displayName="BubbleSelect";function NE(e){const t=Dt(e),r=v.useRef(""),n=v.useRef(0),s=v.useCallback(i=>{const a=r.current+i;t(a),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(a)},[t]),o=v.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function TE(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=Y8(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function Y8(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Z8=tE,RE=nE,K8=oE,G8=iE,q8=aE,PE=lE,X8=fE,Q8=pE,AE=gE,DE=yE,J8=xE,eU=_E,OE=bE,ME=SE,IE=CE;const Mo=Z8,cl=Q8,Io=K8,Ks=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(RE,{ref:n,className:ae("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,l.jsx(G8,{asChild:!0,children:l.jsx(Lg,{className:"h-4 w-4 opacity-50"})})]}));Ks.displayName=RE.displayName;const LE=v.forwardRef(({className:e,...t},r)=>l.jsx(OE,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(aA,{className:"h-4 w-4"})}));LE.displayName=OE.displayName;const FE=v.forwardRef(({className:e,...t},r)=>l.jsx(ME,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Lg,{className:"h-4 w-4"})}));FE.displayName=ME.displayName;const Gs=v.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>l.jsx(q8,{children:l.jsxs(PE,{ref:s,className:ae("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[l.jsx(LE,{}),l.jsx(X8,{className:ae("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(FE,{})]})}));Gs.displayName=PE.displayName;const Wi=v.forwardRef(({className:e,...t},r)=>l.jsx(AE,{ref:r,className:ae("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Wi.displayName=AE.displayName;const pn=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(DE,{ref:n,className:ae("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(eU,{children:l.jsx(eb,{className:"h-4 w-4"})})}),l.jsx(J8,{children:t})]}));pn.displayName=DE.displayName;const tU=v.forwardRef(({className:e,...t},r)=>l.jsx(IE,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));tU.displayName=IE.displayName;const Mm=new Map([["aliyun-cdn",["阿里云-CDN","/imgs/providers/aliyun.svg"]],["aliyun-oss",["阿里云-OSS","/imgs/providers/aliyun.svg"]],["aliyun-dcdn",["阿里云-DCDN","/imgs/providers/aliyun.svg"]],["tencent-cdn",["腾讯云-CDN","/imgs/providers/tencent.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.svg"]],["qiniu-cdn",["七牛云-CDN","/imgs/providers/qiniu.svg"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),rU=Array.from(Mm.keys()),my=mv,gy=gv,nU=vv,zE=v.forwardRef(({className:e,...t},r)=>l.jsx(Ec,{ref:r,className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));zE.displayName=Ec.displayName;const th=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(nU,{children:[l.jsx(zE,{}),l.jsxs(Nc,{ref:n,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,l.jsxs(Tf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(Fg,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));th.displayName=Nc.displayName;const rh=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});rh.displayName="DialogHeader";const nh=v.forwardRef(({className:e,...t},r)=>l.jsx(Tc,{ref:r,className:ae("text-lg font-semibold leading-none tracking-tight",e),...t}));nh.displayName=Tc.displayName;const sU=v.forwardRef(({className:e,...t},r)=>l.jsx(Rc,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));sU.displayName=Rc.displayName;function oU(e,t){return v.useReducer((r,n)=>t[r][n]??r,e)}var vy="ScrollArea",[UE,N$]=xr(vy),[iU,cn]=UE(vy),$E=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:o=600,...i}=e,[a,c]=v.useState(null),[u,d]=v.useState(null),[f,m]=v.useState(null),[y,x]=v.useState(null),[g,_]=v.useState(null),[p,h]=v.useState(0),[w,C]=v.useState(0),[j,E]=v.useState(!1),[R,P]=v.useState(!1),A=Ke(t,q=>c(q)),L=Ea(s);return l.jsx(iU,{scope:r,type:n,dir:L,scrollHideDelay:o,scrollArea:a,viewport:u,onViewportChange:d,content:f,onContentChange:m,scrollbarX:y,onScrollbarXChange:x,scrollbarXEnabled:j,onScrollbarXEnabledChange:E,scrollbarY:g,onScrollbarYChange:_,scrollbarYEnabled:R,onScrollbarYEnabledChange:P,onCornerWidthChange:h,onCornerHeightChange:C,children:l.jsx(Re.div,{dir:L,...i,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":p+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});$E.displayName=vy;var VE="ScrollAreaViewport",WE=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...o}=e,i=cn(VE,r),a=v.useRef(null),c=Ke(t,a,i.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(Re.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});WE.displayName=VE;var Xn="ScrollAreaScrollbar",yy=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,a=e.orientation==="horizontal";return v.useEffect(()=>(a?o(!0):i(!0),()=>{a?o(!1):i(!1)}),[a,o,i]),s.type==="hover"?l.jsx(aU,{...n,ref:t,forceMount:r}):s.type==="scroll"?l.jsx(lU,{...n,ref:t,forceMount:r}):s.type==="auto"?l.jsx(BE,{...n,ref:t,forceMount:r}):s.type==="always"?l.jsx(xy,{...n,ref:t}):null});yy.displayName=Xn;var aU=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),[o,i]=v.useState(!1);return v.useEffect(()=>{const a=s.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),l.jsx(ur,{present:r||o,children:l.jsx(BE,{"data-state":o?"visible":"hidden",...n,ref:t})})}),lU=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),o=e.orientation==="horizontal",i=oh(()=>c("SCROLL_END"),100),[a,c]=oU("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,s.scrollHideDelay,c]),v.useEffect(()=>{const u=s.viewport,d=o?"scrollLeft":"scrollTop";if(u){let f=u[d];const m=()=>{const y=u[d];f!==y&&(c("SCROLL"),i()),f=y};return u.addEventListener("scroll",m),()=>u.removeEventListener("scroll",m)}},[s.viewport,o,c,i]),l.jsx(ur,{present:r||a!=="hidden",children:l.jsx(xy,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:ce(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ce(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),BE=v.forwardRef((e,t)=>{const r=cn(Xn,e.__scopeScrollArea),{forceMount:n,...s}=e,[o,i]=v.useState(!1),a=e.orientation==="horizontal",c=oh(()=>{if(r.viewport){const u=r.viewport.offsetWidth{const{orientation:r="vertical",...n}=e,s=cn(Xn,e.__scopeScrollArea),o=v.useRef(null),i=v.useRef(0),[a,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=GE(a.viewport,a.content),d={...n,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:m=>o.current=m,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:m=>i.current=m};function f(m,y){return pU(m,i.current,a,y)}return r==="horizontal"?l.jsx(cU,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollLeft,y=yw(m,a,s.dir);o.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollLeft=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollLeft=f(m,s.dir))}}):r==="vertical"?l.jsx(uU,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollTop,y=yw(m,a);o.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollTop=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollTop=f(m))}}):null}),cU=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=cn(Xn,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Ke(t,c,o.onScrollbarXChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(YE,{"data-orientation":"horizontal",...s,ref:u,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":sh(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const m=o.viewport.scrollLeft+d.deltaX;e.onWheelScroll(m),XE(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Kd(i.paddingLeft),paddingEnd:Kd(i.paddingRight)}})}})}),uU=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=cn(Xn,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Ke(t,c,o.onScrollbarYChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(YE,{"data-orientation":"vertical",...s,ref:u,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":sh(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const m=o.viewport.scrollTop+d.deltaY;e.onWheelScroll(m),XE(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Kd(i.paddingTop),paddingEnd:Kd(i.paddingBottom)}})}})}),[dU,HE]=UE(Xn),YE=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...m}=e,y=cn(Xn,r),[x,g]=v.useState(null),_=Ke(t,A=>g(A)),p=v.useRef(null),h=v.useRef(""),w=y.viewport,C=n.content-n.viewport,j=Dt(d),E=Dt(c),R=oh(f,10);function P(A){if(p.current){const L=A.clientX-p.current.left,q=A.clientY-p.current.top;u({x:L,y:q})}}return v.useEffect(()=>{const A=L=>{const q=L.target;(x==null?void 0:x.contains(q))&&j(L,C)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[w,x,C,j]),v.useEffect(E,[n,E]),wa(x,R),wa(y.content,R),l.jsx(dU,{scope:r,scrollbar:x,hasThumb:s,onThumbChange:Dt(o),onThumbPointerUp:Dt(i),onThumbPositionChange:E,onThumbPointerDown:Dt(a),children:l.jsx(Re.div,{...m,ref:_,style:{position:"absolute",...m.style},onPointerDown:ce(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),p.current=x.getBoundingClientRect(),h.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),P(A))}),onPointerMove:ce(e.onPointerMove,P),onPointerUp:ce(e.onPointerUp,A=>{const L=A.target;L.hasPointerCapture(A.pointerId)&&L.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=h.current,y.viewport&&(y.viewport.style.scrollBehavior=""),p.current=null})})})}),Zd="ScrollAreaThumb",ZE=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=HE(Zd,e.__scopeScrollArea);return l.jsx(ur,{present:r||s.hasThumb,children:l.jsx(fU,{ref:t,...n})})}),fU=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,o=cn(Zd,r),i=HE(Zd,r),{onThumbPositionChange:a}=i,c=Ke(t,f=>i.onThumbChange(f)),u=v.useRef(),d=oh(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const f=o.viewport;if(f){const m=()=>{if(d(),!u.current){const y=mU(f,a);u.current=y,a()}};return a(),f.addEventListener("scroll",m),()=>f.removeEventListener("scroll",m)}},[o.viewport,d,a]),l.jsx(Re.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ce(e.onPointerDownCapture,f=>{const y=f.target.getBoundingClientRect(),x=f.clientX-y.left,g=f.clientY-y.top;i.onThumbPointerDown({x,y:g})}),onPointerUp:ce(e.onPointerUp,i.onThumbPointerUp)})});ZE.displayName=Zd;var wy="ScrollAreaCorner",KE=v.forwardRef((e,t)=>{const r=cn(wy,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?l.jsx(hU,{...e,ref:t}):null});KE.displayName=wy;var hU=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=cn(wy,r),[o,i]=v.useState(0),[a,c]=v.useState(0),u=!!(o&&a);return wa(s.scrollbarX,()=>{var f;const d=((f=s.scrollbarX)==null?void 0:f.offsetHeight)||0;s.onCornerHeightChange(d),c(d)}),wa(s.scrollbarY,()=>{var f;const d=((f=s.scrollbarY)==null?void 0:f.offsetWidth)||0;s.onCornerWidthChange(d),i(d)}),u?l.jsx(Re.div,{...n,ref:t,style:{width:o,height:a,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Kd(e){return e?parseInt(e,10):0}function GE(e,t){const r=e/t;return isNaN(r)?0:r}function sh(e){const t=GE(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function pU(e,t,r,n="ltr"){const s=sh(r),o=s/2,i=t||o,a=s-i,c=r.scrollbar.paddingStart+i,u=r.scrollbar.size-r.scrollbar.paddingEnd-a,d=r.content-r.viewport,f=n==="ltr"?[0,d]:[d*-1,0];return qE([c,u],f)(e)}function yw(e,t,r="ltr"){const n=sh(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,i=t.content-t.viewport,a=o-n,c=r==="ltr"?[0,i]:[i*-1,0],u=Tm(e,c);return qE([0,i],[0,a])(u)}function qE(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function XE(e,t){return e>0&&e{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function s(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,a=r.top!==o.top;(i||a)&&t(),r=o,n=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(n)};function oh(e,t){const r=Dt(e),n=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),v.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function wa(e,t){const r=Dt(t);Jt(()=>{let n=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(n),s.unobserve(e)}}},[e,r])}var QE=$E,gU=WE,vU=KE;const ih=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(QE,{ref:n,className:ae("relative overflow-hidden",e),...r,children:[l.jsx(gU,{className:"h-full w-full rounded-[inherit]",children:t}),l.jsx(JE,{}),l.jsx(vU,{})]}));ih.displayName=QE.displayName;const JE=v.forwardRef(({className:e,orientation:t="vertical",...r},n)=>l.jsx(yy,{ref:n,orientation:t,className:ae("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:l.jsx(ZE,{className:"relative flex-1 rounded-full bg-border"})}));JE.displayName=yy.displayName;const uo=new Map([["tencent",["腾讯云","/imgs/providers/tencent.svg"]],["aliyun",["阿里云","/imgs/providers/aliyun.svg"]],["cloudflare",["Cloudflare","/imgs/providers/cloudflare.svg"]],["namesilo",["Namesilo","/imgs/providers/namesilo.svg"]],["godaddy",["GoDaddy","/imgs/providers/godaddy.svg"]],["qiniu",["七牛云","/imgs/providers/qiniu.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.svg"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),xw=e=>uo.get(e),To=pe.union([pe.literal("aliyun"),pe.literal("tencent"),pe.literal("ssh"),pe.literal("webhook"),pe.literal("cloudflare"),pe.literal("qiniu"),pe.literal("namesilo"),pe.literal("godaddy")],{message:"请选择云服务商"}),Ro=e=>{switch(e){case"aliyun":case"tencent":return"all";case"ssh":case"webhook":case"qiniu":return"deploy";case"cloudflare":case"namesilo":case"godaddy":return"apply";default:return"all"}},yU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,secretId:pe.string().min(1).max(64),secretKey:pe.string().min(1).max(64)});let o={secretId:"",secretKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"tencent",secretId:o.secretId,secretKey:o.secretKey}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{secretId:c.secretId,secretKey:c.secretKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretId"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretId",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretKey",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},xU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,accessKeyId:pe.string().min(1).max(64),accessSecretId:pe.string().min(1).max(64)});let o={accessKeyId:"",accessKeySecret:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"aliyun",accessKeyId:o.accessKeyId,accessSecretId:o.accessKeySecret}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{accessKeyId:c.accessKeyId,accessKeySecret:c.accessSecretId}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessKeyId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKeyId"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKeyId",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessSecretId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKeySecret"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKeySecret",...c})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},mc=v.forwardRef(({className:e,...t},r)=>l.jsx("textarea",{className:ae("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));mc.displayName="Textarea";const _y=({className:e,trigger:t})=>{const{reloadAccessGroups:r}=Kr(),[n,s]=v.useState(!1),o=pe.object({name:pe.string().min(1).max(64)}),i=Tr({resolver:Rr(o),defaultValues:{name:""}}),a=async c=>{try{await S3({name:c.name}),r(),s(!1)}catch(u){Object.entries(u.response.data).forEach(([f,m])=>{i.setError(f,{type:"manual",message:m.message})})}};return l.jsxs(my,{onOpenChange:s,open:n,children:[l.jsx(gy,{asChild:!0,className:ae(e),children:t}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsx(nh,{children:"添加分组"})}),l.jsx("div",{className:"container py-3",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"组名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入组名",...c,type:"text"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})},wU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n,reloadAccessGroups:s,config:{accessGroups:o}}=Kr(),i=v.useRef(null),[a,c]=v.useState(""),u=e&&e.group?e.group:"",d=/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,f=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,m=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,host:pe.string().refine(h=>f.test(h)||d.test(h),{message:"请输入正确的域名或IP"}),group:pe.string().optional(),port:pe.string().min(1).max(5),username:pe.string().min(1).max(64),password:pe.string().min(0).max(64),key:pe.string().min(0).max(20480),keyFile:pe.any().optional(),command:pe.string().min(1).max(2048),certPath:pe.string().min(0).max(2048),keyPath:pe.string().min(0).max(2048)});let y={host:"127.0.0.1",port:"22",username:"root",password:"",key:"",keyFile:"",command:"sudo service nginx restart",certPath:"/etc/nginx/ssl/certificate.crt",keyPath:"/etc/nginx/ssl/private.key"};e&&(y=e.config);const x=Tr({resolver:Rr(m),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"ssh",group:e==null?void 0:e.group,host:y.host,port:y.port,username:y.username,password:y.password,key:y.key,keyFile:y.keyFile,certPath:y.certPath,keyPath:y.keyPath,command:y.command}}),g=async h=>{console.log(h);let w=h.group;w=="emptyId"&&(w="");const C={id:h.id,name:h.name,configType:h.configType,usage:Ro(h.configType),group:w,config:{host:h.host,port:h.port,username:h.username,password:h.password,key:h.key,command:h.command,certPath:h.certPath,keyPath:h.keyPath}};try{const j=await jo(C);t(),C.id=j.id,C.created=j.created,C.updated=j.updated,h.id?n(C):r(C),w!=u&&(u&&await nw({id:u,"access-":C.id}),w&&await nw({id:w,"access+":C.id})),s()}catch(j){Object.entries(j.response.data).forEach(([R,P])=>{x.setError(R,{type:"manual",message:P.message})});return}},_=async h=>{var E;const w=(E=h.target.files)==null?void 0:E[0];if(!w)return;const C=w;c(C.name);const j=await K6(C);x.setValue("key",j)},p=()=>{var h;console.log(i.current),(h=i.current)==null||h.click()};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...x,children:l.jsxs("form",{onSubmit:h=>{h.stopPropagation(),x.handleSubmit(g)(h)},className:"space-y-3",children:[l.jsx(Ne,{control:x.control,name:"name",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"group",render:({field:h})=>l.jsxs(Ce,{children:[l.jsxs(je,{className:"w-full flex justify-between",children:[l.jsx("div",{children:"授权配置组(用于将一个域名证书部署到多个 ssh 主机)"}),l.jsx(_y,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]})})]}),l.jsx(Ee,{children:l.jsxs(Mo,{...h,value:h.value,defaultValue:"emptyId",onValueChange:w=>{x.setValue("group",w)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择分组"})}),l.jsxs(Gs,{children:[l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),o.map(w=>l.jsx(pn,{value:w.id?w.id:"",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:w.name})},w.id))]})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"id",render:({field:h})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"configType",render:({field:h})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...h})}),l.jsx(Se,{})]})}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(Ne,{control:x.control,name:"host",render:({field:h})=>l.jsxs(Ce,{className:"grow",children:[l.jsx(je,{children:"服务器HOST"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Host",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"port",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SSH端口"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Port",...h,type:"number"})}),l.jsx(Se,{})]})})]}),l.jsx(Ne,{control:x.control,name:"username",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"用户名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入用户名",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"password",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入密码",...h,type:"password"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"key",render:({field:h})=>l.jsxs(Ce,{hidden:!0,children:[l.jsx(je,{children:"Key(使用证书登录)"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Key",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"keyFile",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Key(使用证书登录)"}),l.jsx(Ee,{children:l.jsxs("div",{children:[l.jsx(He,{type:"button",variant:"secondary",size:"sm",className:"w-48",onClick:p,children:a||"请选择文件"}),l.jsx(Te,{placeholder:"请输入Key",...h,ref:i,className:"hidden",hidden:!0,type:"file",onChange:_})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"certPath",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"证书上传路径"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入证书上传路径",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"keyPath",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"私钥上传路径"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入私钥上传路径",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"command",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Command"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:"请输入要执行的命令",...h})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},_U=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,url:pe.string().url()});let o={url:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"webhook",url:o.url}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{url:c.url}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"url",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Webhook Url"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Webhook Url",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},bU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,dnsApiToken:pe.string().min(1).max(64)});let o={dnsApiToken:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"cloudflare",dnsApiToken:o.dnsApiToken}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{dnsApiToken:c.dnsApiToken}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"dnsApiToken",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"CLOUD_DNS_API_TOKEN"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入CLOUD_DNS_API_TOKEN",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},SU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,accessKey:pe.string().min(1).max(64),secretKey:pe.string().min(1).max(64)});let o={accessKey:"",secretKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"qiniu",accessKey:o.accessKey,secretKey:o.secretKey}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{accessKey:c.accessKey,secretKey:c.secretKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKey",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretKey",...c})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},kU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,apiKey:pe.string().min(1).max(64)});let o={apiKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"namesilo",apiKey:o.apiKey}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{apiKey:c.apiKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"NAMESILO_API_KEY"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入NAMESILO_API_KEY",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},CU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,apiKey:pe.string().min(1).max(64),apiSecret:pe.string().min(1).max(64)});let o={apiKey:"",apiSecret:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"godaddy",apiKey:o.apiKey,apiSecret:o.apiSecret}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{apiKey:c.apiKey,apiSecret:c.apiSecret}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"GODADDY_API_KEY"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入GODADDY_API_KEY",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiSecret",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"GODADDY_API_SECRET"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入GODADDY_API_SECRET",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})};function jl({trigger:e,op:t,data:r,className:n}){const[s,o]=v.useState(!1),i=Array.from(uo.keys()),[a,c]=v.useState((r==null?void 0:r.configType)||"");let u=l.jsx(l.Fragment,{children:" "});switch(a){case"tencent":u=l.jsx(yU,{data:r,onAfterReq:()=>{o(!1)}});break;case"aliyun":u=l.jsx(xU,{data:r,onAfterReq:()=>{o(!1)}});break;case"ssh":u=l.jsx(wU,{data:r,onAfterReq:()=>{o(!1)}});break;case"webhook":u=l.jsx(_U,{data:r,onAfterReq:()=>{o(!1)}});break;case"cloudflare":u=l.jsx(bU,{data:r,onAfterReq:()=>{o(!1)}});break;case"qiniu":u=l.jsx(SU,{data:r,onAfterReq:()=>{o(!1)}});break;case"namesilo":u=l.jsx(kU,{data:r,onAfterReq:()=>{o(!1)}});break;case"godaddy":u=l.jsx(CU,{data:r,onAfterReq:()=>{o(!1)}});break}const d=f=>f==a?"border-primary":"";return l.jsxs(my,{onOpenChange:o,open:s,children:[l.jsx(gy,{asChild:!0,className:ae(n),children:e}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsxs(nh,{children:[t=="add"?"添加":"编辑","授权"]})}),l.jsx(ih,{className:"max-h-[80vh]",children:l.jsxs("div",{className:"container py-3",children:[l.jsx(Ma,{children:"服务商"}),l.jsxs(Mo,{onValueChange:f=>{console.log(f),c(f)},defaultValue:a,children:[l.jsx(Ks,{className:"mt-3",children:l.jsx(Io,{placeholder:"请选择服务商"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"服务商"}),i.map(f=>{var m,y;return l.jsx(pn,{value:f,children:l.jsxs("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer",d(f)),children:[l.jsx("img",{src:(m=uo.get(f))==null?void 0:m[1],className:"h-6 w-6"}),l.jsx("div",{children:(y=uo.get(f))==null?void 0:y[0]})]})},f)})]})})]}),u]})})]})]})}const jU=({className:e,trigger:t})=>{const{config:{emails:r},setEmails:n}=Kr(),[s,o]=v.useState(!1),i=pe.object({email:pe.string().email()}),a=Tr({resolver:Rr(i),defaultValues:{email:""}}),c=async u=>{if(r.content.emails.includes(u.email)){a.setError("email",{message:"邮箱已存在"});return}const d=[...r.content.emails,u.email];try{const f=await Mc({...r,name:"emails",content:{emails:d}});n(f),a.reset(),a.clearErrors(),o(!1)}catch(f){Object.entries(f.response.data).forEach(([y,x])=>{a.setError(y,{type:"manual",message:x.message})})}};return l.jsxs(my,{onOpenChange:o,open:s,children:[l.jsx(gy,{asChild:!0,className:ae(e),children:t}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsx(nh,{children:"添加邮箱"})}),l.jsx("div",{className:"container py-3",children:l.jsx(Pr,{...a,children:l.jsxs("form",{onSubmit:u=>{console.log(u),u.stopPropagation(),a.handleSubmit(c)(u)},className:"space-y-8",children:[l.jsx(Ne,{control:a.control,name:"email",render:({field:u})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"邮箱"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入邮箱",...u,type:"email"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})},EU=()=>{const{config:{accesses:e,emails:t,accessGroups:r}}=Kr(),[n,s]=v.useState(),o=Nn(),[i,a]=v.useState("base"),[c,u]=v.useState(n?n.targetType:"");v.useEffect(()=>{const p=new URLSearchParams(o.search).get("id");p&&(async()=>{const w=await J6(p);s(w),u(w.targetType)})()},[o.search]);const d=pe.object({id:pe.string().optional(),domain:pe.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,{message:"请输入正确的域名"}),email:pe.string().email().optional(),access:pe.string().regex(/^[a-zA-Z0-9]+$/,{message:"请选择DNS服务商授权配置"}),targetAccess:pe.string().optional(),targetType:pe.string().regex(/^[a-zA-Z0-9-]+$/,{message:"请选择部署服务类型"}),variables:pe.string().optional(),group:pe.string().optional(),nameservers:pe.string().optional()}),f=Tr({resolver:Rr(d),defaultValues:{id:"",domain:"",email:"",access:"",targetAccess:"",targetType:"",variables:"",group:"",nameservers:""}});v.useEffect(()=>{n&&f.reset({id:n.id,domain:n.domain,email:n.email,access:n.access,targetAccess:n.targetAccess,targetType:n.targetType,variables:n.variables,group:n.group,nameservers:n.nameservers})},[n,f]);const m=e.filter(_=>{if(_.usage=="apply")return!1;if(c=="")return!0;const p=c.split("-");return _.configType===p[0]}),{toast:y}=qn(),x=Nr(),g=async _=>{const p=_.group=="emptyId"?"":_.group,h=_.targetAccess==="emptyId"?"":_.targetAccess;if(p==""&&h==""){f.setError("group",{type:"manual",message:"部署授权和部署授权组至少选一个"}),f.setError("targetAccess",{type:"manual",message:"部署授权和部署授权组至少选一个"});return}const w={id:_.id,crontab:"0 0 * * *",domain:_.domain,email:_.email,access:_.access,group:p,targetAccess:h,targetType:_.targetType,variables:_.variables,nameservers:_.nameservers};try{await km(w);let C="域名编辑成功";w.id==""&&(C="域名添加成功"),y({title:"成功",description:C}),x("/domains")}catch(C){Object.entries(C.response.data).forEach(([E,R])=>{f.setError(E,{type:"manual",message:R.message})});return}};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(ay,{}),l.jsxs("div",{className:" h-5 text-muted-foreground",children:[n!=null&&n.id?"编辑":"新增","域名"]}),l.jsxs("div",{className:"mt-5 flex w-full justify-center md:space-x-10 flex-col md:flex-row",children:[l.jsxs("div",{className:"w-full md:w-[200px] text-muted-foreground space-x-3 md:space-y-3 flex-row md:flex-col flex",children:[l.jsx("div",{className:ae("cursor-pointer text-right",i==="base"?"text-primary":""),onClick:()=>{a("base")},children:"基础设置"}),l.jsx("div",{className:ae("cursor-pointer text-right",i==="advance"?"text-primary":""),onClick:()=>{a("advance")},children:"高级设置"})]}),l.jsx("div",{className:"w-full md:w-[35em] bg-gray-100 dark:bg-gray-900 p-5 rounded mt-3 md:mt-0",children:l.jsx(Pr,{...f,children:l.jsxs("form",{onSubmit:f.handleSubmit(g),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:f.control,name:"domain",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsx(je,{children:"域名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入域名",..._})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"email",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"flex w-full justify-between",children:[l.jsx("div",{children:"Email(申请证书需要提供邮箱)"}),l.jsx(jU,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]})})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,onValueChange:p=>{f.setValue("email",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择邮箱"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"邮箱列表"}),t.content.emails.map(p=>l.jsx(pn,{value:p,children:l.jsx("div",{children:p})},p))]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"access",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"flex w-full justify-between",children:[l.jsx("div",{children:"DNS 服务商授权配置"}),l.jsx(jl,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]}),op:"add"})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,onValueChange:p=>{f.setValue("access",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择授权配置"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"服务商授权配置"}),e.filter(p=>p.usage!="deploy").map(p=>{var h;return l.jsx(pn,{value:p.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=uo.get(p.configType))==null?void 0:h[1]}),l.jsx("div",{children:p.name})]})},p.id)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"targetType",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsx(je,{children:"部署服务类型"}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,onValueChange:p=>{u(p),f.setValue("targetType",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择部署服务类型"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"部署服务类型"}),rU.map(p=>{var h,w;return l.jsx(pn,{value:p,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=Mm.get(p))==null?void 0:h[1]}),l.jsx("div",{children:(w=Mm.get(p))==null?void 0:w[0]})]})},p)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"targetAccess",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"w-full flex justify-between",children:[l.jsx("div",{children:"部署服务商授权配置"}),l.jsx(jl,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]}),op:"add"})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,onValueChange:p=>{f.setValue("targetAccess",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择授权配置"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsxs(Wi,{children:["服务商授权配置",f.getValues().targetAccess]}),l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:"flex items-center space-x-2",children:"--"})}),m.map(p=>{var h;return l.jsx(pn,{value:p.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=uo.get(p.configType))==null?void 0:h[1]}),l.jsx("div",{children:p.name})]})},p.id)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"group",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance"||c!="ssh",children:[l.jsx(je,{className:"w-full flex justify-between",children:l.jsx("div",{children:"部署配置组(用于将一个域名证书部署到多个 ssh 主机)"})}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,defaultValue:"emptyId",onValueChange:p=>{f.setValue("group",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择分组"})}),l.jsxs(Gs,{children:[l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),r.filter(p=>{var h;return p.expand&&((h=p.expand)==null?void 0:h.access.length)>0}).map(p=>l.jsx(pn,{value:p.id?p.id:"",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:p.name})},p.id))]})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"variables",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance",children:[l.jsx(je,{children:"变量"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:`可在SSH部署中使用,形如: 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",EU=()=>{const{config:{accessGroups:e},reloadAccessGroups:t}=Kr(),{toast:r}=qn(),n=Nr(),s=async i=>{try{await _3(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",[NU,N$]=xr(by,[kf]),iN=kf(),[TU,Sy]=NU(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(TU,{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 RU=aN,gN=cN,vN=dN,yN=hN;const xN=RU,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 PU=()=>{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 w3(_);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(EU,{})})]})]})},AU=_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(AU({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"})},DU=()=>{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:"添加域名"})})]})]})})]})},OU=pe.object({username:pe.string().email({message:"请输入正确的邮箱地址"}),password:pe.string().min(10,{message:"密码至少10个字符"})}),MU=()=>{const e=Tr({resolver:Rr(OU),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:"登录"})})]})})]})},IU=()=>st().authStore.isValid&&st().authStore.isAdmin?l.jsx(Q1,{to:"/"}):l.jsxs("div",{className:"container",children:[l.jsx(Ig,{}),l.jsx(cC,{})]}),LU=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"]}),FU=()=>{const{toast:e}=qn(),t=Nr(),r=Tr({resolver:Rr(LU),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:"确认修改"})})]})})})})},zU=()=>{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,{})})})]})})]})},UU=()=>{const[e,t]=v.useState(),[r,n]=v.useState(),s=Nr();return v.useEffect(()=>{(async()=>{const i=await X6();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)})]})]})]})},$U=pe.object({email:pe.string().email("请输入正确的邮箱")}),VU=()=>{var i;const{toast:e}=qn(),t=Nr(),[r,n]=v.useState(!1),s=Tr({resolver:Rr($U),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:"确认修改"})})]})})})})},WU=(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),BU=({children:e})=>{const[t,r]=v.useReducer(WU,{});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})},HU=()=>{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:"保存"})})]})},YU={title:"您有{COUNT}张证书即将过期",content:"有{COUNT}张证书即将过期,域名分别为{DOMAINS},请保持关注!"},ZU=()=>{const[e,t]=v.useState(""),[r,n]=v.useState([YU]),{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:"保存"})})]})},KU=()=>{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 GU(e){try{return new URL(e),!0}catch{return!1}}const qU=()=>{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(),!GU(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",[XU,bN]=xr(Ty),[QU,Ry]=XU(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(QU,{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(JU,{...n,ref:t,present:o})})});jN.displayName=Py;var JU=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 e$=SN,t$=CN,r$=jN,Ms="Accordion",n$=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Dy,s$,o$]=bc(Ms),[ah,T$]=xr(Ms,[o$,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(c$,{...o,ref:t}):l.jsx(l$,{...s,ref:t})})});EN.displayName=Ms;var[NN,i$]=ah(Ms),[TN,a$]=ah(Ms,{collapsible:!1}),l$=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})})})}),c$=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})})})}),[u$,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=s$(r),f=Ea(s)==="ltr",m=ce(e.onKeyDown,y=>{var P;if(!n$.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=i$(qd,r),a=Oy(r),c=Ur(),u=n&&i.value.includes(n)||!1,d=o.disabled||e.disabled;return l.jsx(d$,{scope:r,open:u,disabled:d,triggerId:c,children:l.jsx(e$,{"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=a$(Im,r),a=Oy(r);return l.jsx(Dy.ItemSlot,{scope:r,children:l.jsx(t$,{"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(r$,{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 f$=EN,h$=PN,p$=DN,FN=ON,zN=IN;const ww=f$,ul=v.forwardRef(({className:e,...t},r)=>l.jsx(h$,{ref:r,className:ae("border-b",e),...t}));ul.displayName="AccordionItem";const dl=v.forwardRef(({className:e,children:t,...r},n)=>l.jsx(p$,{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 m$=()=>l.jsx(l.Fragment,{children:l.jsxs(BU,{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(ZU,{})})]})})}),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(HU,{})})]}),l.jsxs(ul,{value:"item-4",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"Telegram"}),l.jsx(fl,{children:l.jsx(KU,{})})]}),l.jsxs(ul,{value:"item-5",className:"dark:border-stone-200",children:[l.jsx(dl,{children:"Webhook"}),l.jsx(fl,{children:l.jsx(qU,{})})]})]})})]})}),g$=FP([{path:"/",element:l.jsx(O3,{}),children:[{path:"/",element:l.jsx(UU,{})},{path:"/domains",element:l.jsx(rz,{})},{path:"/edit",element:l.jsx(jU,{})},{path:"/access",element:l.jsx(PU,{})},{path:"/history",element:l.jsx(DU,{})},{path:"/setting",element:l.jsx(zU,{}),children:[{path:"/setting/password",element:l.jsx(FU,{})},{path:"/setting/account",element:l.jsx(VU,{})},{path:"/setting/notify",element:l.jsx(m$,{})}]}]},{path:"/login",element:l.jsx(IU,{}),children:[{path:"/login",element:l.jsx(MU,{})}]},{path:"/about",element:l.jsx("div",{children:"About"})}]);ip.createRoot(document.getElementById("root")).render(l.jsx(We.StrictMode,{children:l.jsx(E3,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(ZP,{router:g$})})}))});export default v$(); +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/dist/index.html b/ui/dist/index.html index 89f70228..b7ae27d5 100644 --- a/ui/dist/index.html +++ b/ui/dist/index.html @@ -5,7 +5,7 @@ Certimate - Your Trusted SSL Automation Partner - + From aa1046c39aa01fad0ebce479f3207b2155b873a7 Mon Sep 17 00:00:00 2001 From: yoan <536464346@qq.com> Date: Thu, 26 Sep 2024 20:31:04 +0800 Subject: [PATCH 5/5] fixconflict --- .../{index-CnO7gXFE.js => index-5t0OlkS6.js} | 2 +- ui/dist/assets/index-DusjrPWT.js | 308 ------------------ ui/dist/index.html | 4 +- 3 files changed, 3 insertions(+), 311 deletions(-) rename ui/dist/assets/{index-CnO7gXFE.js => index-5t0OlkS6.js} (95%) delete mode 100644 ui/dist/assets/index-DusjrPWT.js diff --git a/ui/dist/assets/index-CnO7gXFE.js b/ui/dist/assets/index-5t0OlkS6.js similarity index 95% rename from ui/dist/assets/index-CnO7gXFE.js rename to ui/dist/assets/index-5t0OlkS6.js index 972fe4ce..1884dd60 100644 --- a/ui/dist/assets/index-CnO7gXFE.js +++ b/ui/dist/assets/index-5t0OlkS6.js @@ -310,4 +310,4 @@ https://github.com/nodeca/pako/blob/main/LICENSE key=val; key2=val2;`,..._,className:"placeholder:whitespace-pre-wrap"})}),a.jsx(ge,{})]})}),a.jsx(Se,{control:f.control,name:"nameservers",render:({field:_})=>a.jsxs(we,{hidden:i!="advance",children:[a.jsx(_e,{children:"域名服务器"}),a.jsx(be,{children:a.jsx(Sa,{placeholder:`自定义域名服务器,多个用分号隔开,如: 8.8.8.8; -8.8.4.4;`,..._,className:"placeholder:whitespace-pre-wrap"})}),a.jsx(ge,{})]})}),a.jsx("div",{className:"flex justify-end",children:a.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})})},sN=g.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:oe("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));sN.displayName="Card";const oN=g.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:oe("flex flex-col space-y-1.5 p-6",e),...t}));oN.displayName="CardHeader";const iN=g.forwardRef(({className:e,...t},r)=>a.jsx("h3",{ref:r,className:oe("text-2xl font-semibold leading-none tracking-tight",e),...t}));iN.displayName="CardTitle";const aN=g.forwardRef(({className:e,...t},r)=>a.jsx("p",{ref:r,className:oe("text-sm text-muted-foreground",e),...t}));aN.displayName="CardDescription";const lN=g.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:oe("p-6 pt-0",e),...t}));lN.displayName="CardContent";const cN=g.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:oe("flex items-center p-6 pt-0",e),...t}));cN.displayName="CardFooter";const Es=e=>e instanceof Error?e.message:typeof e=="object"&&e!==null&&"message"in e?String(e.message):typeof e=="string"?e:"Something went wrong",KU=()=>{const{config:{accessGroups:e},reloadAccessGroups:t}=Ar(),{toast:r}=Pn(),n=Pr(),s=async i=>{try{await U3(i),t()}catch(l){r({title:"删除失败",description:Es(l),variant:"destructive"});return}},o=()=>{n("/access")};return a.jsxs("div",{className:"mt-10",children:[a.jsx(ia,{when:e.length==0,children:a.jsx(a.Fragment,{children:a.jsxs("div",{className:"flex flex-col items-center mt-10",children:[a.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:a.jsx(C0,{size:40,className:"text-primary"})}),a.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),a.jsx(Ey,{trigger:a.jsx(He,{children:"新增授权组"}),className:"mt-3"})]})})}),a.jsx(ih,{className:"h-[75vh] overflow-hidden",children:a.jsx("div",{className:"flex gap-5 flex-wrap",children:e.map(i=>a.jsxs(sN,{className:"w-full md:w-[350px]",children:[a.jsxs(oN,{children:[a.jsx(iN,{children:i.name}),a.jsxs(aN,{children:["共有",i.expand?i.expand.access.length:0,"个部署授权配置"]})]}),a.jsx(lN,{className:"min-h-[180px]",children:i.expand?a.jsx(a.Fragment,{children:i.expand.access.slice(0,3).map(l=>a.jsx("div",{className:"flex flex-col mb-3",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"",children:a.jsx("img",{src:Ew(l.configType)[1],alt:"provider",className:"w-8 h-8"})}),a.jsxs("div",{className:"ml-3",children:[a.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:l.name}),a.jsx("div",{className:"text-xs text-muted-foreground",children:Ew(l.configType)[0]})]})]})},l.id))}):a.jsx(a.Fragment,{children:a.jsxs("div",{className:"flex text-gray-700 dark:text-gray-200 items-center",children:[a.jsx("div",{children:a.jsx(C0,{size:40})}),a.jsx("div",{className:"ml-2",children:"暂无部署授权配置,请添加后开始使用吧"})]})})}),a.jsx(cN,{children:a.jsxs("div",{className:"flex justify-end w-full",children:[a.jsx(ia,{when:!!(i.expand&&i.expand.access.length>0),children:a.jsx("div",{children:a.jsx(He,{size:"sm",variant:"link",onClick:()=>{n(`/access?accessGroupId=${i.id}&tab=access`,{replace:!0})},children:"所有授权"})})}),a.jsx(ia,{when:!i.expand||i.expand.access.length==0,children:a.jsx("div",{children:a.jsx(He,{size:"sm",onClick:o,children:"新增授权"})})}),a.jsx("div",{className:"ml-3",children:a.jsxs(GC,{children:[a.jsx(ZC,{asChild:!0,children:a.jsx(He,{variant:"destructive",size:"sm",children:"删除"})}),a.jsxs(ty,{children:[a.jsxs(ry,{children:[a.jsx(sy,{className:"dark:text-gray-200",children:"删除组"}),a.jsx(oy,{children:"确定要删除部署授权组吗?"})]}),a.jsxs(ny,{children:[a.jsx(ay,{className:"dark:text-gray-200",children:"取消"}),a.jsx(iy,{onClick:()=>{s(i.id?i.id:"")},children:"确认"})]})]})]})})]})})]}))})})]})};var Ny="Tabs",[GU,iV]=sr(Ny,[Oa]),uN=Oa(),[ZU,Ty]=GU(Ny),dN=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=di(l),[f,m]=Yr({prop:n,onChange:s,defaultProp:o});return a.jsx(ZU,{scope:r,baseId:$r(),value:f,onValueChange:m,orientation:i,dir:d,activationMode:c,children:a.jsx(Re.div,{dir:d,"data-orientation":i,...u,ref:t})})});dN.displayName=Ny;var fN="TabsList",hN=g.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...s}=e,o=Ty(fN,r),i=uN(r);return a.jsx(nv,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:n,children:a.jsx(Re.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});hN.displayName=fN;var pN="TabsTrigger",mN=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...o}=e,i=Ty(pN,r),l=uN(r),c=yN(i.baseId,n),u=xN(i.baseId,n),d=n===i.value;return a.jsx(sv,{asChild:!0,...l,focusable:!s,active:d,children:a.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:ue(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?i.onValueChange(n):f.preventDefault()}),onKeyDown:ue(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(n)}),onFocus:ue(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!s&&f&&i.onValueChange(n)})})})});mN.displayName=pN;var gN="TabsContent",vN=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:s,children:o,...i}=e,l=Ty(gN,r),c=yN(l.baseId,n),u=xN(l.baseId,n),d=n===l.value,f=g.useRef(d);return g.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(or,{present:s||d,children:({present:m})=>a.jsx(Re.div,{"data-state":d?"active":"inactive","data-orientation":l.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})})});vN.displayName=gN;function yN(e,t){return`${e}-trigger-${t}`}function xN(e,t){return`${e}-content-${t}`}var qU=dN,wN=hN,_N=mN,bN=vN;const SN=qU,Ry=g.forwardRef(({className:e,...t},r)=>a.jsx(wN,{ref:r,className:oe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Ry.displayName=wN.displayName;const Yo=g.forwardRef(({className:e,...t},r)=>a.jsx(_N,{ref:r,className:oe("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}));Yo.displayName=_N.displayName;const qd=g.forwardRef(({className:e,...t},r)=>a.jsx(bN,{ref:r,className:oe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));qd.displayName=bN.displayName;const XU=()=>{const{config:e,deleteAccess:t}=Ar(),{accesses:r}=e,n=10,s=Math.ceil(r.length/n),o=Pr(),i=Nn(),l=new URLSearchParams(i.search),c=l.get("page"),u=c?Number(c):1,d=l.get("tab"),f=l.get("accessGroupId"),m=(u-1)*n,v=m+n,x=async _=>{const p=await z3(_);t(p.id)},y=_=>{l.set("tab",_),o({search:l.toString()})};return a.jsxs("div",{className:"",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("div",{className:"text-muted-foreground",children:"授权管理"}),d!="access_group"?a.jsx(Tl,{trigger:a.jsx(He,{children:"添加授权"}),op:"add"}):a.jsx(Ey,{trigger:a.jsx(He,{children:"添加授权组"})})]}),a.jsxs(SN,{defaultValue:d||"access",value:d||"access",className:"w-full mt-5",children:[a.jsxs(Ry,{className:"space-x-5 px-3",children:[a.jsx(Yo,{value:"access",onClick:()=>{y("access")},children:"授权管理"}),a.jsx(Yo,{value:"access_group",onClick:()=>{y("access_group")},children:"授权组管理"})]}),a.jsx(qd,{value:"access",children:r.length===0?a.jsxs("div",{className:"flex flex-col items-center mt-10",children:[a.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:a.jsx(RA,{size:40,className:"text-primary"})}),a.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加授权开始部署证书吧。"}),a.jsx(Tl,{trigger:a.jsx(He,{children:"添加授权"}),op:"add",className:"mt-3"})]}):a.jsxs(a.Fragment,{children:[a.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:[a.jsx("div",{className:"w-48",children:"名称"}),a.jsx("div",{className:"w-48",children:"服务商"}),a.jsx("div",{className:"w-52",children:"创建时间"}),a.jsx("div",{className:"w-52",children:"更新时间"}),a.jsx("div",{className:"grow",children:"操作"})]}),a.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"授权列表"}),r.filter(_=>f?_.group==f:!0).slice(m,v).map(_=>{var p,h;return a.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:[a.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:_.name}),a.jsxs("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center space-x-2",children:[a.jsx("img",{src:(p=mo.get(_.configType))==null?void 0:p[1],className:"w-6"}),a.jsx("div",{children:(h=mo.get(_.configType))==null?void 0:h[0]})]}),a.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["创建于"," ",_.created&&ya(_.created)]}),a.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["更新于"," ",_.updated&&ya(_.updated)]}),a.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[a.jsx(Tl,{trigger:a.jsx(He,{variant:"link",className:"p-0",children:"编辑"}),op:"edit",data:_}),a.jsx(Bt,{orientation:"vertical",className:"h-4 mx-2"}),a.jsx(He,{variant:"link",className:"p-0",onClick:()=>{x(_)},children:"删除"})]})]},_.id)}),a.jsx(NC,{totalPages:s,currentPage:u,onPageChange:_=>{l.set("page",_.toString()),o({search:l.toString()})}})]})}),a.jsx(qd,{value:"access_group",children:a.jsx(KU,{})})]})]})},QU=Sc("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"}}),Py=g.forwardRef(({className:e,variant:t,...r},n)=>a.jsx("div",{ref:n,role:"alert",className:oe(QU({variant:t}),e),...r}));Py.displayName="Alert";const Ay=g.forwardRef(({className:e,...t},r)=>a.jsx("h5",{ref:r,className:oe("mb-1 font-medium leading-none tracking-tight",e),...t}));Ay.displayName="AlertTitle";const Dy=g.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:oe("text-sm [&_p]:leading-relaxed",e),...t}));Dy.displayName="AlertDescription";const kN=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"})},JU=()=>{const e=Pr(),[t,r]=g.useState(),[n]=vA(),s=n.get("domain");return g.useEffect(()=>{(async()=>{const i={};s&&(i.domain=s);const l=await kN(i);r(l.items)})()},[s]),a.jsxs(ih,{className:"h-[80vh] overflow-hidden",children:[a.jsx("div",{className:"text-muted-foreground",children:"部署历史"}),t!=null&&t.length?a.jsxs(a.Fragment,{children:[a.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:[a.jsx("div",{className:"w-48",children:"域名"}),a.jsx("div",{className:"w-24",children:"状态"}),a.jsx("div",{className:"w-56",children:"阶段"}),a.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),a.jsx("div",{className:"grow",children:"操作"})]}),a.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),t==null?void 0:t.map(o=>{var i,l;return a.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:[a.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}),a.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:a.jsx(ey,{deployment:o})}),a.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:a.jsx(qv,{phase:o.phase,phaseSuccess:o.phaseSuccess})}),a.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:ya(o.deployedAt)}),a.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:a.jsxs(bv,{children:[a.jsx(Sv,{asChild:!0,children:a.jsx(He,{variant:"link",className:"p-0",children:"日志"})}),a.jsxs(Rf,{className:"sm:max-w-5xl",children:[a.jsx(kv,{children:a.jsxs(Cv,{children:[(l=o.expand.domain)==null?void 0:l.domain,"-",o.id,"部署详情"]})}),a.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[o.log.check&&a.jsx(a.Fragment,{children:o.log.check.map(c=>a.jsxs("div",{className:"flex flex-col mt-2",children:[a.jsxs("div",{className:"flex",children:[a.jsxs("div",{children:["[",c.time,"]"]}),a.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&a.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.apply&&a.jsx(a.Fragment,{children:o.log.apply.map(c=>a.jsxs("div",{className:"flex flex-col mt-2",children:[a.jsxs("div",{className:"flex",children:[a.jsxs("div",{children:["[",c.time,"]"]}),a.jsx("div",{className:"ml-2",children:c.message})]}),c.info&&c.info.map(u=>a.jsx("div",{className:"mt-1 text-green-600",children:u})),c.error&&a.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.deploy&&a.jsx(a.Fragment,{children:o.log.deploy.map(c=>a.jsxs("div",{className:"flex flex-col mt-2",children:[a.jsxs("div",{className:"flex",children:[a.jsxs("div",{children:["[",c.time,"]"]}),a.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&a.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))})]})]})]})})]},o.id)})]}):a.jsx(a.Fragment,{children:a.jsxs(Py,{className:"max-w-[40em] mx-auto mt-20",children:[a.jsx(Ay,{children:"暂无数据"}),a.jsxs(Dy,{children:[a.jsxs("div",{className:"flex items-center mt-5",children:[a.jsx("div",{children:a.jsx(ub,{className:"text-yellow-400",size:36})}),a.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),a.jsx("div",{className:"mt-2 flex justify-end",children:a.jsx(He,{onClick:()=>{e("/")},children:"添加域名"})})]})]})})]})},e$=ce.object({username:ce.string().email({message:"请输入正确的邮箱地址"}),password:ce.string().min(10,{message:"密码至少10个字符"})}),t$=()=>{const e=fr({resolver:hr(e$),defaultValues:{username:"",password:""}}),t=async n=>{try{await st().admins.authWithPassword(n.username,n.password),r("/")}catch(s){const o=Es(s);e.setError("username",{message:o}),e.setError("password",{message:o})}},r=Pr();return a.jsxs("div",{className:"max-w-[35em] border dark:border-stone-500 mx-auto mt-32 p-10 rounded-md shadow-md",children:[a.jsx("div",{className:"flex justify-center mb-10",children:a.jsx("img",{src:"/vite.svg",className:"w-16"})}),a.jsx(pr,{...e,children:a.jsxs("form",{onSubmit:e.handleSubmit(t),className:"space-y-8 dark:text-stone-200",children:[a.jsx(Se,{control:e.control,name:"username",render:({field:n})=>a.jsxs(we,{children:[a.jsx(_e,{children:"用户名"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"email",...n})}),a.jsx(ge,{})]})}),a.jsx(Se,{control:e.control,name:"password",render:({field:n})=>a.jsxs(we,{children:[a.jsx(_e,{children:"密码"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"shadcn",...n,type:"password"})}),a.jsx(ge,{})]})}),a.jsx("div",{className:"flex justify-end",children:a.jsx(He,{type:"submit",children:"登录"})})]})})]})},r$=()=>st().authStore.isValid&&st().authStore.isAdmin?a.jsx(ib,{to:"/"}):a.jsxs("div",{className:"container",children:[a.jsx(Lg,{}),a.jsx(pC,{})]}),n$=ce.object({oldPassword:ce.string().min(10,{message:"密码至少10个字符"}),newPassword:ce.string().min(10,{message:"密码至少10个字符"}),confirmPassword:ce.string().min(10,{message:"密码至少10个字符"})}).refine(e=>e.newPassword===e.confirmPassword,{message:"两次密码不一致",path:["confirmPassword"]}),s$=()=>{const{toast:e}=Pn(),t=Pr(),r=fr({resolver:hr(n$),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(l){const c=Es(l);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(l){const c=Es(l);e({title:"修改密码失败",description:c,variant:"destructive"})}};return a.jsx(a.Fragment,{children:a.jsx("div",{className:"w-full md:max-w-[35em]",children:a.jsx(pr,{...r,children:a.jsxs("form",{onSubmit:r.handleSubmit(n),className:"space-y-8 dark:text-stone-200",children:[a.jsx(Se,{control:r.control,name:"oldPassword",render:({field:s})=>a.jsxs(we,{children:[a.jsx(_e,{children:"当前密码"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"当前密码",...s,type:"password"})}),a.jsx(ge,{})]})}),a.jsx(Se,{control:r.control,name:"newPassword",render:({field:s})=>a.jsxs(we,{children:[a.jsx(_e,{children:"新密码"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"newPassword",...s,type:"password"})}),a.jsx(ge,{})]})}),a.jsx(Se,{control:r.control,name:"confirmPassword",render:({field:s})=>a.jsxs(we,{children:[a.jsx(_e,{children:"确认密码"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"confirmPassword",...s,type:"password"})}),a.jsx(ge,{})]})}),a.jsx("div",{className:"flex justify-end",children:a.jsx(He,{type:"submit",children:"确认修改"})})]})})})})},o$=()=>{const e=Nn(),[t,r]=g.useState("account"),n=Pr();return g.useEffect(()=>{const o=e.pathname.split("/")[2];r(o)},[e]),a.jsxs("div",{children:[a.jsx(hy,{}),a.jsx("div",{className:"text-muted-foreground border-b dark:border-stone-500 py-5",children:"偏好设置"}),a.jsx("div",{className:"w-full mt-5 p-0 md:p-3 flex justify-center",children:a.jsxs(SN,{defaultValue:"account",className:"w-full",value:t,children:[a.jsxs(Ry,{className:"mx-auto",children:[a.jsxs(Yo,{value:"account",onClick:()=>{n("/setting/account")},className:"px-5",children:[a.jsx(FA,{size:14}),a.jsx("div",{className:"ml-1",children:"账户"})]}),a.jsxs(Yo,{value:"password",onClick:()=>{n("/setting/password")},className:"px-5",children:[a.jsx(TA,{size:14}),a.jsx("div",{className:"ml-1",children:"密码"})]}),a.jsxs(Yo,{value:"notify",onClick:()=>{n("/setting/notify")},className:"px-5",children:[a.jsx(AA,{size:14}),a.jsx("div",{className:"ml-1",children:"消息推送"})]}),a.jsxs(Yo,{value:"ssl-provider",onClick:()=>{n("/setting/ssl-provider")},className:"px-5",children:[a.jsx(MA,{size:14}),a.jsx("div",{className:"ml-1",children:"证书厂商"})]})]}),a.jsx(qd,{value:t,children:a.jsx("div",{className:"mt-5 w-full md:w-[45em]",children:a.jsx(Lg,{})})})]})})]})},i$=()=>{const[e,t]=g.useState(),[r,n]=g.useState(),s=Pr();return g.useEffect(()=>{(async()=>{const i=await gz();t(i)})()},[]),g.useEffect(()=>{(async()=>{const l=await kN({perPage:8});n(l.items)})()},[]),a.jsxs("div",{className:"flex flex-col",children:[a.jsx("div",{className:"flex justify-between items-center",children:a.jsx("div",{className:"text-muted-foreground",children:"控制面板"})}),a.jsxs("div",{className:"flex mt-10 gap-5 flex-col flex-wrap md:flex-row",children:[a.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[a.jsx("div",{className:"p-3",children:a.jsx(IA,{size:48,strokeWidth:1,className:"text-blue-400"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-muted-foreground font-semibold",children:"所有"}),a.jsxs("div",{className:"flex items-baseline",children:[a.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.total?a.jsx(gr,{to:"/domains",className:"hover:underline",children:e==null?void 0:e.total}):0}),a.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),a.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[a.jsx("div",{className:"p-3",children:a.jsx(SA,{size:48,strokeWidth:1,className:"text-red-400"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-muted-foreground font-semibold",children:"即将过期"}),a.jsxs("div",{className:"flex items-baseline",children:[a.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.expired?a.jsx(gr,{to:"/domains?state=expired",className:"hover:underline",children:e==null?void 0:e.expired}):0}),a.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),a.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[a.jsx("div",{className:"p-3",children:a.jsx(PA,{size:48,strokeWidth:1,className:"text-green-400"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-muted-foreground font-semibold",children:"启用中"}),a.jsxs("div",{className:"flex items-baseline",children:[a.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.enabled?a.jsx(gr,{to:"/domains?state=enabled",className:"hover:underline",children:e==null?void 0:e.enabled}):0}),a.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),a.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[a.jsx("div",{className:"p-3",children:a.jsx(_A,{size:48,strokeWidth:1,className:"text-gray-400"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-muted-foreground font-semibold",children:"未启用"}),a.jsxs("div",{className:"flex items-baseline",children:[a.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.disabled?a.jsx(gr,{to:"/domains?state=disabled",className:"hover:underline",children:e==null?void 0:e.disabled}):0}),a.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-muted-foreground mt-5 text-sm",children:"部署历史"}),(r==null?void 0:r.length)==0?a.jsx(a.Fragment,{children:a.jsxs(Py,{className:"max-w-[40em] mt-10",children:[a.jsx(Ay,{children:"暂无数据"}),a.jsxs(Dy,{children:[a.jsxs("div",{className:"flex items-center mt-5",children:[a.jsx("div",{children:a.jsx(ub,{className:"text-yellow-400",size:36})}),a.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),a.jsx("div",{className:"mt-2 flex justify-end",children:a.jsx(He,{onClick:()=>{s("/edit")},children:"添加域名"})})]})]})}):a.jsxs(a.Fragment,{children:[a.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:[a.jsx("div",{className:"w-48",children:"域名"}),a.jsx("div",{className:"w-24",children:"状态"}),a.jsx("div",{className:"w-56",children:"阶段"}),a.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),a.jsx("div",{className:"grow",children:"操作"})]}),a.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),r==null?void 0:r.map(o=>{var i,l;return a.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:[a.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}),a.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:a.jsx(ey,{deployment:o})}),a.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:a.jsx(qv,{phase:o.phase,phaseSuccess:o.phaseSuccess})}),a.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:ya(o.deployedAt)}),a.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:a.jsxs(bv,{children:[a.jsx(Sv,{asChild:!0,children:a.jsx(He,{variant:"link",className:"p-0",children:"日志"})}),a.jsxs(Rf,{className:"sm:max-w-5xl",children:[a.jsx(kv,{children:a.jsxs(Cv,{children:[(l=o.expand.domain)==null?void 0:l.domain,"-",o.id,"部署详情"]})}),a.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[o.log.check&&a.jsx(a.Fragment,{children:o.log.check.map(c=>a.jsxs("div",{className:"flex flex-col mt-2",children:[a.jsxs("div",{className:"flex",children:[a.jsxs("div",{children:["[",c.time,"]"]}),a.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&a.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.apply&&a.jsx(a.Fragment,{children:o.log.apply.map(c=>a.jsxs("div",{className:"flex flex-col mt-2",children:[a.jsxs("div",{className:"flex",children:[a.jsxs("div",{children:["[",c.time,"]"]}),a.jsx("div",{className:"ml-2",children:c.message})]}),c.info&&c.info.map(u=>a.jsx("div",{className:"mt-1 text-green-600",children:u})),c.error&&a.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.deploy&&a.jsx(a.Fragment,{children:o.log.deploy.map(c=>a.jsxs("div",{className:"flex flex-col mt-2",children:[a.jsxs("div",{className:"flex",children:[a.jsxs("div",{children:["[",c.time,"]"]}),a.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&a.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))})]})]})]})})]},o.id)})]})]})]})},a$=ce.object({email:ce.string().email("请输入正确的邮箱")}),l$=()=>{var i;const{toast:e}=Pn(),t=Pr(),[r,n]=g.useState(!1),s=fr({resolver:hr(a$),defaultValues:{email:(i=st().authStore.model)==null?void 0:i.email}}),o=async l=>{var c;try{await st().admins.update((c=st().authStore.model)==null?void 0:c.id,{email:l.email}),st().authStore.clear(),e({title:"修改账户邮箱功",description:"请重新登录"}),setTimeout(()=>{t("/login")},500)}catch(u){const d=Es(u);e({title:"修改账户邮箱失败",description:d,variant:"destructive"})}};return a.jsx(a.Fragment,{children:a.jsx("div",{className:"w-full md:max-w-[35em]",children:a.jsx(pr,{...s,children:a.jsxs("form",{onSubmit:s.handleSubmit(o),className:"space-y-8 dark:text-stone-200",children:[a.jsx(Se,{control:s.control,name:"email",render:({field:l})=>a.jsxs(we,{children:[a.jsx(_e,{children:"邮箱"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"请输入邮箱",...l,type:"email",onChange:c=>{n(!0),s.setValue("email",c.target.value)}})}),a.jsx(ge,{})]})}),a.jsx("div",{className:"flex justify-end",children:r?a.jsx(He,{type:"submit",children:"确认修改"}):a.jsx(He,{type:"submit",disabled:!0,variant:"secondary",children:"确认修改"})})]})})})})},c$=(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}},CN=g.createContext({}),Oy=()=>g.useContext(CN),u$=({children:e})=>{const[t,r]=g.useReducer(c$,{});g.useEffect(()=>{(async()=>{const i=await Zv("notifyChannels");r({type:"SET_CHANNELS",payload:i})})()},[]);const n=g.useCallback(o=>{r({type:"SET_CHANNEL",payload:o})},[]),s=g.useCallback(o=>{r({type:"SET_CHANNELS",payload:o})},[]);return a.jsx(CN.Provider,{value:{config:t,setChannel:n,setChannels:s},children:e})},d$=()=>{const{config:e,setChannels:t}=Oy(),[r,n]=g.useState({id:e.id??"",name:"notifyChannels",data:{accessToken:"",secret:"",enabled:!1}});g.useEffect(()=>{const l=(()=>{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:l})},[e]);const{toast:s}=Pn(),o=async()=>{try{const i=await Fa({...e,name:"notifyChannels",content:{...e.content,dingtalk:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const l=Es(i);s({title:"保存失败",description:"配置保存失败:"+l,variant:"destructive"})}};return a.jsxs("div",{children:[a.jsx(Ne,{placeholder:"AccessToken",value:r.data.accessToken,onChange:i=>{n({...r,data:{...r.data,accessToken:i.target.value}})}}),a.jsx(Ne,{placeholder:"加签的签名",className:"mt-2",value:r.data.secret,onChange:i=>{n({...r,data:{...r.data,secret:i.target.value}})}}),a.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[a.jsx(Fc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),a.jsx(Co,{htmlFor:"airplane-mode",children:"是否启用"})]}),a.jsx("div",{className:"flex justify-end mt-2",children:a.jsx(He,{onClick:()=>{o()},children:"保存"})})]})},f$={title:"您有{COUNT}张证书即将过期",content:"有{COUNT}张证书即将过期,域名分别为{DOMAINS},请保持关注!"},h$=()=>{const[e,t]=g.useState(""),[r,n]=g.useState([f$]),{toast:s}=Pn();g.useEffect(()=>{(async()=>{const u=await Zv("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}])},l=async()=>{const c=await Fa({id:e,content:{notifyTemplates:r},name:"templates"});c.id&&t(c.id),s({title:"保存成功",description:"通知模板保存成功"})};return a.jsxs("div",{children:[a.jsx(Ne,{value:r[0].title,onChange:c=>{o(c.target.value)}}),a.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:"可选的变量, COUNT:即将过期张数"}),a.jsx(Sa,{className:"mt-2",value:r[0].content,onChange:c=>{i(c.target.value)}}),a.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:"可选的变量, COUNT:即将过期张数,DOMAINS:域名列表"}),a.jsx("div",{className:"flex justify-end mt-2",children:a.jsx(He,{onClick:l,children:"保存"})})]})},p$=()=>{const{config:e,setChannels:t}=Oy(),[r,n]=g.useState({id:e.id??"",name:"notifyChannels",data:{apiToken:"",chatId:"",enabled:!1}});g.useEffect(()=>{const l=(()=>{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:l})},[e]);const{toast:s}=Pn(),o=async()=>{try{const i=await Fa({...e,name:"notifyChannels",content:{...e.content,telegram:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const l=Es(i);s({title:"保存失败",description:"配置保存失败:"+l,variant:"destructive"})}};return a.jsxs("div",{children:[a.jsx(Ne,{placeholder:"ApiToken",value:r.data.apiToken,onChange:i=>{n({...r,data:{...r.data,apiToken:i.target.value}})}}),a.jsx(Ne,{placeholder:"ChatId",value:r.data.chatId,onChange:i=>{n({...r,data:{...r.data,chatId:i.target.value}})}}),a.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[a.jsx(Fc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),a.jsx(Co,{htmlFor:"airplane-mode",children:"是否启用"})]}),a.jsx("div",{className:"flex justify-end mt-2",children:a.jsx(He,{onClick:()=>{o()},children:"保存"})})]})};function m$(e){try{return new URL(e),!0}catch{return!1}}const g$=()=>{const{config:e,setChannels:t}=Oy(),[r,n]=g.useState({id:e.id??"",name:"notifyChannels",data:{url:"",enabled:!1}});g.useEffect(()=>{const l=(()=>{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:l})},[e]);const{toast:s}=Pn(),o=async()=>{try{if(r.data.url=r.data.url.trim(),!m$(r.data.url)){s({title:"保存失败",description:"Url格式不正确",variant:"destructive"});return}const i=await Fa({...e,name:"notifyChannels",content:{...e.content,webhook:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const l=Es(i);s({title:"保存失败",description:"配置保存失败:"+l,variant:"destructive"})}};return a.jsxs("div",{children:[a.jsx(Ne,{placeholder:"Url",value:r.data.url,onChange:i=>{n({...r,data:{...r.data,url:i.target.value}})}}),a.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[a.jsx(Fc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),a.jsx(Co,{htmlFor:"airplane-mode",children:"是否启用"})]}),a.jsx("div",{className:"flex justify-end mt-2",children:a.jsx(He,{onClick:()=>{o()},children:"保存"})})]})};var My="Collapsible",[v$,jN]=sr(My),[y$,Iy]=v$(My),EN=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:o,onOpenChange:i,...l}=e,[c=!1,u]=Yr({prop:n,defaultProp:s,onChange:i});return a.jsx(y$,{scope:r,disabled:o,contentId:$r(),open:c,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),children:a.jsx(Re.div,{"data-state":Fy(c),"data-disabled":o?"":void 0,...l,ref:t})})});EN.displayName=My;var NN="CollapsibleTrigger",TN=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,...n}=e,s=Iy(NN,r);return a.jsx(Re.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Fy(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:t,onClick:ue(e.onClick,s.onOpenToggle)})});TN.displayName=NN;var Ly="CollapsibleContent",RN=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Iy(Ly,e.__scopeCollapsible);return a.jsx(or,{present:r||s.open,children:({present:o})=>a.jsx(x$,{...n,ref:t,present:o})})});RN.displayName=Ly;var x$=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:n,children:s,...o}=e,i=Iy(Ly,r),[l,c]=g.useState(n),u=g.useRef(null),d=Ke(t,u),f=g.useRef(0),m=f.current,v=g.useRef(0),x=v.current,y=i.open||l,_=g.useRef(y),p=g.useRef();return g.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,v.current=w.width,_.current||(h.style.transitionDuration=p.current.transitionDuration,h.style.animationName=p.current.animationName),c(n)}},[i.open,n]),a.jsx(Re.div,{"data-state":Fy(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!y,...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:y&&s})});function Fy(e){return e?"open":"closed"}var w$=EN,_$=TN,b$=RN,zs="Accordion",S$=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[zy,k$,C$]=kc(zs),[ah,aV]=sr(zs,[C$,jN]),Uy=jN(),PN=Be.forwardRef((e,t)=>{const{type:r,...n}=e,s=n,o=n;return a.jsx(zy.Provider,{scope:e.__scopeAccordion,children:r==="multiple"?a.jsx(T$,{...o,ref:t}):a.jsx(N$,{...s,ref:t})})});PN.displayName=zs;var[AN,j$]=ah(zs),[DN,E$]=ah(zs,{collapsible:!1}),N$=Be.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},collapsible:o=!1,...i}=e,[l,c]=Yr({prop:r,defaultProp:n,onChange:s});return a.jsx(AN,{scope:e.__scopeAccordion,value:l?[l]:[],onItemOpen:c,onItemClose:Be.useCallback(()=>o&&c(""),[o,c]),children:a.jsx(DN,{scope:e.__scopeAccordion,collapsible:o,children:a.jsx(ON,{...i,ref:t})})})}),T$=Be.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...o}=e,[i=[],l]=Yr({prop:r,defaultProp:n,onChange:s}),c=Be.useCallback(d=>l((f=[])=>[...f,d]),[l]),u=Be.useCallback(d=>l((f=[])=>f.filter(m=>m!==d)),[l]);return a.jsx(AN,{scope:e.__scopeAccordion,value:i,onItemOpen:c,onItemClose:u,children:a.jsx(DN,{scope:e.__scopeAccordion,collapsible:!0,children:a.jsx(ON,{...o,ref:t})})})}),[R$,lh]=ah(zs),ON=Be.forwardRef((e,t)=>{const{__scopeAccordion:r,disabled:n,dir:s,orientation:o="vertical",...i}=e,l=Be.useRef(null),c=Ke(l,t),u=k$(r),f=di(s)==="ltr",m=ue(e.onKeyDown,v=>{var P;if(!S$.includes(v.key))return;const x=v.target,y=u().filter(A=>{var L;return!((L=A.ref.current)!=null&&L.disabled)}),_=y.findIndex(A=>A.ref.current===x),p=y.length;if(_===-1)return;v.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(Xd,r),i=j$(Xd,r),l=Uy(r),c=$r(),u=n&&i.value.includes(n)||!1,d=o.disabled||e.disabled;return a.jsx(P$,{scope:r,open:u,disabled:d,triggerId:c,children:a.jsx(w$,{"data-orientation":o.orientation,"data-state":$N(u),...l,...s,ref:t,disabled:d,open:u,onOpenChange:f=>{f?i.onItemOpen(n):i.onItemClose(n)}})})});MN.displayName=Xd;var IN="AccordionHeader",LN=Be.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(zs,r),o=$y(IN,r);return a.jsx(Re.h3,{"data-orientation":s.orientation,"data-state":$N(o.open),"data-disabled":o.disabled?"":void 0,...n,ref:t})});LN.displayName=IN;var Im="AccordionTrigger",FN=Be.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(zs,r),o=$y(Im,r),i=E$(Im,r),l=Uy(r);return a.jsx(zy.ItemSlot,{scope:r,children:a.jsx(_$,{"aria-disabled":o.open&&!i.collapsible||void 0,"data-orientation":s.orientation,id:o.triggerId,...l,...n,ref:t})})});FN.displayName=Im;var zN="AccordionContent",UN=Be.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(zs,r),o=$y(zN,r),i=Uy(r);return a.jsx(b$,{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}})});UN.displayName=zN;function $N(e){return e?"open":"closed"}var A$=PN,D$=MN,O$=LN,VN=FN,BN=UN;const Nw=A$,hl=g.forwardRef(({className:e,...t},r)=>a.jsx(D$,{ref:r,className:oe("border-b",e),...t}));hl.displayName="AccordionItem";const pl=g.forwardRef(({className:e,children:t,...r},n)=>a.jsx(O$,{className:"flex",children:a.jsxs(VN,{ref:n,className:oe("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,a.jsx(Fg,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));pl.displayName=VN.displayName;const ml=g.forwardRef(({className:e,children:t,...r},n)=>a.jsx(BN,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:a.jsx("div",{className:oe("pb-4 pt-0",e),children:t})}));ml.displayName=BN.displayName;const M$=()=>a.jsx(a.Fragment,{children:a.jsxs(u$,{children:[a.jsx("div",{className:"border rounded-sm p-5 shadow-lg",children:a.jsx(Nw,{type:"multiple",className:"dark:text-stone-200",children:a.jsxs(hl,{value:"item-1",className:"dark:border-stone-200",children:[a.jsx(pl,{children:"模板"}),a.jsx(ml,{children:a.jsx(h$,{})})]})})}),a.jsx("div",{className:"border rounded-md p-5 mt-7 shadow-lg",children:a.jsxs(Nw,{type:"single",className:"dark:text-stone-200",children:[a.jsxs(hl,{value:"item-2",className:"dark:border-stone-200",children:[a.jsx(pl,{children:"钉钉"}),a.jsx(ml,{children:a.jsx(d$,{})})]}),a.jsxs(hl,{value:"item-4",className:"dark:border-stone-200",children:[a.jsx(pl,{children:"Telegram"}),a.jsx(ml,{children:a.jsx(p$,{})})]}),a.jsxs(hl,{value:"item-5",className:"dark:border-stone-200",children:[a.jsx(pl,{children:"Webhook"}),a.jsx(ml,{children:a.jsx(g$,{})})]})]})})]})});var Vy="Radio",[I$,WN]=sr(Vy),[L$,F$]=I$(Vy),HN=g.forwardRef((e,t)=>{const{__scopeRadio:r,name:n,checked:s=!1,required:o,disabled:i,value:l="on",onCheck:c,...u}=e,[d,f]=g.useState(null),m=Ke(t,y=>f(y)),v=g.useRef(!1),x=d?!!d.closest("form"):!0;return a.jsxs(L$,{scope:r,checked:s,disabled:i,children:[a.jsx(Re.button,{type:"button",role:"radio","aria-checked":s,"data-state":GN(s),"data-disabled":i?"":void 0,disabled:i,value:l,...u,ref:m,onClick:ue(e.onClick,y=>{s||c==null||c(),x&&(v.current=y.isPropagationStopped(),v.current||y.stopPropagation())})}),x&&a.jsx(z$,{control:d,bubbles:!v.current,name:n,value:l,checked:s,required:o,disabled:i,style:{transform:"translateX(-100%)"}})]})});HN.displayName=Vy;var YN="RadioIndicator",KN=g.forwardRef((e,t)=>{const{__scopeRadio:r,forceMount:n,...s}=e,o=F$(YN,r);return a.jsx(or,{present:n||o.checked,children:a.jsx(Re.span,{"data-state":GN(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t})})});KN.displayName=YN;var z$=e=>{const{control:t,checked:r,bubbles:n=!0,...s}=e,o=g.useRef(null),i=ly(r),l=qg(t);return g.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(i!==r&&f){const m=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(m)}},[i,r,n]),a.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:o,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function GN(e){return e?"checked":"unchecked"}var U$=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],By="RadioGroup",[$$,lV]=sr(By,[Oa,WN]),ZN=Oa(),qN=WN(),[V$,B$]=$$(By),XN=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,name:n,defaultValue:s,value:o,required:i=!1,disabled:l=!1,orientation:c,dir:u,loop:d=!0,onValueChange:f,...m}=e,v=ZN(r),x=di(u),[y,_]=Yr({prop:o,defaultProp:s,onChange:f});return a.jsx(V$,{scope:r,name:n,required:i,disabled:l,value:y,onValueChange:_,children:a.jsx(nv,{asChild:!0,...v,orientation:c,dir:x,loop:d,children:a.jsx(Re.div,{role:"radiogroup","aria-required":i,"aria-orientation":c,"data-disabled":l?"":void 0,dir:x,...m,ref:t})})})});XN.displayName=By;var QN="RadioGroupItem",JN=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,disabled:n,...s}=e,o=B$(QN,r),i=o.disabled||n,l=ZN(r),c=qN(r),u=g.useRef(null),d=Ke(t,u),f=o.value===s.value,m=g.useRef(!1);return g.useEffect(()=>{const v=y=>{U$.includes(y.key)&&(m.current=!0)},x=()=>m.current=!1;return document.addEventListener("keydown",v),document.addEventListener("keyup",x),()=>{document.removeEventListener("keydown",v),document.removeEventListener("keyup",x)}},[]),a.jsx(sv,{asChild:!0,...l,focusable:!i,active:f,children:a.jsx(HN,{disabled:i,required:o.required,checked:f,...c,...s,name:o.name,ref:d,onCheck:()=>o.onValueChange(s.value),onKeyDown:ue(v=>{v.key==="Enter"&&v.preventDefault()}),onFocus:ue(s.onFocus,()=>{var v;m.current&&((v=u.current)==null||v.click())})})})});JN.displayName=QN;var W$="RadioGroupIndicator",eT=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...n}=e,s=qN(r);return a.jsx(KN,{...s,...n,ref:t})});eT.displayName=W$;var tT=XN,rT=JN,H$=eT;const nT=g.forwardRef(({className:e,...t},r)=>a.jsx(tT,{className:oe("grid gap-2",e),...t,ref:r}));nT.displayName=tT.displayName;const Lm=g.forwardRef(({className:e,...t},r)=>a.jsx(rT,{ref:r,className:oe("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:a.jsx(H$,{className:"flex items-center justify-center",children:a.jsx(cb,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Lm.displayName=rT.displayName;const Y$=ce.object({provider:ce.enum(["letsencrypt","zerossl"],{message:"请选择SSL提供商"}),eabKid:ce.string().optional(),eabHmacKey:ce.string().optional()}),K$=()=>{const e=fr({resolver:hr(Y$),defaultValues:{provider:"letsencrypt"}}),[t,r]=g.useState("letsencrypt"),[n,s]=g.useState(),{toast:o}=Pn();g.useEffect(()=>{(async()=>{const u=await Zv("ssl-provider");if(u){s(u);const d=u.content;e.setValue("provider",d.provider),e.setValue("eabKid",d.config[d.provider].eabKid),e.setValue("eabHmacKey",d.config[d.provider].eabHmacKey),r(d.provider)}else e.setValue("provider","letsencrypt"),r("letsencrypt")})()},[]);const i=c=>t===c?"border-primary":"",l=async c=>{if(c.provider==="zerossl"&&(c.eabKid||e.setError("eabKid",{message:"请输入EAB_KID和EAB_HMAC_KEY"}),c.eabHmacKey||e.setError("eabHmacKey",{message:"请输入EAB_KID和EAB_HMAC_KEY"}),!c.eabKid||!c.eabHmacKey))return;const u={id:n==null?void 0:n.id,name:"ssl-provider",content:{provider:c.provider,config:{letsencrypt:{},zerossl:{eabKid:c.eabKid??"",eabHmacKey:c.eabHmacKey??""}}}};try{await Fa(u),o({title:"修改成功",description:"修改成功"})}catch(d){const f=Es(d);o({title:"修改失败",description:f,variant:"destructive"})}};return a.jsx(a.Fragment,{children:a.jsx("div",{className:"w-full md:max-w-[35em]",children:a.jsx(pr,{...e,children:a.jsxs("form",{onSubmit:e.handleSubmit(l),className:"space-y-8 dark:text-stone-200",children:[a.jsx(Se,{control:e.control,name:"provider",render:({field:c})=>a.jsxs(we,{children:[a.jsx(_e,{children:"证书厂商"}),a.jsx(be,{children:a.jsxs(nT,{...c,className:"flex",onValueChange:u=>{r(u),e.setValue("provider",u)},value:t,children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Lm,{value:"letsencrypt",id:"letsencrypt"}),a.jsx(Co,{htmlFor:"letsencrypt",children:a.jsxs("div",{className:oe("flex items-center space-x-2 border p-2 rounded cursor-pointer",i("letsencrypt")),children:[a.jsx("img",{src:"/imgs/providers/letsencrypt.svg",className:"h-6"}),a.jsx("div",{children:"Let's Encrypt"})]})})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Lm,{value:"zerossl",id:"zerossl"}),a.jsx(Co,{htmlFor:"zerossl",children:a.jsxs("div",{className:oe("flex items-center space-x-2 border p-2 rounded cursor-pointer",i("zerossl")),children:[a.jsx("img",{src:"/imgs/providers/zerossl.svg",className:"h-6"}),a.jsx("div",{children:"ZeroSSL"})]})})]})]})}),a.jsx(Se,{control:e.control,name:"eabKid",render:({field:u})=>a.jsxs(we,{hidden:t!=="zerossl",children:[a.jsx(_e,{children:"EAB_KID"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"请输入EAB_KID",...u,type:"text"})}),a.jsx(ge,{})]})}),a.jsx(Se,{control:e.control,name:"eabHmacKey",render:({field:u})=>a.jsxs(we,{hidden:t!=="zerossl",children:[a.jsx(_e,{children:"EAB_HMAC_KEY"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"请输入EAB_HMAC_KEY",...u,type:"text"})}),a.jsx(ge,{})]})}),a.jsx(ge,{})]})}),a.jsx("div",{className:"flex justify-end",children:a.jsx(He,{type:"submit",children:"确认修改"})})]})})})})},G$=rA([{path:"/",element:a.jsx(J3,{}),children:[{path:"/",element:a.jsx(i$,{})},{path:"/domains",element:a.jsx(_z,{})},{path:"/edit",element:a.jsx(YU,{})},{path:"/access",element:a.jsx(XU,{})},{path:"/history",element:a.jsx(JU,{})},{path:"/setting",element:a.jsx(o$,{}),children:[{path:"/setting/password",element:a.jsx(s$,{})},{path:"/setting/account",element:a.jsx(l$,{})},{path:"/setting/notify",element:a.jsx(M$,{})},{path:"/setting/ssl-provider",element:a.jsx(K$,{})}]}]},{path:"/login",element:a.jsx(r$,{}),children:[{path:"/login",element:a.jsx(t$,{})}]},{path:"/about",element:a.jsx("div",{children:"About"})}]);ip.createRoot(document.getElementById("root")).render(a.jsx(Be.StrictMode,{children:a.jsx(Y3,{defaultTheme:"system",storageKey:"vite-ui-theme",children:a.jsx(dA,{router:G$})})}))});export default Z$(); +8.8.4.4;`,..._,className:"placeholder:whitespace-pre-wrap"})}),a.jsx(ge,{})]})}),a.jsx("div",{className:"flex justify-end",children:a.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})})},sN=g.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:oe("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));sN.displayName="Card";const oN=g.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:oe("flex flex-col space-y-1.5 p-6",e),...t}));oN.displayName="CardHeader";const iN=g.forwardRef(({className:e,...t},r)=>a.jsx("h3",{ref:r,className:oe("text-2xl font-semibold leading-none tracking-tight",e),...t}));iN.displayName="CardTitle";const aN=g.forwardRef(({className:e,...t},r)=>a.jsx("p",{ref:r,className:oe("text-sm text-muted-foreground",e),...t}));aN.displayName="CardDescription";const lN=g.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:oe("p-6 pt-0",e),...t}));lN.displayName="CardContent";const cN=g.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:oe("flex items-center p-6 pt-0",e),...t}));cN.displayName="CardFooter";const Es=e=>e instanceof Error?e.message:typeof e=="object"&&e!==null&&"message"in e?String(e.message):typeof e=="string"?e:"Something went wrong",KU=()=>{const{config:{accessGroups:e},reloadAccessGroups:t}=Ar(),{toast:r}=Pn(),n=Pr(),s=async i=>{try{await U3(i),t()}catch(l){r({title:"删除失败",description:Es(l),variant:"destructive"});return}},o=()=>{n("/access")};return a.jsxs("div",{className:"mt-10",children:[a.jsx(ia,{when:e.length==0,children:a.jsx(a.Fragment,{children:a.jsxs("div",{className:"flex flex-col items-center mt-10",children:[a.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:a.jsx(C0,{size:40,className:"text-primary"})}),a.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),a.jsx(Ey,{trigger:a.jsx(He,{children:"新增授权组"}),className:"mt-3"})]})})}),a.jsx(ih,{className:"h-[75vh] overflow-hidden",children:a.jsx("div",{className:"flex gap-5 flex-wrap",children:e.map(i=>a.jsxs(sN,{className:"w-full md:w-[350px]",children:[a.jsxs(oN,{children:[a.jsx(iN,{children:i.name}),a.jsxs(aN,{children:["共有",i.expand?i.expand.access.length:0,"个部署授权配置"]})]}),a.jsx(lN,{className:"min-h-[180px]",children:i.expand?a.jsx(a.Fragment,{children:i.expand.access.slice(0,3).map(l=>a.jsx("div",{className:"flex flex-col mb-3",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:"",children:a.jsx("img",{src:Ew(l.configType)[1],alt:"provider",className:"w-8 h-8"})}),a.jsxs("div",{className:"ml-3",children:[a.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200",children:l.name}),a.jsx("div",{className:"text-xs text-muted-foreground",children:Ew(l.configType)[0]})]})]})},l.id))}):a.jsx(a.Fragment,{children:a.jsxs("div",{className:"flex text-gray-700 dark:text-gray-200 items-center",children:[a.jsx("div",{children:a.jsx(C0,{size:40})}),a.jsx("div",{className:"ml-2",children:"暂无部署授权配置,请添加后开始使用吧"})]})})}),a.jsx(cN,{children:a.jsxs("div",{className:"flex justify-end w-full",children:[a.jsx(ia,{when:!!(i.expand&&i.expand.access.length>0),children:a.jsx("div",{children:a.jsx(He,{size:"sm",variant:"link",onClick:()=>{n(`/access?accessGroupId=${i.id}&tab=access`,{replace:!0})},children:"所有授权"})})}),a.jsx(ia,{when:!i.expand||i.expand.access.length==0,children:a.jsx("div",{children:a.jsx(He,{size:"sm",onClick:o,children:"新增授权"})})}),a.jsx("div",{className:"ml-3",children:a.jsxs(GC,{children:[a.jsx(ZC,{asChild:!0,children:a.jsx(He,{variant:"destructive",size:"sm",children:"删除"})}),a.jsxs(ty,{children:[a.jsxs(ry,{children:[a.jsx(sy,{className:"dark:text-gray-200",children:"删除组"}),a.jsx(oy,{children:"确定要删除部署授权组吗?"})]}),a.jsxs(ny,{children:[a.jsx(ay,{className:"dark:text-gray-200",children:"取消"}),a.jsx(iy,{onClick:()=>{s(i.id?i.id:"")},children:"确认"})]})]})]})})]})})]}))})})]})};var Ny="Tabs",[GU,iV]=sr(Ny,[Oa]),uN=Oa(),[ZU,Ty]=GU(Ny),dN=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=di(l),[f,m]=Yr({prop:n,onChange:s,defaultProp:o});return a.jsx(ZU,{scope:r,baseId:$r(),value:f,onValueChange:m,orientation:i,dir:d,activationMode:c,children:a.jsx(Re.div,{dir:d,"data-orientation":i,...u,ref:t})})});dN.displayName=Ny;var fN="TabsList",hN=g.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...s}=e,o=Ty(fN,r),i=uN(r);return a.jsx(nv,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:n,children:a.jsx(Re.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});hN.displayName=fN;var pN="TabsTrigger",mN=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...o}=e,i=Ty(pN,r),l=uN(r),c=yN(i.baseId,n),u=xN(i.baseId,n),d=n===i.value;return a.jsx(sv,{asChild:!0,...l,focusable:!s,active:d,children:a.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:ue(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?i.onValueChange(n):f.preventDefault()}),onKeyDown:ue(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(n)}),onFocus:ue(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!s&&f&&i.onValueChange(n)})})})});mN.displayName=pN;var gN="TabsContent",vN=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:s,children:o,...i}=e,l=Ty(gN,r),c=yN(l.baseId,n),u=xN(l.baseId,n),d=n===l.value,f=g.useRef(d);return g.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(or,{present:s||d,children:({present:m})=>a.jsx(Re.div,{"data-state":d?"active":"inactive","data-orientation":l.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})})});vN.displayName=gN;function yN(e,t){return`${e}-trigger-${t}`}function xN(e,t){return`${e}-content-${t}`}var qU=dN,wN=hN,_N=mN,bN=vN;const SN=qU,Ry=g.forwardRef(({className:e,...t},r)=>a.jsx(wN,{ref:r,className:oe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Ry.displayName=wN.displayName;const Yo=g.forwardRef(({className:e,...t},r)=>a.jsx(_N,{ref:r,className:oe("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}));Yo.displayName=_N.displayName;const qd=g.forwardRef(({className:e,...t},r)=>a.jsx(bN,{ref:r,className:oe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));qd.displayName=bN.displayName;const XU=()=>{const{config:e,deleteAccess:t}=Ar(),{accesses:r}=e,n=10,s=Math.ceil(r.length/n),o=Pr(),i=Nn(),l=new URLSearchParams(i.search),c=l.get("page"),u=c?Number(c):1,d=l.get("tab"),f=l.get("accessGroupId"),m=(u-1)*n,v=m+n,x=async _=>{const p=await z3(_);t(p.id)},y=_=>{l.set("tab",_),o({search:l.toString()})};return a.jsxs("div",{className:"",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("div",{className:"text-muted-foreground",children:"授权管理"}),d!="access_group"?a.jsx(Tl,{trigger:a.jsx(He,{children:"添加授权"}),op:"add"}):a.jsx(Ey,{trigger:a.jsx(He,{children:"添加授权组"})})]}),a.jsxs(SN,{defaultValue:d||"access",value:d||"access",className:"w-full mt-5",children:[a.jsxs(Ry,{className:"space-x-5 px-3",children:[a.jsx(Yo,{value:"access",onClick:()=>{y("access")},children:"授权管理"}),a.jsx(Yo,{value:"access_group",onClick:()=>{y("access_group")},children:"授权组管理"})]}),a.jsx(qd,{value:"access",children:r.length===0?a.jsxs("div",{className:"flex flex-col items-center mt-10",children:[a.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:a.jsx(RA,{size:40,className:"text-primary"})}),a.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加授权开始部署证书吧。"}),a.jsx(Tl,{trigger:a.jsx(He,{children:"添加授权"}),op:"add",className:"mt-3"})]}):a.jsxs(a.Fragment,{children:[a.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:[a.jsx("div",{className:"w-48",children:"名称"}),a.jsx("div",{className:"w-48",children:"服务商"}),a.jsx("div",{className:"w-52",children:"创建时间"}),a.jsx("div",{className:"w-52",children:"更新时间"}),a.jsx("div",{className:"grow",children:"操作"})]}),a.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"授权列表"}),r.filter(_=>f?_.group==f:!0).slice(m,v).map(_=>{var p,h;return a.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:[a.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:_.name}),a.jsxs("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center space-x-2",children:[a.jsx("img",{src:(p=mo.get(_.configType))==null?void 0:p[1],className:"w-6"}),a.jsx("div",{children:(h=mo.get(_.configType))==null?void 0:h[0]})]}),a.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["创建于"," ",_.created&&ya(_.created)]}),a.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["更新于"," ",_.updated&&ya(_.updated)]}),a.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[a.jsx(Tl,{trigger:a.jsx(He,{variant:"link",className:"p-0",children:"编辑"}),op:"edit",data:_}),a.jsx(Bt,{orientation:"vertical",className:"h-4 mx-2"}),a.jsx(He,{variant:"link",className:"p-0",onClick:()=>{x(_)},children:"删除"})]})]},_.id)}),a.jsx(NC,{totalPages:s,currentPage:u,onPageChange:_=>{l.set("page",_.toString()),o({search:l.toString()})}})]})}),a.jsx(qd,{value:"access_group",children:a.jsx(KU,{})})]})]})},QU=Sc("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"}}),Py=g.forwardRef(({className:e,variant:t,...r},n)=>a.jsx("div",{ref:n,role:"alert",className:oe(QU({variant:t}),e),...r}));Py.displayName="Alert";const Ay=g.forwardRef(({className:e,...t},r)=>a.jsx("h5",{ref:r,className:oe("mb-1 font-medium leading-none tracking-tight",e),...t}));Ay.displayName="AlertTitle";const Dy=g.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:oe("text-sm [&_p]:leading-relaxed",e),...t}));Dy.displayName="AlertDescription";const kN=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"})},JU=()=>{const e=Pr(),[t,r]=g.useState(),[n]=vA(),s=n.get("domain");return g.useEffect(()=>{(async()=>{const i={};s&&(i.domain=s);const l=await kN(i);r(l.items)})()},[s]),a.jsxs(ih,{className:"h-[80vh] overflow-hidden",children:[a.jsx("div",{className:"text-muted-foreground",children:"部署历史"}),t!=null&&t.length?a.jsxs(a.Fragment,{children:[a.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:[a.jsx("div",{className:"w-48",children:"域名"}),a.jsx("div",{className:"w-24",children:"状态"}),a.jsx("div",{className:"w-56",children:"阶段"}),a.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),a.jsx("div",{className:"grow",children:"操作"})]}),a.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),t==null?void 0:t.map(o=>{var i,l;return a.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:[a.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}),a.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:a.jsx(ey,{deployment:o})}),a.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:a.jsx(qv,{phase:o.phase,phaseSuccess:o.phaseSuccess})}),a.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:ya(o.deployedAt)}),a.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:a.jsxs(bv,{children:[a.jsx(Sv,{asChild:!0,children:a.jsx(He,{variant:"link",className:"p-0",children:"日志"})}),a.jsxs(Rf,{className:"sm:max-w-5xl",children:[a.jsx(kv,{children:a.jsxs(Cv,{children:[(l=o.expand.domain)==null?void 0:l.domain,"-",o.id,"部署详情"]})}),a.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[o.log.check&&a.jsx(a.Fragment,{children:o.log.check.map(c=>a.jsxs("div",{className:"flex flex-col mt-2",children:[a.jsxs("div",{className:"flex",children:[a.jsxs("div",{children:["[",c.time,"]"]}),a.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&a.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.apply&&a.jsx(a.Fragment,{children:o.log.apply.map(c=>a.jsxs("div",{className:"flex flex-col mt-2",children:[a.jsxs("div",{className:"flex",children:[a.jsxs("div",{children:["[",c.time,"]"]}),a.jsx("div",{className:"ml-2",children:c.message})]}),c.info&&c.info.map(u=>a.jsx("div",{className:"mt-1 text-green-600",children:u})),c.error&&a.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.deploy&&a.jsx(a.Fragment,{children:o.log.deploy.map(c=>a.jsxs("div",{className:"flex flex-col mt-2",children:[a.jsxs("div",{className:"flex",children:[a.jsxs("div",{children:["[",c.time,"]"]}),a.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&a.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))})]})]})]})})]},o.id)})]}):a.jsx(a.Fragment,{children:a.jsxs(Py,{className:"max-w-[40em] mx-auto mt-20",children:[a.jsx(Ay,{children:"暂无数据"}),a.jsxs(Dy,{children:[a.jsxs("div",{className:"flex items-center mt-5",children:[a.jsx("div",{children:a.jsx(ub,{className:"text-yellow-400",size:36})}),a.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),a.jsx("div",{className:"mt-2 flex justify-end",children:a.jsx(He,{onClick:()=>{e("/")},children:"添加域名"})})]})]})})]})},e$=ce.object({username:ce.string().email({message:"请输入正确的邮箱地址"}),password:ce.string().min(10,{message:"密码至少10个字符"})}),t$=()=>{const e=fr({resolver:hr(e$),defaultValues:{username:"",password:""}}),t=async n=>{try{await st().admins.authWithPassword(n.username,n.password),r("/")}catch(s){const o=Es(s);e.setError("username",{message:o}),e.setError("password",{message:o})}},r=Pr();return a.jsxs("div",{className:"max-w-[35em] border dark:border-stone-500 mx-auto mt-32 p-10 rounded-md shadow-md",children:[a.jsx("div",{className:"flex justify-center mb-10",children:a.jsx("img",{src:"/vite.svg",className:"w-16"})}),a.jsx(pr,{...e,children:a.jsxs("form",{onSubmit:e.handleSubmit(t),className:"space-y-8 dark:text-stone-200",children:[a.jsx(Se,{control:e.control,name:"username",render:({field:n})=>a.jsxs(we,{children:[a.jsx(_e,{children:"用户名"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"email",...n})}),a.jsx(ge,{})]})}),a.jsx(Se,{control:e.control,name:"password",render:({field:n})=>a.jsxs(we,{children:[a.jsx(_e,{children:"密码"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"password",...n,type:"password"})}),a.jsx(ge,{})]})}),a.jsx("div",{className:"flex justify-end",children:a.jsx(He,{type:"submit",children:"登录"})})]})})]})},r$=()=>st().authStore.isValid&&st().authStore.isAdmin?a.jsx(ib,{to:"/"}):a.jsxs("div",{className:"container",children:[a.jsx(Lg,{}),a.jsx(pC,{})]}),n$=ce.object({oldPassword:ce.string().min(10,{message:"密码至少10个字符"}),newPassword:ce.string().min(10,{message:"密码至少10个字符"}),confirmPassword:ce.string().min(10,{message:"密码至少10个字符"})}).refine(e=>e.newPassword===e.confirmPassword,{message:"两次密码不一致",path:["confirmPassword"]}),s$=()=>{const{toast:e}=Pn(),t=Pr(),r=fr({resolver:hr(n$),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(l){const c=Es(l);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(l){const c=Es(l);e({title:"修改密码失败",description:c,variant:"destructive"})}};return a.jsx(a.Fragment,{children:a.jsx("div",{className:"w-full md:max-w-[35em]",children:a.jsx(pr,{...r,children:a.jsxs("form",{onSubmit:r.handleSubmit(n),className:"space-y-8 dark:text-stone-200",children:[a.jsx(Se,{control:r.control,name:"oldPassword",render:({field:s})=>a.jsxs(we,{children:[a.jsx(_e,{children:"当前密码"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"当前密码",...s,type:"password"})}),a.jsx(ge,{})]})}),a.jsx(Se,{control:r.control,name:"newPassword",render:({field:s})=>a.jsxs(we,{children:[a.jsx(_e,{children:"新密码"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"newPassword",...s,type:"password"})}),a.jsx(ge,{})]})}),a.jsx(Se,{control:r.control,name:"confirmPassword",render:({field:s})=>a.jsxs(we,{children:[a.jsx(_e,{children:"确认密码"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"confirmPassword",...s,type:"password"})}),a.jsx(ge,{})]})}),a.jsx("div",{className:"flex justify-end",children:a.jsx(He,{type:"submit",children:"确认修改"})})]})})})})},o$=()=>{const e=Nn(),[t,r]=g.useState("account"),n=Pr();return g.useEffect(()=>{const o=e.pathname.split("/")[2];r(o)},[e]),a.jsxs("div",{children:[a.jsx(hy,{}),a.jsx("div",{className:"text-muted-foreground border-b dark:border-stone-500 py-5",children:"偏好设置"}),a.jsx("div",{className:"w-full mt-5 p-0 md:p-3 flex justify-center",children:a.jsxs(SN,{defaultValue:"account",className:"w-full",value:t,children:[a.jsxs(Ry,{className:"mx-auto",children:[a.jsxs(Yo,{value:"account",onClick:()=>{n("/setting/account")},className:"px-5",children:[a.jsx(FA,{size:14}),a.jsx("div",{className:"ml-1",children:"账户"})]}),a.jsxs(Yo,{value:"password",onClick:()=>{n("/setting/password")},className:"px-5",children:[a.jsx(TA,{size:14}),a.jsx("div",{className:"ml-1",children:"密码"})]}),a.jsxs(Yo,{value:"notify",onClick:()=>{n("/setting/notify")},className:"px-5",children:[a.jsx(AA,{size:14}),a.jsx("div",{className:"ml-1",children:"消息推送"})]}),a.jsxs(Yo,{value:"ssl-provider",onClick:()=>{n("/setting/ssl-provider")},className:"px-5",children:[a.jsx(MA,{size:14}),a.jsx("div",{className:"ml-1",children:"证书厂商"})]})]}),a.jsx(qd,{value:t,children:a.jsx("div",{className:"mt-5 w-full md:w-[45em]",children:a.jsx(Lg,{})})})]})})]})},i$=()=>{const[e,t]=g.useState(),[r,n]=g.useState(),s=Pr();return g.useEffect(()=>{(async()=>{const i=await gz();t(i)})()},[]),g.useEffect(()=>{(async()=>{const l=await kN({perPage:8});n(l.items)})()},[]),a.jsxs("div",{className:"flex flex-col",children:[a.jsx("div",{className:"flex justify-between items-center",children:a.jsx("div",{className:"text-muted-foreground",children:"控制面板"})}),a.jsxs("div",{className:"flex mt-10 gap-5 flex-col flex-wrap md:flex-row",children:[a.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[a.jsx("div",{className:"p-3",children:a.jsx(IA,{size:48,strokeWidth:1,className:"text-blue-400"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-muted-foreground font-semibold",children:"所有"}),a.jsxs("div",{className:"flex items-baseline",children:[a.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.total?a.jsx(gr,{to:"/domains",className:"hover:underline",children:e==null?void 0:e.total}):0}),a.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),a.jsxs("div",{className:"w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg border",children:[a.jsx("div",{className:"p-3",children:a.jsx(SA,{size:48,strokeWidth:1,className:"text-red-400"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-muted-foreground font-semibold",children:"即将过期"}),a.jsxs("div",{className:"flex items-baseline",children:[a.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.expired?a.jsx(gr,{to:"/domains?state=expired",className:"hover:underline",children:e==null?void 0:e.expired}):0}),a.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),a.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[a.jsx("div",{className:"p-3",children:a.jsx(PA,{size:48,strokeWidth:1,className:"text-green-400"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-muted-foreground font-semibold",children:"启用中"}),a.jsxs("div",{className:"flex items-baseline",children:[a.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.enabled?a.jsx(gr,{to:"/domains?state=enabled",className:"hover:underline",children:e==null?void 0:e.enabled}):0}),a.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]}),a.jsxs("div",{className:"border w-full md:w-[250px] 3xl:w-[300px] flex items-center rounded-md p-3 shadow-lg",children:[a.jsx("div",{className:"p-3",children:a.jsx(_A,{size:48,strokeWidth:1,className:"text-gray-400"})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-muted-foreground font-semibold",children:"未启用"}),a.jsxs("div",{className:"flex items-baseline",children:[a.jsx("div",{className:"text-3xl text-stone-700 dark:text-stone-200",children:e!=null&&e.disabled?a.jsx(gr,{to:"/domains?state=disabled",className:"hover:underline",children:e==null?void 0:e.disabled}):0}),a.jsx("div",{className:"ml-1 text-stone-700 dark:text-stone-200",children:"个"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"text-muted-foreground mt-5 text-sm",children:"部署历史"}),(r==null?void 0:r.length)==0?a.jsx(a.Fragment,{children:a.jsxs(Py,{className:"max-w-[40em] mt-10",children:[a.jsx(Ay,{children:"暂无数据"}),a.jsxs(Dy,{children:[a.jsxs("div",{className:"flex items-center mt-5",children:[a.jsx("div",{children:a.jsx(ub,{className:"text-yellow-400",size:36})}),a.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),a.jsx("div",{className:"mt-2 flex justify-end",children:a.jsx(He,{onClick:()=>{s("/edit")},children:"添加域名"})})]})]})}):a.jsxs(a.Fragment,{children:[a.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:[a.jsx("div",{className:"w-48",children:"域名"}),a.jsx("div",{className:"w-24",children:"状态"}),a.jsx("div",{className:"w-56",children:"阶段"}),a.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),a.jsx("div",{className:"grow",children:"操作"})]}),a.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),r==null?void 0:r.map(o=>{var i,l;return a.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:[a.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}),a.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:a.jsx(ey,{deployment:o})}),a.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:a.jsx(qv,{phase:o.phase,phaseSuccess:o.phaseSuccess})}),a.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:ya(o.deployedAt)}),a.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:a.jsxs(bv,{children:[a.jsx(Sv,{asChild:!0,children:a.jsx(He,{variant:"link",className:"p-0",children:"日志"})}),a.jsxs(Rf,{className:"sm:max-w-5xl",children:[a.jsx(kv,{children:a.jsxs(Cv,{children:[(l=o.expand.domain)==null?void 0:l.domain,"-",o.id,"部署详情"]})}),a.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[o.log.check&&a.jsx(a.Fragment,{children:o.log.check.map(c=>a.jsxs("div",{className:"flex flex-col mt-2",children:[a.jsxs("div",{className:"flex",children:[a.jsxs("div",{children:["[",c.time,"]"]}),a.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&a.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.apply&&a.jsx(a.Fragment,{children:o.log.apply.map(c=>a.jsxs("div",{className:"flex flex-col mt-2",children:[a.jsxs("div",{className:"flex",children:[a.jsxs("div",{children:["[",c.time,"]"]}),a.jsx("div",{className:"ml-2",children:c.message})]}),c.info&&c.info.map(u=>a.jsx("div",{className:"mt-1 text-green-600",children:u})),c.error&&a.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))}),o.log.deploy&&a.jsx(a.Fragment,{children:o.log.deploy.map(c=>a.jsxs("div",{className:"flex flex-col mt-2",children:[a.jsxs("div",{className:"flex",children:[a.jsxs("div",{children:["[",c.time,"]"]}),a.jsx("div",{className:"ml-2",children:c.message})]}),c.error&&a.jsx("div",{className:"mt-1 text-red-600",children:c.error})]}))})]})]})]})})]},o.id)})]})]})]})},a$=ce.object({email:ce.string().email("请输入正确的邮箱")}),l$=()=>{var i;const{toast:e}=Pn(),t=Pr(),[r,n]=g.useState(!1),s=fr({resolver:hr(a$),defaultValues:{email:(i=st().authStore.model)==null?void 0:i.email}}),o=async l=>{var c;try{await st().admins.update((c=st().authStore.model)==null?void 0:c.id,{email:l.email}),st().authStore.clear(),e({title:"修改账户邮箱功",description:"请重新登录"}),setTimeout(()=>{t("/login")},500)}catch(u){const d=Es(u);e({title:"修改账户邮箱失败",description:d,variant:"destructive"})}};return a.jsx(a.Fragment,{children:a.jsx("div",{className:"w-full md:max-w-[35em]",children:a.jsx(pr,{...s,children:a.jsxs("form",{onSubmit:s.handleSubmit(o),className:"space-y-8 dark:text-stone-200",children:[a.jsx(Se,{control:s.control,name:"email",render:({field:l})=>a.jsxs(we,{children:[a.jsx(_e,{children:"邮箱"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"请输入邮箱",...l,type:"email",onChange:c=>{n(!0),s.setValue("email",c.target.value)}})}),a.jsx(ge,{})]})}),a.jsx("div",{className:"flex justify-end",children:r?a.jsx(He,{type:"submit",children:"确认修改"}):a.jsx(He,{type:"submit",disabled:!0,variant:"secondary",children:"确认修改"})})]})})})})},c$=(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}},CN=g.createContext({}),Oy=()=>g.useContext(CN),u$=({children:e})=>{const[t,r]=g.useReducer(c$,{});g.useEffect(()=>{(async()=>{const i=await Zv("notifyChannels");r({type:"SET_CHANNELS",payload:i})})()},[]);const n=g.useCallback(o=>{r({type:"SET_CHANNEL",payload:o})},[]),s=g.useCallback(o=>{r({type:"SET_CHANNELS",payload:o})},[]);return a.jsx(CN.Provider,{value:{config:t,setChannel:n,setChannels:s},children:e})},d$=()=>{const{config:e,setChannels:t}=Oy(),[r,n]=g.useState({id:e.id??"",name:"notifyChannels",data:{accessToken:"",secret:"",enabled:!1}});g.useEffect(()=>{const l=(()=>{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:l})},[e]);const{toast:s}=Pn(),o=async()=>{try{const i=await Fa({...e,name:"notifyChannels",content:{...e.content,dingtalk:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const l=Es(i);s({title:"保存失败",description:"配置保存失败:"+l,variant:"destructive"})}};return a.jsxs("div",{children:[a.jsx(Ne,{placeholder:"AccessToken",value:r.data.accessToken,onChange:i=>{n({...r,data:{...r.data,accessToken:i.target.value}})}}),a.jsx(Ne,{placeholder:"加签的签名",className:"mt-2",value:r.data.secret,onChange:i=>{n({...r,data:{...r.data,secret:i.target.value}})}}),a.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[a.jsx(Fc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),a.jsx(Co,{htmlFor:"airplane-mode",children:"是否启用"})]}),a.jsx("div",{className:"flex justify-end mt-2",children:a.jsx(He,{onClick:()=>{o()},children:"保存"})})]})},f$={title:"您有{COUNT}张证书即将过期",content:"有{COUNT}张证书即将过期,域名分别为{DOMAINS},请保持关注!"},h$=()=>{const[e,t]=g.useState(""),[r,n]=g.useState([f$]),{toast:s}=Pn();g.useEffect(()=>{(async()=>{const u=await Zv("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}])},l=async()=>{const c=await Fa({id:e,content:{notifyTemplates:r},name:"templates"});c.id&&t(c.id),s({title:"保存成功",description:"通知模板保存成功"})};return a.jsxs("div",{children:[a.jsx(Ne,{value:r[0].title,onChange:c=>{o(c.target.value)}}),a.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:"可选的变量, COUNT:即将过期张数"}),a.jsx(Sa,{className:"mt-2",value:r[0].content,onChange:c=>{i(c.target.value)}}),a.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:"可选的变量, COUNT:即将过期张数,DOMAINS:域名列表"}),a.jsx("div",{className:"flex justify-end mt-2",children:a.jsx(He,{onClick:l,children:"保存"})})]})},p$=()=>{const{config:e,setChannels:t}=Oy(),[r,n]=g.useState({id:e.id??"",name:"notifyChannels",data:{apiToken:"",chatId:"",enabled:!1}});g.useEffect(()=>{const l=(()=>{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:l})},[e]);const{toast:s}=Pn(),o=async()=>{try{const i=await Fa({...e,name:"notifyChannels",content:{...e.content,telegram:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const l=Es(i);s({title:"保存失败",description:"配置保存失败:"+l,variant:"destructive"})}};return a.jsxs("div",{children:[a.jsx(Ne,{placeholder:"ApiToken",value:r.data.apiToken,onChange:i=>{n({...r,data:{...r.data,apiToken:i.target.value}})}}),a.jsx(Ne,{placeholder:"ChatId",value:r.data.chatId,onChange:i=>{n({...r,data:{...r.data,chatId:i.target.value}})}}),a.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[a.jsx(Fc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),a.jsx(Co,{htmlFor:"airplane-mode",children:"是否启用"})]}),a.jsx("div",{className:"flex justify-end mt-2",children:a.jsx(He,{onClick:()=>{o()},children:"保存"})})]})};function m$(e){try{return new URL(e),!0}catch{return!1}}const g$=()=>{const{config:e,setChannels:t}=Oy(),[r,n]=g.useState({id:e.id??"",name:"notifyChannels",data:{url:"",enabled:!1}});g.useEffect(()=>{const l=(()=>{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:l})},[e]);const{toast:s}=Pn(),o=async()=>{try{if(r.data.url=r.data.url.trim(),!m$(r.data.url)){s({title:"保存失败",description:"Url格式不正确",variant:"destructive"});return}const i=await Fa({...e,name:"notifyChannels",content:{...e.content,webhook:{...r.data}}});t(i),s({title:"保存成功",description:"配置保存成功"})}catch(i){const l=Es(i);s({title:"保存失败",description:"配置保存失败:"+l,variant:"destructive"})}};return a.jsxs("div",{children:[a.jsx(Ne,{placeholder:"Url",value:r.data.url,onChange:i=>{n({...r,data:{...r.data,url:i.target.value}})}}),a.jsxs("div",{className:"flex items-center space-x-1 mt-2",children:[a.jsx(Fc,{id:"airplane-mode",checked:r.data.enabled,onCheckedChange:()=>{n({...r,data:{...r.data,enabled:!r.data.enabled}})}}),a.jsx(Co,{htmlFor:"airplane-mode",children:"是否启用"})]}),a.jsx("div",{className:"flex justify-end mt-2",children:a.jsx(He,{onClick:()=>{o()},children:"保存"})})]})};var My="Collapsible",[v$,jN]=sr(My),[y$,Iy]=v$(My),EN=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:o,onOpenChange:i,...l}=e,[c=!1,u]=Yr({prop:n,defaultProp:s,onChange:i});return a.jsx(y$,{scope:r,disabled:o,contentId:$r(),open:c,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),children:a.jsx(Re.div,{"data-state":Fy(c),"data-disabled":o?"":void 0,...l,ref:t})})});EN.displayName=My;var NN="CollapsibleTrigger",TN=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,...n}=e,s=Iy(NN,r);return a.jsx(Re.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Fy(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:t,onClick:ue(e.onClick,s.onOpenToggle)})});TN.displayName=NN;var Ly="CollapsibleContent",RN=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Iy(Ly,e.__scopeCollapsible);return a.jsx(or,{present:r||s.open,children:({present:o})=>a.jsx(x$,{...n,ref:t,present:o})})});RN.displayName=Ly;var x$=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:n,children:s,...o}=e,i=Iy(Ly,r),[l,c]=g.useState(n),u=g.useRef(null),d=Ke(t,u),f=g.useRef(0),m=f.current,v=g.useRef(0),x=v.current,y=i.open||l,_=g.useRef(y),p=g.useRef();return g.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,v.current=w.width,_.current||(h.style.transitionDuration=p.current.transitionDuration,h.style.animationName=p.current.animationName),c(n)}},[i.open,n]),a.jsx(Re.div,{"data-state":Fy(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!y,...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:y&&s})});function Fy(e){return e?"open":"closed"}var w$=EN,_$=TN,b$=RN,zs="Accordion",S$=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[zy,k$,C$]=kc(zs),[ah,aV]=sr(zs,[C$,jN]),Uy=jN(),PN=Be.forwardRef((e,t)=>{const{type:r,...n}=e,s=n,o=n;return a.jsx(zy.Provider,{scope:e.__scopeAccordion,children:r==="multiple"?a.jsx(T$,{...o,ref:t}):a.jsx(N$,{...s,ref:t})})});PN.displayName=zs;var[AN,j$]=ah(zs),[DN,E$]=ah(zs,{collapsible:!1}),N$=Be.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},collapsible:o=!1,...i}=e,[l,c]=Yr({prop:r,defaultProp:n,onChange:s});return a.jsx(AN,{scope:e.__scopeAccordion,value:l?[l]:[],onItemOpen:c,onItemClose:Be.useCallback(()=>o&&c(""),[o,c]),children:a.jsx(DN,{scope:e.__scopeAccordion,collapsible:o,children:a.jsx(ON,{...i,ref:t})})})}),T$=Be.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...o}=e,[i=[],l]=Yr({prop:r,defaultProp:n,onChange:s}),c=Be.useCallback(d=>l((f=[])=>[...f,d]),[l]),u=Be.useCallback(d=>l((f=[])=>f.filter(m=>m!==d)),[l]);return a.jsx(AN,{scope:e.__scopeAccordion,value:i,onItemOpen:c,onItemClose:u,children:a.jsx(DN,{scope:e.__scopeAccordion,collapsible:!0,children:a.jsx(ON,{...o,ref:t})})})}),[R$,lh]=ah(zs),ON=Be.forwardRef((e,t)=>{const{__scopeAccordion:r,disabled:n,dir:s,orientation:o="vertical",...i}=e,l=Be.useRef(null),c=Ke(l,t),u=k$(r),f=di(s)==="ltr",m=ue(e.onKeyDown,v=>{var P;if(!S$.includes(v.key))return;const x=v.target,y=u().filter(A=>{var L;return!((L=A.ref.current)!=null&&L.disabled)}),_=y.findIndex(A=>A.ref.current===x),p=y.length;if(_===-1)return;v.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(Xd,r),i=j$(Xd,r),l=Uy(r),c=$r(),u=n&&i.value.includes(n)||!1,d=o.disabled||e.disabled;return a.jsx(P$,{scope:r,open:u,disabled:d,triggerId:c,children:a.jsx(w$,{"data-orientation":o.orientation,"data-state":$N(u),...l,...s,ref:t,disabled:d,open:u,onOpenChange:f=>{f?i.onItemOpen(n):i.onItemClose(n)}})})});MN.displayName=Xd;var IN="AccordionHeader",LN=Be.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(zs,r),o=$y(IN,r);return a.jsx(Re.h3,{"data-orientation":s.orientation,"data-state":$N(o.open),"data-disabled":o.disabled?"":void 0,...n,ref:t})});LN.displayName=IN;var Im="AccordionTrigger",FN=Be.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(zs,r),o=$y(Im,r),i=E$(Im,r),l=Uy(r);return a.jsx(zy.ItemSlot,{scope:r,children:a.jsx(_$,{"aria-disabled":o.open&&!i.collapsible||void 0,"data-orientation":s.orientation,id:o.triggerId,...l,...n,ref:t})})});FN.displayName=Im;var zN="AccordionContent",UN=Be.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,s=lh(zs,r),o=$y(zN,r),i=Uy(r);return a.jsx(b$,{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}})});UN.displayName=zN;function $N(e){return e?"open":"closed"}var A$=PN,D$=MN,O$=LN,VN=FN,BN=UN;const Nw=A$,hl=g.forwardRef(({className:e,...t},r)=>a.jsx(D$,{ref:r,className:oe("border-b",e),...t}));hl.displayName="AccordionItem";const pl=g.forwardRef(({className:e,children:t,...r},n)=>a.jsx(O$,{className:"flex",children:a.jsxs(VN,{ref:n,className:oe("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,a.jsx(Fg,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));pl.displayName=VN.displayName;const ml=g.forwardRef(({className:e,children:t,...r},n)=>a.jsx(BN,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:a.jsx("div",{className:oe("pb-4 pt-0",e),children:t})}));ml.displayName=BN.displayName;const M$=()=>a.jsx(a.Fragment,{children:a.jsxs(u$,{children:[a.jsx("div",{className:"border rounded-sm p-5 shadow-lg",children:a.jsx(Nw,{type:"multiple",className:"dark:text-stone-200",children:a.jsxs(hl,{value:"item-1",className:"dark:border-stone-200",children:[a.jsx(pl,{children:"模板"}),a.jsx(ml,{children:a.jsx(h$,{})})]})})}),a.jsx("div",{className:"border rounded-md p-5 mt-7 shadow-lg",children:a.jsxs(Nw,{type:"single",className:"dark:text-stone-200",children:[a.jsxs(hl,{value:"item-2",className:"dark:border-stone-200",children:[a.jsx(pl,{children:"钉钉"}),a.jsx(ml,{children:a.jsx(d$,{})})]}),a.jsxs(hl,{value:"item-4",className:"dark:border-stone-200",children:[a.jsx(pl,{children:"Telegram"}),a.jsx(ml,{children:a.jsx(p$,{})})]}),a.jsxs(hl,{value:"item-5",className:"dark:border-stone-200",children:[a.jsx(pl,{children:"Webhook"}),a.jsx(ml,{children:a.jsx(g$,{})})]})]})})]})});var Vy="Radio",[I$,WN]=sr(Vy),[L$,F$]=I$(Vy),HN=g.forwardRef((e,t)=>{const{__scopeRadio:r,name:n,checked:s=!1,required:o,disabled:i,value:l="on",onCheck:c,...u}=e,[d,f]=g.useState(null),m=Ke(t,y=>f(y)),v=g.useRef(!1),x=d?!!d.closest("form"):!0;return a.jsxs(L$,{scope:r,checked:s,disabled:i,children:[a.jsx(Re.button,{type:"button",role:"radio","aria-checked":s,"data-state":GN(s),"data-disabled":i?"":void 0,disabled:i,value:l,...u,ref:m,onClick:ue(e.onClick,y=>{s||c==null||c(),x&&(v.current=y.isPropagationStopped(),v.current||y.stopPropagation())})}),x&&a.jsx(z$,{control:d,bubbles:!v.current,name:n,value:l,checked:s,required:o,disabled:i,style:{transform:"translateX(-100%)"}})]})});HN.displayName=Vy;var YN="RadioIndicator",KN=g.forwardRef((e,t)=>{const{__scopeRadio:r,forceMount:n,...s}=e,o=F$(YN,r);return a.jsx(or,{present:n||o.checked,children:a.jsx(Re.span,{"data-state":GN(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t})})});KN.displayName=YN;var z$=e=>{const{control:t,checked:r,bubbles:n=!0,...s}=e,o=g.useRef(null),i=ly(r),l=qg(t);return g.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(i!==r&&f){const m=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(m)}},[i,r,n]),a.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:o,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function GN(e){return e?"checked":"unchecked"}var U$=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],By="RadioGroup",[$$,lV]=sr(By,[Oa,WN]),ZN=Oa(),qN=WN(),[V$,B$]=$$(By),XN=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,name:n,defaultValue:s,value:o,required:i=!1,disabled:l=!1,orientation:c,dir:u,loop:d=!0,onValueChange:f,...m}=e,v=ZN(r),x=di(u),[y,_]=Yr({prop:o,defaultProp:s,onChange:f});return a.jsx(V$,{scope:r,name:n,required:i,disabled:l,value:y,onValueChange:_,children:a.jsx(nv,{asChild:!0,...v,orientation:c,dir:x,loop:d,children:a.jsx(Re.div,{role:"radiogroup","aria-required":i,"aria-orientation":c,"data-disabled":l?"":void 0,dir:x,...m,ref:t})})})});XN.displayName=By;var QN="RadioGroupItem",JN=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,disabled:n,...s}=e,o=B$(QN,r),i=o.disabled||n,l=ZN(r),c=qN(r),u=g.useRef(null),d=Ke(t,u),f=o.value===s.value,m=g.useRef(!1);return g.useEffect(()=>{const v=y=>{U$.includes(y.key)&&(m.current=!0)},x=()=>m.current=!1;return document.addEventListener("keydown",v),document.addEventListener("keyup",x),()=>{document.removeEventListener("keydown",v),document.removeEventListener("keyup",x)}},[]),a.jsx(sv,{asChild:!0,...l,focusable:!i,active:f,children:a.jsx(HN,{disabled:i,required:o.required,checked:f,...c,...s,name:o.name,ref:d,onCheck:()=>o.onValueChange(s.value),onKeyDown:ue(v=>{v.key==="Enter"&&v.preventDefault()}),onFocus:ue(s.onFocus,()=>{var v;m.current&&((v=u.current)==null||v.click())})})})});JN.displayName=QN;var W$="RadioGroupIndicator",eT=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...n}=e,s=qN(r);return a.jsx(KN,{...s,...n,ref:t})});eT.displayName=W$;var tT=XN,rT=JN,H$=eT;const nT=g.forwardRef(({className:e,...t},r)=>a.jsx(tT,{className:oe("grid gap-2",e),...t,ref:r}));nT.displayName=tT.displayName;const Lm=g.forwardRef(({className:e,...t},r)=>a.jsx(rT,{ref:r,className:oe("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:a.jsx(H$,{className:"flex items-center justify-center",children:a.jsx(cb,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Lm.displayName=rT.displayName;const Y$=ce.object({provider:ce.enum(["letsencrypt","zerossl"],{message:"请选择SSL提供商"}),eabKid:ce.string().optional(),eabHmacKey:ce.string().optional()}),K$=()=>{const e=fr({resolver:hr(Y$),defaultValues:{provider:"letsencrypt"}}),[t,r]=g.useState("letsencrypt"),[n,s]=g.useState(),{toast:o}=Pn();g.useEffect(()=>{(async()=>{const u=await Zv("ssl-provider");if(u){s(u);const d=u.content;e.setValue("provider",d.provider),e.setValue("eabKid",d.config[d.provider].eabKid),e.setValue("eabHmacKey",d.config[d.provider].eabHmacKey),r(d.provider)}else e.setValue("provider","letsencrypt"),r("letsencrypt")})()},[]);const i=c=>t===c?"border-primary":"",l=async c=>{if(c.provider==="zerossl"&&(c.eabKid||e.setError("eabKid",{message:"请输入EAB_KID和EAB_HMAC_KEY"}),c.eabHmacKey||e.setError("eabHmacKey",{message:"请输入EAB_KID和EAB_HMAC_KEY"}),!c.eabKid||!c.eabHmacKey))return;const u={id:n==null?void 0:n.id,name:"ssl-provider",content:{provider:c.provider,config:{letsencrypt:{},zerossl:{eabKid:c.eabKid??"",eabHmacKey:c.eabHmacKey??""}}}};try{await Fa(u),o({title:"修改成功",description:"修改成功"})}catch(d){const f=Es(d);o({title:"修改失败",description:f,variant:"destructive"})}};return a.jsx(a.Fragment,{children:a.jsx("div",{className:"w-full md:max-w-[35em]",children:a.jsx(pr,{...e,children:a.jsxs("form",{onSubmit:e.handleSubmit(l),className:"space-y-8 dark:text-stone-200",children:[a.jsx(Se,{control:e.control,name:"provider",render:({field:c})=>a.jsxs(we,{children:[a.jsx(_e,{children:"证书厂商"}),a.jsx(be,{children:a.jsxs(nT,{...c,className:"flex",onValueChange:u=>{r(u),e.setValue("provider",u)},value:t,children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Lm,{value:"letsencrypt",id:"letsencrypt"}),a.jsx(Co,{htmlFor:"letsencrypt",children:a.jsxs("div",{className:oe("flex items-center space-x-2 border p-2 rounded cursor-pointer",i("letsencrypt")),children:[a.jsx("img",{src:"/imgs/providers/letsencrypt.svg",className:"h-6"}),a.jsx("div",{children:"Let's Encrypt"})]})})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Lm,{value:"zerossl",id:"zerossl"}),a.jsx(Co,{htmlFor:"zerossl",children:a.jsxs("div",{className:oe("flex items-center space-x-2 border p-2 rounded cursor-pointer",i("zerossl")),children:[a.jsx("img",{src:"/imgs/providers/zerossl.svg",className:"h-6"}),a.jsx("div",{children:"ZeroSSL"})]})})]})]})}),a.jsx(Se,{control:e.control,name:"eabKid",render:({field:u})=>a.jsxs(we,{hidden:t!=="zerossl",children:[a.jsx(_e,{children:"EAB_KID"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"请输入EAB_KID",...u,type:"text"})}),a.jsx(ge,{})]})}),a.jsx(Se,{control:e.control,name:"eabHmacKey",render:({field:u})=>a.jsxs(we,{hidden:t!=="zerossl",children:[a.jsx(_e,{children:"EAB_HMAC_KEY"}),a.jsx(be,{children:a.jsx(Ne,{placeholder:"请输入EAB_HMAC_KEY",...u,type:"text"})}),a.jsx(ge,{})]})}),a.jsx(ge,{})]})}),a.jsx("div",{className:"flex justify-end",children:a.jsx(He,{type:"submit",children:"确认修改"})})]})})})})},G$=rA([{path:"/",element:a.jsx(J3,{}),children:[{path:"/",element:a.jsx(i$,{})},{path:"/domains",element:a.jsx(_z,{})},{path:"/edit",element:a.jsx(YU,{})},{path:"/access",element:a.jsx(XU,{})},{path:"/history",element:a.jsx(JU,{})},{path:"/setting",element:a.jsx(o$,{}),children:[{path:"/setting/password",element:a.jsx(s$,{})},{path:"/setting/account",element:a.jsx(l$,{})},{path:"/setting/notify",element:a.jsx(M$,{})},{path:"/setting/ssl-provider",element:a.jsx(K$,{})}]}]},{path:"/login",element:a.jsx(r$,{}),children:[{path:"/login",element:a.jsx(t$,{})}]},{path:"/about",element:a.jsx("div",{children:"About"})}]);ip.createRoot(document.getElementById("root")).render(a.jsx(Be.StrictMode,{children:a.jsx(Y3,{defaultTheme:"system",storageKey:"vite-ui-theme",children:a.jsx(dA,{router:G$})})}))});export default Z$(); diff --git a/ui/dist/assets/index-DusjrPWT.js b/ui/dist/assets/index-DusjrPWT.js deleted file mode 100644 index ebc4d713..00000000 --- a/ui/dist/assets/index-DusjrPWT.js +++ /dev/null @@ -1,308 +0,0 @@ -var HN=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var y$=HN((P$,Gu)=>{function _w(e,t){for(var r=0;rn[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(s){if(s.ep)return;s.ep=!0;const o=r(s);fetch(s.href,o)}})();var Kc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bw={exports:{}},Xd={},Sw={exports:{}},tt={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var gc=Symbol.for("react.element"),YN=Symbol.for("react.portal"),ZN=Symbol.for("react.fragment"),KN=Symbol.for("react.strict_mode"),GN=Symbol.for("react.profiler"),qN=Symbol.for("react.provider"),XN=Symbol.for("react.context"),QN=Symbol.for("react.forward_ref"),JN=Symbol.for("react.suspense"),eT=Symbol.for("react.memo"),tT=Symbol.for("react.lazy"),zy=Symbol.iterator;function rT(e){return e===null||typeof e!="object"?null:(e=zy&&e[zy]||e["@@iterator"],typeof e=="function"?e:null)}var kw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Cw=Object.assign,jw={};function _a(e,t,r){this.props=e,this.context=t,this.refs=jw,this.updater=r||kw}_a.prototype.isReactComponent={};_a.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};_a.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ew(){}Ew.prototype=_a.prototype;function Fm(e,t,r){this.props=e,this.context=t,this.refs=jw,this.updater=r||kw}var zm=Fm.prototype=new Ew;zm.constructor=Fm;Cw(zm,_a.prototype);zm.isPureReactComponent=!0;var Uy=Array.isArray,Nw=Object.prototype.hasOwnProperty,Um={current:null},Tw={key:!0,ref:!0,__self:!0,__source:!0};function Rw(e,t,r){var n,s={},o=null,i=null;if(t!=null)for(n in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)Nw.call(t,n)&&!Tw.hasOwnProperty(n)&&(s[n]=t[n]);var a=arguments.length-2;if(a===1)s.children=r;else if(1>>1,$=Z[z];if(0>>1;zs(se,Q))Oe<$&&0>s(he,se)?(Z[z]=he,Z[Oe]=Q,z=Oe):(Z[z]=se,Z[ne]=Q,z=ne);else if(Oe<$&&0>s(he,Q))Z[z]=he,Z[Oe]=Q,z=Oe;else break e}}return I}function s(Z,I){var Q=Z.sortIndex-I.sortIndex;return Q!==0?Q:Z.id-I.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,a=i.now();e.unstable_now=function(){return i.now()-a}}var c=[],u=[],d=1,f=null,m=3,y=!1,x=!1,g=!1,_=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,h=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(Z){for(var I=r(u);I!==null;){if(I.callback===null)n(u);else if(I.startTime<=Z)n(u),I.sortIndex=I.expirationTime,t(c,I);else break;I=r(u)}}function C(Z){if(g=!1,w(Z),!x)if(r(c)!==null)x=!0,te(j);else{var I=r(u);I!==null&&W(C,I.startTime-Z)}}function j(Z,I){x=!1,g&&(g=!1,p(P),P=-1),y=!0;var Q=m;try{for(w(I),f=r(c);f!==null&&(!(f.expirationTime>I)||Z&&!q());){var z=f.callback;if(typeof z=="function"){f.callback=null,m=f.priorityLevel;var $=z(f.expirationTime<=I);I=e.unstable_now(),typeof $=="function"?f.callback=$:f===r(c)&&n(c),w(I)}else n(c);f=r(c)}if(f!==null)var fe=!0;else{var ne=r(u);ne!==null&&W(C,ne.startTime-I),fe=!1}return fe}finally{f=null,m=Q,y=!1}}var E=!1,R=null,P=-1,A=5,L=-1;function q(){return!(e.unstable_now()-LZ||125z?(Z.sortIndex=Q,t(u,Z),r(c)===null&&Z===r(u)&&(g?(p(P),P=-1):g=!0,W(C,Q-z))):(Z.sortIndex=$,t(c,Z),x||y||(x=!0,te(j))),Z},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(Z){var I=m;return function(){var Q=m;m=I;try{return Z.apply(this,arguments)}finally{m=Q}}}})(Iw);Mw.exports=Iw;var hT=Mw.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var pT=v,Br=hT;function oe(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ap=Object.prototype.hasOwnProperty,mT=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Vy={},Wy={};function gT(e){return ap.call(Wy,e)?!0:ap.call(Vy,e)?!1:mT.test(e)?Wy[e]=!0:(Vy[e]=!0,!1)}function vT(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function yT(e,t,r,n){if(t===null||typeof t>"u"||vT(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function yr(e,t,r,n,s,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var nr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){nr[e]=new yr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];nr[t]=new yr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){nr[e]=new yr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){nr[e]=new yr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){nr[e]=new yr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){nr[e]=new yr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){nr[e]=new yr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){nr[e]=new yr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){nr[e]=new yr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Vm=/[\-:]([a-z])/g;function Wm(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Vm,Wm);nr[t]=new yr(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Vm,Wm);nr[t]=new yr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Vm,Wm);nr[t]=new yr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){nr[e]=new yr(e,1,!1,e.toLowerCase(),null,!1,!1)});nr.xlinkHref=new yr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){nr[e]=new yr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Bm(e,t,r,n){var s=nr.hasOwnProperty(t)?nr[t]:null;(s!==null?s.type!==0:n||!(2a||s[i]!==o[a]){var c=` -`+s[i].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=i&&0<=a);break}}}finally{fh=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?el(e):""}function xT(e){switch(e.tag){case 5:return el(e.type);case 16:return el("Lazy");case 13:return el("Suspense");case 19:return el("SuspenseList");case 0:case 2:case 15:return e=hh(e.type,!1),e;case 11:return e=hh(e.type.render,!1),e;case 1:return e=hh(e.type,!0),e;default:return""}}function dp(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ni:return"Fragment";case Ei:return"Portal";case lp:return"Profiler";case Hm:return"StrictMode";case cp:return"Suspense";case up:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case zw:return(e.displayName||"Context")+".Consumer";case Fw:return(e._context.displayName||"Context")+".Provider";case Ym:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Zm:return t=e.displayName||null,t!==null?t:dp(e.type)||"Memo";case Ws:t=e._payload,e=e._init;try{return dp(e(t))}catch{}}return null}function wT(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return dp(t);case 8:return t===Hm?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function fo(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function $w(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _T(e){var t=$w(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,o=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(i){n=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(i){n=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Xc(e){e._valueTracker||(e._valueTracker=_T(e))}function Vw(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=$w(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function qu(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function fp(e,t){var r=t.checked;return Mt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function Hy(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=fo(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ww(e,t){t=t.checked,t!=null&&Bm(e,"checked",t,!1)}function hp(e,t){Ww(e,t);var r=fo(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?pp(e,t.type,r):t.hasOwnProperty("defaultValue")&&pp(e,t.type,fo(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Yy(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function pp(e,t,r){(t!=="number"||qu(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var tl=Array.isArray;function Bi(e,t,r,n){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Qc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Nl(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var hl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},bT=["Webkit","ms","Moz","O"];Object.keys(hl).forEach(function(e){bT.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),hl[t]=hl[e]})});function Zw(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||hl.hasOwnProperty(e)&&hl[e]?(""+t).trim():t+"px"}function Kw(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=Zw(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,s):e[r]=s}}var ST=Mt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function vp(e,t){if(t){if(ST[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(oe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(oe(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(oe(61))}if(t.style!=null&&typeof t.style!="object")throw Error(oe(62))}}function yp(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var xp=null;function Km(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var wp=null,Hi=null,Yi=null;function Gy(e){if(e=xc(e)){if(typeof wp!="function")throw Error(oe(280));var t=e.stateNode;t&&(t=rf(t),wp(e.stateNode,e.type,t))}}function Gw(e){Hi?Yi?Yi.push(e):Yi=[e]:Hi=e}function qw(){if(Hi){var e=Hi,t=Yi;if(Yi=Hi=null,Gy(e),t)for(e=0;e>>=0,e===0?32:31-(OT(e)/MT|0)|0}var Jc=64,eu=4194304;function rl(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ed(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,s=e.suspendedLanes,o=e.pingedLanes,i=r&268435455;if(i!==0){var a=i&~s;a!==0?n=rl(a):(o&=i,o!==0&&(n=rl(o)))}else i=r&~s,i!==0?n=rl(i):o!==0&&(n=rl(o));if(n===0)return 0;if(t!==0&&t!==n&&!(t&s)&&(s=n&-n,o=t&-t,s>=o||s===16&&(o&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function vc(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-xn(t),e[t]=r}function zT(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0=ml),sx=" ",ox=!1;function g_(e,t){switch(e){case"keyup":return h2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function v_(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ti=!1;function m2(e,t){switch(e){case"compositionend":return v_(t);case"keypress":return t.which!==32?null:(ox=!0,sx);case"textInput":return e=t.data,e===sx&&ox?null:e;default:return null}}function g2(e,t){if(Ti)return e==="compositionend"||!rg&&g_(e,t)?(e=p_(),Tu=Jm=qs=null,Ti=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=cx(r)}}function __(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?__(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function b_(){for(var e=window,t=qu();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=qu(e.document)}return t}function ng(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function C2(e){var t=b_(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&__(r.ownerDocument.documentElement,r)){if(n!==null&&ng(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=r.textContent.length,o=Math.min(n.start,s);n=n.end===void 0?o:Math.min(n.end,s),!e.extend&&o>n&&(s=n,n=o,o=s),s=ux(r,o);var i=ux(r,n);s&&i&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),o>n?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Ri=null,jp=null,vl=null,Ep=!1;function dx(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Ep||Ri==null||Ri!==qu(n)||(n=Ri,"selectionStart"in n&&ng(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),vl&&Ol(vl,n)||(vl=n,n=nd(jp,"onSelect"),0Di||(e.current=Dp[Di],Dp[Di]=null,Di--)}function wt(e,t){Di++,Dp[Di]=e.current,e.current=t}var ho={},lr=So(ho),Cr=So(!1),Go=ho;function la(e,t){var r=e.type.contextTypes;if(!r)return ho;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var s={},o;for(o in r)s[o]=t[o];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function jr(e){return e=e.childContextTypes,e!=null}function od(){St(Cr),St(lr)}function yx(e,t,r){if(lr.current!==ho)throw Error(oe(168));wt(lr,t),wt(Cr,r)}function P_(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var s in n)if(!(s in t))throw Error(oe(108,wT(e)||"Unknown",s));return Mt({},r,n)}function id(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ho,Go=lr.current,wt(lr,e),wt(Cr,Cr.current),!0}function xx(e,t,r){var n=e.stateNode;if(!n)throw Error(oe(169));r?(e=P_(e,t,Go),n.__reactInternalMemoizedMergedChildContext=e,St(Cr),St(lr),wt(lr,e)):St(Cr),wt(Cr,r)}var cs=null,nf=!1,Eh=!1;function A_(e){cs===null?cs=[e]:cs.push(e)}function L2(e){nf=!0,A_(e)}function ko(){if(!Eh&&cs!==null){Eh=!0;var e=0,t=pt;try{var r=cs;for(pt=1;e>=i,s-=i,us=1<<32-xn(t)+s|r<P?(A=R,R=null):A=R.sibling;var L=m(p,R,w[P],C);if(L===null){R===null&&(R=A);break}e&&R&&L.alternate===null&&t(p,R),h=o(L,h,P),E===null?j=L:E.sibling=L,E=L,R=A}if(P===w.length)return r(p,R),Tt&&Ao(p,P),j;if(R===null){for(;PP?(A=R,R=null):A=R.sibling;var q=m(p,R,L.value,C);if(q===null){R===null&&(R=A);break}e&&R&&q.alternate===null&&t(p,R),h=o(q,h,P),E===null?j=q:E.sibling=q,E=q,R=A}if(L.done)return r(p,R),Tt&&Ao(p,P),j;if(R===null){for(;!L.done;P++,L=w.next())L=f(p,L.value,C),L!==null&&(h=o(L,h,P),E===null?j=L:E.sibling=L,E=L);return Tt&&Ao(p,P),j}for(R=n(p,R);!L.done;P++,L=w.next())L=y(R,p,P,L.value,C),L!==null&&(e&&L.alternate!==null&&R.delete(L.key===null?P:L.key),h=o(L,h,P),E===null?j=L:E.sibling=L,E=L);return e&&R.forEach(function(N){return t(p,N)}),Tt&&Ao(p,P),j}function _(p,h,w,C){if(typeof w=="object"&&w!==null&&w.type===Ni&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case qc:e:{for(var j=w.key,E=h;E!==null;){if(E.key===j){if(j=w.type,j===Ni){if(E.tag===7){r(p,E.sibling),h=s(E,w.props.children),h.return=p,p=h;break e}}else if(E.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Ws&&bx(j)===E.type){r(p,E.sibling),h=s(E,w.props),h.ref=Wa(p,E,w),h.return=p,p=h;break e}r(p,E);break}else t(p,E);E=E.sibling}w.type===Ni?(h=Yo(w.props.children,p.mode,C,w.key),h.return=p,p=h):(C=Lu(w.type,w.key,w.props,null,p.mode,C),C.ref=Wa(p,h,w),C.return=p,p=C)}return i(p);case Ei:e:{for(E=w.key;h!==null;){if(h.key===E)if(h.tag===4&&h.stateNode.containerInfo===w.containerInfo&&h.stateNode.implementation===w.implementation){r(p,h.sibling),h=s(h,w.children||[]),h.return=p,p=h;break e}else{r(p,h);break}else t(p,h);h=h.sibling}h=Mh(w,p.mode,C),h.return=p,p=h}return i(p);case Ws:return E=w._init,_(p,h,E(w._payload),C)}if(tl(w))return x(p,h,w,C);if(Fa(w))return g(p,h,w,C);au(p,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,h!==null&&h.tag===6?(r(p,h.sibling),h=s(h,w),h.return=p,p=h):(r(p,h),h=Oh(w,p.mode,C),h.return=p,p=h),i(p)):r(p,h)}return _}var ua=I_(!0),L_=I_(!1),cd=So(null),ud=null,Ii=null,ag=null;function lg(){ag=Ii=ud=null}function cg(e){var t=cd.current;St(cd),e._currentValue=t}function Ip(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function Ki(e,t){ud=e,ag=Ii=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(kr=!0),e.firstContext=null)}function nn(e){var t=e._currentValue;if(ag!==e)if(e={context:e,memoizedValue:t,next:null},Ii===null){if(ud===null)throw Error(oe(308));Ii=e,ud.dependencies={lanes:0,firstContext:e}}else Ii=Ii.next=e;return t}var Fo=null;function ug(e){Fo===null?Fo=[e]:Fo.push(e)}function F_(e,t,r,n){var s=t.interleaved;return s===null?(r.next=r,ug(t)):(r.next=s.next,s.next=r),t.interleaved=r,ws(e,n)}function ws(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var Bs=!1;function dg(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function z_(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ps(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function oo(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,lt&2){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,ws(e,r)}return s=n.interleaved,s===null?(t.next=t,ug(n)):(t.next=s.next,s.next=t),n.interleaved=t,ws(e,r)}function Pu(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,qm(e,r)}}function Sx(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var s=null,o=null;if(r=r.firstBaseUpdate,r!==null){do{var i={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};o===null?s=o=i:o=o.next=i,r=r.next}while(r!==null);o===null?s=o=t:o=o.next=t}else s=o=t;r={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:o,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function dd(e,t,r,n){var s=e.updateQueue;Bs=!1;var o=s.firstBaseUpdate,i=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var c=a,u=c.next;c.next=null,i===null?o=u:i.next=u,i=c;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==i&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=c))}if(o!==null){var f=s.baseState;i=0,d=u=c=null,a=o;do{var m=a.lane,y=a.eventTime;if((n&m)===m){d!==null&&(d=d.next={eventTime:y,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var x=e,g=a;switch(m=t,y=r,g.tag){case 1:if(x=g.payload,typeof x=="function"){f=x.call(y,f,m);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=g.payload,m=typeof x=="function"?x.call(y,f,m):x,m==null)break e;f=Mt({},f,m);break e;case 2:Bs=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,m=s.effects,m===null?s.effects=[a]:m.push(a))}else y={eventTime:y,lane:m,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=y,c=f):d=d.next=y,i|=m;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;m=a,a=m.next,m.next=null,s.lastBaseUpdate=m,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do i|=s.lane,s=s.next;while(s!==t)}else o===null&&(s.shared.lanes=0);Qo|=i,e.lanes=i,e.memoizedState=f}}function kx(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var n=Th.transition;Th.transition={};try{e(!1),t()}finally{pt=r,Th.transition=n}}function r1(){return sn().memoizedState}function $2(e,t,r){var n=ao(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},n1(e))s1(t,r);else if(r=F_(e,t,r,n),r!==null){var s=mr();wn(r,e,n,s),o1(r,t,n)}}function V2(e,t,r){var n=ao(e),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(n1(e))s1(t,s);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,a=o(i,r);if(s.hasEagerState=!0,s.eagerState=a,bn(a,i)){var c=t.interleaved;c===null?(s.next=s,ug(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}r=F_(e,t,s,n),r!==null&&(s=mr(),wn(r,e,n,s),o1(r,t,n))}}function n1(e){var t=e.alternate;return e===Ot||t!==null&&t===Ot}function s1(e,t){yl=hd=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function o1(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,qm(e,r)}}var pd={readContext:nn,useCallback:sr,useContext:sr,useEffect:sr,useImperativeHandle:sr,useInsertionEffect:sr,useLayoutEffect:sr,useMemo:sr,useReducer:sr,useRef:sr,useState:sr,useDebugValue:sr,useDeferredValue:sr,useTransition:sr,useMutableSource:sr,useSyncExternalStore:sr,useId:sr,unstable_isNewReconciler:!1},W2={readContext:nn,useCallback:function(e,t){return On().memoizedState=[e,t===void 0?null:t],e},useContext:nn,useEffect:jx,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Du(4194308,4,X_.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Du(4194308,4,e,t)},useInsertionEffect:function(e,t){return Du(4,2,e,t)},useMemo:function(e,t){var r=On();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=On();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=$2.bind(null,Ot,e),[n.memoizedState,e]},useRef:function(e){var t=On();return e={current:e},t.memoizedState=e},useState:Cx,useDebugValue:xg,useDeferredValue:function(e){return On().memoizedState=e},useTransition:function(){var e=Cx(!1),t=e[0];return e=U2.bind(null,e[1]),On().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=Ot,s=On();if(Tt){if(r===void 0)throw Error(oe(407));r=r()}else{if(r=t(),Qt===null)throw Error(oe(349));Xo&30||W_(n,t,r)}s.memoizedState=r;var o={value:r,getSnapshot:t};return s.queue=o,jx(H_.bind(null,n,o,e),[e]),n.flags|=2048,Vl(9,B_.bind(null,n,o,r,t),void 0,null),r},useId:function(){var e=On(),t=Qt.identifierPrefix;if(Tt){var r=ds,n=us;r=(n&~(1<<32-xn(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Ul++,0<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=i.createElement(r,{is:n.is}):(e=i.createElement(r),r==="select"&&(i=e,n.multiple?i.multiple=!0:n.size&&(i.size=n.size))):e=i.createElementNS(e,r),e[Mn]=t,e[Ll]=n,m1(e,t,!1,!1),t.stateNode=e;e:{switch(i=yp(r,n),r){case"dialog":bt("cancel",e),bt("close",e),s=n;break;case"iframe":case"object":case"embed":bt("load",e),s=n;break;case"video":case"audio":for(s=0;sha&&(t.flags|=128,n=!0,Ba(o,!1),t.lanes=4194304)}else{if(!n)if(e=fd(i),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Ba(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!Tt)return or(t),null}else 2*Ut()-o.renderingStartTime>ha&&r!==1073741824&&(t.flags|=128,n=!0,Ba(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(r=o.last,r!==null?r.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ut(),t.sibling=null,r=At.current,wt(At,n?r&1|2:r&1),t):(or(t),null);case 22:case 23:return Cg(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Mr&1073741824&&(or(t),t.subtreeFlags&6&&(t.flags|=8192)):or(t),null;case 24:return null;case 25:return null}throw Error(oe(156,t.tag))}function X2(e,t){switch(og(t),t.tag){case 1:return jr(t.type)&&od(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return da(),St(Cr),St(lr),pg(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return hg(t),null;case 13:if(St(At),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(oe(340));ca()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return St(At),null;case 4:return da(),null;case 10:return cg(t.type._context),null;case 22:case 23:return Cg(),null;case 24:return null;default:return null}}var cu=!1,ir=!1,Q2=typeof WeakSet=="function"?WeakSet:Set,be=null;function Li(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Lt(e,t,n)}else r.current=null}function Hp(e,t,r){try{r()}catch(n){Lt(e,t,n)}}var Lx=!1;function J2(e,t){if(Np=td,e=b_(),ng(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var s=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break e}var i=0,a=-1,c=-1,u=0,d=0,f=e,m=null;t:for(;;){for(var y;f!==r||s!==0&&f.nodeType!==3||(a=i+s),f!==o||n!==0&&f.nodeType!==3||(c=i+n),f.nodeType===3&&(i+=f.nodeValue.length),(y=f.firstChild)!==null;)m=f,f=y;for(;;){if(f===e)break t;if(m===r&&++u===s&&(a=i),m===o&&++d===n&&(c=i),(y=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=y}r=a===-1||c===-1?null:{start:a,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(Tp={focusedElem:e,selectionRange:r},td=!1,be=t;be!==null;)if(t=be,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,be=e;else for(;be!==null;){t=be;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var g=x.memoizedProps,_=x.memoizedState,p=t.stateNode,h=p.getSnapshotBeforeUpdate(t.elementType===t.type?g:dn(t.type,g),_);p.__reactInternalSnapshotBeforeUpdate=h}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(oe(163))}}catch(C){Lt(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,be=e;break}be=t.return}return x=Lx,Lx=!1,x}function xl(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var o=s.destroy;s.destroy=void 0,o!==void 0&&Hp(t,r,o)}s=s.next}while(s!==n)}}function af(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function Yp(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function y1(e){var t=e.alternate;t!==null&&(e.alternate=null,y1(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Mn],delete t[Ll],delete t[Ap],delete t[M2],delete t[I2])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function x1(e){return e.tag===5||e.tag===3||e.tag===4}function Fx(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||x1(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Zp(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=sd));else if(n!==4&&(e=e.child,e!==null))for(Zp(e,t,r),e=e.sibling;e!==null;)Zp(e,t,r),e=e.sibling}function Kp(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Kp(e,t,r),e=e.sibling;e!==null;)Kp(e,t,r),e=e.sibling}var tr=null,fn=!1;function Fs(e,t,r){for(r=r.child;r!==null;)w1(e,t,r),r=r.sibling}function w1(e,t,r){if($n&&typeof $n.onCommitFiberUnmount=="function")try{$n.onCommitFiberUnmount(Qd,r)}catch{}switch(r.tag){case 5:ir||Li(r,t);case 6:var n=tr,s=fn;tr=null,Fs(e,t,r),tr=n,fn=s,tr!==null&&(fn?(e=tr,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):tr.removeChild(r.stateNode));break;case 18:tr!==null&&(fn?(e=tr,r=r.stateNode,e.nodeType===8?jh(e.parentNode,r):e.nodeType===1&&jh(e,r),Al(e)):jh(tr,r.stateNode));break;case 4:n=tr,s=fn,tr=r.stateNode.containerInfo,fn=!0,Fs(e,t,r),tr=n,fn=s;break;case 0:case 11:case 14:case 15:if(!ir&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var o=s,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&Hp(r,t,i),s=s.next}while(s!==n)}Fs(e,t,r);break;case 1:if(!ir&&(Li(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){Lt(r,t,a)}Fs(e,t,r);break;case 21:Fs(e,t,r);break;case 22:r.mode&1?(ir=(n=ir)||r.memoizedState!==null,Fs(e,t,r),ir=n):Fs(e,t,r);break;default:Fs(e,t,r)}}function zx(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Q2),t.forEach(function(n){var s=lR.bind(null,e,n);r.has(n)||(r.add(n),n.then(s,s))})}}function un(e,t){var r=t.deletions;if(r!==null)for(var n=0;ns&&(s=i),n&=~o}if(n=s,n=Ut()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*tR(n/1960))-n,10e?16:e,Xs===null)var n=!1;else{if(e=Xs,Xs=null,vd=0,lt&6)throw Error(oe(331));var s=lt;for(lt|=4,be=e.current;be!==null;){var o=be,i=o.child;if(be.flags&16){var a=o.deletions;if(a!==null){for(var c=0;cUt()-Sg?Ho(e,0):bg|=r),Er(e,t)}function N1(e,t){t===0&&(e.mode&1?(t=eu,eu<<=1,!(eu&130023424)&&(eu=4194304)):t=1);var r=mr();e=ws(e,t),e!==null&&(vc(e,t,r),Er(e,r))}function aR(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),N1(e,r)}function lR(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,s=e.memoizedState;s!==null&&(r=s.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(oe(314))}n!==null&&n.delete(t),N1(e,r)}var T1;T1=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Cr.current)kr=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return kr=!1,G2(e,t,r);kr=!!(e.flags&131072)}else kr=!1,Tt&&t.flags&1048576&&D_(t,ld,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Ou(e,t),e=t.pendingProps;var s=la(t,lr.current);Ki(t,r),s=gg(null,t,n,e,s,r);var o=vg();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,jr(n)?(o=!0,id(t)):o=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,dg(t),s.updater=of,t.stateNode=s,s._reactInternals=t,Fp(t,n,e,r),t=$p(null,t,n,!0,o,r)):(t.tag=0,Tt&&o&&sg(t),hr(null,t,s,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Ou(e,t),e=t.pendingProps,s=n._init,n=s(n._payload),t.type=n,s=t.tag=uR(n),e=dn(n,e),s){case 0:t=Up(null,t,n,e,r);break e;case 1:t=Ox(null,t,n,e,r);break e;case 11:t=Ax(null,t,n,e,r);break e;case 14:t=Dx(null,t,n,dn(n.type,e),r);break e}throw Error(oe(306,n,""))}return t;case 0:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:dn(n,s),Up(e,t,n,s,r);case 1:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:dn(n,s),Ox(e,t,n,s,r);case 3:e:{if(f1(t),e===null)throw Error(oe(387));n=t.pendingProps,o=t.memoizedState,s=o.element,z_(e,t),dd(t,n,null,r);var i=t.memoizedState;if(n=i.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){s=fa(Error(oe(423)),t),t=Mx(e,t,n,r,s);break e}else if(n!==s){s=fa(Error(oe(424)),t),t=Mx(e,t,n,r,s);break e}else for(Fr=so(t.stateNode.containerInfo.firstChild),zr=t,Tt=!0,mn=null,r=L_(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(ca(),n===s){t=_s(e,t,r);break e}hr(e,t,n,r)}t=t.child}return t;case 5:return U_(t),e===null&&Mp(t),n=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,i=s.children,Rp(n,s)?i=null:o!==null&&Rp(n,o)&&(t.flags|=32),d1(e,t),hr(e,t,i,r),t.child;case 6:return e===null&&Mp(t),null;case 13:return h1(e,t,r);case 4:return fg(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=ua(t,null,n,r):hr(e,t,n,r),t.child;case 11:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:dn(n,s),Ax(e,t,n,s,r);case 7:return hr(e,t,t.pendingProps,r),t.child;case 8:return hr(e,t,t.pendingProps.children,r),t.child;case 12:return hr(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,s=t.pendingProps,o=t.memoizedProps,i=s.value,wt(cd,n._currentValue),n._currentValue=i,o!==null)if(bn(o.value,i)){if(o.children===s.children&&!Cr.current){t=_s(e,t,r);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){i=o.child;for(var c=a.firstContext;c!==null;){if(c.context===n){if(o.tag===1){c=ps(-1,r&-r),c.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}o.lanes|=r,c=o.alternate,c!==null&&(c.lanes|=r),Ip(o.return,r,t),a.lanes|=r;break}c=c.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(oe(341));i.lanes|=r,a=i.alternate,a!==null&&(a.lanes|=r),Ip(i,r,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}hr(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,n=t.pendingProps.children,Ki(t,r),s=nn(s),n=n(s),t.flags|=1,hr(e,t,n,r),t.child;case 14:return n=t.type,s=dn(n,t.pendingProps),s=dn(n.type,s),Dx(e,t,n,s,r);case 15:return c1(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:dn(n,s),Ou(e,t),t.tag=1,jr(n)?(e=!0,id(t)):e=!1,Ki(t,r),i1(t,n,s),Fp(t,n,s,r),$p(null,t,n,!0,e,r);case 19:return p1(e,t,r);case 22:return u1(e,t,r)}throw Error(oe(156,t.tag))};function R1(e,t){return n_(e,t)}function cR(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function en(e,t,r,n){return new cR(e,t,r,n)}function Eg(e){return e=e.prototype,!(!e||!e.isReactComponent)}function uR(e){if(typeof e=="function")return Eg(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ym)return 11;if(e===Zm)return 14}return 2}function lo(e,t){var r=e.alternate;return r===null?(r=en(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Lu(e,t,r,n,s,o){var i=2;if(n=e,typeof e=="function")Eg(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Ni:return Yo(r.children,s,o,t);case Hm:i=8,s|=8;break;case lp:return e=en(12,r,t,s|2),e.elementType=lp,e.lanes=o,e;case cp:return e=en(13,r,t,s),e.elementType=cp,e.lanes=o,e;case up:return e=en(19,r,t,s),e.elementType=up,e.lanes=o,e;case Uw:return cf(r,s,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Fw:i=10;break e;case zw:i=9;break e;case Ym:i=11;break e;case Zm:i=14;break e;case Ws:i=16,n=null;break e}throw Error(oe(130,e==null?e:typeof e,""))}return t=en(i,r,t,s),t.elementType=e,t.type=n,t.lanes=o,t}function Yo(e,t,r,n){return e=en(7,e,n,t),e.lanes=r,e}function cf(e,t,r,n){return e=en(22,e,n,t),e.elementType=Uw,e.lanes=r,e.stateNode={isHidden:!1},e}function Oh(e,t,r){return e=en(6,e,null,t),e.lanes=r,e}function Mh(e,t,r){return t=en(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function dR(e,t,r,n,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=mh(0),this.expirationTimes=mh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mh(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Ng(e,t,r,n,s,o,i,a,c){return e=new dR(e,t,r,a,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=en(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},dg(o),e}function fR(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(O1)}catch(e){console.error(e)}}O1(),Ow.exports=Hr;var Ns=Ow.exports;const M1=Lm(Ns),vR=_w({__proto__:null,default:M1},[Ns]);var Zx=Ns;ip.createRoot=Zx.createRoot,ip.hydrateRoot=Zx.hydrateRoot;/** - * @remix-run/router v1.18.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Pt(){return Pt=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function ei(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function xR(){return Math.random().toString(36).substr(2,8)}function Gx(e,t){return{usr:e.state,key:e.key,idx:t}}function Bl(e,t,r,n){return r===void 0&&(r=null),Pt({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Ts(t):t,{state:r,key:t&&t.key||n||xR()})}function ti(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Ts(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function wR(e,t,r,n){n===void 0&&(n={});let{window:s=document.defaultView,v5Compat:o=!1}=n,i=s.history,a=Vt.Pop,c=null,u=d();u==null&&(u=0,i.replaceState(Pt({},i.state,{idx:u}),""));function d(){return(i.state||{idx:null}).idx}function f(){a=Vt.Pop;let _=d(),p=_==null?null:_-u;u=_,c&&c({action:a,location:g.location,delta:p})}function m(_,p){a=Vt.Push;let h=Bl(g.location,_,p);r&&r(h,_),u=d()+1;let w=Gx(h,u),C=g.createHref(h);try{i.pushState(w,"",C)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;s.location.assign(C)}o&&c&&c({action:a,location:g.location,delta:1})}function y(_,p){a=Vt.Replace;let h=Bl(g.location,_,p);r&&r(h,_),u=d();let w=Gx(h,u),C=g.createHref(h);i.replaceState(w,"",C),o&&c&&c({action:a,location:g.location,delta:0})}function x(_){let p=s.location.origin!=="null"?s.location.origin:s.location.href,h=typeof _=="string"?_:ti(_);return h=h.replace(/ $/,"%20"),et(p,"No window.location.(origin|href) available to create URL for href: "+h),new URL(h,p)}let g={get action(){return a},get location(){return e(s,i)},listen(_){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(Kx,f),c=_,()=>{s.removeEventListener(Kx,f),c=null}},createHref(_){return t(s,_)},createURL:x,encodeLocation(_){let p=x(_);return{pathname:p.pathname,search:p.search,hash:p.hash}},push:m,replace:y,go(_){return i.go(_)}};return g}var xt;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(xt||(xt={}));const _R=new Set(["lazy","caseSensitive","path","id","index","children"]);function bR(e){return e.index===!0}function Hl(e,t,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),e.map((s,o)=>{let i=[...r,String(o)],a=typeof s.id=="string"?s.id:i.join("-");if(et(s.index!==!0||!s.children,"Cannot specify children on an index route"),et(!n[a],'Found a route id collision on id "'+a+`". Route id's must be globally unique within Data Router usages`),bR(s)){let c=Pt({},s,t(s),{id:a});return n[a]=c,c}else{let c=Pt({},s,t(s),{id:a,children:void 0});return n[a]=c,s.children&&(c.children=Hl(s.children,t,i,n)),c}})}function Oo(e,t,r){return r===void 0&&(r="/"),Fu(e,t,r,!1)}function Fu(e,t,r,n){let s=typeof t=="string"?Ts(t):t,o=ka(s.pathname||"/",r);if(o==null)return null;let i=I1(e);kR(i);let a=null;for(let c=0;a==null&&c{let c={relativePath:a===void 0?o.path||"":a,caseSensitive:o.caseSensitive===!0,childrenIndex:i,route:o};c.relativePath.startsWith("/")&&(et(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let u=ms([n,c.relativePath]),d=r.concat(c);o.children&&o.children.length>0&&(et(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),I1(o.children,t,d,u)),!(o.path==null&&!o.index)&&t.push({path:u,score:PR(u,o.index),routesMeta:d})};return e.forEach((o,i)=>{var a;if(o.path===""||!((a=o.path)!=null&&a.includes("?")))s(o,i);else for(let c of L1(o.path))s(o,i,c)}),t}function L1(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,s=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return s?[o,""]:[o];let i=L1(n.join("/")),a=[];return a.push(...i.map(c=>c===""?o:[o,c].join("/"))),s&&a.push(...i),a.map(c=>e.startsWith("/")&&c===""?"/":c)}function kR(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:AR(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const CR=/^:[\w-]+$/,jR=3,ER=2,NR=1,TR=10,RR=-2,qx=e=>e==="*";function PR(e,t){let r=e.split("/"),n=r.length;return r.some(qx)&&(n+=RR),t&&(n+=ER),r.filter(s=>!qx(s)).reduce((s,o)=>s+(CR.test(o)?jR:o===""?NR:TR),n)}function AR(e,t){return e.length===t.length&&e.slice(0,-1).every((n,s)=>n===t[s])?e[e.length-1]-t[t.length-1]:0}function DR(e,t,r){r===void 0&&(r=!1);let{routesMeta:n}=e,s={},o="/",i=[];for(let a=0;a{let{paramName:m,isOptional:y}=d;if(m==="*"){let g=a[f]||"";i=o.slice(0,o.length-g.length).replace(/(.)\/+$/,"$1")}const x=a[f];return y&&!x?u[m]=void 0:u[m]=(x||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function OR(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),ei(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,a,c)=>(n.push({paramName:a,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),n]}function MR(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ei(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function ka(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}function IR(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:s=""}=typeof e=="string"?Ts(e):e;return{pathname:r?r.startsWith("/")?r:LR(r,t):t,search:zR(n),hash:UR(s)}}function LR(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function Ih(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function F1(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function pf(e,t){let r=F1(e);return t?r.map((n,s)=>s===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function mf(e,t,r,n){n===void 0&&(n=!1);let s;typeof e=="string"?s=Ts(e):(s=Pt({},e),et(!s.pathname||!s.pathname.includes("?"),Ih("?","pathname","search",s)),et(!s.pathname||!s.pathname.includes("#"),Ih("#","pathname","hash",s)),et(!s.search||!s.search.includes("#"),Ih("#","search","hash",s)));let o=e===""||s.pathname==="",i=o?"/":s.pathname,a;if(i==null)a=r;else{let f=t.length-1;if(!n&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),f-=1;s.pathname=m.join("/")}a=f>=0?t[f]:"/"}let c=IR(s,a),u=i&&i!=="/"&&i.endsWith("/"),d=(o||i===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const ms=e=>e.join("/").replace(/\/\/+/g,"/"),FR=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),zR=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,UR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Ag{constructor(t,r,n,s){s===void 0&&(s=!1),this.status=t,this.statusText=r||"",this.internal=s,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function gf(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const z1=["post","put","patch","delete"],$R=new Set(z1),VR=["get",...z1],WR=new Set(VR),BR=new Set([301,302,303,307,308]),HR=new Set([307,308]),Lh={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},YR={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ya={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Dg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ZR=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),U1="remix-router-transitions";function KR(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",n=!r;et(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let s;if(e.mapRouteProperties)s=e.mapRouteProperties;else if(e.detectErrorBoundary){let U=e.detectErrorBoundary;s=B=>({hasErrorBoundary:U(B)})}else s=ZR;let o={},i=Hl(e.routes,s,void 0,o),a,c=e.basename||"/",u=e.unstable_dataStrategy||JR,d=e.unstable_patchRoutesOnMiss,f=Pt({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),m=null,y=new Set,x=null,g=null,_=null,p=e.hydrationData!=null,h=Oo(i,e.history.location,c),w=null;if(h==null&&!d){let U=dr(404,{pathname:e.history.location.pathname}),{matches:B,route:G}=a0(i);h=B,w={[G.id]:U}}h&&d&&!e.hydrationData&&ch(h,i,e.history.location.pathname).active&&(h=null);let C;if(!h)C=!1,h=[];else if(h.some(U=>U.route.lazy))C=!1;else if(!h.some(U=>U.route.loader))C=!0;else if(f.v7_partialHydration){let U=e.hydrationData?e.hydrationData.loaderData:null,B=e.hydrationData?e.hydrationData.errors:null,G=re=>re.route.loader?typeof re.route.loader=="function"&&re.route.loader.hydrate===!0?!1:U&&U[re.route.id]!==void 0||B&&B[re.route.id]!==void 0:!0;if(B){let re=h.findIndex(xe=>B[xe.route.id]!==void 0);C=h.slice(0,re+1).every(G)}else C=h.every(G)}else C=e.hydrationData!=null;let j,E={historyAction:e.history.action,location:e.history.location,matches:h,initialized:C,navigation:Lh,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||w,fetchers:new Map,blockers:new Map},R=Vt.Pop,P=!1,A,L=!1,q=new Map,N=null,F=!1,b=!1,V=[],te=[],W=new Map,Z=0,I=-1,Q=new Map,z=new Set,$=new Map,fe=new Map,ne=new Set,se=new Map,Oe=new Map,he=new Map,ye=!1;function ke(){if(m=e.history.listen(U=>{let{action:B,location:G,delta:re}=U;if(ye){ye=!1;return}ei(Oe.size===0||re!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let xe=Wc({currentLocation:E.location,nextLocation:G,historyAction:B});if(xe&&re!=null){ye=!0,e.history.go(re*-1),hi(xe,{state:"blocked",location:G,proceed(){hi(xe,{state:"proceeding",proceed:void 0,reset:void 0,location:G}),e.history.go(re)},reset(){let Ae=new Map(E.blockers);Ae.set(xe,Ya),Pe({blockers:Ae})}});return}return K(B,G)}),r){fP(t,q);let U=()=>hP(t,q);t.addEventListener("pagehide",U),N=()=>t.removeEventListener("pagehide",U)}return E.initialized||K(Vt.Pop,E.location,{initialHydration:!0}),j}function Fe(){m&&m(),N&&N(),y.clear(),A&&A.abort(),E.fetchers.forEach((U,B)=>Ht(B)),E.blockers.forEach((U,B)=>Vc(B))}function Me(U){return y.add(U),()=>y.delete(U)}function Pe(U,B){B===void 0&&(B={}),E=Pt({},E,U);let G=[],re=[];f.v7_fetcherPersist&&E.fetchers.forEach((xe,Ae)=>{xe.state==="idle"&&(ne.has(Ae)?re.push(Ae):G.push(Ae))}),[...y].forEach(xe=>xe(E,{deletedFetchers:re,unstable_viewTransitionOpts:B.viewTransitionOpts,unstable_flushSync:B.flushSync===!0})),f.v7_fetcherPersist&&(G.forEach(xe=>E.fetchers.delete(xe)),re.forEach(xe=>Ht(xe)))}function nt(U,B,G){var re,xe;let{flushSync:Ae}=G===void 0?{}:G,Ve=E.actionData!=null&&E.navigation.formMethod!=null&&hn(E.navigation.formMethod)&&E.navigation.state==="loading"&&((re=U.state)==null?void 0:re._isRedirect)!==!0,de;B.actionData?Object.keys(B.actionData).length>0?de=B.actionData:de=null:Ve?de=E.actionData:de=null;let Ge=B.loaderData?o0(E.loaderData,B.loaderData,B.matches||[],B.errors):E.loaderData,Le=E.blockers;Le.size>0&&(Le=new Map(Le),Le.forEach((ht,yt)=>Le.set(yt,Ya)));let ze=P===!0||E.navigation.formMethod!=null&&hn(E.navigation.formMethod)&&((xe=U.state)==null?void 0:xe._isRedirect)!==!0;a&&(i=a,a=void 0),F||R===Vt.Pop||(R===Vt.Push?e.history.push(U,U.state):R===Vt.Replace&&e.history.replace(U,U.state));let gt;if(R===Vt.Pop){let ht=q.get(E.location.pathname);ht&&ht.has(U.pathname)?gt={currentLocation:E.location,nextLocation:U}:q.has(U.pathname)&&(gt={currentLocation:U,nextLocation:E.location})}else if(L){let ht=q.get(E.location.pathname);ht?ht.add(U.pathname):(ht=new Set([U.pathname]),q.set(E.location.pathname,ht)),gt={currentLocation:E.location,nextLocation:U}}Pe(Pt({},B,{actionData:de,loaderData:Ge,historyAction:R,location:U,initialized:!0,navigation:Lh,revalidation:"idle",restoreScrollPosition:Ly(U,B.matches||E.matches),preventScrollReset:ze,blockers:Le}),{viewTransitionOpts:gt,flushSync:Ae===!0}),R=Vt.Pop,P=!1,L=!1,F=!1,b=!1,V=[],te=[]}async function k(U,B){if(typeof U=="number"){e.history.go(U);return}let G=Jp(E.location,E.matches,c,f.v7_prependBasename,U,f.v7_relativeSplatPath,B==null?void 0:B.fromRouteId,B==null?void 0:B.relative),{path:re,submission:xe,error:Ae}=Qx(f.v7_normalizeFormMethod,!1,G,B),Ve=E.location,de=Bl(E.location,re,B&&B.state);de=Pt({},de,e.history.encodeLocation(de));let Ge=B&&B.replace!=null?B.replace:void 0,Le=Vt.Push;Ge===!0?Le=Vt.Replace:Ge===!1||xe!=null&&hn(xe.formMethod)&&xe.formAction===E.location.pathname+E.location.search&&(Le=Vt.Replace);let ze=B&&"preventScrollReset"in B?B.preventScrollReset===!0:void 0,gt=(B&&B.unstable_flushSync)===!0,ht=Wc({currentLocation:Ve,nextLocation:de,historyAction:Le});if(ht){hi(ht,{state:"blocked",location:de,proceed(){hi(ht,{state:"proceeding",proceed:void 0,reset:void 0,location:de}),k(U,B)},reset(){let yt=new Map(E.blockers);yt.set(ht,Ya),Pe({blockers:yt})}});return}return await K(Le,de,{submission:xe,pendingError:Ae,preventScrollReset:ze,replace:B&&B.replace,enableViewTransition:B&&B.unstable_viewTransition,flushSync:gt})}function J(){if(Ye(),Pe({revalidation:"loading"}),E.navigation.state!=="submitting"){if(E.navigation.state==="idle"){K(E.historyAction,E.location,{startUninterruptedRevalidation:!0});return}K(R||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation})}}async function K(U,B,G){A&&A.abort(),A=null,R=U,F=(G&&G.startUninterruptedRevalidation)===!0,$N(E.location,E.matches),P=(G&&G.preventScrollReset)===!0,L=(G&&G.enableViewTransition)===!0;let re=a||i,xe=G&&G.overrideNavigation,Ae=Oo(re,B,c),Ve=(G&&G.flushSync)===!0,de=ch(Ae,re,B.pathname);if(de.active&&de.matches&&(Ae=de.matches),!Ae){let{error:dt,notFoundMatches:er,route:$t}=pi(B.pathname);nt(B,{matches:er,loaderData:{},errors:{[$t.id]:dt}},{flushSync:Ve});return}if(E.initialized&&!b&&oP(E.location,B)&&!(G&&G.submission&&hn(G.submission.formMethod))){nt(B,{matches:Ae},{flushSync:Ve});return}A=new AbortController;let Ge=xi(e.history,B,A.signal,G&&G.submission),Le;if(G&&G.pendingError)Le=[zi(Ae).route.id,{type:xt.error,error:G.pendingError}];else if(G&&G.submission&&hn(G.submission.formMethod)){let dt=await D(Ge,B,G.submission,Ae,de.active,{replace:G.replace,flushSync:Ve});if(dt.shortCircuited)return;if(dt.pendingActionResult){let[er,$t]=dt.pendingActionResult;if(Ir($t)&&gf($t.error)&&$t.error.status===404){A=null,nt(B,{matches:dt.matches,loaderData:{},errors:{[er]:$t.error}});return}}Ae=dt.matches||Ae,Le=dt.pendingActionResult,xe=Fh(B,G.submission),Ve=!1,de.active=!1,Ge=xi(e.history,Ge.url,Ge.signal)}let{shortCircuited:ze,matches:gt,loaderData:ht,errors:yt}=await S(Ge,B,Ae,de.active,xe,G&&G.submission,G&&G.fetcherSubmission,G&&G.replace,G&&G.initialHydration===!0,Ve,Le);ze||(A=null,nt(B,Pt({matches:gt||Ae},i0(Le),{loaderData:ht,errors:yt})))}async function D(U,B,G,re,xe,Ae){Ae===void 0&&(Ae={}),Ye();let Ve=uP(B,G);if(Pe({navigation:Ve},{flushSync:Ae.flushSync===!0}),xe){let Le=await Bc(re,B.pathname,U.signal);if(Le.type==="aborted")return{shortCircuited:!0};if(Le.type==="error"){let{boundaryId:ze,error:gt}=Pn(B.pathname,Le);return{matches:Le.partialMatches,pendingActionResult:[ze,{type:xt.error,error:gt}]}}else if(Le.matches)re=Le.matches;else{let{notFoundMatches:ze,error:gt,route:ht}=pi(B.pathname);return{matches:ze,pendingActionResult:[ht.id,{type:xt.error,error:gt}]}}}let de,Ge=sl(re,B);if(!Ge.route.action&&!Ge.route.lazy)de={type:xt.error,error:dr(405,{method:U.method,pathname:B.pathname,routeId:Ge.route.id})};else if(de=(await ee("action",U,[Ge],re))[0],U.signal.aborted)return{shortCircuited:!0};if($o(de)){let Le;return Ae&&Ae.replace!=null?Le=Ae.replace:Le=r0(de.response.headers.get("Location"),new URL(U.url),c)===E.location.pathname+E.location.search,await X(U,de,{submission:G,replace:Le}),{shortCircuited:!0}}if(Uo(de))throw dr(400,{type:"defer-action"});if(Ir(de)){let Le=zi(re,Ge.route.id);return(Ae&&Ae.replace)!==!0&&(R=Vt.Push),{matches:re,pendingActionResult:[Le.route.id,de]}}return{matches:re,pendingActionResult:[Ge.route.id,de]}}async function S(U,B,G,re,xe,Ae,Ve,de,Ge,Le,ze){let gt=xe||Fh(B,Ae),ht=Ae||Ve||u0(gt),yt=!F&&(!f.v7_partialHydration||!Ge);if(re){if(yt){let It=T(ze);Pe(Pt({navigation:gt},It!==void 0?{actionData:It}:{}),{flushSync:Le})}let Qe=await Bc(G,B.pathname,U.signal);if(Qe.type==="aborted")return{shortCircuited:!0};if(Qe.type==="error"){let{boundaryId:It,error:Ar}=Pn(B.pathname,Qe);return{matches:Qe.partialMatches,loaderData:{},errors:{[It]:Ar}}}else if(Qe.matches)G=Qe.matches;else{let{error:It,notFoundMatches:Ar,route:Et}=pi(B.pathname);return{matches:Ar,loaderData:{},errors:{[Et.id]:It}}}}let dt=a||i,[er,$t]=Jx(e.history,E,G,ht,B,f.v7_partialHydration&&Ge===!0,f.v7_skipActionErrorRevalidation,b,V,te,ne,$,z,dt,c,ze);if(Is(Qe=>!(G&&G.some(It=>It.route.id===Qe))||er&&er.some(It=>It.route.id===Qe)),I=++Z,er.length===0&&$t.length===0){let Qe=es();return nt(B,Pt({matches:G,loaderData:{},errors:ze&&Ir(ze[1])?{[ze[0]]:ze[1].error}:null},i0(ze),Qe?{fetchers:new Map(E.fetchers)}:{}),{flushSync:Le}),{shortCircuited:!0}}if(yt){let Qe={};if(!re){Qe.navigation=gt;let It=T(ze);It!==void 0&&(Qe.actionData=It)}$t.length>0&&(Qe.fetchers=O($t)),Pe(Qe,{flushSync:Le})}$t.forEach(Qe=>{W.has(Qe.key)&&at(Qe.key),Qe.controller&&W.set(Qe.key,Qe.controller)});let La=()=>$t.forEach(Qe=>at(Qe.key));A&&A.signal.addEventListener("abort",La);let{loaderResults:Ls,fetcherResults:mi}=await me(E.matches,G,er,$t,U);if(U.signal.aborted)return{shortCircuited:!0};A&&A.signal.removeEventListener("abort",La),$t.forEach(Qe=>W.delete(Qe.key));let gi=l0([...Ls,...mi]);if(gi){if(gi.idx>=er.length){let Qe=$t[gi.idx-er.length].key;z.add(Qe)}return await X(U,gi.result,{replace:de}),{shortCircuited:!0}}let{loaderData:vi,errors:An}=s0(E,G,er,Ls,ze,$t,mi,se);se.forEach((Qe,It)=>{Qe.subscribe(Ar=>{(Ar||Qe.done)&&se.delete(It)})}),f.v7_partialHydration&&Ge&&E.errors&&Object.entries(E.errors).filter(Qe=>{let[It]=Qe;return!er.some(Ar=>Ar.route.id===It)}).forEach(Qe=>{let[It,Ar]=Qe;An=Object.assign(An||{},{[It]:Ar})});let Hc=es(),Yc=qr(I),Zc=Hc||Yc||$t.length>0;return Pt({matches:G,loaderData:vi,errors:An},Zc?{fetchers:new Map(E.fetchers)}:{})}function T(U){if(U&&!Ir(U[1]))return{[U[0]]:U[1].data};if(E.actionData)return Object.keys(E.actionData).length===0?null:E.actionData}function O(U){return U.forEach(B=>{let G=E.fetchers.get(B.key),re=Za(void 0,G?G.data:void 0);E.fetchers.set(B.key,re)}),new Map(E.fetchers)}function Y(U,B,G,re){if(n)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");W.has(U)&&at(U);let xe=(re&&re.unstable_flushSync)===!0,Ae=a||i,Ve=Jp(E.location,E.matches,c,f.v7_prependBasename,G,f.v7_relativeSplatPath,B,re==null?void 0:re.relative),de=Oo(Ae,Ve,c),Ge=ch(de,Ae,Ve);if(Ge.active&&Ge.matches&&(de=Ge.matches),!de){jt(U,B,dr(404,{pathname:Ve}),{flushSync:xe});return}let{path:Le,submission:ze,error:gt}=Qx(f.v7_normalizeFormMethod,!0,Ve,re);if(gt){jt(U,B,gt,{flushSync:xe});return}let ht=sl(de,Le);if(P=(re&&re.preventScrollReset)===!0,ze&&hn(ze.formMethod)){M(U,B,Le,ht,de,Ge.active,xe,ze);return}$.set(U,{routeId:B,path:Le}),H(U,B,Le,ht,de,Ge.active,xe,ze)}async function M(U,B,G,re,xe,Ae,Ve,de){Ye(),$.delete(U);function Ge(Et){if(!Et.route.action&&!Et.route.lazy){let ts=dr(405,{method:de.formMethod,pathname:G,routeId:B});return jt(U,B,ts,{flushSync:Ve}),!0}return!1}if(!Ae&&Ge(re))return;let Le=E.fetchers.get(U);Ue(U,dP(de,Le),{flushSync:Ve});let ze=new AbortController,gt=xi(e.history,G,ze.signal,de);if(Ae){let Et=await Bc(xe,G,gt.signal);if(Et.type==="aborted")return;if(Et.type==="error"){let{error:ts}=Pn(G,Et);jt(U,B,ts,{flushSync:Ve});return}else if(Et.matches){if(xe=Et.matches,re=sl(xe,G),Ge(re))return}else{jt(U,B,dr(404,{pathname:G}),{flushSync:Ve});return}}W.set(U,ze);let ht=Z,dt=(await ee("action",gt,[re],xe))[0];if(gt.signal.aborted){W.get(U)===ze&&W.delete(U);return}if(f.v7_fetcherPersist&&ne.has(U)){if($o(dt)||Ir(dt)){Ue(U,$s(void 0));return}}else{if($o(dt))if(W.delete(U),I>ht){Ue(U,$s(void 0));return}else return z.add(U),Ue(U,Za(de)),X(gt,dt,{fetcherSubmission:de});if(Ir(dt)){jt(U,B,dt.error);return}}if(Uo(dt))throw dr(400,{type:"defer-action"});let er=E.navigation.location||E.location,$t=xi(e.history,er,ze.signal),La=a||i,Ls=E.navigation.state!=="idle"?Oo(La,E.navigation.location,c):E.matches;et(Ls,"Didn't find any matches after fetcher action");let mi=++Z;Q.set(U,mi);let gi=Za(de,dt.data);E.fetchers.set(U,gi);let[vi,An]=Jx(e.history,E,Ls,de,er,!1,f.v7_skipActionErrorRevalidation,b,V,te,ne,$,z,La,c,[re.route.id,dt]);An.filter(Et=>Et.key!==U).forEach(Et=>{let ts=Et.key,Fy=E.fetchers.get(ts),BN=Za(void 0,Fy?Fy.data:void 0);E.fetchers.set(ts,BN),W.has(ts)&&at(ts),Et.controller&&W.set(ts,Et.controller)}),Pe({fetchers:new Map(E.fetchers)});let Hc=()=>An.forEach(Et=>at(Et.key));ze.signal.addEventListener("abort",Hc);let{loaderResults:Yc,fetcherResults:Zc}=await me(E.matches,Ls,vi,An,$t);if(ze.signal.aborted)return;ze.signal.removeEventListener("abort",Hc),Q.delete(U),W.delete(U),An.forEach(Et=>W.delete(Et.key));let Qe=l0([...Yc,...Zc]);if(Qe){if(Qe.idx>=vi.length){let Et=An[Qe.idx-vi.length].key;z.add(Et)}return X($t,Qe.result)}let{loaderData:It,errors:Ar}=s0(E,E.matches,vi,Yc,void 0,An,Zc,se);if(E.fetchers.has(U)){let Et=$s(dt.data);E.fetchers.set(U,Et)}qr(mi),E.navigation.state==="loading"&&mi>I?(et(R,"Expected pending action"),A&&A.abort(),nt(E.navigation.location,{matches:Ls,loaderData:It,errors:Ar,fetchers:new Map(E.fetchers)})):(Pe({errors:Ar,loaderData:o0(E.loaderData,It,Ls,Ar),fetchers:new Map(E.fetchers)}),b=!1)}async function H(U,B,G,re,xe,Ae,Ve,de){let Ge=E.fetchers.get(U);Ue(U,Za(de,Ge?Ge.data:void 0),{flushSync:Ve});let Le=new AbortController,ze=xi(e.history,G,Le.signal);if(Ae){let dt=await Bc(xe,G,ze.signal);if(dt.type==="aborted")return;if(dt.type==="error"){let{error:er}=Pn(G,dt);jt(U,B,er,{flushSync:Ve});return}else if(dt.matches)xe=dt.matches,re=sl(xe,G);else{jt(U,B,dr(404,{pathname:G}),{flushSync:Ve});return}}W.set(U,Le);let gt=Z,yt=(await ee("loader",ze,[re],xe))[0];if(Uo(yt)&&(yt=await H1(yt,ze.signal,!0)||yt),W.get(U)===Le&&W.delete(U),!ze.signal.aborted){if(ne.has(U)){Ue(U,$s(void 0));return}if($o(yt))if(I>gt){Ue(U,$s(void 0));return}else{z.add(U),await X(ze,yt);return}if(Ir(yt)){jt(U,B,yt.error);return}et(!Uo(yt),"Unhandled fetcher deferred data"),Ue(U,$s(yt.data))}}async function X(U,B,G){let{submission:re,fetcherSubmission:xe,replace:Ae}=G===void 0?{}:G;B.response.headers.has("X-Remix-Revalidate")&&(b=!0);let Ve=B.response.headers.get("Location");et(Ve,"Expected a Location header on the redirect Response"),Ve=r0(Ve,new URL(U.url),c);let de=Bl(E.location,Ve,{_isRedirect:!0});if(r){let yt=!1;if(B.response.headers.has("X-Remix-Reload-Document"))yt=!0;else if(Dg.test(Ve)){const dt=e.history.createURL(Ve);yt=dt.origin!==t.location.origin||ka(dt.pathname,c)==null}if(yt){Ae?t.location.replace(Ve):t.location.assign(Ve);return}}A=null;let Ge=Ae===!0?Vt.Replace:Vt.Push,{formMethod:Le,formAction:ze,formEncType:gt}=E.navigation;!re&&!xe&&Le&&ze&>&&(re=u0(E.navigation));let ht=re||xe;if(HR.has(B.response.status)&&ht&&hn(ht.formMethod))await K(Ge,de,{submission:Pt({},ht,{formAction:Ve}),preventScrollReset:P});else{let yt=Fh(de,re);await K(Ge,de,{overrideNavigation:yt,fetcherSubmission:xe,preventScrollReset:P})}}async function ee(U,B,G,re){try{let xe=await eP(u,U,B,G,re,o,s);return await Promise.all(xe.map((Ae,Ve)=>{if(aP(Ae)){let de=Ae.result;return{type:xt.redirect,response:nP(de,B,G[Ve].route.id,re,c,f.v7_relativeSplatPath)}}return rP(Ae)}))}catch(xe){return G.map(()=>({type:xt.error,error:xe}))}}async function me(U,B,G,re,xe){let[Ae,...Ve]=await Promise.all([G.length?ee("loader",xe,G,B):[],...re.map(de=>{if(de.matches&&de.match&&de.controller){let Ge=xi(e.history,de.path,de.controller.signal);return ee("loader",Ge,[de.match],de.matches).then(Le=>Le[0])}else return Promise.resolve({type:xt.error,error:dr(404,{pathname:de.path})})})]);return await Promise.all([c0(U,G,Ae,Ae.map(()=>xe.signal),!1,E.loaderData),c0(U,re.map(de=>de.match),Ve,re.map(de=>de.controller?de.controller.signal:null),!0)]),{loaderResults:Ae,fetcherResults:Ve}}function Ye(){b=!0,V.push(...Is()),$.forEach((U,B)=>{W.has(B)&&(te.push(B),at(B))})}function Ue(U,B,G){G===void 0&&(G={}),E.fetchers.set(U,B),Pe({fetchers:new Map(E.fetchers)},{flushSync:(G&&G.flushSync)===!0})}function jt(U,B,G,re){re===void 0&&(re={});let xe=zi(E.matches,B);Ht(U),Pe({errors:{[xe.route.id]:G},fetchers:new Map(E.fetchers)},{flushSync:(re&&re.flushSync)===!0})}function Gr(U){return f.v7_fetcherPersist&&(fe.set(U,(fe.get(U)||0)+1),ne.has(U)&&ne.delete(U)),E.fetchers.get(U)||YR}function Ht(U){let B=E.fetchers.get(U);W.has(U)&&!(B&&B.state==="loading"&&Q.has(U))&&at(U),$.delete(U),Q.delete(U),z.delete(U),ne.delete(U),E.fetchers.delete(U)}function Qn(U){if(f.v7_fetcherPersist){let B=(fe.get(U)||0)-1;B<=0?(fe.delete(U),ne.add(U)):fe.set(U,B)}else Ht(U);Pe({fetchers:new Map(E.fetchers)})}function at(U){let B=W.get(U);et(B,"Expected fetch controller: "+U),B.abort(),W.delete(U)}function Jn(U){for(let B of U){let G=Gr(B),re=$s(G.data);E.fetchers.set(B,re)}}function es(){let U=[],B=!1;for(let G of z){let re=E.fetchers.get(G);et(re,"Expected fetcher: "+G),re.state==="loading"&&(z.delete(G),U.push(G),B=!0)}return Jn(U),B}function qr(U){let B=[];for(let[G,re]of Q)if(re0}function $c(U,B){let G=E.blockers.get(U)||Ya;return Oe.get(U)!==B&&Oe.set(U,B),G}function Vc(U){E.blockers.delete(U),Oe.delete(U)}function hi(U,B){let G=E.blockers.get(U)||Ya;et(G.state==="unblocked"&&B.state==="blocked"||G.state==="blocked"&&B.state==="blocked"||G.state==="blocked"&&B.state==="proceeding"||G.state==="blocked"&&B.state==="unblocked"||G.state==="proceeding"&&B.state==="unblocked","Invalid blocker state transition: "+G.state+" -> "+B.state);let re=new Map(E.blockers);re.set(U,B),Pe({blockers:re})}function Wc(U){let{currentLocation:B,nextLocation:G,historyAction:re}=U;if(Oe.size===0)return;Oe.size>1&&ei(!1,"A router only supports one blocker at a time");let xe=Array.from(Oe.entries()),[Ae,Ve]=xe[xe.length-1],de=E.blockers.get(Ae);if(!(de&&de.state==="proceeding")&&Ve({currentLocation:B,nextLocation:G,historyAction:re}))return Ae}function pi(U){let B=dr(404,{pathname:U}),G=a||i,{matches:re,route:xe}=a0(G);return Is(),{notFoundMatches:re,route:xe,error:B}}function Pn(U,B){return{boundaryId:zi(B.partialMatches).route.id,error:dr(400,{type:"route-discovery",pathname:U,message:B.error!=null&&"message"in B.error?B.error:String(B.error)})}}function Is(U){let B=[];return se.forEach((G,re)=>{(!U||U(re))&&(G.cancel(),B.push(re),se.delete(re))}),B}function UN(U,B,G){if(x=U,_=B,g=G||null,!p&&E.navigation===Lh){p=!0;let re=Ly(E.location,E.matches);re!=null&&Pe({restoreScrollPosition:re})}return()=>{x=null,_=null,g=null}}function Iy(U,B){return g&&g(U,B.map(re=>SR(re,E.loaderData)))||U.key}function $N(U,B){if(x&&_){let G=Iy(U,B);x[G]=_()}}function Ly(U,B){if(x){let G=Iy(U,B),re=x[G];if(typeof re=="number")return re}return null}function ch(U,B,G){if(d)if(U){let re=U[U.length-1].route;if(re.path&&(re.path==="*"||re.path.endsWith("/*")))return{active:!0,matches:Fu(B,G,c,!0)}}else return{active:!0,matches:Fu(B,G,c,!0)||[]};return{active:!1,matches:null}}async function Bc(U,B,G){let re=U,xe=re.length>0?re[re.length-1].route:null;for(;;){let Ae=a==null,Ve=a||i;try{await QR(d,B,re,Ve,o,s,he,G)}catch(ze){return{type:"error",error:ze,partialMatches:re}}finally{Ae&&(i=[...i])}if(G.aborted)return{type:"aborted"};let de=Oo(Ve,B,c),Ge=!1;if(de){let ze=de[de.length-1].route;if(ze.index)return{type:"success",matches:de};if(ze.path&&ze.path.length>0)if(ze.path==="*")Ge=!0;else return{type:"success",matches:de}}let Le=Fu(Ve,B,c,!0);if(!Le||re.map(ze=>ze.route.id).join("-")===Le.map(ze=>ze.route.id).join("-"))return{type:"success",matches:Ge?de:null};if(re=Le,xe=re[re.length-1].route,xe.path==="*")return{type:"success",matches:re}}}function VN(U){o={},a=Hl(U,s,void 0,o)}function WN(U,B){let G=a==null;V1(U,B,a||i,o,s),G&&(i=[...i],Pe({}))}return j={get basename(){return c},get future(){return f},get state(){return E},get routes(){return i},get window(){return t},initialize:ke,subscribe:Me,enableScrollRestoration:UN,navigate:k,fetch:Y,revalidate:J,createHref:U=>e.history.createHref(U),encodeLocation:U=>e.history.encodeLocation(U),getFetcher:Gr,deleteFetcher:Qn,dispose:Fe,getBlocker:$c,deleteBlocker:Vc,patchRoutes:WN,_internalFetchControllers:W,_internalActiveDeferreds:se,_internalSetRoutes:VN},j}function GR(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Jp(e,t,r,n,s,o,i,a){let c,u;if(i){c=[];for(let f of t)if(c.push(f),f.route.id===i){u=f;break}}else c=t,u=t[t.length-1];let d=mf(s||".",pf(c,o),ka(e.pathname,r)||e.pathname,a==="path");return s==null&&(d.search=e.search,d.hash=e.hash),(s==null||s===""||s===".")&&u&&u.route.index&&!Og(d.search)&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),n&&r!=="/"&&(d.pathname=d.pathname==="/"?r:ms([r,d.pathname])),ti(d)}function Qx(e,t,r,n){if(!n||!GR(n))return{path:r};if(n.formMethod&&!cP(n.formMethod))return{path:r,error:dr(405,{method:n.formMethod})};let s=()=>({path:r,error:dr(400,{type:"invalid-body"})}),o=n.formMethod||"get",i=e?o.toUpperCase():o.toLowerCase(),a=W1(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!hn(i))return s();let m=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((y,x)=>{let[g,_]=x;return""+y+g+"="+_+` -`},""):String(n.body);return{path:r,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:m}}}else if(n.formEncType==="application/json"){if(!hn(i))return s();try{let m=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:m,text:void 0}}}catch{return s()}}}et(typeof FormData=="function","FormData is not available in this environment");let c,u;if(n.formData)c=em(n.formData),u=n.formData;else if(n.body instanceof FormData)c=em(n.body),u=n.body;else if(n.body instanceof URLSearchParams)c=n.body,u=n0(c);else if(n.body==null)c=new URLSearchParams,u=new FormData;else try{c=new URLSearchParams(n.body),u=n0(c)}catch{return s()}let d={formMethod:i,formAction:a,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(hn(d.formMethod))return{path:r,submission:d};let f=Ts(r);return t&&f.search&&Og(f.search)&&c.append("index",""),f.search="?"+c,{path:ti(f),submission:d}}function qR(e,t){let r=e;if(t){let n=e.findIndex(s=>s.route.id===t);n>=0&&(r=e.slice(0,n))}return r}function Jx(e,t,r,n,s,o,i,a,c,u,d,f,m,y,x,g){let _=g?Ir(g[1])?g[1].error:g[1].data:void 0,p=e.createURL(t.location),h=e.createURL(s),w=g&&Ir(g[1])?g[0]:void 0,C=w?qR(r,w):r,j=g?g[1].statusCode:void 0,E=i&&j&&j>=400,R=C.filter((A,L)=>{let{route:q}=A;if(q.lazy)return!0;if(q.loader==null)return!1;if(o)return typeof q.loader!="function"||q.loader.hydrate?!0:t.loaderData[q.id]===void 0&&(!t.errors||t.errors[q.id]===void 0);if(XR(t.loaderData,t.matches[L],A)||c.some(b=>b===A.route.id))return!0;let N=t.matches[L],F=A;return e0(A,Pt({currentUrl:p,currentParams:N.params,nextUrl:h,nextParams:F.params},n,{actionResult:_,actionStatus:j,defaultShouldRevalidate:E?!1:a||p.pathname+p.search===h.pathname+h.search||p.search!==h.search||$1(N,F)}))}),P=[];return f.forEach((A,L)=>{if(o||!r.some(V=>V.route.id===A.routeId)||d.has(L))return;let q=Oo(y,A.path,x);if(!q){P.push({key:L,routeId:A.routeId,path:A.path,matches:null,match:null,controller:null});return}let N=t.fetchers.get(L),F=sl(q,A.path),b=!1;m.has(L)?b=!1:u.includes(L)?b=!0:N&&N.state!=="idle"&&N.data===void 0?b=a:b=e0(F,Pt({currentUrl:p,currentParams:t.matches[t.matches.length-1].params,nextUrl:h,nextParams:r[r.length-1].params},n,{actionResult:_,actionStatus:j,defaultShouldRevalidate:E?!1:a})),b&&P.push({key:L,routeId:A.routeId,path:A.path,matches:q,match:F,controller:new AbortController})}),[R,P]}function XR(e,t,r){let n=!t||r.route.id!==t.route.id,s=e[r.route.id]===void 0;return n||s}function $1(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function e0(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}async function QR(e,t,r,n,s,o,i,a){let c=[t,...r.map(u=>u.route.id)].join("-");try{let u=i.get(c);u||(u=e({path:t,matches:r,patch:(d,f)=>{a.aborted||V1(d,f,n,s,o)}}),i.set(c,u)),u&&iP(u)&&await u}finally{i.delete(c)}}function V1(e,t,r,n,s){if(e){var o;let i=n[e];et(i,"No route found to patch children into: routeId = "+e);let a=Hl(t,s,[e,"patch",String(((o=i.children)==null?void 0:o.length)||"0")],n);i.children?i.children.push(...a):i.children=a}else{let i=Hl(t,s,["patch",String(r.length||"0")],n);r.push(...i)}}async function t0(e,t,r){if(!e.lazy)return;let n=await e.lazy();if(!e.lazy)return;let s=r[e.id];et(s,"No route found in manifest");let o={};for(let i in n){let c=s[i]!==void 0&&i!=="hasErrorBoundary";ei(!c,'Route "'+s.id+'" has a static property "'+i+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+i+'" will be ignored.')),!c&&!_R.has(i)&&(o[i]=n[i])}Object.assign(s,o),Object.assign(s,Pt({},t(s),{lazy:void 0}))}function JR(e){return Promise.all(e.matches.map(t=>t.resolve()))}async function eP(e,t,r,n,s,o,i,a){let c=n.reduce((f,m)=>f.add(m.route.id),new Set),u=new Set,d=await e({matches:s.map(f=>{let m=c.has(f.route.id);return Pt({},f,{shouldLoad:m,resolve:x=>(u.add(f.route.id),m?tP(t,r,f,o,i,x,a):Promise.resolve({type:xt.data,result:void 0}))})}),request:r,params:s[0].params,context:a});return s.forEach(f=>et(u.has(f.route.id),'`match.resolve()` was not called for route id "'+f.route.id+'". You must call `match.resolve()` on every match passed to `dataStrategy` to ensure all routes are properly loaded.')),d.filter((f,m)=>c.has(s[m].route.id))}async function tP(e,t,r,n,s,o,i){let a,c,u=d=>{let f,m=new Promise((g,_)=>f=_);c=()=>f(),t.signal.addEventListener("abort",c);let y=g=>typeof d!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+r.route.id+"]"))):d({request:t,params:r.params,context:i},...g!==void 0?[g]:[]),x;return o?x=o(g=>y(g)):x=(async()=>{try{return{type:"data",result:await y()}}catch(g){return{type:"error",result:g}}})(),Promise.race([x,m])};try{let d=r.route[e];if(r.route.lazy)if(d){let f,[m]=await Promise.all([u(d).catch(y=>{f=y}),t0(r.route,s,n)]);if(f!==void 0)throw f;a=m}else if(await t0(r.route,s,n),d=r.route[e],d)a=await u(d);else if(e==="action"){let f=new URL(t.url),m=f.pathname+f.search;throw dr(405,{method:t.method,pathname:m,routeId:r.route.id})}else return{type:xt.data,result:void 0};else if(d)a=await u(d);else{let f=new URL(t.url),m=f.pathname+f.search;throw dr(404,{pathname:m})}et(a.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(d){return{type:xt.error,result:d}}finally{c&&t.signal.removeEventListener("abort",c)}return a}async function rP(e){let{result:t,type:r,status:n}=e;if(B1(t)){let i;try{let a=t.headers.get("Content-Type");a&&/\bapplication\/json\b/.test(a)?t.body==null?i=null:i=await t.json():i=await t.text()}catch(a){return{type:xt.error,error:a}}return r===xt.error?{type:xt.error,error:new Ag(t.status,t.statusText,i),statusCode:t.status,headers:t.headers}:{type:xt.data,data:i,statusCode:t.status,headers:t.headers}}if(r===xt.error)return{type:xt.error,error:t,statusCode:gf(t)?t.status:n};if(lP(t)){var s,o;return{type:xt.deferred,deferredData:t,statusCode:(s=t.init)==null?void 0:s.status,headers:((o=t.init)==null?void 0:o.headers)&&new Headers(t.init.headers)}}return{type:xt.data,data:t,statusCode:n}}function nP(e,t,r,n,s,o){let i=e.headers.get("Location");if(et(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!Dg.test(i)){let a=n.slice(0,n.findIndex(c=>c.route.id===r)+1);i=Jp(new URL(t.url),a,s,!0,i,o),e.headers.set("Location",i)}return e}function r0(e,t,r){if(Dg.test(e)){let n=e,s=n.startsWith("//")?new URL(t.protocol+n):new URL(n),o=ka(s.pathname,r)!=null;if(s.origin===t.origin&&o)return s.pathname+s.search+s.hash}return e}function xi(e,t,r,n){let s=e.createURL(W1(t)).toString(),o={signal:r};if(n&&hn(n.formMethod)){let{formMethod:i,formEncType:a}=n;o.method=i.toUpperCase(),a==="application/json"?(o.headers=new Headers({"Content-Type":a}),o.body=JSON.stringify(n.json)):a==="text/plain"?o.body=n.text:a==="application/x-www-form-urlencoded"&&n.formData?o.body=em(n.formData):o.body=n.formData}return new Request(s,o)}function em(e){let t=new URLSearchParams;for(let[r,n]of e.entries())t.append(r,typeof n=="string"?n:n.name);return t}function n0(e){let t=new FormData;for(let[r,n]of e.entries())t.append(r,n);return t}function sP(e,t,r,n,s,o){let i={},a=null,c,u=!1,d={},f=n&&Ir(n[1])?n[1].error:void 0;return r.forEach((m,y)=>{let x=t[y].route.id;if(et(!$o(m),"Cannot handle redirect results in processLoaderData"),Ir(m)){let g=m.error;f!==void 0&&(g=f,f=void 0),a=a||{};{let _=zi(e,x);a[_.route.id]==null&&(a[_.route.id]=g)}i[x]=void 0,u||(u=!0,c=gf(m.error)?m.error.status:500),m.headers&&(d[x]=m.headers)}else Uo(m)?(s.set(x,m.deferredData),i[x]=m.deferredData.data,m.statusCode!=null&&m.statusCode!==200&&!u&&(c=m.statusCode),m.headers&&(d[x]=m.headers)):(i[x]=m.data,m.statusCode&&m.statusCode!==200&&!u&&(c=m.statusCode),m.headers&&(d[x]=m.headers))}),f!==void 0&&n&&(a={[n[0]]:f},i[n[0]]=void 0),{loaderData:i,errors:a,statusCode:c||200,loaderHeaders:d}}function s0(e,t,r,n,s,o,i,a){let{loaderData:c,errors:u}=sP(t,r,n,s,a);for(let d=0;dn.route.id===t)+1):[...e]).reverse().find(n=>n.route.hasErrorBoundary===!0)||e[0]}function a0(e){let t=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function dr(e,t){let{pathname:r,routeId:n,method:s,type:o,message:i}=t===void 0?{}:t,a="Unknown Server Error",c="Unknown @remix-run/router error";return e===400?(a="Bad Request",o==="route-discovery"?c='Unable to match URL "'+r+'" - the `unstable_patchRoutesOnMiss()` '+(`function threw the following error: -`+i):s&&r&&n?c="You made a "+s+' request to "'+r+'" but '+('did not provide a `loader` for route "'+n+'", ')+"so there is no way to handle the request.":o==="defer-action"?c="defer() is not supported in actions":o==="invalid-body"&&(c="Unable to encode submission body")):e===403?(a="Forbidden",c='Route "'+n+'" does not match URL "'+r+'"'):e===404?(a="Not Found",c='No route matches URL "'+r+'"'):e===405&&(a="Method Not Allowed",s&&r&&n?c="You made a "+s.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+n+'", ')+"so there is no way to handle the request.":s&&(c='Invalid request method "'+s.toUpperCase()+'"')),new Ag(e||500,a,new Error(c),!0)}function l0(e){for(let t=e.length-1;t>=0;t--){let r=e[t];if($o(r))return{result:r,idx:t}}}function W1(e){let t=typeof e=="string"?Ts(e):e;return ti(Pt({},t,{hash:""}))}function oP(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function iP(e){return typeof e=="object"&&e!=null&&"then"in e}function aP(e){return B1(e.result)&&BR.has(e.result.status)}function Uo(e){return e.type===xt.deferred}function Ir(e){return e.type===xt.error}function $o(e){return(e&&e.type)===xt.redirect}function lP(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function B1(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function cP(e){return WR.has(e.toLowerCase())}function hn(e){return $R.has(e.toLowerCase())}async function c0(e,t,r,n,s,o){for(let i=0;if.route.id===c.route.id),d=u!=null&&!$1(u,c)&&(o&&o[c.route.id])!==void 0;if(Uo(a)&&(s||d)){let f=n[i];et(f,"Expected an AbortSignal for revalidating fetcher deferred result"),await H1(a,f,s).then(m=>{m&&(r[i]=m||r[i])})}}}async function H1(e,t,r){if(r===void 0&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:xt.data,data:e.deferredData.unwrappedData}}catch(s){return{type:xt.error,error:s}}return{type:xt.data,data:e.deferredData.data}}}function Og(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function sl(e,t){let r=typeof t=="string"?Ts(t).search:t.search;if(e[e.length-1].route.index&&Og(r||""))return e[e.length-1];let n=F1(e);return n[n.length-1]}function u0(e){let{formMethod:t,formAction:r,formEncType:n,text:s,formData:o,json:i}=e;if(!(!t||!r||!n)){if(s!=null)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:void 0,text:s};if(o!=null)return{formMethod:t,formAction:r,formEncType:n,formData:o,json:void 0,text:void 0};if(i!==void 0)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:i,text:void 0}}}function Fh(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function uP(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function Za(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function dP(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function $s(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function fP(e,t){try{let r=e.sessionStorage.getItem(U1);if(r){let n=JSON.parse(r);for(let[s,o]of Object.entries(n||{}))o&&Array.isArray(o)&&t.set(s,new Set(o||[]))}}catch{}}function hP(e,t){if(t.size>0){let r={};for(let[n,s]of t)r[n]=[...s];try{e.sessionStorage.setItem(U1,JSON.stringify(r))}catch(n){ei(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}/** - * React Router v6.25.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function wd(){return wd=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),v.useCallback(function(u,d){if(d===void 0&&(d={}),!a.current)return;if(typeof u=="number"){n.go(u);return}let f=mf(u,JSON.parse(i),o,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:ms([t,f.pathname])),(d.replace?n.replace:n.push)(f,d.state,d)},[t,n,i,o,e])}const gP=v.createContext(null);function vP(e){let t=v.useContext(Rs).outlet;return t&&v.createElement(gP.Provider,{value:e},t)}function G1(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=v.useContext(Co),{matches:s}=v.useContext(Rs),{pathname:o}=Nn(),i=JSON.stringify(pf(s,n.v7_relativeSplatPath));return v.useMemo(()=>mf(e,JSON.parse(i),o,r==="path"),[e,i,o,r])}function yP(e,t,r,n){Ca()||et(!1);let{navigator:s}=v.useContext(Co),{matches:o}=v.useContext(Rs),i=o[o.length-1],a=i?i.params:{};i&&i.pathname;let c=i?i.pathnameBase:"/";i&&i.route;let u=Nn(),d;d=u;let f=d.pathname||"/",m=f;if(c!=="/"){let g=c.replace(/^\//,"").split("/");m="/"+f.replace(/^\//,"").split("/").slice(g.length).join("/")}let y=Oo(e,{pathname:m});return SP(y&&y.map(g=>Object.assign({},g,{params:Object.assign({},a,g.params),pathname:ms([c,s.encodeLocation?s.encodeLocation(g.pathname).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?c:ms([c,s.encodeLocation?s.encodeLocation(g.pathnameBase).pathname:g.pathnameBase])})),o,r,n)}function xP(){let e=EP(),t=gf(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),r?v.createElement("pre",{style:s},r):null,null)}const wP=v.createElement(xP,null);class _P extends v.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?v.createElement(Rs.Provider,{value:this.props.routeContext},v.createElement(Z1.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function bP(e){let{routeContext:t,match:r,children:n}=e,s=v.useContext(vf);return s&&s.static&&s.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=r.route.id),v.createElement(Rs.Provider,{value:t},n)}function SP(e,t,r,n){var s;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var o;if((o=r)!=null&&o.errors)e=r.matches;else return null}let i=e,a=(s=r)==null?void 0:s.errors;if(a!=null){let d=i.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);d>=0||et(!1),i=i.slice(0,Math.min(i.length,d+1))}let c=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d=0?i=i.slice(0,u+1):i=[i[0]];break}}}return i.reduceRight((d,f,m)=>{let y,x=!1,g=null,_=null;r&&(y=a&&f.route.id?a[f.route.id]:void 0,g=f.route.errorElement||wP,c&&(u<0&&m===0?(TP("route-fallback"),x=!0,_=null):u===m&&(x=!0,_=f.route.hydrateFallbackElement||null)));let p=t.concat(i.slice(0,m+1)),h=()=>{let w;return y?w=g:x?w=_:f.route.Component?w=v.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,v.createElement(bP,{match:f,routeContext:{outlet:d,matches:p,isDataRoute:r!=null},children:w})};return r&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?v.createElement(_P,{location:r.location,revalidation:r.revalidation,component:g,error:y,children:h(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):h()},null)}var q1=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(q1||{}),_d=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(_d||{});function kP(e){let t=v.useContext(vf);return t||et(!1),t}function CP(e){let t=v.useContext(Y1);return t||et(!1),t}function jP(e){let t=v.useContext(Rs);return t||et(!1),t}function X1(e){let t=jP(),r=t.matches[t.matches.length-1];return r.route.id||et(!1),r.route.id}function EP(){var e;let t=v.useContext(Z1),r=CP(_d.UseRouteError),n=X1(_d.UseRouteError);return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function NP(){let{router:e}=kP(q1.UseNavigateStable),t=X1(_d.UseNavigateStable),r=v.useRef(!1);return K1(()=>{r.current=!0}),v.useCallback(function(s,o){o===void 0&&(o={}),r.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,wd({fromRouteId:t},o)))},[e,t])}const d0={};function TP(e,t,r){d0[e]||(d0[e]=!0)}function Q1(e){let{to:t,replace:r,state:n,relative:s}=e;Ca()||et(!1);let{future:o,static:i}=v.useContext(Co),{matches:a}=v.useContext(Rs),{pathname:c}=Nn(),u=Nr(),d=mf(t,pf(a,o.v7_relativeSplatPath),c,s==="path"),f=JSON.stringify(d);return v.useEffect(()=>u(JSON.parse(f),{replace:r,state:n,relative:s}),[u,f,s,r,n]),null}function Ig(e){return vP(e.context)}function RP(e){let{basename:t="/",children:r=null,location:n,navigationType:s=Vt.Pop,navigator:o,static:i=!1,future:a}=e;Ca()&&et(!1);let c=t.replace(/^\/*/,"/"),u=v.useMemo(()=>({basename:c,navigator:o,static:i,future:wd({v7_relativeSplatPath:!1},a)}),[c,a,o,i]);typeof n=="string"&&(n=Ts(n));let{pathname:d="/",search:f="",hash:m="",state:y=null,key:x="default"}=n,g=v.useMemo(()=>{let _=ka(d,c);return _==null?null:{location:{pathname:_,search:f,hash:m,state:y,key:x},navigationType:s}},[c,d,f,m,y,x,s]);return g==null?null:v.createElement(Co.Provider,{value:u},v.createElement(Mg.Provider,{children:r,value:g}))}new Promise(()=>{});function PP(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:v.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/** - * React Router DOM v6.25.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Yl(){return Yl=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(r[s]=e[s]);return r}function DP(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function OP(e,t){return e.button===0&&(!t||t==="_self")&&!DP(e)}function tm(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(s=>[r,s]):[[r,n]])},[]))}function MP(e,t){let r=tm(e);return t&&t.forEach((n,s)=>{r.has(s)||t.getAll(s).forEach(o=>{r.append(s,o)})}),r}const IP=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],LP="6";try{window.__reactRouterVersion=LP}catch{}function FP(e,t){return KR({basename:void 0,future:Yl({},void 0,{v7_prependBasename:!0}),history:yR({window:void 0}),hydrationData:zP(),routes:e,mapRouteProperties:PP,unstable_dataStrategy:void 0,unstable_patchRoutesOnMiss:void 0,window:void 0}).initialize()}function zP(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Yl({},t,{errors:UP(t.errors)})),t}function UP(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,s]of t)if(s&&s.__type==="RouteErrorResponse")r[n]=new Ag(s.status,s.statusText,s.data,s.internal===!0);else if(s&&s.__type==="Error"){if(s.__subType){let o=window[s.__subType];if(typeof o=="function")try{let i=new o(s.message);i.stack="",r[n]=i}catch{}}if(r[n]==null){let o=new Error(s.message);o.stack="",r[n]=o}}else r[n]=s;return r}const $P=v.createContext({isTransitioning:!1}),VP=v.createContext(new Map),WP="startTransition",f0=Aw[WP],BP="flushSync",h0=vR[BP];function HP(e){f0?f0(e):e()}function Ka(e){h0?h0(e):e()}class YP{constructor(){this.status="pending",this.promise=new Promise((t,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function ZP(e){let{fallbackElement:t,router:r,future:n}=e,[s,o]=v.useState(r.state),[i,a]=v.useState(),[c,u]=v.useState({isTransitioning:!1}),[d,f]=v.useState(),[m,y]=v.useState(),[x,g]=v.useState(),_=v.useRef(new Map),{v7_startTransition:p}=n||{},h=v.useCallback(P=>{p?HP(P):P()},[p]),w=v.useCallback((P,A)=>{let{deletedFetchers:L,unstable_flushSync:q,unstable_viewTransitionOpts:N}=A;L.forEach(b=>_.current.delete(b)),P.fetchers.forEach((b,V)=>{b.data!==void 0&&_.current.set(V,b.data)});let F=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!N||F){q?Ka(()=>o(P)):h(()=>o(P));return}if(q){Ka(()=>{m&&(d&&d.resolve(),m.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:N.currentLocation,nextLocation:N.nextLocation})});let b=r.window.document.startViewTransition(()=>{Ka(()=>o(P))});b.finished.finally(()=>{Ka(()=>{f(void 0),y(void 0),a(void 0),u({isTransitioning:!1})})}),Ka(()=>y(b));return}m?(d&&d.resolve(),m.skipTransition(),g({state:P,currentLocation:N.currentLocation,nextLocation:N.nextLocation})):(a(P),u({isTransitioning:!0,flushSync:!1,currentLocation:N.currentLocation,nextLocation:N.nextLocation}))},[r.window,m,d,_,h]);v.useLayoutEffect(()=>r.subscribe(w),[r,w]),v.useEffect(()=>{c.isTransitioning&&!c.flushSync&&f(new YP)},[c]),v.useEffect(()=>{if(d&&i&&r.window){let P=i,A=d.promise,L=r.window.document.startViewTransition(async()=>{h(()=>o(P)),await A});L.finished.finally(()=>{f(void 0),y(void 0),a(void 0),u({isTransitioning:!1})}),y(L)}},[h,i,d,r.window]),v.useEffect(()=>{d&&i&&s.location.key===i.location.key&&d.resolve()},[d,m,s.location,i]),v.useEffect(()=>{!c.isTransitioning&&x&&(a(x.state),u({isTransitioning:!0,flushSync:!1,currentLocation:x.currentLocation,nextLocation:x.nextLocation}),g(void 0))},[c.isTransitioning,x]),v.useEffect(()=>{},[]);let C=v.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:P=>r.navigate(P),push:(P,A,L)=>r.navigate(P,{state:A,preventScrollReset:L==null?void 0:L.preventScrollReset}),replace:(P,A,L)=>r.navigate(P,{replace:!0,state:A,preventScrollReset:L==null?void 0:L.preventScrollReset})}),[r]),j=r.basename||"/",E=v.useMemo(()=>({router:r,navigator:C,static:!1,basename:j}),[r,C,j]),R=v.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return v.createElement(v.Fragment,null,v.createElement(vf.Provider,{value:E},v.createElement(Y1.Provider,{value:s},v.createElement(VP.Provider,{value:_.current},v.createElement($P.Provider,{value:c},v.createElement(RP,{basename:j,location:s.location,navigationType:s.historyAction,navigator:C,future:R},s.initialized||r.future.v7_partialHydration?v.createElement(KP,{routes:r.routes,future:r.future,state:s}):t))))),null)}const KP=v.memo(GP);function GP(e){let{routes:t,future:r,state:n}=e;return yP(t,void 0,n,r)}const qP=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",XP=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fr=v.forwardRef(function(t,r){let{onClick:n,relative:s,reloadDocument:o,replace:i,state:a,target:c,to:u,preventScrollReset:d,unstable_viewTransition:f}=t,m=AP(t,IP),{basename:y}=v.useContext(Co),x,g=!1;if(typeof u=="string"&&XP.test(u)&&(x=u,qP))try{let w=new URL(window.location.href),C=u.startsWith("//")?new URL(w.protocol+u):new URL(u),j=ka(C.pathname,y);C.origin===w.origin&&j!=null?u=j+C.search+C.hash:g=!0}catch{}let _=pP(u,{relative:s}),p=QP(u,{replace:i,state:a,target:c,preventScrollReset:d,relative:s,unstable_viewTransition:f});function h(w){n&&n(w),w.defaultPrevented||p(w)}return v.createElement("a",Yl({},m,{href:x||_,onClick:g||o?n:h,ref:r,target:c}))});var p0;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(p0||(p0={}));var m0;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(m0||(m0={}));function QP(e,t){let{target:r,replace:n,state:s,preventScrollReset:o,relative:i,unstable_viewTransition:a}=t===void 0?{}:t,c=Nr(),u=Nn(),d=G1(e,{relative:i});return v.useCallback(f=>{if(OP(f,r)){f.preventDefault();let m=n!==void 0?n:ti(u)===ti(d);c(e,{replace:m,state:s,preventScrollReset:o,relative:i,unstable_viewTransition:a})}},[u,c,d,n,s,r,e,o,i,a])}function JP(e){let t=v.useRef(tm(e)),r=v.useRef(!1),n=Nn(),s=v.useMemo(()=>MP(n.search,r.current?null:t.current),[n.search]),o=Nr(),i=v.useCallback((a,c)=>{const u=tm(typeof a=="function"?a(s):a);r.current=!0,o("?"+u,c)},[o,s]);return[s,i]}/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const eA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),J1=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var tA={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rA=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:o,iconNode:i,...a},c)=>v.createElement("svg",{ref:c,...tA,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:J1("lucide",s),...a},[...i.map(([u,d])=>v.createElement(u,d)),...Array.isArray(o)?o:[o]]));/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mt=(e,t)=>{const r=v.forwardRef(({className:n,...s},o)=>v.createElement(rA,{ref:o,iconNode:t,className:J1(`lucide-${eA(e)}`,n),...s}));return r.displayName=`${e}`,r};/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nA=mt("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sA=mt("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oA=mt("CalendarX2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m17 22 5-5",key:"1k6ppv"}],["path",{d:"m17 17 5 5",key:"p7ous7"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const eb=mt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Lg=mt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const iA=mt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aA=mt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lA=mt("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cA=mt("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const g0=mt("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uA=mt("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rm=mt("Earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dA=mt("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const v0=mt("Group",[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2",key:"adw53z"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2",key:"an4l38"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2",key:"144t0e"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2",key:"rtnfgi"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1",key:"1eyiv7"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1",key:"1qlmkx"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const y0=mt("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const x0=mt("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fA=mt("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hA=mt("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pA=mt("LoaderPinwheel",[["path",{d:"M2 12c0-2.8 2.2-5 5-5s5 2.2 5 5 2.2 5 5 5 5-2.2 5-5",key:"1cg5zf"}],["path",{d:"M7 20.7a1 1 0 1 1 5-8.7 1 1 0 1 0 5-8.6",key:"1gnrpi"}],["path",{d:"M7 3.3a1 1 0 1 1 5 8.6 1 1 0 1 0 5 8.6",key:"u9yy5q"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mA=mt("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gA=mt("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vA=mt("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zu=mt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const w0=mt("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tb=mt("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yA=mt("SquareSigma",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M16 8.9V7H8l4 5-4 5h8v-1.9",key:"9nih0i"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xA=mt("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wA=mt("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/** - * @license lucide-react v0.417.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Fg=mt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function _A(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function yf(...e){return t=>e.forEach(r=>_A(r,t))}function Ke(...e){return v.useCallback(yf(...e),e)}var bs=v.forwardRef((e,t)=>{const{children:r,...n}=e,s=v.Children.toArray(r),o=s.find(bA);if(o){const i=o.props.children,a=s.map(c=>c===o?v.Children.count(i)>1?v.Children.only(null):v.isValidElement(i)?i.props.children:null:c);return l.jsx(nm,{...n,ref:t,children:v.isValidElement(i)?v.cloneElement(i,void 0,a):null})}return l.jsx(nm,{...n,ref:t,children:r})});bs.displayName="Slot";var nm=v.forwardRef((e,t)=>{const{children:r,...n}=e;if(v.isValidElement(r)){const s=kA(r);return v.cloneElement(r,{...SA(n,r.props),ref:t?yf(t,s):s})}return v.Children.count(r)>1?v.Children.only(null):null});nm.displayName="SlotClone";var zg=({children:e})=>l.jsx(l.Fragment,{children:e});function bA(e){return v.isValidElement(e)&&e.type===zg}function SA(e,t){const r={...t};for(const n in t){const s=e[n],o=t[n];/^on[A-Z]/.test(n)?s&&o?r[n]=(...a)=>{o(...a),s(...a)}:s&&(r[n]=s):n==="style"?r[n]={...s,...o}:n==="className"&&(r[n]=[s,o].filter(Boolean).join(" "))}return{...e,...r}}function kA(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function rb(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;ttypeof e=="boolean"?"".concat(e):e===0?"0":e,b0=CA,_c=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return b0(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(u=>{const d=r==null?void 0:r[u],f=o==null?void 0:o[u];if(d===null)return null;const m=_0(d)||_0(f);return s[u][m]}),a=r&&Object.entries(r).reduce((u,d)=>{let[f,m]=d;return m===void 0||(u[f]=m),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:f,className:m,...y}=d;return Object.entries(y).every(x=>{let[g,_]=x;return Array.isArray(_)?_.includes({...o,...a}[g]):{...o,...a}[g]===_})?[...u,f,m]:u},[]);return b0(e,i,c,r==null?void 0:r.class,r==null?void 0:r.className)};function nb(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;ta(o)))==null?void 0:i.classGroupId}const S0=/^\[(.+)\]$/;function NA(e){if(S0.test(e)){const t=S0.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}}function TA(e){const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return PA(Object.entries(e.classGroups),r).forEach(([o,i])=>{sm(i,n,o,t)}),n}function sm(e,t,r,n){e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:k0(t,s);o.classGroupId=r;return}if(typeof s=="function"){if(RA(s)){sm(s(n),t,r,n);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([o,i])=>{sm(i,k0(t,o),r,n)})})}function k0(e,t){let r=e;return t.split(Ug).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r}function RA(e){return e.isThemeGetter}function PA(e,t){return t?e.map(([r,n])=>{const s=n.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,a])=>[t+i,a])):o);return[r,s]}):e}function AA(e){if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;function s(o,i){r.set(o,i),t++,t>e&&(t=0,n=r,r=new Map)}return{get(o){let i=r.get(o);if(i!==void 0)return i;if((i=n.get(o))!==void 0)return s(o,i),i},set(o,i){r.has(o)?r.set(o,i):s(o,i)}}}const ob="!";function DA(e){const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,s=t[0],o=t.length;function i(a){const c=[];let u=0,d=0,f;for(let _=0;_d?f-d:void 0;return{modifiers:c,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:g}}return r?function(c){return r({className:c,parseClassName:i})}:i}function OA(e){if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t}function MA(e){return{cache:AA(e.cacheSize),parseClassName:DA(e),...EA(e)}}const IA=/\s+/;function LA(e,t){const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=t,o=new Set;return e.trim().split(IA).map(i=>{const{modifiers:a,hasImportantModifier:c,baseClassName:u,maybePostfixModifierPosition:d}=r(i);let f=!!d,m=n(f?u.substring(0,d):u);if(!m){if(!f)return{isTailwindClass:!1,originalClassName:i};if(m=n(u),!m)return{isTailwindClass:!1,originalClassName:i};f=!1}const y=OA(a).join(":");return{isTailwindClass:!0,modifierId:c?y+ob:y,classGroupId:m,originalClassName:i,hasPostfixModifier:f}}).reverse().filter(i=>{if(!i.isTailwindClass)return!0;const{modifierId:a,classGroupId:c,hasPostfixModifier:u}=i,d=a+c;return o.has(d)?!1:(o.add(d),s(c,u).forEach(f=>o.add(a+f)),!0)}).reverse().map(i=>i.originalClassName).join(" ")}function FA(){let e=0,t,r,n="";for(;ef(d),e());return r=MA(u),n=r.cache.get,s=r.cache.set,o=a,a(c)}function a(c){const u=n(c);if(u)return u;const d=LA(c,r);return s(c,d),d}return function(){return o(FA.apply(null,arguments))}}function _t(e){const t=r=>r[e]||[];return t.isThemeGetter=!0,t}const ab=/^\[(?:([a-z-]+):)?(.+)\]$/i,UA=/^\d+\/\d+$/,$A=new Set(["px","full","screen"]),VA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,WA=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,BA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,HA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,YA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function rs(e){return Vo(e)||$A.has(e)||UA.test(e)}function zs(e){return ja(e,"length",eD)}function Vo(e){return!!e&&!Number.isNaN(Number(e))}function fu(e){return ja(e,"number",Vo)}function Ga(e){return!!e&&Number.isInteger(Number(e))}function ZA(e){return e.endsWith("%")&&Vo(e.slice(0,-1))}function qe(e){return ab.test(e)}function Us(e){return VA.test(e)}const KA=new Set(["length","size","percentage"]);function GA(e){return ja(e,KA,lb)}function qA(e){return ja(e,"position",lb)}const XA=new Set(["image","url"]);function QA(e){return ja(e,XA,rD)}function JA(e){return ja(e,"",tD)}function qa(){return!0}function ja(e,t,r){const n=ab.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1}function eD(e){return WA.test(e)&&!BA.test(e)}function lb(){return!1}function tD(e){return HA.test(e)}function rD(e){return YA.test(e)}function nD(){const e=_t("colors"),t=_t("spacing"),r=_t("blur"),n=_t("brightness"),s=_t("borderColor"),o=_t("borderRadius"),i=_t("borderSpacing"),a=_t("borderWidth"),c=_t("contrast"),u=_t("grayscale"),d=_t("hueRotate"),f=_t("invert"),m=_t("gap"),y=_t("gradientColorStops"),x=_t("gradientColorStopPositions"),g=_t("inset"),_=_t("margin"),p=_t("opacity"),h=_t("padding"),w=_t("saturate"),C=_t("scale"),j=_t("sepia"),E=_t("skew"),R=_t("space"),P=_t("translate"),A=()=>["auto","contain","none"],L=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto",qe,t],N=()=>[qe,t],F=()=>["",rs,zs],b=()=>["auto",Vo,qe],V=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],te=()=>["solid","dashed","dotted","double","none"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>["start","end","center","between","around","evenly","stretch"],I=()=>["","0",qe],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>[Vo,fu],$=()=>[Vo,qe];return{cacheSize:500,separator:":",theme:{colors:[qa],spacing:[rs,zs],blur:["none","",Us,qe],brightness:z(),borderColor:[e],borderRadius:["none","","full",Us,qe],borderSpacing:N(),borderWidth:F(),contrast:z(),grayscale:I(),hueRotate:$(),invert:I(),gap:N(),gradientColorStops:[e],gradientColorStopPositions:[ZA,zs],inset:q(),margin:q(),opacity:z(),padding:N(),saturate:z(),scale:z(),sepia:I(),skew:$(),space:N(),translate:N()},classGroups:{aspect:[{aspect:["auto","square","video",qe]}],container:["container"],columns:[{columns:[Us]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...V(),qe]}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ga,qe]}],basis:[{basis:q()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",qe]}],grow:[{grow:I()}],shrink:[{shrink:I()}],order:[{order:["first","last","none",Ga,qe]}],"grid-cols":[{"grid-cols":[qa]}],"col-start-end":[{col:["auto",{span:["full",Ga,qe]},qe]}],"col-start":[{"col-start":b()}],"col-end":[{"col-end":b()}],"grid-rows":[{"grid-rows":[qa]}],"row-start-end":[{row:["auto",{span:[Ga,qe]},qe]}],"row-start":[{"row-start":b()}],"row-end":[{"row-end":b()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",qe]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",qe]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...Z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[h]}],px:[{px:[h]}],py:[{py:[h]}],ps:[{ps:[h]}],pe:[{pe:[h]}],pt:[{pt:[h]}],pr:[{pr:[h]}],pb:[{pb:[h]}],pl:[{pl:[h]}],m:[{m:[_]}],mx:[{mx:[_]}],my:[{my:[_]}],ms:[{ms:[_]}],me:[{me:[_]}],mt:[{mt:[_]}],mr:[{mr:[_]}],mb:[{mb:[_]}],ml:[{ml:[_]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",qe,t]}],"min-w":[{"min-w":[qe,t,"min","max","fit"]}],"max-w":[{"max-w":[qe,t,"none","full","min","max","fit","prose",{screen:[Us]},Us]}],h:[{h:[qe,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[qe,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[qe,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[qe,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Us,zs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",fu]}],"font-family":[{font:[qa]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",qe]}],"line-clamp":[{"line-clamp":["none",Vo,fu]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",rs,qe]}],"list-image":[{"list-image":["none",qe]}],"list-style-type":[{list:["none","disc","decimal",qe]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[p]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[p]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",rs,zs]}],"underline-offset":[{"underline-offset":["auto",rs,qe]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",qe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",qe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[p]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...V(),qA]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",GA]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},QA]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[p]}],"border-style":[{border:[...te(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[p]}],"divide-style":[{divide:te()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...te()]}],"outline-offset":[{"outline-offset":[rs,qe]}],"outline-w":[{outline:[rs,zs]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[p]}],"ring-offset-w":[{"ring-offset":[rs,zs]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Us,JA]}],"shadow-color":[{shadow:[qa]}],opacity:[{opacity:[p]}],"mix-blend":[{"mix-blend":[...W(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":W()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Us,qe]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[j]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[p]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[j]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",qe]}],duration:[{duration:$()}],ease:[{ease:["linear","in","out","in-out",qe]}],delay:[{delay:$()}],animate:[{animate:["none","spin","ping","pulse","bounce",qe]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[Ga,qe]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",qe]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",qe]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",qe]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[rs,zs,fu]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const sD=zA(nD);function ae(...e){return sD(jA(e))}const xf=_c("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),He=v.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...s},o)=>{const i=n?bs:"button";return l.jsx(i,{className:ae(xf({variant:t,size:r,className:e})),ref:o,...s})});He.displayName="Button";function ce(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e==null||e(s),r===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function oD(e,t){const r=v.createContext(t);function n(o){const{children:i,...a}=o,c=v.useMemo(()=>a,Object.values(a));return l.jsx(r.Provider,{value:c,children:i})}function s(o){const i=v.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return n.displayName=e+"Provider",[n,s]}function xr(e,t=[]){let r=[];function n(o,i){const a=v.createContext(i),c=r.length;r=[...r,i];function u(f){const{scope:m,children:y,...x}=f,g=(m==null?void 0:m[e][c])||a,_=v.useMemo(()=>x,Object.values(x));return l.jsx(g.Provider,{value:_,children:y})}function d(f,m){const y=(m==null?void 0:m[e][c])||a,x=v.useContext(y);if(x)return x;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const s=()=>{const o=r.map(i=>v.createContext(i));return function(a){const c=(a==null?void 0:a[e])||o;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return s.scopeName=e,[n,iD(s,...t)]}function iD(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=n.reduce((a,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...a,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}function Dt(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function on({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,s]=aD({defaultProp:t,onChange:r}),o=e!==void 0,i=o?e:n,a=Dt(r),c=v.useCallback(u=>{if(o){const f=typeof u=="function"?u(e):u;f!==e&&a(f)}else s(u)},[o,e,s,a]);return[i,c]}function aD({defaultProp:e,onChange:t}){const r=v.useState(e),[n]=r,s=v.useRef(n),o=Dt(t);return v.useEffect(()=>{s.current!==n&&(o(n),s.current=n)},[n,s,o]),r}var lD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Re=lD.reduce((e,t)=>{const r=v.forwardRef((n,s)=>{const{asChild:o,...i}=n,a=o?bs:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...i,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function $g(e,t){e&&Ns.flushSync(()=>e.dispatchEvent(t))}function bc(e){const t=e+"CollectionProvider",[r,n]=xr(t),[s,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=y=>{const{scope:x,children:g}=y,_=We.useRef(null),p=We.useRef(new Map).current;return l.jsx(s,{scope:x,itemMap:p,collectionRef:_,children:g})};i.displayName=t;const a=e+"CollectionSlot",c=We.forwardRef((y,x)=>{const{scope:g,children:_}=y,p=o(a,g),h=Ke(x,p.collectionRef);return l.jsx(bs,{ref:h,children:_})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=We.forwardRef((y,x)=>{const{scope:g,children:_,...p}=y,h=We.useRef(null),w=Ke(x,h),C=o(u,g);return We.useEffect(()=>(C.itemMap.set(h,{ref:h,...p}),()=>void C.itemMap.delete(h))),l.jsx(bs,{[d]:"",ref:w,children:_})});f.displayName=u;function m(y){const x=o(e+"CollectionConsumer",y);return We.useCallback(()=>{const _=x.collectionRef.current;if(!_)return[];const p=Array.from(_.querySelectorAll(`[${d}]`));return Array.from(x.itemMap.values()).sort((C,j)=>p.indexOf(C.ref.current)-p.indexOf(j.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:c,ItemSlot:f},m,n]}var cD=v.createContext(void 0);function Ea(e){const t=v.useContext(cD);return e||t||"ltr"}function uD(e,t=globalThis==null?void 0:globalThis.document){const r=Dt(e);v.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var dD="DismissableLayer",om="dismissableLayer.update",fD="dismissableLayer.pointerDownOutside",hD="dismissableLayer.focusOutside",C0,cb=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Na=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:a,...c}=e,u=v.useContext(cb),[d,f]=v.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=v.useState({}),x=Ke(t,R=>f(R)),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),p=g.indexOf(_),h=d?g.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,C=h>=p,j=mD(R=>{const P=R.target,A=[...u.branches].some(L=>L.contains(P));!C||A||(s==null||s(R),i==null||i(R),R.defaultPrevented||a==null||a())},m),E=gD(R=>{const P=R.target;[...u.branches].some(L=>L.contains(P))||(o==null||o(R),i==null||i(R),R.defaultPrevented||a==null||a())},m);return uD(R=>{h===u.layers.size-1&&(n==null||n(R),!R.defaultPrevented&&a&&(R.preventDefault(),a()))},m),v.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(C0=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),j0(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=C0)}},[d,m,r,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),j0())},[d,u]),v.useEffect(()=>{const R=()=>y({});return document.addEventListener(om,R),()=>document.removeEventListener(om,R)},[]),l.jsx(Re.div,{...c,ref:x,style:{pointerEvents:w?C?"auto":"none":void 0,...e.style},onFocusCapture:ce(e.onFocusCapture,E.onFocusCapture),onBlurCapture:ce(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:ce(e.onPointerDownCapture,j.onPointerDownCapture)})});Na.displayName=dD;var pD="DismissableLayerBranch",ub=v.forwardRef((e,t)=>{const r=v.useContext(cb),n=v.useRef(null),s=Ke(t,n);return v.useEffect(()=>{const o=n.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),l.jsx(Re.div,{...e,ref:s})});ub.displayName=pD;function mD(e,t=globalThis==null?void 0:globalThis.document){const r=Dt(e),n=v.useRef(!1),s=v.useRef(()=>{});return v.useEffect(()=>{const o=a=>{if(a.target&&!n.current){let c=function(){db(fD,r,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);n.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function gD(e,t=globalThis==null?void 0:globalThis.document){const r=Dt(e),n=v.useRef(!1);return v.useEffect(()=>{const s=o=>{o.target&&!n.current&&db(hD,r,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function j0(){const e=new CustomEvent(om);document.dispatchEvent(e)}function db(e,t,r,{discrete:n}){const s=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?$g(s,o):s.dispatchEvent(o)}var vD=Na,yD=ub,zh=0;function Vg(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??E0()),document.body.insertAdjacentElement("beforeend",e[1]??E0()),zh++,()=>{zh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),zh--}},[])}function E0(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var Uh="focusScope.autoFocusOnMount",$h="focusScope.autoFocusOnUnmount",N0={bubbles:!1,cancelable:!0},xD="FocusScope",wf=v.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[a,c]=v.useState(null),u=Dt(s),d=Dt(o),f=v.useRef(null),m=Ke(t,g=>c(g)),y=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(n){let g=function(w){if(y.paused||!a)return;const C=w.target;a.contains(C)?f.current=C:Vs(f.current,{select:!0})},_=function(w){if(y.paused||!a)return;const C=w.relatedTarget;C!==null&&(a.contains(C)||Vs(f.current,{select:!0}))},p=function(w){if(document.activeElement===document.body)for(const j of w)j.removedNodes.length>0&&Vs(a)};document.addEventListener("focusin",g),document.addEventListener("focusout",_);const h=new MutationObserver(p);return a&&h.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",_),h.disconnect()}}},[n,a,y.paused]),v.useEffect(()=>{if(a){R0.add(y);const g=document.activeElement;if(!a.contains(g)){const p=new CustomEvent(Uh,N0);a.addEventListener(Uh,u),a.dispatchEvent(p),p.defaultPrevented||(wD(CD(fb(a)),{select:!0}),document.activeElement===g&&Vs(a))}return()=>{a.removeEventListener(Uh,u),setTimeout(()=>{const p=new CustomEvent($h,N0);a.addEventListener($h,d),a.dispatchEvent(p),p.defaultPrevented||Vs(g??document.body,{select:!0}),a.removeEventListener($h,d),R0.remove(y)},0)}}},[a,u,d,y]);const x=v.useCallback(g=>{if(!r&&!n||y.paused)return;const _=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,p=document.activeElement;if(_&&p){const h=g.currentTarget,[w,C]=_D(h);w&&C?!g.shiftKey&&p===C?(g.preventDefault(),r&&Vs(w,{select:!0})):g.shiftKey&&p===w&&(g.preventDefault(),r&&Vs(C,{select:!0})):p===h&&g.preventDefault()}},[r,n,y.paused]);return l.jsx(Re.div,{tabIndex:-1,...i,ref:m,onKeyDown:x})});wf.displayName=xD;function wD(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Vs(n,{select:t}),document.activeElement!==r)return}function _D(e){const t=fb(e),r=T0(t,e),n=T0(t.reverse(),e);return[r,n]}function fb(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function T0(e,t){for(const r of e)if(!bD(r,{upTo:t}))return r}function bD(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function SD(e){return e instanceof HTMLInputElement&&"select"in e}function Vs(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&SD(e)&&t&&e.select()}}var R0=kD();function kD(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=P0(e,t),e.unshift(t)},remove(t){var r;e=P0(e,t),(r=e[0])==null||r.resume()}}}function P0(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function CD(e){return e.filter(t=>t.tagName!=="A")}var Jt=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},jD=Aw.useId||(()=>{}),ED=0;function Ur(e){const[t,r]=v.useState(jD());return Jt(()=>{r(n=>n??String(ED++))},[e]),t?`radix-${t}`:""}const ND=["top","right","bottom","left"],zn=Math.min,Lr=Math.max,bd=Math.round,hu=Math.floor,po=e=>({x:e,y:e}),TD={left:"right",right:"left",bottom:"top",top:"bottom"},RD={start:"end",end:"start"};function im(e,t,r){return Lr(e,zn(t,r))}function Ss(e,t){return typeof e=="function"?e(t):e}function ks(e){return e.split("-")[0]}function Ta(e){return e.split("-")[1]}function Wg(e){return e==="x"?"y":"x"}function Bg(e){return e==="y"?"height":"width"}function mo(e){return["top","bottom"].includes(ks(e))?"y":"x"}function Hg(e){return Wg(mo(e))}function PD(e,t,r){r===void 0&&(r=!1);const n=Ta(e),s=Hg(e),o=Bg(s);let i=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Sd(i)),[i,Sd(i)]}function AD(e){const t=Sd(e);return[am(e),t,am(t)]}function am(e){return e.replace(/start|end/g,t=>RD[t])}function DD(e,t,r){const n=["left","right"],s=["right","left"],o=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return r?t?s:n:t?n:s;case"left":case"right":return t?o:i;default:return[]}}function OD(e,t,r,n){const s=Ta(e);let o=DD(ks(e),r==="start",n);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(am)))),o}function Sd(e){return e.replace(/left|right|bottom|top/g,t=>TD[t])}function MD(e){return{top:0,right:0,bottom:0,left:0,...e}}function hb(e){return typeof e!="number"?MD(e):{top:e,right:e,bottom:e,left:e}}function kd(e){const{x:t,y:r,width:n,height:s}=e;return{width:n,height:s,top:r,left:t,right:t+n,bottom:r+s,x:t,y:r}}function A0(e,t,r){let{reference:n,floating:s}=e;const o=mo(t),i=Hg(t),a=Bg(i),c=ks(t),u=o==="y",d=n.x+n.width/2-s.width/2,f=n.y+n.height/2-s.height/2,m=n[a]/2-s[a]/2;let y;switch(c){case"top":y={x:d,y:n.y-s.height};break;case"bottom":y={x:d,y:n.y+n.height};break;case"right":y={x:n.x+n.width,y:f};break;case"left":y={x:n.x-s.width,y:f};break;default:y={x:n.x,y:n.y}}switch(Ta(t)){case"start":y[i]-=m*(r&&u?-1:1);break;case"end":y[i]+=m*(r&&u?-1:1);break}return y}const ID=async(e,t,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:o=[],platform:i}=r,a=o.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:f}=A0(u,n,c),m=n,y={},x=0;for(let g=0;g({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:s,rects:o,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=Ss(e,t)||{};if(u==null)return{};const f=hb(d),m={x:r,y:n},y=Hg(s),x=Bg(y),g=await i.getDimensions(u),_=y==="y",p=_?"top":"left",h=_?"bottom":"right",w=_?"clientHeight":"clientWidth",C=o.reference[x]+o.reference[y]-m[y]-o.floating[x],j=m[y]-o.reference[y],E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let R=E?E[w]:0;(!R||!await(i.isElement==null?void 0:i.isElement(E)))&&(R=a.floating[w]||o.floating[x]);const P=C/2-j/2,A=R/2-g[x]/2-1,L=zn(f[p],A),q=zn(f[h],A),N=L,F=R-g[x]-q,b=R/2-g[x]/2+P,V=im(N,b,F),te=!c.arrow&&Ta(s)!=null&&b!==V&&o.reference[x]/2-(bb<=0)){var q,N;const b=(((q=o.flip)==null?void 0:q.index)||0)+1,V=R[b];if(V)return{data:{index:b,overflows:L},reset:{placement:V}};let te=(N=L.filter(W=>W.overflows[0]<=0).sort((W,Z)=>W.overflows[1]-Z.overflows[1])[0])==null?void 0:N.placement;if(!te)switch(y){case"bestFit":{var F;const W=(F=L.filter(Z=>{if(E){const I=mo(Z.placement);return I===h||I==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(I=>I>0).reduce((I,Q)=>I+Q,0)]).sort((Z,I)=>Z[1]-I[1])[0])==null?void 0:F[0];W&&(te=W);break}case"initialPlacement":te=a;break}if(s!==te)return{reset:{placement:te}}}return{}}}};function D0(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function O0(e){return ND.some(t=>e[t]>=0)}const zD=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...s}=Ss(e,t);switch(n){case"referenceHidden":{const o=await Zl(t,{...s,elementContext:"reference"}),i=D0(o,r.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:O0(i)}}}case"escaped":{const o=await Zl(t,{...s,altBoundary:!0}),i=D0(o,r.floating);return{data:{escapedOffsets:i,escaped:O0(i)}}}default:return{}}}}};async function UD(e,t){const{placement:r,platform:n,elements:s}=e,o=await(n.isRTL==null?void 0:n.isRTL(s.floating)),i=ks(r),a=Ta(r),c=mo(r)==="y",u=["left","top"].includes(i)?-1:1,d=o&&c?-1:1,f=Ss(t,e);let{mainAxis:m,crossAxis:y,alignmentAxis:x}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof x=="number"&&(y=a==="end"?x*-1:x),c?{x:y*d,y:m*u}:{x:m*u,y:y*d}}const $D=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:s,y:o,placement:i,middlewareData:a}=t,c=await UD(t,e);return i===((r=a.offset)==null?void 0:r.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:i}}}}},VD=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:a={fn:_=>{let{x:p,y:h}=_;return{x:p,y:h}}},...c}=Ss(e,t),u={x:r,y:n},d=await Zl(t,c),f=mo(ks(s)),m=Wg(f);let y=u[m],x=u[f];if(o){const _=m==="y"?"top":"left",p=m==="y"?"bottom":"right",h=y+d[_],w=y-d[p];y=im(h,y,w)}if(i){const _=f==="y"?"top":"left",p=f==="y"?"bottom":"right",h=x+d[_],w=x-d[p];x=im(h,x,w)}const g=a.fn({...t,[m]:y,[f]:x});return{...g,data:{x:g.x-r,y:g.y-n}}}}},WD=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:s,rects:o,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Ss(e,t),d={x:r,y:n},f=mo(s),m=Wg(f);let y=d[m],x=d[f];const g=Ss(a,t),_=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const w=m==="y"?"height":"width",C=o.reference[m]-o.floating[w]+_.mainAxis,j=o.reference[m]+o.reference[w]-_.mainAxis;yj&&(y=j)}if(u){var p,h;const w=m==="y"?"width":"height",C=["top","left"].includes(ks(s)),j=o.reference[f]-o.floating[w]+(C&&((p=i.offset)==null?void 0:p[f])||0)+(C?0:_.crossAxis),E=o.reference[f]+o.reference[w]+(C?0:((h=i.offset)==null?void 0:h[f])||0)-(C?_.crossAxis:0);xE&&(x=E)}return{[m]:y,[f]:x}}}},BD=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:r,rects:n,platform:s,elements:o}=t,{apply:i=()=>{},...a}=Ss(e,t),c=await Zl(t,a),u=ks(r),d=Ta(r),f=mo(r)==="y",{width:m,height:y}=n.floating;let x,g;u==="top"||u==="bottom"?(x=u,g=d===(await(s.isRTL==null?void 0:s.isRTL(o.floating))?"start":"end")?"left":"right"):(g=u,x=d==="end"?"top":"bottom");const _=y-c.top-c.bottom,p=m-c.left-c.right,h=zn(y-c[x],_),w=zn(m-c[g],p),C=!t.middlewareData.shift;let j=h,E=w;if(f?E=d||C?zn(w,p):p:j=d||C?zn(h,_):_,C&&!d){const P=Lr(c.left,0),A=Lr(c.right,0),L=Lr(c.top,0),q=Lr(c.bottom,0);f?E=m-2*(P!==0||A!==0?P+A:Lr(c.left,c.right)):j=y-2*(L!==0||q!==0?L+q:Lr(c.top,c.bottom))}await i({...t,availableWidth:E,availableHeight:j});const R=await s.getDimensions(o.floating);return m!==R.width||y!==R.height?{reset:{rects:!0}}:{}}}};function Ra(e){return pb(e)?(e.nodeName||"").toLowerCase():"#document"}function $r(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ps(e){var t;return(t=(pb(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function pb(e){return e instanceof Node||e instanceof $r(e).Node}function Sn(e){return e instanceof Element||e instanceof $r(e).Element}function Bn(e){return e instanceof HTMLElement||e instanceof $r(e).HTMLElement}function M0(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof $r(e).ShadowRoot}function Sc(e){const{overflow:t,overflowX:r,overflowY:n,display:s}=kn(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(s)}function HD(e){return["table","td","th"].includes(Ra(e))}function _f(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Yg(e){const t=Zg(),r=Sn(e)?kn(e):e;return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function YD(e){let t=go(e);for(;Bn(t)&&!pa(t);){if(Yg(t))return t;if(_f(t))return null;t=go(t)}return null}function Zg(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function pa(e){return["html","body","#document"].includes(Ra(e))}function kn(e){return $r(e).getComputedStyle(e)}function bf(e){return Sn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function go(e){if(Ra(e)==="html")return e;const t=e.assignedSlot||e.parentNode||M0(e)&&e.host||Ps(e);return M0(t)?t.host:t}function mb(e){const t=go(e);return pa(t)?e.ownerDocument?e.ownerDocument.body:e.body:Bn(t)&&Sc(t)?t:mb(t)}function Kl(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=mb(e),o=s===((n=e.ownerDocument)==null?void 0:n.body),i=$r(s);return o?t.concat(i,i.visualViewport||[],Sc(s)?s:[],i.frameElement&&r?Kl(i.frameElement):[]):t.concat(s,Kl(s,[],r))}function gb(e){const t=kn(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const s=Bn(e),o=s?e.offsetWidth:r,i=s?e.offsetHeight:n,a=bd(r)!==o||bd(n)!==i;return a&&(r=o,n=i),{width:r,height:n,$:a}}function Kg(e){return Sn(e)?e:e.contextElement}function qi(e){const t=Kg(e);if(!Bn(t))return po(1);const r=t.getBoundingClientRect(),{width:n,height:s,$:o}=gb(t);let i=(o?bd(r.width):r.width)/n,a=(o?bd(r.height):r.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const ZD=po(0);function vb(e){const t=$r(e);return!Zg()||!t.visualViewport?ZD:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function KD(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==$r(e)?!1:t}function ri(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),o=Kg(e);let i=po(1);t&&(n?Sn(n)&&(i=qi(n)):i=qi(e));const a=KD(o,r,n)?vb(o):po(0);let c=(s.left+a.x)/i.x,u=(s.top+a.y)/i.y,d=s.width/i.x,f=s.height/i.y;if(o){const m=$r(o),y=n&&Sn(n)?$r(n):n;let x=m,g=x.frameElement;for(;g&&n&&y!==x;){const _=qi(g),p=g.getBoundingClientRect(),h=kn(g),w=p.left+(g.clientLeft+parseFloat(h.paddingLeft))*_.x,C=p.top+(g.clientTop+parseFloat(h.paddingTop))*_.y;c*=_.x,u*=_.y,d*=_.x,f*=_.y,c+=w,u+=C,x=$r(g),g=x.frameElement}}return kd({width:d,height:f,x:c,y:u})}function GD(e){let{elements:t,rect:r,offsetParent:n,strategy:s}=e;const o=s==="fixed",i=Ps(n),a=t?_f(t.floating):!1;if(n===i||a&&o)return r;let c={scrollLeft:0,scrollTop:0},u=po(1);const d=po(0),f=Bn(n);if((f||!f&&!o)&&((Ra(n)!=="body"||Sc(i))&&(c=bf(n)),Bn(n))){const m=ri(n);u=qi(n),d.x=m.x+n.clientLeft,d.y=m.y+n.clientTop}return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+d.x,y:r.y*u.y-c.scrollTop*u.y+d.y}}function qD(e){return Array.from(e.getClientRects())}function yb(e){return ri(Ps(e)).left+bf(e).scrollLeft}function XD(e){const t=Ps(e),r=bf(e),n=e.ownerDocument.body,s=Lr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=Lr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+yb(e);const a=-r.scrollTop;return kn(n).direction==="rtl"&&(i+=Lr(t.clientWidth,n.clientWidth)-s),{width:s,height:o,x:i,y:a}}function QD(e,t){const r=$r(e),n=Ps(e),s=r.visualViewport;let o=n.clientWidth,i=n.clientHeight,a=0,c=0;if(s){o=s.width,i=s.height;const u=Zg();(!u||u&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:o,height:i,x:a,y:c}}function JD(e,t){const r=ri(e,!0,t==="fixed"),n=r.top+e.clientTop,s=r.left+e.clientLeft,o=Bn(e)?qi(e):po(1),i=e.clientWidth*o.x,a=e.clientHeight*o.y,c=s*o.x,u=n*o.y;return{width:i,height:a,x:c,y:u}}function I0(e,t,r){let n;if(t==="viewport")n=QD(e,r);else if(t==="document")n=XD(Ps(e));else if(Sn(t))n=JD(t,r);else{const s=vb(e);n={...t,x:t.x-s.x,y:t.y-s.y}}return kd(n)}function xb(e,t){const r=go(e);return r===t||!Sn(r)||pa(r)?!1:kn(r).position==="fixed"||xb(r,t)}function eO(e,t){const r=t.get(e);if(r)return r;let n=Kl(e,[],!1).filter(a=>Sn(a)&&Ra(a)!=="body"),s=null;const o=kn(e).position==="fixed";let i=o?go(e):e;for(;Sn(i)&&!pa(i);){const a=kn(i),c=Yg(i);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||Sc(i)&&!c&&xb(e,i))?n=n.filter(d=>d!==i):s=a,i=go(i)}return t.set(e,n),n}function tO(e){let{element:t,boundary:r,rootBoundary:n,strategy:s}=e;const i=[...r==="clippingAncestors"?_f(t)?[]:eO(t,this._c):[].concat(r),n],a=i[0],c=i.reduce((u,d)=>{const f=I0(t,d,s);return u.top=Lr(f.top,u.top),u.right=zn(f.right,u.right),u.bottom=zn(f.bottom,u.bottom),u.left=Lr(f.left,u.left),u},I0(t,a,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function rO(e){const{width:t,height:r}=gb(e);return{width:t,height:r}}function nO(e,t,r){const n=Bn(t),s=Ps(t),o=r==="fixed",i=ri(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=po(0);if(n||!n&&!o)if((Ra(t)!=="body"||Sc(s))&&(a=bf(t)),n){const f=ri(t,!0,o,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else s&&(c.x=yb(s));const u=i.left+a.scrollLeft-c.x,d=i.top+a.scrollTop-c.y;return{x:u,y:d,width:i.width,height:i.height}}function Vh(e){return kn(e).position==="static"}function L0(e,t){return!Bn(e)||kn(e).position==="fixed"?null:t?t(e):e.offsetParent}function wb(e,t){const r=$r(e);if(_f(e))return r;if(!Bn(e)){let s=go(e);for(;s&&!pa(s);){if(Sn(s)&&!Vh(s))return s;s=go(s)}return r}let n=L0(e,t);for(;n&&HD(n)&&Vh(n);)n=L0(n,t);return n&&pa(n)&&Vh(n)&&!Yg(n)?r:n||YD(e)||r}const sO=async function(e){const t=this.getOffsetParent||wb,r=this.getDimensions,n=await r(e.floating);return{reference:nO(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function oO(e){return kn(e).direction==="rtl"}const iO={convertOffsetParentRelativeRectToViewportRelativeRect:GD,getDocumentElement:Ps,getClippingRect:tO,getOffsetParent:wb,getElementRects:sO,getClientRects:qD,getDimensions:rO,getScale:qi,isElement:Sn,isRTL:oO};function aO(e,t){let r=null,n;const s=Ps(e);function o(){var a;clearTimeout(n),(a=r)==null||a.disconnect(),r=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const{left:u,top:d,width:f,height:m}=e.getBoundingClientRect();if(a||t(),!f||!m)return;const y=hu(d),x=hu(s.clientWidth-(u+f)),g=hu(s.clientHeight-(d+m)),_=hu(u),h={rootMargin:-y+"px "+-x+"px "+-g+"px "+-_+"px",threshold:Lr(0,zn(1,c))||1};let w=!0;function C(j){const E=j[0].intersectionRatio;if(E!==c){if(!w)return i();E?i(!1,E):n=setTimeout(()=>{i(!1,1e-7)},1e3)}w=!1}try{r=new IntersectionObserver(C,{...h,root:s.ownerDocument})}catch{r=new IntersectionObserver(C,h)}r.observe(e)}return i(!0),o}function lO(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=Kg(e),d=s||o?[...u?Kl(u):[],...Kl(t)]:[];d.forEach(p=>{s&&p.addEventListener("scroll",r,{passive:!0}),o&&p.addEventListener("resize",r)});const f=u&&a?aO(u,r):null;let m=-1,y=null;i&&(y=new ResizeObserver(p=>{let[h]=p;h&&h.target===u&&y&&(y.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=y)==null||w.observe(t)})),r()}),u&&!c&&y.observe(u),y.observe(t));let x,g=c?ri(e):null;c&&_();function _(){const p=ri(e);g&&(p.x!==g.x||p.y!==g.y||p.width!==g.width||p.height!==g.height)&&r(),g=p,x=requestAnimationFrame(_)}return r(),()=>{var p;d.forEach(h=>{s&&h.removeEventListener("scroll",r),o&&h.removeEventListener("resize",r)}),f==null||f(),(p=y)==null||p.disconnect(),y=null,c&&cancelAnimationFrame(x)}}const cO=$D,uO=VD,dO=FD,fO=BD,hO=zD,F0=LD,pO=WD,mO=(e,t,r)=>{const n=new Map,s={platform:iO,...r},o={...s.platform,_c:n};return ID(e,t,{...s,platform:o})};var Uu=typeof document<"u"?v.useLayoutEffect:v.useEffect;function Cd(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!Cd(e[n],t[n]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,s[n]))return!1;for(n=r;n--!==0;){const o=s[n];if(!(o==="_owner"&&e.$$typeof)&&!Cd(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function _b(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function z0(e,t){const r=_b(e);return Math.round(t*r)/r}function U0(e){const t=v.useRef(e);return Uu(()=>{t.current=e}),t}function gO(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:o,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[d,f]=v.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,y]=v.useState(n);Cd(m,n)||y(n);const[x,g]=v.useState(null),[_,p]=v.useState(null),h=v.useCallback(W=>{W!==E.current&&(E.current=W,g(W))},[]),w=v.useCallback(W=>{W!==R.current&&(R.current=W,p(W))},[]),C=o||x,j=i||_,E=v.useRef(null),R=v.useRef(null),P=v.useRef(d),A=c!=null,L=U0(c),q=U0(s),N=v.useCallback(()=>{if(!E.current||!R.current)return;const W={placement:t,strategy:r,middleware:m};q.current&&(W.platform=q.current),mO(E.current,R.current,W).then(Z=>{const I={...Z,isPositioned:!0};F.current&&!Cd(P.current,I)&&(P.current=I,Ns.flushSync(()=>{f(I)}))})},[m,t,r,q]);Uu(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f(W=>({...W,isPositioned:!1})))},[u]);const F=v.useRef(!1);Uu(()=>(F.current=!0,()=>{F.current=!1}),[]),Uu(()=>{if(C&&(E.current=C),j&&(R.current=j),C&&j){if(L.current)return L.current(C,j,N);N()}},[C,j,N,L,A]);const b=v.useMemo(()=>({reference:E,floating:R,setReference:h,setFloating:w}),[h,w]),V=v.useMemo(()=>({reference:C,floating:j}),[C,j]),te=v.useMemo(()=>{const W={position:r,left:0,top:0};if(!V.floating)return W;const Z=z0(V.floating,d.x),I=z0(V.floating,d.y);return a?{...W,transform:"translate("+Z+"px, "+I+"px)",..._b(V.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:Z,top:I}},[r,a,V.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:N,refs:b,elements:V,floatingStyles:te}),[d,N,b,V,te])}const vO=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:s}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?F0({element:n.current,padding:s}).fn(r):{}:n?F0({element:n,padding:s}).fn(r):{}}}},yO=(e,t)=>({...cO(e),options:[e,t]}),xO=(e,t)=>({...uO(e),options:[e,t]}),wO=(e,t)=>({...pO(e),options:[e,t]}),_O=(e,t)=>({...dO(e),options:[e,t]}),bO=(e,t)=>({...fO(e),options:[e,t]}),SO=(e,t)=>({...hO(e),options:[e,t]}),kO=(e,t)=>({...vO(e),options:[e,t]});var CO="Arrow",bb=v.forwardRef((e,t)=>{const{children:r,width:n=10,height:s=5,...o}=e;return l.jsx(Re.svg,{...o,ref:t,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});bb.displayName=CO;var jO=bb;function Sb(e){const[t,r]=v.useState(void 0);return Jt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let i,a;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;r({width:i,height:a})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var Gg="Popper",[kb,Pa]=xr(Gg),[EO,Cb]=kb(Gg),jb=e=>{const{__scopePopper:t,children:r}=e,[n,s]=v.useState(null);return l.jsx(EO,{scope:t,anchor:n,onAnchorChange:s,children:r})};jb.displayName=Gg;var Eb="PopperAnchor",Nb=v.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...s}=e,o=Cb(Eb,r),i=v.useRef(null),a=Ke(t,i);return v.useEffect(()=>{o.onAnchorChange((n==null?void 0:n.current)||i.current)}),n?null:l.jsx(Re.div,{...s,ref:a})});Nb.displayName=Eb;var qg="PopperContent",[NO,TO]=kb(qg),Tb=v.forwardRef((e,t)=>{var he,ye,ke,Fe,Me,Pe;const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:y="optimized",onPlaced:x,...g}=e,_=Cb(qg,r),[p,h]=v.useState(null),w=Ke(t,nt=>h(nt)),[C,j]=v.useState(null),E=Sb(C),R=(E==null?void 0:E.width)??0,P=(E==null?void 0:E.height)??0,A=n+(o!=="center"?"-"+o:""),L=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},q=Array.isArray(u)?u:[u],N=q.length>0,F={padding:L,boundary:q.filter(PO),altBoundary:N},{refs:b,floatingStyles:V,placement:te,isPositioned:W,middlewareData:Z}=gO({strategy:"fixed",placement:A,whileElementsMounted:(...nt)=>lO(...nt,{animationFrame:y==="always"}),elements:{reference:_.anchor},middleware:[yO({mainAxis:s+P,alignmentAxis:i}),c&&xO({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?wO():void 0,...F}),c&&_O({...F}),bO({...F,apply:({elements:nt,rects:k,availableWidth:J,availableHeight:K})=>{const{width:D,height:S}=k.reference,T=nt.floating.style;T.setProperty("--radix-popper-available-width",`${J}px`),T.setProperty("--radix-popper-available-height",`${K}px`),T.setProperty("--radix-popper-anchor-width",`${D}px`),T.setProperty("--radix-popper-anchor-height",`${S}px`)}}),C&&kO({element:C,padding:a}),AO({arrowWidth:R,arrowHeight:P}),m&&SO({strategy:"referenceHidden",...F})]}),[I,Q]=Ab(te),z=Dt(x);Jt(()=>{W&&(z==null||z())},[W,z]);const $=(he=Z.arrow)==null?void 0:he.x,fe=(ye=Z.arrow)==null?void 0:ye.y,ne=((ke=Z.arrow)==null?void 0:ke.centerOffset)!==0,[se,Oe]=v.useState();return Jt(()=>{p&&Oe(window.getComputedStyle(p).zIndex)},[p]),l.jsx("div",{ref:b.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:W?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[(Fe=Z.transformOrigin)==null?void 0:Fe.x,(Me=Z.transformOrigin)==null?void 0:Me.y].join(" "),...((Pe=Z.hide)==null?void 0:Pe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(NO,{scope:r,placedSide:I,onArrowChange:j,arrowX:$,arrowY:fe,shouldHideArrow:ne,children:l.jsx(Re.div,{"data-side":I,"data-align":Q,...g,ref:w,style:{...g.style,animation:W?void 0:"none"}})})})});Tb.displayName=qg;var Rb="PopperArrow",RO={top:"bottom",right:"left",bottom:"top",left:"right"},Pb=v.forwardRef(function(t,r){const{__scopePopper:n,...s}=t,o=TO(Rb,n),i=RO[o.placedSide];return l.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:l.jsx(jO,{...s,ref:r,style:{...s.style,display:"block"}})})});Pb.displayName=Rb;function PO(e){return e!==null}var AO=e=>({name:"transformOrigin",options:e,fn(t){var _,p,h;const{placement:r,rects:n,middlewareData:s}=t,i=((_=s.arrow)==null?void 0:_.centerOffset)!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,d]=Ab(r),f={start:"0%",center:"50%",end:"100%"}[d],m=(((p=s.arrow)==null?void 0:p.x)??0)+a/2,y=(((h=s.arrow)==null?void 0:h.y)??0)+c/2;let x="",g="";return u==="bottom"?(x=i?f:`${m}px`,g=`${-c}px`):u==="top"?(x=i?f:`${m}px`,g=`${n.floating.height+c}px`):u==="right"?(x=`${-c}px`,g=i?f:`${y}px`):u==="left"&&(x=`${n.floating.width+c}px`,g=i?f:`${y}px`),{data:{x,y:g}}}});function Ab(e){const[t,r="center"]=e.split("-");return[t,r]}var Xg=jb,Qg=Nb,Jg=Tb,ev=Pb,DO="Portal",kc=v.forwardRef((e,t)=>{var a;const{container:r,...n}=e,[s,o]=v.useState(!1);Jt(()=>o(!0),[]);const i=r||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?M1.createPortal(l.jsx(Re.div,{...n,ref:t}),i):null});kc.displayName=DO;function OO(e,t){return v.useReducer((r,n)=>t[r][n]??r,e)}var ur=e=>{const{present:t,children:r}=e,n=MO(t),s=typeof r=="function"?r({present:n.isPresent}):v.Children.only(r),o=Ke(n.ref,IO(s));return typeof r=="function"||n.isPresent?v.cloneElement(s,{ref:o}):null};ur.displayName="Presence";function MO(e){const[t,r]=v.useState(),n=v.useRef({}),s=v.useRef(e),o=v.useRef("none"),i=e?"mounted":"unmounted",[a,c]=OO(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=pu(n.current);o.current=a==="mounted"?u:"none"},[a]),Jt(()=>{const u=n.current,d=s.current;if(d!==e){const m=o.current,y=pu(u);e?c("MOUNT"):y==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),Jt(()=>{if(t){const u=f=>{const y=pu(n.current).includes(f.animationName);f.target===t&&y&&Ns.flushSync(()=>c("ANIMATION_END"))},d=f=>{f.target===t&&(o.current=pu(n.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:v.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function pu(e){return(e==null?void 0:e.animationName)||"none"}function IO(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Wh="rovingFocusGroup.onEntryFocus",LO={bubbles:!1,cancelable:!0},Sf="RovingFocusGroup",[lm,Db,FO]=bc(Sf),[zO,kf]=xr(Sf,[FO]),[UO,$O]=zO(Sf),Ob=v.forwardRef((e,t)=>l.jsx(lm.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(lm.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(VO,{...e,ref:t})})}));Ob.displayName=Sf;var VO=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,m=v.useRef(null),y=Ke(t,m),x=Ea(o),[g=null,_]=on({prop:i,defaultProp:a,onChange:c}),[p,h]=v.useState(!1),w=Dt(u),C=Db(r),j=v.useRef(!1),[E,R]=v.useState(0);return v.useEffect(()=>{const P=m.current;if(P)return P.addEventListener(Wh,w),()=>P.removeEventListener(Wh,w)},[w]),l.jsx(UO,{scope:r,orientation:n,dir:x,loop:s,currentTabStopId:g,onItemFocus:v.useCallback(P=>_(P),[_]),onItemShiftTab:v.useCallback(()=>h(!0),[]),onFocusableItemAdd:v.useCallback(()=>R(P=>P+1),[]),onFocusableItemRemove:v.useCallback(()=>R(P=>P-1),[]),children:l.jsx(Re.div,{tabIndex:p||E===0?-1:0,"data-orientation":n,...f,ref:y,style:{outline:"none",...e.style},onMouseDown:ce(e.onMouseDown,()=>{j.current=!0}),onFocus:ce(e.onFocus,P=>{const A=!j.current;if(P.target===P.currentTarget&&A&&!p){const L=new CustomEvent(Wh,LO);if(P.currentTarget.dispatchEvent(L),!L.defaultPrevented){const q=C().filter(te=>te.focusable),N=q.find(te=>te.active),F=q.find(te=>te.id===g),V=[N,F,...q].filter(Boolean).map(te=>te.ref.current);Lb(V,d)}}j.current=!1}),onBlur:ce(e.onBlur,()=>h(!1))})})}),Mb="RovingFocusGroupItem",Ib=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:o,...i}=e,a=Ur(),c=o||a,u=$O(Mb,r),d=u.currentTabStopId===c,f=Db(r),{onFocusableItemAdd:m,onFocusableItemRemove:y}=u;return v.useEffect(()=>{if(n)return m(),()=>y()},[n,m,y]),l.jsx(lm.ItemSlot,{scope:r,id:c,focusable:n,active:s,children:l.jsx(Re.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...i,ref:t,onMouseDown:ce(e.onMouseDown,x=>{n?u.onItemFocus(c):x.preventDefault()}),onFocus:ce(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:ce(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){u.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const g=HO(x,u.orientation,u.dir);if(g!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let p=f().filter(h=>h.focusable).map(h=>h.ref.current);if(g==="last")p.reverse();else if(g==="prev"||g==="next"){g==="prev"&&p.reverse();const h=p.indexOf(x.currentTarget);p=u.loop?YO(p,h+1):p.slice(h+1)}setTimeout(()=>Lb(p))}})})})});Ib.displayName=Mb;var WO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function BO(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function HO(e,t,r){const n=BO(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return WO[n]}function Lb(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function YO(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Fb=Ob,zb=Ib,ZO=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},wi=new WeakMap,mu=new WeakMap,gu={},Bh=0,Ub=function(e){return e&&(e.host||Ub(e.parentNode))},KO=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Ub(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},GO=function(e,t,r,n){var s=KO(t,Array.isArray(e)?e:[e]);gu[r]||(gu[r]=new WeakMap);var o=gu[r],i=[],a=new Set,c=new Set(s),u=function(f){!f||a.has(f)||(a.add(f),u(f.parentNode))};s.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(m){if(a.has(m))d(m);else try{var y=m.getAttribute(n),x=y!==null&&y!=="false",g=(wi.get(m)||0)+1,_=(o.get(m)||0)+1;wi.set(m,g),o.set(m,_),i.push(m),g===1&&x&&mu.set(m,!0),_===1&&m.setAttribute(r,"true"),x||m.setAttribute(n,"true")}catch(p){console.error("aria-hidden: cannot operate on ",m,p)}})};return d(t),a.clear(),Bh++,function(){i.forEach(function(f){var m=wi.get(f)-1,y=o.get(f)-1;wi.set(f,m),o.set(f,y),m||(mu.has(f)||f.removeAttribute(n),mu.delete(f)),y||f.removeAttribute(r)}),Bh--,Bh||(wi=new WeakMap,wi=new WeakMap,mu=new WeakMap,gu={})}},tv=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),s=ZO(e);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live]"))),GO(n,s,r,"aria-hidden")):function(){return null}},In=function(){return In=Object.assign||function(t){for(var r,n=1,s=arguments.length;n"u")return fM;var t=hM(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},mM=Bb(),Xi="data-scroll-locked",gM=function(e,t,r,n){var s=e.left,o=e.top,i=e.right,a=e.gap;return r===void 0&&(r="margin"),` - .`.concat(XO,` { - overflow: hidden `).concat(n,`; - padding-right: `).concat(a,"px ").concat(n,`; - } - body[`).concat(Xi,`] { - overflow: hidden `).concat(n,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&` - padding-left: `.concat(s,`px; - padding-top: `).concat(o,`px; - padding-right: `).concat(i,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(a,"px ").concat(n,`; - `),r==="padding"&&"padding-right: ".concat(a,"px ").concat(n,";")].filter(Boolean).join(""),` - } - - .`).concat($u,` { - right: `).concat(a,"px ").concat(n,`; - } - - .`).concat(Vu,` { - margin-right: `).concat(a,"px ").concat(n,`; - } - - .`).concat($u," .").concat($u,` { - right: 0 `).concat(n,`; - } - - .`).concat(Vu," .").concat(Vu,` { - margin-right: 0 `).concat(n,`; - } - - body[`).concat(Xi,`] { - `).concat(QO,": ").concat(a,`px; - } -`)},V0=function(){var e=parseInt(document.body.getAttribute(Xi)||"0",10);return isFinite(e)?e:0},vM=function(){v.useEffect(function(){return document.body.setAttribute(Xi,(V0()+1).toString()),function(){var e=V0()-1;e<=0?document.body.removeAttribute(Xi):document.body.setAttribute(Xi,e.toString())}},[])},yM=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;vM();var o=v.useMemo(function(){return pM(s)},[s]);return v.createElement(mM,{styles:gM(o,!t,s,r?"":"!important")})},cm=!1;if(typeof window<"u")try{var vu=Object.defineProperty({},"passive",{get:function(){return cm=!0,!0}});window.addEventListener("test",vu,vu),window.removeEventListener("test",vu,vu)}catch{cm=!1}var _i=cm?{passive:!1}:!1,xM=function(e){return e.tagName==="TEXTAREA"},Hb=function(e,t){var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!xM(e)&&r[t]==="visible")},wM=function(e){return Hb(e,"overflowY")},_M=function(e){return Hb(e,"overflowX")},W0=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=Yb(e,n);if(s){var o=Zb(e,n),i=o[1],a=o[2];if(i>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},bM=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},SM=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Yb=function(e,t){return e==="v"?wM(t):_M(t)},Zb=function(e,t){return e==="v"?bM(t):SM(t)},kM=function(e,t){return e==="h"&&t==="rtl"?-1:1},CM=function(e,t,r,n,s){var o=kM(e,window.getComputedStyle(t).direction),i=o*n,a=r.target,c=t.contains(a),u=!1,d=i>0,f=0,m=0;do{var y=Zb(e,a),x=y[0],g=y[1],_=y[2],p=g-_-o*x;(x||p)&&Yb(e,a)&&(f+=p,m+=x),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&(Math.abs(f)<1||!s)||!d&&(Math.abs(m)<1||!s))&&(u=!0),u},yu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},B0=function(e){return[e.deltaX,e.deltaY]},H0=function(e){return e&&"current"in e?e.current:e},jM=function(e,t){return e[0]===t[0]&&e[1]===t[1]},EM=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},NM=0,bi=[];function TM(e){var t=v.useRef([]),r=v.useRef([0,0]),n=v.useRef(),s=v.useState(NM++)[0],o=v.useState(Bb)[0],i=v.useRef(e);v.useEffect(function(){i.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=qO([e.lockRef.current],(e.shards||[]).map(H0),!0).filter(Boolean);return g.forEach(function(_){return _.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(g,_){if("touches"in g&&g.touches.length===2)return!i.current.allowPinchZoom;var p=yu(g),h=r.current,w="deltaX"in g?g.deltaX:h[0]-p[0],C="deltaY"in g?g.deltaY:h[1]-p[1],j,E=g.target,R=Math.abs(w)>Math.abs(C)?"h":"v";if("touches"in g&&R==="h"&&E.type==="range")return!1;var P=W0(R,E);if(!P)return!0;if(P?j=R:(j=R==="v"?"h":"v",P=W0(R,E)),!P)return!1;if(!n.current&&"changedTouches"in g&&(w||C)&&(n.current=j),!j)return!0;var A=n.current||j;return CM(A,_,g,A==="h"?w:C,!0)},[]),c=v.useCallback(function(g){var _=g;if(!(!bi.length||bi[bi.length-1]!==o)){var p="deltaY"in _?B0(_):yu(_),h=t.current.filter(function(j){return j.name===_.type&&(j.target===_.target||_.target===j.shadowParent)&&jM(j.delta,p)})[0];if(h&&h.should){_.cancelable&&_.preventDefault();return}if(!h){var w=(i.current.shards||[]).map(H0).filter(Boolean).filter(function(j){return j.contains(_.target)}),C=w.length>0?a(_,w[0]):!i.current.noIsolation;C&&_.cancelable&&_.preventDefault()}}},[]),u=v.useCallback(function(g,_,p,h){var w={name:g,delta:_,target:p,should:h,shadowParent:RM(p)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(C){return C!==w})},1)},[]),d=v.useCallback(function(g){r.current=yu(g),n.current=void 0},[]),f=v.useCallback(function(g){u(g.type,B0(g),g.target,a(g,e.lockRef.current))},[]),m=v.useCallback(function(g){u(g.type,yu(g),g.target,a(g,e.lockRef.current))},[]);v.useEffect(function(){return bi.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,_i),document.addEventListener("touchmove",c,_i),document.addEventListener("touchstart",d,_i),function(){bi=bi.filter(function(g){return g!==o}),document.removeEventListener("wheel",c,_i),document.removeEventListener("touchmove",c,_i),document.removeEventListener("touchstart",d,_i)}},[]);var y=e.removeScrollBar,x=e.inert;return v.createElement(v.Fragment,null,x?v.createElement(o,{styles:EM(s)}):null,y?v.createElement(yM,{gapMode:e.gapMode}):null)}function RM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const PM=oM(Wb,TM);var jf=v.forwardRef(function(e,t){return v.createElement(Cf,In({},e,{ref:t,sideCar:PM}))});jf.classNames=Cf.classNames;var um=["Enter"," "],AM=["ArrowDown","PageUp","Home"],Kb=["ArrowUp","PageDown","End"],DM=[...AM,...Kb],OM={ltr:[...um,"ArrowRight"],rtl:[...um,"ArrowLeft"]},MM={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Cc="Menu",[Gl,IM,LM]=bc(Cc),[ci,Gb]=xr(Cc,[LM,Pa,kf]),Ef=Pa(),qb=kf(),[FM,ui]=ci(Cc),[zM,jc]=ci(Cc),Xb=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:s,onOpenChange:o,modal:i=!0}=e,a=Ef(t),[c,u]=v.useState(null),d=v.useRef(!1),f=Dt(o),m=Ea(s);return v.useEffect(()=>{const y=()=>{d.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>d.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),l.jsx(Xg,{...a,children:l.jsx(FM,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:l.jsx(zM,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:i,children:n})})})};Xb.displayName=Cc;var UM="MenuAnchor",rv=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Ef(r);return l.jsx(Qg,{...s,...n,ref:t})});rv.displayName=UM;var nv="MenuPortal",[$M,Qb]=ci(nv,{forceMount:void 0}),Jb=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:s}=e,o=ui(nv,t);return l.jsx($M,{scope:t,forceMount:r,children:l.jsx(ur,{present:r||o.open,children:l.jsx(kc,{asChild:!0,container:s,children:n})})})};Jb.displayName=nv;var rn="MenuContent",[VM,sv]=ci(rn),eS=v.forwardRef((e,t)=>{const r=Qb(rn,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=ui(rn,e.__scopeMenu),i=jc(rn,e.__scopeMenu);return l.jsx(Gl.Provider,{scope:e.__scopeMenu,children:l.jsx(ur,{present:n||o.open,children:l.jsx(Gl.Slot,{scope:e.__scopeMenu,children:i.modal?l.jsx(WM,{...s,ref:t}):l.jsx(BM,{...s,ref:t})})})})}),WM=v.forwardRef((e,t)=>{const r=ui(rn,e.__scopeMenu),n=v.useRef(null),s=Ke(t,n);return v.useEffect(()=>{const o=n.current;if(o)return tv(o)},[]),l.jsx(ov,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ce(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),BM=v.forwardRef((e,t)=>{const r=ui(rn,e.__scopeMenu);return l.jsx(ov,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),ov=v.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:y,disableOutsideScroll:x,...g}=e,_=ui(rn,r),p=jc(rn,r),h=Ef(r),w=qb(r),C=IM(r),[j,E]=v.useState(null),R=v.useRef(null),P=Ke(t,R,_.onContentChange),A=v.useRef(0),L=v.useRef(""),q=v.useRef(0),N=v.useRef(null),F=v.useRef("right"),b=v.useRef(0),V=x?jf:v.Fragment,te=x?{as:bs,allowPinchZoom:!0}:void 0,W=I=>{var he,ye;const Q=L.current+I,z=C().filter(ke=>!ke.disabled),$=document.activeElement,fe=(he=z.find(ke=>ke.ref.current===$))==null?void 0:he.textValue,ne=z.map(ke=>ke.textValue),se=rI(ne,Q,fe),Oe=(ye=z.find(ke=>ke.textValue===se))==null?void 0:ye.ref.current;(function ke(Fe){L.current=Fe,window.clearTimeout(A.current),Fe!==""&&(A.current=window.setTimeout(()=>ke(""),1e3))})(Q),Oe&&setTimeout(()=>Oe.focus())};v.useEffect(()=>()=>window.clearTimeout(A.current),[]),Vg();const Z=v.useCallback(I=>{var z,$;return F.current===((z=N.current)==null?void 0:z.side)&&sI(I,($=N.current)==null?void 0:$.area)},[]);return l.jsx(VM,{scope:r,searchRef:L,onItemEnter:v.useCallback(I=>{Z(I)&&I.preventDefault()},[Z]),onItemLeave:v.useCallback(I=>{var Q;Z(I)||((Q=R.current)==null||Q.focus(),E(null))},[Z]),onTriggerLeave:v.useCallback(I=>{Z(I)&&I.preventDefault()},[Z]),pointerGraceTimerRef:q,onPointerGraceIntentChange:v.useCallback(I=>{N.current=I},[]),children:l.jsx(V,{...te,children:l.jsx(wf,{asChild:!0,trapped:s,onMountAutoFocus:ce(o,I=>{var Q;I.preventDefault(),(Q=R.current)==null||Q.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:y,children:l.jsx(Fb,{asChild:!0,...w,dir:p.dir,orientation:"vertical",loop:n,currentTabStopId:j,onCurrentTabStopIdChange:E,onEntryFocus:ce(c,I=>{p.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(Jg,{role:"menu","aria-orientation":"vertical","data-state":gS(_.open),"data-radix-menu-content":"",dir:p.dir,...h,...g,ref:P,style:{outline:"none",...g.style},onKeyDown:ce(g.onKeyDown,I=>{const z=I.target.closest("[data-radix-menu-content]")===I.currentTarget,$=I.ctrlKey||I.altKey||I.metaKey,fe=I.key.length===1;z&&(I.key==="Tab"&&I.preventDefault(),!$&&fe&&W(I.key));const ne=R.current;if(I.target!==ne||!DM.includes(I.key))return;I.preventDefault();const Oe=C().filter(he=>!he.disabled).map(he=>he.ref.current);Kb.includes(I.key)&&Oe.reverse(),eI(Oe)}),onBlur:ce(e.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(A.current),L.current="")}),onPointerMove:ce(e.onPointerMove,ql(I=>{const Q=I.target,z=b.current!==I.clientX;if(I.currentTarget.contains(Q)&&z){const $=I.clientX>b.current?"right":"left";F.current=$,b.current=I.clientX}}))})})})})})})});eS.displayName=rn;var HM="MenuGroup",iv=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{role:"group",...n,ref:t})});iv.displayName=HM;var YM="MenuLabel",tS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});tS.displayName=YM;var jd="MenuItem",Y0="menu.itemSelect",Nf=v.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...s}=e,o=v.useRef(null),i=jc(jd,e.__scopeMenu),a=sv(jd,e.__scopeMenu),c=Ke(t,o),u=v.useRef(!1),d=()=>{const f=o.current;if(!r&&f){const m=new CustomEvent(Y0,{bubbles:!0,cancelable:!0});f.addEventListener(Y0,y=>n==null?void 0:n(y),{once:!0}),$g(f,m),m.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx(rS,{...s,ref:c,disabled:r,onClick:ce(e.onClick,d),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),u.current=!0},onPointerUp:ce(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:ce(e.onKeyDown,f=>{const m=a.searchRef.current!=="";r||m&&f.key===" "||um.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Nf.displayName=jd;var rS=v.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...o}=e,i=sv(jd,r),a=qb(r),c=v.useRef(null),u=Ke(t,c),[d,f]=v.useState(!1),[m,y]=v.useState("");return v.useEffect(()=>{const x=c.current;x&&y((x.textContent??"").trim())},[o.children]),l.jsx(Gl.ItemSlot,{scope:r,disabled:n,textValue:s??m,children:l.jsx(zb,{asChild:!0,...a,focusable:!n,children:l.jsx(Re.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:u,onPointerMove:ce(e.onPointerMove,ql(x=>{n?i.onItemLeave(x):(i.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ce(e.onPointerLeave,ql(x=>i.onItemLeave(x))),onFocus:ce(e.onFocus,()=>f(!0)),onBlur:ce(e.onBlur,()=>f(!1))})})})}),ZM="MenuCheckboxItem",nS=v.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...s}=e;return l.jsx(lS,{scope:e.__scopeMenu,checked:r,children:l.jsx(Nf,{role:"menuitemcheckbox","aria-checked":Ed(r)?"mixed":r,...s,ref:t,"data-state":lv(r),onSelect:ce(s.onSelect,()=>n==null?void 0:n(Ed(r)?!0:!r),{checkForDefaultPrevented:!1})})})});nS.displayName=ZM;var sS="MenuRadioGroup",[KM,GM]=ci(sS,{value:void 0,onValueChange:()=>{}}),oS=v.forwardRef((e,t)=>{const{value:r,onValueChange:n,...s}=e,o=Dt(n);return l.jsx(KM,{scope:e.__scopeMenu,value:r,onValueChange:o,children:l.jsx(iv,{...s,ref:t})})});oS.displayName=sS;var iS="MenuRadioItem",aS=v.forwardRef((e,t)=>{const{value:r,...n}=e,s=GM(iS,e.__scopeMenu),o=r===s.value;return l.jsx(lS,{scope:e.__scopeMenu,checked:o,children:l.jsx(Nf,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":lv(o),onSelect:ce(n.onSelect,()=>{var i;return(i=s.onValueChange)==null?void 0:i.call(s,r)},{checkForDefaultPrevented:!1})})})});aS.displayName=iS;var av="MenuItemIndicator",[lS,qM]=ci(av,{checked:!1}),cS=v.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...s}=e,o=qM(av,r);return l.jsx(ur,{present:n||Ed(o.checked)||o.checked===!0,children:l.jsx(Re.span,{...s,ref:t,"data-state":lv(o.checked)})})});cS.displayName=av;var XM="MenuSeparator",uS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return l.jsx(Re.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});uS.displayName=XM;var QM="MenuArrow",dS=v.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Ef(r);return l.jsx(ev,{...s,...n,ref:t})});dS.displayName=QM;var JM="MenuSub",[w$,fS]=ci(JM),ol="MenuSubTrigger",hS=v.forwardRef((e,t)=>{const r=ui(ol,e.__scopeMenu),n=jc(ol,e.__scopeMenu),s=fS(ol,e.__scopeMenu),o=sv(ol,e.__scopeMenu),i=v.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=o,u={__scopeMenu:e.__scopeMenu},d=v.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),l.jsx(rv,{asChild:!0,...u,children:l.jsx(rS,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":gS(r.open),...e,ref:yf(t,s.onTriggerChange),onClick:f=>{var m;(m=e.onClick)==null||m.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ce(e.onPointerMove,ql(f=>{o.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:ce(e.onPointerLeave,ql(f=>{var y,x;d();const m=(y=r.content)==null?void 0:y.getBoundingClientRect();if(m){const g=(x=r.content)==null?void 0:x.dataset.side,_=g==="right",p=_?-5:5,h=m[_?"left":"right"],w=m[_?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+p,y:f.clientY},{x:h,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x:h,y:m.bottom}],side:g}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:ce(e.onKeyDown,f=>{var y;const m=o.searchRef.current!=="";e.disabled||m&&f.key===" "||OM[n.dir].includes(f.key)&&(r.onOpenChange(!0),(y=r.content)==null||y.focus(),f.preventDefault())})})})});hS.displayName=ol;var pS="MenuSubContent",mS=v.forwardRef((e,t)=>{const r=Qb(rn,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=ui(rn,e.__scopeMenu),i=jc(rn,e.__scopeMenu),a=fS(pS,e.__scopeMenu),c=v.useRef(null),u=Ke(t,c);return l.jsx(Gl.Provider,{scope:e.__scopeMenu,children:l.jsx(ur,{present:n||o.open,children:l.jsx(Gl.Slot,{scope:e.__scopeMenu,children:l.jsx(ov,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;i.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:ce(e.onFocusOutside,d=>{d.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:ce(e.onEscapeKeyDown,d=>{i.onClose(),d.preventDefault()}),onKeyDown:ce(e.onKeyDown,d=>{var y;const f=d.currentTarget.contains(d.target),m=MM[i.dir].includes(d.key);f&&m&&(o.onOpenChange(!1),(y=a.trigger)==null||y.focus(),d.preventDefault())})})})})})});mS.displayName=pS;function gS(e){return e?"open":"closed"}function Ed(e){return e==="indeterminate"}function lv(e){return Ed(e)?"indeterminate":e?"checked":"unchecked"}function eI(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function tI(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function rI(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=tI(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function nI(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;on!=d>n&&r<(u-a)*(n-c)/(d-c)+a&&(s=!s)}return s}function sI(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return nI(r,t)}function ql(e){return t=>t.pointerType==="mouse"?e(t):void 0}var oI=Xb,iI=rv,aI=Jb,lI=eS,cI=iv,uI=tS,dI=Nf,fI=nS,hI=oS,pI=aS,mI=cS,gI=uS,vI=dS,yI=hS,xI=mS,cv="DropdownMenu",[wI,_$]=xr(cv,[Gb]),wr=Gb(),[_I,vS]=wI(cv),yS=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:s,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,c=wr(t),u=v.useRef(null),[d=!1,f]=on({prop:s,defaultProp:o,onChange:i});return l.jsx(_I,{scope:t,triggerId:Ur(),triggerRef:u,contentId:Ur(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(m=>!m),[f]),modal:a,children:l.jsx(oI,{...c,open:d,onOpenChange:f,dir:n,modal:a,children:r})})};yS.displayName=cv;var xS="DropdownMenuTrigger",wS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=e,o=vS(xS,r),i=wr(r);return l.jsx(iI,{asChild:!0,...i,children:l.jsx(Re.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:yf(t,o.triggerRef),onPointerDown:ce(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:ce(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});wS.displayName=xS;var bI="DropdownMenuPortal",_S=e=>{const{__scopeDropdownMenu:t,...r}=e,n=wr(t);return l.jsx(aI,{...n,...r})};_S.displayName=bI;var bS="DropdownMenuContent",SS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=vS(bS,r),o=wr(r),i=v.useRef(!1);return l.jsx(lI,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...n,ref:t,onCloseAutoFocus:ce(e.onCloseAutoFocus,a=>{var c;i.current||(c=s.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:ce(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});SS.displayName=bS;var SI="DropdownMenuGroup",kI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(cI,{...s,...n,ref:t})});kI.displayName=SI;var CI="DropdownMenuLabel",kS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(uI,{...s,...n,ref:t})});kS.displayName=CI;var jI="DropdownMenuItem",CS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(dI,{...s,...n,ref:t})});CS.displayName=jI;var EI="DropdownMenuCheckboxItem",jS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(fI,{...s,...n,ref:t})});jS.displayName=EI;var NI="DropdownMenuRadioGroup",TI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(hI,{...s,...n,ref:t})});TI.displayName=NI;var RI="DropdownMenuRadioItem",ES=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(pI,{...s,...n,ref:t})});ES.displayName=RI;var PI="DropdownMenuItemIndicator",NS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(mI,{...s,...n,ref:t})});NS.displayName=PI;var AI="DropdownMenuSeparator",TS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(gI,{...s,...n,ref:t})});TS.displayName=AI;var DI="DropdownMenuArrow",OI=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(vI,{...s,...n,ref:t})});OI.displayName=DI;var MI="DropdownMenuSubTrigger",RS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(yI,{...s,...n,ref:t})});RS.displayName=MI;var II="DropdownMenuSubContent",PS=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=wr(r);return l.jsx(xI,{...s,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});PS.displayName=II;var LI=yS,FI=wS,zI=_S,AS=SS,DS=kS,OS=CS,MS=jS,IS=ES,LS=NS,FS=TS,zS=RS,US=PS;const $S=LI,VS=FI,UI=v.forwardRef(({className:e,inset:t,children:r,...n},s)=>l.jsxs(zS,{ref:s,className:ae("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...n,children:[r,l.jsx(iA,{className:"ml-auto h-4 w-4"})]}));UI.displayName=zS.displayName;const $I=v.forwardRef(({className:e,...t},r)=>l.jsx(US,{ref:r,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));$I.displayName=US.displayName;const uv=v.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(zI,{children:l.jsx(AS,{ref:n,sideOffset:t,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));uv.displayName=AS.displayName;const Qi=v.forwardRef(({className:e,inset:t,...r},n)=>l.jsx(OS,{ref:n,className:ae("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));Qi.displayName=OS.displayName;const VI=v.forwardRef(({className:e,children:t,checked:r,...n},s)=>l.jsxs(MS,{ref:s,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(LS,{children:l.jsx(eb,{className:"h-4 w-4"})})}),t]}));VI.displayName=MS.displayName;const WI=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(IS,{ref:n,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(LS,{children:l.jsx(uA,{className:"h-2 w-2 fill-current"})})}),t]}));WI.displayName=IS.displayName;const WS=v.forwardRef(({className:e,inset:t,...r},n)=>l.jsx(DS,{ref:n,className:ae("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));WS.displayName=DS.displayName;const BS=v.forwardRef(({className:e,...t},r)=>l.jsx(FS,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));BS.displayName=FS.displayName;var dv="Dialog",[HS,YS]=xr(dv),[BI,Tn]=HS(dv),ZS=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,a=v.useRef(null),c=v.useRef(null),[u=!1,d]=on({prop:n,defaultProp:s,onChange:o});return l.jsx(BI,{scope:t,triggerRef:a,contentRef:c,contentId:Ur(),titleId:Ur(),descriptionId:Ur(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:i,children:r})};ZS.displayName=dv;var KS="DialogTrigger",GS=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(KS,r),o=Ke(t,s.triggerRef);return l.jsx(Re.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":pv(s.open),...n,ref:o,onClick:ce(e.onClick,s.onOpenToggle)})});GS.displayName=KS;var fv="DialogPortal",[HI,qS]=HS(fv,{forceMount:void 0}),XS=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,o=Tn(fv,t);return l.jsx(HI,{scope:t,forceMount:r,children:v.Children.map(n,i=>l.jsx(ur,{present:r||o.open,children:l.jsx(kc,{asChild:!0,container:s,children:i})}))})};XS.displayName=fv;var Nd="DialogOverlay",QS=v.forwardRef((e,t)=>{const r=qS(Nd,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=Tn(Nd,e.__scopeDialog);return o.modal?l.jsx(ur,{present:n||o.open,children:l.jsx(YI,{...s,ref:t})}):null});QS.displayName=Nd;var YI=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(Nd,r);return l.jsx(jf,{as:bs,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(Re.div,{"data-state":pv(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),ni="DialogContent",JS=v.forwardRef((e,t)=>{const r=qS(ni,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=Tn(ni,e.__scopeDialog);return l.jsx(ur,{present:n||o.open,children:o.modal?l.jsx(ZI,{...s,ref:t}):l.jsx(KI,{...s,ref:t})})});JS.displayName=ni;var ZI=v.forwardRef((e,t)=>{const r=Tn(ni,e.__scopeDialog),n=v.useRef(null),s=Ke(t,r.contentRef,n);return v.useEffect(()=>{const o=n.current;if(o)return tv(o)},[]),l.jsx(ek,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ce(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ce(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&o.preventDefault()}),onFocusOutside:ce(e.onFocusOutside,o=>o.preventDefault())})}),KI=v.forwardRef((e,t)=>{const r=Tn(ni,e.__scopeDialog),n=v.useRef(!1),s=v.useRef(!1);return l.jsx(ek,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(n.current||(a=r.triggerRef.current)==null||a.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;((u=r.triggerRef.current)==null?void 0:u.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),ek=v.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,a=Tn(ni,r),c=v.useRef(null),u=Ke(t,c);return Vg(),l.jsxs(l.Fragment,{children:[l.jsx(wf,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(Na,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":pv(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(qI,{titleId:a.titleId}),l.jsx(QI,{contentRef:c,descriptionId:a.descriptionId})]})]})}),hv="DialogTitle",tk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(hv,r);return l.jsx(Re.h2,{id:s.titleId,...n,ref:t})});tk.displayName=hv;var rk="DialogDescription",nk=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(rk,r);return l.jsx(Re.p,{id:s.descriptionId,...n,ref:t})});nk.displayName=rk;var sk="DialogClose",ok=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Tn(sk,r);return l.jsx(Re.button,{type:"button",...n,ref:t,onClick:ce(e.onClick,()=>s.onOpenChange(!1))})});ok.displayName=sk;function pv(e){return e?"open":"closed"}var ik="DialogTitleWarning",[GI,ak]=oD(ik,{contentName:ni,titleName:hv,docsSlug:"dialog"}),qI=({titleId:e})=>{const t=ak(ik),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},XI="DialogDescriptionWarning",QI=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ak(XI).contentName}}.`;return v.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},mv=ZS,gv=GS,vv=XS,Ec=QS,Nc=JS,Tc=tk,Rc=nk,Tf=ok;const yv=mv,xv=gv,JI=vv,lk=v.forwardRef(({className:e,...t},r)=>l.jsx(Ec,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));lk.displayName=Ec.displayName;const eL=_c("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Rf=v.forwardRef(({side:e="right",className:t,children:r,...n},s)=>l.jsxs(JI,{children:[l.jsx(lk,{}),l.jsxs(Nc,{ref:s,className:ae(eL({side:e}),t),...n,children:[r,l.jsxs(Tf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[l.jsx(Fg,{className:"h-4 w-4 dark:text-stone-200"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rf.displayName=Nc.displayName;const wv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});wv.displayName="SheetHeader";const _v=v.forwardRef(({className:e,...t},r)=>l.jsx(Tc,{ref:r,className:ae("text-lg font-semibold text-foreground",e),...t}));_v.displayName=Tc.displayName;const tL=v.forwardRef(({className:e,...t},r)=>l.jsx(Rc,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));tL.displayName=Rc.displayName;class Vr extends Error{constructor(t){var r,n,s,o;super("ClientResponseError"),this.url="",this.status=0,this.response={},this.isAbort=!1,this.originalError=null,Object.setPrototypeOf(this,Vr.prototype),t!==null&&typeof t=="object"&&(this.url=typeof t.url=="string"?t.url:"",this.status=typeof t.status=="number"?t.status:0,this.isAbort=!!t.isAbort,this.originalError=t.originalError,t.response!==null&&typeof t.response=="object"?this.response=t.response:t.data!==null&&typeof t.data=="object"?this.response=t.data:this.response={}),this.originalError||t instanceof Vr||(this.originalError=t),typeof DOMException<"u"&&t instanceof DOMException&&(this.isAbort=!0),this.name="ClientResponseError "+this.status,this.message=(r=this.response)==null?void 0:r.message,this.message||(this.isAbort?this.message="The request was autocancelled. You can find more info in https://github.com/pocketbase/js-sdk#auto-cancellation.":(o=(s=(n=this.originalError)==null?void 0:n.cause)==null?void 0:s.message)!=null&&o.includes("ECONNREFUSED ::1")?this.message="Failed to connect to the PocketBase server. Try changing the SDK URL from localhost to 127.0.0.1 (https://github.com/pocketbase/js-sdk/issues/21).":this.message="Something went wrong while processing your request.")}get data(){return this.response}toJSON(){return{...this}}}const xu=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function rL(e,t){const r={};if(typeof e!="string")return r;const n=Object.assign({},{}).decode||nL;let s=0;for(;s0&&(!r.exp||r.exp-t>Date.now()/1e3))}ck=typeof atob!="function"||oL?e=>{let t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,s=0,o=0,i="";n=t.charAt(o++);~n&&(r=s%4?64*r+n:n,s++%4)?i+=String.fromCharCode(255&r>>(-2*s&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return i}:atob;const K0="pb_auth";class iL{constructor(){this.baseToken="",this.baseModel=null,this._onChangeCallbacks=[]}get token(){return this.baseToken}get model(){return this.baseModel}get isValid(){return!uk(this.token)}get isAdmin(){return Ji(this.token).type==="admin"}get isAuthRecord(){return Ji(this.token).type==="authRecord"}save(t,r){this.baseToken=t||"",this.baseModel=r||null,this.triggerChange()}clear(){this.baseToken="",this.baseModel=null,this.triggerChange()}loadFromCookie(t,r=K0){const n=rL(t||"")[r]||"";let s={};try{s=JSON.parse(n),(typeof s===null||typeof s!="object"||Array.isArray(s))&&(s={})}catch{}this.save(s.token||"",s.model||null)}exportToCookie(t,r=K0){var c,u;const n={secure:!0,sameSite:!0,httpOnly:!0,path:"/"},s=Ji(this.token);n.expires=s!=null&&s.exp?new Date(1e3*s.exp):new Date("1970-01-01"),t=Object.assign({},n,t);const o={token:this.token,model:this.model?JSON.parse(JSON.stringify(this.model)):null};let i=Z0(r,JSON.stringify(o),t);const a=typeof Blob<"u"?new Blob([i]).size:i.length;if(o.model&&a>4096){o.model={id:(c=o==null?void 0:o.model)==null?void 0:c.id,email:(u=o==null?void 0:o.model)==null?void 0:u.email};const d=["collectionId","username","verified"];for(const f in this.model)d.includes(f)&&(o.model[f]=this.model[f]);i=Z0(r,JSON.stringify(o),t)}return i}onChange(t,r=!1){return this._onChangeCallbacks.push(t),r&&t(this.token,this.model),()=>{for(let n=this._onChangeCallbacks.length-1;n>=0;n--)if(this._onChangeCallbacks[n]==t)return delete this._onChangeCallbacks[n],void this._onChangeCallbacks.splice(n,1)}}triggerChange(){for(const t of this._onChangeCallbacks)t&&t(this.token,this.model)}}class aL extends iL{constructor(t="pocketbase_auth"){super(),this.storageFallback={},this.storageKey=t,this._bindStorageEvent()}get token(){return(this._storageGet(this.storageKey)||{}).token||""}get model(){return(this._storageGet(this.storageKey)||{}).model||null}save(t,r){this._storageSet(this.storageKey,{token:t,model:r}),super.save(t,r)}clear(){this._storageRemove(this.storageKey),super.clear()}_storageGet(t){if(typeof window<"u"&&(window!=null&&window.localStorage)){const r=window.localStorage.getItem(t)||"";try{return JSON.parse(r)}catch{return r}}return this.storageFallback[t]}_storageSet(t,r){if(typeof window<"u"&&(window!=null&&window.localStorage)){let n=r;typeof r!="string"&&(n=JSON.stringify(r)),window.localStorage.setItem(t,n)}else this.storageFallback[t]=r}_storageRemove(t){var r;typeof window<"u"&&(window!=null&&window.localStorage)&&((r=window.localStorage)==null||r.removeItem(t)),delete this.storageFallback[t]}_bindStorageEvent(){typeof window<"u"&&(window!=null&&window.localStorage)&&window.addEventListener&&window.addEventListener("storage",t=>{if(t.key!=this.storageKey)return;const r=this._storageGet(this.storageKey)||{};super.save(r.token||"",r.model||null)})}}class di{constructor(t){this.client=t}}class lL extends di{async getAll(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/settings",t)}async update(t,r){return r=Object.assign({method:"PATCH",body:t},r),this.client.send("/api/settings",r)}async testS3(t="storage",r){return r=Object.assign({method:"POST",body:{filesystem:t}},r),this.client.send("/api/settings/test/s3",r).then(()=>!0)}async testEmail(t,r,n){return n=Object.assign({method:"POST",body:{email:t,template:r}},n),this.client.send("/api/settings/test/email",n).then(()=>!0)}async generateAppleClientSecret(t,r,n,s,o,i){return i=Object.assign({method:"POST",body:{clientId:t,teamId:r,keyId:n,privateKey:s,duration:o}},i),this.client.send("/api/settings/apple/generate-client-secret",i)}}class bv extends di{decode(t){return t}async getFullList(t,r){if(typeof t=="number")return this._getFullList(t,r);let n=500;return(r=Object.assign({},t,r)).batch&&(n=r.batch,delete r.batch),this._getFullList(n,r)}async getList(t=1,r=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:t,perPage:r},n.query),this.client.send(this.baseCrudPath,n).then(s=>{var o;return s.items=((o=s.items)==null?void 0:o.map(i=>this.decode(i)))||[],s})}async getFirstListItem(t,r){return(r=Object.assign({requestKey:"one_by_filter_"+this.baseCrudPath+"_"+t},r)).query=Object.assign({filter:t,skipTotal:1},r.query),this.getList(1,1,r).then(n=>{var s;if(!((s=n==null?void 0:n.items)!=null&&s.length))throw new Vr({status:404,response:{code:404,message:"The requested resource wasn't found.",data:{}}});return n.items[0]})}async getOne(t,r){if(!t)throw new Vr({url:this.client.buildUrl(this.baseCrudPath+"/"),status:404,response:{code:404,message:"Missing required record id.",data:{}}});return r=Object.assign({method:"GET"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),r).then(n=>this.decode(n))}async create(t,r){return r=Object.assign({method:"POST",body:t},r),this.client.send(this.baseCrudPath,r).then(n=>this.decode(n))}async update(t,r,n){return n=Object.assign({method:"PATCH",body:r},n),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),n).then(s=>this.decode(s))}async delete(t,r){return r=Object.assign({method:"DELETE"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t),r).then(()=>!0)}_getFullList(t=500,r){(r=r||{}).query=Object.assign({skipTotal:1},r.query);let n=[],s=async o=>this.getList(o,t||500,r).then(i=>{const a=i.items;return n=n.concat(a),a.length==i.perPage?s(o+1):n});return s(1)}}function Dr(e,t,r,n){const s=n!==void 0;return s||r!==void 0?s?(console.warn(e),t.body=Object.assign({},t.body,r),t.query=Object.assign({},t.query,n),t):Object.assign(t,r):t}function Kh(e){var t;(t=e._resetAutoRefresh)==null||t.call(e)}class cL extends bv{get baseCrudPath(){return"/api/admins"}async update(t,r,n){return super.update(t,r,n).then(s=>{var o,i;return((o=this.client.authStore.model)==null?void 0:o.id)===s.id&&((i=this.client.authStore.model)==null?void 0:i.collectionId)===void 0&&this.client.authStore.save(this.client.authStore.token,s),s})}async delete(t,r){return super.delete(t,r).then(n=>{var s,o;return n&&((s=this.client.authStore.model)==null?void 0:s.id)===t&&((o=this.client.authStore.model)==null?void 0:o.collectionId)===void 0&&this.client.authStore.clear(),n})}authResponse(t){const r=this.decode((t==null?void 0:t.admin)||{});return t!=null&&t.token&&(t!=null&&t.admin)&&this.client.authStore.save(t.token,r),Object.assign({},t,{token:(t==null?void 0:t.token)||"",admin:r})}async authWithPassword(t,r,n,s){let o={method:"POST",body:{identity:t,password:r}};o=Dr("This form of authWithPassword(email, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(email, pass, options?).",o,n,s);const i=o.autoRefreshThreshold;delete o.autoRefreshThreshold,o.autoRefresh||Kh(this.client);let a=await this.client.send(this.baseCrudPath+"/auth-with-password",o);return a=this.authResponse(a),i&&function(u,d,f,m){Kh(u);const y=u.beforeSend,x=u.authStore.model,g=u.authStore.onChange((_,p)=>{(!_||(p==null?void 0:p.id)!=(x==null?void 0:x.id)||(p!=null&&p.collectionId||x!=null&&x.collectionId)&&(p==null?void 0:p.collectionId)!=(x==null?void 0:x.collectionId))&&Kh(u)});u._resetAutoRefresh=function(){g(),u.beforeSend=y,delete u._resetAutoRefresh},u.beforeSend=async(_,p)=>{var j;const h=u.authStore.token;if((j=p.query)!=null&&j.autoRefresh)return y?y(_,p):{url:_,sendOptions:p};let w=u.authStore.isValid;if(w&&uk(u.authStore.token,d))try{await f()}catch{w=!1}w||await m();const C=p.headers||{};for(let E in C)if(E.toLowerCase()=="authorization"&&h==C[E]&&u.authStore.token){C[E]=u.authStore.token;break}return p.headers=C,y?y(_,p):{url:_,sendOptions:p}}}(this.client,i,()=>this.authRefresh({autoRefresh:!0}),()=>this.authWithPassword(t,r,Object.assign({autoRefresh:!0},o))),a}async authRefresh(t,r){let n={method:"POST"};return n=Dr("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",n,t,r),this.client.send(this.baseCrudPath+"/auth-refresh",n).then(this.authResponse.bind(this))}async requestPasswordReset(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",s,r,n),this.client.send(this.baseCrudPath+"/request-password-reset",s).then(()=>!0)}async confirmPasswordReset(t,r,n,s,o){let i={method:"POST",body:{token:t,password:r,passwordConfirm:n}};return i=Dr("This form of confirmPasswordReset(resetToken, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(resetToken, password, passwordConfirm, options?).",i,s,o),this.client.send(this.baseCrudPath+"/confirm-password-reset",i).then(()=>!0)}}const uL=["requestKey","$cancelKey","$autoCancel","fetch","headers","body","query","params","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy","signal","window"];function dk(e){if(e){e.query=e.query||{};for(let t in e)uL.includes(t)||(e.query[t]=e[t],delete e[t])}}class fk extends di{constructor(){super(...arguments),this.clientId="",this.eventSource=null,this.subscriptions={},this.lastSentSubscriptions=[],this.maxConnectTimeout=15e3,this.reconnectAttempts=0,this.maxReconnectAttempts=1/0,this.predefinedReconnectIntervals=[200,300,500,1e3,1200,1500,2e3],this.pendingConnects=[]}get isConnected(){return!!this.eventSource&&!!this.clientId&&!this.pendingConnects.length}async subscribe(t,r,n){var i;if(!t)throw new Error("topic must be set.");let s=t;if(n){dk(n);const a="options="+encodeURIComponent(JSON.stringify({query:n.query,headers:n.headers}));s+=(s.includes("?")?"&":"?")+a}const o=function(a){const c=a;let u;try{u=JSON.parse(c==null?void 0:c.data)}catch{}r(u||{})};return this.subscriptions[s]||(this.subscriptions[s]=[]),this.subscriptions[s].push(o),this.isConnected?this.subscriptions[s].length===1?await this.submitSubscriptions():(i=this.eventSource)==null||i.addEventListener(s,o):await this.connect(),async()=>this.unsubscribeByTopicAndListener(t,o)}async unsubscribe(t){var n;let r=!1;if(t){const s=this.getSubscriptionsByTopic(t);for(let o in s)if(this.hasSubscriptionListeners(o)){for(let i of this.subscriptions[o])(n=this.eventSource)==null||n.removeEventListener(o,i);delete this.subscriptions[o],r||(r=!0)}}else this.subscriptions={};this.hasSubscriptionListeners()?r&&await this.submitSubscriptions():this.disconnect()}async unsubscribeByPrefix(t){var n;let r=!1;for(let s in this.subscriptions)if((s+"?").startsWith(t)){r=!0;for(let o of this.subscriptions[s])(n=this.eventSource)==null||n.removeEventListener(s,o);delete this.subscriptions[s]}r&&(this.hasSubscriptionListeners()?await this.submitSubscriptions():this.disconnect())}async unsubscribeByTopicAndListener(t,r){var o;let n=!1;const s=this.getSubscriptionsByTopic(t);for(let i in s){if(!Array.isArray(this.subscriptions[i])||!this.subscriptions[i].length)continue;let a=!1;for(let c=this.subscriptions[i].length-1;c>=0;c--)this.subscriptions[i][c]===r&&(a=!0,delete this.subscriptions[i][c],this.subscriptions[i].splice(c,1),(o=this.eventSource)==null||o.removeEventListener(i,r));a&&(this.subscriptions[i].length||delete this.subscriptions[i],n||this.hasSubscriptionListeners(i)||(n=!0))}this.hasSubscriptionListeners()?n&&await this.submitSubscriptions():this.disconnect()}hasSubscriptionListeners(t){var r,n;if(this.subscriptions=this.subscriptions||{},t)return!!((r=this.subscriptions[t])!=null&&r.length);for(let s in this.subscriptions)if((n=this.subscriptions[s])!=null&&n.length)return!0;return!1}async submitSubscriptions(){if(this.clientId)return this.addAllSubscriptionListeners(),this.lastSentSubscriptions=this.getNonEmptySubscriptionKeys(),this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentSubscriptions},requestKey:this.getSubscriptionsCancelKey()}).catch(t=>{if(!(t!=null&&t.isAbort))throw t})}getSubscriptionsCancelKey(){return"realtime_"+this.clientId}getSubscriptionsByTopic(t){const r={};t=t.includes("?")?t:t+"?";for(let n in this.subscriptions)(n+"?").startsWith(t)&&(r[n]=this.subscriptions[n]);return r}getNonEmptySubscriptionKeys(){const t=[];for(let r in this.subscriptions)this.subscriptions[r].length&&t.push(r);return t}addAllSubscriptionListeners(){if(this.eventSource){this.removeAllSubscriptionListeners();for(let t in this.subscriptions)for(let r of this.subscriptions[t])this.eventSource.addEventListener(t,r)}}removeAllSubscriptionListeners(){if(this.eventSource)for(let t in this.subscriptions)for(let r of this.subscriptions[t])this.eventSource.removeEventListener(t,r)}async connect(){if(!(this.reconnectAttempts>0))return new Promise((t,r)=>{this.pendingConnects.push({resolve:t,reject:r}),this.pendingConnects.length>1||this.initConnect()})}initConnect(){this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout(()=>{this.connectErrorHandler(new Error("EventSource connect took too long."))},this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=t=>{this.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",t=>{const r=t;this.clientId=r==null?void 0:r.lastEventId,this.submitSubscriptions().then(async()=>{let n=3;for(;this.hasUnsentSubscriptions()&&n>0;)n--,await this.submitSubscriptions()}).then(()=>{for(let s of this.pendingConnects)s.resolve();this.pendingConnects=[],this.reconnectAttempts=0,clearTimeout(this.reconnectTimeoutId),clearTimeout(this.connectTimeoutId);const n=this.getSubscriptionsByTopic("PB_CONNECT");for(let s in n)for(let o of n[s])o(t)}).catch(n=>{this.clientId="",this.connectErrorHandler(n)})})}hasUnsentSubscriptions(){const t=this.getNonEmptySubscriptionKeys();if(t.length!=this.lastSentSubscriptions.length)return!0;for(const r of t)if(!this.lastSentSubscriptions.includes(r))return!0;return!1}connectErrorHandler(t){if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),!this.clientId&&!this.reconnectAttempts||this.reconnectAttempts>this.maxReconnectAttempts){for(let n of this.pendingConnects)n.reject(new Vr(t));return this.pendingConnects=[],void this.disconnect()}this.disconnect(!0);const r=this.predefinedReconnectIntervals[this.reconnectAttempts]||this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length-1];this.reconnectAttempts++,this.reconnectTimeoutId=setTimeout(()=>{this.initConnect()},r)}disconnect(t=!1){var r;if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),this.removeAllSubscriptionListeners(),this.client.cancelRequest(this.getSubscriptionsCancelKey()),(r=this.eventSource)==null||r.close(),this.eventSource=null,this.clientId="",!t){this.reconnectAttempts=0;for(let n of this.pendingConnects)n.resolve();this.pendingConnects=[]}}}class dL extends bv{constructor(t,r){super(t),this.collectionIdOrName=r}get baseCrudPath(){return this.baseCollectionPath+"/records"}get baseCollectionPath(){return"/api/collections/"+encodeURIComponent(this.collectionIdOrName)}async subscribe(t,r,n){if(!t)throw new Error("Missing topic.");if(!r)throw new Error("Missing subscription callback.");return this.client.realtime.subscribe(this.collectionIdOrName+"/"+t,r,n)}async unsubscribe(t){return t?this.client.realtime.unsubscribe(this.collectionIdOrName+"/"+t):this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName)}async getFullList(t,r){if(typeof t=="number")return super.getFullList(t,r);const n=Object.assign({},t,r);return super.getFullList(n)}async getList(t=1,r=30,n){return super.getList(t,r,n)}async getFirstListItem(t,r){return super.getFirstListItem(t,r)}async getOne(t,r){return super.getOne(t,r)}async create(t,r){return super.create(t,r)}async update(t,r,n){return super.update(t,r,n).then(s=>{var o,i,a;return((o=this.client.authStore.model)==null?void 0:o.id)!==(s==null?void 0:s.id)||((i=this.client.authStore.model)==null?void 0:i.collectionId)!==this.collectionIdOrName&&((a=this.client.authStore.model)==null?void 0:a.collectionName)!==this.collectionIdOrName||this.client.authStore.save(this.client.authStore.token,s),s})}async delete(t,r){return super.delete(t,r).then(n=>{var s,o,i;return!n||((s=this.client.authStore.model)==null?void 0:s.id)!==t||((o=this.client.authStore.model)==null?void 0:o.collectionId)!==this.collectionIdOrName&&((i=this.client.authStore.model)==null?void 0:i.collectionName)!==this.collectionIdOrName||this.client.authStore.clear(),n})}authResponse(t){const r=this.decode((t==null?void 0:t.record)||{});return this.client.authStore.save(t==null?void 0:t.token,r),Object.assign({},t,{token:(t==null?void 0:t.token)||"",record:r})}async listAuthMethods(t){return t=Object.assign({method:"GET"},t),this.client.send(this.baseCollectionPath+"/auth-methods",t).then(r=>Object.assign({},r,{usernamePassword:!!(r!=null&&r.usernamePassword),emailPassword:!!(r!=null&&r.emailPassword),authProviders:Array.isArray(r==null?void 0:r.authProviders)?r==null?void 0:r.authProviders:[]}))}async authWithPassword(t,r,n,s){let o={method:"POST",body:{identity:t,password:r}};return o=Dr("This form of authWithPassword(usernameOrEmail, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(usernameOrEmail, pass, options?).",o,n,s),this.client.send(this.baseCollectionPath+"/auth-with-password",o).then(i=>this.authResponse(i))}async authWithOAuth2Code(t,r,n,s,o,i,a){let c={method:"POST",body:{provider:t,code:r,codeVerifier:n,redirectUrl:s,createData:o}};return c=Dr("This form of authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, body?, query?) is deprecated. Consider replacing it with authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, options?).",c,i,a),this.client.send(this.baseCollectionPath+"/auth-with-oauth2",c).then(u=>this.authResponse(u))}authWithOAuth2(...t){if(t.length>1||typeof(t==null?void 0:t[0])=="string")return console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),this.authWithOAuth2Code((t==null?void 0:t[0])||"",(t==null?void 0:t[1])||"",(t==null?void 0:t[2])||"",(t==null?void 0:t[3])||"",(t==null?void 0:t[4])||{},(t==null?void 0:t[5])||{},(t==null?void 0:t[6])||{});const r=(t==null?void 0:t[0])||{};let n=null;r.urlCallback||(n=G0(void 0));const s=new fk(this.client);function o(){n==null||n.close(),s.unsubscribe()}const i={},a=r.requestKey;return a&&(i.requestKey=a),this.listAuthMethods(i).then(c=>{var m;const u=c.authProviders.find(y=>y.name===r.provider);if(!u)throw new Vr(new Error(`Missing or invalid provider "${r.provider}".`));const d=this.client.buildUrl("/api/oauth2-redirect"),f=a?(m=this.client.cancelControllers)==null?void 0:m[a]:void 0;return f&&(f.signal.onabort=()=>{o()}),new Promise(async(y,x)=>{var g;try{await s.subscribe("@oauth2",async w=>{var j;const C=s.clientId;try{if(!w.state||C!==w.state)throw new Error("State parameters don't match.");if(w.error||!w.code)throw new Error("OAuth2 redirect error or missing code: "+w.error);const E=Object.assign({},r);delete E.provider,delete E.scopes,delete E.createData,delete E.urlCallback,(j=f==null?void 0:f.signal)!=null&&j.onabort&&(f.signal.onabort=null);const R=await this.authWithOAuth2Code(u.name,w.code,u.codeVerifier,d,r.createData,E);y(R)}catch(E){x(new Vr(E))}o()});const _={state:s.clientId};(g=r.scopes)!=null&&g.length&&(_.scope=r.scopes.join(" "));const p=this._replaceQueryParams(u.authUrl+d,_);await(r.urlCallback||function(w){n?n.location.href=w:n=G0(w)})(p)}catch(_){o(),x(new Vr(_))}})}).catch(c=>{throw o(),c})}async authRefresh(t,r){let n={method:"POST"};return n=Dr("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",n,t,r),this.client.send(this.baseCollectionPath+"/auth-refresh",n).then(s=>this.authResponse(s))}async requestPasswordReset(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-password-reset",s).then(()=>!0)}async confirmPasswordReset(t,r,n,s,o){let i={method:"POST",body:{token:t,password:r,passwordConfirm:n}};return i=Dr("This form of confirmPasswordReset(token, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(token, password, passwordConfirm, options?).",i,s,o),this.client.send(this.baseCollectionPath+"/confirm-password-reset",i).then(()=>!0)}async requestVerification(t,r,n){let s={method:"POST",body:{email:t}};return s=Dr("This form of requestVerification(email, body?, query?) is deprecated. Consider replacing it with requestVerification(email, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-verification",s).then(()=>!0)}async confirmVerification(t,r,n){let s={method:"POST",body:{token:t}};return s=Dr("This form of confirmVerification(token, body?, query?) is deprecated. Consider replacing it with confirmVerification(token, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/confirm-verification",s).then(()=>{const o=Ji(t),i=this.client.authStore.model;return i&&!i.verified&&i.id===o.id&&i.collectionId===o.collectionId&&(i.verified=!0,this.client.authStore.save(this.client.authStore.token,i)),!0})}async requestEmailChange(t,r,n){let s={method:"POST",body:{newEmail:t}};return s=Dr("This form of requestEmailChange(newEmail, body?, query?) is deprecated. Consider replacing it with requestEmailChange(newEmail, options?).",s,r,n),this.client.send(this.baseCollectionPath+"/request-email-change",s).then(()=>!0)}async confirmEmailChange(t,r,n,s){let o={method:"POST",body:{token:t,password:r}};return o=Dr("This form of confirmEmailChange(token, password, body?, query?) is deprecated. Consider replacing it with confirmEmailChange(token, password, options?).",o,n,s),this.client.send(this.baseCollectionPath+"/confirm-email-change",o).then(()=>{const i=Ji(t),a=this.client.authStore.model;return a&&a.id===i.id&&a.collectionId===i.collectionId&&this.client.authStore.clear(),!0})}async listExternalAuths(t,r){return r=Object.assign({method:"GET"},r),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t)+"/external-auths",r)}async unlinkExternalAuth(t,r,n){return n=Object.assign({method:"DELETE"},n),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(t)+"/external-auths/"+encodeURIComponent(r),n).then(()=>!0)}_replaceQueryParams(t,r={}){let n=t,s="";t.indexOf("?")>=0&&(n=t.substring(0,t.indexOf("?")),s=t.substring(t.indexOf("?")+1));const o={},i=s.split("&");for(const a of i){if(a=="")continue;const c=a.split("=");o[decodeURIComponent(c[0].replace(/\+/g," "))]=decodeURIComponent((c[1]||"").replace(/\+/g," "))}for(let a in r)r.hasOwnProperty(a)&&(r[a]==null?delete o[a]:o[a]=r[a]);s="";for(let a in o)o.hasOwnProperty(a)&&(s!=""&&(s+="&"),s+=encodeURIComponent(a.replace(/%20/g,"+"))+"="+encodeURIComponent(o[a].replace(/%20/g,"+")));return s!=""?n+"?"+s:n}}function G0(e){if(typeof window>"u"||!(window!=null&&window.open))throw new Vr(new Error("Not in a browser context - please pass a custom urlCallback function."));let t=1024,r=768,n=window.innerWidth,s=window.innerHeight;t=t>n?n:t,r=r>s?s:r;let o=n/2-t/2,i=s/2-r/2;return window.open(e,"popup_window","width="+t+",height="+r+",top="+i+",left="+o+",resizable,menubar=no")}class fL extends bv{get baseCrudPath(){return"/api/collections"}async import(t,r=!1,n){return n=Object.assign({method:"PUT",body:{collections:t,deleteMissing:r}},n),this.client.send(this.baseCrudPath+"/import",n).then(()=>!0)}}class hL extends di{async getList(t=1,r=30,n){return(n=Object.assign({method:"GET"},n)).query=Object.assign({page:t,perPage:r},n.query),this.client.send("/api/logs",n)}async getOne(t,r){if(!t)throw new Vr({url:this.client.buildUrl("/api/logs/"),status:404,response:{code:404,message:"Missing required log id.",data:{}}});return r=Object.assign({method:"GET"},r),this.client.send("/api/logs/"+encodeURIComponent(t),r)}async getStats(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/logs/stats",t)}}class pL extends di{async check(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/health",t)}}class mL extends di{getUrl(t,r,n={}){if(!r||!(t!=null&&t.id)||!(t!=null&&t.collectionId)&&!(t!=null&&t.collectionName))return"";const s=[];s.push("api"),s.push("files"),s.push(encodeURIComponent(t.collectionId||t.collectionName)),s.push(encodeURIComponent(t.id)),s.push(encodeURIComponent(r));let o=this.client.buildUrl(s.join("/"));if(Object.keys(n).length){n.download===!1&&delete n.download;const i=new URLSearchParams(n);o+=(o.includes("?")?"&":"?")+i}return o}async getToken(t){return t=Object.assign({method:"POST"},t),this.client.send("/api/files/token",t).then(r=>(r==null?void 0:r.token)||"")}}class gL extends di{async getFullList(t){return t=Object.assign({method:"GET"},t),this.client.send("/api/backups",t)}async create(t,r){return r=Object.assign({method:"POST",body:{name:t}},r),this.client.send("/api/backups",r).then(()=>!0)}async upload(t,r){return r=Object.assign({method:"POST",body:t},r),this.client.send("/api/backups/upload",r).then(()=>!0)}async delete(t,r){return r=Object.assign({method:"DELETE"},r),this.client.send(`/api/backups/${encodeURIComponent(t)}`,r).then(()=>!0)}async restore(t,r){return r=Object.assign({method:"POST"},r),this.client.send(`/api/backups/${encodeURIComponent(t)}/restore`,r).then(()=>!0)}getDownloadUrl(t,r){return this.client.buildUrl(`/api/backups/${encodeURIComponent(r)}?token=${encodeURIComponent(t)}`)}}class vL{constructor(t="/",r,n="en-US"){this.cancelControllers={},this.recordServices={},this.enableAutoCancellation=!0,this.baseUrl=t,this.lang=n,this.authStore=r||new aL,this.admins=new cL(this),this.collections=new fL(this),this.files=new mL(this),this.logs=new hL(this),this.settings=new lL(this),this.realtime=new fk(this),this.health=new pL(this),this.backups=new gL(this)}collection(t){return this.recordServices[t]||(this.recordServices[t]=new dL(this,t)),this.recordServices[t]}autoCancellation(t){return this.enableAutoCancellation=!!t,this}cancelRequest(t){return this.cancelControllers[t]&&(this.cancelControllers[t].abort(),delete this.cancelControllers[t]),this}cancelAllRequests(){for(let t in this.cancelControllers)this.cancelControllers[t].abort();return this.cancelControllers={},this}filter(t,r){if(!r)return t;for(let n in r){let s=r[n];switch(typeof s){case"boolean":case"number":s=""+s;break;case"string":s="'"+s.replace(/'/g,"\\'")+"'";break;default:s=s===null?"null":s instanceof Date?"'"+s.toISOString().replace("T"," ")+"'":"'"+JSON.stringify(s).replace(/'/g,"\\'")+"'"}t=t.replaceAll("{:"+n+"}",s)}return t}getFileUrl(t,r,n={}){return this.files.getUrl(t,r,n)}buildUrl(t){var n;let r=this.baseUrl;return typeof window>"u"||!window.location||r.startsWith("https://")||r.startsWith("http://")||(r=(n=window.location.origin)!=null&&n.endsWith("/")?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(r+=window.location.pathname||"/",r+=r.endsWith("/")?"":"/"),r+=this.baseUrl),t&&(r+=r.endsWith("/")?"":"/",r+=t.startsWith("/")?t.substring(1):t),r}async send(t,r){r=this.initSendOptions(t,r);let n=this.buildUrl(t);if(this.beforeSend){const s=Object.assign({},await this.beforeSend(n,r));s.url!==void 0||s.options!==void 0?(n=s.url||n,r=s.options||r):Object.keys(s).length&&(r=s,console!=null&&console.warn&&console.warn("Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`."))}if(r.query!==void 0){const s=this.serializeQueryParams(r.query);s&&(n+=(n.includes("?")?"&":"?")+s),delete r.query}return this.getHeader(r.headers,"Content-Type")=="application/json"&&r.body&&typeof r.body!="string"&&(r.body=JSON.stringify(r.body)),(r.fetch||fetch)(n,r).then(async s=>{let o={};try{o=await s.json()}catch{}if(this.afterSend&&(o=await this.afterSend(s,o)),s.status>=400)throw new Vr({url:s.url,status:s.status,data:o});return o}).catch(s=>{throw new Vr(s)})}initSendOptions(t,r){if((r=Object.assign({method:"GET"},r)).body=this.convertToFormDataIfNeeded(r.body),dk(r),r.query=Object.assign({},r.params,r.query),r.requestKey===void 0&&(r.$autoCancel===!1||r.query.$autoCancel===!1?r.requestKey=null:(r.$cancelKey||r.query.$cancelKey)&&(r.requestKey=r.$cancelKey||r.query.$cancelKey)),delete r.$autoCancel,delete r.query.$autoCancel,delete r.$cancelKey,delete r.query.$cancelKey,this.getHeader(r.headers,"Content-Type")!==null||this.isFormData(r.body)||(r.headers=Object.assign({},r.headers,{"Content-Type":"application/json"})),this.getHeader(r.headers,"Accept-Language")===null&&(r.headers=Object.assign({},r.headers,{"Accept-Language":this.lang})),this.authStore.token&&this.getHeader(r.headers,"Authorization")===null&&(r.headers=Object.assign({},r.headers,{Authorization:this.authStore.token})),this.enableAutoCancellation&&r.requestKey!==null){const n=r.requestKey||(r.method||"GET")+t;delete r.requestKey,this.cancelRequest(n);const s=new AbortController;this.cancelControllers[n]=s,r.signal=s.signal}return r}convertToFormDataIfNeeded(t){if(typeof FormData>"u"||t===void 0||typeof t!="object"||t===null||this.isFormData(t)||!this.hasBlobField(t))return t;const r=new FormData;for(const n in t){const s=t[n];if(typeof s!="object"||this.hasBlobField({data:s})){const o=Array.isArray(s)?s:[s];for(let i of o)r.append(n,i)}else{let o={};o[n]=s,r.append("@jsonPayload",JSON.stringify(o))}}return r}hasBlobField(t){for(const r in t){const n=Array.isArray(t[r])?t[r]:[t[r]];for(const s of n)if(typeof Blob<"u"&&s instanceof Blob||typeof File<"u"&&s instanceof File)return!0}return!1}getHeader(t,r){t=t||{},r=r.toLowerCase();for(let n in t)if(n.toLowerCase()==r)return t[n];return null}isFormData(t){return t&&(t.constructor.name==="FormData"||typeof FormData<"u"&&t instanceof FormData)}serializeQueryParams(t){const r=[];for(const n in t){if(t[n]===null)continue;const s=t[n],o=encodeURIComponent(n);if(Array.isArray(s))for(const i of s)r.push(o+"="+encodeURIComponent(i));else s instanceof Date?r.push(o+"="+encodeURIComponent(s.toISOString())):typeof s!==null&&typeof s=="object"?r.push(o+"="+encodeURIComponent(JSON.stringify(s))):r.push(o+"="+encodeURIComponent(s))}return r.join("&")}}var yL={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const xL=yL.VITE_API_DOMAIN;console.log(xL);let wu;const st=()=>wu||(wu=new vL("/"),wu);//! moment.js -//! version : 2.30.1 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com -var hk;function ve(){return hk.apply(null,arguments)}function wL(e){hk=e}function Cn(e){return e instanceof Array||Object.prototype.toString.call(e)==="[object Array]"}function Zo(e){return e!=null&&Object.prototype.toString.call(e)==="[object Object]"}function ct(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Sv(e){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(e).length===0;var t;for(t in e)if(ct(e,t))return!1;return!0}function _r(e){return e===void 0}function Cs(e){return typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]"}function Pc(e){return e instanceof Date||Object.prototype.toString.call(e)==="[object Date]"}function pk(e,t){var r=[],n,s=e.length;for(n=0;n>>0,n;for(n=0;n0)for(r=0;r=0;return(o?r?"+":"":"-")+Math.pow(10,Math.max(0,s)).toString().substr(1)+n}var Ev=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,_u=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,qh={},ea={};function Ie(e,t,r,n){var s=n;typeof n=="string"&&(s=function(){return this[n]()}),e&&(ea[e]=s),t&&(ea[t[0]]=function(){return Hn(s.apply(this,arguments),t[1],t[2])}),r&&(ea[r]=function(){return this.localeData().ordinal(s.apply(this,arguments),e)})}function CL(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function jL(e){var t=e.match(Ev),r,n;for(r=0,n=t.length;r=0&&_u.test(e);)e=e.replace(_u,n),_u.lastIndex=0,r-=1;return e}var EL={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function NL(e){var t=this._longDateFormat[e],r=this._longDateFormat[e.toUpperCase()];return t||!r?t:(this._longDateFormat[e]=r.match(Ev).map(function(n){return n==="MMMM"||n==="MM"||n==="DD"||n==="dddd"?n.slice(1):n}).join(""),this._longDateFormat[e])}var TL="Invalid date";function RL(){return this._invalidDate}var PL="%d",AL=/\d{1,2}/;function DL(e){return this._ordinal.replace("%d",e)}var OL={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function ML(e,t,r,n){var s=this._relativeTime[r];return Gn(s)?s(e,t,r,n):s.replace(/%d/i,e)}function IL(e,t){var r=this._relativeTime[e>0?"future":"past"];return Gn(r)?r(t):r.replace(/%s/i,t)}var Q0={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function ln(e){return typeof e=="string"?Q0[e]||Q0[e.toLowerCase()]:void 0}function Nv(e){var t={},r,n;for(n in e)ct(e,n)&&(r=ln(n),r&&(t[r]=e[n]));return t}var LL={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function FL(e){var t=[],r;for(r in e)ct(e,r)&&t.push({unit:r,priority:LL[r]});return t.sort(function(n,s){return n.priority-s.priority}),t}var yk=/\d/,Zr=/\d\d/,xk=/\d{3}/,Tv=/\d{4}/,Af=/[+-]?\d{6}/,Ct=/\d\d?/,wk=/\d\d\d\d?/,_k=/\d\d\d\d\d\d?/,Df=/\d{1,3}/,Rv=/\d{1,4}/,Of=/[+-]?\d{1,6}/,Aa=/\d+/,Mf=/[+-]?\d+/,zL=/Z|[+-]\d\d:?\d\d/gi,If=/Z|[+-]\d\d(?::?\d\d)?/gi,UL=/[+-]?\d+(\.\d{1,3})?/,Dc=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Da=/^[1-9]\d?/,Pv=/^([1-9]\d|\d)/,Td;Td={};function _e(e,t,r){Td[e]=Gn(t)?t:function(n,s){return n&&r?r:t}}function $L(e,t){return ct(Td,e)?Td[e](t._strict,t._locale):new RegExp(VL(e))}function VL(e){return gs(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,r,n,s,o){return r||n||s||o}))}function gs(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Jr(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function rt(e){var t=+e,r=0;return t!==0&&isFinite(t)&&(r=Jr(t)),r}var pm={};function vt(e,t){var r,n=t,s;for(typeof e=="string"&&(e=[e]),Cs(t)&&(n=function(o,i){i[t]=rt(o)}),s=e.length,r=0;r68?1900:2e3)};var bk=Oa("FullYear",!0);function YL(){return Lf(this.year())}function Oa(e,t){return function(r){return r!=null?(Sk(this,e,r),ve.updateOffset(this,t),this):Xl(this,e)}}function Xl(e,t){if(!e.isValid())return NaN;var r=e._d,n=e._isUTC;switch(t){case"Milliseconds":return n?r.getUTCMilliseconds():r.getMilliseconds();case"Seconds":return n?r.getUTCSeconds():r.getSeconds();case"Minutes":return n?r.getUTCMinutes():r.getMinutes();case"Hours":return n?r.getUTCHours():r.getHours();case"Date":return n?r.getUTCDate():r.getDate();case"Day":return n?r.getUTCDay():r.getDay();case"Month":return n?r.getUTCMonth():r.getMonth();case"FullYear":return n?r.getUTCFullYear():r.getFullYear();default:return NaN}}function Sk(e,t,r){var n,s,o,i,a;if(!(!e.isValid()||isNaN(r))){switch(n=e._d,s=e._isUTC,t){case"Milliseconds":return void(s?n.setUTCMilliseconds(r):n.setMilliseconds(r));case"Seconds":return void(s?n.setUTCSeconds(r):n.setSeconds(r));case"Minutes":return void(s?n.setUTCMinutes(r):n.setMinutes(r));case"Hours":return void(s?n.setUTCHours(r):n.setHours(r));case"Date":return void(s?n.setUTCDate(r):n.setDate(r));case"FullYear":break;default:return}o=r,i=e.month(),a=e.date(),a=a===29&&i===1&&!Lf(o)?28:a,s?n.setUTCFullYear(o,i,a):n.setFullYear(o,i,a)}}function ZL(e){return e=ln(e),Gn(this[e])?this[e]():this}function KL(e,t){if(typeof e=="object"){e=Nv(e);var r=FL(e),n,s=r.length;for(n=0;n=0?(a=new Date(e+400,t,r,n,s,o,i),isFinite(a.getFullYear())&&a.setFullYear(e)):a=new Date(e,t,r,n,s,o,i),a}function Ql(e){var t,r;return e<100&&e>=0?(r=Array.prototype.slice.call(arguments),r[0]=e+400,t=new Date(Date.UTC.apply(null,r)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Rd(e,t,r){var n=7+t-r,s=(7+Ql(e,0,n).getUTCDay()-t)%7;return-s+n-1}function Tk(e,t,r,n,s){var o=(7+r-n)%7,i=Rd(e,n,s),a=1+7*(t-1)+o+i,c,u;return a<=0?(c=e-1,u=bl(c)+a):a>bl(e)?(c=e+1,u=a-bl(e)):(c=e,u=a),{year:c,dayOfYear:u}}function Jl(e,t,r){var n=Rd(e.year(),t,r),s=Math.floor((e.dayOfYear()-n-1)/7)+1,o,i;return s<1?(i=e.year()-1,o=s+vs(i,t,r)):s>vs(e.year(),t,r)?(o=s-vs(e.year(),t,r),i=e.year()+1):(i=e.year(),o=s),{week:o,year:i}}function vs(e,t,r){var n=Rd(e,t,r),s=Rd(e+1,t,r);return(bl(e)-n+s)/7}Ie("w",["ww",2],"wo","week");Ie("W",["WW",2],"Wo","isoWeek");_e("w",Ct,Da);_e("ww",Ct,Zr);_e("W",Ct,Da);_e("WW",Ct,Zr);Oc(["w","ww","W","WW"],function(e,t,r,n){t[n.substr(0,1)]=rt(e)});function a4(e){return Jl(e,this._week.dow,this._week.doy).week}var l4={dow:0,doy:6};function c4(){return this._week.dow}function u4(){return this._week.doy}function d4(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function f4(e){var t=Jl(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}Ie("d",0,"do","day");Ie("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)});Ie("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)});Ie("dddd",0,0,function(e){return this.localeData().weekdays(this,e)});Ie("e",0,0,"weekday");Ie("E",0,0,"isoWeekday");_e("d",Ct);_e("e",Ct);_e("E",Ct);_e("dd",function(e,t){return t.weekdaysMinRegex(e)});_e("ddd",function(e,t){return t.weekdaysShortRegex(e)});_e("dddd",function(e,t){return t.weekdaysRegex(e)});Oc(["dd","ddd","dddd"],function(e,t,r,n){var s=r._locale.weekdaysParse(e,n,r._strict);s!=null?t.d=s:Xe(r).invalidWeekday=e});Oc(["d","e","E"],function(e,t,r,n){t[n]=rt(e)});function h4(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function p4(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Dv(e,t){return e.slice(t,7).concat(e.slice(0,t))}var m4="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Rk="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),g4="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),v4=Dc,y4=Dc,x4=Dc;function w4(e,t){var r=Cn(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?Dv(r,this._week.dow):e?r[e.day()]:r}function _4(e){return e===!0?Dv(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function b4(e){return e===!0?Dv(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function S4(e,t,r){var n,s,o,i=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)o=Kn([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(o,"").toLocaleLowerCase();return r?t==="dddd"?(s=zt.call(this._weekdaysParse,i),s!==-1?s:null):t==="ddd"?(s=zt.call(this._shortWeekdaysParse,i),s!==-1?s:null):(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null):t==="dddd"?(s=zt.call(this._weekdaysParse,i),s!==-1||(s=zt.call(this._shortWeekdaysParse,i),s!==-1)?s:(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null)):t==="ddd"?(s=zt.call(this._shortWeekdaysParse,i),s!==-1||(s=zt.call(this._weekdaysParse,i),s!==-1)?s:(s=zt.call(this._minWeekdaysParse,i),s!==-1?s:null)):(s=zt.call(this._minWeekdaysParse,i),s!==-1||(s=zt.call(this._weekdaysParse,i),s!==-1)?s:(s=zt.call(this._shortWeekdaysParse,i),s!==-1?s:null))}function k4(e,t,r){var n,s,o;if(this._weekdaysParseExact)return S4.call(this,e,t,r);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(s=Kn([2e3,1]).day(n),r&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(s,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(s,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(s,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[n]||(o="^"+this.weekdays(s,"")+"|^"+this.weekdaysShort(s,"")+"|^"+this.weekdaysMin(s,""),this._weekdaysParse[n]=new RegExp(o.replace(".",""),"i")),r&&t==="dddd"&&this._fullWeekdaysParse[n].test(e))return n;if(r&&t==="ddd"&&this._shortWeekdaysParse[n].test(e))return n;if(r&&t==="dd"&&this._minWeekdaysParse[n].test(e))return n;if(!r&&this._weekdaysParse[n].test(e))return n}}function C4(e){if(!this.isValid())return e!=null?this:NaN;var t=Xl(this,"Day");return e!=null?(e=h4(e,this.localeData()),this.add(e-t,"d")):t}function j4(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function E4(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=p4(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function N4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(ct(this,"_weekdaysRegex")||(this._weekdaysRegex=v4),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function T4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(ct(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=y4),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function R4(e){return this._weekdaysParseExact?(ct(this,"_weekdaysRegex")||Ov.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(ct(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=x4),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ov(){function e(d,f){return f.length-d.length}var t=[],r=[],n=[],s=[],o,i,a,c,u;for(o=0;o<7;o++)i=Kn([2e3,1]).day(o),a=gs(this.weekdaysMin(i,"")),c=gs(this.weekdaysShort(i,"")),u=gs(this.weekdays(i,"")),t.push(a),r.push(c),n.push(u),s.push(a),s.push(c),s.push(u);t.sort(e),r.sort(e),n.sort(e),s.sort(e),this._weekdaysRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function Mv(){return this.hours()%12||12}function P4(){return this.hours()||24}Ie("H",["HH",2],0,"hour");Ie("h",["hh",2],0,Mv);Ie("k",["kk",2],0,P4);Ie("hmm",0,0,function(){return""+Mv.apply(this)+Hn(this.minutes(),2)});Ie("hmmss",0,0,function(){return""+Mv.apply(this)+Hn(this.minutes(),2)+Hn(this.seconds(),2)});Ie("Hmm",0,0,function(){return""+this.hours()+Hn(this.minutes(),2)});Ie("Hmmss",0,0,function(){return""+this.hours()+Hn(this.minutes(),2)+Hn(this.seconds(),2)});function Pk(e,t){Ie(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}Pk("a",!0);Pk("A",!1);function Ak(e,t){return t._meridiemParse}_e("a",Ak);_e("A",Ak);_e("H",Ct,Pv);_e("h",Ct,Da);_e("k",Ct,Da);_e("HH",Ct,Zr);_e("hh",Ct,Zr);_e("kk",Ct,Zr);_e("hmm",wk);_e("hmmss",_k);_e("Hmm",wk);_e("Hmmss",_k);vt(["H","HH"],Gt);vt(["k","kk"],function(e,t,r){var n=rt(e);t[Gt]=n===24?0:n});vt(["a","A"],function(e,t,r){r._isPm=r._locale.isPM(e),r._meridiem=e});vt(["h","hh"],function(e,t,r){t[Gt]=rt(e),Xe(r).bigHour=!0});vt("hmm",function(e,t,r){var n=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n)),Xe(r).bigHour=!0});vt("hmmss",function(e,t,r){var n=e.length-4,s=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n,2)),t[hs]=rt(e.substr(s)),Xe(r).bigHour=!0});vt("Hmm",function(e,t,r){var n=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n))});vt("Hmmss",function(e,t,r){var n=e.length-4,s=e.length-2;t[Gt]=rt(e.substr(0,n)),t[vn]=rt(e.substr(n,2)),t[hs]=rt(e.substr(s))});function A4(e){return(e+"").toLowerCase().charAt(0)==="p"}var D4=/[ap]\.?m?\.?/i,O4=Oa("Hours",!0);function M4(e,t,r){return e>11?r?"pm":"PM":r?"am":"AM"}var Dk={calendar:SL,longDateFormat:EL,invalidDate:TL,ordinal:PL,dayOfMonthOrdinalParse:AL,relativeTime:OL,months:qL,monthsShort:kk,week:l4,weekdays:m4,weekdaysMin:g4,weekdaysShort:Rk,meridiemParse:D4},Nt={},Xa={},ec;function I4(e,t){var r,n=Math.min(e.length,t.length);for(r=0;r0;){if(s=Ff(o.slice(0,r).join("-")),s)return s;if(n&&n.length>=r&&I4(o,n)>=r-1)break;r--}t++}return ec}function F4(e){return!!(e&&e.match("^[^/\\\\]*$"))}function Ff(e){var t=null,r;if(Nt[e]===void 0&&typeof Gu<"u"&&Gu&&Gu.exports&&F4(e))try{t=ec._abbr,r=require,r("./locale/"+e),co(t)}catch{Nt[e]=null}return Nt[e]}function co(e,t){var r;return e&&(_r(t)?r=As(e):r=Iv(e,t),r?ec=r:typeof console<"u"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),ec._abbr}function Iv(e,t){if(t!==null){var r,n=Dk;if(t.abbr=e,Nt[e]!=null)gk("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=Nt[e]._config;else if(t.parentLocale!=null)if(Nt[t.parentLocale]!=null)n=Nt[t.parentLocale]._config;else if(r=Ff(t.parentLocale),r!=null)n=r._config;else return Xa[t.parentLocale]||(Xa[t.parentLocale]=[]),Xa[t.parentLocale].push({name:e,config:t}),null;return Nt[e]=new jv(fm(n,t)),Xa[e]&&Xa[e].forEach(function(s){Iv(s.name,s.config)}),co(e),Nt[e]}else return delete Nt[e],null}function z4(e,t){if(t!=null){var r,n,s=Dk;Nt[e]!=null&&Nt[e].parentLocale!=null?Nt[e].set(fm(Nt[e]._config,t)):(n=Ff(e),n!=null&&(s=n._config),t=fm(s,t),n==null&&(t.abbr=e),r=new jv(t),r.parentLocale=Nt[e],Nt[e]=r),co(e)}else Nt[e]!=null&&(Nt[e].parentLocale!=null?(Nt[e]=Nt[e].parentLocale,e===co()&&co(e)):Nt[e]!=null&&delete Nt[e]);return Nt[e]}function As(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return ec;if(!Cn(e)){if(t=Ff(e),t)return t;e=[e]}return L4(e)}function U4(){return hm(Nt)}function Lv(e){var t,r=e._a;return r&&Xe(e).overflow===-2&&(t=r[fs]<0||r[fs]>11?fs:r[Ln]<1||r[Ln]>Av(r[ar],r[fs])?Ln:r[Gt]<0||r[Gt]>24||r[Gt]===24&&(r[vn]!==0||r[hs]!==0||r[Wo]!==0)?Gt:r[vn]<0||r[vn]>59?vn:r[hs]<0||r[hs]>59?hs:r[Wo]<0||r[Wo]>999?Wo:-1,Xe(e)._overflowDayOfYear&&(tLn)&&(t=Ln),Xe(e)._overflowWeeks&&t===-1&&(t=BL),Xe(e)._overflowWeekday&&t===-1&&(t=HL),Xe(e).overflow=t),e}var $4=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,V4=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,W4=/Z|[+-]\d\d(?::?\d\d)?/,bu=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Xh=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],B4=/^\/?Date\((-?\d+)/i,H4=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Y4={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Ok(e){var t,r,n=e._i,s=$4.exec(n)||V4.exec(n),o,i,a,c,u=bu.length,d=Xh.length;if(s){for(Xe(e).iso=!0,t=0,r=u;tbl(i)||e._dayOfYear===0)&&(Xe(e)._overflowDayOfYear=!0),r=Ql(i,0,e._dayOfYear),e._a[fs]=r.getUTCMonth(),e._a[Ln]=r.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=n[t]=s[t];for(;t<7;t++)e._a[t]=n[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[Gt]===24&&e._a[vn]===0&&e._a[hs]===0&&e._a[Wo]===0&&(e._nextDay=!0,e._a[Gt]=0),e._d=(e._useUTC?Ql:i4).apply(null,n),o=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Gt]=24),e._w&&typeof e._w.d<"u"&&e._w.d!==o&&(Xe(e).weekdayMismatch=!0)}}function e5(e){var t,r,n,s,o,i,a,c,u;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(o=1,i=4,r=Ci(t.GG,e._a[ar],Jl(kt(),1,4).year),n=Ci(t.W,1),s=Ci(t.E,1),(s<1||s>7)&&(c=!0)):(o=e._locale._week.dow,i=e._locale._week.doy,u=Jl(kt(),o,i),r=Ci(t.gg,e._a[ar],u.year),n=Ci(t.w,u.week),t.d!=null?(s=t.d,(s<0||s>6)&&(c=!0)):t.e!=null?(s=t.e+o,(t.e<0||t.e>6)&&(c=!0)):s=o),n<1||n>vs(r,o,i)?Xe(e)._overflowWeeks=!0:c!=null?Xe(e)._overflowWeekday=!0:(a=Tk(r,n,s,o,i),e._a[ar]=a.year,e._dayOfYear=a.dayOfYear)}ve.ISO_8601=function(){};ve.RFC_2822=function(){};function zv(e){if(e._f===ve.ISO_8601){Ok(e);return}if(e._f===ve.RFC_2822){Mk(e);return}e._a=[],Xe(e).empty=!0;var t=""+e._i,r,n,s,o,i,a=t.length,c=0,u,d;for(s=vk(e._f,e._locale).match(Ev)||[],d=s.length,r=0;r0&&Xe(e).unusedInput.push(i),t=t.slice(t.indexOf(n)+n.length),c+=n.length),ea[o]?(n?Xe(e).empty=!1:Xe(e).unusedTokens.push(o),WL(o,n,e)):e._strict&&!n&&Xe(e).unusedTokens.push(o);Xe(e).charsLeftOver=a-c,t.length>0&&Xe(e).unusedInput.push(t),e._a[Gt]<=12&&Xe(e).bigHour===!0&&e._a[Gt]>0&&(Xe(e).bigHour=void 0),Xe(e).parsedDateParts=e._a.slice(0),Xe(e).meridiem=e._meridiem,e._a[Gt]=t5(e._locale,e._a[Gt],e._meridiem),u=Xe(e).era,u!==null&&(e._a[ar]=e._locale.erasConvertYear(u,e._a[ar])),Fv(e),Lv(e)}function t5(e,t,r){var n;return r==null?t:e.meridiemHour!=null?e.meridiemHour(t,r):(e.isPM!=null&&(n=e.isPM(r),n&&t<12&&(t+=12),!n&&t===12&&(t=0)),t)}function r5(e){var t,r,n,s,o,i,a=!1,c=e._f.length;if(c===0){Xe(e).invalidFormat=!0,e._d=new Date(NaN);return}for(s=0;sthis?this:e:Pf()});function Fk(e,t){var r,n;if(t.length===1&&Cn(t[0])&&(t=t[0]),!t.length)return kt();for(r=t[0],n=1;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function S5(){if(!_r(this._isDSTShifted))return this._isDSTShifted;var e={},t;return Cv(e,this),e=Ik(e),e._a?(t=e._isUTC?Kn(e._a):kt(e._a),this._isDSTShifted=this.isValid()&&p5(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function k5(){return this.isValid()?!this._isUTC:!1}function C5(){return this.isValid()?this._isUTC:!1}function Uk(){return this.isValid()?this._isUTC&&this._offset===0:!1}var j5=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,E5=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Rn(e,t){var r=e,n=null,s,o,i;return Bu(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:Cs(e)||!isNaN(+e)?(r={},t?r[t]=+e:r.milliseconds=+e):(n=j5.exec(e))?(s=n[1]==="-"?-1:1,r={y:0,d:rt(n[Ln])*s,h:rt(n[Gt])*s,m:rt(n[vn])*s,s:rt(n[hs])*s,ms:rt(mm(n[Wo]*1e3))*s}):(n=E5.exec(e))?(s=n[1]==="-"?-1:1,r={y:Po(n[2],s),M:Po(n[3],s),w:Po(n[4],s),d:Po(n[5],s),h:Po(n[6],s),m:Po(n[7],s),s:Po(n[8],s)}):r==null?r={}:typeof r=="object"&&("from"in r||"to"in r)&&(i=N5(kt(r.from),kt(r.to)),r={},r.ms=i.milliseconds,r.M=i.months),o=new zf(r),Bu(e)&&ct(e,"_locale")&&(o._locale=e._locale),Bu(e)&&ct(e,"_isValid")&&(o._isValid=e._isValid),o}Rn.fn=zf.prototype;Rn.invalid=h5;function Po(e,t){var r=e&&parseFloat(e.replace(",","."));return(isNaN(r)?0:r)*t}function ew(e,t){var r={};return r.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(r.months,"M").isAfter(t)&&--r.months,r.milliseconds=+t-+e.clone().add(r.months,"M"),r}function N5(e,t){var r;return e.isValid()&&t.isValid()?(t=$v(t,e),e.isBefore(t)?r=ew(e,t):(r=ew(t,e),r.milliseconds=-r.milliseconds,r.months=-r.months),r):{milliseconds:0,months:0}}function $k(e,t){return function(r,n){var s,o;return n!==null&&!isNaN(+n)&&(gk(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=r,r=n,n=o),s=Rn(r,n),Vk(this,s,e),this}}function Vk(e,t,r,n){var s=t._milliseconds,o=mm(t._days),i=mm(t._months);e.isValid()&&(n=n??!0,i&&jk(e,Xl(e,"Month")+i*r),o&&Sk(e,"Date",Xl(e,"Date")+o*r),s&&e._d.setTime(e._d.valueOf()+s*r),n&&ve.updateOffset(e,o||i))}var T5=$k(1,"add"),R5=$k(-1,"subtract");function Wk(e){return typeof e=="string"||e instanceof String}function P5(e){return jn(e)||Pc(e)||Wk(e)||Cs(e)||D5(e)||A5(e)||e===null||e===void 0}function A5(e){var t=Zo(e)&&!Sv(e),r=!1,n=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],s,o,i=n.length;for(s=0;sr.valueOf():r.valueOf()9999?Wu(r,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Gn(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Wu(r,"Z")):Wu(r,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Z5(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",r,n,s,o;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),r="["+e+'("]',n=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",s="-MM-DD[T]HH:mm:ss.SSS",o=t+'[")]',this.format(r+n+s+o)}function K5(e){e||(e=this.isUtc()?ve.defaultFormatUtc:ve.defaultFormat);var t=Wu(this,e);return this.localeData().postformat(t)}function G5(e,t){return this.isValid()&&(jn(e)&&e.isValid()||kt(e).isValid())?Rn({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function q5(e){return this.from(kt(),e)}function X5(e,t){return this.isValid()&&(jn(e)&&e.isValid()||kt(e).isValid())?Rn({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function Q5(e){return this.to(kt(),e)}function Bk(e){var t;return e===void 0?this._locale._abbr:(t=As(e),t!=null&&(this._locale=t),this)}var Hk=an("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return e===void 0?this.localeData():this.locale(e)});function Yk(){return this._locale}var Pd=1e3,ta=60*Pd,Ad=60*ta,Zk=(365*400+97)*24*Ad;function ra(e,t){return(e%t+t)%t}function Kk(e,t,r){return e<100&&e>=0?new Date(e+400,t,r)-Zk:new Date(e,t,r).valueOf()}function Gk(e,t,r){return e<100&&e>=0?Date.UTC(e+400,t,r)-Zk:Date.UTC(e,t,r)}function J5(e){var t,r;if(e=ln(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(r=this._isUTC?Gk:Kk,e){case"year":t=r(this.year(),0,1);break;case"quarter":t=r(this.year(),this.month()-this.month()%3,1);break;case"month":t=r(this.year(),this.month(),1);break;case"week":t=r(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=r(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=ra(t+(this._isUTC?0:this.utcOffset()*ta),Ad);break;case"minute":t=this._d.valueOf(),t-=ra(t,ta);break;case"second":t=this._d.valueOf(),t-=ra(t,Pd);break}return this._d.setTime(t),ve.updateOffset(this,!0),this}function eF(e){var t,r;if(e=ln(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(r=this._isUTC?Gk:Kk,e){case"year":t=r(this.year()+1,0,1)-1;break;case"quarter":t=r(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=r(this.year(),this.month()+1,1)-1;break;case"week":t=r(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=r(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=r(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=Ad-ra(t+(this._isUTC?0:this.utcOffset()*ta),Ad)-1;break;case"minute":t=this._d.valueOf(),t+=ta-ra(t,ta)-1;break;case"second":t=this._d.valueOf(),t+=Pd-ra(t,Pd)-1;break}return this._d.setTime(t),ve.updateOffset(this,!0),this}function tF(){return this._d.valueOf()-(this._offset||0)*6e4}function rF(){return Math.floor(this.valueOf()/1e3)}function nF(){return new Date(this.valueOf())}function sF(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function oF(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function iF(){return this.isValid()?this.toISOString():null}function aF(){return kv(this)}function lF(){return Qs({},Xe(this))}function cF(){return Xe(this).overflow}function uF(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Ie("N",0,0,"eraAbbr");Ie("NN",0,0,"eraAbbr");Ie("NNN",0,0,"eraAbbr");Ie("NNNN",0,0,"eraName");Ie("NNNNN",0,0,"eraNarrow");Ie("y",["y",1],"yo","eraYear");Ie("y",["yy",2],0,"eraYear");Ie("y",["yyy",3],0,"eraYear");Ie("y",["yyyy",4],0,"eraYear");_e("N",Vv);_e("NN",Vv);_e("NNN",Vv);_e("NNNN",_F);_e("NNNNN",bF);vt(["N","NN","NNN","NNNN","NNNNN"],function(e,t,r,n){var s=r._locale.erasParse(e,n,r._strict);s?Xe(r).era=s:Xe(r).invalidEra=e});_e("y",Aa);_e("yy",Aa);_e("yyy",Aa);_e("yyyy",Aa);_e("yo",SF);vt(["y","yy","yyy","yyyy"],ar);vt(["yo"],function(e,t,r,n){var s;r._locale._eraYearOrdinalRegex&&(s=e.match(r._locale._eraYearOrdinalRegex)),r._locale.eraYearOrdinalParse?t[ar]=r._locale.eraYearOrdinalParse(e,s):t[ar]=parseInt(e,10)});function dF(e,t){var r,n,s,o=this._eras||As("en")._eras;for(r=0,n=o.length;r=0)return o[n]}function hF(e,t){var r=e.since<=e.until?1:-1;return t===void 0?ve(e.since).year():ve(e.since).year()+(t-e.offset)*r}function pF(){var e,t,r,n=this.localeData().eras();for(e=0,t=n.length;eo&&(t=o),RF.call(this,e,t,r,n,s))}function RF(e,t,r,n,s){var o=Tk(e,t,r,n,s),i=Ql(o.year,0,o.dayOfYear);return this.year(i.getUTCFullYear()),this.month(i.getUTCMonth()),this.date(i.getUTCDate()),this}Ie("Q",0,"Qo","quarter");_e("Q",yk);vt("Q",function(e,t){t[fs]=(rt(e)-1)*3});function PF(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}Ie("D",["DD",2],"Do","date");_e("D",Ct,Da);_e("DD",Ct,Zr);_e("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient});vt(["D","DD"],Ln);vt("Do",function(e,t){t[Ln]=rt(e.match(Ct)[0])});var Xk=Oa("Date",!0);Ie("DDD",["DDDD",3],"DDDo","dayOfYear");_e("DDD",Df);_e("DDDD",xk);vt(["DDD","DDDD"],function(e,t,r){r._dayOfYear=rt(e)});function AF(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}Ie("m",["mm",2],0,"minute");_e("m",Ct,Pv);_e("mm",Ct,Zr);vt(["m","mm"],vn);var DF=Oa("Minutes",!1);Ie("s",["ss",2],0,"second");_e("s",Ct,Pv);_e("ss",Ct,Zr);vt(["s","ss"],hs);var OF=Oa("Seconds",!1);Ie("S",0,0,function(){return~~(this.millisecond()/100)});Ie(0,["SS",2],0,function(){return~~(this.millisecond()/10)});Ie(0,["SSS",3],0,"millisecond");Ie(0,["SSSS",4],0,function(){return this.millisecond()*10});Ie(0,["SSSSS",5],0,function(){return this.millisecond()*100});Ie(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3});Ie(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4});Ie(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5});Ie(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6});_e("S",Df,yk);_e("SS",Df,Zr);_e("SSS",Df,xk);var Js,Qk;for(Js="SSSS";Js.length<=9;Js+="S")_e(Js,Aa);function MF(e,t){t[Wo]=rt(("0."+e)*1e3)}for(Js="S";Js.length<=9;Js+="S")vt(Js,MF);Qk=Oa("Milliseconds",!1);Ie("z",0,0,"zoneAbbr");Ie("zz",0,0,"zoneName");function IF(){return this._isUTC?"UTC":""}function LF(){return this._isUTC?"Coordinated Universal Time":""}var le=Ac.prototype;le.add=T5;le.calendar=I5;le.clone=L5;le.diff=B5;le.endOf=eF;le.format=K5;le.from=G5;le.fromNow=q5;le.to=X5;le.toNow=Q5;le.get=ZL;le.invalidAt=cF;le.isAfter=F5;le.isBefore=z5;le.isBetween=U5;le.isSame=$5;le.isSameOrAfter=V5;le.isSameOrBefore=W5;le.isValid=aF;le.lang=Hk;le.locale=Bk;le.localeData=Yk;le.max=a5;le.min=i5;le.parsingFlags=lF;le.set=KL;le.startOf=J5;le.subtract=R5;le.toArray=sF;le.toObject=oF;le.toDate=nF;le.toISOString=Y5;le.inspect=Z5;typeof Symbol<"u"&&Symbol.for!=null&&(le[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"});le.toJSON=iF;le.toString=H5;le.unix=rF;le.valueOf=tF;le.creationData=uF;le.eraName=pF;le.eraNarrow=mF;le.eraAbbr=gF;le.eraYear=vF;le.year=bk;le.isLeapYear=YL;le.weekYear=kF;le.isoWeekYear=CF;le.quarter=le.quarters=PF;le.month=Ek;le.daysInMonth=n4;le.week=le.weeks=d4;le.isoWeek=le.isoWeeks=f4;le.weeksInYear=NF;le.weeksInWeekYear=TF;le.isoWeeksInYear=jF;le.isoWeeksInISOWeekYear=EF;le.date=Xk;le.day=le.days=C4;le.weekday=j4;le.isoWeekday=E4;le.dayOfYear=AF;le.hour=le.hours=O4;le.minute=le.minutes=DF;le.second=le.seconds=OF;le.millisecond=le.milliseconds=Qk;le.utcOffset=g5;le.utc=y5;le.local=x5;le.parseZone=w5;le.hasAlignedHourOffset=_5;le.isDST=b5;le.isLocal=k5;le.isUtcOffset=C5;le.isUtc=Uk;le.isUTC=Uk;le.zoneAbbr=IF;le.zoneName=LF;le.dates=an("dates accessor is deprecated. Use date instead.",Xk);le.months=an("months accessor is deprecated. Use month instead",Ek);le.years=an("years accessor is deprecated. Use year instead",bk);le.zone=an("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",v5);le.isDSTShifted=an("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",S5);function FF(e){return kt(e*1e3)}function zF(){return kt.apply(null,arguments).parseZone()}function Jk(e){return e}var ut=jv.prototype;ut.calendar=kL;ut.longDateFormat=NL;ut.invalidDate=RL;ut.ordinal=DL;ut.preparse=Jk;ut.postformat=Jk;ut.relativeTime=ML;ut.pastFuture=IL;ut.set=bL;ut.eras=dF;ut.erasParse=fF;ut.erasConvertYear=hF;ut.erasAbbrRegex=xF;ut.erasNameRegex=yF;ut.erasNarrowRegex=wF;ut.months=JL;ut.monthsShort=e4;ut.monthsParse=r4;ut.monthsRegex=o4;ut.monthsShortRegex=s4;ut.week=a4;ut.firstDayOfYear=u4;ut.firstDayOfWeek=c4;ut.weekdays=w4;ut.weekdaysMin=b4;ut.weekdaysShort=_4;ut.weekdaysParse=k4;ut.weekdaysRegex=N4;ut.weekdaysShortRegex=T4;ut.weekdaysMinRegex=R4;ut.isPM=A4;ut.meridiem=M4;function Dd(e,t,r,n){var s=As(),o=Kn().set(n,t);return s[r](o,e)}function eC(e,t,r){if(Cs(e)&&(t=e,e=void 0),e=e||"",t!=null)return Dd(e,t,r,"month");var n,s=[];for(n=0;n<12;n++)s[n]=Dd(e,n,r,"month");return s}function Bv(e,t,r,n){typeof e=="boolean"?(Cs(t)&&(r=t,t=void 0),t=t||""):(t=e,r=t,e=!1,Cs(t)&&(r=t,t=void 0),t=t||"");var s=As(),o=e?s._week.dow:0,i,a=[];if(r!=null)return Dd(t,(r+o)%7,n,"day");for(i=0;i<7;i++)a[i]=Dd(t,(i+o)%7,n,"day");return a}function UF(e,t){return eC(e,t,"months")}function $F(e,t){return eC(e,t,"monthsShort")}function VF(e,t,r){return Bv(e,t,r,"weekdays")}function WF(e,t,r){return Bv(e,t,r,"weekdaysShort")}function BF(e,t,r){return Bv(e,t,r,"weekdaysMin")}co("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,r=rt(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+r}});ve.lang=an("moment.lang is deprecated. Use moment.locale instead.",co);ve.langData=an("moment.langData is deprecated. Use moment.localeData instead.",As);var ns=Math.abs;function HF(){var e=this._data;return this._milliseconds=ns(this._milliseconds),this._days=ns(this._days),this._months=ns(this._months),e.milliseconds=ns(e.milliseconds),e.seconds=ns(e.seconds),e.minutes=ns(e.minutes),e.hours=ns(e.hours),e.months=ns(e.months),e.years=ns(e.years),this}function tC(e,t,r,n){var s=Rn(t,r);return e._milliseconds+=n*s._milliseconds,e._days+=n*s._days,e._months+=n*s._months,e._bubble()}function YF(e,t){return tC(this,e,t,1)}function ZF(e,t){return tC(this,e,t,-1)}function tw(e){return e<0?Math.floor(e):Math.ceil(e)}function KF(){var e=this._milliseconds,t=this._days,r=this._months,n=this._data,s,o,i,a,c;return e>=0&&t>=0&&r>=0||e<=0&&t<=0&&r<=0||(e+=tw(vm(r)+t)*864e5,t=0,r=0),n.milliseconds=e%1e3,s=Jr(e/1e3),n.seconds=s%60,o=Jr(s/60),n.minutes=o%60,i=Jr(o/60),n.hours=i%24,t+=Jr(i/24),c=Jr(rC(t)),r+=c,t-=tw(vm(c)),a=Jr(r/12),r%=12,n.days=t,n.months=r,n.years=a,this}function rC(e){return e*4800/146097}function vm(e){return e*146097/4800}function GF(e){if(!this.isValid())return NaN;var t,r,n=this._milliseconds;if(e=ln(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+n/864e5,r=this._months+rC(t),e){case"month":return r;case"quarter":return r/3;case"year":return r/12}else switch(t=this._days+Math.round(vm(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return t*24+n/36e5;case"minute":return t*1440+n/6e4;case"second":return t*86400+n/1e3;case"millisecond":return Math.floor(t*864e5)+n;default:throw new Error("Unknown unit "+e)}}function Ds(e){return function(){return this.as(e)}}var nC=Ds("ms"),qF=Ds("s"),XF=Ds("m"),QF=Ds("h"),JF=Ds("d"),e3=Ds("w"),t3=Ds("M"),r3=Ds("Q"),n3=Ds("y"),s3=nC;function o3(){return Rn(this)}function i3(e){return e=ln(e),this.isValid()?this[e+"s"]():NaN}function fi(e){return function(){return this.isValid()?this._data[e]:NaN}}var a3=fi("milliseconds"),l3=fi("seconds"),c3=fi("minutes"),u3=fi("hours"),d3=fi("days"),f3=fi("months"),h3=fi("years");function p3(){return Jr(this.days()/7)}var as=Math.round,Ui={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function m3(e,t,r,n,s){return s.relativeTime(t||1,!!r,e,n)}function g3(e,t,r,n){var s=Rn(e).abs(),o=as(s.as("s")),i=as(s.as("m")),a=as(s.as("h")),c=as(s.as("d")),u=as(s.as("M")),d=as(s.as("w")),f=as(s.as("y")),m=o<=r.ss&&["s",o]||o0,m[4]=n,m3.apply(null,m)}function v3(e){return e===void 0?as:typeof e=="function"?(as=e,!0):!1}function y3(e,t){return Ui[e]===void 0?!1:t===void 0?Ui[e]:(Ui[e]=t,e==="s"&&(Ui.ss=t-1),!0)}function x3(e,t){if(!this.isValid())return this.localeData().invalidDate();var r=!1,n=Ui,s,o;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(r=e),typeof t=="object"&&(n=Object.assign({},Ui,t),t.s!=null&&t.ss==null&&(n.ss=t.s-1)),s=this.localeData(),o=g3(this,!r,n,s),r&&(o=s.pastFuture(+this,o)),s.postformat(o)}var Qh=Math.abs;function Si(e){return(e>0)-(e<0)||+e}function $f(){if(!this.isValid())return this.localeData().invalidDate();var e=Qh(this._milliseconds)/1e3,t=Qh(this._days),r=Qh(this._months),n,s,o,i,a=this.asSeconds(),c,u,d,f;return a?(n=Jr(e/60),s=Jr(n/60),e%=60,n%=60,o=Jr(r/12),r%=12,i=e?e.toFixed(3).replace(/\.?0+$/,""):"",c=a<0?"-":"",u=Si(this._months)!==Si(a)?"-":"",d=Si(this._days)!==Si(a)?"-":"",f=Si(this._milliseconds)!==Si(a)?"-":"",c+"P"+(o?u+o+"Y":"")+(r?u+r+"M":"")+(t?d+t+"D":"")+(s||n||e?"T":"")+(s?f+s+"H":"")+(n?f+n+"M":"")+(e?f+i+"S":"")):"P0D"}var it=zf.prototype;it.isValid=f5;it.abs=HF;it.add=YF;it.subtract=ZF;it.as=GF;it.asMilliseconds=nC;it.asSeconds=qF;it.asMinutes=XF;it.asHours=QF;it.asDays=JF;it.asWeeks=e3;it.asMonths=t3;it.asQuarters=r3;it.asYears=n3;it.valueOf=s3;it._bubble=KF;it.clone=o3;it.get=i3;it.milliseconds=a3;it.seconds=l3;it.minutes=c3;it.hours=u3;it.days=d3;it.weeks=p3;it.months=f3;it.years=h3;it.humanize=x3;it.toISOString=$f;it.toString=$f;it.toJSON=$f;it.locale=Bk;it.localeData=Yk;it.toIsoString=an("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",$f);it.lang=Hk;Ie("X",0,0,"unix");Ie("x",0,0,"valueOf");_e("x",Mf);_e("X",UL);vt("X",function(e,t,r){r._d=new Date(parseFloat(e)*1e3)});vt("x",function(e,t,r){r._d=new Date(rt(e))});//! moment.js -ve.version="2.30.1";wL(kt);ve.fn=le;ve.min=l5;ve.max=c5;ve.now=u5;ve.utc=Kn;ve.unix=FF;ve.months=UF;ve.isDate=Pc;ve.locale=co;ve.invalid=Pf;ve.duration=Rn;ve.isMoment=jn;ve.weekdays=VF;ve.parseZone=zF;ve.localeData=As;ve.isDuration=Bu;ve.monthsShort=$F;ve.weekdaysMin=BF;ve.defineLocale=Iv;ve.updateLocale=z4;ve.locales=U4;ve.weekdaysShort=WF;ve.normalizeUnits=ln;ve.relativeTimeRounding=v3;ve.relativeTimeThreshold=y3;ve.calendarFormat=M5;ve.prototype=le;ve.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const w3=async()=>await st().collection("access").getFullList({sort:"-created",filter:"deleted = null"}),jo=async e=>e.id?await st().collection("access").update(e.id,e):await st().collection("access").create(e),_3=async e=>(e.deleted=ve.utc().format("YYYY-MM-DD HH:mm:ss"),await st().collection("access").update(e.id,e)),rw=async()=>await st().collection("access_groups").getFullList({sort:"-created",expand:"access"}),b3=async e=>{const t=st();if((await t.collection("access").getList(1,1,{filter:`group='${e}' && deleted=null`})).items.length>0)throw new Error("该分组下有授权配置,无法删除");await t.collection("access_groups").delete(e)},S3=async e=>{const t=st();return e.id?await t.collection("access_groups").update(e.id,e):await t.collection("access_groups").create(e)},nw=async e=>await st().collection("access_groups").update(e.id,e),k3=(e,t)=>{switch(t.type){case"SET_ACCESSES":return{...e,accesses:t.payload};case"ADD_ACCESS":return{...e,accesses:[t.payload,...e.accesses]};case"DELETE_ACCESS":return{...e,accesses:e.accesses.filter(r=>r.id!==t.payload)};case"UPDATE_ACCESS":return{...e,accesses:e.accesses.map(r=>r.id===t.payload.id?t.payload:r)};case"SET_EMAILS":return{...e,emails:t.payload};case"ADD_EMAIL":return{...e,emails:{...e.emails,content:{emails:[...e.emails.content.emails,t.payload]}}};case"SET_ACCESS_GROUPS":return{...e,accessGroups:t.payload};default:return e}},C3=async()=>{try{return await st().collection("settings").getFirstListItem("name='emails'")}catch{return{content:{emails:[]}}}},sC=async e=>{try{return await st().collection("settings").getFirstListItem(`name='${e}'`)}catch{return{name:e}}},Mc=async e=>{const t=st();let r;return e.id?r=await t.collection("settings").update(e.id,e):r=await t.collection("settings").create(e),r},oC=v.createContext({}),Kr=()=>v.useContext(oC),j3=({children:e})=>{const[t,r]=v.useReducer(k3,{accesses:[],emails:{content:{emails:[]}},accessGroups:[]});v.useEffect(()=>{(async()=>{const d=await w3();r({type:"SET_ACCESSES",payload:d})})()},[]),v.useEffect(()=>{(async()=>{const d=await C3();r({type:"SET_EMAILS",payload:d})})()},[]),v.useEffect(()=>{(async()=>{const d=await rw();r({type:"SET_ACCESS_GROUPS",payload:d})})()},[]);const n=v.useCallback(async()=>{const u=await rw();r({type:"SET_ACCESS_GROUPS",payload:u})},[]),s=v.useCallback(u=>{r({type:"SET_EMAILS",payload:u})},[]),o=v.useCallback(u=>{r({type:"DELETE_ACCESS",payload:u})},[]),i=v.useCallback(u=>{r({type:"ADD_ACCESS",payload:u})},[]),a=v.useCallback(u=>{r({type:"UPDATE_ACCESS",payload:u})},[]),c=v.useCallback(u=>{r({type:"SET_ACCESS_GROUPS",payload:u})},[]);return l.jsx(oC.Provider,{value:{config:{accesses:t.accesses,emails:t.emails,accessGroups:t.accessGroups},deleteAccess:o,addAccess:i,setEmails:s,updateAccess:a,setAccessGroups:c,reloadAccessGroups:n},children:e&&e})},E3={theme:"system",setTheme:()=>null},iC=v.createContext(E3);function N3({children:e,defaultTheme:t="system",storageKey:r="vite-ui-theme",...n}){const[s,o]=v.useState(()=>localStorage.getItem(r)||t);v.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(c);return}a.classList.add(s)},[s]);const i={theme:s,setTheme:a=>{localStorage.setItem(r,a),o(a)}};return l.jsx(iC.Provider,{...n,value:i,children:e})}const T3=()=>{const e=v.useContext(iC);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};function R3(){const{setTheme:e}=T3();return l.jsxs($S,{children:[l.jsx(VS,{asChild:!0,children:l.jsxs(He,{variant:"outline",size:"icon",children:[l.jsx(xA,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),l.jsx(vA,{className:"absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100 dark:text-white"}),l.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),l.jsxs(uv,{align:"end",children:[l.jsx(Qi,{onClick:()=>e("light"),children:"浅色"}),l.jsx(Qi,{onClick:()=>e("dark"),children:"暗黑"}),l.jsx(Qi,{onClick:()=>e("system"),children:"系统"})]})]})}var P3="Separator",sw="horizontal",A3=["horizontal","vertical"],aC=v.forwardRef((e,t)=>{const{decorative:r,orientation:n=sw,...s}=e,o=D3(n)?n:sw,a=r?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return l.jsx(Re.div,{"data-orientation":o,...a,...s,ref:t})});aC.displayName=P3;function D3(e){return A3.includes(e)}var lC=aC;const Wt=v.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},s)=>l.jsx(lC,{ref:s,decorative:r,orientation:t,className:ae("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Wt.displayName=lC.displayName;const O3="Certimate v0.1.11",cC=()=>l.jsxs("div",{className:"fixed right-0 bottom-0 w-full flex justify-between p-5",children:[l.jsx("div",{className:""}),l.jsxs("div",{className:"text-muted-foreground text-sm hover:text-stone-900 dark:hover:text-stone-200 flex",children:[l.jsxs("a",{href:"https://docs.certimate.me",target:"_blank",className:"flex items-center",children:[l.jsx(sA,{size:16}),l.jsx("div",{className:"ml-1",children:"文档"})]}),l.jsx(Wt,{orientation:"vertical",className:"mx-2"}),l.jsx("a",{href:"https://github.com/usual2970/certimate/releases",target:"_blank",children:O3})]})]});function M3(){const e=Nr(),t=Nn();if(!st().authStore.isValid||!st().authStore.isAdmin)return l.jsx(Q1,{to:"/login"});const r=t.pathname,n=i=>(console.log(r),i==r?"bg-muted text-primary":"text-muted-foreground"),s=()=>{st().authStore.clear(),e("/login")},o=()=>{e("/setting/account")};return l.jsx(l.Fragment,{children:l.jsx(j3,{children:l.jsxs("div",{className:"grid min-h-screen w-full md:grid-cols-[180px_1fr] lg:grid-cols-[200px_1fr] 2xl:md:grid-cols-[280px_1fr] ",children:[l.jsx("div",{className:"hidden border-r dark:border-stone-500 bg-muted/40 md:block",children:l.jsxs("div",{className:"flex h-full max-h-screen flex-col gap-2",children:[l.jsx("div",{className:"flex h-14 items-center border-b dark:border-stone-500 px-4 lg:h-[60px] lg:px-6",children:l.jsxs(fr,{to:"/",className:"flex items-center gap-2 font-semibold",children:[l.jsx("img",{src:"/vite.svg",className:"w-[36px] h-[36px]"}),l.jsx("span",{className:"dark:text-white",children:"Certimate"})]})}),l.jsx("div",{className:"flex-1",children:l.jsxs("nav",{className:"grid items-start px-2 text-sm font-medium lg:px-4",children:[l.jsxs(fr,{to:"/",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/")),children:[l.jsx(x0,{className:"h-4 w-4"}),"控制面板"]}),l.jsxs(fr,{to:"/domains",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/domains")),children:[l.jsx(rm,{className:"h-4 w-4"}),"域名列表"]}),l.jsxs(fr,{to:"/access",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/access")),children:[l.jsx(w0,{className:"h-4 w-4"}),"授权管理"]}),l.jsxs(fr,{to:"/history",className:ae("flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary",n("/history")),children:[l.jsx(y0,{className:"h-4 w-4"}),"部署历史"]})]})})]})}),l.jsxs("div",{className:"flex flex-col",children:[l.jsxs("header",{className:"flex h-14 items-center gap-4 border-b dark:border-stone-500 bg-muted/40 px-4 lg:h-[60px] lg:px-6",children:[l.jsxs(yv,{children:[l.jsx(xv,{asChild:!0,children:l.jsxs(He,{variant:"outline",size:"icon",className:"shrink-0 md:hidden",children:[l.jsx(gA,{className:"h-5 w-5 dark:text-white"}),l.jsx("span",{className:"sr-only",children:"Toggle navigation menu"})]})}),l.jsx(Rf,{side:"left",className:"flex flex-col",children:l.jsxs("nav",{className:"grid gap-2 text-lg font-medium",children:[l.jsxs(fr,{to:"/",className:"flex items-center gap-2 text-lg font-semibold",children:[l.jsx("img",{src:"/vite.svg",className:"w-[36px] h-[36px]"}),l.jsx("span",{className:"dark:text-white",children:"Certimate"}),l.jsx("span",{className:"sr-only",children:"Certimate"})]}),l.jsxs(fr,{to:"/",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/")),children:[l.jsx(x0,{className:"h-5 w-5"}),"控制面板"]}),l.jsxs(fr,{to:"/domains",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/domains")),children:[l.jsx(rm,{className:"h-5 w-5"}),"域名列表"]}),l.jsxs(fr,{to:"/access",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/access")),children:[l.jsx(w0,{className:"h-5 w-5"}),"授权管理"]}),l.jsxs(fr,{to:"/history",className:ae("mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground",n("/history")),children:[l.jsx(y0,{className:"h-5 w-5"}),"部署历史"]})]})})]}),l.jsx("div",{className:"w-full flex-1"}),l.jsx(R3,{}),l.jsxs($S,{children:[l.jsx(VS,{asChild:!0,children:l.jsxs(He,{variant:"secondary",size:"icon",className:"rounded-full",children:[l.jsx(cA,{className:"h-5 w-5"}),l.jsx("span",{className:"sr-only",children:"Toggle user menu"})]})}),l.jsxs(uv,{align:"end",children:[l.jsx(WS,{children:"账户"}),l.jsx(BS,{}),l.jsx(Qi,{onClick:o,children:"偏好设置"}),l.jsx(Qi,{onClick:s,children:"退出"})]})]})]}),l.jsxs("main",{className:"flex flex-1 flex-col gap-4 p-4 lg:gap-6 lg:p-6 relative",children:[l.jsx(Ig,{}),l.jsx(cC,{})]})]})]})})})}const Hv=({phase:e,phaseSuccess:t})=>{let r=l.jsx(l.Fragment,{children:" "});return e==="check"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]})),e==="apply"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow"}),l.jsx("div",{className:"text-xs text-nowrap text-muted-foreground",children:"部署"})]})),e==="deploy"&&(t?r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"部署"})]}):r=l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"检查 "}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-green-600",children:"获取"}),l.jsx(Wt,{className:"h-1 grow bg-green-600"}),l.jsx("div",{className:"text-xs text-nowrap text-red-600",children:"部署"})]})),r};var I3="VisuallyHidden",Ic=v.forwardRef((e,t)=>l.jsx(Re.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));Ic.displayName=I3;var L3=Ic,[Vf,b$]=xr("Tooltip",[Pa]),Wf=Pa(),uC="TooltipProvider",F3=700,ym="tooltip.open",[z3,Yv]=Vf(uC),Zv=e=>{const{__scopeTooltip:t,delayDuration:r=F3,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:o}=e,[i,a]=v.useState(!0),c=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),l.jsx(z3,{scope:t,isOpenDelayed:i,delayDuration:r,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(d=>{c.current=d},[]),disableHoverableContent:s,children:o})};Zv.displayName=uC;var Bf="Tooltip",[U3,Hf]=Vf(Bf),dC=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:s=!1,onOpenChange:o,disableHoverableContent:i,delayDuration:a}=e,c=Yv(Bf,e.__scopeTooltip),u=Wf(t),[d,f]=v.useState(null),m=Ur(),y=v.useRef(0),x=i??c.disableHoverableContent,g=a??c.delayDuration,_=v.useRef(!1),[p=!1,h]=on({prop:n,defaultProp:s,onChange:R=>{R?(c.onOpen(),document.dispatchEvent(new CustomEvent(ym))):c.onClose(),o==null||o(R)}}),w=v.useMemo(()=>p?_.current?"delayed-open":"instant-open":"closed",[p]),C=v.useCallback(()=>{window.clearTimeout(y.current),_.current=!1,h(!0)},[h]),j=v.useCallback(()=>{window.clearTimeout(y.current),h(!1)},[h]),E=v.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{_.current=!0,h(!0)},g)},[g,h]);return v.useEffect(()=>()=>window.clearTimeout(y.current),[]),l.jsx(Xg,{...u,children:l.jsx(U3,{scope:t,contentId:m,open:p,stateAttribute:w,trigger:d,onTriggerChange:f,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayed?E():C()},[c.isOpenDelayed,E,C]),onTriggerLeave:v.useCallback(()=>{x?j():window.clearTimeout(y.current)},[j,x]),onOpen:C,onClose:j,disableHoverableContent:x,children:r})})};dC.displayName=Bf;var xm="TooltipTrigger",fC=v.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Hf(xm,r),o=Yv(xm,r),i=Wf(r),a=v.useRef(null),c=Ke(t,a,s.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),f=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l.jsx(Qg,{asChild:!0,...i,children:l.jsx(Re.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:ce(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:ce(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:ce(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ce(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:ce(e.onBlur,s.onClose),onClick:ce(e.onClick,s.onClose)})})});fC.displayName=xm;var $3="TooltipPortal",[S$,V3]=Vf($3,{forceMount:void 0}),ma="TooltipContent",Kv=v.forwardRef((e,t)=>{const r=V3(ma,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...o}=e,i=Hf(ma,e.__scopeTooltip);return l.jsx(ur,{present:n||i.open,children:i.disableHoverableContent?l.jsx(hC,{side:s,...o,ref:t}):l.jsx(W3,{side:s,...o,ref:t})})}),W3=v.forwardRef((e,t)=>{const r=Hf(ma,e.__scopeTooltip),n=Yv(ma,e.__scopeTooltip),s=v.useRef(null),o=Ke(t,s),[i,a]=v.useState(null),{trigger:c,onClose:u}=r,d=s.current,{onPointerInTransitChange:f}=n,m=v.useCallback(()=>{a(null),f(!1)},[f]),y=v.useCallback((x,g)=>{const _=x.currentTarget,p={x:x.clientX,y:x.clientY},h=Z3(p,_.getBoundingClientRect()),w=K3(p,h),C=G3(g.getBoundingClientRect()),j=X3([...w,...C]);a(j),f(!0)},[f]);return v.useEffect(()=>()=>m(),[m]),v.useEffect(()=>{if(c&&d){const x=_=>y(_,d),g=_=>y(_,c);return c.addEventListener("pointerleave",x),d.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",x),d.removeEventListener("pointerleave",g)}}},[c,d,y,m]),v.useEffect(()=>{if(i){const x=g=>{const _=g.target,p={x:g.clientX,y:g.clientY},h=(c==null?void 0:c.contains(_))||(d==null?void 0:d.contains(_)),w=!q3(p,i);h?m():w&&(m(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,d,i,u,m]),l.jsx(hC,{...e,ref:o})}),[B3,H3]=Vf(Bf,{isInside:!1}),hC=v.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:i,...a}=e,c=Hf(ma,r),u=Wf(r),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(ym,d),()=>document.removeEventListener(ym,d)),[d]),v.useEffect(()=>{if(c.trigger){const f=m=>{const y=m.target;y!=null&&y.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:l.jsxs(Jg,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[l.jsx(zg,{children:n}),l.jsx(B3,{scope:r,isInside:!0,children:l.jsx(L3,{id:c.contentId,role:"tooltip",children:s||n})})]})})});Kv.displayName=ma;var pC="TooltipArrow",Y3=v.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Wf(r);return H3(pC,r).isInside?null:l.jsx(ev,{...s,...n,ref:t})});Y3.displayName=pC;function Z3(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(r,n,s,o)){case o:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function K3(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function G3(e){const{top:t,right:r,bottom:n,left:s}=e;return[{x:s,y:t},{x:r,y:t},{x:r,y:n},{x:s,y:n}]}function q3(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,i=t.length-1;on!=d>n&&r<(u-a)*(n-c)/(d-c)+a&&(s=!s)}return s}function X3(e){const t=e.slice();return t.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),Q3(t)}function Q3(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const s=e[n];for(;r.length>=2;){const o=r[r.length-1],i=r[r.length-2];if((o.x-i.x)*(s.y-i.y)>=(o.y-i.y)*(s.x-i.x))r.pop();else break}r.push(s)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var J3=Zv,e6=dC,t6=fC,mC=Kv;const r6=J3,gC=e6,vC=t6,yC=v.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(mC,{ref:n,sideOffset:t,className:ae("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));yC.displayName=mC.displayName;const Gv=({deployment:e})=>{const t=r=>e.log[r]?e.log[r][e.log[r].length-1].error:"";return l.jsx(l.Fragment,{children:e.phase==="deploy"&&e.phaseSuccess||e.wholeSuccess?l.jsx(lA,{size:16,className:"text-green-700"}):l.jsx(l.Fragment,{children:t(e.phase).length?l.jsx(r6,{children:l.jsxs(gC,{children:[l.jsx(vC,{asChild:!0,className:"cursor-pointer",children:l.jsx(g0,{size:16,className:"text-red-700"})}),l.jsx(yC,{className:"max-w-[35em]",children:t(e.phase)})]})}):l.jsx(g0,{size:16,className:"text-red-700"})})})},xC=({className:e,...t})=>l.jsx("nav",{role:"navigation","aria-label":"pagination",className:ae("mx-auto flex w-full justify-center",e),...t});xC.displayName="Pagination";const wC=v.forwardRef(({className:e,...t},r)=>l.jsx("ul",{ref:r,className:ae("flex flex-row items-center gap-1",e),...t}));wC.displayName="PaginationContent";const wm=v.forwardRef(({className:e,...t},r)=>l.jsx("li",{ref:r,className:ae("",e),...t}));wm.displayName="PaginationItem";const _C=({className:e,isActive:t,size:r="icon",...n})=>l.jsx("a",{"aria-current":t?"page":void 0,className:ae(xf({variant:t?"outline":"ghost",size:r}),e),...n});_C.displayName="PaginationLink";const bC=({className:e,...t})=>l.jsxs("span",{"aria-hidden":!0,className:ae("flex h-9 w-9 items-center justify-center",e),...t,children:[l.jsx(dA,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"More pages"})]});bC.displayName="PaginationEllipsis";const SC=({totalPages:e,currentPage:t,onPageChange:r})=>{const s=()=>{if(e>7){let u=[];const d=Math.max(2,t-1),f=Math.min(e-1,t+1),m=e-1;return u=o(d,f),t>3&&u.unshift("..."),t{let d=a;const f=[];for(;d<=c;)f.push(d),d+=u;return f},i=s();return l.jsx(l.Fragment,{children:l.jsx(xC,{className:"dark:text-stone-200 justify-end mt-3",children:l.jsx(wC,{children:i.map((a,c)=>a==="..."?l.jsx(wm,{children:l.jsx(bC,{})},c):l.jsx(wm,{children:l.jsx(_C,{href:"#",isActive:t==a,onClick:u=>{u.preventDefault(),r(a)},children:a})},c))})})})},na=({when:e,children:t,fallback:r})=>e?t:r;var kC="AlertDialog",[n6,k$]=xr(kC,[YS]),Os=YS(),CC=e=>{const{__scopeAlertDialog:t,...r}=e,n=Os(t);return l.jsx(mv,{...n,...r,modal:!0})};CC.displayName=kC;var s6="AlertDialogTrigger",jC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(gv,{...s,...n,ref:t})});jC.displayName=s6;var o6="AlertDialogPortal",EC=e=>{const{__scopeAlertDialog:t,...r}=e,n=Os(t);return l.jsx(vv,{...n,...r})};EC.displayName=o6;var i6="AlertDialogOverlay",NC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Ec,{...s,...n,ref:t})});NC.displayName=i6;var sa="AlertDialogContent",[a6,l6]=n6(sa),TC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...s}=e,o=Os(r),i=v.useRef(null),a=Ke(t,i),c=v.useRef(null);return l.jsx(GI,{contentName:sa,titleName:RC,docsSlug:"alert-dialog",children:l.jsx(a6,{scope:r,cancelRef:c,children:l.jsxs(Nc,{role:"alertdialog",...o,...s,ref:a,onOpenAutoFocus:ce(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[l.jsx(zg,{children:n}),l.jsx(u6,{contentRef:i})]})})})});TC.displayName=sa;var RC="AlertDialogTitle",PC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Tc,{...s,...n,ref:t})});PC.displayName=RC;var AC="AlertDialogDescription",DC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Rc,{...s,...n,ref:t})});DC.displayName=AC;var c6="AlertDialogAction",OC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=Os(r);return l.jsx(Tf,{...s,...n,ref:t})});OC.displayName=c6;var MC="AlertDialogCancel",IC=v.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:s}=l6(MC,r),o=Os(r),i=Ke(t,s);return l.jsx(Tf,{...o,...n,ref:i})});IC.displayName=MC;var u6=({contentRef:e})=>{const t=`\`${sa}\` requires a description for the component to be accessible for screen reader users. - -You can add a description to the \`${sa}\` by passing a \`${AC}\` component as a child, which also benefits sighted users by adding visible context to the dialog. - -Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${sa}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. - -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},d6=CC,f6=jC,h6=EC,LC=NC,FC=TC,zC=OC,UC=IC,$C=PC,VC=DC;const WC=d6,BC=f6,p6=h6,HC=v.forwardRef(({className:e,...t},r)=>l.jsx(LC,{className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));HC.displayName=LC.displayName;const qv=v.forwardRef(({className:e,...t},r)=>l.jsxs(p6,{children:[l.jsx(HC,{}),l.jsx(FC,{ref:r,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));qv.displayName=FC.displayName;const Xv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-2 text-center sm:text-left",e),...t});Xv.displayName="AlertDialogHeader";const Qv=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Qv.displayName="AlertDialogFooter";const Jv=v.forwardRef(({className:e,...t},r)=>l.jsx($C,{ref:r,className:ae("text-lg font-semibold",e),...t}));Jv.displayName=$C.displayName;const ey=v.forwardRef(({className:e,...t},r)=>l.jsx(VC,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));ey.displayName=VC.displayName;const ty=v.forwardRef(({className:e,...t},r)=>l.jsx(zC,{ref:r,className:ae(xf(),e),...t}));ty.displayName=zC.displayName;const ry=v.forwardRef(({className:e,...t},r)=>l.jsx(UC,{ref:r,className:ae(xf({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));ry.displayName=UC.displayName;function YC(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ny="Switch",[m6,C$]=xr(ny),[g6,v6]=m6(ny),ZC=v.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:o,required:i,disabled:a,value:c="on",onCheckedChange:u,...d}=e,[f,m]=v.useState(null),y=Ke(t,h=>m(h)),x=v.useRef(!1),g=f?!!f.closest("form"):!0,[_=!1,p]=on({prop:s,defaultProp:o,onChange:u});return l.jsxs(g6,{scope:r,checked:_,disabled:a,children:[l.jsx(Re.button,{type:"button",role:"switch","aria-checked":_,"aria-required":i,"data-state":qC(_),"data-disabled":a?"":void 0,disabled:a,value:c,...d,ref:y,onClick:ce(e.onClick,h=>{p(w=>!w),g&&(x.current=h.isPropagationStopped(),x.current||h.stopPropagation())})}),g&&l.jsx(y6,{control:f,bubbles:!x.current,name:n,value:c,checked:_,required:i,disabled:a,style:{transform:"translateX(-100%)"}})]})});ZC.displayName=ny;var KC="SwitchThumb",GC=v.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,s=v6(KC,r);return l.jsx(Re.span,{"data-state":qC(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t})});GC.displayName=KC;var y6=e=>{const{control:t,checked:r,bubbles:n=!0,...s}=e,o=v.useRef(null),i=YC(r),a=Sb(t);return v.useEffect(()=>{const c=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(i!==r&&f){const m=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(m)}},[i,r,n]),l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function qC(e){return e?"checked":"unchecked"}var XC=ZC,x6=GC;const Lc=v.forwardRef(({className:e,...t},r)=>l.jsx(XC,{className:ae("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:l.jsx(x6,{className:ae("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Lc.displayName=XC.displayName;var sy="ToastProvider",[oy,w6,_6]=bc("Toast"),[QC,j$]=xr("Toast",[_6]),[b6,Yf]=QC(sy),JC=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:o=50,children:i}=e,[a,c]=v.useState(null),[u,d]=v.useState(0),f=v.useRef(!1),m=v.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${sy}\`. Expected non-empty \`string\`.`),l.jsx(oy.Provider,{scope:t,children:l.jsx(b6,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:o,toastCount:u,viewport:a,onViewportChange:c,onToastAdd:v.useCallback(()=>d(y=>y+1),[]),onToastRemove:v.useCallback(()=>d(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:m,children:i})})};JC.displayName=sy;var ej="ToastViewport",S6=["F8"],_m="toast.viewportPause",bm="toast.viewportResume",tj=v.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=S6,label:s="Notifications ({hotkey})",...o}=e,i=Yf(ej,r),a=w6(r),c=v.useRef(null),u=v.useRef(null),d=v.useRef(null),f=v.useRef(null),m=Ke(t,f,i.onViewportChange),y=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=i.toastCount>0;v.useEffect(()=>{const _=p=>{var w;n.every(C=>p[C]||p.code===C)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[n]),v.useEffect(()=>{const _=c.current,p=f.current;if(x&&_&&p){const h=()=>{if(!i.isClosePausedRef.current){const E=new CustomEvent(_m);p.dispatchEvent(E),i.isClosePausedRef.current=!0}},w=()=>{if(i.isClosePausedRef.current){const E=new CustomEvent(bm);p.dispatchEvent(E),i.isClosePausedRef.current=!1}},C=E=>{!_.contains(E.relatedTarget)&&w()},j=()=>{_.contains(document.activeElement)||w()};return _.addEventListener("focusin",h),_.addEventListener("focusout",C),_.addEventListener("pointermove",h),_.addEventListener("pointerleave",j),window.addEventListener("blur",h),window.addEventListener("focus",w),()=>{_.removeEventListener("focusin",h),_.removeEventListener("focusout",C),_.removeEventListener("pointermove",h),_.removeEventListener("pointerleave",j),window.removeEventListener("blur",h),window.removeEventListener("focus",w)}}},[x,i.isClosePausedRef]);const g=v.useCallback(({tabbingDirection:_})=>{const h=a().map(w=>{const C=w.ref.current,j=[C,...I6(C)];return _==="forwards"?j:j.reverse()});return(_==="forwards"?h.reverse():h).flat()},[a]);return v.useEffect(()=>{const _=f.current;if(_){const p=h=>{var j,E,R;const w=h.altKey||h.ctrlKey||h.metaKey;if(h.key==="Tab"&&!w){const P=document.activeElement,A=h.shiftKey;if(h.target===_&&A){(j=u.current)==null||j.focus();return}const N=g({tabbingDirection:A?"backwards":"forwards"}),F=N.findIndex(b=>b===P);Jh(N.slice(F+1))?h.preventDefault():A?(E=u.current)==null||E.focus():(R=d.current)==null||R.focus()}};return _.addEventListener("keydown",p),()=>_.removeEventListener("keydown",p)}},[a,g]),l.jsxs(yD,{ref:c,role:"region","aria-label":s.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&l.jsx(Sm,{ref:u,onFocusFromOutsideViewport:()=>{const _=g({tabbingDirection:"forwards"});Jh(_)}}),l.jsx(oy.Slot,{scope:r,children:l.jsx(Re.ol,{tabIndex:-1,...o,ref:m})}),x&&l.jsx(Sm,{ref:d,onFocusFromOutsideViewport:()=>{const _=g({tabbingDirection:"backwards"});Jh(_)}})]})});tj.displayName=ej;var rj="ToastFocusProxy",Sm=v.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,o=Yf(rj,r);return l.jsx(Ic,{"aria-hidden":!0,tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const a=i.relatedTarget;!((u=o.viewport)!=null&&u.contains(a))&&n()}})});Sm.displayName=rj;var Zf="Toast",k6="toast.swipeStart",C6="toast.swipeMove",j6="toast.swipeCancel",E6="toast.swipeEnd",nj=v.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:o,...i}=e,[a=!0,c]=on({prop:n,defaultProp:s,onChange:o});return l.jsx(ur,{present:r||a,children:l.jsx(R6,{open:a,...i,ref:t,onClose:()=>c(!1),onPause:Dt(e.onPause),onResume:Dt(e.onResume),onSwipeStart:ce(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ce(e.onSwipeMove,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:ce(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ce(e.onSwipeEnd,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});nj.displayName=Zf;var[N6,T6]=QC(Zf,{onClose(){}}),R6=v.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:o,onClose:i,onEscapeKeyDown:a,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:m,onSwipeEnd:y,...x}=e,g=Yf(Zf,r),[_,p]=v.useState(null),h=Ke(t,b=>p(b)),w=v.useRef(null),C=v.useRef(null),j=s||g.duration,E=v.useRef(0),R=v.useRef(j),P=v.useRef(0),{onToastAdd:A,onToastRemove:L}=g,q=Dt(()=>{var V;(_==null?void 0:_.contains(document.activeElement))&&((V=g.viewport)==null||V.focus()),i()}),N=v.useCallback(b=>{!b||b===1/0||(window.clearTimeout(P.current),E.current=new Date().getTime(),P.current=window.setTimeout(q,b))},[q]);v.useEffect(()=>{const b=g.viewport;if(b){const V=()=>{N(R.current),u==null||u()},te=()=>{const W=new Date().getTime()-E.current;R.current=R.current-W,window.clearTimeout(P.current),c==null||c()};return b.addEventListener(_m,te),b.addEventListener(bm,V),()=>{b.removeEventListener(_m,te),b.removeEventListener(bm,V)}}},[g.viewport,j,c,u,N]),v.useEffect(()=>{o&&!g.isClosePausedRef.current&&N(j)},[o,j,g.isClosePausedRef,N]),v.useEffect(()=>(A(),()=>L()),[A,L]);const F=v.useMemo(()=>_?uj(_):null,[_]);return g.viewport?l.jsxs(l.Fragment,{children:[F&&l.jsx(P6,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:F}),l.jsx(N6,{scope:r,onClose:q,children:Ns.createPortal(l.jsx(oy.ItemSlot,{scope:r,children:l.jsx(vD,{asChild:!0,onEscapeKeyDown:ce(a,()=>{g.isFocusedToastEscapeKeyDownRef.current||q(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(Re.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":g.swipeDirection,...x,ref:h,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ce(e.onKeyDown,b=>{b.key==="Escape"&&(a==null||a(b.nativeEvent),b.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,q()))}),onPointerDown:ce(e.onPointerDown,b=>{b.button===0&&(w.current={x:b.clientX,y:b.clientY})}),onPointerMove:ce(e.onPointerMove,b=>{if(!w.current)return;const V=b.clientX-w.current.x,te=b.clientY-w.current.y,W=!!C.current,Z=["left","right"].includes(g.swipeDirection),I=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,Q=Z?I(0,V):0,z=Z?0:I(0,te),$=b.pointerType==="touch"?10:2,fe={x:Q,y:z},ne={originalEvent:b,delta:fe};W?(C.current=fe,Su(C6,f,ne,{discrete:!1})):ow(fe,g.swipeDirection,$)?(C.current=fe,Su(k6,d,ne,{discrete:!1}),b.target.setPointerCapture(b.pointerId)):(Math.abs(V)>$||Math.abs(te)>$)&&(w.current=null)}),onPointerUp:ce(e.onPointerUp,b=>{const V=C.current,te=b.target;if(te.hasPointerCapture(b.pointerId)&&te.releasePointerCapture(b.pointerId),C.current=null,w.current=null,V){const W=b.currentTarget,Z={originalEvent:b,delta:V};ow(V,g.swipeDirection,g.swipeThreshold)?Su(E6,y,Z,{discrete:!0}):Su(j6,m,Z,{discrete:!0}),W.addEventListener("click",I=>I.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),P6=e=>{const{__scopeToast:t,children:r,...n}=e,s=Yf(Zf,t),[o,i]=v.useState(!1),[a,c]=v.useState(!1);return O6(()=>i(!0)),v.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:l.jsx(kc,{asChild:!0,children:l.jsx(Ic,{...n,children:o&&l.jsxs(l.Fragment,{children:[s.label," ",r]})})})},A6="ToastTitle",sj=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});sj.displayName=A6;var D6="ToastDescription",oj=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(Re.div,{...n,ref:t})});oj.displayName=D6;var ij="ToastAction",aj=v.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?l.jsx(cj,{altText:r,asChild:!0,children:l.jsx(iy,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${ij}\`. Expected non-empty \`string\`.`),null)});aj.displayName=ij;var lj="ToastClose",iy=v.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,s=T6(lj,r);return l.jsx(cj,{asChild:!0,children:l.jsx(Re.button,{type:"button",...n,ref:t,onClick:ce(e.onClick,s.onClose)})})});iy.displayName=lj;var cj=v.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...s}=e;return l.jsx(Re.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:t})});function uj(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),M6(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",o=n.dataset.radixToastAnnounceExclude==="";if(!s)if(o){const i=n.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...uj(n))}}),t}function Su(e,t,r,{discrete:n}){const s=r.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?$g(s,o):s.dispatchEvent(o)}var ow=(e,t,r=0)=>{const n=Math.abs(e.x),s=Math.abs(e.y),o=n>s;return t==="left"||t==="right"?o&&n>r:!o&&s>r};function O6(e=()=>{}){const t=Dt(e);Jt(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function M6(e){return e.nodeType===e.ELEMENT_NODE}function I6(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Jh(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var L6=JC,dj=tj,fj=nj,hj=sj,pj=oj,mj=aj,gj=iy;const F6=L6,vj=v.forwardRef(({className:e,...t},r)=>l.jsx(dj,{ref:r,className:ae("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));vj.displayName=dj.displayName;const z6=_c("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),yj=v.forwardRef(({className:e,variant:t,...r},n)=>l.jsx(fj,{ref:n,className:ae(z6({variant:t}),e),...r}));yj.displayName=fj.displayName;const U6=v.forwardRef(({className:e,...t},r)=>l.jsx(mj,{ref:r,className:ae("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));U6.displayName=mj.displayName;const xj=v.forwardRef(({className:e,...t},r)=>l.jsx(gj,{ref:r,className:ae("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:l.jsx(Fg,{className:"h-4 w-4"})}));xj.displayName=gj.displayName;const wj=v.forwardRef(({className:e,...t},r)=>l.jsx(hj,{ref:r,className:ae("text-sm font-semibold",e),...t}));wj.displayName=hj.displayName;const _j=v.forwardRef(({className:e,...t},r)=>l.jsx(pj,{ref:r,className:ae("text-sm opacity-90",e),...t}));_j.displayName=pj.displayName;const $6=1,V6=1e6;let ep=0;function W6(){return ep=(ep+1)%Number.MAX_SAFE_INTEGER,ep.toString()}const tp=new Map,iw=e=>{if(tp.has(e))return;const t=setTimeout(()=>{tp.delete(e),Sl({type:"REMOVE_TOAST",toastId:e})},V6);tp.set(e,t)},B6=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,$6)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?iw(r):e.toasts.forEach(n=>{iw(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Yu=[];let Zu={toasts:[]};function Sl(e){Zu=B6(Zu,e),Yu.forEach(t=>{t(Zu)})}function H6({...e}){const t=W6(),r=s=>Sl({type:"UPDATE_TOAST",toast:{...s,id:t}}),n=()=>Sl({type:"DISMISS_TOAST",toastId:t});return Sl({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||n()}}}),{id:t,dismiss:n,update:r}}function qn(){const[e,t]=v.useState(Zu);return v.useEffect(()=>(Yu.push(t),()=>{const r=Yu.indexOf(t);r>-1&&Yu.splice(r,1)}),[e]),{...e,toast:H6,dismiss:r=>Sl({type:"DISMISS_TOAST",toastId:r})}}function ay(){const{toasts:e}=qn();return l.jsxs(F6,{children:[e.map(function({id:t,title:r,description:n,action:s,...o}){return l.jsxs(yj,{...o,children:[l.jsxs("div",{className:"grid gap-1",children:[r&&l.jsx(wj,{children:r}),n&&l.jsx(_j,{children:n})]}),s,l.jsx(xj,{})]},t)}),l.jsx(vj,{})]})}function ku(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var bj={exports:{}};/*! - -JSZip v3.10.1 - A JavaScript class for generating and reading zip files - - -(c) 2009-2016 Stuart Knightley -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. - -JSZip uses the library pako released under the MIT license : -https://github.com/nodeca/pako/blob/main/LICENSE -*/(function(e,t){(function(r){e.exports=r()})(function(){return function r(n,s,o){function i(u,d){if(!s[u]){if(!n[u]){var f=typeof ku=="function"&&ku;if(!d&&f)return f(u,!0);if(a)return a(u,!0);var m=new Error("Cannot find module '"+u+"'");throw m.code="MODULE_NOT_FOUND",m}var y=s[u]={exports:{}};n[u][0].call(y.exports,function(x){var g=n[u][1][x];return i(g||x)},y,y.exports,r,n,s,o)}return s[u].exports}for(var a=typeof ku=="function"&&ku,c=0;c>2,y=(3&u)<<4|d>>4,x=1>6:64,g=2>4,d=(15&m)<<4|(y=a.indexOf(c.charAt(g++)))>>2,f=(3&y)<<6|(x=a.indexOf(c.charAt(g++))),h[_++]=u,y!==64&&(h[_++]=d),x!==64&&(h[_++]=f);return h}},{"./support":30,"./utils":32}],2:[function(r,n,s){var o=r("./external"),i=r("./stream/DataWorker"),a=r("./stream/Crc32Probe"),c=r("./stream/DataLengthProbe");function u(d,f,m,y,x){this.compressedSize=d,this.uncompressedSize=f,this.crc32=m,this.compression=y,this.compressedContent=x}u.prototype={getContentWorker:function(){var d=new i(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new i(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,m){return d.pipe(new a).pipe(new c("uncompressedSize")).pipe(f.compressWorker(m)).pipe(new c("compressedSize")).withStreamInfo("compression",f)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,s){var o=r("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},s.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,s){var o=r("./utils"),i=function(){for(var a,c=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;c[u]=a}return c}();n.exports=function(a,c){return a!==void 0&&a.length?o.getTypeOf(a)!=="string"?function(u,d,f,m){var y=i,x=m+f;u^=-1;for(var g=m;g>>8^y[255&(u^d[g])];return-1^u}(0|c,a,a.length,0):function(u,d,f,m){var y=i,x=m+f;u^=-1;for(var g=m;g>>8^y[255&(u^d.charCodeAt(g))];return-1^u}(0|c,a,a.length,0):0}},{"./utils":32}],5:[function(r,n,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(r,n,s){var o=null;o=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:o}},{lie:37}],7:[function(r,n,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=r("pako"),a=r("./utils"),c=r("./stream/GenericWorker"),u=o?"uint8array":"array";function d(f,m){c.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=m,this.meta={}}s.magic="\b\0",a.inherits(d,c),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,f.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(m){f.push({data:m,meta:f.meta})}},s.compressWorker=function(f){return new d("Deflate",f)},s.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,s){function o(y,x){var g,_="";for(g=0;g>>=8;return _}function i(y,x,g,_,p,h){var w,C,j=y.file,E=y.compression,R=h!==u.utf8encode,P=a.transformTo("string",h(j.name)),A=a.transformTo("string",u.utf8encode(j.name)),L=j.comment,q=a.transformTo("string",h(L)),N=a.transformTo("string",u.utf8encode(L)),F=A.length!==j.name.length,b=N.length!==L.length,V="",te="",W="",Z=j.dir,I=j.date,Q={crc32:0,compressedSize:0,uncompressedSize:0};x&&!g||(Q.crc32=y.crc32,Q.compressedSize=y.compressedSize,Q.uncompressedSize=y.uncompressedSize);var z=0;x&&(z|=8),R||!F&&!b||(z|=2048);var $=0,fe=0;Z&&($|=16),p==="UNIX"?(fe=798,$|=function(se,Oe){var he=se;return se||(he=Oe?16893:33204),(65535&he)<<16}(j.unixPermissions,Z)):(fe=20,$|=function(se){return 63&(se||0)}(j.dosPermissions)),w=I.getUTCHours(),w<<=6,w|=I.getUTCMinutes(),w<<=5,w|=I.getUTCSeconds()/2,C=I.getUTCFullYear()-1980,C<<=4,C|=I.getUTCMonth()+1,C<<=5,C|=I.getUTCDate(),F&&(te=o(1,1)+o(d(P),4)+A,V+="up"+o(te.length,2)+te),b&&(W=o(1,1)+o(d(q),4)+N,V+="uc"+o(W.length,2)+W);var ne="";return ne+=` -\0`,ne+=o(z,2),ne+=E.magic,ne+=o(w,2),ne+=o(C,2),ne+=o(Q.crc32,4),ne+=o(Q.compressedSize,4),ne+=o(Q.uncompressedSize,4),ne+=o(P.length,2),ne+=o(V.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ne+P+V,dirRecord:f.CENTRAL_FILE_HEADER+o(fe,2)+ne+o(q.length,2)+"\0\0\0\0"+o($,4)+o(_,4)+P+V+q}}var a=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),d=r("../crc32"),f=r("../signature");function m(y,x,g,_){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=g,this.encodeFileName=_,this.streamFiles=y,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(m,c),m.prototype.push=function(y){var x=y.meta.percent||0,g=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(y):(this.bytesWritten+=y.data.length,c.prototype.push.call(this,{data:y.data,meta:{currentFile:this.currentFile,percent:g?(x+100*(g-_-1))/g:100}}))},m.prototype.openedSource=function(y){this.currentSourceOffset=this.bytesWritten,this.currentFile=y.file.name;var x=this.streamFiles&&!y.file.dir;if(x){var g=i(y,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(y){this.accumulate=!1;var x=this.streamFiles&&!y.file.dir,g=i(y,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),x)this.push({data:function(_){return f.DATA_DESCRIPTOR+o(_.crc32,4)+o(_.compressedSize,4)+o(_.uncompressedSize,4)}(y),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var y=this.bytesWritten,x=0;x=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=a,u},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=i},{"../utils":32}],19:[function(r,n,s){var o=r("./Uint8ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,s){var o=r("./DataReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./DataReader":18}],21:[function(r,n,s){var o=r("./ArrayReader");function i(a){o.call(this,a)}r("../utils").inherits(i,o),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},n.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,s){var o=r("../utils"),i=r("../support"),a=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),d=r("./Uint8ArrayReader");n.exports=function(f){var m=o.getTypeOf(f);return o.checkSupport(m),m!=="string"||i.uint8array?m==="nodebuffer"?new u(f):i.uint8array?new d(o.transformTo("uint8array",f)):new a(o.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,s){var o=r("./GenericWorker"),i=r("../utils");function a(c){o.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(a,o),a.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,s){var o=r("./GenericWorker"),i=r("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(a,o),a.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}o.inherits(a,i),a.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}i.prototype.processChunk.call(this,c)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,s){var o=r("../utils"),i=r("./GenericWorker");function a(c){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=o.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}o.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,s){function o(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var c=0;c "+i:i}},n.exports=o},{}],29:[function(r,n,s){var o=r("../utils"),i=r("./ConvertWorker"),a=r("./GenericWorker"),c=r("../base64"),u=r("../support"),d=r("../external"),f=null;if(u.nodestream)try{f=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(x,g){return new d.Promise(function(_,p){var h=[],w=x._internalType,C=x._outputType,j=x._mimeType;x.on("data",function(E,R){h.push(E),g&&g(R)}).on("error",function(E){h=[],p(E)}).on("end",function(){try{var E=function(R,P,A){switch(R){case"blob":return o.newBlob(o.transformTo("arraybuffer",P),A);case"base64":return c.encode(P);default:return o.transformTo(R,P)}}(C,function(R,P){var A,L=0,q=null,N=0;for(A=0;A"u")s.blob=!1;else{var o=new ArrayBuffer(0);try{s.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(o),s.blob=i.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!r("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,s){for(var o=r("./utils"),i=r("./support"),a=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function m(){c.call(this,"utf-8 encode")}s.utf8encode=function(y){return i.nodebuffer?a.newBufferFrom(y,"utf-8"):function(x){var g,_,p,h,w,C=x.length,j=0;for(h=0;h>>6:(_<65536?g[w++]=224|_>>>12:(g[w++]=240|_>>>18,g[w++]=128|_>>>12&63),g[w++]=128|_>>>6&63),g[w++]=128|63&_);return g}(y)},s.utf8decode=function(y){return i.nodebuffer?o.transformTo("nodebuffer",y).toString("utf-8"):function(x){var g,_,p,h,w=x.length,C=new Array(2*w);for(g=_=0;g>10&1023,C[_++]=56320|1023&p)}return C.length!==_&&(C.subarray?C=C.subarray(0,_):C.length=_),o.applyFromCharCode(C)}(y=o.transformTo(i.uint8array?"uint8array":"array",y))},o.inherits(f,c),f.prototype.processChunk=function(y){var x=o.transformTo(i.uint8array?"uint8array":"array",y.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var g=x;(x=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),x.set(g,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var _=function(h,w){var C;for((w=w||h.length)>h.length&&(w=h.length),C=w-1;0<=C&&(192&h[C])==128;)C--;return C<0||C===0?w:C+u[h[C]]>w?C:w}(x),p=x;_!==x.length&&(i.uint8array?(p=x.subarray(0,_),this.leftOver=x.subarray(_,x.length)):(p=x.slice(0,_),this.leftOver=x.slice(_,x.length))),this.push({data:s.utf8decode(p),meta:y.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=f,o.inherits(m,c),m.prototype.processChunk=function(y){this.push({data:s.utf8encode(y.data),meta:y.meta})},s.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,s){var o=r("./support"),i=r("./base64"),a=r("./nodejsUtils"),c=r("./external");function u(g){return g}function d(g,_){for(var p=0;p>8;this.dir=!!(16&this.externalFileAttributes),y==0&&(this.dosPermissions=63&this.externalFileAttributes),y==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var y=o(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=y.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=y.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=y.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=y.readInt(4))}},readExtraFields:function(y){var x,g,_,p=y.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});y.index+4>>6:(y<65536?m[_++]=224|y>>>12:(m[_++]=240|y>>>18,m[_++]=128|y>>>12&63),m[_++]=128|y>>>6&63),m[_++]=128|63&y);return m},s.buf2binstring=function(f){return d(f,f.length)},s.binstring2buf=function(f){for(var m=new o.Buf8(f.length),y=0,x=m.length;y>10&1023,h[x++]=56320|1023&g)}return d(h,x)},s.utf8border=function(f,m){var y;for((m=m||f.length)>f.length&&(m=f.length),y=m-1;0<=y&&(192&f[y])==128;)y--;return y<0||y===0?m:y+c[f[y]]>m?y:m}},{"./common":41}],43:[function(r,n,s){n.exports=function(o,i,a,c){for(var u=65535&o|0,d=o>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3>>1:i>>>1;a[c]=i}return a}();n.exports=function(i,a,c,u){var d=o,f=u+c;i^=-1;for(var m=u;m>>8^d[255&(i^a[m])];return-1^i}},{}],46:[function(r,n,s){var o,i=r("../utils/common"),a=r("./trees"),c=r("./adler32"),u=r("./crc32"),d=r("./messages"),f=0,m=4,y=0,x=-2,g=-1,_=4,p=2,h=8,w=9,C=286,j=30,E=19,R=2*C+1,P=15,A=3,L=258,q=L+A+1,N=42,F=113,b=1,V=2,te=3,W=4;function Z(k,J){return k.msg=d[J],J}function I(k){return(k<<1)-(4k.avail_out&&(K=k.avail_out),K!==0&&(i.arraySet(k.output,J.pending_buf,J.pending_out,K,k.next_out),k.next_out+=K,J.pending_out+=K,k.total_out+=K,k.avail_out-=K,J.pending-=K,J.pending===0&&(J.pending_out=0))}function $(k,J){a._tr_flush_block(k,0<=k.block_start?k.block_start:-1,k.strstart-k.block_start,J),k.block_start=k.strstart,z(k.strm)}function fe(k,J){k.pending_buf[k.pending++]=J}function ne(k,J){k.pending_buf[k.pending++]=J>>>8&255,k.pending_buf[k.pending++]=255&J}function se(k,J){var K,D,S=k.max_chain_length,T=k.strstart,O=k.prev_length,Y=k.nice_match,M=k.strstart>k.w_size-q?k.strstart-(k.w_size-q):0,H=k.window,X=k.w_mask,ee=k.prev,me=k.strstart+L,Ye=H[T+O-1],Ue=H[T+O];k.prev_length>=k.good_match&&(S>>=2),Y>k.lookahead&&(Y=k.lookahead);do if(H[(K=J)+O]===Ue&&H[K+O-1]===Ye&&H[K]===H[T]&&H[++K]===H[T+1]){T+=2,K++;do;while(H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&H[++T]===H[++K]&&TM&&--S!=0);return O<=k.lookahead?O:k.lookahead}function Oe(k){var J,K,D,S,T,O,Y,M,H,X,ee=k.w_size;do{if(S=k.window_size-k.lookahead-k.strstart,k.strstart>=ee+(ee-q)){for(i.arraySet(k.window,k.window,ee,ee,0),k.match_start-=ee,k.strstart-=ee,k.block_start-=ee,J=K=k.hash_size;D=k.head[--J],k.head[J]=ee<=D?D-ee:0,--K;);for(J=K=ee;D=k.prev[--J],k.prev[J]=ee<=D?D-ee:0,--K;);S+=ee}if(k.strm.avail_in===0)break;if(O=k.strm,Y=k.window,M=k.strstart+k.lookahead,H=S,X=void 0,X=O.avail_in,H=A)for(T=k.strstart-k.insert,k.ins_h=k.window[T],k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A)if(D=a._tr_tally(k,k.strstart-k.match_start,k.match_length-A),k.lookahead-=k.match_length,k.match_length<=k.max_lazy_match&&k.lookahead>=A){for(k.match_length--;k.strstart++,k.ins_h=(k.ins_h<=A&&(k.ins_h=(k.ins_h<=A&&k.match_length<=k.prev_length){for(S=k.strstart+k.lookahead-A,D=a._tr_tally(k,k.strstart-1-k.prev_match,k.prev_length-A),k.lookahead-=k.prev_length-1,k.prev_length-=2;++k.strstart<=S&&(k.ins_h=(k.ins_h<k.pending_buf_size-5&&(K=k.pending_buf_size-5);;){if(k.lookahead<=1){if(Oe(k),k.lookahead===0&&J===f)return b;if(k.lookahead===0)break}k.strstart+=k.lookahead,k.lookahead=0;var D=k.block_start+K;if((k.strstart===0||k.strstart>=D)&&(k.lookahead=k.strstart-D,k.strstart=D,$(k,!1),k.strm.avail_out===0)||k.strstart-k.block_start>=k.w_size-q&&($(k,!1),k.strm.avail_out===0))return b}return k.insert=0,J===m?($(k,!0),k.strm.avail_out===0?te:W):(k.strstart>k.block_start&&($(k,!1),k.strm.avail_out),b)}),new ke(4,4,8,4,he),new ke(4,5,16,8,he),new ke(4,6,32,32,he),new ke(4,4,16,16,ye),new ke(8,16,32,32,ye),new ke(8,16,128,128,ye),new ke(8,32,128,256,ye),new ke(32,128,258,1024,ye),new ke(32,258,258,4096,ye)],s.deflateInit=function(k,J){return nt(k,J,h,15,8,0)},s.deflateInit2=nt,s.deflateReset=Pe,s.deflateResetKeep=Me,s.deflateSetHeader=function(k,J){return k&&k.state?k.state.wrap!==2?x:(k.state.gzhead=J,y):x},s.deflate=function(k,J){var K,D,S,T;if(!k||!k.state||5>8&255),fe(D,D.gzhead.time>>16&255),fe(D,D.gzhead.time>>24&255),fe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),fe(D,255&D.gzhead.os),D.gzhead.extra&&D.gzhead.extra.length&&(fe(D,255&D.gzhead.extra.length),fe(D,D.gzhead.extra.length>>8&255)),D.gzhead.hcrc&&(k.adler=u(k.adler,D.pending_buf,D.pending,0)),D.gzindex=0,D.status=69):(fe(D,0),fe(D,0),fe(D,0),fe(D,0),fe(D,0),fe(D,D.level===9?2:2<=D.strategy||D.level<2?4:0),fe(D,3),D.status=F);else{var O=h+(D.w_bits-8<<4)<<8;O|=(2<=D.strategy||D.level<2?0:D.level<6?1:D.level===6?2:3)<<6,D.strstart!==0&&(O|=32),O+=31-O%31,D.status=F,ne(D,O),D.strstart!==0&&(ne(D,k.adler>>>16),ne(D,65535&k.adler)),k.adler=1}if(D.status===69)if(D.gzhead.extra){for(S=D.pending;D.gzindex<(65535&D.gzhead.extra.length)&&(D.pending!==D.pending_buf_size||(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending!==D.pending_buf_size));)fe(D,255&D.gzhead.extra[D.gzindex]),D.gzindex++;D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),D.gzindex===D.gzhead.extra.length&&(D.gzindex=0,D.status=73)}else D.status=73;if(D.status===73)if(D.gzhead.name){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){T=1;break}T=D.gzindexS&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),T===0&&(D.gzindex=0,D.status=91)}else D.status=91;if(D.status===91)if(D.gzhead.comment){S=D.pending;do{if(D.pending===D.pending_buf_size&&(D.gzhead.hcrc&&D.pending>S&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),z(k),S=D.pending,D.pending===D.pending_buf_size)){T=1;break}T=D.gzindexS&&(k.adler=u(k.adler,D.pending_buf,D.pending-S,S)),T===0&&(D.status=103)}else D.status=103;if(D.status===103&&(D.gzhead.hcrc?(D.pending+2>D.pending_buf_size&&z(k),D.pending+2<=D.pending_buf_size&&(fe(D,255&k.adler),fe(D,k.adler>>8&255),k.adler=0,D.status=F)):D.status=F),D.pending!==0){if(z(k),k.avail_out===0)return D.last_flush=-1,y}else if(k.avail_in===0&&I(J)<=I(K)&&J!==m)return Z(k,-5);if(D.status===666&&k.avail_in!==0)return Z(k,-5);if(k.avail_in!==0||D.lookahead!==0||J!==f&&D.status!==666){var Y=D.strategy===2?function(M,H){for(var X;;){if(M.lookahead===0&&(Oe(M),M.lookahead===0)){if(H===f)return b;break}if(M.match_length=0,X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===m?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):D.strategy===3?function(M,H){for(var X,ee,me,Ye,Ue=M.window;;){if(M.lookahead<=L){if(Oe(M),M.lookahead<=L&&H===f)return b;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=A&&0M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=A?(X=a._tr_tally(M,1,M.match_length-A),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(X=a._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),X&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,H===m?($(M,!0),M.strm.avail_out===0?te:W):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:V}(D,J):o[D.level].func(D,J);if(Y!==te&&Y!==W||(D.status=666),Y===b||Y===te)return k.avail_out===0&&(D.last_flush=-1),y;if(Y===V&&(J===1?a._tr_align(D):J!==5&&(a._tr_stored_block(D,0,0,!1),J===3&&(Q(D.head),D.lookahead===0&&(D.strstart=0,D.block_start=0,D.insert=0))),z(k),k.avail_out===0))return D.last_flush=-1,y}return J!==m?y:D.wrap<=0?1:(D.wrap===2?(fe(D,255&k.adler),fe(D,k.adler>>8&255),fe(D,k.adler>>16&255),fe(D,k.adler>>24&255),fe(D,255&k.total_in),fe(D,k.total_in>>8&255),fe(D,k.total_in>>16&255),fe(D,k.total_in>>24&255)):(ne(D,k.adler>>>16),ne(D,65535&k.adler)),z(k),0=K.w_size&&(T===0&&(Q(K.head),K.strstart=0,K.block_start=0,K.insert=0),H=new i.Buf8(K.w_size),i.arraySet(H,J,X-K.w_size,K.w_size,0),J=H,X=K.w_size),O=k.avail_in,Y=k.next_in,M=k.input,k.avail_in=X,k.next_in=0,k.input=J,Oe(K);K.lookahead>=A;){for(D=K.strstart,S=K.lookahead-(A-1);K.ins_h=(K.ins_h<>>=A=P>>>24,w-=A,(A=P>>>16&255)===0)V[d++]=65535&P;else{if(!(16&A)){if(!(64&A)){P=C[(65535&P)+(h&(1<>>=A,w-=A),w<15&&(h+=b[c++]<>>=A=P>>>24,w-=A,!(16&(A=P>>>16&255))){if(!(64&A)){P=j[(65535&P)+(h&(1<>>=A,w-=A,(A=d-f)>3,h&=(1<<(w-=L<<3))-1,o.next_in=c,o.next_out=d,o.avail_in=c>>24&255)+(N>>>8&65280)+((65280&N)<<8)+((255&N)<<24)}function h(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(N){var F;return N&&N.state?(F=N.state,N.total_in=N.total_out=F.total=0,N.msg="",F.wrap&&(N.adler=1&F.wrap),F.mode=x,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new o.Buf32(g),F.distcode=F.distdyn=new o.Buf32(_),F.sane=1,F.back=-1,m):y}function C(N){var F;return N&&N.state?((F=N.state).wsize=0,F.whave=0,F.wnext=0,w(N)):y}function j(N,F){var b,V;return N&&N.state?(V=N.state,F<0?(b=0,F=-F):(b=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15=W.wsize?(o.arraySet(W.window,F,b-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(V<(te=W.wsize-W.wnext)&&(te=V),o.arraySet(W.window,F,b-V,te,W.wnext),(V-=te)?(o.arraySet(W.window,F,b-V,V,0),W.wnext=V,W.whave=W.wsize):(W.wnext+=te,W.wnext===W.wsize&&(W.wnext=0),W.whave>>8&255,b.check=a(b.check,T,2,0),$=z=0,b.mode=2;break}if(b.flags=0,b.head&&(b.head.done=!1),!(1&b.wrap)||(((255&z)<<8)+(z>>8))%31){N.msg="incorrect header check",b.mode=30;break}if((15&z)!=8){N.msg="unknown compression method",b.mode=30;break}if($-=4,k=8+(15&(z>>>=4)),b.wbits===0)b.wbits=k;else if(k>b.wbits){N.msg="invalid window size",b.mode=30;break}b.dmax=1<>8&1),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0,b.mode=3;case 3:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.time=z),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,T[2]=z>>>16&255,T[3]=z>>>24&255,b.check=a(b.check,T,4,0)),$=z=0,b.mode=4;case 4:for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.head&&(b.head.xflags=255&z,b.head.os=z>>8),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0,b.mode=5;case 5:if(1024&b.flags){for(;$<16;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}b.length=z,b.head&&(b.head.extra_len=z),512&b.flags&&(T[0]=255&z,T[1]=z>>>8&255,b.check=a(b.check,T,2,0)),$=z=0}else b.head&&(b.head.extra=null);b.mode=6;case 6:if(1024&b.flags&&(I<(se=b.length)&&(se=I),se&&(b.head&&(k=b.head.extra_len-b.length,b.head.extra||(b.head.extra=new Array(b.head.extra_len)),o.arraySet(b.head.extra,V,W,se,k)),512&b.flags&&(b.check=a(b.check,V,se,W)),I-=se,W+=se,b.length-=se),b.length))break e;b.length=0,b.mode=7;case 7:if(2048&b.flags){if(I===0)break e;for(se=0;k=V[W+se++],b.head&&k&&b.length<65536&&(b.head.name+=String.fromCharCode(k)),k&&se>9&1,b.head.done=!0),N.adler=b.check=0,b.mode=12;break;case 10:for(;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}N.adler=b.check=p(z),$=z=0,b.mode=11;case 11:if(b.havedict===0)return N.next_out=Z,N.avail_out=Q,N.next_in=W,N.avail_in=I,b.hold=z,b.bits=$,2;N.adler=b.check=1,b.mode=12;case 12:if(F===5||F===6)break e;case 13:if(b.last){z>>>=7&$,$-=7&$,b.mode=27;break}for(;$<3;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}switch(b.last=1&z,$-=1,3&(z>>>=1)){case 0:b.mode=14;break;case 1:if(L(b),b.mode=20,F!==6)break;z>>>=2,$-=2;break e;case 2:b.mode=17;break;case 3:N.msg="invalid block type",b.mode=30}z>>>=2,$-=2;break;case 14:for(z>>>=7&$,$-=7&$;$<32;){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if((65535&z)!=(z>>>16^65535)){N.msg="invalid stored block lengths",b.mode=30;break}if(b.length=65535&z,$=z=0,b.mode=15,F===6)break e;case 15:b.mode=16;case 16:if(se=b.length){if(I>>=5,$-=5,b.ndist=1+(31&z),z>>>=5,$-=5,b.ncode=4+(15&z),z>>>=4,$-=4,286>>=3,$-=3}for(;b.have<19;)b.lens[O[b.have++]]=0;if(b.lencode=b.lendyn,b.lenbits=7,K={bits:b.lenbits},J=u(0,b.lens,0,19,b.lencode,0,b.work,K),b.lenbits=K.bits,J){N.msg="invalid code lengths set",b.mode=30;break}b.have=0,b.mode=19;case 19:for(;b.have>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(Fe<16)z>>>=ye,$-=ye,b.lens[b.have++]=Fe;else{if(Fe===16){for(D=ye+2;$>>=ye,$-=ye,b.have===0){N.msg="invalid bit length repeat",b.mode=30;break}k=b.lens[b.have-1],se=3+(3&z),z>>>=2,$-=2}else if(Fe===17){for(D=ye+3;$>>=ye)),z>>>=3,$-=3}else{for(D=ye+7;$>>=ye)),z>>>=7,$-=7}if(b.have+se>b.nlen+b.ndist){N.msg="invalid bit length repeat",b.mode=30;break}for(;se--;)b.lens[b.have++]=k}}if(b.mode===30)break;if(b.lens[256]===0){N.msg="invalid code -- missing end-of-block",b.mode=30;break}if(b.lenbits=9,K={bits:b.lenbits},J=u(d,b.lens,0,b.nlen,b.lencode,0,b.work,K),b.lenbits=K.bits,J){N.msg="invalid literal/lengths set",b.mode=30;break}if(b.distbits=6,b.distcode=b.distdyn,K={bits:b.distbits},J=u(f,b.lens,b.nlen,b.ndist,b.distcode,0,b.work,K),b.distbits=K.bits,J){N.msg="invalid distances set",b.mode=30;break}if(b.mode=20,F===6)break e;case 20:b.mode=21;case 21:if(6<=I&&258<=Q){N.next_out=Z,N.avail_out=Q,N.next_in=W,N.avail_in=I,b.hold=z,b.bits=$,c(N,ne),Z=N.next_out,te=N.output,Q=N.avail_out,W=N.next_in,V=N.input,I=N.avail_in,z=b.hold,$=b.bits,b.mode===12&&(b.back=-1);break}for(b.back=0;ke=(S=b.lencode[z&(1<>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(ke&&!(240&ke)){for(Me=ye,Pe=ke,nt=Fe;ke=(S=b.lencode[nt+((z&(1<>Me)])>>>16&255,Fe=65535&S,!(Me+(ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Me,$-=Me,b.back+=Me}if(z>>>=ye,$-=ye,b.back+=ye,b.length=Fe,ke===0){b.mode=26;break}if(32&ke){b.back=-1,b.mode=12;break}if(64&ke){N.msg="invalid literal/length code",b.mode=30;break}b.extra=15&ke,b.mode=22;case 22:if(b.extra){for(D=b.extra;$>>=b.extra,$-=b.extra,b.back+=b.extra}b.was=b.length,b.mode=23;case 23:for(;ke=(S=b.distcode[z&(1<>>16&255,Fe=65535&S,!((ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}if(!(240&ke)){for(Me=ye,Pe=ke,nt=Fe;ke=(S=b.distcode[nt+((z&(1<>Me)])>>>16&255,Fe=65535&S,!(Me+(ye=S>>>24)<=$);){if(I===0)break e;I--,z+=V[W++]<<$,$+=8}z>>>=Me,$-=Me,b.back+=Me}if(z>>>=ye,$-=ye,b.back+=ye,64&ke){N.msg="invalid distance code",b.mode=30;break}b.offset=Fe,b.extra=15&ke,b.mode=24;case 24:if(b.extra){for(D=b.extra;$>>=b.extra,$-=b.extra,b.back+=b.extra}if(b.offset>b.dmax){N.msg="invalid distance too far back",b.mode=30;break}b.mode=25;case 25:if(Q===0)break e;if(se=ne-Q,b.offset>se){if((se=b.offset-se)>b.whave&&b.sane){N.msg="invalid distance too far back",b.mode=30;break}Oe=se>b.wnext?(se-=b.wnext,b.wsize-se):b.wnext-se,se>b.length&&(se=b.length),he=b.window}else he=te,Oe=Z-b.offset,se=b.length;for(QR?(A=Oe[he+_[F]],$[fe+_[F]]):(A=96,0),h=1<>Z)+(w-=h)]=P<<24|A<<16|L|0,w!==0;);for(h=1<>=1;if(h!==0?(z&=h-1,z+=h):z=0,F++,--ne[N]==0){if(N===V)break;N=f[m+_[F]]}if(te>>7)]}function fe(S,T){S.pending_buf[S.pending++]=255&T,S.pending_buf[S.pending++]=T>>>8&255}function ne(S,T,O){S.bi_valid>p-O?(S.bi_buf|=T<>p-S.bi_valid,S.bi_valid+=O-p):(S.bi_buf|=T<>>=1,O<<=1,0<--T;);return O>>>1}function he(S,T,O){var Y,M,H=new Array(_+1),X=0;for(Y=1;Y<=_;Y++)H[Y]=X=X+O[Y-1]<<1;for(M=0;M<=T;M++){var ee=S[2*M+1];ee!==0&&(S[2*M]=Oe(H[ee]++,ee))}}function ye(S){var T;for(T=0;T>1;1<=O;O--)Me(S,H,O);for(M=me;O=S.heap[1],S.heap[1]=S.heap[S.heap_len--],Me(S,H,1),Y=S.heap[1],S.heap[--S.heap_max]=O,S.heap[--S.heap_max]=Y,H[2*M]=H[2*O]+H[2*Y],S.depth[M]=(S.depth[O]>=S.depth[Y]?S.depth[O]:S.depth[Y])+1,H[2*O+1]=H[2*Y+1]=M,S.heap[1]=M++,Me(S,H,1),2<=S.heap_len;);S.heap[--S.heap_max]=S.heap[1],function(Ue,jt){var Gr,Ht,Qn,at,Jn,es,qr=jt.dyn_tree,$c=jt.max_code,Vc=jt.stat_desc.static_tree,hi=jt.stat_desc.has_stree,Wc=jt.stat_desc.extra_bits,pi=jt.stat_desc.extra_base,Pn=jt.stat_desc.max_length,Is=0;for(at=0;at<=_;at++)Ue.bl_count[at]=0;for(qr[2*Ue.heap[Ue.heap_max]+1]=0,Gr=Ue.heap_max+1;Gr>=7;M>>=1)if(1&Ye&&ee.dyn_ltree[2*me]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return a;for(me=32;me>>3,(H=S.static_len+3+7>>>3)<=M&&(M=H)):M=H=O+5,O+4<=M&&T!==-1?D(S,T,O,Y):S.strategy===4||H===M?(ne(S,2+(Y?1:0),3),Pe(S,q,N)):(ne(S,4+(Y?1:0),3),function(ee,me,Ye,Ue){var jt;for(ne(ee,me-257,5),ne(ee,Ye-1,5),ne(ee,Ue-4,4),jt=0;jt>>8&255,S.pending_buf[S.d_buf+2*S.last_lit+1]=255&T,S.pending_buf[S.l_buf+S.last_lit]=255&O,S.last_lit++,T===0?S.dyn_ltree[2*O]++:(S.matches++,T--,S.dyn_ltree[2*(b[O]+f+1)]++,S.dyn_dtree[2*$(T)]++),S.last_lit===S.lit_bufsize-1},s._tr_align=function(S){ne(S,2,3),se(S,w,q),function(T){T.bi_valid===16?(fe(T,T.bi_buf),T.bi_buf=0,T.bi_valid=0):8<=T.bi_valid&&(T.pending_buf[T.pending++]=255&T.bi_buf,T.bi_buf>>=8,T.bi_valid-=8)}(S)}},{"../utils/common":41}],53:[function(r,n,s){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,n,s){(function(o){(function(i,a){if(!i.setImmediate){var c,u,d,f,m=1,y={},x=!1,g=i.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(i);_=_&&_.setTimeout?_:i,c={}.toString.call(i.process)==="[object process]"?function(C){process.nextTick(function(){h(C)})}:function(){if(i.postMessage&&!i.importScripts){var C=!0,j=i.onmessage;return i.onmessage=function(){C=!1},i.postMessage("","*"),i.onmessage=j,C}}()?(f="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",w,!1):i.attachEvent("onmessage",w),function(C){i.postMessage(f+C,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){h(C.data)},function(C){d.port2.postMessage(C)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(C){var j=g.createElement("script");j.onreadystatechange=function(){h(C),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(C){setTimeout(h,0,C)},_.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var j=new Array(arguments.length-1),E=0;E"u"?o===void 0?this:o:self)}).call(this,typeof Kc<"u"?Kc:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(bj);var Y6=bj.exports;const Z6=Lm(Y6);function K6(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{n.result?t(n.result.toString()):r("No content found")},n.onerror=()=>r(n.error),n.readAsText(e)})}const G6=async(e,t)=>{const r=new Z6;t.forEach(o=>{r.file(o.name,o.content)});const n=await r.generateAsync({type:"blob"}),s=document.createElement("a");s.href=URL.createObjectURL(n),s.download=e,s.click()},ga=e=>{const t=new Date(e);return new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"Asia/Shanghai"}).format(t)},q6=e=>ga(e).split(" ")[0];function Sj(e){const t=new Date;t.setUTCDate(t.getUTCDate()+e);const r=t.getUTCFullYear(),n=String(t.getUTCMonth()+1).padStart(2,"0"),s=String(t.getUTCDate()).padStart(2,"0"),o=String(t.getUTCHours()).padStart(2,"0"),i=String(t.getUTCMinutes()).padStart(2,"0"),a=String(t.getUTCSeconds()).padStart(2,"0");return`${r}-${n}-${s} ${o}:${i}:${a}`}const X6=async e=>{let t=1;e.page&&(t=e.page);let r=2;e.perPage&&(r=e.perPage);const n=st();let s="";return e.state==="enabled"?s="enabled=true":e.state==="disabled"?s="enabled=false":e.state==="expired"&&(s=n.filter("expiredAt<{:expiredAt}",{expiredAt:Sj(15)})),n.collection("domains").getList(t,r,{sort:"-created",expand:"lastDeployment",filter:s})},Q6=async()=>{const e=st(),t=await e.collection("domains").getList(1,1,{}),r=await e.collection("domains").getList(1,1,{filter:e.filter("expiredAt<{:expiredAt}",{expiredAt:Sj(15)})}),n=await e.collection("domains").getList(1,1,{filter:"enabled=true"}),s=await e.collection("domains").getList(1,1,{filter:"enabled=false"});return{total:t.totalItems,expired:r.totalItems,enabled:n.totalItems,disabled:s.totalItems}},J6=async e=>await st().collection("domains").getOne(e),km=async e=>e.id?await st().collection("domains").update(e.id,e):await st().collection("domains").create(e),ez=async e=>await st().collection("domains").delete(e),tz=(e,t)=>st().collection("domains").subscribe(e,r=>{r.action==="update"&&t(r.record)},{expand:"lastDeployment"}),rz=e=>{st().collection("domains").unsubscribe(e)},nz=()=>{const e=qn(),t=Nr(),r=Nn(),n=new URLSearchParams(r.search),s=n.get("page"),o=n.get("state"),[i,a]=v.useState(0),c=()=>{t("/edit")},u=w=>{n.set("page",w.toString()),t(`?${n.toString()}`)},d=w=>{t(`/edit?id=${w}`)},f=w=>{t(`/history?domain=${w}`)},m=async w=>{try{await ez(w),x(y.filter(C=>C.id!==w))}catch(C){console.error("Error deleting domain:",C)}},[y,x]=v.useState([]);v.useEffect(()=>{(async()=>{const C=await X6({page:s?Number(s):1,perPage:10,state:o||""});x(C.items),a(C.totalPages)})()},[s,o]);const g=async w=>{const C=y.filter(P=>P.id===w),j=C[0].enabled,E=C[0];E.enabled=!j,await km(E);const R=y.map(P=>P.id===w?{...P,checked:!j}:P);x(R)},_=async w=>{try{rz(w.id),tz(w.id,C=>{console.log(C);const j=y.map(E=>E.id===C.id?{...C}:E);x(j)}),w.rightnow=!0,await km(w),e.toast({title:"操作成功",description:"已发起部署,请稍后查看部署日志。"})}catch{e.toast({title:"执行失败",description:l.jsxs(l.Fragment,{children:["执行失败,请查看",l.jsx(fr,{to:`/history?domain=${w.id}`,className:"underline text-blue-500",children:"部署日志"}),"查看详情。"]}),variant:"destructive"})}},p=async w=>{await _({...w,deployed:!1})},h=async w=>{const C=`${w.id}-${w.domain}.zip`,j=[{name:`${w.domain}.pem`,content:w.certificate?w.certificate:""},{name:`${w.domain}.key`,content:w.privateKey?w.privateKey:""}];await G6(C,j)};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(ay,{}),l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("div",{className:"text-muted-foreground",children:"域名列表"}),l.jsx(He,{onClick:c,children:"新增域名"})]}),y.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-36",children:"域名"}),l.jsx("div",{className:"w-40",children:"有效期限"}),l.jsx("div",{className:"w-32",children:"最近执行状态"}),l.jsx("div",{className:"w-64",children:"最近执行阶段"}),l.jsx("div",{className:"w-40 sm:ml-2",children:"最近执行时间"}),l.jsx("div",{className:"w-24",children:"是否启用"}),l.jsx("div",{className:"grow",children:"操作"})]}),l.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"域名"}),y.map(w=>{var C,j,E,R;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-36 w-full pt-1 sm:pt-0 flex items-center",children:w.domain}),l.jsx("div",{className:"sm:w-40 w-full pt-1 sm:pt-0 flex items-center",children:l.jsx("div",{children:w.expiredAt?l.jsxs(l.Fragment,{children:[l.jsx("div",{children:"有效期90天"}),l.jsxs("div",{children:[q6(w.expiredAt),"到期"]})]}):"---"})}),l.jsx("div",{className:"sm:w-32 w-full pt-1 sm:pt-0 flex items-center",children:w.lastDeployedAt&&((C=w.expand)!=null&&C.lastDeployment)?l.jsx(l.Fragment,{children:l.jsx(Gv,{deployment:w.expand.lastDeployment})}):"---"}),l.jsx("div",{className:"sm:w-64 w-full pt-1 sm:pt-0 flex items-center",children:w.lastDeployedAt&&((j=w.expand)!=null&&j.lastDeployment)?l.jsx(Hv,{phase:(E=w.expand.lastDeployment)==null?void 0:E.phase,phaseSuccess:(R=w.expand.lastDeployment)==null?void 0:R.phaseSuccess}):"---"}),l.jsx("div",{className:"sm:w-40 pt-1 sm:pt-0 sm:ml-2 flex items-center",children:w.lastDeployedAt?ga(w.lastDeployedAt):"---"}),l.jsx("div",{className:"sm:w-24 flex items-center",children:l.jsx(Zv,{children:l.jsxs(gC,{children:[l.jsx(vC,{children:l.jsx(Lc,{checked:w.enabled,onCheckedChange:()=>{g(w.id)}})}),l.jsx(Kv,{children:l.jsx("div",{className:"border rounded-sm px-3 bg-background text-muted-foreground text-xs",children:w.enabled?"禁用":"启用"})})]})})}),l.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[l.jsx(He,{variant:"link",className:"p-0",onClick:()=>f(w.id),children:"部署历史"}),l.jsxs(na,{when:!!w.enabled,children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>_(w),children:"立即部署"})]}),l.jsxs(na,{when:!!(w.enabled&&w.deployed),children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>p(w),children:"强行部署"})]}),l.jsxs(na,{when:!!w.expiredAt,children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>h(w),children:"下载"})]}),!w.enabled&&l.jsxs(l.Fragment,{children:[l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsxs(WC,{children:[l.jsx(BC,{asChild:!0,children:l.jsx(He,{variant:"link",className:"p-0",children:"删除"})}),l.jsxs(qv,{children:[l.jsxs(Xv,{children:[l.jsx(Jv,{children:"删除域名"}),l.jsx(ey,{children:"确定要删除域名吗?"})]}),l.jsxs(Qv,{children:[l.jsx(ry,{children:"取消"}),l.jsx(ty,{onClick:()=>{m(w.id)},children:"确认"})]})]})]}),l.jsx(Wt,{orientation:"vertical",className:"h-4 mx-2"}),l.jsx(He,{variant:"link",className:"p-0",onClick:()=>d(w.id),children:"编辑"})]})]})]},w.id)}),l.jsx(SC,{totalPages:i,currentPage:s?Number(s):1,onPageChange:w=>{u(w)}})]}):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(rm,{size:40,className:"text-primary"})}),l.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),l.jsx(He,{onClick:c,className:"mt-3",children:"添加域名"})]})})]})})},Te=v.forwardRef(({className:e,type:t,...r},n)=>l.jsx("input",{type:t,className:ae("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...r}));Te.displayName="Input";var Fc=e=>e.type==="checkbox",$i=e=>e instanceof Date,pr=e=>e==null;const kj=e=>typeof e=="object";var qt=e=>!pr(e)&&!Array.isArray(e)&&kj(e)&&!$i(e),Cj=e=>qt(e)&&e.target?Fc(e.target)?e.target.checked:e.target.value:e,sz=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,jj=(e,t)=>e.has(sz(t)),oz=e=>{const t=e.constructor&&e.constructor.prototype;return qt(t)&&t.hasOwnProperty("isPrototypeOf")},ly=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function br(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(ly&&(e instanceof Blob||e instanceof FileList))&&(r||qt(e)))if(t=r?[]:{},!r&&!oz(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=br(e[n]));else return e;return t}var Kf=e=>Array.isArray(e)?e.filter(Boolean):[],Ft=e=>e===void 0,ue=(e,t,r)=>{if(!t||!qt(e))return r;const n=Kf(t.split(/[,[\].]+?/)).reduce((s,o)=>pr(s)?s:s[o],e);return Ft(n)||n===e?Ft(e[t])?r:e[t]:n},Fn=e=>typeof e=="boolean",cy=e=>/^\w*$/.test(e),Ej=e=>Kf(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ft=(e,t,r)=>{let n=-1;const s=cy(t)?[t]:Ej(t),o=s.length,i=o-1;for(;++nWe.useContext(Nj),iz=e=>{const{children:t,...r}=e;return We.createElement(Nj.Provider,{value:r},t)};var Tj=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const i=o;return t._proxyFormState[i]!==gn.all&&(t._proxyFormState[i]=!n||gn.all),r&&(r[i]=!0),e[i]}});return s},Or=e=>qt(e)&&!Object.keys(e).length,Rj=(e,t,r,n)=>{r(e);const{name:s,...o}=e;return Or(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!n||gn.all))},kl=e=>Array.isArray(e)?e:[e],Pj=(e,t,r)=>!e||!t||e===t||kl(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n)));function uy(e){const t=We.useRef(e);t.current=e,We.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}function az(e){const t=Gf(),{control:r=t.control,disabled:n,name:s,exact:o}=e||{},[i,a]=We.useState(r._formState),c=We.useRef(!0),u=We.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=We.useRef(s);return d.current=s,uy({disabled:n,next:f=>c.current&&Pj(d.current,f.name,o)&&Rj(f,u.current,r._updateFormState)&&a({...r._formState,...f}),subject:r._subjects.state}),We.useEffect(()=>(c.current=!0,u.current.isValid&&r._updateValid(!0),()=>{c.current=!1}),[r]),Tj(i,r,u.current,!1)}var Un=e=>typeof e=="string",Aj=(e,t,r,n,s)=>Un(e)?(n&&t.watch.add(e),ue(r,e,s)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),ue(r,o))):(n&&(t.watchAll=!0),r);function lz(e){const t=Gf(),{control:r=t.control,name:n,defaultValue:s,disabled:o,exact:i}=e||{},a=We.useRef(n);a.current=n,uy({disabled:o,subject:r._subjects.values,next:d=>{Pj(a.current,d.name,i)&&u(br(Aj(a.current,r._names,d.values||r._formValues,!1,s)))}});const[c,u]=We.useState(r._getWatch(n,s));return We.useEffect(()=>r._removeUnmounted()),c}function cz(e){const t=Gf(),{name:r,disabled:n,control:s=t.control,shouldUnregister:o}=e,i=jj(s._names.array,r),a=lz({control:s,name:r,defaultValue:ue(s._formValues,r,ue(s._defaultValues,r,e.defaultValue)),exact:!0}),c=az({control:s,name:r}),u=We.useRef(s.register(r,{...e.rules,value:a,...Fn(e.disabled)?{disabled:e.disabled}:{}}));return We.useEffect(()=>{const d=s._options.shouldUnregister||o,f=(m,y)=>{const x=ue(s._fields,m);x&&x._f&&(x._f.mount=y)};if(f(r,!0),d){const m=br(ue(s._options.defaultValues,r));ft(s._defaultValues,r,m),Ft(ue(s._formValues,r))&&ft(s._formValues,r,m)}return()=>{(i?d&&!s._state.action:d)?s.unregister(r):f(r,!1)}},[r,s,i,o]),We.useEffect(()=>{ue(s._fields,r)&&s._updateDisabledField({disabled:n,fields:s._fields,name:r,value:ue(s._fields,r)._f.value})},[n,r,s]),{field:{name:r,value:a,...Fn(n)||c.disabled?{disabled:c.disabled||n}:{},onChange:We.useCallback(d=>u.current.onChange({target:{value:Cj(d),name:r},type:Od.CHANGE}),[r]),onBlur:We.useCallback(()=>u.current.onBlur({target:{value:ue(s._formValues,r),name:r},type:Od.BLUR}),[r,s]),ref:d=>{const f=ue(s._fields,r);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:m=>d.setCustomValidity(m),reportValidity:()=>d.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ue(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!ue(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ue(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ue(c.validatingFields,r)},error:{enumerable:!0,get:()=>ue(c.errors,r)}})}}const uz=e=>e.render(cz(e));var Dj=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},aw=e=>({isOnSubmit:!e||e===gn.onSubmit,isOnBlur:e===gn.onBlur,isOnChange:e===gn.onChange,isOnAll:e===gn.all,isOnTouch:e===gn.onTouched}),lw=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Cl=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const o=ue(e,s);if(o){const{_f:i,...a}=o;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],s)&&!n)break;if(i.ref&&t(i.ref,i.name)&&!n)break;Cl(a,t)}else qt(a)&&Cl(a,t)}}};var dz=(e,t,r)=>{const n=kl(ue(e,r));return ft(n,"root",t[r]),ft(e,r,n),e},dy=e=>e.type==="file",eo=e=>typeof e=="function",Md=e=>{if(!ly)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ku=e=>Un(e),fy=e=>e.type==="radio",Id=e=>e instanceof RegExp;const cw={value:!1,isValid:!1},uw={value:!0,isValid:!0};var Oj=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ft(e[0].attributes.value)?Ft(e[0].value)||e[0].value===""?uw:{value:e[0].value,isValid:!0}:uw:cw}return cw};const dw={isValid:!1,value:null};var Mj=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,dw):dw;function fw(e,t,r="validate"){if(Ku(e)||Array.isArray(e)&&e.every(Ku)||Fn(e)&&!e)return{type:r,message:Ku(e)?e:"",ref:t}}var ki=e=>qt(e)&&!Id(e)?e:{value:e,message:""},hw=async(e,t,r,n,s)=>{const{ref:o,refs:i,required:a,maxLength:c,minLength:u,min:d,max:f,pattern:m,validate:y,name:x,valueAsNumber:g,mount:_,disabled:p}=e._f,h=ue(t,x);if(!_||p)return{};const w=i?i[0]:o,C=N=>{n&&w.reportValidity&&(w.setCustomValidity(Fn(N)?"":N||""),w.reportValidity())},j={},E=fy(o),R=Fc(o),P=E||R,A=(g||dy(o))&&Ft(o.value)&&Ft(h)||Md(o)&&o.value===""||h===""||Array.isArray(h)&&!h.length,L=Dj.bind(null,x,r,j),q=(N,F,b,V=ss.maxLength,te=ss.minLength)=>{const W=N?F:b;j[x]={type:N?V:te,message:W,ref:o,...L(N?V:te,W)}};if(s?!Array.isArray(h)||!h.length:a&&(!P&&(A||pr(h))||Fn(h)&&!h||R&&!Oj(i).isValid||E&&!Mj(i).isValid)){const{value:N,message:F}=Ku(a)?{value:!!a,message:a}:ki(a);if(N&&(j[x]={type:ss.required,message:F,ref:w,...L(ss.required,F)},!r))return C(F),j}if(!A&&(!pr(d)||!pr(f))){let N,F;const b=ki(f),V=ki(d);if(!pr(h)&&!isNaN(h)){const te=o.valueAsNumber||h&&+h;pr(b.value)||(N=te>b.value),pr(V.value)||(F=tenew Date(new Date().toDateString()+" "+Q),Z=o.type=="time",I=o.type=="week";Un(b.value)&&h&&(N=Z?W(h)>W(b.value):I?h>b.value:te>new Date(b.value)),Un(V.value)&&h&&(F=Z?W(h)+N.value,V=!pr(F.value)&&h.length<+F.value;if((b||V)&&(q(b,N.message,F.message),!r))return C(j[x].message),j}if(m&&!A&&Un(h)){const{value:N,message:F}=ki(m);if(Id(N)&&!h.match(N)&&(j[x]={type:ss.pattern,message:F,ref:o,...L(ss.pattern,F)},!r))return C(F),j}if(y){if(eo(y)){const N=await y(h,t),F=fw(N,w);if(F&&(j[x]={...F,...L(ss.validate,F.message)},!r))return C(F.message),j}else if(qt(y)){let N={};for(const F in y){if(!Or(N)&&!r)break;const b=fw(await y[F](h,t),w,F);b&&(N={...b,...L(F,b.message)},C(b.message),r&&(j[x]=N))}if(!Or(N)&&(j[x]={ref:w,...N},!r))return j}}return C(!0),j};function fz(e,t){const r=t.slice(0,-1).length;let n=0;for(;n{let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}},Ld=e=>pr(e)||!kj(e);function Bo(e,t){if(Ld(e)||Ld(t))return e===t;if($i(e)&&$i(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const s of r){const o=e[s];if(!n.includes(s))return!1;if(s!=="ref"){const i=t[s];if($i(o)&&$i(i)||qt(o)&&qt(i)||Array.isArray(o)&&Array.isArray(i)?!Bo(o,i):o!==i)return!1}}return!0}var Ij=e=>e.type==="select-multiple",pz=e=>fy(e)||Fc(e),np=e=>Md(e)&&e.isConnected,Lj=e=>{for(const t in e)if(eo(e[t]))return!0;return!1};function Fd(e,t={}){const r=Array.isArray(e);if(qt(e)||r)for(const n in e)Array.isArray(e[n])||qt(e[n])&&!Lj(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Fd(e[n],t[n])):pr(e[n])||(t[n]=!0);return t}function Fj(e,t,r){const n=Array.isArray(e);if(qt(e)||n)for(const s in e)Array.isArray(e[s])||qt(e[s])&&!Lj(e[s])?Ft(t)||Ld(r[s])?r[s]=Array.isArray(e[s])?Fd(e[s],[]):{...Fd(e[s])}:Fj(e[s],pr(t)?{}:t[s],r[s]):r[s]=!Bo(e[s],t[s]);return r}var Cu=(e,t)=>Fj(e,t,Fd(t)),zj=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ft(e)?e:t?e===""?NaN:e&&+e:r&&Un(e)?new Date(e):n?n(e):e;function sp(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return dy(t)?t.files:fy(t)?Mj(e.refs).value:Ij(t)?[...t.selectedOptions].map(({value:r})=>r):Fc(t)?Oj(e.refs).value:zj(Ft(t.value)?e.ref.value:t.value,e)}var mz=(e,t,r,n)=>{const s={};for(const o of e){const i=ue(t,o);i&&ft(s,o,i._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},Ja=e=>Ft(e)?e:Id(e)?e.source:qt(e)?Id(e.value)?e.value.source:e.value:e,gz=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function pw(e,t,r){const n=ue(e,r);if(n||cy(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),i=ue(t,o),a=ue(e,o);if(i&&!Array.isArray(i)&&r!==o)return{name:r};if(a&&a.type)return{name:o,error:a};s.pop()}return{name:r}}var vz=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,yz=(e,t)=>!Kf(ue(e,t)).length&&Yt(e,t);const xz={mode:gn.onSubmit,reValidateMode:gn.onChange,shouldFocusError:!0};function wz(e={}){let t={...xz,...e},r={submitCount:0,isDirty:!1,isLoading:eo(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=qt(t.defaultValues)||qt(t.values)?br(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:br(s),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:rp(),array:rp(),state:rp()},m=aw(t.mode),y=aw(t.reValidateMode),x=t.criteriaMode===gn.all,g=S=>T=>{clearTimeout(u),u=setTimeout(S,T)},_=async S=>{if(d.isValid||S){const T=t.resolver?Or((await P()).errors):await L(n,!0);T!==r.isValid&&f.state.next({isValid:T})}},p=(S,T)=>{(d.isValidating||d.validatingFields)&&((S||Array.from(a.mount)).forEach(O=>{O&&(T?ft(r.validatingFields,O,T):Yt(r.validatingFields,O))}),f.state.next({validatingFields:r.validatingFields,isValidating:!Or(r.validatingFields)}))},h=(S,T=[],O,Y,M=!0,H=!0)=>{if(Y&&O){if(i.action=!0,H&&Array.isArray(ue(n,S))){const X=O(ue(n,S),Y.argA,Y.argB);M&&ft(n,S,X)}if(H&&Array.isArray(ue(r.errors,S))){const X=O(ue(r.errors,S),Y.argA,Y.argB);M&&ft(r.errors,S,X),yz(r.errors,S)}if(d.touchedFields&&H&&Array.isArray(ue(r.touchedFields,S))){const X=O(ue(r.touchedFields,S),Y.argA,Y.argB);M&&ft(r.touchedFields,S,X)}d.dirtyFields&&(r.dirtyFields=Cu(s,o)),f.state.next({name:S,isDirty:N(S,T),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ft(o,S,T)},w=(S,T)=>{ft(r.errors,S,T),f.state.next({errors:r.errors})},C=S=>{r.errors=S,f.state.next({errors:r.errors,isValid:!1})},j=(S,T,O,Y)=>{const M=ue(n,S);if(M){const H=ue(o,S,Ft(O)?ue(s,S):O);Ft(H)||Y&&Y.defaultChecked||T?ft(o,S,T?H:sp(M._f)):V(S,H),i.mount&&_()}},E=(S,T,O,Y,M)=>{let H=!1,X=!1;const ee={name:S},me=!!(ue(n,S)&&ue(n,S)._f&&ue(n,S)._f.disabled);if(!O||Y){d.isDirty&&(X=r.isDirty,r.isDirty=ee.isDirty=N(),H=X!==ee.isDirty);const Ye=me||Bo(ue(s,S),T);X=!!(!me&&ue(r.dirtyFields,S)),Ye||me?Yt(r.dirtyFields,S):ft(r.dirtyFields,S,!0),ee.dirtyFields=r.dirtyFields,H=H||d.dirtyFields&&X!==!Ye}if(O){const Ye=ue(r.touchedFields,S);Ye||(ft(r.touchedFields,S,O),ee.touchedFields=r.touchedFields,H=H||d.touchedFields&&Ye!==O)}return H&&M&&f.state.next(ee),H?ee:{}},R=(S,T,O,Y)=>{const M=ue(r.errors,S),H=d.isValid&&Fn(T)&&r.isValid!==T;if(e.delayError&&O?(c=g(()=>w(S,O)),c(e.delayError)):(clearTimeout(u),c=null,O?ft(r.errors,S,O):Yt(r.errors,S)),(O?!Bo(M,O):M)||!Or(Y)||H){const X={...Y,...H&&Fn(T)?{isValid:T}:{},errors:r.errors,name:S};r={...r,...X},f.state.next(X)}},P=async S=>{p(S,!0);const T=await t.resolver(o,t.context,mz(S||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return p(S),T},A=async S=>{const{errors:T}=await P(S);if(S)for(const O of S){const Y=ue(T,O);Y?ft(r.errors,O,Y):Yt(r.errors,O)}else r.errors=T;return T},L=async(S,T,O={valid:!0})=>{for(const Y in S){const M=S[Y];if(M){const{_f:H,...X}=M;if(H){const ee=a.array.has(H.name);p([Y],!0);const me=await hw(M,o,x,t.shouldUseNativeValidation&&!T,ee);if(p([Y]),me[H.name]&&(O.valid=!1,T))break;!T&&(ue(me,H.name)?ee?dz(r.errors,me,H.name):ft(r.errors,H.name,me[H.name]):Yt(r.errors,H.name))}X&&await L(X,T,O)}}return O.valid},q=()=>{for(const S of a.unMount){const T=ue(n,S);T&&(T._f.refs?T._f.refs.every(O=>!np(O)):!np(T._f.ref))&&Oe(S)}a.unMount=new Set},N=(S,T)=>(S&&T&&ft(o,S,T),!Bo(z(),s)),F=(S,T,O)=>Aj(S,a,{...i.mount?o:Ft(T)?s:Un(S)?{[S]:T}:T},O,T),b=S=>Kf(ue(i.mount?o:s,S,e.shouldUnregister?ue(s,S,[]):[])),V=(S,T,O={})=>{const Y=ue(n,S);let M=T;if(Y){const H=Y._f;H&&(!H.disabled&&ft(o,S,zj(T,H)),M=Md(H.ref)&&pr(T)?"":T,Ij(H.ref)?[...H.ref.options].forEach(X=>X.selected=M.includes(X.value)):H.refs?Fc(H.ref)?H.refs.length>1?H.refs.forEach(X=>(!X.defaultChecked||!X.disabled)&&(X.checked=Array.isArray(M)?!!M.find(ee=>ee===X.value):M===X.value)):H.refs[0]&&(H.refs[0].checked=!!M):H.refs.forEach(X=>X.checked=X.value===M):dy(H.ref)?H.ref.value="":(H.ref.value=M,H.ref.type||f.values.next({name:S,values:{...o}})))}(O.shouldDirty||O.shouldTouch)&&E(S,M,O.shouldTouch,O.shouldDirty,!0),O.shouldValidate&&Q(S)},te=(S,T,O)=>{for(const Y in T){const M=T[Y],H=`${S}.${Y}`,X=ue(n,H);(a.array.has(S)||!Ld(M)||X&&!X._f)&&!$i(M)?te(H,M,O):V(H,M,O)}},W=(S,T,O={})=>{const Y=ue(n,S),M=a.array.has(S),H=br(T);ft(o,S,H),M?(f.array.next({name:S,values:{...o}}),(d.isDirty||d.dirtyFields)&&O.shouldDirty&&f.state.next({name:S,dirtyFields:Cu(s,o),isDirty:N(S,H)})):Y&&!Y._f&&!pr(H)?te(S,H,O):V(S,H,O),lw(S,a)&&f.state.next({...r}),f.values.next({name:i.mount?S:void 0,values:{...o}})},Z=async S=>{i.mount=!0;const T=S.target;let O=T.name,Y=!0;const M=ue(n,O),H=()=>T.type?sp(M._f):Cj(S),X=ee=>{Y=Number.isNaN(ee)||ee===ue(o,O,ee)};if(M){let ee,me;const Ye=H(),Ue=S.type===Od.BLUR||S.type===Od.FOCUS_OUT,jt=!gz(M._f)&&!t.resolver&&!ue(r.errors,O)&&!M._f.deps||vz(Ue,ue(r.touchedFields,O),r.isSubmitted,y,m),Gr=lw(O,a,Ue);ft(o,O,Ye),Ue?(M._f.onBlur&&M._f.onBlur(S),c&&c(0)):M._f.onChange&&M._f.onChange(S);const Ht=E(O,Ye,Ue,!1),Qn=!Or(Ht)||Gr;if(!Ue&&f.values.next({name:O,type:S.type,values:{...o}}),jt)return d.isValid&&_(),Qn&&f.state.next({name:O,...Gr?{}:Ht});if(!Ue&&Gr&&f.state.next({...r}),t.resolver){const{errors:at}=await P([O]);if(X(Ye),Y){const Jn=pw(r.errors,n,O),es=pw(at,n,Jn.name||O);ee=es.error,O=es.name,me=Or(at)}}else p([O],!0),ee=(await hw(M,o,x,t.shouldUseNativeValidation))[O],p([O]),X(Ye),Y&&(ee?me=!1:d.isValid&&(me=await L(n,!0)));Y&&(M._f.deps&&Q(M._f.deps),R(O,me,ee,Ht))}},I=(S,T)=>{if(ue(r.errors,T)&&S.focus)return S.focus(),1},Q=async(S,T={})=>{let O,Y;const M=kl(S);if(t.resolver){const H=await A(Ft(S)?S:M);O=Or(H),Y=S?!M.some(X=>ue(H,X)):O}else S?(Y=(await Promise.all(M.map(async H=>{const X=ue(n,H);return await L(X&&X._f?{[H]:X}:X)}))).every(Boolean),!(!Y&&!r.isValid)&&_()):Y=O=await L(n);return f.state.next({...!Un(S)||d.isValid&&O!==r.isValid?{}:{name:S},...t.resolver||!S?{isValid:O}:{},errors:r.errors}),T.shouldFocus&&!Y&&Cl(n,I,S?M:a.mount),Y},z=S=>{const T={...i.mount?o:s};return Ft(S)?T:Un(S)?ue(T,S):S.map(O=>ue(T,O))},$=(S,T)=>({invalid:!!ue((T||r).errors,S),isDirty:!!ue((T||r).dirtyFields,S),error:ue((T||r).errors,S),isValidating:!!ue(r.validatingFields,S),isTouched:!!ue((T||r).touchedFields,S)}),fe=S=>{S&&kl(S).forEach(T=>Yt(r.errors,T)),f.state.next({errors:S?r.errors:{}})},ne=(S,T,O)=>{const Y=(ue(n,S,{_f:{}})._f||{}).ref,M=ue(r.errors,S)||{},{ref:H,message:X,type:ee,...me}=M;ft(r.errors,S,{...me,...T,ref:Y}),f.state.next({name:S,errors:r.errors,isValid:!1}),O&&O.shouldFocus&&Y&&Y.focus&&Y.focus()},se=(S,T)=>eo(S)?f.values.subscribe({next:O=>S(F(void 0,T),O)}):F(S,T,!0),Oe=(S,T={})=>{for(const O of S?kl(S):a.mount)a.mount.delete(O),a.array.delete(O),T.keepValue||(Yt(n,O),Yt(o,O)),!T.keepError&&Yt(r.errors,O),!T.keepDirty&&Yt(r.dirtyFields,O),!T.keepTouched&&Yt(r.touchedFields,O),!T.keepIsValidating&&Yt(r.validatingFields,O),!t.shouldUnregister&&!T.keepDefaultValue&&Yt(s,O);f.values.next({values:{...o}}),f.state.next({...r,...T.keepDirty?{isDirty:N()}:{}}),!T.keepIsValid&&_()},he=({disabled:S,name:T,field:O,fields:Y,value:M})=>{if(Fn(S)&&i.mount||S){const H=S?void 0:Ft(M)?sp(O?O._f:ue(Y,T)._f):M;ft(o,T,H),E(T,H,!1,!1,!0)}},ye=(S,T={})=>{let O=ue(n,S);const Y=Fn(T.disabled);return ft(n,S,{...O||{},_f:{...O&&O._f?O._f:{ref:{name:S}},name:S,mount:!0,...T}}),a.mount.add(S),O?he({field:O,disabled:T.disabled,name:S,value:T.value}):j(S,!0,T.value),{...Y?{disabled:T.disabled}:{},...t.progressive?{required:!!T.required,min:Ja(T.min),max:Ja(T.max),minLength:Ja(T.minLength),maxLength:Ja(T.maxLength),pattern:Ja(T.pattern)}:{},name:S,onChange:Z,onBlur:Z,ref:M=>{if(M){ye(S,T),O=ue(n,S);const H=Ft(M.value)&&M.querySelectorAll&&M.querySelectorAll("input,select,textarea")[0]||M,X=pz(H),ee=O._f.refs||[];if(X?ee.find(me=>me===H):H===O._f.ref)return;ft(n,S,{_f:{...O._f,...X?{refs:[...ee.filter(np),H,...Array.isArray(ue(s,S))?[{}]:[]],ref:{type:H.type,name:S}}:{ref:H}}}),j(S,!1,void 0,H)}else O=ue(n,S,{}),O._f&&(O._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(jj(a.array,S)&&i.action)&&a.unMount.add(S)}}},ke=()=>t.shouldFocusError&&Cl(n,I,a.mount),Fe=S=>{Fn(S)&&(f.state.next({disabled:S}),Cl(n,(T,O)=>{const Y=ue(n,O);Y&&(T.disabled=Y._f.disabled||S,Array.isArray(Y._f.refs)&&Y._f.refs.forEach(M=>{M.disabled=Y._f.disabled||S}))},0,!1))},Me=(S,T)=>async O=>{let Y;O&&(O.preventDefault&&O.preventDefault(),O.persist&&O.persist());let M=br(o);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:H,values:X}=await P();r.errors=H,M=X}else await L(n);if(Yt(r.errors,"root"),Or(r.errors)){f.state.next({errors:{}});try{await S(M,O)}catch(H){Y=H}}else T&&await T({...r.errors},O),ke(),setTimeout(ke);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Or(r.errors)&&!Y,submitCount:r.submitCount+1,errors:r.errors}),Y)throw Y},Pe=(S,T={})=>{ue(n,S)&&(Ft(T.defaultValue)?W(S,br(ue(s,S))):(W(S,T.defaultValue),ft(s,S,br(T.defaultValue))),T.keepTouched||Yt(r.touchedFields,S),T.keepDirty||(Yt(r.dirtyFields,S),r.isDirty=T.defaultValue?N(S,br(ue(s,S))):N()),T.keepError||(Yt(r.errors,S),d.isValid&&_()),f.state.next({...r}))},nt=(S,T={})=>{const O=S?br(S):s,Y=br(O),M=Or(S),H=M?s:Y;if(T.keepDefaultValues||(s=O),!T.keepValues){if(T.keepDirtyValues)for(const X of a.mount)ue(r.dirtyFields,X)?ft(H,X,ue(o,X)):W(X,ue(H,X));else{if(ly&&Ft(S))for(const X of a.mount){const ee=ue(n,X);if(ee&&ee._f){const me=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(Md(me)){const Ye=me.closest("form");if(Ye){Ye.reset();break}}}}n={}}o=e.shouldUnregister?T.keepDefaultValues?br(s):{}:br(H),f.array.next({values:{...H}}),f.values.next({values:{...H}})}a={mount:T.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!T.keepIsValid||!!T.keepDirtyValues,i.watch=!!e.shouldUnregister,f.state.next({submitCount:T.keepSubmitCount?r.submitCount:0,isDirty:M?!1:T.keepDirty?r.isDirty:!!(T.keepDefaultValues&&!Bo(S,s)),isSubmitted:T.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:M?{}:T.keepDirtyValues?T.keepDefaultValues&&o?Cu(s,o):r.dirtyFields:T.keepDefaultValues&&S?Cu(s,S):T.keepDirty?r.dirtyFields:{},touchedFields:T.keepTouched?r.touchedFields:{},errors:T.keepErrors?r.errors:{},isSubmitSuccessful:T.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},k=(S,T)=>nt(eo(S)?S(o):S,T);return{control:{register:ye,unregister:Oe,getFieldState:$,handleSubmit:Me,setError:ne,_executeSchema:P,_getWatch:F,_getDirty:N,_updateValid:_,_removeUnmounted:q,_updateFieldArray:h,_updateDisabledField:he,_getFieldArray:b,_reset:nt,_resetDefaultValues:()=>eo(t.defaultValues)&&t.defaultValues().then(S=>{k(S,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:S=>{r={...r,...S}},_disableForm:Fe,_subjects:f,_proxyFormState:d,_setErrors:C,get _fields(){return n},get _formValues(){return o},get _state(){return i},set _state(S){i=S},get _defaultValues(){return s},get _names(){return a},set _names(S){a=S},get _formState(){return r},set _formState(S){r=S},get _options(){return t},set _options(S){t={...t,...S}}},trigger:Q,register:ye,handleSubmit:Me,watch:se,setValue:W,getValues:z,reset:k,resetField:Pe,clearErrors:fe,unregister:Oe,setError:ne,setFocus:(S,T={})=>{const O=ue(n,S),Y=O&&O._f;if(Y){const M=Y.refs?Y.refs[0]:Y.ref;M.focus&&(M.focus(),T.shouldSelect&&M.select())}},getFieldState:$}}function Tr(e={}){const t=We.useRef(),r=We.useRef(),[n,s]=We.useState({isDirty:!1,isValidating:!1,isLoading:eo(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:eo(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...wz(e),formState:n});const o=t.current.control;return o._options=e,uy({subject:o._subjects.state,next:i=>{Rj(i,o._proxyFormState,o._updateFormState,!0)&&s({...o._formState})}}),We.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),We.useEffect(()=>{if(o._proxyFormState.isDirty){const i=o._getDirty();i!==n.isDirty&&o._subjects.state.next({isDirty:i})}},[o,n.isDirty]),We.useEffect(()=>{e.values&&!Bo(e.values,r.current)?(o._reset(e.values,o._options.resetOptions),r.current=e.values,s(i=>({...i}))):o._resetDefaultValues()},[e.values,o]),We.useEffect(()=>{e.errors&&o._setErrors(e.errors)},[e.errors,o]),We.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),We.useEffect(()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[e.shouldUnregister,o]),t.current.formState=Tj(n,o),t.current}const mw=(e,t,r)=>{if(e&&"reportValidity"in e){const n=ue(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Uj=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?mw(n.ref,r,e):n.refs&&n.refs.forEach(s=>mw(s,r,e))}},_z=(e,t)=>{t.shouldUseNativeValidation&&Uj(e,t);const r={};for(const n in e){const s=ue(t.fields,n),o=Object.assign(e[n]||{},{ref:s&&s.ref});if(bz(t.names||Object.keys(e),n)){const i=Object.assign({},ue(r,n));ft(i,"root",o),ft(r,n,i)}else ft(r,n,o)}return r},bz=(e,t)=>e.some(r=>r.startsWith(t+"."));var Sz=function(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=r[i].types,u=c&&c[n.code];r[i]=Dj(i,t,r,s,u?[].concat(u,n.message):n.message)}e.shift()}return r},Rr=function(e,t,r){return r===void 0&&(r={}),function(n,s,o){try{return Promise.resolve(function(i,a){try{var c=Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(u){return o.shouldUseNativeValidation&&Uj({},o),{errors:{},values:r.raw?n:u}})}catch(u){return a(u)}return c&&c.then?c.then(void 0,a):c}(0,function(i){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(i))return{values:{},errors:_z(Sz(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}}},ot;(function(e){e.assertEqual=s=>s;function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,e.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(const a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},e.find=(s,o)=>{for(const i of s)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(ot||(ot={}));var Cm;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Cm||(Cm={}));const we=ot.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zs=e=>{switch(typeof e){case"undefined":return we.undefined;case"string":return we.string;case"number":return isNaN(e)?we.nan:we.number;case"boolean":return we.boolean;case"function":return we.function;case"bigint":return we.bigint;case"symbol":return we.symbol;case"object":return Array.isArray(e)?we.array:e===null?we.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?we.promise:typeof Map<"u"&&e instanceof Map?we.map:typeof Set<"u"&&e instanceof Set?we.set:typeof Date<"u"&&e instanceof Date?we.date:we.object;default:return we.unknown}},ie=ot.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),kz=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Wr extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const r=t||function(o){return o.message},n={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;cr.message){const r={},n=[];for(const s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Wr.create=e=>new Wr(e);const va=(e,t)=>{let r;switch(e.code){case ie.invalid_type:e.received===we.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case ie.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ot.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:r=`Unrecognized key(s) in object: ${ot.joinValues(e.keys,", ")}`;break;case ie.invalid_union:r="Invalid input";break;case ie.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ot.joinValues(e.options)}`;break;case ie.invalid_enum_value:r=`Invalid enum value. Expected ${ot.joinValues(e.options)}, received '${e.received}'`;break;case ie.invalid_arguments:r="Invalid function arguments";break;case ie.invalid_return_type:r="Invalid function return type";break;case ie.invalid_date:r="Invalid date";break;case ie.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ot.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case ie.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case ie.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case ie.custom:r="Invalid input";break;case ie.invalid_intersection_types:r="Intersection results could not be merged";break;case ie.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ie.not_finite:r="Number must be finite";break;default:r=t.defaultError,ot.assertNever(e)}return{message:r}};let $j=va;function Cz(e){$j=e}function zd(){return $j}const Ud=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)a=u(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}},jz=[];function ge(e,t){const r=zd(),n=Ud({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===va?void 0:va].filter(s=>!!s)});e.common.issues.push(n)}class cr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return Be;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const o=await s.key,i=await s.value;n.push({key:o,value:i})}return cr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return Be;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:t.value,value:n}}}const Be=Object.freeze({status:"aborted"}),Vi=e=>({status:"dirty",value:e}),gr=e=>({status:"valid",value:e}),jm=e=>e.status==="aborted",Em=e=>e.status==="dirty",tc=e=>e.status==="valid",rc=e=>typeof Promise<"u"&&e instanceof Promise;function $d(e,t,r,n){if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function Vj(e,t,r,n,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var De;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(De||(De={}));var il,al;class Yn{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const gw=(e,t)=>{if(tc(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new Wr(e.common.issues);return this._error=r,this._error}}};function Ze(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(i,a)=>{var c,u;const{message:d}=e;return i.code==="invalid_enum_value"?{message:d??a.defaultError}:typeof a.data>"u"?{message:(c=d??n)!==null&&c!==void 0?c:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(u=d??r)!==null&&u!==void 0?u:a.defaultError}},description:s}}class Je{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Zs(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new cr,ctx:{common:t.parent.common,data:t.data,parsedType:Zs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(rc(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;const s={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},o=this._parseSync({data:t,path:s.path,parent:s});return gw(s,o)}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Zs(t)},s=this._parse({data:t,path:n.path,parent:n}),o=await(rc(s)?s:Promise.resolve(s));return gw(n,o)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{const i=t(s),a=()=>o.addIssue({code:ie.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new En({schema:this,typeName:$e.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Wn.create(this,this._def)}nullable(){return wo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _n.create(this,this._def)}promise(){return xa.create(this,this._def)}or(t){return ic.create([this,t],this._def)}and(t){return ac.create(this,t,this._def)}transform(t){return new En({...Ze(this._def),schema:this,typeName:$e.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new fc({...Ze(this._def),innerType:this,defaultValue:r,typeName:$e.ZodDefault})}brand(){return new hy({typeName:$e.ZodBranded,type:this,...Ze(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new hc({...Ze(this._def),innerType:this,catchValue:r,typeName:$e.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return zc.create(this,t)}readonly(){return pc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ez=/^c[^\s-]{8,}$/i,Nz=/^[0-9a-z]+$/,Tz=/^[0-9A-HJKMNP-TV-Z]{26}$/,Rz=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Pz=/^[a-z0-9_-]{21}$/i,Az=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Dz=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Oz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let op;const Mz=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Iz=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Lz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wj="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Fz=new RegExp(`^${Wj}$`);function Bj(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function zz(e){return new RegExp(`^${Bj(e)}$`)}function Hj(e){let t=`${Wj}T${Bj(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Uz(e,t){return!!((t==="v4"||!t)&&Mz.test(e)||(t==="v6"||!t)&&Iz.test(e))}class yn extends Je{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==we.string){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.string,received:o.parsedType}),Be}const n=new cr;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(s=this._getOrReturnCtx(t,s),ge(s,{code:ie.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,a=t.data.lengtht.test(s),{validation:r,code:ie.invalid_string,...De.errToObj(n)})}_addCheck(t){return new yn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...De.errToObj(t)})}url(t){return this._addCheck({kind:"url",...De.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...De.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...De.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...De.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...De.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...De.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...De.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...De.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...De.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(r=t==null?void 0:t.offset)!==null&&r!==void 0?r:!1,local:(n=t==null?void 0:t.local)!==null&&n!==void 0?n:!1,...De.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...De.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...De.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...De.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...De.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...De.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...De.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...De.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...De.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...De.errToObj(r)})}nonempty(t){return this.min(1,De.errToObj(t))}trim(){return new yn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new yn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new yn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value{var t;return new yn({checks:[],typeName:$e.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};function $z(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=parseInt(e.toFixed(s).replace(".","")),i=parseInt(t.toFixed(s).replace(".",""));return o%i/Math.pow(10,s)}class vo extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==we.number){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.number,received:o.parsedType}),Be}let n;const s=new cr;for(const o of this._def.checks)o.kind==="int"?ot.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?$z(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_finite,message:o.message}),s.dirty()):ot.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,De.toString(r))}gt(t,r){return this.setLimit("min",t,!1,De.toString(r))}lte(t,r){return this.setLimit("max",t,!0,De.toString(r))}lt(t,r){return this.setLimit("max",t,!1,De.toString(r))}setLimit(t,r,n,s){return new vo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:De.toString(s)}]})}_addCheck(t){return new vo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:De.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:De.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:De.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:De.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:De.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.valuet.kind==="int"||t.kind==="multipleOf"&&ot.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.valuenew vo({checks:[],typeName:$e.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class yo extends Je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==we.bigint){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.bigint,received:o.parsedType}),Be}let n;const s=new cr;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),ge(n,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):ot.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,De.toString(r))}gt(t,r){return this.setLimit("min",t,!1,De.toString(r))}lte(t,r){return this.setLimit("max",t,!0,De.toString(r))}lt(t,r){return this.setLimit("max",t,!1,De.toString(r))}setLimit(t,r,n,s){return new yo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:De.toString(s)}]})}_addCheck(t){return new yo({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:De.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value{var t;return new yo({checks:[],typeName:$e.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};class nc extends Je{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==we.boolean){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.boolean,received:n.parsedType}),Be}return gr(t.data)}}nc.create=e=>new nc({typeName:$e.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class si extends Je{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==we.date){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_type,expected:we.date,received:o.parsedType}),Be}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ge(o,{code:ie.invalid_date}),Be}const n=new cr;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(s=this._getOrReturnCtx(t,s),ge(s,{code:ie.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ot.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new si({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:De.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:De.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew si({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:$e.ZodDate,...Ze(e)});class Vd extends Je{_parse(t){if(this._getType(t)!==we.symbol){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.symbol,received:n.parsedType}),Be}return gr(t.data)}}Vd.create=e=>new Vd({typeName:$e.ZodSymbol,...Ze(e)});class sc extends Je{_parse(t){if(this._getType(t)!==we.undefined){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.undefined,received:n.parsedType}),Be}return gr(t.data)}}sc.create=e=>new sc({typeName:$e.ZodUndefined,...Ze(e)});class oc extends Je{_parse(t){if(this._getType(t)!==we.null){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.null,received:n.parsedType}),Be}return gr(t.data)}}oc.create=e=>new oc({typeName:$e.ZodNull,...Ze(e)});class ya extends Je{constructor(){super(...arguments),this._any=!0}_parse(t){return gr(t.data)}}ya.create=e=>new ya({typeName:$e.ZodAny,...Ze(e)});class Ko extends Je{constructor(){super(...arguments),this._unknown=!0}_parse(t){return gr(t.data)}}Ko.create=e=>new Ko({typeName:$e.ZodUnknown,...Ze(e)});class js extends Je{_parse(t){const r=this._getOrReturnCtx(t);return ge(r,{code:ie.invalid_type,expected:we.never,received:r.parsedType}),Be}}js.create=e=>new js({typeName:$e.ZodNever,...Ze(e)});class Wd extends Je{_parse(t){if(this._getType(t)!==we.undefined){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.void,received:n.parsedType}),Be}return gr(t.data)}}Wd.create=e=>new Wd({typeName:$e.ZodVoid,...Ze(e)});class _n extends Je{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==we.array)return ge(r,{code:ie.invalid_type,expected:we.array,received:r.parsedType}),Be;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,a=r.data.lengths.maxLength.value&&(ge(r,{code:ie.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>s.type._parseAsync(new Yn(r,i,r.path,a)))).then(i=>cr.mergeArray(n,i));const o=[...r.data].map((i,a)=>s.type._parseSync(new Yn(r,i,r.path,a)));return cr.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new _n({...this._def,minLength:{value:t,message:De.toString(r)}})}max(t,r){return new _n({...this._def,maxLength:{value:t,message:De.toString(r)}})}length(t,r){return new _n({...this._def,exactLength:{value:t,message:De.toString(r)}})}nonempty(t){return this.min(1,t)}}_n.create=(e,t)=>new _n({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$e.ZodArray,...Ze(t)});function ji(e){if(e instanceof Rt){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Wn.create(ji(n))}return new Rt({...e._def,shape:()=>t})}else return e instanceof _n?new _n({...e._def,type:ji(e.element)}):e instanceof Wn?Wn.create(ji(e.unwrap())):e instanceof wo?wo.create(ji(e.unwrap())):e instanceof Zn?Zn.create(e.items.map(t=>ji(t))):e}class Rt extends Je{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),r=ot.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==we.object){const u=this._getOrReturnCtx(t);return ge(u,{code:ie.invalid_type,expected:we.object,received:u.parsedType}),Be}const{status:n,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof js&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const d=o[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Yn(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof js){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")a.length>0&&(ge(s,{code:ie.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of a){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Yn(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,m=await d.value;u.push({key:f,value:m,alwaysSet:d.alwaysSet})}return u}).then(u=>cr.mergeObjectSync(n,u)):cr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return De.errToObj,new Rt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var s,o,i,a;const c=(i=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,r,n).message)!==null&&i!==void 0?i:n.defaultError;return r.code==="unrecognized_keys"?{message:(a=De.errToObj(t).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new Rt({...this._def,unknownKeys:"strip"})}passthrough(){return new Rt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Rt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Rt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:$e.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Rt({...this._def,catchall:t})}pick(t){const r={};return ot.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Rt({...this._def,shape:()=>r})}omit(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new Rt({...this._def,shape:()=>r})}deepPartial(){return ji(this)}partial(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}),new Rt({...this._def,shape:()=>r})}required(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Wn;)o=o._def.innerType;r[n]=o}}),new Rt({...this._def,shape:()=>r})}keyof(){return Yj(ot.objectKeys(this.shape))}}Rt.create=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strip",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});Rt.strictCreate=(e,t)=>new Rt({shape:()=>e,unknownKeys:"strict",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});Rt.lazycreate=(e,t)=>new Rt({shape:e,unknownKeys:"strip",catchall:js.create(),typeName:$e.ZodObject,...Ze(t)});class ic extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function s(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new Wr(a.ctx.common.issues));return ge(r,{code:ie.invalid_union,unionErrors:i}),Be}if(r.common.async)return Promise.all(n.map(async o=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(c=>new Wr(c));return ge(r,{code:ie.invalid_union,unionErrors:a}),Be}}get options(){return this._def.options}}ic.create=(e,t)=>new ic({options:e,typeName:$e.ZodUnion,...Ze(t)});const os=e=>e instanceof cc?os(e.schema):e instanceof En?os(e.innerType()):e instanceof uc?[e.value]:e instanceof xo?e.options:e instanceof dc?ot.objectValues(e.enum):e instanceof fc?os(e._def.innerType):e instanceof sc?[void 0]:e instanceof oc?[null]:e instanceof Wn?[void 0,...os(e.unwrap())]:e instanceof wo?[null,...os(e.unwrap())]:e instanceof hy||e instanceof pc?os(e.unwrap()):e instanceof hc?os(e._def.innerType):[];class qf extends Je{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.object)return ge(r,{code:ie.invalid_type,expected:we.object,received:r.parsedType}),Be;const n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(ge(r,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const s=new Map;for(const o of r){const i=os(o.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of i){if(s.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);s.set(a,o)}}return new qf({typeName:$e.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:s,...Ze(n)})}}function Nm(e,t){const r=Zs(e),n=Zs(t);if(e===t)return{valid:!0,data:e};if(r===we.object&&n===we.object){const s=ot.objectKeys(t),o=ot.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(const a of o){const c=Nm(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===we.array&&n===we.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o{if(jm(o)||jm(i))return Be;const a=Nm(o.value,i.value);return a.valid?((Em(o)||Em(i))&&r.dirty(),{status:r.value,value:a.data}):(ge(n,{code:ie.invalid_intersection_types}),Be)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ac.create=(e,t,r)=>new ac({left:e,right:t,typeName:$e.ZodIntersection,...Ze(r)});class Zn extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.array)return ge(n,{code:ie.invalid_type,expected:we.array,received:n.parsedType}),Be;if(n.data.lengththis._def.items.length&&(ge(n,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const o=[...n.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Yn(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>cr.mergeArray(r,i)):cr.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new Zn({...this._def,rest:t})}}Zn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zn({items:e,typeName:$e.ZodTuple,rest:null,...Ze(t)})};class lc extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.object)return ge(n,{code:ie.invalid_type,expected:we.object,received:n.parsedType}),Be;const s=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)s.push({key:o._parse(new Yn(n,a,n.path,a)),value:i._parse(new Yn(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?cr.mergeObjectAsync(r,s):cr.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Je?new lc({keyType:t,valueType:r,typeName:$e.ZodRecord,...Ze(n)}):new lc({keyType:yn.create(),valueType:t,typeName:$e.ZodRecord,...Ze(r)})}}class Bd extends Je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.map)return ge(n,{code:ie.invalid_type,expected:we.map,received:n.parsedType}),Be;const s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new Yn(n,a,n.path,[u,"key"])),value:o._parse(new Yn(n,c,n.path,[u,"value"]))}));if(n.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}}Bd.create=(e,t,r)=>new Bd({valueType:t,keyType:e,typeName:$e.ZodMap,...Ze(r)});class oi extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==we.set)return ge(n,{code:ie.invalid_type,expected:we.set,received:n.parsedType}),Be;const s=this._def;s.minSize!==null&&n.data.sizes.maxSize.value&&(ge(n,{code:ie.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const o=this._def.valueType;function i(c){const u=new Set;for(const d of c){if(d.status==="aborted")return Be;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}const a=[...n.data.values()].map((c,u)=>o._parse(new Yn(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,r){return new oi({...this._def,minSize:{value:t,message:De.toString(r)}})}max(t,r){return new oi({...this._def,maxSize:{value:t,message:De.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}oi.create=(e,t)=>new oi({valueType:e,minSize:null,maxSize:null,typeName:$e.ZodSet,...Ze(t)});class oa extends Je{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.function)return ge(r,{code:ie.invalid_type,expected:we.function,received:r.parsedType}),Be;function n(a,c){return Ud({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zd(),va].filter(u=>!!u),issueData:{code:ie.invalid_arguments,argumentsError:c}})}function s(a,c){return Ud({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zd(),va].filter(u=>!!u),issueData:{code:ie.invalid_return_type,returnTypeError:c}})}const o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof xa){const a=this;return gr(async function(...c){const u=new Wr([]),d=await a._def.args.parseAsync(c,o).catch(y=>{throw u.addIssue(n(c,y)),u}),f=await Reflect.apply(i,this,d);return await a._def.returns._def.type.parseAsync(f,o).catch(y=>{throw u.addIssue(s(f,y)),u})})}else{const a=this;return gr(function(...c){const u=a._def.args.safeParse(c,o);if(!u.success)throw new Wr([n(c,u.error)]);const d=Reflect.apply(i,this,u.data),f=a._def.returns.safeParse(d,o);if(!f.success)throw new Wr([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new oa({...this._def,args:Zn.create(t).rest(Ko.create())})}returns(t){return new oa({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new oa({args:t||Zn.create([]).rest(Ko.create()),returns:r||Ko.create(),typeName:$e.ZodFunction,...Ze(n)})}}class cc extends Je{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}cc.create=(e,t)=>new cc({getter:e,typeName:$e.ZodLazy,...Ze(t)});class uc extends Je{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return ge(r,{received:r.data,code:ie.invalid_literal,expected:this._def.value}),Be}return{status:"valid",value:t.data}}get value(){return this._def.value}}uc.create=(e,t)=>new uc({value:e,typeName:$e.ZodLiteral,...Ze(t)});function Yj(e,t){return new xo({values:e,typeName:$e.ZodEnum,...Ze(t)})}class xo extends Je{constructor(){super(...arguments),il.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return ge(r,{expected:ot.joinValues(n),received:r.parsedType,code:ie.invalid_type}),Be}if($d(this,il)||Vj(this,il,new Set(this._def.values)),!$d(this,il).has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return ge(r,{received:r.data,code:ie.invalid_enum_value,options:n}),Be}return gr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return xo.create(t,{...this._def,...r})}exclude(t,r=this._def){return xo.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}il=new WeakMap;xo.create=Yj;class dc extends Je{constructor(){super(...arguments),al.set(this,void 0)}_parse(t){const r=ot.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==we.string&&n.parsedType!==we.number){const s=ot.objectValues(r);return ge(n,{expected:ot.joinValues(s),received:n.parsedType,code:ie.invalid_type}),Be}if($d(this,al)||Vj(this,al,new Set(ot.getValidEnumValues(this._def.values))),!$d(this,al).has(t.data)){const s=ot.objectValues(r);return ge(n,{received:n.data,code:ie.invalid_enum_value,options:s}),Be}return gr(t.data)}get enum(){return this._def.values}}al=new WeakMap;dc.create=(e,t)=>new dc({values:e,typeName:$e.ZodNativeEnum,...Ze(t)});class xa extends Je{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==we.promise&&r.common.async===!1)return ge(r,{code:ie.invalid_type,expected:we.promise,received:r.parsedType}),Be;const n=r.parsedType===we.promise?r.data:Promise.resolve(r.data);return gr(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}xa.create=(e,t)=>new xa({type:e,typeName:$e.ZodPromise,...Ze(t)});class En extends Je{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$e.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:i=>{ge(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return Be;const c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Be:c.status==="dirty"||r.value==="dirty"?Vi(c.value):c});{if(r.value==="aborted")return Be;const a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?Be:a.status==="dirty"||r.value==="dirty"?Vi(a.value):a}}if(s.type==="refinement"){const i=a=>{const c=s.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Be:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Be:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!tc(i))return i;const a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>tc(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):i);ot.assertNever(s)}}En.create=(e,t,r)=>new En({schema:e,typeName:$e.ZodEffects,effect:t,...Ze(r)});En.createWithPreprocess=(e,t,r)=>new En({schema:t,effect:{type:"preprocess",transform:e},typeName:$e.ZodEffects,...Ze(r)});class Wn extends Je{_parse(t){return this._getType(t)===we.undefined?gr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Wn.create=(e,t)=>new Wn({innerType:e,typeName:$e.ZodOptional,...Ze(t)});class wo extends Je{_parse(t){return this._getType(t)===we.null?gr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}wo.create=(e,t)=>new wo({innerType:e,typeName:$e.ZodNullable,...Ze(t)});class fc extends Je{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===we.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}fc.create=(e,t)=>new fc({innerType:e,typeName:$e.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ze(t)});class hc extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rc(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Wr(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Wr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}hc.create=(e,t)=>new hc({innerType:e,typeName:$e.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ze(t)});class Hd extends Je{_parse(t){if(this._getType(t)!==we.nan){const n=this._getOrReturnCtx(t);return ge(n,{code:ie.invalid_type,expected:we.nan,received:n.parsedType}),Be}return{status:"valid",value:t.data}}}Hd.create=e=>new Hd({typeName:$e.ZodNaN,...Ze(e)});const Vz=Symbol("zod_brand");class hy extends Je{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class zc extends Je{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Be:o.status==="dirty"?(r.dirty(),Vi(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Be:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new zc({in:t,out:r,typeName:$e.ZodPipeline})}}class pc extends Je{_parse(t){const r=this._def.innerType._parse(t),n=s=>(tc(s)&&(s.value=Object.freeze(s.value)),s);return rc(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}pc.create=(e,t)=>new pc({innerType:e,typeName:$e.ZodReadonly,...Ze(t)});function Zj(e,t={},r){return e?ya.create().superRefine((n,s)=>{var o,i;if(!e(n)){const a=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,c=(i=(o=a.fatal)!==null&&o!==void 0?o:r)!==null&&i!==void 0?i:!0,u=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...u,fatal:c})}}):ya.create()}const Wz={object:Rt.lazycreate};var $e;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})($e||($e={}));const Bz=(e,t={message:`Input not instance of ${e.name}`})=>Zj(r=>r instanceof e,t),Kj=yn.create,Gj=vo.create,Hz=Hd.create,Yz=yo.create,qj=nc.create,Zz=si.create,Kz=Vd.create,Gz=sc.create,qz=oc.create,Xz=ya.create,Qz=Ko.create,Jz=js.create,e8=Wd.create,t8=_n.create,r8=Rt.create,n8=Rt.strictCreate,s8=ic.create,o8=qf.create,i8=ac.create,a8=Zn.create,l8=lc.create,c8=Bd.create,u8=oi.create,d8=oa.create,f8=cc.create,h8=uc.create,p8=xo.create,m8=dc.create,g8=xa.create,vw=En.create,v8=Wn.create,y8=wo.create,x8=En.createWithPreprocess,w8=zc.create,_8=()=>Kj().optional(),b8=()=>Gj().optional(),S8=()=>qj().optional(),k8={string:e=>yn.create({...e,coerce:!0}),number:e=>vo.create({...e,coerce:!0}),boolean:e=>nc.create({...e,coerce:!0}),bigint:e=>yo.create({...e,coerce:!0}),date:e=>si.create({...e,coerce:!0})},C8=Be;var pe=Object.freeze({__proto__:null,defaultErrorMap:va,setErrorMap:Cz,getErrorMap:zd,makeIssue:Ud,EMPTY_PATH:jz,addIssueToContext:ge,ParseStatus:cr,INVALID:Be,DIRTY:Vi,OK:gr,isAborted:jm,isDirty:Em,isValid:tc,isAsync:rc,get util(){return ot},get objectUtil(){return Cm},ZodParsedType:we,getParsedType:Zs,ZodType:Je,datetimeRegex:Hj,ZodString:yn,ZodNumber:vo,ZodBigInt:yo,ZodBoolean:nc,ZodDate:si,ZodSymbol:Vd,ZodUndefined:sc,ZodNull:oc,ZodAny:ya,ZodUnknown:Ko,ZodNever:js,ZodVoid:Wd,ZodArray:_n,ZodObject:Rt,ZodUnion:ic,ZodDiscriminatedUnion:qf,ZodIntersection:ac,ZodTuple:Zn,ZodRecord:lc,ZodMap:Bd,ZodSet:oi,ZodFunction:oa,ZodLazy:cc,ZodLiteral:uc,ZodEnum:xo,ZodNativeEnum:dc,ZodPromise:xa,ZodEffects:En,ZodTransformer:En,ZodOptional:Wn,ZodNullable:wo,ZodDefault:fc,ZodCatch:hc,ZodNaN:Hd,BRAND:Vz,ZodBranded:hy,ZodPipeline:zc,ZodReadonly:pc,custom:Zj,Schema:Je,ZodSchema:Je,late:Wz,get ZodFirstPartyTypeKind(){return $e},coerce:k8,any:Xz,array:t8,bigint:Yz,boolean:qj,date:Zz,discriminatedUnion:o8,effect:vw,enum:p8,function:d8,instanceof:Bz,intersection:i8,lazy:f8,literal:h8,map:c8,nan:Hz,nativeEnum:m8,never:Jz,null:qz,nullable:y8,number:Gj,object:r8,oboolean:S8,onumber:b8,optional:v8,ostring:_8,pipeline:w8,preprocess:x8,promise:g8,record:l8,set:u8,strictObject:n8,string:Kj,symbol:Kz,transformer:vw,tuple:a8,undefined:Gz,union:s8,unknown:Qz,void:e8,NEVER:C8,ZodIssueCode:ie,quotelessJson:kz,ZodError:Wr}),j8="Label",Xj=v.forwardRef((e,t)=>l.jsx(Re.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Xj.displayName=j8;var Qj=Xj;const E8=_c("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ma=v.forwardRef(({className:e,...t},r)=>l.jsx(Qj,{ref:r,className:ae(E8(),e),...t}));Ma.displayName=Qj.displayName;const Pr=iz,Jj=v.createContext({}),Ne=({...e})=>l.jsx(Jj.Provider,{value:{name:e.name},children:l.jsx(uz,{...e})}),Xf=()=>{const e=v.useContext(Jj),t=v.useContext(eE),{getFieldState:r,formState:n}=Gf(),s=r(e.name,n);if(!e)throw new Error("useFormField should be used within ");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...s}},eE=v.createContext({}),Ce=v.forwardRef(({className:e,...t},r)=>{const n=v.useId();return l.jsx(eE.Provider,{value:{id:n},children:l.jsx("div",{ref:r,className:ae("space-y-2",e),...t})})});Ce.displayName="FormItem";const je=v.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:s}=Xf();return l.jsx(Ma,{ref:r,className:ae(n&&"text-destructive",e),htmlFor:s,...t})});je.displayName="FormLabel";const Ee=v.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:s,formMessageId:o}=Xf();return l.jsx(bs,{ref:t,id:n,"aria-describedby":r?`${s} ${o}`:`${s}`,"aria-invalid":!!r,...e})});Ee.displayName="FormControl";const N8=v.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=Xf();return l.jsx("p",{ref:r,id:n,className:ae("text-sm text-muted-foreground",e),...t})});N8.displayName="FormDescription";const Se=v.forwardRef(({className:e,children:t,...r},n)=>{const{error:s,formMessageId:o}=Xf(),i=s?String(s==null?void 0:s.message):t;return i?l.jsx("p",{ref:n,id:o,className:ae("text-sm font-medium text-destructive",e),...r,children:i}):null});Se.displayName="FormMessage";function Tm(e,[t,r]){return Math.min(r,Math.max(t,e))}var T8=[" ","Enter","ArrowUp","ArrowDown"],R8=[" ","Enter"],Uc="Select",[Qf,Jf,P8]=bc(Uc),[Ia,E$]=xr(Uc,[P8,Pa]),eh=Pa(),[A8,Eo]=Ia(Uc),[D8,O8]=Ia(Uc),tE=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:i,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:m,required:y}=e,x=eh(t),[g,_]=v.useState(null),[p,h]=v.useState(null),[w,C]=v.useState(!1),j=Ea(u),[E=!1,R]=on({prop:n,defaultProp:s,onChange:o}),[P,A]=on({prop:i,defaultProp:a,onChange:c}),L=v.useRef(null),q=g?!!g.closest("form"):!0,[N,F]=v.useState(new Set),b=Array.from(N).map(V=>V.props.value).join(";");return l.jsx(Xg,{...x,children:l.jsxs(A8,{required:y,scope:t,trigger:g,onTriggerChange:_,valueNode:p,onValueNodeChange:h,valueNodeHasChildren:w,onValueNodeHasChildrenChange:C,contentId:Ur(),value:P,onValueChange:A,open:E,onOpenChange:R,dir:j,triggerPointerDownPosRef:L,disabled:m,children:[l.jsx(Qf.Provider,{scope:t,children:l.jsx(D8,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(V=>{F(te=>new Set(te).add(V))},[]),onNativeOptionRemove:v.useCallback(V=>{F(te=>{const W=new Set(te);return W.delete(V),W})},[]),children:r})}),q?l.jsxs(EE,{"aria-hidden":!0,required:y,tabIndex:-1,name:d,autoComplete:f,value:P,onChange:V=>A(V.target.value),disabled:m,children:[P===void 0?l.jsx("option",{value:""}):null,Array.from(N)]},b):null]})})};tE.displayName=Uc;var rE="SelectTrigger",nE=v.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,o=eh(r),i=Eo(rE,r),a=i.disabled||n,c=Ke(t,i.onTriggerChange),u=Jf(r),[d,f,m]=NE(x=>{const g=u().filter(h=>!h.disabled),_=g.find(h=>h.value===i.value),p=TE(g,x,_);p!==void 0&&i.onValueChange(p.value)}),y=()=>{a||(i.onOpenChange(!0),m())};return l.jsx(Qg,{asChild:!0,...o,children:l.jsx(Re.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":jE(i.value)?"":void 0,...s,ref:c,onClick:ce(s.onClick,x=>{x.currentTarget.focus()}),onPointerDown:ce(s.onPointerDown,x=>{const g=x.target;g.hasPointerCapture(x.pointerId)&&g.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&(y(),i.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)},x.preventDefault())}),onKeyDown:ce(s.onKeyDown,x=>{const g=d.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&f(x.key),!(g&&x.key===" ")&&T8.includes(x.key)&&(y(),x.preventDefault())})})})});nE.displayName=rE;var sE="SelectValue",oE=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:i="",...a}=e,c=Eo(sE,r),{onValueNodeHasChildrenChange:u}=c,d=o!==void 0,f=Ke(t,c.onValueNodeChange);return Jt(()=>{u(d)},[u,d]),l.jsx(Re.span,{...a,ref:f,style:{pointerEvents:"none"},children:jE(c.value)?l.jsx(l.Fragment,{children:i}):o})});oE.displayName=sE;var M8="SelectIcon",iE=v.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return l.jsx(Re.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});iE.displayName=M8;var I8="SelectPortal",aE=e=>l.jsx(kc,{asChild:!0,...e});aE.displayName=I8;var ii="SelectContent",lE=v.forwardRef((e,t)=>{const r=Eo(ii,e.__scopeSelect),[n,s]=v.useState();if(Jt(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?Ns.createPortal(l.jsx(cE,{scope:e.__scopeSelect,children:l.jsx(Qf.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),o):null}return l.jsx(uE,{...e,ref:t})});lE.displayName=ii;var ls=10,[cE,No]=Ia(ii),L8="SelectContentImpl",uE=v.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:i,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:g,avoidCollisions:_,...p}=e,h=Eo(ii,r),[w,C]=v.useState(null),[j,E]=v.useState(null),R=Ke(t,he=>C(he)),[P,A]=v.useState(null),[L,q]=v.useState(null),N=Jf(r),[F,b]=v.useState(!1),V=v.useRef(!1);v.useEffect(()=>{if(w)return tv(w)},[w]),Vg();const te=v.useCallback(he=>{const[ye,...ke]=N().map(Pe=>Pe.ref.current),[Fe]=ke.slice(-1),Me=document.activeElement;for(const Pe of he)if(Pe===Me||(Pe==null||Pe.scrollIntoView({block:"nearest"}),Pe===ye&&j&&(j.scrollTop=0),Pe===Fe&&j&&(j.scrollTop=j.scrollHeight),Pe==null||Pe.focus(),document.activeElement!==Me))return},[N,j]),W=v.useCallback(()=>te([P,w]),[te,P,w]);v.useEffect(()=>{F&&W()},[F,W]);const{onOpenChange:Z,triggerPointerDownPosRef:I}=h;v.useEffect(()=>{if(w){let he={x:0,y:0};const ye=Fe=>{var Me,Pe;he={x:Math.abs(Math.round(Fe.pageX)-(((Me=I.current)==null?void 0:Me.x)??0)),y:Math.abs(Math.round(Fe.pageY)-(((Pe=I.current)==null?void 0:Pe.y)??0))}},ke=Fe=>{he.x<=10&&he.y<=10?Fe.preventDefault():w.contains(Fe.target)||Z(!1),document.removeEventListener("pointermove",ye),I.current=null};return I.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",ke,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",ke,{capture:!0})}}},[w,Z,I]),v.useEffect(()=>{const he=()=>Z(!1);return window.addEventListener("blur",he),window.addEventListener("resize",he),()=>{window.removeEventListener("blur",he),window.removeEventListener("resize",he)}},[Z]);const[Q,z]=NE(he=>{const ye=N().filter(Me=>!Me.disabled),ke=ye.find(Me=>Me.ref.current===document.activeElement),Fe=TE(ye,he,ke);Fe&&setTimeout(()=>Fe.ref.current.focus())}),$=v.useCallback((he,ye,ke)=>{const Fe=!V.current&&!ke;(h.value!==void 0&&h.value===ye||Fe)&&(A(he),Fe&&(V.current=!0))},[h.value]),fe=v.useCallback(()=>w==null?void 0:w.focus(),[w]),ne=v.useCallback((he,ye,ke)=>{const Fe=!V.current&&!ke;(h.value!==void 0&&h.value===ye||Fe)&&q(he)},[h.value]),se=n==="popper"?Rm:dE,Oe=se===Rm?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:y,sticky:x,hideWhenDetached:g,avoidCollisions:_}:{};return l.jsx(cE,{scope:r,content:w,viewport:j,onViewportChange:E,itemRefCallback:$,selectedItem:P,onItemLeave:fe,itemTextRefCallback:ne,focusSelectedItem:W,selectedItemText:L,position:n,isPositioned:F,searchRef:Q,children:l.jsx(jf,{as:bs,allowPinchZoom:!0,children:l.jsx(wf,{asChild:!0,trapped:h.open,onMountAutoFocus:he=>{he.preventDefault()},onUnmountAutoFocus:ce(s,he=>{var ye;(ye=h.trigger)==null||ye.focus({preventScroll:!0}),he.preventDefault()}),children:l.jsx(Na,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:he=>he.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:l.jsx(se,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:he=>he.preventDefault(),...p,...Oe,onPlaced:()=>b(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...p.style},onKeyDown:ce(p.onKeyDown,he=>{const ye=he.ctrlKey||he.altKey||he.metaKey;if(he.key==="Tab"&&he.preventDefault(),!ye&&he.key.length===1&&z(he.key),["ArrowUp","ArrowDown","Home","End"].includes(he.key)){let Fe=N().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);if(["ArrowUp","End"].includes(he.key)&&(Fe=Fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(he.key)){const Me=he.target,Pe=Fe.indexOf(Me);Fe=Fe.slice(Pe+1)}setTimeout(()=>te(Fe)),he.preventDefault()}})})})})})})});uE.displayName=L8;var F8="SelectItemAlignedPosition",dE=v.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,o=Eo(ii,r),i=No(ii,r),[a,c]=v.useState(null),[u,d]=v.useState(null),f=Ke(t,R=>d(R)),m=Jf(r),y=v.useRef(!1),x=v.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:p,focusSelectedItem:h}=i,w=v.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&u&&g&&_&&p){const R=o.trigger.getBoundingClientRect(),P=u.getBoundingClientRect(),A=o.valueNode.getBoundingClientRect(),L=p.getBoundingClientRect();if(o.dir!=="rtl"){const Me=L.left-P.left,Pe=A.left-Me,nt=R.left-Pe,k=R.width+nt,J=Math.max(k,P.width),K=window.innerWidth-ls,D=Tm(Pe,[ls,K-J]);a.style.minWidth=k+"px",a.style.left=D+"px"}else{const Me=P.right-L.right,Pe=window.innerWidth-A.right-Me,nt=window.innerWidth-R.right-Pe,k=R.width+nt,J=Math.max(k,P.width),K=window.innerWidth-ls,D=Tm(Pe,[ls,K-J]);a.style.minWidth=k+"px",a.style.right=D+"px"}const q=m(),N=window.innerHeight-ls*2,F=g.scrollHeight,b=window.getComputedStyle(u),V=parseInt(b.borderTopWidth,10),te=parseInt(b.paddingTop,10),W=parseInt(b.borderBottomWidth,10),Z=parseInt(b.paddingBottom,10),I=V+te+F+Z+W,Q=Math.min(_.offsetHeight*5,I),z=window.getComputedStyle(g),$=parseInt(z.paddingTop,10),fe=parseInt(z.paddingBottom,10),ne=R.top+R.height/2-ls,se=N-ne,Oe=_.offsetHeight/2,he=_.offsetTop+Oe,ye=V+te+he,ke=I-ye;if(ye<=ne){const Me=_===q[q.length-1].ref.current;a.style.bottom="0px";const Pe=u.clientHeight-g.offsetTop-g.offsetHeight,nt=Math.max(se,Oe+(Me?fe:0)+Pe+W),k=ye+nt;a.style.height=k+"px"}else{const Me=_===q[0].ref.current;a.style.top="0px";const nt=Math.max(ne,V+g.offsetTop+(Me?$:0)+Oe)+ke;a.style.height=nt+"px",g.scrollTop=ye-ne+g.offsetTop}a.style.margin=`${ls}px 0`,a.style.minHeight=Q+"px",a.style.maxHeight=N+"px",n==null||n(),requestAnimationFrame(()=>y.current=!0)}},[m,o.trigger,o.valueNode,a,u,g,_,p,o.dir,n]);Jt(()=>w(),[w]);const[C,j]=v.useState();Jt(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const E=v.useCallback(R=>{R&&x.current===!0&&(w(),h==null||h(),x.current=!1)},[w,h]);return l.jsx(U8,{scope:r,contentWrapper:a,shouldExpandOnScrollRef:y,onScrollButtonChange:E,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:l.jsx(Re.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});dE.displayName=F8;var z8="SelectPopperPosition",Rm=v.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=ls,...o}=e,i=eh(r);return l.jsx(Jg,{...i,...o,ref:t,align:n,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Rm.displayName=z8;var[U8,py]=Ia(ii,{}),Pm="SelectViewport",fE=v.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,o=No(Pm,r),i=py(Pm,r),a=Ke(t,o.onViewportChange),c=v.useRef(0);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),l.jsx(Qf.Slot,{scope:r,children:l.jsx(Re.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"auto",...s.style},onScroll:ce(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&f){const y=Math.abs(c.current-d.scrollTop);if(y>0){const x=window.innerHeight-ls*2,g=parseFloat(f.style.minHeight),_=parseFloat(f.style.height),p=Math.max(g,_);if(p0?C:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});fE.displayName=Pm;var hE="SelectGroup",[$8,V8]=Ia(hE),pE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Ur();return l.jsx($8,{scope:r,id:s,children:l.jsx(Re.div,{role:"group","aria-labelledby":s,...n,ref:t})})});pE.displayName=hE;var mE="SelectLabel",gE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=V8(mE,r);return l.jsx(Re.div,{id:s.id,...n,ref:t})});gE.displayName=mE;var Yd="SelectItem",[W8,vE]=Ia(Yd),yE=v.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...i}=e,a=Eo(Yd,r),c=No(Yd,r),u=a.value===n,[d,f]=v.useState(o??""),[m,y]=v.useState(!1),x=Ke(t,p=>{var h;return(h=c.itemRefCallback)==null?void 0:h.call(c,p,n,s)}),g=Ur(),_=()=>{s||(a.onValueChange(n),a.onOpenChange(!1))};if(n==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l.jsx(W8,{scope:r,value:n,disabled:s,textId:g,isSelected:u,onItemTextChange:v.useCallback(p=>{f(h=>h||((p==null?void 0:p.textContent)??"").trim())},[]),children:l.jsx(Qf.ItemSlot,{scope:r,value:n,disabled:s,textValue:d,children:l.jsx(Re.div,{role:"option","aria-labelledby":g,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:x,onFocus:ce(i.onFocus,()=>y(!0)),onBlur:ce(i.onBlur,()=>y(!1)),onPointerUp:ce(i.onPointerUp,_),onPointerMove:ce(i.onPointerMove,p=>{var h;s?(h=c.onItemLeave)==null||h.call(c):p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ce(i.onPointerLeave,p=>{var h;p.currentTarget===document.activeElement&&((h=c.onItemLeave)==null||h.call(c))}),onKeyDown:ce(i.onKeyDown,p=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&p.key===" "||(R8.includes(p.key)&&_(),p.key===" "&&p.preventDefault())})})})})});yE.displayName=Yd;var ll="SelectItemText",xE=v.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...o}=e,i=Eo(ll,r),a=No(ll,r),c=vE(ll,r),u=O8(ll,r),[d,f]=v.useState(null),m=Ke(t,p=>f(p),c.onItemTextChange,p=>{var h;return(h=a.itemTextRefCallback)==null?void 0:h.call(a,p,c.value,c.disabled)}),y=d==null?void 0:d.textContent,x=v.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:y},c.value),[c.disabled,c.value,y]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return Jt(()=>(g(x),()=>_(x)),[g,_,x]),l.jsxs(l.Fragment,{children:[l.jsx(Re.span,{id:c.textId,...o,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ns.createPortal(o.children,i.valueNode):null]})});xE.displayName=ll;var wE="SelectItemIndicator",_E=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return vE(wE,r).isSelected?l.jsx(Re.span,{"aria-hidden":!0,...n,ref:t}):null});_E.displayName=wE;var Am="SelectScrollUpButton",bE=v.forwardRef((e,t)=>{const r=No(Am,e.__scopeSelect),n=py(Am,e.__scopeSelect),[s,o]=v.useState(!1),i=Ke(t,n.onScrollButtonChange);return Jt(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollTop>0;o(u)};const c=r.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(kE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});bE.displayName=Am;var Dm="SelectScrollDownButton",SE=v.forwardRef((e,t)=>{const r=No(Dm,e.__scopeSelect),n=py(Dm,e.__scopeSelect),[s,o]=v.useState(!1),i=Ke(t,n.onScrollButtonChange);return Jt(()=>{if(r.viewport&&r.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",a)}},[r.viewport,r.isPositioned]),s?l.jsx(kE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=r;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});SE.displayName=Dm;var kE=v.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,o=No("SelectScrollButton",r),i=v.useRef(null),a=Jf(r),c=v.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Jt(()=>{var d;const u=a().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),l.jsx(Re.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:ce(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:ce(s.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:ce(s.onPointerLeave,()=>{c()})})}),B8="SelectSeparator",CE=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return l.jsx(Re.div,{"aria-hidden":!0,...n,ref:t})});CE.displayName=B8;var Om="SelectArrow",H8=v.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=eh(r),o=Eo(Om,r),i=No(Om,r);return o.open&&i.position==="popper"?l.jsx(ev,{...s,...n,ref:t}):null});H8.displayName=Om;function jE(e){return e===""||e===void 0}var EE=v.forwardRef((e,t)=>{const{value:r,...n}=e,s=v.useRef(null),o=Ke(t,s),i=YC(r);return v.useEffect(()=>{const a=s.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==r&&d){const f=new Event("change",{bubbles:!0});d.call(a,r),a.dispatchEvent(f)}},[i,r]),l.jsx(Ic,{asChild:!0,children:l.jsx("select",{...n,ref:o,defaultValue:r})})});EE.displayName="BubbleSelect";function NE(e){const t=Dt(e),r=v.useRef(""),n=v.useRef(0),s=v.useCallback(i=>{const a=r.current+i;t(a),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(a)},[t]),o=v.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function TE(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let i=Y8(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==r));const c=i.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function Y8(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Z8=tE,RE=nE,K8=oE,G8=iE,q8=aE,PE=lE,X8=fE,Q8=pE,AE=gE,DE=yE,J8=xE,eU=_E,OE=bE,ME=SE,IE=CE;const Mo=Z8,cl=Q8,Io=K8,Ks=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(RE,{ref:n,className:ae("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,l.jsx(G8,{asChild:!0,children:l.jsx(Lg,{className:"h-4 w-4 opacity-50"})})]}));Ks.displayName=RE.displayName;const LE=v.forwardRef(({className:e,...t},r)=>l.jsx(OE,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(aA,{className:"h-4 w-4"})}));LE.displayName=OE.displayName;const FE=v.forwardRef(({className:e,...t},r)=>l.jsx(ME,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Lg,{className:"h-4 w-4"})}));FE.displayName=ME.displayName;const Gs=v.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>l.jsx(q8,{children:l.jsxs(PE,{ref:s,className:ae("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[l.jsx(LE,{}),l.jsx(X8,{className:ae("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(FE,{})]})}));Gs.displayName=PE.displayName;const Wi=v.forwardRef(({className:e,...t},r)=>l.jsx(AE,{ref:r,className:ae("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Wi.displayName=AE.displayName;const pn=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(DE,{ref:n,className:ae("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(eU,{children:l.jsx(eb,{className:"h-4 w-4"})})}),l.jsx(J8,{children:t})]}));pn.displayName=DE.displayName;const tU=v.forwardRef(({className:e,...t},r)=>l.jsx(IE,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));tU.displayName=IE.displayName;const Mm=new Map([["aliyun-cdn",["阿里云-CDN","/imgs/providers/aliyun.svg"]],["aliyun-oss",["阿里云-OSS","/imgs/providers/aliyun.svg"]],["aliyun-dcdn",["阿里云-DCDN","/imgs/providers/aliyun.svg"]],["tencent-cdn",["腾讯云-CDN","/imgs/providers/tencent.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.svg"]],["qiniu-cdn",["七牛云-CDN","/imgs/providers/qiniu.svg"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),rU=Array.from(Mm.keys()),my=mv,gy=gv,nU=vv,zE=v.forwardRef(({className:e,...t},r)=>l.jsx(Ec,{ref:r,className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));zE.displayName=Ec.displayName;const th=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(nU,{children:[l.jsx(zE,{}),l.jsxs(Nc,{ref:n,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,l.jsxs(Tf,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(Fg,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));th.displayName=Nc.displayName;const rh=({className:e,...t})=>l.jsx("div",{className:ae("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});rh.displayName="DialogHeader";const nh=v.forwardRef(({className:e,...t},r)=>l.jsx(Tc,{ref:r,className:ae("text-lg font-semibold leading-none tracking-tight",e),...t}));nh.displayName=Tc.displayName;const sU=v.forwardRef(({className:e,...t},r)=>l.jsx(Rc,{ref:r,className:ae("text-sm text-muted-foreground",e),...t}));sU.displayName=Rc.displayName;function oU(e,t){return v.useReducer((r,n)=>t[r][n]??r,e)}var vy="ScrollArea",[UE,N$]=xr(vy),[iU,cn]=UE(vy),$E=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:o=600,...i}=e,[a,c]=v.useState(null),[u,d]=v.useState(null),[f,m]=v.useState(null),[y,x]=v.useState(null),[g,_]=v.useState(null),[p,h]=v.useState(0),[w,C]=v.useState(0),[j,E]=v.useState(!1),[R,P]=v.useState(!1),A=Ke(t,q=>c(q)),L=Ea(s);return l.jsx(iU,{scope:r,type:n,dir:L,scrollHideDelay:o,scrollArea:a,viewport:u,onViewportChange:d,content:f,onContentChange:m,scrollbarX:y,onScrollbarXChange:x,scrollbarXEnabled:j,onScrollbarXEnabledChange:E,scrollbarY:g,onScrollbarYChange:_,scrollbarYEnabled:R,onScrollbarYEnabledChange:P,onCornerWidthChange:h,onCornerHeightChange:C,children:l.jsx(Re.div,{dir:L,...i,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":p+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});$E.displayName=vy;var VE="ScrollAreaViewport",WE=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...o}=e,i=cn(VE,r),a=v.useRef(null),c=Ke(t,a,i.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(Re.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});WE.displayName=VE;var Xn="ScrollAreaScrollbar",yy=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:i}=s,a=e.orientation==="horizontal";return v.useEffect(()=>(a?o(!0):i(!0),()=>{a?o(!1):i(!1)}),[a,o,i]),s.type==="hover"?l.jsx(aU,{...n,ref:t,forceMount:r}):s.type==="scroll"?l.jsx(lU,{...n,ref:t,forceMount:r}):s.type==="auto"?l.jsx(BE,{...n,ref:t,forceMount:r}):s.type==="always"?l.jsx(xy,{...n,ref:t}):null});yy.displayName=Xn;var aU=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),[o,i]=v.useState(!1);return v.useEffect(()=>{const a=s.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),l.jsx(ur,{present:r||o,children:l.jsx(BE,{"data-state":o?"visible":"hidden",...n,ref:t})})}),lU=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cn(Xn,e.__scopeScrollArea),o=e.orientation==="horizontal",i=oh(()=>c("SCROLL_END"),100),[a,c]=oU("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,s.scrollHideDelay,c]),v.useEffect(()=>{const u=s.viewport,d=o?"scrollLeft":"scrollTop";if(u){let f=u[d];const m=()=>{const y=u[d];f!==y&&(c("SCROLL"),i()),f=y};return u.addEventListener("scroll",m),()=>u.removeEventListener("scroll",m)}},[s.viewport,o,c,i]),l.jsx(ur,{present:r||a!=="hidden",children:l.jsx(xy,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:ce(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ce(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),BE=v.forwardRef((e,t)=>{const r=cn(Xn,e.__scopeScrollArea),{forceMount:n,...s}=e,[o,i]=v.useState(!1),a=e.orientation==="horizontal",c=oh(()=>{if(r.viewport){const u=r.viewport.offsetWidth{const{orientation:r="vertical",...n}=e,s=cn(Xn,e.__scopeScrollArea),o=v.useRef(null),i=v.useRef(0),[a,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=GE(a.viewport,a.content),d={...n,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:m=>o.current=m,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:m=>i.current=m};function f(m,y){return pU(m,i.current,a,y)}return r==="horizontal"?l.jsx(cU,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollLeft,y=yw(m,a,s.dir);o.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollLeft=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollLeft=f(m,s.dir))}}):r==="vertical"?l.jsx(uU,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const m=s.viewport.scrollTop,y=yw(m,a);o.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollTop=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollTop=f(m))}}):null}),cU=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=cn(Xn,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Ke(t,c,o.onScrollbarXChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(YE,{"data-orientation":"horizontal",...s,ref:u,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":sh(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const m=o.viewport.scrollLeft+d.deltaX;e.onWheelScroll(m),XE(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Kd(i.paddingLeft),paddingEnd:Kd(i.paddingRight)}})}})}),uU=v.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=cn(Xn,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Ke(t,c,o.onScrollbarYChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(YE,{"data-orientation":"vertical",...s,ref:u,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":sh(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const m=o.viewport.scrollTop+d.deltaY;e.onWheelScroll(m),XE(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&o.viewport&&i&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Kd(i.paddingTop),paddingEnd:Kd(i.paddingBottom)}})}})}),[dU,HE]=UE(Xn),YE=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...m}=e,y=cn(Xn,r),[x,g]=v.useState(null),_=Ke(t,A=>g(A)),p=v.useRef(null),h=v.useRef(""),w=y.viewport,C=n.content-n.viewport,j=Dt(d),E=Dt(c),R=oh(f,10);function P(A){if(p.current){const L=A.clientX-p.current.left,q=A.clientY-p.current.top;u({x:L,y:q})}}return v.useEffect(()=>{const A=L=>{const q=L.target;(x==null?void 0:x.contains(q))&&j(L,C)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[w,x,C,j]),v.useEffect(E,[n,E]),wa(x,R),wa(y.content,R),l.jsx(dU,{scope:r,scrollbar:x,hasThumb:s,onThumbChange:Dt(o),onThumbPointerUp:Dt(i),onThumbPositionChange:E,onThumbPointerDown:Dt(a),children:l.jsx(Re.div,{...m,ref:_,style:{position:"absolute",...m.style},onPointerDown:ce(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),p.current=x.getBoundingClientRect(),h.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),P(A))}),onPointerMove:ce(e.onPointerMove,P),onPointerUp:ce(e.onPointerUp,A=>{const L=A.target;L.hasPointerCapture(A.pointerId)&&L.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=h.current,y.viewport&&(y.viewport.style.scrollBehavior=""),p.current=null})})})}),Zd="ScrollAreaThumb",ZE=v.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=HE(Zd,e.__scopeScrollArea);return l.jsx(ur,{present:r||s.hasThumb,children:l.jsx(fU,{ref:t,...n})})}),fU=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,o=cn(Zd,r),i=HE(Zd,r),{onThumbPositionChange:a}=i,c=Ke(t,f=>i.onThumbChange(f)),u=v.useRef(),d=oh(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const f=o.viewport;if(f){const m=()=>{if(d(),!u.current){const y=mU(f,a);u.current=y,a()}};return a(),f.addEventListener("scroll",m),()=>f.removeEventListener("scroll",m)}},[o.viewport,d,a]),l.jsx(Re.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ce(e.onPointerDownCapture,f=>{const y=f.target.getBoundingClientRect(),x=f.clientX-y.left,g=f.clientY-y.top;i.onThumbPointerDown({x,y:g})}),onPointerUp:ce(e.onPointerUp,i.onThumbPointerUp)})});ZE.displayName=Zd;var wy="ScrollAreaCorner",KE=v.forwardRef((e,t)=>{const r=cn(wy,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?l.jsx(hU,{...e,ref:t}):null});KE.displayName=wy;var hU=v.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=cn(wy,r),[o,i]=v.useState(0),[a,c]=v.useState(0),u=!!(o&&a);return wa(s.scrollbarX,()=>{var f;const d=((f=s.scrollbarX)==null?void 0:f.offsetHeight)||0;s.onCornerHeightChange(d),c(d)}),wa(s.scrollbarY,()=>{var f;const d=((f=s.scrollbarY)==null?void 0:f.offsetWidth)||0;s.onCornerWidthChange(d),i(d)}),u?l.jsx(Re.div,{...n,ref:t,style:{width:o,height:a,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Kd(e){return e?parseInt(e,10):0}function GE(e,t){const r=e/t;return isNaN(r)?0:r}function sh(e){const t=GE(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function pU(e,t,r,n="ltr"){const s=sh(r),o=s/2,i=t||o,a=s-i,c=r.scrollbar.paddingStart+i,u=r.scrollbar.size-r.scrollbar.paddingEnd-a,d=r.content-r.viewport,f=n==="ltr"?[0,d]:[d*-1,0];return qE([c,u],f)(e)}function yw(e,t,r="ltr"){const n=sh(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,i=t.content-t.viewport,a=o-n,c=r==="ltr"?[0,i]:[i*-1,0],u=Tm(e,c);return qE([0,i],[0,a])(u)}function qE(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function XE(e,t){return e>0&&e{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function s(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,a=r.top!==o.top;(i||a)&&t(),r=o,n=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(n)};function oh(e,t){const r=Dt(e),n=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(n.current),[]),v.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function wa(e,t){const r=Dt(t);Jt(()=>{let n=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(n),s.unobserve(e)}}},[e,r])}var QE=$E,gU=WE,vU=KE;const ih=v.forwardRef(({className:e,children:t,...r},n)=>l.jsxs(QE,{ref:n,className:ae("relative overflow-hidden",e),...r,children:[l.jsx(gU,{className:"h-full w-full rounded-[inherit]",children:t}),l.jsx(JE,{}),l.jsx(vU,{})]}));ih.displayName=QE.displayName;const JE=v.forwardRef(({className:e,orientation:t="vertical",...r},n)=>l.jsx(yy,{ref:n,orientation:t,className:ae("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:l.jsx(ZE,{className:"relative flex-1 rounded-full bg-border"})}));JE.displayName=yy.displayName;const uo=new Map([["tencent",["腾讯云","/imgs/providers/tencent.svg"]],["aliyun",["阿里云","/imgs/providers/aliyun.svg"]],["cloudflare",["Cloudflare","/imgs/providers/cloudflare.svg"]],["namesilo",["Namesilo","/imgs/providers/namesilo.svg"]],["godaddy",["GoDaddy","/imgs/providers/godaddy.svg"]],["qiniu",["七牛云","/imgs/providers/qiniu.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.svg"]],["webhook",["Webhook","/imgs/providers/webhook.svg"]]]),xw=e=>uo.get(e),To=pe.union([pe.literal("aliyun"),pe.literal("tencent"),pe.literal("ssh"),pe.literal("webhook"),pe.literal("cloudflare"),pe.literal("qiniu"),pe.literal("namesilo"),pe.literal("godaddy")],{message:"请选择云服务商"}),Ro=e=>{switch(e){case"aliyun":case"tencent":return"all";case"ssh":case"webhook":case"qiniu":return"deploy";case"cloudflare":case"namesilo":case"godaddy":return"apply";default:return"all"}},yU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,secretId:pe.string().min(1).max(64),secretKey:pe.string().min(1).max(64)});let o={secretId:"",secretKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"tencent",secretId:o.secretId,secretKey:o.secretKey}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{secretId:c.secretId,secretKey:c.secretKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretId"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretId",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretKey",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},xU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,accessKeyId:pe.string().min(1).max(64),accessSecretId:pe.string().min(1).max(64)});let o={accessKeyId:"",accessKeySecret:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"aliyun",accessKeyId:o.accessKeyId,accessSecretId:o.accessKeySecret}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{accessKeyId:c.accessKeyId,accessKeySecret:c.accessSecretId}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessKeyId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKeyId"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKeyId",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessSecretId",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKeySecret"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKeySecret",...c})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},mc=v.forwardRef(({className:e,...t},r)=>l.jsx("textarea",{className:ae("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));mc.displayName="Textarea";const _y=({className:e,trigger:t})=>{const{reloadAccessGroups:r}=Kr(),[n,s]=v.useState(!1),o=pe.object({name:pe.string().min(1).max(64)}),i=Tr({resolver:Rr(o),defaultValues:{name:""}}),a=async c=>{try{await S3({name:c.name}),r(),s(!1)}catch(u){Object.entries(u.response.data).forEach(([f,m])=>{i.setError(f,{type:"manual",message:m.message})})}};return l.jsxs(my,{onOpenChange:s,open:n,children:[l.jsx(gy,{asChild:!0,className:ae(e),children:t}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsx(nh,{children:"添加分组"})}),l.jsx("div",{className:"container py-3",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"组名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入组名",...c,type:"text"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})},wU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n,reloadAccessGroups:s,config:{accessGroups:o}}=Kr(),i=v.useRef(null),[a,c]=v.useState(""),u=e&&e.group?e.group:"",d=/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,f=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,m=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,host:pe.string().refine(h=>f.test(h)||d.test(h),{message:"请输入正确的域名或IP"}),group:pe.string().optional(),port:pe.string().min(1).max(5),username:pe.string().min(1).max(64),password:pe.string().min(0).max(64),key:pe.string().min(0).max(20480),keyFile:pe.any().optional(),command:pe.string().min(1).max(2048),certPath:pe.string().min(0).max(2048),keyPath:pe.string().min(0).max(2048)});let y={host:"127.0.0.1",port:"22",username:"root",password:"",key:"",keyFile:"",command:"sudo service nginx restart",certPath:"/etc/nginx/ssl/certificate.crt",keyPath:"/etc/nginx/ssl/private.key"};e&&(y=e.config);const x=Tr({resolver:Rr(m),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"ssh",group:e==null?void 0:e.group,host:y.host,port:y.port,username:y.username,password:y.password,key:y.key,keyFile:y.keyFile,certPath:y.certPath,keyPath:y.keyPath,command:y.command}}),g=async h=>{console.log(h);let w=h.group;w=="emptyId"&&(w="");const C={id:h.id,name:h.name,configType:h.configType,usage:Ro(h.configType),group:w,config:{host:h.host,port:h.port,username:h.username,password:h.password,key:h.key,command:h.command,certPath:h.certPath,keyPath:h.keyPath}};try{const j=await jo(C);t(),C.id=j.id,C.created=j.created,C.updated=j.updated,h.id?n(C):r(C),w!=u&&(u&&await nw({id:u,"access-":C.id}),w&&await nw({id:w,"access+":C.id})),s()}catch(j){Object.entries(j.response.data).forEach(([R,P])=>{x.setError(R,{type:"manual",message:P.message})});return}},_=async h=>{var E;const w=(E=h.target.files)==null?void 0:E[0];if(!w)return;const C=w;c(C.name);const j=await K6(C);x.setValue("key",j)},p=()=>{var h;console.log(i.current),(h=i.current)==null||h.click()};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...x,children:l.jsxs("form",{onSubmit:h=>{h.stopPropagation(),x.handleSubmit(g)(h)},className:"space-y-3",children:[l.jsx(Ne,{control:x.control,name:"name",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"group",render:({field:h})=>l.jsxs(Ce,{children:[l.jsxs(je,{className:"w-full flex justify-between",children:[l.jsx("div",{children:"授权配置组(用于将一个域名证书部署到多个 ssh 主机)"}),l.jsx(_y,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]})})]}),l.jsx(Ee,{children:l.jsxs(Mo,{...h,value:h.value,defaultValue:"emptyId",onValueChange:w=>{x.setValue("group",w)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择分组"})}),l.jsxs(Gs,{children:[l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),o.map(w=>l.jsx(pn,{value:w.id?w.id:"",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:w.name})},w.id))]})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"id",render:({field:h})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"configType",render:({field:h})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...h})}),l.jsx(Se,{})]})}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx(Ne,{control:x.control,name:"host",render:({field:h})=>l.jsxs(Ce,{className:"grow",children:[l.jsx(je,{children:"服务器HOST"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Host",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"port",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SSH端口"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Port",...h,type:"number"})}),l.jsx(Se,{})]})})]}),l.jsx(Ne,{control:x.control,name:"username",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"用户名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入用户名",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"password",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"密码"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入密码",...h,type:"password"})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"key",render:({field:h})=>l.jsxs(Ce,{hidden:!0,children:[l.jsx(je,{children:"Key(使用证书登录)"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Key",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"keyFile",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Key(使用证书登录)"}),l.jsx(Ee,{children:l.jsxs("div",{children:[l.jsx(He,{type:"button",variant:"secondary",size:"sm",className:"w-48",onClick:p,children:a||"请选择文件"}),l.jsx(Te,{placeholder:"请输入Key",...h,ref:i,className:"hidden",hidden:!0,type:"file",onChange:_})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"certPath",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"证书上传路径"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入证书上传路径",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"keyPath",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"私钥上传路径"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入私钥上传路径",...h})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:x.control,name:"command",render:({field:h})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Command"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:"请输入要执行的命令",...h})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},_U=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,url:pe.string().url()});let o={url:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"webhook",url:o.url}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{url:c.url}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"url",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"Webhook Url"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入Webhook Url",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},bU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,dnsApiToken:pe.string().min(1).max(64)});let o={dnsApiToken:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"cloudflare",dnsApiToken:o.dnsApiToken}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{dnsApiToken:c.dnsApiToken}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"dnsApiToken",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"CLOUD_DNS_API_TOKEN"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入CLOUD_DNS_API_TOKEN",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},SU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,accessKey:pe.string().min(1).max(64),secretKey:pe.string().min(1).max(64)});let o={accessKey:"",secretKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"qiniu",accessKey:o.accessKey,secretKey:o.secretKey}}),a=async c=>{const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{accessKey:c.accessKey,secretKey:c.secretKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})});return}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"accessKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"AccessKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入AccessKey",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"secretKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"SecretKey"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入SecretKey",...c})}),l.jsx(Se,{})]})}),l.jsx(Se,{}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},kU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,apiKey:pe.string().min(1).max(64)});let o={apiKey:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"namesilo",apiKey:o.apiKey}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{apiKey:c.apiKey}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"NAMESILO_API_KEY"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入NAMESILO_API_KEY",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})},CU=({data:e,onAfterReq:t})=>{const{addAccess:r,updateAccess:n}=Kr(),s=pe.object({id:pe.string().optional(),name:pe.string().min(1).max(64),configType:To,apiKey:pe.string().min(1).max(64),apiSecret:pe.string().min(1).max(64)});let o={apiKey:"",apiSecret:""};e&&(o=e.config);const i=Tr({resolver:Rr(s),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"godaddy",apiKey:o.apiKey,apiSecret:o.apiSecret}}),a=async c=>{console.log(c);const u={id:c.id,name:c.name,configType:c.configType,usage:Ro(c.configType),config:{apiKey:c.apiKey,apiSecret:c.apiSecret}};try{const d=await jo(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,c.id){n(u);return}r(u)}catch(d){Object.entries(d.response.data).forEach(([m,y])=>{i.setError(m,{type:"manual",message:y.message})})}};return l.jsx(l.Fragment,{children:l.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:l.jsx(Pr,{...i,children:l.jsxs("form",{onSubmit:c=>{console.log(c),c.stopPropagation(),i.handleSubmit(a)(c)},className:"space-y-8",children:[l.jsx(Ne,{control:i.control,name:"name",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"名称"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入授权名称",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"id",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"configType",render:({field:c})=>l.jsxs(Ce,{className:"hidden",children:[l.jsx(je,{children:"配置类型"}),l.jsx(Ee,{children:l.jsx(Te,{...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiKey",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"GODADDY_API_KEY"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入GODADDY_API_KEY",...c})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:i.control,name:"apiSecret",render:({field:c})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"GODADDY_API_SECRET"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入GODADDY_API_SECRET",...c})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})})};function jl({trigger:e,op:t,data:r,className:n}){const[s,o]=v.useState(!1),i=Array.from(uo.keys()),[a,c]=v.useState((r==null?void 0:r.configType)||"");let u=l.jsx(l.Fragment,{children:" "});switch(a){case"tencent":u=l.jsx(yU,{data:r,onAfterReq:()=>{o(!1)}});break;case"aliyun":u=l.jsx(xU,{data:r,onAfterReq:()=>{o(!1)}});break;case"ssh":u=l.jsx(wU,{data:r,onAfterReq:()=>{o(!1)}});break;case"webhook":u=l.jsx(_U,{data:r,onAfterReq:()=>{o(!1)}});break;case"cloudflare":u=l.jsx(bU,{data:r,onAfterReq:()=>{o(!1)}});break;case"qiniu":u=l.jsx(SU,{data:r,onAfterReq:()=>{o(!1)}});break;case"namesilo":u=l.jsx(kU,{data:r,onAfterReq:()=>{o(!1)}});break;case"godaddy":u=l.jsx(CU,{data:r,onAfterReq:()=>{o(!1)}});break}const d=f=>f==a?"border-primary":"";return l.jsxs(my,{onOpenChange:o,open:s,children:[l.jsx(gy,{asChild:!0,className:ae(n),children:e}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsxs(nh,{children:[t=="add"?"添加":"编辑","授权"]})}),l.jsx(ih,{className:"max-h-[80vh]",children:l.jsxs("div",{className:"container py-3",children:[l.jsx(Ma,{children:"服务商"}),l.jsxs(Mo,{onValueChange:f=>{console.log(f),c(f)},defaultValue:a,children:[l.jsx(Ks,{className:"mt-3",children:l.jsx(Io,{placeholder:"请选择服务商"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"服务商"}),i.map(f=>{var m,y;return l.jsx(pn,{value:f,children:l.jsxs("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer",d(f)),children:[l.jsx("img",{src:(m=uo.get(f))==null?void 0:m[1],className:"h-6 w-6"}),l.jsx("div",{children:(y=uo.get(f))==null?void 0:y[0]})]})},f)})]})})]}),u]})})]})]})}const jU=({className:e,trigger:t})=>{const{config:{emails:r},setEmails:n}=Kr(),[s,o]=v.useState(!1),i=pe.object({email:pe.string().email()}),a=Tr({resolver:Rr(i),defaultValues:{email:""}}),c=async u=>{if(r.content.emails.includes(u.email)){a.setError("email",{message:"邮箱已存在"});return}const d=[...r.content.emails,u.email];try{const f=await Mc({...r,name:"emails",content:{emails:d}});n(f),a.reset(),a.clearErrors(),o(!1)}catch(f){Object.entries(f.response.data).forEach(([y,x])=>{a.setError(y,{type:"manual",message:x.message})})}};return l.jsxs(my,{onOpenChange:o,open:s,children:[l.jsx(gy,{asChild:!0,className:ae(e),children:t}),l.jsxs(th,{className:"sm:max-w-[600px] w-full dark:text-stone-200",children:[l.jsx(rh,{children:l.jsx(nh,{children:"添加邮箱"})}),l.jsx("div",{className:"container py-3",children:l.jsx(Pr,{...a,children:l.jsxs("form",{onSubmit:u=>{console.log(u),u.stopPropagation(),a.handleSubmit(c)(u)},className:"space-y-8",children:[l.jsx(Ne,{control:a.control,name:"email",render:({field:u})=>l.jsxs(Ce,{children:[l.jsx(je,{children:"邮箱"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入邮箱",...u,type:"email"})}),l.jsx(Se,{})]})}),l.jsx("div",{className:"flex justify-end",children:l.jsx(He,{type:"submit",children:"保存"})})]})})})]})]})},EU=()=>{const{config:{accesses:e,emails:t,accessGroups:r}}=Kr(),[n,s]=v.useState(),o=Nn(),[i,a]=v.useState("base"),[c,u]=v.useState(n?n.targetType:"");v.useEffect(()=>{const p=new URLSearchParams(o.search).get("id");p&&(async()=>{const w=await J6(p);s(w),u(w.targetType)})()},[o.search]);const d=pe.object({id:pe.string().optional(),domain:pe.string().regex(/^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,{message:"请输入正确的域名"}),email:pe.string().email().optional(),access:pe.string().regex(/^[a-zA-Z0-9]+$/,{message:"请选择DNS服务商授权配置"}),targetAccess:pe.string().optional(),targetType:pe.string().regex(/^[a-zA-Z0-9-]+$/,{message:"请选择部署服务类型"}),variables:pe.string().optional(),group:pe.string().optional(),nameservers:pe.string().optional()}),f=Tr({resolver:Rr(d),defaultValues:{id:"",domain:"",email:"",access:"",targetAccess:"",targetType:"",variables:"",group:"",nameservers:""}});v.useEffect(()=>{n&&f.reset({id:n.id,domain:n.domain,email:n.email,access:n.access,targetAccess:n.targetAccess,targetType:n.targetType,variables:n.variables,group:n.group,nameservers:n.nameservers})},[n,f]);const m=e.filter(_=>{if(_.usage=="apply")return!1;if(c=="")return!0;const p=c.split("-");return _.configType===p[0]}),{toast:y}=qn(),x=Nr(),g=async _=>{const p=_.group=="emptyId"?"":_.group,h=_.targetAccess==="emptyId"?"":_.targetAccess;if(p==""&&h==""){f.setError("group",{type:"manual",message:"部署授权和部署授权组至少选一个"}),f.setError("targetAccess",{type:"manual",message:"部署授权和部署授权组至少选一个"});return}const w={id:_.id,crontab:"0 0 * * *",domain:_.domain,email:_.email,access:_.access,group:p,targetAccess:h,targetType:_.targetType,variables:_.variables,nameservers:_.nameservers};try{await km(w);let C="域名编辑成功";w.id==""&&(C="域名添加成功"),y({title:"成功",description:C}),x("/domains")}catch(C){Object.entries(C.response.data).forEach(([E,R])=>{f.setError(E,{type:"manual",message:R.message})});return}};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"",children:[l.jsx(ay,{}),l.jsxs("div",{className:" h-5 text-muted-foreground",children:[n!=null&&n.id?"编辑":"新增","域名"]}),l.jsxs("div",{className:"mt-5 flex w-full justify-center md:space-x-10 flex-col md:flex-row",children:[l.jsxs("div",{className:"w-full md:w-[200px] text-muted-foreground space-x-3 md:space-y-3 flex-row md:flex-col flex",children:[l.jsx("div",{className:ae("cursor-pointer text-right",i==="base"?"text-primary":""),onClick:()=>{a("base")},children:"基础设置"}),l.jsx("div",{className:ae("cursor-pointer text-right",i==="advance"?"text-primary":""),onClick:()=>{a("advance")},children:"高级设置"})]}),l.jsx("div",{className:"w-full md:w-[35em] bg-gray-100 dark:bg-gray-900 p-5 rounded mt-3 md:mt-0",children:l.jsx(Pr,{...f,children:l.jsxs("form",{onSubmit:f.handleSubmit(g),className:"space-y-8 dark:text-stone-200",children:[l.jsx(Ne,{control:f.control,name:"domain",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsx(je,{children:"域名"}),l.jsx(Ee,{children:l.jsx(Te,{placeholder:"请输入域名",..._})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"email",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"flex w-full justify-between",children:[l.jsx("div",{children:"Email(申请证书需要提供邮箱)"}),l.jsx(jU,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]})})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,onValueChange:p=>{f.setValue("email",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择邮箱"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"邮箱列表"}),t.content.emails.map(p=>l.jsx(pn,{value:p,children:l.jsx("div",{children:p})},p))]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"access",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"flex w-full justify-between",children:[l.jsx("div",{children:"DNS 服务商授权配置"}),l.jsx(jl,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]}),op:"add"})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,onValueChange:p=>{f.setValue("access",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择授权配置"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"服务商授权配置"}),e.filter(p=>p.usage!="deploy").map(p=>{var h;return l.jsx(pn,{value:p.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=uo.get(p.configType))==null?void 0:h[1]}),l.jsx("div",{children:p.name})]})},p.id)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"targetType",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsx(je,{children:"部署服务类型"}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,onValueChange:p=>{u(p),f.setValue("targetType",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择部署服务类型"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsx(Wi,{children:"部署服务类型"}),rU.map(p=>{var h,w;return l.jsx(pn,{value:p,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=Mm.get(p))==null?void 0:h[1]}),l.jsx("div",{children:(w=Mm.get(p))==null?void 0:w[0]})]})},p)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"targetAccess",render:({field:_})=>l.jsxs(Ce,{hidden:i!="base",children:[l.jsxs(je,{className:"w-full flex justify-between",children:[l.jsx("div",{children:"部署服务商授权配置"}),l.jsx(jl,{trigger:l.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[l.jsx(zu,{size:14}),"新增"]}),op:"add"})]}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,onValueChange:p=>{f.setValue("targetAccess",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择授权配置"})}),l.jsx(Gs,{children:l.jsxs(cl,{children:[l.jsxs(Wi,{children:["服务商授权配置",f.getValues().targetAccess]}),l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:"flex items-center space-x-2",children:"--"})}),m.map(p=>{var h;return l.jsx(pn,{value:p.id,children:l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("img",{className:"w-6",src:(h=uo.get(p.configType))==null?void 0:h[1]}),l.jsx("div",{children:p.name})]})},p.id)})]})})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"group",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance"||c!="ssh",children:[l.jsx(je,{className:"w-full flex justify-between",children:l.jsx("div",{children:"部署配置组(用于将一个域名证书部署到多个 ssh 主机)"})}),l.jsx(Ee,{children:l.jsxs(Mo,{..._,value:_.value,defaultValue:"emptyId",onValueChange:p=>{f.setValue("group",p)},children:[l.jsx(Ks,{children:l.jsx(Io,{placeholder:"请选择分组"})}),l.jsxs(Gs,{children:[l.jsx(pn,{value:"emptyId",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:"--"})}),r.filter(p=>{var h;return p.expand&&((h=p.expand)==null?void 0:h.access.length)>0}).map(p=>l.jsx(pn,{value:p.id?p.id:"",children:l.jsx("div",{className:ae("flex items-center space-x-2 rounded cursor-pointer"),children:p.name})},p.id))]})]})}),l.jsx(Se,{})]})}),l.jsx(Ne,{control:f.control,name:"variables",render:({field:_})=>l.jsxs(Ce,{hidden:i!="advance",children:[l.jsx(je,{children:"变量"}),l.jsx(Ee,{children:l.jsx(mc,{placeholder:`可在SSH部署中使用,形如: -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:"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/dist/index.html b/ui/dist/index.html index b7ae27d5..fc176b7e 100644 --- a/ui/dist/index.html +++ b/ui/dist/index.html @@ -5,8 +5,8 @@ Certimate - Your Trusted SSL Automation Partner - - + +