import{r as e,j as a,M as s}from"./vendor--leCAzSo.js";import{B as t}from"./c87b7760f-oG193yNp.js";import{am as i,an as n,ao as l,ap as r,aq as c,ar as o,as as d,at as x,a8 as m,au as f,av as j}from"./index-DZuQva-j.js";import{a as g,N as h}from"./ca9c256b9-7brFE8T2.js";import"./c723dd3dd-58n3MxoB.js";import"./c57c2877c-dpgWZiV5.js";import"./cb5cdda9a-CSfiLIa6.js";import"./c51e217b4-KUwQQl_W.js";import"./tree-sitter-BFuuT2ac.js";const u=e.memo(function({isOpen:u,onClose:p,onDontAskAgain:b}){const v=g(),N=i(),k=n(),[y,w]=e.useState(!1),{data:M}=l(),C=r(),Y=e.useCallback(async()=>{w(!0);try{const{success:e}=await k();if(e){const e=M?.preferences||{};await C.mutateAsync({preferences:{...e,feature_preference:{...e.feature_preference,bogosort:{...e.feature_preference?.bogosort,enable_push:!0,enable_email:e.feature_preference?.bogosort?.enable_email??!0}}}}),b?.(),p()}}finally{w(!1)}},[k,M,C,b,p]),z=e.useCallback(()=>{b?.(),p()},[b,p]),G=e.useCallback(()=>{v.push("/settings/general"),p()},[v,p]),S=e.useCallback(e=>{e||y||p()},[p,y]);let T;return T="default"===N?a.jsxs(a.Fragment,{children:[a.jsx(h,{className:"h-[var(--h6)] w-[var(--h6)] text-accent-brand"}),a.jsxs("div",{className:"flex flex-col items-center gap-g6",children:[a.jsx(f,{className:"text-heading-semibold text-t9",children:a.jsx(s,{defaultMessage:"Enable notifications",id:"AIUVfaT9og"})}),a.jsx(j,{className:"text-body text-t6",children:a.jsx(s,{defaultMessage:"Get notified when your tasks complete so you don’t have to keep checking back.",id:"/GY9xNc1u1"})})]}),a.jsxs("div",{className:"flex justify-center gap-g4",children:[a.jsx(t,{variant:"contained",onClick:p,disabled:y,children:a.jsx(s,{defaultMessage:"Not now",id:"dUCA4Khx0S"})}),a.jsx(t,{variant:"primary",onClick:Y,busy:y,children:a.jsx(s,{defaultMessage:"Enable",id:"TqSTI0/TZI"})})]}),a.jsx(t,{variant:"link",size:"small",onClick:z,children:a.jsx(s,{defaultMessage:"Don’t ask me again",id:"+xRY6yy3uz"})})]}):"denied"===N?a.jsxs(a.Fragment,{children:[a.jsx(h,{className:"h-[var(--h6)] w-[var(--h6)] text-t5"}),a.jsxs("div",{className:"flex flex-col items-center gap-g6",children:[a.jsx(f,{className:"text-heading-semibold text-t9",children:a.jsx(s,{defaultMessage:"Notifications blocked",id:"E7B/kovpEi"})}),a.jsx(j,{className:"text-body text-t6",children:a.jsx(s,{defaultMessage:"Enable notifications in your browser settings to get updates when tasks complete.",id:"ZNQ/KiYXaG"})})]}),a.jsx("div",{className:"flex justify-center gap-g4",children:a.jsx(t,{variant:"contained",onClick:p,children:a.jsx(s,{defaultMessage:"Got it",id:"NYTGIbSNz5"})})}),a.jsx(t,{variant:"link",size:"small",onClick:z,children:a.jsx(s,{defaultMessage:"Don’t ask me again",id:"+xRY6yy3uz"})})]}):a.jsxs(a.Fragment,{children:[a.jsx(h,{className:"h-[var(--h6)] w-[var(--h6)] text-accent-brand"}),a.jsxs("div",{className:"flex flex-col items-center gap-g6",children:[a.jsx(f,{className:"text-heading-semibold text-t9",children:a.jsx(s,{defaultMessage:"Notifications enabled",id:"SkJDT6Yg8Y"})}),a.jsx(j,{className:"text-body text-t6",children:a.jsx(s,{defaultMessage:"You’ll receive notifications when your tasks need attention.",id:"ZG1w2HTdIt"})})]}),a.jsxs("div",{className:"flex justify-center gap-g4",children:[a.jsx(t,{variant:"contained",onClick:G,children:a.jsx(s,{defaultMessage:"Settings",id:"D3idYvSLF9"})}),a.jsx(t,{variant:"primary",onClick:p,children:a.jsx(s,{defaultMessage:"Got it",id:"NYTGIbSNz5"})})]})]}),a.jsx(c,{open:u,onOpenChange:S,children:a.jsxs(o,{children:[a.jsx(d,{className:"fixed inset-0 z-50 bg-always-black/50 backdrop-blur-[2px] draggable-none"}),a.jsx(x,{className:"epitaxy-root fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2 w-[26rem] max-w-[calc(100vw-2rem)] draggable-none outline-none",children:a.jsxs("div",{className:"relative isolate rounded-r6 p-[var(--h4)] flex flex-col items-center gap-g8 text-center",children:[a.jsx(m,{elevation:"popover"}),T]})})]})})});u.displayName="EpitaxyNotificationPermissionModal";export{u as EpitaxyNotificationPermissionModal};
