const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BillingPortalApp-Dr6DU9j3.js","assets/vendor-BJ87Oh2i.js","assets/react-vendor-Dai7d0mP.js"])))=>i.map(i=>d[i]); var Ds=Object.defineProperty;var Ls=(e,t,r)=>t in e?Ds(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ne=(e,t,r)=>Ls(e,typeof t!="symbol"?t+"":t,r);import{j as u,c as Ms,u as Fs,_ as $s,Q as zs,a as Bs}from"./vendor-BJ87Oh2i.js";import{a as It,r as c,o as N,v as Cn,R as Tn,u as Cr,b as Rn,L as Us,B as Hs,d as Ws,e as vt}from"./react-vendor-Dai7d0mP.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(o){if(o.ep)return;o.ep=!0;const s=r(o);fetch(o.href,s)}})();var Sn,Xr=It;Sn=Xr.createRoot,Xr.hydrateRoot;const Vs=1,Ks=1e6;let Qt=0;function Gs(){return Qt=(Qt+1)%Number.MAX_SAFE_INTEGER,Qt.toString()}const Zt=new Map,Jr=e=>{if(Zt.has(e))return;const t=setTimeout(()=>{Zt.delete(e),lt({type:"REMOVE_TOAST",toastId:e})},Ks);Zt.set(e,t)},Ys=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,Vs)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?Jr(r):e.toasts.forEach(n=>{Jr(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Ct=[];let Tt={toasts:[]};function lt(e){Tt=Ys(Tt,e),Ct.forEach(t=>{t(Tt)})}function qs({...e}){const t=Gs(),r=o=>lt({type:"UPDATE_TOAST",toast:{...o,id:t}}),n=()=>lt({type:"DISMISS_TOAST",toastId:t});return lt({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||n()}}}),{id:t,dismiss:n,update:r}}function Xs(){const[e,t]=c.useState(Tt);return c.useEffect(()=>(Ct.push(t),()=>{const r=Ct.indexOf(t);r>-1&&Ct.splice(r,1)}),[e]),{...e,toast:qs,dismiss:r=>lt({type:"DISMISS_TOAST",toastId:r})}}function G(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o.defaultPrevented)return t?.(o)}}function Qr(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Nn(...e){return t=>{let r=!1;const n=e.map(o=>{const s=Qr(o,t);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let o=0;o{const{children:a,...i}=s,f=c.useMemo(()=>i,Object.values(i));return u.jsx(r.Provider,{value:f,children:a})};n.displayName=e+"Provider";function o(s){const a=c.useContext(r);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[n,o]}function Ze(e,t=[]){let r=[];function n(s,a){const i=c.createContext(a),f=r.length;r=[...r,a];const d=m=>{const{scope:g,children:l,...y}=m,v=g?.[e]?.[f]||i,h=c.useMemo(()=>y,Object.values(y));return u.jsx(v.Provider,{value:h,children:l})};d.displayName=s+"Provider";function p(m,g){const l=g?.[e]?.[f]||i,y=c.useContext(l);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[d,p]}const o=()=>{const s=r.map(a=>c.createContext(a));return function(i){const f=i?.[e]||s;return c.useMemo(()=>({[`__scope${e}`]:{...i,[e]:f}}),[i,f])}};return o.scopeName=e,[n,Js(o,...t)]}function Js(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const a=n.reduce((i,{useScope:f,scopeName:d})=>{const m=f(s)[`__scope${d}`];return{...i,...m}},{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}function St(e){const t=Zs(e),r=c.forwardRef((n,o)=>{const{children:s,...a}=n,i=c.Children.toArray(s),f=i.find(ta);if(f){const d=f.props.children,p=i.map(m=>m===f?c.Children.count(d)>1?c.Children.only(null):c.isValidElement(d)?d.props.children:null:m);return u.jsx(t,{...a,ref:o,children:c.isValidElement(d)?c.cloneElement(d,void 0,p):null})}return u.jsx(t,{...a,ref:o,children:s})});return r.displayName=`${e}.Slot`,r}var Qs=St("Slot");function Zs(e){const t=c.forwardRef((r,n)=>{const{children:o,...s}=r;if(c.isValidElement(o)){const a=na(o),i=ra(s,o.props);return o.type!==c.Fragment&&(i.ref=n?Nn(n,a):a),c.cloneElement(o,i)}return c.Children.count(o)>1?c.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Pn=Symbol("radix.slottable");function ea(e){const t=({children:r})=>u.jsx(u.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Pn,t}function ta(e){return c.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Pn}function ra(e,t){const r={...t};for(const n in t){const o=e[n],s=t[n];/^on[A-Z]/.test(n)?o&&s?r[n]=(...i)=>{const f=s(...i);return o(...i),f}:o&&(r[n]=o):n==="style"?r[n]={...o,...s}:n==="className"&&(r[n]=[o,s].filter(Boolean).join(" "))}return{...e,...r}}function na(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function An(e){const t=e+"CollectionProvider",[r,n]=Ze(t),[o,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:h,children:b}=v,x=N.useRef(null),w=N.useRef(new Map).current;return u.jsx(o,{scope:h,itemMap:w,collectionRef:x,children:b})};a.displayName=t;const i=e+"CollectionSlot",f=St(i),d=N.forwardRef((v,h)=>{const{scope:b,children:x}=v,w=s(i,b),T=ce(h,w.collectionRef);return u.jsx(f,{ref:T,children:x})});d.displayName=i;const p=e+"CollectionItemSlot",m="data-radix-collection-item",g=St(p),l=N.forwardRef((v,h)=>{const{scope:b,children:x,...w}=v,T=N.useRef(null),S=ce(h,T),E=s(p,b);return N.useEffect(()=>(E.itemMap.set(T,{ref:T,...w}),()=>void E.itemMap.delete(T))),u.jsx(g,{[m]:"",ref:S,children:x})});l.displayName=p;function y(v){const h=s(e+"CollectionConsumer",v);return N.useCallback(()=>{const x=h.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${m}]`));return Array.from(h.itemMap.values()).sort((E,C)=>w.indexOf(E.ref.current)-w.indexOf(C.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:a,Slot:d,ItemSlot:l},y,n]}var oa=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],J=oa.reduce((e,t)=>{const r=St(`Primitive.${t}`),n=c.forwardRef((o,s)=>{const{asChild:a,...i}=o,f=a?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(f,{...i,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function _n(e,t){e&&It.flushSync(()=>e.dispatchEvent(t))}function Ee(e){const t=c.useRef(e);return c.useEffect(()=>{t.current=e}),c.useMemo(()=>(...r)=>t.current?.(...r),[])}function sa(e,t=globalThis?.document){const r=Ee(e);c.useEffect(()=>{const n=o=>{o.key==="Escape"&&r(o)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var aa="DismissableLayer",cr="dismissableLayer.update",ia="dismissableLayer.pointerDownOutside",ca="dismissableLayer.focusOutside",Zr,In=c.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Tr=c.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:i,...f}=e,d=c.useContext(In),[p,m]=c.useState(null),g=p?.ownerDocument??globalThis?.document,[,l]=c.useState({}),y=ce(t,C=>m(C)),v=Array.from(d.layers),[h]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(h),x=p?v.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,T=x>=b,S=da(C=>{const R=C.target,I=[...d.branches].some(j=>j.contains(R));!T||I||(o?.(C),a?.(C),C.defaultPrevented||i?.())},g),E=ua(C=>{const R=C.target;[...d.branches].some(j=>j.contains(R))||(s?.(C),a?.(C),C.defaultPrevented||i?.())},g);return sa(C=>{x===d.layers.size-1&&(n?.(C),!C.defaultPrevented&&i&&(C.preventDefault(),i()))},g),c.useEffect(()=>{if(p)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Zr=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),en(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Zr)}},[p,g,r,d]),c.useEffect(()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),en())},[p,d]),c.useEffect(()=>{const C=()=>l({});return document.addEventListener(cr,C),()=>document.removeEventListener(cr,C)},[]),u.jsx(J.div,{...f,ref:y,style:{pointerEvents:w?T?"auto":"none":void 0,...e.style},onFocusCapture:G(e.onFocusCapture,E.onFocusCapture),onBlurCapture:G(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:G(e.onPointerDownCapture,S.onPointerDownCapture)})});Tr.displayName=aa;var la="DismissableLayerBranch",On=c.forwardRef((e,t)=>{const r=c.useContext(In),n=c.useRef(null),o=ce(t,n);return c.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),u.jsx(J.div,{...e,ref:o})});On.displayName=la;function da(e,t=globalThis?.document){const r=Ee(e),n=c.useRef(!1),o=c.useRef(()=>{});return c.useEffect(()=>{const s=i=>{if(i.target&&!n.current){let f=function(){kn(ia,r,d,{discrete:!0})};const d={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=f,t.addEventListener("click",o.current,{once:!0})):f()}else t.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function ua(e,t=globalThis?.document){const r=Ee(e),n=c.useRef(!1);return c.useEffect(()=>{const o=s=>{s.target&&!n.current&&kn(ca,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function en(){const e=new CustomEvent(cr);document.dispatchEvent(e)}function kn(e,t,r,{discrete:n}){const o=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?_n(o,s):o.dispatchEvent(s)}var fa=Tr,pa=On,Ce=globalThis?.document?c.useLayoutEffect:()=>{},ma="Portal",jn=c.forwardRef((e,t)=>{const{container:r,...n}=e,[o,s]=c.useState(!1);Ce(()=>s(!0),[]);const a=r||o&&globalThis?.document?.body;return a?Cn.createPortal(u.jsx(J.div,{...n,ref:t}),a):null});jn.displayName=ma;function ha(e,t){return c.useReducer((r,n)=>t[r][n]??r,e)}var Ot=e=>{const{present:t,children:r}=e,n=ga(t),o=typeof r=="function"?r({present:n.isPresent}):c.Children.only(r),s=ce(n.ref,va(o));return typeof r=="function"||n.isPresent?c.cloneElement(o,{ref:s}):null};Ot.displayName="Presence";function ga(e){const[t,r]=c.useState(),n=c.useRef(null),o=c.useRef(e),s=c.useRef("none"),a=e?"mounted":"unmounted",[i,f]=ha(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return c.useEffect(()=>{const d=yt(n.current);s.current=i==="mounted"?d:"none"},[i]),Ce(()=>{const d=n.current,p=o.current;if(p!==e){const g=s.current,l=yt(d);e?f("MOUNT"):l==="none"||d?.display==="none"?f("UNMOUNT"):f(p&&g!==l?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,f]),Ce(()=>{if(t){let d;const p=t.ownerDocument.defaultView??window,m=l=>{const v=yt(n.current).includes(l.animationName);if(l.target===t&&v&&(f("ANIMATION_END"),!o.current)){const h=t.style.animationFillMode;t.style.animationFillMode="forwards",d=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=h)})}},g=l=>{l.target===t&&(s.current=yt(n.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(d),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:c.useCallback(d=>{n.current=d?getComputedStyle(d):null,r(d)},[])}}function yt(e){return e?.animationName||"none"}function va(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var ya=Tn[" useInsertionEffect ".trim().toString()]||Ce;function kt({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[o,s,a]=ba({defaultProp:t,onChange:r}),i=e!==void 0,f=i?e:o;{const p=c.useRef(e!==void 0);c.useEffect(()=>{const m=p.current;m!==i&&console.warn(`${n} is changing from ${m?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=i},[i,n])}const d=c.useCallback(p=>{if(i){const m=xa(p)?p(e):p;m!==e&&a.current?.(m)}else s(p)},[i,e,s,a]);return[f,d]}function ba({defaultProp:e,onChange:t}){const[r,n]=c.useState(e),o=c.useRef(r),s=c.useRef(t);return ya(()=>{s.current=t},[t]),c.useEffect(()=>{o.current!==r&&(s.current?.(r),o.current=r)},[r,o]),[r,n,s]}function xa(e){return typeof e=="function"}var wa=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Ea="VisuallyHidden",jt=c.forwardRef((e,t)=>u.jsx(J.span,{...e,ref:t,style:{...wa,...e.style}}));jt.displayName=Ea;var Ca=jt,Rr="ToastProvider",[Sr,Ta,Ra]=An("Toast"),[Dn,uu]=Ze("Toast",[Ra]),[Sa,Dt]=Dn(Rr),Ln=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:o="right",swipeThreshold:s=50,children:a}=e,[i,f]=c.useState(null),[d,p]=c.useState(0),m=c.useRef(!1),g=c.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${Rr}\`. Expected non-empty \`string\`.`),u.jsx(Sr.Provider,{scope:t,children:u.jsx(Sa,{scope:t,label:r,duration:n,swipeDirection:o,swipeThreshold:s,toastCount:d,viewport:i,onViewportChange:f,onToastAdd:c.useCallback(()=>p(l=>l+1),[]),onToastRemove:c.useCallback(()=>p(l=>l-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:g,children:a})})};Ln.displayName=Rr;var Mn="ToastViewport",Na=["F8"],lr="toast.viewportPause",dr="toast.viewportResume",Fn=c.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=Na,label:o="Notifications ({hotkey})",...s}=e,a=Dt(Mn,r),i=Ta(r),f=c.useRef(null),d=c.useRef(null),p=c.useRef(null),m=c.useRef(null),g=ce(t,m,a.onViewportChange),l=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=a.toastCount>0;c.useEffect(()=>{const h=b=>{n.length!==0&&n.every(w=>b[w]||b.code===w)&&m.current?.focus()};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[n]),c.useEffect(()=>{const h=f.current,b=m.current;if(y&&h&&b){const x=()=>{if(!a.isClosePausedRef.current){const E=new CustomEvent(lr);b.dispatchEvent(E),a.isClosePausedRef.current=!0}},w=()=>{if(a.isClosePausedRef.current){const E=new CustomEvent(dr);b.dispatchEvent(E),a.isClosePausedRef.current=!1}},T=E=>{!h.contains(E.relatedTarget)&&w()},S=()=>{h.contains(document.activeElement)||w()};return h.addEventListener("focusin",x),h.addEventListener("focusout",T),h.addEventListener("pointermove",x),h.addEventListener("pointerleave",S),window.addEventListener("blur",x),window.addEventListener("focus",w),()=>{h.removeEventListener("focusin",x),h.removeEventListener("focusout",T),h.removeEventListener("pointermove",x),h.removeEventListener("pointerleave",S),window.removeEventListener("blur",x),window.removeEventListener("focus",w)}}},[y,a.isClosePausedRef]);const v=c.useCallback(({tabbingDirection:h})=>{const x=i().map(w=>{const T=w.ref.current,S=[T,...za(T)];return h==="forwards"?S:S.reverse()});return(h==="forwards"?x.reverse():x).flat()},[i]);return c.useEffect(()=>{const h=m.current;if(h){const b=x=>{const w=x.altKey||x.ctrlKey||x.metaKey;if(x.key==="Tab"&&!w){const S=document.activeElement,E=x.shiftKey;if(x.target===h&&E){d.current?.focus();return}const I=v({tabbingDirection:E?"backwards":"forwards"}),j=I.findIndex(D=>D===S);er(I.slice(j+1))?x.preventDefault():E?d.current?.focus():p.current?.focus()}};return h.addEventListener("keydown",b),()=>h.removeEventListener("keydown",b)}},[i,v]),u.jsxs(pa,{ref:f,role:"region","aria-label":o.replace("{hotkey}",l),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&u.jsx(ur,{ref:d,onFocusFromOutsideViewport:()=>{const h=v({tabbingDirection:"forwards"});er(h)}}),u.jsx(Sr.Slot,{scope:r,children:u.jsx(J.ol,{tabIndex:-1,...s,ref:g})}),y&&u.jsx(ur,{ref:p,onFocusFromOutsideViewport:()=>{const h=v({tabbingDirection:"backwards"});er(h)}})]})});Fn.displayName=Mn;var $n="ToastFocusProxy",ur=c.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...o}=e,s=Dt($n,r);return u.jsx(jt,{"aria-hidden":!0,tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:a=>{const i=a.relatedTarget;!s.viewport?.contains(i)&&n()}})});ur.displayName=$n;var pt="Toast",Pa="toast.swipeStart",Aa="toast.swipeMove",_a="toast.swipeCancel",Ia="toast.swipeEnd",zn=c.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:o,onOpenChange:s,...a}=e,[i,f]=kt({prop:n,defaultProp:o??!0,onChange:s,caller:pt});return u.jsx(Ot,{present:r||i,children:u.jsx(ja,{open:i,...a,ref:t,onClose:()=>f(!1),onPause:Ee(e.onPause),onResume:Ee(e.onResume),onSwipeStart:G(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:G(e.onSwipeMove,d=>{const{x:p,y:m}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${p}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:G(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:G(e.onSwipeEnd,d=>{const{x:p,y:m}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${p}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),f(!1)})})})});zn.displayName=pt;var[Oa,ka]=Dn(pt,{onClose(){}}),ja=c.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:o,open:s,onClose:a,onEscapeKeyDown:i,onPause:f,onResume:d,onSwipeStart:p,onSwipeMove:m,onSwipeCancel:g,onSwipeEnd:l,...y}=e,v=Dt(pt,r),[h,b]=c.useState(null),x=ce(t,P=>b(P)),w=c.useRef(null),T=c.useRef(null),S=o||v.duration,E=c.useRef(0),C=c.useRef(S),R=c.useRef(0),{onToastAdd:I,onToastRemove:j}=v,D=Ee(()=>{h?.contains(document.activeElement)&&v.viewport?.focus(),a()}),_=c.useCallback(P=>{!P||P===1/0||(window.clearTimeout(R.current),E.current=new Date().getTime(),R.current=window.setTimeout(D,P))},[D]);c.useEffect(()=>{const P=v.viewport;if(P){const k=()=>{_(C.current),d?.()},O=()=>{const F=new Date().getTime()-E.current;C.current=C.current-F,window.clearTimeout(R.current),f?.()};return P.addEventListener(lr,O),P.addEventListener(dr,k),()=>{P.removeEventListener(lr,O),P.removeEventListener(dr,k)}}},[v.viewport,S,f,d,_]),c.useEffect(()=>{s&&!v.isClosePausedRef.current&&_(S)},[s,S,v.isClosePausedRef,_]),c.useEffect(()=>(I(),()=>j()),[I,j]);const L=c.useMemo(()=>h?Gn(h):null,[h]);return v.viewport?u.jsxs(u.Fragment,{children:[L&&u.jsx(Da,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:L}),u.jsx(Oa,{scope:r,onClose:D,children:It.createPortal(u.jsx(Sr.ItemSlot,{scope:r,children:u.jsx(fa,{asChild:!0,onEscapeKeyDown:G(i,()=>{v.isFocusedToastEscapeKeyDownRef.current||D(),v.isFocusedToastEscapeKeyDownRef.current=!1}),children:u.jsx(J.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":v.swipeDirection,...y,ref:x,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:G(e.onKeyDown,P=>{P.key==="Escape"&&(i?.(P.nativeEvent),P.nativeEvent.defaultPrevented||(v.isFocusedToastEscapeKeyDownRef.current=!0,D()))}),onPointerDown:G(e.onPointerDown,P=>{P.button===0&&(w.current={x:P.clientX,y:P.clientY})}),onPointerMove:G(e.onPointerMove,P=>{if(!w.current)return;const k=P.clientX-w.current.x,O=P.clientY-w.current.y,F=!!T.current,M=["left","right"].includes(v.swipeDirection),A=["left","up"].includes(v.swipeDirection)?Math.min:Math.max,H=M?A(0,k):0,Q=M?0:A(0,O),U=P.pointerType==="touch"?10:2,B={x:H,y:Q},W={originalEvent:P,delta:B};F?(T.current=B,bt(Aa,m,W,{discrete:!1})):tn(B,v.swipeDirection,U)?(T.current=B,bt(Pa,p,W,{discrete:!1}),P.target.setPointerCapture(P.pointerId)):(Math.abs(k)>U||Math.abs(O)>U)&&(w.current=null)}),onPointerUp:G(e.onPointerUp,P=>{const k=T.current,O=P.target;if(O.hasPointerCapture(P.pointerId)&&O.releasePointerCapture(P.pointerId),T.current=null,w.current=null,k){const F=P.currentTarget,M={originalEvent:P,delta:k};tn(k,v.swipeDirection,v.swipeThreshold)?bt(Ia,l,M,{discrete:!0}):bt(_a,g,M,{discrete:!0}),F.addEventListener("click",A=>A.preventDefault(),{once:!0})}})})})}),v.viewport)})]}):null}),Da=e=>{const{__scopeToast:t,children:r,...n}=e,o=Dt(pt,t),[s,a]=c.useState(!1),[i,f]=c.useState(!1);return Fa(()=>a(!0)),c.useEffect(()=>{const d=window.setTimeout(()=>f(!0),1e3);return()=>window.clearTimeout(d)},[]),i?null:u.jsx(jn,{asChild:!0,children:u.jsx(jt,{...n,children:s&&u.jsxs(u.Fragment,{children:[o.label," ",r]})})})},La="ToastTitle",Bn=c.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return u.jsx(J.div,{...n,ref:t})});Bn.displayName=La;var Ma="ToastDescription",Un=c.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return u.jsx(J.div,{...n,ref:t})});Un.displayName=Ma;var Hn="ToastAction",Wn=c.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?u.jsx(Kn,{altText:r,asChild:!0,children:u.jsx(Nr,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Hn}\`. Expected non-empty \`string\`.`),null)});Wn.displayName=Hn;var Vn="ToastClose",Nr=c.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,o=ka(Vn,r);return u.jsx(Kn,{asChild:!0,children:u.jsx(J.button,{type:"button",...n,ref:t,onClick:G(e.onClick,o.onClose)})})});Nr.displayName=Vn;var Kn=c.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...o}=e;return u.jsx(J.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...o,ref:t})});function Gn(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),$a(n)){const o=n.ariaHidden||n.hidden||n.style.display==="none",s=n.dataset.radixToastAnnounceExclude==="";if(!o)if(s){const a=n.dataset.radixToastAnnounceAlt;a&&t.push(a)}else t.push(...Gn(n))}}),t}function bt(e,t,r,{discrete:n}){const o=r.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?_n(o,s):o.dispatchEvent(s)}var tn=(e,t,r=0)=>{const n=Math.abs(e.x),o=Math.abs(e.y),s=n>o;return t==="left"||t==="right"?s&&n>r:!s&&o>r};function Fa(e=()=>{}){const t=Ee(e);Ce(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function $a(e){return e.nodeType===e.ELEMENT_NODE}function za(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function er(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var Ba=Ln,Yn=Fn,qn=zn,Xn=Bn,Jn=Un,Qn=Wn,Zn=Nr;function eo(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,nn=to,Lt=(e,t)=>r=>{var n;if(t?.variants==null)return nn(e,r?.class,r?.className);const{variants:o,defaultVariants:s}=t,a=Object.keys(o).map(d=>{const p=r?.[d],m=s?.[d];if(p===null)return null;const g=rn(p)||rn(m);return o[d][g]}),i=r&&Object.entries(r).reduce((d,p)=>{let[m,g]=p;return g===void 0||(d[m]=g),d},{}),f=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,p)=>{let{class:m,className:g,...l}=p;return Object.entries(l).every(y=>{let[v,h]=y;return Array.isArray(h)?h.includes({...s,...i}[v]):{...s,...i}[v]===h})?[...d,m,g]:d},[]);return nn(e,a,f,r?.class,r?.className)};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ua=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ro=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var Ha={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wa=c.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:s,iconNode:a,...i},f)=>c.createElement("svg",{ref:f,...Ha,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:ro("lucide",o),...i},[...a.map(([d,p])=>c.createElement(d,p)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const le=(e,t)=>{const r=c.forwardRef(({className:n,...o},s)=>c.createElement(Wa,{ref:s,iconNode:t,className:ro(`lucide-${Ua(e)}`,n),...o}));return r.displayName=`${e}`,r};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Va=le("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ka=le("Building",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fr=le("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ga=le("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const on=le("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ya=le("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const no=le("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qa=le("Stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xa=le("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ja=le("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qa=le("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Za=le("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Pr="-",ei=e=>{const t=ri(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:a=>{const i=a.split(Pr);return i[0]===""&&i.length!==1&&i.shift(),oo(i,t)||ti(a)},getConflictingClassGroupIds:(a,i)=>{const f=r[a]||[];return i&&n[a]?[...f,...n[a]]:f}}},oo=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),o=n?oo(e.slice(1),n):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(Pr);return t.validators.find(({validator:a})=>a(s))?.classGroupId},sn=/^\[(.+)\]$/,ti=e=>{if(sn.test(e)){const t=sn.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},ri=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return oi(Object.entries(e.classGroups),r).forEach(([s,a])=>{pr(a,n,s,t)}),n},pr=(e,t,r,n)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:an(t,o);s.classGroupId=r;return}if(typeof o=="function"){if(ni(o)){pr(o(n),t,r,n);return}t.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([s,a])=>{pr(a,an(t,s),r,n)})})},an=(e,t)=>{let r=e;return t.split(Pr).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},ni=e=>e.isThemeGetter,oi=(e,t)=>t?e.map(([r,n])=>{const o=n.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([a,i])=>[t+a,i])):s);return[r,o]}):e,si=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const o=(s,a)=>{r.set(s,a),t++,t>e&&(t=0,n=r,r=new Map)};return{get(s){let a=r.get(s);if(a!==void 0)return a;if((a=n.get(s))!==void 0)return o(s,a),a},set(s,a){r.has(s)?r.set(s,a):o(s,a)}}},so="!",ai=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,o=t[0],s=t.length,a=i=>{const f=[];let d=0,p=0,m;for(let h=0;hp?m-p:void 0;return{modifiers:f,hasImportantModifier:l,baseClassName:y,maybePostfixModifierPosition:v}};return r?i=>r({className:i,parseClassName:a}):a},ii=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},ci=e=>({cache:si(e.cacheSize),parseClassName:ai(e),...ei(e)}),li=/\s+/,di=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=t,s=[],a=e.trim().split(li);let i="";for(let f=a.length-1;f>=0;f-=1){const d=a[f],{modifiers:p,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:l}=r(d);let y=!!l,v=n(y?g.substring(0,l):g);if(!v){if(!y){i=d+(i.length>0?" "+i:i);continue}if(v=n(g),!v){i=d+(i.length>0?" "+i:i);continue}y=!1}const h=ii(p).join(":"),b=m?h+so:h,x=b+v;if(s.includes(x))continue;s.push(x);const w=o(v,y);for(let T=0;T0?" "+i:i)}return i};function ui(){let e=0,t,r,n="";for(;e{if(typeof e=="string")return e;let t,r="";for(let n=0;nm(p),e());return r=ci(d),n=r.cache.get,o=r.cache.set,s=i,i(f)}function i(f){const d=n(f);if(d)return d;const p=di(f,r);return o(f,p),p}return function(){return s(ui.apply(null,arguments))}}const Y=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},io=/^\[(?:([a-z-]+):)?(.+)\]$/i,pi=/^\d+\/\d+$/,mi=new Set(["px","full","screen"]),hi=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gi=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,vi=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,yi=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,bi=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,we=e=>qe(e)||mi.has(e)||pi.test(e),_e=e=>et(e,"length",Ni),qe=e=>!!e&&!Number.isNaN(Number(e)),tr=e=>et(e,"number",qe),it=e=>!!e&&Number.isInteger(Number(e)),xi=e=>e.endsWith("%")&&qe(e.slice(0,-1)),z=e=>io.test(e),Ie=e=>hi.test(e),wi=new Set(["length","size","percentage"]),Ei=e=>et(e,wi,co),Ci=e=>et(e,"position",co),Ti=new Set(["image","url"]),Ri=e=>et(e,Ti,Ai),Si=e=>et(e,"",Pi),ct=()=>!0,et=(e,t,r)=>{const n=io.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},Ni=e=>gi.test(e)&&!vi.test(e),co=()=>!1,Pi=e=>yi.test(e),Ai=e=>bi.test(e),_i=()=>{const e=Y("colors"),t=Y("spacing"),r=Y("blur"),n=Y("brightness"),o=Y("borderColor"),s=Y("borderRadius"),a=Y("borderSpacing"),i=Y("borderWidth"),f=Y("contrast"),d=Y("grayscale"),p=Y("hueRotate"),m=Y("invert"),g=Y("gap"),l=Y("gradientColorStops"),y=Y("gradientColorStopPositions"),v=Y("inset"),h=Y("margin"),b=Y("opacity"),x=Y("padding"),w=Y("saturate"),T=Y("scale"),S=Y("sepia"),E=Y("skew"),C=Y("space"),R=Y("translate"),I=()=>["auto","contain","none"],j=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",z,t],_=()=>[z,t],L=()=>["",we,_e],P=()=>["auto",qe,z],k=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],O=()=>["solid","dashed","dotted","double","none"],F=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],M=()=>["start","end","center","between","around","evenly","stretch"],A=()=>["","0",z],H=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Q=()=>[qe,z];return{cacheSize:500,separator:":",theme:{colors:[ct],spacing:[we,_e],blur:["none","",Ie,z],brightness:Q(),borderColor:[e],borderRadius:["none","","full",Ie,z],borderSpacing:_(),borderWidth:L(),contrast:Q(),grayscale:A(),hueRotate:Q(),invert:A(),gap:_(),gradientColorStops:[e],gradientColorStopPositions:[xi,_e],inset:D(),margin:D(),opacity:Q(),padding:_(),saturate:Q(),scale:Q(),sepia:A(),skew:Q(),space:_(),translate:_()},classGroups:{aspect:[{aspect:["auto","square","video",z]}],container:["container"],columns:[{columns:[Ie]}],"break-after":[{"break-after":H()}],"break-before":[{"break-before":H()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...k(),z]}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",it,z]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",z]}],grow:[{grow:A()}],shrink:[{shrink:A()}],order:[{order:["first","last","none",it,z]}],"grid-cols":[{"grid-cols":[ct]}],"col-start-end":[{col:["auto",{span:["full",it,z]},z]}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":[ct]}],"row-start-end":[{row:["auto",{span:[it,z]},z]}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",z]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",z]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...M()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...M(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...M(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[h]}],mx:[{mx:[h]}],my:[{my:[h]}],ms:[{ms:[h]}],me:[{me:[h]}],mt:[{mt:[h]}],mr:[{mr:[h]}],mb:[{mb:[h]}],ml:[{ml:[h]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",z,t]}],"min-w":[{"min-w":[z,t,"min","max","fit"]}],"max-w":[{"max-w":[z,t,"none","full","min","max","fit","prose",{screen:[Ie]},Ie]}],h:[{h:[z,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[z,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[z,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[z,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ie,_e]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",tr]}],"font-family":[{font:[ct]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",z]}],"line-clamp":[{"line-clamp":["none",qe,tr]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",we,z]}],"list-image":[{"list-image":["none",z]}],"list-style-type":[{list:["none","disc","decimal",z]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",we,_e]}],"underline-offset":[{"underline-offset":["auto",we,z]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",z]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",z]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...k(),Ci]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Ei]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Ri]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[l]}],"gradient-via":[{via:[l]}],"gradient-to":[{to:[l]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...O(),"hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:O()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...O()]}],"outline-offset":[{"outline-offset":[we,z]}],"outline-w":[{outline:[we,_e]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[we,_e]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ie,Si]}],"shadow-color":[{shadow:[ct]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...F(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":F()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",Ie,z]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[m]}],saturate:[{saturate:[w]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",z]}],duration:[{duration:Q()}],ease:[{ease:["linear","in","out","in-out",z]}],delay:[{delay:Q()}],animate:[{animate:["none","spin","ping","pulse","bounce",z]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[it,z]}],"translate-x":[{"translate-x":[R]}],"translate-y":[{"translate-y":[R]}],"skew-x":[{"skew-x":[E]}],"skew-y":[{"skew-y":[E]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",z]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",z]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",z]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[we,_e,tr]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Ii=fi(_i);function X(...e){return Ii(to(e))}const Oi=Ba,lo=c.forwardRef(({className:e,...t},r)=>u.jsx(Yn,{ref:r,className:X("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));lo.displayName=Yn.displayName;const ki=Lt("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),uo=c.forwardRef(({className:e,variant:t,...r},n)=>u.jsx(qn,{ref:n,className:X(ki({variant:t}),e),...r}));uo.displayName=qn.displayName;const ji=c.forwardRef(({className:e,...t},r)=>u.jsx(Qn,{ref:r,className:X("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));ji.displayName=Qn.displayName;const fo=c.forwardRef(({className:e,...t},r)=>u.jsx(Zn,{ref:r,className:X("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:u.jsx(Za,{className:"h-4 w-4"})}));fo.displayName=Zn.displayName;const po=c.forwardRef(({className:e,...t},r)=>u.jsx(Xn,{ref:r,className:X("text-sm font-semibold",e),...t}));po.displayName=Xn.displayName;const mo=c.forwardRef(({className:e,...t},r)=>u.jsx(Jn,{ref:r,className:X("text-sm opacity-90",e),...t}));mo.displayName=Jn.displayName;function Di(){const{toasts:e}=Xs();return u.jsxs(Oi,{children:[e.map(function({id:t,title:r,description:n,action:o,...s}){return u.jsxs(uo,{...s,children:[u.jsxs("div",{className:"grid gap-1",children:[r&&u.jsx(po,{children:r}),n&&u.jsx(mo,{children:n})]}),o,u.jsx(fo,{})]},t)}),u.jsx(lo,{})]})}var cn=["light","dark"],Li="(prefers-color-scheme: dark)",Mi=c.createContext(void 0),Fi={setTheme:e=>{},themes:[]},$i=()=>{var e;return(e=c.useContext(Mi))!=null?e:Fi};c.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:o,defaultTheme:s,value:a,attrs:i,nonce:f})=>{let d=s==="system",p=r==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${i.map(y=>`'${y}'`).join(",")})`};`:`var d=document.documentElement,n='${r}',s='setAttribute';`,m=o?cn.includes(s)&&s?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",g=(y,v=!1,h=!0)=>{let b=a?a[y]:y,x=v?y+"|| ''":`'${b}'`,w="";return o&&h&&!v&&cn.includes(y)&&(w+=`d.style.colorScheme = '${y}';`),r==="class"?v||b?w+=`c.add(${x})`:w+="null":b&&(w+=`d[s](n,${x})`),w},l=e?`!function(){${p}${g(e)}}()`:n?`!function(){try{${p}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${d})){var t='${Li}',m=window.matchMedia(t);if(m.media!==t||m.matches){${g("dark")}}else{${g("light")}}}else if(e){${a?`var x=${JSON.stringify(a)};`:""}${g(a?"x[e]":"e",!0)}}${d?"":"else{"+g(s,!1,!1)+"}"}${m}}catch(e){}}()`:`!function(){try{${p}var e=localStorage.getItem('${t}');if(e){${a?`var x=${JSON.stringify(a)};`:""}${g(a?"x[e]":"e",!0)}}else{${g(s,!1,!1)};}${m}}catch(t){}}();`;return c.createElement("script",{nonce:f,dangerouslySetInnerHTML:{__html:l}})});var zi=e=>{switch(e){case"success":return Hi;case"info":return Vi;case"warning":return Wi;case"error":return Ki;default:return null}},Bi=Array(12).fill(0),Ui=({visible:e,className:t})=>N.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},N.createElement("div",{className:"sonner-spinner"},Bi.map((r,n)=>N.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),Hi=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Wi=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Vi=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Ki=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Gi=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},N.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),N.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Yi=()=>{let[e,t]=N.useState(document.hidden);return N.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},mr=1,qi=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:r,...n}=e,o=typeof e?.id=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:mr++,s=this.toasts.find(i=>i.id===o),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),s?this.toasts=this.toasts.map(i=>i.id===o?(this.publish({...i,...e,id:o,title:r}),{...i,...e,id:o,dismissible:a,title:r}):i):this.addToast({title:r,...n,dismissible:a,id:o}),o},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(r=>r({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;t.loading!==void 0&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let n=e instanceof Promise?e:e(),o=r!==void 0,s,a=n.then(async f=>{if(s=["resolve",f],N.isValidElement(f))o=!1,this.create({id:r,type:"default",message:f});else if(Ji(f)&&!f.ok){o=!1;let d=typeof t.error=="function"?await t.error(`HTTP error! status: ${f.status}`):t.error,p=typeof t.description=="function"?await t.description(`HTTP error! status: ${f.status}`):t.description;this.create({id:r,type:"error",message:d,description:p})}else if(t.success!==void 0){o=!1;let d=typeof t.success=="function"?await t.success(f):t.success,p=typeof t.description=="function"?await t.description(f):t.description;this.create({id:r,type:"success",message:d,description:p})}}).catch(async f=>{if(s=["reject",f],t.error!==void 0){o=!1;let d=typeof t.error=="function"?await t.error(f):t.error,p=typeof t.description=="function"?await t.description(f):t.description;this.create({id:r,type:"error",message:d,description:p})}}).finally(()=>{var f;o&&(this.dismiss(r),r=void 0),(f=t.finally)==null||f.call(t)}),i=()=>new Promise((f,d)=>a.then(()=>s[0]==="reject"?d(s[1]):f(s[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:i}:Object.assign(r,{unwrap:i})},this.custom=(e,t)=>{let r=t?.id||mr++;return this.create({jsx:e(r),id:r,...t}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},te=new qi,Xi=(e,t)=>{let r=t?.id||mr++;return te.addToast({title:e,...t,id:r}),r},Ji=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Qi=Xi,Zi=()=>te.toasts,ec=()=>te.getActiveToasts(),fu=Object.assign(Qi,{success:te.success,info:te.info,warning:te.warning,error:te.error,custom:te.custom,message:te.message,promise:te.promise,dismiss:te.dismiss,loading:te.loading},{getHistory:Zi,getToasts:ec});function tc(e,{insertAt:t}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}tc(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} `);function xt(e){return e.label!==void 0}var rc=3,nc="32px",oc="16px",ln=4e3,sc=356,ac=14,ic=20,cc=200;function pe(...e){return e.filter(Boolean).join(" ")}function lc(e){let[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}var dc=e=>{var t,r,n,o,s,a,i,f,d,p,m;let{invert:g,toast:l,unstyled:y,interacting:v,setHeights:h,visibleToasts:b,heights:x,index:w,toasts:T,expanded:S,removeToast:E,defaultRichColors:C,closeButton:R,style:I,cancelButtonStyle:j,actionButtonStyle:D,className:_="",descriptionClassName:L="",duration:P,position:k,gap:O,loadingIcon:F,expandByDefault:M,classNames:A,icons:H,closeButtonAriaLabel:Q="Close toast",pauseWhenPageIsHidden:U}=e,[B,W]=N.useState(null),[ee,Se]=N.useState(null),[V,We]=N.useState(!1),[De,Ve]=N.useState(!1),[Le,st]=N.useState(!1),[Me,Es]=N.useState(!1),[Cs,Hr]=N.useState(!1),[Ts,qt]=N.useState(0),[Rs,Wr]=N.useState(0),at=N.useRef(l.duration||P||ln),Vr=N.useRef(null),Fe=N.useRef(null),Ss=w===0,Ns=w+1<=b,ie=l.type,Ke=l.dismissible!==!1,Ps=l.className||"",As=l.descriptionClassName||"",gt=N.useMemo(()=>x.findIndex($=>$.toastId===l.id)||0,[x,l.id]),_s=N.useMemo(()=>{var $;return($=l.closeButton)!=null?$:R},[l.closeButton,R]),Kr=N.useMemo(()=>l.duration||P||ln,[l.duration,P]),Xt=N.useRef(0),Ge=N.useRef(0),Gr=N.useRef(0),Ye=N.useRef(null),[Is,Os]=k.split("-"),Yr=N.useMemo(()=>x.reduce(($,K,q)=>q>=gt?$:$+K.height,0),[x,gt]),qr=Yi(),ks=l.invert||g,Jt=ie==="loading";Ge.current=N.useMemo(()=>gt*O+Yr,[gt,Yr]),N.useEffect(()=>{at.current=Kr},[Kr]),N.useEffect(()=>{We(!0)},[]),N.useEffect(()=>{let $=Fe.current;if($){let K=$.getBoundingClientRect().height;return Wr(K),h(q=>[{toastId:l.id,height:K,position:l.position},...q]),()=>h(q=>q.filter(de=>de.toastId!==l.id))}},[h,l.id]),N.useLayoutEffect(()=>{if(!V)return;let $=Fe.current,K=$.style.height;$.style.height="auto";let q=$.getBoundingClientRect().height;$.style.height=K,Wr(q),h(de=>de.find(ue=>ue.toastId===l.id)?de.map(ue=>ue.toastId===l.id?{...ue,height:q}:ue):[{toastId:l.id,height:q,position:l.position},...de])},[V,l.title,l.description,h,l.id]);let Ne=N.useCallback(()=>{Ve(!0),qt(Ge.current),h($=>$.filter(K=>K.toastId!==l.id)),setTimeout(()=>{E(l)},cc)},[l,E,h,Ge]);N.useEffect(()=>{if(l.promise&&ie==="loading"||l.duration===1/0||l.type==="loading")return;let $;return S||v||U&&qr?(()=>{if(Gr.current{var K;(K=l.onAutoClose)==null||K.call(l,l),Ne()},at.current)),()=>clearTimeout($)},[S,v,l,ie,U,qr,Ne]),N.useEffect(()=>{l.delete&&Ne()},[Ne,l.delete]);function js(){var $,K,q;return H!=null&&H.loading?N.createElement("div",{className:pe(A?.loader,($=l?.classNames)==null?void 0:$.loader,"sonner-loader"),"data-visible":ie==="loading"},H.loading):F?N.createElement("div",{className:pe(A?.loader,(K=l?.classNames)==null?void 0:K.loader,"sonner-loader"),"data-visible":ie==="loading"},F):N.createElement(Ui,{className:pe(A?.loader,(q=l?.classNames)==null?void 0:q.loader),visible:ie==="loading"})}return N.createElement("li",{tabIndex:0,ref:Fe,className:pe(_,Ps,A?.toast,(t=l?.classNames)==null?void 0:t.toast,A?.default,A?.[ie],(r=l?.classNames)==null?void 0:r[ie]),"data-sonner-toast":"","data-rich-colors":(n=l.richColors)!=null?n:C,"data-styled":!(l.jsx||l.unstyled||y),"data-mounted":V,"data-promise":!!l.promise,"data-swiped":Cs,"data-removed":De,"data-visible":Ns,"data-y-position":Is,"data-x-position":Os,"data-index":w,"data-front":Ss,"data-swiping":Le,"data-dismissible":Ke,"data-type":ie,"data-invert":ks,"data-swipe-out":Me,"data-swipe-direction":ee,"data-expanded":!!(S||M&&V),style:{"--index":w,"--toasts-before":w,"--z-index":T.length-w,"--offset":`${De?Ts:Ge.current}px`,"--initial-height":M?"auto":`${Rs}px`,...I,...l.style},onDragEnd:()=>{st(!1),W(null),Ye.current=null},onPointerDown:$=>{Jt||!Ke||(Vr.current=new Date,qt(Ge.current),$.target.setPointerCapture($.pointerId),$.target.tagName!=="BUTTON"&&(st(!0),Ye.current={x:$.clientX,y:$.clientY}))},onPointerUp:()=>{var $,K,q,de;if(Me||!Ke)return;Ye.current=null;let ue=Number((($=Fe.current)==null?void 0:$.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Pe=Number(((K=Fe.current)==null?void 0:K.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),$e=new Date().getTime()-((q=Vr.current)==null?void 0:q.getTime()),fe=B==="x"?ue:Pe,Ae=Math.abs(fe)/$e;if(Math.abs(fe)>=ic||Ae>.11){qt(Ge.current),(de=l.onDismiss)==null||de.call(l,l),Se(B==="x"?ue>0?"right":"left":Pe>0?"down":"up"),Ne(),Es(!0),Hr(!1);return}st(!1),W(null)},onPointerMove:$=>{var K,q,de,ue;if(!Ye.current||!Ke||((K=window.getSelection())==null?void 0:K.toString().length)>0)return;let Pe=$.clientY-Ye.current.y,$e=$.clientX-Ye.current.x,fe=(q=e.swipeDirections)!=null?q:lc(k);!B&&(Math.abs($e)>1||Math.abs(Pe)>1)&&W(Math.abs($e)>Math.abs(Pe)?"x":"y");let Ae={x:0,y:0};B==="y"?(fe.includes("top")||fe.includes("bottom"))&&(fe.includes("top")&&Pe<0||fe.includes("bottom")&&Pe>0)&&(Ae.y=Pe):B==="x"&&(fe.includes("left")||fe.includes("right"))&&(fe.includes("left")&&$e<0||fe.includes("right")&&$e>0)&&(Ae.x=$e),(Math.abs(Ae.x)>0||Math.abs(Ae.y)>0)&&Hr(!0),(de=Fe.current)==null||de.style.setProperty("--swipe-amount-x",`${Ae.x}px`),(ue=Fe.current)==null||ue.style.setProperty("--swipe-amount-y",`${Ae.y}px`)}},_s&&!l.jsx?N.createElement("button",{"aria-label":Q,"data-disabled":Jt,"data-close-button":!0,onClick:Jt||!Ke?()=>{}:()=>{var $;Ne(),($=l.onDismiss)==null||$.call(l,l)},className:pe(A?.closeButton,(o=l?.classNames)==null?void 0:o.closeButton)},(s=H?.close)!=null?s:Gi):null,l.jsx||c.isValidElement(l.title)?l.jsx?l.jsx:typeof l.title=="function"?l.title():l.title:N.createElement(N.Fragment,null,ie||l.icon||l.promise?N.createElement("div",{"data-icon":"",className:pe(A?.icon,(a=l?.classNames)==null?void 0:a.icon)},l.promise||l.type==="loading"&&!l.icon?l.icon||js():null,l.type!=="loading"?l.icon||H?.[ie]||zi(ie):null):null,N.createElement("div",{"data-content":"",className:pe(A?.content,(i=l?.classNames)==null?void 0:i.content)},N.createElement("div",{"data-title":"",className:pe(A?.title,(f=l?.classNames)==null?void 0:f.title)},typeof l.title=="function"?l.title():l.title),l.description?N.createElement("div",{"data-description":"",className:pe(L,As,A?.description,(d=l?.classNames)==null?void 0:d.description)},typeof l.description=="function"?l.description():l.description):null),c.isValidElement(l.cancel)?l.cancel:l.cancel&&xt(l.cancel)?N.createElement("button",{"data-button":!0,"data-cancel":!0,style:l.cancelButtonStyle||j,onClick:$=>{var K,q;xt(l.cancel)&&Ke&&((q=(K=l.cancel).onClick)==null||q.call(K,$),Ne())},className:pe(A?.cancelButton,(p=l?.classNames)==null?void 0:p.cancelButton)},l.cancel.label):null,c.isValidElement(l.action)?l.action:l.action&&xt(l.action)?N.createElement("button",{"data-button":!0,"data-action":!0,style:l.actionButtonStyle||D,onClick:$=>{var K,q;xt(l.action)&&((q=(K=l.action).onClick)==null||q.call(K,$),!$.defaultPrevented&&Ne())},className:pe(A?.actionButton,(m=l?.classNames)==null?void 0:m.actionButton)},l.action.label):null))};function dn(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function uc(e,t){let r={};return[e,t].forEach((n,o)=>{let s=o===1,a=s?"--mobile-offset":"--offset",i=s?oc:nc;function f(d){["top","right","bottom","left"].forEach(p=>{r[`${a}-${p}`]=typeof d=="number"?`${d}px`:d})}typeof n=="number"||typeof n=="string"?f(n):typeof n=="object"?["top","right","bottom","left"].forEach(d=>{n[d]===void 0?r[`${a}-${d}`]=i:r[`${a}-${d}`]=typeof n[d]=="number"?`${n[d]}px`:n[d]}):f(i)}),r}var fc=c.forwardRef(function(e,t){let{invert:r,position:n="bottom-right",hotkey:o=["altKey","KeyT"],expand:s,closeButton:a,className:i,offset:f,mobileOffset:d,theme:p="light",richColors:m,duration:g,style:l,visibleToasts:y=rc,toastOptions:v,dir:h=dn(),gap:b=ac,loadingIcon:x,icons:w,containerAriaLabel:T="Notifications",pauseWhenPageIsHidden:S}=e,[E,C]=N.useState([]),R=N.useMemo(()=>Array.from(new Set([n].concat(E.filter(U=>U.position).map(U=>U.position)))),[E,n]),[I,j]=N.useState([]),[D,_]=N.useState(!1),[L,P]=N.useState(!1),[k,O]=N.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),F=N.useRef(null),M=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),A=N.useRef(null),H=N.useRef(!1),Q=N.useCallback(U=>{C(B=>{var W;return(W=B.find(ee=>ee.id===U.id))!=null&&W.delete||te.dismiss(U.id),B.filter(({id:ee})=>ee!==U.id)})},[]);return N.useEffect(()=>te.subscribe(U=>{if(U.dismiss){C(B=>B.map(W=>W.id===U.id?{...W,delete:!0}:W));return}setTimeout(()=>{Cn.flushSync(()=>{C(B=>{let W=B.findIndex(ee=>ee.id===U.id);return W!==-1?[...B.slice(0,W),{...B[W],...U},...B.slice(W+1)]:[U,...B]})})})}),[]),N.useEffect(()=>{if(p!=="system"){O(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?O("dark"):O("light")),typeof window>"u")return;let U=window.matchMedia("(prefers-color-scheme: dark)");try{U.addEventListener("change",({matches:B})=>{O(B?"dark":"light")})}catch{U.addListener(({matches:W})=>{try{O(W?"dark":"light")}catch(ee){console.error(ee)}})}},[p]),N.useEffect(()=>{E.length<=1&&_(!1)},[E]),N.useEffect(()=>{let U=B=>{var W,ee;o.every(Se=>B[Se]||B.code===Se)&&(_(!0),(W=F.current)==null||W.focus()),B.code==="Escape"&&(document.activeElement===F.current||(ee=F.current)!=null&&ee.contains(document.activeElement))&&_(!1)};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[o]),N.useEffect(()=>{if(F.current)return()=>{A.current&&(A.current.focus({preventScroll:!0}),A.current=null,H.current=!1)}},[F.current]),N.createElement("section",{ref:t,"aria-label":`${T} ${M}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},R.map((U,B)=>{var W;let[ee,Se]=U.split("-");return E.length?N.createElement("ol",{key:U,dir:h==="auto"?dn():h,tabIndex:-1,ref:F,className:i,"data-sonner-toaster":!0,"data-theme":k,"data-y-position":ee,"data-lifted":D&&E.length>1&&!s,"data-x-position":Se,style:{"--front-toast-height":`${((W=I[0])==null?void 0:W.height)||0}px`,"--width":`${sc}px`,"--gap":`${b}px`,...l,...uc(f,d)},onBlur:V=>{H.current&&!V.currentTarget.contains(V.relatedTarget)&&(H.current=!1,A.current&&(A.current.focus({preventScroll:!0}),A.current=null))},onFocus:V=>{V.target instanceof HTMLElement&&V.target.dataset.dismissible==="false"||H.current||(H.current=!0,A.current=V.relatedTarget)},onMouseEnter:()=>_(!0),onMouseMove:()=>_(!0),onMouseLeave:()=>{L||_(!1)},onDragEnd:()=>_(!1),onPointerDown:V=>{V.target instanceof HTMLElement&&V.target.dataset.dismissible==="false"||P(!0)},onPointerUp:()=>P(!1)},E.filter(V=>!V.position&&B===0||V.position===U).map((V,We)=>{var De,Ve;return N.createElement(dc,{key:V.id,icons:w,index:We,toast:V,defaultRichColors:m,duration:(De=v?.duration)!=null?De:g,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:r,visibleToasts:y,closeButton:(Ve=v?.closeButton)!=null?Ve:a,interacting:L,position:U,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,removeToast:Q,toasts:E.filter(Le=>Le.position==V.position),heights:I.filter(Le=>Le.position==V.position),setHeights:j,expandByDefault:s,gap:b,loadingIcon:x,expanded:D,pauseWhenPageIsHidden:S,swipeDirections:e.swipeDirections})})):null}))});const pc=({...e})=>{const{theme:t="system"}=$i();return u.jsx(fc,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})};var mc=Tn[" useId ".trim().toString()]||(()=>{}),hc=0;function Ar(e){const[t,r]=c.useState(mc());return Ce(()=>{e||r(n=>n??String(hc++))},[e]),e||(t?`radix-${t}`:"")}const gc=["top","right","bottom","left"],ke=Math.min,se=Math.max,Nt=Math.round,wt=Math.floor,ye=e=>({x:e,y:e}),vc={left:"right",right:"left",bottom:"top",top:"bottom"},yc={start:"end",end:"start"};function hr(e,t,r){return se(e,ke(t,r))}function Te(e,t){return typeof e=="function"?e(t):e}function Re(e){return e.split("-")[0]}function tt(e){return e.split("-")[1]}function _r(e){return e==="x"?"y":"x"}function Ir(e){return e==="y"?"height":"width"}const bc=new Set(["top","bottom"]);function ve(e){return bc.has(Re(e))?"y":"x"}function Or(e){return _r(ve(e))}function xc(e,t,r){r===void 0&&(r=!1);const n=tt(e),o=Or(e),s=Ir(o);let a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Pt(a)),[a,Pt(a)]}function wc(e){const t=Pt(e);return[gr(e),t,gr(t)]}function gr(e){return e.replace(/start|end/g,t=>yc[t])}const un=["left","right"],fn=["right","left"],Ec=["top","bottom"],Cc=["bottom","top"];function Tc(e,t,r){switch(e){case"top":case"bottom":return r?t?fn:un:t?un:fn;case"left":case"right":return t?Ec:Cc;default:return[]}}function Rc(e,t,r,n){const o=tt(e);let s=Tc(Re(e),r==="start",n);return o&&(s=s.map(a=>a+"-"+o),t&&(s=s.concat(s.map(gr)))),s}function Pt(e){return e.replace(/left|right|bottom|top/g,t=>vc[t])}function Sc(e){return{top:0,right:0,bottom:0,left:0,...e}}function ho(e){return typeof e!="number"?Sc(e):{top:e,right:e,bottom:e,left:e}}function At(e){const{x:t,y:r,width:n,height:o}=e;return{width:n,height:o,top:r,left:t,right:t+n,bottom:r+o,x:t,y:r}}function pn(e,t,r){let{reference:n,floating:o}=e;const s=ve(t),a=Or(t),i=Ir(a),f=Re(t),d=s==="y",p=n.x+n.width/2-o.width/2,m=n.y+n.height/2-o.height/2,g=n[i]/2-o[i]/2;let l;switch(f){case"top":l={x:p,y:n.y-o.height};break;case"bottom":l={x:p,y:n.y+n.height};break;case"right":l={x:n.x+n.width,y:m};break;case"left":l={x:n.x-o.width,y:m};break;default:l={x:n.x,y:n.y}}switch(tt(t)){case"start":l[a]-=g*(r&&d?-1:1);break;case"end":l[a]+=g*(r&&d?-1:1);break}return l}const Nc=async(e,t,r)=>{const{placement:n="bottom",strategy:o="absolute",middleware:s=[],platform:a}=r,i=s.filter(Boolean),f=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:p,y:m}=pn(d,n,f),g=n,l={},y=0;for(let v=0;v({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:o,rects:s,platform:a,elements:i,middlewareData:f}=t,{element:d,padding:p=0}=Te(e,t)||{};if(d==null)return{};const m=ho(p),g={x:r,y:n},l=Or(o),y=Ir(l),v=await a.getDimensions(d),h=l==="y",b=h?"top":"left",x=h?"bottom":"right",w=h?"clientHeight":"clientWidth",T=s.reference[y]+s.reference[l]-g[l]-s.floating[y],S=g[l]-s.reference[l],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let C=E?E[w]:0;(!C||!await(a.isElement==null?void 0:a.isElement(E)))&&(C=i.floating[w]||s.floating[y]);const R=T/2-S/2,I=C/2-v[y]/2-1,j=ke(m[b],I),D=ke(m[x],I),_=j,L=C-v[y]-D,P=C/2-v[y]/2+R,k=hr(_,P,L),O=!f.arrow&&tt(o)!=null&&P!==k&&s.reference[y]/2-(P<_?j:D)-v[y]/2<0,F=O?P<_?P-_:P-L:0;return{[l]:g[l]+F,data:{[l]:k,centerOffset:P-k-F,...O&&{alignmentOffset:F}},reset:O}}}),Ac=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:o,middlewareData:s,rects:a,initialPlacement:i,platform:f,elements:d}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:l="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:v=!0,...h}=Te(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const b=Re(o),x=ve(i),w=Re(i)===i,T=await(f.isRTL==null?void 0:f.isRTL(d.floating)),S=g||(w||!v?[Pt(i)]:wc(i)),E=y!=="none";!g&&E&&S.push(...Rc(i,v,y,T));const C=[i,...S],R=await dt(t,h),I=[];let j=((n=s.flip)==null?void 0:n.overflows)||[];if(p&&I.push(R[b]),m){const P=xc(o,a,T);I.push(R[P[0]],R[P[1]])}if(j=[...j,{placement:o,overflows:I}],!I.every(P=>P<=0)){var D,_;const P=(((D=s.flip)==null?void 0:D.index)||0)+1,k=C[P];if(k&&(!(m==="alignment"?x!==ve(k):!1)||j.every(M=>M.overflows[0]>0&&ve(M.placement)===x)))return{data:{index:P,overflows:j},reset:{placement:k}};let O=(_=j.filter(F=>F.overflows[0]<=0).sort((F,M)=>F.overflows[1]-M.overflows[1])[0])==null?void 0:_.placement;if(!O)switch(l){case"bestFit":{var L;const F=(L=j.filter(M=>{if(E){const A=ve(M.placement);return A===x||A==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(A=>A>0).reduce((A,H)=>A+H,0)]).sort((M,A)=>M[1]-A[1])[0])==null?void 0:L[0];F&&(O=F);break}case"initialPlacement":O=i;break}if(o!==O)return{reset:{placement:O}}}return{}}}};function mn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function hn(e){return gc.some(t=>e[t]>=0)}const _c=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...o}=Te(e,t);switch(n){case"referenceHidden":{const s=await dt(t,{...o,elementContext:"reference"}),a=mn(s,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:hn(a)}}}case"escaped":{const s=await dt(t,{...o,altBoundary:!0}),a=mn(s,r.floating);return{data:{escapedOffsets:a,escaped:hn(a)}}}default:return{}}}}},go=new Set(["left","top"]);async function Ic(e,t){const{placement:r,platform:n,elements:o}=e,s=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=Re(r),i=tt(r),f=ve(r)==="y",d=go.has(a)?-1:1,p=s&&f?-1:1,m=Te(t,e);let{mainAxis:g,crossAxis:l,alignmentAxis:y}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return i&&typeof y=="number"&&(l=i==="end"?y*-1:y),f?{x:l*p,y:g*d}:{x:g*d,y:l*p}}const Oc=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:o,y:s,placement:a,middlewareData:i}=t,f=await Ic(t,e);return a===((r=i.offset)==null?void 0:r.placement)&&(n=i.arrow)!=null&&n.alignmentOffset?{}:{x:o+f.x,y:s+f.y,data:{...f,placement:a}}}}},kc=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:o}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:i={fn:h=>{let{x:b,y:x}=h;return{x:b,y:x}}},...f}=Te(e,t),d={x:r,y:n},p=await dt(t,f),m=ve(Re(o)),g=_r(m);let l=d[g],y=d[m];if(s){const h=g==="y"?"top":"left",b=g==="y"?"bottom":"right",x=l+p[h],w=l-p[b];l=hr(x,l,w)}if(a){const h=m==="y"?"top":"left",b=m==="y"?"bottom":"right",x=y+p[h],w=y-p[b];y=hr(x,y,w)}const v=i.fn({...t,[g]:l,[m]:y});return{...v,data:{x:v.x-r,y:v.y-n,enabled:{[g]:s,[m]:a}}}}}},jc=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:o,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:f=!0,crossAxis:d=!0}=Te(e,t),p={x:r,y:n},m=ve(o),g=_r(m);let l=p[g],y=p[m];const v=Te(i,t),h=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(f){const w=g==="y"?"height":"width",T=s.reference[g]-s.floating[w]+h.mainAxis,S=s.reference[g]+s.reference[w]-h.mainAxis;lS&&(l=S)}if(d){var b,x;const w=g==="y"?"width":"height",T=go.has(Re(o)),S=s.reference[m]-s.floating[w]+(T&&((b=a.offset)==null?void 0:b[m])||0)+(T?0:h.crossAxis),E=s.reference[m]+s.reference[w]+(T?0:((x=a.offset)==null?void 0:x[m])||0)-(T?h.crossAxis:0);yE&&(y=E)}return{[g]:l,[m]:y}}}},Dc=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:o,rects:s,platform:a,elements:i}=t,{apply:f=()=>{},...d}=Te(e,t),p=await dt(t,d),m=Re(o),g=tt(o),l=ve(o)==="y",{width:y,height:v}=s.floating;let h,b;m==="top"||m==="bottom"?(h=m,b=g===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(b=m,h=g==="end"?"top":"bottom");const x=v-p.top-p.bottom,w=y-p.left-p.right,T=ke(v-p[h],x),S=ke(y-p[b],w),E=!t.middlewareData.shift;let C=T,R=S;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(R=w),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(C=x),E&&!g){const j=se(p.left,0),D=se(p.right,0),_=se(p.top,0),L=se(p.bottom,0);l?R=y-2*(j!==0||D!==0?j+D:se(p.left,p.right)):C=v-2*(_!==0||L!==0?_+L:se(p.top,p.bottom))}await f({...t,availableWidth:R,availableHeight:C});const I=await a.getDimensions(i.floating);return y!==I.width||v!==I.height?{reset:{rects:!0}}:{}}}};function Mt(){return typeof window<"u"}function rt(e){return vo(e)?(e.nodeName||"").toLowerCase():"#document"}function ae(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function xe(e){var t;return(t=(vo(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function vo(e){return Mt()?e instanceof Node||e instanceof ae(e).Node:!1}function he(e){return Mt()?e instanceof Element||e instanceof ae(e).Element:!1}function be(e){return Mt()?e instanceof HTMLElement||e instanceof ae(e).HTMLElement:!1}function gn(e){return!Mt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ae(e).ShadowRoot}const Lc=new Set(["inline","contents"]);function mt(e){const{overflow:t,overflowX:r,overflowY:n,display:o}=ge(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!Lc.has(o)}const Mc=new Set(["table","td","th"]);function Fc(e){return Mc.has(rt(e))}const $c=[":popover-open",":modal"];function Ft(e){return $c.some(t=>{try{return e.matches(t)}catch{return!1}})}const zc=["transform","translate","scale","rotate","perspective"],Bc=["transform","translate","scale","rotate","perspective","filter"],Uc=["paint","layout","strict","content"];function kr(e){const t=jr(),r=he(e)?ge(e):e;return zc.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||Bc.some(n=>(r.willChange||"").includes(n))||Uc.some(n=>(r.contain||"").includes(n))}function Hc(e){let t=je(e);for(;be(t)&&!Je(t);){if(kr(t))return t;if(Ft(t))return null;t=je(t)}return null}function jr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Wc=new Set(["html","body","#document"]);function Je(e){return Wc.has(rt(e))}function ge(e){return ae(e).getComputedStyle(e)}function $t(e){return he(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function je(e){if(rt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gn(e)&&e.host||xe(e);return gn(t)?t.host:t}function yo(e){const t=je(e);return Je(t)?e.ownerDocument?e.ownerDocument.body:e.body:be(t)&&mt(t)?t:yo(t)}function ut(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=yo(e),s=o===((n=e.ownerDocument)==null?void 0:n.body),a=ae(o);if(s){const i=vr(a);return t.concat(a,a.visualViewport||[],mt(o)?o:[],i&&r?ut(i):[])}return t.concat(o,ut(o,[],r))}function vr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function bo(e){const t=ge(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const o=be(e),s=o?e.offsetWidth:r,a=o?e.offsetHeight:n,i=Nt(r)!==s||Nt(n)!==a;return i&&(r=s,n=a),{width:r,height:n,$:i}}function Dr(e){return he(e)?e:e.contextElement}function Xe(e){const t=Dr(e);if(!be(t))return ye(1);const r=t.getBoundingClientRect(),{width:n,height:o,$:s}=bo(t);let a=(s?Nt(r.width):r.width)/n,i=(s?Nt(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const Vc=ye(0);function xo(e){const t=ae(e);return!jr()||!t.visualViewport?Vc:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Kc(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==ae(e)?!1:t}function He(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),s=Dr(e);let a=ye(1);t&&(n?he(n)&&(a=Xe(n)):a=Xe(e));const i=Kc(s,r,n)?xo(s):ye(0);let f=(o.left+i.x)/a.x,d=(o.top+i.y)/a.y,p=o.width/a.x,m=o.height/a.y;if(s){const g=ae(s),l=n&&he(n)?ae(n):n;let y=g,v=vr(y);for(;v&&n&&l!==y;){const h=Xe(v),b=v.getBoundingClientRect(),x=ge(v),w=b.left+(v.clientLeft+parseFloat(x.paddingLeft))*h.x,T=b.top+(v.clientTop+parseFloat(x.paddingTop))*h.y;f*=h.x,d*=h.y,p*=h.x,m*=h.y,f+=w,d+=T,y=ae(v),v=vr(y)}}return At({width:p,height:m,x:f,y:d})}function Lr(e,t){const r=$t(e).scrollLeft;return t?t.left+r:He(xe(e)).left+r}function wo(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-(r?0:Lr(e,n)),s=n.top+t.scrollTop;return{x:o,y:s}}function Gc(e){let{elements:t,rect:r,offsetParent:n,strategy:o}=e;const s=o==="fixed",a=xe(n),i=t?Ft(t.floating):!1;if(n===a||i&&s)return r;let f={scrollLeft:0,scrollTop:0},d=ye(1);const p=ye(0),m=be(n);if((m||!m&&!s)&&((rt(n)!=="body"||mt(a))&&(f=$t(n)),be(n))){const l=He(n);d=Xe(n),p.x=l.x+n.clientLeft,p.y=l.y+n.clientTop}const g=a&&!m&&!s?wo(a,f,!0):ye(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-f.scrollLeft*d.x+p.x+g.x,y:r.y*d.y-f.scrollTop*d.y+p.y+g.y}}function Yc(e){return Array.from(e.getClientRects())}function qc(e){const t=xe(e),r=$t(e),n=e.ownerDocument.body,o=se(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=se(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+Lr(e);const i=-r.scrollTop;return ge(n).direction==="rtl"&&(a+=se(t.clientWidth,n.clientWidth)-o),{width:o,height:s,x:a,y:i}}function Xc(e,t){const r=ae(e),n=xe(e),o=r.visualViewport;let s=n.clientWidth,a=n.clientHeight,i=0,f=0;if(o){s=o.width,a=o.height;const d=jr();(!d||d&&t==="fixed")&&(i=o.offsetLeft,f=o.offsetTop)}return{width:s,height:a,x:i,y:f}}const Jc=new Set(["absolute","fixed"]);function Qc(e,t){const r=He(e,!0,t==="fixed"),n=r.top+e.clientTop,o=r.left+e.clientLeft,s=be(e)?Xe(e):ye(1),a=e.clientWidth*s.x,i=e.clientHeight*s.y,f=o*s.x,d=n*s.y;return{width:a,height:i,x:f,y:d}}function vn(e,t,r){let n;if(t==="viewport")n=Xc(e,r);else if(t==="document")n=qc(xe(e));else if(he(t))n=Qc(t,r);else{const o=xo(e);n={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return At(n)}function Eo(e,t){const r=je(e);return r===t||!he(r)||Je(r)?!1:ge(r).position==="fixed"||Eo(r,t)}function Zc(e,t){const r=t.get(e);if(r)return r;let n=ut(e,[],!1).filter(i=>he(i)&&rt(i)!=="body"),o=null;const s=ge(e).position==="fixed";let a=s?je(e):e;for(;he(a)&&!Je(a);){const i=ge(a),f=kr(a);!f&&i.position==="fixed"&&(o=null),(s?!f&&!o:!f&&i.position==="static"&&!!o&&Jc.has(o.position)||mt(a)&&!f&&Eo(e,a))?n=n.filter(p=>p!==a):o=i,a=je(a)}return t.set(e,n),n}function el(e){let{element:t,boundary:r,rootBoundary:n,strategy:o}=e;const a=[...r==="clippingAncestors"?Ft(t)?[]:Zc(t,this._c):[].concat(r),n],i=a[0],f=a.reduce((d,p)=>{const m=vn(t,p,o);return d.top=se(m.top,d.top),d.right=ke(m.right,d.right),d.bottom=ke(m.bottom,d.bottom),d.left=se(m.left,d.left),d},vn(t,i,o));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function tl(e){const{width:t,height:r}=bo(e);return{width:t,height:r}}function rl(e,t,r){const n=be(t),o=xe(t),s=r==="fixed",a=He(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const f=ye(0);function d(){f.x=Lr(o)}if(n||!n&&!s)if((rt(t)!=="body"||mt(o))&&(i=$t(t)),n){const l=He(t,!0,s,t);f.x=l.x+t.clientLeft,f.y=l.y+t.clientTop}else o&&d();s&&!n&&o&&d();const p=o&&!n&&!s?wo(o,i):ye(0),m=a.left+i.scrollLeft-f.x-p.x,g=a.top+i.scrollTop-f.y-p.y;return{x:m,y:g,width:a.width,height:a.height}}function rr(e){return ge(e).position==="static"}function yn(e,t){if(!be(e)||ge(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return xe(e)===r&&(r=r.ownerDocument.body),r}function Co(e,t){const r=ae(e);if(Ft(e))return r;if(!be(e)){let o=je(e);for(;o&&!Je(o);){if(he(o)&&!rr(o))return o;o=je(o)}return r}let n=yn(e,t);for(;n&&Fc(n)&&rr(n);)n=yn(n,t);return n&&Je(n)&&rr(n)&&!kr(n)?r:n||Hc(e)||r}const nl=async function(e){const t=this.getOffsetParent||Co,r=this.getDimensions,n=await r(e.floating);return{reference:rl(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function ol(e){return ge(e).direction==="rtl"}const sl={convertOffsetParentRelativeRectToViewportRelativeRect:Gc,getDocumentElement:xe,getClippingRect:el,getOffsetParent:Co,getElementRects:nl,getClientRects:Yc,getDimensions:tl,getScale:Xe,isElement:he,isRTL:ol};function To(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function al(e,t){let r=null,n;const o=xe(e);function s(){var i;clearTimeout(n),(i=r)==null||i.disconnect(),r=null}function a(i,f){i===void 0&&(i=!1),f===void 0&&(f=1),s();const d=e.getBoundingClientRect(),{left:p,top:m,width:g,height:l}=d;if(i||t(),!g||!l)return;const y=wt(m),v=wt(o.clientWidth-(p+g)),h=wt(o.clientHeight-(m+l)),b=wt(p),w={rootMargin:-y+"px "+-v+"px "+-h+"px "+-b+"px",threshold:se(0,ke(1,f))||1};let T=!0;function S(E){const C=E[0].intersectionRatio;if(C!==f){if(!T)return a();C?a(!1,C):n=setTimeout(()=>{a(!1,1e-7)},1e3)}C===1&&!To(d,e.getBoundingClientRect())&&a(),T=!1}try{r=new IntersectionObserver(S,{...w,root:o.ownerDocument})}catch{r=new IntersectionObserver(S,w)}r.observe(e)}return a(!0),s}function il(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:f=!1}=n,d=Dr(e),p=o||s?[...d?ut(d):[],...ut(t)]:[];p.forEach(b=>{o&&b.addEventListener("scroll",r,{passive:!0}),s&&b.addEventListener("resize",r)});const m=d&&i?al(d,r):null;let g=-1,l=null;a&&(l=new ResizeObserver(b=>{let[x]=b;x&&x.target===d&&l&&(l.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var w;(w=l)==null||w.observe(t)})),r()}),d&&!f&&l.observe(d),l.observe(t));let y,v=f?He(e):null;f&&h();function h(){const b=He(e);v&&!To(v,b)&&r(),v=b,y=requestAnimationFrame(h)}return r(),()=>{var b;p.forEach(x=>{o&&x.removeEventListener("scroll",r),s&&x.removeEventListener("resize",r)}),m?.(),(b=l)==null||b.disconnect(),l=null,f&&cancelAnimationFrame(y)}}const cl=Oc,ll=kc,dl=Ac,ul=Dc,fl=_c,bn=Pc,pl=jc,ml=(e,t,r)=>{const n=new Map,o={platform:sl,...r},s={...o.platform,_c:n};return Nc(e,t,{...o,platform:s})};var hl=typeof document<"u",gl=function(){},Rt=hl?c.useLayoutEffect:gl;function _t(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!_t(e[n],t[n]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,o[n]))return!1;for(n=r;n--!==0;){const s=o[n];if(!(s==="_owner"&&e.$$typeof)&&!_t(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Ro(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xn(e,t){const r=Ro(e);return Math.round(t*r)/r}function nr(e){const t=c.useRef(e);return Rt(()=>{t.current=e}),t}function vl(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:s,floating:a}={},transform:i=!0,whileElementsMounted:f,open:d}=e,[p,m]=c.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[g,l]=c.useState(n);_t(g,n)||l(n);const[y,v]=c.useState(null),[h,b]=c.useState(null),x=c.useCallback(M=>{M!==E.current&&(E.current=M,v(M))},[]),w=c.useCallback(M=>{M!==C.current&&(C.current=M,b(M))},[]),T=s||y,S=a||h,E=c.useRef(null),C=c.useRef(null),R=c.useRef(p),I=f!=null,j=nr(f),D=nr(o),_=nr(d),L=c.useCallback(()=>{if(!E.current||!C.current)return;const M={placement:t,strategy:r,middleware:g};D.current&&(M.platform=D.current),ml(E.current,C.current,M).then(A=>{const H={...A,isPositioned:_.current!==!1};P.current&&!_t(R.current,H)&&(R.current=H,It.flushSync(()=>{m(H)}))})},[g,t,r,D,_]);Rt(()=>{d===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,m(M=>({...M,isPositioned:!1})))},[d]);const P=c.useRef(!1);Rt(()=>(P.current=!0,()=>{P.current=!1}),[]),Rt(()=>{if(T&&(E.current=T),S&&(C.current=S),T&&S){if(j.current)return j.current(T,S,L);L()}},[T,S,L,j,I]);const k=c.useMemo(()=>({reference:E,floating:C,setReference:x,setFloating:w}),[x,w]),O=c.useMemo(()=>({reference:T,floating:S}),[T,S]),F=c.useMemo(()=>{const M={position:r,left:0,top:0};if(!O.floating)return M;const A=xn(O.floating,p.x),H=xn(O.floating,p.y);return i?{...M,transform:"translate("+A+"px, "+H+"px)",...Ro(O.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:A,top:H}},[r,i,O.floating,p.x,p.y]);return c.useMemo(()=>({...p,update:L,refs:k,elements:O,floatingStyles:F}),[p,L,k,O,F])}const yl=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:o}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?bn({element:n.current,padding:o}).fn(r):{}:n?bn({element:n,padding:o}).fn(r):{}}}},bl=(e,t)=>({...cl(e),options:[e,t]}),xl=(e,t)=>({...ll(e),options:[e,t]}),wl=(e,t)=>({...pl(e),options:[e,t]}),El=(e,t)=>({...dl(e),options:[e,t]}),Cl=(e,t)=>({...ul(e),options:[e,t]}),Tl=(e,t)=>({...fl(e),options:[e,t]}),Rl=(e,t)=>({...yl(e),options:[e,t]});var Sl="Arrow",So=c.forwardRef((e,t)=>{const{children:r,width:n=10,height:o=5,...s}=e;return u.jsx(J.svg,{...s,ref:t,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});So.displayName=Sl;var Nl=So;function Pl(e){const[t,r]=c.useState(void 0);return Ce(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let a,i;if("borderBoxSize"in s){const f=s.borderBoxSize,d=Array.isArray(f)?f[0]:f;a=d.inlineSize,i=d.blockSize}else a=e.offsetWidth,i=e.offsetHeight;r({width:a,height:i})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var Mr="Popper",[No,Po]=Ze(Mr),[Al,Ao]=No(Mr),_o=e=>{const{__scopePopper:t,children:r}=e,[n,o]=c.useState(null);return u.jsx(Al,{scope:t,anchor:n,onAnchorChange:o,children:r})};_o.displayName=Mr;var Io="PopperAnchor",Oo=c.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...o}=e,s=Ao(Io,r),a=c.useRef(null),i=ce(t,a);return c.useEffect(()=>{s.onAnchorChange(n?.current||a.current)}),n?null:u.jsx(J.div,{...o,ref:i})});Oo.displayName=Io;var Fr="PopperContent",[_l,Il]=No(Fr),ko=c.forwardRef((e,t)=>{const{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:s="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:f=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:l="optimized",onPlaced:y,...v}=e,h=Ao(Fr,r),[b,x]=c.useState(null),w=ce(t,V=>x(V)),[T,S]=c.useState(null),E=Pl(T),C=E?.width??0,R=E?.height??0,I=n+(s!=="center"?"-"+s:""),j=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},D=Array.isArray(d)?d:[d],_=D.length>0,L={padding:j,boundary:D.filter(kl),altBoundary:_},{refs:P,floatingStyles:k,placement:O,isPositioned:F,middlewareData:M}=vl({strategy:"fixed",placement:I,whileElementsMounted:(...V)=>il(...V,{animationFrame:l==="always"}),elements:{reference:h.anchor},middleware:[bl({mainAxis:o+R,alignmentAxis:a}),f&&xl({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?wl():void 0,...L}),f&&El({...L}),Cl({...L,apply:({elements:V,rects:We,availableWidth:De,availableHeight:Ve})=>{const{width:Le,height:st}=We.reference,Me=V.floating.style;Me.setProperty("--radix-popper-available-width",`${De}px`),Me.setProperty("--radix-popper-available-height",`${Ve}px`),Me.setProperty("--radix-popper-anchor-width",`${Le}px`),Me.setProperty("--radix-popper-anchor-height",`${st}px`)}}),T&&Rl({element:T,padding:i}),jl({arrowWidth:C,arrowHeight:R}),g&&Tl({strategy:"referenceHidden",...L})]}),[A,H]=Lo(O),Q=Ee(y);Ce(()=>{F&&Q?.()},[F,Q]);const U=M.arrow?.x,B=M.arrow?.y,W=M.arrow?.centerOffset!==0,[ee,Se]=c.useState();return Ce(()=>{b&&Se(window.getComputedStyle(b).zIndex)},[b]),u.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...k,transform:F?k.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(" "),...M.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(_l,{scope:r,placedSide:A,onArrowChange:S,arrowX:U,arrowY:B,shouldHideArrow:W,children:u.jsx(J.div,{"data-side":A,"data-align":H,...v,ref:w,style:{...v.style,animation:F?void 0:"none"}})})})});ko.displayName=Fr;var jo="PopperArrow",Ol={top:"bottom",right:"left",bottom:"top",left:"right"},Do=c.forwardRef(function(t,r){const{__scopePopper:n,...o}=t,s=Il(jo,n),a=Ol[s.placedSide];return u.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:u.jsx(Nl,{...o,ref:r,style:{...o.style,display:"block"}})})});Do.displayName=jo;function kl(e){return e!==null}var jl=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:o}=t,a=o.arrow?.centerOffset!==0,i=a?0:e.arrowWidth,f=a?0:e.arrowHeight,[d,p]=Lo(r),m={start:"0%",center:"50%",end:"100%"}[p],g=(o.arrow?.x??0)+i/2,l=(o.arrow?.y??0)+f/2;let y="",v="";return d==="bottom"?(y=a?m:`${g}px`,v=`${-f}px`):d==="top"?(y=a?m:`${g}px`,v=`${n.floating.height+f}px`):d==="right"?(y=`${-f}px`,v=a?m:`${l}px`):d==="left"&&(y=`${n.floating.width+f}px`,v=a?m:`${l}px`),{data:{x:y,y:v}}}});function Lo(e){const[t,r="center"]=e.split("-");return[t,r]}var Dl=_o,Ll=Oo,Ml=ko,Fl=Do,[zt,pu]=Ze("Tooltip",[Po]),Bt=Po(),Mo="TooltipProvider",$l=700,yr="tooltip.open",[zl,$r]=zt(Mo),Fo=e=>{const{__scopeTooltip:t,delayDuration:r=$l,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:s}=e,a=c.useRef(!0),i=c.useRef(!1),f=c.useRef(0);return c.useEffect(()=>{const d=f.current;return()=>window.clearTimeout(d)},[]),u.jsx(zl,{scope:t,isOpenDelayedRef:a,delayDuration:r,onOpen:c.useCallback(()=>{window.clearTimeout(f.current),a.current=!1},[]),onClose:c.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>a.current=!0,n)},[n]),isPointerInTransitRef:i,onPointerInTransitChange:c.useCallback(d=>{i.current=d},[]),disableHoverableContent:o,children:s})};Fo.displayName=Mo;var ft="Tooltip",[Bl,Ut]=zt(ft),$o=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:o,onOpenChange:s,disableHoverableContent:a,delayDuration:i}=e,f=$r(ft,e.__scopeTooltip),d=Bt(t),[p,m]=c.useState(null),g=Ar(),l=c.useRef(0),y=a??f.disableHoverableContent,v=i??f.delayDuration,h=c.useRef(!1),[b,x]=kt({prop:n,defaultProp:o??!1,onChange:C=>{C?(f.onOpen(),document.dispatchEvent(new CustomEvent(yr))):f.onClose(),s?.(C)},caller:ft}),w=c.useMemo(()=>b?h.current?"delayed-open":"instant-open":"closed",[b]),T=c.useCallback(()=>{window.clearTimeout(l.current),l.current=0,h.current=!1,x(!0)},[x]),S=c.useCallback(()=>{window.clearTimeout(l.current),l.current=0,x(!1)},[x]),E=c.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>{h.current=!0,x(!0),l.current=0},v)},[v,x]);return c.useEffect(()=>()=>{l.current&&(window.clearTimeout(l.current),l.current=0)},[]),u.jsx(Dl,{...d,children:u.jsx(Bl,{scope:t,contentId:g,open:b,stateAttribute:w,trigger:p,onTriggerChange:m,onTriggerEnter:c.useCallback(()=>{f.isOpenDelayedRef.current?E():T()},[f.isOpenDelayedRef,E,T]),onTriggerLeave:c.useCallback(()=>{y?S():(window.clearTimeout(l.current),l.current=0)},[S,y]),onOpen:T,onClose:S,disableHoverableContent:y,children:r})})};$o.displayName=ft;var br="TooltipTrigger",zo=c.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,o=Ut(br,r),s=$r(br,r),a=Bt(r),i=c.useRef(null),f=ce(t,i,o.onTriggerChange),d=c.useRef(!1),p=c.useRef(!1),m=c.useCallback(()=>d.current=!1,[]);return c.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),u.jsx(Ll,{asChild:!0,...a,children:u.jsx(J.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:f,onPointerMove:G(e.onPointerMove,g=>{g.pointerType!=="touch"&&!p.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),p.current=!0)}),onPointerLeave:G(e.onPointerLeave,()=>{o.onTriggerLeave(),p.current=!1}),onPointerDown:G(e.onPointerDown,()=>{o.open&&o.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:G(e.onFocus,()=>{d.current||o.onOpen()}),onBlur:G(e.onBlur,o.onClose),onClick:G(e.onClick,o.onClose)})})});zo.displayName=br;var Ul="TooltipPortal",[mu,Hl]=zt(Ul,{forceMount:void 0}),Qe="TooltipContent",Bo=c.forwardRef((e,t)=>{const r=Hl(Qe,e.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...s}=e,a=Ut(Qe,e.__scopeTooltip);return u.jsx(Ot,{present:n||a.open,children:a.disableHoverableContent?u.jsx(Uo,{side:o,...s,ref:t}):u.jsx(Wl,{side:o,...s,ref:t})})}),Wl=c.forwardRef((e,t)=>{const r=Ut(Qe,e.__scopeTooltip),n=$r(Qe,e.__scopeTooltip),o=c.useRef(null),s=ce(t,o),[a,i]=c.useState(null),{trigger:f,onClose:d}=r,p=o.current,{onPointerInTransitChange:m}=n,g=c.useCallback(()=>{i(null),m(!1)},[m]),l=c.useCallback((y,v)=>{const h=y.currentTarget,b={x:y.clientX,y:y.clientY},x=ql(b,h.getBoundingClientRect()),w=Xl(b,x),T=Jl(v.getBoundingClientRect()),S=Zl([...w,...T]);i(S),m(!0)},[m]);return c.useEffect(()=>()=>g(),[g]),c.useEffect(()=>{if(f&&p){const y=h=>l(h,p),v=h=>l(h,f);return f.addEventListener("pointerleave",y),p.addEventListener("pointerleave",v),()=>{f.removeEventListener("pointerleave",y),p.removeEventListener("pointerleave",v)}}},[f,p,l,g]),c.useEffect(()=>{if(a){const y=v=>{const h=v.target,b={x:v.clientX,y:v.clientY},x=f?.contains(h)||p?.contains(h),w=!Ql(b,a);x?g():w&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[f,p,a,d,g]),u.jsx(Uo,{...e,ref:s})}),[Vl,Kl]=zt(ft,{isInside:!1}),Gl=ea("TooltipContent"),Uo=c.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:a,...i}=e,f=Ut(Qe,r),d=Bt(r),{onClose:p}=f;return c.useEffect(()=>(document.addEventListener(yr,p),()=>document.removeEventListener(yr,p)),[p]),c.useEffect(()=>{if(f.trigger){const m=g=>{g.target?.contains(f.trigger)&&p()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[f.trigger,p]),u.jsx(Tr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:p,children:u.jsxs(Ml,{"data-state":f.stateAttribute,...d,...i,ref:t,style:{...i.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:[u.jsx(Gl,{children:n}),u.jsx(Vl,{scope:r,isInside:!0,children:u.jsx(Ca,{id:f.contentId,role:"tooltip",children:o||n})})]})})});Bo.displayName=Qe;var Ho="TooltipArrow",Yl=c.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,o=Bt(r);return Kl(Ho,r).isInside?null:u.jsx(Fl,{...o,...n,ref:t})});Yl.displayName=Ho;function ql(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(r,n,o,s)){case s:return"left";case o:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function Xl(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function Jl(e){const{top:t,right:r,bottom:n,left:o}=e;return[{x:o,y:t},{x:r,y:t},{x:r,y:n},{x:o,y:n}]}function Ql(e,t){const{x:r,y:n}=e;let o=!1;for(let s=0,a=t.length-1;sn!=g>n&&r<(m-d)*(n-p)/(g-p)+d&&(o=!o)}return o}function Zl(e){const t=e.slice();return t.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),ed(t)}function ed(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(o.y-a.y)>=(s.y-a.y)*(o.x-a.x))t.pop();else break}t.push(o)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const o=e[n];for(;r.length>=2;){const s=r[r.length-1],a=r[r.length-2];if((s.x-a.x)*(o.y-a.y)>=(s.y-a.y)*(o.x-a.x))r.pop();else break}r.push(o)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var td=Fo,rd=$o,nd=zo,Wo=Bo;const od=td,hu=rd,gu=nd,sd=c.forwardRef(({className:e,sideOffset:t=4,...r},n)=>u.jsx(Wo,{ref:n,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),...r}));sd.displayName=Wo.displayName;const ad="https://ahqauomkgflopxgnlndd.supabase.co",id="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFocWF1b21rZ2Zsb3B4Z25sbmRkIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjQwMTA2NjcsImV4cCI6MjA3OTU4NjY2N30.WGZoTjcJMSDxG5ss1Oe4T0bSBzhsiijfj-I3DnviWGU";async function cd(e,t,r){return await r()}function ld(){return Ms(ad,id,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0,lock:cd},global:{headers:{"User-Agent":"Supabase-JS/2.0"}}})}const re=ld(),dd={user:null,isLoading:!1,error:null,login:async()=>{throw new Error("AuthenticationProvider not initialized")},logout:async()=>{throw new Error("AuthenticationProvider not initialized")},resetAuth:async()=>{throw new Error("AuthenticationProvider not initialized")},refreshUserData:async()=>{throw new Error("AuthenticationProvider not initialized")},userRole:null,tenantId:null,isAdmin:!1,loading:!1,signOut:async()=>{throw new Error("AuthenticationProvider not initialized")},signIn:async()=>{throw new Error("AuthenticationProvider not initialized")},signUp:async()=>{throw new Error("AuthenticationProvider not initialized")},resetPassword:async()=>{throw new Error("AuthenticationProvider not initialized")}},Vo=c.createContext(dd);function nt(){const e=c.useContext(Vo);if(!e)throw new Error("useAuth must be used within AuthenticationProvider");return e}class ze{constructor(){ne(this,"memoryCache",new Map);ne(this,"STORAGE_PREFIX","auth_cache_");ne(this,"DEFAULT_TTL",36e5)}set(t,r,n){const o={value:r,timestamp:Date.now(),ttl:n??this.DEFAULT_TTL};this.memoryCache.set(t,o);try{sessionStorage.setItem(this.getStorageKey(t),JSON.stringify(o))}catch{console.error("[SessionCacheService] Failed to sync to sessionStorage",{key:t})}}get(t){let r=this.memoryCache.get(t);return r||(r=this.loadFromStorage(t),r&&this.memoryCache.set(t,r)),r?Date.now()-r.timestamp>r.ttl?(this.delete(t),null):r.value:null}has(t){return this.get(t)!==null}delete(t){this.memoryCache.delete(t);try{sessionStorage.removeItem(this.getStorageKey(t))}catch{console.error("[SessionCacheService] Failed to remove from sessionStorage",{key:t})}}clear(){this.memoryCache.clear();try{const t=[];for(let r=0;rsessionStorage.removeItem(r))}catch{console.error("[SessionCacheService] Failed to clear sessionStorage")}}getStats(){return{memoryCacheSize:this.memoryCache.size,keys:Array.from(this.memoryCache.keys())}}loadFromStorage(t){try{const r=sessionStorage.getItem(this.getStorageKey(t));if(!r)return null;const n=JSON.parse(r);return!n||typeof n.timestamp!="number"||typeof n.ttl!="number"?null:n}catch{return null}}getStorageKey(t){return`${this.STORAGE_PREFIX}${t}`}static userKey(t){return`user:${t}`}static roleKey(t){return`role:${t}`}static permissionsKey(t){return`permissions:${t}`}static profileKey(t){return`profile:${t}`}static clinicianKey(t){return`clinician:${t}`}}const oe=new ze;class ud{constructor(){ne(this,"pending",new Map);ne(this,"CLEANUP_DELAY",100)}async deduplicate(t,r){const n=this.pending.get(t);if(n)return new Promise((a,i)=>{n.resolvers.push(a),n.rejectors.push(i)});const o=r(),s={promise:o,resolvers:[],rejectors:[],timestamp:Date.now()};this.pending.set(t,s);try{const a=await o;return s.resolvers.forEach(i=>i(a)),a}catch(a){const i=a instanceof Error?a:new Error(String(a));throw s.rejectors.forEach(f=>f(i)),a}finally{setTimeout(()=>{this.pending.delete(t)},this.CLEANUP_DELAY)}}clear(t){this.pending.delete(t)}clearAll(){this.pending.clear()}getPendingCount(){return this.pending.size}isPending(t){return this.pending.has(t)}getPendingKeys(){return Array.from(this.pending.keys())}}const or=new ud;class fd{constructor(){ne(this,"CACHE_TTL",36e5)}async detectUserRole(t){const r=this.getCachedRole(t);if(r)return r;const n=await this.fetchUserRoleData(t);return oe.set(ze.roleKey(t),n,this.CACHE_TTL),n}getCachedRole(t){return oe.get(ze.roleKey(t))}invalidateCache(t){oe.delete(ze.roleKey(t)),oe.delete(ze.profileKey(t)),oe.delete(ze.clinicianKey(t)),oe.delete(ze.permissionsKey(t))}async fetchUserRoleData(t){const r=await or.deduplicate(`profile:${t}`,()=>this.fetchProfile(t));if(!r)return{userId:t,role:"staff",isStaff:!1,isClient:!1,isClinician:!1,isAdmin:!1,permissions:{user_id:t,tenant_id:""},tenantId:"",profile:null,signupIncomplete:!0};const{data:n,error:o}=await re.from("user_roles").select("*").eq("user_id",t);if(o)throw o;const s=n?.map(l=>l.role)||[],a=s.includes("admin"),i=!1,f=s.includes("staff")||i||a,d=s.includes("client");let p=null;(f||a)&&(p=await or.deduplicate(`clinician:${t}`,()=>this.fetchClinicianData(t,r.tenant_id)));let m={user_id:t,tenant_id:r.tenant_id};if(f){const l=await or.deduplicate(`permissions:${t}`,()=>this.fetchPermissions(t,r.tenant_id));l&&(m=l)}return{userId:t,role:f?"staff":"client",isStaff:f,isClient:d,isClinician:i,isAdmin:a,permissions:m,tenantId:r.tenant_id,profile:r,clinicianData:p||void 0}}async fetchProfile(t){const{data:r,error:n}=await re.from("profiles").select("*").eq("id",t).maybeSingle();if(n)throw n;if(!r)return null;const{data:o,error:s}=await re.from("staff").select("*").eq("profile_id",t).maybeSingle();return{user_id:t,email:r.email,first_name:o?.prov_name_f||null,last_name:o?.prov_name_l||null,full_name:o?`${o.prov_name_f||""} ${o.prov_name_l||""}`.trim():null,role:"staff",tenant_id:o?.tenant_id||"00000000-0000-0000-0000-000000000001",avatar_url:o?.prov_image_url||null,phone:o?.prov_phone||null,archived:!r.is_active,staff_id:o?.id}}async fetchClinicianData(t,r){const{data:n,error:o}=await re.from("staff").select("*").eq("profile_id",t).eq("tenant_id",r).maybeSingle();return o||!n?null:{id:n.id,user_id:t,tenant_id:n.tenant_id,is_clinician:!0,is_admin:!1,clinician_status:n.prov_status,prov_name_f:n.prov_name_f,prov_name_last:n.prov_name_l,prov_npi:n.prov_npi,prov_license_type:n.prov_license_type}}async fetchPermissions(t,r){return{user_id:t,tenant_id:r,access_appointments:!0,access_calendar:!0,access_customers:!0,access_forms:!0,access_invoicing:!0,access_services:!0,access_settings:!0,access_user_management:!0,supervisor:!1}}}const Et=new fd;var me=(e=>(e.NETWORK_ERROR="NETWORK_ERROR",e.AUTHENTICATION_FAILED="AUTHENTICATION_FAILED",e.ROLE_DETECTION_FAILED="ROLE_DETECTION_FAILED",e.CIRCUIT_BREAKER_OPEN="CIRCUIT_BREAKER_OPEN",e.REDIRECT_LOOP_DETECTED="REDIRECT_LOOP_DETECTED",e.PERMISSION_DENIED="PERMISSION_DENIED",e.DATA_FETCH_FAILED="DATA_FETCH_FAILED",e.SESSION_EXPIRED="SESSION_EXPIRED",e.UNKNOWN_ERROR="UNKNOWN_ERROR",e))(me||{});class Z extends Error{constructor(r,n,o,s=!0,a){super(n);ne(this,"type");ne(this,"recoverable");ne(this,"userMessage");ne(this,"technicalDetails");this.name="AuthError",this.type=r,this.recoverable=s,this.userMessage=o,this.technicalDetails=a,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Z)}static fromError(r,n){if(r instanceof Z)return r;if(r instanceof Error){const o=n||Z.detectErrorType(r),s=Z.getUserMessage(o,r);return new Z(o,r.message,s,!0,{originalError:r})}return new Z("UNKNOWN_ERROR","An unknown error occurred","Something went wrong. Please try again.",!0,{originalError:r})}static detectErrorType(r){const n=r.message.toLowerCase();return n.includes("network")||n.includes("fetch")?"NETWORK_ERROR":n.includes("circuit breaker")?"CIRCUIT_BREAKER_OPEN":n.includes("invalid")||n.includes("credentials")?"AUTHENTICATION_FAILED":n.includes("role")||n.includes("profile")?"ROLE_DETECTION_FAILED":n.includes("permission")||n.includes("access denied")?"PERMISSION_DENIED":n.includes("session")||n.includes("expired")?"SESSION_EXPIRED":"UNKNOWN_ERROR"}static getUserMessage(r,n){switch(r){case"NETWORK_ERROR":return"Network connection issue. Please check your internet connection and try again.";case"AUTHENTICATION_FAILED":return"Invalid email or password. Please check your credentials and try again.";case"ROLE_DETECTION_FAILED":return"Unable to determine your account type. Please contact support if this persists.";case"CIRCUIT_BREAKER_OPEN":return"The system is experiencing issues. Please wait a moment and try again.";case"REDIRECT_LOOP_DETECTED":return"Navigation error detected. Please refresh the page or contact support.";case"PERMISSION_DENIED":return"You do not have permission to access this resource.";case"DATA_FETCH_FAILED":return"Failed to load your account data. Please try again.";case"SESSION_EXPIRED":return"Your session has expired. Please log in again.";case"UNKNOWN_ERROR":default:return n?.message||"An unexpected error occurred. Please try again."}}isRecoverable(){return this.recoverable}shouldRetry(){return this.type==="NETWORK_ERROR"||this.type==="DATA_FETCH_FAILED"}getRetryDelay(r){return Math.min(1e3*Math.pow(2,r-1),4e3)}}function pd({children:e}){const t=Fs(),[r,n]=c.useState(null),[o,s]=c.useState(!0),[a,i]=c.useState(null),[f,d]=c.useState(!1),p=c.useCallback(async(E,C)=>{try{const R=await Et.detectUserRole(E);let I;R.isStaff&&(I={is_clinician:R.isClinician,is_admin:R.isAdmin,clinician_status:R.clinicianData?.clinician_status,clinicianData:R.clinicianData});const j={id:E,email:C,profile:R.profile,role:R.role,staffAttributes:I,permissions:R.permissions,roleContext:R,user_metadata:{full_name:`${R.profile.first_name||""} ${R.profile.last_name||""}`.trim(),first_name:R.profile.first_name,last_name:R.profile.last_name}};if(oe.set(`user:${E}`,j,36e5),!R.tenantId)throw new Error("User loaded but tenantId is missing - this indicates a profile or data integrity issue");n(j),i(null)}catch(R){const I=Z.fromError(R,me.DATA_FETCH_FAILED);throw console.error("[AuthenticationProvider] Failed to load user data",{userId:E,error:I.message}),i(I),I}},[]),m=c.useCallback(async(E,C)=>{s(!0),i(null);try{const{data:R,error:I}=await re.auth.signInWithPassword({email:E,password:C});if(I)throw new Z(me.AUTHENTICATION_FAILED,I.message,"Invalid email or password. Please check your credentials and try again.",!1,{originalError:I});if(!R.user)throw new Z(me.AUTHENTICATION_FAILED,"Authentication succeeded but no user data returned","Login failed. Please try again.",!0);await p(R.user.id,R.user.email||E)}catch(R){const I=Z.fromError(R);throw console.error("[AuthenticationProvider] Login failed",{error:I.message}),i(I),n(null),I}finally{s(!1)}},[p]),g=c.useCallback(async()=>{s(!0);try{const{error:E}=await re.auth.signOut();E&&console.error("[AuthenticationProvider] Supabase sign out error",E),n(null),i(null),oe.clear(),r&&Et.invalidateCache(r.id)}catch(E){console.error("[AuthenticationProvider] Logout error",E),n(null),i(null),oe.clear()}finally{s(!1)}},[r]),l=c.useCallback(async()=>{s(!0),i(null);try{oe.clear(),r&&Et.invalidateCache(r.id);const{data:{session:E},error:C}=await re.auth.getSession();if(C)throw new Z(me.SESSION_EXPIRED,C.message,"Failed to retrieve session. Please log in again.",!0,{originalError:C});E?.user?await p(E.user.id,E.user.email||""):n(null)}catch(E){const C=Z.fromError(E);throw console.error("[AuthenticationProvider] Reset error",{error:C.message}),i(C),C}finally{s(!1)}},[r,p]),y=c.useCallback(async()=>{if(r){s(!0),i(null);try{Et.invalidateCache(r.id),oe.delete(`user:${r.id}`),await p(r.id,r.email)}catch(E){const C=Z.fromError(E,me.DATA_FETCH_FAILED);throw console.error("[AuthenticationProvider] Refresh error",{error:C.message}),i(C),C}finally{s(!1)}}},[r,p]);c.useEffect(()=>{let E=!0;return(async()=>{try{const R=re.auth.getSession();let I;const j=new Promise((L,P)=>{I=setTimeout(()=>{P(new Error("Session initialization timeout after 8 seconds"))},8e3)});let D,_;try{const L=await Promise.race([R,j]);clearTimeout(I),D=L.data?.session,_=L.error}catch(L){throw clearTimeout(I),L}if(_)throw _;if(D?.user&&E){t.invalidateQueries({queryKey:["customers"]});const L=oe.get(`user:${D.user.id}`);if(L){n(L),s(!1),d(!0);return}await p(D.user.id,D.user.email||"")}}catch(R){const I=Z.fromError(R,me.SESSION_EXPIRED);console.error("[AuthenticationProvider] Session initialization error",{error:I.message}),i(I)}finally{E&&(s(!1),d(!0))}})(),()=>{E=!1}},[p]),c.useEffect(()=>{const{data:{subscription:E}}=re.auth.onAuthStateChange(async(C,R)=>{try{switch(C){case"SIGNED_IN":R?.user&&await p(R.user.id,R.user.email||"");break;case"SIGNED_OUT":n(null),i(null),oe.clear();break;case"TOKEN_REFRESHED":break;case"USER_UPDATED":R?.user&&r&&await p(R.user.id,R.user.email||"");break;case"INITIAL_SESSION":break;default:break}}catch(I){const j=Z.fromError(I);console.error("[AuthenticationProvider] Auth state change error",{error:j.message}),i(j)}});return()=>{E.unsubscribe()}},[p,r]);const v=c.useCallback(async(E,C)=>{try{return await m(E,C),{}}catch(R){return{error:R}}},[m]),h=c.useCallback(async(E,C,R,I,j,D,_)=>{try{const L=`${window.location.origin}/`,{error:P}=await re.auth.signUp({email:E,password:C,options:{emailRedirectTo:L,data:{first_name:R,last_name:I,phone:j,company_name:D,user_type:_}}});return P?{error:P}:{}}catch(L){return{error:L}}},[]),b=c.useCallback(async E=>{try{const{error:C}=await re.auth.resetPasswordForEmail(E,{redirectTo:`${window.location.origin}/reset-password`});return C?{error:C}:{}}catch(C){return{error:C}}},[]),x=r?.role||null,w=r?.profile?.tenant_id||null,T=r?.staffAttributes?.is_admin||!1,S={user:r,isLoading:o,error:a,login:m,logout:g,resetAuth:l,refreshUserData:y,userRole:x,tenantId:w,isAdmin:T,loading:o,signOut:g,signIn:v,signUp:h,resetPassword:b};return f?u.jsx(Vo.Provider,{value:S,children:e}):null}const md=Lt("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Oe=c.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},s)=>{const a=n?Qs:"button";return u.jsx(a,{className:X(md({variant:t,size:r,className:e})),ref:s,...o})});Oe.displayName="Button";const Ht=c.forwardRef(({className:e,...t},r)=>u.jsx("div",{ref:r,className:X("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Ht.displayName="Card";const Wt=c.forwardRef(({className:e,...t},r)=>u.jsx("div",{ref:r,className:X("flex flex-col space-y-1.5 p-6",e),...t}));Wt.displayName="CardHeader";const Vt=c.forwardRef(({className:e,...t},r)=>u.jsx("h3",{ref:r,className:X("text-2xl font-semibold leading-none tracking-tight",e),...t}));Vt.displayName="CardTitle";const Kt=c.forwardRef(({className:e,...t},r)=>u.jsx("p",{ref:r,className:X("text-sm text-muted-foreground",e),...t}));Kt.displayName="CardDescription";const Gt=c.forwardRef(({className:e,...t},r)=>u.jsx("div",{ref:r,className:X("p-6 pt-0",e),...t}));Gt.displayName="CardContent";const Ko=c.forwardRef(({className:e,...t},r)=>u.jsx("div",{ref:r,className:X("flex items-center p-6 pt-0",e),...t}));Ko.displayName="CardFooter";const hd=Lt("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),zr=c.forwardRef(({className:e,variant:t,...r},n)=>u.jsx("div",{ref:n,role:"alert",className:X(hd({variant:t}),e),...r}));zr.displayName="Alert";const Go=c.forwardRef(({className:e,...t},r)=>u.jsx("h5",{ref:r,className:X("mb-1 font-medium leading-none tracking-tight",e),...t}));Go.displayName="AlertTitle";const Br=c.forwardRef(({className:e,...t},r)=>u.jsx("div",{ref:r,className:X("text-sm [&_p]:leading-relaxed",e),...t}));Br.displayName="AlertDescription";function wn({error:e,onReset:t}){const r=()=>{console.debug("[RoutingErrorPage] Reset button clicked"),t()},n=()=>{console.debug("[RoutingErrorPage] Go home button clicked"),window.location.href="/"};return u.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:u.jsxs(Ht,{className:"max-w-2xl w-full",children:[u.jsxs(Wt,{children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(fr,{className:"h-6 w-6 text-destructive"}),u.jsx(Vt,{children:"Navigation Error"})]}),u.jsx(Kt,{children:"We encountered an issue while trying to navigate you to the correct page."})]}),u.jsxs(Gt,{className:"space-y-4",children:[u.jsxs(zr,{variant:"destructive",children:[u.jsx(fr,{className:"h-4 w-4"}),u.jsx(Go,{children:"Error Details"}),u.jsx(Br,{children:e.userMessage})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("h3",{className:"font-semibold text-sm",children:"What you can try:"}),u.jsxs("ul",{className:"list-disc list-inside space-y-1 text-sm text-muted-foreground",children:[u.jsx("li",{children:'Click "Reset and Retry" to clear the error and try again'}),u.jsx("li",{children:"Refresh your browser page"}),u.jsx("li",{children:"Clear your browser cache and cookies"}),u.jsx("li",{children:"If the problem persists, contact support"})]})]}),!1]}),u.jsxs(Ko,{className:"flex gap-2",children:[u.jsxs(Oe,{onClick:r,className:"flex items-center gap-2",children:[u.jsx(no,{className:"h-4 w-4"}),"Reset and Retry"]}),u.jsxs(Oe,{onClick:n,variant:"outline",className:"flex items-center gap-2",children:[u.jsx(Ga,{className:"h-4 w-4"}),"Go to Home"]})]})]})})}const gd=["/auth","/login","/complete-signup","/public-invoice"],vd=3,yd=5e3,bd=100;function Yo(e){return gd.some(t=>e.startsWith(t))}function xd(e,t){return e?t.startsWith("/billing/")?{shouldRedirect:!1,reason:"User accessing billing portal"}:{shouldRedirect:!0,redirectTo:"/billing/dashboard",reason:"User redirected to billing dashboard"}:Yo(t)?{shouldRedirect:!1,reason:"Public route, no authentication required"}:{shouldRedirect:!0,redirectTo:"/auth",reason:"User not authenticated"}}function wd({children:e}){const{user:t,isLoading:r,error:n}=nt(),o=Cr(),s=Rn(),a=c.useRef([]),i=c.useRef(0),[f,d]=c.useState(null),p=()=>{const g=Date.now();if(g-i.currentg-l.timestamp=vd){const l=new Z(me.REDIRECT_LOOP_DETECTED,"Too many redirects detected","Navigation error detected. Please refresh the page or contact support.",!0,{redirectHistory:a.current,currentPath:o.pathname});return d(l),!1}return!0},m=g=>{const l=Date.now();a.current.push({path:g,timestamp:l}),i.current=l};return c.useEffect(()=>{if(r||f)return;if(n){n instanceof Z&&(n.type===me.AUTHENTICATION_FAILED||n.type===me.SESSION_EXPIRED)&&(Yo(o.pathname)||s("/auth",{replace:!0}));return}const g=xd(t,o.pathname);if(g.shouldRedirect&&g.redirectTo){if(!p())return;m(g.redirectTo),s(g.redirectTo,{replace:!0})}},[t,r,n,o.pathname,s,f]),f?u.jsx(wn,{error:f,onReset:()=>{d(null),a.current=[],i.current=0}}):r?u.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:u.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-primary"})}):n&&n instanceof Z&&n.type===me.ROLE_DETECTION_FAILED?u.jsx(wn,{error:n,onReset:()=>{window.location.href="/auth"}}):u.jsx(u.Fragment,{children:e})}const Ed={light:{primary:"207 90% 54%",primaryDark:"210 100% 45%",primaryLight:"207 82% 66%",ring:"207 90% 54%"},dark:{primary:"207 82% 66%",primaryDark:"207 90% 54%",primaryLight:"207 82% 76%",ring:"207 82% 66%"}};function Cd({children:e}){return c.useEffect(()=>{const t=Ed,r=document.documentElement;r.style.setProperty("--primary",t.light.primary),r.style.setProperty("--primary-dark",t.light.primaryDark),r.style.setProperty("--primary-light",t.light.primaryLight),r.style.setProperty("--ring",t.light.ring),Td(t.dark)},[]),u.jsx(u.Fragment,{children:e})}function Td(e){let t=document.getElementById("dynamic-dark-theme");t||(t=document.createElement("style"),t.id="dynamic-dark-theme",document.head.appendChild(t)),t.textContent=` .dark { --primary: ${e.primary}; --primary-dark: ${e.primaryDark}; --primary-light: ${e.primaryLight}; --ring: ${e.ring}; } `}const ot=(e,t)=>e?e[t]===!0:!1,vu=e=>ot(e,"access_appointments"),yu=e=>ot(e,"access_services"),bu=e=>ot(e,"access_invoicing"),xu=e=>ot(e,"access_forms"),wu=e=>ot(e,"supervisor"),Eu=e=>ot(e,"access_payroll"),Rd=e=>e==="client"?{access_appointments:!1,access_services:!1,access_invoicing:!1,access_forms:!1,access_payroll:!1,supervisor:!1}:{access_appointments:!1,access_services:!1,access_invoicing:!1,access_forms:!1,access_payroll:!1,supervisor:!1},Sd={ACCOUNT_OWNER:{access_appointments:!0,access_services:!0,access_invoicing:!0,access_forms:!0,access_payroll:!0,supervisor:!0},ADMIN:{access_appointments:!0,access_services:!0,access_invoicing:!0,access_forms:!0,access_payroll:!0,supervisor:!1},BILLING:{access_appointments:!1,access_services:!1,access_invoicing:!0,access_forms:!1,access_payroll:!0,supervisor:!1},CLINICIAN:{access_appointments:!0,access_services:!1,access_invoicing:!1,access_forms:!0,access_payroll:!1,supervisor:!1},SUPERVISOR:{access_appointments:!0,access_services:!1,access_invoicing:!1,access_forms:!0,access_payroll:!1,supervisor:!0},OFFICE:{access_appointments:!0,access_services:!0,access_invoicing:!1,access_forms:!1,access_payroll:!1,supervisor:!1},TELEHEALTH:{access_appointments:!0,access_services:!1,access_invoicing:!1,access_forms:!1,access_payroll:!1,supervisor:!1}};function Nd(e){const t={access_appointments:!1,access_services:!1,access_invoicing:!1,access_forms:!1,access_payroll:!1,supervisor:!1};return e.reduce((r,n)=>{const o=Sd[n];return o?{access_appointments:r.access_appointments||o.access_appointments||!1,access_services:r.access_services||o.access_services||!1,access_invoicing:r.access_invoicing||o.access_invoicing||!1,access_forms:r.access_forms||o.access_forms||!1,access_payroll:r.access_payroll||o.access_payroll||!1,supervisor:r.supervisor||o.supervisor||!1}:(console.warn(`[rolePermissionMapping] Unknown role code: ${n}`),r)},t)}function Pd(e={}){const{user:t,userRole:r,tenantId:n}=nt(),o=e.userId||t?.id,[s,a]=c.useState(null),[i,f]=c.useState(!0),[d,p]=c.useState(null),m=c.useCallback(async()=>{if(!o||e.enabled===!1){f(!1);return}f(!0),p(null);try{const{data:b,error:x}=await re.from("staff").select("id").eq("profile_id",o).maybeSingle();if(x)throw x;if(!b){a([]),f(!1);return}const{data:w,error:T}=await re.from("staff_role_assignments").select(` id, staff_id, staff_role_id, staff_roles!inner ( id, code, name ) `).eq("staff_id",b.id);if(T)throw T;const S=w?.map(E=>E.staff_roles?.code).filter(Boolean)||[];a(S)}catch(b){const x=b instanceof Error?b.message:"Failed to fetch permissions";console.error("[usePermissionsData] Error:",x),p(x),a([])}finally{f(!1)}},[o,e.enabled]);c.useEffect(()=>{m()},[m]);const g=c.useMemo(()=>i?null:s&&s.length>0?Nd(s):Rd(r),[s,r,i]),l=c.useCallback(()=>{m()},[m]);return{data:g,loading:i,error:d,mutating:!1,create:async(b,x)=>{throw new Error("Permissions are derived from staff roles. Use staff role assignments instead.")},update:async b=>{throw new Error("Permissions are derived from staff roles. Use staff role assignments instead.")},remove:async()=>{throw new Error("Permissions are derived from staff roles. Use staff role assignments instead.")},refetch:l,hasCustomPermissions:(s?.length??0)>0}}const qo=c.createContext(void 0);function Ad({children:e}){const{data:t,loading:r,error:n,hasCustomPermissions:o,create:s,update:a,remove:i,refetch:f}=Pd(),d={permissions:t,loading:r,error:n,hasCustomPermissions:o,updatePermissions:a,createPermissions:s,removePermissions:i,refetch:f};return u.jsx(qo.Provider,{value:d,children:e})}function Cu(){const e=c.useContext(qo);if(e===void 0)throw new Error("usePermissionContext must be used within a PermissionProvider");return e}class _d extends c.Component{constructor(){super(...arguments);ne(this,"state",{hasError:!1});ne(this,"handleRetry",()=>{this.setState({hasError:!1,error:void 0})})}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,n){console.error("ErrorBoundary caught an error:",r,n)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:u.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:u.jsxs(Ht,{className:"max-w-md w-full",children:[u.jsxs(Wt,{className:"text-center",children:[u.jsx("div",{className:"flex justify-center mb-4",children:u.jsx(Xa,{className:"h-12 w-12 text-red-500"})}),u.jsx(Vt,{className:"text-xl",children:"Something went wrong"}),u.jsx(Kt,{children:"An unexpected error occurred. Please try refreshing the page."})]}),u.jsxs(Gt,{className:"text-center space-y-4",children:[this.state.error&&u.jsxs("details",{className:"text-left",children:[u.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground",children:"Error details"}),u.jsx("pre",{className:"mt-2 text-xs bg-muted p-2 rounded overflow-auto",children:this.state.error.message})]}),u.jsxs(Oe,{onClick:this.handleRetry,className:"w-full",children:[u.jsx(no,{className:"h-4 w-4 mr-2"}),"Try Again"]})]})]})}):this.props.children}}const Be=c.forwardRef(({className:e,type:t,...r},n)=>u.jsx("input",{type:t,className:X("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...r}));Be.displayName="Input";var Id="Label",Xo=c.forwardRef((e,t)=>u.jsx(J.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Xo.displayName=Id;var Jo=Xo;const Od=Lt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ue=c.forwardRef(({className:e,...t},r)=>u.jsx(Jo,{ref:r,className:X(Od(),e),...t}));Ue.displayName=Jo.displayName;var kd="Separator",En="horizontal",jd=["horizontal","vertical"],Qo=c.forwardRef((e,t)=>{const{decorative:r,orientation:n=En,...o}=e,s=Dd(n)?n:En,i=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return u.jsx(J.div,{"data-orientation":s,...i,...o,ref:t})});Qo.displayName=kd;function Dd(e){return jd.includes(e)}var Zo=Qo;const es=c.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},o)=>u.jsx(Zo,{ref:o,decorative:r,orientation:t,className:X("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));es.displayName=Zo.displayName;var Ld=c.createContext(void 0);function ts(e){const t=c.useContext(Ld);return e||t||"ltr"}var sr="rovingFocusGroup.onEntryFocus",Md={bubbles:!1,cancelable:!0},ht="RovingFocusGroup",[xr,rs,Fd]=An(ht),[$d,ns]=Ze(ht,[Fd]),[zd,Bd]=$d(ht),os=c.forwardRef((e,t)=>u.jsx(xr.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx(xr.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Ud,{...e,ref:t})})}));os.displayName=ht;var Ud=c.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:o=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:f,onEntryFocus:d,preventScrollOnEntryFocus:p=!1,...m}=e,g=c.useRef(null),l=ce(t,g),y=ts(s),[v,h]=kt({prop:a,defaultProp:i??null,onChange:f,caller:ht}),[b,x]=c.useState(!1),w=Ee(d),T=rs(r),S=c.useRef(!1),[E,C]=c.useState(0);return c.useEffect(()=>{const R=g.current;if(R)return R.addEventListener(sr,w),()=>R.removeEventListener(sr,w)},[w]),u.jsx(zd,{scope:r,orientation:n,dir:y,loop:o,currentTabStopId:v,onItemFocus:c.useCallback(R=>h(R),[h]),onItemShiftTab:c.useCallback(()=>x(!0),[]),onFocusableItemAdd:c.useCallback(()=>C(R=>R+1),[]),onFocusableItemRemove:c.useCallback(()=>C(R=>R-1),[]),children:u.jsx(J.div,{tabIndex:b||E===0?-1:0,"data-orientation":n,...m,ref:l,style:{outline:"none",...e.style},onMouseDown:G(e.onMouseDown,()=>{S.current=!0}),onFocus:G(e.onFocus,R=>{const I=!S.current;if(R.target===R.currentTarget&&I&&!b){const j=new CustomEvent(sr,Md);if(R.currentTarget.dispatchEvent(j),!j.defaultPrevented){const D=T().filter(O=>O.focusable),_=D.find(O=>O.active),L=D.find(O=>O.id===v),k=[_,L,...D].filter(Boolean).map(O=>O.ref.current);is(k,p)}}S.current=!1}),onBlur:G(e.onBlur,()=>x(!1))})})}),ss="RovingFocusGroupItem",as=c.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:s,children:a,...i}=e,f=Ar(),d=s||f,p=Bd(ss,r),m=p.currentTabStopId===d,g=rs(r),{onFocusableItemAdd:l,onFocusableItemRemove:y,currentTabStopId:v}=p;return c.useEffect(()=>{if(n)return l(),()=>y()},[n,l,y]),u.jsx(xr.ItemSlot,{scope:r,id:d,focusable:n,active:o,children:u.jsx(J.span,{tabIndex:m?0:-1,"data-orientation":p.orientation,...i,ref:t,onMouseDown:G(e.onMouseDown,h=>{n?p.onItemFocus(d):h.preventDefault()}),onFocus:G(e.onFocus,()=>p.onItemFocus(d)),onKeyDown:G(e.onKeyDown,h=>{if(h.key==="Tab"&&h.shiftKey){p.onItemShiftTab();return}if(h.target!==h.currentTarget)return;const b=Vd(h,p.orientation,p.dir);if(b!==void 0){if(h.metaKey||h.ctrlKey||h.altKey||h.shiftKey)return;h.preventDefault();let w=g().filter(T=>T.focusable).map(T=>T.ref.current);if(b==="last")w.reverse();else if(b==="prev"||b==="next"){b==="prev"&&w.reverse();const T=w.indexOf(h.currentTarget);w=p.loop?Kd(w,T+1):w.slice(T+1)}setTimeout(()=>is(w))}}),children:typeof a=="function"?a({isCurrentTabStop:m,hasTabStop:v!=null}):a})})});as.displayName=ss;var Hd={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Wd(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Vd(e,t,r){const n=Wd(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Hd[n]}function is(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function Kd(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Gd=os,Yd=as,Yt="Tabs",[qd,Tu]=Ze(Yt,[ns]),cs=ns(),[Xd,Ur]=qd(Yt),ls=c.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:o,defaultValue:s,orientation:a="horizontal",dir:i,activationMode:f="automatic",...d}=e,p=ts(i),[m,g]=kt({prop:n,onChange:o,defaultProp:s??"",caller:Yt});return u.jsx(Xd,{scope:r,baseId:Ar(),value:m,onValueChange:g,orientation:a,dir:p,activationMode:f,children:u.jsx(J.div,{dir:p,"data-orientation":a,...d,ref:t})})});ls.displayName=Yt;var ds="TabsList",us=c.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...o}=e,s=Ur(ds,r),a=cs(r);return u.jsx(Gd,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:n,children:u.jsx(J.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});us.displayName=ds;var fs="TabsTrigger",ps=c.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:o=!1,...s}=e,a=Ur(fs,r),i=cs(r),f=gs(a.baseId,n),d=vs(a.baseId,n),p=n===a.value;return u.jsx(Yd,{asChild:!0,...i,focusable:!o,active:p,children:u.jsx(J.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":d,"data-state":p?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:f,...s,ref:t,onMouseDown:G(e.onMouseDown,m=>{!o&&m.button===0&&m.ctrlKey===!1?a.onValueChange(n):m.preventDefault()}),onKeyDown:G(e.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&a.onValueChange(n)}),onFocus:G(e.onFocus,()=>{const m=a.activationMode!=="manual";!p&&!o&&m&&a.onValueChange(n)})})})});ps.displayName=fs;var ms="TabsContent",hs=c.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:o,children:s,...a}=e,i=Ur(ms,r),f=gs(i.baseId,n),d=vs(i.baseId,n),p=n===i.value,m=c.useRef(p);return c.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),u.jsx(Ot,{present:o||p,children:({present:g})=>u.jsx(J.div,{"data-state":p?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":f,hidden:!g,id:d,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:m.current?"0s":void 0},children:g&&s})})});hs.displayName=ms;function gs(e,t){return`${e}-trigger-${t}`}function vs(e,t){return`${e}-content-${t}`}var Jd=ls,ys=us,bs=ps,xs=hs;const Qd=Jd,ws=c.forwardRef(({className:e,...t},r)=>u.jsx(ys,{ref:r,className:X("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));ws.displayName=ys.displayName;const wr=c.forwardRef(({className:e,...t},r)=>u.jsx(bs,{ref:r,className:X("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",e),...t}));wr.displayName=bs.displayName;const Er=c.forwardRef(({className:e,...t},r)=>u.jsx(xs,{ref:r,className:X("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Er.displayName=xs.displayName;function Zd(e){const{user:t}=nt(),[r,n]=c.useState(null),[o,s]=c.useState(!0),[a,i]=c.useState(!1),[f,d]=c.useState(null),[p,m]=c.useState(new Date),g=c.useRef(null),{table:l,select:y="*",filters:v,orderBy:h,enabled:b=!0,onSuccess:x,onError:w}=e,T=c.useRef(v);T.current=v;const S=c.useRef(h);S.current=h;const E=c.useRef(x);E.current=x;const C=c.useRef(w);C.current=w;const R=JSON.stringify(v??{}),I=h?.column,j=h?.ascending,D=t?.id,_=t?.roleContext?.tenantId,L=c.useCallback(async(k=!1)=>{const O=T.current,F=S.current;if(!b){k||s(!1);return}if((O?.user_id!==void 0||O?.tenant_id!==void 0)&&!D){k||s(!1);return}g.current&&g.current.abort(),g.current=new AbortController,k?i(!0):s(!0),d(null);try{let A=re.from(l).select(y);O&&Object.entries(O).forEach(([U,B])=>{if(B!=null){let W=B;U==="user_id"&&B==="current"?W=D:U==="tenant_id"&&B==="current"&&(W=_),A=A.eq(U,W)}}),F&&(A=A.order(F.column,{ascending:F.ascending??!0}));const{data:H,error:Q}=await A;if(g.current?.signal.aborted)return;if(Q)throw Q;n(H||null),d(null),m(new Date),E.current&&H&&E.current(H)}catch(A){if(A instanceof Error&&A.name==="AbortError")return;const H=A instanceof Error?A.message:"Unknown error";console.error("[useSupabaseQuery] Query failed",{table:l,error:H}),d(H),n(null),C.current&&A instanceof Error&&C.current(A)}finally{k?i(!1):s(!1),g.current=null}},[l,y,R,I,j,b,D,_]),P=c.useCallback(async()=>{await L(!0)},[L]);return c.useEffect(()=>(L(!1),()=>{g.current&&g.current.abort()}),[L]),{data:r,loading:o,error:f,refetch:P,isRefreshing:a,isStale:!1,isCircuitBreakerOpen:!1,lastUpdated:p,errorType:void 0}}function eu(){const{tenantId:e}=nt(),{data:t,loading:r,error:n}=Zd({table:"tenants",select:"id, name, display_name, logo_url",filters:e?{id:e}:{},enabled:!!e,staleTime:3e5}),o=t?.[0]??null;return{settings:o?{business_name:o.display_name||o.name,logo_url:o.logo_url}:null,loading:r,error:n}}function ar(e,t="Unknown error"){if(typeof e=="string"&&e)return e;if(typeof e=="object"&&e!==null&&"message"in e){const{message:r}=e;if(typeof r=="string"&&r)return r}return t}function tu(){const[e,t]=c.useState(!0),[r,n]=c.useState(!1),[o,s]=c.useState("client"),[a,i]=c.useState(""),[f,d]=c.useState(""),[p,m]=c.useState(""),[g,l]=c.useState(""),[y,v]=c.useState(""),[h,b]=c.useState(""),[x,w]=c.useState(!1),[T,S]=c.useState(null),{signIn:E,signUp:C,resetPassword:R,user:I,loading:j}=nt(),{settings:D}=eu(),_=Rn(),L=Cr();c.useEffect(()=>{if(I&&!j){const k=L.state?.from?.pathname||"/";_(k,{replace:!0})}},[I,j,_,L]);const P=async k=>{k.preventDefault(),w(!0),S(null);try{if(r){const{error:O}=await R(a);O?S(ar(O,"Something went wrong. Please try again.")):(n(!1),i(""))}else if(e){const{error:O}=await E(a,f);if(O)S(ar(O,"Something went wrong. Please try again."));else{const F=L.state?.from?.pathname||"/";_(F,{replace:!0})}}else{const{error:O}=await C(a,f,p,g,y,h,o);O?S(ar(O,"Something went wrong. Please try again.")):(t(!0),i(""),d(""),m(""),l(""),v(""),b(""))}}finally{w(!1)}};return j?u.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-slate-100 flex items-center justify-center",children:u.jsx(on,{className:"h-8 w-8 animate-spin text-blue-500"})}):u.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-slate-100 flex items-center justify-center p-4",children:u.jsxs("div",{className:"w-full max-w-md space-y-6",children:[u.jsxs("div",{className:"text-center space-y-3",children:[u.jsx("div",{className:"flex justify-center",children:D?.logo_url?u.jsx("img",{src:D.logo_url,alt:"Business Logo",className:"h-20 w-20 object-contain"}):u.jsx(Ka,{className:"h-20 w-20 text-blue-500"})}),u.jsxs("h1",{className:"text-3xl font-bold text-foreground",children:["Welcome to ",D?.business_name||"ValorWell"]}),u.jsx("p",{className:"text-muted-foreground",children:"Your mental health practice management platform"})]}),u.jsxs(Ht,{className:"shadow-material-lg",children:[u.jsxs(Wt,{className:"space-y-1",children:[u.jsx(Vt,{className:"text-2xl font-semibold text-center",children:r?"Reset your password":e?"Welcome back":"Create your account"}),u.jsx(Kt,{className:"text-center",children:r?"Enter your email address to receive a password reset link":e?`Sign in to your ${D?.business_name||"FieldFlow"} account`:`Get started with ${D?.business_name||"FieldFlow"} today`})]}),u.jsxs(Gt,{className:"space-y-4",children:[r&&u.jsxs(Oe,{variant:"ghost",onClick:()=>{n(!1),i("")},className:"mb-4 p-0 h-auto text-sm text-muted-foreground hover:text-foreground",children:[u.jsx(Va,{className:"mr-2 h-4 w-4"}),"Back to sign in"]}),!e&&!r&&u.jsxs(Qd,{value:o,onValueChange:k=>s(k),className:"mb-6",children:[u.jsxs(ws,{className:"grid w-full grid-cols-2",children:[u.jsxs(wr,{value:"client",className:"flex items-center gap-2",children:[u.jsx(Qa,{className:"h-4 w-4"}),"Sign up as Client"]}),u.jsxs(wr,{value:"contractor",className:"flex items-center gap-2",children:[u.jsx(qa,{className:"h-4 w-4"}),"Sign up as Provider"]})]}),u.jsx(Er,{value:"client",className:"mt-4",children:u.jsx("div",{className:"text-center p-4 bg-muted/50 rounded-md",children:u.jsx("p",{className:"text-sm text-muted-foreground",children:"Creating an account as a client/patient to access your personal care portal"})})}),u.jsx(Er,{value:"contractor",className:"mt-4",children:u.jsx("div",{className:"text-center p-4 bg-muted/50 rounded-md",children:u.jsx("p",{className:"text-sm text-muted-foreground",children:"Creating an account as a healthcare provider/practitioner"})})})]}),u.jsxs("form",{onSubmit:P,className:"space-y-4",children:[!e&&!r&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(Ue,{htmlFor:"firstName",children:"First Name"}),u.jsx(Be,{id:"firstName",placeholder:"Enter your first name",type:"text",value:p,onChange:k=>m(k.target.value),required:!e,className:"transition-all duration-normal"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(Ue,{htmlFor:"lastName",children:"Last Name"}),u.jsx(Be,{id:"lastName",placeholder:"Enter your last name",type:"text",value:g,onChange:k=>l(k.target.value),required:!e,className:"transition-all duration-normal"})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(Ue,{htmlFor:"phone",children:"Phone Number"}),u.jsx(Be,{id:"phone",placeholder:"Enter your phone number",type:"tel",value:y,onChange:k=>v(k.target.value),required:!e,className:"transition-all duration-normal"})]}),o==="contractor"&&u.jsxs("div",{className:"space-y-2",children:[u.jsx(Ue,{htmlFor:"companyName",children:"Practice/Organization Name"}),u.jsx(Be,{id:"companyName",placeholder:"Enter your practice or organization name",type:"text",value:h,onChange:k=>b(k.target.value),required:!e&&o==="contractor",className:"transition-all duration-normal"})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(Ue,{htmlFor:"email",children:"Email"}),u.jsx(Be,{id:"email",placeholder:"Enter your email",type:"email",value:a,onChange:k=>i(k.target.value),required:!0,className:"transition-all duration-normal"})]}),!r&&u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx(Ue,{htmlFor:"password",children:"Password"}),e&&u.jsx(Oe,{type:"button",variant:"link",onClick:()=>n(!0),className:"p-0 h-auto text-sm text-muted-foreground hover:text-foreground",children:"Forgot password?"})]}),u.jsx(Be,{id:"password",placeholder:"Enter your password",type:"password",value:f,onChange:k=>d(k.target.value),required:!0,className:"transition-all duration-normal"})]}),u.jsx(Oe,{type:"submit",className:"w-full bg-blue-500 hover:bg-blue-600 text-white",disabled:x,children:x?u.jsxs(u.Fragment,{children:[u.jsx(on,{className:"mr-2 h-4 w-4 animate-spin"}),r?"Sending email...":e?"Signing in...":"Creating account..."]}):u.jsx(u.Fragment,{children:r?u.jsxs(u.Fragment,{children:[u.jsx(Ya,{className:"mr-2 h-4 w-4"}),"Send Reset Email"]}):u.jsxs(u.Fragment,{children:[u.jsx(Ja,{className:"mr-2 h-4 w-4"}),e?"Sign In":`Sign Up${e?"":` as ${o==="client"?"Client":"Provider"}`}`]})})})]}),!r&&!e&&u.jsxs(u.Fragment,{children:[u.jsx(es,{}),u.jsxs("div",{className:"text-center space-y-2",children:[u.jsx("p",{className:"text-sm text-muted-foreground",children:"Already have an account?"}),u.jsx(Oe,{variant:"outline",onClick:()=>t(!0),className:"w-full",disabled:x,children:"Sign in instead"})]})]})]})]}),T&&u.jsxs(zr,{variant:"destructive",children:[u.jsx(fr,{className:"h-4 w-4"}),u.jsx(Br,{children:T})]}),u.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"By continuing, you agree to our Terms of Service and Privacy Policy."})]})})}const ru=()=>{const e=Cr(),{user:t,userRole:r}=nt();c.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]);const n=()=>t?r==="client"?"/client/dashboard":"/staff/dashboard":"/auth";return u.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:u.jsxs("div",{className:"text-center",children:[u.jsx("h1",{className:"mb-4 text-4xl font-bold text-foreground",children:"404"}),u.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),u.jsx(Us,{to:n(),className:"text-primary underline hover:text-primary/80",children:"Return to Home"})]})})},nu=c.lazy(()=>$s(()=>import("./BillingPortalApp-Dr6DU9j3.js").then(e=>e.c),__vite__mapDeps([0,1,2]))),ou=()=>u.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:u.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-primary"})}),su=new zs,au=()=>u.jsx(_d,{children:u.jsx(Bs,{client:su,children:u.jsx(pd,{children:u.jsx(Ad,{children:u.jsx(Cd,{children:u.jsxs(od,{children:[u.jsx(Di,{}),u.jsx(pc,{}),u.jsx(Hs,{children:u.jsx(wd,{children:u.jsxs(Ws,{children:[u.jsx(vt,{path:"/auth",element:u.jsx(tu,{})}),u.jsx(vt,{path:"/billing/*",element:u.jsx(c.Suspense,{fallback:u.jsx(ou,{}),children:u.jsx(nu,{})})}),u.jsx(vt,{path:"/",element:u.jsx("div",{})}),u.jsx(vt,{path:"*",element:u.jsx(ru,{})})]})})})]})})})})})}),ir=document.getElementById("root");try{ir.innerHTML="",Sn(ir).render(u.jsx(au,{}))}catch(e){console.error("Failed to initialize app:",e),ir.innerHTML=`

Failed to load application

Please try refreshing the page.

`}export{Ue as $,zr as A,Oe as B,fr as C,Pl as D,kt as E,qs as F,Lt as G,ts as H,Be as I,Ee as J,Ce as K,on as L,Qd as M,ws as N,wr as O,J as P,Er as Q,no as R,es as S,Xa as T,fu as U,od as V,hu as W,Za as X,gu as Y,sd as Z,Va as _,Cu as a,Ka as a0,ea as a1,md as a2,Ar as a3,Nn as a4,Qa as a5,Po as a6,Ll as a7,Tr as a8,Ml as a9,Fl as aa,Dl as ab,jn as ac,St as ad,An as ae,wa as af,du as ag,vu as b,le as c,yu as d,bu as e,xu as f,Eu as g,wu as h,Go as i,Br as j,ot as k,eu as l,X as m,Ht as n,Wt as o,Vt as p,Kt as q,Gt as r,re as s,Xs as t,nt as u,ar as v,Ze as w,ce as x,G as y,Ot as z};