import{_ as z}from"./gQe2oyAA.js";import{d as $,x as K,L as R,H as L,I as U,r as y,P as F,M as O,Z as W,$ as Z,f as k,b as _,e as i,a as x,q as n,c as v,u as e,t as c,w as o,C as G,E as J,A as w,v as A,s as C,n as I,a0 as Q}from"./B2UyoCas.js";import{P as X}from"./DbfbC-Kb.js";import{_ as Y}from"./D7ehs0CJ.js";import{_ as ee}from"./DaLgO_IH.js";import{_ as te}from"./DvpWg0hF.js";import{_ as oe}from"./d7uC5V4A.js";import{_ as se}from"./C9KnTrrC.js";import{_ as ne}from"./Cdabmjjd.js";import"./CVosDfjh.js";import"./DeNTsafF.js";import"./DmViyvlQ.js";import"./CsNNGtvO.js";import"./C7qbYC45.js";import"./88opOQSr.js";import"./CHIgUVhi.js";import"./DyQtVBit.js";const ae={class:"rounded-lg o_border border-uiBorder-subtle"},re={class:"o_p-4"},le={key:0,class:"text-uiText-toned max-w-[70ch] text-balance o_mb-4"},ie={class:""},ce={class:"font-medium text-sm truncate group-hover:underline"},ue={class:"text-xs text-uiText-toned truncate"},me={class:"text-base max-w-[70ch] text-pretty"},_e={class:"max-w-[70ch] text-pretty"},de=$({__name:"DeleteAccount",setup(T){const r=K(),u=R(),S=L(),{t:d}=U(),m=y(!1),p=F(),{kapi:D}=O(),{$cpanel:f}=W(),h=y(null),N=()=>{var a,b,g;const t=(a=p.userDetails)==null?void 0:a.masterId,l=((b=p.companyDetails)==null?void 0:b.masterID)||((g=p.companyDetails)==null?void 0:g.id.replace("m",""));if(!t||!l)throw new Error("User details not found");return{uMID:t,cMID:l}},{levels:B}=Z(),P=async()=>{const{uMID:t,cMID:l}=N();try{await D("Company").then(a=>a.disconnectUser(Q().public.provider,+l,t,{deleteIfNoCompany:!0})),f&&await f.delete(),u.push(B.logout)}catch(a){console.error(a)}},V=[{accessorKey:"name",header:d("Project"),meta:{class:{td:"o_w-[400px]"}}},{accessorKey:"sku",header:d("Sku")}];return(t,l)=>{const a=G,b=X,g=Y,E=ee,H=te,M=oe,j=A,q=se;return _(),k("div",ae,[i("div",re,[e(r).allSystems.length?(_(),k("p",le,c(t.$t("userDetails.FollowingProjectsWillDeleted")),1)):x("",!0),n(E,{class:"m-px overflow-hidden",variant:"subtle",ui:{header:"border-b-0",body:"border-b-0"}},{default:o(()=>[e(r).allSystems.length?(_(),v(g,{key:0,data:e(r).allSystems,columns:V,sticky:"",ui:{th:"border-t border-uiBorder-subtle hidden",td:"o_py-2"}},{"name-cell":o(({row:s})=>[n(a,{class:"flex gap-x-4 group",to:{name:"p-pid-sid",params:{pid:s.original.pid,sid:s.original.sid}}},{default:o(()=>[i("div",{class:J(["rounded-full o_py-5 o_w-2",e(S).getStatusColor(s.original.pid)])},null,2),i("div",ie,[i("div",ce,c(s.original.name),1),i("div",ue,c(s.original.domain),1)])]),_:2},1032,["to"])]),"sku-cell":o(({row:s})=>[n(b,{"sku-name":s.original.skuName,"wanna-upsell":!1},null,8,["sku-name"])]),_:1},8,["data"])):x("",!0)]),_:1}),e(h)?(_(),v(H,{key:1,error:e(h),"with-refresh":!1,refresh:()=>{},class:"o_mt-4"},null,8,["error"])):x("",!0),e(r).allSystems.length?(_(),v(q,{key:2,icon:e(C).icoError,class:"o_mt-4",color:"error",variant:"subtle"},{title:o(()=>[i("div",me,c(t.$t("userDetails.deleteConfirmSentence")),1)]),description:o(()=>[i("div",_e,c(t.$t("accountDeletionConsequences")),1),n(M,{modelValue:e(m),"onUpdate:modelValue":l[0]||(l[0]=s=>w(m)?m.value=s:null),class:"my-4",required:"",size:"lg",color:"error",ui:{base:"ring ring-uiError-300",label:"text-uiText font-normal"},label:t.$t("ConfirmStartAccountDeletion")},null,8,["modelValue","label"]),n(j,{ui:{base:"dark:text-uiText-highlighted"},color:"error",size:"lg",disabled:!e(m),icon:e(C).icoTrash,onClick:P},{default:o(()=>[I(c(t.$t("userDetails.delete")),1)]),_:1},8,["disabled","icon"])]),_:1},8,["icon"])):x("",!0)])])}}}),pe=Object.assign(de,{__name:"DeleteAccount"}),Ne=$({__name:"customerDetails",setup(T){const{t:r}=U();r("userDetails.delete"),y(["0"]);const u=y(!1);return(S,d)=>{const m=z,p=A,D=pe,f=ne;return _(),k("div",null,[n(m,{"page-key":"pCustomerDetails"}),n(f,{open:e(u),"onUpdate:open":d[0]||(d[0]=h=>w(u)?u.value=h:null)},{content:o(()=>[n(D,{class:"o_mt-4"})]),default:o(()=>[n(p,{color:"error",variant:"outline",icon:e(C).icoTrash,active:e(u),"active-variant":"solid"},{default:o(()=>[I(c(e(r)("userDetails.delete")),1)]),_:1},8,["icon","active"])]),_:1},8,["open"])])}}});export{Ne as default};
