1import{r,j as n,a as Ie}from"./react-vendor-DL_jcNr5.js";import{u as Ae}from"./use-toast-1yORltRL.js";import{c as _e,a as De,d as te,G as Fe,P as I,H as oe,u as je,h as Le,s as W,f as b,I as Me,k as Oe,q as ke,v as Ve}from"./radix-core-B_pLx6zZ.js";import{a as Ke}from"./ui-utils--X5BZniO.js";import{c as A}from"./utils-BGkA_7jJ.js";import{X as $e}from"./x-h9zEmomr.js";import"./floating-ui-Cvfw4c_J.js";import"./createLucideIcon-C621SLsM.js";var se="ToastProvider",[G,He,We]=_e("Toast"),[re,xt]=De("Toast",[We]),[Xe,X]=re(se),ne=e=>{const{__scopeToast:t,label:o="Notification",duration:s=5e3,swipeDirection:u="right",swipeThreshold:d=50,children:p}=e,[v,w]=r.useState(null),[c,h]=r.useState(0),x=r.useRef(!1),_=r.useRef(!1);return o.trim(),n.jsx(G.Provider,{scope:t,children:n.jsx(Xe,{scope:t,label:o,duration:s,swipeDirection:u,swipeThreshold:d,toastCount:c,viewport:v,onViewportChange:w,onToastAdd:r.useCallback(()=>h(R=>R+1),[]),onToastRemove:r.useCallback(()=>h(R=>R-1),[]),isFocusedToastEscapeKeyDownRef:x,isClosePausedRef:_,children:p})})};ne.displayName=se;var ae="ToastViewport",Ue=["F8"],B="toast.viewportPause",q="toast.viewportResume",ie=r.forwardRef((e,t)=>{const{__scopeToast:o,hotkey:s=Ue,label:u="Notifications ({hotkey})",...d}=e,p=X(ae,o),v=He(o),w=r.useRef(null),c=r.useRef(null),h=r.useRef(null),x=r.useRef(null),_=te(t,x,p.onViewportChange),R=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=p.toastCount>0;r.useEffect(()=>{const i=E=>{s.length!==0&&s.every(m=>E[m]||E.code===m)&&x.current?.focus()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[s]),r.useEffect(()=>{const i=w.current,E=x.current;if(N&&i&&E){const f=()=>{if(!p.isClosePausedRef.current){const T=new CustomEvent(B);E.dispatchEvent(T),p.isClosePausedRef.current=!0}},m=()=>{if(p.isClosePausedRef.current){const T=new CustomEvent(q);E.dispatchEvent(T),p.isClosePausedRef.current=!1}},y=T=>{!i.contains(T.relatedTarget)&&m()},g=()=>{i.contains(document.activeElement)||m()};return i.addEventListener("focusin",f),i.addEventListener("focusout",y),i.addEventListener("pointermove",f),i.addEventListener("pointerleave",g),window.addEventListener("blur",f),window.addEventListener("focus",m),()=>{i.removeEventListener("focusin",f),i.removeEventListener("focusout",y),i.removeEventListener("pointermove",f),i.removeEventListener("pointerleave",g),window.removeEventListener("blur",f),window.removeEventListener("focus",m)}}},[N,p.isClosePausedRef]);const l=r.useCallback(({tabbingDirection:i})=>{const f=v().map(m=>{const y=m.ref.current,g=[y,...nt(y)];return i==="forwards"?g:g.reverse()});return(i==="forwards"?f.reverse():f).flat()},[v]);return r.useEffect(()=>{const i=x.current;if(i){const E=f=>{const m=f.altKey||f.ctrlKey||f.metaKey;if(f.key==="Tab"&&!m){const g=document.activeElement,T=f.shiftKey;if(f.target===i&&T){c.current?.focus();return}const F=l({tabbingDirection:T?"backwards":"forwards"}),k=F.findIndex(S=>S===g);Y(F.slice(k+1))?f.preventDefault():T?c.current?.focus():h.current?.focus()}};return i.addEventListener("keydown",E),()=>i.removeEventListener("keydown",E)}},[v,l]),n.jsxs(Fe,{ref:w,role:"region","aria-label":u.replace("{hotkey}",R),tabIndex:-1,style:{pointerEvents:N?void 0:"none"},children:[N&&n.jsx(z,{ref:c,onFocusFromOutsideViewport:()=>{const i=l({tabbingDirection:"forwards"});Y(i)}}),n.jsx(G.Slot,{scope:o,children:n.jsx(I.ol,{tabIndex:-1,...d,ref:_})}),N&&n.jsx(z,{ref:h,onFocusFromOutsideViewport:()=>{const i=l({tabbingDirection:"backwards"});Y(i)}})]})});ie.displayName=ae;var ce="ToastFocusProxy",z=r.forwardRef((e,t)=>{const{__scopeToast:o,onFocusFromOutsideViewport:s,...u}=e,d=X(ce,o);return n.jsx(oe,{"aria-hidden":!0,tabIndex:0,...u,ref:t,style:{position:"fixed"},onFocus:p=>{const v=p.relatedTarget;!d.viewport?.contains(v)&&s()}})});z.displayName=ce;var M="Toast",Ye="toast.swipeStart",Be="toast.swipeMove",qe="toast.swipeCancel",ze="toast.swipeEnd",ue=r.forwardRef((e,t)=>{const{forceMount:o,open:s,defaultOpen:u,onOpenChange:d,...p}=e,[v,w]=je({prop:s,defaultProp:u??!0,onChange:d,caller:M});return n.jsx(Le,{present:o||v,children:n.jsx(Qe,{open:v,...p,ref:t,onClose:()=>w(!1),onPause:W(e.onPause),onResume:W(e.onResume),onSwipeStart:b(e.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:b(e.onSwipeMove,c=>{const{x:h,y:x}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${h}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${x}px`)}),onSwipeCancel:b(e.onSwipeCancel,c=>{c.currentTarget.setAttribute("data-swipe","cancel"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:b(e.onSwipeEnd,c=>{const{x:h,y:x}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","end"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${h}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${x}px`),w(!1)})})})});ue.displayName=M;var[Ge,Je]=re(M,{onClose(){}}),Qe=r.forwardRef((e,t)=>
1{const{__scopeToast:o,type:s="foreground",duration:u,open:d,onClose:p,onEscapeKeyDown:v,onPause:w,onResume:c,onSwipeStart:h,onSwipeMove:x,onSwipeCancel:_,onSwipeEnd:R,...N}=e,l=X(M,o),[i,E]=r.useState(null),f=te(t,a=>E(a)),m=r.useRef(null),y=r.useRef(null),g=u||l.duration,T=r.useRef(0),D=r.useRef(g),O=r.useRef(0),{onToastAdd:F,onToastRemove:k}=l,S=W(()=>{i?.contains(document.activeElement)&&l.viewport?.focus(),p()}),V=r.useCallback(a=>{!a||a===1/0||(window.clearTimeout(O.current),T.current=new Date().getTime(),O.current=window.setTimeout(S,a))},[S]);r.useEffect(()=>{const a=l.viewport;if(a){const P=()=>{V(D.current),c?.()},C=()=>{const j=new Date().getTime()-T.current;D.current=D.current-j,window.clearTimeout(O.current),w?.()};return a.addEventListener(B,C),a.addEventListener(q,P),()=>{a.removeEventListener(B,C),a.removeEventListener(q,P)}}},[l.viewport,g,w,c,V]),r.useEffect(()=>{d&&!l.isClosePausedRef.current&&V(g)},[d,g,l.isClosePausedRef,V]),r.useEffect(()=>(F(),()=>k()),[F,k]);const Q=r.useMemo(()=>i?ve(i):null,[i]);return l.viewport?n.jsxs(n.Fragment,{children:[Q&&n.jsx(Ze,{__scopeToast:o,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:Q}),n.jsx(Ge,{scope:o,onClose:S,children:Ie.createPortal(n.jsx(G.ItemSlot,{scope:o,children:n.jsx(Me,{asChild:!0,onEscapeKeyDown:b(v,()=>{l.isFocusedToastEscapeKeyDownRef.current||S(),l.isFocusedToastEscapeKeyDownRef.current=!1}),children:n.jsx(I.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":d?"open":"closed","data-swipe-direction":l.swipeDirection,...N,ref:f,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:b(e.onKeyDown,a=>{a.key==="Escape"&&(v?.(a.nativeEvent),a.nativeEvent.defaultPrevented||(l.isFocusedToastEscapeKeyDownRef.current=!0,S()))}),onPointerDown:b(e.onPointerDown,a=>{a.button===0&&(m.current={x:a.clientX,y:a.clientY})}),onPointerMove:b(e.onPointerMove,a=>{if(!m.current)return;const P=a.clientX-m.current.x,C=a.clientY-m.current.y,j=!!y.current,L=["left","right"].includes(l.swipeDirection),K=["left","up"].includes(l.swipeDirection)?Math.min:Math.max,Ne=L?K(0,P):0,Se=L?0:K(0,C),U=a.pointerType==="touch"?10:2,$={x:Ne,y:Se},Z={originalEvent:a,delta:$};j?(y.current=$,H(Be,x,Z,{discrete:!1})):ee($,l.swipeDirection,U)?(y.current=$,H(Ye,h,Z,{discrete:!1}),a.target.setPointerCapture(a.pointerId)):(Math.abs(P)>U||Math.abs(C)>U)&&(m.current=null)}),onPointerUp:b(e.onPointerUp,a=>{const P=y.current,C=a.target;if(C.hasPointerCapture(a.pointerId)&&C.releasePointerCapture(a.pointerId),y.current=null,m.current=null,P){const j=a.currentTarget,L={originalEvent:a,delta:P};ee(P,l.swipeDirection,l.swipeThreshold)?H(ze,R,L,{discrete:!0}):H(qe,_,L,{discrete:!0}),j.addEventListener("click",K=>K.preventDefault(),{once:!0})}})})})}),l.viewport)})]}):null}),Ze=e=>{const{__scopeToast:t,children:o,...s}=e,u=X(M,t),[d,p]=r.useState(!1),[v,w]=r.useState(!1);return st(()=>p(!0)),r.useEffect(()=>{const c=window.setTimeout(()=>w(!0),1e3);return()=>window.clearTimeout(c)},[]),v?null:n.jsx(Oe,{asChild:!0,children:n.jsx(oe,{...s,children:d&&n.jsxs(n.Fragment,{children:[u.label," ",o]})})})},et="ToastTitle",de=r.forwardRef((e,t)=>{const{__scopeToast:o,...s}=e;return n.jsx(I.div,{...s,ref:t})});de.displayName=et;var tt="ToastDescription",le=r.forwardRef((e,t)=>{const{__scopeToast:o,...s}=e;return n.jsx(I.div,{...s,ref:t})});le.displayName=tt;var ot="ToastAction",pe=r.forwardRef((e,t)=>{const{altText:o,...s}=e;return o.trim()?n.jsx(me,{altText:o,asChild:!0,children:n.jsx(J,{...s,ref:t})}):null});pe.displayName=ot;var fe="ToastClose",J=r.forwardRef((e,t)=>{const{__scopeToast:o,...s}=e,u=Je(fe,o);return n.jsx(me,{asChild:!0,children:n.jsx(I.button,{type:"button",...s,ref:t,onClick:b(e.onClick,u.onClose)})})});J.displayName=fe;var me=r.forwardRef((e,t)=>{const{__scopeToast:o,altText:s,...u}=e;return n.jsx(I.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...u,ref:t})});function ve(e){const t=[];return Array.from(e.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&t.push(s.textContent),rt(s)){const u=s.ariaHidden||s.hidden||s.style.display==="none",d=s.dataset.radixToastAnnounceExclude==="";if(!u)if(d){const p=s.dataset.radixToastAnnounceAlt;p&&t.push(p)}else t.push(...ve(s))}}),t}function H(e,t,o,{discrete:s}){const u=o.originalEvent.currentTarget,d=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:o});t&&u.addEventListener(e,t,{once:!0}),s?Ve(u,d):u.dispatchEvent(d)}var ee=(e,t,o=0)=>{const s=Math.abs(e.x),u=Math.abs(e.y),d=s>u;return t==="left"||t==="right"?d&&s>o:!d&&u>o};function st(e=()=>{}){const t=W(e);ke(()=>{let o=0,s=0;return o=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(o),window.cancelAnimationFrame(s)}},[t])}
1function rt(e){return e.nodeType===e.ELEMENT_NODE}function nt(e){const t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const u=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||u?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;o.nextNode();)t.push(o.currentNode);return t}function Y(e){const t=document.activeElement;return e.some(o=>o===t?!0:(o.focus(),document.activeElement!==t))}var at=ne,we=ie,Te=ue,xe=de,Ee=le,ye=pe,ge=J;const it=at,he=r.forwardRef(({className:e,...t},o)=>n.jsx(we,{ref:o,className:A("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}));he.displayName=we.displayName;const ct=Ke("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"}}),be=r.forwardRef(({className:e,variant:t,...o},s)=>n.jsx(Te,{ref:s,className:A(ct({variant:t}),e),...o}));be.displayName=Te.displayName;const ut=r.forwardRef(({className:e,...t},o)=>n.jsx(ye,{ref:o,className:A("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}));ut.displayName=ye.displayName;const Pe=r.forwardRef(({className:e,...t},o)=>n.jsx(ge,{ref:o,className:A("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:n.jsx($e,{className:"h-4 w-4"})}));Pe.displayName=ge.displayName;const Ce=r.forwardRef(({className:e,...t},o)=>n.jsx(xe,{ref:o,className:A("text-sm font-semibold",e),...t}));Ce.displayName=xe.displayName;const Re=r.forwardRef(({className:e,...t},o)=>n.jsx(Ee,{ref:o,className:A("text-sm opacity-90",e),...t}));Re.displayName=Ee.displayName;function Et(){const{toasts:e}=Ae();return n.jsxs(it,{children:[e.map(function({id:t,title:o,description:s,action:u,...d}){return n.jsxs(be,{...d,children:[n.jsxs("div",{className:"grid gap-1",children:[o&&n.jsx(Ce,{children:o}),s&&n.jsx(Re,{children:s})]}),u,n.jsx(Pe,{})]},t)}),n.jsx(he,{})]})}export{Et as Toaster};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.