diff --git a/ui/dist/assets/index-BaOyaxPQ.js b/ui/dist/assets/index-BvAG2YSh.js similarity index 95% rename from ui/dist/assets/index-BaOyaxPQ.js rename to ui/dist/assets/index-BvAG2YSh.js index c8a6f57c..14cdc5d6 100644 --- a/ui/dist/assets/index-BaOyaxPQ.js +++ b/ui/dist/assets/index-BvAG2YSh.js @@ -225,4 +225,4 @@ You can add a description to the \`${Di}\` by passing a \`${gC}\` component as a 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 \`${Di}\`. 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 h.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},oU=cC,sU=uC,iU=dC,SC=fC,_C=hC,bC=yC,CC=wC,kC=mC,EC=vC;const aU=oU,lU=sU,cU=iU,TC=h.forwardRef(({className:e,...t},n)=>c.jsx(SC,{className:se("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:n}));TC.displayName=SC.displayName;const RC=h.forwardRef(({className:e,...t},n)=>c.jsxs(cU,{children:[c.jsx(TC,{}),c.jsx(_C,{ref:n,className:se("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})]}));RC.displayName=_C.displayName;const NC=({className:e,...t})=>c.jsx("div",{className:se("flex flex-col space-y-2 text-center sm:text-left",e),...t});NC.displayName="AlertDialogHeader";const PC=({className:e,...t})=>c.jsx("div",{className:se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});PC.displayName="AlertDialogFooter";const jC=h.forwardRef(({className:e,...t},n)=>c.jsx(kC,{ref:n,className:se("text-lg font-semibold",e),...t}));jC.displayName=kC.displayName;const DC=h.forwardRef(({className:e,...t},n)=>c.jsx(EC,{ref:n,className:se("text-sm text-muted-foreground",e),...t}));DC.displayName=EC.displayName;const MC=h.forwardRef(({className:e,...t},n)=>c.jsx(bC,{ref:n,className:se(tg(),e),...t}));MC.displayName=bC.displayName;const OC=h.forwardRef(({className:e,...t},n)=>c.jsx(CC,{ref:n,className:se(tg({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));OC.displayName=CC.displayName;function ov(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var sv="Switch",[uU,a3]=_n(sv),[dU,fU]=uU(sv),AC=h.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:s,required:i,disabled:a,value:l="on",onCheckedChange:u,...d}=e,[f,p]=h.useState(null),x=be(t,m=>p(m)),g=h.useRef(!1),y=f?!!f.closest("form"):!0,[S=!1,v]=so({prop:o,defaultProp:s,onChange:u});return c.jsxs(dU,{scope:n,checked:S,disabled:a,children:[c.jsx(ve.button,{type:"button",role:"switch","aria-checked":S,"aria-required":i,"data-state":FC(S),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:x,onClick:G(e.onClick,m=>{v(w=>!w),y&&(g.current=m.isPropagationStopped(),g.current||m.stopPropagation())})}),y&&c.jsx(hU,{control:f,bubbles:!g.current,name:r,value:l,checked:S,required:i,disabled:a,style:{transform:"translateX(-100%)"}})]})});AC.displayName=sv;var IC="SwitchThumb",LC=h.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=fU(IC,n);return c.jsx(ve.span,{"data-state":FC(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});LC.displayName=IC;var hU=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,s=h.useRef(null),i=ov(n),a=ug(t);return h.useEffect(()=>{const l=s.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(i!==n&&f){const p=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(p)}},[i,n,r]),c.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:s,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function FC(e){return e?"checked":"unchecked"}var UC=AC,pU=LC;const $C=h.forwardRef(({className:e,...t},n)=>c.jsx(UC,{className:se("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:n,children:c.jsx(pU,{className:se("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")})}));$C.displayName=UC.displayName;var mU="VisuallyHidden",oc=h.forwardRef((e,t)=>c.jsx(ve.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}}));oc.displayName=mU;var gU=oc,iv="ToastProvider",[av,vU,yU]=Ld("Toast"),[VC,l3]=_n("Toast",[yU]),[xU,sf]=VC(iv),zC=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:s=50,children:i}=e,[a,l]=h.useState(null),[u,d]=h.useState(0),f=h.useRef(!1),p=h.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${iv}\`. Expected non-empty \`string\`.`),c.jsx(av.Provider,{scope:t,children:c.jsx(xU,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:s,toastCount:u,viewport:a,onViewportChange:l,onToastAdd:h.useCallback(()=>d(x=>x+1),[]),onToastRemove:h.useCallback(()=>d(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:p,children:i})})};zC.displayName=iv;var WC="ToastViewport",wU=["F8"],Mp="toast.viewportPause",Op="toast.viewportResume",YC=h.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=wU,label:o="Notifications ({hotkey})",...s}=e,i=sf(WC,n),a=vU(n),l=h.useRef(null),u=h.useRef(null),d=h.useRef(null),f=h.useRef(null),p=be(t,f,i.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),g=i.toastCount>0;h.useEffect(()=>{const S=v=>{var w;r.every(b=>v[b]||v.code===b)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[r]),h.useEffect(()=>{const S=l.current,v=f.current;if(g&&S&&v){const m=()=>{if(!i.isClosePausedRef.current){const _=new CustomEvent(Mp);v.dispatchEvent(_),i.isClosePausedRef.current=!0}},w=()=>{if(i.isClosePausedRef.current){const _=new CustomEvent(Op);v.dispatchEvent(_),i.isClosePausedRef.current=!1}},b=_=>{!S.contains(_.relatedTarget)&&w()},C=()=>{S.contains(document.activeElement)||w()};return S.addEventListener("focusin",m),S.addEventListener("focusout",b),S.addEventListener("pointermove",m),S.addEventListener("pointerleave",C),window.addEventListener("blur",m),window.addEventListener("focus",w),()=>{S.removeEventListener("focusin",m),S.removeEventListener("focusout",b),S.removeEventListener("pointermove",m),S.removeEventListener("pointerleave",C),window.removeEventListener("blur",m),window.removeEventListener("focus",w)}}},[g,i.isClosePausedRef]);const y=h.useCallback(({tabbingDirection:S})=>{const m=a().map(w=>{const b=w.ref.current,C=[b,...MU(b)];return S==="forwards"?C:C.reverse()});return(S==="forwards"?m.reverse():m).flat()},[a]);return h.useEffect(()=>{const S=f.current;if(S){const v=m=>{var C,_,R;const w=m.altKey||m.ctrlKey||m.metaKey;if(m.key==="Tab"&&!w){const N=document.activeElement,D=m.shiftKey;if(m.target===S&&D){(C=u.current)==null||C.focus();return}const A=y({tabbingDirection:D?"backwards":"forwards"}),H=A.findIndex(L=>L===N);ph(A.slice(H+1))?m.preventDefault():D?(_=u.current)==null||_.focus():(R=d.current)==null||R.focus()}};return S.addEventListener("keydown",v),()=>S.removeEventListener("keydown",v)}},[a,y]),c.jsxs(LD,{ref:l,role:"region","aria-label":o.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:g?void 0:"none"},children:[g&&c.jsx(Ap,{ref:u,onFocusFromOutsideViewport:()=>{const S=y({tabbingDirection:"forwards"});ph(S)}}),c.jsx(av.Slot,{scope:n,children:c.jsx(ve.ol,{tabIndex:-1,...s,ref:p})}),g&&c.jsx(Ap,{ref:d,onFocusFromOutsideViewport:()=>{const S=y({tabbingDirection:"backwards"});ph(S)}})]})});YC.displayName=WC;var HC="ToastFocusProxy",Ap=h.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,s=sf(HC,n);return c.jsx(oc,{"aria-hidden":!0,tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const a=i.relatedTarget;!((u=s.viewport)!=null&&u.contains(a))&&r()}})});Ap.displayName=HC;var af="Toast",SU="toast.swipeStart",_U="toast.swipeMove",bU="toast.swipeCancel",CU="toast.swipeEnd",BC=h.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:s,...i}=e,[a=!0,l]=so({prop:r,defaultProp:o,onChange:s});return c.jsx(fn,{present:n||a,children:c.jsx(TU,{open:a,...i,ref:t,onClose:()=>l(!1),onPause:_t(e.onPause),onResume:_t(e.onResume),onSwipeStart:G(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:G(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:G(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:G(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`),l(!1)})})})});BC.displayName=af;var[kU,EU]=VC(af,{onClose(){}}),TU=h.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:s,onClose:i,onEscapeKeyDown:a,onPause:l,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:p,onSwipeEnd:x,...g}=e,y=sf(af,n),[S,v]=h.useState(null),m=be(t,L=>v(L)),w=h.useRef(null),b=h.useRef(null),C=o||y.duration,_=h.useRef(0),R=h.useRef(C),N=h.useRef(0),{onToastAdd:D,onToastRemove:O}=y,B=_t(()=>{var K;(S==null?void 0:S.contains(document.activeElement))&&((K=y.viewport)==null||K.focus()),i()}),A=h.useCallback(L=>{!L||L===1/0||(window.clearTimeout(N.current),_.current=new Date().getTime(),N.current=window.setTimeout(B,L))},[B]);h.useEffect(()=>{const L=y.viewport;if(L){const K=()=>{A(R.current),u==null||u()},ne=()=>{const W=new Date().getTime()-_.current;R.current=R.current-W,window.clearTimeout(N.current),l==null||l()};return L.addEventListener(Mp,ne),L.addEventListener(Op,K),()=>{L.removeEventListener(Mp,ne),L.removeEventListener(Op,K)}}},[y.viewport,C,l,u,A]),h.useEffect(()=>{s&&!y.isClosePausedRef.current&&A(C)},[s,C,y.isClosePausedRef,A]),h.useEffect(()=>(D(),()=>O()),[D,O]);const H=h.useMemo(()=>S?JC(S):null,[S]);return y.viewport?c.jsxs(c.Fragment,{children:[H&&c.jsx(RU,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:H}),c.jsx(kU,{scope:n,onClose:B,children:fo.createPortal(c.jsx(av.ItemSlot,{scope:n,children:c.jsx(ID,{asChild:!0,onEscapeKeyDown:G(a,()=>{y.isFocusedToastEscapeKeyDownRef.current||B(),y.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(ve.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":y.swipeDirection,...g,ref:m,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:G(e.onKeyDown,L=>{L.key==="Escape"&&(a==null||a(L.nativeEvent),L.nativeEvent.defaultPrevented||(y.isFocusedToastEscapeKeyDownRef.current=!0,B()))}),onPointerDown:G(e.onPointerDown,L=>{L.button===0&&(w.current={x:L.clientX,y:L.clientY})}),onPointerMove:G(e.onPointerMove,L=>{if(!w.current)return;const K=L.clientX-w.current.x,ne=L.clientY-w.current.y,W=!!b.current,F=["left","right"].includes(y.swipeDirection),M=["left","up"].includes(y.swipeDirection)?Math.min:Math.max,X=F?M(0,K):0,le=F?0:M(0,ne),me=L.pointerType==="touch"?10:2,rt={x:X,y:le},je={originalEvent:L,delta:rt};W?(b.current=rt,Bc(_U,f,je,{discrete:!1})):qx(rt,y.swipeDirection,me)?(b.current=rt,Bc(SU,d,je,{discrete:!1}),L.target.setPointerCapture(L.pointerId)):(Math.abs(K)>me||Math.abs(ne)>me)&&(w.current=null)}),onPointerUp:G(e.onPointerUp,L=>{const K=b.current,ne=L.target;if(ne.hasPointerCapture(L.pointerId)&&ne.releasePointerCapture(L.pointerId),b.current=null,w.current=null,K){const W=L.currentTarget,F={originalEvent:L,delta:K};qx(K,y.swipeDirection,y.swipeThreshold)?Bc(CU,x,F,{discrete:!0}):Bc(bU,p,F,{discrete:!0}),W.addEventListener("click",M=>M.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null}),RU=e=>{const{__scopeToast:t,children:n,...r}=e,o=sf(af,t),[s,i]=h.useState(!1),[a,l]=h.useState(!1);return jU(()=>i(!0)),h.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:c.jsx(Bl,{asChild:!0,children:c.jsx(oc,{...r,children:s&&c.jsxs(c.Fragment,{children:[o.label," ",n]})})})},NU="ToastTitle",GC=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(ve.div,{...r,ref:t})});GC.displayName=NU;var PU="ToastDescription",KC=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(ve.div,{...r,ref:t})});KC.displayName=PU;var ZC="ToastAction",qC=h.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(QC,{altText:n,asChild:!0,children:c.jsx(lv,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${ZC}\`. Expected non-empty \`string\`.`),null)});qC.displayName=ZC;var XC="ToastClose",lv=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=EU(XC,n);return c.jsx(QC,{asChild:!0,children:c.jsx(ve.button,{type:"button",...r,ref:t,onClick:G(e.onClick,o.onClose)})})});lv.displayName=XC;var QC=h.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return c.jsx(ve.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function JC(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),DU(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!o)if(s){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...JC(r))}}),t}function Bc(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ng(o,s):o.dispatchEvent(s)}var qx=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),s=r>o;return t==="left"||t==="right"?s&&r>n:!s&&o>n};function jU(e=()=>{}){const t=_t(e);Kt(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function DU(e){return e.nodeType===e.ELEMENT_NODE}function MU(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ph(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var OU=zC,ek=YC,tk=BC,nk=GC,rk=KC,ok=qC,sk=lv;const AU=OU,ik=h.forwardRef(({className:e,...t},n)=>c.jsx(ek,{ref:n,className:se("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}));ik.displayName=ek.displayName;const IU=Wl("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"}}),ak=h.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(tk,{ref:r,className:se(IU({variant:t}),e),...n}));ak.displayName=tk.displayName;const LU=h.forwardRef(({className:e,...t},n)=>c.jsx(ok,{ref:n,className:se("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}));LU.displayName=ok.displayName;const lk=h.forwardRef(({className:e,...t},n)=>c.jsx(sk,{ref:n,className:se("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:c.jsx(Qm,{className:"h-4 w-4"})}));lk.displayName=sk.displayName;const ck=h.forwardRef(({className:e,...t},n)=>c.jsx(nk,{ref:n,className:se("text-sm font-semibold",e),...t}));ck.displayName=nk.displayName;const uk=h.forwardRef(({className:e,...t},n)=>c.jsx(rk,{ref:n,className:se("text-sm opacity-90",e),...t}));uk.displayName=rk.displayName;const FU=1,UU=1e6;let mh=0;function $U(){return mh=(mh+1)%Number.MAX_SAFE_INTEGER,mh.toString()}const gh=new Map,Xx=e=>{if(gh.has(e))return;const t=setTimeout(()=>{gh.delete(e),Ya({type:"REMOVE_TOAST",toastId:e})},UU);gh.set(e,t)},VU=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,FU)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?Xx(n):e.toasts.forEach(r=>{Xx(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},hu=[];let pu={toasts:[]};function Ya(e){pu=VU(pu,e),hu.forEach(t=>{t(pu)})}function zU({...e}){const t=$U(),n=o=>Ya({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>Ya({type:"DISMISS_TOAST",toastId:t});return Ya({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}function cv(){const[e,t]=h.useState(pu);return h.useEffect(()=>(hu.push(t),()=>{const n=hu.indexOf(t);n>-1&&hu.splice(n,1)}),[e]),{...e,toast:zU,dismiss:n=>Ya({type:"DISMISS_TOAST",toastId:n})}}function dk(){const{toasts:e}=cv();return c.jsxs(AU,{children:[e.map(function({id:t,title:n,description:r,action:o,...s}){return c.jsxs(ak,{...s,children:[c.jsxs("div",{className:"grid gap-1",children:[n&&c.jsx(ck,{children:n}),r&&c.jsx(uk,{children:r})]}),o,c.jsx(lk,{})]},t)}),c.jsx(ik,{})]})}var[lf,c3]=_n("Tooltip",[na]),cf=na(),fk="TooltipProvider",WU=700,Ip="tooltip.open",[YU,uv]=lf(fk),hk=e=>{const{__scopeTooltip:t,delayDuration:n=WU,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,[i,a]=h.useState(!0),l=h.useRef(!1),u=h.useRef(0);return h.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),c.jsx(YU,{scope:t,isOpenDelayed:i,delayDuration:n,onOpen:h.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:h.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:h.useCallback(d=>{l.current=d},[]),disableHoverableContent:o,children:s})};hk.displayName=fk;var uf="Tooltip",[HU,df]=lf(uf),pk=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:s,disableHoverableContent:i,delayDuration:a}=e,l=uv(uf,e.__scopeTooltip),u=cf(t),[d,f]=h.useState(null),p=Tr(),x=h.useRef(0),g=i??l.disableHoverableContent,y=a??l.delayDuration,S=h.useRef(!1),[v=!1,m]=so({prop:r,defaultProp:o,onChange:R=>{R?(l.onOpen(),document.dispatchEvent(new CustomEvent(Ip))):l.onClose(),s==null||s(R)}}),w=h.useMemo(()=>v?S.current?"delayed-open":"instant-open":"closed",[v]),b=h.useCallback(()=>{window.clearTimeout(x.current),S.current=!1,m(!0)},[m]),C=h.useCallback(()=>{window.clearTimeout(x.current),m(!1)},[m]),_=h.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{S.current=!0,m(!0)},y)},[y,m]);return h.useEffect(()=>()=>window.clearTimeout(x.current),[]),c.jsx(hg,{...u,children:c.jsx(HU,{scope:t,contentId:p,open:v,stateAttribute:w,trigger:d,onTriggerChange:f,onTriggerEnter:h.useCallback(()=>{l.isOpenDelayed?_():b()},[l.isOpenDelayed,_,b]),onTriggerLeave:h.useCallback(()=>{g?C():window.clearTimeout(x.current)},[C,g]),onOpen:b,onClose:C,disableHoverableContent:g,children:n})})};pk.displayName=uf;var Lp="TooltipTrigger",mk=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=df(Lp,n),s=uv(Lp,n),i=cf(n),a=h.useRef(null),l=be(t,a,o.onTriggerChange),u=h.useRef(!1),d=h.useRef(!1),f=h.useCallback(()=>u.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),c.jsx(pg,{asChild:!0,...i,children:c.jsx(ve.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:G(e.onPointerMove,p=>{p.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:G(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:G(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:G(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:G(e.onBlur,o.onClose),onClick:G(e.onClick,o.onClose)})})});mk.displayName=Lp;var BU="TooltipPortal",[u3,GU]=lf(BU,{forceMount:void 0}),zi="TooltipContent",dv=h.forwardRef((e,t)=>{const n=GU(zi,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=df(zi,e.__scopeTooltip);return c.jsx(fn,{present:r||i.open,children:i.disableHoverableContent?c.jsx(gk,{side:o,...s,ref:t}):c.jsx(KU,{side:o,...s,ref:t})})}),KU=h.forwardRef((e,t)=>{const n=df(zi,e.__scopeTooltip),r=uv(zi,e.__scopeTooltip),o=h.useRef(null),s=be(t,o),[i,a]=h.useState(null),{trigger:l,onClose:u}=n,d=o.current,{onPointerInTransitChange:f}=r,p=h.useCallback(()=>{a(null),f(!1)},[f]),x=h.useCallback((g,y)=>{const S=g.currentTarget,v={x:g.clientX,y:g.clientY},m=QU(v,S.getBoundingClientRect()),w=JU(v,m),b=e$(y.getBoundingClientRect()),C=n$([...w,...b]);a(C),f(!0)},[f]);return h.useEffect(()=>()=>p(),[p]),h.useEffect(()=>{if(l&&d){const g=S=>x(S,d),y=S=>x(S,l);return l.addEventListener("pointerleave",g),d.addEventListener("pointerleave",y),()=>{l.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",y)}}},[l,d,x,p]),h.useEffect(()=>{if(i){const g=y=>{const S=y.target,v={x:y.clientX,y:y.clientY},m=(l==null?void 0:l.contains(S))||(d==null?void 0:d.contains(S)),w=!t$(v,i);m?p():w&&(p(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[l,d,i,u,p]),c.jsx(gk,{...e,ref:s})}),[ZU,qU]=lf(uf,{isInside:!1}),gk=h.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,l=df(zi,n),u=cf(n),{onClose:d}=l;return h.useEffect(()=>(document.addEventListener(Ip,d),()=>document.removeEventListener(Ip,d)),[d]),h.useEffect(()=>{if(l.trigger){const f=p=>{const x=p.target;x!=null&&x.contains(l.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,d]),c.jsx(Ji,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:c.jsxs(mg,{"data-state":l.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:[c.jsx(Jm,{children:r}),c.jsx(ZU,{scope:n,isInside:!0,children:c.jsx(gU,{id:l.contentId,role:"tooltip",children:o||r})})]})})});dv.displayName=zi;var vk="TooltipArrow",XU=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=cf(n);return qU(vk,n).isInside?null:c.jsx(gg,{...o,...r,ref:t})});XU.displayName=vk;function QU(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function JU(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function e$(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function t$(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;sr!=d>r&&n<(u-a)*(r-l)/(d-l)+a&&(o=!o)}return o}function n$(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),r$(t)}function r$(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var o$=pk,s$=mk,yk=dv;const i$=o$,a$=s$,l$=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>c.jsx(yk,{ref:r,sideOffset:t,className:se("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),...n}));l$.displayName=yk.displayName;const _l=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)},c$=e=>_l(e).split(" ")[0],u$=async()=>Vt().collection("domains").getFullList({sort:"-created",expand:"lastDeployment"}),d$=async e=>await Vt().collection("domains").getOne(e),Fp=async e=>e.id?await Vt().collection("domains").update(e.id,e):await Vt().collection("domains").create(e),f$=async e=>await Vt().collection("domains").delete(e),h$=(e,t)=>Vt().collection("domains").subscribe(e,n=>{n.action==="update"&&t(n.record)},{expand:"lastDeployment"}),p$=e=>{Vt().collection("domains").unsubscribe(e)},m$=()=>{const e=cv(),t=as(),n=()=>{t("/edit")},r=d=>{t(`/edit?id=${d}`)},o=d=>{t(`/history?domain=${d}`)},s=async d=>{try{await f$(d),a(i.filter(f=>f.id!==d))}catch(f){console.error("Error deleting domain:",f)}},[i,a]=h.useState([]);h.useEffect(()=>{(async()=>{const f=await u$();a(f)})()},[]);const l=async d=>{const f=i.filter(y=>y.id===d),p=f[0].enabled,x=f[0];x.enabled=!p,await Fp(x);const g=i.map(y=>y.id===d?{...y,checked:!p}:y);a(g)},u=async d=>{try{p$(d.id),h$(d.id,f=>{console.log(f);const p=i.map(x=>x.id===f.id?{...f}:x);a(p)}),d.rightnow=!0,await Fp(d),e.toast({title:"操作成功",description:"已发起部署,请稍后查看部署日志。"})}catch{e.toast({title:"执行失败",description:c.jsxs(c.Fragment,{children:["执行失败,请查看",c.jsx($r,{to:`/history?domain=${d.id}`,className:"underline text-blue-500",children:"部署日志"}),"查看详情。"]}),variant:"destructive"})}};return c.jsx(c.Fragment,{children:c.jsxs("div",{className:"",children:[c.jsx(dk,{}),c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("div",{className:"text-muted-foreground",children:"域名列表"}),c.jsx(Dt,{onClick:n,children:"新增域名"})]}),i.length?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b sm:p-2 mt-5",children:[c.jsx("div",{className:"w-40",children:"域名"}),c.jsx("div",{className:"w-48",children:"有效期限"}),c.jsx("div",{className:"w-32",children:"最近执行状态"}),c.jsx("div",{className:"w-64",children:"最近执行阶段"}),c.jsx("div",{className:"w-40 sm:ml-2",children:"最近执行时间"}),c.jsx("div",{className:"w-32",children:"是否启用"}),c.jsx("div",{className:"grow",children:"操作"})]}),c.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"域名"}),i.map(d=>{var f,p,x,g,y,S;return c.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b sm:p-2 hover:bg-muted/50 text-sm",children:[c.jsx("div",{className:"sm:w-40 w-full pt-1 sm:pt-0 flex items-center",children:d.domain}),c.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:c.jsx("div",{children:d.expiredAt?c.jsxs(c.Fragment,{children:[c.jsx("div",{children:"有效期90天"}),c.jsxs("div",{children:[c$(d.expiredAt),"到期"]})]}):"---"})}),c.jsx("div",{className:"sm:w-32 w-full pt-1 sm:pt-0 flex items-center",children:d.lastDeployedAt&&((f=d.expand)!=null&&f.lastDeployment)?c.jsx(c.Fragment,{children:((p=d.expand.lastDeployment)==null?void 0:p.phase)==="deploy"&&((x=d.expand.lastDeployment)!=null&&x.phaseSuccess)?c.jsx(qS,{size:16,className:"text-green-700"}):c.jsx(XS,{size:16,className:"text-red-700"})}):"---"}),c.jsx("div",{className:"sm:w-64 w-full pt-1 sm:pt-0 flex items-center",children:d.lastDeployedAt&&((g=d.expand)!=null&&g.lastDeployment)?c.jsx(aC,{phase:(y=d.expand.lastDeployment)==null?void 0:y.phase,phaseSuccess:(S=d.expand.lastDeployment)==null?void 0:S.phaseSuccess}):"---"}),c.jsx("div",{className:"sm:w-40 pt-1 sm:pt-0 sm:ml-2 flex items-center",children:d.lastDeployedAt?_l(d.lastDeployedAt):"---"}),c.jsx("div",{className:"sm:w-32 flex items-center",children:c.jsx(hk,{children:c.jsxs(i$,{children:[c.jsx(a$,{children:c.jsx($C,{checked:d.enabled,onCheckedChange:()=>{l(d.id)}})}),c.jsx(dv,{children:c.jsx("div",{className:"border rounded-sm px-3 bg-background text-muted-foreground text-xs",children:d.enabled?"禁用":"启用"})})]})})}),c.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[c.jsx(Dt,{variant:"link",className:"p-0",onClick:()=>o(d.id),children:"部署历史"}),c.jsxs(Z4,{when:!!d.enabled,children:[c.jsx(Ht,{orientation:"vertical",className:"h-4 mx-2"}),c.jsx(Dt,{variant:"link",className:"p-0",onClick:()=>u(d),children:"立即部署"})]}),!d.enabled&&c.jsxs(c.Fragment,{children:[c.jsx(Ht,{orientation:"vertical",className:"h-4 mx-2"}),c.jsxs(aU,{children:[c.jsx(lU,{asChild:!0,children:c.jsx(Dt,{variant:"link",className:"p-0",children:"删除"})}),c.jsxs(RC,{children:[c.jsxs(NC,{children:[c.jsx(jC,{children:"删除域名"}),c.jsx(DC,{children:"确定要删除域名吗?"})]}),c.jsxs(PC,{children:[c.jsx(OC,{children:"取消"}),c.jsx(MC,{onClick:()=>{s(d.id)},children:"确认"})]})]})]}),c.jsx(Ht,{orientation:"vertical",className:"h-4 mx-2"}),c.jsx(Dt,{variant:"link",className:"p-0",onClick:()=>r(d.id),children:"编辑"})]})]})]},d.id)})]}):c.jsx(c.Fragment,{children:c.jsxs("div",{className:"flex flex-col items-center mt-10",children:[c.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:c.jsx(vp,{size:40,className:"text-primary"})}),c.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),c.jsx(Dt,{onClick:n,className:"mt-3",children:"添加域名"})]})})]})})},ct=h.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{type:t,className:se("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:r,...n}));ct.displayName="Input";var sc=e=>e.type==="checkbox",yi=e=>e instanceof Date,an=e=>e==null;const xk=e=>typeof e=="object";var Ft=e=>!an(e)&&!Array.isArray(e)&&xk(e)&&!yi(e),wk=e=>Ft(e)&&e.target?sc(e.target)?e.target.checked:e.target.value:e,g$=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Sk=(e,t)=>e.has(g$(t)),v$=e=>{const t=e.constructor&&e.constructor.prototype;return Ft(t)&&t.hasOwnProperty("isPrototypeOf")},fv=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function gn(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(fv&&(e instanceof Blob||e instanceof FileList))&&(n||Ft(e)))if(t=n?[]:{},!n&&!v$(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=gn(e[r]));else return e;return t}var ff=e=>Array.isArray(e)?e.filter(Boolean):[],Tt=e=>e===void 0,Z=(e,t,n)=>{if(!t||!Ft(e))return n;const r=ff(t.split(/[,[\].]+?/)).reduce((o,s)=>an(o)?o:o[s],e);return Tt(r)||r===e?Tt(e[t])?n:e[t]:r},_r=e=>typeof e=="boolean",hv=e=>/^\w*$/.test(e),_k=e=>ff(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Ke=(e,t,n)=>{let r=-1;const o=hv(t)?[t]:_k(t),s=o.length,i=s-1;for(;++rOe.useContext(bk),y$=e=>{const{children:t,...n}=e;return Oe.createElement(bk.Provider,{value:n},t)};var Ck=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return t._proxyFormState[i]!==nr.all&&(t._proxyFormState[i]=!r||nr.all),n&&(n[i]=!0),e[i]}});return o},kn=e=>Ft(e)&&!Object.keys(e).length,kk=(e,t,n,r)=>{n(e);const{name:o,...s}=e;return kn(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===(!r||nr.all))},Ha=e=>Array.isArray(e)?e:[e],Ek=(e,t,n)=>!e||!t||e===t||Ha(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function pv(e){const t=Oe.useRef(e);t.current=e,Oe.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function x$(e){const t=hf(),{control:n=t.control,disabled:r,name:o,exact:s}=e||{},[i,a]=Oe.useState(n._formState),l=Oe.useRef(!0),u=Oe.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=Oe.useRef(o);return d.current=o,pv({disabled:r,next:f=>l.current&&Ek(d.current,f.name,s)&&kk(f,u.current,n._updateFormState)&&a({...n._formState,...f}),subject:n._subjects.state}),Oe.useEffect(()=>(l.current=!0,u.current.isValid&&n._updateValid(!0),()=>{l.current=!1}),[n]),Ck(i,n,u.current,!1)}var Cr=e=>typeof e=="string",Tk=(e,t,n,r,o)=>Cr(e)?(r&&t.watch.add(e),Z(n,e,o)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),Z(n,s))):(r&&(t.watchAll=!0),n);function w$(e){const t=hf(),{control:n=t.control,name:r,defaultValue:o,disabled:s,exact:i}=e||{},a=Oe.useRef(r);a.current=r,pv({disabled:s,subject:n._subjects.values,next:d=>{Ek(a.current,d.name,i)&&u(gn(Tk(a.current,n._names,d.values||n._formValues,!1,o)))}});const[l,u]=Oe.useState(n._getWatch(r,o));return Oe.useEffect(()=>n._removeUnmounted()),l}function S$(e){const t=hf(),{name:n,disabled:r,control:o=t.control,shouldUnregister:s}=e,i=Sk(o._names.array,n),a=w$({control:o,name:n,defaultValue:Z(o._formValues,n,Z(o._defaultValues,n,e.defaultValue)),exact:!0}),l=x$({control:o,name:n}),u=Oe.useRef(o.register(n,{...e.rules,value:a,..._r(e.disabled)?{disabled:e.disabled}:{}}));return Oe.useEffect(()=>{const d=o._options.shouldUnregister||s,f=(p,x)=>{const g=Z(o._fields,p);g&&g._f&&(g._f.mount=x)};if(f(n,!0),d){const p=gn(Z(o._options.defaultValues,n));Ke(o._defaultValues,n,p),Tt(Z(o._formValues,n))&&Ke(o._formValues,n,p)}return()=>{(i?d&&!o._state.action:d)?o.unregister(n):f(n,!1)}},[n,o,i,s]),Oe.useEffect(()=>{Z(o._fields,n)&&o._updateDisabledField({disabled:r,fields:o._fields,name:n,value:Z(o._fields,n)._f.value})},[r,n,o]),{field:{name:n,value:a,..._r(r)||l.disabled?{disabled:l.disabled||r}:{},onChange:Oe.useCallback(d=>u.current.onChange({target:{value:wk(d),name:n},type:td.CHANGE}),[n]),onBlur:Oe.useCallback(()=>u.current.onBlur({target:{value:Z(o._formValues,n),name:n},type:td.BLUR}),[n,o]),ref:d=>{const f=Z(o._fields,n);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:p=>d.setCustomValidity(p),reportValidity:()=>d.reportValidity()})}},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Z(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!Z(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Z(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Z(l.validatingFields,n)},error:{enumerable:!0,get:()=>Z(l.errors,n)}})}}const _$=e=>e.render(S$(e));var Rk=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},Qx=e=>({isOnSubmit:!e||e===nr.onSubmit,isOnBlur:e===nr.onBlur,isOnChange:e===nr.onChange,isOnAll:e===nr.all,isOnTouch:e===nr.onTouched}),Jx=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Ba=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const s=Z(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!r)break;if(i.ref&&t(i.ref,i.name)&&!r)break;Ba(a,t)}else Ft(a)&&Ba(a,t)}}};var b$=(e,t,n)=>{const r=Ha(Z(e,n));return Ke(r,"root",t[n]),Ke(e,n,r),e},mv=e=>e.type==="file",Lo=e=>typeof e=="function",nd=e=>{if(!fv)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},mu=e=>Cr(e),gv=e=>e.type==="radio",rd=e=>e instanceof RegExp;const ew={value:!1,isValid:!1},tw={value:!0,isValid:!0};var Nk=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Tt(e[0].attributes.value)?Tt(e[0].value)||e[0].value===""?tw:{value:e[0].value,isValid:!0}:tw:ew}return ew};const nw={isValid:!1,value:null};var Pk=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,nw):nw;function rw(e,t,n="validate"){if(mu(e)||Array.isArray(e)&&e.every(mu)||_r(e)&&!e)return{type:n,message:mu(e)?e:"",ref:t}}var ti=e=>Ft(e)&&!rd(e)?e:{value:e,message:""},ow=async(e,t,n,r,o)=>{const{ref:s,refs:i,required:a,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:x,name:g,valueAsNumber:y,mount:S,disabled:v}=e._f,m=Z(t,g);if(!S||v)return{};const w=i?i[0]:s,b=A=>{r&&w.reportValidity&&(w.setCustomValidity(_r(A)?"":A||""),w.reportValidity())},C={},_=gv(s),R=sc(s),N=_||R,D=(y||mv(s))&&Tt(s.value)&&Tt(m)||nd(s)&&s.value===""||m===""||Array.isArray(m)&&!m.length,O=Rk.bind(null,g,n,C),B=(A,H,L,K=Ur.maxLength,ne=Ur.minLength)=>{const W=A?H:L;C[g]={type:A?K:ne,message:W,ref:s,...O(A?K:ne,W)}};if(o?!Array.isArray(m)||!m.length:a&&(!N&&(D||an(m))||_r(m)&&!m||R&&!Nk(i).isValid||_&&!Pk(i).isValid)){const{value:A,message:H}=mu(a)?{value:!!a,message:a}:ti(a);if(A&&(C[g]={type:Ur.required,message:H,ref:w,...O(Ur.required,H)},!n))return b(H),C}if(!D&&(!an(d)||!an(f))){let A,H;const L=ti(f),K=ti(d);if(!an(m)&&!isNaN(m)){const ne=s.valueAsNumber||m&&+m;an(L.value)||(A=ne>L.value),an(K.value)||(H=nenew Date(new Date().toDateString()+" "+X),F=s.type=="time",M=s.type=="week";Cr(L.value)&&m&&(A=F?W(m)>W(L.value):M?m>L.value:ne>new Date(L.value)),Cr(K.value)&&m&&(H=F?W(m)+A.value,K=!an(H.value)&&m.length<+H.value;if((L||K)&&(B(L,A.message,H.message),!n))return b(C[g].message),C}if(p&&!D&&Cr(m)){const{value:A,message:H}=ti(p);if(rd(A)&&!m.match(A)&&(C[g]={type:Ur.pattern,message:H,ref:s,...O(Ur.pattern,H)},!n))return b(H),C}if(x){if(Lo(x)){const A=await x(m,t),H=rw(A,w);if(H&&(C[g]={...H,...O(Ur.validate,H.message)},!n))return b(H.message),C}else if(Ft(x)){let A={};for(const H in x){if(!kn(A)&&!n)break;const L=rw(await x[H](m,t),w,H);L&&(A={...L,...O(H,L.message)},b(L.message),n&&(C[g]=A))}if(!kn(A)&&(C[g]={ref:w,...A},!n))return C}}return b(!0),C};function C$(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},od=e=>an(e)||!xk(e);function Ss(e,t){if(od(e)||od(t))return e===t;if(yi(e)&&yi(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const s=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const i=t[o];if(yi(s)&&yi(i)||Ft(s)&&Ft(i)||Array.isArray(s)&&Array.isArray(i)?!Ss(s,i):s!==i)return!1}}return!0}var jk=e=>e.type==="select-multiple",E$=e=>gv(e)||sc(e),yh=e=>nd(e)&&e.isConnected,Dk=e=>{for(const t in e)if(Lo(e[t]))return!0;return!1};function sd(e,t={}){const n=Array.isArray(e);if(Ft(e)||n)for(const r in e)Array.isArray(e[r])||Ft(e[r])&&!Dk(e[r])?(t[r]=Array.isArray(e[r])?[]:{},sd(e[r],t[r])):an(e[r])||(t[r]=!0);return t}function Mk(e,t,n){const r=Array.isArray(e);if(Ft(e)||r)for(const o in e)Array.isArray(e[o])||Ft(e[o])&&!Dk(e[o])?Tt(t)||od(n[o])?n[o]=Array.isArray(e[o])?sd(e[o],[]):{...sd(e[o])}:Mk(e[o],an(t)?{}:t[o],n[o]):n[o]=!Ss(e[o],t[o]);return n}var Gc=(e,t)=>Mk(e,t,sd(t)),Ok=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Tt(e)?e:t?e===""?NaN:e&&+e:n&&Cr(e)?new Date(e):r?r(e):e;function xh(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return mv(t)?t.files:gv(t)?Pk(e.refs).value:jk(t)?[...t.selectedOptions].map(({value:n})=>n):sc(t)?Nk(e.refs).value:Ok(Tt(t.value)?e.ref.value:t.value,e)}var T$=(e,t,n,r)=>{const o={};for(const s of e){const i=Z(t,s);i&&Ke(o,s,i._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},Ca=e=>Tt(e)?e:rd(e)?e.source:Ft(e)?rd(e.value)?e.value.source:e.value:e,R$=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function sw(e,t,n){const r=Z(e,n);if(r||hv(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const s=o.join("."),i=Z(t,s),a=Z(e,s);if(i&&!Array.isArray(i)&&n!==s)return{name:n};if(a&&a.type)return{name:s,error:a};o.pop()}return{name:n}}var N$=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,P$=(e,t)=>!ff(Z(e,t)).length&&Ot(e,t);const j$={mode:nr.onSubmit,reValidateMode:nr.onChange,shouldFocusError:!0};function D$(e={}){let t={...j$,...e},n={submitCount:0,isDirty:!1,isLoading:Lo(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=Ft(t.defaultValues)||Ft(t.values)?gn(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:gn(o),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},l,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:vh(),array:vh(),state:vh()},p=Qx(t.mode),x=Qx(t.reValidateMode),g=t.criteriaMode===nr.all,y=k=>P=>{clearTimeout(u),u=setTimeout(k,P)},S=async k=>{if(d.isValid||k){const P=t.resolver?kn((await N()).errors):await O(r,!0);P!==n.isValid&&f.state.next({isValid:P})}},v=(k,P)=>{(d.isValidating||d.validatingFields)&&((k||Array.from(a.mount)).forEach(I=>{I&&(P?Ke(n.validatingFields,I,P):Ot(n.validatingFields,I))}),f.state.next({validatingFields:n.validatingFields,isValidating:!kn(n.validatingFields)}))},m=(k,P=[],I,J,Q=!0,Y=!0)=>{if(J&&I){if(i.action=!0,Y&&Array.isArray(Z(r,k))){const ue=I(Z(r,k),J.argA,J.argB);Q&&Ke(r,k,ue)}if(Y&&Array.isArray(Z(n.errors,k))){const ue=I(Z(n.errors,k),J.argA,J.argB);Q&&Ke(n.errors,k,ue),P$(n.errors,k)}if(d.touchedFields&&Y&&Array.isArray(Z(n.touchedFields,k))){const ue=I(Z(n.touchedFields,k),J.argA,J.argB);Q&&Ke(n.touchedFields,k,ue)}d.dirtyFields&&(n.dirtyFields=Gc(o,s)),f.state.next({name:k,isDirty:A(k,P),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Ke(s,k,P)},w=(k,P)=>{Ke(n.errors,k,P),f.state.next({errors:n.errors})},b=k=>{n.errors=k,f.state.next({errors:n.errors,isValid:!1})},C=(k,P,I,J)=>{const Q=Z(r,k);if(Q){const Y=Z(s,k,Tt(I)?Z(o,k):I);Tt(Y)||J&&J.defaultChecked||P?Ke(s,k,P?Y:xh(Q._f)):K(k,Y),i.mount&&S()}},_=(k,P,I,J,Q)=>{let Y=!1,ue=!1;const Me={name:k},yt=!!(Z(r,k)&&Z(r,k)._f&&Z(r,k)._f.disabled);if(!I||J){d.isDirty&&(ue=n.isDirty,n.isDirty=Me.isDirty=A(),Y=ue!==Me.isDirty);const zt=yt||Ss(Z(o,k),P);ue=!!(!yt&&Z(n.dirtyFields,k)),zt||yt?Ot(n.dirtyFields,k):Ke(n.dirtyFields,k,!0),Me.dirtyFields=n.dirtyFields,Y=Y||d.dirtyFields&&ue!==!zt}if(I){const zt=Z(n.touchedFields,k);zt||(Ke(n.touchedFields,k,I),Me.touchedFields=n.touchedFields,Y=Y||d.touchedFields&&zt!==I)}return Y&&Q&&f.state.next(Me),Y?Me:{}},R=(k,P,I,J)=>{const Q=Z(n.errors,k),Y=d.isValid&&_r(P)&&n.isValid!==P;if(e.delayError&&I?(l=y(()=>w(k,I)),l(e.delayError)):(clearTimeout(u),l=null,I?Ke(n.errors,k,I):Ot(n.errors,k)),(I?!Ss(Q,I):Q)||!kn(J)||Y){const ue={...J,...Y&&_r(P)?{isValid:P}:{},errors:n.errors,name:k};n={...n,...ue},f.state.next(ue)}},N=async k=>{v(k,!0);const P=await t.resolver(s,t.context,T$(k||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return v(k),P},D=async k=>{const{errors:P}=await N(k);if(k)for(const I of k){const J=Z(P,I);J?Ke(n.errors,I,J):Ot(n.errors,I)}else n.errors=P;return P},O=async(k,P,I={valid:!0})=>{for(const J in k){const Q=k[J];if(Q){const{_f:Y,...ue}=Q;if(Y){const Me=a.array.has(Y.name);v([J],!0);const yt=await ow(Q,s,g,t.shouldUseNativeValidation&&!P,Me);if(v([J]),yt[Y.name]&&(I.valid=!1,P))break;!P&&(Z(yt,Y.name)?Me?b$(n.errors,yt,Y.name):Ke(n.errors,Y.name,yt[Y.name]):Ot(n.errors,Y.name))}ue&&await O(ue,P,I)}}return I.valid},B=()=>{for(const k of a.unMount){const P=Z(r,k);P&&(P._f.refs?P._f.refs.every(I=>!yh(I)):!yh(P._f.ref))&&Ue(k)}a.unMount=new Set},A=(k,P)=>(k&&P&&Ke(s,k,P),!Ss(le(),o)),H=(k,P,I)=>Tk(k,a,{...i.mount?s:Tt(P)?o:Cr(k)?{[k]:P}:P},I,P),L=k=>ff(Z(i.mount?s:o,k,e.shouldUnregister?Z(o,k,[]):[])),K=(k,P,I={})=>{const J=Z(r,k);let Q=P;if(J){const Y=J._f;Y&&(!Y.disabled&&Ke(s,k,Ok(P,Y)),Q=nd(Y.ref)&&an(P)?"":P,jk(Y.ref)?[...Y.ref.options].forEach(ue=>ue.selected=Q.includes(ue.value)):Y.refs?sc(Y.ref)?Y.refs.length>1?Y.refs.forEach(ue=>(!ue.defaultChecked||!ue.disabled)&&(ue.checked=Array.isArray(Q)?!!Q.find(Me=>Me===ue.value):Q===ue.value)):Y.refs[0]&&(Y.refs[0].checked=!!Q):Y.refs.forEach(ue=>ue.checked=ue.value===Q):mv(Y.ref)?Y.ref.value="":(Y.ref.value=Q,Y.ref.type||f.values.next({name:k,values:{...s}})))}(I.shouldDirty||I.shouldTouch)&&_(k,Q,I.shouldTouch,I.shouldDirty,!0),I.shouldValidate&&X(k)},ne=(k,P,I)=>{for(const J in P){const Q=P[J],Y=`${k}.${J}`,ue=Z(r,Y);(a.array.has(k)||!od(Q)||ue&&!ue._f)&&!yi(Q)?ne(Y,Q,I):K(Y,Q,I)}},W=(k,P,I={})=>{const J=Z(r,k),Q=a.array.has(k),Y=gn(P);Ke(s,k,Y),Q?(f.array.next({name:k,values:{...s}}),(d.isDirty||d.dirtyFields)&&I.shouldDirty&&f.state.next({name:k,dirtyFields:Gc(o,s),isDirty:A(k,Y)})):J&&!J._f&&!an(Y)?ne(k,Y,I):K(k,Y,I),Jx(k,a)&&f.state.next({...n}),f.values.next({name:i.mount?k:void 0,values:{...s}})},F=async k=>{i.mount=!0;const P=k.target;let I=P.name,J=!0;const Q=Z(r,I),Y=()=>P.type?xh(Q._f):wk(k),ue=Me=>{J=Number.isNaN(Me)||Me===Z(s,I,Me)};if(Q){let Me,yt;const zt=Y(),rn=k.type===td.BLUR||k.type===td.FOCUS_OUT,Zn=!R$(Q._f)&&!t.resolver&&!Z(n.errors,I)&&!Q._f.deps||N$(rn,Z(n.touchedFields,I),n.isSubmitted,x,p),Hs=Jx(I,a,rn);Ke(s,I,zt),rn?(Q._f.onBlur&&Q._f.onBlur(k),l&&l(0)):Q._f.onChange&&Q._f.onChange(k);const So=_(I,zt,rn,!1),Sf=!kn(So)||Hs;if(!rn&&f.values.next({name:I,type:k.type,values:{...s}}),Zn)return d.isValid&&S(),Sf&&f.state.next({name:I,...Hs?{}:So});if(!rn&&Hs&&f.state.next({...n}),t.resolver){const{errors:qn}=await N([I]);if(ue(zt),J){const dc=sw(n.errors,r,I),aa=sw(qn,r,dc.name||I);Me=aa.error,I=aa.name,yt=kn(qn)}}else v([I],!0),Me=(await ow(Q,s,g,t.shouldUseNativeValidation))[I],v([I]),ue(zt),J&&(Me?yt=!1:d.isValid&&(yt=await O(r,!0)));J&&(Q._f.deps&&X(Q._f.deps),R(I,yt,Me,So))}},M=(k,P)=>{if(Z(n.errors,P)&&k.focus)return k.focus(),1},X=async(k,P={})=>{let I,J;const Q=Ha(k);if(t.resolver){const Y=await D(Tt(k)?k:Q);I=kn(Y),J=k?!Q.some(ue=>Z(Y,ue)):I}else k?(J=(await Promise.all(Q.map(async Y=>{const ue=Z(r,Y);return await O(ue&&ue._f?{[Y]:ue}:ue)}))).every(Boolean),!(!J&&!n.isValid)&&S()):J=I=await O(r);return f.state.next({...!Cr(k)||d.isValid&&I!==n.isValid?{}:{name:k},...t.resolver||!k?{isValid:I}:{},errors:n.errors}),P.shouldFocus&&!J&&Ba(r,M,k?Q:a.mount),J},le=k=>{const P={...i.mount?s:o};return Tt(k)?P:Cr(k)?Z(P,k):k.map(I=>Z(P,I))},me=(k,P)=>({invalid:!!Z((P||n).errors,k),isDirty:!!Z((P||n).dirtyFields,k),error:Z((P||n).errors,k),isValidating:!!Z(n.validatingFields,k),isTouched:!!Z((P||n).touchedFields,k)}),rt=k=>{k&&Ha(k).forEach(P=>Ot(n.errors,P)),f.state.next({errors:k?n.errors:{}})},je=(k,P,I)=>{const J=(Z(r,k,{_f:{}})._f||{}).ref,Q=Z(n.errors,k)||{},{ref:Y,message:ue,type:Me,...yt}=Q;Ke(n.errors,k,{...yt,...P,ref:J}),f.state.next({name:k,errors:n.errors,isValid:!1}),I&&I.shouldFocus&&J&&J.focus&&J.focus()},gt=(k,P)=>Lo(k)?f.values.subscribe({next:I=>k(H(void 0,P),I)}):H(k,P,!0),Ue=(k,P={})=>{for(const I of k?Ha(k):a.mount)a.mount.delete(I),a.array.delete(I),P.keepValue||(Ot(r,I),Ot(s,I)),!P.keepError&&Ot(n.errors,I),!P.keepDirty&&Ot(n.dirtyFields,I),!P.keepTouched&&Ot(n.touchedFields,I),!P.keepIsValidating&&Ot(n.validatingFields,I),!t.shouldUnregister&&!P.keepDefaultValue&&Ot(o,I);f.values.next({values:{...s}}),f.state.next({...n,...P.keepDirty?{isDirty:A()}:{}}),!P.keepIsValid&&S()},ce=({disabled:k,name:P,field:I,fields:J,value:Q})=>{if(_r(k)&&i.mount||k){const Y=k?void 0:Tt(Q)?xh(I?I._f:Z(J,P)._f):Q;Ke(s,P,Y),_(P,Y,!1,!1,!0)}},De=(k,P={})=>{let I=Z(r,k);const J=_r(P.disabled);return Ke(r,k,{...I||{},_f:{...I&&I._f?I._f:{ref:{name:k}},name:k,mount:!0,...P}}),a.mount.add(k),I?ce({field:I,disabled:P.disabled,name:k,value:P.value}):C(k,!0,P.value),{...J?{disabled:P.disabled}:{},...t.progressive?{required:!!P.required,min:Ca(P.min),max:Ca(P.max),minLength:Ca(P.minLength),maxLength:Ca(P.maxLength),pattern:Ca(P.pattern)}:{},name:k,onChange:F,onBlur:F,ref:Q=>{if(Q){De(k,P),I=Z(r,k);const Y=Tt(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,ue=E$(Y),Me=I._f.refs||[];if(ue?Me.find(yt=>yt===Y):Y===I._f.ref)return;Ke(r,k,{_f:{...I._f,...ue?{refs:[...Me.filter(yh),Y,...Array.isArray(Z(o,k))?[{}]:[]],ref:{type:Y.type,name:k}}:{ref:Y}}}),C(k,!1,void 0,Y)}else I=Z(r,k,{}),I._f&&(I._f.mount=!1),(t.shouldUnregister||P.shouldUnregister)&&!(Sk(a.array,k)&&i.action)&&a.unMount.add(k)}}},He=()=>t.shouldFocusError&&Ba(r,M,a.mount),$e=k=>{_r(k)&&(f.state.next({disabled:k}),Ba(r,(P,I)=>{const J=Z(r,I);J&&(P.disabled=J._f.disabled||k,Array.isArray(J._f.refs)&&J._f.refs.forEach(Q=>{Q.disabled=J._f.disabled||k}))},0,!1))},Ve=(k,P)=>async I=>{let J;I&&(I.preventDefault&&I.preventDefault(),I.persist&&I.persist());let Q=gn(s);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:Y,values:ue}=await N();n.errors=Y,Q=ue}else await O(r);if(Ot(n.errors,"root"),kn(n.errors)){f.state.next({errors:{}});try{await k(Q,I)}catch(Y){J=Y}}else P&&await P({...n.errors},I),He(),setTimeout(He);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:kn(n.errors)&&!J,submitCount:n.submitCount+1,errors:n.errors}),J)throw J},Se=(k,P={})=>{Z(r,k)&&(Tt(P.defaultValue)?W(k,gn(Z(o,k))):(W(k,P.defaultValue),Ke(o,k,gn(P.defaultValue))),P.keepTouched||Ot(n.touchedFields,k),P.keepDirty||(Ot(n.dirtyFields,k),n.isDirty=P.defaultValue?A(k,gn(Z(o,k))):A()),P.keepError||(Ot(n.errors,k),d.isValid&&S()),f.state.next({...n}))},vt=(k,P={})=>{const I=k?gn(k):o,J=gn(I),Q=kn(k),Y=Q?o:J;if(P.keepDefaultValues||(o=I),!P.keepValues){if(P.keepDirtyValues)for(const ue of a.mount)Z(n.dirtyFields,ue)?Ke(Y,ue,Z(s,ue)):W(ue,Z(Y,ue));else{if(fv&&Tt(k))for(const ue of a.mount){const Me=Z(r,ue);if(Me&&Me._f){const yt=Array.isArray(Me._f.refs)?Me._f.refs[0]:Me._f.ref;if(nd(yt)){const zt=yt.closest("form");if(zt){zt.reset();break}}}}r={}}s=e.shouldUnregister?P.keepDefaultValues?gn(o):{}:gn(Y),f.array.next({values:{...Y}}),f.values.next({values:{...Y}})}a={mount:P.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!P.keepIsValid||!!P.keepDirtyValues,i.watch=!!e.shouldUnregister,f.state.next({submitCount:P.keepSubmitCount?n.submitCount:0,isDirty:Q?!1:P.keepDirty?n.isDirty:!!(P.keepDefaultValues&&!Ss(k,o)),isSubmitted:P.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Q?{}:P.keepDirtyValues?P.keepDefaultValues&&s?Gc(o,s):n.dirtyFields:P.keepDefaultValues&&k?Gc(o,k):P.keepDirty?n.dirtyFields:{},touchedFields:P.keepTouched?n.touchedFields:{},errors:P.keepErrors?n.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Zt=(k,P)=>vt(Lo(k)?k(s):k,P);return{control:{register:De,unregister:Ue,getFieldState:me,handleSubmit:Ve,setError:je,_executeSchema:N,_getWatch:H,_getDirty:A,_updateValid:S,_removeUnmounted:B,_updateFieldArray:m,_updateDisabledField:ce,_getFieldArray:L,_reset:vt,_resetDefaultValues:()=>Lo(t.defaultValues)&&t.defaultValues().then(k=>{Zt(k,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:k=>{n={...n,...k}},_disableForm:$e,_subjects:f,_proxyFormState:d,_setErrors:b,get _fields(){return r},get _formValues(){return s},get _state(){return i},set _state(k){i=k},get _defaultValues(){return o},get _names(){return a},set _names(k){a=k},get _formState(){return n},set _formState(k){n=k},get _options(){return t},set _options(k){t={...t,...k}}},trigger:X,register:De,handleSubmit:Ve,watch:gt,setValue:W,getValues:le,reset:Zt,resetField:Se,clearErrors:rt,unregister:Ue,setError:je,setFocus:(k,P={})=>{const I=Z(r,k),J=I&&I._f;if(J){const Q=J.refs?J.refs[0]:J.ref;Q.focus&&(Q.focus(),P.shouldSelect&&Q.select())}},getFieldState:me}}function ic(e={}){const t=Oe.useRef(),n=Oe.useRef(),[r,o]=Oe.useState({isDirty:!1,isValidating:!1,isLoading:Lo(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Lo(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...D$(e),formState:r});const s=t.current.control;return s._options=e,pv({subject:s._subjects.state,next:i=>{kk(i,s._proxyFormState,s._updateFormState,!0)&&o({...s._formState})}}),Oe.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),Oe.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==r.isDirty&&s._subjects.state.next({isDirty:i})}},[s,r.isDirty]),Oe.useEffect(()=>{e.values&&!Ss(e.values,n.current)?(s._reset(e.values,s._options.resetOptions),n.current=e.values,o(i=>({...i}))):s._resetDefaultValues()},[e.values,s]),Oe.useEffect(()=>{e.errors&&s._setErrors(e.errors)},[e.errors,s]),Oe.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),Oe.useEffect(()=>{e.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[e.shouldUnregister,s]),t.current.formState=Ck(r,s),t.current}const iw=(e,t,n)=>{if(e&&"reportValidity"in e){const r=Z(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Ak=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?iw(r.ref,n,e):r.refs&&r.refs.forEach(o=>iw(o,n,e))}},M$=(e,t)=>{t.shouldUseNativeValidation&&Ak(e,t);const n={};for(const r in e){const o=Z(t.fields,r),s=Object.assign(e[r]||{},{ref:o&&o.ref});if(O$(t.names||Object.keys(e),r)){const i=Object.assign({},Z(n,r));Ke(i,"root",s),Ke(n,r,i)}else Ke(n,r,s)}return n},O$=(e,t)=>e.some(n=>n.startsWith(t+"."));var A$=function(e,t){for(var n={};e.length;){var r=e[0],o=r.code,s=r.message,i=r.path.join(".");if(!n[i])if("unionErrors"in r){var a=r.unionErrors[0].errors[0];n[i]={message:a.message,type:a.code}}else n[i]={message:s,type:o};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var l=n[i].types,u=l&&l[r.code];n[i]=Rk(i,t,n,o,u?[].concat(u,r.message):r.message)}e.shift()}return n},ac=function(e,t,n){return n===void 0&&(n={}),function(r,o,s){try{return Promise.resolve(function(i,a){try{var l=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(u){return s.shouldUseNativeValidation&&Ak({},s),{errors:{},values:n.raw?r:u}})}catch(u){return a(u)}return l&&l.then?l.then(void 0,a):l}(0,function(i){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(i))return{values:{},errors:M$(A$(i.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw i}))}catch(i){return Promise.reject(i)}}},Le;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const s={};for(const i of o)s[i]=i;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(const i of o)if(s(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(Le||(Le={}));var Up;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Up||(Up={}));const oe=Le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Do=e=>{switch(typeof e){case"undefined":return oe.undefined;case"string":return oe.string;case"number":return isNaN(e)?oe.nan:oe.number;case"boolean":return oe.boolean;case"function":return oe.function;case"bigint":return oe.bigint;case"symbol":return oe.symbol;case"object":return Array.isArray(e)?oe.array:e===null?oe.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?oe.promise:typeof Map<"u"&&e instanceof Map?oe.map:typeof Set<"u"&&e instanceof Set?oe.set:typeof Date<"u"&&e instanceof Date?oe.date:oe.object;default:return oe.unknown}},V=Le.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"]),I$=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Mn extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;ln.message){const n={},r=[];for(const o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Mn.create=e=>new Mn(e);const Wi=(e,t)=>{let n;switch(e.code){case V.invalid_type:e.received===oe.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case V.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Le.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${Le.joinValues(e.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Le.joinValues(e.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${Le.joinValues(e.options)}, received '${e.received}'`;break;case V.invalid_arguments:n="Invalid function arguments";break;case V.invalid_return_type:n="Invalid function return type";break;case V.invalid_date:n="Invalid date";break;case V.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Le.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case V.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case V.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case V.custom:n="Invalid input";break;case V.invalid_intersection_types:n="Intersection results could not be merged";break;case V.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case V.not_finite:n="Number must be finite";break;default:n=t.defaultError,Le.assertNever(e)}return{message:n}};let Ik=Wi;function L$(e){Ik=e}function id(){return Ik}const ad=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)a=u(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}},F$=[];function ee(e,t){const n=id(),r=ad({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Wi?void 0:Wi].filter(o=>!!o)});e.common.issues.push(r)}class tn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return we;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const s=await o.key,i=await o.value;r.push({key:s,value:i})}return tn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return we;s.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:t.value,value:r}}}const we=Object.freeze({status:"aborted"}),xi=e=>({status:"dirty",value:e}),cn=e=>({status:"valid",value:e}),$p=e=>e.status==="aborted",Vp=e=>e.status==="dirty",bl=e=>e.status==="valid",Cl=e=>typeof Promise<"u"&&e instanceof Promise;function ld(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function Lk(e,t,n,r,o){if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var fe;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(fe||(fe={}));var ja,Da;class jr{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}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 aw=(e,t)=>{if(bl(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 n=new Mn(e.common.issues);return this._error=n,this._error}}};function _e(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(i,a)=>{var l,u;const{message:d}=e;return i.code==="invalid_enum_value"?{message:d??a.defaultError}:typeof a.data>"u"?{message:(l=d??r)!==null&&l!==void 0?l:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:a.defaultError}},description:o}}class Re{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 Do(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Do(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new tn,ctx:{common:t.parent.common,data:t.data,parsedType:Do(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Cl(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const o={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Do(t)},s=this._parseSync({data:t,path:o.path,parent:o});return aw(o,s)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Do(t)},o=this._parse({data:t,path:r.path,parent:r}),s=await(Cl(o)?o:Promise.resolve(o));return aw(r,s)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{const i=t(o),a=()=>s.addIssue({code:V.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new hr({schema:this,typeName:ye.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Rr.create(this,this._def)}nullable(){return ts.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ar.create(this,this._def)}promise(){return Hi.create(this,this._def)}or(t){return Rl.create([this,t],this._def)}and(t){return Nl.create(this,t,this._def)}transform(t){return new hr({..._e(this._def),schema:this,typeName:ye.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Ol({..._e(this._def),innerType:this,defaultValue:n,typeName:ye.ZodDefault})}brand(){return new vv({typeName:ye.ZodBranded,type:this,..._e(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Al({..._e(this._def),innerType:this,catchValue:n,typeName:ye.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return lc.create(this,t)}readonly(){return Il.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const U$=/^c[^\s-]{8,}$/i,$$=/^[0-9a-z]+$/,V$=/^[0-9A-HJKMNP-TV-Z]{26}$/,z$=/^[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,W$=/^[a-z0-9_-]{21}$/i,Y$=/^[-+]?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)?)??$/,H$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,B$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let wh;const G$=/^(?:(?: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])$/,K$=/^(([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})))$/,Z$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Fk="((\\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])))",q$=new RegExp(`^${Fk}$`);function Uk(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 X$(e){return new RegExp(`^${Uk(e)}$`)}function $k(e){let t=`${Fk}T${Uk(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Q$(e,t){return!!((t==="v4"||!t)&&G$.test(e)||(t==="v6"||!t)&&K$.test(e))}class or extends Re{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==oe.string){const s=this._getOrReturnCtx(t);return ee(s,{code:V.invalid_type,expected:oe.string,received:s.parsedType}),we}const r=new tn;let o;for(const s of this._def.checks)if(s.kind==="min")t.data.lengths.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:V.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const i=t.data.length>s.value,a=t.data.lengtht.test(o),{validation:n,code:V.invalid_string,...fe.errToObj(r)})}_addCheck(t){return new or({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...fe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...fe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...fe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...fe.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...fe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...fe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...fe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...fe.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...fe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...fe.errToObj(t)})}datetime(t){var n,r;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:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...fe.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,...fe.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...fe.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...fe.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...fe.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...fe.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...fe.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...fe.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...fe.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...fe.errToObj(n)})}nonempty(t){return this.min(1,fe.errToObj(t))}trim(){return new or({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new or({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new or({...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 n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new or({checks:[],typeName:ye.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,..._e(e)})};function J$(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=parseInt(e.toFixed(o).replace(".","")),i=parseInt(t.toFixed(o).replace(".",""));return s%i/Math.pow(10,o)}class Qo extends Re{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)!==oe.number){const s=this._getOrReturnCtx(t);return ee(s,{code:V.invalid_type,expected:oe.number,received:s.parsedType}),we}let r;const o=new tn;for(const s of this._def.checks)s.kind==="int"?Le.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ee(r,{code:V.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.datas.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),ee(r,{code:V.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?J$(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),ee(r,{code:V.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ee(r,{code:V.not_finite,message:s.message}),o.dirty()):Le.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,fe.toString(n))}gt(t,n){return this.setLimit("min",t,!1,fe.toString(n))}lte(t,n){return this.setLimit("max",t,!0,fe.toString(n))}lt(t,n){return this.setLimit("max",t,!1,fe.toString(n))}setLimit(t,n,r,o){return new Qo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:fe.toString(o)}]})}_addCheck(t){return new Qo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:fe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:fe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:fe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:fe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:fe.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:fe.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:fe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:fe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:fe.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&Le.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew Qo({checks:[],typeName:ye.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,..._e(e)});class Jo extends Re{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)!==oe.bigint){const s=this._getOrReturnCtx(t);return ee(s,{code:V.invalid_type,expected:oe.bigint,received:s.parsedType}),we}let r;const o=new tn;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.datas.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),ee(r,{code:V.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ee(r,{code:V.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):Le.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,fe.toString(n))}gt(t,n){return this.setLimit("min",t,!1,fe.toString(n))}lte(t,n){return this.setLimit("max",t,!0,fe.toString(n))}lt(t,n){return this.setLimit("max",t,!1,fe.toString(n))}setLimit(t,n,r,o){return new Jo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:fe.toString(o)}]})}_addCheck(t){return new Jo({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:fe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:fe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:fe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:fe.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:fe.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Jo({checks:[],typeName:ye.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,..._e(e)})};class kl extends Re{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==oe.boolean){const r=this._getOrReturnCtx(t);return ee(r,{code:V.invalid_type,expected:oe.boolean,received:r.parsedType}),we}return cn(t.data)}}kl.create=e=>new kl({typeName:ye.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,..._e(e)});class Is extends Re{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==oe.date){const s=this._getOrReturnCtx(t);return ee(s,{code:V.invalid_type,expected:oe.date,received:s.parsedType}),we}if(isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return ee(s,{code:V.invalid_date}),we}const r=new tn;let o;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()s.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:V.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Le.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Is({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:fe.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:fe.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Is({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ye.ZodDate,..._e(e)});class cd extends Re{_parse(t){if(this._getType(t)!==oe.symbol){const r=this._getOrReturnCtx(t);return ee(r,{code:V.invalid_type,expected:oe.symbol,received:r.parsedType}),we}return cn(t.data)}}cd.create=e=>new cd({typeName:ye.ZodSymbol,..._e(e)});class El extends Re{_parse(t){if(this._getType(t)!==oe.undefined){const r=this._getOrReturnCtx(t);return ee(r,{code:V.invalid_type,expected:oe.undefined,received:r.parsedType}),we}return cn(t.data)}}El.create=e=>new El({typeName:ye.ZodUndefined,..._e(e)});class Tl extends Re{_parse(t){if(this._getType(t)!==oe.null){const r=this._getOrReturnCtx(t);return ee(r,{code:V.invalid_type,expected:oe.null,received:r.parsedType}),we}return cn(t.data)}}Tl.create=e=>new Tl({typeName:ye.ZodNull,..._e(e)});class Yi extends Re{constructor(){super(...arguments),this._any=!0}_parse(t){return cn(t.data)}}Yi.create=e=>new Yi({typeName:ye.ZodAny,..._e(e)});class ks extends Re{constructor(){super(...arguments),this._unknown=!0}_parse(t){return cn(t.data)}}ks.create=e=>new ks({typeName:ye.ZodUnknown,..._e(e)});class co extends Re{_parse(t){const n=this._getOrReturnCtx(t);return ee(n,{code:V.invalid_type,expected:oe.never,received:n.parsedType}),we}}co.create=e=>new co({typeName:ye.ZodNever,..._e(e)});class ud extends Re{_parse(t){if(this._getType(t)!==oe.undefined){const r=this._getOrReturnCtx(t);return ee(r,{code:V.invalid_type,expected:oe.void,received:r.parsedType}),we}return cn(t.data)}}ud.create=e=>new ud({typeName:ye.ZodVoid,..._e(e)});class ar extends Re{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==oe.array)return ee(n,{code:V.invalid_type,expected:oe.array,received:n.parsedType}),we;if(o.exactLength!==null){const i=n.data.length>o.exactLength.value,a=n.data.lengtho.maxLength.value&&(ee(n,{code:V.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new jr(n,i,n.path,a)))).then(i=>tn.mergeArray(r,i));const s=[...n.data].map((i,a)=>o.type._parseSync(new jr(n,i,n.path,a)));return tn.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new ar({...this._def,minLength:{value:t,message:fe.toString(n)}})}max(t,n){return new ar({...this._def,maxLength:{value:t,message:fe.toString(n)}})}length(t,n){return new ar({...this._def,exactLength:{value:t,message:fe.toString(n)}})}nonempty(t){return this.min(1,t)}}ar.create=(e,t)=>new ar({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ye.ZodArray,..._e(t)});function ri(e){if(e instanceof xt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Rr.create(ri(r))}return new xt({...e._def,shape:()=>t})}else return e instanceof ar?new ar({...e._def,type:ri(e.element)}):e instanceof Rr?Rr.create(ri(e.unwrap())):e instanceof ts?ts.create(ri(e.unwrap())):e instanceof Dr?Dr.create(e.items.map(t=>ri(t))):e}class xt extends Re{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(),n=Le.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==oe.object){const u=this._getOrReturnCtx(t);return ee(u,{code:V.invalid_type,expected:oe.object,received:u.parsedType}),we}const{status:r,ctx:o}=this._processInputParams(t),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof co&&this._def.unknownKeys==="strip"))for(const u in o.data)i.includes(u)||a.push(u);const l=[];for(const u of i){const d=s[u],f=o.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new jr(o,f,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof co){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)l.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(u==="strict")a.length>0&&(ee(o,{code:V.unrecognized_keys,keys:a}),r.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=o.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new jr(o,f,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of l){const f=await d.key,p=await d.value;u.push({key:f,value:p,alwaysSet:d.alwaysSet})}return u}).then(u=>tn.mergeObjectSync(r,u)):tn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return fe.errToObj,new xt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,s,i,a;const l=(i=(s=(o=this._def).errorMap)===null||s===void 0?void 0:s.call(o,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=fe.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new xt({...this._def,unknownKeys:"strip"})}passthrough(){return new xt({...this._def,unknownKeys:"passthrough"})}extend(t){return new xt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new xt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ye.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new xt({...this._def,catchall:t})}pick(t){const n={};return Le.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new xt({...this._def,shape:()=>n})}omit(t){const n={};return Le.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new xt({...this._def,shape:()=>n})}deepPartial(){return ri(this)}partial(t){const n={};return Le.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new xt({...this._def,shape:()=>n})}required(t){const n={};return Le.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Rr;)s=s._def.innerType;n[r]=s}}),new xt({...this._def,shape:()=>n})}keyof(){return Vk(Le.objectKeys(this.shape))}}xt.create=(e,t)=>new xt({shape:()=>e,unknownKeys:"strip",catchall:co.create(),typeName:ye.ZodObject,..._e(t)});xt.strictCreate=(e,t)=>new xt({shape:()=>e,unknownKeys:"strict",catchall:co.create(),typeName:ye.ZodObject,..._e(t)});xt.lazycreate=(e,t)=>new xt({shape:e,unknownKeys:"strip",catchall:co.create(),typeName:ye.ZodObject,..._e(t)});class Rl extends Re{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=s.map(a=>new Mn(a.ctx.common.issues));return ee(n,{code:V.invalid_union,unionErrors:i}),we}if(n.common.async)return Promise.all(r.map(async s=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s;const i=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=l._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(l=>new Mn(l));return ee(n,{code:V.invalid_union,unionErrors:a}),we}}get options(){return this._def.options}}Rl.create=(e,t)=>new Rl({options:e,typeName:ye.ZodUnion,..._e(t)});const Vr=e=>e instanceof jl?Vr(e.schema):e instanceof hr?Vr(e.innerType()):e instanceof Dl?[e.value]:e instanceof es?e.options:e instanceof Ml?Le.objectValues(e.enum):e instanceof Ol?Vr(e._def.innerType):e instanceof El?[void 0]:e instanceof Tl?[null]:e instanceof Rr?[void 0,...Vr(e.unwrap())]:e instanceof ts?[null,...Vr(e.unwrap())]:e instanceof vv||e instanceof Il?Vr(e.unwrap()):e instanceof Al?Vr(e._def.innerType):[];class pf extends Re{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==oe.object)return ee(n,{code:V.invalid_type,expected:oe.object,received:n.parsedType}),we;const r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(ee(n,{code:V.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),we)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const s of n){const i=Vr(s.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(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,s)}}return new pf({typeName:ye.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,..._e(r)})}}function zp(e,t){const n=Do(e),r=Do(t);if(e===t)return{valid:!0,data:e};if(n===oe.object&&r===oe.object){const o=Le.objectKeys(t),s=Le.objectKeys(e).filter(a=>o.indexOf(a)!==-1),i={...e,...t};for(const a of s){const l=zp(e[a],t[a]);if(!l.valid)return{valid:!1};i[a]=l.data}return{valid:!0,data:i}}else if(n===oe.array&&r===oe.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let s=0;s{if($p(s)||$p(i))return we;const a=zp(s.value,i.value);return a.valid?((Vp(s)||Vp(i))&&n.dirty(),{status:n.value,value:a.data}):(ee(r,{code:V.invalid_intersection_types}),we)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Nl.create=(e,t,n)=>new Nl({left:e,right:t,typeName:ye.ZodIntersection,..._e(n)});class Dr extends Re{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==oe.array)return ee(r,{code:V.invalid_type,expected:oe.array,received:r.parsedType}),we;if(r.data.lengththis._def.items.length&&(ee(r,{code:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((i,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new jr(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>tn.mergeArray(n,i)):tn.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new Dr({...this._def,rest:t})}}Dr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dr({items:e,typeName:ye.ZodTuple,rest:null,..._e(t)})};class Pl extends Re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==oe.object)return ee(r,{code:V.invalid_type,expected:oe.object,received:r.parsedType}),we;const o=[],s=this._def.keyType,i=this._def.valueType;for(const a in r.data)o.push({key:s._parse(new jr(r,a,r.path,a)),value:i._parse(new jr(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?tn.mergeObjectAsync(n,o):tn.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Re?new Pl({keyType:t,valueType:n,typeName:ye.ZodRecord,..._e(r)}):new Pl({keyType:or.create(),valueType:t,typeName:ye.ZodRecord,..._e(n)})}}class dd extends Re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==oe.map)return ee(r,{code:V.invalid_type,expected:oe.map,received:r.parsedType}),we;const o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,l],u)=>({key:o._parse(new jr(r,a,r.path,[u,"key"])),value:s._parse(new jr(r,l,r.path,[u,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of i){const u=await l.key,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return we;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of i){const u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return we;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}}}}dd.create=(e,t,n)=>new dd({valueType:t,keyType:e,typeName:ye.ZodMap,..._e(n)});class Ls extends Re{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==oe.set)return ee(r,{code:V.invalid_type,expected:oe.set,received:r.parsedType}),we;const o=this._def;o.minSize!==null&&r.data.sizeo.maxSize.value&&(ee(r,{code:V.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const s=this._def.valueType;function i(l){const u=new Set;for(const d of l){if(d.status==="aborted")return we;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((l,u)=>s._parse(new jr(r,l,r.path,u)));return r.common.async?Promise.all(a).then(l=>i(l)):i(a)}min(t,n){return new Ls({...this._def,minSize:{value:t,message:fe.toString(n)}})}max(t,n){return new Ls({...this._def,maxSize:{value:t,message:fe.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Ls.create=(e,t)=>new Ls({valueType:e,minSize:null,maxSize:null,typeName:ye.ZodSet,..._e(t)});class Mi extends Re{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==oe.function)return ee(n,{code:V.invalid_type,expected:oe.function,received:n.parsedType}),we;function r(a,l){return ad({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,id(),Wi].filter(u=>!!u),issueData:{code:V.invalid_arguments,argumentsError:l}})}function o(a,l){return ad({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,id(),Wi].filter(u=>!!u),issueData:{code:V.invalid_return_type,returnTypeError:l}})}const s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Hi){const a=this;return cn(async function(...l){const u=new Mn([]),d=await a._def.args.parseAsync(l,s).catch(x=>{throw u.addIssue(r(l,x)),u}),f=await Reflect.apply(i,this,d);return await a._def.returns._def.type.parseAsync(f,s).catch(x=>{throw u.addIssue(o(f,x)),u})})}else{const a=this;return cn(function(...l){const u=a._def.args.safeParse(l,s);if(!u.success)throw new Mn([r(l,u.error)]);const d=Reflect.apply(i,this,u.data),f=a._def.returns.safeParse(d,s);if(!f.success)throw new Mn([o(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Mi({...this._def,args:Dr.create(t).rest(ks.create())})}returns(t){return new Mi({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Mi({args:t||Dr.create([]).rest(ks.create()),returns:n||ks.create(),typeName:ye.ZodFunction,..._e(r)})}}class jl extends Re{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}jl.create=(e,t)=>new jl({getter:e,typeName:ye.ZodLazy,..._e(t)});class Dl extends Re{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ee(n,{received:n.data,code:V.invalid_literal,expected:this._def.value}),we}return{status:"valid",value:t.data}}get value(){return this._def.value}}Dl.create=(e,t)=>new Dl({value:e,typeName:ye.ZodLiteral,..._e(t)});function Vk(e,t){return new es({values:e,typeName:ye.ZodEnum,..._e(t)})}class es extends Re{constructor(){super(...arguments),ja.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ee(n,{expected:Le.joinValues(r),received:n.parsedType,code:V.invalid_type}),we}if(ld(this,ja)||Lk(this,ja,new Set(this._def.values)),!ld(this,ja).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return ee(n,{received:n.data,code:V.invalid_enum_value,options:r}),we}return cn(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return es.create(t,{...this._def,...n})}exclude(t,n=this._def){return es.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}ja=new WeakMap;es.create=Vk;class Ml extends Re{constructor(){super(...arguments),Da.set(this,void 0)}_parse(t){const n=Le.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==oe.string&&r.parsedType!==oe.number){const o=Le.objectValues(n);return ee(r,{expected:Le.joinValues(o),received:r.parsedType,code:V.invalid_type}),we}if(ld(this,Da)||Lk(this,Da,new Set(Le.getValidEnumValues(this._def.values))),!ld(this,Da).has(t.data)){const o=Le.objectValues(n);return ee(r,{received:r.data,code:V.invalid_enum_value,options:o}),we}return cn(t.data)}get enum(){return this._def.values}}Da=new WeakMap;Ml.create=(e,t)=>new Ml({values:e,typeName:ye.ZodNativeEnum,..._e(t)});class Hi extends Re{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==oe.promise&&n.common.async===!1)return ee(n,{code:V.invalid_type,expected:oe.promise,received:n.parsedType}),we;const r=n.parsedType===oe.promise?n.data:Promise.resolve(n.data);return cn(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Hi.create=(e,t)=>new Hi({type:e,typeName:ye.ZodPromise,..._e(t)});class hr extends Re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ye.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,s={addIssue:i=>{ee(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){const i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return we;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?we:l.status==="dirty"||n.value==="dirty"?xi(l.value):l});{if(n.value==="aborted")return we;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?we:a.status==="dirty"||n.value==="dirty"?xi(a.value):a}}if(o.type==="refinement"){const i=a=>{const l=o.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?we:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?we:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!bl(i))return i;const a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>bl(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):i);Le.assertNever(o)}}hr.create=(e,t,n)=>new hr({schema:e,typeName:ye.ZodEffects,effect:t,..._e(n)});hr.createWithPreprocess=(e,t,n)=>new hr({schema:t,effect:{type:"preprocess",transform:e},typeName:ye.ZodEffects,..._e(n)});class Rr extends Re{_parse(t){return this._getType(t)===oe.undefined?cn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Rr.create=(e,t)=>new Rr({innerType:e,typeName:ye.ZodOptional,..._e(t)});class ts extends Re{_parse(t){return this._getType(t)===oe.null?cn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ts.create=(e,t)=>new ts({innerType:e,typeName:ye.ZodNullable,..._e(t)});class Ol extends Re{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===oe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Ol.create=(e,t)=>new Ol({innerType:e,typeName:ye.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,..._e(t)});class Al extends Re{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Cl(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Mn(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Mn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Al.create=(e,t)=>new Al({innerType:e,typeName:ye.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,..._e(t)});class fd extends Re{_parse(t){if(this._getType(t)!==oe.nan){const r=this._getOrReturnCtx(t);return ee(r,{code:V.invalid_type,expected:oe.nan,received:r.parsedType}),we}return{status:"valid",value:t.data}}}fd.create=e=>new fd({typeName:ye.ZodNaN,..._e(e)});const eV=Symbol("zod_brand");class vv extends Re{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class lc extends Re{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?we:s.status==="dirty"?(n.dirty(),xi(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?we:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new lc({in:t,out:n,typeName:ye.ZodPipeline})}}class Il extends Re{_parse(t){const n=this._def.innerType._parse(t),r=o=>(bl(o)&&(o.value=Object.freeze(o.value)),o);return Cl(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}Il.create=(e,t)=>new Il({innerType:e,typeName:ye.ZodReadonly,..._e(t)});function zk(e,t={},n){return e?Yi.create().superRefine((r,o)=>{var s,i;if(!e(r)){const a=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(i=(s=a.fatal)!==null&&s!==void 0?s:n)!==null&&i!==void 0?i:!0,u=typeof a=="string"?{message:a}:a;o.addIssue({code:"custom",...u,fatal:l})}}):Yi.create()}const tV={object:xt.lazycreate};var ye;(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"})(ye||(ye={}));const nV=(e,t={message:`Input not instance of ${e.name}`})=>zk(n=>n instanceof e,t),Wk=or.create,Yk=Qo.create,rV=fd.create,oV=Jo.create,Hk=kl.create,sV=Is.create,iV=cd.create,aV=El.create,lV=Tl.create,cV=Yi.create,uV=ks.create,dV=co.create,fV=ud.create,hV=ar.create,pV=xt.create,mV=xt.strictCreate,gV=Rl.create,vV=pf.create,yV=Nl.create,xV=Dr.create,wV=Pl.create,SV=dd.create,_V=Ls.create,bV=Mi.create,CV=jl.create,kV=Dl.create,EV=es.create,TV=Ml.create,RV=Hi.create,lw=hr.create,NV=Rr.create,PV=ts.create,jV=hr.createWithPreprocess,DV=lc.create,MV=()=>Wk().optional(),OV=()=>Yk().optional(),AV=()=>Hk().optional(),IV={string:e=>or.create({...e,coerce:!0}),number:e=>Qo.create({...e,coerce:!0}),boolean:e=>kl.create({...e,coerce:!0}),bigint:e=>Jo.create({...e,coerce:!0}),date:e=>Is.create({...e,coerce:!0})},LV=we;var Ie=Object.freeze({__proto__:null,defaultErrorMap:Wi,setErrorMap:L$,getErrorMap:id,makeIssue:ad,EMPTY_PATH:F$,addIssueToContext:ee,ParseStatus:tn,INVALID:we,DIRTY:xi,OK:cn,isAborted:$p,isDirty:Vp,isValid:bl,isAsync:Cl,get util(){return Le},get objectUtil(){return Up},ZodParsedType:oe,getParsedType:Do,ZodType:Re,datetimeRegex:$k,ZodString:or,ZodNumber:Qo,ZodBigInt:Jo,ZodBoolean:kl,ZodDate:Is,ZodSymbol:cd,ZodUndefined:El,ZodNull:Tl,ZodAny:Yi,ZodUnknown:ks,ZodNever:co,ZodVoid:ud,ZodArray:ar,ZodObject:xt,ZodUnion:Rl,ZodDiscriminatedUnion:pf,ZodIntersection:Nl,ZodTuple:Dr,ZodRecord:Pl,ZodMap:dd,ZodSet:Ls,ZodFunction:Mi,ZodLazy:jl,ZodLiteral:Dl,ZodEnum:es,ZodNativeEnum:Ml,ZodPromise:Hi,ZodEffects:hr,ZodTransformer:hr,ZodOptional:Rr,ZodNullable:ts,ZodDefault:Ol,ZodCatch:Al,ZodNaN:fd,BRAND:eV,ZodBranded:vv,ZodPipeline:lc,ZodReadonly:Il,custom:zk,Schema:Re,ZodSchema:Re,late:tV,get ZodFirstPartyTypeKind(){return ye},coerce:IV,any:cV,array:hV,bigint:oV,boolean:Hk,date:sV,discriminatedUnion:vV,effect:lw,enum:EV,function:bV,instanceof:nV,intersection:yV,lazy:CV,literal:kV,map:SV,nan:rV,nativeEnum:TV,never:dV,null:lV,nullable:PV,number:Yk,object:pV,oboolean:AV,onumber:OV,optional:NV,ostring:MV,pipeline:DV,preprocess:jV,promise:RV,record:wV,set:_V,strictObject:mV,string:Wk,symbol:iV,transformer:lw,tuple:xV,undefined:aV,union:gV,unknown:uV,void:fV,NEVER:LV,ZodIssueCode:V,quotelessJson:I$,ZodError:Mn}),FV="Label",Bk=h.forwardRef((e,t)=>c.jsx(ve.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Bk.displayName=FV;var Gk=Bk;const UV=Wl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ll=h.forwardRef(({className:e,...t},n)=>c.jsx(Gk,{ref:n,className:se(UV(),e),...t}));Ll.displayName=Gk.displayName;const cc=y$,Kk=h.createContext({}),tt=({...e})=>c.jsx(Kk.Provider,{value:{name:e.name},children:c.jsx(_$,{...e})}),mf=()=>{const e=h.useContext(Kk),t=h.useContext(Zk),{getFieldState:n,formState:r}=hf(),o=n(e.name,r);if(!e)throw new Error("useFormField should be used within ");const{id:s}=t;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...o}},Zk=h.createContext({}),qe=h.forwardRef(({className:e,...t},n)=>{const r=h.useId();return c.jsx(Zk.Provider,{value:{id:r},children:c.jsx("div",{ref:n,className:se("space-y-2",e),...t})})});qe.displayName="FormItem";const Xe=h.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:o}=mf();return c.jsx(Ll,{ref:n,className:se(r&&"text-destructive",e),htmlFor:o,...t})});Xe.displayName="FormLabel";const Qe=h.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:o,formMessageId:s}=mf();return c.jsx(oo,{ref:t,id:r,"aria-describedby":n?`${o} ${s}`:`${o}`,"aria-invalid":!!n,...e})});Qe.displayName="FormControl";const $V=h.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=mf();return c.jsx("p",{ref:n,id:r,className:se("text-sm text-muted-foreground",e),...t})});$V.displayName="FormDescription";const Be=h.forwardRef(({className:e,children:t,...n},r)=>{const{error:o,formMessageId:s}=mf(),i=o?String(o==null?void 0:o.message):t;return i?c.jsx("p",{ref:r,id:s,className:se("text-sm font-medium text-destructive",e),...n,children:i}):null});Be.displayName="FormMessage";function Wp(e,[t,n]){return Math.min(n,Math.max(t,e))}var VV=[" ","Enter","ArrowUp","ArrowDown"],zV=[" ","Enter"],uc="Select",[gf,vf,WV]=Ld(uc),[ia,d3]=_n(uc,[WV,na]),yf=na(),[YV,ls]=ia(uc),[HV,BV]=ia(uc),qk=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:a,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:x}=e,g=yf(t),[y,S]=h.useState(null),[v,m]=h.useState(null),[w,b]=h.useState(!1),C=Yl(u),[_=!1,R]=so({prop:r,defaultProp:o,onChange:s}),[N,D]=so({prop:i,defaultProp:a,onChange:l}),O=h.useRef(null),B=y?!!y.closest("form"):!0,[A,H]=h.useState(new Set),L=Array.from(A).map(K=>K.props.value).join(";");return c.jsx(hg,{...g,children:c.jsxs(YV,{required:x,scope:t,trigger:y,onTriggerChange:S,valueNode:v,onValueNodeChange:m,valueNodeHasChildren:w,onValueNodeHasChildrenChange:b,contentId:Tr(),value:N,onValueChange:D,open:_,onOpenChange:R,dir:C,triggerPointerDownPosRef:O,disabled:p,children:[c.jsx(gf.Provider,{scope:t,children:c.jsx(HV,{scope:e.__scopeSelect,onNativeOptionAdd:h.useCallback(K=>{H(ne=>new Set(ne).add(K))},[]),onNativeOptionRemove:h.useCallback(K=>{H(ne=>{const W=new Set(ne);return W.delete(K),W})},[]),children:n})}),B?c.jsxs(_E,{"aria-hidden":!0,required:x,tabIndex:-1,name:d,autoComplete:f,value:N,onChange:K=>D(K.target.value),disabled:p,children:[N===void 0?c.jsx("option",{value:""}):null,Array.from(A)]},L):null]})})};qk.displayName=uc;var Xk="SelectTrigger",Qk=h.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=yf(n),i=ls(Xk,n),a=i.disabled||r,l=be(t,i.onTriggerChange),u=vf(n),[d,f,p]=bE(g=>{const y=u().filter(m=>!m.disabled),S=y.find(m=>m.value===i.value),v=CE(y,g,S);v!==void 0&&i.onValueChange(v.value)}),x=()=>{a||(i.onOpenChange(!0),p())};return c.jsx(pg,{asChild:!0,...s,children:c.jsx(ve.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":SE(i.value)?"":void 0,...o,ref:l,onClick:G(o.onClick,g=>{g.currentTarget.focus()}),onPointerDown:G(o.onPointerDown,g=>{const y=g.target;y.hasPointerCapture(g.pointerId)&&y.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&(x(),i.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)},g.preventDefault())}),onKeyDown:G(o.onKeyDown,g=>{const y=d.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&f(g.key),!(y&&g.key===" ")&&VV.includes(g.key)&&(x(),g.preventDefault())})})})});Qk.displayName=Xk;var Jk="SelectValue",eE=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...a}=e,l=ls(Jk,n),{onValueNodeHasChildrenChange:u}=l,d=s!==void 0,f=be(t,l.onValueNodeChange);return Kt(()=>{u(d)},[u,d]),c.jsx(ve.span,{...a,ref:f,style:{pointerEvents:"none"},children:SE(l.value)?c.jsx(c.Fragment,{children:i}):s})});eE.displayName=Jk;var GV="SelectIcon",tE=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return c.jsx(ve.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});tE.displayName=GV;var KV="SelectPortal",nE=e=>c.jsx(Bl,{asChild:!0,...e});nE.displayName=KV;var Fs="SelectContent",rE=h.forwardRef((e,t)=>{const n=ls(Fs,e.__scopeSelect),[r,o]=h.useState();if(Kt(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?fo.createPortal(c.jsx(oE,{scope:e.__scopeSelect,children:c.jsx(gf.Slot,{scope:e.__scopeSelect,children:c.jsx("div",{children:e.children})})}),s):null}return c.jsx(sE,{...e,ref:t})});rE.displayName=Fs;var Yr=10,[oE,cs]=ia(Fs),ZV="SelectContentImpl",sE=h.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:a,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:x,sticky:g,hideWhenDetached:y,avoidCollisions:S,...v}=e,m=ls(Fs,n),[w,b]=h.useState(null),[C,_]=h.useState(null),R=be(t,ce=>b(ce)),[N,D]=h.useState(null),[O,B]=h.useState(null),A=vf(n),[H,L]=h.useState(!1),K=h.useRef(!1);h.useEffect(()=>{if(w)return vg(w)},[w]),rg();const ne=h.useCallback(ce=>{const[De,...He]=A().map(Se=>Se.ref.current),[$e]=He.slice(-1),Ve=document.activeElement;for(const Se of ce)if(Se===Ve||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===De&&C&&(C.scrollTop=0),Se===$e&&C&&(C.scrollTop=C.scrollHeight),Se==null||Se.focus(),document.activeElement!==Ve))return},[A,C]),W=h.useCallback(()=>ne([N,w]),[ne,N,w]);h.useEffect(()=>{H&&W()},[H,W]);const{onOpenChange:F,triggerPointerDownPosRef:M}=m;h.useEffect(()=>{if(w){let ce={x:0,y:0};const De=$e=>{var Ve,Se;ce={x:Math.abs(Math.round($e.pageX)-(((Ve=M.current)==null?void 0:Ve.x)??0)),y:Math.abs(Math.round($e.pageY)-(((Se=M.current)==null?void 0:Se.y)??0))}},He=$e=>{ce.x<=10&&ce.y<=10?$e.preventDefault():w.contains($e.target)||F(!1),document.removeEventListener("pointermove",De),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",De),document.addEventListener("pointerup",He,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",De),document.removeEventListener("pointerup",He,{capture:!0})}}},[w,F,M]),h.useEffect(()=>{const ce=()=>F(!1);return window.addEventListener("blur",ce),window.addEventListener("resize",ce),()=>{window.removeEventListener("blur",ce),window.removeEventListener("resize",ce)}},[F]);const[X,le]=bE(ce=>{const De=A().filter(Ve=>!Ve.disabled),He=De.find(Ve=>Ve.ref.current===document.activeElement),$e=CE(De,ce,He);$e&&setTimeout(()=>$e.ref.current.focus())}),me=h.useCallback((ce,De,He)=>{const $e=!K.current&&!He;(m.value!==void 0&&m.value===De||$e)&&(D(ce),$e&&(K.current=!0))},[m.value]),rt=h.useCallback(()=>w==null?void 0:w.focus(),[w]),je=h.useCallback((ce,De,He)=>{const $e=!K.current&&!He;(m.value!==void 0&&m.value===De||$e)&&B(ce)},[m.value]),gt=r==="popper"?Yp:iE,Ue=gt===Yp?{side:a,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:x,sticky:g,hideWhenDetached:y,avoidCollisions:S}:{};return c.jsx(oE,{scope:n,content:w,viewport:C,onViewportChange:_,itemRefCallback:me,selectedItem:N,onItemLeave:rt,itemTextRefCallback:je,focusSelectedItem:W,selectedItemText:O,position:r,isPositioned:H,searchRef:X,children:c.jsx(Yd,{as:oo,allowPinchZoom:!0,children:c.jsx(Fd,{asChild:!0,trapped:m.open,onMountAutoFocus:ce=>{ce.preventDefault()},onUnmountAutoFocus:G(o,ce=>{var De;(De=m.trigger)==null||De.focus({preventScroll:!0}),ce.preventDefault()}),children:c.jsx(Ji,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:ce=>ce.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:c.jsx(gt,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:ce=>ce.preventDefault(),...v,...Ue,onPlaced:()=>L(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:G(v.onKeyDown,ce=>{const De=ce.ctrlKey||ce.altKey||ce.metaKey;if(ce.key==="Tab"&&ce.preventDefault(),!De&&ce.key.length===1&&le(ce.key),["ArrowUp","ArrowDown","Home","End"].includes(ce.key)){let $e=A().filter(Ve=>!Ve.disabled).map(Ve=>Ve.ref.current);if(["ArrowUp","End"].includes(ce.key)&&($e=$e.slice().reverse()),["ArrowUp","ArrowDown"].includes(ce.key)){const Ve=ce.target,Se=$e.indexOf(Ve);$e=$e.slice(Se+1)}setTimeout(()=>ne($e)),ce.preventDefault()}})})})})})})});sE.displayName=ZV;var qV="SelectItemAlignedPosition",iE=h.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=ls(Fs,n),i=cs(Fs,n),[a,l]=h.useState(null),[u,d]=h.useState(null),f=be(t,R=>d(R)),p=vf(n),x=h.useRef(!1),g=h.useRef(!0),{viewport:y,selectedItem:S,selectedItemText:v,focusSelectedItem:m}=i,w=h.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&u&&y&&S&&v){const R=s.trigger.getBoundingClientRect(),N=u.getBoundingClientRect(),D=s.valueNode.getBoundingClientRect(),O=v.getBoundingClientRect();if(s.dir!=="rtl"){const Ve=O.left-N.left,Se=D.left-Ve,vt=R.left-Se,Zt=R.width+vt,xo=Math.max(Zt,N.width),pn=window.innerWidth-Yr,wo=Wp(Se,[Yr,pn-xo]);a.style.minWidth=Zt+"px",a.style.left=wo+"px"}else{const Ve=N.right-O.right,Se=window.innerWidth-D.right-Ve,vt=window.innerWidth-R.right-Se,Zt=R.width+vt,xo=Math.max(Zt,N.width),pn=window.innerWidth-Yr,wo=Wp(Se,[Yr,pn-xo]);a.style.minWidth=Zt+"px",a.style.right=wo+"px"}const B=p(),A=window.innerHeight-Yr*2,H=y.scrollHeight,L=window.getComputedStyle(u),K=parseInt(L.borderTopWidth,10),ne=parseInt(L.paddingTop,10),W=parseInt(L.borderBottomWidth,10),F=parseInt(L.paddingBottom,10),M=K+ne+H+F+W,X=Math.min(S.offsetHeight*5,M),le=window.getComputedStyle(y),me=parseInt(le.paddingTop,10),rt=parseInt(le.paddingBottom,10),je=R.top+R.height/2-Yr,gt=A-je,Ue=S.offsetHeight/2,ce=S.offsetTop+Ue,De=K+ne+ce,He=M-De;if(De<=je){const Ve=S===B[B.length-1].ref.current;a.style.bottom="0px";const Se=u.clientHeight-y.offsetTop-y.offsetHeight,vt=Math.max(gt,Ue+(Ve?rt:0)+Se+W),Zt=De+vt;a.style.height=Zt+"px"}else{const Ve=S===B[0].ref.current;a.style.top="0px";const vt=Math.max(je,K+y.offsetTop+(Ve?me:0)+Ue)+He;a.style.height=vt+"px",y.scrollTop=De-je+y.offsetTop}a.style.margin=`${Yr}px 0`,a.style.minHeight=X+"px",a.style.maxHeight=A+"px",r==null||r(),requestAnimationFrame(()=>x.current=!0)}},[p,s.trigger,s.valueNode,a,u,y,S,v,s.dir,r]);Kt(()=>w(),[w]);const[b,C]=h.useState();Kt(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const _=h.useCallback(R=>{R&&g.current===!0&&(w(),m==null||m(),g.current=!1)},[w,m]);return c.jsx(QV,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:x,onScrollButtonChange:_,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:c.jsx(ve.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});iE.displayName=qV;var XV="SelectPopperPosition",Yp=h.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Yr,...s}=e,i=yf(n);return c.jsx(mg,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.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)"}})});Yp.displayName=XV;var[QV,yv]=ia(Fs,{}),Hp="SelectViewport",aE=h.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=cs(Hp,n),i=yv(Hp,n),a=be(t,s.onViewportChange),l=h.useRef(0);return c.jsxs(c.Fragment,{children:[c.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:r}),c.jsx(gf.Slot,{scope:n,children:c.jsx(ve.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"auto",...o.style},onScroll:G(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:p}=i;if(p!=null&&p.current&&f){const x=Math.abs(l.current-d.scrollTop);if(x>0){const g=window.innerHeight-Yr*2,y=parseFloat(f.style.minHeight),S=parseFloat(f.style.height),v=Math.max(y,S);if(v0?b:0,f.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});aE.displayName=Hp;var lE="SelectGroup",[JV,ez]=ia(lE),cE=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Tr();return c.jsx(JV,{scope:n,id:o,children:c.jsx(ve.div,{role:"group","aria-labelledby":o,...r,ref:t})})});cE.displayName=lE;var uE="SelectLabel",dE=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=ez(uE,n);return c.jsx(ve.div,{id:o.id,...r,ref:t})});dE.displayName=uE;var hd="SelectItem",[tz,fE]=ia(hd),hE=h.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,a=ls(hd,n),l=cs(hd,n),u=a.value===r,[d,f]=h.useState(s??""),[p,x]=h.useState(!1),g=be(t,v=>{var m;return(m=l.itemRefCallback)==null?void 0:m.call(l,v,r,o)}),y=Tr(),S=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")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 c.jsx(tz,{scope:n,value:r,disabled:o,textId:y,isSelected:u,onItemTextChange:h.useCallback(v=>{f(m=>m||((v==null?void 0:v.textContent)??"").trim())},[]),children:c.jsx(gf.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:c.jsx(ve.div,{role:"option","aria-labelledby":y,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:g,onFocus:G(i.onFocus,()=>x(!0)),onBlur:G(i.onBlur,()=>x(!1)),onPointerUp:G(i.onPointerUp,S),onPointerMove:G(i.onPointerMove,v=>{var m;o?(m=l.onItemLeave)==null||m.call(l):v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:G(i.onPointerLeave,v=>{var m;v.currentTarget===document.activeElement&&((m=l.onItemLeave)==null||m.call(l))}),onKeyDown:G(i.onKeyDown,v=>{var w;((w=l.searchRef)==null?void 0:w.current)!==""&&v.key===" "||(zV.includes(v.key)&&S(),v.key===" "&&v.preventDefault())})})})})});hE.displayName=hd;var Ma="SelectItemText",pE=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=ls(Ma,n),a=cs(Ma,n),l=fE(Ma,n),u=BV(Ma,n),[d,f]=h.useState(null),p=be(t,v=>f(v),l.onItemTextChange,v=>{var m;return(m=a.itemTextRefCallback)==null?void 0:m.call(a,v,l.value,l.disabled)}),x=d==null?void 0:d.textContent,g=h.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:x},l.value),[l.disabled,l.value,x]),{onNativeOptionAdd:y,onNativeOptionRemove:S}=u;return Kt(()=>(y(g),()=>S(g)),[y,S,g]),c.jsxs(c.Fragment,{children:[c.jsx(ve.span,{id:l.textId,...s,ref:p}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?fo.createPortal(s.children,i.valueNode):null]})});pE.displayName=Ma;var mE="SelectItemIndicator",gE=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return fE(mE,n).isSelected?c.jsx(ve.span,{"aria-hidden":!0,...r,ref:t}):null});gE.displayName=mE;var Bp="SelectScrollUpButton",vE=h.forwardRef((e,t)=>{const n=cs(Bp,e.__scopeSelect),r=yv(Bp,e.__scopeSelect),[o,s]=h.useState(!1),i=be(t,r.onScrollButtonChange);return Kt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=l.scrollTop>0;s(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?c.jsx(xE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});vE.displayName=Bp;var Gp="SelectScrollDownButton",yE=h.forwardRef((e,t)=>{const n=cs(Gp,e.__scopeSelect),r=yv(Gp,e.__scopeSelect),[o,s]=h.useState(!1),i=be(t,r.onScrollButtonChange);return Kt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?c.jsx(xE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});yE.displayName=Gp;var xE=h.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=cs("SelectScrollButton",n),i=h.useRef(null),a=vf(n),l=h.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return h.useEffect(()=>()=>l(),[l]),Kt(()=>{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]),c.jsx(ve.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:G(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:G(o.onPointerMove,()=>{var u;(u=s.onItemLeave)==null||u.call(s),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:G(o.onPointerLeave,()=>{l()})})}),nz="SelectSeparator",wE=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c.jsx(ve.div,{"aria-hidden":!0,...r,ref:t})});wE.displayName=nz;var Kp="SelectArrow",rz=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=yf(n),s=ls(Kp,n),i=cs(Kp,n);return s.open&&i.position==="popper"?c.jsx(gg,{...o,...r,ref:t}):null});rz.displayName=Kp;function SE(e){return e===""||e===void 0}var _E=h.forwardRef((e,t)=>{const{value:n,...r}=e,o=h.useRef(null),s=be(t,o),i=ov(n);return h.useEffect(()=>{const a=o.current,l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==n&&d){const f=new Event("change",{bubbles:!0});d.call(a,n),a.dispatchEvent(f)}},[i,n]),c.jsx(oc,{asChild:!0,children:c.jsx("select",{...r,ref:s,defaultValue:n})})});_E.displayName="BubbleSelect";function bE(e){const t=_t(e),n=h.useRef(""),r=h.useRef(0),o=h.useCallback(i=>{const a=n.current+i;t(a),function l(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),s=h.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function CE(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=oz(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const l=i.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function oz(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var sz=qk,kE=Qk,iz=eE,az=tE,lz=nE,EE=rE,cz=aE,uz=cE,TE=dE,RE=hE,dz=pE,fz=gE,NE=vE,PE=yE,jE=wE;const cw=sz,uw=uz,dw=iz,Zp=h.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(kE,{ref:r,className:se("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),...n,children:[t,c.jsx(az,{asChild:!0,children:c.jsx(ZS,{className:"h-4 w-4 opacity-50"})})]}));Zp.displayName=kE.displayName;const DE=h.forwardRef(({className:e,...t},n)=>c.jsx(NE,{ref:n,className:se("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(Aj,{className:"h-4 w-4"})}));DE.displayName=NE.displayName;const ME=h.forwardRef(({className:e,...t},n)=>c.jsx(PE,{ref:n,className:se("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(ZS,{className:"h-4 w-4"})}));ME.displayName=PE.displayName;const qp=h.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>c.jsx(lz,{children:c.jsxs(EE,{ref:o,className:se("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",n==="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:n,...r,children:[c.jsx(DE,{}),c.jsx(cz,{className:se("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),c.jsx(ME,{})]})}));qp.displayName=EE.displayName;const Xp=h.forwardRef(({className:e,...t},n)=>c.jsx(TE,{ref:n,className:se("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Xp.displayName=TE.displayName;const Qp=h.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(RE,{ref:r,className:se("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),...n,children:[c.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(fz,{children:c.jsx(KS,{className:"h-4 w-4"})})}),c.jsx(dz,{children:t})]}));Qp.displayName=RE.displayName;const hz=h.forwardRef(({className:e,...t},n)=>c.jsx(jE,{ref:n,className:se("-mx-1 my-1 h-px bg-muted",e),...t}));hz.displayName=jE.displayName;const Jp=new Map([["aliyun-cdn",["阿里云-CDN","/imgs/providers/aliyun.svg"]],["aliyun-oss",["阿里云-OSS","/imgs/providers/aliyun.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.png"]]]),pz=Array.from(Jp.keys()),mz=Pg,gz=jg,vz=Dg,OE=h.forwardRef(({className:e,...t},n)=>c.jsx(Zl,{ref:n,className:se("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}));OE.displayName=Zl.displayName;const AE=h.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(vz,{children:[c.jsx(OE,{}),c.jsxs(ql,{ref:r,className:se("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),...n,children:[t,c.jsxs(Gd,{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:[c.jsx(Qm,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));AE.displayName=ql.displayName;const IE=({className:e,...t})=>c.jsx("div",{className:se("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});IE.displayName="DialogHeader";const LE=h.forwardRef(({className:e,...t},n)=>c.jsx(Xl,{ref:n,className:se("text-lg font-semibold leading-none tracking-tight",e),...t}));LE.displayName=Xl.displayName;const yz=h.forwardRef(({className:e,...t},n)=>c.jsx(Ql,{ref:n,className:se("text-sm text-muted-foreground",e),...t}));yz.displayName=Ql.displayName;const Es=new Map([["tencent",["腾讯云","/imgs/providers/tencent.svg"]],["aliyun",["阿里云","/imgs/providers/aliyun.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.png"]]]),xv=Ie.union([Ie.literal("aliyun"),Ie.literal("tencent"),Ie.literal("ssh")],{message:"请选择云服务商"}),xz=({data:e,onAfterReq:t})=>{const{addAccess:n,updateAccess:r}=rc(),o=Ie.object({id:Ie.string().optional(),name:Ie.string().min(1).max(64),configType:xv,secretId:Ie.string().min(1).max(64),secretKey:Ie.string().min(1).max(64)});let s={secretId:"",secretKey:""};e&&(s=e.config);const i=ic({resolver:ac(o),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"tencent",secretId:s.secretId,secretKey:s.secretKey}}),a=async l=>{const u={id:l.id,name:l.name,configType:l.configType,config:{secretId:l.secretId,secretKey:l.secretKey}};try{const d=await rv(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,l.id){r(u);return}n(u)}catch(d){Object.entries(d.response.data).forEach(([p,x])=>{i.setError(p,{type:"manual",message:x.message})})}};return c.jsx(c.Fragment,{children:c.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:c.jsx(cc,{...i,children:c.jsxs("form",{onSubmit:l=>{l.stopPropagation(),i.handleSubmit(a)(l)},className:"space-y-8",children:[c.jsx(tt,{control:i.control,name:"name",render:({field:l})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"名称"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入授权名称",...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"id",render:({field:l})=>c.jsxs(qe,{className:"hidden",children:[c.jsx(Xe,{children:"配置类型"}),c.jsx(Qe,{children:c.jsx(ct,{...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"configType",render:({field:l})=>c.jsxs(qe,{className:"hidden",children:[c.jsx(Xe,{children:"配置类型"}),c.jsx(Qe,{children:c.jsx(ct,{...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"secretId",render:({field:l})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"SecretId"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入SecretId",...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"secretKey",render:({field:l})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"SecretKey"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入SecretKey",...l})}),c.jsx(Be,{})]})}),c.jsx("div",{className:"flex justify-end",children:c.jsx(Dt,{type:"submit",children:"保存"})})]})})})})},wz=({data:e,onAfterReq:t})=>{const{addAccess:n,updateAccess:r}=rc(),o=Ie.object({id:Ie.string().optional(),name:Ie.string().min(1).max(64),configType:xv,accessKeyId:Ie.string().min(1).max(64),accessSecretId:Ie.string().min(1).max(64)});let s={accessKeyId:"",accessKeySecret:""};e&&(s=e.config);const i=ic({resolver:ac(o),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"aliyun",accessKeyId:s.accessKeyId,accessSecretId:s.accessKeySecret}}),a=async l=>{const u={id:l.id,name:l.name,configType:l.configType,config:{accessKeyId:l.accessKeyId,accessKeySecret:l.accessSecretId}};try{const d=await rv(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,l.id){r(u);return}n(u)}catch(d){Object.entries(d.response.data).forEach(([p,x])=>{i.setError(p,{type:"manual",message:x.message})});return}};return c.jsx(c.Fragment,{children:c.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:c.jsx(cc,{...i,children:c.jsxs("form",{onSubmit:l=>{l.stopPropagation(),i.handleSubmit(a)(l)},className:"space-y-8",children:[c.jsx(tt,{control:i.control,name:"name",render:({field:l})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"名称"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入授权名称",...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"id",render:({field:l})=>c.jsxs(qe,{className:"hidden",children:[c.jsx(Xe,{children:"配置类型"}),c.jsx(Qe,{children:c.jsx(ct,{...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"configType",render:({field:l})=>c.jsxs(qe,{className:"hidden",children:[c.jsx(Xe,{children:"配置类型"}),c.jsx(Qe,{children:c.jsx(ct,{...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"accessKeyId",render:({field:l})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"AccessKeyId"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入AccessKeyId",...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"accessSecretId",render:({field:l})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"AccessKeySecret"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入AccessKeySecret",...l})}),c.jsx(Be,{})]})}),c.jsx(Be,{}),c.jsx("div",{className:"flex justify-end",children:c.jsx(Dt,{type:"submit",children:"保存"})})]})})})})};var wv="Radio",[Sz,FE]=_n(wv),[_z,bz]=Sz(wv),UE=h.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:o=!1,required:s,disabled:i,value:a="on",onCheck:l,...u}=e,[d,f]=h.useState(null),p=be(t,y=>f(y)),x=h.useRef(!1),g=d?!!d.closest("form"):!0;return c.jsxs(_z,{scope:n,checked:o,disabled:i,children:[c.jsx(ve.button,{type:"button",role:"radio","aria-checked":o,"data-state":zE(o),"data-disabled":i?"":void 0,disabled:i,value:a,...u,ref:p,onClick:G(e.onClick,y=>{o||l==null||l(),g&&(x.current=y.isPropagationStopped(),x.current||y.stopPropagation())})}),g&&c.jsx(Cz,{control:d,bubbles:!x.current,name:r,value:a,checked:o,required:s,disabled:i,style:{transform:"translateX(-100%)"}})]})});UE.displayName=wv;var $E="RadioIndicator",VE=h.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...o}=e,s=bz($E,n);return c.jsx(fn,{present:r||s.checked,children:c.jsx(ve.span,{"data-state":zE(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t})})});VE.displayName=$E;var Cz=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,s=h.useRef(null),i=ov(n),a=ug(t);return h.useEffect(()=>{const l=s.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(i!==n&&f){const p=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(p)}},[i,n,r]),c.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:s,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function zE(e){return e?"checked":"unchecked"}var kz=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Sv="RadioGroup",[Ez,f3]=_n(Sv,[zd,FE]),WE=zd(),YE=FE(),[Tz,Rz]=Ez(Sv),HE=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:o,value:s,required:i=!1,disabled:a=!1,orientation:l,dir:u,loop:d=!0,onValueChange:f,...p}=e,x=WE(n),g=Yl(u),[y,S]=so({prop:s,defaultProp:o,onChange:f});return c.jsx(Tz,{scope:n,name:r,required:i,disabled:a,value:y,onValueChange:S,children:c.jsx(O_,{asChild:!0,...x,orientation:l,dir:g,loop:d,children:c.jsx(ve.div,{role:"radiogroup","aria-required":i,"aria-orientation":l,"data-disabled":a?"":void 0,dir:g,...p,ref:t})})})});HE.displayName=Sv;var BE="RadioGroupItem",GE=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...o}=e,s=Rz(BE,n),i=s.disabled||r,a=WE(n),l=YE(n),u=h.useRef(null),d=be(t,u),f=s.value===o.value,p=h.useRef(!1);return h.useEffect(()=>{const x=y=>{kz.includes(y.key)&&(p.current=!0)},g=()=>p.current=!1;return document.addEventListener("keydown",x),document.addEventListener("keyup",g),()=>{document.removeEventListener("keydown",x),document.removeEventListener("keyup",g)}},[]),c.jsx(A_,{asChild:!0,...a,focusable:!i,active:f,children:c.jsx(UE,{disabled:i,required:s.required,checked:f,...l,...o,name:s.name,ref:d,onCheck:()=>s.onValueChange(o.value),onKeyDown:G(x=>{x.key==="Enter"&&x.preventDefault()}),onFocus:G(o.onFocus,()=>{var x;p.current&&((x=u.current)==null||x.click())})})})});GE.displayName=BE;var Nz="RadioGroupIndicator",KE=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,o=YE(n);return c.jsx(VE,{...o,...r,ref:t})});KE.displayName=Nz;var ZE=HE,qE=GE,Pz=KE;const _v=h.forwardRef(({className:e,...t},n)=>c.jsx(ZE,{className:se("grid gap-2",e),...t,ref:n}));_v.displayName=ZE.displayName;const bv=h.forwardRef(({className:e,...t},n)=>c.jsx(qE,{ref:n,className:se("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:c.jsx(Pz,{className:"flex items-center justify-center",children:c.jsx(QS,{className:"h-2.5 w-2.5 fill-current text-current"})})}));bv.displayName=qE.displayName;const XE=h.forwardRef(({className:e,...t},n)=>c.jsx("textarea",{className:se("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:n,...t}));XE.displayName="Textarea";function jz(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{r.result?t(r.result.toString()):n("No content found")},r.onerror=()=>n(r.error),r.readAsText(e)})}const Dz=({data:e,onAfterReq:t})=>{const{addAccess:n,updateAccess:r}=rc(),o=Ie.object({id:Ie.string().optional(),name:Ie.string().min(1).max(64),configType:xv,host:Ie.string().ip({message:"请输入合法的IP地址"}),port:Ie.string().min(1).max(5),username:Ie.string().min(1).max(64),password:Ie.string().min(0).max(64),key:Ie.string().min(0).max(20480),keyFile:Ie.string().optional(),command:Ie.string().min(1).max(2048),certPath:Ie.string().min(0).max(2048),keyPath:Ie.string().min(0).max(2048)});let s={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&&(s=e.config);const i=ic({resolver:ac(o),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"ssh",host:s.host,port:s.port,username:s.username,password:s.password,key:s.key,keyFile:s.keyFile,certPath:s.certPath,keyPath:s.keyPath,command:s.command}}),a=async u=>{console.log(u);const d={id:u.id,name:u.name,configType:u.configType,config:{host:u.host,port:u.port,username:u.username,password:u.password,key:u.key,command:u.command,certPath:u.certPath,keyPath:u.keyPath}};try{const f=await rv(d);if(t(),d.id=f.id,d.created=f.created,d.updated=f.updated,u.id){r(d);return}n(d)}catch(f){Object.entries(f.response.data).forEach(([x,g])=>{i.setError(x,{type:"manual",message:g.message})});return}},l=async u=>{var p;const d=(p=u.target.files)==null?void 0:p[0];if(!d)return;const f=await jz(d);i.setValue("key",f),i.setValue("keyFile","")};return c.jsx(c.Fragment,{children:c.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:c.jsx(cc,{...i,children:c.jsxs("form",{onSubmit:u=>{u.stopPropagation(),i.handleSubmit(a)(u)},className:"space-y-3",children:[c.jsx(tt,{control:i.control,name:"name",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"名称"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入授权名称",...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"id",render:({field:u})=>c.jsxs(qe,{className:"hidden",children:[c.jsx(Xe,{children:"配置类型"}),c.jsx(Qe,{children:c.jsx(ct,{...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"configType",render:({field:u})=>c.jsxs(qe,{className:"hidden",children:[c.jsx(Xe,{children:"配置类型"}),c.jsx(Qe,{children:c.jsx(ct,{...u})}),c.jsx(Be,{})]})}),c.jsxs("div",{className:"flex space-x-2",children:[c.jsx(tt,{control:i.control,name:"host",render:({field:u})=>c.jsxs(qe,{className:"grow",children:[c.jsx(Xe,{children:"服务器IP"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入Host",...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"port",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"SSH端口"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入Port",...u,type:"number"})}),c.jsx(Be,{})]})})]}),c.jsx(tt,{control:i.control,name:"username",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"用户名"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入用户名",...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"password",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"密码"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入密码",...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"key",render:({field:u})=>c.jsxs(qe,{hidden:!0,children:[c.jsx(Xe,{children:"Key(使用证书登录)"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入Key",...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"keyFile",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"Key(使用证书登录)"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入Key",...u,type:"file",onChange:l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"certPath",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"证书上传路径"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入证书上传路径",...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"keyPath",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"私钥上传路径"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入私钥上传路径",...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"command",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"Command"}),c.jsx(Qe,{children:c.jsx(XE,{placeholder:"请输入要执行的命令",...u})}),c.jsx(Be,{})]})}),c.jsx(Be,{}),c.jsx("div",{className:"flex justify-end",children:c.jsx(Dt,{type:"submit",children:"保存"})})]})})})})};function Ga({trigger:e,op:t,data:n,className:r}){const[o,s]=h.useState(!1),i=Array.from(Es.keys()),[a,l]=h.useState((n==null?void 0:n.configType)||"");let u=c.jsx(c.Fragment,{children:" "});switch(a){case"tencent":u=c.jsx(xz,{data:n,onAfterReq:()=>{s(!1)}});break;case"aliyun":u=c.jsx(wz,{data:n,onAfterReq:()=>{s(!1)}});break;case"ssh":u=c.jsx(Dz,{data:n,onAfterReq:()=>{s(!1)}});break}const d=f=>f==a?"border-primary":"";return c.jsxs(mz,{onOpenChange:s,open:o,children:[c.jsx(gz,{asChild:!0,className:se(r),children:e}),c.jsxs(AE,{className:"sm:max-w-[600px] w-full",children:[c.jsx(IE,{children:c.jsxs(LE,{children:[t=="add"?"添加":"编辑","授权"]})}),c.jsxs("div",{className:"container",children:[c.jsx(Ll,{children:"服务商"}),c.jsx(_v,{value:a,className:"flex mt-3 space-x-2",onValueChange:l,children:i.map(f=>{var p,x;return c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx(bv,{value:f,id:f,hidden:!0}),c.jsx(Ll,{htmlFor:f,children:c.jsxs("div",{className:se("flex items-center space-x-2 border p-2 rounded cursor-pointer",d(f)),children:[c.jsx("img",{src:(p=Es.get(f))==null?void 0:p[1],className:"h-6"}),c.jsx("div",{children:(x=Es.get(f))==null?void 0:x[0]})]})})]},f)})}),u]})]})]})}const Mz=()=>{const{config:{accesses:e}}=rc(),[t,n]=h.useState(),r=is();h.useEffect(()=>{const g=new URLSearchParams(r.search).get("id");g&&(async()=>{const S=await d$(g);n(S)})()},[r.search]);const o=Ie.object({id:Ie.string().optional(),domain:Ie.string().regex(new RegExp("^(?!-)[A-Za-z0-9-]{1,63}(?{t&&s.reset({id:t.id,domain:t.domain,access:t.access,targetAccess:t.targetAccess,targetType:t.targetType})},[t,s]);const[i,a]=h.useState(t?t.targetType:""),l=e.filter(x=>{if(i=="")return!0;const g=s.getValues().targetType.split("-");return x.configType===g[0]}),{toast:u}=cv(),d=as(),f=async x=>{const g={id:x.id,crontab:"0 0 * * *",domain:x.domain,access:x.access,targetAccess:x.targetAccess,targetType:x.targetType};try{await Fp(g);let y="域名编辑成功";g.id==""&&(y="域名添加成功"),u({title:"成功",description:y}),d("/")}catch(y){Object.entries(y.response.data).forEach(([v,m])=>{s.setError(v,{type:"manual",message:m.message})});return}},p=x=>s.getValues().targetType==x?"border-primary":"";return c.jsx(c.Fragment,{children:c.jsxs("div",{className:"",children:[c.jsx(dk,{}),c.jsxs("div",{className:"border-b h-10 text-muted-foreground",children:[t!=null&&t.id?"编辑":"新增","域名"]}),c.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:c.jsx(cc,{...s,children:c.jsxs("form",{onSubmit:s.handleSubmit(f),className:"space-y-8",children:[c.jsx(tt,{control:s.control,name:"domain",render:({field:x})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"域名"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入域名",...x})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:s.control,name:"access",render:({field:x})=>c.jsxs(qe,{children:[c.jsxs(Xe,{className:"flex w-full justify-between",children:[c.jsx("div",{children:"DNS 服务商授权配置"}),c.jsx(Ga,{trigger:c.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[c.jsx(fx,{size:14}),"新增"]}),op:"add"})]}),c.jsx(Qe,{children:c.jsxs(cw,{...x,value:x.value,onValueChange:g=>{s.setValue("access",g)},children:[c.jsx(Zp,{children:c.jsx(dw,{placeholder:"请选择授权配置"})}),c.jsx(qp,{children:c.jsxs(uw,{children:[c.jsx(Xp,{children:"服务商授权配置"}),e.map(g=>{var y;return c.jsx(Qp,{value:g.id,children:c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx("img",{className:"w-6",src:(y=Es.get(g.configType))==null?void 0:y[1]}),c.jsx("div",{children:g.name})]})},g.id)})]})})]})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:s.control,name:"targetType",render:({field:x})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"部署服务类型"}),c.jsx(Qe,{children:c.jsx(_v,{className:"flex mt-3 space-x-2",onValueChange:g=>{a(g),s.setValue("targetType",g)},...x,children:pz.map(g=>{var y,S;return c.jsx("div",{className:"flex items-center space-x-2",children:c.jsxs(Ll,{children:[c.jsx(bv,{value:g,id:g,hidden:!0}),c.jsxs("div",{className:se("flex items-center space-x-2 border p-2 rounded cursor-pointer",p(g)),children:[c.jsx("img",{src:(y=Jp.get(g))==null?void 0:y[1],className:"h-6"}),c.jsx("div",{children:(S=Jp.get(g))==null?void 0:S[0]})]})]})},g)})})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:s.control,name:"targetAccess",render:({field:x})=>c.jsxs(qe,{children:[c.jsxs(Xe,{className:"w-full flex justify-between",children:[c.jsx("div",{children:"部署服务商授权配置"}),c.jsx(Ga,{trigger:c.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[c.jsx(fx,{size:14}),"新增"]}),op:"add"})]}),c.jsx(Qe,{children:c.jsxs(cw,{...x,onValueChange:g=>{s.setValue("targetAccess",g)},children:[c.jsx(Zp,{children:c.jsx(dw,{placeholder:"请选择授权配置"})}),c.jsx(qp,{children:c.jsxs(uw,{children:[c.jsx(Xp,{children:"服务商授权配置"}),l.map(g=>{var y;return c.jsx(Qp,{value:g.id,children:c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx("img",{className:"w-6",src:(y=Es.get(g.configType))==null?void 0:y[1]}),c.jsx("div",{children:g.name})]})},g.id)})]})})]})}),c.jsx(Be,{})]})}),c.jsx("div",{className:"flex justify-end",children:c.jsx(Dt,{type:"submit",children:"保存"})})]})})})]})})},Oz=()=>{const{config:e,deleteAccess:t}=rc(),{accesses:n}=e,r=async o=>{const s=await z4(o);t(s.id)};return c.jsxs("div",{className:"",children:[c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("div",{className:"text-muted-foreground",children:"授权管理"}),c.jsx(Ga,{trigger:c.jsx(Dt,{children:"添加授权"}),op:"add"})]}),n.length===0?c.jsxs("div",{className:"flex flex-col items-center mt-10",children:[c.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:c.jsx(Lj,{size:40,className:"text-primary"})}),c.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加授权开始部署证书吧。"}),c.jsx(Ga,{trigger:c.jsx(Dt,{children:"添加授权"}),op:"add",className:"mt-3"})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b sm:p-2 mt-5",children:[c.jsx("div",{className:"w-48",children:"名称"}),c.jsx("div",{className:"w-48",children:"服务商"}),c.jsx("div",{className:"w-52",children:"创建时间"}),c.jsx("div",{className:"w-52",children:"更新时间"}),c.jsx("div",{className:"grow",children:"操作"})]}),c.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"授权列表"}),n.map(o=>{var s,i;return c.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b sm:p-2 hover:bg-muted/50 text-sm",children:[c.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:o.name}),c.jsxs("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center space-x-2",children:[c.jsx("img",{src:(s=Es.get(o.configType))==null?void 0:s[1],className:"w-6"}),c.jsx("div",{children:(i=Es.get(o.configType))==null?void 0:i[0]})]}),c.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["创建于 ",o.created&&_l(o.created)]}),c.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["更新于 ",o.updated&&_l(o.updated)]}),c.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[c.jsx(Ga,{trigger:c.jsx(Dt,{variant:"link",className:"p-0",children:"编辑"}),op:"edit",data:o}),c.jsx(Ht,{orientation:"vertical",className:"h-4 mx-2"}),c.jsx(Dt,{variant:"link",className:"p-0",onClick:()=>{r(o)},children:"删除"})]})]},o.id)})]})]})},Az=Wl("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"}}),QE=h.forwardRef(({className:e,variant:t,...n},r)=>c.jsx("div",{ref:r,role:"alert",className:se(Az({variant:t}),e),...n}));QE.displayName="Alert";const JE=h.forwardRef(({className:e,...t},n)=>c.jsx("h5",{ref:n,className:se("mb-1 font-medium leading-none tracking-tight",e),...t}));JE.displayName="AlertTitle";const eT=h.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:se("text-sm [&_p]:leading-relaxed",e),...t}));eT.displayName="AlertDescription";function Iz(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var Cv="ScrollArea",[tT,h3]=_n(Cv),[Lz,Kn]=tT(Cv),nT=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[a,l]=h.useState(null),[u,d]=h.useState(null),[f,p]=h.useState(null),[x,g]=h.useState(null),[y,S]=h.useState(null),[v,m]=h.useState(0),[w,b]=h.useState(0),[C,_]=h.useState(!1),[R,N]=h.useState(!1),D=be(t,B=>l(B)),O=Yl(o);return c.jsx(Lz,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:d,content:f,onContentChange:p,scrollbarX:x,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:_,scrollbarY:y,onScrollbarYChange:S,scrollbarYEnabled:R,onScrollbarYEnabledChange:N,onCornerWidthChange:m,onCornerHeightChange:b,children:c.jsx(ve.div,{dir:O,...i,ref:D,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});nT.displayName=Cv;var rT="ScrollAreaViewport",oT=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...s}=e,i=Kn(rT,n),a=h.useRef(null),l=be(t,a,i.onViewportChange);return c.jsxs(c.Fragment,{children:[c.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:o}),c.jsx(ve.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:c.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});oT.displayName=rT;var Ar="ScrollAreaScrollbar",kv=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Kn(Ar,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,a=e.orientation==="horizontal";return h.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),o.type==="hover"?c.jsx(Fz,{...r,ref:t,forceMount:n}):o.type==="scroll"?c.jsx(Uz,{...r,ref:t,forceMount:n}):o.type==="auto"?c.jsx(sT,{...r,ref:t,forceMount:n}):o.type==="always"?c.jsx(Ev,{...r,ref:t}):null});kv.displayName=Ar;var Fz=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Kn(Ar,e.__scopeScrollArea),[s,i]=h.useState(!1);return h.useEffect(()=>{const a=o.scrollArea;let l=0;if(a){const u=()=>{window.clearTimeout(l),i(!0)},d=()=>{l=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",d)}}},[o.scrollArea,o.scrollHideDelay]),c.jsx(fn,{present:n||s,children:c.jsx(sT,{"data-state":s?"visible":"hidden",...r,ref:t})})}),Uz=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Kn(Ar,e.__scopeScrollArea),s=e.orientation==="horizontal",i=wf(()=>l("SCROLL_END"),100),[a,l]=Iz("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 h.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>l("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,o.scrollHideDelay,l]),h.useEffect(()=>{const u=o.viewport,d=s?"scrollLeft":"scrollTop";if(u){let f=u[d];const p=()=>{const x=u[d];f!==x&&(l("SCROLL"),i()),f=x};return u.addEventListener("scroll",p),()=>u.removeEventListener("scroll",p)}},[o.viewport,s,l,i]),c.jsx(fn,{present:n||a!=="hidden",children:c.jsx(Ev,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:G(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:G(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),sT=h.forwardRef((e,t)=>{const n=Kn(Ar,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=h.useState(!1),a=e.orientation==="horizontal",l=wf(()=>{if(n.viewport){const u=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=Kn(Ar,e.__scopeScrollArea),s=h.useRef(null),i=h.useRef(0),[a,l]=h.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=uT(a.viewport,a.content),d={...r,sizes:a,onSizesChange:l,hasThumb:u>0&&u<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:p=>i.current=p};function f(p,x){return Hz(p,i.current,a,x)}return n==="horizontal"?c.jsx($z,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const p=o.viewport.scrollLeft,x=fw(p,a,o.dir);s.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollLeft=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollLeft=f(p,o.dir))}}):n==="vertical"?c.jsx(Vz,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const p=o.viewport.scrollTop,x=fw(p,a);s.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollTop=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollTop=f(p))}}):null}),$z=h.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=Kn(Ar,e.__scopeScrollArea),[i,a]=h.useState(),l=h.useRef(null),u=be(t,l,s.onScrollbarXChange);return h.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),c.jsx(aT,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":xf(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(s.viewport){const p=s.viewport.scrollLeft+d.deltaX;e.onWheelScroll(p),fT(p,f)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:md(i.paddingLeft),paddingEnd:md(i.paddingRight)}})}})}),Vz=h.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=Kn(Ar,e.__scopeScrollArea),[i,a]=h.useState(),l=h.useRef(null),u=be(t,l,s.onScrollbarYChange);return h.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),c.jsx(aT,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":xf(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(s.viewport){const p=s.viewport.scrollTop+d.deltaY;e.onWheelScroll(p),fT(p,f)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:md(i.paddingTop),paddingEnd:md(i.paddingBottom)}})}})}),[zz,iT]=tT(Ar),aT=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:d,onResize:f,...p}=e,x=Kn(Ar,n),[g,y]=h.useState(null),S=be(t,D=>y(D)),v=h.useRef(null),m=h.useRef(""),w=x.viewport,b=r.content-r.viewport,C=_t(d),_=_t(l),R=wf(f,10);function N(D){if(v.current){const O=D.clientX-v.current.left,B=D.clientY-v.current.top;u({x:O,y:B})}}return h.useEffect(()=>{const D=O=>{const B=O.target;(g==null?void 0:g.contains(B))&&C(O,b)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[w,g,b,C]),h.useEffect(_,[r,_]),Bi(g,R),Bi(x.content,R),c.jsx(zz,{scope:n,scrollbar:g,hasThumb:o,onThumbChange:_t(s),onThumbPointerUp:_t(i),onThumbPositionChange:_,onThumbPointerDown:_t(a),children:c.jsx(ve.div,{...p,ref:S,style:{position:"absolute",...p.style},onPointerDown:G(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),v.current=g.getBoundingClientRect(),m.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),N(D))}),onPointerMove:G(e.onPointerMove,N),onPointerUp:G(e.onPointerUp,D=>{const O=D.target;O.hasPointerCapture(D.pointerId)&&O.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=m.current,x.viewport&&(x.viewport.style.scrollBehavior=""),v.current=null})})})}),pd="ScrollAreaThumb",lT=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=iT(pd,e.__scopeScrollArea);return c.jsx(fn,{present:n||o.hasThumb,children:c.jsx(Wz,{ref:t,...r})})}),Wz=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=Kn(pd,n),i=iT(pd,n),{onThumbPositionChange:a}=i,l=be(t,f=>i.onThumbChange(f)),u=h.useRef(),d=wf(()=>{u.current&&(u.current(),u.current=void 0)},100);return h.useEffect(()=>{const f=s.viewport;if(f){const p=()=>{if(d(),!u.current){const x=Bz(f,a);u.current=x,a()}};return a(),f.addEventListener("scroll",p),()=>f.removeEventListener("scroll",p)}},[s.viewport,d,a]),c.jsx(ve.div,{"data-state":i.hasThumb?"visible":"hidden",...o,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:G(e.onPointerDownCapture,f=>{const x=f.target.getBoundingClientRect(),g=f.clientX-x.left,y=f.clientY-x.top;i.onThumbPointerDown({x:g,y})}),onPointerUp:G(e.onPointerUp,i.onThumbPointerUp)})});lT.displayName=pd;var Tv="ScrollAreaCorner",cT=h.forwardRef((e,t)=>{const n=Kn(Tv,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?c.jsx(Yz,{...e,ref:t}):null});cT.displayName=Tv;var Yz=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=Kn(Tv,n),[s,i]=h.useState(0),[a,l]=h.useState(0),u=!!(s&&a);return Bi(o.scrollbarX,()=>{var f;const d=((f=o.scrollbarX)==null?void 0:f.offsetHeight)||0;o.onCornerHeightChange(d),l(d)}),Bi(o.scrollbarY,()=>{var f;const d=((f=o.scrollbarY)==null?void 0:f.offsetWidth)||0;o.onCornerWidthChange(d),i(d)}),u?c.jsx(ve.div,{...r,ref:t,style:{width:s,height:a,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function md(e){return e?parseInt(e,10):0}function uT(e,t){const n=e/t;return isNaN(n)?0:n}function xf(e){const t=uT(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function Hz(e,t,n,r="ltr"){const o=xf(n),s=o/2,i=t||s,a=o-i,l=n.scrollbar.paddingStart+i,u=n.scrollbar.size-n.scrollbar.paddingEnd-a,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return dT([l,u],f)(e)}function fw(e,t,n="ltr"){const r=xf(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,a=s-r,l=n==="ltr"?[0,i]:[i*-1,0],u=Wp(e,l);return dT([0,i],[0,a])(u)}function dT(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function fT(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,a=n.top!==s.top;(i||a)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function wf(e,t){const n=_t(e),r=h.useRef(0);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),h.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Bi(e,t){const n=_t(t);Kt(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}var hT=nT,Gz=oT,Kz=cT;const pT=h.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(hT,{ref:r,className:se("relative overflow-hidden",e),...n,children:[c.jsx(Gz,{className:"h-full w-full rounded-[inherit]",children:t}),c.jsx(mT,{}),c.jsx(Kz,{})]}));pT.displayName=hT.displayName;const mT=h.forwardRef(({className:e,orientation:t="vertical",...n},r)=>c.jsx(kv,{ref:r,orientation:t,className:se("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),...n,children:c.jsx(lT,{className:"relative flex-1 rounded-full bg-border"})}));mT.displayName=kv.displayName;const Zz=async e=>{let t=1;e.page&&(t=e.page);let n=50;e.perPage&&(n=e.perPage);let r="domain!=null";return e.domain&&(r=`domain="${e.domain}"`),await Vt().collection("deployments").getList(t,n,{filter:r,sort:"-deployedAt",expand:"domain"})},qz=()=>{const e=as(),[t,n]=h.useState(),[r]=Pj(),o=r.get("domain");return h.useEffect(()=>{(async()=>{const i={};o&&(i.domain=o);const a=await Zz(i);n(a.items)})()},[o]),c.jsxs(pT,{className:"h-[80vh] overflow-hidden",children:[c.jsx("div",{className:"text-muted-foreground",children:"部署历史"}),t!=null&&t.length?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b sm:p-2 mt-5",children:[c.jsx("div",{className:"w-48",children:"域名"}),c.jsx("div",{className:"w-24",children:"状态"}),c.jsx("div",{className:"w-56",children:"阶段"}),c.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),c.jsx("div",{className:"grow",children:"操作"})]}),c.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),t==null?void 0:t.map(s=>{var i,a;return c.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b sm:p-2 hover:bg-muted/50 text-sm",children:[c.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(i=s.expand.domain)==null?void 0:i.domain}),c.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:s.phase==="deploy"&&s.phaseSuccess?c.jsx(qS,{size:16,className:"text-green-700"}):c.jsx(XS,{size:16,className:"text-red-700"})}),c.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:c.jsx(aC,{phase:s.phase,phaseSuccess:s.phaseSuccess})}),c.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:_l(s.deployedAt)}),c.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:c.jsxs(o1,{children:[c.jsx(s1,{asChild:!0,children:c.jsx(Dt,{variant:"link",className:"p-0",children:"日志"})}),c.jsxs(Mg,{className:"sm:max-w-5xl",children:[c.jsx(a1,{children:c.jsxs(l1,{children:[(a=s.expand.domain)==null?void 0:a.domain,"-",s.id,"部署详情"]})}),c.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[s.log.check&&c.jsx(c.Fragment,{children:s.log.check.map(l=>c.jsxs("div",{className:"flex flex-col mt-2",children:[c.jsxs("div",{className:"flex",children:[c.jsxs("div",{children:["[",l.time,"]"]}),c.jsx("div",{className:"ml-2",children:l.message})]}),l.error&&c.jsx("div",{className:"mt-1 text-red-600",children:l.error})]}))}),s.log.apply&&c.jsx(c.Fragment,{children:s.log.apply.map(l=>c.jsxs("div",{className:"flex flex-col mt-2",children:[c.jsxs("div",{className:"flex",children:[c.jsxs("div",{children:["[",l.time,"]"]}),c.jsx("div",{className:"ml-2",children:l.message})]}),l.error&&c.jsx("div",{className:"mt-1 text-red-600",children:l.error})]}))}),s.log.deploy&&c.jsx(c.Fragment,{children:s.log.deploy.map(l=>c.jsxs("div",{className:"flex flex-col mt-2",children:[c.jsxs("div",{className:"flex",children:[c.jsxs("div",{children:["[",l.time,"]"]}),c.jsx("div",{className:"ml-2",children:l.message})]}),l.error&&c.jsx("div",{className:"mt-1 text-red-600",children:l.error})]}))})]})]})]})})]},s.id)})]}):c.jsx(c.Fragment,{children:c.jsxs(QE,{className:"max-w-[40em] mx-auto mt-20",children:[c.jsx(JE,{children:"暂无数据"}),c.jsxs(eT,{children:[c.jsxs("div",{className:"flex items-center mt-5",children:[c.jsx("div",{children:c.jsx(Uj,{className:"text-yellow-400",size:36})}),c.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),c.jsx("div",{className:"mt-2 flex justify-end",children:c.jsx(Dt,{onClick:()=>{e("/")},children:"添加域名"})})]})]})})]})},Xz=e=>e instanceof Error?e.message:typeof e=="object"&&e!==null&&"message"in e?String(e.message):typeof e=="string"?e:"Something went wrong",Qz=Ie.object({username:Ie.string().email({message:"请输入正确的邮箱地址"}),password:Ie.string().min(10,{message:"密码至少10个字符"})}),Jz=()=>{const e=ic({resolver:ac(Qz),defaultValues:{username:"",password:""}}),t=async r=>{try{await Vt().admins.authWithPassword(r.username,r.password),n("/")}catch(o){const s=Xz(o);e.setError("username",{message:s}),e.setError("password",{message:s})}},n=as();return c.jsxs("div",{className:"max-w-[35em] border mx-auto mt-32 p-10 rounded-md shadow-md",children:[c.jsx("div",{className:"flex justify-center mb-10",children:c.jsx("img",{src:"/vite.svg",className:"w-16"})}),c.jsx(cc,{...e,children:c.jsxs("form",{onSubmit:e.handleSubmit(t),className:"space-y-8",children:[c.jsx(tt,{control:e.control,name:"username",render:({field:r})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"用户名"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"email",...r})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:e.control,name:"password",render:({field:r})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"密码"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"shadcn",...r,type:"password"})}),c.jsx(Be,{})]})}),c.jsx("div",{className:"flex justify-end",children:c.jsx(Dt,{type:"submit",children:"登录"})})]})})]})},e3=()=>Vt().authStore.isValid&&Vt().authStore.isAdmin?c.jsx(HS,{to:"/"}):c.jsx("div",{className:"container",children:c.jsx(BS,{})}),t3=mj([{path:"/",element:c.jsx(H4,{}),children:[{path:"/",element:c.jsx(m$,{})},{path:"/edit",element:c.jsx(Mz,{})},{path:"/access",element:c.jsx(Oz,{})},{path:"/history",element:c.jsx(qz,{})}]},{path:"/login",element:c.jsx(e3,{}),children:[{path:"/login",element:c.jsx(Jz,{})}]},{path:"/about",element:c.jsx("div",{children:"About"})}]);Sh.createRoot(document.getElementById("root")).render(c.jsx(Oe.StrictMode,{children:c.jsx(Cj,{router:t3})}))});export default n3(); +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return h.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},oU=cC,sU=uC,iU=dC,SC=fC,_C=hC,bC=yC,CC=wC,kC=mC,EC=vC;const aU=oU,lU=sU,cU=iU,TC=h.forwardRef(({className:e,...t},n)=>c.jsx(SC,{className:se("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:n}));TC.displayName=SC.displayName;const RC=h.forwardRef(({className:e,...t},n)=>c.jsxs(cU,{children:[c.jsx(TC,{}),c.jsx(_C,{ref:n,className:se("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})]}));RC.displayName=_C.displayName;const NC=({className:e,...t})=>c.jsx("div",{className:se("flex flex-col space-y-2 text-center sm:text-left",e),...t});NC.displayName="AlertDialogHeader";const PC=({className:e,...t})=>c.jsx("div",{className:se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});PC.displayName="AlertDialogFooter";const jC=h.forwardRef(({className:e,...t},n)=>c.jsx(kC,{ref:n,className:se("text-lg font-semibold",e),...t}));jC.displayName=kC.displayName;const DC=h.forwardRef(({className:e,...t},n)=>c.jsx(EC,{ref:n,className:se("text-sm text-muted-foreground",e),...t}));DC.displayName=EC.displayName;const MC=h.forwardRef(({className:e,...t},n)=>c.jsx(bC,{ref:n,className:se(tg(),e),...t}));MC.displayName=bC.displayName;const OC=h.forwardRef(({className:e,...t},n)=>c.jsx(CC,{ref:n,className:se(tg({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));OC.displayName=CC.displayName;function ov(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var sv="Switch",[uU,a3]=_n(sv),[dU,fU]=uU(sv),AC=h.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:s,required:i,disabled:a,value:l="on",onCheckedChange:u,...d}=e,[f,p]=h.useState(null),x=be(t,m=>p(m)),g=h.useRef(!1),y=f?!!f.closest("form"):!0,[S=!1,v]=so({prop:o,defaultProp:s,onChange:u});return c.jsxs(dU,{scope:n,checked:S,disabled:a,children:[c.jsx(ve.button,{type:"button",role:"switch","aria-checked":S,"aria-required":i,"data-state":FC(S),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:x,onClick:G(e.onClick,m=>{v(w=>!w),y&&(g.current=m.isPropagationStopped(),g.current||m.stopPropagation())})}),y&&c.jsx(hU,{control:f,bubbles:!g.current,name:r,value:l,checked:S,required:i,disabled:a,style:{transform:"translateX(-100%)"}})]})});AC.displayName=sv;var IC="SwitchThumb",LC=h.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=fU(IC,n);return c.jsx(ve.span,{"data-state":FC(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});LC.displayName=IC;var hU=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,s=h.useRef(null),i=ov(n),a=ug(t);return h.useEffect(()=>{const l=s.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(i!==n&&f){const p=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(p)}},[i,n,r]),c.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:s,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function FC(e){return e?"checked":"unchecked"}var UC=AC,pU=LC;const $C=h.forwardRef(({className:e,...t},n)=>c.jsx(UC,{className:se("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:n,children:c.jsx(pU,{className:se("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")})}));$C.displayName=UC.displayName;var mU="VisuallyHidden",oc=h.forwardRef((e,t)=>c.jsx(ve.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}}));oc.displayName=mU;var gU=oc,iv="ToastProvider",[av,vU,yU]=Ld("Toast"),[VC,l3]=_n("Toast",[yU]),[xU,sf]=VC(iv),zC=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:s=50,children:i}=e,[a,l]=h.useState(null),[u,d]=h.useState(0),f=h.useRef(!1),p=h.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${iv}\`. Expected non-empty \`string\`.`),c.jsx(av.Provider,{scope:t,children:c.jsx(xU,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:s,toastCount:u,viewport:a,onViewportChange:l,onToastAdd:h.useCallback(()=>d(x=>x+1),[]),onToastRemove:h.useCallback(()=>d(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:p,children:i})})};zC.displayName=iv;var WC="ToastViewport",wU=["F8"],Mp="toast.viewportPause",Op="toast.viewportResume",YC=h.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=wU,label:o="Notifications ({hotkey})",...s}=e,i=sf(WC,n),a=vU(n),l=h.useRef(null),u=h.useRef(null),d=h.useRef(null),f=h.useRef(null),p=be(t,f,i.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),g=i.toastCount>0;h.useEffect(()=>{const S=v=>{var w;r.every(b=>v[b]||v.code===b)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[r]),h.useEffect(()=>{const S=l.current,v=f.current;if(g&&S&&v){const m=()=>{if(!i.isClosePausedRef.current){const _=new CustomEvent(Mp);v.dispatchEvent(_),i.isClosePausedRef.current=!0}},w=()=>{if(i.isClosePausedRef.current){const _=new CustomEvent(Op);v.dispatchEvent(_),i.isClosePausedRef.current=!1}},b=_=>{!S.contains(_.relatedTarget)&&w()},C=()=>{S.contains(document.activeElement)||w()};return S.addEventListener("focusin",m),S.addEventListener("focusout",b),S.addEventListener("pointermove",m),S.addEventListener("pointerleave",C),window.addEventListener("blur",m),window.addEventListener("focus",w),()=>{S.removeEventListener("focusin",m),S.removeEventListener("focusout",b),S.removeEventListener("pointermove",m),S.removeEventListener("pointerleave",C),window.removeEventListener("blur",m),window.removeEventListener("focus",w)}}},[g,i.isClosePausedRef]);const y=h.useCallback(({tabbingDirection:S})=>{const m=a().map(w=>{const b=w.ref.current,C=[b,...MU(b)];return S==="forwards"?C:C.reverse()});return(S==="forwards"?m.reverse():m).flat()},[a]);return h.useEffect(()=>{const S=f.current;if(S){const v=m=>{var C,_,R;const w=m.altKey||m.ctrlKey||m.metaKey;if(m.key==="Tab"&&!w){const N=document.activeElement,D=m.shiftKey;if(m.target===S&&D){(C=u.current)==null||C.focus();return}const A=y({tabbingDirection:D?"backwards":"forwards"}),H=A.findIndex(L=>L===N);ph(A.slice(H+1))?m.preventDefault():D?(_=u.current)==null||_.focus():(R=d.current)==null||R.focus()}};return S.addEventListener("keydown",v),()=>S.removeEventListener("keydown",v)}},[a,y]),c.jsxs(LD,{ref:l,role:"region","aria-label":o.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:g?void 0:"none"},children:[g&&c.jsx(Ap,{ref:u,onFocusFromOutsideViewport:()=>{const S=y({tabbingDirection:"forwards"});ph(S)}}),c.jsx(av.Slot,{scope:n,children:c.jsx(ve.ol,{tabIndex:-1,...s,ref:p})}),g&&c.jsx(Ap,{ref:d,onFocusFromOutsideViewport:()=>{const S=y({tabbingDirection:"backwards"});ph(S)}})]})});YC.displayName=WC;var HC="ToastFocusProxy",Ap=h.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,s=sf(HC,n);return c.jsx(oc,{"aria-hidden":!0,tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const a=i.relatedTarget;!((u=s.viewport)!=null&&u.contains(a))&&r()}})});Ap.displayName=HC;var af="Toast",SU="toast.swipeStart",_U="toast.swipeMove",bU="toast.swipeCancel",CU="toast.swipeEnd",BC=h.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:s,...i}=e,[a=!0,l]=so({prop:r,defaultProp:o,onChange:s});return c.jsx(fn,{present:n||a,children:c.jsx(TU,{open:a,...i,ref:t,onClose:()=>l(!1),onPause:_t(e.onPause),onResume:_t(e.onResume),onSwipeStart:G(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:G(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:G(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:G(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`),l(!1)})})})});BC.displayName=af;var[kU,EU]=VC(af,{onClose(){}}),TU=h.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:s,onClose:i,onEscapeKeyDown:a,onPause:l,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:p,onSwipeEnd:x,...g}=e,y=sf(af,n),[S,v]=h.useState(null),m=be(t,L=>v(L)),w=h.useRef(null),b=h.useRef(null),C=o||y.duration,_=h.useRef(0),R=h.useRef(C),N=h.useRef(0),{onToastAdd:D,onToastRemove:O}=y,B=_t(()=>{var K;(S==null?void 0:S.contains(document.activeElement))&&((K=y.viewport)==null||K.focus()),i()}),A=h.useCallback(L=>{!L||L===1/0||(window.clearTimeout(N.current),_.current=new Date().getTime(),N.current=window.setTimeout(B,L))},[B]);h.useEffect(()=>{const L=y.viewport;if(L){const K=()=>{A(R.current),u==null||u()},ne=()=>{const W=new Date().getTime()-_.current;R.current=R.current-W,window.clearTimeout(N.current),l==null||l()};return L.addEventListener(Mp,ne),L.addEventListener(Op,K),()=>{L.removeEventListener(Mp,ne),L.removeEventListener(Op,K)}}},[y.viewport,C,l,u,A]),h.useEffect(()=>{s&&!y.isClosePausedRef.current&&A(C)},[s,C,y.isClosePausedRef,A]),h.useEffect(()=>(D(),()=>O()),[D,O]);const H=h.useMemo(()=>S?JC(S):null,[S]);return y.viewport?c.jsxs(c.Fragment,{children:[H&&c.jsx(RU,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:H}),c.jsx(kU,{scope:n,onClose:B,children:fo.createPortal(c.jsx(av.ItemSlot,{scope:n,children:c.jsx(ID,{asChild:!0,onEscapeKeyDown:G(a,()=>{y.isFocusedToastEscapeKeyDownRef.current||B(),y.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(ve.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":y.swipeDirection,...g,ref:m,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:G(e.onKeyDown,L=>{L.key==="Escape"&&(a==null||a(L.nativeEvent),L.nativeEvent.defaultPrevented||(y.isFocusedToastEscapeKeyDownRef.current=!0,B()))}),onPointerDown:G(e.onPointerDown,L=>{L.button===0&&(w.current={x:L.clientX,y:L.clientY})}),onPointerMove:G(e.onPointerMove,L=>{if(!w.current)return;const K=L.clientX-w.current.x,ne=L.clientY-w.current.y,W=!!b.current,F=["left","right"].includes(y.swipeDirection),M=["left","up"].includes(y.swipeDirection)?Math.min:Math.max,X=F?M(0,K):0,le=F?0:M(0,ne),me=L.pointerType==="touch"?10:2,rt={x:X,y:le},je={originalEvent:L,delta:rt};W?(b.current=rt,Bc(_U,f,je,{discrete:!1})):qx(rt,y.swipeDirection,me)?(b.current=rt,Bc(SU,d,je,{discrete:!1}),L.target.setPointerCapture(L.pointerId)):(Math.abs(K)>me||Math.abs(ne)>me)&&(w.current=null)}),onPointerUp:G(e.onPointerUp,L=>{const K=b.current,ne=L.target;if(ne.hasPointerCapture(L.pointerId)&&ne.releasePointerCapture(L.pointerId),b.current=null,w.current=null,K){const W=L.currentTarget,F={originalEvent:L,delta:K};qx(K,y.swipeDirection,y.swipeThreshold)?Bc(CU,x,F,{discrete:!0}):Bc(bU,p,F,{discrete:!0}),W.addEventListener("click",M=>M.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null}),RU=e=>{const{__scopeToast:t,children:n,...r}=e,o=sf(af,t),[s,i]=h.useState(!1),[a,l]=h.useState(!1);return jU(()=>i(!0)),h.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:c.jsx(Bl,{asChild:!0,children:c.jsx(oc,{...r,children:s&&c.jsxs(c.Fragment,{children:[o.label," ",n]})})})},NU="ToastTitle",GC=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(ve.div,{...r,ref:t})});GC.displayName=NU;var PU="ToastDescription",KC=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(ve.div,{...r,ref:t})});KC.displayName=PU;var ZC="ToastAction",qC=h.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(QC,{altText:n,asChild:!0,children:c.jsx(lv,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${ZC}\`. Expected non-empty \`string\`.`),null)});qC.displayName=ZC;var XC="ToastClose",lv=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=EU(XC,n);return c.jsx(QC,{asChild:!0,children:c.jsx(ve.button,{type:"button",...r,ref:t,onClick:G(e.onClick,o.onClose)})})});lv.displayName=XC;var QC=h.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return c.jsx(ve.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function JC(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),DU(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!o)if(s){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...JC(r))}}),t}function Bc(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ng(o,s):o.dispatchEvent(s)}var qx=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),s=r>o;return t==="left"||t==="right"?s&&r>n:!s&&o>n};function jU(e=()=>{}){const t=_t(e);Kt(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function DU(e){return e.nodeType===e.ELEMENT_NODE}function MU(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ph(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var OU=zC,ek=YC,tk=BC,nk=GC,rk=KC,ok=qC,sk=lv;const AU=OU,ik=h.forwardRef(({className:e,...t},n)=>c.jsx(ek,{ref:n,className:se("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}));ik.displayName=ek.displayName;const IU=Wl("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"}}),ak=h.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(tk,{ref:r,className:se(IU({variant:t}),e),...n}));ak.displayName=tk.displayName;const LU=h.forwardRef(({className:e,...t},n)=>c.jsx(ok,{ref:n,className:se("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}));LU.displayName=ok.displayName;const lk=h.forwardRef(({className:e,...t},n)=>c.jsx(sk,{ref:n,className:se("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:c.jsx(Qm,{className:"h-4 w-4"})}));lk.displayName=sk.displayName;const ck=h.forwardRef(({className:e,...t},n)=>c.jsx(nk,{ref:n,className:se("text-sm font-semibold",e),...t}));ck.displayName=nk.displayName;const uk=h.forwardRef(({className:e,...t},n)=>c.jsx(rk,{ref:n,className:se("text-sm opacity-90",e),...t}));uk.displayName=rk.displayName;const FU=1,UU=1e6;let mh=0;function $U(){return mh=(mh+1)%Number.MAX_SAFE_INTEGER,mh.toString()}const gh=new Map,Xx=e=>{if(gh.has(e))return;const t=setTimeout(()=>{gh.delete(e),Ya({type:"REMOVE_TOAST",toastId:e})},UU);gh.set(e,t)},VU=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,FU)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?Xx(n):e.toasts.forEach(r=>{Xx(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},hu=[];let pu={toasts:[]};function Ya(e){pu=VU(pu,e),hu.forEach(t=>{t(pu)})}function zU({...e}){const t=$U(),n=o=>Ya({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>Ya({type:"DISMISS_TOAST",toastId:t});return Ya({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}function cv(){const[e,t]=h.useState(pu);return h.useEffect(()=>(hu.push(t),()=>{const n=hu.indexOf(t);n>-1&&hu.splice(n,1)}),[e]),{...e,toast:zU,dismiss:n=>Ya({type:"DISMISS_TOAST",toastId:n})}}function dk(){const{toasts:e}=cv();return c.jsxs(AU,{children:[e.map(function({id:t,title:n,description:r,action:o,...s}){return c.jsxs(ak,{...s,children:[c.jsxs("div",{className:"grid gap-1",children:[n&&c.jsx(ck,{children:n}),r&&c.jsx(uk,{children:r})]}),o,c.jsx(lk,{})]},t)}),c.jsx(ik,{})]})}var[lf,c3]=_n("Tooltip",[na]),cf=na(),fk="TooltipProvider",WU=700,Ip="tooltip.open",[YU,uv]=lf(fk),hk=e=>{const{__scopeTooltip:t,delayDuration:n=WU,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,[i,a]=h.useState(!0),l=h.useRef(!1),u=h.useRef(0);return h.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),c.jsx(YU,{scope:t,isOpenDelayed:i,delayDuration:n,onOpen:h.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:h.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:h.useCallback(d=>{l.current=d},[]),disableHoverableContent:o,children:s})};hk.displayName=fk;var uf="Tooltip",[HU,df]=lf(uf),pk=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:s,disableHoverableContent:i,delayDuration:a}=e,l=uv(uf,e.__scopeTooltip),u=cf(t),[d,f]=h.useState(null),p=Tr(),x=h.useRef(0),g=i??l.disableHoverableContent,y=a??l.delayDuration,S=h.useRef(!1),[v=!1,m]=so({prop:r,defaultProp:o,onChange:R=>{R?(l.onOpen(),document.dispatchEvent(new CustomEvent(Ip))):l.onClose(),s==null||s(R)}}),w=h.useMemo(()=>v?S.current?"delayed-open":"instant-open":"closed",[v]),b=h.useCallback(()=>{window.clearTimeout(x.current),S.current=!1,m(!0)},[m]),C=h.useCallback(()=>{window.clearTimeout(x.current),m(!1)},[m]),_=h.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{S.current=!0,m(!0)},y)},[y,m]);return h.useEffect(()=>()=>window.clearTimeout(x.current),[]),c.jsx(hg,{...u,children:c.jsx(HU,{scope:t,contentId:p,open:v,stateAttribute:w,trigger:d,onTriggerChange:f,onTriggerEnter:h.useCallback(()=>{l.isOpenDelayed?_():b()},[l.isOpenDelayed,_,b]),onTriggerLeave:h.useCallback(()=>{g?C():window.clearTimeout(x.current)},[C,g]),onOpen:b,onClose:C,disableHoverableContent:g,children:n})})};pk.displayName=uf;var Lp="TooltipTrigger",mk=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=df(Lp,n),s=uv(Lp,n),i=cf(n),a=h.useRef(null),l=be(t,a,o.onTriggerChange),u=h.useRef(!1),d=h.useRef(!1),f=h.useCallback(()=>u.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),c.jsx(pg,{asChild:!0,...i,children:c.jsx(ve.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:G(e.onPointerMove,p=>{p.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:G(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:G(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:G(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:G(e.onBlur,o.onClose),onClick:G(e.onClick,o.onClose)})})});mk.displayName=Lp;var BU="TooltipPortal",[u3,GU]=lf(BU,{forceMount:void 0}),zi="TooltipContent",dv=h.forwardRef((e,t)=>{const n=GU(zi,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=df(zi,e.__scopeTooltip);return c.jsx(fn,{present:r||i.open,children:i.disableHoverableContent?c.jsx(gk,{side:o,...s,ref:t}):c.jsx(KU,{side:o,...s,ref:t})})}),KU=h.forwardRef((e,t)=>{const n=df(zi,e.__scopeTooltip),r=uv(zi,e.__scopeTooltip),o=h.useRef(null),s=be(t,o),[i,a]=h.useState(null),{trigger:l,onClose:u}=n,d=o.current,{onPointerInTransitChange:f}=r,p=h.useCallback(()=>{a(null),f(!1)},[f]),x=h.useCallback((g,y)=>{const S=g.currentTarget,v={x:g.clientX,y:g.clientY},m=QU(v,S.getBoundingClientRect()),w=JU(v,m),b=e$(y.getBoundingClientRect()),C=n$([...w,...b]);a(C),f(!0)},[f]);return h.useEffect(()=>()=>p(),[p]),h.useEffect(()=>{if(l&&d){const g=S=>x(S,d),y=S=>x(S,l);return l.addEventListener("pointerleave",g),d.addEventListener("pointerleave",y),()=>{l.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",y)}}},[l,d,x,p]),h.useEffect(()=>{if(i){const g=y=>{const S=y.target,v={x:y.clientX,y:y.clientY},m=(l==null?void 0:l.contains(S))||(d==null?void 0:d.contains(S)),w=!t$(v,i);m?p():w&&(p(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[l,d,i,u,p]),c.jsx(gk,{...e,ref:s})}),[ZU,qU]=lf(uf,{isInside:!1}),gk=h.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,l=df(zi,n),u=cf(n),{onClose:d}=l;return h.useEffect(()=>(document.addEventListener(Ip,d),()=>document.removeEventListener(Ip,d)),[d]),h.useEffect(()=>{if(l.trigger){const f=p=>{const x=p.target;x!=null&&x.contains(l.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,d]),c.jsx(Ji,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:c.jsxs(mg,{"data-state":l.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:[c.jsx(Jm,{children:r}),c.jsx(ZU,{scope:n,isInside:!0,children:c.jsx(gU,{id:l.contentId,role:"tooltip",children:o||r})})]})})});dv.displayName=zi;var vk="TooltipArrow",XU=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=cf(n);return qU(vk,n).isInside?null:c.jsx(gg,{...o,...r,ref:t})});XU.displayName=vk;function QU(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function JU(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function e$(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function t$(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;sr!=d>r&&n<(u-a)*(r-l)/(d-l)+a&&(o=!o)}return o}function n$(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),r$(t)}function r$(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var o$=pk,s$=mk,yk=dv;const i$=o$,a$=s$,l$=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>c.jsx(yk,{ref:r,sideOffset:t,className:se("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),...n}));l$.displayName=yk.displayName;const _l=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)},c$=e=>_l(e).split(" ")[0],u$=async()=>Vt().collection("domains").getFullList({sort:"-created",expand:"lastDeployment"}),d$=async e=>await Vt().collection("domains").getOne(e),Fp=async e=>e.id?await Vt().collection("domains").update(e.id,e):await Vt().collection("domains").create(e),f$=async e=>await Vt().collection("domains").delete(e),h$=(e,t)=>Vt().collection("domains").subscribe(e,n=>{n.action==="update"&&t(n.record)},{expand:"lastDeployment"}),p$=e=>{Vt().collection("domains").unsubscribe(e)},m$=()=>{const e=cv(),t=as(),n=()=>{t("/edit")},r=d=>{t(`/edit?id=${d}`)},o=d=>{t(`/history?domain=${d}`)},s=async d=>{try{await f$(d),a(i.filter(f=>f.id!==d))}catch(f){console.error("Error deleting domain:",f)}},[i,a]=h.useState([]);h.useEffect(()=>{(async()=>{const f=await u$();a(f)})()},[]);const l=async d=>{const f=i.filter(y=>y.id===d),p=f[0].enabled,x=f[0];x.enabled=!p,await Fp(x);const g=i.map(y=>y.id===d?{...y,checked:!p}:y);a(g)},u=async d=>{try{p$(d.id),h$(d.id,f=>{console.log(f);const p=i.map(x=>x.id===f.id?{...f}:x);a(p)}),d.rightnow=!0,await Fp(d),e.toast({title:"操作成功",description:"已发起部署,请稍后查看部署日志。"})}catch{e.toast({title:"执行失败",description:c.jsxs(c.Fragment,{children:["执行失败,请查看",c.jsx($r,{to:`/history?domain=${d.id}`,className:"underline text-blue-500",children:"部署日志"}),"查看详情。"]}),variant:"destructive"})}};return c.jsx(c.Fragment,{children:c.jsxs("div",{className:"",children:[c.jsx(dk,{}),c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("div",{className:"text-muted-foreground",children:"域名列表"}),c.jsx(Dt,{onClick:n,children:"新增域名"})]}),i.length?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b sm:p-2 mt-5",children:[c.jsx("div",{className:"w-40",children:"域名"}),c.jsx("div",{className:"w-48",children:"有效期限"}),c.jsx("div",{className:"w-32",children:"最近执行状态"}),c.jsx("div",{className:"w-64",children:"最近执行阶段"}),c.jsx("div",{className:"w-40 sm:ml-2",children:"最近执行时间"}),c.jsx("div",{className:"w-32",children:"是否启用"}),c.jsx("div",{className:"grow",children:"操作"})]}),c.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"域名"}),i.map(d=>{var f,p,x,g,y,S;return c.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b sm:p-2 hover:bg-muted/50 text-sm",children:[c.jsx("div",{className:"sm:w-40 w-full pt-1 sm:pt-0 flex items-center",children:d.domain}),c.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:c.jsx("div",{children:d.expiredAt?c.jsxs(c.Fragment,{children:[c.jsx("div",{children:"有效期90天"}),c.jsxs("div",{children:[c$(d.expiredAt),"到期"]})]}):"---"})}),c.jsx("div",{className:"sm:w-32 w-full pt-1 sm:pt-0 flex items-center",children:d.lastDeployedAt&&((f=d.expand)!=null&&f.lastDeployment)?c.jsx(c.Fragment,{children:((p=d.expand.lastDeployment)==null?void 0:p.phase)==="deploy"&&((x=d.expand.lastDeployment)!=null&&x.phaseSuccess)?c.jsx(qS,{size:16,className:"text-green-700"}):c.jsx(XS,{size:16,className:"text-red-700"})}):"---"}),c.jsx("div",{className:"sm:w-64 w-full pt-1 sm:pt-0 flex items-center",children:d.lastDeployedAt&&((g=d.expand)!=null&&g.lastDeployment)?c.jsx(aC,{phase:(y=d.expand.lastDeployment)==null?void 0:y.phase,phaseSuccess:(S=d.expand.lastDeployment)==null?void 0:S.phaseSuccess}):"---"}),c.jsx("div",{className:"sm:w-40 pt-1 sm:pt-0 sm:ml-2 flex items-center",children:d.lastDeployedAt?_l(d.lastDeployedAt):"---"}),c.jsx("div",{className:"sm:w-32 flex items-center",children:c.jsx(hk,{children:c.jsxs(i$,{children:[c.jsx(a$,{children:c.jsx($C,{checked:d.enabled,onCheckedChange:()=>{l(d.id)}})}),c.jsx(dv,{children:c.jsx("div",{className:"border rounded-sm px-3 bg-background text-muted-foreground text-xs",children:d.enabled?"禁用":"启用"})})]})})}),c.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[c.jsx(Dt,{variant:"link",className:"p-0",onClick:()=>o(d.id),children:"部署历史"}),c.jsxs(Z4,{when:!!d.enabled,children:[c.jsx(Ht,{orientation:"vertical",className:"h-4 mx-2"}),c.jsx(Dt,{variant:"link",className:"p-0",onClick:()=>u(d),children:"立即部署"})]}),!d.enabled&&c.jsxs(c.Fragment,{children:[c.jsx(Ht,{orientation:"vertical",className:"h-4 mx-2"}),c.jsxs(aU,{children:[c.jsx(lU,{asChild:!0,children:c.jsx(Dt,{variant:"link",className:"p-0",children:"删除"})}),c.jsxs(RC,{children:[c.jsxs(NC,{children:[c.jsx(jC,{children:"删除域名"}),c.jsx(DC,{children:"确定要删除域名吗?"})]}),c.jsxs(PC,{children:[c.jsx(OC,{children:"取消"}),c.jsx(MC,{onClick:()=>{s(d.id)},children:"确认"})]})]})]}),c.jsx(Ht,{orientation:"vertical",className:"h-4 mx-2"}),c.jsx(Dt,{variant:"link",className:"p-0",onClick:()=>r(d.id),children:"编辑"})]})]})]},d.id)})]}):c.jsx(c.Fragment,{children:c.jsxs("div",{className:"flex flex-col items-center mt-10",children:[c.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:c.jsx(vp,{size:40,className:"text-primary"})}),c.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加域名开始部署证书吧。"}),c.jsx(Dt,{onClick:n,className:"mt-3",children:"添加域名"})]})})]})})},ct=h.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{type:t,className:se("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:r,...n}));ct.displayName="Input";var sc=e=>e.type==="checkbox",yi=e=>e instanceof Date,an=e=>e==null;const xk=e=>typeof e=="object";var Ft=e=>!an(e)&&!Array.isArray(e)&&xk(e)&&!yi(e),wk=e=>Ft(e)&&e.target?sc(e.target)?e.target.checked:e.target.value:e,g$=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Sk=(e,t)=>e.has(g$(t)),v$=e=>{const t=e.constructor&&e.constructor.prototype;return Ft(t)&&t.hasOwnProperty("isPrototypeOf")},fv=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function gn(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(fv&&(e instanceof Blob||e instanceof FileList))&&(n||Ft(e)))if(t=n?[]:{},!n&&!v$(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=gn(e[r]));else return e;return t}var ff=e=>Array.isArray(e)?e.filter(Boolean):[],Tt=e=>e===void 0,Z=(e,t,n)=>{if(!t||!Ft(e))return n;const r=ff(t.split(/[,[\].]+?/)).reduce((o,s)=>an(o)?o:o[s],e);return Tt(r)||r===e?Tt(e[t])?n:e[t]:r},_r=e=>typeof e=="boolean",hv=e=>/^\w*$/.test(e),_k=e=>ff(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Ke=(e,t,n)=>{let r=-1;const o=hv(t)?[t]:_k(t),s=o.length,i=s-1;for(;++rOe.useContext(bk),y$=e=>{const{children:t,...n}=e;return Oe.createElement(bk.Provider,{value:n},t)};var Ck=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return t._proxyFormState[i]!==nr.all&&(t._proxyFormState[i]=!r||nr.all),n&&(n[i]=!0),e[i]}});return o},kn=e=>Ft(e)&&!Object.keys(e).length,kk=(e,t,n,r)=>{n(e);const{name:o,...s}=e;return kn(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===(!r||nr.all))},Ha=e=>Array.isArray(e)?e:[e],Ek=(e,t,n)=>!e||!t||e===t||Ha(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function pv(e){const t=Oe.useRef(e);t.current=e,Oe.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function x$(e){const t=hf(),{control:n=t.control,disabled:r,name:o,exact:s}=e||{},[i,a]=Oe.useState(n._formState),l=Oe.useRef(!0),u=Oe.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=Oe.useRef(o);return d.current=o,pv({disabled:r,next:f=>l.current&&Ek(d.current,f.name,s)&&kk(f,u.current,n._updateFormState)&&a({...n._formState,...f}),subject:n._subjects.state}),Oe.useEffect(()=>(l.current=!0,u.current.isValid&&n._updateValid(!0),()=>{l.current=!1}),[n]),Ck(i,n,u.current,!1)}var Cr=e=>typeof e=="string",Tk=(e,t,n,r,o)=>Cr(e)?(r&&t.watch.add(e),Z(n,e,o)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),Z(n,s))):(r&&(t.watchAll=!0),n);function w$(e){const t=hf(),{control:n=t.control,name:r,defaultValue:o,disabled:s,exact:i}=e||{},a=Oe.useRef(r);a.current=r,pv({disabled:s,subject:n._subjects.values,next:d=>{Ek(a.current,d.name,i)&&u(gn(Tk(a.current,n._names,d.values||n._formValues,!1,o)))}});const[l,u]=Oe.useState(n._getWatch(r,o));return Oe.useEffect(()=>n._removeUnmounted()),l}function S$(e){const t=hf(),{name:n,disabled:r,control:o=t.control,shouldUnregister:s}=e,i=Sk(o._names.array,n),a=w$({control:o,name:n,defaultValue:Z(o._formValues,n,Z(o._defaultValues,n,e.defaultValue)),exact:!0}),l=x$({control:o,name:n}),u=Oe.useRef(o.register(n,{...e.rules,value:a,..._r(e.disabled)?{disabled:e.disabled}:{}}));return Oe.useEffect(()=>{const d=o._options.shouldUnregister||s,f=(p,x)=>{const g=Z(o._fields,p);g&&g._f&&(g._f.mount=x)};if(f(n,!0),d){const p=gn(Z(o._options.defaultValues,n));Ke(o._defaultValues,n,p),Tt(Z(o._formValues,n))&&Ke(o._formValues,n,p)}return()=>{(i?d&&!o._state.action:d)?o.unregister(n):f(n,!1)}},[n,o,i,s]),Oe.useEffect(()=>{Z(o._fields,n)&&o._updateDisabledField({disabled:r,fields:o._fields,name:n,value:Z(o._fields,n)._f.value})},[r,n,o]),{field:{name:n,value:a,..._r(r)||l.disabled?{disabled:l.disabled||r}:{},onChange:Oe.useCallback(d=>u.current.onChange({target:{value:wk(d),name:n},type:td.CHANGE}),[n]),onBlur:Oe.useCallback(()=>u.current.onBlur({target:{value:Z(o._formValues,n),name:n},type:td.BLUR}),[n,o]),ref:d=>{const f=Z(o._fields,n);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:p=>d.setCustomValidity(p),reportValidity:()=>d.reportValidity()})}},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Z(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!Z(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Z(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Z(l.validatingFields,n)},error:{enumerable:!0,get:()=>Z(l.errors,n)}})}}const _$=e=>e.render(S$(e));var Rk=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},Qx=e=>({isOnSubmit:!e||e===nr.onSubmit,isOnBlur:e===nr.onBlur,isOnChange:e===nr.onChange,isOnAll:e===nr.all,isOnTouch:e===nr.onTouched}),Jx=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Ba=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const s=Z(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!r)break;if(i.ref&&t(i.ref,i.name)&&!r)break;Ba(a,t)}else Ft(a)&&Ba(a,t)}}};var b$=(e,t,n)=>{const r=Ha(Z(e,n));return Ke(r,"root",t[n]),Ke(e,n,r),e},mv=e=>e.type==="file",Lo=e=>typeof e=="function",nd=e=>{if(!fv)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},mu=e=>Cr(e),gv=e=>e.type==="radio",rd=e=>e instanceof RegExp;const ew={value:!1,isValid:!1},tw={value:!0,isValid:!0};var Nk=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Tt(e[0].attributes.value)?Tt(e[0].value)||e[0].value===""?tw:{value:e[0].value,isValid:!0}:tw:ew}return ew};const nw={isValid:!1,value:null};var Pk=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,nw):nw;function rw(e,t,n="validate"){if(mu(e)||Array.isArray(e)&&e.every(mu)||_r(e)&&!e)return{type:n,message:mu(e)?e:"",ref:t}}var ti=e=>Ft(e)&&!rd(e)?e:{value:e,message:""},ow=async(e,t,n,r,o)=>{const{ref:s,refs:i,required:a,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:x,name:g,valueAsNumber:y,mount:S,disabled:v}=e._f,m=Z(t,g);if(!S||v)return{};const w=i?i[0]:s,b=A=>{r&&w.reportValidity&&(w.setCustomValidity(_r(A)?"":A||""),w.reportValidity())},C={},_=gv(s),R=sc(s),N=_||R,D=(y||mv(s))&&Tt(s.value)&&Tt(m)||nd(s)&&s.value===""||m===""||Array.isArray(m)&&!m.length,O=Rk.bind(null,g,n,C),B=(A,H,L,K=Ur.maxLength,ne=Ur.minLength)=>{const W=A?H:L;C[g]={type:A?K:ne,message:W,ref:s,...O(A?K:ne,W)}};if(o?!Array.isArray(m)||!m.length:a&&(!N&&(D||an(m))||_r(m)&&!m||R&&!Nk(i).isValid||_&&!Pk(i).isValid)){const{value:A,message:H}=mu(a)?{value:!!a,message:a}:ti(a);if(A&&(C[g]={type:Ur.required,message:H,ref:w,...O(Ur.required,H)},!n))return b(H),C}if(!D&&(!an(d)||!an(f))){let A,H;const L=ti(f),K=ti(d);if(!an(m)&&!isNaN(m)){const ne=s.valueAsNumber||m&&+m;an(L.value)||(A=ne>L.value),an(K.value)||(H=nenew Date(new Date().toDateString()+" "+X),F=s.type=="time",M=s.type=="week";Cr(L.value)&&m&&(A=F?W(m)>W(L.value):M?m>L.value:ne>new Date(L.value)),Cr(K.value)&&m&&(H=F?W(m)+A.value,K=!an(H.value)&&m.length<+H.value;if((L||K)&&(B(L,A.message,H.message),!n))return b(C[g].message),C}if(p&&!D&&Cr(m)){const{value:A,message:H}=ti(p);if(rd(A)&&!m.match(A)&&(C[g]={type:Ur.pattern,message:H,ref:s,...O(Ur.pattern,H)},!n))return b(H),C}if(x){if(Lo(x)){const A=await x(m,t),H=rw(A,w);if(H&&(C[g]={...H,...O(Ur.validate,H.message)},!n))return b(H.message),C}else if(Ft(x)){let A={};for(const H in x){if(!kn(A)&&!n)break;const L=rw(await x[H](m,t),w,H);L&&(A={...L,...O(H,L.message)},b(L.message),n&&(C[g]=A))}if(!kn(A)&&(C[g]={ref:w,...A},!n))return C}}return b(!0),C};function C$(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},od=e=>an(e)||!xk(e);function Ss(e,t){if(od(e)||od(t))return e===t;if(yi(e)&&yi(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const s=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const i=t[o];if(yi(s)&&yi(i)||Ft(s)&&Ft(i)||Array.isArray(s)&&Array.isArray(i)?!Ss(s,i):s!==i)return!1}}return!0}var jk=e=>e.type==="select-multiple",E$=e=>gv(e)||sc(e),yh=e=>nd(e)&&e.isConnected,Dk=e=>{for(const t in e)if(Lo(e[t]))return!0;return!1};function sd(e,t={}){const n=Array.isArray(e);if(Ft(e)||n)for(const r in e)Array.isArray(e[r])||Ft(e[r])&&!Dk(e[r])?(t[r]=Array.isArray(e[r])?[]:{},sd(e[r],t[r])):an(e[r])||(t[r]=!0);return t}function Mk(e,t,n){const r=Array.isArray(e);if(Ft(e)||r)for(const o in e)Array.isArray(e[o])||Ft(e[o])&&!Dk(e[o])?Tt(t)||od(n[o])?n[o]=Array.isArray(e[o])?sd(e[o],[]):{...sd(e[o])}:Mk(e[o],an(t)?{}:t[o],n[o]):n[o]=!Ss(e[o],t[o]);return n}var Gc=(e,t)=>Mk(e,t,sd(t)),Ok=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Tt(e)?e:t?e===""?NaN:e&&+e:n&&Cr(e)?new Date(e):r?r(e):e;function xh(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return mv(t)?t.files:gv(t)?Pk(e.refs).value:jk(t)?[...t.selectedOptions].map(({value:n})=>n):sc(t)?Nk(e.refs).value:Ok(Tt(t.value)?e.ref.value:t.value,e)}var T$=(e,t,n,r)=>{const o={};for(const s of e){const i=Z(t,s);i&&Ke(o,s,i._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},Ca=e=>Tt(e)?e:rd(e)?e.source:Ft(e)?rd(e.value)?e.value.source:e.value:e,R$=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function sw(e,t,n){const r=Z(e,n);if(r||hv(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const s=o.join("."),i=Z(t,s),a=Z(e,s);if(i&&!Array.isArray(i)&&n!==s)return{name:n};if(a&&a.type)return{name:s,error:a};o.pop()}return{name:n}}var N$=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,P$=(e,t)=>!ff(Z(e,t)).length&&Ot(e,t);const j$={mode:nr.onSubmit,reValidateMode:nr.onChange,shouldFocusError:!0};function D$(e={}){let t={...j$,...e},n={submitCount:0,isDirty:!1,isLoading:Lo(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=Ft(t.defaultValues)||Ft(t.values)?gn(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:gn(o),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},l,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:vh(),array:vh(),state:vh()},p=Qx(t.mode),x=Qx(t.reValidateMode),g=t.criteriaMode===nr.all,y=k=>P=>{clearTimeout(u),u=setTimeout(k,P)},S=async k=>{if(d.isValid||k){const P=t.resolver?kn((await N()).errors):await O(r,!0);P!==n.isValid&&f.state.next({isValid:P})}},v=(k,P)=>{(d.isValidating||d.validatingFields)&&((k||Array.from(a.mount)).forEach(I=>{I&&(P?Ke(n.validatingFields,I,P):Ot(n.validatingFields,I))}),f.state.next({validatingFields:n.validatingFields,isValidating:!kn(n.validatingFields)}))},m=(k,P=[],I,J,Q=!0,Y=!0)=>{if(J&&I){if(i.action=!0,Y&&Array.isArray(Z(r,k))){const ue=I(Z(r,k),J.argA,J.argB);Q&&Ke(r,k,ue)}if(Y&&Array.isArray(Z(n.errors,k))){const ue=I(Z(n.errors,k),J.argA,J.argB);Q&&Ke(n.errors,k,ue),P$(n.errors,k)}if(d.touchedFields&&Y&&Array.isArray(Z(n.touchedFields,k))){const ue=I(Z(n.touchedFields,k),J.argA,J.argB);Q&&Ke(n.touchedFields,k,ue)}d.dirtyFields&&(n.dirtyFields=Gc(o,s)),f.state.next({name:k,isDirty:A(k,P),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Ke(s,k,P)},w=(k,P)=>{Ke(n.errors,k,P),f.state.next({errors:n.errors})},b=k=>{n.errors=k,f.state.next({errors:n.errors,isValid:!1})},C=(k,P,I,J)=>{const Q=Z(r,k);if(Q){const Y=Z(s,k,Tt(I)?Z(o,k):I);Tt(Y)||J&&J.defaultChecked||P?Ke(s,k,P?Y:xh(Q._f)):K(k,Y),i.mount&&S()}},_=(k,P,I,J,Q)=>{let Y=!1,ue=!1;const Me={name:k},yt=!!(Z(r,k)&&Z(r,k)._f&&Z(r,k)._f.disabled);if(!I||J){d.isDirty&&(ue=n.isDirty,n.isDirty=Me.isDirty=A(),Y=ue!==Me.isDirty);const zt=yt||Ss(Z(o,k),P);ue=!!(!yt&&Z(n.dirtyFields,k)),zt||yt?Ot(n.dirtyFields,k):Ke(n.dirtyFields,k,!0),Me.dirtyFields=n.dirtyFields,Y=Y||d.dirtyFields&&ue!==!zt}if(I){const zt=Z(n.touchedFields,k);zt||(Ke(n.touchedFields,k,I),Me.touchedFields=n.touchedFields,Y=Y||d.touchedFields&&zt!==I)}return Y&&Q&&f.state.next(Me),Y?Me:{}},R=(k,P,I,J)=>{const Q=Z(n.errors,k),Y=d.isValid&&_r(P)&&n.isValid!==P;if(e.delayError&&I?(l=y(()=>w(k,I)),l(e.delayError)):(clearTimeout(u),l=null,I?Ke(n.errors,k,I):Ot(n.errors,k)),(I?!Ss(Q,I):Q)||!kn(J)||Y){const ue={...J,...Y&&_r(P)?{isValid:P}:{},errors:n.errors,name:k};n={...n,...ue},f.state.next(ue)}},N=async k=>{v(k,!0);const P=await t.resolver(s,t.context,T$(k||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return v(k),P},D=async k=>{const{errors:P}=await N(k);if(k)for(const I of k){const J=Z(P,I);J?Ke(n.errors,I,J):Ot(n.errors,I)}else n.errors=P;return P},O=async(k,P,I={valid:!0})=>{for(const J in k){const Q=k[J];if(Q){const{_f:Y,...ue}=Q;if(Y){const Me=a.array.has(Y.name);v([J],!0);const yt=await ow(Q,s,g,t.shouldUseNativeValidation&&!P,Me);if(v([J]),yt[Y.name]&&(I.valid=!1,P))break;!P&&(Z(yt,Y.name)?Me?b$(n.errors,yt,Y.name):Ke(n.errors,Y.name,yt[Y.name]):Ot(n.errors,Y.name))}ue&&await O(ue,P,I)}}return I.valid},B=()=>{for(const k of a.unMount){const P=Z(r,k);P&&(P._f.refs?P._f.refs.every(I=>!yh(I)):!yh(P._f.ref))&&Ue(k)}a.unMount=new Set},A=(k,P)=>(k&&P&&Ke(s,k,P),!Ss(le(),o)),H=(k,P,I)=>Tk(k,a,{...i.mount?s:Tt(P)?o:Cr(k)?{[k]:P}:P},I,P),L=k=>ff(Z(i.mount?s:o,k,e.shouldUnregister?Z(o,k,[]):[])),K=(k,P,I={})=>{const J=Z(r,k);let Q=P;if(J){const Y=J._f;Y&&(!Y.disabled&&Ke(s,k,Ok(P,Y)),Q=nd(Y.ref)&&an(P)?"":P,jk(Y.ref)?[...Y.ref.options].forEach(ue=>ue.selected=Q.includes(ue.value)):Y.refs?sc(Y.ref)?Y.refs.length>1?Y.refs.forEach(ue=>(!ue.defaultChecked||!ue.disabled)&&(ue.checked=Array.isArray(Q)?!!Q.find(Me=>Me===ue.value):Q===ue.value)):Y.refs[0]&&(Y.refs[0].checked=!!Q):Y.refs.forEach(ue=>ue.checked=ue.value===Q):mv(Y.ref)?Y.ref.value="":(Y.ref.value=Q,Y.ref.type||f.values.next({name:k,values:{...s}})))}(I.shouldDirty||I.shouldTouch)&&_(k,Q,I.shouldTouch,I.shouldDirty,!0),I.shouldValidate&&X(k)},ne=(k,P,I)=>{for(const J in P){const Q=P[J],Y=`${k}.${J}`,ue=Z(r,Y);(a.array.has(k)||!od(Q)||ue&&!ue._f)&&!yi(Q)?ne(Y,Q,I):K(Y,Q,I)}},W=(k,P,I={})=>{const J=Z(r,k),Q=a.array.has(k),Y=gn(P);Ke(s,k,Y),Q?(f.array.next({name:k,values:{...s}}),(d.isDirty||d.dirtyFields)&&I.shouldDirty&&f.state.next({name:k,dirtyFields:Gc(o,s),isDirty:A(k,Y)})):J&&!J._f&&!an(Y)?ne(k,Y,I):K(k,Y,I),Jx(k,a)&&f.state.next({...n}),f.values.next({name:i.mount?k:void 0,values:{...s}})},F=async k=>{i.mount=!0;const P=k.target;let I=P.name,J=!0;const Q=Z(r,I),Y=()=>P.type?xh(Q._f):wk(k),ue=Me=>{J=Number.isNaN(Me)||Me===Z(s,I,Me)};if(Q){let Me,yt;const zt=Y(),rn=k.type===td.BLUR||k.type===td.FOCUS_OUT,Zn=!R$(Q._f)&&!t.resolver&&!Z(n.errors,I)&&!Q._f.deps||N$(rn,Z(n.touchedFields,I),n.isSubmitted,x,p),Hs=Jx(I,a,rn);Ke(s,I,zt),rn?(Q._f.onBlur&&Q._f.onBlur(k),l&&l(0)):Q._f.onChange&&Q._f.onChange(k);const So=_(I,zt,rn,!1),Sf=!kn(So)||Hs;if(!rn&&f.values.next({name:I,type:k.type,values:{...s}}),Zn)return d.isValid&&S(),Sf&&f.state.next({name:I,...Hs?{}:So});if(!rn&&Hs&&f.state.next({...n}),t.resolver){const{errors:qn}=await N([I]);if(ue(zt),J){const dc=sw(n.errors,r,I),aa=sw(qn,r,dc.name||I);Me=aa.error,I=aa.name,yt=kn(qn)}}else v([I],!0),Me=(await ow(Q,s,g,t.shouldUseNativeValidation))[I],v([I]),ue(zt),J&&(Me?yt=!1:d.isValid&&(yt=await O(r,!0)));J&&(Q._f.deps&&X(Q._f.deps),R(I,yt,Me,So))}},M=(k,P)=>{if(Z(n.errors,P)&&k.focus)return k.focus(),1},X=async(k,P={})=>{let I,J;const Q=Ha(k);if(t.resolver){const Y=await D(Tt(k)?k:Q);I=kn(Y),J=k?!Q.some(ue=>Z(Y,ue)):I}else k?(J=(await Promise.all(Q.map(async Y=>{const ue=Z(r,Y);return await O(ue&&ue._f?{[Y]:ue}:ue)}))).every(Boolean),!(!J&&!n.isValid)&&S()):J=I=await O(r);return f.state.next({...!Cr(k)||d.isValid&&I!==n.isValid?{}:{name:k},...t.resolver||!k?{isValid:I}:{},errors:n.errors}),P.shouldFocus&&!J&&Ba(r,M,k?Q:a.mount),J},le=k=>{const P={...i.mount?s:o};return Tt(k)?P:Cr(k)?Z(P,k):k.map(I=>Z(P,I))},me=(k,P)=>({invalid:!!Z((P||n).errors,k),isDirty:!!Z((P||n).dirtyFields,k),error:Z((P||n).errors,k),isValidating:!!Z(n.validatingFields,k),isTouched:!!Z((P||n).touchedFields,k)}),rt=k=>{k&&Ha(k).forEach(P=>Ot(n.errors,P)),f.state.next({errors:k?n.errors:{}})},je=(k,P,I)=>{const J=(Z(r,k,{_f:{}})._f||{}).ref,Q=Z(n.errors,k)||{},{ref:Y,message:ue,type:Me,...yt}=Q;Ke(n.errors,k,{...yt,...P,ref:J}),f.state.next({name:k,errors:n.errors,isValid:!1}),I&&I.shouldFocus&&J&&J.focus&&J.focus()},gt=(k,P)=>Lo(k)?f.values.subscribe({next:I=>k(H(void 0,P),I)}):H(k,P,!0),Ue=(k,P={})=>{for(const I of k?Ha(k):a.mount)a.mount.delete(I),a.array.delete(I),P.keepValue||(Ot(r,I),Ot(s,I)),!P.keepError&&Ot(n.errors,I),!P.keepDirty&&Ot(n.dirtyFields,I),!P.keepTouched&&Ot(n.touchedFields,I),!P.keepIsValidating&&Ot(n.validatingFields,I),!t.shouldUnregister&&!P.keepDefaultValue&&Ot(o,I);f.values.next({values:{...s}}),f.state.next({...n,...P.keepDirty?{isDirty:A()}:{}}),!P.keepIsValid&&S()},ce=({disabled:k,name:P,field:I,fields:J,value:Q})=>{if(_r(k)&&i.mount||k){const Y=k?void 0:Tt(Q)?xh(I?I._f:Z(J,P)._f):Q;Ke(s,P,Y),_(P,Y,!1,!1,!0)}},De=(k,P={})=>{let I=Z(r,k);const J=_r(P.disabled);return Ke(r,k,{...I||{},_f:{...I&&I._f?I._f:{ref:{name:k}},name:k,mount:!0,...P}}),a.mount.add(k),I?ce({field:I,disabled:P.disabled,name:k,value:P.value}):C(k,!0,P.value),{...J?{disabled:P.disabled}:{},...t.progressive?{required:!!P.required,min:Ca(P.min),max:Ca(P.max),minLength:Ca(P.minLength),maxLength:Ca(P.maxLength),pattern:Ca(P.pattern)}:{},name:k,onChange:F,onBlur:F,ref:Q=>{if(Q){De(k,P),I=Z(r,k);const Y=Tt(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,ue=E$(Y),Me=I._f.refs||[];if(ue?Me.find(yt=>yt===Y):Y===I._f.ref)return;Ke(r,k,{_f:{...I._f,...ue?{refs:[...Me.filter(yh),Y,...Array.isArray(Z(o,k))?[{}]:[]],ref:{type:Y.type,name:k}}:{ref:Y}}}),C(k,!1,void 0,Y)}else I=Z(r,k,{}),I._f&&(I._f.mount=!1),(t.shouldUnregister||P.shouldUnregister)&&!(Sk(a.array,k)&&i.action)&&a.unMount.add(k)}}},He=()=>t.shouldFocusError&&Ba(r,M,a.mount),$e=k=>{_r(k)&&(f.state.next({disabled:k}),Ba(r,(P,I)=>{const J=Z(r,I);J&&(P.disabled=J._f.disabled||k,Array.isArray(J._f.refs)&&J._f.refs.forEach(Q=>{Q.disabled=J._f.disabled||k}))},0,!1))},Ve=(k,P)=>async I=>{let J;I&&(I.preventDefault&&I.preventDefault(),I.persist&&I.persist());let Q=gn(s);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:Y,values:ue}=await N();n.errors=Y,Q=ue}else await O(r);if(Ot(n.errors,"root"),kn(n.errors)){f.state.next({errors:{}});try{await k(Q,I)}catch(Y){J=Y}}else P&&await P({...n.errors},I),He(),setTimeout(He);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:kn(n.errors)&&!J,submitCount:n.submitCount+1,errors:n.errors}),J)throw J},Se=(k,P={})=>{Z(r,k)&&(Tt(P.defaultValue)?W(k,gn(Z(o,k))):(W(k,P.defaultValue),Ke(o,k,gn(P.defaultValue))),P.keepTouched||Ot(n.touchedFields,k),P.keepDirty||(Ot(n.dirtyFields,k),n.isDirty=P.defaultValue?A(k,gn(Z(o,k))):A()),P.keepError||(Ot(n.errors,k),d.isValid&&S()),f.state.next({...n}))},vt=(k,P={})=>{const I=k?gn(k):o,J=gn(I),Q=kn(k),Y=Q?o:J;if(P.keepDefaultValues||(o=I),!P.keepValues){if(P.keepDirtyValues)for(const ue of a.mount)Z(n.dirtyFields,ue)?Ke(Y,ue,Z(s,ue)):W(ue,Z(Y,ue));else{if(fv&&Tt(k))for(const ue of a.mount){const Me=Z(r,ue);if(Me&&Me._f){const yt=Array.isArray(Me._f.refs)?Me._f.refs[0]:Me._f.ref;if(nd(yt)){const zt=yt.closest("form");if(zt){zt.reset();break}}}}r={}}s=e.shouldUnregister?P.keepDefaultValues?gn(o):{}:gn(Y),f.array.next({values:{...Y}}),f.values.next({values:{...Y}})}a={mount:P.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!d.isValid||!!P.keepIsValid||!!P.keepDirtyValues,i.watch=!!e.shouldUnregister,f.state.next({submitCount:P.keepSubmitCount?n.submitCount:0,isDirty:Q?!1:P.keepDirty?n.isDirty:!!(P.keepDefaultValues&&!Ss(k,o)),isSubmitted:P.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Q?{}:P.keepDirtyValues?P.keepDefaultValues&&s?Gc(o,s):n.dirtyFields:P.keepDefaultValues&&k?Gc(o,k):P.keepDirty?n.dirtyFields:{},touchedFields:P.keepTouched?n.touchedFields:{},errors:P.keepErrors?n.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Zt=(k,P)=>vt(Lo(k)?k(s):k,P);return{control:{register:De,unregister:Ue,getFieldState:me,handleSubmit:Ve,setError:je,_executeSchema:N,_getWatch:H,_getDirty:A,_updateValid:S,_removeUnmounted:B,_updateFieldArray:m,_updateDisabledField:ce,_getFieldArray:L,_reset:vt,_resetDefaultValues:()=>Lo(t.defaultValues)&&t.defaultValues().then(k=>{Zt(k,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:k=>{n={...n,...k}},_disableForm:$e,_subjects:f,_proxyFormState:d,_setErrors:b,get _fields(){return r},get _formValues(){return s},get _state(){return i},set _state(k){i=k},get _defaultValues(){return o},get _names(){return a},set _names(k){a=k},get _formState(){return n},set _formState(k){n=k},get _options(){return t},set _options(k){t={...t,...k}}},trigger:X,register:De,handleSubmit:Ve,watch:gt,setValue:W,getValues:le,reset:Zt,resetField:Se,clearErrors:rt,unregister:Ue,setError:je,setFocus:(k,P={})=>{const I=Z(r,k),J=I&&I._f;if(J){const Q=J.refs?J.refs[0]:J.ref;Q.focus&&(Q.focus(),P.shouldSelect&&Q.select())}},getFieldState:me}}function ic(e={}){const t=Oe.useRef(),n=Oe.useRef(),[r,o]=Oe.useState({isDirty:!1,isValidating:!1,isLoading:Lo(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Lo(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...D$(e),formState:r});const s=t.current.control;return s._options=e,pv({subject:s._subjects.state,next:i=>{kk(i,s._proxyFormState,s._updateFormState,!0)&&o({...s._formState})}}),Oe.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),Oe.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==r.isDirty&&s._subjects.state.next({isDirty:i})}},[s,r.isDirty]),Oe.useEffect(()=>{e.values&&!Ss(e.values,n.current)?(s._reset(e.values,s._options.resetOptions),n.current=e.values,o(i=>({...i}))):s._resetDefaultValues()},[e.values,s]),Oe.useEffect(()=>{e.errors&&s._setErrors(e.errors)},[e.errors,s]),Oe.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),Oe.useEffect(()=>{e.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[e.shouldUnregister,s]),t.current.formState=Ck(r,s),t.current}const iw=(e,t,n)=>{if(e&&"reportValidity"in e){const r=Z(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Ak=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?iw(r.ref,n,e):r.refs&&r.refs.forEach(o=>iw(o,n,e))}},M$=(e,t)=>{t.shouldUseNativeValidation&&Ak(e,t);const n={};for(const r in e){const o=Z(t.fields,r),s=Object.assign(e[r]||{},{ref:o&&o.ref});if(O$(t.names||Object.keys(e),r)){const i=Object.assign({},Z(n,r));Ke(i,"root",s),Ke(n,r,i)}else Ke(n,r,s)}return n},O$=(e,t)=>e.some(n=>n.startsWith(t+"."));var A$=function(e,t){for(var n={};e.length;){var r=e[0],o=r.code,s=r.message,i=r.path.join(".");if(!n[i])if("unionErrors"in r){var a=r.unionErrors[0].errors[0];n[i]={message:a.message,type:a.code}}else n[i]={message:s,type:o};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var l=n[i].types,u=l&&l[r.code];n[i]=Rk(i,t,n,o,u?[].concat(u,r.message):r.message)}e.shift()}return n},ac=function(e,t,n){return n===void 0&&(n={}),function(r,o,s){try{return Promise.resolve(function(i,a){try{var l=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(u){return s.shouldUseNativeValidation&&Ak({},s),{errors:{},values:n.raw?r:u}})}catch(u){return a(u)}return l&&l.then?l.then(void 0,a):l}(0,function(i){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(i))return{values:{},errors:M$(A$(i.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw i}))}catch(i){return Promise.reject(i)}}},Le;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const s={};for(const i of o)s[i]=i;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(const i of o)if(s(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(Le||(Le={}));var Up;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Up||(Up={}));const oe=Le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Do=e=>{switch(typeof e){case"undefined":return oe.undefined;case"string":return oe.string;case"number":return isNaN(e)?oe.nan:oe.number;case"boolean":return oe.boolean;case"function":return oe.function;case"bigint":return oe.bigint;case"symbol":return oe.symbol;case"object":return Array.isArray(e)?oe.array:e===null?oe.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?oe.promise:typeof Map<"u"&&e instanceof Map?oe.map:typeof Set<"u"&&e instanceof Set?oe.set:typeof Date<"u"&&e instanceof Date?oe.date:oe.object;default:return oe.unknown}},V=Le.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"]),I$=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Mn extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;ln.message){const n={},r=[];for(const o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Mn.create=e=>new Mn(e);const Wi=(e,t)=>{let n;switch(e.code){case V.invalid_type:e.received===oe.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case V.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Le.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${Le.joinValues(e.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Le.joinValues(e.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${Le.joinValues(e.options)}, received '${e.received}'`;break;case V.invalid_arguments:n="Invalid function arguments";break;case V.invalid_return_type:n="Invalid function return type";break;case V.invalid_date:n="Invalid date";break;case V.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Le.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case V.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case V.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case V.custom:n="Invalid input";break;case V.invalid_intersection_types:n="Intersection results could not be merged";break;case V.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case V.not_finite:n="Number must be finite";break;default:n=t.defaultError,Le.assertNever(e)}return{message:n}};let Ik=Wi;function L$(e){Ik=e}function id(){return Ik}const ad=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)a=u(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}},F$=[];function ee(e,t){const n=id(),r=ad({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Wi?void 0:Wi].filter(o=>!!o)});e.common.issues.push(r)}class tn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return we;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const s=await o.key,i=await o.value;r.push({key:s,value:i})}return tn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return we;s.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:t.value,value:r}}}const we=Object.freeze({status:"aborted"}),xi=e=>({status:"dirty",value:e}),cn=e=>({status:"valid",value:e}),$p=e=>e.status==="aborted",Vp=e=>e.status==="dirty",bl=e=>e.status==="valid",Cl=e=>typeof Promise<"u"&&e instanceof Promise;function ld(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function Lk(e,t,n,r,o){if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var fe;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(fe||(fe={}));var ja,Da;class jr{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}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 aw=(e,t)=>{if(bl(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 n=new Mn(e.common.issues);return this._error=n,this._error}}};function _e(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(i,a)=>{var l,u;const{message:d}=e;return i.code==="invalid_enum_value"?{message:d??a.defaultError}:typeof a.data>"u"?{message:(l=d??r)!==null&&l!==void 0?l:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:a.defaultError}},description:o}}class Re{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 Do(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Do(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new tn,ctx:{common:t.parent.common,data:t.data,parsedType:Do(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Cl(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const o={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Do(t)},s=this._parseSync({data:t,path:o.path,parent:o});return aw(o,s)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Do(t)},o=this._parse({data:t,path:r.path,parent:r}),s=await(Cl(o)?o:Promise.resolve(o));return aw(r,s)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{const i=t(o),a=()=>s.addIssue({code:V.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new hr({schema:this,typeName:ye.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Rr.create(this,this._def)}nullable(){return ts.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ar.create(this,this._def)}promise(){return Hi.create(this,this._def)}or(t){return Rl.create([this,t],this._def)}and(t){return Nl.create(this,t,this._def)}transform(t){return new hr({..._e(this._def),schema:this,typeName:ye.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Ol({..._e(this._def),innerType:this,defaultValue:n,typeName:ye.ZodDefault})}brand(){return new vv({typeName:ye.ZodBranded,type:this,..._e(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Al({..._e(this._def),innerType:this,catchValue:n,typeName:ye.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return lc.create(this,t)}readonly(){return Il.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const U$=/^c[^\s-]{8,}$/i,$$=/^[0-9a-z]+$/,V$=/^[0-9A-HJKMNP-TV-Z]{26}$/,z$=/^[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,W$=/^[a-z0-9_-]{21}$/i,Y$=/^[-+]?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)?)??$/,H$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,B$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let wh;const G$=/^(?:(?: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])$/,K$=/^(([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})))$/,Z$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Fk="((\\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])))",q$=new RegExp(`^${Fk}$`);function Uk(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 X$(e){return new RegExp(`^${Uk(e)}$`)}function $k(e){let t=`${Fk}T${Uk(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Q$(e,t){return!!((t==="v4"||!t)&&G$.test(e)||(t==="v6"||!t)&&K$.test(e))}class or extends Re{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==oe.string){const s=this._getOrReturnCtx(t);return ee(s,{code:V.invalid_type,expected:oe.string,received:s.parsedType}),we}const r=new tn;let o;for(const s of this._def.checks)if(s.kind==="min")t.data.lengths.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:V.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const i=t.data.length>s.value,a=t.data.lengtht.test(o),{validation:n,code:V.invalid_string,...fe.errToObj(r)})}_addCheck(t){return new or({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...fe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...fe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...fe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...fe.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...fe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...fe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...fe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...fe.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...fe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...fe.errToObj(t)})}datetime(t){var n,r;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:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...fe.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,...fe.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...fe.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...fe.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...fe.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...fe.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...fe.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...fe.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...fe.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...fe.errToObj(n)})}nonempty(t){return this.min(1,fe.errToObj(t))}trim(){return new or({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new or({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new or({...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 n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new or({checks:[],typeName:ye.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,..._e(e)})};function J$(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=parseInt(e.toFixed(o).replace(".","")),i=parseInt(t.toFixed(o).replace(".",""));return s%i/Math.pow(10,o)}class Qo extends Re{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)!==oe.number){const s=this._getOrReturnCtx(t);return ee(s,{code:V.invalid_type,expected:oe.number,received:s.parsedType}),we}let r;const o=new tn;for(const s of this._def.checks)s.kind==="int"?Le.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ee(r,{code:V.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.datas.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),ee(r,{code:V.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?J$(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),ee(r,{code:V.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ee(r,{code:V.not_finite,message:s.message}),o.dirty()):Le.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,fe.toString(n))}gt(t,n){return this.setLimit("min",t,!1,fe.toString(n))}lte(t,n){return this.setLimit("max",t,!0,fe.toString(n))}lt(t,n){return this.setLimit("max",t,!1,fe.toString(n))}setLimit(t,n,r,o){return new Qo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:fe.toString(o)}]})}_addCheck(t){return new Qo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:fe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:fe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:fe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:fe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:fe.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:fe.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:fe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:fe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:fe.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&Le.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew Qo({checks:[],typeName:ye.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,..._e(e)});class Jo extends Re{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)!==oe.bigint){const s=this._getOrReturnCtx(t);return ee(s,{code:V.invalid_type,expected:oe.bigint,received:s.parsedType}),we}let r;const o=new tn;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.datas.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),ee(r,{code:V.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ee(r,{code:V.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):Le.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,fe.toString(n))}gt(t,n){return this.setLimit("min",t,!1,fe.toString(n))}lte(t,n){return this.setLimit("max",t,!0,fe.toString(n))}lt(t,n){return this.setLimit("max",t,!1,fe.toString(n))}setLimit(t,n,r,o){return new Jo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:fe.toString(o)}]})}_addCheck(t){return new Jo({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:fe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:fe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:fe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:fe.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:fe.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Jo({checks:[],typeName:ye.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,..._e(e)})};class kl extends Re{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==oe.boolean){const r=this._getOrReturnCtx(t);return ee(r,{code:V.invalid_type,expected:oe.boolean,received:r.parsedType}),we}return cn(t.data)}}kl.create=e=>new kl({typeName:ye.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,..._e(e)});class Is extends Re{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==oe.date){const s=this._getOrReturnCtx(t);return ee(s,{code:V.invalid_type,expected:oe.date,received:s.parsedType}),we}if(isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return ee(s,{code:V.invalid_date}),we}const r=new tn;let o;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()s.value&&(o=this._getOrReturnCtx(t,o),ee(o,{code:V.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Le.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Is({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:fe.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:fe.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Is({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ye.ZodDate,..._e(e)});class cd extends Re{_parse(t){if(this._getType(t)!==oe.symbol){const r=this._getOrReturnCtx(t);return ee(r,{code:V.invalid_type,expected:oe.symbol,received:r.parsedType}),we}return cn(t.data)}}cd.create=e=>new cd({typeName:ye.ZodSymbol,..._e(e)});class El extends Re{_parse(t){if(this._getType(t)!==oe.undefined){const r=this._getOrReturnCtx(t);return ee(r,{code:V.invalid_type,expected:oe.undefined,received:r.parsedType}),we}return cn(t.data)}}El.create=e=>new El({typeName:ye.ZodUndefined,..._e(e)});class Tl extends Re{_parse(t){if(this._getType(t)!==oe.null){const r=this._getOrReturnCtx(t);return ee(r,{code:V.invalid_type,expected:oe.null,received:r.parsedType}),we}return cn(t.data)}}Tl.create=e=>new Tl({typeName:ye.ZodNull,..._e(e)});class Yi extends Re{constructor(){super(...arguments),this._any=!0}_parse(t){return cn(t.data)}}Yi.create=e=>new Yi({typeName:ye.ZodAny,..._e(e)});class ks extends Re{constructor(){super(...arguments),this._unknown=!0}_parse(t){return cn(t.data)}}ks.create=e=>new ks({typeName:ye.ZodUnknown,..._e(e)});class co extends Re{_parse(t){const n=this._getOrReturnCtx(t);return ee(n,{code:V.invalid_type,expected:oe.never,received:n.parsedType}),we}}co.create=e=>new co({typeName:ye.ZodNever,..._e(e)});class ud extends Re{_parse(t){if(this._getType(t)!==oe.undefined){const r=this._getOrReturnCtx(t);return ee(r,{code:V.invalid_type,expected:oe.void,received:r.parsedType}),we}return cn(t.data)}}ud.create=e=>new ud({typeName:ye.ZodVoid,..._e(e)});class ar extends Re{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==oe.array)return ee(n,{code:V.invalid_type,expected:oe.array,received:n.parsedType}),we;if(o.exactLength!==null){const i=n.data.length>o.exactLength.value,a=n.data.lengtho.maxLength.value&&(ee(n,{code:V.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new jr(n,i,n.path,a)))).then(i=>tn.mergeArray(r,i));const s=[...n.data].map((i,a)=>o.type._parseSync(new jr(n,i,n.path,a)));return tn.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new ar({...this._def,minLength:{value:t,message:fe.toString(n)}})}max(t,n){return new ar({...this._def,maxLength:{value:t,message:fe.toString(n)}})}length(t,n){return new ar({...this._def,exactLength:{value:t,message:fe.toString(n)}})}nonempty(t){return this.min(1,t)}}ar.create=(e,t)=>new ar({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ye.ZodArray,..._e(t)});function ri(e){if(e instanceof xt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Rr.create(ri(r))}return new xt({...e._def,shape:()=>t})}else return e instanceof ar?new ar({...e._def,type:ri(e.element)}):e instanceof Rr?Rr.create(ri(e.unwrap())):e instanceof ts?ts.create(ri(e.unwrap())):e instanceof Dr?Dr.create(e.items.map(t=>ri(t))):e}class xt extends Re{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(),n=Le.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==oe.object){const u=this._getOrReturnCtx(t);return ee(u,{code:V.invalid_type,expected:oe.object,received:u.parsedType}),we}const{status:r,ctx:o}=this._processInputParams(t),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof co&&this._def.unknownKeys==="strip"))for(const u in o.data)i.includes(u)||a.push(u);const l=[];for(const u of i){const d=s[u],f=o.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new jr(o,f,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof co){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)l.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(u==="strict")a.length>0&&(ee(o,{code:V.unrecognized_keys,keys:a}),r.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=o.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new jr(o,f,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of l){const f=await d.key,p=await d.value;u.push({key:f,value:p,alwaysSet:d.alwaysSet})}return u}).then(u=>tn.mergeObjectSync(r,u)):tn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return fe.errToObj,new xt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,s,i,a;const l=(i=(s=(o=this._def).errorMap)===null||s===void 0?void 0:s.call(o,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=fe.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new xt({...this._def,unknownKeys:"strip"})}passthrough(){return new xt({...this._def,unknownKeys:"passthrough"})}extend(t){return new xt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new xt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ye.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new xt({...this._def,catchall:t})}pick(t){const n={};return Le.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new xt({...this._def,shape:()=>n})}omit(t){const n={};return Le.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new xt({...this._def,shape:()=>n})}deepPartial(){return ri(this)}partial(t){const n={};return Le.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new xt({...this._def,shape:()=>n})}required(t){const n={};return Le.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Rr;)s=s._def.innerType;n[r]=s}}),new xt({...this._def,shape:()=>n})}keyof(){return Vk(Le.objectKeys(this.shape))}}xt.create=(e,t)=>new xt({shape:()=>e,unknownKeys:"strip",catchall:co.create(),typeName:ye.ZodObject,..._e(t)});xt.strictCreate=(e,t)=>new xt({shape:()=>e,unknownKeys:"strict",catchall:co.create(),typeName:ye.ZodObject,..._e(t)});xt.lazycreate=(e,t)=>new xt({shape:e,unknownKeys:"strip",catchall:co.create(),typeName:ye.ZodObject,..._e(t)});class Rl extends Re{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=s.map(a=>new Mn(a.ctx.common.issues));return ee(n,{code:V.invalid_union,unionErrors:i}),we}if(n.common.async)return Promise.all(r.map(async s=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s;const i=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=l._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(l=>new Mn(l));return ee(n,{code:V.invalid_union,unionErrors:a}),we}}get options(){return this._def.options}}Rl.create=(e,t)=>new Rl({options:e,typeName:ye.ZodUnion,..._e(t)});const Vr=e=>e instanceof jl?Vr(e.schema):e instanceof hr?Vr(e.innerType()):e instanceof Dl?[e.value]:e instanceof es?e.options:e instanceof Ml?Le.objectValues(e.enum):e instanceof Ol?Vr(e._def.innerType):e instanceof El?[void 0]:e instanceof Tl?[null]:e instanceof Rr?[void 0,...Vr(e.unwrap())]:e instanceof ts?[null,...Vr(e.unwrap())]:e instanceof vv||e instanceof Il?Vr(e.unwrap()):e instanceof Al?Vr(e._def.innerType):[];class pf extends Re{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==oe.object)return ee(n,{code:V.invalid_type,expected:oe.object,received:n.parsedType}),we;const r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(ee(n,{code:V.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),we)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const s of n){const i=Vr(s.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(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,s)}}return new pf({typeName:ye.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,..._e(r)})}}function zp(e,t){const n=Do(e),r=Do(t);if(e===t)return{valid:!0,data:e};if(n===oe.object&&r===oe.object){const o=Le.objectKeys(t),s=Le.objectKeys(e).filter(a=>o.indexOf(a)!==-1),i={...e,...t};for(const a of s){const l=zp(e[a],t[a]);if(!l.valid)return{valid:!1};i[a]=l.data}return{valid:!0,data:i}}else if(n===oe.array&&r===oe.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let s=0;s{if($p(s)||$p(i))return we;const a=zp(s.value,i.value);return a.valid?((Vp(s)||Vp(i))&&n.dirty(),{status:n.value,value:a.data}):(ee(r,{code:V.invalid_intersection_types}),we)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Nl.create=(e,t,n)=>new Nl({left:e,right:t,typeName:ye.ZodIntersection,..._e(n)});class Dr extends Re{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==oe.array)return ee(r,{code:V.invalid_type,expected:oe.array,received:r.parsedType}),we;if(r.data.lengththis._def.items.length&&(ee(r,{code:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((i,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new jr(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>tn.mergeArray(n,i)):tn.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new Dr({...this._def,rest:t})}}Dr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dr({items:e,typeName:ye.ZodTuple,rest:null,..._e(t)})};class Pl extends Re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==oe.object)return ee(r,{code:V.invalid_type,expected:oe.object,received:r.parsedType}),we;const o=[],s=this._def.keyType,i=this._def.valueType;for(const a in r.data)o.push({key:s._parse(new jr(r,a,r.path,a)),value:i._parse(new jr(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?tn.mergeObjectAsync(n,o):tn.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Re?new Pl({keyType:t,valueType:n,typeName:ye.ZodRecord,..._e(r)}):new Pl({keyType:or.create(),valueType:t,typeName:ye.ZodRecord,..._e(n)})}}class dd extends Re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==oe.map)return ee(r,{code:V.invalid_type,expected:oe.map,received:r.parsedType}),we;const o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,l],u)=>({key:o._parse(new jr(r,a,r.path,[u,"key"])),value:s._parse(new jr(r,l,r.path,[u,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of i){const u=await l.key,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return we;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of i){const u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return we;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}}}}dd.create=(e,t,n)=>new dd({valueType:t,keyType:e,typeName:ye.ZodMap,..._e(n)});class Ls extends Re{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==oe.set)return ee(r,{code:V.invalid_type,expected:oe.set,received:r.parsedType}),we;const o=this._def;o.minSize!==null&&r.data.sizeo.maxSize.value&&(ee(r,{code:V.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const s=this._def.valueType;function i(l){const u=new Set;for(const d of l){if(d.status==="aborted")return we;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((l,u)=>s._parse(new jr(r,l,r.path,u)));return r.common.async?Promise.all(a).then(l=>i(l)):i(a)}min(t,n){return new Ls({...this._def,minSize:{value:t,message:fe.toString(n)}})}max(t,n){return new Ls({...this._def,maxSize:{value:t,message:fe.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Ls.create=(e,t)=>new Ls({valueType:e,minSize:null,maxSize:null,typeName:ye.ZodSet,..._e(t)});class Mi extends Re{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==oe.function)return ee(n,{code:V.invalid_type,expected:oe.function,received:n.parsedType}),we;function r(a,l){return ad({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,id(),Wi].filter(u=>!!u),issueData:{code:V.invalid_arguments,argumentsError:l}})}function o(a,l){return ad({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,id(),Wi].filter(u=>!!u),issueData:{code:V.invalid_return_type,returnTypeError:l}})}const s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Hi){const a=this;return cn(async function(...l){const u=new Mn([]),d=await a._def.args.parseAsync(l,s).catch(x=>{throw u.addIssue(r(l,x)),u}),f=await Reflect.apply(i,this,d);return await a._def.returns._def.type.parseAsync(f,s).catch(x=>{throw u.addIssue(o(f,x)),u})})}else{const a=this;return cn(function(...l){const u=a._def.args.safeParse(l,s);if(!u.success)throw new Mn([r(l,u.error)]);const d=Reflect.apply(i,this,u.data),f=a._def.returns.safeParse(d,s);if(!f.success)throw new Mn([o(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Mi({...this._def,args:Dr.create(t).rest(ks.create())})}returns(t){return new Mi({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Mi({args:t||Dr.create([]).rest(ks.create()),returns:n||ks.create(),typeName:ye.ZodFunction,..._e(r)})}}class jl extends Re{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}jl.create=(e,t)=>new jl({getter:e,typeName:ye.ZodLazy,..._e(t)});class Dl extends Re{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ee(n,{received:n.data,code:V.invalid_literal,expected:this._def.value}),we}return{status:"valid",value:t.data}}get value(){return this._def.value}}Dl.create=(e,t)=>new Dl({value:e,typeName:ye.ZodLiteral,..._e(t)});function Vk(e,t){return new es({values:e,typeName:ye.ZodEnum,..._e(t)})}class es extends Re{constructor(){super(...arguments),ja.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ee(n,{expected:Le.joinValues(r),received:n.parsedType,code:V.invalid_type}),we}if(ld(this,ja)||Lk(this,ja,new Set(this._def.values)),!ld(this,ja).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return ee(n,{received:n.data,code:V.invalid_enum_value,options:r}),we}return cn(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return es.create(t,{...this._def,...n})}exclude(t,n=this._def){return es.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}ja=new WeakMap;es.create=Vk;class Ml extends Re{constructor(){super(...arguments),Da.set(this,void 0)}_parse(t){const n=Le.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==oe.string&&r.parsedType!==oe.number){const o=Le.objectValues(n);return ee(r,{expected:Le.joinValues(o),received:r.parsedType,code:V.invalid_type}),we}if(ld(this,Da)||Lk(this,Da,new Set(Le.getValidEnumValues(this._def.values))),!ld(this,Da).has(t.data)){const o=Le.objectValues(n);return ee(r,{received:r.data,code:V.invalid_enum_value,options:o}),we}return cn(t.data)}get enum(){return this._def.values}}Da=new WeakMap;Ml.create=(e,t)=>new Ml({values:e,typeName:ye.ZodNativeEnum,..._e(t)});class Hi extends Re{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==oe.promise&&n.common.async===!1)return ee(n,{code:V.invalid_type,expected:oe.promise,received:n.parsedType}),we;const r=n.parsedType===oe.promise?n.data:Promise.resolve(n.data);return cn(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Hi.create=(e,t)=>new Hi({type:e,typeName:ye.ZodPromise,..._e(t)});class hr extends Re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ye.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,s={addIssue:i=>{ee(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){const i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return we;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?we:l.status==="dirty"||n.value==="dirty"?xi(l.value):l});{if(n.value==="aborted")return we;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?we:a.status==="dirty"||n.value==="dirty"?xi(a.value):a}}if(o.type==="refinement"){const i=a=>{const l=o.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?we:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?we:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!bl(i))return i;const a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>bl(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):i);Le.assertNever(o)}}hr.create=(e,t,n)=>new hr({schema:e,typeName:ye.ZodEffects,effect:t,..._e(n)});hr.createWithPreprocess=(e,t,n)=>new hr({schema:t,effect:{type:"preprocess",transform:e},typeName:ye.ZodEffects,..._e(n)});class Rr extends Re{_parse(t){return this._getType(t)===oe.undefined?cn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Rr.create=(e,t)=>new Rr({innerType:e,typeName:ye.ZodOptional,..._e(t)});class ts extends Re{_parse(t){return this._getType(t)===oe.null?cn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ts.create=(e,t)=>new ts({innerType:e,typeName:ye.ZodNullable,..._e(t)});class Ol extends Re{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===oe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Ol.create=(e,t)=>new Ol({innerType:e,typeName:ye.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,..._e(t)});class Al extends Re{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Cl(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Mn(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Mn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Al.create=(e,t)=>new Al({innerType:e,typeName:ye.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,..._e(t)});class fd extends Re{_parse(t){if(this._getType(t)!==oe.nan){const r=this._getOrReturnCtx(t);return ee(r,{code:V.invalid_type,expected:oe.nan,received:r.parsedType}),we}return{status:"valid",value:t.data}}}fd.create=e=>new fd({typeName:ye.ZodNaN,..._e(e)});const eV=Symbol("zod_brand");class vv extends Re{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class lc extends Re{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?we:s.status==="dirty"?(n.dirty(),xi(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?we:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new lc({in:t,out:n,typeName:ye.ZodPipeline})}}class Il extends Re{_parse(t){const n=this._def.innerType._parse(t),r=o=>(bl(o)&&(o.value=Object.freeze(o.value)),o);return Cl(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}Il.create=(e,t)=>new Il({innerType:e,typeName:ye.ZodReadonly,..._e(t)});function zk(e,t={},n){return e?Yi.create().superRefine((r,o)=>{var s,i;if(!e(r)){const a=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(i=(s=a.fatal)!==null&&s!==void 0?s:n)!==null&&i!==void 0?i:!0,u=typeof a=="string"?{message:a}:a;o.addIssue({code:"custom",...u,fatal:l})}}):Yi.create()}const tV={object:xt.lazycreate};var ye;(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"})(ye||(ye={}));const nV=(e,t={message:`Input not instance of ${e.name}`})=>zk(n=>n instanceof e,t),Wk=or.create,Yk=Qo.create,rV=fd.create,oV=Jo.create,Hk=kl.create,sV=Is.create,iV=cd.create,aV=El.create,lV=Tl.create,cV=Yi.create,uV=ks.create,dV=co.create,fV=ud.create,hV=ar.create,pV=xt.create,mV=xt.strictCreate,gV=Rl.create,vV=pf.create,yV=Nl.create,xV=Dr.create,wV=Pl.create,SV=dd.create,_V=Ls.create,bV=Mi.create,CV=jl.create,kV=Dl.create,EV=es.create,TV=Ml.create,RV=Hi.create,lw=hr.create,NV=Rr.create,PV=ts.create,jV=hr.createWithPreprocess,DV=lc.create,MV=()=>Wk().optional(),OV=()=>Yk().optional(),AV=()=>Hk().optional(),IV={string:e=>or.create({...e,coerce:!0}),number:e=>Qo.create({...e,coerce:!0}),boolean:e=>kl.create({...e,coerce:!0}),bigint:e=>Jo.create({...e,coerce:!0}),date:e=>Is.create({...e,coerce:!0})},LV=we;var Ie=Object.freeze({__proto__:null,defaultErrorMap:Wi,setErrorMap:L$,getErrorMap:id,makeIssue:ad,EMPTY_PATH:F$,addIssueToContext:ee,ParseStatus:tn,INVALID:we,DIRTY:xi,OK:cn,isAborted:$p,isDirty:Vp,isValid:bl,isAsync:Cl,get util(){return Le},get objectUtil(){return Up},ZodParsedType:oe,getParsedType:Do,ZodType:Re,datetimeRegex:$k,ZodString:or,ZodNumber:Qo,ZodBigInt:Jo,ZodBoolean:kl,ZodDate:Is,ZodSymbol:cd,ZodUndefined:El,ZodNull:Tl,ZodAny:Yi,ZodUnknown:ks,ZodNever:co,ZodVoid:ud,ZodArray:ar,ZodObject:xt,ZodUnion:Rl,ZodDiscriminatedUnion:pf,ZodIntersection:Nl,ZodTuple:Dr,ZodRecord:Pl,ZodMap:dd,ZodSet:Ls,ZodFunction:Mi,ZodLazy:jl,ZodLiteral:Dl,ZodEnum:es,ZodNativeEnum:Ml,ZodPromise:Hi,ZodEffects:hr,ZodTransformer:hr,ZodOptional:Rr,ZodNullable:ts,ZodDefault:Ol,ZodCatch:Al,ZodNaN:fd,BRAND:eV,ZodBranded:vv,ZodPipeline:lc,ZodReadonly:Il,custom:zk,Schema:Re,ZodSchema:Re,late:tV,get ZodFirstPartyTypeKind(){return ye},coerce:IV,any:cV,array:hV,bigint:oV,boolean:Hk,date:sV,discriminatedUnion:vV,effect:lw,enum:EV,function:bV,instanceof:nV,intersection:yV,lazy:CV,literal:kV,map:SV,nan:rV,nativeEnum:TV,never:dV,null:lV,nullable:PV,number:Yk,object:pV,oboolean:AV,onumber:OV,optional:NV,ostring:MV,pipeline:DV,preprocess:jV,promise:RV,record:wV,set:_V,strictObject:mV,string:Wk,symbol:iV,transformer:lw,tuple:xV,undefined:aV,union:gV,unknown:uV,void:fV,NEVER:LV,ZodIssueCode:V,quotelessJson:I$,ZodError:Mn}),FV="Label",Bk=h.forwardRef((e,t)=>c.jsx(ve.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Bk.displayName=FV;var Gk=Bk;const UV=Wl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ll=h.forwardRef(({className:e,...t},n)=>c.jsx(Gk,{ref:n,className:se(UV(),e),...t}));Ll.displayName=Gk.displayName;const cc=y$,Kk=h.createContext({}),tt=({...e})=>c.jsx(Kk.Provider,{value:{name:e.name},children:c.jsx(_$,{...e})}),mf=()=>{const e=h.useContext(Kk),t=h.useContext(Zk),{getFieldState:n,formState:r}=hf(),o=n(e.name,r);if(!e)throw new Error("useFormField should be used within ");const{id:s}=t;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...o}},Zk=h.createContext({}),qe=h.forwardRef(({className:e,...t},n)=>{const r=h.useId();return c.jsx(Zk.Provider,{value:{id:r},children:c.jsx("div",{ref:n,className:se("space-y-2",e),...t})})});qe.displayName="FormItem";const Xe=h.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:o}=mf();return c.jsx(Ll,{ref:n,className:se(r&&"text-destructive",e),htmlFor:o,...t})});Xe.displayName="FormLabel";const Qe=h.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:o,formMessageId:s}=mf();return c.jsx(oo,{ref:t,id:r,"aria-describedby":n?`${o} ${s}`:`${o}`,"aria-invalid":!!n,...e})});Qe.displayName="FormControl";const $V=h.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=mf();return c.jsx("p",{ref:n,id:r,className:se("text-sm text-muted-foreground",e),...t})});$V.displayName="FormDescription";const Be=h.forwardRef(({className:e,children:t,...n},r)=>{const{error:o,formMessageId:s}=mf(),i=o?String(o==null?void 0:o.message):t;return i?c.jsx("p",{ref:r,id:s,className:se("text-sm font-medium text-destructive",e),...n,children:i}):null});Be.displayName="FormMessage";function Wp(e,[t,n]){return Math.min(n,Math.max(t,e))}var VV=[" ","Enter","ArrowUp","ArrowDown"],zV=[" ","Enter"],uc="Select",[gf,vf,WV]=Ld(uc),[ia,d3]=_n(uc,[WV,na]),yf=na(),[YV,ls]=ia(uc),[HV,BV]=ia(uc),qk=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:a,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:x}=e,g=yf(t),[y,S]=h.useState(null),[v,m]=h.useState(null),[w,b]=h.useState(!1),C=Yl(u),[_=!1,R]=so({prop:r,defaultProp:o,onChange:s}),[N,D]=so({prop:i,defaultProp:a,onChange:l}),O=h.useRef(null),B=y?!!y.closest("form"):!0,[A,H]=h.useState(new Set),L=Array.from(A).map(K=>K.props.value).join(";");return c.jsx(hg,{...g,children:c.jsxs(YV,{required:x,scope:t,trigger:y,onTriggerChange:S,valueNode:v,onValueNodeChange:m,valueNodeHasChildren:w,onValueNodeHasChildrenChange:b,contentId:Tr(),value:N,onValueChange:D,open:_,onOpenChange:R,dir:C,triggerPointerDownPosRef:O,disabled:p,children:[c.jsx(gf.Provider,{scope:t,children:c.jsx(HV,{scope:e.__scopeSelect,onNativeOptionAdd:h.useCallback(K=>{H(ne=>new Set(ne).add(K))},[]),onNativeOptionRemove:h.useCallback(K=>{H(ne=>{const W=new Set(ne);return W.delete(K),W})},[]),children:n})}),B?c.jsxs(_E,{"aria-hidden":!0,required:x,tabIndex:-1,name:d,autoComplete:f,value:N,onChange:K=>D(K.target.value),disabled:p,children:[N===void 0?c.jsx("option",{value:""}):null,Array.from(A)]},L):null]})})};qk.displayName=uc;var Xk="SelectTrigger",Qk=h.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=yf(n),i=ls(Xk,n),a=i.disabled||r,l=be(t,i.onTriggerChange),u=vf(n),[d,f,p]=bE(g=>{const y=u().filter(m=>!m.disabled),S=y.find(m=>m.value===i.value),v=CE(y,g,S);v!==void 0&&i.onValueChange(v.value)}),x=()=>{a||(i.onOpenChange(!0),p())};return c.jsx(pg,{asChild:!0,...s,children:c.jsx(ve.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":SE(i.value)?"":void 0,...o,ref:l,onClick:G(o.onClick,g=>{g.currentTarget.focus()}),onPointerDown:G(o.onPointerDown,g=>{const y=g.target;y.hasPointerCapture(g.pointerId)&&y.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&(x(),i.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)},g.preventDefault())}),onKeyDown:G(o.onKeyDown,g=>{const y=d.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&f(g.key),!(y&&g.key===" ")&&VV.includes(g.key)&&(x(),g.preventDefault())})})})});Qk.displayName=Xk;var Jk="SelectValue",eE=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...a}=e,l=ls(Jk,n),{onValueNodeHasChildrenChange:u}=l,d=s!==void 0,f=be(t,l.onValueNodeChange);return Kt(()=>{u(d)},[u,d]),c.jsx(ve.span,{...a,ref:f,style:{pointerEvents:"none"},children:SE(l.value)?c.jsx(c.Fragment,{children:i}):s})});eE.displayName=Jk;var GV="SelectIcon",tE=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return c.jsx(ve.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});tE.displayName=GV;var KV="SelectPortal",nE=e=>c.jsx(Bl,{asChild:!0,...e});nE.displayName=KV;var Fs="SelectContent",rE=h.forwardRef((e,t)=>{const n=ls(Fs,e.__scopeSelect),[r,o]=h.useState();if(Kt(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?fo.createPortal(c.jsx(oE,{scope:e.__scopeSelect,children:c.jsx(gf.Slot,{scope:e.__scopeSelect,children:c.jsx("div",{children:e.children})})}),s):null}return c.jsx(sE,{...e,ref:t})});rE.displayName=Fs;var Yr=10,[oE,cs]=ia(Fs),ZV="SelectContentImpl",sE=h.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:a,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:x,sticky:g,hideWhenDetached:y,avoidCollisions:S,...v}=e,m=ls(Fs,n),[w,b]=h.useState(null),[C,_]=h.useState(null),R=be(t,ce=>b(ce)),[N,D]=h.useState(null),[O,B]=h.useState(null),A=vf(n),[H,L]=h.useState(!1),K=h.useRef(!1);h.useEffect(()=>{if(w)return vg(w)},[w]),rg();const ne=h.useCallback(ce=>{const[De,...He]=A().map(Se=>Se.ref.current),[$e]=He.slice(-1),Ve=document.activeElement;for(const Se of ce)if(Se===Ve||(Se==null||Se.scrollIntoView({block:"nearest"}),Se===De&&C&&(C.scrollTop=0),Se===$e&&C&&(C.scrollTop=C.scrollHeight),Se==null||Se.focus(),document.activeElement!==Ve))return},[A,C]),W=h.useCallback(()=>ne([N,w]),[ne,N,w]);h.useEffect(()=>{H&&W()},[H,W]);const{onOpenChange:F,triggerPointerDownPosRef:M}=m;h.useEffect(()=>{if(w){let ce={x:0,y:0};const De=$e=>{var Ve,Se;ce={x:Math.abs(Math.round($e.pageX)-(((Ve=M.current)==null?void 0:Ve.x)??0)),y:Math.abs(Math.round($e.pageY)-(((Se=M.current)==null?void 0:Se.y)??0))}},He=$e=>{ce.x<=10&&ce.y<=10?$e.preventDefault():w.contains($e.target)||F(!1),document.removeEventListener("pointermove",De),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",De),document.addEventListener("pointerup",He,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",De),document.removeEventListener("pointerup",He,{capture:!0})}}},[w,F,M]),h.useEffect(()=>{const ce=()=>F(!1);return window.addEventListener("blur",ce),window.addEventListener("resize",ce),()=>{window.removeEventListener("blur",ce),window.removeEventListener("resize",ce)}},[F]);const[X,le]=bE(ce=>{const De=A().filter(Ve=>!Ve.disabled),He=De.find(Ve=>Ve.ref.current===document.activeElement),$e=CE(De,ce,He);$e&&setTimeout(()=>$e.ref.current.focus())}),me=h.useCallback((ce,De,He)=>{const $e=!K.current&&!He;(m.value!==void 0&&m.value===De||$e)&&(D(ce),$e&&(K.current=!0))},[m.value]),rt=h.useCallback(()=>w==null?void 0:w.focus(),[w]),je=h.useCallback((ce,De,He)=>{const $e=!K.current&&!He;(m.value!==void 0&&m.value===De||$e)&&B(ce)},[m.value]),gt=r==="popper"?Yp:iE,Ue=gt===Yp?{side:a,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:x,sticky:g,hideWhenDetached:y,avoidCollisions:S}:{};return c.jsx(oE,{scope:n,content:w,viewport:C,onViewportChange:_,itemRefCallback:me,selectedItem:N,onItemLeave:rt,itemTextRefCallback:je,focusSelectedItem:W,selectedItemText:O,position:r,isPositioned:H,searchRef:X,children:c.jsx(Yd,{as:oo,allowPinchZoom:!0,children:c.jsx(Fd,{asChild:!0,trapped:m.open,onMountAutoFocus:ce=>{ce.preventDefault()},onUnmountAutoFocus:G(o,ce=>{var De;(De=m.trigger)==null||De.focus({preventScroll:!0}),ce.preventDefault()}),children:c.jsx(Ji,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:ce=>ce.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:c.jsx(gt,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:ce=>ce.preventDefault(),...v,...Ue,onPlaced:()=>L(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:G(v.onKeyDown,ce=>{const De=ce.ctrlKey||ce.altKey||ce.metaKey;if(ce.key==="Tab"&&ce.preventDefault(),!De&&ce.key.length===1&&le(ce.key),["ArrowUp","ArrowDown","Home","End"].includes(ce.key)){let $e=A().filter(Ve=>!Ve.disabled).map(Ve=>Ve.ref.current);if(["ArrowUp","End"].includes(ce.key)&&($e=$e.slice().reverse()),["ArrowUp","ArrowDown"].includes(ce.key)){const Ve=ce.target,Se=$e.indexOf(Ve);$e=$e.slice(Se+1)}setTimeout(()=>ne($e)),ce.preventDefault()}})})})})})})});sE.displayName=ZV;var qV="SelectItemAlignedPosition",iE=h.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=ls(Fs,n),i=cs(Fs,n),[a,l]=h.useState(null),[u,d]=h.useState(null),f=be(t,R=>d(R)),p=vf(n),x=h.useRef(!1),g=h.useRef(!0),{viewport:y,selectedItem:S,selectedItemText:v,focusSelectedItem:m}=i,w=h.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&u&&y&&S&&v){const R=s.trigger.getBoundingClientRect(),N=u.getBoundingClientRect(),D=s.valueNode.getBoundingClientRect(),O=v.getBoundingClientRect();if(s.dir!=="rtl"){const Ve=O.left-N.left,Se=D.left-Ve,vt=R.left-Se,Zt=R.width+vt,xo=Math.max(Zt,N.width),pn=window.innerWidth-Yr,wo=Wp(Se,[Yr,pn-xo]);a.style.minWidth=Zt+"px",a.style.left=wo+"px"}else{const Ve=N.right-O.right,Se=window.innerWidth-D.right-Ve,vt=window.innerWidth-R.right-Se,Zt=R.width+vt,xo=Math.max(Zt,N.width),pn=window.innerWidth-Yr,wo=Wp(Se,[Yr,pn-xo]);a.style.minWidth=Zt+"px",a.style.right=wo+"px"}const B=p(),A=window.innerHeight-Yr*2,H=y.scrollHeight,L=window.getComputedStyle(u),K=parseInt(L.borderTopWidth,10),ne=parseInt(L.paddingTop,10),W=parseInt(L.borderBottomWidth,10),F=parseInt(L.paddingBottom,10),M=K+ne+H+F+W,X=Math.min(S.offsetHeight*5,M),le=window.getComputedStyle(y),me=parseInt(le.paddingTop,10),rt=parseInt(le.paddingBottom,10),je=R.top+R.height/2-Yr,gt=A-je,Ue=S.offsetHeight/2,ce=S.offsetTop+Ue,De=K+ne+ce,He=M-De;if(De<=je){const Ve=S===B[B.length-1].ref.current;a.style.bottom="0px";const Se=u.clientHeight-y.offsetTop-y.offsetHeight,vt=Math.max(gt,Ue+(Ve?rt:0)+Se+W),Zt=De+vt;a.style.height=Zt+"px"}else{const Ve=S===B[0].ref.current;a.style.top="0px";const vt=Math.max(je,K+y.offsetTop+(Ve?me:0)+Ue)+He;a.style.height=vt+"px",y.scrollTop=De-je+y.offsetTop}a.style.margin=`${Yr}px 0`,a.style.minHeight=X+"px",a.style.maxHeight=A+"px",r==null||r(),requestAnimationFrame(()=>x.current=!0)}},[p,s.trigger,s.valueNode,a,u,y,S,v,s.dir,r]);Kt(()=>w(),[w]);const[b,C]=h.useState();Kt(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const _=h.useCallback(R=>{R&&g.current===!0&&(w(),m==null||m(),g.current=!1)},[w,m]);return c.jsx(QV,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:x,onScrollButtonChange:_,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:c.jsx(ve.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});iE.displayName=qV;var XV="SelectPopperPosition",Yp=h.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Yr,...s}=e,i=yf(n);return c.jsx(mg,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.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)"}})});Yp.displayName=XV;var[QV,yv]=ia(Fs,{}),Hp="SelectViewport",aE=h.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=cs(Hp,n),i=yv(Hp,n),a=be(t,s.onViewportChange),l=h.useRef(0);return c.jsxs(c.Fragment,{children:[c.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:r}),c.jsx(gf.Slot,{scope:n,children:c.jsx(ve.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"auto",...o.style},onScroll:G(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:p}=i;if(p!=null&&p.current&&f){const x=Math.abs(l.current-d.scrollTop);if(x>0){const g=window.innerHeight-Yr*2,y=parseFloat(f.style.minHeight),S=parseFloat(f.style.height),v=Math.max(y,S);if(v0?b:0,f.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});aE.displayName=Hp;var lE="SelectGroup",[JV,ez]=ia(lE),cE=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Tr();return c.jsx(JV,{scope:n,id:o,children:c.jsx(ve.div,{role:"group","aria-labelledby":o,...r,ref:t})})});cE.displayName=lE;var uE="SelectLabel",dE=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=ez(uE,n);return c.jsx(ve.div,{id:o.id,...r,ref:t})});dE.displayName=uE;var hd="SelectItem",[tz,fE]=ia(hd),hE=h.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,a=ls(hd,n),l=cs(hd,n),u=a.value===r,[d,f]=h.useState(s??""),[p,x]=h.useState(!1),g=be(t,v=>{var m;return(m=l.itemRefCallback)==null?void 0:m.call(l,v,r,o)}),y=Tr(),S=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")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 c.jsx(tz,{scope:n,value:r,disabled:o,textId:y,isSelected:u,onItemTextChange:h.useCallback(v=>{f(m=>m||((v==null?void 0:v.textContent)??"").trim())},[]),children:c.jsx(gf.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:c.jsx(ve.div,{role:"option","aria-labelledby":y,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:g,onFocus:G(i.onFocus,()=>x(!0)),onBlur:G(i.onBlur,()=>x(!1)),onPointerUp:G(i.onPointerUp,S),onPointerMove:G(i.onPointerMove,v=>{var m;o?(m=l.onItemLeave)==null||m.call(l):v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:G(i.onPointerLeave,v=>{var m;v.currentTarget===document.activeElement&&((m=l.onItemLeave)==null||m.call(l))}),onKeyDown:G(i.onKeyDown,v=>{var w;((w=l.searchRef)==null?void 0:w.current)!==""&&v.key===" "||(zV.includes(v.key)&&S(),v.key===" "&&v.preventDefault())})})})})});hE.displayName=hd;var Ma="SelectItemText",pE=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=ls(Ma,n),a=cs(Ma,n),l=fE(Ma,n),u=BV(Ma,n),[d,f]=h.useState(null),p=be(t,v=>f(v),l.onItemTextChange,v=>{var m;return(m=a.itemTextRefCallback)==null?void 0:m.call(a,v,l.value,l.disabled)}),x=d==null?void 0:d.textContent,g=h.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:x},l.value),[l.disabled,l.value,x]),{onNativeOptionAdd:y,onNativeOptionRemove:S}=u;return Kt(()=>(y(g),()=>S(g)),[y,S,g]),c.jsxs(c.Fragment,{children:[c.jsx(ve.span,{id:l.textId,...s,ref:p}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?fo.createPortal(s.children,i.valueNode):null]})});pE.displayName=Ma;var mE="SelectItemIndicator",gE=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return fE(mE,n).isSelected?c.jsx(ve.span,{"aria-hidden":!0,...r,ref:t}):null});gE.displayName=mE;var Bp="SelectScrollUpButton",vE=h.forwardRef((e,t)=>{const n=cs(Bp,e.__scopeSelect),r=yv(Bp,e.__scopeSelect),[o,s]=h.useState(!1),i=be(t,r.onScrollButtonChange);return Kt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=l.scrollTop>0;s(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?c.jsx(xE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});vE.displayName=Bp;var Gp="SelectScrollDownButton",yE=h.forwardRef((e,t)=>{const n=cs(Gp,e.__scopeSelect),r=yv(Gp,e.__scopeSelect),[o,s]=h.useState(!1),i=be(t,r.onScrollButtonChange);return Kt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?c.jsx(xE,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});yE.displayName=Gp;var xE=h.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=cs("SelectScrollButton",n),i=h.useRef(null),a=vf(n),l=h.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return h.useEffect(()=>()=>l(),[l]),Kt(()=>{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]),c.jsx(ve.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:G(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:G(o.onPointerMove,()=>{var u;(u=s.onItemLeave)==null||u.call(s),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:G(o.onPointerLeave,()=>{l()})})}),nz="SelectSeparator",wE=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c.jsx(ve.div,{"aria-hidden":!0,...r,ref:t})});wE.displayName=nz;var Kp="SelectArrow",rz=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=yf(n),s=ls(Kp,n),i=cs(Kp,n);return s.open&&i.position==="popper"?c.jsx(gg,{...o,...r,ref:t}):null});rz.displayName=Kp;function SE(e){return e===""||e===void 0}var _E=h.forwardRef((e,t)=>{const{value:n,...r}=e,o=h.useRef(null),s=be(t,o),i=ov(n);return h.useEffect(()=>{const a=o.current,l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==n&&d){const f=new Event("change",{bubbles:!0});d.call(a,n),a.dispatchEvent(f)}},[i,n]),c.jsx(oc,{asChild:!0,children:c.jsx("select",{...r,ref:s,defaultValue:n})})});_E.displayName="BubbleSelect";function bE(e){const t=_t(e),n=h.useRef(""),r=h.useRef(0),o=h.useCallback(i=>{const a=n.current+i;t(a),function l(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),s=h.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function CE(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=oz(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const l=i.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function oz(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var sz=qk,kE=Qk,iz=eE,az=tE,lz=nE,EE=rE,cz=aE,uz=cE,TE=dE,RE=hE,dz=pE,fz=gE,NE=vE,PE=yE,jE=wE;const cw=sz,uw=uz,dw=iz,Zp=h.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(kE,{ref:r,className:se("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),...n,children:[t,c.jsx(az,{asChild:!0,children:c.jsx(ZS,{className:"h-4 w-4 opacity-50"})})]}));Zp.displayName=kE.displayName;const DE=h.forwardRef(({className:e,...t},n)=>c.jsx(NE,{ref:n,className:se("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(Aj,{className:"h-4 w-4"})}));DE.displayName=NE.displayName;const ME=h.forwardRef(({className:e,...t},n)=>c.jsx(PE,{ref:n,className:se("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(ZS,{className:"h-4 w-4"})}));ME.displayName=PE.displayName;const qp=h.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>c.jsx(lz,{children:c.jsxs(EE,{ref:o,className:se("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",n==="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:n,...r,children:[c.jsx(DE,{}),c.jsx(cz,{className:se("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),c.jsx(ME,{})]})}));qp.displayName=EE.displayName;const Xp=h.forwardRef(({className:e,...t},n)=>c.jsx(TE,{ref:n,className:se("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Xp.displayName=TE.displayName;const Qp=h.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(RE,{ref:r,className:se("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),...n,children:[c.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(fz,{children:c.jsx(KS,{className:"h-4 w-4"})})}),c.jsx(dz,{children:t})]}));Qp.displayName=RE.displayName;const hz=h.forwardRef(({className:e,...t},n)=>c.jsx(jE,{ref:n,className:se("-mx-1 my-1 h-px bg-muted",e),...t}));hz.displayName=jE.displayName;const Jp=new Map([["aliyun-cdn",["阿里云-CDN","/imgs/providers/aliyun.svg"]],["aliyun-oss",["阿里云-OSS","/imgs/providers/aliyun.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.png"]]]),pz=Array.from(Jp.keys()),mz=Pg,gz=jg,vz=Dg,OE=h.forwardRef(({className:e,...t},n)=>c.jsx(Zl,{ref:n,className:se("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}));OE.displayName=Zl.displayName;const AE=h.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(vz,{children:[c.jsx(OE,{}),c.jsxs(ql,{ref:r,className:se("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),...n,children:[t,c.jsxs(Gd,{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:[c.jsx(Qm,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));AE.displayName=ql.displayName;const IE=({className:e,...t})=>c.jsx("div",{className:se("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});IE.displayName="DialogHeader";const LE=h.forwardRef(({className:e,...t},n)=>c.jsx(Xl,{ref:n,className:se("text-lg font-semibold leading-none tracking-tight",e),...t}));LE.displayName=Xl.displayName;const yz=h.forwardRef(({className:e,...t},n)=>c.jsx(Ql,{ref:n,className:se("text-sm text-muted-foreground",e),...t}));yz.displayName=Ql.displayName;const Es=new Map([["tencent",["腾讯云","/imgs/providers/tencent.svg"]],["aliyun",["阿里云","/imgs/providers/aliyun.svg"]],["ssh",["SSH部署","/imgs/providers/ssh.png"]]]),xv=Ie.union([Ie.literal("aliyun"),Ie.literal("tencent"),Ie.literal("ssh")],{message:"请选择云服务商"}),xz=({data:e,onAfterReq:t})=>{const{addAccess:n,updateAccess:r}=rc(),o=Ie.object({id:Ie.string().optional(),name:Ie.string().min(1).max(64),configType:xv,secretId:Ie.string().min(1).max(64),secretKey:Ie.string().min(1).max(64)});let s={secretId:"",secretKey:""};e&&(s=e.config);const i=ic({resolver:ac(o),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"tencent",secretId:s.secretId,secretKey:s.secretKey}}),a=async l=>{const u={id:l.id,name:l.name,configType:l.configType,config:{secretId:l.secretId,secretKey:l.secretKey}};try{const d=await rv(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,l.id){r(u);return}n(u)}catch(d){Object.entries(d.response.data).forEach(([p,x])=>{i.setError(p,{type:"manual",message:x.message})})}};return c.jsx(c.Fragment,{children:c.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:c.jsx(cc,{...i,children:c.jsxs("form",{onSubmit:l=>{l.stopPropagation(),i.handleSubmit(a)(l)},className:"space-y-8",children:[c.jsx(tt,{control:i.control,name:"name",render:({field:l})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"名称"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入授权名称",...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"id",render:({field:l})=>c.jsxs(qe,{className:"hidden",children:[c.jsx(Xe,{children:"配置类型"}),c.jsx(Qe,{children:c.jsx(ct,{...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"configType",render:({field:l})=>c.jsxs(qe,{className:"hidden",children:[c.jsx(Xe,{children:"配置类型"}),c.jsx(Qe,{children:c.jsx(ct,{...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"secretId",render:({field:l})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"SecretId"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入SecretId",...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"secretKey",render:({field:l})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"SecretKey"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入SecretKey",...l})}),c.jsx(Be,{})]})}),c.jsx("div",{className:"flex justify-end",children:c.jsx(Dt,{type:"submit",children:"保存"})})]})})})})},wz=({data:e,onAfterReq:t})=>{const{addAccess:n,updateAccess:r}=rc(),o=Ie.object({id:Ie.string().optional(),name:Ie.string().min(1).max(64),configType:xv,accessKeyId:Ie.string().min(1).max(64),accessSecretId:Ie.string().min(1).max(64)});let s={accessKeyId:"",accessKeySecret:""};e&&(s=e.config);const i=ic({resolver:ac(o),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"aliyun",accessKeyId:s.accessKeyId,accessSecretId:s.accessKeySecret}}),a=async l=>{const u={id:l.id,name:l.name,configType:l.configType,config:{accessKeyId:l.accessKeyId,accessKeySecret:l.accessSecretId}};try{const d=await rv(u);if(t(),u.id=d.id,u.created=d.created,u.updated=d.updated,l.id){r(u);return}n(u)}catch(d){Object.entries(d.response.data).forEach(([p,x])=>{i.setError(p,{type:"manual",message:x.message})});return}};return c.jsx(c.Fragment,{children:c.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:c.jsx(cc,{...i,children:c.jsxs("form",{onSubmit:l=>{l.stopPropagation(),i.handleSubmit(a)(l)},className:"space-y-8",children:[c.jsx(tt,{control:i.control,name:"name",render:({field:l})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"名称"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入授权名称",...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"id",render:({field:l})=>c.jsxs(qe,{className:"hidden",children:[c.jsx(Xe,{children:"配置类型"}),c.jsx(Qe,{children:c.jsx(ct,{...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"configType",render:({field:l})=>c.jsxs(qe,{className:"hidden",children:[c.jsx(Xe,{children:"配置类型"}),c.jsx(Qe,{children:c.jsx(ct,{...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"accessKeyId",render:({field:l})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"AccessKeyId"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入AccessKeyId",...l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"accessSecretId",render:({field:l})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"AccessKeySecret"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入AccessKeySecret",...l})}),c.jsx(Be,{})]})}),c.jsx(Be,{}),c.jsx("div",{className:"flex justify-end",children:c.jsx(Dt,{type:"submit",children:"保存"})})]})})})})};var wv="Radio",[Sz,FE]=_n(wv),[_z,bz]=Sz(wv),UE=h.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:o=!1,required:s,disabled:i,value:a="on",onCheck:l,...u}=e,[d,f]=h.useState(null),p=be(t,y=>f(y)),x=h.useRef(!1),g=d?!!d.closest("form"):!0;return c.jsxs(_z,{scope:n,checked:o,disabled:i,children:[c.jsx(ve.button,{type:"button",role:"radio","aria-checked":o,"data-state":zE(o),"data-disabled":i?"":void 0,disabled:i,value:a,...u,ref:p,onClick:G(e.onClick,y=>{o||l==null||l(),g&&(x.current=y.isPropagationStopped(),x.current||y.stopPropagation())})}),g&&c.jsx(Cz,{control:d,bubbles:!x.current,name:r,value:a,checked:o,required:s,disabled:i,style:{transform:"translateX(-100%)"}})]})});UE.displayName=wv;var $E="RadioIndicator",VE=h.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...o}=e,s=bz($E,n);return c.jsx(fn,{present:r||s.checked,children:c.jsx(ve.span,{"data-state":zE(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t})})});VE.displayName=$E;var Cz=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,s=h.useRef(null),i=ov(n),a=ug(t);return h.useEffect(()=>{const l=s.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(i!==n&&f){const p=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(p)}},[i,n,r]),c.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:s,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function zE(e){return e?"checked":"unchecked"}var kz=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Sv="RadioGroup",[Ez,f3]=_n(Sv,[zd,FE]),WE=zd(),YE=FE(),[Tz,Rz]=Ez(Sv),HE=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:o,value:s,required:i=!1,disabled:a=!1,orientation:l,dir:u,loop:d=!0,onValueChange:f,...p}=e,x=WE(n),g=Yl(u),[y,S]=so({prop:s,defaultProp:o,onChange:f});return c.jsx(Tz,{scope:n,name:r,required:i,disabled:a,value:y,onValueChange:S,children:c.jsx(O_,{asChild:!0,...x,orientation:l,dir:g,loop:d,children:c.jsx(ve.div,{role:"radiogroup","aria-required":i,"aria-orientation":l,"data-disabled":a?"":void 0,dir:g,...p,ref:t})})})});HE.displayName=Sv;var BE="RadioGroupItem",GE=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...o}=e,s=Rz(BE,n),i=s.disabled||r,a=WE(n),l=YE(n),u=h.useRef(null),d=be(t,u),f=s.value===o.value,p=h.useRef(!1);return h.useEffect(()=>{const x=y=>{kz.includes(y.key)&&(p.current=!0)},g=()=>p.current=!1;return document.addEventListener("keydown",x),document.addEventListener("keyup",g),()=>{document.removeEventListener("keydown",x),document.removeEventListener("keyup",g)}},[]),c.jsx(A_,{asChild:!0,...a,focusable:!i,active:f,children:c.jsx(UE,{disabled:i,required:s.required,checked:f,...l,...o,name:s.name,ref:d,onCheck:()=>s.onValueChange(o.value),onKeyDown:G(x=>{x.key==="Enter"&&x.preventDefault()}),onFocus:G(o.onFocus,()=>{var x;p.current&&((x=u.current)==null||x.click())})})})});GE.displayName=BE;var Nz="RadioGroupIndicator",KE=h.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,o=YE(n);return c.jsx(VE,{...o,...r,ref:t})});KE.displayName=Nz;var ZE=HE,qE=GE,Pz=KE;const _v=h.forwardRef(({className:e,...t},n)=>c.jsx(ZE,{className:se("grid gap-2",e),...t,ref:n}));_v.displayName=ZE.displayName;const bv=h.forwardRef(({className:e,...t},n)=>c.jsx(qE,{ref:n,className:se("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:c.jsx(Pz,{className:"flex items-center justify-center",children:c.jsx(QS,{className:"h-2.5 w-2.5 fill-current text-current"})})}));bv.displayName=qE.displayName;const XE=h.forwardRef(({className:e,...t},n)=>c.jsx("textarea",{className:se("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:n,...t}));XE.displayName="Textarea";function jz(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{r.result?t(r.result.toString()):n("No content found")},r.onerror=()=>n(r.error),r.readAsText(e)})}const Dz=({data:e,onAfterReq:t})=>{const{addAccess:n,updateAccess:r}=rc(),o=Ie.object({id:Ie.string().optional(),name:Ie.string().min(1).max(64),configType:xv,host:Ie.string().ip({message:"请输入合法的IP地址"}),port:Ie.string().min(1).max(5),username:Ie.string().min(1).max(64),password:Ie.string().min(0).max(64),key:Ie.string().min(0).max(20480),keyFile:Ie.string().optional(),command:Ie.string().min(1).max(2048),certPath:Ie.string().min(0).max(2048),keyPath:Ie.string().min(0).max(2048)});let s={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&&(s=e.config);const i=ic({resolver:ac(o),defaultValues:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,configType:"ssh",host:s.host,port:s.port,username:s.username,password:s.password,key:s.key,keyFile:s.keyFile,certPath:s.certPath,keyPath:s.keyPath,command:s.command}}),a=async u=>{console.log(u);const d={id:u.id,name:u.name,configType:u.configType,config:{host:u.host,port:u.port,username:u.username,password:u.password,key:u.key,command:u.command,certPath:u.certPath,keyPath:u.keyPath}};try{const f=await rv(d);if(t(),d.id=f.id,d.created=f.created,d.updated=f.updated,u.id){r(d);return}n(d)}catch(f){Object.entries(f.response.data).forEach(([x,g])=>{i.setError(x,{type:"manual",message:g.message})});return}},l=async u=>{var p;const d=(p=u.target.files)==null?void 0:p[0];if(!d)return;const f=await jz(d);i.setValue("key",f),i.setValue("keyFile","")};return c.jsx(c.Fragment,{children:c.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:c.jsx(cc,{...i,children:c.jsxs("form",{onSubmit:u=>{u.stopPropagation(),i.handleSubmit(a)(u)},className:"space-y-3",children:[c.jsx(tt,{control:i.control,name:"name",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"名称"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入授权名称",...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"id",render:({field:u})=>c.jsxs(qe,{className:"hidden",children:[c.jsx(Xe,{children:"配置类型"}),c.jsx(Qe,{children:c.jsx(ct,{...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"configType",render:({field:u})=>c.jsxs(qe,{className:"hidden",children:[c.jsx(Xe,{children:"配置类型"}),c.jsx(Qe,{children:c.jsx(ct,{...u})}),c.jsx(Be,{})]})}),c.jsxs("div",{className:"flex space-x-2",children:[c.jsx(tt,{control:i.control,name:"host",render:({field:u})=>c.jsxs(qe,{className:"grow",children:[c.jsx(Xe,{children:"服务器IP"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入Host",...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"port",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"SSH端口"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入Port",...u,type:"number"})}),c.jsx(Be,{})]})})]}),c.jsx(tt,{control:i.control,name:"username",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"用户名"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入用户名",...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"password",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"密码"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入密码",...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"key",render:({field:u})=>c.jsxs(qe,{hidden:!0,children:[c.jsx(Xe,{children:"Key(使用证书登录)"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入Key",...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"keyFile",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"Key(使用证书登录)"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入Key",...u,type:"file",onChange:l})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"certPath",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"证书上传路径"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入证书上传路径",...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"keyPath",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"私钥上传路径"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入私钥上传路径",...u})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:i.control,name:"command",render:({field:u})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"Command"}),c.jsx(Qe,{children:c.jsx(XE,{placeholder:"请输入要执行的命令",...u})}),c.jsx(Be,{})]})}),c.jsx(Be,{}),c.jsx("div",{className:"flex justify-end",children:c.jsx(Dt,{type:"submit",children:"保存"})})]})})})})};function Ga({trigger:e,op:t,data:n,className:r}){const[o,s]=h.useState(!1),i=Array.from(Es.keys()),[a,l]=h.useState((n==null?void 0:n.configType)||"");let u=c.jsx(c.Fragment,{children:" "});switch(a){case"tencent":u=c.jsx(xz,{data:n,onAfterReq:()=>{s(!1)}});break;case"aliyun":u=c.jsx(wz,{data:n,onAfterReq:()=>{s(!1)}});break;case"ssh":u=c.jsx(Dz,{data:n,onAfterReq:()=>{s(!1)}});break}const d=f=>f==a?"border-primary":"";return c.jsxs(mz,{onOpenChange:s,open:o,children:[c.jsx(gz,{asChild:!0,className:se(r),children:e}),c.jsxs(AE,{className:"sm:max-w-[600px] w-full",children:[c.jsx(IE,{children:c.jsxs(LE,{children:[t=="add"?"添加":"编辑","授权"]})}),c.jsxs("div",{className:"container",children:[c.jsx(Ll,{children:"服务商"}),c.jsx(_v,{value:a,className:"flex mt-3 space-x-2",onValueChange:f=>{console.log(f),l(f)},children:i.map(f=>{var p,x;return c.jsx("div",{className:"flex items-center space-x-2",children:c.jsxs(Ll,{children:[c.jsx(bv,{value:f,hidden:!0}),c.jsxs("div",{className:se("flex items-center space-x-2 border p-2 rounded cursor-pointer",d(f)),children:[c.jsx("img",{src:(p=Es.get(f))==null?void 0:p[1],className:"h-6"}),c.jsx("div",{children:(x=Es.get(f))==null?void 0:x[0]})]})]})},f)})}),u]})]})]})}const Mz=()=>{const{config:{accesses:e}}=rc(),[t,n]=h.useState(),r=is();h.useEffect(()=>{const g=new URLSearchParams(r.search).get("id");g&&(async()=>{const S=await d$(g);n(S)})()},[r.search]);const o=Ie.object({id:Ie.string().optional(),domain:Ie.string().regex(/^(?!:\/\/)([a-zA-Z0-9-_]+\.)+[a-zA-Z]{2,}$/,{message:"请输入正确的域名"}),access:Ie.string().regex(/^[a-zA-Z0-9]+$/,{message:"请选择DNS服务商授权配置"}),targetAccess:Ie.string().regex(/^[a-zA-Z0-9]+$/,{message:"请选择部署服务商配置"}),targetType:Ie.string().regex(/^[a-zA-Z0-9-]+$/,{message:"请选择部署服务类型"})}),s=ic({resolver:ac(o),defaultValues:{id:"",domain:"",access:"",targetAccess:"",targetType:""}});h.useEffect(()=>{t&&s.reset({id:t.id,domain:t.domain,access:t.access,targetAccess:t.targetAccess,targetType:t.targetType})},[t,s]);const[i,a]=h.useState(t?t.targetType:""),l=e.filter(x=>{if(i=="")return!0;const g=s.getValues().targetType.split("-");return x.configType===g[0]}),{toast:u}=cv(),d=as(),f=async x=>{const g={id:x.id,crontab:"0 0 * * *",domain:x.domain,access:x.access,targetAccess:x.targetAccess,targetType:x.targetType};try{await Fp(g);let y="域名编辑成功";g.id==""&&(y="域名添加成功"),u({title:"成功",description:y}),d("/")}catch(y){Object.entries(y.response.data).forEach(([v,m])=>{s.setError(v,{type:"manual",message:m.message})});return}},p=x=>s.getValues().targetType==x?"border-primary":"";return c.jsx(c.Fragment,{children:c.jsxs("div",{className:"",children:[c.jsx(dk,{}),c.jsxs("div",{className:"border-b h-10 text-muted-foreground",children:[t!=null&&t.id?"编辑":"新增","域名"]}),c.jsx("div",{className:"max-w-[35em] mx-auto mt-10",children:c.jsx(cc,{...s,children:c.jsxs("form",{onSubmit:s.handleSubmit(f),className:"space-y-8",children:[c.jsx(tt,{control:s.control,name:"domain",render:({field:x})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"域名"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"请输入域名",...x})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:s.control,name:"access",render:({field:x})=>c.jsxs(qe,{children:[c.jsxs(Xe,{className:"flex w-full justify-between",children:[c.jsx("div",{children:"DNS 服务商授权配置"}),c.jsx(Ga,{trigger:c.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[c.jsx(fx,{size:14}),"新增"]}),op:"add"})]}),c.jsx(Qe,{children:c.jsxs(cw,{...x,value:x.value,onValueChange:g=>{s.setValue("access",g)},children:[c.jsx(Zp,{children:c.jsx(dw,{placeholder:"请选择授权配置"})}),c.jsx(qp,{children:c.jsxs(uw,{children:[c.jsx(Xp,{children:"服务商授权配置"}),e.map(g=>{var y;return c.jsx(Qp,{value:g.id,children:c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx("img",{className:"w-6",src:(y=Es.get(g.configType))==null?void 0:y[1]}),c.jsx("div",{children:g.name})]})},g.id)})]})})]})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:s.control,name:"targetType",render:({field:x})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"部署服务类型"}),c.jsx(Qe,{children:c.jsx(_v,{className:"flex mt-3 space-x-2",onValueChange:g=>{a(g),s.setValue("targetType",g)},...x,children:pz.map(g=>{var y,S;return c.jsx("div",{className:"flex items-center space-x-2",children:c.jsxs(Ll,{children:[c.jsx(bv,{value:g,id:g,hidden:!0}),c.jsxs("div",{className:se("flex items-center space-x-2 border p-2 rounded cursor-pointer",p(g)),children:[c.jsx("img",{src:(y=Jp.get(g))==null?void 0:y[1],className:"h-6"}),c.jsx("div",{children:(S=Jp.get(g))==null?void 0:S[0]})]})]})},g)})})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:s.control,name:"targetAccess",render:({field:x})=>c.jsxs(qe,{children:[c.jsxs(Xe,{className:"w-full flex justify-between",children:[c.jsx("div",{children:"部署服务商授权配置"}),c.jsx(Ga,{trigger:c.jsxs("div",{className:"font-normal text-primary hover:underline cursor-pointer flex items-center",children:[c.jsx(fx,{size:14}),"新增"]}),op:"add"})]}),c.jsx(Qe,{children:c.jsxs(cw,{...x,onValueChange:g=>{s.setValue("targetAccess",g)},children:[c.jsx(Zp,{children:c.jsx(dw,{placeholder:"请选择授权配置"})}),c.jsx(qp,{children:c.jsxs(uw,{children:[c.jsx(Xp,{children:"服务商授权配置"}),l.map(g=>{var y;return c.jsx(Qp,{value:g.id,children:c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx("img",{className:"w-6",src:(y=Es.get(g.configType))==null?void 0:y[1]}),c.jsx("div",{children:g.name})]})},g.id)})]})})]})}),c.jsx(Be,{})]})}),c.jsx("div",{className:"flex justify-end",children:c.jsx(Dt,{type:"submit",children:"保存"})})]})})})]})})},Oz=()=>{const{config:e,deleteAccess:t}=rc(),{accesses:n}=e,r=async o=>{const s=await z4(o);t(s.id)};return c.jsxs("div",{className:"",children:[c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("div",{className:"text-muted-foreground",children:"授权管理"}),c.jsx(Ga,{trigger:c.jsx(Dt,{children:"添加授权"}),op:"add"})]}),n.length===0?c.jsxs("div",{className:"flex flex-col items-center mt-10",children:[c.jsx("span",{className:"bg-orange-100 p-5 rounded-full",children:c.jsx(Lj,{size:40,className:"text-primary"})}),c.jsx("div",{className:"text-center text-sm text-muted-foreground mt-3",children:"请添加授权开始部署证书吧。"}),c.jsx(Ga,{trigger:c.jsx(Dt,{children:"添加授权"}),op:"add",className:"mt-3"})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b sm:p-2 mt-5",children:[c.jsx("div",{className:"w-48",children:"名称"}),c.jsx("div",{className:"w-48",children:"服务商"}),c.jsx("div",{className:"w-52",children:"创建时间"}),c.jsx("div",{className:"w-52",children:"更新时间"}),c.jsx("div",{className:"grow",children:"操作"})]}),c.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"授权列表"}),n.map(o=>{var s,i;return c.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b sm:p-2 hover:bg-muted/50 text-sm",children:[c.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:o.name}),c.jsxs("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center space-x-2",children:[c.jsx("img",{src:(s=Es.get(o.configType))==null?void 0:s[1],className:"w-6"}),c.jsx("div",{children:(i=Es.get(o.configType))==null?void 0:i[0]})]}),c.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["创建于 ",o.created&&_l(o.created)]}),c.jsxs("div",{className:"sm:w-52 w-full pt-1 sm:pt-0 flex items-center",children:["更新于 ",o.updated&&_l(o.updated)]}),c.jsxs("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0",children:[c.jsx(Ga,{trigger:c.jsx(Dt,{variant:"link",className:"p-0",children:"编辑"}),op:"edit",data:o}),c.jsx(Ht,{orientation:"vertical",className:"h-4 mx-2"}),c.jsx(Dt,{variant:"link",className:"p-0",onClick:()=>{r(o)},children:"删除"})]})]},o.id)})]})]})},Az=Wl("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"}}),QE=h.forwardRef(({className:e,variant:t,...n},r)=>c.jsx("div",{ref:r,role:"alert",className:se(Az({variant:t}),e),...n}));QE.displayName="Alert";const JE=h.forwardRef(({className:e,...t},n)=>c.jsx("h5",{ref:n,className:se("mb-1 font-medium leading-none tracking-tight",e),...t}));JE.displayName="AlertTitle";const eT=h.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:se("text-sm [&_p]:leading-relaxed",e),...t}));eT.displayName="AlertDescription";function Iz(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var Cv="ScrollArea",[tT,h3]=_n(Cv),[Lz,Kn]=tT(Cv),nT=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[a,l]=h.useState(null),[u,d]=h.useState(null),[f,p]=h.useState(null),[x,g]=h.useState(null),[y,S]=h.useState(null),[v,m]=h.useState(0),[w,b]=h.useState(0),[C,_]=h.useState(!1),[R,N]=h.useState(!1),D=be(t,B=>l(B)),O=Yl(o);return c.jsx(Lz,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:d,content:f,onContentChange:p,scrollbarX:x,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:_,scrollbarY:y,onScrollbarYChange:S,scrollbarYEnabled:R,onScrollbarYEnabledChange:N,onCornerWidthChange:m,onCornerHeightChange:b,children:c.jsx(ve.div,{dir:O,...i,ref:D,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});nT.displayName=Cv;var rT="ScrollAreaViewport",oT=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...s}=e,i=Kn(rT,n),a=h.useRef(null),l=be(t,a,i.onViewportChange);return c.jsxs(c.Fragment,{children:[c.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:o}),c.jsx(ve.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:c.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});oT.displayName=rT;var Ar="ScrollAreaScrollbar",kv=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Kn(Ar,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,a=e.orientation==="horizontal";return h.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),o.type==="hover"?c.jsx(Fz,{...r,ref:t,forceMount:n}):o.type==="scroll"?c.jsx(Uz,{...r,ref:t,forceMount:n}):o.type==="auto"?c.jsx(sT,{...r,ref:t,forceMount:n}):o.type==="always"?c.jsx(Ev,{...r,ref:t}):null});kv.displayName=Ar;var Fz=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Kn(Ar,e.__scopeScrollArea),[s,i]=h.useState(!1);return h.useEffect(()=>{const a=o.scrollArea;let l=0;if(a){const u=()=>{window.clearTimeout(l),i(!0)},d=()=>{l=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",d)}}},[o.scrollArea,o.scrollHideDelay]),c.jsx(fn,{present:n||s,children:c.jsx(sT,{"data-state":s?"visible":"hidden",...r,ref:t})})}),Uz=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Kn(Ar,e.__scopeScrollArea),s=e.orientation==="horizontal",i=wf(()=>l("SCROLL_END"),100),[a,l]=Iz("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 h.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>l("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,o.scrollHideDelay,l]),h.useEffect(()=>{const u=o.viewport,d=s?"scrollLeft":"scrollTop";if(u){let f=u[d];const p=()=>{const x=u[d];f!==x&&(l("SCROLL"),i()),f=x};return u.addEventListener("scroll",p),()=>u.removeEventListener("scroll",p)}},[o.viewport,s,l,i]),c.jsx(fn,{present:n||a!=="hidden",children:c.jsx(Ev,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:G(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:G(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),sT=h.forwardRef((e,t)=>{const n=Kn(Ar,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=h.useState(!1),a=e.orientation==="horizontal",l=wf(()=>{if(n.viewport){const u=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=Kn(Ar,e.__scopeScrollArea),s=h.useRef(null),i=h.useRef(0),[a,l]=h.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=uT(a.viewport,a.content),d={...r,sizes:a,onSizesChange:l,hasThumb:u>0&&u<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:p=>i.current=p};function f(p,x){return Hz(p,i.current,a,x)}return n==="horizontal"?c.jsx($z,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const p=o.viewport.scrollLeft,x=fw(p,a,o.dir);s.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollLeft=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollLeft=f(p,o.dir))}}):n==="vertical"?c.jsx(Vz,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const p=o.viewport.scrollTop,x=fw(p,a);s.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollTop=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollTop=f(p))}}):null}),$z=h.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=Kn(Ar,e.__scopeScrollArea),[i,a]=h.useState(),l=h.useRef(null),u=be(t,l,s.onScrollbarXChange);return h.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),c.jsx(aT,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":xf(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(s.viewport){const p=s.viewport.scrollLeft+d.deltaX;e.onWheelScroll(p),fT(p,f)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:md(i.paddingLeft),paddingEnd:md(i.paddingRight)}})}})}),Vz=h.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=Kn(Ar,e.__scopeScrollArea),[i,a]=h.useState(),l=h.useRef(null),u=be(t,l,s.onScrollbarYChange);return h.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),c.jsx(aT,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":xf(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(s.viewport){const p=s.viewport.scrollTop+d.deltaY;e.onWheelScroll(p),fT(p,f)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:md(i.paddingTop),paddingEnd:md(i.paddingBottom)}})}})}),[zz,iT]=tT(Ar),aT=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:d,onResize:f,...p}=e,x=Kn(Ar,n),[g,y]=h.useState(null),S=be(t,D=>y(D)),v=h.useRef(null),m=h.useRef(""),w=x.viewport,b=r.content-r.viewport,C=_t(d),_=_t(l),R=wf(f,10);function N(D){if(v.current){const O=D.clientX-v.current.left,B=D.clientY-v.current.top;u({x:O,y:B})}}return h.useEffect(()=>{const D=O=>{const B=O.target;(g==null?void 0:g.contains(B))&&C(O,b)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[w,g,b,C]),h.useEffect(_,[r,_]),Bi(g,R),Bi(x.content,R),c.jsx(zz,{scope:n,scrollbar:g,hasThumb:o,onThumbChange:_t(s),onThumbPointerUp:_t(i),onThumbPositionChange:_,onThumbPointerDown:_t(a),children:c.jsx(ve.div,{...p,ref:S,style:{position:"absolute",...p.style},onPointerDown:G(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),v.current=g.getBoundingClientRect(),m.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),N(D))}),onPointerMove:G(e.onPointerMove,N),onPointerUp:G(e.onPointerUp,D=>{const O=D.target;O.hasPointerCapture(D.pointerId)&&O.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=m.current,x.viewport&&(x.viewport.style.scrollBehavior=""),v.current=null})})})}),pd="ScrollAreaThumb",lT=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=iT(pd,e.__scopeScrollArea);return c.jsx(fn,{present:n||o.hasThumb,children:c.jsx(Wz,{ref:t,...r})})}),Wz=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=Kn(pd,n),i=iT(pd,n),{onThumbPositionChange:a}=i,l=be(t,f=>i.onThumbChange(f)),u=h.useRef(),d=wf(()=>{u.current&&(u.current(),u.current=void 0)},100);return h.useEffect(()=>{const f=s.viewport;if(f){const p=()=>{if(d(),!u.current){const x=Bz(f,a);u.current=x,a()}};return a(),f.addEventListener("scroll",p),()=>f.removeEventListener("scroll",p)}},[s.viewport,d,a]),c.jsx(ve.div,{"data-state":i.hasThumb?"visible":"hidden",...o,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:G(e.onPointerDownCapture,f=>{const x=f.target.getBoundingClientRect(),g=f.clientX-x.left,y=f.clientY-x.top;i.onThumbPointerDown({x:g,y})}),onPointerUp:G(e.onPointerUp,i.onThumbPointerUp)})});lT.displayName=pd;var Tv="ScrollAreaCorner",cT=h.forwardRef((e,t)=>{const n=Kn(Tv,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?c.jsx(Yz,{...e,ref:t}):null});cT.displayName=Tv;var Yz=h.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=Kn(Tv,n),[s,i]=h.useState(0),[a,l]=h.useState(0),u=!!(s&&a);return Bi(o.scrollbarX,()=>{var f;const d=((f=o.scrollbarX)==null?void 0:f.offsetHeight)||0;o.onCornerHeightChange(d),l(d)}),Bi(o.scrollbarY,()=>{var f;const d=((f=o.scrollbarY)==null?void 0:f.offsetWidth)||0;o.onCornerWidthChange(d),i(d)}),u?c.jsx(ve.div,{...r,ref:t,style:{width:s,height:a,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function md(e){return e?parseInt(e,10):0}function uT(e,t){const n=e/t;return isNaN(n)?0:n}function xf(e){const t=uT(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function Hz(e,t,n,r="ltr"){const o=xf(n),s=o/2,i=t||s,a=o-i,l=n.scrollbar.paddingStart+i,u=n.scrollbar.size-n.scrollbar.paddingEnd-a,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return dT([l,u],f)(e)}function fw(e,t,n="ltr"){const r=xf(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,a=s-r,l=n==="ltr"?[0,i]:[i*-1,0],u=Wp(e,l);return dT([0,i],[0,a])(u)}function dT(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function fT(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,a=n.top!==s.top;(i||a)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function wf(e,t){const n=_t(e),r=h.useRef(0);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),h.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Bi(e,t){const n=_t(t);Kt(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}var hT=nT,Gz=oT,Kz=cT;const pT=h.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(hT,{ref:r,className:se("relative overflow-hidden",e),...n,children:[c.jsx(Gz,{className:"h-full w-full rounded-[inherit]",children:t}),c.jsx(mT,{}),c.jsx(Kz,{})]}));pT.displayName=hT.displayName;const mT=h.forwardRef(({className:e,orientation:t="vertical",...n},r)=>c.jsx(kv,{ref:r,orientation:t,className:se("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),...n,children:c.jsx(lT,{className:"relative flex-1 rounded-full bg-border"})}));mT.displayName=kv.displayName;const Zz=async e=>{let t=1;e.page&&(t=e.page);let n=50;e.perPage&&(n=e.perPage);let r="domain!=null";return e.domain&&(r=`domain="${e.domain}"`),await Vt().collection("deployments").getList(t,n,{filter:r,sort:"-deployedAt",expand:"domain"})},qz=()=>{const e=as(),[t,n]=h.useState(),[r]=Pj(),o=r.get("domain");return h.useEffect(()=>{(async()=>{const i={};o&&(i.domain=o);const a=await Zz(i);n(a.items)})()},[o]),c.jsxs(pT,{className:"h-[80vh] overflow-hidden",children:[c.jsx("div",{className:"text-muted-foreground",children:"部署历史"}),t!=null&&t.length?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"hidden sm:flex sm:flex-row text-muted-foreground text-sm border-b sm:p-2 mt-5",children:[c.jsx("div",{className:"w-48",children:"域名"}),c.jsx("div",{className:"w-24",children:"状态"}),c.jsx("div",{className:"w-56",children:"阶段"}),c.jsx("div",{className:"w-56 sm:ml-2 text-center",children:"最近执行时间"}),c.jsx("div",{className:"grow",children:"操作"})]}),c.jsx("div",{className:"sm:hidden flex text-sm text-muted-foreground",children:"部署历史"}),t==null?void 0:t.map(s=>{var i,a;return c.jsxs("div",{className:"flex flex-col sm:flex-row text-secondary-foreground border-b sm:p-2 hover:bg-muted/50 text-sm",children:[c.jsx("div",{className:"sm:w-48 w-full pt-1 sm:pt-0 flex items-center",children:(i=s.expand.domain)==null?void 0:i.domain}),c.jsx("div",{className:"sm:w-24 w-full pt-1 sm:pt-0 flex items-center",children:s.phase==="deploy"&&s.phaseSuccess?c.jsx(qS,{size:16,className:"text-green-700"}):c.jsx(XS,{size:16,className:"text-red-700"})}),c.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center",children:c.jsx(aC,{phase:s.phase,phaseSuccess:s.phaseSuccess})}),c.jsx("div",{className:"sm:w-56 w-full pt-1 sm:pt-0 flex items-center sm:justify-center",children:_l(s.deployedAt)}),c.jsx("div",{className:"flex items-center grow justify-start pt-1 sm:pt-0 sm:ml-2",children:c.jsxs(o1,{children:[c.jsx(s1,{asChild:!0,children:c.jsx(Dt,{variant:"link",className:"p-0",children:"日志"})}),c.jsxs(Mg,{className:"sm:max-w-5xl",children:[c.jsx(a1,{children:c.jsxs(l1,{children:[(a=s.expand.domain)==null?void 0:a.domain,"-",s.id,"部署详情"]})}),c.jsxs("div",{className:"bg-gray-950 text-stone-100 p-5 text-sm h-[80dvh]",children:[s.log.check&&c.jsx(c.Fragment,{children:s.log.check.map(l=>c.jsxs("div",{className:"flex flex-col mt-2",children:[c.jsxs("div",{className:"flex",children:[c.jsxs("div",{children:["[",l.time,"]"]}),c.jsx("div",{className:"ml-2",children:l.message})]}),l.error&&c.jsx("div",{className:"mt-1 text-red-600",children:l.error})]}))}),s.log.apply&&c.jsx(c.Fragment,{children:s.log.apply.map(l=>c.jsxs("div",{className:"flex flex-col mt-2",children:[c.jsxs("div",{className:"flex",children:[c.jsxs("div",{children:["[",l.time,"]"]}),c.jsx("div",{className:"ml-2",children:l.message})]}),l.error&&c.jsx("div",{className:"mt-1 text-red-600",children:l.error})]}))}),s.log.deploy&&c.jsx(c.Fragment,{children:s.log.deploy.map(l=>c.jsxs("div",{className:"flex flex-col mt-2",children:[c.jsxs("div",{className:"flex",children:[c.jsxs("div",{children:["[",l.time,"]"]}),c.jsx("div",{className:"ml-2",children:l.message})]}),l.error&&c.jsx("div",{className:"mt-1 text-red-600",children:l.error})]}))})]})]})]})})]},s.id)})]}):c.jsx(c.Fragment,{children:c.jsxs(QE,{className:"max-w-[40em] mx-auto mt-20",children:[c.jsx(JE,{children:"暂无数据"}),c.jsxs(eT,{children:[c.jsxs("div",{className:"flex items-center mt-5",children:[c.jsx("div",{children:c.jsx(Uj,{className:"text-yellow-400",size:36})}),c.jsxs("div",{className:"ml-2",children:[" ","你暂未创建任何部署,请先添加域名进行部署吧!"]})]}),c.jsx("div",{className:"mt-2 flex justify-end",children:c.jsx(Dt,{onClick:()=>{e("/")},children:"添加域名"})})]})]})})]})},Xz=e=>e instanceof Error?e.message:typeof e=="object"&&e!==null&&"message"in e?String(e.message):typeof e=="string"?e:"Something went wrong",Qz=Ie.object({username:Ie.string().email({message:"请输入正确的邮箱地址"}),password:Ie.string().min(10,{message:"密码至少10个字符"})}),Jz=()=>{const e=ic({resolver:ac(Qz),defaultValues:{username:"",password:""}}),t=async r=>{try{await Vt().admins.authWithPassword(r.username,r.password),n("/")}catch(o){const s=Xz(o);e.setError("username",{message:s}),e.setError("password",{message:s})}},n=as();return c.jsxs("div",{className:"max-w-[35em] border mx-auto mt-32 p-10 rounded-md shadow-md",children:[c.jsx("div",{className:"flex justify-center mb-10",children:c.jsx("img",{src:"/vite.svg",className:"w-16"})}),c.jsx(cc,{...e,children:c.jsxs("form",{onSubmit:e.handleSubmit(t),className:"space-y-8",children:[c.jsx(tt,{control:e.control,name:"username",render:({field:r})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"用户名"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"email",...r})}),c.jsx(Be,{})]})}),c.jsx(tt,{control:e.control,name:"password",render:({field:r})=>c.jsxs(qe,{children:[c.jsx(Xe,{children:"密码"}),c.jsx(Qe,{children:c.jsx(ct,{placeholder:"shadcn",...r,type:"password"})}),c.jsx(Be,{})]})}),c.jsx("div",{className:"flex justify-end",children:c.jsx(Dt,{type:"submit",children:"登录"})})]})})]})},e3=()=>Vt().authStore.isValid&&Vt().authStore.isAdmin?c.jsx(HS,{to:"/"}):c.jsx("div",{className:"container",children:c.jsx(BS,{})}),t3=mj([{path:"/",element:c.jsx(H4,{}),children:[{path:"/",element:c.jsx(m$,{})},{path:"/edit",element:c.jsx(Mz,{})},{path:"/access",element:c.jsx(Oz,{})},{path:"/history",element:c.jsx(qz,{})}]},{path:"/login",element:c.jsx(e3,{}),children:[{path:"/login",element:c.jsx(Jz,{})}]},{path:"/about",element:c.jsx("div",{children:"About"})}]);Sh.createRoot(document.getElementById("root")).render(c.jsx(Oe.StrictMode,{children:c.jsx(Cj,{router:t3})}))});export default n3(); diff --git a/ui/dist/index.html b/ui/dist/index.html index a0aab532..29dc216d 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/src/components/certimate/AccessEdit.tsx b/ui/src/components/certimate/AccessEdit.tsx index 38efa396..d218664c 100644 --- a/ui/src/components/certimate/AccessEdit.tsx +++ b/ui/src/components/certimate/AccessEdit.tsx @@ -89,12 +89,15 @@ export function AccessEdit({ { + console.log(val); + setConfigType(val); + }} > {typeKeys.map((key) => (
-