PageSourceSearch

https://store.geniecompany.com/cdn/shopifycloud/checkout-web/asset…ets-rendering-extension-targets.CdMbdCiY.js

js geniecompany.com collected 2026-09-24 09:28:58 UTC 92,574 bytes, 8 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["apply-cart-line-change.BJG2ANXA.js","addresses-is-address-empty.-MuOhIyI.js","esnext-vendor.D7ldIee_.js","app.A60-IfPs.js","assets/app.Sxsz5knT.css","assets/is-address-empty.DJksNKpk.css","utilities-extension-execution-errors.C94S0eIO.js","hydrate.ByRIsqvd.js","constants.DowbVE6J.js","hooks-useReplaceShopPayInHistory.Cz4PqGkk.js","assets/previous.ClThmeCv.css","dist-v4.EwEgHOG0.js","deferred-mutations-assert-cart-line-change.WgOgqKt4.js","AnnouncementRuntimeExtensions.CUaevDBz.js","QRCode.BFweZYBT.js","assets/QRCode.BZ_m5G5a.css","Checkbox.Cby2hWUV.js","assets/Checkbox.SrYMuQu4.css","Choice.Dywz6_Fr.js","hooks-useUnauthenticatedErrorModal.CzvtLqeY.js","assets/Choice.aPApdPe_.css","utilities-dates.ChO2GdxN.js","Popover.BNecjV8x.js","assets/Popover.Bi1nHaU-.css","PaymentIcon.Ddd-WnG2.js","assets/PaymentIcon.gzvCNwz_.css","NumberField.BTk3WiBo.js","assets/NumberField.CRpcZnVJ.css","Switch.aKF4dNrP.js","assets/Switch.BS8yVgoP.css","extensions-remote-dom.JXLuoF43.js","EmailField.Bx6jEWuK.js","TextArea.wcLwM1i3.js","Sheet.BMp0ktaT.js","assets/Sheet.CpR5hiDV.css","styles-floating-layer.module.CcHB2ksN.js","assets/floating-layer.DfWUBaTh.css","hooks-useForceShopPayUrl.MIxsBkT_.js","models-ShopPayBuyerDetails.model.CahX79UU.js","shop-pay-normalizeBuyerDetails.BcEhgoK7.js","context-CheckoutSheetProtocolClient.CNLSBD5p.js","hooks-useCanChangeCompanyLocation.Bk004VMP.js","PhoneField.BapDvZfY.js","hooks-useSuppressShopPayModalOnLoad.CI5bzdLE.js","assets/PhoneField.uZEuHncj.css","assets/AnnouncementRuntimeExtensions.DWE5rRxz.css","consent-manager-shared.B29itG0S.js","mobile-checkout-sdk-MobileCheckoutSdkClient.CVSnUTrf.js","performance-index.mu6MOGR9.js","apple-pay-errors.CcNuwNMC.js","apply-cart-line-change-queue.DQe1EOux.js"])))=>i.map(i=>d[i]);
2import{A as D,i as Kn,t as Re,g as Qn,d as Ce}from"./hooks-useReplaceShopPayInHistory.Cz4PqGkk.js";import{o as mn,p as je,q as yn,r as hn,s as Ae,d as Wn,U as Xn,S as is,t as vn,I as Zn,D as xn,u as gn,O as et}from"./utilities-extension-execution-errors.C94S0eIO.js";import{a7 as v,jf as st,N as nt,bW as Qe,cc as rs,dH as tt,f as os,B as Ve,dS as $e,dX as it,bf as rt,cx as ot,bh as as,be as at,j as dt,dn as ut,jg as ct,jh as lt,cT as We,ji as pt,bw as An,bk as ft,g as En,c4 as ds,c5 as us,ir as mt,aG as In}from"./addresses-is-address-empty.-MuOhIyI.js";import{dD as te,cO as yt,fz as ht,fw as Xe,gQ as vt,gR as Fe,gS as Se,gT as gt,gU as At,gV as _n,dl as fe,ay as Ie,bK as He,bL as ze,gW as Et,bB as It,gX as _t,gn as cs,gY as Rt}from"./hydrate.ByRIsqvd.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 Lt,y as he,R as Dn,a3 as Sn,r as Pt}from"./esnext-vendor.D7ldIee_.js";import{g as kt,b as wt,a as Y}from"./AnnouncementRuntimeExtensions.CUaevDBz.js";import{_ as bn}from"./app.A60-IfPs.js";import{p as Tn,c as ye,g as Mt,q as Ct}from"./consent-manager-shared.B29itG0S.js";import{e as ls}from"./performance-index.mu6MOGR9.js";import{d as Vt,c as Ut}from"./apple-pay-errors.CcNuwNMC.js";import{v as Bt}from"./dist-v4.EwEgHOG0.js";let Je,On,Nn,Ln,Pn;const kn=()=>({analytics:On(),marketing:Nn(),preferences:Ln(),saleOfData:Pn()}),Te=e=>e??[],Or=()=>{const{currentVisitorConsent:e,shouldShowBanner:s,saleOfDataRegion:n,analyticsProcessingAllowed:t,marketingAllowed:i,saleOfDataAllowed:r,preferencesProcessingAllowed:o,setTrackingConsent:a}=Dt();Je||(Je=a,Nn=i,On=t,Pn=r,Ln=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 Nr(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 Lr={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"&&st(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 yn(n):s!=null&&s>
2=400?new hn(n):Ft()&&e.includes("The string did not match the expected pattern")?new mn(n):new je(n)}function re({customerPrivacySignal:e,createSubscribableFromSignal:s,extension:n,storefrontTokens:t,applyChange:i,extensionInstance:r,checkout:o,consentManager:a}){const c=n.capabilities.collectBuyerConsent?.customerPrivacy===!0,u=te(n.approvalScopes,D.CustomerPersonalData);async function d(p){return i({unknownChange:p,extension:n,extensionInstanceId:r.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}},(...[P,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(P instanceof Error)A(new v(`Failed to set tracking consent: ${P.message}`));else if(P&&"error"in P){const ee=String(P.error),w=P.statusCode,ce=Ht(ee,w);A(ce)}else A(new je("Received unexpected callback from setTrackingConsent()"))})})}},errorResult:l=>l instanceof v||l instanceof mn||l instanceof je||l instanceof yn||l instanceof hn?{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 Pr(){const{source:e,checkout:s}=nt(),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 kr(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 r={promise:new Promise(o=>{t=o}),resolve:t};return e.set(s,r),r}function wr(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 i=e();return t?s(n,i)?n:(n=i,i):(t=!0,n=i,i)})}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(i=>e[i]===s[i])}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"],ei=["DELIVERY_COMPANY_REQUIRED","DELIVERY_COMPANY_TOO_LONG","DELIVERY_COMPANY_CONTAINS_EMOJIS","DELIVERY_COMPANY_CONTAINS_HTML_TAGS","DELIVERY_COMPANY_CONTAINS_MATHEMATICAL_SYMBOLS"],si=["DELIVERY_ADDRESS1_REQUIRED","DELIVERY_ADDRESS1_TOO_LONG","DELIVERY_ADDRESS1_CONTAINS_EMOJIS","DELIVERY_ADDRESS1_CONTAINS_HTML_TAGS","DELIVERY_ADDRESS1_CONTAINS_MATHEMATICAL_SYMBOLS"],ni=["DELIVERY_ADDRESS2_REQUIRED","DELIVERY_ADDRESS2_TOO_LONG","DELIVERY_ADDRESS2_CONTAINS_EMOJIS","DELIVERY_ADDRESS2_CONTAINS_HTML_TAGS","DELIVERY_ADDRESS2_CONTAINS_MATHEMATICAL_SYMBOLS"],ti=["DELIVERY_CITY_REQUIRED","DELIVERY_CITY_TOO_LONG","DELIVERY_CITY_CONTAINS_EMOJIS","DELIVERY_CITY_CONTAINS_HTML_TAGS","DELIVERY_CITY_CONTAINS_MATHEMATICAL_SYMBOLS"],ii=["DELIVERY_PHONE_NUMBER_REQUIRED","DELIVERY_PHONE_NUMBER_CONTAINS_EMOJIS","DELIVERY_PHONE_NUMBER_DOES_NOT_MATCH_EXPECTED_PATTERN"],ri=["DELIVERY_ZONE_REQUIRED_FOR_COUNTRY","DELIVERY_ZONE_NOT_FOUND"],oi=["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"],ai=["DELIVERY_COUNTRY_REQUIRED"],qe={firstName:Zt,lastName:xt,company:ei,address1:si,address2:ni,city:ti,provinceCode:ri,zip:oi,phone:ii,countryCode:ai,oneTimeUse:[]},di=new Map(Object.entries(qe).flatMap(([e,s])=>s.map(n=>[n,e])));function ui(e){return Object.keys(e).length===0}function M({createSubscribableFromSignal:e,extension:s,negotiated:n,proposed:t,journeyCompletedSignal:i,cartInstructionsSignal:r,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||ui(R))return;const{address1:ee,address2:w,city:ce,company:me,countryCode:le,firstName:T,lastName:b,name:L,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(L,D.CustomerName),phone:p(k,D.CustomerPhone),provinceCode:Ge,zip:p(Ye,D.CustomerAddress),oneTimeUse:De}};
2if(n.fields.isShippingRequired.value===!1)return;if(i.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:P,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:P,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(i.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(!r.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 L=Xt[T];L&&!te(s.approvalScopes,L)||(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,L)=>{if(!A.has(L.code))return b;const k=di.get(L.code);return b.concat({message:li(L),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&&!tt(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"},ci=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 li(e){return ci.get(e.code)??e.localizedMessage??e.nonLocalizedMessage}async function Ne(e){try{return await e()}catch(s){if(pi(s))return;throw s}}function pi(e){return e instanceof Wn&&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:i,extensionInstance:r,applyChange:o}){async function a(c){return o({unknownChange:c,extension:i,extensionInstanceId:r.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 fi(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 fi(e,s,n){const t=o=>{const a=o?.find(c=>c.key===e.key);return a!==void 0&&a.value===e.value},i=t(n),r=s===void 0?i:t(s);return i&&r}function ys(e,s){const n=e?[...e]:[],t=n.findIndex(({key:i})=>i===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 mi=/^\$app|^app--\d+--/,yi=/^app--\d+--/,hi=/^app--\d+$/,Le="$app",Mn=":";function vi(e){return hi.test(e)?Le:e.replace(yi,Le+Mn)}function gi(e,s){if(e.trim()===Le)return`app--${s}`;const n=Le+Mn;return e.trim().startsWith(n)?`app--${s}--${e.slice(n.length)}`:e}const Cn="2026-01";function ie({proposed:e,createSubscribableFromSignal:s,extension:n,cartInstructionsSignal:t,applyChange:i,extensionInstance:r,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 i({unknownChange:u,extension:n,extensionInstanceId:r.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."),Ai(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),Ei(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),Ii(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 Ai(e){const{key:s,namespace:n,value:t,valueType:i}=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(mi.test(n))throw new v(`Invalid property namespace: "${n}". App reserved namespaces not supported.`);switch(i){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(!_i(t))throw new v(`Invalid property value: "${t}". It must be a json_string.`);break;default:throw new v(`Invalid property valueType: "${i}". It must be in one of these values: integer, string, json_string.`)}return!0}function Ei(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:i,type:r}=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 r!="string")throw new v(`Invalid property type: "${r}". It must be a string. Received type: ${typeof r}.`);if(r==="integer"){if(typeof i!="number"&&typeof i!="string")throw new v(`Invalid property value: "${i}". It must be a number or a string when type is "integer". Received type: ${typeof i}.`)}else if(typeof i!="string")throw new v(`Invalid property value: "${i}". It must be a string when type ("${r}") is not "integer". Received type: ${typeof i}.`)}function Ii(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 _i(e){if(typeof e!="string")return!1;try{return JSON.parse(e),!0}catch{}return!1}function Ri(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()],i=e.errors.filter(c=>vt.has(c.code));if(i.length===0)return;const r=i.reduce((c,u)=>{if("target"in u){const d=Ri(u.target);d>=0&&!c[d]&&(c[d]=u)}return c},{}),o=t.findIndex((c,u)=>r[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=r[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=os(s.appId)||"unknown-app",t=os(Xe(s))||"unknown-extension";return{analytics:{publish:(i,r={})=>e.publishCustomEvent(i,r,{extension:{extensionId:t,appId:n,type:s.type||"unknown-type"}}),visitor:i=>e.visitor(i,{apiClientId:n})}}}const Di={id:"be4fa5a8e92c26d115e34073b486a58fc317388a2eedddb82d02eeccb9573278",type:"query",name:"ExtensionMetafields",source:""},As=async({withCache:e=!0,coreGraphql:s,extension:n,observability:t,negotiated:i,checkoutProfileId:r,appMetafieldsSignal:o})=>{let a=[];const c=Mt(i),u=await Ct({withCache:e,coreGraphql:s,resourceIds:c,
2checkoutProfileId:r}),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(Di,{variables:y,cache:e});h?.extensionMetafields&&(m=h?.extensionMetafields)}a=Si({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:i,createSubscribableFromSignal:r,sourceId:o,checkout:a,appMetafieldsSignal:c}){const u=Lt(()=>{As({withCache:!0,coreGraphql:e,extension:s,observability:i,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:i,negotiated:t,appMetafieldsSignal:c,checkoutProfileId:a.configuration.profileId.value})}finally{ls.markFinished("app-metafields-load",d)}})(),{appMetafields:r(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&&gi(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")?vi(s):s}function Si({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 i=[];for(const r of s){if(!bi(t,r.ownerType))continue;const o=Ke(t.apiVersion,r.namespace);i.push({target:Ti(r.ownerId,r.ownerType),metafield:{key:r.key,namespace:o,value:r.value,type:r.type.toLowerCase(),valueType:r.valueType.toLowerCase()}})}return i}function bi(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 Ti(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(i=>{throw new Xn(`Metafield ownerType "${s}" with id "${e}" cannot be resolved`)})()}}function se({publicCheckoutSessionId:e,createSubscribableFromSignal:s}){return{checkoutToken:s(he(e))}}function Oi(e){return{initial:e.current,subscribe(n){Dn(n);const t=e.subscribe((r=e.current)=>n(r));return[()=>{t(),Sn(n)},e.current]}}}function H({extension:e,extensionInstance:s,createSubscribableFromSignal:n,isCheckoutEditor:t,observability:i}){const r=S(()=>{const a=e.behaviors.value,c=new Set;return a.blockProgress||c.add("blockProgress"),Ni(e.capabilities,c)}),o=Oi({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 i.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(r),editor:t?{type:"checkout"}:void 0,target:s.target}}function Ni(e,s){const n=[];return Object.keys(e).forEach(t=>{const i=t;i in e&&(typeof e[i]!="object"&&!s.has(i)&&e[i]&&n.push(Fe(i)),typeof e[i]=="object"&&Object.entries(e[i]).forEach(([r,o])=>{if(Array.isArray(o)&&o.length>0||!Array.isArray(o)&&o){const a=`${Fe(t)}.${Fe(r)}`;n.push(a)}}))}),n}function z({locale:e,currencySignal:s,timezone:n,extension:t,createSubscribableFromSignal:i,negotiated:r}){return{localization:{language:i(he({isoCode:e})),extensionLanguage:i(he({isoCode:t.extensionLocale})),currency:i(s),timezone:i(he(n??new Intl.DateTimeFormat().resolvedOptions().timeZone)),country:i(S(()=>{const o=r.fields.buyerIdentity.value?.countryCode;if(o)return{isoCode:o}})),market:i(S(()=>{const o=r.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:i,extensionInstance:r}){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 i.get(s.appId,s.type,"fetchWithToken");if(!p)throw new it(`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?(i.cache.delete(i.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:r.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:r.id});try{return await p.json()}catch(f){throw new is("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 is&&(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:r.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?Li(e.storefrontUrl):void 0,myshopifyDomain:e.myshopifyDomain}}function Li(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=rt.ExtensionStorage,n=i=>`${e}-${i}`,t=()=>at(s)??{};return{async read(i){Se(typeof i=="string",'Missing "key" argument. Please pass a key to read from to storage.');const r=n(i),o=t();return Object.keys(o).length&&o[r]||null},async write(i,r){Se(typeof i=="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 "${i}" `);
6const o=n(i),a=t();a[o]=r,as(s,a)},async delete(i){Se(typeof i=="string",'Missing "key" argument. Please pass a key to delete from storage.');const r=n(i),o=t();delete o[r],Object.keys(o).length===0?ot(s):as(s,o)}}}function Mr(e){return e}function Pi(e,s){return e.filter(n=>dt(n)&&n.discount.presentationLevel===s).map(n=>{const{discount:t,amount:i,title:r}=n;return t.type==="code"?{type:"code",code:r,discountedAmount:i}:t.type==="automatic"?{type:"automatic",title:r,discountedAmount:i}:{type:"custom",title:r,discountedAmount:i}})}function ki(e,s){return e.filter(n=>ut(n.discountDetails.discount)&&n.discountDetails.discount.presentationLevel===s).map(n=>{const{discount:t,title:i}=n.discountDetails;return t.type==="code"?{type:"code",code:i,discountedAmount:n.amount}:t.type==="automatic"?{type:"automatic",title:i,discountedAmount:n.amount}:{type:"custom",title:i,discountedAmount:n.amount}})}const wi=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:i,applyChange:r,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?Pi(p,"CART"):[]})),d=["non-merchandise"];return{discountCodes:c,discountAllocations:u,async applyDiscountCodeChange(p){return r({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(!i.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"&&ct(t.targetEntity)?.title!==s))return wi.has(t.code)});if(n)throw new v(n.nonLocalizedMessage,{cause:{code:n.code}})}function Mi({extension:e,checkout:s}){return{experimentalIsShopAppStyle:kt({allowLocal:!0,extension:e})?s.identity.current.value==="shopPay":void 0}}const Ci=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_INVA
6LID_GIFT_CARD_CODE","PAYMENTS_INSTALLMENTS_GIFT_CARD_NOT_ALLOWED","PAYMENTS_GIFT_CARDS_UNAVAILABLE"]);function U({negotiated:e,proposed:s,extension:n,createSubscribableFromSignal:t,shop:i,applyChange:r,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 r({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=i.hasFlagEnabled(lt);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=Vi(s),t=e.findIndex(({method:r})=>r.type!=="giftCard"?!1:s.length===4?r.code.toLowerCase().slice(-4)===n.slice(-4):r.code.toLowerCase()===n);if(t===-1)return e;const i=[...e];return i.splice(t,1),i}function Vi(e){return e.replace(/[\s-]/g,"").toLowerCase()}function Ss(e){const s=e.errors.find(n=>Ci.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??=Pt(e).catch(i=>{throw s=void 0,i}),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:Ui(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:ki(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(i=>({key:i.name,value:String(i.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:Bi(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 Ui(e){return`gid://shopify/CartLine/${e}`}function Ts(e){return`gid://shopify/CartLineComponent/${e}`}function Bi(e){return`gid://shopify/PresentmentCartLine/${e}`}const Gi="merchandiseError:",Yi=Bn(()=>bn(()=>import("./apply-cart-line-change.BJG2ANXA.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,49]))),$i=Bn(()=>bn(()=>import("./apply-cart-line-change-queue.DQe1EOux.js"),__vite__mapDeps([50,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,49])));function B({negotiated:e,proposed:s,createSubscribableFromSignal:n,extension:t,stableDetourSignal:i,cartInstructionsSignal:r,cartLineChangeLoadingSignal:o,observability:a,applyChange:c,extensionInstance:u,isCheckoutEditor:d,shop:p}){const l=p.hasFlagEnabled(pt)?Yi:$i;l.preload();async function f(m,y){return o.value=!0,(await l.load()).applyCartLineChange({change:m,negotiated:e,proposed:s,stableDetourSignal:i,cartInstructionsSignal:r,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=>!An(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(Gi)?{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:i,applyChange:r,extensionInstance:o}){return{note:n(e.note),async applyNoteChange(c){return r({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 Fi(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(),Hi(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(!i.peek().notes.canUpdateNote)throw new v(ve("applyNoteChange","notes"))}}function Fi(e,s,n){const t=e||void 0;return s===t&&(n||void 0)===t}function Hi(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:i}=G(e),{applyMetafieldChange:r}=ie(e),{applyDiscountCodeChange:o}=V(e),{applyGiftCardChange:a}=U(e),{applyShippingAddressChange:c}=M(e),{experimentalIsShopAppStyle:u}=Mi(e);switch(s.apiVersion){case"2023-04":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:a};case"2023-07":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2023-10":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2024-01":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2024-04":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2024-07":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2024-10":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2025-01":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2025-04":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2025-07":case"unstable":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2025-10":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2026-01":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2026-04":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2026-07":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2026-10":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,applyDiscountCodeChange:o,applyGiftCardChange:a,applyShippingAddressChange:c,experimentalIsShopAppStyle:u};case"2027-01":return{applyAttributeChange:n,applyCartLinesChange:t,applyNoteChange:i,applyMetafieldChange:r,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 zi({negotiated:e,createSubscribableFromSignal:s,observability:n}){return{presentmentLines:s(S(()=>{const t=e.fields.merchandiseLines.value;return t?t.lines.flatMap(i=>i.variantId?_n(i).map(r=>Gn(r)):(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 i=e.fields.buyerIdentity.value?.customerProfile;if(i?.__typename==="CustomerProfile"||i?.__typename==="BusinessCustomerProfile"){const r=te(t.approvalScopes,D.CustomerEmail),o=te(t.approvalScopes,D.CustomerPhone),a=te(t.approvalScopes,D.CustomerName),c=i?.__typename==="CustomerProfile"?i.storeCreditAccounts.map(u=>({...u,balance:u.balance})):[];return{id:i.id,email:r?i.email??void 0:void 0,phone:o?i.phone??void 0:void 0,fullName:a?i.fullName??void 0:void 0,firstName:a?i.firstName??void 0:void 0,lastName:a?i.lastName??void 0:void 0,image:{url:i.imageUrl},acceptsMarketing:i.acceptsEmailMarketing,acceptsEmailMarketing:i.acceptsEmailMarketing,acceptsSmsMarketing:i.acceptsSmsMarketing,storeCreditAccounts:c,ordersCount:i.ordersCount??0}}})),email:s(S(()=>
6{if(!te(t.approvalScopes,D.CustomerEmail))return;const r=n.email.value,o=e.fields.buyerIdentity.value?.customerProfile?.email,a=e.fields.contactInfo.value?.email;return r||o||a})),phone:s(S(()=>{if(!te(t.approvalScopes,D.CustomerPhone))return;const r=n.phone.value,o=e.fields.buyerIdentity.value?.customerProfile?.phone,a=e.fields.contactInfo.value?.phone;return r||o||a})),purchasingCompany:s(S(()=>{const i=e.fields.buyerIdentity.value?.purchasingCompany;if(i)return{company:{id:i.company.id,name:i.company.name,externalId:i.company?.externalId},location:{id:i.location.id,name:i.location.name,externalId:i.location?.externalId}}}))}}:{buyerIdentity:void 0}}const ji=3e4,_e={behavior:"allow"};function K({extension:e,extensionInstance:s,proposal:n,captureEvent:t,journeyCompletedSignal:i,sourceType:r,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=[],P={interceptorKey:I,extension:e,captureEvent:t,sourceType:r,observability:f,activeRaces:A,extensionInstance:s,suppressMalformedInterceptionErrors:e.type==="persisted"||e.type==="global"},R=Ji(E,P),ee=async b=>{switch(b){case"registration":return await R({requiresRenderToBlock:!1}),_e;case"negotiation":{const L=await R({requiresRenderToBlock:!0});if(!L)return _e;const{perform:k}=L.interceptorRunResponse;return L.isBlocking?{behavior:"allow",errors:L.interceptorRunResponse.errors,perform:k&&Ee(()=>k({behavior:"allow"}),P)}:{behavior:"allow",perform:k&&Ee(()=>k({behavior:"allow"}),P)}}case"progression":case"completion":{const L=await R({requiresRenderToBlock:!0});if(!L)return _e;const{perform:k}=L.interceptorRunResponse;if(L.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:L.interceptorRunResponse.errors,perform:k&&Ee(()=>k({behavior:"block"}),P)}}return t("extensionBuyerJourneyBlock",{behavior:"block",reason:L.interceptorRunResponse.reason,extension:e,section:"extension",timestamp:new Date,validationErrors:L.interceptorRunResponse.errors??[]}),f.debug("extensions_buyer_journey_intercepted","[Extensions::BuyerJourneyIntercept] Blocked checkout progress",{...ps(e),errors:L.interceptorRunResponse.errors,reason:L.interceptorRunResponse.reason}),{behavior:"block",reason:ft.InvalidExtensionState,errors:L.interceptorRunResponse.errors,perform:k&&Ee(()=>k({behavior:"block"}),P),context:{extension:fe(e)}}}return{behavior:"allow",perform:k&&Ee(()=>k({behavior:"allow"}),P)}}default:return b}},w=n.intercept(({reason:b})=>ee(b));Ki({interceptorRegistrationResolvers:h,interceptorRegistration:g,extension:e,sourceType:r,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:L}=b.interceptorRunResponse;L&&await Ee(()=>L({behavior:"block"}),P)()};ee("registration").then(ce).catch(b=>{f.error(b,{metadata:{extension:fe(e),source:{type:r}}})});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(i),steps:o(S(()=>{if(i.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,P=E.filter(({skipOverPage:w})=>!w||!w(O)),R=P.findIndex(w=>w.id===I?.id),ee=P.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(i.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:i,extension:r}=s,o=s.duration??ji,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(()=>{i("extensionInteraction",{interaction:"buyerJourneyInterceptor",extension:r,section:"extension",timestamp:new Date,duration:performance.now()-a,extensionInstanceId:n}),clearTimeout(u)})]),t}function Ji(e,s){return async({requiresRenderToBlock:n})=>{const{interceptorKey:t,extension:i,captureEvent:r,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=i.capabilities.blockProgress&&i.behaviors.value.blockProgress,l=(async()=>{try{return await e({canBlockProgress:p})}catch(y){return a.error(new vn(`Error in buyer journey interceptor callback: ${y}`,{cause:y}),{metadata:{extension:fe(i),source:{type:o}}}),{behavior:"allow",perform:()=>{}}}})(),f=Yn(l,{captureEvent:r,extension:i,onTimeout:()=>(a.error(new v("buyer journey interceptor callback timed out"),{metadata:{extension:fe(i),source:{type:o}}}),_e)},u.id);c.push(f);let m;try{m=await f.finished,qi(i,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:i,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:i,sourceType:r,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(i),source:{type:r}}})}})();return async()=>{const d=Yn(u,{captureEvent:t,extension:i,onTimeout:()=>{n.error(new v("perform() in buyer journey interceptor timed out"),{metadata:{extension:fe(i),source:{type:r}}})}},a.id);o.push(d),await d.finished}}function qi(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 Zn(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:i}=e;return{handle:n,to:t,label:i,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 Ki({interceptorRegistrationResolvers:e,interceptorRegistration:s,extension:n,sourceType:t,observability:i}){if(s){qt(e,n.id,s);return}i.error(new vn("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,i=t?{id:t.id,name:t.translatedName,dueDate:t.dueDate||void 0,dueInDays:t.dueInDays||void 0}:void 0,r=e.fields.checkoutCompletionTarget.value,o=r||"ORDER",a=n?.__typename==="BusinessCustomerProfile"&&n.checkoutExperienceConfiguration?n.checkoutExperienceConfiguration.editableShippingAddress:!0;return{orderSubmission:o,shippingAddress:{isEditable:a},paymentTermsTemplate:i}}))}}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(r=>An(r.stableId,s))})}function W({negotiated:e,isOnePageCheckout:s,createSubscribableFromSignal:n}
8){return{cost:{subtotalAmount:n(e.fields.subtotal),totalShippingAmount:n(S(()=>{const t=e.fields.deliveryNext.value,i=e.fields.remoteMerchandiseDetails.value;if(t?.status!=="filled")return;const r=Be(t.lines,i),o=Qi(r,!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 Qi(e,s){return e.reduce((n,t)=>{if(t.status==="not_required")return n;const{methods:i,selectedDeliveryMethodHandle:r}=t,o=i.find(({handle:u})=>r===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:Xi(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:Zi(e),code:e.code||"",metafields:n||[]}}
8function Wi(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 Xi(e){return e==="LOCAL"?"local":"shipping"}function Zi(e){return{timeInTransit:xi(e.estimatedTimeInTransit)}}function xi(e){if(e)return typeof e=="number"?{lower:e,upper:e}:{lower:e.lower,upper:e.upper}}function er({line:e,extensionContext:s,observability:n,proposedSelectedDeliveryMethodHandles:t,lines:i}){if(e.status==="available"){const r=nr(e.methods,n,s);return{targetedCartLines:Ls(e.targetMerchandiseLines??[],i),deliveryOptions:r,selectedDeliveryOption:sr(e,r,t),groupType:Ie(e.type),isDeliveryRequired:!0,id:Ps(e.id)}}else return{targetedCartLines:Ls(e.targetMerchandiseLines,i),deliveryOptions:[],selectedDeliveryOption:void 0,groupType:Ie(e.type),isDeliveryRequired:!1,id:Ps(e.id)}}function Ls(e,s){return s?s.filter(t=>e.some(i=>i.stableId===t.stableId)).flatMap(({lineAllocations:t})=>t.map(i=>({id:`gid://shopify/CartLine/${i.stableId}`}))):[]}function sr(e,s,n){if(s.length===0)return;const t=e.methods.map(o=>o.handle),r=n.find(o=>o&&t.includes(o))||e.selectedDeliveryMethodHandle;return r?{handle:r}:void 0}function nr(e,s,n){return e.map(t=>{switch(t.methodType){case"SHIPPING":case"LOCAL":return Fn(t,n);case"PICK_UP":return tr(t,s,n);case"PICKUP_POINT":return rr(t,s,n);case"RETAIL":case"NONE":return;default:{const i=`Unknown delivery method type: ${t.methodType}`;s?.error(new es(i),{metadata:{deliveryMethod:{type:t.methodType,handle:t.handle}}});return}}}).filter(t=>t!=null)}function tr(e,s,n){const t=ir(e,s);if(t==null)return;const i=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:i||[]}}function ir({pickupLocation:e,methodType:s},n){if(e?.type==="PickupInStoreLocation"){const{address:i}=e;return{name:e?.name,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 rr(e,s,n){const t=dr(e,s);if(t==null)return;const i=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:or(e),code:ar(e)},location:t,metafields:i||[]}}function or({pickupLocation:e}){if(e?.type==="PickupPointLocation")return e.carrierName}function ar({pickupLocation:e}){if(e?.type==="PickupPointLocation")return e.carrierCode}function dr({pickupLocation:e,methodType:s},n){if(e?.type==="PickupPointLocation"){const{name:i,address:r,handle:o}=e;return{name:i,handle:o,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 xe(e){const s=e?.coordinates;return s?.latitude==null||s.longitude==null?{}:{latitude:s.latitude,longitude:s.longitude}}function Ps(e){if(e)return En("DeliveryGroup",Ve(e))}class es extends Error{constructor(s){super(s),this.name="DeliveryError"}}class Pe{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 Pe?n:new Pe(s,n)}counter(...s){this.observability.counter(...s)}
8gauge(...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)}monorailEvent(...s){this.observability.monorailEvent(...s)}refineryEvent(...s){this.observability.refineryEvent(...s)}async exportMetrics(){await this.observability.exportMetrics()}async exportLogs(){await this.observability.exportLogs()}addAttributesForLogs(...s){this.observability.addAttributesForLogs(...s)}enableKeepAlive(){return this.observability.enableKeepAlive()}async emitMonorailEvents(){await this.observability.emitMonorailEvents()}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:i}){const r=s?new ss(s):void 0;return er({line:e,extensionContext:r,observability:Pe.wrapClient(s,n),proposedSelectedDeliveryMethodHandles:t,lines:i})}function ur(e,s){return Wi(e,new ss(s))}function X({extension:e,negotiated:s,proposed:n,observability:t,createSubscribableFromSignal:i}){return{deliveryGroups:i(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 xn(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 i=s.localizationExtensions.value;return i?i.map(({fields:r})=>({key:r.key.value,title:r.title.value,value:r.value.value??""})):(t.value.localizationExtensions||[]).map(({key:r,title:o,value:a})=>({key:r,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,i=s.paymentLines.value,r=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=ds(u),p=us(d,i,t,{negotiatedPaymentLines:r?.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,i=e.fields.paymentMethods.value,r=e.fields.paymentLines.value,o=e.fields.deferredTotal.value;if(!i)return[];const a=ds(t);return us(a,t,i,{negotiatedPaymentLines:r?.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 i=H(e),{attributes:r}=C(e),{lines:o}=B(e),{presentmentLines:a}=zi(e),{note:c}=G(e),{metafields:u}=ie(e),{discountAllocations:d,discountCodes:p}=V(e),{appliedGiftCards:l}=U(e),{shippingAddress:f}=M(e);return{version:n.apiVersion,extensionPoint:t.target,extension:{...i,apiVersion:i.apiVersion,target:i.target,capabilities:i.capabilities},settings:J(e),shop:be(s),appliedGiftCards:l,attributes:r,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 i=H(e),{attributes:r}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=ie(e),{discountAllocations:u,discountCodes:d}=V(e),{appliedGiftCards:p}=U(e),{shippingAddress:l}=M(e);return{version:n.apiVersion,extensionPoint:n.extensionPoint.target,extension:{...i,apiVersion:i.apiVersion,target:i.target,capabilities:i.capabilities},settings:J(e),shop:be(s),appliedGiftCards:p,attributes:r,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 i=H(e),{attributes:r}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=ie(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:{...i,apiVersion:i.apiVersion,target:i.target,capabilities:i.capabilities},settings:J(e),shop:be(s),appliedGiftCards:p,attributes:r,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 i=H(e),{attributes:r}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=ie(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:{...i,apiVersion:i.apiVersion,target:i.target,capabilities:i.capabilities},settings:J(e),shop:be(s),appliedGiftCards:p,attributes:r,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 i=H(e),{attributes:r}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=ie(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:{...i,apiVersion:i.apiVersion,target:i.target,capabilities:i.capabilities},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,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),...re(e)}}case"2024-07":{const i=H(e),{attributes:r}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=ie(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:{...i,apiVersion:i.apiVersion,target:i.target,capabilities:i.capabilities},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,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),...re(e),...de(e)}}case"2024-10":{const i=H(e),{attributes:r}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=ie(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:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,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),...re(e),...de(e)}}case"2025-01":{const i=H(e),{attributes:r}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=ie(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:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,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),...re(e),...de(e),...pe(e)}}case"2025-04":{const i=H(e),{attributes:r}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=ie(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:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,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),...re(e),...de(e),...pe(e)}}case"2025-07":case"unstable":{const i=H(e),{attributes:r}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=ie(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:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,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),...re(e),...de(e),...pe(e)}}case"2025-10":{const i=H(e),{attributes:r}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=ie(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:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,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),...re(e),...de(e),...pe(e)}}case"2026-01":{const i=H(e),{attributes:r}=C(e),{lines:o}=B(e),{note:a}=G(e),{metafields:c}=ie(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:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:p,attributes:r,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),...re(e),...de(e),...pe(e)}}case"2026-04":{const i=H(e),{attributes:r}=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:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:d,attributes:r,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),...re(e),...de(e),...pe(e)}}case"2026-07":{const i=H(e),{attributes:r}=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:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:d,attributes:r,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),...re(e),...de(e),...pe(e)}}case"2026-10":{const i=H(e),{attributes:r}=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:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:d,attributes:r,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),...re(e),...de(e),...pe(e)}}case"2027-01":{const i=H(e),{attributes:r}=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:{...i,apiVersion:i.apiVersion,target:i.target},settings:J(e),shop:oe(s),appliedGiftCards:d,attributes:r,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),...re(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{...cr(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 r=s.fields.merchandiseLines.value,o=Et({stableId:n,merchandiseLines:r?.lines??[]});if(o===null&&!t)throw new gn("No merchandise item found");return o!==null&&(t=Ze(o)),t}))}}function cr({createSubscribableFromSignal:e,negotiated:s},n){let t;return{target:e(S(()=>{const r=s.fields.merchandiseLines.value,o=It(n,r?.lines??[]);if(o===null&&!t)throw new gn("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:i,bankIdNumberSignal:r},{paymentMethodIdentifier:o}){const a=te(s.approvalScopes,D.CheckoutExtensionPayments);async function c(u){return e({unknownChange:u,extension:s,extensionInstanceId:i.id,handlers:{async updatePaymentMethodAttributes({change:d}){if(!a)throw new v(lr);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(r):void 0}}const lr="Access denied: the extension does not have the required approval scopes";function pr({createSubscribableFromSignal:e,extension:s,negotiated:n,proposal:t},i){let r;const o=i?.handle,a=e(S(()=>{const u=n.fields.deliveryNext.value;if(!u||u.status!=="filled")return r;const l=u.lines.filter(f=>f.status==="available").flatMap(f=>f.methods).find(f=>f.handle===o);if(l){const f=ur(l,s);r=Qe(r,f)?r:f}return r})),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 fr({extension:e,negotiated:s,applyChange:n,extensionInstance:t},{paymentMethodIdentifier:i,submitRedeemablePaymentLine:r}){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:i,maskedIdentifier:mr(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(r){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 r(h,g),I=E&&(E.status==="error"&&E.violations.some(mt)||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 mr(e){return e.slice(0,-4).replace(/./g,"•")+e.slice(-4)}function Jn({createSubscribableFromSignal:e,extension:s,negotiated:n,proposal:t},{handle:i,isInModal:r}){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===i);if(m){const y=Fn(m,d);o=Qe(o,y)?o:y}return o}
8)),c=e(S(()=>t.parts.deliveryLines.value.some(p=>i===p.fields.deliveryMethodHandle.value)));return{target:a,isTargetSelected:c,renderMode:{overlay:r??!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 yr(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:i},{includeDeliverySelectionGroups:r,groupType:o}){return{target:e(S(()=>{const a=i.fields.deliveryNext.value;if(!o||a?.status!=="filled")return;const c=i.fields.remoteMerchandiseDetails.value,u=a.lines.filter(In),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=i.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(!r||!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 yr({createSubscribableFromSignal:e,observability:s,extension:n,proposed:t,negotiated:i},{groupType:r}){return{target:e(S(()=>{const o=i.fields.deliveryNext.value;if(!r||o?.status!=="filled")return;const a=i.fields.remoteMerchandiseDetails.value,c=o.lines.filter(In),d=Be(c,a).filter(({type:h})=>Ie(h)===r),l=t.deliveryLines.value.filter(h=>Ie(h.fields.type.value)===r).map(h=>h.fields.deliveryMethodHandle.value),f=i.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),...fr(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),...pr(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 hr({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:i}){return{orderConfirmation:e(S(()=>{const r=s.latestReceipt.value,o=!r||r.status!=="processed";if(o&&n)return{order:{id:En("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 r&&i.leaveErrorBreadcrumb("Receipt (OrderConfirmationApi):",{status:r.status,keys:Object.keys(r)}),new et(a)}return{order:{id:r.orderIdentity.id},number:r.orderIdentity.buyerIdentifier??void 0,isFirstOrder:r.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),...hr(e)}}},Cr={[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},Vr=[ke.name,we.name,Me.name],Ur=[ke.name,we.name,Me.name];export{Vr as D,Gi as M,Cr as R,Ur as a,M as b,C as c,ie as d,ps as e,F as f,ne as g,oe as h,ve as i,J as j,H as k,j as l,z as m,se as n,$ as o,Mr as p,Oi as q,Jt as r,gs as s,wr as t,kr as u,Lr as v,Pr as w,Nr as x,Or 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.