@objectstack/account 7.2.1 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -144,5 +144,5 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
144
144
 
145
145
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
146
146
 
147
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return j.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},kw=`DialogDescriptionWarning`,Aw=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Dw(kw).contentName}}.`;return j.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},jw=nw,Mw=cw,Nw=uw,Pw=mw,Fw=yw,Iw=xw,Lw=Cw,Rw=jw,zw=Mw,Bw=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Nw,{className:X(`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}));Bw.displayName=Nw.displayName;var Vw=iy(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),Hw=j.forwardRef(({side:e=`right`,className:t,children:n,...r},i)=>(0,M.jsxs)(zw,{children:[(0,M.jsx)(Bw,{}),(0,M.jsxs)(Pw,{ref:i,className:X(Vw({side:e}),t),...r,children:[n,(0,M.jsxs)(Lw,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,M.jsx)(ob,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Hw.displayName=Pw.displayName;var Uw=({className:e,...t})=>(0,M.jsx)(`div`,{className:X(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});Uw.displayName=`SheetHeader`;var Ww=({className:e,...t})=>(0,M.jsx)(`div`,{className:X(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Ww.displayName=`SheetFooter`;var Gw=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Fw,{ref:n,className:X(`text-lg font-semibold text-foreground`,e),...t}));Gw.displayName=Fw.displayName;var Kw=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Iw,{ref:n,className:X(`text-sm text-muted-foreground`,e),...t}));Kw.displayName=Iw.displayName;function qw({className:e,...t}){return(0,M.jsx)(`div`,{className:X(`bg-muted animate-pulse rounded-md`,e),...t})}var Jw=[`top`,`right`,`bottom`,`left`],Yw=Math.min,Xw=Math.max,Zw=Math.round,Qw=Math.floor,$w=e=>({x:e,y:e}),eT={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function tT(e,t,n){return Xw(e,Yw(t,n))}function nT(e,t){return typeof e==`function`?e(t):e}function rT(e){return e.split(`-`)[0]}function iT(e){return e.split(`-`)[1]}function aT(e){return e===`x`?`y`:`x`}function oT(e){return e===`y`?`height`:`width`}function sT(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function cT(e){return aT(sT(e))}function lT(e,t,n){n===void 0&&(n=!1);let r=iT(e),i=cT(e),a=oT(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=vT(o)),[o,vT(o)]}function uT(e){let t=vT(e);return[dT(e),t,dT(t)]}function dT(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var fT=[`left`,`right`],pT=[`right`,`left`],mT=[`top`,`bottom`],hT=[`bottom`,`top`];function gT(e,t,n){switch(e){case`top`:case`bottom`:return n?t?pT:fT:t?fT:pT;case`left`:case`right`:return t?mT:hT;default:return[]}}function _T(e,t,n,r){let i=iT(e),a=gT(rT(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(dT)))),a}function vT(e){let t=rT(e);return eT[t]+e.slice(t.length)}function yT(e){return{top:0,right:0,bottom:0,left:0,...e}}function bT(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:yT(e)}function xT(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ST(e,t,n){let{reference:r,floating:i}=e,a=sT(t),o=cT(t),s=oT(o),c=rT(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(iT(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function CT(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=nT(t,e),p=bT(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=xT(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=xT(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var wT=50,TT=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:CT},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ST(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<wT&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ST(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ET=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=nT(e,t)||{};if(l==null)return{};let d=bT(u),f={x:n,y:r},p=cT(i),m=oT(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Yw(d[_],T),D=Yw(d[v],T),O=E,ee=C-h[m]-D,te=C/2-h[m]/2+w,ne=tT(O,te,ee),re=!c.arrow&&iT(i)!=null&&te!==ne&&a.reference[m]/2-(te<O?E:D)-h[m]/2<0,ie=re?te<O?te-O:te-ee:0;return{[p]:f[p]+ie,data:{[p]:ne,centerOffset:te-ne-ie,...re&&{alignmentOffset:ie}},reset:re}}}),DT=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=nT(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=rT(r),_=sT(o),v=rT(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[vT(o)]:uT(o)),x=p!==`none`;!d&&x&&b.push(..._T(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=lT(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==sT(t))||T.every(e=>sT(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=sT(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function OT(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kT(e){return Jw.some(t=>e[t]>=0)}var AT=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=nT(e,t);switch(i){case`referenceHidden`:{let e=OT(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:kT(e)}}}case`escaped`:{let e=OT(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:kT(e)}}}default:return{}}}}},jT=new Set([`left`,`top`]);async function MT(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=rT(n),s=iT(n),c=sT(n)===`y`,l=jT.has(o)?-1:1,u=a&&c?-1:1,d=nT(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var NT=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await MT(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},PT=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=nT(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=sT(rT(i)),p=aT(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=tT(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=tT(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},FT=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=nT(e,t),u={x:n,y:r},d=sT(i),f=aT(d),p=u[f],m=u[d],h=nT(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=jT.has(rT(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},IT=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=nT(e,t),u=await o.detectOverflow(t,l),d=rT(i),f=iT(i),p=sT(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Yw(h-u[g],v),x=Yw(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Xw(u.left,0),t=Xw(u.right,0),n=Xw(u.top,0),r=Xw(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Xw(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Xw(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function LT(){return typeof window<`u`}function RT(e){return VT(e)?(e.nodeName||``).toLowerCase():`#document`}function zT(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function BT(e){return((VT(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function VT(e){return LT()?e instanceof Node||e instanceof zT(e).Node:!1}function HT(e){return LT()?e instanceof Element||e instanceof zT(e).Element:!1}function UT(e){return LT()?e instanceof HTMLElement||e instanceof zT(e).HTMLElement:!1}function WT(e){return!LT()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof zT(e).ShadowRoot}function GT(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=nE(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function KT(e){return/^(table|td|th)$/.test(RT(e))}function qT(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var JT=/transform|translate|scale|rotate|perspective|filter/,YT=/paint|layout|strict|content/,XT=e=>!!e&&e!==`none`,ZT;function QT(e){let t=HT(e)?nE(e):e;return XT(t.transform)||XT(t.translate)||XT(t.scale)||XT(t.rotate)||XT(t.perspective)||!eE()&&(XT(t.backdropFilter)||XT(t.filter))||JT.test(t.willChange||``)||YT.test(t.contain||``)}function $T(e){let t=iE(e);for(;UT(t)&&!tE(t);){if(QT(t))return t;if(qT(t))return null;t=iE(t)}return null}function eE(){return ZT??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ZT}function tE(e){return/^(html|body|#document)$/.test(RT(e))}function nE(e){return zT(e).getComputedStyle(e)}function rE(e){return HT(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function iE(e){if(RT(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||WT(e)&&e.host||BT(e);return WT(t)?t.host:t}function aE(e){let t=iE(e);return tE(t)?e.ownerDocument?e.ownerDocument.body:e.body:UT(t)&&GT(t)?t:aE(t)}function oE(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=aE(e),i=r===e.ownerDocument?.body,a=zT(r);if(i){let e=sE(a);return t.concat(a,a.visualViewport||[],GT(r)?r:[],e&&n?oE(e):[])}else return t.concat(r,oE(r,[],n))}function sE(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function cE(e){let t=nE(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=UT(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Zw(n)!==a||Zw(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function lE(e){return HT(e)?e:e.contextElement}function uE(e){let t=lE(e);if(!UT(t))return $w(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=cE(t),o=(a?Zw(n.width):n.width)/r,s=(a?Zw(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var dE=$w(0);function fE(e){let t=zT(e);return!eE()||!t.visualViewport?dE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==zT(e)?!1:t}function mE(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=lE(e),o=$w(1);t&&(r?HT(r)&&(o=uE(r)):o=uE(e));let s=pE(a,n,r)?fE(a):$w(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=zT(a),t=r&&HT(r)?zT(r):r,n=e,i=sE(n);for(;i&&r&&t!==n;){let e=uE(i),t=i.getBoundingClientRect(),r=nE(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=zT(i),i=sE(n)}}return xT({width:u,height:d,x:c,y:l})}function hE(e,t){let n=rE(e).scrollLeft;return t?t.left+n:mE(BT(e)).left+n}function gE(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-hE(e,n),y:n.top+t.scrollTop}}function _E(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=BT(r),s=t?qT(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=$w(1),u=$w(0),d=UT(r);if((d||!d&&!a)&&((RT(r)!==`body`||GT(o))&&(c=rE(r)),d)){let e=mE(r);l=uE(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?gE(o,c):$w(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function vE(e){return Array.from(e.getClientRects())}function yE(e){let t=BT(e),n=rE(e),r=e.ownerDocument.body,i=Xw(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Xw(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+hE(e),s=-n.scrollTop;return nE(r).direction===`rtl`&&(o+=Xw(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var bE=25;function xE(e,t){let n=zT(e),r=BT(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=eE();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=hE(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=bE&&(a-=o)}else l<=bE&&(a+=l);return{width:a,height:o,x:s,y:c}}function SE(e,t){let n=mE(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=UT(e)?uE(e):$w(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function CE(e,t,n){let r;if(t===`viewport`)r=xE(e,n);else if(t===`document`)r=yE(BT(e));else if(HT(t))r=SE(t,n);else{let n=fE(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return xT(r)}function wE(e,t){let n=iE(e);return n===t||!HT(n)||tE(n)?!1:nE(n).position===`fixed`||wE(n,t)}function TE(e,t){let n=t.get(e);if(n)return n;let r=oE(e,[],!1).filter(e=>HT(e)&&RT(e)!==`body`),i=null,a=nE(e).position===`fixed`,o=a?iE(e):e;for(;HT(o)&&!tE(o);){let t=nE(o),n=QT(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||GT(o)&&!n&&wE(e,o))?r=r.filter(e=>e!==o):i=t,o=iE(o)}return t.set(e,r),r}function EE(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?qT(t)?[]:TE(t,this._c):[].concat(n),r],o=CE(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=CE(t,a[e],i);s=Xw(n.top,s),c=Yw(n.right,c),l=Yw(n.bottom,l),u=Xw(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function DE(e){let{width:t,height:n}=cE(e);return{width:t,height:n}}function OE(e,t,n){let r=UT(t),i=BT(t),a=n===`fixed`,o=mE(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=$w(0);function l(){c.x=hE(i)}if(r||!r&&!a)if((RT(t)!==`body`||GT(i))&&(s=rE(t)),r){let e=mE(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?gE(i,s):$w(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function kE(e){return nE(e).position===`static`}function AE(e,t){if(!UT(e)||nE(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return BT(e)===n&&(n=n.ownerDocument.body),n}function jE(e,t){let n=zT(e);if(qT(e))return n;if(!UT(e)){let t=iE(e);for(;t&&!tE(t);){if(HT(t)&&!kE(t))return t;t=iE(t)}return n}let r=AE(e,t);for(;r&&KT(r)&&kE(r);)r=AE(r,t);return r&&tE(r)&&kE(r)&&!QT(r)?n:r||$T(e)||n}var ME=async function(e){let t=this.getOffsetParent||jE,n=this.getDimensions,r=await n(e.floating);return{reference:OE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function NE(e){return nE(e).direction===`rtl`}var PE={convertOffsetParentRelativeRectToViewportRelativeRect:_E,getDocumentElement:BT,getClippingRect:EE,getOffsetParent:jE,getElementRects:ME,getClientRects:vE,getDimensions:DE,getScale:uE,isElement:HT,isRTL:NE};function FE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function IE(e,t){let n=null,r,i=BT(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Qw(d),h=Qw(i.clientWidth-(u+f)),g=Qw(i.clientHeight-(d+p)),_=Qw(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Xw(0,Yw(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!FE(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function LE(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=lE(e),u=i||a?[...l?oE(l):[],...t?oE(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?IE(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?mE(e):null;c&&g();function g(){let t=mE(e);h&&!FE(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var RE=NT,zE=PT,BE=DT,VE=IT,HE=AT,UE=ET,WE=FT,GE=(e,t,n)=>{let r=new Map,i={platform:PE,...n},a={...i.platform,_c:r};return TT(e,t,{...i,platform:a})},KE=typeof document<`u`?j.useLayoutEffect:function(){};function qE(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!qE(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!qE(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function JE(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function YE(e,t){let n=JE(e);return Math.round(t*n)/n}function XE(e){let t=j.useRef(e);return KE(()=>{t.current=e}),t}function ZE(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=j.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=j.useState(r);qE(f,r)||p(r);let[m,h]=j.useState(null),[g,_]=j.useState(null),v=j.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=j.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=j.useRef(null),C=j.useRef(null),w=j.useRef(u),T=c!=null,E=XE(c),D=XE(i),O=XE(l),ee=j.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),GE(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};te.current&&!qE(w.current,t)&&(w.current=t,Gi.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);KE(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let te=j.useRef(!1);KE(()=>(te.current=!0,()=>{te.current=!1}),[]),KE(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,ee);ee()}},[b,x,ee,E,T]);let ne=j.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),re=j.useMemo(()=>({reference:b,floating:x}),[b,x]),ie=j.useMemo(()=>{let e={position:n,left:0,top:0};if(!re.floating)return e;let t=YE(re.floating,u.x),r=YE(re.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...JE(re.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,re.floating,u.x,u.y]);return j.useMemo(()=>({...u,update:ee,refs:ne,elements:re,floatingStyles:ie}),[u,ee,ne,re,ie])}var QE=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:UE({element:r.current,padding:i}).fn(n):r?UE({element:r,padding:i}).fn(n):{}}}},$E=(e,t)=>{let n=RE(e);return{name:n.name,fn:n.fn,options:[e,t]}},eD=(e,t)=>{let n=zE(e);return{name:n.name,fn:n.fn,options:[e,t]}},tD=(e,t)=>({fn:WE(e).fn,options:[e,t]}),nD=(e,t)=>{let n=BE(e);return{name:n.name,fn:n.fn,options:[e,t]}},rD=(e,t)=>{let n=VE(e);return{name:n.name,fn:n.fn,options:[e,t]}},iD=(e,t)=>{let n=HE(e);return{name:n.name,fn:n.fn,options:[e,t]}},aD=(e,t)=>{let n=QE(e);return{name:n.name,fn:n.fn,options:[e,t]}},oD=`Arrow`,sD=j.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,M.jsx)(w_.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,M.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});sD.displayName=oD;var cD=sD;function lD(e){let[t,n]=j.useState(void 0);return U_(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var uD=`Popper`,[dD,fD]=m_(uD),[pD,mD]=dD(uD),hD=e=>{let{__scopePopper:t,children:n}=e,[r,i]=j.useState(null);return(0,M.jsx)(pD,{scope:t,anchor:r,onAnchorChange:i,children:n})};hD.displayName=uD;var gD=`PopperAnchor`,_D=j.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=mD(gD,n),o=j.useRef(null),s=f_(t,o),c=j.useRef(null);return j.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,M.jsx)(w_.div,{...i,ref:s})});_D.displayName=gD;var vD=`PopperContent`,[yD,bD]=dD(vD),xD=j.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=mD(vD,n),[_,v]=j.useState(null),y=f_(t,e=>v(e)),[b,x]=j.useState(null),S=lD(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,ee={padding:E,boundary:D.filter(TD),altBoundary:O},{refs:te,floatingStyles:ne,placement:re,isPositioned:ie,middlewareData:ae}=ZE({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>LE(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[$E({mainAxis:i+w,alignmentAxis:o}),c&&eD({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?tD():void 0,...ee}),c&&nD({...ee}),rD({...ee,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&aD({element:b,padding:s}),ED({arrowWidth:C,arrowHeight:w}),f&&iD({strategy:`referenceHidden`,...ee})]}),[oe,k]=DD(re),se=E_(m);U_(()=>{ie&&se?.()},[ie,se]);let ce=ae.arrow?.x,le=ae.arrow?.y,ue=ae.arrow?.centerOffset!==0,[A,de]=j.useState();return U_(()=>{_&&de(window.getComputedStyle(_).zIndex)},[_]),(0,M.jsx)(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:ie?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:A,"--radix-popper-transform-origin":[ae.transformOrigin?.x,ae.transformOrigin?.y].join(` `),...ae.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,M.jsx)(yD,{scope:n,placedSide:oe,onArrowChange:x,arrowX:ce,arrowY:le,shouldHideArrow:ue,children:(0,M.jsx)(w_.div,{"data-side":oe,"data-align":k,...h,ref:y,style:{...h.style,animation:ie?void 0:`none`}})})})});xD.displayName=vD;var SD=`PopperArrow`,CD={top:`bottom`,right:`left`,bottom:`top`,left:`right`},wD=j.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=bD(SD,n),a=CD[i.placedSide];return(0,M.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,M.jsx)(cD,{...r,ref:t,style:{...r.style,display:`block`}})})});wD.displayName=SD;function TD(e){return e!==null}var ED=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=DD(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function DD(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var OD=hD,kD=_D,AD=xD,jD=wD,[MD,ND]=m_(`Tooltip`,[fD]),PD=fD(),FD=`TooltipProvider`,ID=700,LD=`tooltip.open`,[RD,zD]=MD(FD),BD=e=>{let{__scopeTooltip:t,delayDuration:n=ID,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=j.useRef(!0),s=j.useRef(!1),c=j.useRef(0);return j.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,M.jsx)(RD,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:j.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:j.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:j.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};BD.displayName=FD;var VD=`Tooltip`,[HD,UD]=MD(VD),WD=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=zD(VD,e.__scopeTooltip),l=PD(t),[u,d]=j.useState(null),f=pS(),p=j.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=j.useRef(!1),[_,v]=Q_({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(LD))):c.onClose(),a?.(e)},caller:VD}),y=j.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=j.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=j.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=j.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return j.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,M.jsx)(OD,{...l,children:(0,M.jsx)(HD,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:j.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:j.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};WD.displayName=VD;var GD=`TooltipTrigger`,KD=j.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=UD(GD,n),a=zD(GD,n),o=PD(n),s=f_(t,j.useRef(null),i.onTriggerChange),c=j.useRef(!1),l=j.useRef(!1),u=j.useCallback(()=>c.current=!1,[]);return j.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,M.jsx)(kD,{asChild:!0,...o,children:(0,M.jsx)(w_.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:q(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:q(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:q(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:q(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:q(e.onBlur,i.onClose),onClick:q(e.onClick,i.onClose)})})});KD.displayName=GD;var qD=`TooltipPortal`,[JD,YD]=MD(qD,{forceMount:void 0}),XD=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=UD(qD,t);return(0,M.jsx)(JD,{scope:t,forceMount:n,children:(0,M.jsx)(q_,{present:n||a.open,children:(0,M.jsx)(G_,{asChild:!0,container:i,children:r})})})};XD.displayName=qD;var ZD=`TooltipContent`,QD=j.forwardRef((e,t)=>{let n=YD(ZD,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=UD(ZD,e.__scopeTooltip);return(0,M.jsx)(q_,{present:r||o.open,children:o.disableHoverableContent?(0,M.jsx)(rO,{side:i,...a,ref:t}):(0,M.jsx)($D,{side:i,...a,ref:t})})}),$D=j.forwardRef((e,t)=>{let n=UD(ZD,e.__scopeTooltip),r=zD(ZD,e.__scopeTooltip),i=j.useRef(null),a=f_(t,i),[o,s]=j.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=j.useCallback(()=>{s(null),d(!1)},[d]),p=j.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=sO(r,oO(r,n.getBoundingClientRect())),a=cO(t.getBoundingClientRect());s(uO([...i,...a])),d(!0)},[d]);return j.useEffect(()=>()=>f(),[f]),j.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),j.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!lO(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,M.jsx)(rO,{...e,ref:a})}),[eO,tO]=MD(VD,{isInside:!1}),nO=y_(`TooltipContent`),rO=j.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=UD(ZD,n),l=PD(n),{onClose:u}=c;return j.useEffect(()=>(document.addEventListener(LD,u),()=>document.removeEventListener(LD,u)),[u]),j.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,M.jsx)(P_,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,M.jsxs)(AD,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.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:[(0,M.jsx)(nO,{children:r}),(0,M.jsx)(eO,{scope:n,isInside:!0,children:(0,M.jsx)(iv,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});QD.displayName=ZD;var iO=`TooltipArrow`,aO=j.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=PD(n);return tO(iO,n).isInside?null:(0,M.jsx)(jD,{...i,...r,ref:t})});aO.displayName=iO;function oO(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function sO(e,t,n=5){let 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 cO(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function lO(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function uO(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),dO(t)}function dO(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}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 fO=BD,pO=WD,mO=KD,hO=QD,gO=fO,_O=pO,vO=mO,yO=j.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,M.jsx)(hO,{ref:r,sideOffset:t,className:X(`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}));yO.displayName=hO.displayName;var bO=`sidebar_state`,xO=3600*24*7,SO=`16rem`,CO=`18rem`,wO=`3rem`,TO=`b`,EO=j.createContext(null);function DO(){let e=j.useContext(EO);if(!e)throw Error(`useSidebar must be used within a SidebarProvider`);return e}var OO=j.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o},s)=>{let c=eS(),[l,u]=j.useState(!1),[d,f]=j.useState(e),p=t??d,m=j.useCallback(e=>{let t=typeof e==`function`?e(p):e;n?n(t):f(t),document.cookie=`${bO}=${t}; path=/; max-age=${xO}`},[n,p]),h=j.useCallback(()=>c?u(e=>!e):m(e=>!e),[c,m,u]);j.useEffect(()=>{let e=e=>{e.key===TO&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]);let g=p?`expanded`:`collapsed`,_=j.useMemo(()=>({state:g,open:p,setOpen:m,isMobile:c,openMobile:l,setOpenMobile:u,toggleSidebar:h}),[g,p,m,c,l,u,h]);return(0,M.jsx)(EO.Provider,{value:_,children:(0,M.jsx)(gO,{delayDuration:0,children:(0,M.jsx)(`div`,{style:{"--sidebar-width":SO,"--sidebar-width-icon":wO,...i},className:X(`group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-0 w-full`,r),ref:s,...o,children:a})})})});OO.displayName=`SidebarProvider`;var kO=j.forwardRef(({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,...a},o)=>{let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=DO();return n===`none`?(0,M.jsx)(`div`,{className:X(`bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col`,r),ref:o,...a,children:i}):s?(0,M.jsx)(Rw,{open:l,onOpenChange:u,...a,children:(0,M.jsx)(Hw,{"data-sidebar":`sidebar`,"data-mobile":`true`,className:`bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden`,style:{"--sidebar-width":CO},side:e,children:(0,M.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})})}):(0,M.jsx)(`div`,{ref:o,className:X(`bg-sidebar text-sidebar-foreground hidden md:flex h-svh w-[var(--sidebar-width)] shrink-0 flex-col border-r transition-[width] duration-200 ease-linear overflow-hidden`,c===`collapsed`&&n===`offcanvas`&&`w-0 border-0`,c===`collapsed`&&n===`icon`&&`w-[var(--sidebar-width-icon)]`,r),"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,...a,children:i})});kO.displayName=`Sidebar`;var AO=j.forwardRef(({className:e,onClick:t,...n},r)=>{let{toggleSidebar:i}=DO();return(0,M.jsxs)(Z,{ref:r,"data-sidebar":`trigger`,variant:`ghost`,size:`icon`,className:X(`h-7 w-7`,e),onClick:e=>{t?.(e),i()},...n,children:[(0,M.jsx)(Hy,{}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})});AO.displayName=`SidebarTrigger`;var jO=j.forwardRef(({className:e,...t},n)=>{let{toggleSidebar:r}=DO();return(0,M.jsx)(`button`,{ref:n,"data-sidebar":`rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onClick:r,title:`Toggle Sidebar`,className:X(`hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex`,`[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,e),...t})});jO.displayName=`SidebarRail`;var MO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`main`,{ref:n,className:X(`relative flex min-h-svh flex-1 flex-col bg-background`,`peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow`,e),...t}));MO.displayName=`SidebarInset`;var NO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(nS,{ref:n,"data-sidebar":`input`,className:X(`h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring`,e),...t}));NO.displayName=`SidebarInput`;var PO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`header`,className:X(`flex flex-col gap-2 p-2`,e),...t}));PO.displayName=`SidebarHeader`;var FO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`footer`,className:X(`flex flex-col gap-2 p-2`,e),...t}));FO.displayName=`SidebarFooter`;var IO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(uS,{ref:n,"data-sidebar":`separator`,className:X(`mx-2 w-auto bg-sidebar-border`,e),...t}));IO.displayName=`SidebarSeparator`;var LO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`content`,className:X(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto`,e),...t}));LO.displayName=`SidebarContent`;var RO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`group`,className:X(`relative flex w-full min-w-0 flex-col p-2`,e),...t}));RO.displayName=`SidebarGroup`;var zO=j.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,M.jsx)(t?qx:`div`,{ref:r,"data-sidebar":`group-label`,className:X(`text-xs/6 font-medium text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 outline-none transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 [[data-collapsible=icon]_&]:-mt-8 [[data-collapsible=icon]_&]:opacity-0 [[data-collapsible=icon]_&]:overflow-hidden`,e),...n}));zO.displayName=`SidebarGroupLabel`;var BO=j.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,M.jsx)(t?qx:`button`,{ref:r,"data-sidebar":`group-action`,className:X(`absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`group-data-[collapsible=icon]:hidden`,e),...n}));BO.displayName=`SidebarGroupAction`;var VO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`group-content`,className:X(`w-full text-sm`,e),...t}));VO.displayName=`SidebarGroupContent`;var HO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ul`,{ref:n,"data-sidebar":`menu`,className:X(`flex w-full min-w-0 flex-col gap-1`,e),...t}));HO.displayName=`SidebarMenu`;var UO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`li`,{ref:n,"data-sidebar":`menu-item`,className:X(`group/menu-item relative`,e),...t}));UO.displayName=`SidebarMenuItem`;var WO=j.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o},s)=>{let c=e?qx:`button`,{isMobile:l,state:u}=DO(),d=(0,M.jsx)(c,{ref:s,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:X(GO({variant:n,size:r}),a),...o});return i?(typeof i==`string`&&(i={children:i}),(0,M.jsxs)(_O,{children:[(0,M.jsx)(vO,{asChild:!0,children:d}),(0,M.jsx)(yO,{side:`right`,align:`center`,hidden:u!==`collapsed`||l,...i})]})):d});WO.displayName=`SidebarMenuButton`;var GO=iy(`peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:!p-0`}},defaultVariants:{variant:`default`,size:`default`}}),KO=j.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>(0,M.jsx)(t?qx:`button`,{ref:i,"data-sidebar":`menu-action`,className:X(`absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,n&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0`,e),...r}));KO.displayName=`SidebarMenuAction`;var qO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`menu-badge`,className:X(`text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none`,`peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));qO.displayName=`SidebarMenuBadge`;var JO=j.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{let i=j.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return(0,M.jsxs)(`div`,{ref:r,"data-sidebar":`menu-skeleton`,className:X(`rounded-md h-8 flex gap-2 px-2 items-center`,e),...n,children:[t&&(0,M.jsx)(qw,{className:`size-4 rounded-md`,"data-sidebar":`menu-skeleton-icon`}),(0,M.jsx)(qw,{className:`h-4 flex-1 max-w-[var(--skeleton-width)]`,"data-sidebar":`menu-skeleton-text`,style:{"--skeleton-width":i}})]})});JO.displayName=`SidebarMenuSkeleton`;var YO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ul`,{ref:n,"data-sidebar":`menu-sub`,className:X(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));YO.displayName=`SidebarMenuSub`;var XO=j.forwardRef(({...e},t)=>(0,M.jsx)(`li`,{ref:t,...e}));XO.displayName=`SidebarMenuSubItem`;var ZO=j.forwardRef(({asChild:e=!1,size:t=`md`,isActive:n,className:r,...i},a)=>(0,M.jsx)(e?qx:`a`,{ref:a,"data-sidebar":`menu-sub-button`,"data-size":t,"data-active":n,className:X(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,`data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground`,t===`sm`&&`text-xs`,t===`md`&&`text-sm`,r),...i}));ZO.displayName=`SidebarMenuSubButton`;var QO=iy(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`),$O=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`nav`,{ref:n,"aria-label":`breadcrumb`,className:X(QO(),e),...t}));$O.displayName=`Breadcrumb`;var ek=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ol`,{ref:n,className:X(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`,e),...t}));ek.displayName=`BreadcrumbList`;var tk=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`li`,{ref:n,className:X(`inline-flex items-center gap-1.5`,e),...t}));tk.displayName=`BreadcrumbItem`;var nk=j.forwardRef(({asChild:e,className:t,...n},r)=>(0,M.jsx)(e?qx:`a`,{ref:r,className:X(`hover:text-foreground transition-colors`,t),...n}));nk.displayName=`BreadcrumbLink`;var rk=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`span`,{ref:n,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:X(`text-foreground font-normal`,e),...t}));rk.displayName=`BreadcrumbPage`;var ik=({children:e,className:t,...n})=>(0,M.jsx)(`li`,{role:`presentation`,"aria-hidden":`true`,className:X(`[&>svg]:size-3.5`,t),...n,children:e??(0,M.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:(0,M.jsx)(`path`,{d:`m9 18 6-6-6-6`})})});ik.displayName=`BreadcrumbSeparator`;var ak=({className:e,...t})=>(0,M.jsxs)(`span`,{role:`presentation`,"aria-hidden":`true`,className:X(`flex h-9 w-9 items-center justify-center`,e),...t,children:[(0,M.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`}),(0,M.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1`}),(0,M.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1`})]}),(0,M.jsx)(`span`,{className:`sr-only`,children:`More`})]});ak.displayName=`BreadcrumbElipssis`;var ok=j.createContext(void 0);function sk(e){let t=j.useContext(ok);return e||t||`ltr`}var ck=`rovingFocusGroup.onEntryFocus`,lk={bubbles:!1,cancelable:!0},uk=`RovingFocusGroup`,[dk,fk,pk]=C_(uk),[mk,hk]=m_(uk,[pk]),[gk,_k]=mk(uk),vk=j.forwardRef((e,t)=>(0,M.jsx)(dk.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(dk.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(yk,{...e,ref:t})})}));vk.displayName=uk;var yk=j.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=j.useRef(null),p=f_(t,f),m=sk(a),[h,g]=Q_({prop:o,defaultProp:s??null,onChange:c,caller:uk}),[_,v]=j.useState(!1),y=E_(l),b=fk(n),x=j.useRef(!1),[S,C]=j.useState(0);return j.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(ck,y),()=>e.removeEventListener(ck,y)},[y]),(0,M.jsx)(gk,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:j.useCallback(e=>g(e),[g]),onItemShiftTab:j.useCallback(()=>v(!0),[]),onFocusableItemAdd:j.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:j.useCallback(()=>C(e=>e-1),[]),children:(0,M.jsx)(w_.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:q(e.onMouseDown,()=>{x.current=!0}),onFocus:q(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(ck,lk);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Tk([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:q(e.onBlur,()=>v(!1))})})}),bk=`RovingFocusGroupItem`,xk=j.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=pS(),l=a||c,u=_k(bk,n),d=u.currentTabStopId===l,f=fk(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return j.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,M.jsx)(dk.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,M.jsx)(w_.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:q(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:q(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:q(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=wk(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Ek(n,r+1):n.slice(r+1)}setTimeout(()=>Tk(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});xk.displayName=bk;var Sk={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Ck(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function wk(e,t,n){let r=Ck(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Sk[r]}function Tk(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Ek(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Dk=vk,Ok=xk,kk=[`Enter`,` `],Ak=[`ArrowDown`,`PageUp`,`Home`],jk=[`ArrowUp`,`PageDown`,`End`],Mk=[...Ak,...jk],Nk={ltr:[...kk,`ArrowRight`],rtl:[...kk,`ArrowLeft`]},Pk={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Fk=`Menu`,[Ik,Lk,Rk]=C_(Fk),[zk,Bk]=m_(Fk,[Rk,fD,hk]),Vk=fD(),Hk=hk(),[Uk,Wk]=zk(Fk),[Gk,Kk]=zk(Fk),qk=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Vk(t),[c,l]=j.useState(null),u=j.useRef(!1),d=E_(a),f=sk(i);return j.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,M.jsx)(OD,{...s,children:(0,M.jsx)(Uk,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,M.jsx)(Gk,{scope:t,onClose:j.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};qk.displayName=Fk;var Jk=`MenuAnchor`,Yk=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Vk(n);return(0,M.jsx)(kD,{...i,...r,ref:t})});Yk.displayName=Jk;var Xk=`MenuPortal`,[Zk,Qk]=zk(Xk,{forceMount:void 0}),$k=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Wk(Xk,t);return(0,M.jsx)(Zk,{scope:t,forceMount:n,children:(0,M.jsx)(q_,{present:n||a.open,children:(0,M.jsx)(G_,{asChild:!0,container:i,children:r})})})};$k.displayName=Xk;var eA=`MenuContent`,[tA,nA]=zk(eA),rA=j.forwardRef((e,t)=>{let n=Qk(eA,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Wk(eA,e.__scopeMenu),o=Kk(eA,e.__scopeMenu);return(0,M.jsx)(Ik.Provider,{scope:e.__scopeMenu,children:(0,M.jsx)(q_,{present:r||a.open,children:(0,M.jsx)(Ik.Slot,{scope:e.__scopeMenu,children:o.modal?(0,M.jsx)(iA,{...i,ref:t}):(0,M.jsx)(aA,{...i,ref:t})})})})}),iA=j.forwardRef((e,t)=>{let n=Wk(eA,e.__scopeMenu),r=j.useRef(null),i=f_(t,r);return j.useEffect(()=>{let e=r.current;if(e)return XC(e)},[]),(0,M.jsx)(sA,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:q(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),aA=j.forwardRef((e,t)=>{let n=Wk(eA,e.__scopeMenu);return(0,M.jsx)(sA,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),oA=g_(`MenuContent.ScrollLock`),sA=j.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Wk(eA,n),_=Kk(eA,n),v=Vk(n),y=Hk(n),b=Lk(n),[x,S]=j.useState(null),C=j.useRef(null),w=f_(t,C,g.onContentChange),T=j.useRef(0),E=j.useRef(``),D=j.useRef(0),O=j.useRef(null),ee=j.useRef(`right`),te=j.useRef(0),ne=m?VC:j.Fragment,re=m?{as:oA,allowPinchZoom:!0}:void 0,ie=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=GA(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};j.useEffect(()=>()=>window.clearTimeout(T.current),[]),jS();let ae=j.useCallback(e=>ee.current===O.current?.side&&qA(e,O.current?.area),[]);return(0,M.jsx)(tA,{scope:n,searchRef:E,onItemEnter:j.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),onItemLeave:j.useCallback(e=>{ae(e)||(C.current?.focus(),S(null))},[ae]),onTriggerLeave:j.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),pointerGraceTimerRef:D,onPointerGraceIntentChange:j.useCallback(e=>{O.current=e},[]),children:(0,M.jsx)(ne,{...re,children:(0,M.jsx)(vS,{asChild:!0,trapped:i,onMountAutoFocus:q(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,M.jsx)(P_,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,M.jsx)(Dk,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:q(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,M.jsx)(AD,{role:`menu`,"aria-orientation":`vertical`,"data-state":BA(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:q(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ie(e.key));let i=C.current;if(e.target!==i||!Mk.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);jk.includes(e.key)&&a.reverse(),UA(a)}),onBlur:q(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:q(e.onPointerMove,JA(e=>{let t=e.target,n=te.current!==e.clientX;e.currentTarget.contains(t)&&n&&(ee.current=e.clientX>te.current?`right`:`left`,te.current=e.clientX)}))})})})})})})});rA.displayName=eA;var cA=`MenuGroup`,lA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(w_.div,{role:`group`,...r,ref:t})});lA.displayName=cA;var uA=`MenuLabel`,dA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(w_.div,{...r,ref:t})});dA.displayName=uA;var fA=`MenuItem`,pA=`menu.itemSelect`,mA=j.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=j.useRef(null),o=Kk(fA,e.__scopeMenu),s=nA(fA,e.__scopeMenu),c=f_(t,a),l=j.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(pA,{bubbles:!0,cancelable:!0});e.addEventListener(pA,e=>r?.(e),{once:!0}),T_(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,M.jsx)(hA,{...i,ref:c,disabled:n,onClick:q(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:q(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:q(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||kk.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});mA.displayName=fA;var hA=j.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=nA(fA,n),s=Hk(n),c=j.useRef(null),l=f_(t,c),[u,d]=j.useState(!1),[f,p]=j.useState(``);return j.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,M.jsx)(Ik.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,M.jsx)(Ok,{asChild:!0,...s,focusable:!r,children:(0,M.jsx)(w_.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:q(e.onPointerMove,JA(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:q(e.onPointerLeave,JA(e=>o.onItemLeave(e))),onFocus:q(e.onFocus,()=>d(!0)),onBlur:q(e.onBlur,()=>d(!1))})})})}),gA=`MenuCheckboxItem`,_A=j.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,M.jsx)(TA,{scope:e.__scopeMenu,checked:n,children:(0,M.jsx)(mA,{role:`menuitemcheckbox`,"aria-checked":VA(n)?`mixed`:n,...i,ref:t,"data-state":HA(n),onSelect:q(i.onSelect,()=>r?.(VA(n)?!0:!n),{checkForDefaultPrevented:!1})})})});_A.displayName=gA;var vA=`MenuRadioGroup`,[yA,bA]=zk(vA,{value:void 0,onValueChange:()=>{}}),xA=j.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=E_(r);return(0,M.jsx)(yA,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,M.jsx)(lA,{...i,ref:t})})});xA.displayName=vA;var SA=`MenuRadioItem`,CA=j.forwardRef((e,t)=>{let{value:n,...r}=e,i=bA(SA,e.__scopeMenu),a=n===i.value;return(0,M.jsx)(TA,{scope:e.__scopeMenu,checked:a,children:(0,M.jsx)(mA,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":HA(a),onSelect:q(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});CA.displayName=SA;var wA=`MenuItemIndicator`,[TA,EA]=zk(wA,{checked:!1}),DA=j.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=EA(wA,n);return(0,M.jsx)(q_,{present:r||VA(a.checked)||a.checked===!0,children:(0,M.jsx)(w_.span,{...i,ref:t,"data-state":HA(a.checked)})})});DA.displayName=wA;var OA=`MenuSeparator`,kA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(w_.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});kA.displayName=OA;var AA=`MenuArrow`,jA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Vk(n);return(0,M.jsx)(jD,{...i,...r,ref:t})});jA.displayName=AA;var MA=`MenuSub`,[NA,PA]=zk(MA),FA=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Wk(MA,t),o=Vk(t),[s,c]=j.useState(null),[l,u]=j.useState(null),d=E_(i);return j.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,M.jsx)(OD,{...o,children:(0,M.jsx)(Uk,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,M.jsx)(NA,{scope:t,contentId:pS(),triggerId:pS(),trigger:s,onTriggerChange:c,children:n})})})};FA.displayName=MA;var IA=`MenuSubTrigger`,LA=j.forwardRef((e,t)=>{let n=Wk(IA,e.__scopeMenu),r=Kk(IA,e.__scopeMenu),i=PA(IA,e.__scopeMenu),a=nA(IA,e.__scopeMenu),o=j.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=j.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return j.useEffect(()=>u,[u]),j.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,M.jsx)(Yk,{asChild:!0,...l,children:(0,M.jsx)(hA,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":BA(n.open),...e,ref:d_(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:q(e.onPointerMove,JA(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:q(e.onPointerLeave,JA(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:q(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Nk[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});LA.displayName=IA;var RA=`MenuSubContent`,zA=j.forwardRef((e,t)=>{let n=Qk(eA,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Wk(eA,e.__scopeMenu),o=Kk(eA,e.__scopeMenu),s=PA(RA,e.__scopeMenu),c=j.useRef(null),l=f_(t,c);return(0,M.jsx)(Ik.Provider,{scope:e.__scopeMenu,children:(0,M.jsx)(q_,{present:r||a.open,children:(0,M.jsx)(Ik.Slot,{scope:e.__scopeMenu,children:(0,M.jsx)(sA,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:q(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:q(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:q(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Pk[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});zA.displayName=RA;function BA(e){return e?`open`:`closed`}function VA(e){return e===`indeterminate`}function HA(e){return VA(e)?`indeterminate`:e?`checked`:`unchecked`}function UA(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function WA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function GA(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=WA(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function KA(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function qA(e,t){return t?KA({x:e.clientX,y:e.clientY},t):!1}function JA(e){return t=>t.pointerType===`mouse`?e(t):void 0}var YA=qk,XA=Yk,ZA=$k,QA=rA,$A=lA,ej=dA,tj=mA,nj=_A,rj=xA,ij=CA,aj=DA,oj=kA,sj=jA,cj=LA,lj=zA,uj=`DropdownMenu`,[dj,fj]=m_(uj,[Bk]),pj=Bk(),[mj,hj]=dj(uj),gj=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=pj(t),l=j.useRef(null),[u,d]=Q_({prop:i,defaultProp:a??!1,onChange:o,caller:uj});return(0,M.jsx)(mj,{scope:t,triggerId:pS(),triggerRef:l,contentId:pS(),open:u,onOpenChange:d,onOpenToggle:j.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,M.jsx)(YA,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};gj.displayName=uj;var _j=`DropdownMenuTrigger`,vj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=hj(_j,n),o=pj(n);return(0,M.jsx)(XA,{asChild:!0,...o,children:(0,M.jsx)(w_.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:d_(t,a.triggerRef),onPointerDown:q(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:q(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});vj.displayName=_j;var yj=`DropdownMenuPortal`,bj=e=>{let{__scopeDropdownMenu:t,...n}=e,r=pj(t);return(0,M.jsx)(ZA,{...r,...n})};bj.displayName=yj;var xj=`DropdownMenuContent`,Sj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hj(xj,n),a=pj(n),o=j.useRef(!1);return(0,M.jsx)(QA,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:q(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Sj.displayName=xj;var Cj=`DropdownMenuGroup`,wj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)($A,{...i,...r,ref:t})});wj.displayName=Cj;var Tj=`DropdownMenuLabel`,Ej=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(ej,{...i,...r,ref:t})});Ej.displayName=Tj;var Dj=`DropdownMenuItem`,Oj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(tj,{...i,...r,ref:t})});Oj.displayName=Dj;var kj=`DropdownMenuCheckboxItem`,Aj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(nj,{...i,...r,ref:t})});Aj.displayName=kj;var jj=`DropdownMenuRadioGroup`,Mj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(rj,{...i,...r,ref:t})});Mj.displayName=jj;var Nj=`DropdownMenuRadioItem`,Pj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(ij,{...i,...r,ref:t})});Pj.displayName=Nj;var Fj=`DropdownMenuItemIndicator`,Ij=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(aj,{...i,...r,ref:t})});Ij.displayName=Fj;var Lj=`DropdownMenuSeparator`,Rj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(oj,{...i,...r,ref:t})});Rj.displayName=Lj;var zj=`DropdownMenuArrow`,Bj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(sj,{...i,...r,ref:t})});Bj.displayName=zj;var Vj=`DropdownMenuSubTrigger`,Hj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(cj,{...i,...r,ref:t})});Hj.displayName=Vj;var Uj=`DropdownMenuSubContent`,Wj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(lj,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Wj.displayName=Uj;var Gj=gj,Kj=vj,qj=bj,Jj=Sj,Yj=Ej,Xj=Oj,Zj=Aj,Qj=Pj,$j=Ij,eM=Rj,tM=Hj,nM=Wj,rM=Gj,iM=Kj,aM=j.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,M.jsxs)(tM,{ref:i,className:X(`flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...r,children:[n,(0,M.jsx)(yy,{className:`ml-auto`})]}));aM.displayName=tM.displayName;var oM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(nM,{ref:n,className:X(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));oM.displayName=nM.displayName;var sM=j.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,M.jsx)(qj,{children:(0,M.jsx)(Jj,{ref:r,sideOffset:t,className:X(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));sM.displayName=Jj.displayName;var cM=j.forwardRef(({className:e,inset:t,...n},r)=>(0,M.jsx)(Xj,{ref:r,className:X(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...n}));cM.displayName=Xj.displayName;var lM=j.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,M.jsxs)(Zj,{ref:i,className:X(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,M.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)($j,{children:(0,M.jsx)(_y,{className:`h-4 w-4`})})}),t]}));lM.displayName=Zj.displayName;var uM=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(Qj,{ref:r,className:X(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,M.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)($j,{children:(0,M.jsx)(Ty,{className:`h-2 w-2 fill-current`})})}),t]}));uM.displayName=Qj.displayName;var dM=j.forwardRef(({className:e,inset:t,...n},r)=>(0,M.jsx)(Yj,{ref:r,className:X(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));dM.displayName=Yj.displayName;var fM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(eM,{ref:n,className:X(`-mx-1 my-1 h-px bg-muted`,e),...t}));fM.displayName=eM.displayName;var pM=({className:e,...t})=>(0,M.jsx)(`span`,{className:X(`ml-auto text-xs tracking-widest opacity-60`,e),...t});pM.displayName=`DropdownMenuShortcut`;var mM=`modulepreload`,hM=function(e){return`/_account/`+e},gM={},_M=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=hM(t,n),t in gM)return;gM[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:mM,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},vM=[`en`,`zh-CN`],yM={en:()=>_M(()=>import(`./en-QM3gmMOi.js`),[]),"zh-CN":()=>_M(()=>import(`./zh-CN-B0Jn4kQl.js`),[])};function bM(e){return vM.includes(e)?e:e.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`}async function xM(e){let t=bM(e);try{return(await yM[t]()).default}catch(t){return console.warn(`[account/i18n] Failed to load language pack '${e}':`,t),{}}}var SM={en:`English`,"zh-CN":`中文`};function CM(){let{t:e,language:t,changeLanguage:n}=vt();async function r(e){await n(e);try{localStorage.setItem(`account.lang`,e)}catch{}}return(0,M.jsxs)(rM,{children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsxs)(Z,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":e(`common.language`),children:[(0,M.jsx)(Py,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:e(`common.language`)})]})}),(0,M.jsx)(sM,{align:`end`,children:vM.map(e=>(0,M.jsx)(cM,{onSelect:()=>void r(e),className:e===t?`font-medium`:void 0,children:SM[e]},e))})]})}function wM(e){let t=document.documentElement;e===`dark`?t.classList.add(`dark`):t.classList.remove(`dark`)}function TM(){let{t:e}=vt(),[,t]=(0,j.useState)(`light`);(0,j.useEffect)(()=>{let e=localStorage.getItem(`theme`);e?(t(e),wM(e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e)):(t(`system`),wM(window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`))},[]);function n(e){t(e),localStorage.setItem(`theme`,e),wM(e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e)}return(0,M.jsxs)(rM,{children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsxs)(Z,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:[(0,M.jsx)(Xy,{className:`h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,M.jsx)(Vy,{className:`absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`}),(0,M.jsx)(`span`,{className:`sr-only`,children:e(`common.toggleTheme`)})]})}),(0,M.jsxs)(sM,{align:`end`,children:[(0,M.jsxs)(cM,{onClick:()=>n(`light`),children:[(0,M.jsx)(Xy,{className:`mr-2 h-4 w-4`}),e(`common.light`)]}),(0,M.jsxs)(cM,{onClick:()=>n(`dark`),children:[(0,M.jsx)(Vy,{className:`mr-2 h-4 w-4`}),e(`common.dark`)]}),(0,M.jsx)(cM,{onClick:()=>n(`system`),children:e(`common.system`)})]})]})}function EM(e,t=[]){let n=[];function r(t,r){let i=j.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=j.useMemo(()=>o,Object.values(o));return(0,M.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=j.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>j.createContext(e));return function(n){let r=n?.[e]||t;return j.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,DM(i,...t)]}function DM(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function OM(){return(0,ot.useSyncExternalStore)(kM,()=>!0,()=>!1)}function kM(){return()=>{}}var AM=`Avatar`,[jM,MM]=EM(AM),[NM,PM]=jM(AM),FM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=j.useState(`idle`);return(0,M.jsx)(NM,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,M.jsx)(rS.span,{...r,ref:t})})});FM.displayName=AM;var IM=`AvatarImage`,LM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=PM(IM,n),s=VM(r,a),c=E_(e=>{i(e),o.onImageLoadingStatusChange(e)});return U_(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,M.jsx)(rS.img,{...a,ref:t,src:r}):null});LM.displayName=IM;var RM=`AvatarFallback`,zM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=PM(RM,n),[o,s]=j.useState(r===void 0);return j.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,M.jsx)(rS.span,{...i,ref:t}):null});zM.displayName=RM;function BM(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function VM(e,{referrerPolicy:t,crossOrigin:n}){let r=OM(),i=j.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=j.useState(()=>BM(a,e));return U_(()=>{s(BM(a,e))},[a,e]),U_(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var HM=FM,UM=LM,WM=zM,GM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(HM,{ref:n,className:X(`relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,e),...t}));GM.displayName=HM.displayName;var KM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(UM,{ref:n,className:X(`aspect-square h-full w-full`,e),...t}));KM.displayName=UM.displayName;var qM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(WM,{ref:n,className:X(`flex h-full w-full items-center justify-center rounded-full bg-muted`,e),...t}));qM.displayName=WM.displayName;var JM=(0,j.createContext)(null),YM=`auth-session-token`,XM=`auth-active-organization-id`;function ZM(e){if(!(typeof window>`u`))try{e?.token?localStorage.setItem(YM,e.token):localStorage.removeItem(YM),e?.activeOrganizationId?localStorage.setItem(XM,e.activeOrganizationId):localStorage.removeItem(XM)}catch{}}function QM(e){if(!e)return{user:null,session:null};let t=e.data===void 0?e:e.data;return t?{user:t.user??null,session:t.session??null}:{user:null,session:null}}function $M({children:e}){let t=Qg(),[n,r]=(0,j.useState)(null),[i,a]=(0,j.useState)(null),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(null),[u,d]=(0,j.useState)([]),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(!1),[g,_]=(0,j.useState)(null);(0,j.useEffect)(()=>{if(!t?.auth?.getConfig)return;let e=!1;return t.auth.getConfig().then(t=>{if(e)return;let n=t?.data??t??{},r={...n.features??{}};n.emailPassword?.disableSignUp===!0&&(r.signUpDisabled=!0),_(r)}).catch(()=>{e||_(null)}),()=>{e=!0}},[t]);let v=(0,j.useCallback)(async()=>{if(t?.organizations){p(!0);try{d((await t.organizations.list())?.organizations??[])}catch{d([])}finally{p(!1),h(!0)}}},[t]),y=(0,j.useCallback)(async()=>{if(t?.auth){s(!0),l(null);try{let{user:e,session:n}=QM(await t.auth.me());r(e),a(n),ZM(e?n:null)}catch(e){l(e),r(null),a(null),ZM(null)}finally{s(!1)}}},[t]);(0,j.useEffect)(()=>{y()},[y]),(0,j.useEffect)(()=>{n?v():(d([]),h(!1))},[n,v]);let b=(0,j.useCallback)(async()=>{if(t?.auth)try{await t.auth.logout()}finally{r(null),a(null),d([]),h(!1),ZM(null)}},[t]),x=(0,j.useCallback)(async e=>{if(t?.organizations){await t.organizations.setActive(e),await y();try{localStorage.setItem(XM,e)}catch{}}},[t,y]),S=(0,j.useMemo)(()=>({user:n,session:i,loading:o,error:c,refresh:y,logout:b,setActiveOrganization:x,organizations:u,organizationsLoading:f,organizationsFetched:m,reloadOrganizations:v,features:g}),[n,i,o,c,y,b,x,u,f,m,v,g]);return(0,j.createElement)(JM.Provider,{value:S},e)}function eN(){let e=(0,j.useContext)(JM);if(!e)throw Error(`useSession must be used inside <SessionProvider>.`);return e}function tN(){let{organizations:e,organizationsLoading:t,reloadOrganizations:n}=eN();return{organizations:e,loading:t,error:null,reload:n}}function nN(){let e=Qg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{create:(0,j.useCallback)(async t=>{if(!e?.organizations)throw Error(`Client not ready`);n(!0),i(null);try{return await e.organizations.create(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),creating:t,error:r}}function rN(){let e=Qg(),{reloadOrganizations:t,refresh:n}=eN(),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null);return{update:(0,j.useCallback)(async(r,a)=>{if(!e?.organizations?.update)throw Error(`Client not ready`);i(!0),o(null);try{let i=await e.organizations.update(r,a);return await t(),await n(),i}catch(e){throw o(e),e}finally{i(!1)}},[e,t,n]),updating:r,error:a}}function iN(){let e=Qg(),{reloadOrganizations:t,refresh:n}=eN(),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null);return{remove:(0,j.useCallback)(async r=>{if(!e?.organizations?.delete)throw Error(`Client not ready`);i(!0),o(null);try{let i=await e.organizations.delete(r);return await t(),await n(),i}catch(e){throw o(e),e}finally{i(!1)}},[e,t,n]),deleting:r,error:a}}function aN({message:e}){return typeof document>`u`?null:(0,Gi.createPortal)((0,M.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm`,children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-8 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:e})]})}),document.body)}function oN(e,t){let n=(e||t||`?`).trim(),r=n.split(/\s+/);return r.length>=2?(r[0][0]+r[1][0]).toUpperCase():n.slice(0,2).toUpperCase()}function sN(){let{t:e}=vt(),t=Hi(),{user:n,loading:r,logout:i}=eN(),[a,o]=(0,j.useState)(!1);return r&&!n?(0,M.jsx)(`div`,{className:`h-8 w-8 animate-pulse rounded-full bg-muted`,"aria-hidden":!0}):n?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(rM,{children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsx)(Z,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,children:(0,M.jsxs)(GM,{className:`h-7 w-7`,children:[n.image?(0,M.jsx)(KM,{src:n.image,alt:n.name??n.email??e(`userMenu.user`)}):null,(0,M.jsx)(qM,{className:`text-[11px]`,children:oN(n.name,n.email)})]})})}),(0,M.jsxs)(sM,{align:`end`,className:`w-64`,children:[(0,M.jsx)(dM,{children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:n.name||n.email}),n.email&&(0,M.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:n.email})]})}),(0,M.jsx)(fM,{}),(0,M.jsxs)(cM,{onSelect:()=>t({to:`/account`}),children:[(0,M.jsx)(rb,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.account`)]}),(0,M.jsxs)(cM,{onSelect:()=>t({to:`/organizations`}),children:[(0,M.jsx)(gy,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.organizations`)]}),(0,M.jsx)(fM,{}),(0,M.jsxs)(cM,{onSelect:async()=>{o(!0);try{await i()}finally{window.location.assign(`/_account/login`)}},disabled:a,children:[(0,M.jsx)(Ly,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.signOut`)]})]})]}),a?(0,M.jsx)(aN,{message:e(`auth.userMenu.signingOut`,{defaultValue:`Signing you out…`})}):null]}):(0,M.jsx)(Z,{variant:`outline`,size:`sm`,className:`h-8`,onClick:()=>t({to:`/login`}),children:e(`userMenu.signIn`)})}function cN(){let{t:e}=vt(),t=Hi(),n=Oa(),{organizations:r,loading:i,reload:a}=tN(),{session:o,setActiveOrganization:s}=eN(),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(!1),f=o?.activeOrganizationId??void 0,p=(0,j.useMemo)(()=>r.find(e=>e.id===f)??null,[r,f]),m=async r=>{if(l(!1),r===f){t({to:`/organizations/$orgId/general`,params:{orgId:r}});return}d(!0);try{await s(r),await a(),K({title:e(`organizations.general.switched`)});let i=n.pathname.match(/^\/organizations\/[^/]+\/(general|members)\/?$/);t({to:(i?i[1]:`general`)===`members`?`/organizations/$orgId/members`:`/organizations/$orgId/general`,params:{orgId:r}})}catch(t){K({title:e(`organizations.switchFailed`),description:t.message,variant:`destructive`})}finally{d(!1)}};return(0,M.jsxs)(rM,{open:c,onOpenChange:l,children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsxs)(Z,{variant:`ghost`,size:`sm`,className:`h-8 gap-2 px-2 text-sm font-medium`,disabled:u,children:[p?(0,M.jsx)(`span`,{className:`max-w-[160px] truncate`,children:p.name}):(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(i?`organizations.loading`:`organizationSwitcher.select`)}),(0,M.jsx)(xy,{className:`h-3 w-3 opacity-50`})]})}),(0,M.jsxs)(sM,{align:`start`,className:`w-[280px]`,sideOffset:4,children:[(0,M.jsx)(dM,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:e(`organizations.title`)}),r.length===0&&!i&&(0,M.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:e(`organizations.emptyTitle`)}),r.map(e=>(0,M.jsxs)(cM,{onSelect:t=>{t.preventDefault(),m(e.id)},className:`flex items-center gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,M.jsx)(`div`,{className:`truncate font-medium`,children:e.name}),e.slug&&(0,M.jsx)(`code`,{className:`text-[11px] text-muted-foreground font-mono`,children:e.slug})]}),e.id===f&&(0,M.jsx)(_y,{className:`h-3.5 w-3.5 text-primary`})]},e.id)),(0,M.jsx)(fM,{}),(0,M.jsxs)(cM,{onSelect:e=>{e.preventDefault(),l(!1),t({to:`/organizations/new`})},className:`gap-2 text-sm`,children:[(0,M.jsx)(Uy,{className:`h-3.5 w-3.5`}),e(`organizationSwitcher.new`)]}),(0,M.jsx)(cM,{onSelect:e=>{e.preventDefault(),l(!1),t({to:`/organizations`})},className:`gap-2 text-sm text-muted-foreground`,children:e(`organizationSwitcher.manage`)})]})]})}function lN({label:e}){return(0,M.jsx)(`a`,{href:`/`,className:`flex h-8 w-8 items-center justify-center rounded-md bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15 transition-transform hover:scale-105`,"aria-label":e,children:(0,M.jsx)(Cy,{className:`h-4 w-4`})})}function uN(){return(0,M.jsx)(yy,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground/50`})}function dN(){let{t:e}=vt(),t=Oa(),n=Bi({strict:!1}),r=(0,j.useMemo)(()=>{let r=t.pathname,i=t=>e(`topBar.breadcrumb.${t}`);if(r.startsWith(`/account`)){let e=[{label:i(`account`)}];return r===`/account/profile`?e.push({label:i(`profile`)}):r===`/account/security`?e.push({label:i(`security`)}):r===`/account/sessions`?e.push({label:i(`sessions`)}):r===`/account/two-factor`?e.push({label:i(`twoFactor`)}):r===`/account/oauth-applications`?e.push({label:i(`oauthApps`)}):r===`/account/oauth-applications/new`?e.push({label:i(`oauthApps`)},{label:i(`new`)}):r.startsWith(`/account/oauth-applications/`)&&e.push({label:i(`oauthApps`)}),e}if(r===`/organizations/new`)return[{label:i(`organizations`)},{label:i(`new`)}];if(n.orgId){let e=r.endsWith(`/general`)?i(`general`):r.endsWith(`/members`)?i(`members`):i(`settings`);return[{label:i(`organizations`)},{label:e}]}return r===`/organizations`||r.startsWith(`/organizations/`)?[{label:i(`organizations`)}]:r.startsWith(`/accept-invitation/`)?[{label:i(`acceptInvitation`)}]:r.startsWith(`/auth/device`)?[{label:i(`deviceAuthorization`)}]:[{label:i(`account`)}]},[t.pathname,n.orgId,e]);return(0,M.jsxs)(`header`,{className:`sticky top-0 z-30 flex h-14 shrink-0 items-center justify-between gap-2 border-b bg-background/80 px-2 backdrop-blur supports-[backdrop-filter]:bg-background/70 sm:px-4`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 sm:gap-2.5`,children:[(0,M.jsx)(`div`,{className:`sm:hidden`,children:(0,M.jsx)(AO,{className:`h-9 w-9`})}),(0,M.jsx)(lN,{label:e(`topBar.accountHome`)}),(0,M.jsx)(`span`,{className:`hidden text-sm font-semibold tracking-tight sm:inline`,children:e(`topBar.brand`)}),(0,M.jsxs)(`div`,{className:`hidden items-center gap-1.5 sm:flex`,children:[(0,M.jsx)(uS,{orientation:`vertical`,className:`mx-1 h-4`}),(0,M.jsx)(cN,{}),(0,M.jsx)(uN,{}),(0,M.jsx)($O,{children:(0,M.jsx)(ek,{children:r.map((e,t)=>(0,M.jsxs)(`div`,{className:`flex items-center`,children:[t>0&&(0,M.jsx)(ik,{}),(0,M.jsx)(tk,{children:(0,M.jsx)(rk,{className:`font-medium`,children:e.label})})]},t))})})]}),(0,M.jsx)(`div`,{className:`min-w-0 flex-1 sm:hidden`,children:r.length>0&&(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:r[r.length-1].label})})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1 sm:gap-2`,children:[(0,M.jsx)(`div`,{className:`hidden sm:block`,children:(0,M.jsx)(CM,{})}),(0,M.jsx)(`div`,{className:`hidden sm:block`,children:(0,M.jsx)(TM,{})}),(0,M.jsx)(sN,{})]})]})}var fN=[{to:`/account`,label:`home`,icon:jy,exact:!0},{to:`/account/profile`,label:`profile`,icon:rb},{to:`/account/security`,label:`security`,icon:Jy},{to:`/account/sessions`,label:`sessions`,icon:By},{to:`/account/two-factor`,label:`twoFactor`,icon:qy},{to:`/account/invitations`,label:`invitations`,icon:My},{to:`/account/linked-accounts`,label:`linkedAccounts`,icon:Iy}],pN=[`group/nav relative transition-all duration-150`,`before:absolute before:left-0 before:top-1/2 before:h-5 before:w-[3px] before:-translate-y-1/2 before:rounded-r-full before:bg-brand-gradient before:opacity-0 before:transition-opacity`,`data-[active=true]:before:opacity-100`,`data-[active=true]:bg-sidebar-accent/80 data-[active=true]:text-sidebar-accent-foreground`,`[&>svg]:transition-transform [&>svg]:duration-150 hover:[&>svg]:scale-110`,`data-[active=true]:[&>svg]:text-primary`].join(` `);function mN(){let{t:e}=vt(),{pathname:t}=Oa(),{organizations:n}=tN(),r=t,i=t.match(/^\/organizations\/([^/]+)(?:\/.*)?$/),a=i&&n.some(e=>e.id===i[1])?i[1]:null;return(0,M.jsxs)(kO,{collapsible:`icon`,className:`h-full`,children:[(0,M.jsxs)(LO,{children:[(0,M.jsxs)(RO,{children:[(0,M.jsx)(zO,{children:e(`sidebar.groups.account`)}),(0,M.jsx)(VO,{children:(0,M.jsx)(HO,{children:fN.map(t=>{let n=t.icon;return(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t.exact?r===t.to||r===`${t.to}/`:r===t.to||r.startsWith(`${t.to}/`),tooltip:e(`sidebar.items.${t.label}`),className:pN,children:(0,M.jsxs)(ra,{to:t.to,children:[(0,M.jsx)(n,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.${t.label}`)})]})})},t.to)})})})]}),(0,M.jsx)(IO,{}),(0,M.jsxs)(RO,{children:[(0,M.jsx)(zO,{children:e(`sidebar.groups.organization`)}),(0,M.jsx)(VO,{children:(0,M.jsxs)(HO,{children:[(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t===`/organizations`,tooltip:e(`sidebar.items.overview`),className:pN,children:(0,M.jsxs)(ra,{to:`/organizations`,children:[(0,M.jsx)(gy,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.overview`)})]})})}),a&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t===`/organizations/${a}/general`,tooltip:e(`sidebar.items.general`),className:pN,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/general`,params:{orgId:a},children:[(0,M.jsx)(Ky,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.general`)})]})})}),(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t===`/organizations/${a}/members`,tooltip:e(`sidebar.items.members`),className:pN,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/members`,params:{orgId:a},children:[(0,M.jsx)(ab,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.members`)})]})})}),(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t===`/organizations/${a}/teams`,tooltip:e(`sidebar.items.teams`),className:pN,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/teams`,params:{orgId:a},children:[(0,M.jsx)(ib,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.teams`)})]})})})]})]})})]}),(0,M.jsx)(IO,{}),(0,M.jsxs)(RO,{children:[(0,M.jsx)(zO,{children:e(`sidebar.groups.developer`)}),(0,M.jsx)(VO,{children:(0,M.jsx)(HO,{children:(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t.startsWith(`/account/oauth-applications`),tooltip:e(`sidebar.items.oauthApps`),className:pN,children:(0,M.jsxs)(ra,{to:`/account/oauth-applications`,children:[(0,M.jsx)(Ny,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.oauthApps`)})]})})})})})]})]}),(0,M.jsx)(FO,{children:(0,M.jsx)(HO,{children:(0,M.jsx)(UO,{children:(0,M.jsx)(hN,{})})})})]})}function hN(){let{t:e}=vt(),{state:t,toggleSidebar:n}=DO(),r=e(t===`collapsed`?`sidebar.expand`:`sidebar.collapse`);return(0,M.jsx)(WO,{onClick:n,tooltip:r,"aria-label":r,children:(0,M.jsx)(Hy,{className:`size-4`})})}function gN(){return typeof window<`u`&&window.location.pathname.startsWith(`/_account`)?window.location.origin:`http://localhost:3000`}var _N=new Set([`/login`,`/register`,`/forgot-password`,`/reset-password`,`/verify-email`,`/verify-email-prompt`,`/auth/device`,`/setup`]);function vN(e){return _N.has(e)||e.startsWith(`/accept-invitation/`)}function yN(){let[e,t]=(0,j.useState)(null);return(0,j.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await fetch(`/api/v1/auth/bootstrap-status`);if(!n.ok){e||t(!0);return}let r=await n.json();e||t(r.hasOwner!==!1)}catch{e||t(!0)}})(),()=>{e=!0}},[]),e}function bN({children:e}){let{user:t,loading:n}=eN(),r=Hi(),i=Oa(),a=vN(i.pathname),o=i.pathname.startsWith(`/oauth/`)||i.pathname===`/organizations/new`,s=yN(),c=i.pathname===`/setup`;return(0,j.useEffect)(()=>{s===!1&&!c&&!t&&r({to:`/setup`,replace:!0})},[s,c,t,r]),(0,j.useEffect)(()=>{n||s!==!1&&!t&&!a&&r({to:`/login`,search:{redirect:i.pathname+i.searchStr},replace:!0})},[t,n,a,r,i.pathname,i.searchStr,s]),s===null||n&&!t?(0,M.jsx)(`div`,{className:`flex min-h-screen w-full flex-1 items-center justify-center bg-background`,children:(0,M.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-4 border-muted border-t-primary`})}):s===!1&&!c||!t&&!a?null:a||o?(0,M.jsx)(`div`,{className:`flex min-h-screen w-full`,children:e}):(0,M.jsxs)(OO,{className:`flex h-svh w-full flex-col`,children:[(0,M.jsx)(dN,{}),(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 w-full`,children:[(0,M.jsx)(mN,{}),(0,M.jsx)(MO,{className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-auto bg-background`,children:e})})]})]})}function xN(){let e=gN();return(0,M.jsx)(Zg,{client:(0,j.useMemo)(()=>new Jg({baseUrl:e}),[e]),children:(0,M.jsxs)($M,{children:[(0,M.jsx)(bN,{children:(0,M.jsx)(ya,{})}),(0,M.jsx)(Vx,{})]})})}var SN=ca({component:xN}),Q=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:X(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));Q.displayName=`Card`;var CN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:X(`flex flex-col space-y-1.5 p-6`,e),...t}));CN.displayName=`CardHeader`;var wN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`h3`,{ref:n,className:X(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));wN.displayName=`CardTitle`;var TN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`p`,{ref:n,className:X(`text-sm text-muted-foreground`,e),...t}));TN.displayName=`CardDescription`;var EN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:X(`p-6 pt-0`,e),...t}));EN.displayName=`CardContent`;var DN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:X(`flex items-center p-6 pt-0`,e),...t}));DN.displayName=`CardFooter`;function ON(e){let t=e.split(`:`)[0].toLowerCase();return/^cloud\./.test(t)}function kN(){return typeof window>`u`?null:window.location.host||null}function AN({children:e,formWidth:t=`sm`}){let{t:n}=vt(),r=t===`md`?`max-w-md`:`max-w-sm`,i=kN(),a=!!i&&!ON(i);return j.useEffect(()=>{if(typeof document>`u`||!i)return;let e=document.title;return a&&(document.title=i),()=>{document.title=e}},[i,a]),(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted p-6`,children:(0,M.jsxs)(`div`,{className:X(`flex w-full flex-col gap-4`,r),children:[a?(0,M.jsx)(`div`,{className:`flex justify-center`,children:(0,M.jsx)(`span`,{className:`rounded-full border border-border/60 bg-background/60 px-2 py-0.5 font-mono text-[10px] uppercase tracking-wide text-muted-foreground`,title:n(`auth.shell.tenantHostHint`,{defaultValue:`You are signing in to this workspace`}),children:i})}):null,e]})})}var jN=la(`/verify-email-prompt`)({validateSearch:e=>({email:typeof e.email==`string`?e.email:void 0,redirect:typeof e.redirect==`string`?e.redirect:void 0}),component:MN});function MN(){let{t:e}=vt(),t=Hi(),{email:n,redirect:r}=jN.useSearch(),i=Qg(),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(!1);return(0,M.jsx)(AN,{children:(0,M.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-4 flex size-16 items-center justify-center rounded-full bg-primary/10`,children:(0,M.jsx)(Ry,{className:`size-8 text-primary`})}),(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.title`,{defaultValue:`Verify your email address`})}),(0,M.jsx)(TN,{children:e(`auth.verifyEmail.description`,{defaultValue:`We sent a verification link to your email address. Please click the link to verify your account.`})})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[n?(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.verifyEmail.sentTo`,{defaultValue:`Sent to:`}),` `,(0,M.jsx)(`span`,{className:`font-medium text-foreground`,children:n})]}):null,(0,M.jsx)(Z,{onClick:async()=>{if(!n||!i?.auth){K({title:e(`auth.verifyEmail.resendFailed`,{defaultValue:`Cannot resend verification email`}),description:e(`auth.verifyEmail.emailMissing`,{defaultValue:`Email address is missing`}),variant:`destructive`});return}o(!0);try{let t=await fetch(`/api/v1/auth/send-verification-email`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:n,callbackURL:r||`/`})});if(!t.ok){let e=await t.json().catch(()=>({message:`Unknown error`}));throw Error(e.message||`Failed to send verification email`)}c(!0),K({title:e(`auth.verifyEmail.resentSuccess`,{defaultValue:`Verification email sent!`}),description:e(`auth.verifyEmail.resentDescription`,{defaultValue:`Please check your inbox and click the verification link.`})})}catch(t){K({title:e(`auth.verifyEmail.resendFailed`,{defaultValue:`Failed to resend verification email`}),description:t.message,variant:`destructive`})}finally{o(!1)}},disabled:a||s,className:`w-full`,variant:s?`outline`:`default`,children:a?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Wy,{className:`mr-2 size-4 animate-spin`}),e(`auth.verifyEmail.resending`,{defaultValue:`Sending...`})]}):s?e(`auth.verifyEmail.resent`,{defaultValue:`Email sent! Check your inbox`}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Wy,{className:`mr-2 size-4`}),e(`auth.verifyEmail.resendButton`,{defaultValue:`Resend verification email`})]})}),(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,M.jsx)(`span`,{className:`w-full border-t`})}),(0,M.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,M.jsx)(`span`,{className:`bg-card px-2 text-muted-foreground`,children:e(`auth.verifyEmail.or`,{defaultValue:`Or`})})})]}),(0,M.jsx)(Z,{onClick:()=>{t({to:`/login`,search:r?{redirect:r}:void 0})},variant:`ghost`,className:`w-full`,children:e(`auth.verifyEmail.backToLogin`,{defaultValue:`Back to login`})}),(0,M.jsx)(`p`,{className:`text-center text-xs text-muted-foreground`,children:e(`auth.verifyEmail.checkSpam`,{defaultValue:`Didn't receive the email? Check your spam folder or contact support.`})})]})})]})})})}var NN=la(`/verify-email`)({validateSearch:e=>{let t=e.token;return typeof t==`string`?{token:t}:{}},component:PN});function PN(){let{t:e}=vt(),{token:t}=NN.useSearch(),n=Qg(),[r,i]=(0,j.useState)(`loading`),[a,o]=(0,j.useState)(``);return(0,j.useEffect)(()=>{if(!t){i(`error`),o(e(`auth.verifyEmail.missingToken`));return}let r=!1;return(async()=>{try{await n.auth.verifyEmail({token:t}),r||i(`success`)}catch(t){r||(i(`error`),o(t.message||e(`auth.verifyEmail.errorDescription`)))}})(),()=>{r=!0}},[t,e,n]),(0,M.jsx)(AN,{children:(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[r===`loading`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.verifyingTitle`)}),(0,M.jsx)(TN,{children:e(`auth.verifyEmail.verifyingDescription`)})]}),(0,M.jsx)(EN,{className:`flex justify-center py-6`,children:(0,M.jsx)(`div`,{className:`h-10 w-10 animate-spin rounded-full border-4 border-muted border-t-primary`})})]}),r===`success`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-emerald-500/10 text-emerald-500 ring-1 ring-emerald-500/30`,children:(0,M.jsx)(Sy,{className:`size-6`})}),(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.successTitle`)}),(0,M.jsx)(TN,{children:e(`auth.verifyEmail.successDescription`)})]}),(0,M.jsx)(EN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.signInLink`)})})]}),r===`error`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-destructive/10 text-destructive ring-1 ring-destructive/30`,children:(0,M.jsx)(wy,{className:`size-6`})}),(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.errorTitle`)}),(0,M.jsx)(TN,{children:a||e(`auth.verifyEmail.errorDescription`)})]}),(0,M.jsx)(EN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.backToSignIn`)})})]})]})})}var FN=`Label`,IN=j.forwardRef((e,t)=>(0,M.jsx)(rS.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));IN.displayName=FN;var LN=IN,RN=iy(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),$=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(LN,{ref:n,className:X(RN(),e),...t}));$.displayName=LN.displayName;var zN=la(`/setup`)({component:VN});function BN(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function VN(){let{t:e}=vt(),t=Hi(),n=Qg(),{user:r,refresh:i}=eN(),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(``),[p,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(null);return(0,j.useEffect)(()=>{let e=!1;return(async()=>{try{let{hasOwner:t}=await n.auth.bootstrapStatus();e||g(t)}catch{e||g(!1)}})(),()=>{e=!0}},[n]),(0,j.useEffect)(()=>{h===!0&&!r&&t({to:`/login`,replace:!0})},[h,r,t]),(0,j.useEffect)(()=>{r&&window.location.assign(`/`)},[r]),h===null?(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted`,children:(0,M.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-4 border-muted-foreground/20 border-t-primary`})}):(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted p-6`,children:(0,M.jsx)(`div`,{className:`flex w-full max-w-md flex-col gap-6`,children:(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{children:e(`auth.setup.welcomeTitle`)}),(0,M.jsx)(TN,{children:e(`auth.setup.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),n?.auth){m(!0);try{await n.auth.register({name:a,email:s,password:l}),await i();let e=d.trim();if(e)try{let{organizations:t}=await n.organizations.list(),r=t?.[0],i;if(r?.id)await n.organizations.update(r.id,{name:e,slug:BN(e)}),i=r.id;else{let t=await n.organizations.create({name:e,slug:BN(e)});i=t?.id??t?.data?.id}i&&await n.organizations.setActive(i).catch(()=>{})}catch(e){console.warn(`[setup] organization rename/create failed`,e)}window.location.assign(`/`)}catch(t){K({title:e(`auth.setup.failed`),description:t.message,variant:`destructive`})}finally{m(!1)}}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`name`,children:e(`auth.setup.yourName`)}),(0,M.jsx)(nS,{id:`name`,autoComplete:`name`,required:!0,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`orgName`,children:e(`auth.setup.orgName`)}),(0,M.jsx)(nS,{id:`orgName`,required:!0,placeholder:e(`auth.setup.orgNamePlaceholder`),value:d,onChange:e=>f(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(nS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:s,onChange:e=>c(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(nS,{id:`password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,placeholder:e(`auth.setup.passwordHint`),value:l,onChange:e=>u(e.target.value)})]}),(0,M.jsx)(Z,{type:`submit`,className:`mt-2 w-full`,disabled:p,children:e(p?`auth.setup.submitting`:`auth.setup.submit`)})]})})]})})})}var HN=la(`/reset-password`)({validateSearch:e=>{let t=e.token;return typeof t==`string`?{token:t}:{}},component:UN});function UN(){let{t:e}=vt(),t=Hi(),{token:n}=HN.useSearch(),[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(!1);return(0,M.jsx)(AN,{children:(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.resetPassword.title`)}),(0,M.jsx)(TN,{children:e(`auth.resetPassword.description`)})]}),(0,M.jsx)(EN,{children:n?(0,M.jsxs)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r!==a){K({title:e(`auth.resetPassword.passwordsMismatch`),variant:`destructive`});return}if(!n){K({title:e(`auth.resetPassword.missingToken`),variant:`destructive`});return}c(!0);try{let i=await fetch(`/api/v1/auth/reset-password`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({token:n,newPassword:r})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e?.message||`Request failed: ${i.status}`)}K({title:e(`auth.resetPassword.success`)}),t({to:`/login`})}catch(t){K({title:e(`auth.resetPassword.failed`),description:t.message,variant:`destructive`})}finally{c(!1)}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`new-password`,children:e(`auth.resetPassword.newPassword`)}),(0,M.jsx)(nS,{id:`new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:r,onChange:e=>i(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`confirm-password`,children:e(`auth.resetPassword.confirmPassword`)}),(0,M.jsx)(nS,{id:`confirm-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsx)(Z,{type:`submit`,className:`w-full bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,disabled:s,children:e(s?`auth.resetPassword.submitting`:`auth.resetPassword.submit`)})]}):(0,M.jsxs)(`p`,{className:`text-sm text-muted-foreground text-center`,children:[e(`auth.resetPassword.invalidToken`),` `,(0,M.jsx)(ra,{to:`/forgot-password`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.resetPassword.requestNewLink`)})]})})]})})}function WN({mode:e,redirect:t}){let{t:n}=vt(),r=Qg(),[i,a]=(0,j.useState)([]),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(null);if((0,j.useEffect)(()=>{r?.auth?.getConfig&&r.auth.getConfig().then(e=>{a((e?.socialProviders??e?.data?.socialProviders??[]).filter(e=>e.enabled))}).catch(e=>{console.warn(`[SocialSignInButtons] failed to load auth config`,e)}).finally(()=>s(!1))},[r]),o||i.length===0)return null;let u=n(e===`sign-in`?`auth.social.continueWith`:`auth.social.signUpWith`),d=window.location.origin+`/_account/login`+(t?`?redirect=${encodeURIComponent(t)}`:``),f=e=>{c||(l(e),Promise.resolve(r.auth.signInWithProvider(e.id,{callbackURL:d,errorCallbackURL:d,type:e.type??`social`})).catch(e=>{console.warn(`[SocialSignInButtons] signInWithProvider failed`,e),l(null)}))};return(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.map(e=>{let t=c?.id===e.id;return(0,M.jsxs)(Z,{type:`button`,variant:`outline`,className:`w-full`,disabled:!!c,onClick:()=>f(e),children:[t?(0,M.jsx)(`span`,{className:`mr-2 inline-block size-4 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}):(0,M.jsx)(`span`,{className:`mr-2 flex h-4 w-4 items-center justify-center rounded-sm bg-muted text-[10px] font-bold uppercase`,children:e.id[0]}),t?n(`auth.social.redirectingTo`,{provider:e.name,defaultValue:`Redirecting to ${e.name}…`}):`${u} ${e.name}`]},e.id)}),(0,M.jsxs)(`div`,{className:`relative my-1`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,M.jsx)(`span`,{className:`w-full border-t`})}),(0,M.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,M.jsx)(`span`,{className:`bg-card px-2 text-muted-foreground`,children:n(`auth.social.orContinueEmail`)})})]}),c&&typeof document<`u`?(0,Gi.createPortal)((0,M.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm`,children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-8 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:n(`auth.social.redirectingTo`,{provider:c.name,defaultValue:`Redirecting to ${c.name}…`})})]})}),document.body):null]})}function GN(e,t){if(e.metaKey||e.ctrlKey||e.shiftKey||e.button===1)return;e.preventDefault();let n=Math.min(960,window.screen.availWidth-80),r=Math.min(720,window.screen.availHeight-80),i=Math.max(0,Math.round((window.screen.availWidth-n)/2)),a=Math.max(0,Math.round((window.screen.availHeight-r)/2)),o=[`popup=yes`,`width=${n}`,`height=${r}`,`left=${i}`,`top=${a}`,`resizable=yes`,`scrollbars=yes`,`noopener=yes`,`noreferrer=yes`].join(`,`);window.open(t,`objectstack-legal`,o)||window.open(t,`_blank`,`noopener,noreferrer`)}function KN({termsUrl:e,privacyUrl:t}){let{t:n}=vt(`account`),r=typeof e==`string`&&e.length>0,i=typeof t==`string`&&t.length>0;return!r&&!i?null:(0,M.jsxs)(`p`,{className:`px-6 text-center text-xs text-muted-foreground [&_a]:underline [&_a]:underline-offset-4 [&_a]:hover:text-primary`,children:[n(`legal.agreementPrefix`),` `,r?(0,M.jsx)(`a`,{href:e,target:`objectstack-legal`,rel:`noreferrer noopener`,onClick:t=>GN(t,e),children:n(`legal.termsOfService`)}):null,r&&i?(0,M.jsxs)(M.Fragment,{children:[` `,n(`legal.and`),` `]}):null,i?(0,M.jsx)(`a`,{href:t,target:`objectstack-legal`,rel:`noreferrer noopener`,onClick:e=>GN(e,t),children:n(`legal.privacyPolicy`)}):null,`.`]})}var qN=la(`/register`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:XN});function JN(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function YN(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function XN(){let{t:e}=vt(),t=Hi(),{redirect:n}=qN.useSearch(),r=Qg(),{session:i,user:a,loading:o,refresh:s,organizations:c,organizationsLoading:l,organizationsFetched:u,setActiveOrganization:d,features:f}=eN();(0,j.useEffect)(()=>{f?.signUpDisabled===!0&&t({to:`/login`,search:n?{redirect:n}:{},replace:!0})},[f?.signUpDisabled,t,n]);let[p,m]=(0,j.useState)(``),[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{if(a){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){window.location.assign(`/api/v1/auth/oauth2/authorize${window.location.search}`);return}}if(!i?.activeOrganizationId){if(!u||l||x)return;if(c.length===1){S(!0),d(c[0].id).catch(()=>void 0).finally(()=>S(!1));return}if(!f)return;if(c.length>1){t({to:`/organizations`});return}if(f.multiOrgEnabled===!1){JN(n)?window.location.assign(YN(n)):window.location.assign(`/`);return}t({to:`/organizations/new`,search:n?{redirect:n}:{}});return}if(!x){if(JN(n)){window.location.assign(YN(n));return}window.location.assign(`/`)}}},[a,i,t,n,c,l,u,x,d,f]),(0,M.jsx)(AN,{children:o||a?(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:a?e(`auth.register.signingIn`,{defaultValue:`Setting up your account…`}):e(`auth.login.redirecting`,{defaultValue:`Loading…`})})]}):(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.register.title`)}),(0,M.jsx)(TN,{children:e(`auth.register.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsx)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r?.auth){b(!0);try{let i=await r.auth.register({name:p,email:h,password:_}),a=i?.data??i;if(a&&a.token===null&&a.user){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}try{await s()}catch(e){let r=e.message;if(r.includes(`email`)&&(r.toLowerCase().includes(`verif`)||r.toLowerCase().includes(`not verified`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}throw e}K({title:e(`auth.register.successToast`)})}catch(r){let i=r.message;if(i.includes(`email`)&&(i.toLowerCase().includes(`verif`)||i.toLowerCase().includes(`sent`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}K({title:e(`auth.register.failed`),description:i,variant:`destructive`})}finally{b(!1)}}},children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(WN,{mode:`sign-up`,redirect:n}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`name`,children:e(`auth.nameLabel`)}),(0,M.jsx)(nS,{id:`name`,autoComplete:`name`,required:!0,value:p,onChange:e=>m(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(nS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:h,onChange:e=>g(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(nS,{id:`password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:_,onChange:e=>v(e.target.value)})]}),(0,M.jsx)(Z,{type:`submit`,className:`w-full`,disabled:y,children:e(y?`auth.register.submitting`:`auth.register.submit`)}),(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.register.haveAccount`),` `,(0,M.jsx)(ra,{to:`/login`,search:n?{redirect:n}:void 0,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.register.signIn`)})]})]})})})]}),(0,M.jsx)(KN,{termsUrl:f?.termsUrl,privacyUrl:f?.privacyUrl})]})})}var ZN=la(`/login`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:eP});function QN(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function $N(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function eP(){let{t:e}=vt(),t=Hi(),{redirect:n}=ZN.useSearch(),r=Qg(),i=null;if(typeof window<`u`){let e=new URLSearchParams(window.location.search),t=e.get(`redirect_uri`);if(e.has(`client_id`)&&t)try{i=new URL(t).host}catch{i=null}}let{session:a,user:o,loading:s,refresh:c,organizations:l,organizationsLoading:u,organizationsFetched:d,setActiveOrganization:f,features:p}=eN(),m=p?.signUpDisabled===!0,[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{if(o){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){window.location.assign(`/api/v1/auth/oauth2/authorize${window.location.search}`);return}}if(!a?.activeOrganizationId){if(!d||u||x)return;if(l.length===1){S(!0),f(l[0].id).catch(()=>void 0).finally(()=>S(!1));return}if(!p)return;if(l.length===0){if(p.multiOrgEnabled===!1){QN(n)?window.location.assign($N(n)):window.location.assign(`/`);return}t({to:`/organizations/new`});return}if(p.multiOrgEnabled===!1){S(!0),f(l[0].id).catch(()=>void 0).finally(()=>S(!1));return}t({to:`/organizations`});return}if(!x){if(QN(n)){window.location.assign($N(n));return}window.location.assign(`/`)}}},[o,a,t,n,l,u,d,x,f,p]),s||o?(0,M.jsx)(AN,{children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:e(`auth.login.signingIn`,{defaultValue:`Signing you in…`})})]})}):(0,M.jsxs)(AN,{children:[y?(0,M.jsx)(aN,{message:e(`auth.login.signingIn`,{defaultValue:`Signing you in…`})}):null,(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[i?(0,M.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-md border border-primary/30 bg-primary/5 px-4 py-3 text-sm text-foreground`,children:[(0,M.jsx)(`span`,{className:`mt-0.5 inline-block size-2 shrink-0 rounded-full bg-primary`}),(0,M.jsx)(`span`,{children:e(`auth.login.ssoHandoff`,{target:i,defaultValue:`Continue to ${i}`})})]}):null,(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.login.title`)}),(0,M.jsx)(TN,{children:e(`auth.login.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsx)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r?.auth){b(!0);try{await r.auth.login({type:`email`,email:h,password:_}),await c(),K({title:e(`auth.login.welcomeToast`)})}catch(r){let i=r.message,a=r.code,o=(i||``).toLowerCase();if(a===`EMAIL_NOT_VERIFIED`||o.includes(`email`)&&(o.includes(`verif`)||o.includes(`not verified`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}K({title:e(`auth.login.failed`),description:i,variant:`destructive`})}finally{b(!1)}}},children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(WN,{mode:`sign-in`,redirect:n}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(nS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:h,onChange:e=>g(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center`,children:[(0,M.jsx)($,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(ra,{to:`/forgot-password`,className:`ml-auto text-sm underline-offset-4 hover:underline`,children:e(`auth.login.forgotPassword`)})]}),(0,M.jsx)(nS,{id:`password`,type:`password`,autoComplete:`current-password`,required:!0,value:_,onChange:e=>v(e.target.value)})]}),(0,M.jsx)(Z,{type:`submit`,className:`w-full`,disabled:y,children:e(y?`auth.login.submitting`:`auth.login.submit`)}),m?null:(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.login.noAccount`),` `,(0,M.jsx)(ra,{to:`/register`,search:n?{redirect:n}:void 0,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.login.signUp`)})]})]})})})]}),(0,M.jsx)(KN,{termsUrl:p?.termsUrl,privacyUrl:p?.privacyUrl})]})]})}var tP=la(`/forgot-password`)({component:nP});function nP(){let{t:e}=vt(),[t,n]=(0,j.useState)(``),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(!1);return(0,M.jsx)(AN,{children:(0,M.jsx)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:a?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.forgotPassword.checkEmailTitle`)}),(0,M.jsx)(TN,{children:e(`auth.forgotPassword.checkEmailDescription`,{email:t})})]}),(0,M.jsx)(EN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.forgotPassword.backToSignIn`)})})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.forgotPassword.title`)}),(0,M.jsx)(TN,{children:e(`auth.forgotPassword.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{n.preventDefault(),i(!0);try{let e=window.location.origin+`/_account/`.replace(/\/$/,``)+`/reset-password`,n=await fetch(`/api/v1/auth/forget-password`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({email:t,redirectTo:e})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e?.message||`Request failed: ${n.status}`)}o(!0)}catch(t){K({title:e(`auth.forgotPassword.failed`),description:t.message,variant:`destructive`})}finally{i(!1)}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(nS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:t,onChange:e=>n(e.target.value)})]}),(0,M.jsx)(Z,{type:`submit`,className:`w-full bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,disabled:r,children:e(r?`auth.forgotPassword.submitting`:`auth.forgotPassword.submit`)}),(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.forgotPassword.rememberPassword`),` `,(0,M.jsx)(ra,{to:`/login`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.forgotPassword.signIn`)})]})]})})]})})})}var rP=la(`/account`)({component:iP});function iP(){return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-4 py-6 sm:px-6 sm:py-8`,children:(0,M.jsx)(`div`,{className:`page-enter mx-auto flex max-w-4xl flex-col gap-6`,children:(0,M.jsx)(ya,{})})})})}var aP=la(`/`)({component:oP});function oP(){return(0,M.jsx)(Ui,{to:`/login`})}var sP=iy(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function cP({className:e,variant:t,...n}){return(0,M.jsx)(`div`,{className:X(sP({variant:t}),e),...n})}function lP({title:e,description:t,icon:n,actions:r,className:i,...a}){return(0,M.jsxs)(`div`,{className:X(`relative overflow-hidden rounded-xl border bg-brand-gradient-subtle`,`px-5 py-5 sm:px-6 sm:py-6`,i),...a,children:[(0,M.jsx)(`div`,{className:`pointer-events-none absolute inset-0 opacity-60`,style:{backgroundImage:`radial-gradient(ellipse 60% 80% at 0% 0%, hsl(var(--brand-from) / 0.12), transparent 60%)`},"aria-hidden":!0}),(0,M.jsxs)(`div`,{className:`relative flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between sm:gap-6`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[n?(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15`,children:(0,M.jsx)(n,{className:`size-5`})}):null,(0,M.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,M.jsx)(`h1`,{className:`truncate text-xl font-semibold tracking-tight sm:text-2xl`,children:e}),t?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t}):null]})]}),r?(0,M.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:r}):null]})]})}var uP=la(`/organizations/`)({component:dP});function dP(){let{t:e}=vt(),{organizations:t,loading:n}=tN(),{session:r,setActiveOrganization:i,features:a}=eN(),o=Hi(),s=r?.activeOrganizationId??void 0,c=a?.multiOrgEnabled!==!1,l=async t=>{try{t!==s&&await i(t),o({to:`/organizations/$orgId`,params:{orgId:t}})}catch(t){K({title:e(`organizations.switchFailed`),description:t.message,variant:`destructive`})}},u=e=>e.split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase();return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-4 py-6 sm:px-6 sm:py-8`,children:(0,M.jsxs)(`div`,{className:`page-enter mx-auto flex max-w-3xl flex-col gap-6`,children:[(0,M.jsx)(lP,{icon:gy,title:e(`organizations.title`),description:e(`organizations.description`),actions:c?(0,M.jsxs)(Z,{onClick:()=>o({to:`/organizations/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:[(0,M.jsx)(Uy,{className:`mr-2 h-4 w-4`}),e(`organizations.newOrganization`)]}):null}),n&&(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`organizations.loading`)}),!n&&t.length===0&&(0,M.jsxs)(Q,{className:`p-10 text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-3 flex size-12 items-center justify-center rounded-lg bg-brand-gradient-subtle text-primary ring-1 ring-primary/15`,children:(0,M.jsx)(gy,{className:`h-6 w-6`})}),(0,M.jsx)(`h3`,{className:`text-base font-medium`,children:e(`organizations.emptyTitle`)}),(0,M.jsx)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:e(`organizations.emptyDescription`)}),c&&(0,M.jsxs)(Z,{onClick:()=>o({to:`/organizations/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20`,children:[(0,M.jsx)(Uy,{className:`mr-2 h-4 w-4`}),e(`organizations.createOrganization`)]})]}),(0,M.jsx)(`div`,{className:`grid gap-3`,children:t.map(t=>{let n=t.id===s;return(0,M.jsx)(Q,{role:`button`,tabIndex:0,onClick:()=>l(t.id),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l(t.id))},className:`group cursor-pointer p-4 transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5 focus:outline-none focus:ring-2 focus:ring-ring ${n?`border-primary/50 bg-brand-gradient-subtle ring-1 ring-primary/30`:``}`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,M.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-lg font-semibold `+(n?`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15`:`bg-muted text-muted-foreground group-hover:bg-brand-gradient-subtle group-hover:text-primary`),children:u(t.name)||(0,M.jsx)(gy,{className:`h-5 w-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`h3`,{className:`truncate text-base font-medium`,children:t.name}),n&&(0,M.jsxs)(cP,{className:`gap-1 border-transparent bg-emerald-500/15 text-[10px] font-medium text-emerald-600 dark:text-emerald-400`,children:[(0,M.jsx)(_y,{className:`h-3 w-3`}),e(`organizations.active`)]})]}),t.slug&&(0,M.jsx)(`code`,{className:`mt-0.5 block font-mono text-xs text-muted-foreground`,children:t.slug})]}),(0,M.jsx)(yy,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary`})]})},t.id)})})]})})})}var fP=la(`/account/`)({component:pP});function pP(){let{t:e}=vt(),{user:t}=eN(),{organizations:n}=tN(),r=[!!t?.emailVerified,!!t?.twoFactorEnabled,!!t?.name,!!t?.image].filter(Boolean).length*25,i=r>=75?`success`:r>=50?`warn`:`danger`,a=(t?.name??t?.email??`?`).split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase(),o=[{to:`/account/profile`,label:e(`home.tiles.profile.title`,{defaultValue:`Profile`}),description:e(`home.tiles.profile.description`,{defaultValue:`Display name, avatar and contact info.`}),icon:rb},{to:`/account/security`,label:e(`home.tiles.security.title`,{defaultValue:`Security`}),description:e(`home.tiles.security.description`,{defaultValue:`Change your password and review activity.`}),icon:Jy},{to:`/account/two-factor`,label:e(`home.tiles.twoFactor.title`,{defaultValue:`Two-factor auth`}),description:e(`home.tiles.twoFactor.description`,{defaultValue:`Add an authenticator app for stronger sign-in.`}),icon:qy},{to:`/account/sessions`,label:e(`home.tiles.sessions.title`,{defaultValue:`Active sessions`}),description:e(`home.tiles.sessions.description`,{defaultValue:`See and revoke devices that are signed in.`}),icon:By},{to:`/account/linked-accounts`,label:e(`home.tiles.linked.title`,{defaultValue:`Linked accounts`}),description:e(`home.tiles.linked.description`,{defaultValue:`Manage your social and SSO providers.`}),icon:Iy},{to:`/account/oauth-applications`,label:e(`home.tiles.oauth.title`,{defaultValue:`OAuth applications`}),description:e(`home.tiles.oauth.description`,{defaultValue:`Apps you have authorised to access your account.`}),icon:Ny}];return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl border bg-card`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 bg-brand-gradient`,"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`absolute inset-0 opacity-40 mix-blend-soft-light`,style:{backgroundImage:`radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.4), transparent 60%), radial-gradient(ellipse at 100% 100%, rgba(0,0,0,0.25), transparent 60%)`},"aria-hidden":!0}),(0,M.jsxs)(`div`,{className:`relative flex flex-col gap-4 p-6 text-white sm:flex-row sm:items-center sm:gap-6 sm:p-8`,children:[(0,M.jsxs)(GM,{className:`size-16 shrink-0 ring-4 ring-white/30 shadow-md sm:size-20`,children:[t?.image?(0,M.jsx)(KM,{src:t.image,alt:t?.name??``}):null,(0,M.jsx)(qM,{className:`bg-white/20 text-base font-semibold text-white backdrop-blur`,children:a})]}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,M.jsx)(`p`,{className:`text-xs uppercase tracking-wider text-white/70`,children:e(`home.welcome`,{defaultValue:`Welcome back`})}),(0,M.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight`,children:t?.name||t?.email||`ObjectStack user`}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm text-white/80`,children:[(0,M.jsx)(zy,{className:`size-3.5`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`truncate`,children:t?.email}),t?.emailVerified?(0,M.jsx)(cP,{className:`border-white/30 bg-white/15 text-[10px] font-medium text-white backdrop-blur hover:bg-white/20`,children:e(`home.verified`,{defaultValue:`Verified`})}):null]})]})]})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-3`,children:[(0,M.jsx)(mP,{icon:qy,label:e(`home.stats.score`,{defaultValue:`Security score`}),value:`${r}%`,tone:i,extra:(0,M.jsx)(`div`,{className:`mt-2 h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,M.jsx)(`div`,{className:`h-full bg-brand-gradient transition-[width] duration-500`,style:{width:`${r}%`}})})}),(0,M.jsx)(mP,{icon:gy,label:e(`home.stats.orgs`,{defaultValue:`Organizations`}),value:String(n.length),extra:(0,M.jsxs)(ra,{to:`/organizations`,className:`mt-2 inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline`,children:[e(`home.stats.manage`,{defaultValue:`Manage`}),(0,M.jsx)(hy,{className:`size-3`})]})}),(0,M.jsx)(mP,{icon:t?.twoFactorEnabled?qy:Jy,label:e(`home.stats.twoFactor`,{defaultValue:`Two-factor auth`}),value:t?.twoFactorEnabled?e(`home.stats.enabled`,{defaultValue:`Enabled`}):e(`home.stats.disabled`,{defaultValue:`Disabled`}),tone:t?.twoFactorEnabled?`success`:`warn`,extra:(0,M.jsxs)(ra,{to:`/account/two-factor`,className:`mt-2 inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline`,children:[t?.twoFactorEnabled?e(`home.stats.review`,{defaultValue:`Review`}):e(`home.stats.enable`,{defaultValue:`Enable now`}),(0,M.jsx)(hy,{className:`size-3`})]})})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-muted-foreground`,children:e(`home.quickAccess`,{defaultValue:`Quick access`})}),(0,M.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:o.map(({to:e,label:t,description:n,icon:r})=>(0,M.jsxs)(ra,{to:e,className:`group relative flex items-start gap-3 rounded-lg border bg-card p-4 transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5`,children:[(0,M.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md bg-brand-gradient-subtle text-primary ring-1 ring-primary/10 transition-transform group-hover:scale-110`,children:(0,M.jsx)(r,{className:`size-4`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,M.jsx)(`span`,{className:`truncate font-medium`,children:t}),(0,M.jsx)(hy,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary`})]}),(0,M.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:n})]})]},e))})]})]})}function mP({icon:e,label:t,value:n,tone:r=`neutral`,extra:i}){let a=r===`success`?`text-emerald-600 dark:text-emerald-400`:r===`warn`?`text-amber-600 dark:text-amber-400`:r===`danger`?`text-destructive`:`text-foreground`;return(0,M.jsx)(Q,{className:`overflow-hidden`,children:(0,M.jsxs)(EN,{className:`p-5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wider text-muted-foreground`,children:t}),(0,M.jsx)(e,{className:`size-4 ${a}`})]}),(0,M.jsx)(`p`,{className:`mt-1 text-2xl font-semibold tracking-tight ${a}`,children:n}),i]})})}var hP=la(`/organizations/new`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:yP});function gP(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,48)}function _P(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function vP(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function yP(){let{t:e}=vt(),t=Hi(),{redirect:n}=hP.useSearch(),{create:r,creating:i}=nN(),{setActiveOrganization:a,reloadOrganizations:o,features:s}=eN(),[c,l]=(0,j.useState)(``),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(!1);(0,j.useEffect)(()=>{s&&s.multiOrgEnabled===!1&&t({to:`/organizations`})},[s,t]);let m=e=>{l(e),f||d(gP(e))};return(0,M.jsx)(AN,{formWidth:`md`,children:(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`organizations.new.title`)}),(0,M.jsx)(TN,{children:e(`organizations.new.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault();try{let t=await r({name:c,slug:u||void 0}),i=t?.data??t,s=i?.id??i?.organization?.id;s&&await a(s).catch(()=>{}),await o().catch(()=>{}),K({title:e(`organizations.new.successToast`)}),_P(n)?window.location.assign(vP(n)):window.location.assign(`/`)}catch(t){K({title:e(`organizations.new.failed`),description:t.message,variant:`destructive`})}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`name`,children:e(`organizations.new.name`)}),(0,M.jsx)(nS,{id:`name`,required:!0,autoFocus:!0,value:c,onChange:e=>m(e.target.value),placeholder:e(`organizations.new.namePlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`slug`,children:e(`organizations.new.slug`)}),(0,M.jsx)(nS,{id:`slug`,value:u,onChange:e=>{d(e.target.value),p(!0)},placeholder:e(`organizations.new.slugPlaceholder`),pattern:`[a-z0-9-]+`}),(0,M.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e(`organizations.new.slugHint`)})]}),(0,M.jsx)(Z,{type:`submit`,className:`w-full`,disabled:i||!c,children:e(i?`organizations.new.submitting`:`organizations.new.submit`)}),(0,M.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:(0,M.jsx)(ra,{to:`/organizations`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`organizations.new.cancel`)})})]})})]})})}var bP=la(`/organizations/$orgId`)({component:xP});function xP(){let{t:e}=vt(),{orgId:t}=bP.useParams(),{organizations:n}=tN(),r=n.find(e=>e.id===t);return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-6 py-8`,children:(0,M.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-6`,children:[(0,M.jsxs)(`header`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:r?.name??e(`organizations.title`)}),r?.slug&&(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground font-mono`,children:r.slug})]}),(0,M.jsx)(ya,{})]})})})}function SP(){let e=Qg(),[t,n]=(0,j.useState)([]),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null),s=(0,j.useCallback)(async()=>{if(e?.oauth?.applications){i(!0),o(null);try{n((await e.oauth.applications.list())?.applications??[])}catch(e){o(e),n([])}finally{i(!1)}}},[e]);return(0,j.useEffect)(()=>{s()},[s]),{applications:t,loading:r,error:a,reload:s}}function CP(){let e=Qg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null),[a,o]=(0,j.useState)(null);return{register:(0,j.useCallback)(async t=>{if(!e?.oauth?.applications?.register)throw Error(`Client not ready`);n(!0),i(null);try{let n=await e.oauth.applications.register(t);return o(n),n}catch(e){throw i(e),e}finally{n(!1)}},[e]),registering:t,error:r,lastResult:a}}function wP(){let e=Qg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{remove:(0,j.useCallback)(async t=>{if(!e?.oauth?.applications?.delete)throw Error(`Client not ready`);n(!0),i(null);try{return await e.oauth.applications.delete(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),deleting:t,error:r}}function TP(){let e=Qg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{submit:(0,j.useCallback)(async t=>{if(!e?.oauth?.consent)throw Error(`Client not ready`);n(!0),i(null);try{return await e.oauth.consent(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),submitting:t,error:r}}var EP=la(`/oauth/consent`)({validateSearch:e=>e,component:DP});function DP(){let{t:e}=vt(),t=Hi(),n=Qg(),{user:r,loading:i}=eN(),{submit:a,submitting:o}=TP(),[s,c]=(0,j.useState)(null),l=typeof window<`u`?window.location.search:``,u=l.startsWith(`?`)?l.slice(1):l,d=new URLSearchParams(u),f=d.get(`client_id`)??void 0,p=d.get(`scope`)??``;(0,j.useEffect)(()=>{i||r||t({to:`/login`,search:{redirect:window.location.pathname+window.location.search}})},[r,i,t]),(0,j.useEffect)(()=>{if(!f||!n?.oauth?.applications?.getPublic)return;let e=!1;return n.oauth.applications.getPublic(f).then(t=>{if(e)return;let n=t?.data??t;c({name:n?.name??n?.client_name,icon:n?.icon??n?.logo_uri})},()=>{}),()=>{e=!0}},[n,f]);let m=p.split(/\s+/).filter(Boolean),h=async t=>{try{let n=await a({accept:t,oauth_query:u}),r=n?.redirect_uri??n?.redirectURI??n?.url;if(r){window.location.href=r;return}K({title:e(t?`oauth.consent.granted`:`oauth.consent.denied`),description:e(`oauth.consent.noRedirect`),variant:t?void 0:`destructive`})}catch(t){K({title:e(`oauth.consent.failed`),description:t.message,variant:`destructive`})}},g=s?.name??f??e(`oauth.consent.unknownApp`);return(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-1 items-center justify-center bg-background px-4`,children:(0,M.jsxs)(Q,{className:`w-full max-w-md`,children:[(0,M.jsxs)(CN,{className:`items-center text-center`,children:[(0,M.jsx)(`div`,{className:`mb-3 rounded-full border bg-muted p-3`,children:s?.icon?(0,M.jsx)(`img`,{src:s.icon,alt:``,className:`h-8 w-8 rounded`,onError:e=>e.currentTarget.style.display=`none`}):(0,M.jsx)(Ny,{className:`h-7 w-7 text-muted-foreground`})}),(0,M.jsx)(wN,{className:`text-xl`,children:e(`oauth.consent.title`,{appName:g})}),(0,M.jsx)(TN,{children:e(`oauth.consent.request`,{appName:g,suffix:r?.email?` (${r.email})`:``})})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[m.length>0&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:e(`oauth.consent.willAllow`)}),(0,M.jsx)(`ul`,{className:`space-y-1.5 rounded-md border bg-muted/40 p-3 text-sm`,children:m.map(t=>(0,M.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,M.jsx)(_y,{className:`mt-0.5 h-4 w-4 text-green-600 dark:text-green-400`}),(0,M.jsx)(`span`,{children:OP(t,e)})]},t))})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pt-2`,children:[(0,M.jsxs)(Z,{variant:`outline`,onClick:()=>h(!1),disabled:o,children:[(0,M.jsx)(ob,{className:`mr-2 h-4 w-4`}),e(`oauth.consent.deny`)]}),(0,M.jsxs)(Z,{onClick:()=>h(!0),disabled:o,children:[(0,M.jsx)(_y,{className:`mr-2 h-4 w-4`}),e(o?`oauth.consent.submitting`:`oauth.consent.authorize`)]})]}),(0,M.jsx)(`p`,{className:`pt-2 text-center text-xs text-muted-foreground`,children:e(`oauth.consent.footer`)})]})]})})}function OP(e,t){switch(e){case`openid`:return t(`oauth.consent.scope.openid`);case`profile`:return t(`oauth.consent.scope.profile`);case`email`:return t(`oauth.consent.scope.email`);case`offline_access`:return t(`oauth.consent.scope.offlineAccess`);default:return e}}var kP=la(`/auth/device`)({validateSearch:e=>({user_code:e.user_code??e.code??``}),component:jP});function AP({children:e}){return(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10`,children:(0,M.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-6`,children:[(0,M.jsxs)(`a`,{href:`#`,className:`flex items-center gap-2 self-center font-medium`,children:[(0,M.jsx)(`div`,{className:`flex size-6 items-center justify-center rounded-md bg-primary text-primary-foreground`,children:(0,M.jsx)(ky,{className:`size-4`})}),`ObjectStack`]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-6`,children:e})]})})}function jP(){let{t:e}=vt(),{user_code:t}=kP.useSearch(),{user:n,loading:r}=eN(),i=Hi(),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(!1),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(``);return t?r?(0,M.jsx)(AP,{children:(0,M.jsx)(Q,{children:(0,M.jsx)(CN,{className:`text-center`,children:(0,M.jsx)(TN,{children:e(`auth.device.loading`)})})})}):n?l?(0,M.jsx)(AP,{children:(0,M.jsx)(Q,{children:(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(Sy,{className:`h-10 w-10 text-green-500 mx-auto mb-2`}),(0,M.jsx)(wN,{children:e(`auth.device.approvedTitle`)}),(0,M.jsx)(TN,{children:e(`auth.device.approvedDescription`)})]})})}):d?(0,M.jsx)(AP,{children:(0,M.jsx)(Q,{children:(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{children:e(`auth.device.deniedTitle`)}),(0,M.jsx)(TN,{children:e(`auth.device.deniedDescription`)})]})})}):(0,M.jsx)(AP,{children:(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{children:e(`auth.device.title`)}),(0,M.jsx)(TN,{children:e(`auth.device.subtitle`,{email:n.email})})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`rounded-md border bg-background px-4 py-3 text-center`,children:[(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground mb-1`,children:e(`auth.device.userCodeLabel`)}),(0,M.jsx)(`p`,{className:`font-mono font-semibold tracking-widest text-lg`,children:t})]}),(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(`p`,{className:`text-sm text-center text-muted-foreground`,children:e(`auth.device.loggedInAs`,{email:n.email})}),p&&(0,M.jsx)(`p`,{className:`text-sm text-destructive text-center`,children:p}),(0,M.jsx)(Z,{onClick:async()=>{m(``),o(!0);try{let n=await fetch(`/api/v1/auth/device/approve`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:t})});if(!n.ok){let t=await n.json().catch(()=>({}));throw Error(t?.message??t?.error?.message??e(`auth.device.approveFailed`))}u(!0),K({title:e(`auth.device.approveSuccess`),description:e(`auth.device.approveSuccessDescription`)})}catch(t){m(t?.message??e(`auth.device.approveFailed`))}finally{o(!1)}},className:`w-full`,disabled:a||s,children:e(a?`auth.device.approving`:`auth.device.approve`)}),(0,M.jsx)(Z,{onClick:async()=>{m(``),c(!0);try{await fetch(`/api/v1/auth/device/deny`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:t})}),f(!0)}catch(t){m(t?.message??e(`auth.device.denyFailed`))}finally{c(!1)}},variant:`outline`,className:`w-full`,disabled:a||s,children:e(s?`auth.device.denying`:`auth.device.deny`)}),(0,M.jsx)(`div`,{className:`text-center`,children:(0,M.jsx)(`button`,{type:`button`,className:`text-sm text-muted-foreground underline-offset-4 hover:underline`,onClick:()=>i({to:`/`}),children:e(`auth.device.cancel`)})})]})]})]})}):(0,M.jsx)(Ui,{to:`/login`,search:{redirect:`/auth/device?user_code=${encodeURIComponent(t)}`}}):(0,M.jsx)(AP,{children:(0,M.jsx)(Q,{children:(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{children:e(`auth.device.invalidTitle`)}),(0,M.jsx)(TN,{children:e(`auth.device.invalidDescription`)})]})})})}var MP=la(`/account/two-factor`)({component:NP});function NP(){let{t:e}=vt(),t=Qg(),{user:n,loading:r,refresh:i}=eN(),[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(null),[p,m]=(0,j.useState)(null),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(!1),[T,E]=(0,j.useState)(``),[D,O]=(0,j.useState)(!1),[ee,te]=(0,j.useState)(null);(0,j.useEffect)(()=>{r||o(!!n?.twoFactorEnabled)},[r,n?.twoFactorEnabled]);let ne=async n=>{n.preventDefault(),u(!0);try{let e=await t.auth.twoFactor.enable({password:s});f(e?.totpURI??null),m(e?.backupCodes??null),c(``)}catch(t){K({title:e(`twoFactor.enableFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},re=async n=>{n.preventDefault(),b(!0);try{await t.auth.twoFactor.verifyTotp({code:_,trustDevice:h}),K({title:e(`twoFactor.enableSuccess`)}),o(!0),f(null),v(``),await i()}catch(t){K({title:e(`twoFactor.invalidCode`),description:t.message,variant:`destructive`})}finally{b(!1)}},ie=async n=>{n.preventDefault(),w(!0);try{await t.auth.twoFactor.disable({password:x}),K({title:e(`twoFactor.disableSuccess`)}),o(!1),S(``),te(null),await i()}catch(t){K({title:e(`twoFactor.disableFailed`),description:t.message,variant:`destructive`})}finally{w(!1)}},ae=async n=>{n.preventDefault(),O(!0);try{te((await t.auth.twoFactor.generateBackupCodes({password:T}))?.backupCodes??[]),E(``),K({title:e(`twoFactor.backupCodes.regenerated`)})}catch(t){K({title:e(`twoFactor.backupCodes.regenerateFailed`),description:t.message,variant:`destructive`})}finally{O(!1)}},oe=async t=>{try{await navigator.clipboard.writeText(t.join(`
147
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return j.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},kw=`DialogDescriptionWarning`,Aw=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Dw(kw).contentName}}.`;return j.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},jw=nw,Mw=cw,Nw=uw,Pw=mw,Fw=yw,Iw=xw,Lw=Cw,Rw=jw,zw=Mw,Bw=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Nw,{className:X(`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}));Bw.displayName=Nw.displayName;var Vw=iy(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),Hw=j.forwardRef(({side:e=`right`,className:t,children:n,...r},i)=>(0,M.jsxs)(zw,{children:[(0,M.jsx)(Bw,{}),(0,M.jsxs)(Pw,{ref:i,className:X(Vw({side:e}),t),...r,children:[n,(0,M.jsxs)(Lw,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,M.jsx)(ob,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Hw.displayName=Pw.displayName;var Uw=({className:e,...t})=>(0,M.jsx)(`div`,{className:X(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});Uw.displayName=`SheetHeader`;var Ww=({className:e,...t})=>(0,M.jsx)(`div`,{className:X(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Ww.displayName=`SheetFooter`;var Gw=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Fw,{ref:n,className:X(`text-lg font-semibold text-foreground`,e),...t}));Gw.displayName=Fw.displayName;var Kw=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Iw,{ref:n,className:X(`text-sm text-muted-foreground`,e),...t}));Kw.displayName=Iw.displayName;function qw({className:e,...t}){return(0,M.jsx)(`div`,{className:X(`bg-muted animate-pulse rounded-md`,e),...t})}var Jw=[`top`,`right`,`bottom`,`left`],Yw=Math.min,Xw=Math.max,Zw=Math.round,Qw=Math.floor,$w=e=>({x:e,y:e}),eT={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function tT(e,t,n){return Xw(e,Yw(t,n))}function nT(e,t){return typeof e==`function`?e(t):e}function rT(e){return e.split(`-`)[0]}function iT(e){return e.split(`-`)[1]}function aT(e){return e===`x`?`y`:`x`}function oT(e){return e===`y`?`height`:`width`}function sT(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function cT(e){return aT(sT(e))}function lT(e,t,n){n===void 0&&(n=!1);let r=iT(e),i=cT(e),a=oT(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=vT(o)),[o,vT(o)]}function uT(e){let t=vT(e);return[dT(e),t,dT(t)]}function dT(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var fT=[`left`,`right`],pT=[`right`,`left`],mT=[`top`,`bottom`],hT=[`bottom`,`top`];function gT(e,t,n){switch(e){case`top`:case`bottom`:return n?t?pT:fT:t?fT:pT;case`left`:case`right`:return t?mT:hT;default:return[]}}function _T(e,t,n,r){let i=iT(e),a=gT(rT(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(dT)))),a}function vT(e){let t=rT(e);return eT[t]+e.slice(t.length)}function yT(e){return{top:0,right:0,bottom:0,left:0,...e}}function bT(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:yT(e)}function xT(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ST(e,t,n){let{reference:r,floating:i}=e,a=sT(t),o=cT(t),s=oT(o),c=rT(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(iT(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function CT(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=nT(t,e),p=bT(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=xT(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=xT(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var wT=50,TT=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:CT},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ST(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<wT&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ST(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ET=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=nT(e,t)||{};if(l==null)return{};let d=bT(u),f={x:n,y:r},p=cT(i),m=oT(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Yw(d[_],T),D=Yw(d[v],T),O=E,ee=C-h[m]-D,te=C/2-h[m]/2+w,ne=tT(O,te,ee),re=!c.arrow&&iT(i)!=null&&te!==ne&&a.reference[m]/2-(te<O?E:D)-h[m]/2<0,ie=re?te<O?te-O:te-ee:0;return{[p]:f[p]+ie,data:{[p]:ne,centerOffset:te-ne-ie,...re&&{alignmentOffset:ie}},reset:re}}}),DT=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=nT(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=rT(r),_=sT(o),v=rT(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[vT(o)]:uT(o)),x=p!==`none`;!d&&x&&b.push(..._T(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=lT(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==sT(t))||T.every(e=>sT(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=sT(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function OT(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kT(e){return Jw.some(t=>e[t]>=0)}var AT=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=nT(e,t);switch(i){case`referenceHidden`:{let e=OT(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:kT(e)}}}case`escaped`:{let e=OT(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:kT(e)}}}default:return{}}}}},jT=new Set([`left`,`top`]);async function MT(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=rT(n),s=iT(n),c=sT(n)===`y`,l=jT.has(o)?-1:1,u=a&&c?-1:1,d=nT(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var NT=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await MT(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},PT=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=nT(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=sT(rT(i)),p=aT(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=tT(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=tT(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},FT=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=nT(e,t),u={x:n,y:r},d=sT(i),f=aT(d),p=u[f],m=u[d],h=nT(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=jT.has(rT(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},IT=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=nT(e,t),u=await o.detectOverflow(t,l),d=rT(i),f=iT(i),p=sT(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Yw(h-u[g],v),x=Yw(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Xw(u.left,0),t=Xw(u.right,0),n=Xw(u.top,0),r=Xw(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Xw(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Xw(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function LT(){return typeof window<`u`}function RT(e){return VT(e)?(e.nodeName||``).toLowerCase():`#document`}function zT(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function BT(e){return((VT(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function VT(e){return LT()?e instanceof Node||e instanceof zT(e).Node:!1}function HT(e){return LT()?e instanceof Element||e instanceof zT(e).Element:!1}function UT(e){return LT()?e instanceof HTMLElement||e instanceof zT(e).HTMLElement:!1}function WT(e){return!LT()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof zT(e).ShadowRoot}function GT(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=nE(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function KT(e){return/^(table|td|th)$/.test(RT(e))}function qT(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var JT=/transform|translate|scale|rotate|perspective|filter/,YT=/paint|layout|strict|content/,XT=e=>!!e&&e!==`none`,ZT;function QT(e){let t=HT(e)?nE(e):e;return XT(t.transform)||XT(t.translate)||XT(t.scale)||XT(t.rotate)||XT(t.perspective)||!eE()&&(XT(t.backdropFilter)||XT(t.filter))||JT.test(t.willChange||``)||YT.test(t.contain||``)}function $T(e){let t=iE(e);for(;UT(t)&&!tE(t);){if(QT(t))return t;if(qT(t))return null;t=iE(t)}return null}function eE(){return ZT??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ZT}function tE(e){return/^(html|body|#document)$/.test(RT(e))}function nE(e){return zT(e).getComputedStyle(e)}function rE(e){return HT(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function iE(e){if(RT(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||WT(e)&&e.host||BT(e);return WT(t)?t.host:t}function aE(e){let t=iE(e);return tE(t)?e.ownerDocument?e.ownerDocument.body:e.body:UT(t)&&GT(t)?t:aE(t)}function oE(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=aE(e),i=r===e.ownerDocument?.body,a=zT(r);if(i){let e=sE(a);return t.concat(a,a.visualViewport||[],GT(r)?r:[],e&&n?oE(e):[])}else return t.concat(r,oE(r,[],n))}function sE(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function cE(e){let t=nE(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=UT(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Zw(n)!==a||Zw(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function lE(e){return HT(e)?e:e.contextElement}function uE(e){let t=lE(e);if(!UT(t))return $w(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=cE(t),o=(a?Zw(n.width):n.width)/r,s=(a?Zw(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var dE=$w(0);function fE(e){let t=zT(e);return!eE()||!t.visualViewport?dE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==zT(e)?!1:t}function mE(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=lE(e),o=$w(1);t&&(r?HT(r)&&(o=uE(r)):o=uE(e));let s=pE(a,n,r)?fE(a):$w(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=zT(a),t=r&&HT(r)?zT(r):r,n=e,i=sE(n);for(;i&&r&&t!==n;){let e=uE(i),t=i.getBoundingClientRect(),r=nE(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=zT(i),i=sE(n)}}return xT({width:u,height:d,x:c,y:l})}function hE(e,t){let n=rE(e).scrollLeft;return t?t.left+n:mE(BT(e)).left+n}function gE(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-hE(e,n),y:n.top+t.scrollTop}}function _E(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=BT(r),s=t?qT(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=$w(1),u=$w(0),d=UT(r);if((d||!d&&!a)&&((RT(r)!==`body`||GT(o))&&(c=rE(r)),d)){let e=mE(r);l=uE(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?gE(o,c):$w(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function vE(e){return Array.from(e.getClientRects())}function yE(e){let t=BT(e),n=rE(e),r=e.ownerDocument.body,i=Xw(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Xw(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+hE(e),s=-n.scrollTop;return nE(r).direction===`rtl`&&(o+=Xw(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var bE=25;function xE(e,t){let n=zT(e),r=BT(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=eE();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=hE(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=bE&&(a-=o)}else l<=bE&&(a+=l);return{width:a,height:o,x:s,y:c}}function SE(e,t){let n=mE(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=UT(e)?uE(e):$w(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function CE(e,t,n){let r;if(t===`viewport`)r=xE(e,n);else if(t===`document`)r=yE(BT(e));else if(HT(t))r=SE(t,n);else{let n=fE(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return xT(r)}function wE(e,t){let n=iE(e);return n===t||!HT(n)||tE(n)?!1:nE(n).position===`fixed`||wE(n,t)}function TE(e,t){let n=t.get(e);if(n)return n;let r=oE(e,[],!1).filter(e=>HT(e)&&RT(e)!==`body`),i=null,a=nE(e).position===`fixed`,o=a?iE(e):e;for(;HT(o)&&!tE(o);){let t=nE(o),n=QT(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||GT(o)&&!n&&wE(e,o))?r=r.filter(e=>e!==o):i=t,o=iE(o)}return t.set(e,r),r}function EE(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?qT(t)?[]:TE(t,this._c):[].concat(n),r],o=CE(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=CE(t,a[e],i);s=Xw(n.top,s),c=Yw(n.right,c),l=Yw(n.bottom,l),u=Xw(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function DE(e){let{width:t,height:n}=cE(e);return{width:t,height:n}}function OE(e,t,n){let r=UT(t),i=BT(t),a=n===`fixed`,o=mE(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=$w(0);function l(){c.x=hE(i)}if(r||!r&&!a)if((RT(t)!==`body`||GT(i))&&(s=rE(t)),r){let e=mE(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?gE(i,s):$w(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function kE(e){return nE(e).position===`static`}function AE(e,t){if(!UT(e)||nE(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return BT(e)===n&&(n=n.ownerDocument.body),n}function jE(e,t){let n=zT(e);if(qT(e))return n;if(!UT(e)){let t=iE(e);for(;t&&!tE(t);){if(HT(t)&&!kE(t))return t;t=iE(t)}return n}let r=AE(e,t);for(;r&&KT(r)&&kE(r);)r=AE(r,t);return r&&tE(r)&&kE(r)&&!QT(r)?n:r||$T(e)||n}var ME=async function(e){let t=this.getOffsetParent||jE,n=this.getDimensions,r=await n(e.floating);return{reference:OE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function NE(e){return nE(e).direction===`rtl`}var PE={convertOffsetParentRelativeRectToViewportRelativeRect:_E,getDocumentElement:BT,getClippingRect:EE,getOffsetParent:jE,getElementRects:ME,getClientRects:vE,getDimensions:DE,getScale:uE,isElement:HT,isRTL:NE};function FE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function IE(e,t){let n=null,r,i=BT(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Qw(d),h=Qw(i.clientWidth-(u+f)),g=Qw(i.clientHeight-(d+p)),_=Qw(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Xw(0,Yw(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!FE(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function LE(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=lE(e),u=i||a?[...l?oE(l):[],...t?oE(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?IE(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?mE(e):null;c&&g();function g(){let t=mE(e);h&&!FE(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var RE=NT,zE=PT,BE=DT,VE=IT,HE=AT,UE=ET,WE=FT,GE=(e,t,n)=>{let r=new Map,i={platform:PE,...n},a={...i.platform,_c:r};return TT(e,t,{...i,platform:a})},KE=typeof document<`u`?j.useLayoutEffect:function(){};function qE(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!qE(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!qE(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function JE(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function YE(e,t){let n=JE(e);return Math.round(t*n)/n}function XE(e){let t=j.useRef(e);return KE(()=>{t.current=e}),t}function ZE(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=j.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=j.useState(r);qE(f,r)||p(r);let[m,h]=j.useState(null),[g,_]=j.useState(null),v=j.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=j.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=j.useRef(null),C=j.useRef(null),w=j.useRef(u),T=c!=null,E=XE(c),D=XE(i),O=XE(l),ee=j.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),GE(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};te.current&&!qE(w.current,t)&&(w.current=t,Gi.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);KE(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let te=j.useRef(!1);KE(()=>(te.current=!0,()=>{te.current=!1}),[]),KE(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,ee);ee()}},[b,x,ee,E,T]);let ne=j.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),re=j.useMemo(()=>({reference:b,floating:x}),[b,x]),ie=j.useMemo(()=>{let e={position:n,left:0,top:0};if(!re.floating)return e;let t=YE(re.floating,u.x),r=YE(re.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...JE(re.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,re.floating,u.x,u.y]);return j.useMemo(()=>({...u,update:ee,refs:ne,elements:re,floatingStyles:ie}),[u,ee,ne,re,ie])}var QE=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:UE({element:r.current,padding:i}).fn(n):r?UE({element:r,padding:i}).fn(n):{}}}},$E=(e,t)=>{let n=RE(e);return{name:n.name,fn:n.fn,options:[e,t]}},eD=(e,t)=>{let n=zE(e);return{name:n.name,fn:n.fn,options:[e,t]}},tD=(e,t)=>({fn:WE(e).fn,options:[e,t]}),nD=(e,t)=>{let n=BE(e);return{name:n.name,fn:n.fn,options:[e,t]}},rD=(e,t)=>{let n=VE(e);return{name:n.name,fn:n.fn,options:[e,t]}},iD=(e,t)=>{let n=HE(e);return{name:n.name,fn:n.fn,options:[e,t]}},aD=(e,t)=>{let n=QE(e);return{name:n.name,fn:n.fn,options:[e,t]}},oD=`Arrow`,sD=j.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,M.jsx)(w_.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,M.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});sD.displayName=oD;var cD=sD;function lD(e){let[t,n]=j.useState(void 0);return U_(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var uD=`Popper`,[dD,fD]=m_(uD),[pD,mD]=dD(uD),hD=e=>{let{__scopePopper:t,children:n}=e,[r,i]=j.useState(null);return(0,M.jsx)(pD,{scope:t,anchor:r,onAnchorChange:i,children:n})};hD.displayName=uD;var gD=`PopperAnchor`,_D=j.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=mD(gD,n),o=j.useRef(null),s=f_(t,o),c=j.useRef(null);return j.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,M.jsx)(w_.div,{...i,ref:s})});_D.displayName=gD;var vD=`PopperContent`,[yD,bD]=dD(vD),xD=j.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=mD(vD,n),[_,v]=j.useState(null),y=f_(t,e=>v(e)),[b,x]=j.useState(null),S=lD(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,ee={padding:E,boundary:D.filter(TD),altBoundary:O},{refs:te,floatingStyles:ne,placement:re,isPositioned:ie,middlewareData:ae}=ZE({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>LE(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[$E({mainAxis:i+w,alignmentAxis:o}),c&&eD({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?tD():void 0,...ee}),c&&nD({...ee}),rD({...ee,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&aD({element:b,padding:s}),ED({arrowWidth:C,arrowHeight:w}),f&&iD({strategy:`referenceHidden`,...ee})]}),[oe,k]=DD(re),se=E_(m);U_(()=>{ie&&se?.()},[ie,se]);let ce=ae.arrow?.x,le=ae.arrow?.y,ue=ae.arrow?.centerOffset!==0,[A,de]=j.useState();return U_(()=>{_&&de(window.getComputedStyle(_).zIndex)},[_]),(0,M.jsx)(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:ie?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:A,"--radix-popper-transform-origin":[ae.transformOrigin?.x,ae.transformOrigin?.y].join(` `),...ae.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,M.jsx)(yD,{scope:n,placedSide:oe,onArrowChange:x,arrowX:ce,arrowY:le,shouldHideArrow:ue,children:(0,M.jsx)(w_.div,{"data-side":oe,"data-align":k,...h,ref:y,style:{...h.style,animation:ie?void 0:`none`}})})})});xD.displayName=vD;var SD=`PopperArrow`,CD={top:`bottom`,right:`left`,bottom:`top`,left:`right`},wD=j.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=bD(SD,n),a=CD[i.placedSide];return(0,M.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,M.jsx)(cD,{...r,ref:t,style:{...r.style,display:`block`}})})});wD.displayName=SD;function TD(e){return e!==null}var ED=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=DD(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function DD(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var OD=hD,kD=_D,AD=xD,jD=wD,[MD,ND]=m_(`Tooltip`,[fD]),PD=fD(),FD=`TooltipProvider`,ID=700,LD=`tooltip.open`,[RD,zD]=MD(FD),BD=e=>{let{__scopeTooltip:t,delayDuration:n=ID,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=j.useRef(!0),s=j.useRef(!1),c=j.useRef(0);return j.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,M.jsx)(RD,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:j.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:j.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:j.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};BD.displayName=FD;var VD=`Tooltip`,[HD,UD]=MD(VD),WD=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=zD(VD,e.__scopeTooltip),l=PD(t),[u,d]=j.useState(null),f=pS(),p=j.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=j.useRef(!1),[_,v]=Q_({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(LD))):c.onClose(),a?.(e)},caller:VD}),y=j.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=j.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=j.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=j.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return j.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,M.jsx)(OD,{...l,children:(0,M.jsx)(HD,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:j.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:j.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};WD.displayName=VD;var GD=`TooltipTrigger`,KD=j.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=UD(GD,n),a=zD(GD,n),o=PD(n),s=f_(t,j.useRef(null),i.onTriggerChange),c=j.useRef(!1),l=j.useRef(!1),u=j.useCallback(()=>c.current=!1,[]);return j.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,M.jsx)(kD,{asChild:!0,...o,children:(0,M.jsx)(w_.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:q(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:q(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:q(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:q(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:q(e.onBlur,i.onClose),onClick:q(e.onClick,i.onClose)})})});KD.displayName=GD;var qD=`TooltipPortal`,[JD,YD]=MD(qD,{forceMount:void 0}),XD=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=UD(qD,t);return(0,M.jsx)(JD,{scope:t,forceMount:n,children:(0,M.jsx)(q_,{present:n||a.open,children:(0,M.jsx)(G_,{asChild:!0,container:i,children:r})})})};XD.displayName=qD;var ZD=`TooltipContent`,QD=j.forwardRef((e,t)=>{let n=YD(ZD,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=UD(ZD,e.__scopeTooltip);return(0,M.jsx)(q_,{present:r||o.open,children:o.disableHoverableContent?(0,M.jsx)(rO,{side:i,...a,ref:t}):(0,M.jsx)($D,{side:i,...a,ref:t})})}),$D=j.forwardRef((e,t)=>{let n=UD(ZD,e.__scopeTooltip),r=zD(ZD,e.__scopeTooltip),i=j.useRef(null),a=f_(t,i),[o,s]=j.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=j.useCallback(()=>{s(null),d(!1)},[d]),p=j.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=sO(r,oO(r,n.getBoundingClientRect())),a=cO(t.getBoundingClientRect());s(uO([...i,...a])),d(!0)},[d]);return j.useEffect(()=>()=>f(),[f]),j.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),j.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!lO(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,M.jsx)(rO,{...e,ref:a})}),[eO,tO]=MD(VD,{isInside:!1}),nO=y_(`TooltipContent`),rO=j.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=UD(ZD,n),l=PD(n),{onClose:u}=c;return j.useEffect(()=>(document.addEventListener(LD,u),()=>document.removeEventListener(LD,u)),[u]),j.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,M.jsx)(P_,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,M.jsxs)(AD,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.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:[(0,M.jsx)(nO,{children:r}),(0,M.jsx)(eO,{scope:n,isInside:!0,children:(0,M.jsx)(iv,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});QD.displayName=ZD;var iO=`TooltipArrow`,aO=j.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=PD(n);return tO(iO,n).isInside?null:(0,M.jsx)(jD,{...i,...r,ref:t})});aO.displayName=iO;function oO(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function sO(e,t,n=5){let 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 cO(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function lO(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function uO(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),dO(t)}function dO(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}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 fO=BD,pO=WD,mO=KD,hO=QD,gO=fO,_O=pO,vO=mO,yO=j.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,M.jsx)(hO,{ref:r,sideOffset:t,className:X(`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}));yO.displayName=hO.displayName;var bO=`sidebar_state`,xO=3600*24*7,SO=`16rem`,CO=`18rem`,wO=`3rem`,TO=`b`,EO=j.createContext(null);function DO(){let e=j.useContext(EO);if(!e)throw Error(`useSidebar must be used within a SidebarProvider`);return e}var OO=j.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o},s)=>{let c=eS(),[l,u]=j.useState(!1),[d,f]=j.useState(e),p=t??d,m=j.useCallback(e=>{let t=typeof e==`function`?e(p):e;n?n(t):f(t),document.cookie=`${bO}=${t}; path=/; max-age=${xO}`},[n,p]),h=j.useCallback(()=>c?u(e=>!e):m(e=>!e),[c,m,u]);j.useEffect(()=>{let e=e=>{e.key===TO&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]);let g=p?`expanded`:`collapsed`,_=j.useMemo(()=>({state:g,open:p,setOpen:m,isMobile:c,openMobile:l,setOpenMobile:u,toggleSidebar:h}),[g,p,m,c,l,u,h]);return(0,M.jsx)(EO.Provider,{value:_,children:(0,M.jsx)(gO,{delayDuration:0,children:(0,M.jsx)(`div`,{style:{"--sidebar-width":SO,"--sidebar-width-icon":wO,...i},className:X(`group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-0 w-full`,r),ref:s,...o,children:a})})})});OO.displayName=`SidebarProvider`;var kO=j.forwardRef(({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,...a},o)=>{let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=DO();return n===`none`?(0,M.jsx)(`div`,{className:X(`bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col`,r),ref:o,...a,children:i}):s?(0,M.jsx)(Rw,{open:l,onOpenChange:u,...a,children:(0,M.jsx)(Hw,{"data-sidebar":`sidebar`,"data-mobile":`true`,className:`bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden`,style:{"--sidebar-width":CO},side:e,children:(0,M.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})})}):(0,M.jsx)(`div`,{ref:o,className:X(`bg-sidebar text-sidebar-foreground hidden md:flex h-svh w-[var(--sidebar-width)] shrink-0 flex-col border-r transition-[width] duration-200 ease-linear overflow-hidden`,c===`collapsed`&&n===`offcanvas`&&`w-0 border-0`,c===`collapsed`&&n===`icon`&&`w-[var(--sidebar-width-icon)]`,r),"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,...a,children:i})});kO.displayName=`Sidebar`;var AO=j.forwardRef(({className:e,onClick:t,...n},r)=>{let{toggleSidebar:i}=DO();return(0,M.jsxs)(Z,{ref:r,"data-sidebar":`trigger`,variant:`ghost`,size:`icon`,className:X(`h-7 w-7`,e),onClick:e=>{t?.(e),i()},...n,children:[(0,M.jsx)(Hy,{}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})});AO.displayName=`SidebarTrigger`;var jO=j.forwardRef(({className:e,...t},n)=>{let{toggleSidebar:r}=DO();return(0,M.jsx)(`button`,{ref:n,"data-sidebar":`rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onClick:r,title:`Toggle Sidebar`,className:X(`hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex`,`[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,e),...t})});jO.displayName=`SidebarRail`;var MO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`main`,{ref:n,className:X(`relative flex min-h-svh flex-1 flex-col bg-background`,`peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow`,e),...t}));MO.displayName=`SidebarInset`;var NO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(nS,{ref:n,"data-sidebar":`input`,className:X(`h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring`,e),...t}));NO.displayName=`SidebarInput`;var PO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`header`,className:X(`flex flex-col gap-2 p-2`,e),...t}));PO.displayName=`SidebarHeader`;var FO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`footer`,className:X(`flex flex-col gap-2 p-2`,e),...t}));FO.displayName=`SidebarFooter`;var IO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(uS,{ref:n,"data-sidebar":`separator`,className:X(`mx-2 w-auto bg-sidebar-border`,e),...t}));IO.displayName=`SidebarSeparator`;var LO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`content`,className:X(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto`,e),...t}));LO.displayName=`SidebarContent`;var RO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`group`,className:X(`relative flex w-full min-w-0 flex-col p-2`,e),...t}));RO.displayName=`SidebarGroup`;var zO=j.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,M.jsx)(t?qx:`div`,{ref:r,"data-sidebar":`group-label`,className:X(`text-xs/6 font-medium text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 outline-none transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 [[data-collapsible=icon]_&]:-mt-8 [[data-collapsible=icon]_&]:opacity-0 [[data-collapsible=icon]_&]:overflow-hidden`,e),...n}));zO.displayName=`SidebarGroupLabel`;var BO=j.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,M.jsx)(t?qx:`button`,{ref:r,"data-sidebar":`group-action`,className:X(`absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`group-data-[collapsible=icon]:hidden`,e),...n}));BO.displayName=`SidebarGroupAction`;var VO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`group-content`,className:X(`w-full text-sm`,e),...t}));VO.displayName=`SidebarGroupContent`;var HO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ul`,{ref:n,"data-sidebar":`menu`,className:X(`flex w-full min-w-0 flex-col gap-1`,e),...t}));HO.displayName=`SidebarMenu`;var UO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`li`,{ref:n,"data-sidebar":`menu-item`,className:X(`group/menu-item relative`,e),...t}));UO.displayName=`SidebarMenuItem`;var WO=j.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o},s)=>{let c=e?qx:`button`,{isMobile:l,state:u}=DO(),d=(0,M.jsx)(c,{ref:s,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:X(GO({variant:n,size:r}),a),...o});return i?(typeof i==`string`&&(i={children:i}),(0,M.jsxs)(_O,{children:[(0,M.jsx)(vO,{asChild:!0,children:d}),(0,M.jsx)(yO,{side:`right`,align:`center`,hidden:u!==`collapsed`||l,...i})]})):d});WO.displayName=`SidebarMenuButton`;var GO=iy(`peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:!p-0`}},defaultVariants:{variant:`default`,size:`default`}}),KO=j.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>(0,M.jsx)(t?qx:`button`,{ref:i,"data-sidebar":`menu-action`,className:X(`absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,n&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0`,e),...r}));KO.displayName=`SidebarMenuAction`;var qO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`menu-badge`,className:X(`text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none`,`peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));qO.displayName=`SidebarMenuBadge`;var JO=j.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{let i=j.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return(0,M.jsxs)(`div`,{ref:r,"data-sidebar":`menu-skeleton`,className:X(`rounded-md h-8 flex gap-2 px-2 items-center`,e),...n,children:[t&&(0,M.jsx)(qw,{className:`size-4 rounded-md`,"data-sidebar":`menu-skeleton-icon`}),(0,M.jsx)(qw,{className:`h-4 flex-1 max-w-[var(--skeleton-width)]`,"data-sidebar":`menu-skeleton-text`,style:{"--skeleton-width":i}})]})});JO.displayName=`SidebarMenuSkeleton`;var YO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ul`,{ref:n,"data-sidebar":`menu-sub`,className:X(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));YO.displayName=`SidebarMenuSub`;var XO=j.forwardRef(({...e},t)=>(0,M.jsx)(`li`,{ref:t,...e}));XO.displayName=`SidebarMenuSubItem`;var ZO=j.forwardRef(({asChild:e=!1,size:t=`md`,isActive:n,className:r,...i},a)=>(0,M.jsx)(e?qx:`a`,{ref:a,"data-sidebar":`menu-sub-button`,"data-size":t,"data-active":n,className:X(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,`data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground`,t===`sm`&&`text-xs`,t===`md`&&`text-sm`,r),...i}));ZO.displayName=`SidebarMenuSubButton`;var QO=iy(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`),$O=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`nav`,{ref:n,"aria-label":`breadcrumb`,className:X(QO(),e),...t}));$O.displayName=`Breadcrumb`;var ek=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ol`,{ref:n,className:X(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`,e),...t}));ek.displayName=`BreadcrumbList`;var tk=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`li`,{ref:n,className:X(`inline-flex items-center gap-1.5`,e),...t}));tk.displayName=`BreadcrumbItem`;var nk=j.forwardRef(({asChild:e,className:t,...n},r)=>(0,M.jsx)(e?qx:`a`,{ref:r,className:X(`hover:text-foreground transition-colors`,t),...n}));nk.displayName=`BreadcrumbLink`;var rk=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`span`,{ref:n,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:X(`text-foreground font-normal`,e),...t}));rk.displayName=`BreadcrumbPage`;var ik=({children:e,className:t,...n})=>(0,M.jsx)(`li`,{role:`presentation`,"aria-hidden":`true`,className:X(`[&>svg]:size-3.5`,t),...n,children:e??(0,M.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:(0,M.jsx)(`path`,{d:`m9 18 6-6-6-6`})})});ik.displayName=`BreadcrumbSeparator`;var ak=({className:e,...t})=>(0,M.jsxs)(`span`,{role:`presentation`,"aria-hidden":`true`,className:X(`flex h-9 w-9 items-center justify-center`,e),...t,children:[(0,M.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`}),(0,M.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1`}),(0,M.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1`})]}),(0,M.jsx)(`span`,{className:`sr-only`,children:`More`})]});ak.displayName=`BreadcrumbElipssis`;var ok=j.createContext(void 0);function sk(e){let t=j.useContext(ok);return e||t||`ltr`}var ck=`rovingFocusGroup.onEntryFocus`,lk={bubbles:!1,cancelable:!0},uk=`RovingFocusGroup`,[dk,fk,pk]=C_(uk),[mk,hk]=m_(uk,[pk]),[gk,_k]=mk(uk),vk=j.forwardRef((e,t)=>(0,M.jsx)(dk.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(dk.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(yk,{...e,ref:t})})}));vk.displayName=uk;var yk=j.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=j.useRef(null),p=f_(t,f),m=sk(a),[h,g]=Q_({prop:o,defaultProp:s??null,onChange:c,caller:uk}),[_,v]=j.useState(!1),y=E_(l),b=fk(n),x=j.useRef(!1),[S,C]=j.useState(0);return j.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(ck,y),()=>e.removeEventListener(ck,y)},[y]),(0,M.jsx)(gk,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:j.useCallback(e=>g(e),[g]),onItemShiftTab:j.useCallback(()=>v(!0),[]),onFocusableItemAdd:j.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:j.useCallback(()=>C(e=>e-1),[]),children:(0,M.jsx)(w_.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:q(e.onMouseDown,()=>{x.current=!0}),onFocus:q(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(ck,lk);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Tk([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:q(e.onBlur,()=>v(!1))})})}),bk=`RovingFocusGroupItem`,xk=j.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=pS(),l=a||c,u=_k(bk,n),d=u.currentTabStopId===l,f=fk(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return j.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,M.jsx)(dk.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,M.jsx)(w_.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:q(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:q(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:q(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=wk(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Ek(n,r+1):n.slice(r+1)}setTimeout(()=>Tk(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});xk.displayName=bk;var Sk={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Ck(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function wk(e,t,n){let r=Ck(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Sk[r]}function Tk(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Ek(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Dk=vk,Ok=xk,kk=[`Enter`,` `],Ak=[`ArrowDown`,`PageUp`,`Home`],jk=[`ArrowUp`,`PageDown`,`End`],Mk=[...Ak,...jk],Nk={ltr:[...kk,`ArrowRight`],rtl:[...kk,`ArrowLeft`]},Pk={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Fk=`Menu`,[Ik,Lk,Rk]=C_(Fk),[zk,Bk]=m_(Fk,[Rk,fD,hk]),Vk=fD(),Hk=hk(),[Uk,Wk]=zk(Fk),[Gk,Kk]=zk(Fk),qk=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Vk(t),[c,l]=j.useState(null),u=j.useRef(!1),d=E_(a),f=sk(i);return j.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,M.jsx)(OD,{...s,children:(0,M.jsx)(Uk,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,M.jsx)(Gk,{scope:t,onClose:j.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};qk.displayName=Fk;var Jk=`MenuAnchor`,Yk=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Vk(n);return(0,M.jsx)(kD,{...i,...r,ref:t})});Yk.displayName=Jk;var Xk=`MenuPortal`,[Zk,Qk]=zk(Xk,{forceMount:void 0}),$k=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Wk(Xk,t);return(0,M.jsx)(Zk,{scope:t,forceMount:n,children:(0,M.jsx)(q_,{present:n||a.open,children:(0,M.jsx)(G_,{asChild:!0,container:i,children:r})})})};$k.displayName=Xk;var eA=`MenuContent`,[tA,nA]=zk(eA),rA=j.forwardRef((e,t)=>{let n=Qk(eA,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Wk(eA,e.__scopeMenu),o=Kk(eA,e.__scopeMenu);return(0,M.jsx)(Ik.Provider,{scope:e.__scopeMenu,children:(0,M.jsx)(q_,{present:r||a.open,children:(0,M.jsx)(Ik.Slot,{scope:e.__scopeMenu,children:o.modal?(0,M.jsx)(iA,{...i,ref:t}):(0,M.jsx)(aA,{...i,ref:t})})})})}),iA=j.forwardRef((e,t)=>{let n=Wk(eA,e.__scopeMenu),r=j.useRef(null),i=f_(t,r);return j.useEffect(()=>{let e=r.current;if(e)return XC(e)},[]),(0,M.jsx)(sA,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:q(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),aA=j.forwardRef((e,t)=>{let n=Wk(eA,e.__scopeMenu);return(0,M.jsx)(sA,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),oA=g_(`MenuContent.ScrollLock`),sA=j.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Wk(eA,n),_=Kk(eA,n),v=Vk(n),y=Hk(n),b=Lk(n),[x,S]=j.useState(null),C=j.useRef(null),w=f_(t,C,g.onContentChange),T=j.useRef(0),E=j.useRef(``),D=j.useRef(0),O=j.useRef(null),ee=j.useRef(`right`),te=j.useRef(0),ne=m?VC:j.Fragment,re=m?{as:oA,allowPinchZoom:!0}:void 0,ie=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=GA(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};j.useEffect(()=>()=>window.clearTimeout(T.current),[]),jS();let ae=j.useCallback(e=>ee.current===O.current?.side&&qA(e,O.current?.area),[]);return(0,M.jsx)(tA,{scope:n,searchRef:E,onItemEnter:j.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),onItemLeave:j.useCallback(e=>{ae(e)||(C.current?.focus(),S(null))},[ae]),onTriggerLeave:j.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),pointerGraceTimerRef:D,onPointerGraceIntentChange:j.useCallback(e=>{O.current=e},[]),children:(0,M.jsx)(ne,{...re,children:(0,M.jsx)(vS,{asChild:!0,trapped:i,onMountAutoFocus:q(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,M.jsx)(P_,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,M.jsx)(Dk,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:q(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,M.jsx)(AD,{role:`menu`,"aria-orientation":`vertical`,"data-state":BA(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:q(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ie(e.key));let i=C.current;if(e.target!==i||!Mk.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);jk.includes(e.key)&&a.reverse(),UA(a)}),onBlur:q(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:q(e.onPointerMove,JA(e=>{let t=e.target,n=te.current!==e.clientX;e.currentTarget.contains(t)&&n&&(ee.current=e.clientX>te.current?`right`:`left`,te.current=e.clientX)}))})})})})})})});rA.displayName=eA;var cA=`MenuGroup`,lA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(w_.div,{role:`group`,...r,ref:t})});lA.displayName=cA;var uA=`MenuLabel`,dA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(w_.div,{...r,ref:t})});dA.displayName=uA;var fA=`MenuItem`,pA=`menu.itemSelect`,mA=j.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=j.useRef(null),o=Kk(fA,e.__scopeMenu),s=nA(fA,e.__scopeMenu),c=f_(t,a),l=j.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(pA,{bubbles:!0,cancelable:!0});e.addEventListener(pA,e=>r?.(e),{once:!0}),T_(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,M.jsx)(hA,{...i,ref:c,disabled:n,onClick:q(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:q(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:q(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||kk.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});mA.displayName=fA;var hA=j.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=nA(fA,n),s=Hk(n),c=j.useRef(null),l=f_(t,c),[u,d]=j.useState(!1),[f,p]=j.useState(``);return j.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,M.jsx)(Ik.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,M.jsx)(Ok,{asChild:!0,...s,focusable:!r,children:(0,M.jsx)(w_.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:q(e.onPointerMove,JA(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:q(e.onPointerLeave,JA(e=>o.onItemLeave(e))),onFocus:q(e.onFocus,()=>d(!0)),onBlur:q(e.onBlur,()=>d(!1))})})})}),gA=`MenuCheckboxItem`,_A=j.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,M.jsx)(TA,{scope:e.__scopeMenu,checked:n,children:(0,M.jsx)(mA,{role:`menuitemcheckbox`,"aria-checked":VA(n)?`mixed`:n,...i,ref:t,"data-state":HA(n),onSelect:q(i.onSelect,()=>r?.(VA(n)?!0:!n),{checkForDefaultPrevented:!1})})})});_A.displayName=gA;var vA=`MenuRadioGroup`,[yA,bA]=zk(vA,{value:void 0,onValueChange:()=>{}}),xA=j.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=E_(r);return(0,M.jsx)(yA,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,M.jsx)(lA,{...i,ref:t})})});xA.displayName=vA;var SA=`MenuRadioItem`,CA=j.forwardRef((e,t)=>{let{value:n,...r}=e,i=bA(SA,e.__scopeMenu),a=n===i.value;return(0,M.jsx)(TA,{scope:e.__scopeMenu,checked:a,children:(0,M.jsx)(mA,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":HA(a),onSelect:q(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});CA.displayName=SA;var wA=`MenuItemIndicator`,[TA,EA]=zk(wA,{checked:!1}),DA=j.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=EA(wA,n);return(0,M.jsx)(q_,{present:r||VA(a.checked)||a.checked===!0,children:(0,M.jsx)(w_.span,{...i,ref:t,"data-state":HA(a.checked)})})});DA.displayName=wA;var OA=`MenuSeparator`,kA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(w_.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});kA.displayName=OA;var AA=`MenuArrow`,jA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Vk(n);return(0,M.jsx)(jD,{...i,...r,ref:t})});jA.displayName=AA;var MA=`MenuSub`,[NA,PA]=zk(MA),FA=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Wk(MA,t),o=Vk(t),[s,c]=j.useState(null),[l,u]=j.useState(null),d=E_(i);return j.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,M.jsx)(OD,{...o,children:(0,M.jsx)(Uk,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,M.jsx)(NA,{scope:t,contentId:pS(),triggerId:pS(),trigger:s,onTriggerChange:c,children:n})})})};FA.displayName=MA;var IA=`MenuSubTrigger`,LA=j.forwardRef((e,t)=>{let n=Wk(IA,e.__scopeMenu),r=Kk(IA,e.__scopeMenu),i=PA(IA,e.__scopeMenu),a=nA(IA,e.__scopeMenu),o=j.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=j.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return j.useEffect(()=>u,[u]),j.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,M.jsx)(Yk,{asChild:!0,...l,children:(0,M.jsx)(hA,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":BA(n.open),...e,ref:d_(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:q(e.onPointerMove,JA(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:q(e.onPointerLeave,JA(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:q(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Nk[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});LA.displayName=IA;var RA=`MenuSubContent`,zA=j.forwardRef((e,t)=>{let n=Qk(eA,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Wk(eA,e.__scopeMenu),o=Kk(eA,e.__scopeMenu),s=PA(RA,e.__scopeMenu),c=j.useRef(null),l=f_(t,c);return(0,M.jsx)(Ik.Provider,{scope:e.__scopeMenu,children:(0,M.jsx)(q_,{present:r||a.open,children:(0,M.jsx)(Ik.Slot,{scope:e.__scopeMenu,children:(0,M.jsx)(sA,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:q(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:q(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:q(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Pk[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});zA.displayName=RA;function BA(e){return e?`open`:`closed`}function VA(e){return e===`indeterminate`}function HA(e){return VA(e)?`indeterminate`:e?`checked`:`unchecked`}function UA(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function WA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function GA(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=WA(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function KA(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function qA(e,t){return t?KA({x:e.clientX,y:e.clientY},t):!1}function JA(e){return t=>t.pointerType===`mouse`?e(t):void 0}var YA=qk,XA=Yk,ZA=$k,QA=rA,$A=lA,ej=dA,tj=mA,nj=_A,rj=xA,ij=CA,aj=DA,oj=kA,sj=jA,cj=LA,lj=zA,uj=`DropdownMenu`,[dj,fj]=m_(uj,[Bk]),pj=Bk(),[mj,hj]=dj(uj),gj=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=pj(t),l=j.useRef(null),[u,d]=Q_({prop:i,defaultProp:a??!1,onChange:o,caller:uj});return(0,M.jsx)(mj,{scope:t,triggerId:pS(),triggerRef:l,contentId:pS(),open:u,onOpenChange:d,onOpenToggle:j.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,M.jsx)(YA,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};gj.displayName=uj;var _j=`DropdownMenuTrigger`,vj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=hj(_j,n),o=pj(n);return(0,M.jsx)(XA,{asChild:!0,...o,children:(0,M.jsx)(w_.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:d_(t,a.triggerRef),onPointerDown:q(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:q(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});vj.displayName=_j;var yj=`DropdownMenuPortal`,bj=e=>{let{__scopeDropdownMenu:t,...n}=e,r=pj(t);return(0,M.jsx)(ZA,{...r,...n})};bj.displayName=yj;var xj=`DropdownMenuContent`,Sj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hj(xj,n),a=pj(n),o=j.useRef(!1);return(0,M.jsx)(QA,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:q(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Sj.displayName=xj;var Cj=`DropdownMenuGroup`,wj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)($A,{...i,...r,ref:t})});wj.displayName=Cj;var Tj=`DropdownMenuLabel`,Ej=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(ej,{...i,...r,ref:t})});Ej.displayName=Tj;var Dj=`DropdownMenuItem`,Oj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(tj,{...i,...r,ref:t})});Oj.displayName=Dj;var kj=`DropdownMenuCheckboxItem`,Aj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(nj,{...i,...r,ref:t})});Aj.displayName=kj;var jj=`DropdownMenuRadioGroup`,Mj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(rj,{...i,...r,ref:t})});Mj.displayName=jj;var Nj=`DropdownMenuRadioItem`,Pj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(ij,{...i,...r,ref:t})});Pj.displayName=Nj;var Fj=`DropdownMenuItemIndicator`,Ij=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(aj,{...i,...r,ref:t})});Ij.displayName=Fj;var Lj=`DropdownMenuSeparator`,Rj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(oj,{...i,...r,ref:t})});Rj.displayName=Lj;var zj=`DropdownMenuArrow`,Bj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(sj,{...i,...r,ref:t})});Bj.displayName=zj;var Vj=`DropdownMenuSubTrigger`,Hj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(cj,{...i,...r,ref:t})});Hj.displayName=Vj;var Uj=`DropdownMenuSubContent`,Wj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(lj,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Wj.displayName=Uj;var Gj=gj,Kj=vj,qj=bj,Jj=Sj,Yj=Ej,Xj=Oj,Zj=Aj,Qj=Pj,$j=Ij,eM=Rj,tM=Hj,nM=Wj,rM=Gj,iM=Kj,aM=j.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,M.jsxs)(tM,{ref:i,className:X(`flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...r,children:[n,(0,M.jsx)(yy,{className:`ml-auto`})]}));aM.displayName=tM.displayName;var oM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(nM,{ref:n,className:X(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));oM.displayName=nM.displayName;var sM=j.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,M.jsx)(qj,{children:(0,M.jsx)(Jj,{ref:r,sideOffset:t,className:X(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));sM.displayName=Jj.displayName;var cM=j.forwardRef(({className:e,inset:t,...n},r)=>(0,M.jsx)(Xj,{ref:r,className:X(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...n}));cM.displayName=Xj.displayName;var lM=j.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,M.jsxs)(Zj,{ref:i,className:X(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,M.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)($j,{children:(0,M.jsx)(_y,{className:`h-4 w-4`})})}),t]}));lM.displayName=Zj.displayName;var uM=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(Qj,{ref:r,className:X(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,M.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)($j,{children:(0,M.jsx)(Ty,{className:`h-2 w-2 fill-current`})})}),t]}));uM.displayName=Qj.displayName;var dM=j.forwardRef(({className:e,inset:t,...n},r)=>(0,M.jsx)(Yj,{ref:r,className:X(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));dM.displayName=Yj.displayName;var fM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(eM,{ref:n,className:X(`-mx-1 my-1 h-px bg-muted`,e),...t}));fM.displayName=eM.displayName;var pM=({className:e,...t})=>(0,M.jsx)(`span`,{className:X(`ml-auto text-xs tracking-widest opacity-60`,e),...t});pM.displayName=`DropdownMenuShortcut`;var mM=`modulepreload`,hM=function(e){return`/_account/`+e},gM={},_M=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=hM(t,n),t in gM)return;gM[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:mM,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},vM=[`en`,`zh-CN`],yM={en:()=>_M(()=>import(`./en-QM3gmMOi.js`),[]),"zh-CN":()=>_M(()=>import(`./zh-CN-B0Jn4kQl.js`),[])};function bM(e){return vM.includes(e)?e:e.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`}async function xM(e){let t=bM(e);try{return(await yM[t]()).default}catch(t){return console.warn(`[account/i18n] Failed to load language pack '${e}':`,t),{}}}var SM={en:`English`,"zh-CN":`中文`};function CM(){let{t:e,language:t,changeLanguage:n}=vt();async function r(e){await n(e);try{localStorage.setItem(`account.lang`,e)}catch{}}return(0,M.jsxs)(rM,{children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsxs)(Z,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":e(`common.language`),children:[(0,M.jsx)(Py,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:e(`common.language`)})]})}),(0,M.jsx)(sM,{align:`end`,children:vM.map(e=>(0,M.jsx)(cM,{onSelect:()=>void r(e),className:e===t?`font-medium`:void 0,children:SM[e]},e))})]})}function wM(e){let t=document.documentElement;e===`dark`?t.classList.add(`dark`):t.classList.remove(`dark`)}function TM(){let{t:e}=vt(),[,t]=(0,j.useState)(`light`);(0,j.useEffect)(()=>{let e=localStorage.getItem(`theme`);e?(t(e),wM(e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e)):(t(`system`),wM(window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`))},[]);function n(e){t(e),localStorage.setItem(`theme`,e),wM(e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e)}return(0,M.jsxs)(rM,{children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsxs)(Z,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:[(0,M.jsx)(Xy,{className:`h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,M.jsx)(Vy,{className:`absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`}),(0,M.jsx)(`span`,{className:`sr-only`,children:e(`common.toggleTheme`)})]})}),(0,M.jsxs)(sM,{align:`end`,children:[(0,M.jsxs)(cM,{onClick:()=>n(`light`),children:[(0,M.jsx)(Xy,{className:`mr-2 h-4 w-4`}),e(`common.light`)]}),(0,M.jsxs)(cM,{onClick:()=>n(`dark`),children:[(0,M.jsx)(Vy,{className:`mr-2 h-4 w-4`}),e(`common.dark`)]}),(0,M.jsx)(cM,{onClick:()=>n(`system`),children:e(`common.system`)})]})]})}function EM(e,t=[]){let n=[];function r(t,r){let i=j.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=j.useMemo(()=>o,Object.values(o));return(0,M.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=j.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>j.createContext(e));return function(n){let r=n?.[e]||t;return j.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,DM(i,...t)]}function DM(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function OM(){return(0,ot.useSyncExternalStore)(kM,()=>!0,()=>!1)}function kM(){return()=>{}}var AM=`Avatar`,[jM,MM]=EM(AM),[NM,PM]=jM(AM),FM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=j.useState(`idle`);return(0,M.jsx)(NM,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,M.jsx)(rS.span,{...r,ref:t})})});FM.displayName=AM;var IM=`AvatarImage`,LM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=PM(IM,n),s=VM(r,a),c=E_(e=>{i(e),o.onImageLoadingStatusChange(e)});return U_(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,M.jsx)(rS.img,{...a,ref:t,src:r}):null});LM.displayName=IM;var RM=`AvatarFallback`,zM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=PM(RM,n),[o,s]=j.useState(r===void 0);return j.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,M.jsx)(rS.span,{...i,ref:t}):null});zM.displayName=RM;function BM(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function VM(e,{referrerPolicy:t,crossOrigin:n}){let r=OM(),i=j.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=j.useState(()=>BM(a,e));return U_(()=>{s(BM(a,e))},[a,e]),U_(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var HM=FM,UM=LM,WM=zM,GM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(HM,{ref:n,className:X(`relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,e),...t}));GM.displayName=HM.displayName;var KM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(UM,{ref:n,className:X(`aspect-square h-full w-full`,e),...t}));KM.displayName=UM.displayName;var qM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(WM,{ref:n,className:X(`flex h-full w-full items-center justify-center rounded-full bg-muted`,e),...t}));qM.displayName=WM.displayName;var JM=(0,j.createContext)(null),YM=`auth-session-token`,XM=`auth-active-organization-id`;function ZM(e){if(!(typeof window>`u`))try{e?.token?localStorage.setItem(YM,e.token):localStorage.removeItem(YM),e?.activeOrganizationId?localStorage.setItem(XM,e.activeOrganizationId):localStorage.removeItem(XM)}catch{}}function QM(e){if(!e)return{user:null,session:null};let t=e.data===void 0?e:e.data;return t?{user:t.user??null,session:t.session??null}:{user:null,session:null}}function $M({children:e}){let t=Qg(),[n,r]=(0,j.useState)(null),[i,a]=(0,j.useState)(null),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(null),[u,d]=(0,j.useState)([]),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(!1),[g,_]=(0,j.useState)(null);(0,j.useEffect)(()=>{if(!t?.auth?.getConfig)return;let e=!1;return t.auth.getConfig().then(t=>{if(e)return;let n=t?.data??t??{},r={...n.features??{}};n.emailPassword?.disableSignUp===!0&&(r.signUpDisabled=!0),_(r)}).catch(()=>{e||_(null)}),()=>{e=!0}},[t]);let v=(0,j.useCallback)(async()=>{if(t?.organizations){p(!0);try{d((await t.organizations.list())?.organizations??[])}catch{d([])}finally{p(!1),h(!0)}}},[t]),y=(0,j.useCallback)(async()=>{if(t?.auth){s(!0),l(null);try{let{user:e,session:n}=QM(await t.auth.me());r(e),a(n),ZM(e?n:null)}catch(e){l(e),r(null),a(null),ZM(null)}finally{s(!1)}}},[t]);(0,j.useEffect)(()=>{y()},[y]),(0,j.useEffect)(()=>{n?v():(d([]),h(!1))},[n,v]);let b=(0,j.useCallback)(async()=>{if(t?.auth)try{await t.auth.logout()}finally{r(null),a(null),d([]),h(!1),ZM(null)}},[t]),x=(0,j.useCallback)(async e=>{if(t?.organizations){await t.organizations.setActive(e),await y();try{localStorage.setItem(XM,e)}catch{}}},[t,y]),S=(0,j.useMemo)(()=>({user:n,session:i,loading:o,error:c,refresh:y,logout:b,setActiveOrganization:x,organizations:u,organizationsLoading:f,organizationsFetched:m,reloadOrganizations:v,features:g}),[n,i,o,c,y,b,x,u,f,m,v,g]);return(0,j.createElement)(JM.Provider,{value:S},e)}function eN(){let e=(0,j.useContext)(JM);if(!e)throw Error(`useSession must be used inside <SessionProvider>.`);return e}function tN(){let{organizations:e,organizationsLoading:t,reloadOrganizations:n}=eN();return{organizations:e,loading:t,error:null,reload:n}}function nN(){let e=Qg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{create:(0,j.useCallback)(async t=>{if(!e?.organizations)throw Error(`Client not ready`);n(!0),i(null);try{return await e.organizations.create(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),creating:t,error:r}}function rN(){let e=Qg(),{reloadOrganizations:t,refresh:n}=eN(),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null);return{update:(0,j.useCallback)(async(r,a)=>{if(!e?.organizations?.update)throw Error(`Client not ready`);i(!0),o(null);try{let i=await e.organizations.update(r,a);return await t(),await n(),i}catch(e){throw o(e),e}finally{i(!1)}},[e,t,n]),updating:r,error:a}}function iN(){let e=Qg(),{reloadOrganizations:t,refresh:n}=eN(),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null);return{remove:(0,j.useCallback)(async r=>{if(!e?.organizations?.delete)throw Error(`Client not ready`);i(!0),o(null);try{let i=await e.organizations.delete(r);return await t(),await n(),i}catch(e){throw o(e),e}finally{i(!1)}},[e,t,n]),deleting:r,error:a}}function aN({message:e}){return typeof document>`u`?null:(0,Gi.createPortal)((0,M.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm`,children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-8 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:e})]})}),document.body)}function oN(e,t){let n=(e||t||`?`).trim(),r=n.split(/\s+/);return r.length>=2?(r[0][0]+r[1][0]).toUpperCase():n.slice(0,2).toUpperCase()}function sN(){let{t:e}=vt(),t=Hi(),{user:n,loading:r,logout:i}=eN(),[a,o]=(0,j.useState)(!1);return r&&!n?(0,M.jsx)(`div`,{className:`h-8 w-8 animate-pulse rounded-full bg-muted`,"aria-hidden":!0}):n?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(rM,{children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsx)(Z,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,children:(0,M.jsxs)(GM,{className:`h-7 w-7`,children:[n.image?(0,M.jsx)(KM,{src:n.image,alt:n.name??n.email??e(`userMenu.user`)}):null,(0,M.jsx)(qM,{className:`text-[11px]`,children:oN(n.name,n.email)})]})})}),(0,M.jsxs)(sM,{align:`end`,className:`w-64`,children:[(0,M.jsx)(dM,{children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:n.name||n.email}),n.email&&(0,M.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:n.email})]})}),(0,M.jsx)(fM,{}),(0,M.jsxs)(cM,{onSelect:()=>t({to:`/account`}),children:[(0,M.jsx)(rb,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.account`)]}),(0,M.jsxs)(cM,{onSelect:()=>t({to:`/organizations`}),children:[(0,M.jsx)(gy,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.organizations`)]}),(0,M.jsx)(fM,{}),(0,M.jsxs)(cM,{onSelect:async()=>{o(!0);try{await i()}finally{window.location.assign(`/_account/login`)}},disabled:a,children:[(0,M.jsx)(Ly,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.signOut`)]})]})]}),a?(0,M.jsx)(aN,{message:e(`auth.userMenu.signingOut`,{defaultValue:`Signing you out…`})}):null]}):(0,M.jsx)(Z,{variant:`outline`,size:`sm`,className:`h-8`,onClick:()=>t({to:`/login`}),children:e(`userMenu.signIn`)})}function cN(){let{t:e}=vt(),t=Hi(),n=Oa(),{organizations:r,loading:i,reload:a}=tN(),{session:o,setActiveOrganization:s}=eN(),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(!1),f=o?.activeOrganizationId??void 0,p=(0,j.useMemo)(()=>r.find(e=>e.id===f)??null,[r,f]),m=async r=>{if(l(!1),r===f){t({to:`/organizations/$orgId/general`,params:{orgId:r}});return}d(!0);try{await s(r),await a(),K({title:e(`organizations.general.switched`)});let i=n.pathname.match(/^\/organizations\/[^/]+\/(general|members)\/?$/);t({to:(i?i[1]:`general`)===`members`?`/organizations/$orgId/members`:`/organizations/$orgId/general`,params:{orgId:r}})}catch(t){K({title:e(`organizations.switchFailed`),description:t.message,variant:`destructive`})}finally{d(!1)}};return(0,M.jsxs)(rM,{open:c,onOpenChange:l,children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsxs)(Z,{variant:`ghost`,size:`sm`,className:`h-8 gap-2 px-2 text-sm font-medium`,disabled:u,children:[p?(0,M.jsx)(`span`,{className:`max-w-[160px] truncate`,children:p.name}):(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(i?`organizations.loading`:`organizationSwitcher.select`)}),(0,M.jsx)(xy,{className:`h-3 w-3 opacity-50`})]})}),(0,M.jsxs)(sM,{align:`start`,className:`w-[280px]`,sideOffset:4,children:[(0,M.jsx)(dM,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:e(`organizations.title`)}),r.length===0&&!i&&(0,M.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:e(`organizations.emptyTitle`)}),r.map(e=>(0,M.jsxs)(cM,{onSelect:t=>{t.preventDefault(),m(e.id)},className:`flex items-center gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,M.jsx)(`div`,{className:`truncate font-medium`,children:e.name}),e.slug&&(0,M.jsx)(`code`,{className:`text-[11px] text-muted-foreground font-mono`,children:e.slug})]}),e.id===f&&(0,M.jsx)(_y,{className:`h-3.5 w-3.5 text-primary`})]},e.id)),(0,M.jsx)(fM,{}),(0,M.jsxs)(cM,{onSelect:e=>{e.preventDefault(),l(!1),t({to:`/organizations/new`})},className:`gap-2 text-sm`,children:[(0,M.jsx)(Uy,{className:`h-3.5 w-3.5`}),e(`organizationSwitcher.new`)]}),(0,M.jsx)(cM,{onSelect:e=>{e.preventDefault(),l(!1),t({to:`/organizations`})},className:`gap-2 text-sm text-muted-foreground`,children:e(`organizationSwitcher.manage`)})]})]})}function lN({label:e}){return(0,M.jsx)(`a`,{href:`/`,className:`flex h-8 w-8 items-center justify-center rounded-md bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15 transition-transform hover:scale-105`,"aria-label":e,children:(0,M.jsx)(Cy,{className:`h-4 w-4`})})}function uN(){return(0,M.jsx)(yy,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground/50`})}function dN(){let{t:e}=vt(),t=Oa(),n=Bi({strict:!1}),r=(0,j.useMemo)(()=>{let r=t.pathname,i=t=>e(`topBar.breadcrumb.${t}`);if(r.startsWith(`/account`)){let e=[{label:i(`account`)}];return r===`/account/profile`?e.push({label:i(`profile`)}):r===`/account/security`?e.push({label:i(`security`)}):r===`/account/sessions`?e.push({label:i(`sessions`)}):r===`/account/two-factor`?e.push({label:i(`twoFactor`)}):r===`/account/oauth-applications`?e.push({label:i(`oauthApps`)}):r===`/account/oauth-applications/new`?e.push({label:i(`oauthApps`)},{label:i(`new`)}):r.startsWith(`/account/oauth-applications/`)&&e.push({label:i(`oauthApps`)}),e}if(r===`/organizations/new`)return[{label:i(`organizations`)},{label:i(`new`)}];if(n.orgId){let e=r.endsWith(`/general`)?i(`general`):r.endsWith(`/members`)?i(`members`):i(`settings`);return[{label:i(`organizations`)},{label:e}]}return r===`/organizations`||r.startsWith(`/organizations/`)?[{label:i(`organizations`)}]:r.startsWith(`/accept-invitation/`)?[{label:i(`acceptInvitation`)}]:r.startsWith(`/auth/device`)?[{label:i(`deviceAuthorization`)}]:[{label:i(`account`)}]},[t.pathname,n.orgId,e]);return(0,M.jsxs)(`header`,{className:`sticky top-0 z-30 flex h-14 shrink-0 items-center justify-between gap-2 border-b bg-background/80 px-2 backdrop-blur supports-[backdrop-filter]:bg-background/70 sm:px-4`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 sm:gap-2.5`,children:[(0,M.jsx)(`div`,{className:`sm:hidden`,children:(0,M.jsx)(AO,{className:`h-9 w-9`})}),(0,M.jsx)(lN,{label:e(`topBar.accountHome`)}),(0,M.jsx)(`span`,{className:`hidden text-sm font-semibold tracking-tight sm:inline`,children:e(`topBar.brand`)}),(0,M.jsxs)(`div`,{className:`hidden items-center gap-1.5 sm:flex`,children:[(0,M.jsx)(uS,{orientation:`vertical`,className:`mx-1 h-4`}),(0,M.jsx)(cN,{}),(0,M.jsx)(uN,{}),(0,M.jsx)($O,{children:(0,M.jsx)(ek,{children:r.map((e,t)=>(0,M.jsxs)(`div`,{className:`flex items-center`,children:[t>0&&(0,M.jsx)(ik,{}),(0,M.jsx)(tk,{children:(0,M.jsx)(rk,{className:`font-medium`,children:e.label})})]},t))})})]}),(0,M.jsx)(`div`,{className:`min-w-0 flex-1 sm:hidden`,children:r.length>0&&(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:r[r.length-1].label})})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1 sm:gap-2`,children:[(0,M.jsx)(`div`,{className:`hidden sm:block`,children:(0,M.jsx)(CM,{})}),(0,M.jsx)(`div`,{className:`hidden sm:block`,children:(0,M.jsx)(TM,{})}),(0,M.jsx)(sN,{})]})]})}var fN=[{to:`/account`,label:`home`,icon:jy,exact:!0},{to:`/account/profile`,label:`profile`,icon:rb},{to:`/account/security`,label:`security`,icon:Jy},{to:`/account/sessions`,label:`sessions`,icon:By},{to:`/account/two-factor`,label:`twoFactor`,icon:qy},{to:`/account/invitations`,label:`invitations`,icon:My},{to:`/account/linked-accounts`,label:`linkedAccounts`,icon:Iy}],pN=[`group/nav relative transition-all duration-150`,`before:absolute before:left-0 before:top-1/2 before:h-5 before:w-[3px] before:-translate-y-1/2 before:rounded-r-full before:bg-brand-gradient before:opacity-0 before:transition-opacity`,`data-[active=true]:before:opacity-100`,`data-[active=true]:bg-sidebar-accent/80 data-[active=true]:text-sidebar-accent-foreground`,`[&>svg]:transition-transform [&>svg]:duration-150 hover:[&>svg]:scale-110`,`data-[active=true]:[&>svg]:text-primary`].join(` `);function mN(){let{t:e}=vt(),{pathname:t}=Oa(),{organizations:n}=tN(),r=t,i=t.match(/^\/organizations\/([^/]+)(?:\/.*)?$/),a=i&&n.some(e=>e.id===i[1])?i[1]:null;return(0,M.jsxs)(kO,{collapsible:`icon`,className:`h-full`,children:[(0,M.jsxs)(LO,{children:[(0,M.jsxs)(RO,{children:[(0,M.jsx)(zO,{children:e(`sidebar.groups.account`)}),(0,M.jsx)(VO,{children:(0,M.jsx)(HO,{children:fN.map(t=>{let n=t.icon;return(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t.exact?r===t.to||r===`${t.to}/`:r===t.to||r.startsWith(`${t.to}/`),tooltip:e(`sidebar.items.${t.label}`),className:pN,children:(0,M.jsxs)(ra,{to:t.to,children:[(0,M.jsx)(n,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.${t.label}`)})]})})},t.to)})})})]}),(0,M.jsx)(IO,{}),(0,M.jsxs)(RO,{children:[(0,M.jsx)(zO,{children:e(`sidebar.groups.organization`)}),(0,M.jsx)(VO,{children:(0,M.jsxs)(HO,{children:[(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t===`/organizations`,tooltip:e(`sidebar.items.overview`),className:pN,children:(0,M.jsxs)(ra,{to:`/organizations`,children:[(0,M.jsx)(gy,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.overview`)})]})})}),a&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t===`/organizations/${a}/general`,tooltip:e(`sidebar.items.general`),className:pN,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/general`,params:{orgId:a},children:[(0,M.jsx)(Ky,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.general`)})]})})}),(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t===`/organizations/${a}/members`,tooltip:e(`sidebar.items.members`),className:pN,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/members`,params:{orgId:a},children:[(0,M.jsx)(ab,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.members`)})]})})}),(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t===`/organizations/${a}/teams`,tooltip:e(`sidebar.items.teams`),className:pN,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/teams`,params:{orgId:a},children:[(0,M.jsx)(ib,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.teams`)})]})})})]})]})})]}),(0,M.jsx)(IO,{}),(0,M.jsxs)(RO,{children:[(0,M.jsx)(zO,{children:e(`sidebar.groups.developer`)}),(0,M.jsx)(VO,{children:(0,M.jsx)(HO,{children:(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t.startsWith(`/account/oauth-applications`),tooltip:e(`sidebar.items.oauthApps`),className:pN,children:(0,M.jsxs)(ra,{to:`/account/oauth-applications`,children:[(0,M.jsx)(Ny,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.oauthApps`)})]})})})})})]})]}),(0,M.jsx)(FO,{children:(0,M.jsx)(HO,{children:(0,M.jsx)(UO,{children:(0,M.jsx)(hN,{})})})})]})}function hN(){let{t:e}=vt(),{state:t,toggleSidebar:n}=DO(),r=e(t===`collapsed`?`sidebar.expand`:`sidebar.collapse`);return(0,M.jsx)(WO,{onClick:n,tooltip:r,"aria-label":r,children:(0,M.jsx)(Hy,{className:`size-4`})})}function gN(){return typeof window<`u`&&window.location.pathname.startsWith(`/_account`)?window.location.origin:`http://localhost:3000`}var _N=new Set([`/login`,`/register`,`/forgot-password`,`/reset-password`,`/verify-email`,`/verify-email-prompt`,`/auth/device`,`/setup`]);function vN(e){return _N.has(e)||e.startsWith(`/accept-invitation/`)}function yN(){let[e,t]=(0,j.useState)(null);return(0,j.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await fetch(`/api/v1/auth/bootstrap-status`);if(!n.ok){e||t(!0);return}let r=await n.json();e||t(r.hasOwner!==!1)}catch{e||t(!0)}})(),()=>{e=!0}},[]),e}function bN({children:e}){let{user:t,loading:n}=eN(),r=Hi(),i=Oa(),a=vN(i.pathname),o=i.pathname.startsWith(`/oauth/`)||i.pathname===`/organizations/new`,s=yN(),c=i.pathname===`/setup`;return(0,j.useEffect)(()=>{s===!1&&!c&&!t&&r({to:`/setup`,replace:!0})},[s,c,t,r]),(0,j.useEffect)(()=>{n||s!==!1&&!t&&!a&&r({to:`/login`,search:{redirect:i.pathname+i.searchStr},replace:!0})},[t,n,a,r,i.pathname,i.searchStr,s]),s===null||n&&!t?(0,M.jsx)(`div`,{className:`flex min-h-screen w-full flex-1 items-center justify-center bg-background`,children:(0,M.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-4 border-muted border-t-primary`})}):s===!1&&!c||!t&&!a?null:a||o?(0,M.jsx)(`div`,{className:`flex min-h-screen w-full`,children:e}):(0,M.jsxs)(OO,{className:`flex h-svh w-full flex-col`,children:[(0,M.jsx)(dN,{}),(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 w-full`,children:[(0,M.jsx)(mN,{}),(0,M.jsx)(MO,{className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-auto bg-background`,children:e})})]})]})}function xN(){let e=gN();return(0,M.jsx)(Zg,{client:(0,j.useMemo)(()=>new Jg({baseUrl:e}),[e]),children:(0,M.jsxs)($M,{children:[(0,M.jsx)(bN,{children:(0,M.jsx)(ya,{})}),(0,M.jsx)(Vx,{})]})})}var SN=ca({component:xN}),Q=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:X(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));Q.displayName=`Card`;var CN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:X(`flex flex-col space-y-1.5 p-6`,e),...t}));CN.displayName=`CardHeader`;var wN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`h3`,{ref:n,className:X(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));wN.displayName=`CardTitle`;var TN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`p`,{ref:n,className:X(`text-sm text-muted-foreground`,e),...t}));TN.displayName=`CardDescription`;var EN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:X(`p-6 pt-0`,e),...t}));EN.displayName=`CardContent`;var DN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:X(`flex items-center p-6 pt-0`,e),...t}));DN.displayName=`CardFooter`;function ON(e){let t=e.split(`:`)[0].toLowerCase();return/^cloud\./.test(t)}function kN(){return typeof window>`u`?null:window.location.host||null}function AN({children:e,formWidth:t=`sm`}){let{t:n}=vt(),r=t===`md`?`max-w-md`:`max-w-sm`,i=kN(),a=!!i&&!ON(i);return j.useEffect(()=>{if(typeof document>`u`||!i)return;let e=document.title;return a&&(document.title=i),()=>{document.title=e}},[i,a]),(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted p-6`,children:(0,M.jsxs)(`div`,{className:X(`flex w-full flex-col gap-4`,r),children:[a?(0,M.jsx)(`div`,{className:`flex justify-center`,children:(0,M.jsx)(`span`,{className:`rounded-full border border-border/60 bg-background/60 px-2 py-0.5 font-mono text-[10px] uppercase tracking-wide text-muted-foreground`,title:n(`auth.shell.tenantHostHint`,{defaultValue:`You are signing in to this workspace`}),children:i})}):null,e]})})}var jN=la(`/verify-email-prompt`)({validateSearch:e=>({email:typeof e.email==`string`?e.email:void 0,redirect:typeof e.redirect==`string`?e.redirect:void 0}),component:MN});function MN(){let{t:e}=vt(),t=Hi(),{email:n,redirect:r}=jN.useSearch(),i=Qg(),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(!1);return(0,M.jsx)(AN,{children:(0,M.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-4 flex size-16 items-center justify-center rounded-full bg-primary/10`,children:(0,M.jsx)(Ry,{className:`size-8 text-primary`})}),(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.title`,{defaultValue:`Verify your email address`})}),(0,M.jsx)(TN,{children:e(`auth.verifyEmail.description`,{defaultValue:`We sent a verification link to your email address. Please click the link to verify your account.`})})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[n?(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.verifyEmail.sentTo`,{defaultValue:`Sent to:`}),` `,(0,M.jsx)(`span`,{className:`font-medium text-foreground`,children:n})]}):null,(0,M.jsx)(Z,{onClick:async()=>{if(!n||!i?.auth){K({title:e(`auth.verifyEmail.resendFailed`,{defaultValue:`Cannot resend verification email`}),description:e(`auth.verifyEmail.emailMissing`,{defaultValue:`Email address is missing`}),variant:`destructive`});return}o(!0);try{let t=await fetch(`/api/v1/auth/send-verification-email`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:n,callbackURL:r||`/`})});if(!t.ok){let e=await t.json().catch(()=>({message:`Unknown error`}));throw Error(e.message||`Failed to send verification email`)}c(!0),K({title:e(`auth.verifyEmail.resentSuccess`,{defaultValue:`Verification email sent!`}),description:e(`auth.verifyEmail.resentDescription`,{defaultValue:`Please check your inbox and click the verification link.`})})}catch(t){K({title:e(`auth.verifyEmail.resendFailed`,{defaultValue:`Failed to resend verification email`}),description:t.message,variant:`destructive`})}finally{o(!1)}},disabled:a||s,className:`w-full`,variant:s?`outline`:`default`,children:a?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Wy,{className:`mr-2 size-4 animate-spin`}),e(`auth.verifyEmail.resending`,{defaultValue:`Sending...`})]}):s?e(`auth.verifyEmail.resent`,{defaultValue:`Email sent! Check your inbox`}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Wy,{className:`mr-2 size-4`}),e(`auth.verifyEmail.resendButton`,{defaultValue:`Resend verification email`})]})}),(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,M.jsx)(`span`,{className:`w-full border-t`})}),(0,M.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,M.jsx)(`span`,{className:`bg-card px-2 text-muted-foreground`,children:e(`auth.verifyEmail.or`,{defaultValue:`Or`})})})]}),(0,M.jsx)(Z,{onClick:()=>{t({to:`/login`,search:r?{redirect:r}:void 0})},variant:`ghost`,className:`w-full`,children:e(`auth.verifyEmail.backToLogin`,{defaultValue:`Back to login`})}),(0,M.jsx)(`p`,{className:`text-center text-xs text-muted-foreground`,children:e(`auth.verifyEmail.checkSpam`,{defaultValue:`Didn't receive the email? Check your spam folder or contact support.`})})]})})]})})})}var NN=la(`/verify-email`)({validateSearch:e=>{let t=e.token;return typeof t==`string`?{token:t}:{}},component:PN});function PN(){let{t:e}=vt(),{token:t}=NN.useSearch(),n=Qg(),[r,i]=(0,j.useState)(`loading`),[a,o]=(0,j.useState)(``);return(0,j.useEffect)(()=>{if(!t){i(`error`),o(e(`auth.verifyEmail.missingToken`));return}let r=!1;return(async()=>{try{await n.auth.verifyEmail({token:t}),r||i(`success`)}catch(t){r||(i(`error`),o(t.message||e(`auth.verifyEmail.errorDescription`)))}})(),()=>{r=!0}},[t,e,n]),(0,M.jsx)(AN,{children:(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[r===`loading`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.verifyingTitle`)}),(0,M.jsx)(TN,{children:e(`auth.verifyEmail.verifyingDescription`)})]}),(0,M.jsx)(EN,{className:`flex justify-center py-6`,children:(0,M.jsx)(`div`,{className:`h-10 w-10 animate-spin rounded-full border-4 border-muted border-t-primary`})})]}),r===`success`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-emerald-500/10 text-emerald-500 ring-1 ring-emerald-500/30`,children:(0,M.jsx)(Sy,{className:`size-6`})}),(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.successTitle`)}),(0,M.jsx)(TN,{children:e(`auth.verifyEmail.successDescription`)})]}),(0,M.jsx)(EN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.signInLink`)})})]}),r===`error`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-destructive/10 text-destructive ring-1 ring-destructive/30`,children:(0,M.jsx)(wy,{className:`size-6`})}),(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.errorTitle`)}),(0,M.jsx)(TN,{children:a||e(`auth.verifyEmail.errorDescription`)})]}),(0,M.jsx)(EN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.backToSignIn`)})})]})]})})}var FN=`Label`,IN=j.forwardRef((e,t)=>(0,M.jsx)(rS.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));IN.displayName=FN;var LN=IN,RN=iy(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),$=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(LN,{ref:n,className:X(RN(),e),...t}));$.displayName=LN.displayName;var zN=la(`/setup`)({component:VN});function BN(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function VN(){let{t:e}=vt(),t=Hi(),n=Qg(),{user:r,refresh:i}=eN(),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(``),[p,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(null);return(0,j.useEffect)(()=>{let e=!1;return(async()=>{try{let{hasOwner:t}=await n.auth.bootstrapStatus();e||g(t)}catch{e||g(!1)}})(),()=>{e=!0}},[n]),(0,j.useEffect)(()=>{h===!0&&!r&&t({to:`/login`,replace:!0})},[h,r,t]),(0,j.useEffect)(()=>{r&&window.location.assign(`/`)},[r]),h===null?(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted`,children:(0,M.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-4 border-muted-foreground/20 border-t-primary`})}):(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted p-6`,children:(0,M.jsx)(`div`,{className:`flex w-full max-w-md flex-col gap-6`,children:(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{children:e(`auth.setup.welcomeTitle`)}),(0,M.jsx)(TN,{children:e(`auth.setup.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),n?.auth){m(!0);try{await n.auth.register({name:a,email:s,password:l}),await i();let e=d.trim();if(e)try{let{organizations:t}=await n.organizations.list(),r=t?.[0],i;if(r?.id)await n.organizations.update(r.id,{name:e,slug:BN(e)}),i=r.id;else{let t=await n.organizations.create({name:e,slug:BN(e)});i=t?.id??t?.data?.id}i&&await n.organizations.setActive(i).catch(()=>{})}catch(e){console.warn(`[setup] organization rename/create failed`,e)}window.location.assign(`/`)}catch(t){K({title:e(`auth.setup.failed`),description:t.message,variant:`destructive`})}finally{m(!1)}}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`name`,children:e(`auth.setup.yourName`)}),(0,M.jsx)(nS,{id:`name`,autoComplete:`name`,required:!0,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`orgName`,children:e(`auth.setup.orgName`)}),(0,M.jsx)(nS,{id:`orgName`,required:!0,placeholder:e(`auth.setup.orgNamePlaceholder`),value:d,onChange:e=>f(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(nS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:s,onChange:e=>c(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(nS,{id:`password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,placeholder:e(`auth.setup.passwordHint`),value:l,onChange:e=>u(e.target.value)})]}),(0,M.jsx)(Z,{type:`submit`,className:`mt-2 w-full`,disabled:p,children:e(p?`auth.setup.submitting`:`auth.setup.submit`)})]})})]})})})}var HN=la(`/reset-password`)({validateSearch:e=>{let t=e.token;return typeof t==`string`?{token:t}:{}},component:UN});function UN(){let{t:e}=vt(),t=Hi(),{token:n}=HN.useSearch(),[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(!1);return(0,M.jsx)(AN,{children:(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.resetPassword.title`)}),(0,M.jsx)(TN,{children:e(`auth.resetPassword.description`)})]}),(0,M.jsx)(EN,{children:n?(0,M.jsxs)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r!==a){K({title:e(`auth.resetPassword.passwordsMismatch`),variant:`destructive`});return}if(!n){K({title:e(`auth.resetPassword.missingToken`),variant:`destructive`});return}c(!0);try{let i=await fetch(`/api/v1/auth/reset-password`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({token:n,newPassword:r})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e?.message||`Request failed: ${i.status}`)}K({title:e(`auth.resetPassword.success`)}),t({to:`/login`})}catch(t){K({title:e(`auth.resetPassword.failed`),description:t.message,variant:`destructive`})}finally{c(!1)}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`new-password`,children:e(`auth.resetPassword.newPassword`)}),(0,M.jsx)(nS,{id:`new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:r,onChange:e=>i(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`confirm-password`,children:e(`auth.resetPassword.confirmPassword`)}),(0,M.jsx)(nS,{id:`confirm-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsx)(Z,{type:`submit`,className:`w-full bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,disabled:s,children:e(s?`auth.resetPassword.submitting`:`auth.resetPassword.submit`)})]}):(0,M.jsxs)(`p`,{className:`text-sm text-muted-foreground text-center`,children:[e(`auth.resetPassword.invalidToken`),` `,(0,M.jsx)(ra,{to:`/forgot-password`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.resetPassword.requestNewLink`)})]})})]})})}function WN({mode:e,redirect:t}){let{t:n}=vt(),r=Qg(),[i,a]=(0,j.useState)([]),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(null);if((0,j.useEffect)(()=>{r?.auth?.getConfig&&r.auth.getConfig().then(e=>{a((e?.socialProviders??e?.data?.socialProviders??[]).filter(e=>e.enabled))}).catch(e=>{console.warn(`[SocialSignInButtons] failed to load auth config`,e)}).finally(()=>s(!1))},[r]),o||i.length===0)return null;let u=n(e===`sign-in`?`auth.social.continueWith`:`auth.social.signUpWith`),d=window.location.origin+`/_account/login`+(t?`?redirect=${encodeURIComponent(t)}`:``),f=e=>{c||(l(e),Promise.resolve(r.auth.signInWithProvider(e.id,{callbackURL:d,errorCallbackURL:d,type:e.type??`social`})).catch(e=>{console.warn(`[SocialSignInButtons] signInWithProvider failed`,e),l(null)}))};return(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.map(e=>{let t=c?.id===e.id;return(0,M.jsxs)(Z,{type:`button`,variant:`outline`,className:`w-full`,disabled:!!c,onClick:()=>f(e),children:[t?(0,M.jsx)(`span`,{className:`mr-2 inline-block size-4 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}):(0,M.jsx)(`span`,{className:`mr-2 flex h-4 w-4 items-center justify-center rounded-sm bg-muted text-[10px] font-bold uppercase`,children:e.id[0]}),t?n(`auth.social.redirectingTo`,{provider:e.name,defaultValue:`Redirecting to ${e.name}…`}):`${u} ${e.name}`]},e.id)}),(0,M.jsxs)(`div`,{className:`relative my-1`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,M.jsx)(`span`,{className:`w-full border-t`})}),(0,M.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,M.jsx)(`span`,{className:`bg-card px-2 text-muted-foreground`,children:n(`auth.social.orContinueEmail`)})})]}),c&&typeof document<`u`?(0,Gi.createPortal)((0,M.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm`,children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-8 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:n(`auth.social.redirectingTo`,{provider:c.name,defaultValue:`Redirecting to ${c.name}…`})})]})}),document.body):null]})}function GN(e,t){if(e.metaKey||e.ctrlKey||e.shiftKey||e.button===1)return;e.preventDefault();let n=Math.min(960,window.screen.availWidth-80),r=Math.min(720,window.screen.availHeight-80),i=Math.max(0,Math.round((window.screen.availWidth-n)/2)),a=Math.max(0,Math.round((window.screen.availHeight-r)/2)),o=[`popup=yes`,`width=${n}`,`height=${r}`,`left=${i}`,`top=${a}`,`resizable=yes`,`scrollbars=yes`,`noopener=yes`,`noreferrer=yes`].join(`,`);window.open(t,`objectstack-legal`,o)||window.open(t,`_blank`,`noopener,noreferrer`)}function KN({termsUrl:e,privacyUrl:t}){let{t:n}=vt(`account`),r=typeof e==`string`&&e.length>0,i=typeof t==`string`&&t.length>0;return!r&&!i?null:(0,M.jsxs)(`p`,{className:`px-6 text-center text-xs text-muted-foreground [&_a]:underline [&_a]:underline-offset-4 [&_a]:hover:text-primary`,children:[n(`legal.agreementPrefix`),` `,r?(0,M.jsx)(`a`,{href:e,target:`objectstack-legal`,rel:`noreferrer noopener`,onClick:t=>GN(t,e),children:n(`legal.termsOfService`)}):null,r&&i?(0,M.jsxs)(M.Fragment,{children:[` `,n(`legal.and`),` `]}):null,i?(0,M.jsx)(`a`,{href:t,target:`objectstack-legal`,rel:`noreferrer noopener`,onClick:e=>GN(e,t),children:n(`legal.privacyPolicy`)}):null,`.`]})}var qN=la(`/register`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:XN});function JN(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function YN(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function XN(){let{t:e}=vt(),t=Hi(),{redirect:n}=qN.useSearch(),r=Qg(),{session:i,user:a,loading:o,refresh:s,organizations:c,organizationsLoading:l,organizationsFetched:u,setActiveOrganization:d,features:f}=eN();(0,j.useEffect)(()=>{f?.signUpDisabled===!0&&t({to:`/login`,search:n?{redirect:n}:{},replace:!0})},[f?.signUpDisabled,t,n]);let[p,m]=(0,j.useState)(``),[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{if(a){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){window.location.assign(`/api/v1/auth/oauth2/authorize${window.location.search}`);return}}if(!i?.activeOrganizationId){if(!u||l||x)return;if(c.length===1){S(!0),d(c[0].id).catch(()=>void 0).finally(()=>S(!1));return}if(!f)return;if(c.length>1){t({to:`/organizations`});return}if(f.multiOrgEnabled===!1){JN(n)?window.location.assign(YN(n)):window.location.assign(`/`);return}t({to:`/organizations/new`,search:n?{redirect:n}:{}});return}if(!x){if(JN(n)){window.location.assign(YN(n));return}window.location.assign(`/`)}}},[a,i,t,n,c,l,u,x,d,f]),(0,M.jsx)(AN,{children:o||a?(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:a?e(`auth.register.signingIn`,{defaultValue:`Setting up your account…`}):e(`auth.login.redirecting`,{defaultValue:`Loading…`})})]}):(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.register.title`)}),(0,M.jsx)(TN,{children:e(`auth.register.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsx)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r?.auth){b(!0);try{let i=await r.auth.register({name:p,email:h,password:_}),a=i?.data??i;if(a&&a.token===null&&a.user){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}try{await s()}catch(e){let r=e.message;if(r.includes(`email`)&&(r.toLowerCase().includes(`verif`)||r.toLowerCase().includes(`not verified`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}throw e}K({title:e(`auth.register.successToast`)})}catch(r){let i=r.message;if(i.includes(`email`)&&(i.toLowerCase().includes(`verif`)||i.toLowerCase().includes(`sent`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}K({title:e(`auth.register.failed`),description:i,variant:`destructive`})}finally{b(!1)}}},children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(WN,{mode:`sign-up`,redirect:n}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`name`,children:e(`auth.nameLabel`)}),(0,M.jsx)(nS,{id:`name`,autoComplete:`name`,required:!0,value:p,onChange:e=>m(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(nS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:h,onChange:e=>g(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(nS,{id:`password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:_,onChange:e=>v(e.target.value)})]}),(0,M.jsx)(Z,{type:`submit`,className:`w-full`,disabled:y,children:e(y?`auth.register.submitting`:`auth.register.submit`)}),(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.register.haveAccount`),` `,(0,M.jsx)(ra,{to:`/login`,search:n?{redirect:n}:void 0,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.register.signIn`)})]})]})})})]}),(0,M.jsx)(KN,{termsUrl:f?.termsUrl,privacyUrl:f?.privacyUrl})]})})}var ZN=la(`/login`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:eP});function QN(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function $N(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function eP(){let{t:e}=vt(),t=Hi(),{redirect:n}=ZN.useSearch(),r=Qg(),i=null;if(typeof window<`u`){let e=new URLSearchParams(window.location.search),t=e.get(`redirect_uri`);if(e.has(`client_id`)&&t)try{i=new URL(t).host}catch{i=null}}let{session:a,user:o,loading:s,refresh:c,organizations:l,organizationsLoading:u,organizationsFetched:d,setActiveOrganization:f,features:p}=eN(),m=p?.signUpDisabled===!0,[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{if(o){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){window.location.assign(`/api/v1/auth/oauth2/authorize${window.location.search}`);return}}if(!a?.activeOrganizationId){if(!d||u||x)return;if(l.length===1){S(!0),f(l[0].id).catch(()=>void 0).finally(()=>S(!1));return}if(!p)return;if(l.length===0){if(p.multiOrgEnabled===!1){QN(n)?window.location.assign($N(n)):window.location.assign(`/`);return}t({to:`/organizations/new`});return}if(p.multiOrgEnabled===!1){S(!0),f(l[0].id).catch(()=>void 0).finally(()=>S(!1));return}t({to:`/organizations`});return}if(!x){if(QN(n)){window.location.assign($N(n));return}window.location.assign(`/`)}}},[o,a,t,n,l,u,d,x,f,p]),s||o?(0,M.jsx)(AN,{children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:e(`auth.login.signingIn`,{defaultValue:`Signing you in…`})})]})}):(0,M.jsxs)(AN,{children:[y?(0,M.jsx)(aN,{message:e(`auth.login.signingIn`,{defaultValue:`Signing you in…`})}):null,(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[i?(0,M.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-md border border-primary/30 bg-primary/5 px-4 py-3 text-sm text-foreground`,children:[(0,M.jsx)(`span`,{className:`mt-0.5 inline-block size-2 shrink-0 rounded-full bg-primary`}),(0,M.jsx)(`span`,{children:e(`auth.login.ssoHandoff`,{target:i,defaultValue:`Continue to ${i}`})})]}):null,(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.login.title`)}),(0,M.jsx)(TN,{children:e(`auth.login.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsx)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r?.auth){b(!0);try{await r.auth.login({type:`email`,email:h,password:_}),await c(),K({title:e(`auth.login.welcomeToast`)})}catch(r){let i=r.message,a=r.code,o=(i||``).toLowerCase();if(a===`EMAIL_NOT_VERIFIED`||o.includes(`email`)&&(o.includes(`verif`)||o.includes(`not verified`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}K({title:e(`auth.login.failed`),description:i,variant:`destructive`})}finally{b(!1)}}},children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(WN,{mode:`sign-in`,redirect:n}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(nS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:h,onChange:e=>g(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center`,children:[(0,M.jsx)($,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(ra,{to:`/forgot-password`,className:`ml-auto text-sm underline-offset-4 hover:underline`,children:e(`auth.login.forgotPassword`)})]}),(0,M.jsx)(nS,{id:`password`,type:`password`,autoComplete:`current-password`,required:!0,value:_,onChange:e=>v(e.target.value)})]}),(0,M.jsx)(Z,{type:`submit`,className:`w-full`,disabled:y,children:e(y?`auth.login.submitting`:`auth.login.submit`)}),m?null:(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.login.noAccount`),` `,(0,M.jsx)(ra,{to:`/register`,search:n?{redirect:n}:void 0,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.login.signUp`)})]})]})})})]}),(0,M.jsx)(KN,{termsUrl:p?.termsUrl,privacyUrl:p?.privacyUrl})]})]})}var tP=la(`/forgot-password`)({component:nP});function nP(){let{t:e}=vt(),[t,n]=(0,j.useState)(``),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(!1);return(0,M.jsx)(AN,{children:(0,M.jsx)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:a?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.forgotPassword.checkEmailTitle`)}),(0,M.jsx)(TN,{children:e(`auth.forgotPassword.checkEmailDescription`,{email:t})})]}),(0,M.jsx)(EN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.forgotPassword.backToSignIn`)})})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.forgotPassword.title`)}),(0,M.jsx)(TN,{children:e(`auth.forgotPassword.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{n.preventDefault(),i(!0);try{let e=window.location.origin+`/_account/`.replace(/\/$/,``)+`/reset-password`,n=await fetch(`/api/v1/auth/request-password-reset`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({email:t,redirectTo:e})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e?.message||`Request failed: ${n.status}`)}o(!0)}catch(t){K({title:e(`auth.forgotPassword.failed`),description:t.message,variant:`destructive`})}finally{i(!1)}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(nS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:t,onChange:e=>n(e.target.value)})]}),(0,M.jsx)(Z,{type:`submit`,className:`w-full bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,disabled:r,children:e(r?`auth.forgotPassword.submitting`:`auth.forgotPassword.submit`)}),(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.forgotPassword.rememberPassword`),` `,(0,M.jsx)(ra,{to:`/login`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.forgotPassword.signIn`)})]})]})})]})})})}var rP=la(`/account`)({component:iP});function iP(){return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-4 py-6 sm:px-6 sm:py-8`,children:(0,M.jsx)(`div`,{className:`page-enter mx-auto flex max-w-4xl flex-col gap-6`,children:(0,M.jsx)(ya,{})})})})}var aP=la(`/`)({component:oP});function oP(){return(0,M.jsx)(Ui,{to:`/login`})}var sP=iy(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function cP({className:e,variant:t,...n}){return(0,M.jsx)(`div`,{className:X(sP({variant:t}),e),...n})}function lP({title:e,description:t,icon:n,actions:r,className:i,...a}){return(0,M.jsxs)(`div`,{className:X(`relative overflow-hidden rounded-xl border bg-brand-gradient-subtle`,`px-5 py-5 sm:px-6 sm:py-6`,i),...a,children:[(0,M.jsx)(`div`,{className:`pointer-events-none absolute inset-0 opacity-60`,style:{backgroundImage:`radial-gradient(ellipse 60% 80% at 0% 0%, hsl(var(--brand-from) / 0.12), transparent 60%)`},"aria-hidden":!0}),(0,M.jsxs)(`div`,{className:`relative flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between sm:gap-6`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[n?(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15`,children:(0,M.jsx)(n,{className:`size-5`})}):null,(0,M.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,M.jsx)(`h1`,{className:`truncate text-xl font-semibold tracking-tight sm:text-2xl`,children:e}),t?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t}):null]})]}),r?(0,M.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:r}):null]})]})}var uP=la(`/organizations/`)({component:dP});function dP(){let{t:e}=vt(),{organizations:t,loading:n}=tN(),{session:r,setActiveOrganization:i,features:a}=eN(),o=Hi(),s=r?.activeOrganizationId??void 0,c=a?.multiOrgEnabled!==!1,l=async t=>{try{t!==s&&await i(t),o({to:`/organizations/$orgId`,params:{orgId:t}})}catch(t){K({title:e(`organizations.switchFailed`),description:t.message,variant:`destructive`})}},u=e=>e.split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase();return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-4 py-6 sm:px-6 sm:py-8`,children:(0,M.jsxs)(`div`,{className:`page-enter mx-auto flex max-w-3xl flex-col gap-6`,children:[(0,M.jsx)(lP,{icon:gy,title:e(`organizations.title`),description:e(`organizations.description`),actions:c?(0,M.jsxs)(Z,{onClick:()=>o({to:`/organizations/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:[(0,M.jsx)(Uy,{className:`mr-2 h-4 w-4`}),e(`organizations.newOrganization`)]}):null}),n&&(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`organizations.loading`)}),!n&&t.length===0&&(0,M.jsxs)(Q,{className:`p-10 text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-3 flex size-12 items-center justify-center rounded-lg bg-brand-gradient-subtle text-primary ring-1 ring-primary/15`,children:(0,M.jsx)(gy,{className:`h-6 w-6`})}),(0,M.jsx)(`h3`,{className:`text-base font-medium`,children:e(`organizations.emptyTitle`)}),(0,M.jsx)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:e(`organizations.emptyDescription`)}),c&&(0,M.jsxs)(Z,{onClick:()=>o({to:`/organizations/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20`,children:[(0,M.jsx)(Uy,{className:`mr-2 h-4 w-4`}),e(`organizations.createOrganization`)]})]}),(0,M.jsx)(`div`,{className:`grid gap-3`,children:t.map(t=>{let n=t.id===s;return(0,M.jsx)(Q,{role:`button`,tabIndex:0,onClick:()=>l(t.id),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l(t.id))},className:`group cursor-pointer p-4 transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5 focus:outline-none focus:ring-2 focus:ring-ring ${n?`border-primary/50 bg-brand-gradient-subtle ring-1 ring-primary/30`:``}`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,M.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-lg font-semibold `+(n?`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15`:`bg-muted text-muted-foreground group-hover:bg-brand-gradient-subtle group-hover:text-primary`),children:u(t.name)||(0,M.jsx)(gy,{className:`h-5 w-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`h3`,{className:`truncate text-base font-medium`,children:t.name}),n&&(0,M.jsxs)(cP,{className:`gap-1 border-transparent bg-emerald-500/15 text-[10px] font-medium text-emerald-600 dark:text-emerald-400`,children:[(0,M.jsx)(_y,{className:`h-3 w-3`}),e(`organizations.active`)]})]}),t.slug&&(0,M.jsx)(`code`,{className:`mt-0.5 block font-mono text-xs text-muted-foreground`,children:t.slug})]}),(0,M.jsx)(yy,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary`})]})},t.id)})})]})})})}var fP=la(`/account/`)({component:pP});function pP(){let{t:e}=vt(),{user:t}=eN(),{organizations:n}=tN(),r=[!!t?.emailVerified,!!t?.twoFactorEnabled,!!t?.name,!!t?.image].filter(Boolean).length*25,i=r>=75?`success`:r>=50?`warn`:`danger`,a=(t?.name??t?.email??`?`).split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase(),o=[{to:`/account/profile`,label:e(`home.tiles.profile.title`,{defaultValue:`Profile`}),description:e(`home.tiles.profile.description`,{defaultValue:`Display name, avatar and contact info.`}),icon:rb},{to:`/account/security`,label:e(`home.tiles.security.title`,{defaultValue:`Security`}),description:e(`home.tiles.security.description`,{defaultValue:`Change your password and review activity.`}),icon:Jy},{to:`/account/two-factor`,label:e(`home.tiles.twoFactor.title`,{defaultValue:`Two-factor auth`}),description:e(`home.tiles.twoFactor.description`,{defaultValue:`Add an authenticator app for stronger sign-in.`}),icon:qy},{to:`/account/sessions`,label:e(`home.tiles.sessions.title`,{defaultValue:`Active sessions`}),description:e(`home.tiles.sessions.description`,{defaultValue:`See and revoke devices that are signed in.`}),icon:By},{to:`/account/linked-accounts`,label:e(`home.tiles.linked.title`,{defaultValue:`Linked accounts`}),description:e(`home.tiles.linked.description`,{defaultValue:`Manage your social and SSO providers.`}),icon:Iy},{to:`/account/oauth-applications`,label:e(`home.tiles.oauth.title`,{defaultValue:`OAuth applications`}),description:e(`home.tiles.oauth.description`,{defaultValue:`Apps you have authorised to access your account.`}),icon:Ny}];return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl border bg-card`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 bg-brand-gradient`,"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`absolute inset-0 opacity-40 mix-blend-soft-light`,style:{backgroundImage:`radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.4), transparent 60%), radial-gradient(ellipse at 100% 100%, rgba(0,0,0,0.25), transparent 60%)`},"aria-hidden":!0}),(0,M.jsxs)(`div`,{className:`relative flex flex-col gap-4 p-6 text-white sm:flex-row sm:items-center sm:gap-6 sm:p-8`,children:[(0,M.jsxs)(GM,{className:`size-16 shrink-0 ring-4 ring-white/30 shadow-md sm:size-20`,children:[t?.image?(0,M.jsx)(KM,{src:t.image,alt:t?.name??``}):null,(0,M.jsx)(qM,{className:`bg-white/20 text-base font-semibold text-white backdrop-blur`,children:a})]}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,M.jsx)(`p`,{className:`text-xs uppercase tracking-wider text-white/70`,children:e(`home.welcome`,{defaultValue:`Welcome back`})}),(0,M.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight`,children:t?.name||t?.email||`ObjectStack user`}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm text-white/80`,children:[(0,M.jsx)(zy,{className:`size-3.5`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`truncate`,children:t?.email}),t?.emailVerified?(0,M.jsx)(cP,{className:`border-white/30 bg-white/15 text-[10px] font-medium text-white backdrop-blur hover:bg-white/20`,children:e(`home.verified`,{defaultValue:`Verified`})}):null]})]})]})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-3`,children:[(0,M.jsx)(mP,{icon:qy,label:e(`home.stats.score`,{defaultValue:`Security score`}),value:`${r}%`,tone:i,extra:(0,M.jsx)(`div`,{className:`mt-2 h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,M.jsx)(`div`,{className:`h-full bg-brand-gradient transition-[width] duration-500`,style:{width:`${r}%`}})})}),(0,M.jsx)(mP,{icon:gy,label:e(`home.stats.orgs`,{defaultValue:`Organizations`}),value:String(n.length),extra:(0,M.jsxs)(ra,{to:`/organizations`,className:`mt-2 inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline`,children:[e(`home.stats.manage`,{defaultValue:`Manage`}),(0,M.jsx)(hy,{className:`size-3`})]})}),(0,M.jsx)(mP,{icon:t?.twoFactorEnabled?qy:Jy,label:e(`home.stats.twoFactor`,{defaultValue:`Two-factor auth`}),value:t?.twoFactorEnabled?e(`home.stats.enabled`,{defaultValue:`Enabled`}):e(`home.stats.disabled`,{defaultValue:`Disabled`}),tone:t?.twoFactorEnabled?`success`:`warn`,extra:(0,M.jsxs)(ra,{to:`/account/two-factor`,className:`mt-2 inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline`,children:[t?.twoFactorEnabled?e(`home.stats.review`,{defaultValue:`Review`}):e(`home.stats.enable`,{defaultValue:`Enable now`}),(0,M.jsx)(hy,{className:`size-3`})]})})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-muted-foreground`,children:e(`home.quickAccess`,{defaultValue:`Quick access`})}),(0,M.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:o.map(({to:e,label:t,description:n,icon:r})=>(0,M.jsxs)(ra,{to:e,className:`group relative flex items-start gap-3 rounded-lg border bg-card p-4 transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5`,children:[(0,M.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md bg-brand-gradient-subtle text-primary ring-1 ring-primary/10 transition-transform group-hover:scale-110`,children:(0,M.jsx)(r,{className:`size-4`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,M.jsx)(`span`,{className:`truncate font-medium`,children:t}),(0,M.jsx)(hy,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary`})]}),(0,M.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:n})]})]},e))})]})]})}function mP({icon:e,label:t,value:n,tone:r=`neutral`,extra:i}){let a=r===`success`?`text-emerald-600 dark:text-emerald-400`:r===`warn`?`text-amber-600 dark:text-amber-400`:r===`danger`?`text-destructive`:`text-foreground`;return(0,M.jsx)(Q,{className:`overflow-hidden`,children:(0,M.jsxs)(EN,{className:`p-5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wider text-muted-foreground`,children:t}),(0,M.jsx)(e,{className:`size-4 ${a}`})]}),(0,M.jsx)(`p`,{className:`mt-1 text-2xl font-semibold tracking-tight ${a}`,children:n}),i]})})}var hP=la(`/organizations/new`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:yP});function gP(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,48)}function _P(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function vP(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function yP(){let{t:e}=vt(),t=Hi(),{redirect:n}=hP.useSearch(),{create:r,creating:i}=nN(),{setActiveOrganization:a,reloadOrganizations:o,features:s}=eN(),[c,l]=(0,j.useState)(``),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(!1);(0,j.useEffect)(()=>{s&&s.multiOrgEnabled===!1&&t({to:`/organizations`})},[s,t]);let m=e=>{l(e),f||d(gP(e))};return(0,M.jsx)(AN,{formWidth:`md`,children:(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`organizations.new.title`)}),(0,M.jsx)(TN,{children:e(`organizations.new.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault();try{let t=await r({name:c,slug:u||void 0}),i=t?.data??t,s=i?.id??i?.organization?.id;s&&await a(s).catch(()=>{}),await o().catch(()=>{}),K({title:e(`organizations.new.successToast`)}),_P(n)?window.location.assign(vP(n)):window.location.assign(`/`)}catch(t){K({title:e(`organizations.new.failed`),description:t.message,variant:`destructive`})}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`name`,children:e(`organizations.new.name`)}),(0,M.jsx)(nS,{id:`name`,required:!0,autoFocus:!0,value:c,onChange:e=>m(e.target.value),placeholder:e(`organizations.new.namePlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`slug`,children:e(`organizations.new.slug`)}),(0,M.jsx)(nS,{id:`slug`,value:u,onChange:e=>{d(e.target.value),p(!0)},placeholder:e(`organizations.new.slugPlaceholder`),pattern:`[a-z0-9-]+`}),(0,M.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e(`organizations.new.slugHint`)})]}),(0,M.jsx)(Z,{type:`submit`,className:`w-full`,disabled:i||!c,children:e(i?`organizations.new.submitting`:`organizations.new.submit`)}),(0,M.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:(0,M.jsx)(ra,{to:`/organizations`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`organizations.new.cancel`)})})]})})]})})}var bP=la(`/organizations/$orgId`)({component:xP});function xP(){let{t:e}=vt(),{orgId:t}=bP.useParams(),{organizations:n}=tN(),r=n.find(e=>e.id===t);return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-6 py-8`,children:(0,M.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-6`,children:[(0,M.jsxs)(`header`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:r?.name??e(`organizations.title`)}),r?.slug&&(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground font-mono`,children:r.slug})]}),(0,M.jsx)(ya,{})]})})})}function SP(){let e=Qg(),[t,n]=(0,j.useState)([]),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null),s=(0,j.useCallback)(async()=>{if(e?.oauth?.applications){i(!0),o(null);try{n((await e.oauth.applications.list())?.applications??[])}catch(e){o(e),n([])}finally{i(!1)}}},[e]);return(0,j.useEffect)(()=>{s()},[s]),{applications:t,loading:r,error:a,reload:s}}function CP(){let e=Qg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null),[a,o]=(0,j.useState)(null);return{register:(0,j.useCallback)(async t=>{if(!e?.oauth?.applications?.register)throw Error(`Client not ready`);n(!0),i(null);try{let n=await e.oauth.applications.register(t);return o(n),n}catch(e){throw i(e),e}finally{n(!1)}},[e]),registering:t,error:r,lastResult:a}}function wP(){let e=Qg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{remove:(0,j.useCallback)(async t=>{if(!e?.oauth?.applications?.delete)throw Error(`Client not ready`);n(!0),i(null);try{return await e.oauth.applications.delete(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),deleting:t,error:r}}function TP(){let e=Qg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{submit:(0,j.useCallback)(async t=>{if(!e?.oauth?.consent)throw Error(`Client not ready`);n(!0),i(null);try{return await e.oauth.consent(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),submitting:t,error:r}}var EP=la(`/oauth/consent`)({validateSearch:e=>e,component:DP});function DP(){let{t:e}=vt(),t=Hi(),n=Qg(),{user:r,loading:i}=eN(),{submit:a,submitting:o}=TP(),[s,c]=(0,j.useState)(null),l=typeof window<`u`?window.location.search:``,u=l.startsWith(`?`)?l.slice(1):l,d=new URLSearchParams(u),f=d.get(`client_id`)??void 0,p=d.get(`scope`)??``;(0,j.useEffect)(()=>{i||r||t({to:`/login`,search:{redirect:window.location.pathname+window.location.search}})},[r,i,t]),(0,j.useEffect)(()=>{if(!f||!n?.oauth?.applications?.getPublic)return;let e=!1;return n.oauth.applications.getPublic(f).then(t=>{if(e)return;let n=t?.data??t;c({name:n?.name??n?.client_name,icon:n?.icon??n?.logo_uri})},()=>{}),()=>{e=!0}},[n,f]);let m=p.split(/\s+/).filter(Boolean),h=async t=>{try{let n=await a({accept:t,oauth_query:u}),r=n?.redirect_uri??n?.redirectURI??n?.url;if(r){window.location.href=r;return}K({title:e(t?`oauth.consent.granted`:`oauth.consent.denied`),description:e(`oauth.consent.noRedirect`),variant:t?void 0:`destructive`})}catch(t){K({title:e(`oauth.consent.failed`),description:t.message,variant:`destructive`})}},g=s?.name??f??e(`oauth.consent.unknownApp`);return(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-1 items-center justify-center bg-background px-4`,children:(0,M.jsxs)(Q,{className:`w-full max-w-md`,children:[(0,M.jsxs)(CN,{className:`items-center text-center`,children:[(0,M.jsx)(`div`,{className:`mb-3 rounded-full border bg-muted p-3`,children:s?.icon?(0,M.jsx)(`img`,{src:s.icon,alt:``,className:`h-8 w-8 rounded`,onError:e=>e.currentTarget.style.display=`none`}):(0,M.jsx)(Ny,{className:`h-7 w-7 text-muted-foreground`})}),(0,M.jsx)(wN,{className:`text-xl`,children:e(`oauth.consent.title`,{appName:g})}),(0,M.jsx)(TN,{children:e(`oauth.consent.request`,{appName:g,suffix:r?.email?` (${r.email})`:``})})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[m.length>0&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:e(`oauth.consent.willAllow`)}),(0,M.jsx)(`ul`,{className:`space-y-1.5 rounded-md border bg-muted/40 p-3 text-sm`,children:m.map(t=>(0,M.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,M.jsx)(_y,{className:`mt-0.5 h-4 w-4 text-green-600 dark:text-green-400`}),(0,M.jsx)(`span`,{children:OP(t,e)})]},t))})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pt-2`,children:[(0,M.jsxs)(Z,{variant:`outline`,onClick:()=>h(!1),disabled:o,children:[(0,M.jsx)(ob,{className:`mr-2 h-4 w-4`}),e(`oauth.consent.deny`)]}),(0,M.jsxs)(Z,{onClick:()=>h(!0),disabled:o,children:[(0,M.jsx)(_y,{className:`mr-2 h-4 w-4`}),e(o?`oauth.consent.submitting`:`oauth.consent.authorize`)]})]}),(0,M.jsx)(`p`,{className:`pt-2 text-center text-xs text-muted-foreground`,children:e(`oauth.consent.footer`)})]})]})})}function OP(e,t){switch(e){case`openid`:return t(`oauth.consent.scope.openid`);case`profile`:return t(`oauth.consent.scope.profile`);case`email`:return t(`oauth.consent.scope.email`);case`offline_access`:return t(`oauth.consent.scope.offlineAccess`);default:return e}}var kP=la(`/auth/device`)({validateSearch:e=>({user_code:e.user_code??e.code??``}),component:jP});function AP({children:e}){return(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10`,children:(0,M.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-6`,children:[(0,M.jsxs)(`a`,{href:`#`,className:`flex items-center gap-2 self-center font-medium`,children:[(0,M.jsx)(`div`,{className:`flex size-6 items-center justify-center rounded-md bg-primary text-primary-foreground`,children:(0,M.jsx)(ky,{className:`size-4`})}),`ObjectStack`]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-6`,children:e})]})})}function jP(){let{t:e}=vt(),{user_code:t}=kP.useSearch(),{user:n,loading:r}=eN(),i=Hi(),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(!1),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(``);return t?r?(0,M.jsx)(AP,{children:(0,M.jsx)(Q,{children:(0,M.jsx)(CN,{className:`text-center`,children:(0,M.jsx)(TN,{children:e(`auth.device.loading`)})})})}):n?l?(0,M.jsx)(AP,{children:(0,M.jsx)(Q,{children:(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(Sy,{className:`h-10 w-10 text-green-500 mx-auto mb-2`}),(0,M.jsx)(wN,{children:e(`auth.device.approvedTitle`)}),(0,M.jsx)(TN,{children:e(`auth.device.approvedDescription`)})]})})}):d?(0,M.jsx)(AP,{children:(0,M.jsx)(Q,{children:(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{children:e(`auth.device.deniedTitle`)}),(0,M.jsx)(TN,{children:e(`auth.device.deniedDescription`)})]})})}):(0,M.jsx)(AP,{children:(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{children:e(`auth.device.title`)}),(0,M.jsx)(TN,{children:e(`auth.device.subtitle`,{email:n.email})})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`rounded-md border bg-background px-4 py-3 text-center`,children:[(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground mb-1`,children:e(`auth.device.userCodeLabel`)}),(0,M.jsx)(`p`,{className:`font-mono font-semibold tracking-widest text-lg`,children:t})]}),(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(`p`,{className:`text-sm text-center text-muted-foreground`,children:e(`auth.device.loggedInAs`,{email:n.email})}),p&&(0,M.jsx)(`p`,{className:`text-sm text-destructive text-center`,children:p}),(0,M.jsx)(Z,{onClick:async()=>{m(``),o(!0);try{let n=await fetch(`/api/v1/auth/device/approve`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:t})});if(!n.ok){let t=await n.json().catch(()=>({}));throw Error(t?.message??t?.error?.message??e(`auth.device.approveFailed`))}u(!0),K({title:e(`auth.device.approveSuccess`),description:e(`auth.device.approveSuccessDescription`)})}catch(t){m(t?.message??e(`auth.device.approveFailed`))}finally{o(!1)}},className:`w-full`,disabled:a||s,children:e(a?`auth.device.approving`:`auth.device.approve`)}),(0,M.jsx)(Z,{onClick:async()=>{m(``),c(!0);try{await fetch(`/api/v1/auth/device/deny`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:t})}),f(!0)}catch(t){m(t?.message??e(`auth.device.denyFailed`))}finally{c(!1)}},variant:`outline`,className:`w-full`,disabled:a||s,children:e(s?`auth.device.denying`:`auth.device.deny`)}),(0,M.jsx)(`div`,{className:`text-center`,children:(0,M.jsx)(`button`,{type:`button`,className:`text-sm text-muted-foreground underline-offset-4 hover:underline`,onClick:()=>i({to:`/`}),children:e(`auth.device.cancel`)})})]})]})]})}):(0,M.jsx)(Ui,{to:`/login`,search:{redirect:`/auth/device?user_code=${encodeURIComponent(t)}`}}):(0,M.jsx)(AP,{children:(0,M.jsx)(Q,{children:(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{children:e(`auth.device.invalidTitle`)}),(0,M.jsx)(TN,{children:e(`auth.device.invalidDescription`)})]})})})}var MP=la(`/account/two-factor`)({component:NP});function NP(){let{t:e}=vt(),t=Qg(),{user:n,loading:r,refresh:i}=eN(),[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(null),[p,m]=(0,j.useState)(null),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(!1),[T,E]=(0,j.useState)(``),[D,O]=(0,j.useState)(!1),[ee,te]=(0,j.useState)(null);(0,j.useEffect)(()=>{r||o(!!n?.twoFactorEnabled)},[r,n?.twoFactorEnabled]);let ne=async n=>{n.preventDefault(),u(!0);try{let e=await t.auth.twoFactor.enable({password:s});f(e?.totpURI??null),m(e?.backupCodes??null),c(``)}catch(t){K({title:e(`twoFactor.enableFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},re=async n=>{n.preventDefault(),b(!0);try{await t.auth.twoFactor.verifyTotp({code:_,trustDevice:h}),K({title:e(`twoFactor.enableSuccess`)}),o(!0),f(null),v(``),await i()}catch(t){K({title:e(`twoFactor.invalidCode`),description:t.message,variant:`destructive`})}finally{b(!1)}},ie=async n=>{n.preventDefault(),w(!0);try{await t.auth.twoFactor.disable({password:x}),K({title:e(`twoFactor.disableSuccess`)}),o(!1),S(``),te(null),await i()}catch(t){K({title:e(`twoFactor.disableFailed`),description:t.message,variant:`destructive`})}finally{w(!1)}},ae=async n=>{n.preventDefault(),O(!0);try{te((await t.auth.twoFactor.generateBackupCodes({password:T}))?.backupCodes??[]),E(``),K({title:e(`twoFactor.backupCodes.regenerated`)})}catch(t){K({title:e(`twoFactor.backupCodes.regenerateFailed`),description:t.message,variant:`destructive`})}finally{O(!1)}},oe=async t=>{try{await navigator.clipboard.writeText(t.join(`
148
148
  `)),K({title:e(`twoFactor.backupCodes.copied`)})}catch{K({title:e(`twoFactor.backupCodes.copyFailed`),variant:`destructive`})}},k=(0,M.jsx)(lP,{icon:qy,title:e(`twoFactor.title`),description:e(`twoFactor.notEnabledDescription`),actions:a===!0?(0,M.jsx)(cP,{className:`border-transparent bg-emerald-500/15 font-medium text-emerald-600 dark:text-emerald-400`,children:e(`twoFactor.enabled`)}):a===!1?(0,M.jsx)(cP,{variant:`outline`,className:`font-medium`,children:e(`twoFactor.notEnabled`)}):null});if(a===null)return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)(Q,{children:[(0,M.jsx)(CN,{children:(0,M.jsx)(wN,{className:`text-base`,children:e(`twoFactor.loadingStatus`)})}),(0,M.jsxs)(EN,{className:`space-y-2`,children:[(0,M.jsx)(qw,{className:`h-4 w-48`}),(0,M.jsx)(qw,{className:`h-9 w-full`}),(0,M.jsx)(qw,{className:`h-9 w-32`})]})]})]});if(d){let t=`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(d)}`;return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`twoFactor.setupTitle`)}),(0,M.jsx)(TN,{children:e(`twoFactor.setupDescription`)})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,M.jsx)(`img`,{src:t,alt:e(`twoFactor.qrAlt`),width:200,height:200,className:`rounded border bg-white p-2`}),(0,M.jsx)(`div`,{className:`w-full rounded bg-muted p-3 font-mono text-xs break-all`,children:d}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`twoFactor.uriHint`)})]}),p&&p.length>0&&(0,M.jsxs)(`div`,{className:`rounded border bg-muted/40 p-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:e(`twoFactor.backupCodes.savedTitle`)}),(0,M.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>oe(p),children:[(0,M.jsx)(Dy,{className:`mr-1 h-3 w-3`}),e(`twoFactor.backupCodes.copy`)]})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`twoFactor.backupCodes.savedHint`)}),(0,M.jsx)(`div`,{className:`mt-2 grid grid-cols-2 gap-1 font-mono text-xs`,children:p.map(e=>(0,M.jsx)(`span`,{className:`rounded bg-background px-2 py-1`,children:e},e))})]}),(0,M.jsx)(uS,{}),(0,M.jsxs)(`form`,{onSubmit:re,className:`space-y-3`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`totp-code`,children:e(`twoFactor.verificationCode`)}),(0,M.jsx)(nS,{id:`totp-code`,placeholder:`000000`,maxLength:6,inputMode:`numeric`,autoComplete:`one-time-code`,value:_,onChange:e=>v(e.target.value),required:!0})]}),(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked)}),e(`twoFactor.trustDevice`)]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsx)(Z,{type:`submit`,disabled:y||_.length<6,children:e(y?`twoFactor.verifying`:`twoFactor.verify`)}),(0,M.jsx)(Z,{type:`button`,variant:`outline`,onClick:()=>f(null),children:e(`twoFactor.cancel`)})]})]})]})]})]})}return a===!0?(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`twoFactor.enabledTitle`,{defaultValue:`Authenticator app`})}),(0,M.jsx)(TN,{children:e(`twoFactor.enabledDescription`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:ie,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`disable-password`,children:e(`twoFactor.password`)}),(0,M.jsx)(nS,{id:`disable-password`,type:`password`,autoComplete:`current-password`,required:!0,value:x,onChange:e=>S(e.target.value)})]}),(0,M.jsx)(Z,{variant:`destructive`,type:`submit`,disabled:C,children:e(C?`twoFactor.disabling`:`twoFactor.disable`)})]})})]}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsxs)(wN,{className:`text-base flex items-center gap-2`,children:[(0,M.jsx)(Ny,{className:`h-4 w-4`}),e(`twoFactor.backupCodes.title`)]}),(0,M.jsx)(TN,{children:e(`twoFactor.backupCodes.description`)})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[(0,M.jsxs)(`form`,{onSubmit:ae,className:`space-y-3`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`backup-password`,children:e(`twoFactor.password`)}),(0,M.jsx)(nS,{id:`backup-password`,type:`password`,autoComplete:`current-password`,required:!0,value:T,onChange:e=>E(e.target.value)})]}),(0,M.jsxs)(Z,{type:`submit`,variant:`outline`,disabled:D,children:[(0,M.jsx)(Wy,{className:`mr-2 h-4 w-4`}),e(D?`common.saving`:`twoFactor.backupCodes.regenerate`)]})]}),ee&&ee.length>0&&(0,M.jsxs)(`div`,{className:`rounded border bg-muted/40 p-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:e(`twoFactor.backupCodes.newTitle`)}),(0,M.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>oe(ee),children:[(0,M.jsx)(Dy,{className:`mr-1 h-3 w-3`}),e(`twoFactor.backupCodes.copy`)]})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`twoFactor.backupCodes.savedHint`)}),(0,M.jsx)(`div`,{className:`mt-2 grid grid-cols-2 gap-1 font-mono text-xs`,children:ee.map(e=>(0,M.jsx)(`span`,{className:`rounded bg-background px-2 py-1`,children:e},e))})]})]})]})]}):(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`twoFactor.enable`)}),(0,M.jsx)(TN,{children:e(`twoFactor.notEnabledDescription`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:ne,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`enable-password`,children:e(`twoFactor.password`)}),(0,M.jsx)(nS,{id:`enable-password`,type:`password`,autoComplete:`current-password`,required:!0,value:s,onChange:e=>c(e.target.value),placeholder:e(`twoFactor.passwordPlaceholder`)})]}),(0,M.jsx)(Z,{type:`submit`,disabled:l,className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:e(l?`twoFactor.loading`:`twoFactor.enable`)})]})})]})]})}var PP=[[/Edg\//i,`Edge`],[/OPR\//i,`Opera`],[/Chrome\//i,`Chrome`],[/Firefox\//i,`Firefox`],[/Safari\//i,`Safari`]],FP=[[/Windows NT 10/i,`Windows 10/11`],[/Windows/i,`Windows`],[/Mac OS X|Macintosh/i,`macOS`],[/iPhone|iOS/i,`iOS`],[/iPad/i,`iPadOS`],[/Android/i,`Android`],[/Linux/i,`Linux`]];function IP(e){if(!e)return{browser:`Unknown`,os:`Unknown`,device:`desktop`,label:`Unknown device`,icon:Ay};let t=PP.find(([t])=>t.test(e))?.[1]??`Browser`,n=FP.find(([t])=>t.test(e))?.[1]??`Unknown OS`,r=/iPad|Tablet/i.test(e),i=!r&&/Mobile|Android|iPhone|iPod/i.test(e),a=r?`tablet`:i?`mobile`:`desktop`,o=By;return o=a===`mobile`?Yy:a===`tablet`?Zy:/Linux|Windows|Mac/i.test(e)?By:Ay,{browser:t,os:n,device:a,label:`${t} · ${n}`,icon:o}}var LP=la(`/account/sessions`)({component:RP});function RP(){let{t:e}=vt(),t=Qg(),{session:n}=eN(),[r,i]=(0,j.useState)([]),[a,o]=(0,j.useState)(!0),[s,c]=(0,j.useState)(null),[l,u]=(0,j.useState)(!1),d=async()=>{try{i((await t.auth.sessions.list())?.sessions??[])}catch(t){K({title:e(`sessions.loadFailed`),description:t.message,variant:`destructive`})}finally{o(!1)}};(0,j.useEffect)(()=>{d()},[]);let f=async n=>{c(n);try{await t.auth.sessions.revoke(n),K({title:e(`sessions.revoked`)}),await d()}catch(t){K({title:e(`sessions.revokeFailed`),description:t.message,variant:`destructive`})}finally{c(null)}},p=async()=>{u(!0);try{await t.auth.sessions.revokeOthers(),K({title:e(`sessions.othersRevoked`)}),await d()}catch(t){K({title:e(`sessions.revokeOthersFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},m=n?.token,h=r.find(e=>e.token===m),g=r.filter(e=>e.token!==m);return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(lP,{icon:By,title:e(`sessions.title`),description:e(`sessions.description`),actions:r.length>1?(0,M.jsxs)(Z,{variant:`outline`,size:`sm`,onClick:p,disabled:l,children:[(0,M.jsx)(Ly,{className:`mr-2 h-4 w-4`}),e(l?`sessions.revokingOthers`:`sessions.revokeOthers`)]}):null}),a&&(0,M.jsx)(`div`,{className:`space-y-3`,children:[0,1,2].map(e=>(0,M.jsx)(Q,{className:`overflow-hidden`,children:(0,M.jsxs)(EN,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(qw,{className:`size-10 rounded-lg`}),(0,M.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,M.jsx)(qw,{className:`h-4 w-40`}),(0,M.jsx)(qw,{className:`h-3 w-64`})]})]})},e))}),!a&&r.length===0&&(0,M.jsx)(Q,{children:(0,M.jsxs)(EN,{className:`flex flex-col items-center gap-3 p-10 text-center text-sm text-muted-foreground`,children:[(0,M.jsx)(By,{className:`size-10 text-muted-foreground/50`}),e(`sessions.empty`)]})}),!a&&h&&(0,M.jsx)(zP,{session:h,isCurrent:!0,revoking:!1,onRevoke:()=>void 0,t:e}),!a&&g.length>0&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wider text-muted-foreground`,children:e(`sessions.otherDevices`,{defaultValue:`Other signed-in devices`})}),(0,M.jsx)(`div`,{className:`space-y-2`,children:g.map(t=>(0,M.jsx)(zP,{session:t,isCurrent:!1,revoking:s===t.token,onRevoke:()=>f(t.token),t:e},t.id))})]})]})}function zP({session:e,isCurrent:t,revoking:n,onRevoke:r,t:i}){let a=IP(e.userAgent),o=a.icon;return(0,M.jsx)(Q,{className:t?`border-primary/40 bg-brand-gradient-subtle shadow-sm shadow-primary/10`:`transition-colors hover:bg-accent/30`,children:(0,M.jsxs)(EN,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg `+(t?`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30`:`bg-muted text-muted-foreground`),children:(0,M.jsx)(o,{className:`size-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:a.label}),t&&(0,M.jsx)(cP,{className:`border-transparent bg-emerald-500/15 text-[10px] font-medium text-emerald-600 dark:text-emerald-400`,children:i(`sessions.current`)})]}),(0,M.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[e.ipAddress&&(0,M.jsx)(`span`,{className:`font-mono`,children:e.ipAddress}),(0,M.jsx)(`span`,{children:i(`sessions.expires`,{date:new Date(e.expiresAt).toLocaleDateString()})})]})]}),!t&&(0,M.jsxs)(Z,{variant:`ghost`,size:`sm`,onClick:r,disabled:n,className:`ml-3 shrink-0 text-muted-foreground hover:text-destructive`,children:[(0,M.jsx)(Ly,{className:`mr-1.5 h-4 w-4`}),i(`sessions.revoke`,{defaultValue:`Revoke`})]})]})})}var BP=jw,VP=Mw,HP=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Nw,{ref:n,className:X(`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}));HP.displayName=Nw.displayName;var UP=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(VP,{children:[(0,M.jsx)(HP,{}),(0,M.jsxs)(Pw,{ref:r,className:X(`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]: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-1/2 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-1/2 sm:rounded-lg`,e),...n,children:[t,(0,M.jsxs)(Lw,{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:[(0,M.jsx)(ob,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));UP.displayName=Pw.displayName;var WP=({className:e,...t})=>(0,M.jsx)(`div`,{className:X(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});WP.displayName=`DialogHeader`;var GP=({className:e,...t})=>(0,M.jsx)(`div`,{className:X(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});GP.displayName=`DialogFooter`;var KP=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Fw,{ref:n,className:X(`text-lg font-semibold leading-none tracking-tight`,e),...t}));KP.displayName=Fw.displayName;var qP=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Iw,{ref:n,className:X(`text-sm text-muted-foreground`,e),...t}));qP.displayName=Iw.displayName;var JP=la(`/account/security`)({component:YP});function YP(){let{t:e}=vt(),t=Qg(),n=Hi(),{user:r,logout:i}=eN(),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(!0),[p,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(!1),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(``),[T,E]=(0,j.useState)(!1);return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(lP,{icon:Jy,title:e(`security.title`),description:e(`security.description`)}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsxs)(wN,{className:`text-base flex items-center gap-2`,children:[(0,M.jsx)(Jy,{className:`h-4 w-4 text-primary`}),e(`security.changePasswordTitle`,{defaultValue:`Change password`})]}),(0,M.jsx)(TN,{children:e(`security.changePasswordDescription`,{defaultValue:`Use at least 8 characters. Mix letters, numbers and symbols for strength.`})})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),s!==l){K({title:e(`security.passwordsMismatch`),variant:`destructive`});return}m(!0);try{await t.auth.changePassword({currentPassword:a,newPassword:s,revokeOtherSessions:d}),K({title:e(`security.changed`)}),o(``),c(``),u(``)}catch(t){K({title:e(`security.changeFailed`),description:t.message,variant:`destructive`})}finally{m(!1)}},className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`current-password`,children:e(`security.currentPassword`)}),(0,M.jsx)(nS,{id:`current-password`,type:`password`,autoComplete:`current-password`,required:!0,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`new-password`,children:e(`security.newPassword`)}),(0,M.jsx)(nS,{id:`new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:s,onChange:e=>c(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`confirm-new-password`,children:e(`security.confirmPassword`)}),(0,M.jsx)(nS,{id:`confirm-new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:l,onChange:e=>u(e.target.value)})]}),(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),e(`security.revokeOtherSessions`)]}),(0,M.jsx)(Z,{type:`submit`,disabled:p,children:e(p?`common.saving`:`security.submit`)})]})})]}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsxs)(wN,{className:`text-base flex items-center gap-2`,children:[(0,M.jsx)(zy,{className:`h-4 w-4 text-primary`}),e(`security.email.title`)]}),(0,M.jsx)(TN,{children:e(`security.email.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),!(!h||h===r?.email)){v(!0);try{await t.auth.changeEmail({newEmail:h,callbackURL:window.location.origin+`/login`}),K({title:e(`security.email.requested`),description:e(`security.email.checkInbox`,{email:h})}),g(``)}catch(t){K({title:e(`security.email.requestFailed`),description:t.message,variant:`destructive`})}finally{v(!1)}}},className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`current-email`,children:e(`security.email.current`)}),(0,M.jsx)(nS,{id:`current-email`,value:r?.email??``,disabled:!0})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`new-email`,children:e(`security.email.new`)}),(0,M.jsx)(nS,{id:`new-email`,type:`email`,value:h,onChange:e=>g(e.target.value),placeholder:e(`security.email.placeholder`),required:!0})]}),(0,M.jsx)(Z,{type:`submit`,disabled:_||!h||h===r?.email,children:e(_?`common.saving`:`security.email.submit`)})]})})]}),(0,M.jsxs)(Q,{className:`border-destructive/40 bg-destructive/5`,children:[(0,M.jsxs)(CN,{children:[(0,M.jsxs)(wN,{className:`text-base flex items-center gap-2 text-destructive`,children:[(0,M.jsx)($y,{className:`h-4 w-4`}),e(`security.delete.title`)]}),(0,M.jsx)(TN,{children:e(`security.delete.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(Z,{variant:`destructive`,onClick:()=>b(!0),children:[(0,M.jsx)(Qy,{className:`mr-2 h-4 w-4`}),e(`security.delete.cta`)]})})]}),(0,M.jsx)(BP,{open:y,onOpenChange:b,children:(0,M.jsxs)(UP,{children:[(0,M.jsxs)(WP,{children:[(0,M.jsx)(KP,{children:e(`security.delete.dialogTitle`)}),(0,M.jsx)(qP,{children:e(`security.delete.dialogDescription`,{email:r?.email??``})})]}),(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`delete-password`,children:e(`security.delete.password`)}),(0,M.jsx)(nS,{id:`delete-password`,type:`password`,autoComplete:`current-password`,value:x,onChange:e=>S(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`delete-confirm`,children:e(`security.delete.typeEmail`,{email:r?.email??``})}),(0,M.jsx)(nS,{id:`delete-confirm`,value:C,onChange:e=>w(e.target.value),placeholder:r?.email??``})]})]}),(0,M.jsxs)(GP,{children:[(0,M.jsx)(Z,{variant:`outline`,onClick:()=>b(!1),disabled:T,children:e(`common.cancel`)}),(0,M.jsx)(Z,{variant:`destructive`,onClick:async()=>{if(C!==r?.email){K({title:e(`security.delete.confirmationMismatch`),description:e(`security.delete.confirmationHint`,{email:r?.email??``}),variant:`destructive`});return}E(!0);try{await t.auth.deleteUser({password:x}),K({title:e(`security.delete.success`)});try{await i()}catch{}n({to:`/login`,replace:!0})}catch(t){K({title:e(`security.delete.failed`),description:t.message,variant:`destructive`})}finally{E(!1)}},disabled:T||C!==r?.email,children:e(T?`common.saving`:`security.delete.confirm`)})]})]})})]})}var XP=la(`/account/profile`)({component:ZP});function ZP(){let{t:e}=vt(),t=Qg(),{user:n,refresh:r}=eN(),[i,a]=(0,j.useState)(n?.name??``),[o,s]=(0,j.useState)(n?.image??null),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(!1),f=(0,j.useRef)(null);(0,j.useEffect)(()=>{a(n?.name??``),s(n?.image??null)},[n?.id,n?.name,n?.image]);let p=async n=>{n.preventDefault(),l(!0);try{await t.auth.updateUser({name:i,image:o}),await r(),K({title:e(`profile.updated`)})}catch(t){K({title:e(`profile.updateFailed`),description:t.message,variant:`destructive`})}finally{l(!1)}},m=()=>f.current?.click(),h=async n=>{let i=n.target.files?.[0];if(n.target.value=``,i){d(!0);try{if(!t?.storage?.upload)throw Error(e(`profile.avatarStorageUnavailable`));let n=await t.storage.upload(i,`user`),a=n?.data?.url??n?.url;if(!a)throw Error(`Upload returned no URL`);s(a),await t.auth.updateUser({image:a}),await r(),K({title:e(`profile.avatarUpdated`)})}catch(t){K({title:e(`profile.avatarUploadFailed`),description:t.message,variant:`destructive`})}finally{d(!1)}}},g=(n?.name??n?.email??`?`).split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase();return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl border bg-card`,children:[(0,M.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-24 bg-brand-gradient`,"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-24 opacity-30`,style:{backgroundImage:`radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.4), transparent 60%)`},"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`relative px-5 pb-5 pt-12 sm:px-6 sm:pb-6 sm:pt-16`,children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-end sm:gap-5`,children:[(0,M.jsxs)(GM,{className:`size-20 shrink-0 ring-4 ring-card shadow-md`,children:[o?(0,M.jsx)(KM,{src:o,alt:n?.name??``}):null,(0,M.jsx)(qM,{className:`bg-brand-gradient text-base font-semibold text-primary-foreground`,children:g})]}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,M.jsx)(`h2`,{className:`truncate text-xl font-semibold tracking-tight`,children:n?.name||e(`profile.namePlaceholder`)}),(0,M.jsx)(`p`,{className:`truncate text-sm text-muted-foreground`,children:n?.email})]}),(0,M.jsxs)(Z,{type:`button`,variant:`outline`,size:`sm`,onClick:m,disabled:u,className:`self-start sm:self-auto`,children:[(0,M.jsx)(eb,{className:`mr-2 h-4 w-4`}),e(u?`profile.avatarUploading`:`profile.changeAvatar`)]}),(0,M.jsx)(`input`,{ref:f,type:`file`,accept:`image/*`,className:`hidden`,onChange:h})]})})]}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`profile.title`)}),(0,M.jsx)(TN,{children:e(`profile.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:p,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`profile-email`,children:e(`profile.email`)}),(0,M.jsx)(nS,{id:`profile-email`,value:n?.email??``,disabled:!0})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`profile-name`,children:e(`profile.name`)}),(0,M.jsx)(nS,{id:`profile-name`,value:i,onChange:e=>a(e.target.value),placeholder:e(`profile.namePlaceholder`)})]}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`profile.avatarHint`)}),(0,M.jsx)(Z,{type:`submit`,disabled:c,className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:e(c?`common.saving`:`profile.save`)})]})})]})]})}var QP=la(`/account/linked-accounts`)({component:eF}),$P={google:`Google`,github:`GitHub`,microsoft:`Microsoft`,apple:`Apple`,discord:`Discord`,gitlab:`GitLab`,twitter:`Twitter / X`,facebook:`Facebook`};function eF(){let{t:e}=vt(),t=Qg(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!0),[o,s]=(0,j.useState)(null),c=(0,j.useCallback)(async()=>{if(t?.auth?.accounts){a(!0);try{let e=await t.auth.accounts.list();r(e?.accounts??e?.data??(Array.isArray(e)?e:[]))}catch{r([])}finally{a(!1)}}},[t]);(0,j.useEffect)(()=>{c()},[c]);let l=async n=>{if(confirm(e(`linkedAccounts.unlinkConfirm`,{provider:$P[n.providerId]??n.providerId}))){s(n.id);try{await t.auth.accounts.unlink({providerId:n.providerId,accountId:n.accountId}),K({title:e(`linkedAccounts.unlinked`)}),await c()}catch(t){K({title:e(`linkedAccounts.unlinkFailed`),description:t.message,variant:`destructive`})}finally{s(null)}}},u=async n=>{try{let r=await t.auth.accounts.linkSocial({provider:n,callbackURL:window.location.href}),i=r?.url??r?.data?.url;i?window.location.assign(i):K({title:e(`linkedAccounts.linkFailed`),variant:`destructive`})}catch(t){K({title:e(`linkedAccounts.linkFailed`),description:t.message,variant:`destructive`})}},d=new Set(n.map(e=>e.providerId)),f=Object.keys($P).filter(e=>!d.has(e));return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(lP,{icon:Iy,title:e(`linkedAccounts.title`),description:e(`linkedAccounts.description`)}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`linkedAccounts.connectedTitle`,{defaultValue:`Connected providers`})}),(0,M.jsx)(TN,{children:e(`linkedAccounts.connectedDescription`,{defaultValue:`Sign-in providers currently linked to this account.`})})]}),(0,M.jsxs)(EN,{children:[i&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(qw,{className:`h-12 w-full`}),(0,M.jsx)(qw,{className:`h-12 w-full`})]}),!i&&n.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(Iy,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`linkedAccounts.empty`)})]}),!i&&n.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:n.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(cP,{variant:`secondary`,children:$P[t.providerId]??t.providerId}),t.createdAt&&(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`linkedAccounts.linkedOn`,{date:new Date(t.createdAt).toLocaleDateString()})})]}),(0,M.jsxs)(Z,{variant:`ghost`,size:`sm`,disabled:o===t.id,onClick:()=>l(t),children:[(0,M.jsx)(Fy,{className:`mr-1 h-4 w-4`}),e(`linkedAccounts.unlink`)]})]},t.id))})]})]}),f.length>0&&(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`linkedAccounts.addTitle`)}),(0,M.jsx)(TN,{children:e(`linkedAccounts.addDescription`)})]}),(0,M.jsx)(EN,{children:(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:f.map(e=>(0,M.jsxs)(Z,{variant:`outline`,size:`sm`,onClick:()=>u(e),children:[(0,M.jsx)(Uy,{className:`mr-1 h-3 w-3`}),$P[e]]},e))})})]})]})}function tF(e){let t=Qg(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!1),[o,s]=(0,j.useState)(null),c=(0,j.useCallback)(async()=>{if(!(!e||!t?.organizations)){a(!0),s(null);try{let n=await t.organizations.listMembers(e);r(n?.members??n?.data?.members??(Array.isArray(n)?n:[]))}catch(e){s(e),r([])}finally{a(!1)}}},[t,e]);return(0,j.useEffect)(()=>{c()},[c]),{members:n,loading:i,error:o,reload:c,inviteMember:(0,j.useCallback)(async(n,r=`member`)=>{if(!e||!t?.organizations)throw Error(`Organization ID or client not available`);let i=await t.organizations.invite({email:n,role:r,organizationId:e});return await c(),i},[t,e,c]),removeMember:(0,j.useCallback)(async n=>{if(!e||!t?.organizations?.removeMember)throw Error(`Organization ID or client not available`);let r=await t.organizations.removeMember(e,{memberIdOrEmail:n});return await c(),r},[t,e,c]),updateMemberRole:(0,j.useCallback)(async(n,r)=>{if(!e||!t?.organizations?.updateMemberRole)throw Error(`Organization ID or client not available`);let i=await t.organizations.updateMemberRole(e,{memberId:n,role:r});return await c(),i},[t,e,c])}}function nF(e){let t=Qg(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!1),[o,s]=(0,j.useState)(null),c=(0,j.useCallback)(async()=>{if(!(!e||!t?.organizations?.invitations)){a(!0),s(null);try{let n=await t.organizations.invitations.list(e);r(n?.invitations??n?.data?.invitations??(Array.isArray(n)?n:[]))}catch(e){s(e),r([])}finally{a(!1)}}},[t,e]);return(0,j.useEffect)(()=>{c()},[c]),{invitations:n,loading:i,error:o,reload:c,cancelInvitation:(0,j.useCallback)(async e=>{if(!t?.organizations?.invitations?.cancel)throw Error(`Client not available`);let n=await t.organizations.invitations.cancel(e);return await c(),n},[t,c]),resendInvitation:(0,j.useCallback)(async e=>{if(!t?.organizations?.invitations?.resend)throw Error(`Client not available`);let n=await t.organizations.invitations.resend({id:e.id,email:e.email,role:e.role,organizationId:e.organizationId,teamId:e.teamId??null});return await c(),n},[t,c])}}function rF(){let e=Qg(),[t,n]=(0,j.useState)([]),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null),s=(0,j.useCallback)(async()=>{if(e?.organizations?.invitations?.listMine){i(!0),o(null);try{let t=await e.organizations.invitations.listMine();n(t?.invitations??t?.data?.invitations??(Array.isArray(t)?t:[]))}catch(e){o(e),n([])}finally{i(!1)}}},[e]);return(0,j.useEffect)(()=>{s()},[s]),{invitations:t,loading:r,error:a,reload:s,accept:(0,j.useCallback)(async t=>{let n=await e.organizations.invitations.accept(t);return await s(),n},[e,s]),reject:(0,j.useCallback)(async t=>{let n=await e.organizations.invitations.reject(t);return await s(),n},[e,s])}}var iF=la(`/account/invitations`)({component:aF});function aF(){let{t:e}=vt(),{invitations:t,loading:n,accept:r,reject:i}=rF(),a=t.filter(e=>e.status===`pending`),o=async t=>{try{await r(t),K({title:e(`invitations.accepted`)})}catch(t){K({title:e(`invitations.acceptFailed`),description:t.message,variant:`destructive`})}},s=async t=>{try{await i(t),K({title:e(`invitations.rejected`)})}catch(t){K({title:e(`invitations.rejectFailed`),description:t.message,variant:`destructive`})}};return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(lP,{icon:My,title:e(`invitations.title`),description:e(`invitations.description`),actions:a.length>0?(0,M.jsx)(cP,{variant:`outline`,className:`font-medium`,children:e(`invitations.pendingCount`,{count:a.length,defaultValue:`{{count}} pending`})}):null}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`invitations.pendingTitle`,{defaultValue:`Pending invitations`})}),(0,M.jsx)(TN,{children:e(`invitations.pendingDescription`,{defaultValue:`Accept to join an organization, or reject to remove it from your inbox.`})})]}),(0,M.jsxs)(EN,{children:[n&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(qw,{className:`h-12 w-full`}),(0,M.jsx)(qw,{className:`h-12 w-full`})]}),!n&&a.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(My,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`invitations.empty`)})]}),!n&&a.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:a.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsx)(`div`,{className:`text-sm font-medium`,children:t.organizationId}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,M.jsx)(cP,{variant:`outline`,className:`text-xs`,children:e(`common.roles.${t.role}`)}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`invitations.expires`,{date:new Date(t.expiresAt).toLocaleDateString()})})]})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsxs)(Z,{size:`sm`,onClick:()=>o(t.id),children:[(0,M.jsx)(_y,{className:`mr-1 h-4 w-4`}),e(`invitations.accept`)]}),(0,M.jsxs)(Z,{size:`sm`,variant:`outline`,onClick:()=>s(t.id),children:[(0,M.jsx)(ob,{className:`mr-1 h-4 w-4`}),e(`invitations.reject`)]})]})]},t.id))})]})]})]})}var oF=la(`/accept-invitation/$invitationId`)({component:sF});function sF(){let{t:e}=vt(),{invitationId:t}=oF.useParams(),n=Hi(),r=Qg(),{user:i,loading:a,reloadOrganizations:o}=eN(),[s,c]=(0,j.useState)(!1),[l,u]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{a||i||n({to:`/login`,search:{redirect:`/accept-invitation/${t}`},replace:!0})},[a,i,t,n]),(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10`,children:(0,M.jsx)(`div`,{className:`flex w-full max-w-sm flex-col gap-6`,children:(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl`,children:e(`acceptInvitation.title`)}),(0,M.jsx)(TN,{children:e(`acceptInvitation.description`)})]}),(0,M.jsxs)(EN,{className:`flex flex-col gap-3`,children:[(0,M.jsx)(Z,{className:`w-full`,onClick:async()=>{c(!0);try{await r.organizations.invitations.accept(t),await o().catch(()=>{}),K({title:e(`acceptInvitation.accepted`)}),n({to:`/organizations`})}catch(t){K({title:e(`acceptInvitation.acceptFailed`),description:t.message,variant:`destructive`})}finally{c(!1)}},disabled:s||l,children:e(s?`acceptInvitation.accepting`:`acceptInvitation.accept`)}),(0,M.jsx)(Z,{variant:`outline`,className:`w-full`,onClick:async()=>{u(!0);try{await r.organizations.invitations.reject(t),K({title:e(`acceptInvitation.declined`)}),n({to:`/organizations`})}catch(t){K({title:e(`acceptInvitation.declineFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},disabled:s||l,children:e(l?`acceptInvitation.declining`:`acceptInvitation.decline`)})]})]})})})}var cF=la(`/organizations/$orgId/`)({component:()=>{let{orgId:e}=cF.useParams();return(0,M.jsx)(Ui,{to:`/organizations/$orgId/general`,params:{orgId:e},replace:!0})}}),lF=la(`/account/oauth-applications/`)({component:uF});function uF(){let{t:e}=vt(),t=Hi(),{applications:n,loading:r,reload:i}=SP(),{remove:a,deleting:o}=wP(),[s,c]=(0,j.useState)(null);return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(lP,{icon:Ny,title:e(`oauth.applications.title`),description:e(`oauth.applications.description`),actions:(0,M.jsxs)(Z,{onClick:()=>t({to:`/account/oauth-applications/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:[(0,M.jsx)(Uy,{className:`mr-2 h-4 w-4`}),e(`oauth.applications.new`)]})}),r?(0,M.jsx)(`div`,{className:`space-y-3`,children:[0,1,2].map(e=>(0,M.jsx)(Q,{children:(0,M.jsxs)(EN,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(qw,{className:`size-10 rounded-md`}),(0,M.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,M.jsx)(qw,{className:`h-4 w-40`}),(0,M.jsx)(qw,{className:`h-3 w-64`})]})]})},e))}):n.length===0?(0,M.jsx)(Q,{children:(0,M.jsxs)(EN,{className:`flex flex-col items-center gap-3 p-12 text-center`,children:[(0,M.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-lg bg-brand-gradient-subtle text-primary ring-1 ring-primary/15`,children:(0,M.jsx)(Ny,{className:`h-6 w-6`})}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`font-medium`,children:e(`oauth.applications.emptyTitle`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.emptyDescription`)})]}),(0,M.jsxs)(Z,{onClick:()=>t({to:`/account/oauth-applications/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20`,children:[(0,M.jsx)(Uy,{className:`mr-2 h-4 w-4`}),e(`oauth.applications.register`)]})]})}):(0,M.jsx)(`div`,{className:`grid gap-3`,children:n.map(t=>(0,M.jsx)(Q,{className:`group transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5`,children:(0,M.jsx)(CN,{className:`pb-3`,children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsxs)(ra,{to:`/account/oauth-applications/$clientId`,params:{clientId:t.client_id},className:`flex flex-1 items-center gap-3`,children:[(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-md bg-brand-gradient-subtle text-primary ring-1 ring-primary/15 transition-transform group-hover:scale-105`,children:(0,M.jsx)(Ny,{className:`h-5 w-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(wN,{className:`text-base`,children:t.name}),(0,M.jsx)(TN,{className:`font-mono text-xs`,children:t.client_id})]}),(0,M.jsx)(cP,{variant:`outline`,className:`capitalize`,children:t.type}),t.disabled&&(0,M.jsx)(cP,{variant:`destructive`,children:e(`oauth.applications.disabled`)})]}),(0,M.jsx)(Z,{variant:`ghost`,size:`icon`,className:`text-muted-foreground hover:text-destructive`,onClick:e=>{e.preventDefault(),e.stopPropagation(),c(t)},children:(0,M.jsx)(Qy,{className:`h-4 w-4`})})]})})},t.id))}),(0,M.jsx)(BP,{open:!!s,onOpenChange:e=>!e&&c(null),children:(0,M.jsxs)(UP,{children:[(0,M.jsxs)(WP,{children:[(0,M.jsx)(KP,{children:e(`oauth.applications.deleteDialogTitle`)}),(0,M.jsx)(qP,{children:e(`oauth.applications.deleteDialogDescription`,{name:s?.name??``})})]}),(0,M.jsxs)(GP,{children:[(0,M.jsx)(Z,{variant:`outline`,onClick:()=>c(null),disabled:o,children:e(`common.cancel`)}),(0,M.jsx)(Z,{variant:`destructive`,onClick:async()=>{if(s)try{await a(s.client_id),K({title:e(`oauth.applications.deleted`)}),c(null),await i()}catch(t){K({title:e(`oauth.applications.deleteFailed`),description:t.message,variant:`destructive`})}},disabled:o,children:e(o?`oauth.applications.deleting`:`common.delete`)})]})]})})]})}function dF(e,[t,n]){return Math.min(n,Math.max(t,e))}function fF(e){let t=j.useRef({value:e,previous:e});return j.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var pF=[` `,`Enter`,`ArrowUp`,`ArrowDown`],mF=[` `,`Enter`],hF=`Select`,[gF,_F,vF]=C_(hF),[yF,bF]=m_(hF,[vF,fD]),xF=fD(),[SF,CF]=yF(hF),[wF,TF]=yF(hF),EF=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=xF(t),[g,_]=j.useState(null),[v,y]=j.useState(null),[b,x]=j.useState(!1),S=sk(l),[C,w]=Q_({prop:r,defaultProp:i??!1,onChange:a,caller:hF}),[T,E]=Q_({prop:o,defaultProp:s,onChange:c,caller:hF}),D=j.useRef(null),O=g?m||!!g.closest(`form`):!0,[ee,te]=j.useState(new Set),ne=Array.from(ee).map(e=>e.props.value).join(`;`);return(0,M.jsx)(OD,{...h,children:(0,M.jsxs)(SF,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:pS(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,M.jsx)(gF.Provider,{scope:t,children:(0,M.jsx)(wF,{scope:e.__scopeSelect,onNativeOptionAdd:j.useCallback(e=>{te(t=>new Set(t).add(e))},[]),onNativeOptionRemove:j.useCallback(e=>{te(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,M.jsxs)(xI,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:e=>E(e.target.value),disabled:f,form:m,children:[T===void 0?(0,M.jsx)(`option`,{value:``}):null,Array.from(ee)]},ne):null]})})};EF.displayName=hF;var DF=`SelectTrigger`,OF=j.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=xF(n),o=CF(DF,n),s=o.disabled||r,c=f_(t,o.onTriggerChange),l=_F(n),u=j.useRef(`touch`),[d,f,p]=CI(e=>{let t=l().filter(e=>!e.disabled),n=wI(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,M.jsx)(kD,{asChild:!0,...a,children:(0,M.jsx)(w_.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":SI(o.value)?``:void 0,...i,ref:c,onClick:q(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:q(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:q(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&pF.includes(e.key)&&(m(),e.preventDefault())})})})});OF.displayName=DF;var kF=`SelectValue`,AF=j.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=CF(kF,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=f_(t,c.onValueNodeChange);return U_(()=>{l(u)},[l,u]),(0,M.jsx)(w_.span,{...s,ref:d,style:{pointerEvents:`none`},children:SI(c.value)?(0,M.jsx)(M.Fragment,{children:o}):a})});AF.displayName=kF;var jF=`SelectIcon`,MF=j.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,M.jsx)(w_.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});MF.displayName=jF;var NF=`SelectPortal`,PF=e=>(0,M.jsx)(G_,{asChild:!0,...e});PF.displayName=NF;var FF=`SelectContent`,IF=j.forwardRef((e,t)=>{let n=CF(FF,e.__scopeSelect),[r,i]=j.useState();if(U_(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Gi.createPortal((0,M.jsx)(RF,{scope:e.__scopeSelect,children:(0,M.jsx)(gF.Slot,{scope:e.__scopeSelect,children:(0,M.jsx)(`div`,{children:e.children})})}),t):null}return(0,M.jsx)(HF,{...e,ref:t})});IF.displayName=FF;var LF=10,[RF,zF]=yF(FF),BF=`SelectContentImpl`,VF=g_(`SelectContent.RemoveScroll`),HF=j.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=CF(FF,n),[y,b]=j.useState(null),[x,S]=j.useState(null),C=f_(t,e=>b(e)),[w,T]=j.useState(null),[E,D]=j.useState(null),O=_F(n),[ee,te]=j.useState(!1),ne=j.useRef(!1);j.useEffect(()=>{if(y)return XC(y)},[y]),jS();let re=j.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),ie=j.useCallback(()=>re([w,y]),[re,w,y]);j.useEffect(()=>{ee&&ie()},[ee,ie]);let{onOpenChange:ae,triggerPointerDownPosRef:oe}=v;j.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(oe.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(oe.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||ae(!1),document.removeEventListener(`pointermove`,t),oe.current=null};return oe.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,ae,oe]),j.useEffect(()=>{let e=()=>ae(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[ae]);let[k,se]=CI(e=>{let t=O().filter(e=>!e.disabled),n=wI(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ce=j.useCallback((e,t,n)=>{let r=!ne.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(ne.current=!0))},[v.value]),le=j.useCallback(()=>y?.focus(),[y]),ue=j.useCallback((e,t,n)=>{let r=!ne.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),A=r===`popper`?KF:WF,de=A===KF?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,M.jsx)(RF,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:ce,selectedItem:w,onItemLeave:le,itemTextRefCallback:ue,focusSelectedItem:ie,selectedItemText:E,position:r,isPositioned:ee,searchRef:k,children:(0,M.jsx)(VC,{as:VF,allowPinchZoom:!0,children:(0,M.jsx)(vS,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:q(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,M.jsx)(P_,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,M.jsx)(A,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...de,onPlaced:()=>te(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:q(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&se(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>re(t)),e.preventDefault()}})})})})})})});HF.displayName=BF;var UF=`SelectItemAlignedPosition`,WF=j.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=CF(FF,n),o=zF(FF,n),[s,c]=j.useState(null),[l,u]=j.useState(null),d=f_(t,e=>u(e)),f=_F(n),p=j.useRef(!1),m=j.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=j.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-LF,d=dF(a,[LF,Math.max(LF,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-LF,d=dF(a,[LF,Math.max(LF,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-LF*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-LF,D=c-E,O=g.offsetHeight/2,ee=g.offsetTop+O,te=m+v+ee,ne=x-te;if(te<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=te+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+ne;s.style.height=t+`px`,h.scrollTop=te-E+h.offsetTop}s.style.margin=`${LF}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);U_(()=>y(),[y]);let[b,x]=j.useState();return U_(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,M.jsx)(qF,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:j.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,M.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,M.jsx)(w_.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});WF.displayName=UF;var GF=`SelectPopperPosition`,KF=j.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=LF,...a}=e,o=xF(n);return(0,M.jsx)(AD,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.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)`}})});KF.displayName=GF;var[qF,JF]=yF(FF,{}),YF=`SelectViewport`,XF=j.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=zF(YF,n),o=JF(YF,n),s=f_(t,a.onViewportChange),c=j.useRef(0);return(0,M.jsxs)(M.Fragment,{children:[(0,M.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}),(0,M.jsx)(gF.Slot,{scope:n,children:(0,M.jsx)(w_.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:q(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-LF*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});XF.displayName=YF;var ZF=`SelectGroup`,[QF,$F]=yF(ZF),eI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=pS();return(0,M.jsx)(QF,{scope:n,id:i,children:(0,M.jsx)(w_.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});eI.displayName=ZF;var tI=`SelectLabel`,nI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=$F(tI,n);return(0,M.jsx)(w_.div,{id:i.id,...r,ref:t})});nI.displayName=tI;var rI=`SelectItem`,[iI,aI]=yF(rI),oI=j.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=CF(rI,n),c=zF(rI,n),l=s.value===r,[u,d]=j.useState(a??``),[f,p]=j.useState(!1),m=f_(t,e=>c.itemRefCallback?.(e,r,i)),h=pS(),g=j.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> 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(0,M.jsx)(iI,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:j.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,M.jsx)(gF.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,M.jsx)(w_.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:q(o.onFocus,()=>p(!0)),onBlur:q(o.onBlur,()=>p(!1)),onClick:q(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:q(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:q(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:q(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:q(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:q(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(mF.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});oI.displayName=rI;var sI=`SelectItemText`,cI=j.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=CF(sI,n),s=zF(sI,n),c=aI(sI,n),l=TF(sI,n),[u,d]=j.useState(null),f=f_(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=j.useMemo(()=>(0,M.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return U_(()=>(h(m),()=>g(m)),[h,g,m]),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(w_.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Gi.createPortal(a.children,o.valueNode):null]})});cI.displayName=sI;var lI=`SelectItemIndicator`,uI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return aI(lI,n).isSelected?(0,M.jsx)(w_.span,{"aria-hidden":!0,...r,ref:t}):null});uI.displayName=lI;var dI=`SelectScrollUpButton`,fI=j.forwardRef((e,t)=>{let n=zF(dI,e.__scopeSelect),r=JF(dI,e.__scopeSelect),[i,a]=j.useState(!1),o=f_(t,r.onScrollButtonChange);return U_(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,M.jsx)(hI,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});fI.displayName=dI;var pI=`SelectScrollDownButton`,mI=j.forwardRef((e,t)=>{let n=zF(pI,e.__scopeSelect),r=JF(pI,e.__scopeSelect),[i,a]=j.useState(!1),o=f_(t,r.onScrollButtonChange);return U_(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,M.jsx)(hI,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});mI.displayName=pI;var hI=j.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=zF(`SelectScrollButton`,n),o=j.useRef(null),s=_F(n),c=j.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return j.useEffect(()=>()=>c(),[c]),U_(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,M.jsx)(w_.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:q(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:q(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:q(i.onPointerLeave,()=>{c()})})}),gI=`SelectSeparator`,_I=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,M.jsx)(w_.div,{"aria-hidden":!0,...r,ref:t})});_I.displayName=gI;var vI=`SelectArrow`,yI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=xF(n),a=CF(vI,n),o=zF(vI,n);return a.open&&o.position===`popper`?(0,M.jsx)(jD,{...i,...r,ref:t}):null});yI.displayName=vI;var bI=`SelectBubbleInput`,xI=j.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=j.useRef(null),a=f_(r,i),o=fF(t);return j.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,M.jsx)(w_.select,{...n,style:{...tv,...n.style},ref:a,defaultValue:t})});xI.displayName=bI;function SI(e){return e===``||e===void 0}function CI(e){let t=E_(e),n=j.useRef(``),r=j.useRef(0),i=j.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=j.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return j.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function wI(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=TI(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function TI(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var EI=EF,DI=OF,OI=AF,kI=MF,AI=PF,jI=IF,MI=XF,NI=nI,PI=oI,FI=cI,II=uI,LI=fI,RI=mI,zI=_I,BI=EI,VI=OI,HI=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(DI,{ref:r,className:X(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,M.jsx)(kI,{asChild:!0,children:(0,M.jsx)(vy,{className:`h-4 w-4 opacity-50`})})]}));HI.displayName=DI.displayName;var UI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(LI,{ref:n,className:X(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,M.jsx)(by,{className:`h-4 w-4`})}));UI.displayName=LI.displayName;var WI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(RI,{ref:n,className:X(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,M.jsx)(vy,{className:`h-4 w-4`})}));WI.displayName=RI.displayName;var GI=j.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,M.jsx)(AI,{children:(0,M.jsxs)(jI,{ref:i,className:X(`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:[(0,M.jsx)(UI,{}),(0,M.jsx)(MI,{className:X(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,M.jsx)(WI,{})]})}));GI.displayName=jI.displayName;var KI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(NI,{ref:n,className:X(`px-2 py-1.5 text-sm font-semibold`,e),...t}));KI.displayName=NI.displayName;var qI=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(PI,{ref:r,className:X(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,M.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)(II,{children:(0,M.jsx)(_y,{className:`h-4 w-4`})})}),(0,M.jsx)(FI,{children:t})]}));qI.displayName=PI.displayName;var JI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(zI,{ref:n,className:X(`-mx-1 my-1 h-px bg-muted`,e),...t}));JI.displayName=zI.displayName;var YI=la(`/organizations/$orgId/teams`)({component:XI});function XI(){let{t:e}=vt(),{orgId:t}=YI.useParams(),n=Qg(),{members:r}=tF(t),[i,a]=(0,j.useState)([]),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(null),[g,_]=(0,j.useState)([]),[v,y]=(0,j.useState)(!1),[b,x]=(0,j.useState)(!1),[S,C]=(0,j.useState)(``),w=(0,j.useCallback)(async()=>{if(n?.organizations?.teams){s(!0);try{a((await n.organizations.teams.list(t))?.teams??[])}catch{a([])}finally{s(!1)}}},[n,t]);(0,j.useEffect)(()=>{w()},[w]);let T=(0,j.useCallback)(async e=>{if(n?.organizations?.teams){y(!0);try{_((await n.organizations.teams.listMembers(e))?.members??[])}catch{_([])}finally{y(!1)}}},[n]);(0,j.useEffect)(()=>{m&&T(m)},[m,T]);let E=async r=>{if(r.preventDefault(),u.trim()){p(!0);try{await n.organizations.teams.create({name:u.trim(),organizationId:t}),K({title:e(`teams.created`)}),l(!1),d(``),await w()}catch(t){K({title:e(`teams.createFailed`),description:t.message,variant:`destructive`})}finally{p(!1)}}},D=async r=>{if(confirm(e(`teams.deleteConfirm`,{name:r.name})))try{await n.organizations.teams.delete({teamId:r.id,organizationId:t}),K({title:e(`teams.deleted`)}),m===r.id&&h(null),await w()}catch(t){K({title:e(`teams.deleteFailed`),description:t.message,variant:`destructive`})}},O=async()=>{if(!(!m||!S))try{await n.organizations.teams.addMember({teamId:m,userId:S}),K({title:e(`teams.memberAdded`)}),x(!1),C(``),await T(m)}catch(t){K({title:e(`teams.addMemberFailed`),description:t.message,variant:`destructive`})}},ee=async(t,r)=>{try{await n.organizations.teams.removeMember({teamId:t,userId:r}),K({title:e(`teams.memberRemoved`)}),await T(t)}catch(t){K({title:e(`teams.removeMemberFailed`),description:t.message,variant:`destructive`})}},te=Object.fromEntries(r.map(e=>[e.userId,e])),ne=new Set(g.map(e=>e.userId)),re=r.filter(e=>!ne.has(e.userId));return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(Q,{children:[(0,M.jsx)(CN,{children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`teams.title`,{count:i.length})}),(0,M.jsx)(TN,{children:e(`teams.description`)})]}),(0,M.jsxs)(Z,{size:`sm`,onClick:()=>l(!0),children:[(0,M.jsx)(Uy,{className:`mr-2 h-4 w-4`}),e(`teams.create`)]})]})}),(0,M.jsxs)(EN,{children:[o&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(qw,{className:`h-12 w-full`}),(0,M.jsx)(qw,{className:`h-12 w-full`})]}),!o&&i.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(ib,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`teams.empty`)})]}),!o&&i.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:i.map(t=>(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`flex-1 text-left`,onClick:()=>h(m===t.id?null:t.id),children:[(0,M.jsx)(`div`,{className:`font-medium text-sm`,children:t.name}),t.createdAt&&(0,M.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:new Date(t.createdAt).toLocaleDateString()})]}),(0,M.jsxs)(rM,{children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsx)(Z,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,M.jsx)(Oy,{className:`h-4 w-4`})})}),(0,M.jsx)(sM,{align:`end`,children:(0,M.jsxs)(cM,{className:`text-destructive`,onClick:()=>D(t),children:[(0,M.jsx)(Qy,{className:`mr-2 h-4 w-4`}),e(`teams.delete`)]})})]})]}),m===t.id&&(0,M.jsxs)(`div`,{className:`pb-3 pl-4 border-l-2 ml-2 space-y-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e(`teams.members`,{count:g.length})}),(0,M.jsxs)(Z,{size:`sm`,variant:`outline`,onClick:()=>x(!0),children:[(0,M.jsx)(nb,{className:`mr-1 h-3 w-3`}),e(`teams.addMember`)]})]}),v&&(0,M.jsx)(qw,{className:`h-8 w-full`}),!v&&g.length===0&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`teams.noMembers`)}),!v&&g.map(e=>{let n=te[e.userId];return(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,M.jsx)(`span`,{className:`text-sm`,children:n?.user?.name||n?.user?.email||e.userId}),(0,M.jsx)(Z,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:()=>ee(t.id,e.userId),children:(0,M.jsx)(tb,{className:`h-3 w-3`})})]},e.id)})]})]},t.id))})]})]}),(0,M.jsx)(BP,{open:c,onOpenChange:l,children:(0,M.jsxs)(UP,{children:[(0,M.jsxs)(WP,{children:[(0,M.jsx)(KP,{children:e(`teams.createTitle`)}),(0,M.jsx)(qP,{children:e(`teams.createDescription`)})]}),(0,M.jsxs)(`form`,{onSubmit:E,children:[(0,M.jsx)(`div`,{className:`space-y-4 py-4`,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`team-name`,children:e(`teams.nameLabel`)}),(0,M.jsx)(nS,{id:`team-name`,required:!0,placeholder:e(`teams.namePlaceholder`),value:u,onChange:e=>d(e.target.value)})]})}),(0,M.jsxs)(GP,{children:[(0,M.jsx)(Z,{variant:`outline`,type:`button`,onClick:()=>l(!1),children:e(`common.cancel`)}),(0,M.jsx)(Z,{type:`submit`,disabled:f,children:e(f?`common.saving`:`teams.create`)})]})]})]})}),(0,M.jsx)(BP,{open:b,onOpenChange:x,children:(0,M.jsxs)(UP,{children:[(0,M.jsxs)(WP,{children:[(0,M.jsx)(KP,{children:e(`teams.addMemberTitle`)}),(0,M.jsx)(qP,{children:e(`teams.addMemberDescription`)})]}),(0,M.jsx)(`div`,{className:`space-y-4 py-4`,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{children:e(`teams.selectMember`)}),(0,M.jsxs)(BI,{value:S,onValueChange:C,children:[(0,M.jsx)(HI,{children:(0,M.jsx)(VI,{placeholder:e(`teams.selectMemberPlaceholder`)})}),(0,M.jsx)(GI,{children:re.map(e=>(0,M.jsx)(qI,{value:e.userId,children:e.user?.name||e.user?.email||e.userId},e.userId))})]})]})}),(0,M.jsxs)(GP,{children:[(0,M.jsx)(Z,{variant:`outline`,onClick:()=>x(!1),children:e(`common.cancel`)}),(0,M.jsx)(Z,{onClick:O,disabled:!S,children:e(`teams.addMember`)})]})]})})]})}var ZI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`textarea`,{className:X(`flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));ZI.displayName=`Textarea`;var QI=la(`/organizations/$orgId/members`)({component:$I});function $I(){let{t:e}=vt(),{orgId:t}=QI.useParams(),{organizations:n}=tN(),{user:r}=eN(),i=Qg(),a=n.find(e=>e.id===t),{members:o,loading:s,inviteMember:c,removeMember:l,updateMemberRole:u}=tF(t),{invitations:d,loading:f,cancelInvitation:p,resendInvitation:m}=nF(t),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(!1),[y,b]=(0,j.useState)(``),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(`member`),[T,E]=(0,j.useState)(!1),[D,O]=(0,j.useState)(!1),ee=d.filter(e=>e.status===`pending`),te=o.find(e=>e.userId===r?.id),ne=te?.role===`owner`||te?.role===`admin`,re=async()=>{let t=_?x.split(/[,;\n]+/).map(e=>e.trim()).filter(Boolean):[y.trim()].filter(Boolean);if(t.length===0){K({title:e(`organizations.members.emailRequired`),variant:`destructive`});return}E(!0);let n=0;try{for(let e of t)try{await c(e,C)}catch{n++}n>0&&n<t.length?K({title:e(`organizations.members.invitePartialSuccess`,{sent:t.length-n,failed:n}),variant:`destructive`}):n===t.length?K({title:e(`organizations.members.inviteFailed`),variant:`destructive`}):K({title:e(`organizations.members.invitationSent`)}),g(!1),b(``),S(``),w(`member`)}finally{E(!1)}},ie=async(t,n)=>{if(confirm(e(`organizations.members.removeConfirm`,{name:n})))try{await l(t),K({title:e(`organizations.members.memberRemoved`)})}catch(t){K({title:e(`organizations.members.removeFailed`),description:t.message,variant:`destructive`})}},ae=async(t,n)=>{try{await u(t,n),K({title:e(`organizations.members.roleUpdated`)})}catch(t){K({title:e(`organizations.members.roleUpdateFailed`),description:t.message,variant:`destructive`})}},oe=async()=>{if(confirm(e(`organizations.members.leaveConfirm`,{org:a?.name??t}))){O(!0);try{await i.organizations.leave(t),K({title:e(`organizations.members.leftOrg`)}),window.location.assign(`/`)}catch(t){K({title:e(`organizations.members.leaveFailed`),description:t.message,variant:`destructive`})}finally{O(!1)}}},k=async(t,n)=>{if(confirm(e(`organizations.members.cancelConfirm`,{email:n})))try{await p(t),K({title:e(`organizations.members.invitationCanceled`)})}catch(t){K({title:e(`organizations.members.cancelFailed`),description:t.message,variant:`destructive`})}},se=async t=>{try{await m(t),K({title:e(`organizations.members.invitationResent`)})}catch(t){K({title:e(`organizations.members.resendFailed`),description:t.message,variant:`destructive`})}},ce=async t=>{let n=`${window.location.origin}/accept-invitation/${t}`;try{await navigator.clipboard.writeText(n),K({title:e(`organizations.members.linkCopied`)})}catch{K({title:e(`organizations.members.linkCopyFailed`),variant:`destructive`})}};return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(Q,{children:[(0,M.jsx)(CN,{children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`organizations.members.title`,{count:o.length})}),(0,M.jsx)(TN,{children:e(`organizations.members.description`)})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[te&&te.role!==`owner`&&(0,M.jsxs)(Z,{size:`sm`,variant:`outline`,onClick:oe,disabled:D,children:[(0,M.jsx)(Ly,{className:`mr-2 h-4 w-4`}),e(`organizations.members.leave`)]}),ne&&(0,M.jsxs)(Z,{size:`sm`,onClick:()=>g(!0),children:[(0,M.jsx)(nb,{className:`mr-2 h-4 w-4`}),e(`organizations.members.invite`)]})]})]})}),(0,M.jsxs)(EN,{children:[s&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.members.loadingMembers`)}),!s&&o.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(ab,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`organizations.members.empty`)})]}),!s&&o.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:o.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsxs)(`div`,{className:`font-medium text-sm`,children:[t.user?.name||t.user?.email||t.userId,t.userId===r?.id&&(0,M.jsx)(cP,{variant:`secondary`,className:`ml-2 text-xs`,children:e(`organizations.members.you`)})]}),t.user?.email&&(0,M.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.user.email})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ne&&t.role!==`owner`&&t.userId!==r?.id?(0,M.jsxs)(BI,{value:t.role,onValueChange:e=>ae(t.id,e),children:[(0,M.jsx)(HI,{className:`h-7 w-24 text-xs`,children:(0,M.jsx)(VI,{})}),(0,M.jsxs)(GI,{children:[(0,M.jsx)(qI,{value:`admin`,children:e(`common.roles.admin`)}),(0,M.jsx)(qI,{value:`member`,children:e(`common.roles.member`)})]})]}):(0,M.jsx)(cP,{variant:`secondary`,className:`text-xs`,children:e(`common.roles.${t.role??`member`}`)}),ne&&t.role!==`owner`&&t.userId!==r?.id&&(0,M.jsxs)(rM,{children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsx)(Z,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,M.jsx)(Oy,{className:`h-4 w-4`})})}),(0,M.jsx)(sM,{align:`end`,children:(0,M.jsxs)(cM,{className:`text-destructive`,onClick:()=>ie(t.id,t.user?.name||t.user?.email||t.userId),children:[(0,M.jsx)(Qy,{className:`mr-2 h-4 w-4`}),e(`organizations.members.removeMember`)]})})]})]})]},t.id))})]})]}),(0,M.jsxs)(Q,{children:[(0,M.jsx)(CN,{children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`organizations.members.pendingTitle`,{count:ee.length})}),(0,M.jsx)(TN,{children:e(`organizations.members.pendingDescription`)})]}),ne&&(0,M.jsxs)(Z,{size:`sm`,variant:`outline`,onClick:()=>g(!0),children:[(0,M.jsx)(nb,{className:`mr-2 h-4 w-4`}),e(`organizations.members.sendInvitation`)]})]})}),(0,M.jsxs)(EN,{children:[f&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.members.loadingInvitations`)}),!f&&ee.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(zy,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`organizations.members.noPending`)})]}),!f&&ee.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:ee.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsx)(`div`,{className:`font-medium text-sm`,children:t.email}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,M.jsx)(cP,{variant:`outline`,className:`text-xs`,children:e(`common.roles.${t.role}`)}),(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-1`,children:[(0,M.jsx)(Ey,{className:`h-3 w-3`}),e(`organizations.members.expires`,{date:new Date(t.expiresAt).toLocaleDateString()})]})]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(Z,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,title:e(`organizations.members.copyLink`),onClick:()=>ce(t.id),children:(0,M.jsx)(Dy,{className:`h-4 w-4`})}),(0,M.jsx)(Z,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,title:e(`organizations.members.resend`),onClick:()=>se(t),children:(0,M.jsx)(Wy,{className:`h-4 w-4`})}),(0,M.jsx)(Z,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,title:e(`organizations.members.cancel`),onClick:()=>k(t.id,t.email),children:(0,M.jsx)(ob,{className:`h-4 w-4`})})]})]},t.id))})]})]}),(0,M.jsx)(BP,{open:h,onOpenChange:g,children:(0,M.jsxs)(UP,{children:[(0,M.jsxs)(WP,{children:[(0,M.jsx)(KP,{children:e(`organizations.members.inviteDialogTitle`)}),(0,M.jsx)(qP,{children:e(`organizations.members.inviteDialogDescription`,{organization:a?.name??``})})]}),(0,M.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(Z,{type:`button`,variant:_?`outline`:`default`,size:`sm`,onClick:()=>v(!1),children:e(`organizations.members.singleInvite`)}),(0,M.jsx)(Z,{type:`button`,variant:_?`default`:`outline`,size:`sm`,onClick:()=>v(!0),children:e(`organizations.members.bulkInvite`)})]}),_?(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{children:e(`organizations.members.bulkEmails`)}),(0,M.jsx)(ZI,{placeholder:e(`organizations.members.bulkEmailsPlaceholder`),rows:5,value:x,onChange:e=>S(e.target.value)}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.members.bulkEmailsHint`)})]}):(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`invite-email`,children:e(`organizations.members.email`)}),(0,M.jsx)(nS,{id:`invite-email`,type:`email`,placeholder:e(`organizations.members.emailPlaceholder`),value:y,onChange:e=>b(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`role`,children:e(`organizations.members.role`)}),(0,M.jsxs)(BI,{value:C,onValueChange:w,children:[(0,M.jsx)(HI,{id:`role`,children:(0,M.jsx)(VI,{})}),(0,M.jsxs)(GI,{children:[(0,M.jsx)(qI,{value:`owner`,children:e(`common.roles.owner`)}),(0,M.jsx)(qI,{value:`admin`,children:e(`common.roles.admin`)}),(0,M.jsx)(qI,{value:`member`,children:e(`common.roles.member`)})]})]})]})]}),(0,M.jsxs)(GP,{children:[(0,M.jsx)(Z,{variant:`outline`,onClick:()=>g(!1),disabled:T,children:e(`common.cancel`)}),(0,M.jsx)(Z,{onClick:re,disabled:T,children:e(T?`organizations.members.sending`:`organizations.members.sendInvitation`)})]})]})})]})}var eL=la(`/organizations/$orgId/general`)({component:tL});function tL(){let{t:e}=vt(),{orgId:t}=eL.useParams(),n=Hi(),{organizations:r}=tN(),{session:i,user:a,setActiveOrganization:o}=eN(),s=r.find(e=>e.id===t),{members:c}=tF(t),{invitations:l}=nF(t),{remove:u,deleting:d}=iN(),{update:f,updating:p}=rN(),[m,h]=(0,j.useState)(``),[g,_]=(0,j.useState)(``),[v,y]=(0,j.useState)(``),[b,x]=(0,j.useState)(!1),[S,C]=(0,j.useState)(``);(0,j.useEffect)(()=>{h(s?.name??``),_(s?.slug??``),y(s?.logo??``)},[s?.id,s?.name,s?.slug,s?.logo]);let w=i?.activeOrganizationId===t,T=l.filter(e=>e.status===`pending`),E=(a?c.find(e=>e.userId===a.id):void 0)?.role??null,D=E===`owner`||E===`admin`,O=D&&s!=null&&(m.trim()!==(s.name??``)||g.trim()!==(s.slug??``)||v.trim()!==(s.logo??``));return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[w&&(0,M.jsx)(cP,{variant:`outline`,children:e(`organizations.active`)}),E&&(0,M.jsx)(cP,{variant:`secondary`,className:`capitalize`,children:e(`common.roles.${E}`)})]}),!w&&(0,M.jsx)(Z,{size:`sm`,variant:`outline`,onClick:async()=>{try{await o(t),K({title:e(`organizations.general.switched`)})}catch(t){K({title:e(`organizations.general.switchFailed`),description:t.message,variant:`destructive`})}},children:e(`organizations.general.setActive`)})]}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{children:e(`organizations.general.detailsTitle`)}),(0,M.jsx)(TN,{children:e(D?`organizations.general.detailsDescription`:`organizations.general.detailsReadOnly`)})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`org-name`,children:e(`organizations.new.name`)}),(0,M.jsx)(nS,{id:`org-name`,value:m,onChange:e=>h(e.target.value),disabled:!D||p,placeholder:e(`organizations.general.namePlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`org-slug`,children:e(`organizations.new.slug`)}),(0,M.jsx)(nS,{id:`org-slug`,value:g,onChange:e=>_(e.target.value),disabled:!D||p,placeholder:e(`organizations.general.slugPlaceholder`),className:`font-mono text-sm`}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.general.slugHint`)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`org-logo`,children:e(`organizations.general.logo`)}),(0,M.jsx)(nS,{id:`org-logo`,value:v,onChange:e=>y(e.target.value),disabled:!D||p,placeholder:e(`organizations.general.logoPlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`flex justify-between border-t pt-4 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`organizations.general.organizationId`)}),(0,M.jsx)(`code`,{className:`font-mono`,children:t})]})]}),D&&(0,M.jsxs)(EN,{className:`flex justify-end gap-2 border-t pt-4`,children:[(0,M.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:()=>{h(s?.name??``),_(s?.slug??``),y(s?.logo??``)},disabled:!O||p,children:e(`organizations.general.reset`)}),(0,M.jsxs)(Z,{size:`sm`,onClick:async()=>{if(!s||!D||!O)return;let n=m.trim();if(!n){K({title:e(`organizations.general.nameRequired`),variant:`destructive`});return}try{await f(t,{name:n,slug:g.trim()||void 0,logo:v.trim()||void 0}),K({title:e(`organizations.general.updated`)})}catch(t){K({title:e(`organizations.general.updateFailed`),description:t.message,variant:`destructive`})}},disabled:!O||p,children:[(0,M.jsx)(Gy,{className:`mr-2 h-4 w-4`}),e(p?`common.saving`:`organizations.general.save`)]})]})]}),(0,M.jsxs)(Q,{children:[(0,M.jsx)(CN,{children:(0,M.jsx)(wN,{className:`text-base`,children:e(`organizations.general.overviewTitle`)})}),(0,M.jsxs)(EN,{className:`space-y-3 text-sm`,children:[(0,M.jsxs)(`div`,{className:`flex justify-between`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`organizations.general.members`)}),(0,M.jsx)(`span`,{children:c.length})]}),(0,M.jsxs)(`div`,{className:`flex justify-between`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`organizations.general.pendingInvitations`)}),(0,M.jsx)(`span`,{children:T.length})]})]})]}),D&&(0,M.jsxs)(Q,{className:`border-destructive/40`,children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base text-destructive`,children:e(`organizations.general.dangerTitle`)}),(0,M.jsx)(TN,{children:e(`organizations.general.dangerDescription`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(Z,{variant:`destructive`,size:`sm`,onClick:()=>x(!0),disabled:d,children:[(0,M.jsx)(Qy,{className:`mr-2 h-4 w-4`}),e(`organizations.general.delete`)]})})]}),(0,M.jsx)(BP,{open:b,onOpenChange:e=>{x(e),e||C(``)},children:(0,M.jsxs)(UP,{children:[(0,M.jsxs)(WP,{children:[(0,M.jsx)(KP,{className:`text-destructive`,children:e(`organizations.general.deleteDialogTitle`)}),(0,M.jsx)(qP,{children:e(`organizations.general.deleteDialogDescription`,{name:s?.name??``})})]}),(0,M.jsx)(`div`,{className:`space-y-4 py-2`,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`delete-confirm`,children:e(`organizations.general.deleteDialogLabel`,{name:s?.name??``})}),(0,M.jsx)(nS,{id:`delete-confirm`,value:S,onChange:e=>C(e.target.value),placeholder:s?.name??``,disabled:d})]})}),(0,M.jsxs)(GP,{children:[(0,M.jsx)(Z,{variant:`outline`,onClick:()=>x(!1),disabled:d,children:e(`common.cancel`)}),(0,M.jsx)(Z,{variant:`destructive`,onClick:async()=>{if(s){if(S!==s.name){K({title:e(`organizations.general.confirmationMismatch`),description:e(`organizations.general.confirmationHint`,{name:s.name}),variant:`destructive`});return}try{let r=await u(t),i=r?.warnings,a=r?.deletedProjects??0;K({title:e(`organizations.general.deleted`),description:i?.length?e(`organizations.general.deletedWithWarnings`,{deletedProjects:a,warning:i[0],extraCount:Math.max(i.length-1,0)}):e(`organizations.general.deletedDescription`,{name:s.name,deletedProjects:a}),variant:i?.length?`destructive`:void 0}),x(!1),C(``),n({to:`/organizations`})}catch(t){K({title:e(`organizations.general.deleteFailed`),description:t.message,variant:`destructive`})}}},disabled:d||!s||S!==s.name,children:e(d?`organizations.general.deleting`:`organizations.general.delete`)})]})]})})]})}var nL=la(`/account/oauth-applications/new`)({component:rL});function rL(){let{t:e}=vt(),t=Hi(),{register:n,registering:r}=CP(),[i,a]=(0,j.useState)(``),[o,s]=(0,j.useState)(``),[c,l]=(0,j.useState)(`client_secret_basic`),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(``),[m,h]=(0,j.useState)(null),g=async()=>{let t=i.trim(),r=o.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean);if(!t){K({title:e(`oauth.applications.form.nameRequired`),variant:`destructive`});return}if(r.length===0){K({title:e(`oauth.applications.form.redirectRequired`),variant:`destructive`});return}try{let i=await n({client_name:t,redirect_uris:r,token_endpoint_auth_method:c,...u.trim()?{client_uri:u.trim()}:{},...f.trim()?{logo_uri:f.trim()}:{}});h({client_id:i?.client_id??``,client_secret:i?.client_secret}),K({title:e(`oauth.applications.registered`)})}catch(t){K({title:e(`oauth.applications.registerFailed`),description:t.message,variant:`destructive`})}},_=(t,n)=>{navigator.clipboard.writeText(t).then(()=>K({title:e(`oauth.applications.copied`,{label:n})}),()=>K({title:e(`oauth.applications.copyFailed`,{label:n}),variant:`destructive`}))};return m?(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`oauth.applications.registeredTitle`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.registeredDescription`)})]}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{children:e(`oauth.applications.credentials`)}),(0,M.jsx)(TN,{children:e(`oauth.applications.credentialsDescription`)})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)($,{children:e(`oauth.applications.clientId`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:m.client_id}),(0,M.jsx)(Z,{size:`icon`,variant:`outline`,onClick:()=>_(m.client_id,e(`oauth.applications.clientId`)),children:(0,M.jsx)(Dy,{className:`h-4 w-4`})})]})]}),m.client_secret&&(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)($,{children:e(`oauth.applications.clientSecret`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 break-all rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:m.client_secret}),(0,M.jsx)(Z,{size:`icon`,variant:`outline`,onClick:()=>_(m.client_secret,e(`oauth.applications.clientSecret`)),children:(0,M.jsx)(Dy,{className:`h-4 w-4`})})]}),(0,M.jsx)(`p`,{className:`text-xs text-destructive`,children:e(`oauth.applications.clientSecretWarning`)})]})]})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,M.jsx)(Z,{variant:`outline`,onClick:()=>t({to:`/account/oauth-applications`}),children:e(`oauth.applications.backToList`)}),(0,M.jsx)(Z,{onClick:()=>t({to:`/account/oauth-applications/$clientId`,params:{clientId:m.client_id}}),children:e(`oauth.applications.viewApplication`)})]})]}):(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`oauth.applications.form.title`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.form.description`)})]}),(0,M.jsxs)(Q,{children:[(0,M.jsx)(CN,{children:(0,M.jsxs)(wN,{className:`flex items-center gap-2 text-base`,children:[(0,M.jsx)(Ny,{className:`h-4 w-4`}),e(`oauth.applications.form.details`)]})}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`oauth-name`,children:e(`oauth.applications.form.name`)}),(0,M.jsx)(nS,{id:`oauth-name`,value:i,onChange:e=>a(e.target.value),placeholder:e(`oauth.applications.form.namePlaceholder`),disabled:r})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`oauth-redirect`,children:e(`oauth.applications.form.redirectUris`)}),(0,M.jsx)(ZI,{id:`oauth-redirect`,value:o,onChange:e=>s(e.target.value),placeholder:e(`oauth.applications.form.redirectPlaceholder`),rows:3,disabled:r}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`oauth.applications.form.redirectHint`)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{children:e(`oauth.applications.form.authMethod`)}),(0,M.jsxs)(BI,{value:c,onValueChange:e=>l(e),disabled:r,children:[(0,M.jsx)(HI,{children:(0,M.jsx)(VI,{})}),(0,M.jsxs)(GI,{children:[(0,M.jsx)(qI,{value:`client_secret_basic`,children:e(`oauth.applications.form.authMethodBasic`)}),(0,M.jsx)(qI,{value:`client_secret_post`,children:e(`oauth.applications.form.authMethodPost`)}),(0,M.jsx)(qI,{value:`none`,children:e(`oauth.applications.form.authMethodNone`)})]})]})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`oauth-client-uri`,children:e(`oauth.applications.form.clientUri`)}),(0,M.jsx)(nS,{id:`oauth-client-uri`,value:u,onChange:e=>d(e.target.value),placeholder:e(`oauth.applications.form.clientUriPlaceholder`),disabled:r})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`oauth-logo`,children:e(`oauth.applications.form.logoUri`)}),(0,M.jsx)(nS,{id:`oauth-logo`,value:f,onChange:e=>p(e.target.value),placeholder:e(`oauth.applications.form.logoUriPlaceholder`),disabled:r}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`oauth.applications.form.logoHint`)})]})]})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,M.jsx)(Z,{variant:`ghost`,onClick:()=>t({to:`/account/oauth-applications`}),disabled:r,children:e(`common.cancel`)}),(0,M.jsx)(Z,{onClick:g,disabled:r,children:e(r?`oauth.applications.form.registering`:`oauth.applications.register`)})]})]})}var iL=la(`/account/oauth-applications/$clientId`)({component:aL});function aL(){let{t:e}=vt(),{clientId:t}=iL.useParams(),n=Hi(),{applications:r,loading:i,reload:a}=SP(),{remove:o,deleting:s}=wP(),c=Qg(),l=r.find(e=>e.client_id===t),[u,d]=(0,j.useState)(null);(0,j.useEffect)(()=>{let e=!1;if(!l&&c?.oauth?.applications?.get)return c.oauth.applications.get(t).then(t=>{e||d(t?.data??t)},()=>{}),()=>{e=!0}},[c,t,l]);let f=l??u,[p,m]=(0,j.useState)(!1),h=(t,n)=>{navigator.clipboard.writeText(t).then(()=>K({title:e(`oauth.applications.copied`,{label:n})}),()=>K({title:e(`oauth.applications.copyFailed`,{label:n}),variant:`destructive`}))},g=async()=>{if(f)try{await o(f.client_id),K({title:e(`oauth.applications.deleted`)}),await a(),n({to:`/account/oauth-applications`})}catch(t){K({title:e(`oauth.applications.deleteFailed`),description:t.message,variant:`destructive`})}};if(i&&!f)return(0,M.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:e(`common.loading`)});if(!f)return(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`oauth.applications.notFoundTitle`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.notFoundDescription`)}),(0,M.jsx)(Z,{onClick:()=>n({to:`/account/oauth-applications`}),children:e(`oauth.applications.backToList`)})]});let _=typeof f.redirect_urls==`string`?f.redirect_urls.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean):Array.isArray(f.redirect_urls)?f.redirect_urls:[];return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:f.name}),(0,M.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:f.client_id})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f.type&&(0,M.jsx)(cP,{variant:`outline`,className:`capitalize`,children:f.type}),f.disabled&&(0,M.jsx)(cP,{variant:`destructive`,children:e(`oauth.applications.disabled`)})]})]}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{children:e(`oauth.applications.credentials`)}),(0,M.jsx)(TN,{children:e(`oauth.applications.credentialsDescriptionDetail`)})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)($,{children:e(`oauth.applications.clientId`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:f.client_id}),(0,M.jsx)(Z,{size:`icon`,variant:`outline`,onClick:()=>h(f.client_id,e(`oauth.applications.clientId`)),children:(0,M.jsx)(Dy,{className:`h-4 w-4`})})]})]}),(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)($,{children:e(`oauth.applications.redirectUris`)}),_.length===0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.noRedirectUris`)}):(0,M.jsx)(`ul`,{className:`space-y-1`,children:_.map((e,t)=>(0,M.jsx)(`li`,{className:`rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:e},t))})]})]})]}),(0,M.jsxs)(Q,{className:`border-destructive/40`,children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base text-destructive`,children:e(`oauth.applications.dangerTitle`)}),(0,M.jsx)(TN,{children:e(`oauth.applications.dangerDescription`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(Z,{variant:`destructive`,size:`sm`,onClick:()=>m(!0),disabled:s,children:[(0,M.jsx)(Qy,{className:`mr-2 h-4 w-4`}),e(`oauth.applications.delete`)]})})]}),(0,M.jsx)(BP,{open:p,onOpenChange:m,children:(0,M.jsxs)(UP,{children:[(0,M.jsxs)(WP,{children:[(0,M.jsx)(KP,{className:`text-destructive`,children:e(`oauth.applications.deleteDialogTitle`)}),(0,M.jsx)(qP,{children:e(`oauth.applications.deleteDialogDescription`,{name:f.name})})]}),(0,M.jsxs)(GP,{children:[(0,M.jsx)(Z,{variant:`outline`,onClick:()=>m(!1),disabled:s,children:e(`common.cancel`)}),(0,M.jsx)(Z,{variant:`destructive`,onClick:g,disabled:s,children:e(s?`oauth.applications.deleting`:`common.delete`)})]})]})})]})}var oL=jN.update({id:`/verify-email-prompt`,path:`/verify-email-prompt`,getParentRoute:()=>SN}),sL=NN.update({id:`/verify-email`,path:`/verify-email`,getParentRoute:()=>SN}),cL=zN.update({id:`/setup`,path:`/setup`,getParentRoute:()=>SN}),lL=HN.update({id:`/reset-password`,path:`/reset-password`,getParentRoute:()=>SN}),uL=qN.update({id:`/register`,path:`/register`,getParentRoute:()=>SN}),dL=ZN.update({id:`/login`,path:`/login`,getParentRoute:()=>SN}),fL=tP.update({id:`/forgot-password`,path:`/forgot-password`,getParentRoute:()=>SN}),pL=rP.update({id:`/account`,path:`/account`,getParentRoute:()=>SN}),mL=aP.update({id:`/`,path:`/`,getParentRoute:()=>SN}),hL=uP.update({id:`/organizations/`,path:`/organizations/`,getParentRoute:()=>SN}),gL=fP.update({id:`/`,path:`/`,getParentRoute:()=>pL}),_L=hP.update({id:`/organizations/new`,path:`/organizations/new`,getParentRoute:()=>SN}),vL=bP.update({id:`/organizations/$orgId`,path:`/organizations/$orgId`,getParentRoute:()=>SN}),yL=EP.update({id:`/oauth/consent`,path:`/oauth/consent`,getParentRoute:()=>SN}),bL=kP.update({id:`/auth/device`,path:`/auth/device`,getParentRoute:()=>SN}),xL=MP.update({id:`/two-factor`,path:`/two-factor`,getParentRoute:()=>pL}),SL=LP.update({id:`/sessions`,path:`/sessions`,getParentRoute:()=>pL}),CL=JP.update({id:`/security`,path:`/security`,getParentRoute:()=>pL}),wL=XP.update({id:`/profile`,path:`/profile`,getParentRoute:()=>pL}),TL=QP.update({id:`/linked-accounts`,path:`/linked-accounts`,getParentRoute:()=>pL}),EL=iF.update({id:`/invitations`,path:`/invitations`,getParentRoute:()=>pL}),DL=oF.update({id:`/accept-invitation/$invitationId`,path:`/accept-invitation/$invitationId`,getParentRoute:()=>SN}),OL=cF.update({id:`/`,path:`/`,getParentRoute:()=>vL}),kL=lF.update({id:`/oauth-applications/`,path:`/oauth-applications/`,getParentRoute:()=>pL}),AL=YI.update({id:`/teams`,path:`/teams`,getParentRoute:()=>vL}),jL=QI.update({id:`/members`,path:`/members`,getParentRoute:()=>vL}),ML=eL.update({id:`/general`,path:`/general`,getParentRoute:()=>vL}),NL=nL.update({id:`/oauth-applications/new`,path:`/oauth-applications/new`,getParentRoute:()=>pL}),PL={AccountInvitationsRoute:EL,AccountLinkedAccountsRoute:TL,AccountProfileRoute:wL,AccountSecurityRoute:CL,AccountSessionsRoute:SL,AccountTwoFactorRoute:xL,AccountIndexRoute:gL,AccountOauthApplicationsClientIdRoute:iL.update({id:`/oauth-applications/$clientId`,path:`/oauth-applications/$clientId`,getParentRoute:()=>pL}),AccountOauthApplicationsNewRoute:NL,AccountOauthApplicationsIndexRoute:kL},FL=pL._addFileChildren(PL),IL={OrganizationsOrgIdGeneralRoute:ML,OrganizationsOrgIdMembersRoute:jL,OrganizationsOrgIdTeamsRoute:AL,OrganizationsOrgIdIndexRoute:OL},LL={IndexRoute:mL,AccountRoute:FL,ForgotPasswordRoute:fL,LoginRoute:dL,RegisterRoute:uL,ResetPasswordRoute:lL,SetupRoute:cL,VerifyEmailRoute:sL,VerifyEmailPromptRoute:oL,AcceptInvitationInvitationIdRoute:DL,AuthDeviceRoute:bL,OauthConsentRoute:yL,OrganizationsOrgIdRoute:vL._addFileChildren(IL),OrganizationsNewRoute:_L,OrganizationsIndexRoute:hL},RL=SN._addFileChildren(LL)._addFileTypes();function zL(){let e=`/_account/`;return e.endsWith(`/`)?e.slice(0,-1):e}var BL=wa({routeTree:RL,basepath:zL()});function VL(){return(0,M.jsx)(Da,{router:BL})}var HL=typeof localStorage<`u`&&localStorage.getItem(`account.lang`)||typeof navigator<`u`&&navigator.language||`en`;function UL({children:e}){let{i18n:t,language:n}=yt(),[r,i]=j.useReducer(e=>e+1,0),[a,o]=j.useState(!1);return j.useEffect(()=>{let e=()=>i();t.on(`loaded`,e),t.on(`languageChanged`,e);let n=window.setTimeout(()=>o(!0),1500);return()=>{t.off(`loaded`,e),t.off(`languageChanged`,e),window.clearTimeout(n)}},[t]),a||t.isInitialized&&t.hasResourceBundle?.(n,`translation`)?(0,M.jsx)(M.Fragment,{children:e}):null}Jf.createRoot(document.getElementById(`root`)).render((0,M.jsx)(j.StrictMode,{children:(0,M.jsx)(_t,{config:{defaultLanguage:HL,fallbackLanguage:`en`},loadLanguage:xM,children:(0,M.jsx)(UL,{children:(0,M.jsx)(VL,{})})})}));
package/dist/index.html CHANGED
@@ -50,7 +50,7 @@
50
50
  }
51
51
  @keyframes boot-skeleton-spin { to { transform: rotate(360deg); } }
52
52
  </style>
53
- <script type="module" crossorigin src="/_account/assets/index-QurLU-4z.js"></script>
53
+ <script type="module" crossorigin src="/_account/assets/index-CuR0UrRH.js"></script>
54
54
  <link rel="stylesheet" crossorigin href="/_account/assets/index-DEF2FCrM.css">
55
55
  </head>
56
56
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@objectstack/account",
3
- "version": "7.2.1",
3
+ "version": "7.3.0",
4
4
  "description": "ObjectStack Account - End-user account & organization self-service portal",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -50,9 +50,9 @@
50
50
  "typescript": "^6.0.3",
51
51
  "vite": "^8.0.14",
52
52
  "vitest": "^4.1.7",
53
- "@objectstack/client": "7.2.1",
54
- "@objectstack/client-react": "7.2.1",
55
- "@objectstack/spec": "7.2.1"
53
+ "@objectstack/client": "7.3.0",
54
+ "@objectstack/client-react": "7.3.0",
55
+ "@objectstack/spec": "7.3.0"
56
56
  },
57
57
  "scripts": {
58
58
  "dev": "vite",