PageSourceSearch

https://mrkspos.com/build/assets/notification-toast-suVh5ghu.js

js mrkspos.com collected 2026-10-02 01:37:05 UTC 4,440 bytes, 1 lines download raw bytes

1import{r as a,j as o}from"./vendor-react-BXDKjWfl.js";import{u as g}from"./useFirebase-zvKv2S1R.js";import{u as b}from"./vendor-inertia-Ca3DBwCx.js";import{echoIsConfigured as p,echo as m}from"./vendor-echo-CtsglDNk.js";import{j as h}from"./utils-DzIIg4YZ.js";import{LucideX as k}from"./vendor-icons-tduVCsjY.js";import"./app-DIp-NY3u.js";/* empty css            */import"./vendor-other-OHcCBNj6.js";import"./vendor-i18n-QDUiSOiS.js";import"./helper-C4ndmdZS.js";import"./vendor-utils-Sp7XtC9M.js";const x={1:{container:"bg-green-200 border-green-400 dark:bg-green-950 dark:border-green-600",title:"text-green-800 dark:text-green-200",message:"text-green-700 dark:text-green-300",close:"text-green-600 hover:text-green-800 dark:text-green-400 dark:hover:text-green-200"},2:{container:"bg-blue-200 border-blue-400 dark:bg-blue-950 dark:border-blue-600",title:"text-blue-800 dark:text-blue-200",message:"text-blue-700 dark:text-blue-300",close:"text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-200"},3:{container:"bg-yellow-200 border-yellow-400 dark:bg-yellow-950 dark:border-yellow-600",title:"text-yellow-800 dark:text-yellow-200",message:"text-yellow-700 dark:text-yellow-300",close:"text-yellow-600 hover:text-yellow-800 dark:text-yellow-400 dark:hover:text-yellow-200"},4:{container:"bg-red-200 border-red-400 dark:bg-red-950 dark:border-red-600",title:"text-red-800 dark:text-red-200",message:"text-red-700 dark:text-red-300",close:"text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-200"}};function v({toast:e,onRemove:t}){const[r,c]=a.useState(!1),[d,u]=a.useState(!1),n=x[e.layout]??x[2];a.useEffect(()=>{const s=requestAnimationFrame(()=>c(!0));return()=>cancelAnimationFrame(s)},[]);const i=()=>{u(!0),setTimeout(()=>t(e.id),300)},l=o.jsxs("div",{className:["flex min-w-0 items-start gap-3 rounded-lg border p-3 shadow-lg",n.container,"transition-all duration-300",r&&!d?"translate-y-0 scale-100 opacity-100":d?"scale-75 opacity-0":"translate-y-4 opacity-0"].join(" "),children:[e.imageUrl&&o.jsx("img",{src:e.imageUrl,alt:"",className:"mt-0.5 h-10 w-10 flex-shrink-0 rounded-md object-cover"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:`text-sm leading-tight font-semibold ${n.title}`,children:e.title}),o.jsx("p",{className:`mt-0.5 text-sm whitespace-pre-wrap ${n.message}`,children:e.message})]}),o.jsx("button",{type:"button",onClick:s=>{s.preventDefault(),s.stopPropagation(),i()},className:`ml-1 flex-shrink-0 rounded p-0.5 transition-colors ${n.close} cursor-pointer`,"aria-label":"Close notification",children:o.jsx(k,{size:14})})]});return e.url?o.jsx("a",{href:e.url,onClick:()=>{i()},target:"_blank",rel:"noopener noreferrer",className:"block w-full no-underline",children:l}):o.jsx("div",{className:"w-full",children:l})}function y({toasts:e,onRemove:t}){const r=a.useRef(null);return a.useEffect(()=>{r.current&&r.current.scrollIntoView({behavior:"smooth",block:"end"})},[e.length]),e.length===0?null:o.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex w-80 flex-col","aria-live":"polite","aria-label":"Notifications",children:o.jsxs("div",{className:"flex max-h-[80vh] flex-col gap-2 overflow-y-auto pr-1 [scrollbar-width:thin]",style:{scrollbarGutter:"stable"},children:[e.map(c=>o.jsx(v,{toast:c,onRemove:t},c.id)),o.jsx("div",{ref:r})]})})}function f(e){const t=Number(e);return t===1||t===2||t===3||t===4?t:2}function w(e){if(e?.title&&typeof e.title=="string")return{id:e.id??crypto.randomUUID(),layout:f(e.layout),title:e.title,message:e.message??"",url:e.url??void 0,imageUrl:e.imageUrl??void 0,data:e.data??void 0,type:e.type??void 0};const t=e?.notification,r=e?.data??{};return t?.title?{id:r.id??crypto.randomUUID(),layout:f(r.layout),title:t.title,message:t.body??r.message??"",url:r.url??void 0,imageUrl:t.image??r.imageUrl??void 0,data:r,type:r.type??void 0}:null}function $({processNotiticationIfAny:e}){const{auth:t}=b().props,[r,c]=a.useState([]),d=a.useCallback(i=>{c(l=>[...l,i])},[]),u=a.useCallback(i=>{c(l=>l.filter(s=>s.id!==i))},[]),n=a.useCallback(i=>{const l=w(i);l&&d(l)},[d]);return g({enabled:!0,onMessage:i=>{n(i)}}),a.useEffect(()=>{if(!t?.user?.id||!p())return;const i=`App.Models.User.${t.user.id}`,l=m().private(i);return l.notification(s=>{h(s?.data?.type)||(e(s),n(s))}),()=>{l.stopListeningForNotification(()=>{}),m().leave(i)}},[t?.user?.id,n]),o.jsx(y,{toasts:r,onRemove:u})}export{$ as default};

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.