PageSourceSearch

https://shirtshowofficial.com/cdn/shopifycloud/checkout-web/assets/c1/aec7053c.CCucehPE.js

js shirtshowofficial.com collected 2026-10-02 15:37:08 UTC 32,715 bytes, 1 lines download raw bytes

1var e,t,s,n,i,r,a,o,c,u,p,d,l,h,m,f,y,g,_,b,v,E=e=>{throw TypeError(e)},k=(e,t,s)=>t.has(e)||E("Cannot "+s),C=(e,t,s)=>(k(e,t,"read from private field"),s?s.call(e):t.get(e)),R=(e,t,s)=>t.has(e)?E("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),I=(e,t,s,n)=>(k(e,t,"write to private field"),n?n.call(e,s):t.set(e,s),s),P=(e,t,s)=>(k(e,t,"access private method"),s);import{G as S,c as A,j as w}from"./2c1ab0fe.GMbxnz74.js";import{fM as T,g1 as D,h as O,J as N,fN as x,fO as M,fP as q,fQ as j,fR as L}from"./4c290a1e.2OXqqQwu.js";import{U,E as H,b as F,O as Y,a as B,R as z,c as V,d as W,i as G,e as K,D as $,f as X,I as Z,g as J,h as Q,j as ee,k as te,l as se}from"./24dc440e.BDUakuji.js";import{E as ne,a as ie,e as re,b as ae,c as oe,d as ce}from"./5c5c2e96.BLV8mUtf.js";import{d as ue,c as pe}from"./e477f96c.C25EBhFr.js";import{I as de,i as le}from"./0a7dffce.BIRsKacx.js";import{b as he,a as me,c as fe,s as ye,P as ge}from"./711bf263.MCfI959u.js";import{B as _e}from"./9c523c9d.i8UDTV45.js";import{g as be}from"./e592f8b9.DUn4Te8e.js";import"./app.iZwEIta_.js";import"./bff2ff9b.dZiLBpKk.js";import"./21cc90a2.BYvnDDaS.js";const ve=class c{constructor(u,d){R(this,a),R(this,e),R(this,t),R(this,s),R(this,n),R(this,i),R(this,r),this.version=c.version,I(this,e,u),I(this,r,d),I(this,t,new U({context:u,toMinorUnits:Ye,findSelectedInstrument:e=>P(this,a,p).call(this,e),includeShopPromotion:!0})),I(this,s,new H({extensions:[C(this,t)],getCheckout:()=>C(this,i).peek()})),I(this,n,S(()=>{const e=P(this,a,v).call(this);return e?C(this,s).decorateCheckout(e):void 0})),I(this,i,S(()=>{const e=C(this,n).value;return e&&Be(e,C(this,a,o))}))}get ucpCheckout(){return C(this,i)}get shopCash(){return C(this,t).shopCash}get shopDiscountOffer(){return C(this,t).shopDiscountOffer}isShopDiscountOfferUnsettled(){return C(this,t).isShopDiscountOfferUnsettled()}mapEvent(e){return C(this,s).mapEvent(e,()=>P(this,a,u).call(this,e))}mapResponse(t,s){switch(t){case"ec.ready":if(!function(e){return null!=e&&"object"==typeof e}(s))return;return P(this,a,h).call(this,s);case"ec.fulfillment.address_change_request":if(!function(e){if(!e||"object"!=typeof e)return!1;const t=e,s=t.checkout?.fulfillment;return!!s&&null!=je(s)}(s))return;return function(e){const t=e.checkout?.fulfillment,s=t?je(t):void 0;return s?{cart:{delivery:{addresses:[{address:(n=s,{firstName:n.first_name,lastName:n.last_name,phone:n.phone_number,address1:n.street_address,address2:n.extended_address,city:n.address_locality,countryCode:n.address_country,provinceCode:n.address_region,zip:n.postal_code}),oneTimeUse:!1,selected:!0}]}}}:{cart:void 0,errors:void 0};var n}(s,C(this,e));case"ec.payment.instruments_change_request":if(!function(e){if(!e||"object"!=typeof e)return!1;const t=e;return Array.isArray(t.checkout?.payment?.instruments)}(s))return;return P(this,a,d).call(this,s);case"ec.payment.credential_request":if(!function(e){if(!e||"object"!=typeof e)return!1;const t=e,s=t.checkout?.payment?.instruments?.find(e=>null!=e.credential);return null!=s}(s))return;return P(this,a,l).call(this,s);case"ec.window.open_request":if(!function(e){return null!=e&&"object"==typeof e}(s))return;return!0;default:return}}parseIncomingRequest(e){const t=C(this,s).parseIncomingRequest(e);if(t)return t;switch(e.method){case"ec.submit":return P(this,a,m).call(this,e);case"ec.update":return P(this,a,f).call(this,e);default:return{errorResponse:{jsonrpc:"2.0",id:e.id,error:{code:-32601,message:`Unknown method: ${e.method}`}}}}}buildSubmitResponse(e){const t=P(this,a,y).call(this);if(t?.order)return{jsonrpc:"2.0",id:e,result:{ucp:P(this,a,_).call(this),checkout:t,...P(this,a,g).call(this)}}}buildAckResponse(e){return{jsonrpc:"2.0",id:e,result:{ucp:P(this,a,_).call(this)}}}buildErrorResponse(e,t){const{code:n,content:i,severity:r}=function(e,t){const s=t.mapError(e);return s||(e instanceof ne?{code:"invalid_state_error",content:"Checkout not initialized",severity:"unrecoverable"}:e instanceof ie?{code:"invalid_state_error",content:"Payment instrument credential missing",severity:"recoverable"}:e instanceof re?{code:"payment_failed",content:"Checkout submission failed",severity:"recoverable"}:{code:"internal_error",content:"Internal error",severity:"unrecoverable"})}(t,C(this,s));return{jsonrpc:"2.0",id:e,result:{ucp:P(this,a,b).call(this),messages:[{type:"error",code:n,content:i,
1content_type:"plain",severity:r}]}}}};e=new WeakMap,t=new WeakMap,s=new WeakMap,n=new WeakMap,i=new WeakMap,r=new WeakMap,a=new WeakSet,o=function(){return he({context:C(this,e),targetType:C(this,r)})},c=function(){return me({context:C(this,e),targetType:C(this,r)})},u=function(t){const s=C(this,i).peek();switch(t.type){case"checkout.ready":if(!s)return;return{jsonrpc:"2.0",method:"ec.ready",id:fe(),params:{delegate:Array.from(C(this,e).embed.delegations.allowed)}};case"checkout.start":if(!s)return;return{jsonrpc:"2.0",method:"ec.start",params:{checkout:s}};case"checkout.error":{const e=t.severity??"requires_buyer_input",n={type:"error",code:t.code?.toLowerCase()??"unknown_error",content:t.message??"",content_type:"plain",severity:e,path:t.path};if("unrecoverable"===e)return{jsonrpc:"2.0",method:"ec.error",params:{error:{ucp:P(this,a,b).call(this),messages:[n]}}};if(!s)return;return{jsonrpc:"2.0",method:"ec.messages.change",params:{checkout:{...s,messages:[...s.messages??[],n]}}}}case"checkout.addressChangeStart":if(!s)return;return{jsonrpc:"2.0",id:fe(),method:"ec.fulfillment.address_change_request",params:{checkout:s}};case"checkout.paymentMethodChangeStart":if(!s)return;return{jsonrpc:"2.0",id:fe(),method:"ec.payment.instruments_change_request",params:{checkout:s}};case"checkout.submitStart":if(!s)return;return{jsonrpc:"2.0",id:fe(),method:"ec.payment.credential_request",params:{checkout:s}};case"checkout.windowOpen":return{jsonrpc:"2.0",id:fe(),method:"ec.window.open_request",params:{url:t.url}};case"checkout.messagesChange":if(!s)return;return{jsonrpc:"2.0",method:"ec.messages.change",params:{checkout:s}};case"checkout.paymentChange":if(!s)return;return{jsonrpc:"2.0",method:"ec.payment.change",params:{checkout:s}};case"checkout.lineItemsChange":if(!s)return;return{jsonrpc:"2.0",method:"ec.line_items.change",params:{checkout:s}};case"checkout.buyerChange":if(!s)return;return{jsonrpc:"2.0",method:"ec.buyer.change",params:{checkout:s}};case"checkout.fulfillmentChange":if(!s)return;return{jsonrpc:"2.0",method:"ec.fulfillment.change",params:{checkout:s}};case"checkout.totalsChange":if(!s)return;return{jsonrpc:"2.0",method:"ec.totals.change",params:{checkout:s}};case"checkout.complete":{const e=P(this,a,y).call(this);if(!e?.order)return;return{jsonrpc:"2.0",method:"ec.complete",params:{checkout:e}}}default:return}},p=function({instruments:t,hasCredential:s}){if(!t?.length)return;const n=C(this,e).checkout.proposal.negotiated.fields.ucp.value?.paymentHandlers?.map(e=>e.id)??[];return t.find(t=>"string"!=typeof t.id||"string"!=typeof t.handler_id||!0!==t.selected||"string"!=typeof t.display?.last_digits||"string"!=typeof t.display?.brand||null==t.billing_address?(n.includes(t.handler_id)||C(this,e).observability.log("InvalidHandlerId","Payment instrument has an invalid handler ID",{handler_id:t.handler_id}),!1):!s||null!=t.credential&&"string"==typeof t.credential.token)},d=function(e){const{instruments:t}=e.checkout?.payment??{};return{ucpPaymentInstrument:P(this,a,p).call(this,{instruments:t})}},l=function(e){return{ucpPaymentInstrument:P(this,a,p).call(this,{instruments:e.checkout?.payment?.instruments,hasCredential:!0})}},h=function(e){if(null!=e.upgrade&&null!=e.upgrade.port&&e.upgrade.port instanceof MessagePort)return{upgrade:{port:e.upgrade.port}};const{instruments:t}=e.checkout?.payment??{};return{upgrade:void 0,ucpPaymentInstrument:P(this,a,p).call(this,{instruments:t})}},m=function(e){const t=e.params,s=t?.checkout?.payment?.instruments,n=P(this,a,p).call(this,{instruments:s,hasCredential:!0});return n?{type:"submit",instrument:n}:{errorResponse:{jsonrpc:"2.0",id:e.id,error:{code:T.INVALID_PARAMS,message:"Missing payment instrument with credential"}}}},f=function(e){const t=e.params,s=t?.checkout;if(!s||1!==Object.keys(s).length)return{errorResponse:{jsonrpc:"2.0",id:e.id,error:{code:-32602,message:"ec.update requires exactly one field"}}};const n=Object.keys(s)[0];switch(n){case"fulfillment":{const t=s.fulfillment,n=t?je(t):void 0;return n?{type:"addressUpdate",address:n}:{errorResponse:{jsonrpc:"2.0",id:e.id,error:{code:-32602,message:"Invalid delivery address"}}}}case"payment":{const t=s.payment,n=P(this,a,p).call(this,{instruments:t?.instruments});return n?{type:"instrumentUpdate",instrument:n}:{errorResponse:{jsonrpc:"2.0",id:e.id,error:{code:-32602,message:"Invalid payment instrument"}}}}case"buyer":{const t=function(e){if(null==e||"object"!=typeof e||Array.isArray(e))return;const t=new Set(["email","phone_number"]),s=e;if(Object.keys(s).some(e=>!t.has(e)))return;const n=Object.prototype.hasOwnProperty.call(s,"email"),i=Object.prototype.hasOwnProperty.call(s,"phone_number");return n&&"string"!=typeof s.email||i&&"string"!=typeof s.phone_number||!n&&!i?void 0:{...n?{email:s.email}:{},...i?{phone_number:s.phone_number}:{}}}(s.buyer);return t?{type:"buyerUpdate",buyer:t}:{errorResponse:{jsonrpc:"2.0",id:e.id,error:{code:-32602,message:"Invalid buyer identity"}}}}default:return{errorResponse:{jsonrpc:"2.0",id:e.id,error:{code:-32602,message:`Unknown ec.update field: ${n}`}}}}},y=function(){const e=C(this,n).peek();return e&&Be(e,C(this,a,c))},g=function(){if(!C(this,t).enabled)return{};const e=this.shopCash.peek(),s=this.shopDiscountOffer.peek();return{...e?{shop_cash:e}:{},...s?{shop_discount_offer:s}
1:{}}},_=function(){return{version:this.version,status:"success"}},b=function(){return{version:this.version,status:"error"}},v=function(){const{checkout:s,shop:n,i18n:i,embed:r,negotiationContext:a}=C(this,e),{merchandiseLines:o,runningTotal:c,subtotal:u,discountLines:p,contactInfo:d,taxes:l,duties:h,dutiesIncluded:m,optionalDuties:f,landedCostDetails:y,ucp:g}=s.proposal.negotiated.fields,{id:_,paymentHandlers:b}=g.value??{};if(null==_)return;const v=function({contactInfo:e}){const{email:t,phone:s}=e??{};return{...t?{email:t}:{},...s?{phone_number:s}:{}}}({contactInfo:d?.value}),E=s.latestReceipt.value,k=function(e){const t=e?.find(e=>"wallet"===e.method.type||"walletsPlatformPaymentMethod"===e.method.type&&e.method.name in He);if(t)return He[t.method.name];const s=e?.some(e=>"redeemable"===e.method.type&&"SHOP_CASH"===e.method.redemptionSource);return s?"shop_pay":void 0}("processed"===E?.status?E.purchaseOrder.paymentLines:void 0),R=a?.delegatedPaymentInstrument?.value,I=function(e,t,s,n){return e?Ue(e,s,n)?[]:ue(e)?function({instrument:e,proposalBillingAddress:t}){return[{id:e.externalReferenceId,handler_id:"shopify.card",type:"card",selected:!0,display:{last_digits:e.lastDigits,brand:e.brand?.toLowerCase()},cardholder_name:e.cardHolderName,expiry_month:e.month,expiry_year:e.year,billing_address:t}]}({instrument:e,proposalBillingAddress:t}):[{...e,selected:!0,billing_address:t}]:[]}(R,Me(s.proposal.proposed.billingAddress.value),k,C(this,t)),P=[];for(const e of n.merchantPolicies){const t=ke.get(e.handle);t&&P.push({type:t,url:e.url,title:i.translate("shop_policies",{scope:e.handle.replace(/-/g,"_")})})}const{lineItems:S,itemsDiscountAmount:A}=function({lines:e}){if(!e?.length)return{lineItems:[],itemsDiscountAmount:0};let t=0;return{lineItems:e.map(e=>{const s=e.itemPrice,n=s?{...s,amount:s.amount*e.quantity}:void 0,i=e.lineAllocations.reduce((e,t)=>e+t.allocations.reduce((e,{amount:t})=>e+t.amount,0),0),r=[];n&&r.push({type:"subtotal",amount:Ye(n)}),0!==i&&n&&(t+=i,r.push({type:"items_discount",amount:Ye({...n,amount:-i})}));const a=n&&0!==i?{...n,amount:n.amount-i}:e.totalPrice;return r.push({type:"total",amount:Ye(a)}),{id:Oe(e),parent_id:e.parentRelationship?.parent?.id??void 0,quantity:e.quantity,item:{id:e.variantId,title:e.title,price:Ye(s),...e.image?.url?{image_url:e.image.url}:{}},totals:r}}),itemsDiscountAmount:t}}({lines:o.value?.lines}),w=[],T=(O=o.value?.lines,(O?O.reduce((e,t)=>{const s=t.itemPrice;if(!s)return e;const n=s.amount*t.quantity;return e?{...e,amount:e.amount+n}:{...s,amount:n}},void 0):void 0)??u.value);var O;w.push({type:"subtotal",display_text:"Subtotal",amount:Ye(T)}),null!=T&&w.push(...function({currencyCode:e,discountLines:t,itemsDiscountAmount:s}){let n=0;if(t?.lines?.length)for(const r of t.lines)if(le(r))for(const e of r.allocations)"DELIVERYLINE"===e.target.type&&(n+=e.target.amount.amount);const i=[];return s>0&&i.push({type:"items_discount",display_text:"Discounts",amount:Ye({amount:-s,currencyCode:e})}),n>0&&i.push({type:"discount",display_text:"Discount",amount:Ye({amount:-n,currencyCode:e})}),i}({currencyCode:T.currencyCode,discountLines:p?.value,itemsDiscountAmount:A}));const N=function({checkout:e}){const{deliveryNext:t}=e.proposal.negotiated.fields,s=t.value;if("filled"!==s?.status||!s.lines)return;let n,i=0;for(const r of s.lines){if("available"!==r.status)continue;const e=r.selectedDeliveryMethodHandle;if(!e)continue;const t=r.methods.find(t=>t.handle===e);t?.costAfterDiscounts&&(i+=t.costAfterDiscounts.amount,n??=t.costAfterDiscounts.currencyCode)}return null==n?void 0:{amount:i,currencyCode:n}}({checkout:s});null!=N&&w.push({type:"fulfillment",display_text:"Shipping",amount:Ye(N)});const x=l.value,M=s.proposal.facts.tax??("available_total"===x?.status?x.totalTax:void 0);null!=M&&w.push({type:"tax",display_text:"Taxes",amount:Ye(M)});const q=h.value,j=f.value,L=m.value||s.proposal.facts.dutiesIncluded,U=Boolean(j?.refuseDutiesPermitted&&j?.buyerRefusesDuties)&&y.value?.incoterm===de.Ddu,H="available_total"===q?.status?q.totalDuty:null,K=L||U?null:s.proposal.facts.duty??H;null!=K&&(C(this,t).enabled||n.hasFlagEnabled(D))&&w.push({type:"duty",display_text:"Duties",amount:Ye(K)});const $=c.value,X=$?.currencyCode??"USD";w.push({type:"total",display_text:"Total",amount:Ye($)});const Z=function({checkout:e}){const t=new Map,s=e.proposal.negotiated.fields.allViolations.value??[];for(const n of s){if(Y.has(n.__typename))continue;if(B.has(n.code))continue;let e,s;
1z.has(n.__typename)?(e="requires_buyer_review",s=n.code.toLowerCase()):V.has(n.code)?(e="recoverable",s=n.code.toLowerCase()):(e="requires_buyer_input",s=W.has(n.code)?n.code.toLowerCase():"requires_buyer_input");const i=Ce.get(n.code);i&&(s=i);const r="target"in n?n.target:void 0,a=n.localizedMessage||n.nonLocalizedMessage,o=G(n.code)?{type:"warning",content_type:"plain",code:i??n.code.toLowerCase(),content:a,path:r}:{type:"error",severity:e,content_type:"plain",code:s,content:a,path:r};t.set(o,n)}return t}({checkout:s}),J=Ue(R,k,C(this,t)),Q=[...Z.keys(),...J?[(ee=k,{type:"info",path:"$.payment",code:"express_checkout",content_type:"plain",content:ee})]:[]];var ee;const te=F({discountLines:p?.value,toMinorUnits:Ye,hiddenCodeTitle:i.translate("order_summary.discount_title")});return{ucp:Re({embed:r,ucpPaymentHandlers:b}),id:_,status:Ie({checkout:s,violationMessageMap:Z}),buyer:v,line_items:S,links:P,messages:Q,currency:X,totals:w,payment:{instruments:I},fulfillment:{methods:Pe({checkout:s})},order:qe({checkout:s}),...te&&{discounts:te}}},ve.version="2026-04-08";let Ee=ve;const ke=new Map([["terms-of-service","terms_of_service"],["privacy-policy","privacy_policy"],["refund-policy","refund_policy"],["shipping-policy","shipping_policy"]]),Ce=new Map([["MERCHANDISE_OUT_OF_STOCK","out_of_stock"],["MERCHANDISE_OUT_OF_STOCK_IN_CONTEXT","out_of_stock"],["MERCHANDISE_NOT_ENOUGH_STOCK_AVAILABLE","out_of_stock"],["MERCHANDISE_INVENTORY_NOT_FOUND","out_of_stock"],["DELIVERY_OUT_OF_STOCK_AT_ORIGIN_LOCATION","out_of_stock"],["MERCHANDISE_NOT_APPLICABLE","item_unavailable"],["MERCHANDISE_NOT_FOUND","item_unavailable"],["MERCHANDISE_PRODUCT_NOT_PUBLISHED","item_unavailable"],["MERCHANDISE_PRODUCT_NOT_PUBLISHED_IN_BUYER_LOCATION","item_unavailable"],["MERCHANDISE_PRODUCT_VARIANT_NOT_FOUND","item_unavailable"],["DELIVERY_NO_DELIVERY_STRATEGY_AVAILABLE_FOR_MERCHANDISE_LINE","address_undeliverable"],["DELIVERY_ZONE_NOT_FOUND","address_undeliverable"],["DELIVERY_ZONE_REQUIRED_FOR_COUNTRY","address_undeliverable"],["PAYMENTS_CREDIT_CARD_GENERIC","payment_failed"],["PAYMENTS_CREDIT_CARD_BASE_GATEWAY_NOT_SUPPORTED","payment_failed"],["PAYMENTS_PROPOSED_GATEWAY_UNAVAILABLE","payment_failed"],["PAYMENTS_CREDIT_CARD_BASE_EXPIRED","payment_failed"],["PAYMENTS_CREDIT_CARD_YEAR_EXPIRED","payment_failed"],["PAYMENTS_PAYMENT_METHOD_INCOMPATIBLE_WITH_PAYMENT_TERMS","payment_failed"],...$]);function Re({embed:e,ucpPaymentHandlers:t}){const s={};for(const n of t??[]){const{name:e}=n;e&&(s[e]??=[],s[e].push(n))}return{version:Ee.version,services:{"dev.ucp.shopping":[{version:Ee.version,transport:"embedded",schema:"https://ucp.dev/2026-04-08/services/shopping/embedded.openrpc.json",config:{delegate:Array.from(e.delegations.allowed)}}]},capabilities:{"dev.ucp.shopping.discount":[{version:Ee.version,extends:"dev.ucp.shopping.checkout",spec:"https://ucp.dev/2026-04-08/specification/discount",schema:"https://ucp.dev/2026-04-08/schemas/shopping/discount.json"}]},payment_handlers:s}}function Ie({checkout:e,violationMessageMap:t}){const{shippingAddress:s,isShippingRequired:n}=e.proposal.negotiated.fields,i=e.latestReceipt.value?.status;if("processed"===i)return"completed";if("processing"===i||"processing_remote_checkouts"===i||"action_required"===i)return"complete_in_progress";if(Array.from(t.entries()).some(([e,t])=>"error"===e.type&&!K.has(t.code)))return"incomplete";const r=Boolean(n?.value),a=Boolean(s?.value);return r&&!a?"incomplete":"ready_for_complete"}function Pe({checkout:e}){const{merchandiseLines:{value:t},deliveryNext:{value:s},shippingAddress:{value:n}}=e.proposal.negotiated.fields;if("filled"!==s?.status||!s.lines)return function(e){const t=e?.lines?.filter(e=>e.requiresShipping)?.map(e=>Oe(e))??[];return 0===t.length?[]:[{id:"shipping",type:"shipping",line_item_ids:t,destinations:[],groups:[]}]}(t);const i=s.lines.filter(Ne).filter(e=>e.methods.some(e=>
1{return"SHIPPING"===(t=e.methodType)||"LOCAL"===t||"PICK_UP"===t||"PICKUP_POINT"===t;var t})&&e.targetMerchandiseLines?.some(e=>e.requiresShipping));if(!i.length)return[];const r=function(e){const t=new Set;for(const s of e){const e=Se(s);e&&t.add(e)}return Array.from(t)}(i),a=[];for(const o of r){const e=i.filter(e=>Se(e)===o),t=e.map(Te),s=[...new Set(t.flatMap(e=>e.line_item_ids))],r=Ae(o,e,n);a.push({id:o,type:o,line_item_ids:s,...r&&{destinations:[r]},groups:t})}return a}function Se(e){const t=e.methods[0];var s;if(t)return"PICK_UP"===(s=t.methodType)||"PICKUP_POINT"===s?"pickup":"shipping"}function Ae(e,t,s){if("shipping"===e){if(!s)return;return{...Me(n=s),id:`shipping-${n.countryCode}-${n.postalCode}`.replace(/\s+/g,"")}}var n;for(const i of t)if(i.selectedDeliveryMethodHandle){const e=i.methods.find(e=>e.handle===i.selectedDeliveryMethodHandle);if(e)return we(e)}}function we(e){const t=e.pickupLocation;if(t)return{id:e.handle,name:t.name??"",address:Me(t.address)}}function Te(e){return{id:e.id??"",line_item_ids:xe(e),options:e.methods.map(De),...e.selectedDeliveryMethodHandle&&{selected_option_id:e.selectedDeliveryMethodHandle}}}function De(e){return{id:e.handle,title:e.title,...e.description&&{description:e.description},...e.carrierName&&{carrier:e.carrierName},...e.minDeliveryDateTime&&{earliest_fulfillment_time:e.minDeliveryDateTime},...e.maxDeliveryDateTime&&{latest_fulfillment_time:e.maxDeliveryDateTime},totals:[{type:"fulfillment",amount:Ye(e.costAfterDiscounts)}]}}function Oe(e){return e.id??`gid://shopify/CartLine/${e.variantId}`}function Ne(e){return"available"===e.status}function xe(e){return e.targetMerchandiseLines?.filter(e=>e.requiresShipping).map(e=>Oe(e))??[]}function Me(e){return{first_name:e.firstName,last_name:e.lastName,phone_number:e.phone,street_address:e.address1,extended_address:e.address2,address_locality:e.city,address_region:e.zoneCode,address_country:e.countryCode,postal_code:e.postalCode}}function qe({checkout:e}){const t=e.latestReceipt.value;if("processed"!==t?.status)return;const s=t.orderIdentity.buyerIdentifier;return{id:O("Order",N(t.orderIdentity.id)),...s?{label:s}:{},permalink_url:t.confirmationPage.url}}function je(e){if(Array.isArray(e.methods))for(const t of e.methods){if(!t||"object"!=typeof t)continue;const{type:e,destinations:s,selected_destination_id:n}=t;if("shipping"!==e||!Array.isArray(s))continue;const i="string"==typeof n?n:null;if(i){const e=s.find(e=>Le(e)&&"string"==typeof e.id&&e.id===i);if(e&&Le(e))return e}for(const t of s){if(!Le(t))continue;const e="string"==typeof t.id?t.id:void 0;if(null==i||e&&i===e||1===s.length)return t}}}function Le(e){if(!e||"object"!=typeof e)return!1;const t=e;return"string"==typeof t.street_address||"string"==typeof t.address_locality||"string"==typeof t.address_region||"string"==typeof t.address_country||"string"==typeof t.postal_code||"string"==typeof t.first_name||"string"==typeof t.last_name}function Ue(e,t,s){return!(!t||e&&(s.shouldSuppressReceiptWalletAsExpressCheckout()||pe(e)&&"gpay"===e.handler_id&&"google_pay"===t))}const He={APPLE_PAY:"apple_pay",GOOGLE_PAY:"google_pay",SHOP_PAY:"shop_pay",SHOPIFY_INSTALLMENTS:"shop_pay",PAYPAL_EXPRESS:"paypal",VENMO:"venmo",AMAZON_PAY:"amazon_pay",AMAZON_PAY_CLASSIC:"amazon_pay",FACEBOOK_PAY:"facebook_pay",amazon_pay:"amazon_pay",buy_with_prime:"buy_with_prime"},Fe=new Map;function Ye(e){if(!e)return 0;let t=Fe.get(e.currencyCode);t||(t=new Intl.NumberFormat("en",{style:"decimal",currency:e.currencyCode,useGrouping:!1}),Fe.set(e.currencyCode,t));const s=A(e.currencyCode),[n,i=""]=t.format(e.amount).split(".");return Number(n+i.padEnd(s,"0"))}function Be(e,{redactPII:t,redactIdKey:s}){const n=t?function(e){const{buyer:t,payment:s,...n}=e;return{...n,...e.fulfillment&&{fulfillment:(r=e.fulfillment,{...r,methods:r.methods.map(e=>{const{destinations:t,selected_destination_id:s,...n}=e;return n})})},...e.order&&{order:(i=e.order,{...i,permalink_url:"about:blank"})}};var i,r}(e):e;return s?{...n,id:ye(n.id)}:n}class ze extends _e{constructor(e){super(e),this.version="2026-04-08",this.#e=new X,this.#t=!1,this.#s=!1,this.#n=null,this.#i=!1,this.#r=new Z({observability:e.observability}),this.#a=new ge({observability:e.observability}),this.#o=new Ee(e,this.#a.targetType),this.#c=new J([new Q({context:this.context,mapper:this.#o,transport:this.#a,resizeObserver:this.#r,incomingRequests:{submitShopPay:e=>this.#e.submitShopPay(e),applyRedemption:e=>this.#e.applyRedemption(e),applyShopPromotionSelection:e=>this.#e.applyShopPromotionSelection(e)},waitForPendingNegotiations:()=>this.waitForPendingNegotiations(),waitForSkeletonRemoved:()=>this.waitForSkeletonRemoved()})]),this.#a.onRequest(e=>this.#u(e)),this.observability.bridgeInitialized()}get embedderOrigin(){return this.#a.embedderOrigin}get embedderHostname(){const e=this.embedderOrigin;if(e)try{return new URL(e).hostname}catch{return}}#a;#o;#e;#t;#s;#n;#p;#d;#l;#h;#m;#i;#r;#c;unstable_providePreactContext(e){super.unstable_providePreactContext(e),this.#e.initialize({...this.context,...e,shopPaySubmitPreflight:()=>this.#p?.(),addPaymentError:e=>this.addPaymentError(e),removePaymentError:e=>this.removePaymentError(e)}).catch(e=>{this.observability.enqueuedApplyPaymentInstrumentError(e)});const t=this.context.checkout.proposal.negotiated.fields.ucp;t.value={...t.peek()}}unstable_setShopPaySubmitPreflight(e){return this.#p=e,()=>{this.#p===e&&(this.#p=void 0)}}async ready(){if(this.#a.isLoopback){if(this.context.environment.debug.logging&&this.context.client.initialRequest.url.searchParams.has("skip_ec_ready"))return void this.observability.skipEcReady();if(!(await this.#f()))return}this.#y();let e=this.#o.mapEvent({type:"checkout.ready"});if(!e)return;const t=await this.#g(e);let s=this.#o.mapResponse(e.method,t);if(s?.upgrade?.port instanceof MessagePort){if(this.observability.readyMessagePortUpgrade(),this.#a.upgrade(s.upgrade.port),e=this.#o.mapEvent({type:"checkout.ready"}),!e)return;const t=await this.#g(e);s=this.#o.mapResponse(e.method,t)}const n=s?.ucpPaymentInstrument;n&&(this.observability.readyPaymentInstrument(),await this.#e.applyInstrument(n)),ee(s)&&(this.observability.readyCartUpdate(Object.keys(s.
1cart).join(",")),this.applyCart(s.cart))}async start(){const e=this.#o.mapEvent({type:"checkout.start"});e&&(this.#a.notify(e),this.#_(),this.#c.start(),this.observability.checkoutStarted({embedder:this.context.embed.embedder,buyerEmail:this.context.checkout.proposal.proposed.email.peek(),hasPaymentInstrument:this.hasDelegatedPaymentInstrument()}),this.#b())}async resumeFromReceipt(){await this.#f()&&(this.#y(),this.#_(),this.#b())}async complete(){if(this.#v()){const e=new ae;return void this.observability.unauthenticatedIframe(e.message)}if(this.#t)return void this.observability.completedEventSkipped();if(this.#t=!0,this.observability.checkoutCompleted(),this.#n){const e=this.#o.buildSubmitResponse(this.#n);return this.#n=null,void(e&&(this.observability.submitResponseSent(e.id),this.#a.send(e)))}const e=this.#o.mapEvent({type:"checkout.complete"});e&&(this.observability.completedEventEmitted(),this.#a.notify(e))}error(e){const t=this.#o.mapEvent({type:"checkout.error",code:e.code,message:e.message,severity:e.severity,path:e.path});t&&this.#a.notify(t)}async addressChangeStart(e){const t=this.#o.mapEvent({type:"checkout.addressChangeStart",addressType:e});if(!t)return;const s=await this.#a.request(t,{singleFlight:!0});return this.#o.mapResponse(t.method,s)}async paymentMethodChangeStart(){this.removePaymentError(x.PaymentDelegationError);try{const e=this.#o.mapEvent({type:"checkout.paymentMethodChangeStart"});if(!e)return;const t=await this.#a.request(e,{singleFlight:!0}),s=this.#o.mapResponse(e.method,t);return s?.ucpPaymentInstrument&&await this.#e.applyInstrument(s.ucpPaymentInstrument),s}catch(e){return this.#E(e,"payment.instruments_change")}}async submitStart(){this.removePaymentError(x.PaymentDelegationError);try{await this.waitForPendingNegotiations();const e=this.#o.mapEvent({type:"checkout.submitStart"});if(!e)return;const t=await this.#a.request(e,{timeoutMs:be(this.context.embed.embedder),singleFlight:!0}),s=this.#o.mapResponse(e.method,t);if(s?.ucpPaymentInstrument){const e=await this.#e.submit(s.ucpPaymentInstrument);this.#k(e)}return s}catch(e){return this.#E(e,"payment.credential")}}async windowOpenRequest(e){const t=this.#o.mapEvent({type:"checkout.windowOpen",url:e});if(t)try{await this.#a.request(t)}catch(s){if(s instanceof M&&s.errorCode===q.WINDOW_OPEN_REJECTED)return void this.observability.windowOpenRejected(e,s.errorMessage);this.observability.windowOpenError(e,s)}}beforeunload(){this.#c.beforeunload()}dialogChange(e){this.#c.dialogChange(e)}showToast(e){return this.#c.showToast(e)}async requestShopPaySessionRevalidation(){return await this.#c.requestShopPaySessionRevalidation()??!0}shopPaySessionRevalidationChange(e){this.#c.shopPaySessionRevalidationChange(e)}cleanup(){this.#c.cleanup(),this.#a.cleanup(),this.#e.cleanup(),this.#d?.(),this.#l?.(),this.#i=!0}async#g(e){try{return await this.#a.request(e,{timeoutMs:1e4})}catch(t){throw t instanceof M&&(this.observability.handshakeError(t.errorCode,t.errorMessage),this.cleanup()),t}}#E(e,t){if(!(e instanceof M&&e.isUserCancelledError))return e instanceof j?(this.observability.paymentDelegationTimeout(t,e.message),void this.addPaymentError(x.PaymentDelegationError)):e instanceof M&&e.isInternalError?(this.observability.paymentDelegationError(t,e.message),void this.addPaymentError(x.PaymentDelegationError)):void this.observability.paymentDelegationUnexpectedError(t,e instanceof Error?e.message:String(e));this.observability.paymentDelegationCancelled()}async#u(e){const{embed:t}=this.context;try{const s=this.#o.parseIncomingRequest(e);if("errorResponse"in s)return this.observability.incomingRequestValidationFailed(e.id),void this.#a.send(s.errorResponse);if(await this.#c.handleIncomingRequest(s,{requestId:e.id,markSubmitPending:()=>{this.#n=e.id},onSubmitAttempt:e=>this.#k(e),sendAckResponse:()=>{this.#a.send(this.#o.buildAckResponse(e.id))}}))return;if("submit"!==s.type&&!this.#c.canHandleIncomingRequest(s.type))throw new oe(t.embedder);switch(s.type){case"submit":{this.#n=e.id;const t=await this.#e.submit(s.instrument);this.#k(t);break}case"addressUpdate":await this.#e.applyAddress(s.address),this.#a.send(this.#o.buildAckResponse(e.id));break;case"buyerUpdate":await this.#e.applyBuyer(s.buyer),this.#a.send(this.#o.buildAckResponse(e.id));break;case"instrumentUpdate":await this.#e.applyInstrument(s.instrument),this.#a.send(this.#o.buildAckResponse(e.id))}}catch(s){this.#n=null,this.observability.incomingRequestError(e.id,s);try{this.#a.send(this.#o.buildErrorResponse(e.id,s))}catch{}}}#_(){let e;this.#l=w(()=>{const t=this.#o.ucpCheckout.value;if(!e)return e=t,void(this.#m=t?.totals);if(t){if(!function(e,t){return e===t||e.length===t.length&&e.every((e,s)=>{const n=t[s];return e.id===n.id&&e.quantity===n.quantity&&e.parent_id===n.parent_id&&e.item.id===n.item.id&&e.item.title===n.item.title&&e.item.image_url===n.item.image_url})}(e.line_items,t.line_items)){const e=this.#o.mapEvent({type:"checkout.lineItemsChange"});e&&this.#a.notify(e)}if(!L(e.buyer,t.buyer)){const e=this.#o.mapEvent({type:"checkout.buyerChange"});e&&this.#a.notify(e)}if(!L(e.fulfillment,t.fulfillment)){const e=this.#o.mapEvent({type:"checkout.fulfillmentChange"});e&&this.#a.notify(e)}if(!function(e,t){if(e===t)return!0;
1if(!e||!t)return!1;const s=e.instruments??[],n=t.instruments??[];return s.length===n.length&&s.every((e,t)=>{const s=n[t],i=Object.keys(e).filter(e=>"credential"!==e),r=Object.keys(s).filter(e=>"credential"!==e);return i.length===r.length&&i.every(t=>{if(!(t in s))return!1;const n=e[t],i=s[t];return n===i||"object"==typeof n&&"object"==typeof i&&L(n,i)})})}(e.payment,t.payment)){const e=this.#o.mapEvent({type:"checkout.paymentChange"});e&&this.#a.notify(e)}if(this.#c.checkoutChange(e,t),!L(e.messages,t.messages)){const e=this.context.checkout.proposal.negotiated.fields.allViolations.value??[],t=Boolean(this.context.negotiationContext?.delegatedPaymentInstrument?.peek());if(e.some(e=>te.has(e.code)||t&&se.has(e.code))){const e=this.#o.mapEvent({type:"checkout.messagesChange"});e&&this.#a.notify(e)}}L(e.totals,t.totals)||this.#C(),"ready_for_complete"!==t.status||this.#s||(this.#s=!0,this.observability.readyForComplete()),e=t}})}#C(){this.#h||(this.#h=this.#R())}async#R(){try{await this.waitForPendingNegotiations()}finally{this.#h=void 0}if(this.#i)return;const e=this.#o.ucpCheckout.peek()?.totals;if(e&&!L(this.#m,e)){this.#m=e;const t=this.#o.mapEvent({type:"checkout.totalsChange"});t&&this.#a.notify(t)}}#k(e){if(!e)return;const t=this.#n;if("success"===e.status||"alreadyCompleted"===e.status)return void this.#c.onSubmit({type:"attemptSucceeded",result:e,requestId:t});"blocked"===e.status?this.observability.submitBlocked(t??"none",e.reason):this.observability.submitFailed(t??"none",e.reason);const s=this.#c.onSubmit({type:"attemptFailed",failure:e,requestId:t});"errorResponse"===s?.type&&t&&(this.#n=null,this.#a.send(this.#o.buildErrorResponse(t,s.error)))}#b(){if("processed"===this.context.checkout.latestReceipt.peek()?.status)return this.complete(),void this.#I();let e=!0;this.#d=w(()=>{const t=this.context.checkout.latestReceipt.value;if(e)e=!1;else if("failed"===t?.status&&"payment"===t.failure.type){const e="code"in t.failure?String(t.failure.code).toLowerCase():"unknown";this.error({code:"PAYMENT_ERROR",message:e,severity:"recoverable",path:"$.payment",timestamp:Date.now()})}if("failed"===t?.status){const e="code"in t.failure?t.failure.code:"unknown";this.observability.receiptError(t.failure.type,e)}if("failed"===t?.status&&this.#n){const e=this.#n;return this.#n=null,this.observability.submitReceiptFailed(e,t.failure.type),void this.#a.send(this.#o.buildErrorResponse(e,new re(t.failure.type)))}t&&"processed"===t.status&&(this.complete(),this.#I())})}#I(){this.context.checkout.configuration.isUniversalCheckoutFinalizer||this.cleanup()}async#f(){if(!this.#a.isLoopback)return!0;const e=await this.#a.waitForTarget();if(this.#a.isDisposed)return!1;if("loopback"===e){const e=new ce("No embedder transport detected. Checkout was loaded in embedded mode but no parent frame or native bridge was found.");throw this.observability.noTransportDetected(e.message,this.#a.environmentSnapshot),e}return!0}#y(){if(!this.#v())return;const e=new ae;throw this.observability.unauthenticatedIframe(e.message),e}#v(){return this.#a.isIframe&&!this.context.embed.isAuthenticated}}export{ze as Ucp2026_04_08Client};

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.