1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9397],{9397:function(e,s,t){t.r(s);var a=t(57437),d=t(2265),l=t(95478),i=t(98448),r=t(62654),n=t(55191),o=t(78801),c=t(75186),x=t(47903),m=t(31722),g=t(18627),p=t(62475);s.default=()=>{let{t:e}=(0,g.$)("account"),[s,t]=(0,d.useState)("shipping"),{shippingAddresses:b,billingAddresses:h,refetchAddresses:u}=(0,n.S)(),[f,v]=(0,d.useState)(!1),[k,j]=(0,d.useState)(null),[N,w]=(0,d.useState)(!1),y="shipping"===s,C=y?b:h,Z=()=>{j(null),v(!0)},D=e=>{j(e),v(!0)},A=async()=>{v(!1),j(null),await u()},S=async s=>{if(confirm(e("addresses.confirmDelete"))){w(!0);try{let t=await o.default.delete("/api/deleteAddress",{data:{id:s.id,AddressType:y?1:2}});200===t.status&&(c.ZP.success(e("addresses.deleteSuccess")),await u())}catch(s){(0,x.H)("Delete address error:",s),c.ZP.error(e("addresses.deleteError"))}finally{w(!1)}}},T=async s=>{w(!0);try{var t,a;let d=await o.default.post("api/user/address/changeDefaultAddress",{id:s,addressType:y?1:2});(null===(t=d.data)||void 0===t?void 0:t.statusCode)===200?(c.ZP.success(e("addresses.setDefaultSuccess")),await u()):c.ZP.error((null===(a=d.data)||void 0===a?void 0:a.message)||e("addresses.setDefaultError"))}catch(s){(0,x.H)("Set default address error:",s),c.ZP.error(e("addresses.setDefaultError"))}finally{w(!1)}},E=s=>{let{compact:t=!1}=s;return(0,a.jsxs)("button",{type:"button",onClick:Z,className:"inline-flex items-center justify-center gap-2 rounded-xl bg-indigo-600 font-bold text-white shadow-md shadow-indigo-600/15 transition hover:bg-indigo-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2 ".concat(t?"px-4 py-2.5 text-sm":"px-4 py-3 text-sm sm:px-5"),children:[(0,a.jsx)(m.Z,{name:"add.svg",className:"h-4 w-4"}),e("addresses.addNew")]})};return(0,a.jsxs)("div",{className:"space-y-5 sm:space-y-6",children:[(0,a.jsx)(p.Cv,{title:e("addresses.managementTitle"),description:e("addresses.infoText"),icon:"land-location.svg",accent:"emerald",action:(0,a.jsx)(E,{compact:!0})}),(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3 rounded-[1.35rem] border border-slate-200 bg-slate-50 p-1.5 dark:border-slate-800 dark:bg-slate-900 sm:max-w-xl",children:[{id:"shipping",label:e("addresses.tabs.shipping"),count:b.length,icon:"land-location.svg"},{id:"invoice",label:e("addresses.tabs.billing"),count:h.length,icon:"file-invoice.svg"}].map(e=>{let d=s===e.id;return(0,a.jsxs)("button",{type:"button",onClick:()=>t(e.id),className:"flex min-w-0 items-center justify-center gap-2 rounded-xl px-3 py-2.5 text-xs font-extrabold transition sm:text-sm ".concat(d?"bg-white text-indigo-700 shadow-sm ring-1 ring-slate-200/70 dark:bg-slate-800 dark:text-indigo-300 dark:ring-slate-700":"text-slate-600 hover:text-slate-950 dark:text-slate-400 dark:hover:text-white"),children:[(0,a.jsx)(m.Z,{name:e.icon,className:"h-4 w-4 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e.label}),(0,a.jsx)("span",{className:"rounded-full px-2 py-0.5 text-[10px] ".concat(d?"bg-indigo-50 text-indigo-700 dark:bg-indigo-950/70 dark:text-indigo-300":"bg-slate-200/70 text-slate-600 dark:bg-slate-700 dark:text-slate-300"),children:e.count})]},e.id)})}),(0,a.jsx)("div",{className:"flex items-center justify-between gap-4 px-1",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-extrabold text-slate-950 dark:text-white",children:y?e("addresses.shippingTitle"):e("addresses.billingTitle")}),(0,a.jsx)("p",{className:"mt-1 text-xs font-medium text-slate-600 dark:text-slate-400",children:e("addresses.registeredAddresses",{count:C.length,type:y?e("addresses.shipping"):e("addresses.billing")})})]})}),C.length>0?(0,a.jsx)("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3",children:C.map(s=>{let t=[s.district,s.town,s.city].filter(Boolean).join(" \xb7 ");return(0,a.jsxs)("article",{className:"relative flex flex-col overflow-hidden rounded-[1.35rem] border bg-white p-4 transition-all duration-300 hover:-translate-y-0.5 hover:shadow-md sm:p-5 ".concat(s.isDefault?"border-indigo-200 shadow-md shadow-indigo-100/60 ring-1 ring-indigo-100":"border-slate-200/80 shadow-sm hover:border-indigo-200"," dark:border-slate-800 dark:bg-slate-900"),children:[s.isDefault&&(0,a.jsx)("div",{className:"absolute inset-x-0 top-0 h-1 bg-gradient-to-r from-indigo-500 to-violet-500"}),(0,a.jsxs)("div",{className:"flex items-start gap-3.5",children:[(0,a.jsx)("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl ".concat(y?"bg-emerald-50 text-emerald-600 dark:bg-emerald-950/50 dark:text-emerald-300":"bg-violet-50 text-violet-600 dar
1k:bg-violet-950/50 dark:text-violet-300"),children:(0,a.jsx)(m.Z,{name:y?"land-location.svg":"file-invoice.svg",className:"h-5 w-5"})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("h3",{className:"truncate text-base font-extrabold text-slate-950 dark:text-white",children:s.addressName}),s.isDefault&&(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-indigo-50 px-2.5 py-1 text-[10px] font-extrabold uppercase tracking-wide text-indigo-700 dark:bg-indigo-950/60 dark:text-indigo-300",children:[(0,a.jsx)(m.Z,{name:"octagon-check.svg",className:"h-3 w-3"}),e("addresses.default")]})]}),(0,a.jsx)("p",{className:"mt-1 text-sm font-semibold text-slate-700 dark:text-slate-300",children:y?"".concat(s.firstName," ").concat(s.lastName):1===s.billingType?e("addresses.individualInvoice"):e("addresses.corporateInvoice")})]})]}),(0,a.jsxs)("div",{className:"mt-4 flex-1 space-y-1.5",children:[!y&&s.companyName&&(0,a.jsx)("p",{className:"text-sm font-bold text-slate-800 dark:text-slate-200",children:s.companyName}),(0,a.jsx)("p",{className:"line-clamp-2 text-sm font-medium leading-5 text-slate-700 dark:text-slate-300",children:s.addressDetails}),(0,a.jsxs)("p",{className:"text-xs font-medium text-slate-600 dark:text-slate-400",children:[t," \xb7 ",s.country]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 pt-1",children:[s.phone&&(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-lg bg-slate-100 px-2.5 py-1.5 text-xs font-semibold text-slate-700 dark:bg-slate-800 dark:text-slate-300",children:[(0,a.jsx)(m.Z,{name:"mobile-notch.svg",className:"h-3.5 w-3.5"}),s.phone]}),s.postCode&&(0,a.jsxs)("span",{className:"rounded-lg bg-slate-100 px-2.5 py-1.5 text-xs font-semibold text-slate-700 dark:bg-slate-800 dark:text-slate-300",children:[e("addresses.labels.postCode"),": ",s.postCode]}),!y&&s.taxNumber&&(0,a.jsxs)("span",{className:"rounded-lg bg-slate-100 px-2.5 py-1.5 text-xs font-semibold text-slate-700 dark:bg-slate-800 dark:text-slate-300",children:[e("addresses.labels.taxNumber"),": ",s.taxNumber]}),!y&&s.taxOffice&&(0,a.jsxs)("span",{className:"rounded-lg bg-slate-100 px-2.5 py-1.5 text-xs font-semibold text-slate-700 dark:bg-slate-800 dark:text-slate-300",children:[e("addresses.labels.taxOffice"),": ",s.taxOffice]})]})]}),(0,a.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-1.5 border-t border-slate-100 pt-3 dark:border-slate-800",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>D(s),className:"inline-flex items-center gap-1.5 rounded-lg bg-indigo-50 px-3 py-2 text-xs font-bold text-indigo-700 transition hover:bg-indigo-100 dark:bg-indigo-950/50 dark:text-indigo-300",children:[(0,a.jsx)(m.Z,{name:"file-edit.svg",className:"h-3.5 w-3.5"}),e("addresses.edit")]}),!s.isDefault&&(0,a.jsxs)("button",{type:"button",onClick:()=>T(s.id),className:"inline-flex items-center gap-1.5 rounded-lg bg-emerald-50 px-3 py-2 text-xs font-bold text-emerald-700 transition hover:bg-emerald-100 dark:bg-emerald-950/50 dark:text-emerald-300",children:[(0,a.jsx)(m.Z,{name:"octagon-check.svg",className:"h-3.5 w-3.5"}),e("addresses.makeDefault")]}),(0,a.jsxs)("button",{type:"button",onClick:()=>S(s),className:"ml-auto inline-flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs font-bold text-rose-600 transition hover:bg-rose-50 dark:text-rose-300 dark:hover:bg-rose-950/40",children:[(0,a.jsx)(m.Z,{name:"trash.svg",className:"h-3.5 w-3.5"}),e("addresses.delete")]})]})]},s.id)})}):(0,a.jsx)(p.Cr,{icon:y?"land-location.svg":"file-invoice.svg",title:y?e("addresses.noAddresses"):e("addresses.noBillingAddresses"),description:y?e("addresses.addFirst"):e("addresses.addFirstBilling"),accent:y?"emerald":"violet",action:(0,a.jsx)(E,{})}),N&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-slate-950/20 backdrop-blur-sm",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-2xl bg-white px-5 py-4 shadow-2xl dark:bg-slate-900",children:[(0,a.jsx)("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-indigo-100 border-t-indigo-600"}),(0,a.jsx)("span",{className:"text-sm font-bold text-slate-800 dark:text-white",children:e("addresses.loading")})]})}),f&&(0,a.jsx)(l.Z,{show:f,onClose:A,panelClassName:"max-w-3xl",children:y?(0,a.jsx)(i.Z,{onClose:A,onAddressAdded:A,initialData:null!=k?k:void 0}):(0,a.jsx)(r.Z,{onClose:A,onAddressAdded:A,initialData:null!=k?k:void 0})})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.