1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["apply-cart-line-change.B9M8Kv6g.js","addresses-is-address-empty.ZJ1ThpFy.js","esnext-vendor.BBoIVOQW.js","app.CUBUOQtX.js","assets/app.Sxsz5knT.css","assets/is-address-empty.DJksNKpk.css","utilities-extension-execution-errors.DiES5O5t.js","hydrate.Tsur0pib.js","shared-permissions.DW7FOCqf.js","hooks-useShopPayExternalAppContext.YLtTu3k6.js","assets/previous.BfF3jg9W.css","dist-v4.EwEgHOG0.js","deferred-mutations-assert-cart-line-change.C8mxht6x.js","AnnouncementRuntimeExtensions.C0O5WcH_.js","QRCode.OrXXMCLJ.js","assets/QRCode.BZ_m5G5a.css","Checkbox.dqdh-9I_.js","assets/Checkbox.SrYMuQu4.css","Choice.18syyoW7.js","shop-pay-installments-types._vopm3yK.js","assets/Choice.aPApdPe_.css","utilities-dates.ChO2GdxN.js","components-RedirectionNotice.module.qsrQCJ0v.js","assets/RedirectionNotice.DG0OZ1cz.css","PaymentIcon.CEAvn1dM.js","assets/PaymentIcon.gzvCNwz_.css","NumberField.D9yAw9rS.js","assets/NumberField.CRpcZnVJ.css","Switch.DcsaOS_H.js","assets/Switch.BS8yVgoP.css","extensions-remote-dom.DLP6cFL6.js","EmailField.C8ocsqns.js","TextArea.An2gFfWj.js","Sheet.Dx28vgYD.js","assets/Sheet.CpR5hiDV.css","styles-floating-layer.module.BESFBxYZ.js","assets/floating-layer.DfWUBaTh.css","hooks-useForceShopPayUrl.z4AJBm7B.js","AddressPresenter.Ce4uWLSc.js","PhoneField.D8EvZ0Pm.js","shipping-methods-grouping.S_i1LuzE.js","amazon-pay-useAmazonPayPaymentLine.CMgi35Fb.js","hooks-useSuppressShopPayModalOnLoad.CwH45iIp.js","assets/PhoneField.uZEuHncj.css","hooks-useShowShopPayOptin.BPTq9EIX.js","assets/AnnouncementRuntimeExtensions.DWE5rRxz.css","consent-manager-shared.D79dm3f4.js","performance-index.mu6MOGR9.js","shared-negotiation-input-redeemable.DoYPkwkm.js","apply-cart-line-change-queue.DdVVojFC.js"])))=>i.map(i=>d[i]); 2import{A as D,i as Kn,t as Re,g as Qn,b as Ce}from"./shared-permissions.DW7FOCqf.js";import{ad as v,iU as Wn,T as Xn,bU as Qe,aU as rs,dy as Zn,g as is,I as Ve,dI as $e,dN as xn,bj as et,ct as st,bl as os,bi as nt,k as tt,dh as rt,iV as it,iW as ot,cH as We,iX as at,bA as mn,bn as dt,h as yn,c3 as as,c4 as ds,i0 as ut,aP as hn}from"./addresses-is-address-empty.ZJ1ThpFy.js";import{o as vn,p as Je,q as gn,r as An,s as Ae,d as ct,U as lt,S as us,t as En,I as pt,D as ft,u as In,O as mt}from"./utilities-extension-execution-errors.DiES5O5t.js";import{dD as te,cL as yt,fG as ht,fD as Xe,g$ as vt,h0 as Fe,h1 as Se,h2 as gt,h3 as At,h4 as _n,dk as fe,aw as Ie,bA as He,bB as ze,h5 as Et,br as It,h6 as _t,gz as cs,h7 as Rt}from"./hydrate.Tsur0pib.js";import{av as Dt,aw as Rn,ax as St,o as S,f as bt,T as Tt,e as Ot,h as Nt,j as Pt,y as he,R as Dn,a3 as Sn,r as Lt}from"./esnext-vendor.BBoIVOQW.js";import{g as kt,b as wt,a as Y}from"./AnnouncementRuntimeExtensions.C0O5WcH_.js";import{_ as bn}from"./app.CUBUOQtX.js";import{p as Tn,c as ye,g as Mt,q as Ct}from"./consent-manager-shared.D79dm3f4.js";import{e as ls}from"./performance-index.mu6MOGR9.js";import{b as Vt,a as Ut}from"./shared-negotiation-input-redeemable.DoYPkwkm.js";import{v as Bt}from"./dist-v4.EwEgHOG0.js";let je,On,Nn,Pn,Ln;const kn=()=>({analytics:On(),marketing:Nn(),preferences:Pn(),saleOfData:Ln()}),Te=e=>e??[],Oi=()=>{const{currentVisitorConsent:e,shouldShowBanner:s,saleOfDataRegion:n,analyticsProcessingAllowed:t,marketingAllowed:r,saleOfDataAllowed:i,preferencesProcessingAllowed:o,setTrackingConsent:a}=Dt();je||(je=a,Nn=r,On=t,Ln=i,Pn=o);const{analytics:c,marketing:u,preferences:d,sale_of_data:p}=e();return{allowedProcessing:kn(),visitorConsent:{analytics:ye(c),marketing:ye(u),preferences:ye(d),saleOfData:ye(p)},shouldShowBanner:s(),saleOfDataRegion:n(),region:Tn(St()),metafields:Te(Rn())}};function Ni(e){const s=e.merchantVisitorConsent();return{allowedProcessing:e.merchantAllowedProcessing(),visitorConsent:{analytics:ye(s.analytics),marketing:ye(s.marketing),preferences:ye(s.preferences),saleOfData:ye(s.sale_of_data)},shouldShowBanner:e.shouldShowBanner.value,saleOfDataRegion:e.saleOfDataRegion.value,region:Tn(e.getRegion.value),metafields:Te(e.merchantMetafields())}}const Pi={allowedProcessing:{analytics:!1,marketing:!1,preferences:!1,saleOfData:!1},visitorConsent:{analytics:void 0,marketing:void 0,preferences:void 0,saleOfData:void 0},shouldShowBanner:!1,saleOfDataRegion:!1,region:void 0,metafields:[]},Gt="Capability not specified: Please declare this in your config: collect_buyer_consent.customer_privacy = true.",Yt="Personal data approval scope missing",$t="The Customer Privacy API is not supported in Shop Pay.";function Ft(){return typeof navigator<"u"&&Wn(navigator.userAgent)}function Ht(e,s){const n=s!=null&&s>=400?`Failed to set tracking consent: ${e} (HTTP ${s})`:`Failed to set tracking consent: ${e}`;return s===401?new gn(n):s!=null&&s>
2=400?new An(n):Ft()&&e.includes("The string did not match the expected pattern")?new vn(n):new Je(n)}function ie({customerPrivacySignal:e,createSubscribableFromSignal:s,extension:n,storefrontTokens:t,applyChange:r,extensionInstance:i,checkout:o,consentManager:a}){const c=n.capabilities.collectBuyerConsent?.customerPrivacy===!0,u=te(n.approvalScopes,D.CustomerPersonalData);async function d(p){return r({unknownChange:p,extension:n,extensionInstanceId:i.id,allowChangeAfterJourneyCompletion:!0,allowChangeDuringAcceleratedWallet:!0,handlers:{async changeVisitorConsent({change:l}){if(!c)throw new v(Gt);if(!u)throw new v(Yt);if(o.identity.current.value==="shopPay")throw new v($t);const f=(l.metafields||[]).filter(O=>O.value!==void 0);if(!!!f.length&&l.analytics===void 0&&l.marketing===void 0&&l.preferences===void 0&&l.saleOfData===void 0)return{type:"success"};const y=await t.get(n.appId,n.type,"customerPrivacy"),h=a?(O,A)=>a.setTrackingConsent({analytics:O.analytics,marketing:O.marketing,preferences:O.preferences,saleOfData:O.sale_of_data,isExtensionToken:O.isExtensionToken,storefrontAccessToken:O.storefrontAccessToken??void 0,metafields:O.metafields},A):je,g=a?()=>a.merchantAllowedProcessing():kn,E=a?()=>Te(a.merchantMetafields()):()=>Te(Rn()),I=e.peek();return new Promise((O,A)=>{h({analytics:l.analytics,marketing:l.marketing,preferences:l.preferences,sale_of_data:l.saleOfData,isExtensionToken:!0,storefrontAccessToken:y,...f.length&&{metafields:f}},(...[L,R])=>{if(R)e.value={...I,allowedProcessing:g(),metafields:E(),visitorConsent:{analytics:l.analytics,marketing:l.marketing,preferences:l.preferences,saleOfData:l.saleOfData}},O({type:"success"});else if(L instanceof Error)A(new v(`Failed to set tracking consent: ${L.message}`));else if(L&&"error"in L){const ee=String(L.error),w=L.statusCode,ce=Ht(ee,w);A(ce)}else A(new Je("Received unexpected callback from setTrackingConsent()"))})})}},errorResult:l=>l instanceof v||l instanceof vn||l instanceof Je||l instanceof gn||l instanceof An?{type:"error",message:l.message}:{type:"error",message:`Failed to set tracking consent: ${l.message}`}})}return{applyTrackingConsentChange:d,customerPrivacy:s(S(()=>{const{region:p,...l}=e.value,{countryCode:f,provinceCode:m}=p||{};return{...l,region:f||m?{countryCode:u?f:void 0,provinceCode:u?m:void 0}:void 0}}))}}function Li(){const{source:e,checkout:s}=Xn(),n=yt();return bt(()=>
2{const t=s.addressManager.shipping.value.applyAddressChangeBlockReason("ui-extension");return zt({sourceType:e.type,canUpdateDiscountCodes:n.value,canSelectCustomAddress:!t.value})})}function zt({sourceType:e="checkout",canUpdateDiscountCodes:s,canSelectCustomAddress:n}){const t=e==="draftOrder";return{attributes:{canUpdateAttributes:!0},delivery:{canSelectCustomAddress:n},discounts:{canUpdateDiscountCodes:s},lines:{canAddCartLine:!t,canRemoveCartLine:!t,canUpdateCartLine:!t},metafields:{canSetCartMetafields:!0,canDeleteCartMetafield:!0},notes:{canUpdateNote:!t}}}function ve(e,s){return`${e} is not supported on this checkout. Consider checking "instructions.${s}" first.`}function ki(e){const s=Tt(()=>new Map,[]),n=Ot(s);return Nt(()=>{Jt(s,e)},[e,s]),n}function Jt(e,s){for(const n of s)jt(e,n.id)}function jt(e,s){const n=e.get(s);if(n)return n;let t=()=>{};const i={promise:new Promise(o=>{t=o}),resolve:t};return e.set(s,i),i}function wi(e,s,n){e.get(s)===n&&e.delete(s)}function qt(e,s,n){return!n||e.get(s)!==n?!1:(n.resolve(),!0)}function ps(e){const s=e.type==="local"?void 0:e.registrationId;return{appId:e.appId,appName:e.appName,extensionId:Xe(e),extensionRegistrationId:s,extensionName:e.name,extensionVersion:e.version,extensionApiVersion:e.apiVersion,extensionTarget:e.extensionPoint.target,extensionPlacement:e.placementReference,extensionType:e.type,isHighValueExtension:s!=null&&ht.has(s),isRemoteDom:e.apiVersion?Kn(e.apiVersion):!1}}function Oe(e,s=wn){let n,t=!1;return S(()=>{const r=e();return t?s(n,r)?n:(n=r,r):(t=!0,n=r,r)})}function Kt(e){return Oe(e,Qe)}function Qt(e){return Oe(e,Wt)}function Wt(e,s){if(e===s)return!0;if(!Array.isArray(e)||!Array.isArray(s)||e.length!==s.length)return!1;for(let n=0;n<e.length;n++)if(!wn(e[n],s[n]))return!1;return!0}function wn(e,s){if(e===s)return!0;if(e==null||s==null||typeof e!="object"||typeof s!="object")return!1;const n=Object.keys(e),t=Object.keys(s);return n.length!==t.length?!1:n.every(r=>e[r]===s[r])}const Xt={name:D.CustomerName,firstName:D.CustomerName,lastName:D.CustomerName,company:void 0,address1:D.CustomerAddress,address2:D.CustomerAddress,city:void 0,zip:D.CustomerAddress,countryCode:D.CustomerPersonalData,provinceCode:void 0,phone:D.CustomerPhone,oneTimeUse:void 0},Zt=["DELIVERY_FIRST_NAME_REQUIRED","DELIVERY_FIRST_NAME_TOO_LONG","DELIVERY_FIRST_NAME_CONTAINS_EMOJIS","DELIVERY_FIRST_NAME_CONTAINS_HTML_TAGS","DELIVERY_FIRST_NAME_CONTAINS_URL","DELIVERY_FIRST_NAME_CONTAINS_MATHEMATICAL_SYMBOLS"],xt=["DELIVERY_LAST_NAME_REQUIRED","DELIVERY_LAST_NAME_TOO_LONG","DELIVERY_LAST_NAME_CONTAINS_EMOJIS","DELIVERY_LAST_NAME_CONTAINS_HTML_TAGS","DELIVERY_LAST_NAME_CONTAINS_URL","DELIVERY_LAST_NAME_CONTAINS_MATHEMATICAL_SYMBOLS"],er=["DELIVERY_COMPANY_REQUIRED","DELIVERY_COMPANY_TOO_LONG","DELIVERY_COMPANY_CONTAINS_EMOJIS","DELIVERY_COMPANY_CONTAINS_HTML_TAGS","DELIVERY_COMPANY_CONTAINS_MATHEMATICAL_SYMBOLS"],sr=["DELIVERY_ADDRESS1_REQUIRED","DELIVERY_ADDRESS1_TOO_LONG","DELIVERY_ADDRESS1_CONTAINS_EMOJIS","DELIVERY_ADDRESS1_CONTAINS_HTML_TAGS","DELIVERY_ADDRESS1_CONTAINS_MATHEMATICAL_SYMBOLS"],nr=["DELIVERY_ADDRESS2_REQUIRED","DELIVERY_ADDRESS2_TOO_LONG","DELIVERY_ADDRESS2_CONTAINS_EMOJIS","DELIVERY_ADDRESS2_CONTAINS_HTML_TAGS","DELIVERY_ADDRESS2_CONTAINS_MATHEMATICAL_SYMBOLS"],tr=["DELIVERY_CITY_REQUIRED","DELIVERY_CITY_TOO_LONG","DELIVERY_CITY_CONTAINS_EMOJIS","DELIVERY_CITY_CONTAINS_HTML_TAGS","DELIVERY_CITY_CONTAINS_MATHEMATICAL_SYMBOLS"],rr=["DELIVERY_PHONE_NUMBER_REQUIRED","DELIVERY_PHONE_NUMBER_CONTAINS_EMOJIS","DELIVERY_PHONE_NUMBER_DOES_NOT_MATCH_EXPECTED_PATTERN"],ir=["DELIVERY_ZONE_REQUIRED_FOR_COUNTRY","DELIVERY_ZONE_NOT_FOUND"],or=["DELIVERY_INVALID_POSTAL_CODE_FOR_COUNTRY","DELIVERY_INVALID_POSTAL_CODE_FOR_ZONE","DELIVERY_POSTAL_CODE_CONTAINS_EMOJIS","DELIVERY_POSTAL_CODE_REQUIRED","DELIVERY_POSTAL_CODE_NOT_SUPPORTED","DELIVERY_POSTAL_CODE_CONTAINS_MATHEMATICAL_SYMBOLS"],ar=["DELIVERY_COUNTRY_REQUIRED"],qe={firstName:Zt,lastName:xt,company:er,address1:sr,address2:nr,city:tr,provinceCode:ir,zip:or,phone:rr,countryCode:ar,oneTimeUse:[]},dr=new Map(Object.entries(qe).flatMap(([e,s])=>s.map(n=>[n,e])));function ur(e){return Object.keys(e).length===0}function M({createSubscribableFromSignal:e,extension:s,negotiated:n,proposed:t,journeyCompletedSignal:r,cartInstructionsSignal:i,applyChange:o,extensionInstance:a,captureEvent:c,observability:u,checkout:d}){if(!te(s.approvalScopes,D.CustomerPersonalData))return{billingAddress:void 0,shippingAddress:void 0};const p=(g,E)=>te(s.approvalScopes,E)?g:void 0;let l;const f=Oe(()=>{const g=R=>{if(R===void 0||ur(R))return;const{address1:ee,address2:w,city:ce,company:me,countryCode:le,firstName:T,lastName:b,name:P,phone:k,oneTimeUse:De,zoneCode:Ge,postalCode:Ye}=R;return{address1:p(ee,D.CustomerAddress),address2:p(w,D.CustomerAddress),city:ce,company:me,countryCode:p(le,D.CustomerPersonalData),firstName:p(T,D.CustomerName),lastName:p(b,D.CustomerName),name:p(P,D.CustomerName),phone:p(k,D.CustomerPhone),provinceCode:Ge,zip:p(Ye,D.CustomerAddress),oneTimeUse:De}};
2if(n.fields.isShippingRequired.value===!1)return;if(r.value)return g(n.fields.shippingAddress.peek());const I=g(t.shippingAddress.value),O=t.shippingAddress.value?.countryCode,A=l?.countryCode;return t.shippingAddress.dirtyFields.value.has("countryCode")&&A&&O!==A?l:(l=I,I)}),m=Oe(()=>{const g=I=>{if(I===void 0)return;const{address1:O,address2:A,city:L,company:R,countryCode:ee,firstName:w,lastName:ce,name:me,phone:le,zoneCode:T,postalCode:b}=I;return{address1:p(O,D.CustomerAddress),address2:p(A,D.CustomerAddress),city:L,company:R,countryCode:p(ee,D.CustomerPersonalData),firstName:p(w,D.CustomerName),lastName:p(ce,D.CustomerName),name:p(me,D.CustomerName),phone:p(le,D.CustomerPhone),provinceCode:T,zip:p(b,D.CustomerAddress)}};if(r.value)return g(n.fields.billingAddress.peek());const E=t.billingAddress.value;switch(t.billingAddressOption.value){case"shipping":{const I=n.fields.buyerIdentity.value?.purchasingCompany;if(I)return g(I?.location?.shippingAddress??E);if(f.value){const{oneTimeUse:O,...A}=f.value;return A}return g(E)}case"billing":{const I=n.fields.buyerIdentity.value?.purchasingCompany?.location.billingAddress;return g(I??E)}default:return g(E)}});async function y(g){return o({unknownChange:g,extension:s,extensionInstanceId:a.id,handlers:{async updateShippingAddress({change:E,negotiate:I}){if(!i.peek().delivery.canSelectCustomAddress){const T=d.addressManager.shipping.value.a
2pplyAddressChangeBlockReason("ui-extension").value,b=T?fs[T]:ve("applyShippingAddressChange","delivery");throw new Ae(b,{cause:{errors:[{message:b}]}})}const O=h(E);if(O)throw new Ae(O,{cause:{errors:[{message:O}]}});const A=new Set,R={...t.shippingAddress.peek()};let ee=!1,w=!1;for(const T of Object.keys(E.address)){const b=E.address[T];if(T!=="oneTimeUse"){if(b!==void 0&&typeof b!="string"){const k=`Invalid shipping address value for property "${T}". Expected type string or undefined.`;throw new Ae(k,{cause:{errors:[{message:k}]}})}}else if(b!==void 0&&typeof b!="boolean"){const k=`Invalid shipping address value for property "${T}". Expected type boolean or undefined.`;throw new Ae(k,{cause:{errors:[{message:k}]}})}qe[T]&&qe[T].forEach(k=>A.add(k));const P=Xt[T];P&&!te(s.approvalScopes,P)||(T==="zip"?R.postalCode=b:T==="provinceCode"?R.zoneCode=b:T==="countryCode"?R.countryCode=b:T==="oneTimeUse"?R.oneTimeUse=b:(R[T]=b,T==="address1"?ee=!0:T==="address2"&&(w=!0)))}ee&&(delete R.streetName,delete R.streetNumber),w&&(delete R.line2,delete R.neighborhood),t.shippingAddress.value?.countryCode!==R?.countryCode&&c("extensionInteraction",{interaction:"marketDriverChangeShippingAddressCountryCode",extension:s,section:"extension",extensionInstanceId:a.id,timestamp:new Date}),u.log("wallets_shipping_address_update","Extensions: update to proposed shipping address",{extensionInstanceId:a.id,isPostalCodePadded:rs(R.postalCode,R.countryCode),isPreviousPostalCodePadded:rs(t.shippingAddress.value?.postalCode,t.shippingAddress.value?.countryCode),countryCode:R.countryCode});
2const me=await d.addressManager.shipping.value.applyAddressChange({source:"ui-extension",address:R});if(me.type==="failure"){const T=fs[me.reason];throw new Ae(T,{cause:{errors:[{message:T}]}})}const le=await I({include:[],silenceViolations:["non-delivery-address"],runListenersOnError:!1});if(le.status==="error"||le.status==="success"){const T=le.errors.reduce((b,P)=>{if(!A.has(P.code))return b;const k=dr.get(P.code);return b.concat({message:lr(P),field:k})},[]);if(T.length>0)throw new Ae(T.map(({message:b})=>b).join(", "),{cause:{errors:T}})}return{type:"success",errors:null}}},errorResult:E=>({type:"error",errors:E instanceof Ae?E.cause?.errors??[{message:E.message}]:[{message:E.message}]})})}return{billingAddress:e(m),shippingAddress:e(f),applyShippingAddressChange:y};function h(g){return typeof g.address!="object"||g.address===null?'Missing "address" property value.':g.address.countryCode&&!Zn(g.address.countryCode)?"Invalid country code.":null}}const fs={MUST_SELECT_PROVIDED_ADDRESS:"Could not apply shipping address changes: the buyer must use the provided shipping address",ADDRESS_CHANGES_UNAVAILABLE:"Could not apply shipping address changes: current checkout state does not allow address changes",DELIVERY_ADDRESS_NOT_EDITABLE:ve("applyShippingAddressChange","delivery"),ADDRESS_COUNTRY_NOT_SUPPORTED:"Could not apply shipping address changes: this checkout cannot ship to the address country"},cr=new Map([["DELIVERY_ZONE_NOT_FOUND","The specified province was not found within the country"],["DELIVERY_ZONE_REQUIRED_FOR_COUNTRY","The specified country requires a province"]]);function lr(e){return cr.get(e.code)??e.localizedMessage??e.nonLocalizedMessage}async function Ne(e){try{return await e()}catch(s){if(pr(s))return;throw s}}function pr(e){return e instanceof ct&&typeof e.cause=="object"&&e.cause!==null&&"code"in e.cause&&e.cause.code==="INVALID_NEGOTIATION"}function C({proposed:e,negotiated:s,createSubscribableFromSignal:n,cartInstructionsSignal:t,extension:r,extensionInstance:i,applyChange:o}){async function a(c){return o({unknownChange:c,extension:r,extensionInstanceId:i.id,handlers:{async updateAttribute({negotiate:u,change:d,markChangeAsNoOp:p}){if(ms(d),!t.peek().attributes.canUpdateAttributes)throw new v(ve("applyAttributeChange","attributes"));const l=e.attributes.peek();return fr(d,l,s.fields.customAttributes.peek())?(p(),{type:"success"}):(e.attributes.value=ys(l,d),await Ne(()=>u({silenceViolations:["all"]})),{type:"success"})},async removeAttribute({negotiate:u,change:d}){if(ms(d),!t.peek().attributes.canUpdateAttributes)throw new v(ve("applyAttributeChange","attributes"));const p=e.attributes.peek();if(!p?.find(l=>l.key===d.key))throw new v(`Invalid AttributeChange: no attribute with specified key found: "${d.key}"`);return e.attributes.value=ys(p,d),await Ne(()=>u({silenceViolations:["all"]})),{type:"success"}}},errorResult:u=>({type:"error",message:`Could not apply attribute changes. Error: ${u.message}`})})}return{applyAttributeChange:a,attributes:n(Qt(()=>(e.attributes.value||s.fields.customAttributes.value?.map(({key:c,value:u})=>({key:c,value:u})))??[]))}}function ms(e){if(typeof e.key!="string"||e.key.length<3||e.key.length>30)throw new v('Invalid AttributeChange: attribute key must be of type "string" and between 3 and 30 characters in length (inclusive)');if(e.type==="updateAttribute"&&typeof e.value!="string")throw new v('Invalid AttributeChange: attribute value must be of type "string"')}function fr(e,s,n){const t=o=>{const a=o?.find(c=>c.key===e.key);return a!==void 0&&a.value===e.value},r=t(n),i=s===void 0?r:t(s);return r&&i}function ys(e,s){const n=e?[...e]:[],t=n.findIndex(({key:r})=>r===s.key);return s.type==="updateAttribute"&&(t>-1?n[t]={key:s.key,value:s.value}:n.push({key:s.key,value:s.value})),s.type==="removeAttribute"&&n.splice(t,1),n}const mr=/^\$app|^app--\d+--/,yr=/^app--\d+--/,hr=/^app--\d+$/,Pe="$app",Mn=":";function vr(e){return hr.test(e)?Pe:e.replace(yr,Pe+Mn)}function gr(e,s){if(e.trim()===Pe)return`app--${s}`;const n=Pe+Mn;return e.trim().startsWith(n)?`app--${s}--${e.slice(n.length)}`:e}const Cn="2026-01";function re({proposed:e,createSubscribableFromSignal:s,extension:n,cartInstructionsSignal:t,applyChange:r,extensionInstance:i,checkout:o}){const{extensibility:a}=o,c=n.type==="local"&&Re(n.apiVersion).equalTo(Cn);return{metafields:s(S(()=>{const u=o.latestReceipt.value?.status==="processed"?o.latestReceipt.value?.purchaseOrder.metafields:[];return(u&&u.length>0?u:a.ui.metafields.value).map(({key:d,namespace:p,value:l,valueType:f})=>({key:d,namespace:p,value:l,valueType:f}))})),async applyMetafieldChange(u){return r({unknownChange:u,extension:n,extensionInstanceId:i.id,handlers:{async updateMetafield({change:d}){if(!gs(n.apiVersion))throw new v("Change type `updateMetafield` is no longer supported. Use `updateCartMetafield` instead.");c&&console.warn("Change type `updateMetafield` is deprecated and will be removed in a future API version. Use `updateCartMetafield` instead. See https://shopify.dev/docs/api/checkout-ui-extensions/2026-01/apis/metafields#methods-propertydetail-applymetafieldchange for more details."),Ar(d);const{key:p,namespace:l,value:f,valueType:m}=d,y=a.ui.metafields.value,h=y.findIndex(I=>I.key===p&&I.namespace===l),g=[...y],E=g[h];return E?g[h]={...E,value:f,valueType:m,appId:n.appId}:g.push({key:p,namespace:l,value:f,valueType:m,appId:n.appId}),a.ui.updateMetafields(g),{type:"success"}},async removeMetafield({change:d}){if(!gs(n.apiVersion))throw new v("Change type `removeMetafield` is no longer supported. Use `removeCartMetafield` instead.");c&&console.warn("Change type `removeMetafield` is deprecated and will be removed in a future API version. Use `removeCartMetafield` instead. See https://shopify.dev/docs/api/checkout-ui-extensions/2026-01/apis/metafields#methods-propertydetail-applymetafieldchange for more details.");const{key:p,namespace:l}=d,f=a.ui.metafields.value.filter(m=>m.key!==p||m.namespace!==l);return a.ui.updateMetafields(f),{type:"success"}},async updateCartMetafield({change:d,negotiate:p}){hs(d.type,t.peek().metafields),Er(d);const l=typeof d.metafield.value=="string"?d.metafield.value:String(d.metafield.value);e.cartMetafields.value=[...e.cartMetafields.peek(),{update:{key:d.metafield.key,namespace:d.metafield.namespace,value:l,type:d.metafield.type,appId:n.appId}}];const f=await p({fieldsToResolve:["cartMetafields"],silenceViolations:["all"]});return vs(f,e,d),{type:"success"}},async removeCartMetafield({change:d,negotiate:p}){hs(d.type,t.peek().metafields),Ir(d),e.cartMetafields.value=[...e.cartMetafields.peek(),{delete:{appId:n.appId,key:d.key,namespace:d.namespace}}];const l=await p({fieldsToResolve:["cartMetafields"],silenceViolations:["all"]});return vs(l,e,d),{type:"success"}}},errorResult:d=>({type:"error",message:d.message})})}}}function hs(e,{canSetCartMetafields:s,canDeleteCartMetafield:n}){const t=`applyMetafieldChange with type ${e}`;if(e==="updateCartMetafield"&&!s)throw new v(ve(t,"metafields"));if(e==="removeCartMetafield"&&!n)throw new v(ve(t,"metafields"))}function Ar(e){const{key:s,namespace:n,value:t,valueType:r}=e;
2if(typeof s!="string"||s.length<3||s.length>30)throw new v(`Invalid property key: "${s}". It must be between 3 and 30 characters in length (inclusive).`);if(typeof n!="string")throw new v(`Invalid property namespace: "${n}". It must be a string between 2 and 20 characters (inclusive).`);if(n.length<2||n.length>20)throw new v(`Invalid property namespace: "${n}". It must be between 2 and 20 characters in length (inclusive).`);if(mr.test(n))throw new v(`Invalid property namespace: "${n}". App reserved namespaces not supported.`);switch(r){case"integer":if(typeof t!="number")throw new v(`Invalid property value: "${t}". It must be a number.`);break;case"string":if(typeof t!="string")throw new v(`Invalid property value: "${t}". It must be a string.`);if(t.length<=0)throw new v(`Invalid property value: "${t}". It must not be empty.`);break;case"json_string":if(!_r(t))throw new v(`Invalid property value: "${t}". It must be a json_string.`);break;default:throw new v(`Invalid property valueType: "${r}". It must be in one of these values: integer, string, json_string.`)}return!0}function Er(e){const{metafield:s}=e;if(s==null)throw new v(`Invalid property metafield: "${s}". It must be an object.`);const{key:n,namespace:t,value:r,type:i}=s;if(typeof n!="string"||n.length<2||n.length>64)throw new v(`Invalid property key: "${n}". It must be between 2 and 64 characters in length (inclusive).`);if(t!==null&&typeof t!="string"&&typeof t<"u")throw new v(`Invalid property namespace: "${t}". namespace must be null, undefined, or a string between 3 and 255 characters (inclusive).`);if(typeof t=="string"&&(t.length<3||t.length>255))throw new v(`Invalid property namespace: "${t}". It must be between 3 and 255 characters in length (inclusive).`);if(typeof i!="string")throw new v(`Invalid property type: "${i}". It must be a string. Received type: ${typeof i}.`);if(i==="integer"){if(typeof r!="number"&&typeof r!="string")throw new v(`Invalid property value: "${r}". It must be a number or a string when type is "integer". Received type: ${typeof r}.`)}else if(typeof r!="string")throw new v(`Invalid property value: "${r}". It must be a string when type ("${i}") is not "integer". Received type: ${typeof r}.`)}function Ir(e){const{key:s,namespace:n}=e;if(typeof s!="string")throw new v(`Invalid property key: "${s}". It must be a string.`);if(n!=null&&typeof n!="string")throw new v(`Invalid property namespace: "${n}". The namespace must be either null, undefined, or a string.`)}function _r(e){if(typeof e!="string")return!1;try{return JSON.parse(e),!0}catch{}return!1}function Rr(e){const n=e.match(/\[(\d+)\]$/)?.[1];return n!==void 0?parseInt(n,10):-1}function vs(e,s,n){const t=[...s.cartMetafields.peek()],r=e.errors.filter(c=>vt.has(c.code));if(r.length===0)return;const i=r.reduce((c,u)=>{if("target"in u){const d=Rr(u.target);d>=0&&!c[d]&&(c[d]=u)}return c},{}),o=t.findIndex((c,u)=>i[u]?n.type==="updateCartMetafield"&&c.update?.key===n.metafield.key&&c.update?.namespace===n.metafield.namespace&&c.update?.value===n.metafield.value||n.type==="removeCartMetafield"&&c.delete?.key===n.key&&c.delete?.namespace===n.namespace:!1),a=i[o];if(o>-1&&a)throw s.cartMetafields.value=t.slice(0,o),new v(a.nonLocalizedMessage,{cause:{code:a.code}})}function gs(e){return!Re(e).laterThan(Cn)}function $({webPixels:e,extension:s}){const n=is(s.appId)||"unknown-app",t=is(Xe(s))||"unknown-extension";return{analytics:{publish:(r,i={})=>e.publishCustomEvent(r,i,{extension:{extensionId:t,appId:n,type:s.type||"unknown-type"}}),visitor:r=>e.visitor(r,{apiClientId:n})}}}const Dr={id:"be4fa5a8e92c26d115e34073b486a58fc317388a2eedddb82d02eeccb9573278",type:"query",name:"ExtensionMetafields",source:""},As=async({withCache:e=!0,coreGraphql:s,extension:n,observability:t,negotiated:r,checkoutProfileId:i,appMetafieldsSignal:o})=>{let a=[];const c=Mt(r),u=await Ct({withCache:e,coreGraphql:s,resourceIds:c,
2checkoutProfileId:i}),d=u.data?.globalCheckoutUiExtensions??[],f=[...u.data?.checkoutProfile?.activatedExtensions??[],...d].map(({extension:y})=>y)?.find(y=>y.uuid===n.extensionId);let m=f?.metafields??[];if(!f){const y={resourceIds:c};n.type==="local"?y.extensionHandles=[{handle:n.handle,apiKey:n.appApiKey}]:y.extensionIds=[`gid://shopify/UiExtension/${n.extensionId}`];const{data:h}=await s.staticQuery(Dr,{variables:y,cache:e});h?.extensionMetafields&&(m=h?.extensionMetafields)}a=Sr({extension:n,queryResult:u,metafields:m,observability:t}),o.value={...o.peek(),[n.id]:a}};function F({coreGraphql:e,extension:s,extensionInstance:n,negotiated:t,observability:r,createSubscribableFromSignal:i,sourceId:o,checkout:a,appMetafieldsSignal:c}){const u=Pt(()=>{As({withCache:!0,coreGraphql:e,extension:s,observability:r,negotiated:t,appMetafieldsSignal:c,checkoutProfileId:a.configuration.profileId.value})});n.on("destroy",()=>{u()});const d={type:"extension",extension:s,instanceId:n.id};return(async()=>{ls.markStarted("app-metafields-load",d);try{await As({withCache:!0,coreGraphql:e,extension:s,observability:r,negotiated:t,appMetafieldsSignal:c,checkoutProfileId:a.configuration.profileId.value})}finally{ls.markFinished("app-metafields-load",d)}})(),{appMetafields:i(S(()=>{const f=c.value[s.id]??[],m=s.extensionPoint.metafields??[],y=t.fields.buyerIdentity.value,h=y?.shopUser?.metafields??[],g=y?.shopUser?.publicId??"",E=h.flatMap(A=>!A||!g?[]:m.some(R=>R.key===A.key&&R.namespace===A.namespace)?[{target:{type:"shopUser",id:g},metafield:{key:A.key,namespace:Ke(s.apiVersion,A.namespace??""),value:A.value,type:A.type,valueType:A.valueType.toLowerCase()}}]:[]),I=t.fields.cartMetafields.value,O=Ve(s.appId);return[...f,...I?I?.flatMap(A=>A?m.some(R=>R.key===A.key&&gr(R.namespace,O)===A.namespace&&(!A.namespaceAppId||s.appId===A.namespaceAppId))?[{target:{type:"cart",id:o},metafield:{key:A.key,namespace:Ke(s.apiVersion,A.namespace??""),value:A.value,type:A.type,valueType:A.valueType.toLowerCase()}}]:[]:[]):[],...E]}))}}function Ke(e,s){return Re(e).laterThan("2025-01")?vr(s):s}function Sr({queryResult:e,metafields:s,observability:n,extension:t}){if(e.error)return n.leaveErrorBreadcrumb("Extensions::GraphQL",{reason:"Failed to fetch extension metafields.",message:String(e.error),extensionId:t.id,extensionVersion:t.type==="persisted"?t.version:void 0}),[];const r=[];for(const i of s){if(!br(t,i.ownerType))continue;const o=Ke(t.apiVersion,i.namespace);r.push({target:Tr(i.ownerId,i.ownerType),metafield:{key:i.key,namespace:o,value:i.value,type:i.type.toLowerCase(),valueType:i.valueType.toLowerCase()}})}return r}function br(e,s){switch(s){case"CART":case"PRODUCT":case"PRODUCTVARIANT":case"SHOP":case"SHOPUSER":return!0;case"CUSTOMER":case"COMPANY":case"COMPANYLOCATION":return te(e.approvalScopes,D.CustomerPersonalData);default:return(t=>!1)()}}function Tr(e,s){const n=Ve(e);switch(s){case"CUSTOMER":return{type:"customer",id:n};case"PRODUCT":return{type:"product",id:n};case"PRODUCTVARIANT":return{type:"variant",id:n};case"SHOP":return{type:"shop",id:n};case"COMPANY":return{type:"company",id:n};case"COMPANYLOCATION":return{type:"companyLocation",id:n};case"CART":return{type:"cart",id:n};case"SHOPUSER":return{type:"shopUser",id:n};default:return(r=>{throw new lt(`Metafield ownerType "${s}" with id "${e}" cannot be resolved`)})()}}function se({publicCheckoutSessionId:e,createSubscribableFromSignal:s}){return{checkoutToken:s(he(e))}}function Or(e){return{initial:e.current,subscribe(n){Dn(n);const t=e.subscribe((i=e.current)=>n(i));return[()=>{t(),Sn(n)},e.current]}}}function H({extension:e,extensionInstance:s,createSubscribableFromSignal:n,isCheckoutEditor:t,observability:r}){const i=S(()=>{const a=e.behaviors.value,c=new Set;return a.blockProgress||c.add("blockProgress"),Nr(e.capabilities,c)}),o=Or({get current(){return s.rendered},subscribe:a=>{const c=s.on("render",()=>{a(s.rendered)}),u=s.on("remove",()=>{try{a(s.rendered)}catch(f){throw r.leaveErrorBreadcrumb("Error removing rendered subscription on remove event",{isDestroyed:s.isDestroyed,rendered:s.rendered,extensionId:s.id}),f}}),d=s.on("restart",()=>{l()}),p=s.on("destroy",()=>{l()}),l=()=>{c(),u(),d(),p()};return l}});
2return{scriptUrl:e.scriptUrl,version:e.type==="persisted"?e.version:void 0,apiVersion:e.apiVersion,rendered:o,capabilities:n(i),editor:t?{type:"checkout"}:void 0,target:s.target}}function Nr(e,s){const n=[];return Object.keys(e).forEach(t=>{const r=t;r in e&&(typeof e[r]!="object"&&!s.has(r)&&e[r]&&n.push(Fe(r)),typeof e[r]=="object"&&Object.entries(e[r]).forEach(([i,o])=>{if(Array.isArray(o)&&o.length>0||!Array.isArray(o)&&o){const a=`${Fe(t)}.${Fe(i)}`;n.push(a)}}))}),n}function z({locale:e,currencySignal:s,timezone:n,extension:t,createSubscribableFromSignal:r,negotiated:i}){return{localization:{language:r(he({isoCode:e})),extensionLanguage:r(he({isoCode:t.extensionLocale})),currency:r(s),timezone:r(he(n??new Intl.DateTimeFormat().resolvedOptions().timeZone)),country:r(S(()=>{const o=i.fields.buyerIdentity.value?.countryCode;if(o)return{isoCode:o}})),market:r(S(()=>{const o=i.fields.buyerIdentity.value?.market;if(!o)return;const{id:a,handle:c}=o;return{id:a,handle:c}}))}}}function J({captureEvent:e,extension:s,locale:n,shop:t,storefrontTokens:r,extensionInstance:i}){const o=s.capabilities.apiAccess;async function a(c,u=!1,d){if(!o)throw new v(`permission to access the storefront API must be specified under [capabilities] with flag "api_access = true"; this can be done within your extension's configuration. View the docs for more information: 3 4https://shopify.dev/docs/api/checkout-ui-extensions/configuration#api-access`);const p=await r.get(s.appId,s.type,"fetchWithToken");if(!p)throw new xn(`Could not get a storefront token for app ${s.appId} to query ${c}`);try{const l=await fetch(`https://${t.myshopifyDomain}/api/${d?.version??Qn(s.apiVersion)}/graphql.json`,{method:"POST",headers:{"Content-Type":"application/json","Accept-Language":n,"Shopify-Storefront-Extension-Token":p},body:JSON.stringify({query:c,variables:d?.variables})});return l?.status===401&&u?(r.cache.delete(r.cacheKey(s.appId,s.type)),a(c,!1,d)):l}catch(l){if(l.name==="BreadcrumbsPluginFetchError"&&u)return a(c,!1,d);throw new $e(`An error occurred when attempting to fetch the extension api: ${l}`,{cause:l})}}return{query:async(c,u)=>{if(!s.capabilities.apiAccess)throw new v(`Extension is not allowed to use the Storefront API; permission to use the Storefront API must be specified under [capabilities] with:"api_access = true; see: 5 6https://shopify.dev/docs/api/checkout-ui-extensions/configuration#api-access`);const d=performance.now();e("extensionInteraction",{interaction:"storefrontApiQueryStart",extension:s,section:"extension",timestamp:new Date,extensionInstanceId:i.id});try{const p=await a(c,!0,u);if(p&&p.ok){e("extensionInteraction",{interaction:"storefrontApiQuerySuccess",extension:s,section:"extension",timestamp:new Date,duration:performance.now()-d,extensionInstanceId:i.id});try{return await p.json()}catch(f){throw new us("Failed to parse Storefront API response",{cause:f})}}throw new $e(`Failed to query storefront API: status=${p?.status} ${p?.statusText}`.trim())}catch(p){let l="storefrontApiQueryError";throw p instanceof $e&&p?.cause instanceof Error&&p.cause?.name==="BreadcrumbsPluginFetchError"?l="storefrontApiQuerySuccess":p instanceof us&&(l="storefrontResponseParseError"),e("extensionInteraction",{interaction:l,extension:s,section:"extension",timestamp:new Date,duration:performance.now()-d,error:p instanceof Error?p:void 0,extensionInstanceId:i.id}),p}}}}function j({extension:{configuration:e},createSubscribableFromSignal:s}){return s(e)}function oe(e){return{id:e.id,name:e.name,storefrontUrl:e.storefrontUrl??void 0,myshopifyDomain:e.myshopifyDomain}}function be(e){return{id:e.id,name:e.name,storefrontUrl:e.storefrontUrl?Pr(e.storefrontUrl):void 0,myshopifyDomain:e.myshopifyDomain}}function Pr(e){return e.endsWith("/")?e:`${e}/`}const Vn="v1";function Es({extension:e}){const s=Xe(e);return Un(`${Vn}-${s}-${e.extensionPoint.target}`)}function ne({extension:e}){return Un(`${Vn}-${e.appId}-${e.extensionId}`)}function Un(e){const s=et.ExtensionStorage,n=r=>`${e}-${r}`,t=()=>nt(s)??{};return{async read(r){Se(typeof r=="string",'Missing "key" argument. Please pass a key to read from to storage.');const i=n(r),o=t();return Object.keys(o).length&&o[i]||null},async write(r,i){Se(typeof r=="string",'Missing "key" argument. Please pass a key to write to to storage.'),Se(arguments.length>1,`Missing "data" argument. Please pass a value to write to "${r}" `);const o=n(r),a=t();a[o]=i,os(s,a)},async delete(r){Se(typeof r=="string",'Missing "key" argument. Please pass a key to delete from storage.');const i=n(r),o=t();
6delete o[i],Object.keys(o).length===0?st(s):os(s,o)}}}function Mi(e){return e}function Lr(e,s){return e.filter(n=>tt(n)&&n.discount.presentationLevel===s).map(n=>{const{discount:t,amount:r,title:i}=n;return t.type==="code"?{type:"code",code:i,discountedAmount:r}:t.type==="automatic"?{type:"automatic",title:i,discountedAmount:r}:{type:"custom",title:i,discountedAmount:r}})}function kr(e,s){return e.filter(n=>rt(n.discountDetails.discount)&&n.discountDetails.discount.presentationLevel===s).map(n=>{const{discount:t,title:r}=n.discountDetails;return t.type==="code"?{type:"code",code:r,discountedAmount:n.amount}:t.type==="automatic"?{type:"automatic",title:r,discountedAmount:n.amount}:{type:"custom",title:r,discountedAmount:n.amount}})}const wr=new Set(["DISCOUNTS_ONLY_EMPTY_TERMS_ACCEPTED","DISCOUNTS_DISCOUNTS_NOT_ALLOWED_FOR_B2B","DISCOUNTS_DISCOUNT_CODE_NOT_HONOURED","DISCOUNTS_CUSTOM_DISCOUNT_NOT_HONOURED","DISCOUNTS_UNSUPPORTED_EXPECTATION","DISCOUNTS_ALLOCATIONS_MISMATCH","DISCOUNTS_ADDITIONAL_REQUESTED_DISCOUNT_CODE_DISCARDED","DISCOUNTS_NOT_FOUND","DISCOUNTS_CURRENTLY_INACTIVE","DISCOUNTS_USAGE_LIMIT_REACHED","DISCOUNTS_CUSTOMER_USAGE_LIMIT_REACHED","DISCOUNTS_CUSTOMER_NOT_ELIGIBLE","DISCOUNTS_QUANTITY_NOT_IN_RANGE","DISCOUNTS_PURCHASE_NOT_IN_RANGE","DISCOUNTS_NO_ENTITLED_LINE_ITEMS","DISCOUNTS_NO_ENTITLED_SHIPPING_LINES","DISCOUNTS_INCOMPATIBLE_PURCHASE_TYPE","DISCOUNTS_DISCOUNT_ALREADY_APPLIED","DISCOUNTS_HIGHER_VALUE_DISCOUNT_APPLIED","DISCOUNTS_MAXIMUM_DISCOUNT_CODE_LIMIT_REACHED","DISCOUNTS_INVALID_SIGNATURE","REDUCTION_INVALID_CODE","REDUCTION_INVALID_DISCOUNT_CODE"]);function V({negotiated:e,proposed:s,extension:n,createSubscribableFromSignal:t,cartInstructionsSignal:r,applyChange:i,extensionInstance:o,currentDiscountCodeAttemptSignal:a}){const c=t(S(()=>{const p=e.fields.discountLines.value?.lines;return p?p.filter(l=>l.discount.type==="code").map(l=>({code:l.title})):[]})),u=t(S(()=>{const p=e.fields.discountLines.value?.lines;return p?Lr(p,"CART"):[]})),d=["non-merchandise"];return{discountCodes:c,discountAllocations:u,async applyDiscountCodeChange(p){return i({unknownChange:p,extension:n,extensionInstanceId:o.id,handlers:{async addDiscountCode({negotiate:f,change:m}){l(),Is(m);const y=await f({customizeNegotiation:h=>(a.value=m.code,{...h,reduction:{code:m.code}}),silenceViolations:d});return _s(y,m.code),a.value=null,{type:"success"}},async removeDiscountCode({negotiate:f,change:m}){l(),Is(m);const y=s.discountLines.peek(),h=m.code.toUpperCase(),g=y.find(({discount:I})=>I.type==="code"&&I.title.toUpperCase()===h);if(!g)throw new v(`The discount code "${m.code}" is not allocated to this checkout and cannot be removed.`,{cause:{code:"DISCOUNT_NOT_FOUND"}});s.discountLines.value=y.filter(({discount:I})=>I.title.toUpperCase()!==g.title.toUpperCase());const E=await f({include:["deliveryNext"],fieldsToResolve:[...gt],silenceViolations:d});return _s(E,m.code),{type:"success"}}},errorResult:f=>({type:"error",message:`Could not apply discount code changes. Error: ${f.message}`})});function l(){if(!r.peek().discounts.canUpdateDiscountCodes)throw new v(ve("applyDiscountCodeChange","discounts"))}}}}function Is(e){if(typeof e.code!="string")throw new v('Discount code must be of type "string"')}function _s(e,s){const n=e.errors.find(t=>{if(!(t.type==="RemoveTermViolation"&&it(t.targetEntity)?.title!==s))return wr.has(t.code)});if(n)throw new v(n.nonLocalizedMessage,{cause:{code:n.code}})}function Mr({extension:e,checkout:s}){return{experimentalIsShopAppStyle:kt({allowLocal:!0,extension:e})?s.identity.current.value==="shopPay":void 0}}const Cr=new Set(["REDUCTION_INVALID_CODE","PAYMENT_GIFT_CARDS_NOT_ALLOWED_FOR_B2B","PAYMENT_GIFT_CARDS_NOT_ALLOWED_FOR_FIXED_SELLING_PLANS","PAYMENTS_GIFT_CARD_ALREADY_APPLIED","PAYMENTS_GIFT_CARD_BUYING_GIFT_CARD","PAYMENTS_GIFT_CARD_CURRENCY_MISMATCH","PAYMENTS_GIFT_CARD_DISABLED","PAYMENTS_GIFT_CARD_NON_SUFFICIENT_FUNDS","PAYMENTS_GIFT_CARD_NOT_FOUND","REDUCTION_GIFT_CARD_ALREADY_APPLIED","PAYMENTS_SHOP_CASH_GIFT_CARD_NOT_ALLOWED","REDUCTION_INVALID_GIFT_CARD_CODE","PAYMENTS_INSTALLMENTS_GIFT_CARD_NOT_ALLOWED","PAYMENTS_GIFT_CARDS_UNAVAILABLE"]);function U({negotiated:e,proposed:s,extension:n,createSubscribableFromSignal:t,shop:r,a
6pplyChange:i,extensionInstance:o}){return{appliedGiftCards:t(S(()=>{const c=e.fields.paymentLines.value;return c?c.lines.filter(u=>u.method.type==="giftCard").map(u=>({lastCharacters:u.method.code.slice(-4),amountUsed:u.cost,balance:u.method.balance})):[]})),async applyGiftCardChange(c){return i({unknownChange:c,extension:n,extensionInstanceId:o.id,handlers:{async addGiftCard({negotiate:u,change:d}){if(Rs(d),!e.fields.paymentMethods.peek()?.some(f=>f.type==="giftCard"))throw new v("the `applyGiftCardChange` API is disabled");const l=await u({customizeNegotiation:f=>({...f,reduction:{code:d.code}})});return Ss(l),{type:"success"}},async removeGiftCard({negotiate:u,change:d}){Rs(d);const p=s.paymentLines.peek(),l=r.hasFlagEnabled(ot);let f=p;l?d.code.split(",").forEach(h=>{f=Ds(f,h)}):f=Ds(f,d.code),s.paymentLines.value=f;const m=await u({include:["paymentLines"]});return Ss(m),{type:"success"}}},errorResult:u=>({type:"error",message:`Could not apply gift card changes. Error: ${u.message}`})})}}}function Rs(e){if(typeof e?.code!="string")throw new v("Gift card code must be a string")}function Ds(e,s){const n=Vr(s),t=e.findIndex(({method:i})=>i.type!=="giftCard"?!1:s.length===4?i.code.toLowerCase().slice(-4)===n.slice(-4):i.code.toLowerCase()===n);if(t===-1)return e;const r=[...e];return r.splice(t,1),r}function Vr(e){return e.replace(/[\s-]/g,"").toLowerCase()}function Ss(e){const s=e.errors.find(n=>Cr.has(n.code));if(s)throw new v(s.nonLocalizedMessage,{cause:{code:s.code}})}function Bn(e){let s,n=!1;function t(){return s??=Lt(e).catch(r=>{throw s=void 0,r}),s}return{load:t,preload(){n||(n=!0,At(()=>{t().catch(()=>{})}))}}}function Ze(e){const{lineAllocation:s}=e,n="parentRelationship"in e?e.parentRelationship?.parent?.lineAllocations?.[0]:void 0;return{id:Ur(s.stableId),quantity:s.quantity,cost:{totalAmount:s.checkoutPriceAfterDiscounts},merchandise:bs(e),attributes:e.properties.map(t=>({key:t.name,value:String(t.value)})),discountAllocations:kr(s.allocations,"LINE"),lineComponents:e.lineComponents.map(t=>({type:"bundle",id:Ts(t.lineAllocation.stableId),merchandise:bs(t),quantity:t.lineAllocation.quantity,cost:{totalAmount:t.lineAllocation.checkoutPriceAfterDiscounts},attributes:t.properties.map(r=>({key:r.name,value:String(r.value)}))})),parentRelationship:n?{parent:{id:Ts(n.stableId)}}:null}}function bs(e){if(!e.variantId)throw new We("Cannot create cart line API without a variantId. Custom merchandise lines are not yet supported.");return{type:"variant",id:e.variantId.replace("ProductVariantMerchandise","ProductVariant"),title:e.title,subtitle:e.subtitle,image:e.image?{url:e.image.four,altText:e.image.altText}:void 0,selectedOptions:e.options.map(s=>({name:s.name,value:s.value})),product:{id:e.productId,vendor:e.vendor,productType:e.productType},requiresShipping:e.requiresShipping,sellingPlan:e.sellingPlan?{id:e.sellingPlan.id,recurringDeliveries:!!e.sellingPlan.subscriptionDetails}:void 0,sku:e.sku??void 0}}function Gn(e){const{lineAllocation:s,image:n}=e;return{id:Br(s.stableId),title:e.title,subtitle:e.subtitle,lines:[Ze(e)],quantity:s.quantity,cost:{totalAmount:s.checkoutPriceAfterDiscounts},image:n?{url:n.four,altText:n.altText}:void 0}}function Ur(e){return`gid://shopify/CartLine/${e}`}function Ts(e){return`gid://shopify/CartLineComponent/${e}`}function Br(e){return`gid://shopify/PresentmentCartLine/${e}`}const Gr="merchandiseError:",Yr=Bn(()=>bn(()=>import("./apply-cart-line-change.B9M8Kv6g.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48]))),$r=Bn(()=>bn(()=>import("./apply-cart-line-change-queue.DdVVojFC.js"),__vite__mapDeps([49,1,2,3,4,5,7,8,9,10,12,11,6,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48])));function B({negotiated:e,proposed:s,createSubscribableFromSignal:n,extension:t,stableDetourSignal:r,cartInstructionsSignal:i,cartLineChangeLoadingSignal:o,observability:a,applyChange:c,extensionInstance:u,isCheckoutEditor:d,shop:p}){const l=p.hasFlagEnabled(at)?Yr:$r;l.preload();async function f(m,y){return o.value=!0,(await l.load()).applyCartLineChange({change:m,negotiated:e,proposed:s,stableDetourSignal:r,cartInstructionsSignal:i,negotiate:y,isCheckoutEditor:d,observability:a})}return{lines:n(Kt(()=>
6{const m=e.fields.merchandiseLines.value,y=e.fields.remoteMerchandiseDetails?.value;return m?m.lines.filter(h=>!mn(h.stableId,y)).flatMap(h=>h.productId==null?[]:h.variantId?_n(h).map(Ze):(a.error(new We("Cannot create cart line API without a variantId. Custom merchandise lines are not yet supported.")),[])):[]})),async applyCartLinesChange(m){return c({unknownChange:m,extension:t,extensionInstanceId:u.id,handlers:{async addCartLine({negotiate:y,change:h}){return f(h,y)},async removeCartLine({negotiate:y,change:h}){return f(h,y)},async updateCartLine({negotiate:y,change:h}){return f(h,y)}},errorResult:y=>y.message.startsWith(Gr)?{type:"error",message:y.message}:{type:"error",message:`Could not apply line item changes. Error: ${y.message}`}}).finally(()=>{o.value=!1})}}}const Os=5e3;function G({proposed:e,negotiated:s,createSubscribableFromSignal:n,extension:t,cartInstructionsSignal:r,applyChange:i,extensionInstance:o}){return{note:n(e.note),async applyNoteChange(c){return i({unknownChange:c,extension:t,extensionInstanceId:o.id,handlers:{async updateNote({negotiate:u,change:d,markChangeAsNoOp:p}){if(a(),typeof d.note!="string")throw new v('Invalid NoteChange: note must be of type "string"');if(d.note&&d.note.length>Os)throw new v(`Invalid NoteChange: note must be less than or equal to ${Os} characters`);return Fr(d.note,e.note.peek(),s.fields.note.peek())?(p(),{type:"success"}):(e.note.value=d.note||void 0,await Ne(()=>u({silenceViolations:["all"]})),{type:"success"})},async removeNote({negotiate:u,markChangeAsNoOp:d}){return a(),Hr(e.note.peek(),s.fields.note.peek())?(d(),{type:"success"}):(e.note.value=void 0,await Ne(()=>u({silenceViolations:["all"]})),{type:"success"})}},errorResult:u=>({type:"error",message:u.message})})}};function a(){if(!r.peek().notes.canUpdateNote)throw new v(ve("applyNoteChange","notes"))}}function Fr(e,s,n){const t=e||void 0;return s===t&&(n||void 0)===t}function Hr(e,s){return e===void 0&&(s||void 0)===void 0}function N(e){const{extension:s}=e,{applyAttributeChange:n}=C(e),{applyCartLinesChange:t}=B(e),{applyNoteChange:r}=G(e),{applyMetafieldChange:i}=re(e),{applyDiscountCodeChange:o}=V(e),{applyGiftCardChange:a}=U(e),{applyShippingAddressChange:c}=M(e),{experimentalIsShopAppStyle:u}=Mr(e);switch(s.apiVersion){case"2023-04":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a};case"2023-07":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2023-10":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2024-01":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2024-04":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2024-07":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2024-10":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2025-01":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2025-04":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2025-07":case"unstable":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2025-10":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2026-01":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2026-04":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2026-07":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2026-10":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2027-01":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:r,applyMetafieldChange:i,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};default:Ce(s.apiVersion)}}function Ue(e){const{createSubscribableFromSignal:s}=e,{apiVersion:n}=e.extension;return Re(n).equalTo("unstable")?{order:s(he(void 0))}:Re(n).laterThan("2025-07")?{}:{order:s(he(void 0))}}function zr({negotiated:e,createSubscribableFromSignal:s,observability:n}){return{presentmentLines:s(S(()=>{const t=e.fields.merchandiseLines.value;return t?t.lines.flatMap(r=>r.variantId?_n(r).map(i=>Gn(i)):(n.error(new We("Cannot create cart line API without a variantId. Custom merchandise lines are not yet supported.")),[])):[]}))}}function q({negotiated:e,createSubscribableFromSignal:s,proposed:n,extension:t}){return te(t.approvalScopes,D.CustomerPersonalData)?{buyerIdentity:{customer:s(S(()=>{const r=e.fields.buyerIdentity.value?.customerProfile;if(r?.__typename==="CustomerProfile"||r?.__typename==="BusinessCustomerProfile"){const i=te(t.approvalScopes,D.CustomerEmail),o=te(t.approvalScopes,D.CustomerPhone),a=te(t.approvalScopes,D.CustomerName),c=r?.__typename==="CustomerProfile"?r.storeCreditAccounts.map(u=>({...u,balance:u.balance})):[];return{id:r.id,email:i?r.email??void 0:void 0,phone:o?r.phone??void 0:void 0,fullName:a?r.fullName??void 0:void 0,firstName:a?r.firstName??void 0:void 0,lastName:a?r.lastName??void 0:void 0,image:{url:r.imageUrl},acceptsMarketing:r.acceptsEmailMarketing,acceptsEmailMarketing:r.acceptsEmailMarketing,acceptsSmsMarketing:r.acceptsSmsMarketing,storeCreditAccounts:c,ordersCount:r.ordersCount??0}}})),email:s(S(()=>
6{if(!te(t.approvalScopes,D.CustomerEmail))return;const i=n.email.value,o=e.fields.buyerIdentity.value?.customerProfile?.email,a=e.fields.contactInfo.value?.email;return i||o||a})),phone:s(S(()=>{if(!te(t.approvalScopes,D.CustomerPhone))return;const i=n.phone.value,o=e.fields.buyerIdentity.value?.customerProfile?.phone,a=e.fields.contactInfo.value?.phone;return i||o||a})),purchasingCompany:s(S(()=>{const r=e.fields.buyerIdentity.value?.purchasingCompany;if(r)return{company:{id:r.company.id,name:r.company.name,externalId:r.company?.externalId},location:{id:r.location.id,name:r.location.name,externalId:r.location?.externalId}}}))}}:{buyerIdentity:void 0}}const Jr=3e4,_e={behavior:"allow"};function K({extension:e,extensionInstance:s,proposal:n,captureEvent:t,journeyCompletedSignal:r,sourceType:i,createSubscribableFromSignal:o,journeyStateSignal:a,pageBeforeDetourSignal:c,negotiated:u,cartPageSignal:d,checkout:p,interceptorRegistrationResolversSignal:l,observability:f,negotiationRateLimiter:m}){let y=0;const h=l.peek(),g=h.get(e.id);return{intercept(E){const I=String(y++);Dn(E);let O=!1;const A=[],L={interceptorKey:I,extension:e,captureEvent:t,sourceType:i,observability:f,activeRaces:A,extensionInstance:s,suppressMalformedInterceptionErrors:e.type==="persisted"||e.type==="global"},R=jr(E,L),ee=async b=>{switch(b){case"registration":return await R({requiresRenderToBlock:!1}),_e;case"negotiation":{const P=await R({requiresRenderToBlock:!0});if(!P)return _e;const{perform:k}=P.interceptorRunResponse;return P.isBlocking?{behavior:"allow",errors:P.interceptorRunResponse.errors,perform:k&&Ee(()=>k({behavior:"allow"}),L)}:{behavior:"allow",perform:k&&Ee(()=>k({behavior:"allow"}),L)}}case"progression":case"completion":{const P=await R({requiresRenderToBlock:!0});if(!P)return _e;const{perform:k}=P.interceptorRunResponse;if(P.isBlocking){if(m.isThrottled(e.id)){if(!O){O=!0;const De=ps(e),{isRemoteDom:Ge,isHighValueExtension:Ye}=De;f.log("extension_throttled_buyer_journey_block_attempt","[Extensions::BuyerJourneyIntercept] Throttled extension attempted to block checkout progress",{...De,enforced:!0}),f.counter({name:"extension_throttled_buyer_journey_block_attempt",value:1,attributes:{isRemoteDom:Ge,isHighValueExtension:Ye,enforced:!0}})}return s.markNotBlocking(I),{behavior:"allow",errors:P.interceptorRunResponse.errors,perform:k&&Ee(()=>k({behavior:"block"}),L)}}return t("extensionBuyerJourneyBlock",{behavior:"block",reason:P.interceptorRunResponse.reason,extension:e,section:"extension",timestamp:new Date,validationErrors:P.interceptorRunResponse.errors??[]}),f.debug("extensions_buyer_journey_intercepted","[Extensions::BuyerJourneyIntercept] Blocked checkout progress",{...ps(e),errors:P.interceptorRunResponse.errors,reason:P.interceptorRunResponse.reason}),{behavior:"block",reason:dt.InvalidExtensionState,errors:P.interceptorRunResponse.errors,perform:k&&Ee(()=>k({behavior:"block"}),L),context:{extension:fe(e)}}}return{behavior:"allow",perform:k&&Ee(()=>k({behavior:"allow"}),L)}}default:return b}},w=n.intercept(({reason:b})=>ee(b));Kr({interceptorRegistrationResolvers:h,interceptorRegistration:g,extension:e,sourceType:i,observability:f});const ce=async()=>{if(!p.isCheckoutLayoutForcedToOnePage.value||!p.wallets.isAcceleratedWalletEscalation.value||!s.rendered)return;const b=await R({requiresRenderToBlock:!0});if(!b?.isBlocking)return;const{perform:P}=b.interceptorRunResponse;P&&await Ee(()=>P({behavior:"block"}),L)()};ee("registration").then(ce).catch(b=>{f.error(b,{metadata:{extension:fe(e),source:{type:i}}})});const me=s.on("restart",()=>{T()}),le=s.on("destroy",()=>{T()}),T=()=>{s.markNotBlocking(I);for(const b of A)b.abort();w(),me(),le(),Sn(E)};return T},completed:o(r),steps:o(S(()=>{if(r.value)return[{handle:"thank-you",to:"shopify:checkout/thank-you",label:"thank-you",disabled:!1}];const{plan:{greenPath:E}}=a.value,I=c.value,O=u.value,A=d.value,L=E.filter(({skipOverPage:w})=>!w||!w(O)),R=L.findIndex(w=>w.id===I?.id),ee=L.map((w,ce)=>Ns({page:w,disabled:R>=0&&ce>R}));return A&&ee.unshift(Ns({page:A,disabled:!1})),ee})),activeStep:o(S(()=>
6{if(r.value)return{handle:"thank-you"};const{plan:{greenPath:E}}=a.value,I=c.value;if(!I||!E.some(({id:A})=>A===I.id))return;const O=u.value;if(!I.skipOverPage?.(O))return{handle:$n(I).handle}}))}}function Yn(e,s,n){const t={finished:Promise.resolve(),abort:()=>{}},{captureEvent:r,extension:i}=s,o=s.duration??Jr,a=performance.now();let c,u;return t.abort=()=>{clearTimeout(u),c(void 0)},t.finished=Promise.race([new Promise(d=>{c=d,u=setTimeout(()=>{c(s.onTimeout())},o)}),e.finally(()=>{r("extensionInteraction",{interaction:"buyerJourneyInterceptor",extension:i,section:"extension",timestamp:new Date,duration:performance.now()-a,extensionInstanceId:n}),clearTimeout(u)})]),t}function jr(e,s){return async({requiresRenderToBlock:n})=>{const{interceptorKey:t,extension:r,captureEvent:i,sourceType:o,observability:a,activeRaces:c,extensionInstance:u,suppressMalformedInterceptionErrors:d}=s;if(n&&!u.rendered)return u.markNotBlocking(t),{isBlocking:!1,interceptorRunResponse:_e};const p=r.capabilities.blockProgress&&r.behaviors.value.blockProgress,l=(async()=>{try{return await e({canBlockProgress:p})}catch(y){return a.error(new En(`Error in buyer journey interceptor callback: ${y}`,{cause:y}),{metadata:{extension:fe(r),source:{type:o}}}),{behavior:"allow",perform:()=>{}}}})(),f=Yn(l,{captureEvent:i,extension:r,onTimeout:()=>(a.error(new v("buyer journey interceptor callback timed out"),{metadata:{extension:fe(r),source:{type:o}}}),_e)},u.id);c.push(f);let m;try{m=await f.finished,qr(r,m)}catch(y){if(d){const h=y;return console.warn(`${h.name}: ${h.message}`),u.markNotBlocking(t),null}throw y instanceof TypeError&&a.leaveErrorBreadcrumb("BuyerJourneryIntercept: Cannot block progress",{extension:r,interceptorRequest:m}),y}return p&&m.behavior==="block"?(u.markBlocking(t),{isBlocking:!0,interceptorRunResponse:m}):(u.markNotBlocking(t),{isBlocking:!1,interceptorRunResponse:m})}}function Ee(e,s){const{observability:n,captureEvent:t,extension:r,sourceType:i,activeRaces:o,extensionInstance:a}=s,u=(async()=>{try{return await e()}catch(d){n.error(new v(`${d} (in buyer journey interceptor)`,{cause:d}),{metadata:{extension:fe(r),source:{type:i}}})}})();return async()=>{const d=Yn(u,{captureEvent:t,extension:r,onTimeout:()=>{n.error(new v("perform() in buyer journey interceptor timed out"),{metadata:{extension:fe(r),source:{type:i}}})}},a.id);o.push(d),await d.finished}}function qr(e,s){const n=[];if(Object.entries(s||{}).length||n.push("interceptor result cannot be empty or undefined"),(!s?.behavior||!["block","allow"].includes(s.behavior))&&n.push(`behavior must be either "block" or "allow", received "${s?.behavior}"`),s?.hasOwnProperty("perform")&&typeof s?.perform!="function"&&n.push(`perform must be a function: received type ${typeof s?.perform}`),s?.behavior==="block"&&typeof s.reason!="string"&&n.push(`reason must be a string: received type ${typeof s?.reason}`),n.length)throw new pt(n.join("; "));e.type==="local"&&!e.capabilities.blockProgress&&s?.behavior==="block"&&console.warn(`CannotBlockProgressWarning: extension is not allowed to block checkout progress; permission to block checkout progress must be specified under [capabilities] with flag "block_progress = true; see: 7 8https://shopify.dev/docs/api/checkout-ui-extensions/configuration#block-progress`)}function Ns({page:e,disabled:s}){const{handle:n,route:t}=$n(e),{label:r}=e;return{handle:n,to:t,label:r,disabled:s}}function $n({id:e,route:s}){switch(e){case"information":case"shipping":case"payment":case"review":return{handle:e,route:`shopify:checkout${s}`};case"onePage":case"shopPay":return{handle:"checkout",route:`shopify:checkout${s}`};case"cart":return{handle:"cart",route:"shopify:cart"};default:return{handle:"unknown",route:"#"}}}function Kr({interceptorRegistrationResolvers:e,interceptorRegistration:s,extension:n,sourceType:t,observability:r}){if(s){qt(e,n.id,s);return}r.error(new En("Error registering interceptor resolver. No corresponding extension found in interceptorRegistrationResolversSignal."),{metadata:{extension:fe(n),source:{type:t}}})}function de({cartInstructionsSignal:e,createSubscribableFromSignal:s}){return{instructions:s(e)}}function Q({negotiated:e,createSubscribableFromSignal:s}){return{checkoutSettings:s(S(()=>{const n=e.fields.buyerIdentity.value?.customerProfile,t=e.fields.paymentFlexibilityPaymentTermsTemplate.value,r=t?{id:t.id,name:t.translatedName,dueDate:t.dueDate||void 0,dueInDays:t.dueInDays||void 0}:void 0,i=e.fields.checkoutCompletionTarget.value,o=i||"ORDER",a=n?.__typename==="BusinessCustomerProfile"&&n.checkoutExperienceConfiguration?n.checkoutExperienceConfiguration.editableShippingAddress:!0;return{orderSubmission:o,shippingAddress:{isEditable:a},paymentTermsTemplate:r}}
8))}}function Be(e,s){return!e||e.length===0||!s?e:e.filter(n=>{const{targetMerchandiseLines:t}=n;return!t||t.length===0?!0:!t.some(i=>mn(i.stableId,s))})}function W({negotiated:e,isOnePageCheckout:s,createSubscribableFromSignal:n}){return{cost:{subtotalAmount:n(e.fields.subtotal),totalShippingAmount:n(S(()=>{const t=e.fields.deliveryNext.value,r=e.fields.remoteMerchandiseDetails.value;if(t?.status!=="filled")return;const i=Be(t.lines,r),o=Qr(i,!s);return o.length===0?void 0:{amount:o.reduce((u,{costAfterDiscounts:d})=>u+d.amount,0),currencyCode:o[0]?.costAfterDiscounts.currencyCode}})),totalTaxAmount:n(S(()=>{const t=e.fields.taxes.value;if(t?.status==="available_total")return t.totalTax;if(t?.status==="available_total_included")return t.totalIncludedInTarget;t?.status==="unavailable"&&console.error(`Taxes are unavailable: ${t.reason}`)})),totalAmount:n(e.fields.runningTotal)}}}function Qr(e,s){return e.reduce((n,t)=>{if(t.status==="not_required")return n;const{methods:r,selectedDeliveryMethodHandle:i}=t,o=r.find(({handle:u})=>i===u);if(!o)return n;const a=o?.priceBreakdown?.length&&o.priceBreakdown.every(u=>u.excludeFromDeliveryOptionPrice),c=o?.priceBreakdown?.every(u=>!!!u.targetMerchandiseLines[0]?.sellingPlan?.prepaid);return a&&c&&s||n.push({costAfterDiscounts:o.costAfterDiscounts}),n},[])}function Fn(e,s){const n=s?.filterMetafieldsByExtensionId(e.metafields);return{handle:e.handle,title:e.title||void 0,description:e.description||void 0,type:Xr(e.methodType),carrier:{name:e.carrierName||void 0},cost:{amount:e.cost.amount,currencyCode:e.cost.currencyCode},costAfterDiscounts:{amount:e.costAfterDiscounts.amount,currencyCode:e.costAfterDiscounts.currencyCode},deliveryEstimate:Zr(e),code:e.code||"",metafields:n||[]}}function Wr(e,s){const n=s?.filterMetafieldsByExtensionId(e.metafields);return{handle:e.handle,title:e.title||void 0,description:e.description||void 0,code:e.code||"",type:"pickup",location:{address:{address1:e.pickupLocation?.address.address1,address2:e.pickupLocation?.address.address2,city:e.pickupLocation?.address.city,countryCode:e.pickupLocation?.address.countryCode,phone:e.pickupLocation?.address.phone,zip:e.pickupLocation?.address.postalCode,provinceCode:e.pickupLocation?.address.zoneCode,...xe(e.pickupLocation?.address)}},metafields:n||[]}}function Xr(e){return e==="LOCAL"?"local":"shipping"}function Zr(e){return{timeInTransit:xr(e.estimatedTimeInTransit)}}function xr(e){if(e)return typeof e=="number"?{lower:e,upper:e}:{lower:e.lower,upper:e.upper}}function ei({line:e,extensionContext:s,observability:n,proposedSelectedDeliveryMethodHandles:t,lines:r}){if(e.status==="available"){const i=ni(e.methods,n,s);return{targetedCartLines:Ps(e.targetMerchandiseLines??[],r),deliveryOptions:i,selectedDeliveryOption:si(e,i,t),groupType:Ie(e.type),isDeliveryRequired:!0,id:Ls(e.id)}}else return{targetedCartLines:Ps(e.targetMerchandiseLines,r),deliveryOptions:[],selectedDeliveryOption:void 0,groupType:Ie(e.type),isDeliveryRequired:!1,id:Ls(e.id)}}function Ps(e,s){return s?s.filter(t=>e.some(r=>r.stableId===t.stableId)).flatMap(({lineAllocations:t})=>t.map(r=>({id:`gid://shopify/CartLine/${r.stableId}`}))):[]}function si(e,s,n){if(s.length===0)return;const t=e.methods.map(o=>o.handle),i=n.find(o=>o&&t.includes(o))||e.selectedDeliveryMethodHandle;return i?{handle:i}:void 0}function ni(e,s,n){return e.map(t=>{switch(t.methodType){case"SHIPPING":case"LOCAL":return Fn(t,n);case"PICK_UP":return ti(t,s,n);case"PICKUP_POINT":return ii(t,s,n);case"RETAIL":case"NONE":return;default:{const r=`Unknown delivery method type: ${t.methodType}`;s?.error(new es(r),{metadata:{deliveryMethod:{type:t.methodType,handle:t.handle}}});return}}}).filter(t=>t!=null)}function ti(e,s,n){const t=ri(e,s);if(t==null)return;const r=n?.filterMetafieldsByExtensionId(e.metafields);return{handle:e.handle,title:e.title||void 0,description:e.description||void 0,code:e.code||"",type:"pickup",location:t,metafields:r||[]}}function ri({pickupLocation:e,methodType:s},n){if(e?.type==="PickupInStoreLocation"){const{address:r}=e;return{name:e?.name,address:{name:r.name,firstName:r.firstName,lastName:r.lastName,company:r.company,address1:r.address1,address2:r.address2,city:r.city,zip:r.postalCode,countryCode:r.countryCode,provinceCode:r.zoneCode,phone:r.phone,...xe(r)}}}const t=`Invalid pickupLocation type ${e?.type} for ${s} delivery method`;n?.error(new es(t))}function ii(e,s,n){const t=di(e,s);if(t==null)return;const r=n?.filterMetafieldsByExtensionId(e.metafields);return{handle:e.handle,title:e.title||void 0,description:e.description||void 0,code:e.code||"",type:"pickupPoint",cost:{amount:e.cost.amount,currencyCode:e.cost.currencyCode},costAfterDiscounts:{amount:e.costAfterDiscounts.amount,currencyCode:e.costAfterDiscounts.currencyCode},carrier:{name:oi(e),code:ai(e)},location:t,metafields:r||[]}}function oi({pickupLocation:e}){if(e?.type==="PickupPointLocation")return e.carrierName}function ai({pickupLocation:e}){if(e?.type==="PickupPointLocation")return e.carrierCode}function di({pickupLocation:e,methodType:s},n){if(e?.type==="PickupPointLocation"){const{name:r,address:i,handle:o}=e;return{name:r,handle:o,address:{name:i.name,firstName:i.firstName,lastName:i.lastName,company:i.company,address1:i.address1,address2:i.address2,city:i.city,zip:i.postalCode,countryCode:i.countryCode,provinceCode:i.zoneCode,phone:i.phone,...xe(i)}}}const t=`Invalid pickupLocation type ${e?.type} for ${s} delivery method`;n?.error(new es(t))}function xe(e){const s=e?.coordinates;return s?.latitude==null||s.longitude==null?{}:{latitude:s.latitude,longitude:s.longitude}}function Ls(e){if(e)return yn("DeliveryGroup",Ve(e))}
8class es extends Error{constructor(s){super(s),this.name="DeliveryError"}}class Le{constructor(s,n){this.measureAsync=(({functionToMeasure:t})=>Promise.resolve(t())),this.measureSync=(({functionToMeasure:t})=>t()),this.observability=n,this.extension=s}static wrapClient(s,n){return n instanceof Le?n:new Le(s,n)}counter(...s){this.observability.counter(...s)}gauge(...s){this.observability.gauge(...s)}histogram(...s){this.observability.histogram(...s)}debug(...s){this.observability.debug(...s)}log(...s){this.observability.log(...s)}addErrorMetadata(...s){this.observability.addErrorMetadata(...s)}leaveErrorBreadcrumb(...s){this.observability.leaveErrorBreadcrumb(...s)}addOnError(...s){this.observability.addOnError(...s)}removeOnError(...s){this.observability.removeOnError(...s)}async exportMetrics(){await this.observability.exportMetrics()}async exportLogs(){await this.observability.exportLogs()}addAttributesForLogs(...s){this.observability.addAttributesForLogs(...s)}enableKeepAlive(){return this.observability.enableKeepAlive()}error(s,n){const t={...n};t.metadata||(t.metadata={}),t.metadata.extension||(t.metadata.extension=fe(this.extension)),this.observability.error(s,t)}leaveBreadcrumb(s,n,t){this.observability.leaveErrorBreadcrumb(s,n,t)}}class ss{constructor(s){this.extension=s}filterMetafieldsByExtensionId(s){return s.filter(n=>{const t=n.namespace.split("--");return t[0]==="app"&&t[1]===Ve(this.extension.appId)||t[0]!=="app"})}}function ns({line:e,extension:s,observability:n,proposedSelectedDeliveryMethodHandles:t,lines:r}){const i=s?new ss(s):void 0;return ei({line:e,extensionContext:i,observability:Le.wrapClient(s,n),proposedSelectedDeliveryMethodHandles:t,lines:r})}function ui(e,s){return Wr(e,new ss(s))}function X({extension:e,negotiated:s,proposed:n,observability:t,createSubscribableFromSignal:r}){return{deliveryGroups:r(S(()=>{const o=s.fields.deliveryNext.value;if(!o)return[];const a=o.status;if(a==="unavailable")return[];const u=n.deliveryLines.value.map(l=>l.fields.deliveryMethodHandle.value),d=s.fields.remoteMerchandiseDetails.value;if(a==="filled"||a==="partial")return Be(o.lines,d).map(f=>ns({line:f,extension:e,observability:t,proposedSelectedDeliveryMethodHandles:u,lines:s.fields.merchandiseLines.value?.lines}));const p=`Unknown delivery status: ${a}`;return t.error(new ft(p),{metadata:{extension:fe(e)}}),[]}))}}function pe({createSubscribableFromSignal:e,proposed:s,extension:n,negotiated:t}){return te(n.approvalScopes,D.CustomerPersonalData)?{localizedFields:e(S(()=>{const r=s.localizationExtensions.value;return r?r.map(({fields:i})=>({key:i.key.value,title:i.title.value,value:i.value.value??""})):(t.value.localizationExtensions||[]).map(({key:i,title:o,value:a})=>({key:i,title:o,value:a??""}))}))}:{localizedFields:void 0}}function Z({negotiated:e,proposed:s,createSubscribableFromSignal:n}){return{availablePaymentOptions:n(S(()=>{const t=e.fields.paymentMethods.value,r=s.paymentLines.value,i=e.fields.paymentLines.value,o=e.fields.deferredTotal.value,a="giftCard";if(!t)return[];let c=!1;const u=t?.filter(f=>f.type!==a?!0:(c=!0,!1)).map(f=>({method:f}));if(!u&&!c)return[];const d=as(u),p=ds(d,r,t,{negotiatedPaymentLines:i?.lines,deferredTotal:o}),l=p.some(f=>f.method.type===a);return p.map(f=>{const m="name"in f.method?f.method.name:void 0,y="paymentMethodIdentifier"in f.method&&f.method.paymentMethodIdentifier||void 0;return{handle:ze(f.method.type,m,y),type:He(f.method.type)}}).concat(c&&!l?[{handle:ze(a),type:He(a)}]:[])})),selectedPaymentOptions:n(S(()=>{const t=s.paymentLines.value,r=e.fields.paymentMethods.value,i=e.fields.paymentLines.value,o=e.fields.deferredTotal.value;if(!r)return[];const a=as(t);return ds(a,t,r,{negotiatedPaymentLines:i?.lines,deferredTotal:o}).map(u=>{const d="name"in u.method?u.method.name:void 0,p="paymentMethodIdentifier"in u.method&&u.method.paymentMethodIdentifier||void 0;return{handle:ze(u.method.type,d,p),type:He(u.method.type)}})}))}}function ae({extension:e,ui:s}){return{ui:{overlay:{close(n){wt(e,n)&&s.overlay.close(n)}}}}}function _(e){const{shop:s,extension:n,extensionInstance:t}=e;switch(n.apiVersion){case"2023-04":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{presentmentLines:a}=zr(e),{note:c}=G(e),{metafields:u}=re(e),{discountAllocations:d,discountCodes:p}=V(e),{appliedGiftCards:l}=U(e),{shippingAddress:f}=M(e);return{version:n.apiVersion,extensionPoint:t.target,extension:{...r,apiVersion:r.apiVersion,target:r.target,capabilities:r.capabilities},settings:j(e),shop:be(s),appliedGiftCards:l,attributes:i,discountAllocations:d,discountCodes:p,lines:o,metafields:u,note:c,presentmentLines:a,shippingAddress:f,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:Es(e),...$(e),...Y(e),...J(e),...ae(e)}}case"2023-07":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=re(e),{discountAllocations:u,discountCodes:d}=V(e),{appliedGiftCards:p}=U(e),{shippingAddress:l}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...r,apiVersion:r.apiVersion,target:r.target,capabilities:r.capabilities},settings:j(e),shop:be(s),appliedGiftCards:p,attributes:i,discountAllocations:u,discountCodes:d,lines:o,metafields:c,note:a,shippingAddress:l,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:Es(e),...$(e),...Y(e),...J(e),...ae(e)}}case"2023-10":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=re(e),{discountAllocations:u,discountCodes:d}=V(e),{appliedGiftCards:p}=U(e),{shippingAddress:l,billingAddress:f}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...r,apiVersion:r.apiVersion,target:r.target,capabilities:r.capabilities},settings:j(e),shop:be(s),appliedGiftCards:p,attributes:i,discountAllocations:u,discountCodes:d,lines:o,metafields:c,note:a,shippingAddress:l,billingAddress:f,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:ne(e),...$(e),...Y(e),...J(e),...ae(e),...se(e)}}case"2024-01":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=re(e),{discountAllocations:u,discountCodes:d}=V(e),{appliedGiftCards:p}=U(e),{shippingAddress:l,billingAddress:f}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...r,apiVersion:r.apiVersion,target:r.target,capabilities:r.capabilities},settings:j(e),shop:be(s),appliedGiftCards:p,attributes:i,discountAllocations:u,discountCodes:d,lines:o,metafields:c,note:a,shippingAddress:l,billingAddress:f,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:ne(e),...$(e),...Y(e),...J(e),...ae(e),...se(e)}}case"2024-04":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=re(e),{discountAllocations:u,discountCodes:d}=V(e),{appliedGiftCards:p}=U(e),{shippingAddress:l,billingAddress:f}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...r,apiVersion:r.apiVersion,target:r.target,capabilities:r.capabilities},settings:j(e),shop:oe(s),appliedGiftCards:p,attributes:i,discountAllocations:u,discountCodes:d,lines:o,metafields:c,note:a,shippingAddress:l,billingAddress:f,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:ne(e),...$(e),...Y(e),...J(e),...ae(e),...se(e),...ie(e)}}case"2024-07":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=re(e),{discountAllocations:u,discountCodes:d}=V(e),{appliedGiftCards:p}=U(e),{shippingAddress:l,billingAddress:f}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...r,apiVersion:r.apiVersion,target:r.target,capabilities:r.capabilities},settings:j(e),shop:oe(s),appliedGiftCards:p,attributes:i,discountAllocations:u,discountCodes:d,lines:o,metafields:c,note:a,shippingAddress:l,billingAddress:f,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:ne(e),...$(e),...Y(e),...J(e),...ae(e),...se(e),...ie(e),...de(e)}}case"2024-10":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=re(e),{discountAllocations:u,discountCodes:d}=V(e),{appliedGiftCards:p}=U(e),{shippingAddress:l,billingAddress:f}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...r,apiVersion:r.apiVersion,target:r.target},settings:j(e),shop:oe(s),appliedGiftCards:p,attributes:i,discountAllocations:u,discountCodes:d,lines:o,metafields:c,note:a,shippingAddress:l,billingAddress:f,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:ne(e),...$(e),...Y(e),...J(e),...ae(e),...se(e),...ie(e),...de(e)}}case"2025-01":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=re(e),{discountAllocations:u,discountCodes:d}=V(e),{appliedGiftCards:p}=U(e),{shippingAddress:l,billingAddress:f}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...r,apiVersion:r.apiVersion,target:r.target},settings:j(e),shop:oe(s),appliedGiftCards:p,attributes:i,discountAllocations:u,discountCodes:d,lines:o,metafields:c,note:a,shippingAddress:l,billingAddress:f,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:ne(e),...$(e),...Y(e),...J(e),...ae(e),...se(e),...ie(e),...de(e),...pe(e)}}case"2025-04":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=re(e),{discountAllocations:u,discountCodes:d}=V(e),{appliedGiftCards:p}=U(e),{shippingAddress:l,billingAddress:f}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...r,apiVersion:r.apiVersion,target:r.target},settings:j(e),shop:oe(s),appliedGiftCards:p,attributes:i,discountAllocations:u,discountCodes:d,lines:o,metafields:c,note:a,shippingAddress:l,billingAddress:f,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:ne(e),...$(e),...Y(e),...J(e),...ae(e),...se(e),...ie(e),...de(e),...pe(e)}}case"2025-07":case"unstable":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=re(e),{discountAllocations:u,discountCodes:d}=V(e),{appliedGiftCards:p}=U(e),{shippingAddress:l,billingAddress:f}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...r,apiVersion:r.apiVersion,target:r.target},settings:j(e),shop:oe(s),appliedGiftCards:p,attributes:i,discountAllocations:u,discountCodes:d,lines:o,metafields:c,note:a,shippingAddress:l,billingAddress:f,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:ne(e),...$(e),...Y(e),...J(e),...ae(e),...se(e),...ie(e),...de(e),...pe(e)}}case"2025-10":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=re(e),{discountAllocations:u,discountCodes:d}=V(e),{appliedGiftCards:p}=U(e),{shippingAddress:l,billingAddress:f}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...r,apiVersion:r.apiVersion,target:r.target},settings:j(e),shop:oe(s),appliedGiftCards:p,attributes:i,discountAllocations:u,discountCodes:d,lines:o,metafields:c,note:a,shippingAddress:l,billingAddress:f,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:ne(e),...$(e),...Y(e),...J(e),...ae(e),...se(e),...ie(e),...de(e),...pe(e)}}case"2026-01":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=re(e),{discountAllocations:u,discountCodes:d}=V(e),{appliedGiftCards:p}=U(e),{shippingAddress:l,billingAddress:f}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...r,apiVersion:r.apiVersion,target:r.target},settings:j(e),shop:oe(s),appliedGiftCards:p,attributes:i,discountAllocations:u,discountCodes:d,lines:o,metafields:c,note:a,shippingAddress:l,billingAddress:f,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:ne(e),...$(e),...Y(e),...J(e),...ae(e),...se(e),...ie(e),...de(e),...pe(e)}}case"2026-04":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{note:a}=G(e),{discountAllocations:c,discountCodes:u}=V(e),{appliedGiftCards:d}=U(e),{shippingAddress:p,billingAddress:l}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...r,apiVersion:r.apiVersion,target:r.target},settings:j(e),shop:oe(s),appliedGiftCards:d,attributes:i,discountAllocations:c,discountCodes:u,lines:o,note:a,shippingAddress:p,billingAddress:l,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:ne(e),...$(e),...Y(e),...J(e),...se(e),...ie(e),...de(e),...pe(e)}}case"2026-07":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{note:a}=G(e),{discountAllocations:c,discountCodes:u}=V(e),{appliedGiftCards:d}=U(e),{shippingAddress:p,billingAddress:l}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...r,apiVersion:r.apiVersion,target:r.target},settings:j(e),shop:oe(s),appliedGiftCards:d,attributes:i,discountAllocations:c,discountCodes:u,lines:o,note:a,shippingAddress:p,billingAddress:l,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:ne(e),...$(e),...Y(e),...J(e),...se(e),...ie(e),...de(e),...pe(e)}}case"2026-10":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{note:a}=G(e),{discountAllocations:c,discountCodes:u}=V(e),{appliedGiftCards:d}=U(e),{shippingAddress:p,billingAddress:l}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...r,apiVersion:r.apiVersion,target:r.target},settings:j(e),shop:oe(s),appliedGiftCards:d,attributes:i,discountAllocations:c,discountCodes:u,lines:o,note:a,shippingAddress:p,billingAddress:l,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:ne(e),...$(e),...Y(e),...J(e),...se(e),...ie(e),...de(e),...pe(e)}}case"2027-01":{const r=H(e),{attributes:i}=C(e),{lines:o}=B(e),{note:a}=G(e),{discountAllocations:c,discountCodes:u}=V(e),{appliedGiftCards:d}=U(e),{shippingAddress:p,billingAddress:l}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...r,apiVersion:r.apiVersion,target:r.target},settings:j(e),shop:oe(s),appliedGiftCards:d,attributes:i,discountAllocations:c,discountCodes:u,lines:o,note:a,shippingAddress:p,billingAddress:l,buyerJourney:K(e),...Q(e),...z(e),...q(e),...W(e),...Z(e),...X(e),...F(e),storage:ne(e),...$(e),...Y(e),...J(e),...se(e),...ie(e),...de(e),...pe(e)}}default:Ce(n.apiVersion)}}function ts(e,{stableId:s}
8){const{extension:n}=e;switch(n.apiVersion){case"2023-04":return{...ci(e,s)};case"2023-07":return{...x(e,s)};case"2023-10":return{...x(e,s)};case"2024-01":return{...x(e,s)};case"2024-04":return{...x(e,s)};case"2024-07":return{...x(e,s)};case"2024-10":return{...x(e,s)};case"2025-01":return{...x(e,s)};case"2025-04":return{...x(e,s)};case"2025-07":case"unstable":return{...x(e,s)};case"2025-10":return{...x(e,s)};case"2026-01":return{...x(e,s)};case"2026-04":return{...x(e,s)};case"2026-07":return{...x(e,s)};case"2026-10":return{...x(e,s)};case"2027-01":return{...x(e,s)};default:Ce(n.apiVersion)}}function x({createSubscribableFromSignal:e,negotiated:s},n){let t;return{target:e(S(()=>{const i=s.fields.merchandiseLines.value,o=Et({stableId:n,merchandiseLines:i?.lines??[]});if(o===null&&!t)throw new In("No merchandise item found");return o!==null&&(t=Ze(o)),t}))}}function ci({createSubscribableFromSignal:e,negotiated:s},n){let t;return{target:e(S(()=>{const i=s.fields.merchandiseLines.value,o=It(n,i?.lines??[]);if(o===null&&!t)throw new In("No merchandise item found");if(o!==null){const{parent:a,index:c}=o;t=Gn(_t(a,c))}return t}))}}const ks=64;function Hn({applyChange:e,extension:s,proposed:n,createSubscribableFromSignal:t,extensionInstance:r,bankIdNumberSignal:i},{paymentMethodIdentifier:o}){const a=te(s.approvalScopes,D.CheckoutExtensionPayments);async function c(u){return e({unknownChange:u,extension:s,extensionInstanceId:r.id,handlers:{async updatePaymentMethodAttributes({change:d}){if(!a)throw new v(li);d.attributes.forEach(l=>{if(typeof l.value=="string"&&l.value.length>ks)throw new v(`Value length exceeded threshold ${ks} for key ${l.key}`)});const p=n.paymentLines.peek();return n.paymentLines.value=p.map(l=>(l.method.type==="customOnsite"||l.method.type==="direct")&&l.method.paymentMethodIdentifier===o?{...l,method:{...l.method,paymentAttributes:JSON.stringify(d.attributes)}}:l),{type:"success"}}},errorResult:d=>({type:"error",message:d.message})})}return{applyPaymentMethodAttributesChange:c,paymentMethodAttributes:a?t(S(()=>{const u=n.paymentLines.value.find(({method:d})=>{if(d.type==="direct"||d.type==="customOnsite")return d.paymentMethodIdentifier===o&&d.paymentAttributes});if(u){const{paymentAttributes:d}=u.method;if(d)return JSON.parse(d)}})):void 0,bankIdNumber:a?t(i):void 0}}const li="Access denied: the extension does not have the required approval scopes";function pi({createSubscribableFromSignal:e,extension:s,negotiated:n,proposal:t},r){let i;const o=r?.handle,a=e(S(()=>{const u=n.fields.deliveryNext.value;if(!u||u.status!=="filled")return i;const l=u.lines.filter(f=>f.status==="available").flatMap(f=>f.methods).find(f=>f.handle===o);if(l){const f=ui(l,s);i=Qe(i,f)?i:f}return i})),c=e(S(()=>t.parts.deliveryLines.value.some(({fields:{deliveryMethodHandle:d}})=>o===d.value)));return{target:a,isTargetSelected:c}}function zn({createSubscribableFromSignal:e},{isLocationFormVisible:s}){return{isLocationFormVisible:e(he(s))}}function Jn({createSubscribableFromSignal:e},{isLocationFormVisible:s}){return{isLocationFormVisible:e(he(s))}}function fi({extension:e,negotiated:s,applyChange:n,extensionInstance:t},{paymentMethodIdentifier:r,submitRedeemablePaymentLine:i}){return{async applyRedeemableChange(o){return n({unknownChange:o,extension:e,extensionInstanceId:t.id,handlers:{async redeemableAddChange({negotiate:a,change:c}){if(!(e.type==="local")&&!te(e.approvalScopes,D.CheckoutExtensionRedeemables))throw new v("Access denied: the extension does not have the required approval scopes");const d=s.fields.availableRedeemables.peek()?.map(h=>({paymentMethod:Vt(h.paymentMethod)}))??[],p={paymentMethod:{type:"redeemable",redemptionSource:"CUSTOM",redemptionContent:{paymentMethodIdentifier:r,maskedIdentifier:mi(c.identifier),redemptionAttributes:c.attributes}}},l=Ut(p),f=await a({customizeNegotiation:h=>({...h,availableRedeemables:{availableRedeemables:d.concat(l)}}),fieldsToResolve:["availableRedeemables"]}),m=f.status==="error"&&f.violations.some(cs),y=f.violations.find(cs);if(m)throw new v("Could not apply redeemable",{cause:{code:y?.code}});if(i){const h=f.negotiated.availableRedeemables?.find(O=>Rt(p.paymentMethod,O.paymentMethod)),g=f.negotiated.paymentDue;if(!h||!g)throw new v("Could not apply redeemable",{cause:{code:y?.code}});const E=await i(h,g),I=E&&(E.status==="error"&&E.violations.some(ut)||E.status!=="error"&&E.status!=="success");if(!E||I)throw new v("Could not submit redeemable as a payment line")}return{type:"success"}}},errorResult:a=>({type:"error",message:a.message})})}}}function mi(e){return e.slice(0,-4).replace(/./g,"â¢")+e.slice(-4)}function jn({createSubscribableFromSignal:e,extension:s,negotiated:n,proposal:t},{handle:r,isInModal:i}
8){let o;const a=e(S(()=>{const d=s?new ss(s):void 0,p=n.fields.deliveryNext.value;if(!p||p.status!=="filled")return o;const m=p.lines.filter(y=>y.status==="available").flatMap(y=>y.methods).find(y=>y.handle===r);if(m){const y=Fn(m,d);o=Qe(o,y)?o:y}return o})),c=e(S(()=>t.parts.deliveryLines.value.some(p=>r===p.fields.deliveryMethodHandle.value)));return{target:a,isTargetSelected:c,renderMode:{overlay:i??!1}}}function qn(e,s){const{extension:{apiVersion:n}}=e;switch(n){case"2023-04":case"2023-07":case"2023-10":return{};case"2024-01":case"2024-04":return yi(e,s??{});case"2024-07":return ue(e,s??{});case"2024-10":return ue(e,s??{});case"2025-01":return ue(e,s??{});case"2025-04":return ue(e,s??{});case"2025-07":case"unstable":return ue(e,s??{});case"2025-10":return ue(e,s??{});case"2026-01":return ue(e,s??{});case"2026-04":return ue(e,s??{});case"2026-07":return ue(e,s??{});case"2026-10":return ue(e,s??{});case"2027-01":return ue(e,s??{});default:Ce(n)}}function ue({createSubscribableFromSignal:e,observability:s,extension:n,proposed:t,negotiated:r},{includeDeliverySelectionGroups:i,groupType:o}){return{target:e(S(()=>{const a=r.fields.deliveryNext.value;if(!o||a?.status!=="filled")return;const c=r.fields.remoteMerchandiseDetails.value,u=a.lines.filter(hn),p=Be(u,c).filter(({type:g})=>Ie(g)===o),f=t.deliveryLines.value.filter(g=>Ie(g.fields.type.value)===o).map(g=>g.fields.deliveryMethodHandle.value),m=r.fields.merchandiseLines.value?.lines,y=g=>ns({line:g,extension:n,observability:s,proposedSelectedDeliveryMethodHandles:f,lines:m}),h=p.map(y);return h.length>0?{groupType:o,deliveryGroups:h}:void 0})),deliverySelectionGroups:e(S(()=>{const a=t.deliveryMacros.value,c=t.deliveryLines.value.map(d=>d.value).filter(({type:d,deliveryMethodTypes:p})=>d==="ONE_TIME_PURCHASE"&&p.some(l=>l==="SHIPPING"||l==="LOCAL"));if(!i||!a.length||!c.length)return;const u=new Set(c.map(({deliveryMethodHandle:d})=>d).filter(d=>!!d));return a.map(d=>{const p=Object.values(d.deliveryMethodHandles).filter(l=>!!l);return{handle:d.id,selected:p.length===u.size&&p.every(l=>u.has(l)),title:d.title,associatedDeliveryOptions:p.map(l=>({handle:l})),cost:{amount:d.cost.amount,currencyCode:d.cost.currencyCode},costAfterDiscounts:{amount:d.costAfterDiscounts.amount,currencyCode:d.costAfterDiscounts.currencyCode}}})}))}}function yi({createSubscribableFromSignal:e,observability:s,extension:n,proposed:t,negotiated:r},{groupType:i}){return{target:e(S(()=>{const o=r.fields.deliveryNext.value;if(!i||o?.status!=="filled")return;const a=r.fields.remoteMerchandiseDetails.value,c=o.lines.filter(hn),d=Be(c,a).filter(({type:h})=>Ie(h)===i),l=t.deliveryLines.value.filter(h=>Ie(h.fields.type.value)===i).map(h=>h.fields.deliveryMethodHandle.value),f=r.fields.merchandiseLines.value?.lines,m=h=>ns({line:h,extension:n,observability:s,proposedSelectedDeliveryMethodHandles:l,lines:f}),[y]=d;return y?m(y):void 0}))}}const ws={name:"Checkout::Dynamic::Render",api(e){return{..._(e),...N(e),...Ue(e)}}},Ms={name:"Checkout::Actions::RenderBefore",api(e){return{..._(e),...N(e)}}},Cs={name:"Checkout::CartLineDetails::RenderAfter",api(e,s){return{..._(e),...N(e),...ts(e,s),...Ue(e)}}},Vs={name:"Checkout::CartLineDetails::RenderLineComponents",api(e,s){return{..._(e),...ts(e,s)}}},Us={name:"Checkout::CartLines::RenderAfter",api(e){return{..._(e),...N(e),...Ue(e)}}},Bs={name:"Checkout::Contact::RenderAfter",api(e){return{..._(e),...N(e)}}},Gs={name:"Checkout::CustomerInformation::RenderAfter",api(e){return{..._(e),...N(e),...Ue(e)}}},Ys={name:"Checkout::DeliveryAddress::RenderBefore",api(e){return{..._(e),...N(e)}}},$s={name:"purchase.checkout.delivery-address.render-after",api(e){return{..._(e),...N(e)}}},Fs={name:"Checkout::GiftCard::Render",api(e,s){return{..._(e),...N(e),...fi(e,s)}}},Hs={name:"Checkout::PaymentMethod::Render",api(e,s){return{..._(e),...N(e),...Hn(e,s)}}},zs={name:"Checkout::PaymentMethod::HostedFields::RenderAfter",api(e,s){return{..._(e),...N(e),...Hn(e,s)}}},Js={name:"Checkout::PaymentMethod::RenderRequiredAction",api(e){return{..._(e),...N(e)}}},js={name:"purchase.checkout.payment-method-list.render-before",api(e){return{..._(e),...N(e)}}},qs={name:"purchase.checkout.payment-method-list.render-after",api(e){return{..._(e),...N(e)}}},Ks={name:"Checkout::PickupLocations::RenderBefore",api(e,s){return{..._(e),...N(e),...zn(e,s
8)}}},Qs={name:"Checkout::PickupLocations::RenderAfter",api(e,s){return{..._(e),...N(e),...zn(e,s)}}},Ws={name:"Checkout::PickupPoints::RenderBefore",api(e,s){return{..._(e),...N(e),...Jn(e,s)}}},Xs={name:"Checkout::PickupPoints::RenderAfter",api(e,s){return{..._(e),...N(e),...Jn(e,s)}}},Zs={name:"purchase.checkout.pickup-location-option-item.render-after",api(e,s){return{..._(e),...N(e),...pi(e,s)}}},xs={name:"Checkout::Reductions::RenderBefore",api(e){return{..._(e),...N(e)}}},en={name:"Checkout::Reductions::RenderAfter",api(e){return{..._(e),...N(e)}}},sn={name:"Checkout::ShippingMethodDetails::RenderAfter",api(e,s){return{..._(e),...N(e),...jn(e,s)}}},nn={name:"Checkout::ShippingMethodDetails::RenderExpanded",api(e,s){return{..._(e),...N(e),...jn(e,s)}}},tn={name:"Checkout::ShippingMethods::RenderBefore",api(e,s){return{..._(e),...N(e),...qn(e,s)}}},rn={name:"Checkout::ShippingMethods::RenderAfter",api(e,s){return{..._(e),...N(e),...qn(e,s)}}},on={name:"purchase.checkout.header.render-after",api(e){return{..._(e),...N(e)}}},an={name:"purchase.checkout.footer.render-after",api(e){return{..._(e),...N(e)}}},ke={name:"purchase.checkout.chat.render",api(e){return{..._(e),...N(e)}}};function hi({extensionInstance:e,announcementEmitter:s}){return e.target!=="purchase.thank-you.announcement.render"?{}:(e.on("destroy",()=>{s.removeAllListeners()}),e.on("restart",()=>{s.removeAllListeners()}),{})}function ge({createSubscribableFromSignal:e,checkout:s,isCheckoutEditor:n,journeyCompletedSignal:t,observability:r}){return{orderConfirmation:e(S(()=>{const i=s.latestReceipt.value,o=!i||i.status!=="processed";if(o&&n)return{order:{id:yn("Order","0")},number:Bt().substring(0,10),isFirstOrder:!0};if(o){const a=t.peek()?"No receipt available on thankYou page":"No receipt available";throw i&&r.leaveErrorBreadcrumb("Receipt (OrderConfirmationApi):",{status:i.status,keys:Object.keys(i)}),new mt(a)}return{order:{id:i.orderIdentity.id},number:i.orderIdentity.buyerIdentifier??void 0,isFirstOrder:i.isFirstOrder??!0}}))}}const dn={name:"Checkout::ThankYou::Dynamic::Render",api(e){return{..._(e),...ge(e)}}},un={name:"Checkout::ThankYou::CartLineDetails::RenderAfter",api(e,s){return{..._(e),...ts(e,s),...ge(e)}}},cn={name:"Checkout::ThankYou::CartLines::RenderAfter",api(e){return{..._(e),...ge(e)}}},ln={name:"Checkout::ThankYou::CustomerInformation::RenderAfter",api(e){return{..._(e),...ge(e)}}},pn={name:"purchase.thank-you.header.render-after",api(e){return{..._(e),...ge(e)}}},fn={name:"purchase.thank-you.footer.render-after",api(e){return{..._(e),...ge(e)}}},we={name:"purchase.thank-you.chat.render",api(e){return{..._(e),...ge(e)}}},Me={name:"purchase.thank-you.announcement.render",api(e){return{..._(e),...ge(e),...hi(e)}}},Ci={[ws.name]:ws,[Ms.name]:Ms,[Cs.name]:Cs,[Vs.name]:Vs,[Us.name]:Us,[Bs.name]:Bs,[Gs.name]:Gs,[Ys.name]:Ys,[$s.name]:$s,[Fs.name]:Fs,[Hs.name]:Hs,[zs.name]:zs,[js.name]:js,[qs.name]:qs,[Ks.name]:Ks,[Qs.name]:Qs,[Zs.name]:Zs,[Ws.name]:Ws,[Xs.name]:Xs,[Js.name]:Js,[xs.name]:xs,[en.name]:en,[sn.name]:sn,[tn.name]:tn,[rn.name]:rn,[nn.name]:nn,[on.name]:on,[an.name]:an,[ke.name]:ke,[dn.name]:dn,[un.name]:un,[cn.name]:cn,[ln.name]:ln,[pn.name]:pn,[fn.name]:fn,[we.name]:we,[Me.name]:Me},Vi=[ke.name,we.name,Me.name],Ui=[ke.name,we.name,Me.name];export{Vi as D,Gr as M,Ci as R,Ui as a,M as b,C as c,re as d,ps as e,F as f,ne as g,oe as h,ve as i,j,H as k,J as l,z as m,se as n,$ as o,Mi as p,Or as q,jt as r,gs as s,wi as t,ki as u,Pi as v,Li as w,Ni as x,Oi as y,Jt as z};
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.