import{r as e,j as s}from"./vendor-react-Dp9pL_Wn.js";import{aL as a,aM as t,aN as i,aO as n,aP as r,aQ as o,aR as l}from"./index-CBEPphRm.js";import{N as d}from"./c1f7a9f2d-BWS0oZW8.js";import{M as c}from"./vendor-intl-D2wGIp4M.js";import{o as x}from"./c6eedc03a-CsEFTfjy.js";import{u as m,C as j}from"./vendor-ant-cds-bBedrtIN.js";import{P as f,Q as p,R as g,U as h,V as u,W as v}from"./vendor-base-ui-DNypCIlh.js";import"./vendor-infra-DayZK7Ds.js";import"./vendor-zod-0xcuG3aM.js";import"./vendor-router-qG5OCEmI.js";import"./vendor-query-BwvgHhJ1.js";import"./vendor-zustand-BeF8W8xk.js";import"./caf7c7e06-DJYXCm3T.js";import"./vendor-lodash-BvMLws5K.js";import"./vendor-icons-CokWnmlw.js";import"./vendor-motion-EDlUw66k.js";import"./vendor-radix-Ch96tRrt.js";import"./vendor-base-5_f7mmWg.js";import"./c5669b8e4-DFSq88jr.js";import"./vendor-luxon-CZxT8ieM.js";import"./c5f4e1303-CiyIFgnl.js";import"./cbaad2c48-DaP34LG2.js";import"./vendor-virtual-DRz8lJfQ.js";import"./vendor-growthbook-C66YtMMX.js";import"./vendor-zod-v3-CZy0YPWu.js";const b=e.memo(function({isOpen:b,onClose:N,onDontAskAgain:y}){const k=x(),w=a(),M=t(),[C,z]=e.useState(!1),Y=i(),G=m(50),{data:I}=n(),{mutateAsync:S}=r(),T=e.useCallback(async()=>{z(!0);try{const{success:e}=await M();if(e){const e=I?.preferences||{};await S({preferences:{...e,feature_preference:{...e.feature_preference,bogosort:{...e.feature_preference?.bogosort,enable_push:!0,enable_email:e.feature_preference?.bogosort?.enable_email??!0}}}}),y?.(),N()}}finally{z(!1)}},[M,I,S,y,N]),_=e.useCallback(()=>{y?.(),N()},[y,N]),A=e.useCallback(()=>{k.push("/settings/general"),N()},[k,N]),E=e.useCallback(e=>{e||C||N()},[N,C]);let D;return D="default"===w?s.jsxs(s.Fragment,{children:[s.jsx(d,{className:"h-[var(--h6)] w-[var(--h6)] text-accent-brand"}),s.jsxs("div",{className:"flex flex-col items-center gap-g6",children:[s.jsx(u,{className:"text-heading-semibold text-t9",children:s.jsx(c,{defaultMessage:"Enable notifications",id:"AIUVfaT9og"})}),s.jsx(v,{className:"text-body text-t6",children:s.jsx(c,{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(l,{variant:"contained",onClick:N,disabled:C,children:s.jsx(c,{defaultMessage:"Not now",id:"dUCA4Khx0S"})}),s.jsx(l,{variant:"primary",onClick:T,busy:C,children:s.jsx(c,{defaultMessage:"Enable",id:"TqSTI0/TZI"})})]}),s.jsx(l,{variant:"link",size:"small",onClick:_,children:s.jsx(c,{defaultMessage:"Don\u2019t ask me again",id:"+xRY6yy3uz"})})]}):"denied"===w?s.jsxs(s.Fragment,{children:[s.jsx(d,{className:"h-[var(--h6)] w-[var(--h6)] text-t5"}),s.jsxs("div",{className:"flex flex-col items-center gap-g6",children:[s.jsx(u,{className:"text-heading-semibold text-t9",children:s.jsx(c,{defaultMessage:"Notifications blocked",id:"E7B/kovpEi"})}),s.jsx(v,{className:"text-body text-t6",children:s.jsx(c,{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(l,{variant:"contained",onClick:N,children:s.jsx(c,{defaultMessage:"Got it",id:"NYTGIbSNz5"})})}),s.jsx(l,{variant:"link",size:"small",onClick:_,children:s.jsx(c,{defaultMessage:"Don\u2019t ask me again",id:"+xRY6yy3uz"})})]}):s.jsxs(s.Fragment,{children:[s.jsx(d,{className:"h-[var(--h6)] w-[var(--h6)] text-accent-brand"}),s.jsxs("div",{className:"flex flex-col items-center gap-g6",children:[s.jsx(u,{className:"text-heading-semibold text-t9",children:s.jsx(c,{defaultMessage:"Notifications enabled",id:"SkJDT6Yg8Y"})}),s.jsx(v,{className:"text-body text-t6",children:s.jsx(c,{defaultMessage:"You\u2019ll receive notifications when your tasks need attention.",id:"ZG1w2HTdIt"})})]}),s.jsxs("div",{className:"flex justify-center gap-g4",children:[s.jsx(l,{variant:"contained",onClick:A,children:s.jsx(c,{defaultMessage:"Settings",id:"D3idYvSLF9"})}),s.jsx(l,{variant:"primary",onClick:N,children:s.jsx(c,{defaultMessage:"Got it",id:"NYTGIbSNz5"})})]})]}),s.jsx(f,{open:b,onOpenChange:E,children:s.jsxs(p,{container:Y,children:[s.jsx(g,{className:"fixed inset-0 bg-always-black/50 backdrop-blur-[2px] draggable-none",style:{zIndex:G}}),s.jsx(h,{className:"epitaxy-root fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[26rem] max-w-[calc(100vw-2rem)] draggable-none outline-none",style:{zIndex:G},children:s.jsx(j,{children:s.jsxs("div",{className:"relative isolate rounded-r6 p-[var(--h4)] flex flex-col items-center gap-g8 text-center",children:[s.jsx(o,{elevation:"popover"}),D]})})})]})})});b.displayName="EpitaxyNotificationPermissionModal";export{b as EpitaxyNotificationPermissionModal};
