1import{r as m,j as s}from"./chunk-nq58eQEx.js";import{v as fe,w as x,x as P,y as pe,aj as me,ak as ve,al as he,j as be,k as y,am as ye,an as Te,ao as xe,ap as Pe,aq as Ce,ar as Re,as as je,H as h,at as we,au as Ee,av as Se,aw as Ae,p as Ve,ax as Ie,ay as Fe,az as _e,q as k,z as Be,A as Ne,t as Le,G as Oe,W as De,aA as Ue,U as ke,aB as Me,C as E,aa as S,S as We,b as Z,B as T,T as _,F as ze}from"./chunk-CdwB_NcU.js";import{_ as B,$ as $e,a0 as qe,a1 as He,a2 as J,a3 as ee,a4 as Ge,Y as Ke,Z as L,f as M,b as W,U as z,a5 as $,P as q,p as G,i as O,j as Xe,u as te,a6 as Ye,a7 as Qe,a8 as Ze,a9 as Je,aa as et,ab as tt,ac as at,ad as st,ae as rt,d as K,e as X,h as ot}from"./chunk-CKf4mebI.js";import{P as D,a as H}from"../entries/pages_spa.r0pTCx2G.js";import{V as nt}from"./chunk-Dzw4KN5J.js";import"./chunk-BLrTNcVZ.js";/* empty css */import"./chunk-BXl3LOEh.js";const[ae,N]=fe({name:"TabsContext",hookName:"useTabsContext",providerName:"<TabsProvider />"}),se=m.forwardRef((e,t)=>{const[a,r]=B()(e,["value"]),n=N(),o=$e(),l=qe({...o,present:n.value===e.value,immediate:!0}),g=x(n.getContentProps(a),l.getPresenceProps(),r);return s.jsx(He,{value:l,children:l.unmounted?null:s.jsx(P.div,{...g,ref:pe(l.ref,t)})})});se.displayName="TabContent";const re=m.forwardRef((e,t)=>{const a=N(),r=x(a.getIndicatorProps(),e);return s.jsx(P.div,{...r,ref:t})});re.displayName="TabIndicator";const oe=m.forwardRef((e,t)=>{const a=N(),r=x(a.getListProps(),e);return s.jsx(P.div,{...r,ref:t})});oe.displayName="TabList";const ne=m.forwardRef((e,t)=>{const[a,r]=B()(e,["disabled","value"]),n=N(),o=x(n.getTriggerProps(a),r);return s.jsx(P.button,{...o,ref:t})});ne.displayName="TabTrigger";var it=je("tabs").parts("root","list","trigger","content","indicator"),j=it.build(),lt=e=>e.ids?.root??`tabs:${e.id}`,w=e=>e.ids?.list??`tabs:${e.id}:list`,U=(e,t)=>e.ids?.content?.(t)??`tabs:${e.id}:content-${t}`,b=(e,t)=>e.ids?.trigger?.(t)??`tabs:${e.id}:trigger-${t}`,ie=e=>e.ids?.indicator??`tabs:${e.id}:indicator`,ct=e=>e.getById(w(e)),ut=(e,t)=>e.getById(U(e,t)),F=(e,t)=>e.getById(b(e,t)),Y=e=>e.getById(ie(e)),A=e=>{const a=`[role=tab][data-ownedby='${CSS.escape(w(e))}']:not([disabled])`;return _e(ct(e),a)},dt=e=>Ce(A(e)),gt=e=>Pe(A(e)),ft=(e,t)=>xe(A(e),b(e,t.value),t.loopFocus),pt=(e,t)=>Te(A(e),b(e,t.value),t.loopFocus),le=e=>({left:e?.offsetLeft??0,top:e?.offsetTop??0,width:e?.offsetWidth??0,height:e?.offsetHeight??0}),mt=(e,t)=>{const a=Fe(A(e),b(e,t));return ce(le(a))},ce=e=>({width:`${e.width}px`,height:`${e.height}px`,left:`${e.left}px`,top:`${e.top}px`});function vt(e,t){const{state:a,send:r,context:n,prop:o,scope:l}=e,g=o("translations"),f=a.matches("focused"),c=o("orientation")==="vertical",v=o("orientation")==="horizontal",I=o("composite");function C(i){return{selected:n.get("value")===i.value,focused:n.get("focusedValue")===i.value,disabled:!!i.disabled}}return{value:n.get("value"),focusedValue:n.get("focusedValue"),setValue(i){r({type:"SET_VALUE",value:i})},clearValue(){r({type:"CLEAR_VALUE"})},setIndicatorRect(i){const u=b(l,i);r({type:"SET_INDICATOR_RECT",id:u})},syncTabIndex(){r({type:"SYNC_TAB_INDEX"})},selectNext(i){r({type:"TAB_FOCUS",value:i,src:"selectNext"}),r({type:"ARROW_NEXT",src:"selectNext"})},selectPrev(i){r({type:"TAB_FOCUS",value:i,src:"selectPrev"}),r({type:"ARROW_PREV",src:"selectPrev"})},focus(){const i=n.get("value");i&&F(l,i)?.focus()},getRootProps(){return t.element({...j.root.attrs,id:lt(l),"data-orientation":o("orientation"),"data-focus":h(f),dir:o("dir")})},getListProps(){return t.element({...j.list.attrs,id:w(l),role:"tablist",dir:o("dir"),"data-focus":h(f),"aria-orientation":o("orientation"),"data-orientation":o("orientation"),"aria-label":g?.listLabel,onKeyDown(i){if(i.defaultPrevented||Se(i)||!Ae(i.currentTarget,Ve(i)))return;const u={ArrowDown(){v||r({type:"ARROW_NEXT",key:"ArrowDown"})},ArrowUp(){v||r({type:"ARROW_PREV",key:"ArrowUp"})},ArrowLeft(){c||r({type:"ARROW_PREV",key:"ArrowLeft"})},ArrowRight(){c||r({type:"ARROW_NEXT",key:"ArrowRight"})},Home(){r({type:"HOME"})},End(){r({type:"END"})}};let p=Ie(i,{dir:o("dir"),orientation:o("orientation")});const d=u[p];if(d){i.preventDefault(),d(i);return}}})},getTriggerState:C,getTriggerProps(i){const{value:u,disabled:p}=i,d=C(i);return t.button({...j.trigger.attrs,role:"tab",type:"button",disabled:p,dir:o("dir"),"data-orientation":o("orientation"),"data-disabled":h(p),"aria-disabled":p,"data-value":u,"aria-selected":d.selected,"data-selected":h(d.selected),"data-focus":h(d.focused),"aria-controls":d.selected?U(l,u):void 0,"data-ownedby":w(l),"data-ssr":h(n.get("ssr")),id:b(l,u),tabIndex:d.selected&&I?0:-1,onFocus(){r({type:"TAB_FOCUS",value:u})},onBlur(R){R.relatedTarget?.getAttribute("role")!=="tab"&&r({type:"TAB_BLUR"})},onClick(R){R.defaultPrevented||we(R)||p||(Ee()&&R.currentTarget.focu
1s(),r({type:"TAB_CLICK",value:u}))}})},getContentProps(i){const{value:u}=i,p=n.get("value")===u;return t.element({...j.content.attrs,dir:o("dir"),id:U(l,u),tabIndex:I?0:-1,"aria-labelledby":b(l,u),role:"tabpanel","data-ownedby":w(l),"data-selected":h(p),"data-orientation":o("orientation"),hidden:!p})},getIndicatorProps(){const i=n.get("indicatorRect"),u=n.get("indicatorTransition");return t.element({id:ie(l),...j.indicator.attrs,dir:o("dir"),"data-orientation":o("orientation"),style:{"--transition-property":"left, right, top, bottom, width, height","--left":i.left,"--top":i.top,"--width":i.width,"--height":i.height,position:"absolute",willChange:"var(--transition-property)",transitionProperty:"var(--transition-property)",transitionDuration:u?"var(--transition-duration, 150ms)":"0ms",transitionTimingFunction:"var(--transition-timing-function)",[v?"left":"top"]:v?"var(--left)":"var(--top)"}})}}}var{createMachine:ht}=me(),bt=ht({props({props:e}){return{dir:"ltr",orientation:"horizontal",activationMode:"automatic",loopFocus:!0,composite:!0,navigate(t){Re(t.node)},defaultValue:null,...e}},initialState(){return"idle"},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),onChange(a){e("onValueChange")?.({value:a})}})),focusedValue:t(()=>({defaultValue:e("value")||e("defaultValue"),sync:!0,onChange(a){e("onFocusChange")?.({focusedValue:a})}})),ssr:t(()=>({defaultValue:!0})),indicatorTransition:t(()=>({defaultValue:!1})),indicatorRect:t(()=>({defaultValue:{left:"0px",top:"0px",width:"0px",height:"0px"}}))}},watch({context:e,prop:t,track:a,action:r}){a([()=>e.get("value")],()=>{r(["allowIndicatorTransition","syncIndicatorRect","syncTabIndex","navigateIfNeeded"])}),a([()=>t("dir"),()=>t("orientation")],()=>{r(["syncIndicatorRect"])})},on:{SET_VALUE:{actions:["setValue"]},CLEAR_VALUE:{actions:["clearValue"]},SET_INDICATOR_RECT:{actions:["setIndicatorRect"]},SYNC_TAB_INDEX:{actions:["syncTabIndex"]}},entry:["syncIndicatorRect","syncTabIndex","syncSsr"],exit:["cleanupObserver"],states:{idle:{on:{TAB_FOCUS:{target:"focused",actions:["setFocusedValue"]},TAB_CLICK:{target:"focused",actions:["setFocusedValue","setValue"]}}},focused:{on:{TAB_CLICK:{actions:["setFocusedValue","setValue"]},ARROW_PREV:[{guard:"selectOnFocus",actions:["focusPrevTab","selectFocusedTab"]},{actions:["focusPrevTab"]}],ARROW_NEXT:[{guard:"selectOnFocus",actions:["focusNextTab","selectFocusedTab"]},{actions:["focusNextTab"]}],HOME:[{guard:"selectOnFocus",actions:["focusFirstTab","selectFocusedTab"]},{actions:["focusFirstTab"]}],END:[{guard:"selectOnFocus",actions:["focusLastTab","selectFocusedTab"]},{actions:["focusLastTab"]}],TAB_FOCUS:{actions:["setFocusedValue"]},TAB_BLUR:{target:"idle",actions:["clearFocusedValue"]}}}},implementations:{guards:{selectOnFocus:({prop:e})=>e("activationMode")==="automatic"},actions:{selectFocusedTab({context:e,prop:t}){y(()=>{const a=e.get("focusedValue");if(!a)return;const n=t("deselectable")&&e.get("value")===a?null:a;e.set("value",n)})},setFocusedValue({context:e,event:t,flush:a}){t.value!=null&&a(()=>{e.set("focusedValue",t.value)})},clearFocusedValue({context:e}){e.set("focusedValue",null)},setValue({context:e,event:t,prop:a}){const r=a("deselectable")&&e.get("value")===e.get("focusedValue");e.set("value",r?null:t.value)},clearValue({context:e}){e.set("value",null)},focusFirstTab({scope:e}){y(()=>{dt(e)?.focus()})},focusLastTab({scope:e}){y(()=>{gt(e)?.focus()})},focusNextTab({context:e,prop:t,scope:a,event:r}){const n=r.value??e.get("focusedValue");if(!n)return;const o=ft(a,{value:n,loopFocus:t("loopFocus")});y(()=>{t("composite")?o?.focus():o?.dataset.value!=null&&e.set("focusedValue",o.dataset.value)})},focusPrevTab({context:e,prop:t,scope:a,event:r}){const n=r.value??e.get("focusedValue");if(!n)return;const o=pt(a,{value:n,loopFocus:t("loopFocus")});y(()=>{t("composite")?o?.focus():o?.dataset.value!=null&&e.set("focusedValue",o.dataset.value)})},syncTabIndex({context:e,scope:t}){y(()=>{const a=e.get("value");if(!a)return;const r=ut(t,a);if(!r)return;ye(r).length>0?r.removeAttribute("tabindex"):r.setAttribute("tabindex","0")})},cleanupObserver({refs:e}){const t=e.get("indicatorCleanup");t&&t()},allowIndicatorTransition({context:e}){e.set("indicatorTransition",!0)},setIndicatorRect({context:e,event:t,scope:a}){const r=t.id??e.get("value");if(!Y(a))return;if(!r){e.set("indicatorTransition",!1);return}F(a,r)&&(e.set("indicatorRect",mt(a,r)),be(()=>{e.set("indicatorTransition",!1)}))},syncSsr({context:e}){e.set("ssr",!1)},syncIndicatorRect({context:e,refs:t,scope:a}){const r=t.get("indicatorCleanup");r&&r();const n=e.get("value");if(!n){e.set("indicatorTransition",!1);return}const o=F(a,n),l=Y(a);if(!o||!l)return;const g=he([o],{measure(f){return le(f)},onEntry({rects:f}){const[c]=f;e.set("indicatorRect",ce(c))}});t.set("indicatorCleanup",g)},navigateIfNeeded({context:e,prop:t,scope:a}){const r=e.get("value");if(!r)return;const n=F(a,r);ve(n)&&t("navigate")?.({value:r,node:n,href:n.href})}}}});k()(["activationMode","composite","deselectable","dir","getRootNode","id","ids","loopFocus","navigate","onFocusChange","onValueChange","orientation","translations","value","defaultValue"]);k()(["disabled","value"]);k()(["value"]);const yt=e=>{const t=m.useId(),{getRootNode:a}=Be(),{dir:r}=Ne(),n={id:t,dir:r,getRootNode:a,...e},o=Le(bt,n);return vt(o,Oe)},ue=m.forwardRef((e,t)=>
1{const[a,r]=J(e),[n,o]=B()(r,["activationMode","composite","defaultValue","deselectable","id","ids","loopFocus","navigate","onFocusChange","onValueChange","orientation","translations","value"]),l=yt(n),g=x(l.getRootProps(),o);return s.jsx(ae,{value:l,children:s.jsx(ee,{value:a,children:s.jsx(P.div,{...g,ref:t})})})});ue.displayName="TabsRoot";const de=m.forwardRef((e,t)=>{const[a,r]=J(e),[{value:n},o]=B()(r,["value"]),l=x(n.getRootProps(),o);return s.jsx(ae,{value:n,children:s.jsx(ee,{value:a,children:s.jsx(P.div,{...l,ref:t})})})});de.displayName="TabsRootProvider";const Tt=m.forwardRef(function(t,a){const r=De({key:"button"}),[n,o]=m.useMemo(()=>r.splitVariantProps(t),[t,r]);return s.jsx(Ue,{value:n,children:s.jsx(Ge,{ref:a,...o})})}),{withProvider:ge,withContext:V}=ke({key:"tabs"});ge(de,"root",{forwardAsChild:!0});const xt=ge(ue,"root",{forwardAsChild:!0}),Pt=V(ne,"trigger",{forwardAsChild:!0}),Ct=V(se,"content",{forwardAsChild:!0});V("div","contentGroup");const Rt=V(oe,"list",{forwardAsChild:!0});V(re,"indicator",{forwardAsChild:!0});const jt=()=>{const{theme:e,setTheme:t}=Me();return s.jsxs(E,{maxW:"full",children:[s.jsx(S,{size:"sm",py:4,children:"Appearance"}),s.jsx(Ke,{onValueChange:a=>t(a.value??"system"),value:e,colorPalette:"teal",children:s.jsxs(We,{children:[s.jsx(L,{value:"system",children:"System"}),s.jsx(L,{value:"light",children:"Light Mode"}),s.jsx(L,{value:"dark",children:"Dark Mode"})]})})]})},wt=()=>{const{showSuccessToast:e}=q(),{register:t,handleSubmit:a,reset:r,getValues:n,formState:{errors:o,isSubmitting:l}}=M({mode:"onBlur",criteriaMode:"all"}),g=W({mutationFn:c=>z.updatePasswordMe({requestBody:c}),onSuccess:()=>{e("Password updated successfully."),r()},onError:c=>{$(c)}}),f=async c=>{g.mutate(c)};return s.jsxs(E,{maxW:"full",children:[s.jsx(S,{size:"sm",py:4,children:"Change Password"}),s.jsxs(Z,{as:"form",onSubmit:a(f),children:[s.jsxs(nt,{gap:4,w:{base:"100%",md:"sm"},children:[s.jsx(D,{type:"current_password",startElement:s.jsx(O,{}),...t("current_password",G()),placeholder:"Current Password",errors:o}),s.jsx(D,{type:"new_password",startElement:s.jsx(O,{}),...t("new_password",G()),placeholder:"New Password",errors:o}),s.jsx(D,{type:"confirm_password",startElement:s.jsx(O,{}),...t("confirm_password",Xe(n)),placeholder:"Confirm Password",errors:o})]}),s.jsx(T,{variant:"solid",mt:4,type:"submit",loading:l,children:"Save"})]})]})},Et=()=>{const[e,t]=m.useState(!1),a=te(),{showSuccessToast:r}=q(),{handleSubmit:n,formState:{isSubmitting:o}}=M(),{logout:l}=H(),g=W({mutationFn:()=>z.deleteUserMe(),onSuccess:()=>{r("Your account has been successfully deleted"),t(!1),l()},onError:c=>{$(c)},onSettled:()=>{a.invalidateQueries({queryKey:["currentUser"]})}}),f=async()=>{g.mutate()};return s.jsxs(Ye,{size:{base:"xs",md:"md"},role:"alertdialog",placement:"center",open:e,onOpenChange:({open:c})=>t(c),children:[s.jsx(Qe,{asChild:!0,children:s.jsx(T,{variant:"solid",colorPalette:"red",mt:4,children:"Delete"})}),s.jsx(Ze,{children:s.jsxs("form",{onSubmit:n(f),children:[s.jsx(Je,{}),s.jsx(et,{children:s.jsx(tt,{children:"Confirmation Required"})}),s.jsx(at,{children:s.jsxs(_,{mb:4,children:["All your account data will be"," ",s.jsx("strong",{children:"permanently deleted."})," If you are sure, please click ",s.jsx("strong",{children:'"Confirm"'})," to proceed. This action cannot be undone."]})}),s.jsx(st,{gap:2,children:s.jsxs(Tt,{children:[s.jsx(rt,{asChild:!0,children:s.jsx(T,{variant:"subtle",colorPalette:"gray",disabled:o,children:"Cancel"})}),s.jsx(T,{variant:"solid",colorPalette:"red",type:"submit",loading:o,children:"Delete"})]})})]})})]})},St=()=>s.jsxs(E,{maxW:"full",children:[s.jsx(S,{size:"sm",py:4,children:"Delete Account"}),s.jsx(_,{children:"Permanently delete your data and everything associated with your account."}),s.jsx(Et,{})]}),At=()=>{const e=te(),{showSuccessToast:t}=q(),[a,r]=m.useState(!1),{user:n}=H(),{register:o,handleSubmit:l,reset:g,getValues:f,formState:{isSubmitting:c,errors:v,isDirty:I}}=M({mode:"onBlur",criteriaMode:"all",defaultValues:{full_name:n?.full_name,email:n?.email}}),C=()=>{r(!a)},i=W({mutationFn:d=>z.updateUserMe({requestBody:d}),onSuccess:()=>{t("User updated successfully.")},onError:d=>{$(d)},onSettled:()=>
1{e.invalidateQueries()}}),u=async d=>{i.mutate(d)},p=()=>{g(),C()};return s.jsxs(E,{maxW:"full",children:[s.jsx(S,{size:"sm",py:4,children:"User Information"}),s.jsxs(Z,{w:{sm:"full",md:"sm"},as:"form",onSubmit:l(u),children:[s.jsx(K,{label:"Full name",children:a?s.jsx(X,{...o("full_name",{maxLength:30}),type:"text",size:"md"}):s.jsx(_,{fontSize:"md",py:2,color:n?.full_name?"inherit":"gray",truncate:!0,maxW:"sm",children:n?.full_name||"N/A"})}),s.jsx(K,{mt:4,label:"Email",invalid:!!v.email,errorText:v.email?.message,children:a?s.jsx(X,{...o("email",{required:"Email is required",pattern:ot}),type:"email",size:"md"}):s.jsx(_,{fontSize:"md",py:2,truncate:!0,maxW:"sm",children:n?.email})}),s.jsxs(ze,{mt:4,gap:3,children:[s.jsx(T,{variant:"solid",onClick:C,type:a?"button":"submit",loading:a?c:!1,disabled:a?!I||!f("email"):!1,children:a?"Save":"Edit"}),a&&s.jsx(T,{variant:"subtle",colorPalette:"gray",onClick:p,disabled:c,children:"Cancel"})]})]})]})},Q=[{value:"my-profile",title:"My profile",component:At},{value:"password",title:"Password",component:wt},{value:"appearance",title:"Appearance",component:jt},{value:"danger-zone",title:"Danger zone",component:St}];function Ut(){const{user:e}=H(),t=e?.is_superuser?Q.slice(0,3):Q;return e?s.jsxs(E,{maxW:"full",children:[s.jsx(S,{size:"lg",textAlign:{base:"center",md:"left"},py:12,children:"User Settings"}),s.jsxs(xt,{defaultValue:"my-profile",variant:"subtle",children:[s.jsx(Rt,{children:t.map(a=>s.jsx(Pt,{value:a.value,children:a.title},a.value))}),t.map(a=>s.jsx(Ct,{value:a.value,children:s.jsx(a.component,{})},a.value))]})]}):null}export{Ut as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.