PageSourceSearch

https://www.linksys.com/cdn/shopifycloud/checkout-web/assets/c1/PhoneField.BapDvZfY.js

js linksys.com collected 2026-09-24 08:37:34 UTC 4,169 bytes, 1 lines download raw bytes

1import{e as se,h as N,u as l,g as G,k as U,A as P,q as oe,S as ce}from"./esnext-vendor.D7ldIee_.js";import{_ as ae}from"./app.A60-IfPs.js";import{N as Y}from"./addresses-is-address-empty.-MuOhIyI.js";import{T as le,I as ie,k as ue}from"./hydrate.ByRIsqvd.js";import{u as fe}from"./hooks-useSuppressShopPayModalOnLoad.CI5bzdLE.js";import{u as me}from"./hooks-useUnauthenticatedErrorModal.CzvtLqeY.js";var B={FlagIcon:"sgqviy0 _1fragem5u _1fragemve _1fragemvo",sizeVariant:{base:"sgqviy1",small:"sgqviy2"}};const _e="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20640%20480'/%3E";function de({accessibilityLabel:e,countryCode:t,size:s}){const r=se(void 0);N(()=>{let n=!1;async function d(){const{ALL_FLAG_ICON_BY_COUNTRY_CODE:g}=await ae(async()=>{const{ALL_FLAG_ICON_BY_COUNTRY_CODE:f}=await import("./flag-icon-flag-icon.-2ng8G62.js");return{ALL_FLAG_ICON_BY_COUNTRY_CODE:f}},[]);n||(r.value={countryCode:t,src:g[t]})}return d().catch(()=>{n||(r.value={countryCode:t,src:void 0})}),()=>{n=!0}},[t,r]);const o=r.value?.countryCode===t?r.value.src:void 0;return l("img",{alt:e??"",className:G(B.FlagIcon,s&&B.sizeVariant[s]),src:o??_e,role:"img"})}function _(e){return e.replace(/[^+\d]/g,"")}const ge="Ls4zP",ve="gqw6M",pe="wTRvB",he="KHvfK",h={Country:ge,focus:ve,FlagIcon:pe,Select:he},Ne=/[()\-._ ]+/g,D="tel",M="text";function Te({countryCode:e,value:t,onChange:s,onFocus:r,onInput:o,disableFormatting:n=!1,hideCountries:d=!1,prefillCountryCode:g,requireCountryCode:f=!1,onInputValueChange:y,onSelectedCountryChange:E,caretPosition:T,accessoryEnd:A,autocomplete:z="tel",onBlur:H,required:$,type:V,icon:q,...w}){const p=t??void 0,{i18n:K}=Y(),[L,O]=U(!1),c=P(null),b=P(!1),C=me(e,p,g||f),{formattedNumber:i,formattedNumberValueObject:W,regionCode:R,prefix:X,loading:j}=C,Z=i.replace(/\D/g,"").length<4;N(()=>{if(b.current){b.current=!1;const a=_(i);o?.(a),s?.(a)}},[i,s,o]);const J=G(h.Country,L&&h.focus),Q=!d&&R&&i&&i.length>1,m=R??e;N(()=>{m!==e&&E?.(m.toUpperCase(),i)},[E,m,e,i]);const ee=oe(a=>{s?.(_(a))},[s]),x=!j&&(Q||f)&&!Z&&l("div",{className:J,children:[l("div",{className:h.FlagIcon,children:l(de,{countryCode:m.toLowerCase(),accessibilityLabel:m.toUpperCase()})}),l(ie,{type:"chevron-down",size:"small-200",tone:L?"accent":void 0}),l("select",{"aria-label":K.translate("contact.phone_country_code_label"),className:h.Select,value:m.toUpperCase(),onBlur:()=>O(!1),onFocus:()=>O(!0),name:"phone_country_select",onChange:a=>{b.current=!0,C.selectCountry(a.target.value),c.current&&c.current.focus()},children:l(Fe,{})})]}),F=P(null),te=(A||x)&&l(ue,{direction:"inline",gap:"base",alignItems:"center",children:[A,x]});function ne(a){return f&&!a.includes("+")?`${X}${a}`:a}return{...w,icon:V==="mobile"?"mobile":q,onChange:s&&ee,required:$||f,onInputCommit:a=>{const u=ne(a);c?.current&&c.current.value!==u&&(c.current.value=u);const v=_(u),I=c?.current?.selectionEnd||0,re=_(u.slice(0,I));F.current!=null&&clearTimeout(F.current),F.current=setTimeout(()=>{const S=c.current?.type;S!==D&&S!==M||c.current?.value&&k(Ce(re,c.current.value),c.current)}),n?(y?.(u,I),o?.(u)):v!==_(i)&&(y?.(v,I),o?.(v)),(/[a-zA-Z]/.test(u)||v!==_(i))&&C.setPhoneNumber(v)},ref:c,autocomplete:z,value:p,controlledValue:n?void 0:W,onFocus:()=>{T!==void 0&&c.current&&p!==void 0&&T<p.length&&k(T,c.current),r?.()},accessoryEnd:te||void 0,type:n?M:D,name:w.name??"phone",onBlur:H}}function be(e){return e.search(Ne)>-1}function Ce(e,t){let s=0,r=e;for(const o of t){if(!r&&!be(o))break;o===r[0]&&(r=r.substring(1)),s++}return s}function k(e,t){document.activeElement===t&&(t.focus(),t.setSelectionRange(e,e))}function Oe(e){const t=Te(e);return l(le,{...t})}function Fe(){const{fetchCountriesWithPhoneNumberPrefix:e}=fe(),[t,s]=U([]),{observability:r,i18n:{locale:o}}=Y();return N(()=>{e(o).then(n=>{s(n)}).catch(n=>{r.log("atlas_fetch_countries_error",`Unable to fetch countries with phone number prefix: ${n.name}: ${n.message}`,{errorName:n.name,errorMessage:n.message,locale:o})})},[e,o,r]),l(ce,{children:t.map(({code:n,name:d,phoneNumberPrefix:g})=>l("option",{value:n,children:[d,"(+",g,")"]},n))})}export{de as F,Oe as P,_ as s,Te as u};

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.