1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3246],{9182:function(e,s,l){"use strict";l.d(s,{t:function(){return g}});var n,d,t,i,r=l(97582),a=l(85893),o=l(67294),c=l(72832),u=l(83566),h=l(26601),v=l(54350),m=h.Z.div(n||(n=(0,r.cy)(["\n display: flex;\n align-items: center;\n justify-content: center;\n user-select: none;\n"],["\n display: flex;\n align-items: center;\n justify-content: center;\n user-select: none;\n"]))),_=h.Z.div(d||(d=(0,r.cy)(["\n width: 0.531rem;\n height: 0.875rem;\n display: flex;\n align-items: center;\n cursor: pointer;\n"],["\n width: 0.531rem;\n height: 0.875rem;\n display: flex;\n align-items: center;\n cursor: pointer;\n"]))),x=h.Z.div(t||(t=(0,r.cy)(["\n display: flex;\n ",";\n"],["\n display: flex;\n ",";\n"])),(0,v.w)({margin:["0 0.75rem","0 1.25rem"]})),A=h.Z.span(i||(i=(0,r.cy)(["\n font-weight: ",";\n color: ",";\n text-align: center;\n cursor: pointer;\n margin: 0 2px;\n border-bottom: ",";\n ",";\n background: ",";\n"],["\n font-weight: ",";\n color: ",";\n text-align: center;\n cursor: pointer;\n margin: 0 2px;\n border-bottom: ",";\n ",";\n background: ",";\n"])),function(e){return e.bold?"700":"500"},function(e){return e.color},function(e){var s=e.underline,l=e.borderColor;return s?"0.063rem solid ".concat(l):"none"},(0,v.w)({fontSize:["1rem","1.25rem"],lineHeight:["1.5rem","1.75rem"],minWidth:["1.5rem","1.875rem"]}),function(e){return e.background||"unset"}),g=function(e){var s=e.from,l=e.to,n=e.currentPage,d=e.onChange,t=e.underlineActive,i=void 0===t||t,h=e.boldActive,v=void 0===h||h,g=e.disabled,p=void 0!==g&&g,y=e.showReducedPages,S=void 0!==y&&y,f=(0,c.Fg)(),C=(0,o.useState)(void 0===n?s:n),E=C[0],N=C[1],b=function(e){p||e<s||e>l||(N(e),d(e))},j=(0,o.useMemo)(function(){if(!S)return[];var e=[];return Array(l-s+1).fill(0).map(function(l,n){s+n>E-3&&s+n<E+3&&e.push(s+n)}),e[0]===s+3-1?e=[s,s+1].concat(e):e[0]>s+3-1?e=[s,-2].concat(e):e[0]===s+1&&(e=[s].concat(e)),e[e.length-1]===l-3+1?e=e.concat([l-1,l]):e[e.length-1]<l-3+1?e=e.concat([-2,l]):e[e.length-1]===l-1&&(e=e.concat([l])),e},[s,E,S,l]);return(0,a.jsxs)(m,(0,r.pi)({"data-testid":"PaginationContainer"},{children:[(0,a.jsx)(_,(0,r.pi)({onClick:function(){return b(E-1)},"data-testid":"LeftChevron"},{children:(0,a.jsx)(u.J.Arrows.ChevronLeft,{fill:p?f.colors.shades[250].color:f.colors.shades[700].color},void 0)}),void 0),!S&&(0,a.jsx)(x,(0,r.pi)({"data-testid":"PageNumbersContainer",theme:f},{children:Array(l-s+1).fill(0).map(function(e,l){return(0,a.jsx)(A,(0,r.pi)({onClick:function(){return b(l+s)},bold:v&&E===l+s,underline:i&&E===l+s,role:"button",color:p?f.colors.shades[250].color:f.colors.shades[700].color,borderColor:p?f.colors.shades[250].color:f.colors.shades[700].color,theme:f},{children:l+s}),l)})}),void 0),S&&(0,a.jsx)(x,(0,r.pi)({"data-testid":"PageNumbersContainer",theme:f},{children:j.map(function(e,s){return(0,a.jsx)(A,(0,r.pi)({onClick:function(){return b(e)},bold:v&&E===e,underline:i&&E===e,role:"button",color:p?f.colors.shades[250].color:f.colors.shades[700].color,borderColor:p?f.colors.shades[250].color:f.colors.shades[700].color,theme:f},{children:-2!==e?e:"..."}),s)})}),void 0),(0,a.jsx)(_,(0,r.pi)({onClick:function(){return b(E+1)},"data-testid":"RightChevron"},{children:(0,a.jsx)(u.J.Arrows.ChevronRight,{fill:p?f.colors.shades[250].color:f.colors.shades[700].color},void 0)}),void 0)]}),void 0)}},29852:function(e,s,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/account/addresses",function(){return l(94778)}])},94778:function(e,s,l){"use strict";l.r(s),l.d(s,{__N_SSP:function(){return z},default:function(){return B}});var n=l(85893),d=l(67294),t=l(11163),i=l(92490),r=l(90128),a=l(82711),o=l(80496),c=l(19927),u=l(83566),h=l(60814),v=l(9182),m=l(6304),_=l(57742),x=l(73849),A=l.n(x),g=e=>{var s,l;let{address:d,handleEditAddress:t,openDeleteAddressModal:r,labels:a}=e,{isMobile:o}=(0,i.d)();return(0,n.jsxs)("div",{className:A().addressDetails,children:[(0,n.jsxs)("div",{className:A().addressName,children:[(0,n.jsxs)(h.x,{variant:"body",weight:"demi",children:["".concat(null==d?void 0:d.firstName," ").concat(null==d?void 0:d.lastName),(null==d?void 0:d.isDefault)&&(0,n.jsx)("span",{className:A().defaultTag,children:null!==(s=null==a?void 0:a.defaultBadge)&&void 0!==s?s:"Default"})]}),(0,n.jsx)(h.x,{variant:"link",weight:"regular",testId:"address-edit-btn",onClick:()=>t(d),children:(0,n.jsx)(u.J.Actions.Edit,{width:1.5,height:1.375})}),(0,n.jsx)(h.x,{variant:"link",weight:"regular",testId:"address-delete-btn",onClick:()=>r((null==d?void 0:d.id)||""),children:(0,n.jsx)(u.J.Actions.Trash,{width:1.125,height:1.375})})]}),(0,n.jsxs)("div",{className:A().addressContent,children:[(0,n.jsxs)(h.x,{variant:"body",weight:"regular",size:o?"regular":"small",children:[null==d?void 0:d.address1," ",null==d?void 0:d.address2]}),(0,n.jsx)(h.x,{variant:"body",weight:"regular",size:o?"regular":"small",children:null==d?void 0:d.zip}),(0,n.jsxs)(h.x,{variant:"body",weight:"regular",size:o?"regular":"small",children:[null==d?void 0:d.city," ",null==d?void 0:d.state]}),(0,n.jsx)(h.x,{variant:"body",weight:"regular",size:o?"regular":"small",children:null==d?void 0:d.country}),(0,n.jsxs)(h.x,{variant:"body",weight:"regular",size:o?"regular":"small",children:[null!==(l=null==a?void 0:a.phoneNumberLabel)&&void 0!==l?l:"Phone number:"," +",null==d?void 0:d.phone]})]})]})},p=l(87248),y=l(46546),S=l(94760),f=l.n(S),C=l(62851),E=l(89343),N=e=>{let{id:s,title:l,body:d,acceptText:t,rejectText:a,acceptHandler:o}=e,{isMobile:c}=(0,i.d)(),{opened:h}=(0,r.dd)(s),v=()=>(0,r.L5)(s,{type:"close"});return(0,E.h)({isOpen:h}),(0,n.jsx)("div",{className:f().modalContainer,children:(0,n.jsx)(r.u_,{id:s,padding:c?"16px":"24px 48px",children:h&&(0,n.jsxs)(C.Z,{isOpen:h,onClose:v,returnFocus:!1,children:[(0,n.jsx)("button",{type:"button",className:f().closeIcon,onClick:v,"aria-label":"Close modal",children:(0,n.jsx)(u.J.Actions.Close,{showTooltipTitle:!1,title:"","aria-hidden":"true"})}),(0,n.jsx)("div",{className:f().title,children:l}),(0,n.jsx)("div",{className:f().body,children:d}),(0,n.jsxs)("div",{className:f().actionButtons,children:[(0,n.jsx)(p.Z,{onClick:v,text:a}),(0,n.jsx)(y.Z,{onClick:o,text:t})]})]})})})},b=l(52509),j=l(77911),D=l.n(j),w=l(22390),T=e=>{var s,l,d,t,i,r,a,o,c,u,v,m,_,x,A,g,S,f,C,E,N,j,T,R,O;let{address:L,states:F,setAddress:k,onSubmitNewAddress:M,onCancelForm:I,labels:P}=e;return(0,n.jsxs)("form",{onSubmit:M,className:D().newAddressForm,id:"address-".concat((null==L?void 0:L.id)||"new"),children:[(0,n.jsxs)("div",{className:D().inputsName,children:[(0,n.jsx)("label",{htmlFor:"first-name",className:"srOnly",children:null!==(s=null==P?void 0:P.firstName)&&void 0!==s?s:"First Name"}),(0,n.jsx)(b.I.Simple,{label:null!==(l=null==P?void 0:P.firstName)&&void 0!==l?l:"First Name",value:null==L?void 0:L.firstName,maxLength:50,onChange:e=>k({...L,firstName:e}),id:"first-name","aria-label":null!==(d=null==P?void 0:P.firstName)&&void 0!==d?d:"First Name"}),(0,n.jsx)("label",{htmlFor:"last-name",className:"srOnly",children:null!==(t=null==P?void 0:P.lastName)&&void 0!==t?t:"Last Name"}),(0,n.jsx)(b.I.Simple,{label:null!==(i=null==P?void 0:P.lastName)&&void 0!==i?i:"Last Name",value:null==L?void 0:L.lastName,maxLength:50,onChange:e=>k({...L,lastName:e}),id:"last-name","aria-label":null!==(r=null==P?void 0:P.lastName)&&void 0!==r?r:"Last Name"})]}),(0,n.jsxs)("div",{className:D().inputAddressOne,children:[(0,n.jsx)("label",{htmlFor:"address-1",className:"srOnly",children:null!==(a=null==P?void 0:P.address1)&&void 0!==a?a:"Address 1"}),(0,n.jsx)(b.I.Simple,{required:null!==(o=null==P?void 0:P.fieldRequired)&&void 0!==o?o:"This field is required",label:null!==(c=null==P?void 0:P.address1)&&void 0!==c?c:"Address 1",value:null==L?void 0:L.address1,maxLength:250,onChange:e=>k({...L,address1:e}),id:"address-1","aria-label":null!==(u=null==P?void 0:P.address1)&&void 0!==u?u:"Address 1"})]}),(0,n.jsxs)("div",{className:D().inputAddressTwo,children:[(0,n.jsx)("label",{htmlFor:"address-2",className:"srOnly",children:null!==(v=null==P?void 0:P.address2)&&void 0!==v?v:"Address 2"}),(0,n.jsx)(b.I.Simple,{label:null!==(m=null==P?void 0:P.address2)&&void 0!==m?m:"Address 2",value:null==L?void 0:L.address2,maxLength:250,onChange:e=>k({...L,address2:e}),id:"address-2","aria-label":null!==(_=null==P?void 0:P.address2)&&void 0!==_?_:"Address 2"})]}),(0,n.jsxs)("div",{className:D().inputsRegion,children:[(0,n.jsx)("label",{htmlFor:"city",className:"srOnly",children:null!==(x=null==P?void 0:P.city)&&void 0!==x?x:"City"}),(0,n.jsx)(b.I.Simple,{required:null!==(A=null==P?void 0:P.fieldRequired)&&void 0!==A?A:"This field is required",label:null!==(g=null==P?void 0:P.city)&&void 0!==g?g:"City",value:null==L?void 0:L.city,maxLength:50,onChange:e=>k({...L,city:e}),id:"city","aria-label":null!==(S=null==P?void 0:P.city)&&void 0!==S?S:"City"}),!!(null==F?void 0:F.length)&&(0,n.jsxs)("div",{children:[(0,n.jsx)(h.x,{variant:"label",weight:"demi",htmlFor:"state",style:{fontSize:"16px",lineHeight:"24px"},children:null!==(f=null==P?void 0:P.state)&&void 0!==f?f:"State"}),(0,n.jsx)("select",{onChange:e=>{var s;return k({...L,state:null==e?void 0:null===(s=e.target)||void 0===s?void 0:s.value})},value:null==L?void 0:L.state,className:D().optionsSelect,name:"state",id:"state",children:F.map((e,s)=>(0,n.jsx)("option",{value:e,children:e},"state-".concat(s)))})]}),(0,n.jsxs)("div",{className:D().inputCountry,children:[(0,n.jsx)(h.x,{variant:"label",weight:"demi",htmlFor:"country",style:{fontSize:"16px",lineHeight:"24px"}
1,children:null!==(C=null==P?void 0:P.country)&&void 0!==C?C:"Country"}),(0,n.jsx)("select",{onChange:e=>{var s;return k({...L,country:null==e?void 0:null===(s=e.target)||void 0===s?void 0:s.value})},value:null==L?void 0:L.country,className:D().optionsSelect,name:"country",id:"country",children:w.Td.map((e,s)=>(0,n.jsx)("option",{disabled:"---"===e,value:w.od[e],children:w.od[e]||"---"},"country-".concat(s)))})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"phone",className:"srOnly",children:null!==(E=null==P?void 0:P.phone)&&void 0!==E?E:"Phone"}),(0,n.jsx)(b.I.Simple,{label:null!==(N=null==P?void 0:P.phone)&&void 0!==N?N:"Phone",value:null==L?void 0:L.phone,maxLength:16,onChange:e=>k({...L,phone:e}),id:"phone","aria-label":null!==(j=null==P?void 0:P.phone)&&void 0!==j?j:"Phone"})]}),(0,n.jsxs)("div",{className:D().newAddressActions,children:[(0,n.jsx)(y.Z,{text:null!==(T=null==P?void 0:P.cancel)&&void 0!==T?T:"CANCEL",testId:"new-form-cancel-btn",onClick:I}),(0,n.jsx)(p.Z,{type:"submit",text:(null==L?void 0:L.id)?null!==(R=null==P?void 0:P.save)&&void 0!==R?R:"SAVE":null!==(O=null==P?void 0:P.add)&&void 0!==O?O:"ADD",testId:"new-form-submit-btn",onClick:e=>e})]})]})},R=l(73755),O=l(49605);let L={id:"",address1:"",address2:"",city:"",company:"",country:w.od[w.Td[0]],firstName:"",lastName:"",phone:"",state:(0,O.Pz)(w.Td[0])[0],zip:"",isDefault:!1};var F=l(87027),k=l(64889),M=l.n(k),I=l(34090),P=l(20243),U=()=>{var e,s;let l=(0,t.useRouter)(),{isMobile:x}=(0,i.d)(),{getAllAddresses:A,createAddress:p,updateAddress:y,deleteAddress:S}=(0,F.x7)(),{isLoggedIn:f,addresses:C,defaultAddress:E,status:b}=(0,F.q3)(),{translate:j,TRANSLATION_KEYS:D}=(0,P.T)(),[w,k]=(0,d.useState)(1),[U,z]=(0,d.useState)(!1),[B,H]=(0,d.useState)(""),[Z,q]=(0,d.useState)({severity:"",summary:""}),J=(0,d.useRef)(null),V=e=>{var s;null===(s=e.current)||void 0===s||s.show()},G=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",l={create:D.ACCOUNT.ADDRESSES_TOAST_SUCCESS_CREATE,update:D.ACCOUNT.ADDRESSES_TOAST_SUCCESS_UPDATE,delete:D.ACCOUNT.ADDRESSES_TOAST_SUCCESS_DELETE}[s],n="error"!==e&&l?j(l):j(D.ACCOUNT.ADDRESSES_TOAST_ERROR,{action:s});q({severity:e,summary:n})};(0,d.useEffect)(()=>{f&&A()},[f,A]);let[W,Y]=(0,d.useState)(L),Q=(0,d.useMemo)(()=>(0,O.Pz)((0,I.P)((null==W?void 0:W.country)||"")),[W.country]),X=(0,d.useRef)(null);(0,d.useEffect)(()=>{Y(e=>Q.find(s=>s===e.state)?e:{...e,province:Q[0]})},[Q]);let K=(0,d.useCallback)(()=>{var e;null==X||null===(e=X.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[]),$=(0,d.useCallback)(()=>{z(!0),l.replace("/account/addresses?new_address=true",void 0,{shallow:!0}),Y(L),K()},[K]),ee=(0,d.useCallback)(async e=>{e.cancelable&&e.preventDefault();let{id:s,...l}=W,{errors:n}=s?await y({id:s,address:l}):await p(l),d=s?"update":"create";(null==n?void 0:n.message)?(console.error("[handleSubmitAddress]",n.message),G("error",d)):G("success",d),V(J),z(!1),Y(L)},[W,y,p,V]),es=(0,d.useCallback)(e=>{z(!0),Y(e),K()},[K]),el=(0,d.useCallback)(async e=>{let{errors:s}=await S(e);(null==s?void 0:s.message)?(console.error("[handleDeleteAddress]",s.message),G("error","delete")):G("success","delete"),(0,r.L5)("delete-address-modal",{type:"close"}),V(J)},[S,V]),en=e=>{H(e),(0,r.L5)("delete-address-modal",{type:"open"})},ed={width:x?"22px":"24px",height:x?"22px":"24px"},et=()=>{z(!1),l.replace("/account/addresses",void 0,{shallow:!0})};(0,d.useEffect)(()=>{var e;(null===(e=l.query)||void 0===e?void 0:e.new_address)&&z(!0)},[null===(e=l.query)||void 0===e?void 0:e.new_address]);let ei=D.ACCOUNT,er={firstName:j(ei.FORM_FIRST_NAME),lastName:j(ei.FORM_LAST_NAME),address1:j(ei.FORM_ADDRESS_1),address2:j(ei.FORM_ADDRESS_2),city:j(ei.FORM_CITY),state:j(ei.FORM_STATE),country:j(ei.FORM_COUNTRY),phone:j(ei.FORM_PHONE),fieldRequired:j(ei.FORM_FIELD_REQUIRED),cancel:j(ei.FORM_CANCEL),save:j(ei.FORM_SAVE),add:j(ei.FORM_ADD)},ea={defaultBadge:j(ei.COMMON_DEFAULT_BADGE),phoneNumberLabel:j(ei.COMMON_PHONE_NUMBER_LABEL)},eo=U?(null===(s=l.query)||void 0===s?void 0:s.new_address)?j(ei.ADDRESSES_ADD_NEW_TITLE):j(ei.ADDRESSES_EDIT_TITLE):j(ei.ADDRESSES_TITLE);return(0,n.jsxs)(_.Z,{children:[(0,n.jsx)(a.F,{ref:J,summary:Z.summary,severity:Z.severity}),(0,n.jsx)(N,{id:"delete-address-modal",title:j(ei.ADDRESSES_DELETE_MODAL_TITLE),body:j(ei.ADDRESSES_DELETE_MODAL_BODY),acceptText:j(ei.ADDRESSES_DELETE_MODAL_ACCEPT),rejectText:j(ei.ADDRESSES_DELETE_MODAL_REJECT),acceptHandler:()=>el(B)}),(0,n.jsxs)("div",{className:M().title,children:[(x||U)&&(0,n.jsx)(o.h,{onClick:()=>{U?et():globalThis.location.assign("/account/home")},"aria-label":j(D.COMMON.BUTTONS_GO_BACK),backgroundColor:{active:"transparent",hover:"transparent"},size:c.dr.Small,children:(0,n.jsx)(u.J.Arrows.ChevronLeft,{width:ed.width,height:ed.height,"aria-hidden":"true"})}),(0,n.jsx)(h.x,{variant:"heading3",weight:"demi",role:"heading","aria-level":1,children:eo})]}),U?(0,n.jsx)("div",{className:M().newAddressContainer,ref:X,children:(0,n.jsx)(T,{address:W,states:Q,setAddress:Y,onSubmitNewAddress:ee,onCancelForm:et,labels:er})}):(0,n.jsxs)(n.Fragment,{children:["loading"===b&&(0,n.jsx)(R.Z,{height:162}),"loading"!==b&&(null==C?void 0:C.length)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:M().addressesContainer,children:null==C?void 0:C.slice((w-1)*8,8*w).map((e,s)=>(0,n.jsx)(g,{address:e,defaultAddressId:null==E?void 0:E.id,handleEditAddress:es,openDeleteAddressModal:()=>en(e.id||""),labels:ea},"address-".concat(s)))}),(null==C?void 0:C.length)>8&&(0,n.jsx)(v.t,{from:1,to:Math.ceil((null==C?void 0:C.length)/8),onChange:k,underlineActive:!0,showReducedPages:!0})]}):"loading"!==b&&(0,n.jsxs)("div",{className:M().noAddresses,children:[(0,n.jsx)(h.x,{variant:"body",children:j(ei.ADDRESSES_NO_ADDRESSES_MESSAGE)}),(0,n.jsx)(m.Z,{onClick:$,text:j(ei.ADDRESSES_ADD_NEW_SHIPPING_ADDRESS),"data-testid":"add-new-address-btn"})]})]}),!U&&(null==C?void 0:C.length)!==0&&(0,n.jsx)(h.x,{variant:"link",onClick:$,weight:"demi",style:{textDecoration:"underline"},testId:"add-new-address-btn",children:(0,n.jsxs)("div",{className:M().newAddressAction,children:[(0,n.jsx)(u.J.Actions.Add,{width:1.25,height:1.25}),j(ei.ADDRESSES_ADD_NEW_SHIPPING_ADDRESS)]})})]})},z=!0,B=()=>(0,n.jsx)(U,{})}
1,73849:function(e){e.exports={addressDetails:"styles_addressDetails__zeyDO",addressName:"styles_addressName__m3quU",addressContent:"styles_addressContent__TlJja",defaultTag:"styles_defaultTag__0rHOc",defaultAddresses:"styles_defaultAddresses__rwLDh"}},94760:function(e){e.exports={modalContainer:"styles_modalContainer__fUbRW",closeIcon:"styles_closeIcon__RsyB6",title:"styles_title__981_l",body:"styles_body__TiitJ",actionButtons:"styles_actionButtons__dHVt1"}},77911:function(e){e.exports={newAddressForm:"styles_newAddressForm__l56XU",inputsName:"styles_inputsName__1fxci",inputsRegion:"styles_inputsRegion__TRK8t",optionsSelect:"styles_optionsSelect__Q5A_z",newAddressActions:"styles_newAddressActions__P9o8U",fixedActions:"styles_fixedActions__ruB31",inputCountry:"styles_inputCountry__mwbdu",inputAddressOne:"styles_inputAddressOne__8iYiC",inputAddressTwo:"styles_inputAddressTwo__Uc1VH"}},64889:function(e){e.exports={title:"styles_title__yfZr5",backButton:"styles_backButton__sdOjF",addressesContainer:"styles_addressesContainer__FJUNf",newAddressContainer:"styles_newAddressContainer__QJHBM",newAddressAction:"styles_newAddressAction__a1oVd",newAddressTitle:"styles_newAddressTitle__2pM8A",noAddresses:"styles_noAddresses__H9bzn"}}},function(e){e.O(0,[2647,38,2888,9774,179],function(){return e(e.s=29852)}),_N_E=e.O()}]);
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.