1import{G as e}from"./2c1ab0fe.Bywc2Brn.js";import{ck as t,ep as r,eq as a,er as n,cj as i,ag as o,es as s,K as d,et as c,eu as l,a8 as u}from"./9dba8418.DInoCEzY.js";import{h as p,e as m,g as h,p as y,b as g,o as f,t as P,c as b}from"./2255f8fa.8KqxH4Pm.js";import{r as v}from"./2bac2c53.gEGJwgcc.js";import{e as T}from"./5ef0d995.DR0j0v0l.js";import"./app.D2wFhSFv.js";class A extends Error{constructor(){super(...arguments),this.name="ReceiptError"}}function k(i,o={pollingTimeoutReached:!1,skipToThankYouPage:!1,waitingForPostPurchaseDone:!1}){if(p(i))return m(i);switch(i.__typename){case"ProcessingRemoteCheckoutsReceipt":return{status:"processing_remote_checkouts",id:i.id,pollAt:Date.now()+i.pollDelay+n,remoteCheckouts:(S=i.remoteCheckouts,S.map(t=>{switch(t.__typename){case"SubmittingRemoteCheckout":return{status:"submitting",shopId:t.shopId};case"SubmittedRemoteCheckout":return{status:"submitted",shopId:t.shopId};case"FailedRemoteCheckout":return{status:"failed",shopId:t.shopId};default:return e(t)}}))};case"ProcessedReceipt":{if(i.postPurchasePageRequested&&"NOT_READY"===i.postPurchaseVaultedPaymentMethodStatus&&!o.pollingTimeoutReached)return{status:"polling_for_order",id:i.id,token:i.token};const e={amount:parseFloat(i.purchaseOrder.totalAmountToPay.amount),currencyCode:i.purchaseOrder.totalAmountToPay.currencyCode},n=h(i.purchaseOrder.note);return{status:"processed",id:i.id,token:i.token,redirectUrl:i.redirectUrl||null,mapUrl:i.mapUrl??null,mapVisibility:i.mapVisibility,pickupMap:O(i.pickupMap),confirmationPage:{url:i.confirmationPage.url,shouldRedirect:i.confirmationPage.shouldRedirect},analytics:{checkoutCompletedEventId:i.analytics?.checkoutCompletedEventId||null,emitConversionEvent:i.analytics?.emitConversionEvent||!1},orderIdentity:{buyerIdentifier:i.orderIdentity.buyerIdentifier,id:i.orderIdentity.id},paymentDetails:{paymentCardBrand:i.paymentDetails?.paymentCardBrand,creditCardLastFourDigits:i.paymentDetails?.creditCardLastFourDigits,paymentAmount:i.paymentDetails?.paymentAmount?.amount,paymentCurrency:i.paymentDetails?.paymentAmount?.currencyCode,paymentGateway:i.paymentDetails?.paymentGateway,financialPendingReason:i.paymentDetails?.financialPendingReason,paymentDescriptor:i.paymentDetails?.paymentDescriptor,buyerActionInfo:i.paymentDetails?.buyerActionInfo??void 0,paymentIcon:i.paymentDetails?.paymentIcon,installmentDetails:i.paymentDetails?.installmentDetails??void 0},purchaseOrder:{email:M(i.purchaseOrder.buyerIdentity),phone:R(i.purchaseOrder.buyerIdentity),checkoutCompletionTarget:i.purchaseOrder.checkoutCompletionTarget,shippingAddress:_(i.purchaseOrder.delivery,i.completedRemoteCheckouts),billingAddress:C(i.purchaseOrder.payment,i.completedRemoteCheckouts),paymentLines:B(i.purchaseOrder.payment.paymentLines),deliveryNext:L(i.purchaseOrder.delivery,n,i.completedRemoteCheckouts),deliveryExpectations:(l=i.purchaseOrder.deliveryExpectations,l?{status:"filled",deliveryExpectationLines:l.map(e=>({deliveryOptionHandle:void 0,deliveryStrategyHandle:e.deliveryStrategyHandle,brandedPromise:e.brandedPromise?{name:e.brandedPromise.name,logoUrl:e.brandedPromise.logoUrl,handle:e.brandedPromise.handle,darkThemeLogoUrl:e.brandedPromise.darkThemeLogoUrl,lightThemeLogoUrl:e.brandedPromise.lightThemeLogoUrl}:void 0,minDeliveryDateTime:void 0,maxDeliveryDateTime:void 0,deliveryExpectationPresentmentTitle:e.deliveryExpectationPresentmentTitle,promiseProviderApiClientId:void 0,returnability:e.returnability?.returnable}))}:{status:"unavailable",deliveryExpectationLines:null}),paymentDue:y(i.purchaseOrder.payment,e),runningTotal:e,merchandiseLines:T(i.purchaseOrder.merchandise),totalTaxes:i.purchaseOrder.tax.totalTaxAmountV2?U(i.purchaseOrder.tax.totalTaxAmountV2):void 0,metafields:i.purchaseOrder.metafields,cartMetafields:i.purchaseOrder.cartMetafields},purchaseOrderNumber:i.poNumber??void 0,orderStatusPageUrl:i.orderStatusPageUrl,orderCreationStatus:(c=i.orderCreationStatus,"OrderCreationSucceeded"===c.__typename?{status:"created"}:{status:"processing"}),postPurchasePageUrl:i.postPurchasePageUrl,postPurchaseVaultingStatus:q(i.postPurchaseVaultedPaymentMethodStatus),postPurchasePageRequested:i.postPurchasePageRequested,shopPayArtifact:{optIn:i.purchaseOrder.shopPayArtifact?.optIn??void 0},shopAppLinksAndResources:{qrCodeUrl:i.shopAppLinksAndResources.qrCodeUrl,mobileUrl:i.shopAppLinksAndResources.mobileUrl,orderTrackingMobileUrl:i.shopAppLinksAndResources?.orderTrackingMobileUrl??void 0,canTrackOrderUpdates:i.shopAppLinksAndResources.canTrackOrderUpdates,shopInstallmentsViewSchedules:i.shopAppLinksAndResources.shopInstallmentsViewSchedules,installmentsHighlightEligible:i.shopAppLinksAndResources.installmentsHighlightEligible,shopInstallmentsMobileUrl:i.shopAppLinksAndResources.shopInstallmentsMobileUrl,mobileUrlAttributionPayload:i.shopAppLinksAndResources.mobileUrlAttributionPayload,shopAppEligible:i.shopAppLinksAndResources.shopAppEligible,payEscrowMayExist:Boolean(i.shopAppLinksAndResources.payEscrowMayExist),shopAppQrCodeKillswitch:i.shopAppLinksAndResources.shopAppQrCodeKillswitch,shopPayOrder:i.shopAppLinksAndResources.shopPayOrder,buyerHasShopApp:i.shopAppLinksAndResources?.buyerHasShopApp??void 0,buyerHasShopPay:i.shopAppLinksAndResources?.buyerHasShopPay??void 0,buyerHasOrderTrackingPush:i.shopAppLinksAndResources?.buyerHasOrderTrackingPush??void 0,orderTrackingPushCtaVariant:i.shopAppLinksAndResources?.orderTrackingPushCtaVariant??void 0,orderUpdateOptions:i.shopAppLinksAndResources.orderUpdateOptions,giveawayAmount:i.shopAppLinksAndResources.giveawayAmount?{amount:parseFloat(i.shopAppLinksAndResources.giveawayAmount.amount),currencyCode:i.shopAppLinksAndResources.giveawayAmount.currencyCode}:void 0},skipToThankYouPage:Boolean(o.skipToThankYouPage),waitingForPostPurchaseDone:!1,eligibleForMarketingOptIn:i.eligibleForMarketingOptIn,paymentExtensionBrand:i.paymentExtensionBrand,lpmDisclosure:i.lpmDisclosure??void 0,recurringTotals:v(i.purchaseOrder.recurringTotals),deferredTotal:a(i.purchaseOrder.deferredTotal??void 0),checkoutTotalBeforeTaxesAndShipping:i.purchaseOrder.checkoutTotalBeforeTaxesAndShipping?t(i.purchaseOrder.checkoutTotalBeforeTaxesAndShipping):void 0,checkoutTotal:t(i.purchaseOrder.checkoutTotal),checkoutTotalTaxes:i.purchaseOrder.checkoutTotalTaxes?t(i.purchaseOrder.checkoutTotalTaxes):void 0,taxes:P({...i.purchaseOrder.tax,totalTaxAmount:i.purchaseOrder.tax.totalTaxAmountV2??void 0}),legacyRepresentProductsAsFees:i.purchaseOrder.legacyRepresentProductsAsFees,totalSavings:t(i.purchaseOrder.totalSavings),subtotal:t(i.purchaseOrder.subtotalBeforeTaxesAndShipping),landedCostDetails:i.purchaseOrder.landedCostDetails?.incotermInformation??void 0,dutiesIncluded:i.purchaseOrder.dutiesIncluded??void 0,duties:(d=i.purchaseOrder.tax.totalDutyAmount,d?{status:"available_total",totalDuty:t(d)}:{status:"unavailable",reason:""}),paymentFlexibilityPaymentTermsTemplate:i.paymentFlexibilityPaymentTermsTemplate??void 0,optionalDuties:i.purchaseOrder.optionalDuties?f(i.purchaseOrder.optionalDuties):void 0,discountLines:(s=i.purchaseOrder.discounts,{lines:s.lines.map(N).filter(e=>Boolean(e))}),tipLines:(k=i.purchaseOrder.tip,k.tipLines.map(e=>({amount:t(e.amount)}))),hasOnlyDeferredShipping:i.purchaseOrder.hasOnlyDeferredShipping,acceptEmailMarketing:(b=i.purchaseOrder.buyerIdentity,W(b)??b.marketingConsent.some(e=>"PurchaseOrderEmailContactMethod"===e.__typename)),acceptSmsMarketing:G(i.purchaseOrder.buyerIdentity),smsMarketingPhone:H(i.purchaseOrder.buyerIdentity),note:i.purchaseOrder.note.message??void 0,paymentMethods:j(i.purchaseOrder.payment.paymentLines),customerId:i.customerId??void 0,isFirstOrder:i.isFirstOrder??void 0,isRedacted:i.isRedacted,buyerIdentity:i.purchaseOrder.buyerIdentity?g(i.purchaseOrder.buyerIdentity):void 0,subtotalAfterMerchandiseDiscounts:i.purchaseOrder.subtotalAfterMerchandiseDiscounts?t(i.purchaseOrder.subtotalAfterMerchandiseDiscounts):void 0,subtotalBeforeReductions:t(i.purchaseOrder.subtotalBeforeReductions),customAttributes:i.purchaseOrder.note?.customAttributes??void 0,legacySubtotalBeforeTaxesShippingAndFees:t(i.purchaseOrder.legacySubtotalBeforeTaxesShippingAndFees),legacyMerchandiseLinesAsFees:r(i.purchaseOrder.legacyAggregatedMerchandiseTermsAsFees),consolidatedProposedSubtotalBeforeTaxesAndShipping:i.consolidatedProposedSubtotalBeforeTaxesAndShipping?t(i.consolidatedProposedSubtotalBeforeTaxesAndShipping):void 0,completedRemoteCheckouts:Q(i.completedRemoteCheckouts),remotePaymentDue:y(i.purchaseOrder.payment,i.consolidatedTotals?.runningTotal?t(i.consolidatedTotals.runningTotal):void 0),consolidatedTotals:i.consolidatedTotals?(u=i.consolidatedTotals,{total:t(u.runningTotal),runningTotal:t(u.runningTotal),subtotal:t(u.subtotalBeforeTaxesAndShipping),subtotalBeforeReductions:t(u.subtotalBeforeReductions),totalSavings:t(u.totalSavings),checkoutTotalTaxes:u.checkoutTotalTaxes?t(u.checkoutTotalTaxes):void 0,checkoutTotalBeforeTaxesAndShipping:u.checkoutTotalBeforeTaxesAndShipping?t(u.checkoutTotalBeforeTaxesAndShipping):void 0,checkoutTotal:u.checkoutTotal?t(u.checkoutTotal):void 0}):void 0,consolidatedTaxes:i.consolidatedTaxes?I(i.consolidatedTaxes,i.completedRemoteCheckouts):void 0,remoteMerchandiseDetails:z(i.completedRemoteCheckouts)}}
1default:throw new A(`Unknown receipt type: ${i.__typename}`)}var s,d,c,l,u,b,k,S}function O(e){if(!e)return null;const t={latitude:e.coordinates.latitude,longitude:e.coordinates.longitude},{location:r}=e;return"PickupInStoreLocation"===r.__typename?{location:{kind:"inStore",name:r.name,address:o(r.address)},coordinates:t,marker:e.marker}:"PickupPointLocation"===r.__typename?{location:{kind:"pickupPoint",name:r.name,carrierCode:r.carrierCode,carrierName:r.carrierName,carrierLogoUrl:r.carrierLogoUrl,fromDeliveryOptionGenerator:r.fromDeliveryOptionGenerator},coordinates:t,marker:e.marker}:null}function M(e){const{contactMethod:t}=e;return"PurchaseOrderEmailContactMethod"===t?.__typename?t.email:void 0}function R(e){const{contactMethod:t}=e;return"PurchaseOrderSMSContactMethod"===t?.__typename?t.phoneNumber:void 0}function _(e,t){const r=e.deliveryLines.find(e=>e.destinationAddress)?.destinationAddress,a="StreetAddress"===r?.__typename?o(r):void 0;if(a)return a;const n=t?.find(e=>"SubmittedRemoteCheckout"===e.__typename)?.processedRemoteReceipt.remotePurchaseOrder.delivery.deliveryLines.find(e=>e.destinationAddress)?.destinationAddress;return"StreetAddress"===n?.__typename?o(n):void 0}function C(e,t){const r=e.billingAddress&&"address1"in e.billingAddress?e.billingAddress:void 0,a=e.paymentLines.find(e=>"WalletPaymentMethod"===e.paymentMethod.__typename);if(a)return function(e,t){if("WalletPaymentMethod"!==e?.paymentMethod?.__typename)return;if("FacebookPayWalletContent"===e?.paymentMethod?.walletContent.__typename)return;const r=e?.paymentMethod?.walletContent.billingAddress??t??void 0;return r?o(r):void 0}(a,r);const n=e.paymentLines.map(e=>e.paymentMethod).filter(e=>"billingAddress"in e),i=n.find(e=>e.billingAddress&&"address1"in e.billingAddress)?.billingAddress??r??void 0,s=i?o(i):void 0;if(s)return s;for(const d of t??[]){if("SubmittedRemoteCheckout"!==d.__typename)continue;const e=d.processedRemoteReceipt.remotePurchaseOrder.payment;for(const r of e.paymentLines){const e=r.paymentMethod,t="DirectPaymentMethod"===e.__typename?e.billingAddress:void 0;if(t&&"address1"in t)return o(t)}const t=e.billingAddress;if(t&&"address1"in t)return o(t)}}function S(e){if("PickupInStoreLocation"===e?.__typename||"PickupPointLocation"===e?.__typename){if("PickupPointLocation"===e?.__typename){const{name:t,carrierCode:r,carrierName:a,carrierLogoUrl:n,fromDeliveryOptionGenerator:i,address:s}=e;return{name:t,address:o(s),carrierName:a,carrierCode:r,carrierLogoUrl:n,fromDeliveryOptionGenerator:i,type:e?.__typename}}return{name:e.name,address:o(e.address),instructions:e.instructions,type:e?.__typename}}}function I(e,t){if(!t)return;const r=new Map;for(const a of t)"SubmittedRemoteCheckout"===a.__typename&&r.set(a.shopId,P({...a.processedRemoteReceipt.remotePurchaseOrder.tax,totalTaxAmount:a.processedRemoteReceipt.remotePurchaseOrder.tax.totalTaxAmountV2??void 0}));return{perShopTaxes:r,consolidatedTaxes:b(e)}}function D(e,r){if(e)return e.map(({amount:e,discountRecurringCycleLimit:a,excludeFromDeliveryOptionPrice:n,targetMerchandise:i,flatRateGroupId:o})=>({amount:t(e),discountRecurringCycleLimit:a??void 0,excludeFromDeliveryOptionPrice:n,targetMerchandiseLines:x(i,r),flatRateGroupId:o??void 0}))}function x(e,t){return e.reduce((e,r)=>{if("PurchaseOrderMerchandiseLine"!==r.__typename&&"PurchaseOrderBundleLineComponent"!==r.__typename)return e;const{stableId:a,merchandise:n,quantity:i}=r;if("ProductVariantSnapshot"===n.__typename){const r=Y(i),o=n.image?{...n.image,altText:n.image.altText||void 0}:void 0;return[...e,{id:n.variantId,digest:n.digest,title:n.productTitle,stableId:a,requiresShipping:!t&&(n.requiresShipping??!0),properties:l(n.properties),subtitle:n.title??void 0,sellingPlan:c(n.sellingPlan),quantity:r,image:o}]}return e},[])}function L(e,r,a){const n=e.deliveryLines.map(e=>function(e,r){const a={amountCombinabilityToken:e.deliveryStrategy.amountCombinabilityToken,deliveryPresentationGroupToken:e.deliveryStrategy.deliveryPresentationGroupToken,handle:e.deliveryStrategy.handle,title:e.deliveryStrategy.title,de
1scription:e.deliveryStrategy.description??void 0,cost:t(e.lineAmount),costAfterDiscounts:t(e.lineAmountAfterDiscounts),estimatedTimeInTransit:void 0,methodType:e.deliveryStrategy.methodType,brandedPromise:e.deliveryStrategy.brandedPromise,pickupLocation:S(e.deliveryStrategy.pickupLocation),deliveryPromisePresentmentTitle:e.deliveryStrategy.deliveryPromisePresentmentTitle,metafields:[],priceBreakdown:D(e.deliveryStrategy.deliveryStrategyBreakdown,r),deliveryPredictionEligible:!1};return a&&"NONE"!==a.methodType?{status:"available",methods:[a],selectedDeliveryMethodHandle:a.handle,type:e.groupType,targetMerchandiseLines:x(e.targetMerchandise,r),availableOn:e.availableOn}:{status:"not_required",type:e.groupType,targetMerchandiseLines:x(e.targetMerchandise,r)}}(e,r)),i=function(e){const r=e?.filter(e=>"SubmittedRemoteCheckout"===e.__typename);return r&&0!==r.length?r.flatMap(e=>e.processedRemoteReceipt.remotePurchaseOrder.delivery.deliveryLines.filter(e=>"NONE"!==e.deliveryStrategy.methodType).map(e=>function(e){return{status:"available",methods:[{cost:t(e.lineAmount),costAfterDiscounts:t(e.lineAmount),deliveryPredictionEligible:!1,estimatedTimeInTransit:void 0,handle:e.deliveryStrategy.handle,metafields:[],methodType:e.deliveryStrategy.methodType,title:e.deliveryStrategy.title}],selectedDeliveryMethodHandle:e.deliveryStrategy.handle,type:e.groupType,targetMerchandiseLines:(r=e.targetMerchandise,r.reduce((e,t)=>{if("PurchaseOrderMerchandiseLine"!==t.__typename)return e;const{stableId:r,merchandise:a,quantity:n}=t;if("ProductVariantSnapshot"===a.__typename){const t=Y(n);return[...e,{digest:a.digest,title:a.productTitle,stableId:r,requiresShipping:a.requiresShipping,properties:[],quantity:t}]}return e},[])),availableOn:e.availableOn};var r}(e))):[]}(a);return{status:"filled",lines:[...n,...i],splitShippingToggle:e.splitShippingToggle}}function E(e,t){const r="PurchaseOrderGiftCardPaymentMethod"===e.paymentMethod.__typename,a="PurchaseOrderGiftCardPaymentMethod"===t.paymentMethod.__typename;return r&&!a?-1:!r&&a?1:0}function B(e){return e.filter(e=>!e.due).sort(E).map(e=>({...w(e.paymentMethod),cost:U(e.amount),specialInstructions:e.postPaymentMessage??void 0}))}function U(e){if(null!=e)return{amount:parseFloat(e.amount),currencyCode:e.currencyCode}}function w(e){switch(e.__typename){case"DirectPaymentMethod":return{method:{type:"direct",sessionId:e.sessionId,paymentMethodIdentifier:e.paymentMethodIdentifier??"",brand:e.creditCard?.brand??void 0,creditCardLastFourDigits:e.creditCard?.lastDigits??void 0,vaultingAgreement:e.vaultingAgreement}};case"CustomerCreditCardPaymentMethod":return{method:{type:d.CreditCard,id:e.id,token:e.token,billingAddress:o(e.billingAddress),brand:e.brand,firstDigits:e.firstDigits??void 0,displayLastDigits:e.displayLastDigits,defaultPaymentMethod:e.defaultPaymentMethod,deletable:e.deletable,requiresCvvConfirmation:e.requiresCvvConfirmation}};case"PaymentOnDeliveryMethod":return{method:{type:"paymentOnDelivery",additionalDetails:e.additionalDetails??"",paymentInstructions:e.paymentInstructions??"",paymentMethodIdentifier:e.paymentMethodIdentifier??"",availablePresentmentCurrencies:[]}};case"PurchaseOrderGiftCardPaymentMethod":return{method:{type:"giftCard",code:e.code,balance:U(e.balance)}};case"WalletPaymentMethod":return{method:{type:"wallet",name:e.name,walletContent:F(e.walletContent)}};case"WalletsPlatformPaymentMethod":return{method:{type:"walletsPlatformPaymentMethod",name:e.name,walletParams:e.walletParams}};case"LocalPaymentMethod":return{method:{type:"local",paymentMethodIdentifier:e.paymentMethodIdentifier??"",name:e.name}};case"DeferredPaymentMethod":return{method:{type:"deferred"}};case"ManualPaymentMethod":return{method:{type:"manualPayment",name:e.name,id:e.id,additionalDetails:e.additionalDetails??"",paymentInstructions:e.paymentInstructions??"",paymentMethodIdentifier:e.paymentMethodIdentifier??"",availablePresentmentCurrencies:[]}};case"CustomPaymentMethod":return{method:{type:"customManualPayment",name:e.name,id:e.id,additionalDetails:e.additionalDetails??"",paymentInstructions:e.paymentInstructions??"",paymentMethodIdentifier:e.paymentMethodIdentifier??"",availablePresentmentCurrencies:[]}};case"PaypalBillingAgreementPaymentMethod":return{method:{type:d.PayPal,token:e.token,billingAddress:o(e.billingAddress)}};case"OffsitePaymentMethod":return{method:{type:"offsite",paymentMethodIdentifier:e.paymentMethodIdentifier??void 0,name:e.name}};case"RedeemablePaymentMethod":switch(e.redemptionSource){case"CUSTOM":case"SHOP_CASH":return{method:{type:"redeemable",redemptionSource:e.redemptionSource,redemptionContent:e.redemptionContent}};default:return{method:{type:"redeemable",redemptionSource:e.redemptionSource}}}case"CustomOnsitePaymentMethod":return{method:{type:"customOnsite",paymentMethodIdentifier:e.paymentMethodIdentifier??void 0,name:e.name}};case"BankPaymentInstrument":return{method:{type:"bank",paymentMethodIdentifier:e.paymentMethodIdentifier,lastDigits:e.lastDigits??"",bankName:e.bankName??""}};case"ShopWalletPaymentInstrument":return{method:{type:"shopWallet"}};default:return{method:{type:"other"}}}}function F(e){switch(e.__typename){case"ShopifyInstallmentsWalletContent":return{autoPayEnabled:e.autoPayEnabled,billingAddress:u(e.billingAddress),disclosureDetails:e.disclosureDetails,installmentsToken:e.installmentsToken,creditCardBrand:e.creditCard?.brand??void 0,creditCardLastFourDigits:e.creditCard?.lastDigits??void 0};case"ShopPayWalletContent":return{billingAddress:u(e.billingAddress),paymentMethod:e.paymentMethod,paymentAttributes:e.paymentAttributes,paymentMethodIdentifier:e.paymentMethodIdentifier}}}function q(e){switch(e){case"READY":return"ready";case"NOT_READY":return"notReady";case"EXPIRED":return"expired";case"DISABLED_FEATURE":return"disabled"}}function N(e){switch(e.discount.__typename){case"CustomDiscount":return{title:e.discount.title,de
1scription:e.discount.description??void 0,amount:t(e.lineAmount),allocations:V([...e.deliveryAllocations,...e.merchandiseAllocations]),discount:s(e.discount)};case"CodeDiscount":case"AutomaticDiscount":return{title:e.discount.title,amount:t(e.lineAmount),allocations:V([...e.deliveryAllocations,...e.merchandiseAllocations]),discount:s(e.discount)};case"DiscountCodeTrigger":return{title:e.discount.code,discount:s(e.discount)};default:return}}function V(e){return e.map(e=>({target:{index:e.index,amount:t(e.amount),stableId:e.stableId,type:e.targetType}}))}function G(e){return W(e)??e.marketingConsent.some(e=>"PurchaseOrderSMSContactMethod"===e.__typename)}function H(e){const t=e.marketingConsent.find(e=>"PurchaseOrderSMSContactMethod"===e.__typename);return t?.phoneNumber??""}function W(e){return"DecodedCustomerProfile"===e.customer?.__typename||"BusinessCustomerProfile"===e.customer?.__typename?e.customer.acceptsEmailMarketing:void 0}function j(e){const t=function(e){const t=e.map(e=>e.paymentMethod).find(e=>"LocalPaymentMethod"===e.__typename);if(t)return{type:"local",name:t.name,displayName:t.displayName??"",paymentMethodIdentifier:t.paymentMethodIdentifier??"",orderingIndex:Number.MAX_SAFE_INTEGER}}(e);return t?[t]:[]}function Y(e){return"number"==typeof e?e:"PurchaseOrderMerchandiseQuantityByItem"===e.__typename?e.items:0}function Q(r){if(r)return r.map(r=>{switch(r.__typename){case"SubmittedRemoteCheckout":return{status:"submitted",shopId:r.shopId,checkoutSessionToken:r.checkoutSessionToken,orderIdentity:{id:r.processedRemoteReceipt.orderIdentity.id,buyerIdentifier:r.processedRemoteReceipt.orderIdentity.buyerIdentifier},orderStatusPageUrl:r.processedRemoteReceipt.orderStatusPageUrl,remotePurchaseOrder:{paymentLines:B(r.processedRemoteReceipt.remotePurchaseOrder.payment.paymentLines.filter(e=>"DirectPaymentMethod"===e.paymentMethod.__typename)),deliveryLines:(i=r.processedRemoteReceipt.remotePurchaseOrder.delivery.deliveryLines,i.filter(({deliveryStrategy:e})=>"NONE"!==e.methodType).map(({deliveryStrategy:{handle:e,title:r},lineAmount:a})=>({handle:e,title:r,lineAmount:t(a)}))),merchandiseLines:K(r.processedRemoteReceipt.remotePurchaseOrder.merchandise.merchandiseLines),checkoutTotal:t(r.processedRemoteReceipt.remotePurchaseOrder.checkoutTotal),subtotalBeforeTaxesAndShipping:t(r.processedRemoteReceipt.remotePurchaseOrder.subtotalBeforeTaxesAndShipping),tax:r.processedRemoteReceipt.remotePurchaseOrder.tax.totalTaxAmountV2?U(r.processedRemoteReceipt.remotePurchaseOrder.tax.totalTaxAmountV2):void 0}};case"FailedRemoteCheckout":return{status:"failed",shopId:r.shopId,checkoutSessionToken:r.checkoutSessionToken,recoveryUrl:r.recoveryUrl,merchandiseLines:r.failedRemoteReceipt?K(r.failedRemoteReceipt.remotePurchaseOrder.merchandise.merchandiseLines):(n=r.negotiatedProposal.merchandise,"FilledMerchandiseTerms"!==n.__typename?[]:n.merchandiseLines.map(e=>{if("ProductVariantMerchandise"!==e.merchandise.__typename&&"ContextualizedProductVariantMerchandise"!==e.merchandise.__typename)return;const r="ProposalMerchandiseQuantityByItem"===e.quantity?.__typename&&"IntValueConstraint"===e.quantity.items?.__typename?e.quantity.items.value:0;return{stableId:e.stableId,quantity:r,title:e.merchandise.subtitle??null,productTitle:e.merchandise.title,image:e.merchandise.image?{url:e.merchandise.image.url,...e.merchandise.image.altText&&{altText:e.merchandise.image.altText}}:null,price:t(e.totalAmount)}}).filter(e=>Boolean(e))),checkoutTotal:r.failedRemoteReceipt?t(r.failedRemoteReceipt.remotePurchaseOrder.checkoutTotal):(a=r.negotiatedProposal,"MoneyValueConstraint"===a.checkoutTotal?.__typename?t(a.checkoutTotal):t(a.runningTotal)),subtotalBeforeTaxesAndShipping:r.failedRemoteReceipt?t(r.failedRemoteReceipt.remotePurchaseOrder.subtotalBeforeTaxesAndShipping):t(r.negotiatedProposal.subtotalBeforeTaxesAndShipping),tax:r.failedRemoteReceipt?.remotePurchaseOrder.tax.totalTaxAmountV2?U(r.failedRemoteReceipt?.remotePurchaseOrder.tax.totalTaxAmountV2):X(r.negotiatedProposal)};default:return e(r)}var a,n,i})}function K(e){return e.map(({quantity:{items:e},merchandise:r,stableId:a})=>({stableId:a,quantity:e,title:r.title??null,productTitle:r.productTitle,image:r.image?{url:r.image.url,altText:r.image.altText??void 0}:null,price:t(r.price)}))}function X(e){const t=P(e.tax);if("available_total"===t.status)return t.totalTax}function z(e){if(!e)return;const r=new Map,a=[];for(const n of e)"SubmittedRemoteCheckout"===n.__typename&&n.processedRemoteReceipt.remotePurchaseOrder.merchandise.merchandiseLines.forEac
1h(e=>{const o=t(e.merchandise.price);r.set(e.stableId,n.shopId),a.push({...e,lineAmount:{__typename:"Money",amount:i(o.amount*e.quantity.items).toString(),currencyCode:o.currencyCode},legacyFee:!1,lineAllocations:[],lineComponents:[]})});return{stableIdToShopId:r,mergedBuyerProposalMerchandise:{__typename:"PurchaseOrderMerchandiseTerms",merchandiseLines:a}}}export{k as receiptForUI};
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.