https://shop.wsps.ca/cdn/shopifycloud/checkout-web/assets/c1/component-AutocompleteField.O3_o7llA.js
1import{u as t,g as Z,k as P,A as T,q as l1,W as Q,Y as W,Z as Y,h as G,S as i1}from"./esnext-vendor.BBoIVOQW.js";import{cL as u1,T as m1}from"./addresses-is-address-empty.ZJ1ThpFy.js";import{au as f1,ck as p1,u as d1,C as h1,D as g1,cl as $,a as J,T as _1,cm as w1,I as v1,F as b1,cn as y1,l as j}from"./hydrate.Tsur0pib.js";import"./app.CUBUOQtX.js";import{u as A1}from"./AutocompleteField-hooks.Cs2Bn4N3.js";import"./shared-permissions.DW7FOCqf.js";import"./hooks-useShopPayExternalAppContext.YLtTu3k6.js";import"./BillingAddressForm.BMqAGUql.js";import"./localization-index.P2wbDjPJ.js";import"./shipping-methods-grouping.S_i1LuzE.js";import"./amazon-pay-useAmazonPayPaymentLine.CMgi35Fb.js";import"./PhoneField.D8EvZ0Pm.js";import"./hooks-useSuppressShopPayModalOnLoad.CwH45iIp.js";import"./components-RedirectionNotice.module.qsrQCJ0v.js";import"./AddressPresenter.Ce4uWLSc.js";import"./Choice.18syyoW7.js";import"./shop-pay-installments-types._vopm3yK.js";import"./Checkbox.dqdh-9I_.js";var p={Autocomplete:"_1tnwc9f1 _1tnwc9f0 _1fragemup _1fragemv4 _1fragem133 _1fragem5f",colorLayerVariant:{control:"_1tnwc9fk _1tnwc9fi _1fragemy6",base:"_1tnwc9fl _1tnwc9fj _1fragemy5"},colorSchemeVariant:{scheme1:"_1tnwc9fa _1tnwc9f2 _1fragemxx",scheme2:"_1tnwc9fb _1tnwc9f3 _1fragemxy",scheme3:"_1tnwc9fc _1tnwc9f4 _1fragemxz",scheme4:"_1tnwc9fd _1tnwc9f5 _1fragemy0",scheme5:"_1tnwc9fe _1tnwc9f6 _1fragemy1",scheme6:"_1tnwc9ff _1tnwc9f7 _1fragemy2",scheme7:"_1tnwc9fg _1tnwc9f8 _1fragemy3",scheme8:"_1tnwc9fh _1tnwc9f9 _1fragemy4"},Header:"_1tnwc9fn _1tnwc9fm _1fragempp _1fragemri _1fragemnw _1fragemtb _1fragem64 _1fragem19 _1fragembe",Title:"_1tnwc9fp _1tnwc9fo _1fragemyt _1fragem11h _1fragemyh",Close:"_1tnwc9fr _1tnwc9fq _1fragempp _1fragemri _1fragemnw _1fragemtb",Options:"_1tnwc9ft _1tnwc9fs _1fragemqt _1fragemsm _1fragemp0 _1fragemuf _1fragem11h",Option:"_1tnwc9fv _1tnwc9fu _1fragempp _1fragemri _1fragemnw _1fragemtb _1fragemyd",o
1ptionVariant:{selected:"_1tnwc9fx _1tnwc9fw _1fragem11x"},Footer:"_1tnwc9fz _1tnwc9fy _1fragempp _1fragemri _1fragemnw _1fragemtb _1fragemws _1fragem13d"};const z1=b1("Autocomplete");function O1({id:c,onInput:d,onChange:m,options:n,onSelectOption:i,value:g,optionsCloseLabel:v,optionsHeaderLabel:h,children:f,autocomplete:b,onBlur:O,...B}){const[a,k]=P(!1),[y,C]=P(),[x,D]=P(!1),[S,q]=P(!1),r=T(null),_=T(null),V=T(null),A=f1(),{parent:H,current:U}=p1(),{colors:E}=d1(),{colorScheme:I,colorLayer:w}=[U,H].flatMap(e=>e?["control","base"].map(o=>({colorScheme:e,colorLayer:o})):[]).find(({colorScheme:e,colorLayer:o})=>E?.schemes?.[e]?.[o]?.background&&!u1(E.schemes[e][o].background))??{},l=h1(c,z1),M=g1(),z=()=>{if(D(!0),n.length===0){k(!1);return}a||r.current==null||!$(r.current)||(C(void 0),k(!0))},u=()=>{if(a){O?.();return}n.length===0&&q(!1),O?.(),D(!1)},s=l1(()=>{a&&k(!1)},[a]),L=e=>{e===""?s():z(),d?.(e)},R=e=>{C(e)},r1=e=>{s(),i&&i(n[e])},K=e=>{a&&C(o=>o===void 0?e>0?0:n.length-1:o+e>=n.length?0:o+e<0?n.length-1:o+e)},n1=e=>{switch(e.key){case"ArrowDown":case"Down":e.preventDefault(),K(1),z();break;case"ArrowUp":case"Up":e.preventDefault(),K(-1),z();break;case"Enter":a?(e.preventDefault(),s(),i&&y!=null&&i(n[y])):m?.(e.currentTarget.value);break;case"Escape":case"Esc":a&&(e.stopPropagation(),s());break;case"Tab":s();break}},o1=Q.map(f,e=>{if(W(e)&&e.type===X)return Y(e,{id:`${l}-options`},Q.toArray(e.props.children).map((o,N)=>{if(typeof o=="object"&&"type"in o&&o.type===e1)return Y(o,{id:`${l}-option-${N}`,isSelected:y===N,onMouseDown:()=>{r1(N),r.current?.focus()},onMouseOver:()=>R(N)})}))});G(()=>{const e=o=>{o.target instanceof Node&&!r.current?.contains(o.target)&&!V.current?.contains(o.target)?s():o.target!==r.current&&r.current?.focus()};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}},[s]),G(()=>{n.length===0?(a&&r.current&&!$(r.current)&&r.current.focus(),s()):(!a&&r.current&&$(r.current)&&z(),q(!0)),C(void 0)},[n]);const c1=Q.map(f,e=>{if(W(e)&&e.type===t1)return e}),a1=!!(r.current&&$(r.current)),F=a&&n.length>0&&a1;G(()=>{if(x&&S)return J({content:A("autocompleteOptionsAvailable",{count:n.length})})},[x,n.length,S,A]);const s1=y1();return t("div",{ref:_,children:[t(_1,{...B,ariaActiveDescendant:a&&y!==void 0?`${l}-option-${y}`:void 0,ariaAutocomplete:"list",ariaControls:F?`${l}-options`:void 0,ariaOwns:F?`${l}-options`:void 0,ariaExpanded:F,ariaHasPopup:"listbox",autoCorrect:"off",autocomplete:s1||!(a||x)&&b?b:"none",id:l,onInput:L,onChange:m,onFocus:z,onBlur:u,onKeyDown:n1,ref:r,role:"combobox",controlledValue:g}),F&&t(w1,{activator:_.current,sameInlineSize:!0,minInlineSize:320,preventOverflow:!0,positionArea:"block-end",offset:7,children:t("div",{className:Z(p.Autocomplete,w&&p.colorLayerVariant[w],I&&p.colorSchemeVariant[I]),ref:V,"aria-labelledby":`${l}-autocomplete-title`,children:[t("div",{className:p.Header,children:[t("h3",{className:p.Title,id:`${l}-autocomplete-title`,children:h}),t("button",{type:"button",className:p.Close,onClick:()=>{s(),r.current?.focus()},tabIndex:M?-1:void 0,"aria-label":v,"aria-hidden":M?!0:void 0,children:t(v1,{size:"small",type:"x"})})]}),o1,c1]})})]})}function X({children:c,id:d}){return t("ul",{className:p.Options,id:d,onMouseDown:m=>{m.preventDefault()},role:"listbox",children:c})}function e1({children:c,id:d,isSelected:m,onMouseDown:n,onMouseOver:i}){return t("li",{"aria-selected":m,className:Z(p.Option,{[p.optionVariant.selected]:m}),id:d,onMouseDown:n,onMouseOver:i,role:"option",children:t("bdi",{children:c})})}function t1({children:c}){return t("div",{className:p.Footer,children:c})}function C1({description:c,matchedSubstrings:d}){return d.reduce((m,{length:n,offset:i},g,v)=>{const h=i,f=i+n,b=g===0?0:v[g-1].offset+v[g-1].length,O=g===v.length-1;return t("span",{"aria-label":c,children:[m,b===h?null:t(j,{color:"subdued",children:c.substring(b,h)}),h===f?null:t(j,{type:"mark",children:c.substring(h,f)}),O?t(j,{color:"subdued",children:c.substring(f)}):null]})},t(i1,{}))}const L1=c=>t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 116 15",...c,children:t("path",{d:"M4.025 3.572c1.612 0 2.655 1.283 2.655 3.27 0 1.974-1.05 3.27-2.655 3.27-.902 0-1.63-.393-1.974-1.06h-.09v3.057H.95V3.68h.96v1.054h.094c.404-.726 1.16-1.166 2.02-1.166zm-.24 5.63c1.16 0 1.852-.884 1.852-2.36 0-1.477-.692-2.362-1.846-2.362-1.14 0-1.86.91-1.86 2.362 0 1.447.72 2.36 1.858 2.36zm7.072.91c-1.798 0-2.912-1.243-2.912-3.27 0-2.033 1.114-3.27 2.912-3.27 1.8 0 2.913 1.237 2.913 3.27 0 2.027-1.114 3.27-2.913 3.27m0-.91c1.196 0 1.87-.866 1.87-2.36 0-1.5-.674-2.362-1.87-2.3
162-1.195 0-1.87.862-1.87 2.362 0 1.494.675 2.36 1.87 2.36m12.206-5.518H22.05l-1.244 5.05h-.094L19.3 3.684h-.966l-1.412 5.05h-.094l-1.242-5.05h-1.02L16.336 10h1.02l1.406-4.887h.093L20.268 10h1.025zm3.632.78c-1.008 0-1.71.737-1.787 1.856h3.48c-.023-1.12-.69-1.857-1.693-1.857zm1.664 3.9h1.004c-.305 1.085-1.277 1.747-2.66 1.747-1.752 0-2.848-1.26-2.848-3.26 0-1.986 1.113-3.275 2.847-3.275 1.705 0 2.742 1.213 2.742 3.176v.387h-4.542v.047c.053 1.248.75 2.04 1.822 2.04.815 0 1.366-.3 1.63-.857zM31.03 10h1.01V6.086c0-.89.696-1.535 1.657-1.535.2 0 .563.04.645.06V3.6c-.13-.018-.34-.03-.504-.03-.838 0-1.565.434-1.752 1.05h-.094v-.938h-.96V10zm6.915-5.537c-1.008 0-1.71.738-1.787 1.857h3.48c-.023-1.12-.69-1.857-1.693-1.857m1.664 3.902h1.004c-.304 1.084-1.277 1.746-2.66 1.746-1.752 0-2.848-1.26-2.848-3.26 0-1.986 1.113-3.275 2.847-3.275 1.705 0 2.742 1.213 2.742 3.176v.387h-4.542v.047c.053 1.248.75 2.04 1.822 2.04.815 0 1.366-.3 1.63-.857zm5.01 1.746c-1.62 0-2.658-1.28-2.658-3.265 0-1.98 1.05-3.27 2.654-3.27.878 0 1.622.416 1.98 1.108h.087V1.177h1.008V10h-.96V8.992h-.093c-.4.703-1.15 1.12-2.02 1.12zm.23-5.63c-1.15 0-1.845.89-1.845 2.365s.69 2.36 1.846 2.36c1.15 0 1.858-.9 1.858-2.36 0-1.447-.715-2.362-1.857-2.362zm7.876-3.114h1.024V4.49q.346-.45.827-.69.48-.239 1.043-.237 1.172.001 1.9.806c.49.536.73 1.33.73 2.375q0 1.489-.72 2.473t-1.997.984q-.715 0-1.207-.344-.293-.206-.627-.657v.8h-.97V1.364zm4.02 7.225q.426-.679.426-1.793 0-.99-.425-1.64t-1.25-.65q-.719 0-1.264.532-.541.532-.542 1.757.001.885.224 1.435.416 1.04 1.553 1.04.856 0 1.28-.68zM63.4 3.727h1.167q-.222.603-.99 2.754a145 145 0 0 1-.96 2.635q-.915 2.402-1.29 2.93-.375.526-1.29.527-.221 0-.342-.017a3 3 0 0 1-.296-.065v-.96q.273.074.4.093.119.018.214.018.292 0 .43-.093a.9.9 0 0 0 .232-.237q.03-.05.21-.48.183-.436.264-.646l-2.32-6.457h1.196l1.68 5.11 1.694-5.11zm10.594 1.556V6.87h3.814c-.117.89-.416 1.54-.87 1.998-.557.555-1.427 1.16-2.944 1.16-2.35 0-4.184-1.882-4.184-4.217 0-2.33 1.835-4.214 4.184-4.214a4.07 4.07 0 0 1 2.873 1.135l1.122-1.116C77.04.697 75.77 0 73.99 0c-3.218 0-5.923 2.606-5.923 5.805 0 3.2 2.705 5.804 5.923 5.804 1.738 0 3.048-.57 4.073-1.63 1.05-1.044 1.382-2.52 1.382-3.71 0-.365-.028-.707-.087-.99h-5.37zm10.222-1.29c-2.082 0-3.78 1.574-3.78 3.748 0 2.154 1.698 3.747 3.78 3.747S87.998 9.9 87.998 7.74c0-2.174-1.7-3.748-3.782-3.748zm0 6.018c-1.14 0-2.127-.935-2.127-2.27 0-1.348.982-2.27 2.123-2.27s2.128.922 2.128 2.27c0 1.335-.985 2.27-2.127 2.27zm18.54-5.18h-.06c-.37-.438-1.083-.838-1.985-.838-1.88 0-3.52 1.632-3.52 3.748 0 2.102 1.64 3.747 3.52 3.747.906 0 1.62-.4 1.99-.852h.06v.523c0 1.432-.774 2.2-2.013 2.2-1.012 0-1.64-.723-1.9-1.336l-1.44.593c.414.994 1.51 2.213 3.34 2.213 1.94 0 3.58-1.135 3.58-3.902v-6.74h-1.57v.645zm-1.9 5.18c-1.144 0-2.013-.968-2.013-2.27 0-1.323.87-2.27 2.01-2.27 1.13 0 2.012.967 2.012 2.282.006 1.31-.882 2.258-2.01 2.258zM92.65 3.992c-2.084 0-3.783 1.574-3.783 3.748 0 2.154 1.7 3.747 3.782 3.747 2.08 0 3.78-1.587 3.78-3.747 0-2.174-1.7-3.748-3.78-3.748zm0 6.018c-1.143 0-2.13-.935-2.13-2.27 0-1.348.987-2.27 2.13-2.27 1.14 0 2.126.922 2.126 2.27 0 1.335-.986 2.27-2.127 2.27zM105.622.155h1.628v11.332h-1.628m6.655-1.477c-.843 0-1.44-.38-1.83-1.135l5.04-2.07-.168-.426c-.315-.84-1.275-2.39-3.228-2.39-1.94 0-3.554 1.515-3.554 3.75 0 2.1 1.595 3.744 3.736 3.744 1.725 0 2.724-1.05 3.14-1.658l-1.285-.852c-.428.62-1.01 1.032-1.855 1.032zm-.117-4.612c.668 0 1.24.342 1.427.826l-3.405 1.4c0-1.574 1.122-2.226 1.978-2.226"})}),k1="Llh19",x1={GoogleAttribution:k1},V1="autocomplete-service";function K1({error:c,label:d="",autoFocus:m,name:n,field:i,onChange:g,onInput:v,onSelect:h,value:f,required:b,autocomplete:O,disabled:B,readOnly:a,countryCode:k,addressType:y,onBlur:C,id:x=n,allowAllCountries:D,disableAdditionalFields:S=!0,...q}){const{i18n:r}=m1(),{value:_,setValue:V,predictions:A,selectPrediction:H,provider:U}=A1({addressType:y,countryCode:k,field:i,initialAddressQuery:f,allowAllCountries:D}),E=T(),I=u=>{E.current=u,g?.(u)},w=U===V1&&A.length>0&&A[0].completionService==="GOOGLE_PLACE_AUTOCOMPLETE",l=r.translate("general.autocomplete_powered_by_google",{brandName:r.translate("brand.google")}),M=T(!1);G(()=>{w&&!M.current&&J({content:l}),M.current=w},[w,l]);function z({addressId:u,completionService:s}){H(u,s,S,(L,R)=>{V(L[i]??"",!1),h&&h(L,u,s,R)})}return t(O1,{accessibilityDescription:w?l:void 0,error:c,id:x,label:d,name:n,onInput:u=>{V(u),v?.(u)},onChange:I,onSelectOption:z,options:A,value:_,autoFocus:m,required:b,autocomplete:O,optionsHeaderLabel:r.translate("general.autocomplete_title"),optionsCloseLabel:r.translate("general.autocomplete_close"),disabled:B,readOnly:a,...q,onBlur:()=>{f!==void 0&&_!==f&&(_===""||_!==E.current)&&I(_),C?.()},children:[t(X,{children:A.map(({addressId:u,description:s,matchedSubstrings:L})=>t(e1,{children:t(C1,{description:s,matchedSubstrings:L})},u))}),w?t(t1,{children:t(L1,{className:x1.GoogleAttribution,"aria-label":l})}):null]})}export{K1 as default};
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.