1import{a as e,k as a,aY as t,aZ as s,s as n,a_ as r,a$ as o,b0 as i,b1 as c}from"./f67abd2c.BTHhdhoM.js";import{bm as l,bn as u,bo as p,j as d,bp as h,r as m,bq as v,br as g,bs as f}from"./164ad2e3.bPUx3Fg0.js";import{T as k,h as P,k as _,g as b,p as E,L as M,o as T}from"./2c1ab0fe.RaLGJvq2.js";import{d as y}from"./app.CPIYcwpp.js";import{u as S}from"./22345fd4.BOPeNj8v.js";const w="placement-reference";function x(){const{router:r}=e(),o=r.currentUrl.value.searchParams.get(w),{supported:i}=p(),c=d(),l=k(()=>{const e=h(c.value);if(!o){const e=a(t.PlacementReference);return i.has(e)?e:void 0}return i.has(o)?o:(console.error(new s(`'${o}' is not a valid placement reference, falling back to '${e}'. Please see https://shopify.dev/apps/checkout/test-ui-extensions#dynamic-extension-points`)),e)},[o,i,c.value]);return P(()=>{l&&n(t.PlacementReference,l)},[l]),l??void 0}function N(){const e=l(),a=x(),t=e.workspace?.root?.url||e.workspace?.queryUrl;return k(()=>{const e=new URLSearchParams;return t&&e.set(u,t),a&&e.set(w,a),e},[t,a])}function R(){const{checkout:a}=e(),{acceptSmsMarketing:t,phone:s,smsMarketingPhone:n,shippingAddress:r}=a.negotiator.parts,{negotiate:o}=m(),i=r.fields.phone.value,c=n.value,l=0===(a.proposal.negotiated.fields.availableDeliveryAddresses.value??[]).length?i:"",u=c||s.value||l||"";return{handleSmsMarketingConsent:e=>{n.value="",t.value=e,e?n.value=u:o({legacyFiltering:{include:[],silenceViolations:["all"]},silenceViolations:["all"]})}}}function U(){const{checkout:{negotiator:a}}=e(),{shippingAddress:t,locationAddress:s}=a.parts;return _(()=>{const e=t.value,a=s.value;return y(e,a)})}function A(){const{validatePhoneNumber:a}=S(),{negotiate:t}=m(),s=U(),{i18n:n,checkout:{wallets:r,negotiator:o}}=e(),{smsMarketingPhone:i}=o.parts,{marketingPhoneInputError:c}=o.context,l=b(!1);E(()=>{const e=i.value,o=s.value,u=c.peek();if(!l.current)return void(l.current=!0);const p=a(e,o??"ZZ")?void 0:n.translate("field_errors.address_phone_blank");p?u||(c.value=p):c.value=void 0,p||r.activeSession.value||M(()=>{t({legacyFiltering:{include:[],silenceViolations:["all"]},silenceViolations:["all"]})})})}function C(e){return!0===e?.includes("marketingConsent")||!0===e?.includes("messagingMarketingConsent")}const I=new Set(["BUYER_IDENTITY_MARKETING_CONSENT_PHONE_NUMBER_DOES_NOT_MATCH_EXPECTED_PATTERN"]);function j(a){const{checkout:{wallets:t,negotiator:s}}=e(),{smsMarketingPhone:n,acceptSmsMarketing:c}=s.parts,{marketingPhoneInputError:l}=s.context,u=b();function p(){void 0!==u.current&&u.current===n.peek()&&(l.value=void 0,u.current=void 0)}v(e=>{if("success"===e.type)return void p();if("error"!==e.type)return;let t=!1;for(const s of e.violations){if("UnprocessableTermViolation"!==s.__typename||!I.has(s.code)||!C(s.target))continue;t=!0;const e=a||(s.localizedMessage??s.nonLocalizedMessage);l.value=e,u.current=n.peek()}t||p()});const d=T(void 0),h=c.value?l:d;return r(n,h,()=>{},o.InvalidOptInPhone,()=>Boolean(t.activeSession.value)),i(n,l)}function O(a){const{checkout:t,router:s}=e(),{origin:n,prefix:r,searchParams:o}=s.currentUrl.value,i=N(),l=t.negotiator.throttleState.peek().token,u=g(),p=o.get("shop_client_uuid")??o.get("client_uuid"),d=t.checkpointToken.value,h=t.configuration.renderContextToken.token.value;return k(()=>{const e=o.get("channel"),t=o.get("preview_theme_id"),s=new URL(`${n}${r}`);s.searchParams.set("payment","shop_pay");for(const[a,n]of i.entries())s.searchParams.set(a,n);return l&&s.searchParams.set(f,l),a&&s.searchParams.set("redirect_source",a),d&&s.searchParams.set(c,d),e&&s.searchParams.set("channel",e),t&&s.searchParams.set("preview_theme_id",t),p&&s.searchParams.set("shop_client_uuid",p),h?s.searchParams.set("rctx",h):s.searchParams.delete("rctx"),u(s.searchParams,o),s.toString()},[o,n,r,l,a,d,i,u,p,h])}export{x as a,U as b,R as c,A as d,j as e,O as f,C as i,N 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.