1import{$ as e,it as t,t as n}from"./jsx-runtime-CfwYrey9.js";import{y as r}from"./string-C5fLiEhb.js";import{d as i}from"./function-B1_dLWJl.js";import{M as a}from"./assets-DSt_IM9G.js";import{t as o}from"./utils-B6KiDbIe.js";var s=t(e(),1),c=n(),l=[`success`,`info`,`warning`,`danger`],u=[`subtle`,`toast`],d=(0,s.createContext)(null);function f({type:e=i(`type`),msg:t=i(`message`),flavor:n=`toast`,autodismiss:a=!0}){let s=r(),l;if(typeof t==`object`&&t&&`primary`in t){let e=t;l=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`p`,{className:o(n===`toast`&&`font-sa-bold`),children:e.primary}),(0,c.jsx)(`p`,{className:o(n===`toast`&&`font-sa-regular`),children:e.secondary})]})}else l=t;return{id:s,type:e,message:l,flavor:n,autodismiss:a}}function p(){let e=(0,s.use)(d);if(!e)throw Error(`useAlerts must be used within an AlertsContext`);let[t,n]=e;function r(e){let r=t.findIndex(t=>t.id===e);r!==-1&&n([...t.slice(0,r),...t.slice(r+1)])}function o({flavor:e=`toast`,type:r=i(`type`),msg:a=i(`message`),autodismiss:o=!0}){let s=f({type:r,msg:a,flavor:e,autodismiss:o});return n([...t,s]),o&&setTimeout(()=>{n(e=>{let t=e.findIndex(e=>e.id===s.id);return t===-1?e:[...e.slice(0,t),...e.slice(t+1)]})},5e3),s.id}function c({type:e=i(`type`),msg:t=i(`message`),flavor:n=`toast`,autodismiss:r=!0}){let o=a.get(a.Entry.alerts_queued)||[];o.push({type:e,msg:t,flavor:n,autodismiss:r}),a.set(a.Entry.alerts_queued,o)}return{alerts:t,alert:o,dismiss:r,queue:c}}function m({children:e}){let[t,n]=(0,s.useState)([]),r=(0,s.useMemo)(()=>[t,n],[t]);return(0,c.jsx)(d,{value:r,children:e})}export{p as i,u as n,l as r,m as t}; 2//# sourceMappingURL=AlertsProvider-CL6BhD22.js.map
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.