import{r as e}from"./rolldown-runtime-DIIn1E2Q.js";import{ft as t}from"./vendor-primevue-DGevbYGF.js";import"./vendor-firebase-yTFzdAQf.js";import{D as n,F as r,I as i,O as a,R as o,Ut as s,_t as c,et as l,j as u,kt as d}from"./vendor-vue-core-BdhYaYlO.js";import"./vendor-other-D9HJWI2D.js";import"./useFeatureFlags-DLStzqlx.js";import"./api-C1WIrB4Z.js";import"./vendor-markdown-th9BvURy.js";import"./colorUtil-DJbZtU1U.js";import{n as f}from"./vendor-i18n-JubCsGQ_.js";import"./i18n-DKtnmyh4.js";import"./vendor-reka-ui-CSo89nDv.js";import{t as p}from"./Button-DHxPjNdi.js";import{Yr as m,wi as h}from"./dialogService-CwVeD8j9.js";import"./extensionStore-By6c6sCD.js";import"./userStore-ChcnLOkA.js";import"./useErrorHandling-CWU_3R6Y.js";import"./useExternalLink-DZBh_BZs.js";import"./vendor-tiptap-BZHcjrm1.js";import"./markdownRendererUtil-J4WlXR5e.js";import"./Popover-_oREh-V5.js";var g={class:`flex w-full max-w-[400px] flex-col rounded-2xl border border-border-default bg-base-background`},_={class:`flex h-12 items-center justify-between border-b border-border-default px-4`},v={class:`m-0 text-sm font-normal text-base-foreground`},y=[`aria-label`,`disabled`],b={class:`flex flex-col gap-4 px-4 py-4`},x={class:`m-0 text-sm text-muted-foreground`},S={class:`flex items-center justify-end gap-4 px-4 py-4`},C=o({__name:`CancelSubscriptionDialogContent`,props:{cancelAt:{}},setup(e){let o=e,{t:C}=f(),w=h(),T=t(),{cancelSubscription:E,fetchStatus:D,subscription:O}=m(),k=d(!1),A=n(()=>{let e=o.cancelAt??O.value?.endDate;return e?new Date(e).toLocaleDateString(`en-US`,{month:`long`,day:`numeric`,year:`numeric`}):C(`subscription.cancelDialog.endOfBillingPeriod`)}),j=n(()=>C(`subscription.cancelDialog.description`,{date:A.value}));function onClose(){k.value||w.closeDialog({key:`cancel-subscription`})}async function onConfirmCancel(){k.value=!0;try{await E(),await D(),w.closeDialog({key:`cancel-subscription`}),T.add({severity:`success`,summary:C(`subscription.cancelSuccess`),life:5e3})}catch(e){T.add({severity:`error`,summary:C(`subscription.cancelDialog.failed`),detail:e instanceof Error?e.message:C(`g.unknownError`),life:5e3})}finally{k.value=!1}}return(e,t)=>(l(),u(`div`,g,[a(`div`,_,[a(`h2`,v,s(e.$t(`subscription.cancelDialog.title`)),1),a(`button`,{class:`cursor-pointer rounded border-none bg-transparent p-0 text-muted-foreground transition-colors hover:text-base-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-secondary-foreground`,"aria-label":e.$t(`g.close`),disabled:k.value,onClick:onClose},t[0]||=[a(`i`,{class:`pi pi-times size-4`},null,-1)],8,y)]),a(`div`,b,[a(`p`,x,s(j.value),1)]),a(`div`,S,[i(p,{variant:`muted-textonly`,disabled:k.value,onClick:onClose},{default:c(()=>[r(s(e.$t(`subscription.cancelDialog.keepSubscription`)),1)]),_:1},8,[`disabled`]),i(p,{variant:`destructive`,size:`lg`,loading:k.value,onClick:onConfirmCancel},{default:c(()=>[r(s(e.$t(`subscription.cancelDialog.confirmCancel`)),1)]),_:1},8,[`loading`])])]))}});export{C as default};
//# sourceMappingURL=CancelSubscriptionDialogContent-BFl247LR.js.map