import{r as e,j as s}from"./vendor-react-AXa6hZO5.js";import{ax as a,ay as t,az as i,aA as n,aB as r,aC as o}from"./index-D35RxkWr.js";import{N as l}from"./ce1bfd762-CyYdvT0D.js";import{b as d,y as c,z as x,C as m,E as j,F as f,G as g}from"./c6eedc03a-C8LSdtro.js";import{M as p}from"./vendor-intl-BdADXLLt.js";import"./vendor-infra-DayZK7Ds.js";import"./vendor-zod-1gcJXWab.js";import"./vendor-router-B4CxQ1po.js";import"./c365fd3fe-Dmpsm876.js";import"./vendor-lodash-D-zrMTUO.js";import"./vendor-motion-DGh7M6mr.js";import"./vendor-query-B8PP3rYl.js";import"./vendor-growthbook-XJcBFzji.js";import"./vendor-zustand-CcZsBpBq.js";import"./c70a3d12b-BI7Bbafv.js";import"./vendor-luxon-Y8l99kBI.js";import"./vendor-radix-jAWPQP1f.js";import"./vendor-icons-DsiQAprm.js";import"./tree-sitter-BFuuT2ac.js";const h=e.memo(function({isOpen:h,onClose:u,onDontAskAgain:v}){const b=d(),N=a(),y=t(),[k,w]=e.useState(!1),{data:C}=i(),M=n(),z=e.useCallback(async()=>{w(!0);try{const{success:e}=await y();if(e){const e=C?.preferences||{};await M.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}}}}),v?.(),u()}}finally{w(!1)}},[y,C,M,v,u]),Y=e.useCallback(()=>{v?.(),u()},[v,u]),G=e.useCallback(()=>{b.push("/settings/general"),u()},[b,u]),S=e.useCallback(e=>{e||k||u()},[u,k]);let T;return T="default"===N?s.jsxs(s.Fragment,{children:[s.jsx(l,{className:"h-[var(--h6)] w-[var(--h6)] text-accent-brand"}),s.jsxs("div",{className:"flex flex-col items-center gap-g6",children:[s.jsx(f,{className:"text-heading-semibold text-t9",children:s.jsx(p,{defaultMessage:"Enable notifications",id:"AIUVfaT9og"})}),s.jsx(g,{className:"text-body text-t6",children:s.jsx(p,{defaultMessage:"Get notified when your tasks complete so you don\u2019t have to keep checking back.",id:"/GY9xNc1u1"})})]}),s.jsxs("div",{className:"flex justify-center gap-g4",children:[s.jsx(o,{variant:"contained",onClick:u,disabled:k,children:s.jsx(p,{defaultMessage:"Not now",id:"dUCA4Khx0S"})}),s.jsx(o,{variant:"primary",onClick:z,busy:k,children:s.jsx(p,{defaultMessage:"Enable",id:"TqSTI0/TZI"})})]}),s.jsx(o,{variant:"link",size:"small",onClick:Y,children:s.jsx(p,{defaultMessage:"Don\u2019t ask me again",id:"+xRY6yy3uz"})})]}):"denied"===N?s.jsxs(s.Fragment,{children:[s.jsx(l,{className:"h-[var(--h6)] w-[var(--h6)] text-t5"}),s.jsxs("div",{className:"flex flex-col items-center gap-g6",children:[s.jsx(f,{className:"text-heading-semibold text-t9",children:s.jsx(p,{defaultMessage:"Notifications blocked",id:"E7B/kovpEi"})}),s.jsx(g,{className:"text-body text-t6",children:s.jsx(p,{defaultMessage:"Enable notifications in your browser settings to get updates when tasks complete.",id:"ZNQ/KiYXaG"})})]}),s.jsx("div",{className:"flex justify-center gap-g4",children:s.jsx(o,{variant:"contained",onClick:u,children:s.jsx(p,{defaultMessage:"Got it",id:"NYTGIbSNz5"})})}),s.jsx(o,{variant:"link",size:"small",onClick:Y,children:s.jsx(p,{defaultMessage:"Don\u2019t ask me again",id:"+xRY6yy3uz"})})]}):s.jsxs(s.Fragment,{children:[s.jsx(l,{className:"h-[var(--h6)] w-[var(--h6)] text-accent-brand"}),s.jsxs("div",{className:"flex flex-col items-center gap-g6",children:[s.jsx(f,{className:"text-heading-semibold text-t9",children:s.jsx(p,{defaultMessage:"Notifications enabled",id:"SkJDT6Yg8Y"})}),s.jsx(g,{className:"text-body text-t6",children:s.jsx(p,{defaultMessage:"You\u2019ll receive notifications when your tasks need attention.",id:"ZG1w2HTdIt"})})]}),s.jsxs("div",{className:"flex justify-center gap-g4",children:[s.jsx(o,{variant:"contained",onClick:G,children:s.jsx(p,{defaultMessage:"Settings",id:"D3idYvSLF9"})}),s.jsx(o,{variant:"primary",onClick:u,children:s.jsx(p,{defaultMessage:"Got it",id:"NYTGIbSNz5"})})]})]}),s.jsx(c,{open:h,onOpenChange:S,children:s.jsxs(x,{children:[s.jsx(m,{className:"fixed inset-0 z-50 bg-always-black/50 backdrop-blur-[2px] draggable-none"}),s.jsx(j,{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:s.jsxs("div",{className:"relative isolate rounded-r6 p-[var(--h4)] flex flex-col items-center gap-g8 text-center",children:[s.jsx(r,{elevation:"popover"}),T]})})]})})});h.displayName="EpitaxyNotificationPermissionModal";export{h as EpitaxyNotificationPermissionModal};
