PageSourceSearch

https://www.trekaro.com/cdn/shopifycloud/portable-wallets/latest/portable-wallets.de.js

js trekaro.com collected 2026-09-24 11:00:33 UTC 388,353 bytes, 138 lines download raw bytes

1import.meta;function zo(){Array.prototype.flatMap||(Array.prototype.flatMap=function(t,e){const r=[];for(let n=0;n<this.length;n++){const a=t.call(e,this[n],n,this);if(Array.isArray(a))for(const i of a)r.push(i);else r.push(a)}return r})}zo();var Fo=":host{justify-content:center;align-items:center;display:flex}",Uo=class extends HTMLElement{size="18px";color="gray";connectedCallback(){this.attachShadow({mode:"open"}),this.size=this.getAttribute("size")??this.size,this.color=this.getAttribute("color")??this.color,this.render();const t=document.createElement("style");t.textContent=Fo,this.shadowRoot.appendChild(t)}render(){const t=this.shadowRoot;t.innerHTML=`
2      <svg ${`
3      width="${this.size}"
4      height="${this.size}"
5      xmlns="http://www.w3.org/2000/svg"
6      aria-hidden="true"
7    `} viewBox="0 0 20 20" fill="${this.color}">
8        <path d="M17.1 4.3l-1.4-1.4-5.7 5.7-5.7-5.7-1.4 1.4 5.7 5.7-5.7 5.7 1.4 1.4 5.7-5.7 5.7 5.7 1.4-1.4-5.7-5.7z"/>
9      </svg>
10    `}},Bo="#overlay{z-index:2147483647;background:#0006;width:100%;height:100%;animation:.3s ease-out modalPop;position:fixed;top:0;left:0}#modal{color:#000;background:#fff;border-radius:5px;width:100%;max-width:383px;animation:.3s forwards modalSlideInFromTop;position:fixed;top:20%;left:50%;transform:translate(-50%,-100%)}@keyframes modalPop{0%{opacity:0}to{opacity:1}}@keyframes modalSlideInFromTop{0%{transform:translate(-50%,-100%)}to{transform:translate(-50%)}}@keyframes modalSlideInFromBottom{0%{transform:translate(-50%,100%)}to{transform:translate(-50%)}}@media only screen and (width<=640px){#modal{animation:.3s forwards modalSlideInFromBottom;top:auto;bottom:0}}#modal footer{padding:0 21px 21px}#modal header{justify-content:space-between;padding:21px 21px 16px;display:flex}#title{word-wrap:break-word;overflow-wrap:break-word;margin:0;font-size:21px;font-weight:600;line-height:25.2px}.capitalize:first-letter{text-transform:capitalize;display:inline-block}#content{text-align:left;max-height:50vh;padding:0 21px 16px;overflow:auto}#modal #content p{margin:0;font-size:14px;line-height:21px}#close-icon,#close-button{cursor:pointer}#close-icon{background:0 0;border:none;min-width:24px;padding:0}#close-button{color:#fff;background-color:#1773b0;border:none;border-radius:5px;width:100%;padding:16px 21px;font-family:inherit;font-size:14px;line-height:21px}#close-button:hover,#close-button:active{background:#136f99}#close-button:active,#close-button:focus{box-shadow:0 0 0 4px #1990c640}";function Go(t){return Fa(t).map(e=>e instanceof Error?e:new Ua(`[${typeof e}] ${Ho(e).slice(0,10240)}`))}function Fa(t,e=0){return e>=20?[t,"Truncated cause stack"]:t instanceof Error&&t.cause?[t,...Fa(t.cause,e+1)]:[t]}function Ho(t){if(typeof t=="function")return`${t.name||"anonymous"}`;if(typeof t!="string")try{return JSON.stringify(t)??typeof t}catch{}return`${t}`}var Ua=class extends Error{name="BugsnagInvalidError"},Ba=/^\s*at .*(\S+:\d+|\(native\))/m,$o=/^(eval@)?(\[native code])?$/;function Vo(t){return t.stack?t.stack.match(Ba)?Wo(t):jo(t):[]}function Ga(t){if(t.indexOf(":")===-1)return[t];let e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));return[e[1],e[2]?Number(e[2]):void 0,e[3]?Number(e[3]):void 0]}function Wo(t){return t.stack.split(`
11`).filter(e=>!!e.match(Ba)).map(e=>{let r=e.replace(/^\s+/,"").replace(/^.*?\s+/,""),n=r.match(/ (\(.+\)$)/);r=n?r.replace(n[0],""):r;let a=Ga(n?n[1]:r);return{method:n&&r||void 0,file:["eval","<anonymous>"].indexOf(a[0])>-1?void 0:a[0],lineNumber:a[1],columnNumber:a[2]}})}function jo(t){return t.stack.split(`
12`).filter(e=>!e.match($o)).map(e=>{if(e.indexOf("@")===-1&&e.indexOf(":")===-1)return{method:e};let r=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(r),a=n&&n[1]?n[1]:void 0,i=Ga(e.replace(r,""));return{method:a,file:i[0],lineNumber:i[1],columnNumber:i[2]}})}var Ve="5",qo=class{breadcrumbs=[];apiKey;plugins;appId;appType;appVersion;releaseStage;locale;userAgent;metadata;persistedMetadata;onError;onPostErrorListeners=[];endpoints;session;constructor(t){this.apiKey=t.apiKey,this.appType=t.appType,this.appId=t.appId,this.appVersion=t.appVersion,this.releaseStage=t.releaseStage,this.locale=t.locale,this.userAgent=t.userAgent,this.metadata=t.metadata,this.onError=t.onError,this.persistedMetadata={},this.endpoints=t.endpoints??{notify:"https://error-analytics-production.shopifysvc.com",sessions:"https://error-analytics-sessions-production.shopifysvc.com/observeonly"}
12,this.plugins=t.plugins??[],this.plugins.forEach(e=>e.load(this)),this.leaveBreadcrumb("Bugsnag started",void 0,"state"),(t.withSessionTracking??!0)&&(this.session={id:this.getRandomUUID(),startedAt:new Date().toISOString(),events:{handled:0,unhandled:0}},this.startSession())}addMetadata(t){for(let e of Object.keys(t))this.persistedMetadata[e]=t[e]}getSessionId(){return this.session?.id}leaveBreadcrumb(t,e,r="manual"){this.breadcrumbs.push({name:t,metaData:e,type:r,timestamp:new Date().toISOString()})}notify(t,{errorClass:e,severity:r,severityType:n,handled:a=!0,metadata:i,context:o,groupingHash:s}={}){let l=Go(t),d={...this.metadata,...this.persistedMetadata,...i},u=this.buildBugsnagEvent(l,{errorClass:e,severityType:n,handled:a,severity:r,metadata:d,context:o,groupingHash:s});if((this.onError?.(u,t)??!0)&&this.releaseStage!=="development"){this.updateAndAppendSessionInformation(u);let h=this.sendToBugsnag(u);return this.onPostErrorListeners.forEach(p=>p(u,t)),h}return Promise.resolve()}addOnPostError(t){this.onPostErrorListeners.push(t)}updateAndAppendSessionInformation(t){this.session&&(t.unhandled?this.session.events.unhandled++:this.session.events.handled++,t.session=this.session)}buildBugsnagEvent(t,{errorClass:e,severity:r="error",severityType:n="handledException",handled:a,metadata:i={},context:o,groupingHash:s}){let l=new Date().toISOString(),{breadcrumbs:d,appId:u,appType:h,appVersion:p,releaseStage:y,locale:_,userAgent:v}=this;return{payloadVersion:Ve,exceptions:t.map((T,w)=>({errorClass:w===0?e??T.name:T.name,stacktrace:Ha(u,T),message:T.message,type:"browserjs"})),severity:r,severityReason:{type:n},unhandled:!a,app:{id:u,type:h,version:p,releaseStage:y},device:{time:l,locale:_,userAgent:v},breadcrumbs:d,context:o,metaData:i,groupingHash:s}}async startSession(){if(this.releaseStage==="development"){console.log("Skipping error logging session tracking in development mode");return}let{apiKey:t}=this,e={notifier:{name:"Bugsnag JavaScript",version:"7.22.2",url:"https://github.com/bugsnag/bugsnag-js"},app:{version:this.appVersion,releaseStage:this.releaseStage,type:this.appType},device:{id:this.appId,locale:this.locale,userAgent:this.userAgent},sessions:[this.session]};try{await fetch(this.endpoints.sessions,{method:"POST",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":t,"Bugsnag-Payload-Version":Ve,"Bugsnag-Sent-At":this.session?.startedAt??new Date().toISOString()},body:JSON.stringify(e,Yr())})}catch(r){console.warn("[bugsnag-light] failed to start session"),console.warn(r)}}async sendToBugsnag(t){let{apiKey:e}=this,r={apiKey:e,notifier:{name:"Bugsnag JavaScript",version:"7.22.2",url:"https://github.com/bugsnag/bugsnag-js"},events:[t]};try{await fetch(this.endpoints.notify,{method:"POST",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":e,"Bugsnag-Payload-Version":Ve,"Bugsnag-Sent-At":t.device.time},body:JSON.stringify(r,Yr())})}catch(n){console.warn("[bugsnag-light] failed to send an event"),console.warn(n)}}getRandomUUID(){try{return crypto.randomUUID()}catch{return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}}};function Ha(t,e){let r=Vo(e).map(n=>{let a=n.file?.includes(t);return{method:n.method??"",file:n.file??"",lineNumber:n.lineNumber??0,columnNumber:n.columnNumber,inProject:a}});if(e instanceof Ua){let n=r.findIndex(a=>a.method.endsWith("notify"));n>-1&&(r=r.slice(n+1))}return r}function Yr(){let t=new WeakSet;return function(e,r){if(typeof r=="object"&&r!==null){if(t.has(r))return"[Circular]";t.add(r)}return r}}
12var Yo=class wn extends Error{reason;constructor(e){super(e),this.name="BreadcrumbsPluginFetchError",Object.setPrototypeOf(this,wn.prototype)}};function Ko(t,{metadata:e}={}){let r=window.onerror;window.onerror=(n,a,i,o,s)=>{s&&t.notify(s,{severityType:"unhandledException",handled:!1,metadata:e}),typeof r=="function"&&r.apply(window.onerror,[n,a,i,o,s])}}function Qo(t,{metadata:e}={}){window.addEventListener("unhandledrejection",r=>{r.reason&&r.reason instanceof Error&&r.reason.stack&&!(r.reason instanceof Yo)&&t.notify(r.reason,{severityType:"unhandledPromiseRejection",handled:!1,metadata:e})})}function _r(t){try{const e=new RegExp(`(^| )${t}=([^;]+)`).exec(document.cookie);if(e){const r=e[2];try{return decodeURIComponent(r)}catch{return r}}return null}catch{return null}}var nr={BRANDED_BUTTON:"shopify-payment-button__button shopify-payment-button__button--branded",UNBRANDED_BUTTON:"shopify-payment-button__button shopify-payment-button__button--unbranded",MORE_PAYMENT_OPTION_BUTTON:"shopify-payment-button__more-options",HIDDEN:"shopify-payment-button__button--hidden"},Xo={DARK:"apple-pay--dark",LIGHT:"apple-pay--light"},Jo="https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",Zo="discount_code",ti="https://static-na.payments-amazon.com",Er=`${ti}/checkout.js`,D={CURRENCY_CHANGE:"wallet_currency_change",CAPTCHA_REQUIRED:"wallet_captcha_required",NOT_ENOUGH_STOCK:"wallet_not_enough_stock",PRICE_INCREASED:"wallet_price_increased",PAYMENT_METHOD_NOT_APPLICABLE:"wallet_payment_method_not_applicable",INVALID_PAYMENT_DEFERRED_PAYMENT_REQUIRED:"wallet_invalid_payment_deferred_payment_required",WALLET_PROCESSING_FAILED:"wallet_processing_failed",UNSUPPORTED_APPLE_PAY_PAYMENT_METHOD:"wallet_unsupported_apple_pay_payment_method",UNSUPPORTED_GOOGLE_PAY_PAYMENT_METHOD:"wallet_unsupported_google_pay_payment_method",PAYMENTS_COUNTRY_INVALID:"wallet_payments_country_invalid",LOCALIZATION_EXTENSION_FIELD_ERROR:"wallet_localization_extension_field_error",SUBSCRIPTION_REVIEW_REQUIRED:"wallet_subscription_review_required",SUBSCRIPTION_REVIEW_REQUIRED_BANNER_LESS:"wallet_subscription_review_required_banner_less",SHIPPING_COUNTRY_UNAVAILABLE:"wallet_shipping_country_unavailable"},Va="portable-wallets",_t={BUTTON:"accelerated-checkout-button",BUTTON_ON_CART:"accelerated-checkout-button-cart",CONTAINER:"accelerated-checkout-button-container"},ei="unknown",Wa={name:"buy_it_now",supports_subs:!0,supports_def_opts:!0,wallet_params:{}};function ja(t){try{return!t.toString().includes("[native code]")}catch{return!0}}var We=new Map,ri={checkDuplicate({errorClass:t,message:e}){if(We.has(t)){const r=We.get(t);if(r.has(e))return!0;r.add(e)}else We.set(t,new Set([e]));return!1},reset(){}},J=class extends Error{#t;get autogenerateHash(){return!1}get useHashPrefix(){return!1}constructor(t,{groupingHash:e,...r}={}){super(t,r),this.#t=e}get groupingHash(){const t=this.#t??(this.autogenerateHash?ai(this.message):"");return(this.useHashPrefix?`${this.name}-${t}`:t)||void 0}};function ai(t){return t.toLowerCase().slice(0,100).replace(/[^a-z0-9\s]/g,"").trim().split(/\s+/).slice(0,5).join("-")}var Ar="DeveloperError",q=class extends Error{#t;constructor({code:t,message:e},r){const n=`An unexpected error happened likely because of customizations made to HTML/JavaScript on this site ${e}`;super(`[${t}]: ${n}`,r),this.#t=t}get code(){return this.#t}};q.prototype.name=Ar;var qa="SilencedError",Ya="[silenced]",W=class extends Error{constructor(t,e){super(`${Ya} ${t}`,e)}};W.prototype.name=qa;var Ka=class extends Error{};Ka.prototype.name="MissingConfigError";var tt=class extends J{get useHashPrefix(){return!0}get autogenerateHash(){return!0}};tt.prototype.name="NoResponseError";var Ne=class $a extends J{static generateGraphQLGroupingHash(e,r){const{operationName:n}=r,a=this.getErrorMessageCategoryFromMessage(e);return n?`${n}-${a}`:a}static getErrorMessageCategoryFromMessage(e){for(const[n,a]of[[/Variable \$\w+ of type \w+!? was provided invalid value/i,"graphql-input-validation"],[/Cannot read propert(?:y|ies)(?: .+)? of (?:null|undefined)/i,"null-property-access"],[/(?:null|undefined) is not an object/i,"null-not-object"]]){const i=e.match(n);if(i){const o=i[1];return o?`${a}-${o}`:a}}let r=e;for(const n of[/^GraphQL response error for \w+:\s*(with status \d+\s*=>\s*|=>\s*)?/i,/^GraphQL\s+Client:\s*/i,/^GraphQL\s+response\s+error\s+for\s+\w+:\s*with\s+status\s+\d+\s*=>\s*/i,/An error occurred while fetching from the API. Review 'graphQLErrors' for details./i])r=r.replace(n,"");return r=r.slice(0,100),r.toLowerCase().replace(/[^a-z0-9\s]/g,"").trim().split(/\s+/).slice(0,5).join("-")||"unknown-error"}#t;get useHashPrefix(){return!0}constructor(e,{errorDetails:r}){const n=$a.generateGraphQLGroupingHash(e,r);super(e,{groupingHash:n}),this.#t=r}get errorDetails(){return this.#t}};Ne.prototype.name="GraphQLResponseError";var Xa="IgnoredGraphQLResponseError",Dt=class extends Ne{#t;constructor(t,{reason:e,errorDetails:r}){super(t,{errorDetails:r}),this.#t=e}get reason(){return this.#t}};Dt.prototype.name=Xa;var Ja=class extends J{constructor(t){const e=`[${t}] completion returned null result`;super(e,{groupingHash:`${t}-expected-completion-null-result`})}};function R(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var ni=0;function lt(t){return"__private_"+ni+++"_"+t}function Oe(t){return Object.entries(t).map(([e,r])=>({key:e,value:{stringValue:String(r)}}))}function oi(t){return Object.entries(t).map(([e,r])=>({key:e,value:Za(r)}))}function Za(t){if(Array.isArray(t))return{arrayValue:{values:t.map(e=>Za(e))}};switch(typeof t){case"boolean":return{boolValue:!!t};case"number":return{doubleValue:Number(t)};default:return{stringValue:String(t)}}}var Cr=1,ii=si(5,2,12);function si(t,e,r){const n=[0];for(let a=0;a<r;a++){const i=Math.floor(t*e**a);n.push(i)}return n}var pt=lt("exporter"),Y=lt("attributes"),$=lt("metrics"),mt=lt("logs"),li=class{constructor({exporter:t,attributes:e}){Object.defineProperty(this,pt,{writable:!0,value:void 0}),Object.defineProperty(this,Y,{writable:!0,value:void 0}),Object.defineProperty(this,$,{writable:!0,value:[]}),Object.defineProperty(this,mt,{writable:!0,value:[]}),R(this,pt)[pt]=t,R(this,Y)[Y]=e??{}}addAttributes(t){R(this,Y)[Y]={...R(this,Y)[Y],...t}}
12histogram({name:t,value:e,unit:r,bounds:n,attributes:a,scale:i}){const o=Date.now()*1e6;n?R(this,$)[$].push({name:t,type:"histogram",value:e,unit:r,timeUnixNano:o,attributes:a,bounds:n}):R(this,$)[$].push({name:t,type:"exponential_histogram",value:e,unit:r,timeUnixNano:o,attributes:a,scale:i})}counter({name:t,value:e,unit:r,attributes:n}){const a=Date.now()*1e6;R(this,$)[$].push({name:t,type:"counter",value:e,unit:r,timeUnixNano:a,attributes:n})}gauge({name:t,value:e,unit:r,attributes:n}){const a=Date.now()*1e6;R(this,$)[$].push({name:t,type:"gauge",value:e,unit:r,timeUnixNano:a,attributes:n})}log({body:t,attributes:e}){const r=Date.now()*1e6;R(this,mt)[mt].push({timeUnixNano:r,body:t,attributes:e})}async exportMetrics(){const t={};R(this,$)[$].forEach(r=>{switch(r.attributes={...R(this,Y)[Y],...r.attributes},r.type){case"histogram":ci(t,r);break;case"exponential_histogram":di(t,r);break;case"counter":ui(t,r);break;case"gauge":hi(t,r)}});const e=Object.values(t);e.length!==0&&(R(this,$)[$]=[],await R(this,pt)[pt].exportMetrics(e))}async exportLogs(){const t=R(this,mt)[mt].map(e=>{const r={timeUnixNano:e.timeUnixNano,observedTimeUnixNano:e.timeUnixNano,attributes:oi({...R(this,Y)[Y],...e.attributes})};return e.body&&(r.body={stringValue:e.body}),r});t.length!==0&&(R(this,mt)[mt]=[],await R(this,pt)[pt].exportLogs(t))}};function ci(t,e){var r;const{name:n,value:a,unit:i,timeUnixNano:o,attributes:s}=e,l=(r=e.bounds)!==null&&r!==void 0?r:ii,d=new Array(l.length+1).fill(0);t[n]||={name:n,unit:i||"1",histogram:{aggregationTemporality:Cr,dataPoints:[]}};for(let u=0;u<d.length;u++){const h=l[u];if(h===void 0)d[u]=1;else if(a<=h){d[u]=1;break}}t[n].histogram.dataPoints.push({startTimeUnixNano:o,timeUnixNano:o,count:1,sum:a,min:a,max:a,bucketCounts:d,explicitBounds:l,attributes:Oe(s??{})})}function di(t,e){const{name:r,value:n,unit:a,timeUnixNano:i,attributes:o,scale:s}=e;t[r]||={name:r,unit:a||"1",exponentialHistogram:{aggregationTemporality:Cr,dataPoints:[]}};const l=n<=0?0:n,d=s||3,u=2**d/Math.log(2),h=Math.ceil(Math.log(n)*u)-1,p=n<=0?1:0,y={offset:0,bucketCounts:[]},_={offset:n>0?h:0,bucketCounts:n>0?[1]:[]};t[r].exponentialHistogram.dataPoints.push({attributes:Oe(o??{}),startTimeUnixNano:i,timeUnixNano:i,count:1,sum:l,scale:d,zeroCount:p,positive:_,negative:y,min:l,max:l,zeroThreshold:0})}function ui(t,e){const{name:r,value:n,unit:a,timeUnixNano:i,attributes:o}=e;t[r]||={name:r,unit:a||"1",sum:{aggregationTemporality:Cr,isMonotonic:!0,dataPoints:[]}},t[r].sum.dataPoints.push({startTimeUnixNano:i,timeUnixNano:i,asDouble:n,attributes:Oe(o??{})})}function hi(t,e){const{name:r,value:n,unit:a,timeUnixNano:i,attributes:o}=e;t[r]||={name:r,unit:a||"1",gauge:{dataPoints:[]}},t[r].gauge.dataPoints.push({startTimeUnixNano:i,timeUnixNano:i,asDouble:n,attributes:Oe(o??{})})}var Ut=lt("url"),gt=lt("serviceName"),Bt=lt("logger"),Gt=lt("fetchFn"),pi=class{constructor(t,e,r){Object.defineProperty(this,Ut,{writable:!0,value:void 0}),Object.defineProperty(this,gt,{writable:!0,value:void 0}),Object.defineProperty(this,Bt,{writable:!0,value:void 0}),Object.defineProperty(this,Gt,{writable:!0,value:void 0}),R(this,Ut)[Ut]=t.replace(/\/v1\/(logs|metrics|traces)\/?$/,""),R(this,gt)[gt]=e,R(this,Bt)[Bt]=r?.logger,R(this,Gt)[Gt]=r?.fetchFn}async exportMetrics(t){const e={resourceMetrics:[{resource:{attributes:[{key:"service.name",value:{stringValue:R(this,gt)[gt]}}]},scopeMetrics:[{scope:{name:"open-telemetry-mini-client",version:"1.1.0",attributes:[]},metrics:t}]}]};await this.exportTo(e,"/v1/metrics")}async exportLogs(t){const e={resourceLogs:[{resource:{attributes:[{key:"service.name",value:{stringValue:R(this,gt)[gt]}}]},scopeLogs:[{scope:{name:"open-telemetry-mini-client",version:"1.1.0",attributes:[]},logRecords:t}]}]};await this.exportTo(e,"/v1/logs")}async exportTo(t,e){var r;const n=await this.exporterFetch()(`${R(this,Ut)[Ut]}${e}`,{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if((r=R(this,Bt)[Bt])===null||r===void 0||r.log({status:n.status}),!n.ok){if(n.status===400){const a=await n.text();throw new Wt(`Invalid OpenTelemetry Data: ${a}`)}if(n.status===429||n.status===503){const a=await n.text(),i=n.headers.get("Retry-After"),o=i?{seconds:Number(i)}:void 0;throw new Wt("Server did not accept data",{errorData:a,retryAfter:o,body:t})}throw new Wt(`Server responded with ${n.status}`)}}exporterFetch(){return R(this,Gt)[Gt]||fetch}}
12,Wt=class extends Error{constructor(t,e){super(t),this.metadata=void 0,this.name="OpenTelemetryClientError",this.metadata=e}},mi="https://otlp-http-production.shopifysvc.com",gi="portable_wallets",fi=class{#t;constructor(t){this.#t=t}async exportMetrics(t){try{await this.#t.exportMetrics(t)}catch(e){if(e instanceof Wt){const r=e.metadata?.retryAfter;if(r){await new Promise(n=>{setTimeout(()=>{this.exportMetrics(t),n()},r.seconds*1e3)});return}}console.error("Suppressed error while exporting metrics:",e,e instanceof Error?e.cause:void 0)}}async exportLogs(t){try{await this.#t.exportLogs(t)}catch(e){if(e instanceof Wt){const r=e.metadata?.retryAfter;if(r){await new Promise(n=>{setTimeout(()=>{this.exportLogs(t),n()},r.seconds*1e3)});return}}console.error("Suppressed error while exporting logs:",e,e instanceof Error?e.cause:void 0)}}},yi=new fi(new pi(mi,gi)),E=new li({exporter:yi}),tn="TelemetryExportError",bi=class extends Error{};bi.prototype.name=tn;var en="LimitedCartQueryError",rn=class extends Error{};rn.prototype.name=en;var wi=["log","error","debug","warn","info","table"],an=["OpenTelemetryClientError",qa,tn,Xa,Ar],_i=["Load failed","Failed to fetch","when attempting to fetch resource","GraphQL mutation failed with status 404","Component closed",'"isTrusted":true',"CSS.escape is not a function",Ya,...an],Kr=new Map([["TypeError","Illegal constructor"],[en,"Limited cart query returned no response"],["AbortError","Fetch is aborted"]]),Ei=["replaceProperty","replaceWithProxy"],Ai=["chrome-lighthouse","meta-externalads","crawler","spider","scraper","facebookexternalhit","googleother","bot"],Ci=["lightpanda"],nn="silenced-logged-user-agent";function vi(t){return t===nn}function Si(t){const e=t.exceptions[0],r=Pi();return r||(Ii(t)?"empty-stack-trace":ki(e)?"spin":Ti()?"monkey-patch":Li(t)?"external-error":Ri(t)?"injected-code":Mi(t)?"developer-error":xi(e.message)?"discarded-message":zi(t)?"discarded-error-class":Fi(e)?"discarded-class-message":Ui(t)?"unactionable-invalid-error":Ni(t)||null)}function Pi(){const t=navigator.userAgent.toLowerCase();return Ci.some(e=>t.includes(e))?nn:Ai.some(e=>t.includes(e))?"silenced-user-agent":null}function Ii(t){return t.exceptions[0].stacktrace.length===0}function ki(t){return t.stacktrace.some(e=>e.file?.includes("spin.dev"))}function Ti(){return[HTMLElement,Event,document.createElement,URL].some(ja)||Di()}function Di(){return wi.some(t=>typeof console[t]!="function")}function Ri(t){return t.exceptions.some(e=>e.stacktrace.some(r=>r.inProject&&"method"in r&&Ei.some(n=>r.method===n||r.method.endsWith(`.${n}`))))}function Ni(t){const e=t.exceptions.map(r=>r.stacktrace.filter(n=>!Oi(n)));return e.some(r=>!r[0]?.inProject)?"external-trigger":e.some(r=>r.filter(n=>n.inProject).every(n=>["https://www.paypal.com","https://static-na.payments-amazon.com","https://pay.google.com"].some(a=>n.file.startsWith(a))))?"wallet-sdk-stack-trace":null}function Oi(t){return t.file.includes("native code")||t.file.includes("/cdn/wpm/")}function Li(t){return!t.exceptions[0].stacktrace.some(e=>e.inProject)}function xi(t){return _i.some(e=>t?.includes(e))}function Mi(t){const e=t.exceptions.some(r=>r.errorClass===Ar);return e&&console.error(t.exceptions[0]),e}function zi(t){return t.exceptions.some(e=>an.includes(e.errorClass))}function Fi(t){const e=t.errorClass,r=t.message;return Kr.has(e)&&r?.includes(Kr.get(e))}function Ui(t){return t.exceptions[0].errorClass==="BugsnagInvalidError"&&t.unhandled}var m=(function(t){return t.BuyItNow="BuyItNow",t.MoreOptions="MoreOptions",t.ApplePay="ApplePay",t.PayPal="PayPal",t.Venmo="Venmo",t.GooglePay="GooglePay",t.ShopPay="ShopPay",t.MetaPay="FacebookPay",t.BuyWithPrime="BuyWithPrime",t.AmazonPay="AmazonPay",t.Unknown="Unknown",t})({}),F=(function(t){return t.InvalidQuantity="InvalidQuantity",t.VariantRequiresSellingPlan="VariantRequiresSellingPlan",t.SellingPlanNotApplicable="SellingPlanNotApplicable",t.MerchandiseIdInvalid="MerchandiseIdInvalid",t.IgnoredResponseError="IgnoredGraphQLResponseError",t.NoResponse="NoResponse",t.InvalidInput="InvalidInput",t.MerchandiseNotApplicable="MerchandiseNotApplicable",t.ProductFormError="ProductFormError",t.MerchandiseLineTransformersRunError="MerchandiseLineTransformersRunError",t.GiftCardRecipientInvalid="GiftCardRecipientInvalid",t})({}),S=(function(t){return t.CartPage="cart_page",t.CartAjax="cart_ajax",t.ProductPage="product",t.Checkout="checkout",t.Unknown="unknown",t})({}),ie=(function(t){return t.CartChange="/cart/change",t.CartUpdate="/cart/update",t.CartAdd="/cart/add",t.CartClear="/cart/clear",t})({}),Rt=(function(t){return t.OneTimePurchase="ONE_TIME_PURCHASE",t.Subscription="SUBSCRIPTION",t})({}),Le=Bi();function Bi(){return{shop_id:ei,debug:!1,pageType:S.Unknown}}function on(t){Object.assign(Le,t)}function vr(){const{debug:t,...e}=Le;return e}function sn(){return Le.debug}function Sr(){return Le.pageType}function Gi(){return{appVersion:"0.1.95",userAgent:navigator.userAgent}}function ln(t={}){return{...vr(),...Gi(),...t}}var C=(function(t){return t.ButtonRender="portable_wallets_button_render",t.ButtonRenderTimeFromFcp="portable_wallets_button_render_time_from_fcp",t.Decelerated="portable_wallets_decelerated",t.DeliveryWrongNumberOfLines="portable_wallets_delivery_wrong_number_of_lines",t.DigitalPhysicalMismatch="portable_wallets_digital_physical_mismatch",t.InitCompleted="portable_wallets_init_completed",t.InstrumentLoadEligibility="portable_wallets_instrument_load_eligibility",t.InstrumentLoaded="portable_wallets_instrument_loaded",t.InstrumentLoadTime="portable_wallets_instrument_load_time",t.InstrumentLoadTimeFromPageLoad="portable_wallets_instrument_load_time_from_page_load",t.MonorailProduceError="portable_wallets_monorail_produce_error",t.SheetClicked="portable_wallets_sheet_clicked",t.SheetCancelled="portable_wallets_sheet_cancelled",t.SheetFailed="portable_wallets_sheet_failed",t.UpdateFailed="portable_wallets_update_failed",t.PayPalTokenCreationError="portable_wallets_paypal_token_creation_error",t.AuthorizationAttempt="portable_wallets_authorization_attempt",t.AuthorizationComplete="portable_wallets_authorization_complete",t.CartTokenMissing="portable_wallets_cart_token_missing",t.RemovePersonalDataResult="portable_wallets_cart_remove_personal_data_result",t.GooglePayNotEligibleWebview="portable_wallets_google_pay_not_eligible_webview",t.WalletConfigDeveloperError="portable_wallets_wallet_config_developer_error",t.LegacyCartCookie="portable_wallets_legacy_cart_cookie",t.StyleBackwardsCompatibility="portable_wallets_style_backwards_compatibility",t.StyleBackwardsCompatibilityExecutionTime="portable_wallets_style_backwards_compatibility_execution_time",t.StyleBackwardsCompatibilityRules="portable_wallets_style_backwards_compatibility_rules",t.AmazonPayLoadRetries="portable_wallets_amazon_pay_sdk_load_retries",t.DynamicTaxFailed="portable_wallets_dynamic_tax_failed",t.SheetLoaded="portable_wallets_sheet_loaded",t.ErrorTriggered="portable_wallets_error_triggered",t.GooglePayNullCartOnAuthorize="portable_wallets_google_pay_null_cart_on_authorize",t.UnrecoverableCartError="portable_wallets_unrecoverable_cart_error",t.ShopPayPersonalizedIframeLoadTime="portable_wallets_shop_pay_personalized_iframe_load_time",t.ShopPayPersonalizedIframeLoadTimeFromPageLoad="portable_wallets_shop_pay_personalized_iframe_load_time_from_page_load",t.PaymentCompletedAfterAbort="portable_wallets_payment_completed_after_abort",t.WalletSessionAbortError="portable_wallets_wallet_session_abort_error",t.CartPaymentUpdateRetryResult="portable_wallets_cart_payment_update_retry_result",t.ProductFormError="portable_wallets_product_form_error",t.CardsinkDepositResult="portable_wallets_cardsink_deposit_result",t.AddressFieldError="portable_wallets_address_field_error",t.WalletsPlatformConfigResult="portable_wallets_wallets_platform_config_result",t})({}),It=(function(t){return t.InstrumentSdkLoaded="portable_wallets_instrument_sdk_loaded",t.InstrumentSdkFailed="portable_wallets_instrument_sdk_failed",t.InstrumentSdkEligible="portable_wallets_instrument_sdk_eligible",t.InstrumentSdkNotEligible="portable_wallets_instrument_sdk_not_eligible",t})({});function Hi(t,e){const r=t.exceptions[0];if(!r||!r.message||ri.checkDuplicate(r))return!1;$i(t,Wi(e),e);let n=null;try{n=Si(t)}catch(i){const o=i;console.error(o);const s={errorClass:"UnfilterableError",message:`Could not properly filter error with message: ${o.message}`,stacktrace:Ha(Va,o)};t.exceptions.unshift(s)}Ki(n);const a=n==null;return(a||sn()||vi(n))&&Qi({errorClass:r.errorClass,message:r.message,stacktrace:JSON.stringify(r.stacktrace),filterResult:n,metadata:JSON.stringify(t.metaData)}),a}function $i(t,e,r){const n=window.ShopifyAnalytics?.lib?.trekkie?.defaultAttributes;t.context=window.location.pathname,t.request||={},t.request.url=window.location.href,t.device.orientation=window.screen?.orientation?.type,ji(t),qi(t),t.groupingHash=Vi(e);const{shop_id:a,...i}=vr();t.metaData={...t.metaData,shop:{shopId:a,...i,...t.metaData.shop},custom:{...t.metaData.custom,customFetch:ja(fetch),...Yi(r)},error_source:{shop_id:a},monorail:n},e[0]instanceof Ne&&(t.metaData.graphql={...e[0].errorDetails},e[0]instanceof Dt&&(t.metaData.graphql.reason=e[0].reason))}function Vi(t){for(const e of t)if("groupingHash"in e&&e.groupingHash)return e.groupingHash.toString()}function Wi(t){const e=[];let r=t;for(;r instanceof Error&&e.length<20;){e.push(r);const n="cause"in r?r.cause:null;if(!n)break;r=n}return e}function ji(t){for(const e of t.exceptions)for(const r of e.stacktrace)["https://www.paypal.com","https://static-na.payments-amazon.com","https://pay.google.com"].some(n=>r.file.startsWith(n))&&(r.inProject=!0)}function qi(t){for(const e of t.exceptions)for(const r of e.stacktrace)r.file?.includes("portable-wallets")&&(r.file=r.file.split("#")[0].split("?")[0])}function Yi(t){if(sn()&&!(!(t instanceof Error)||!t.stack))return{rawStack:t.stack}}function Ki(t){E.counter({name:C.ErrorTriggered,value:1,attributes:{filterResult:t||"valid-error"}})}function Qi(t){E.log({body:"Bugsnag Error",attributes:ln(t)})}var Xi={apiKey:"e6b446c1ebe782e2b2fc7eb8ef0dc791",appId:Va,appVersion:"0.1.95",releaseStage:"production",locale:"de",userAgent:navigator.userAgent,metadata:{user:{id:_r("_shopify_y")??"unknown"},app:{release:"f31c611189d9a47060e2a0c6a936fe5aaaaf542d"}},onError:Hi},g=new qo(Xi);g.addOnPostError(t=>{g.leaveBreadcrumb("Bugsnag Error Notified",{errorClass:t.exceptions[0].errorClass,message:t.exceptions[0].message},"error")});
12var Ji={de:{instruments_copy:{checkout:{buy_now:"Jetzt zum Checkout"}},error_dialogs:{checkout:{title:"Transaktion fehlgeschlagen",generic_error:"Checkout ist derzeit aufgrund technischer Probleme nicht verf\xFCgbar. Bitte versuche es in ein paar Minuten noch einmal.",button_text:"Schlie\xDFen"},wallet:{title:"%{wallet} nicht verf\xFCgbar",generic_error:"Es ist ein Problem mit %{wallet} aufgetreten. Versuche es erneut oder verwende eine andere Zahlungsmethode.",eligibility_error:"Artikel, die f\xFCr %{wallet} berechtigt waren, befinden sich nicht mehr in deinem Warenkorb."},product:{out_of_stock:"Dieser Artikel ist nicht mehr lieferbar.",gift_card_recipient_validation_error:"Die Person, die den Geschenkgutschein empfangen soll, ist ung\xFCltig."}},more_payment_options:"Weitere Bezahlm\xF6glichkeiten",brand:{apple_pay:"Apple Pay",amazon_pay:"Amazon Pay",shop_pay:"Shop Pay",buy_with_prime:"Buy with Prime",paypal:"PayPal",google_pay:"Google Pay"},buy_with_button_content:"Mit\xA0%{wallet}\xA0kaufen",order_summary:{total:"Gesamtsumme",subtotal:"Zwischensumme",duties:"Zollgeb\xFChren",taxes:"Gesch\xE4tzte Steuern",shipping:"Versand",discount:"Rabatt",shipping_one_time_purchase:"Versand (einmaliger Kauf)",shipping_subscription:"Versand (Abonnement)",subscriptions:{recurring_total_tooltip_line:"Beinhaltet keine Versandkosten, Steuern, Zollgeb\xFChren oder anwendbaren Rabatte",recurring_totals:"%{fixedPrice} jede/n/s %{interval}",recurring_totals_with_policies:{one:"Die erste Zahlung betr\xE4gt %{fixedPrice}, danach %{recurringPrice} alle %{interval}",other:"Die ersten %{count} Zahlungen betragen jeweils %{fixedPrice}, danach %{recurringPrice} alle %{interval}"},recurring_total_intervals:{day:{one:"Tag",other:"%{count}\xA0Tage"},month:{one:"Monat",other:"%{count}\xA0Monate"},week:{one:"Woche",other:"%{count}\xA0Wochen"},year:{one:"Jahr",other:"%{count}\xA0Jahre"}}}},errors:{missing:{address2:"Gib eine Wohnung, ein Zimmer usw. ein",phone:"Gib eine Telefonnummer ein",first_name:"Gib einen Vornamen ein",email:"Gib eine E-Mail-Adresse ein.",last_name:"Gib einen Nachnamen ein",address1:"Gib eine Adresse ein",city:"Gib eine Stadt ein",zone:"W\xE4hle ein Bundesland/eine Provinz aus",postal_code:"Gib eine Postleitzahl ein",shipping_option:"Eine Versandart ausw\xE4hlen",country:"Land ausw\xE4hlen",emirate:"Ein Emirat eingeben"},invalid:{email:"Gib eine g\xFCltige E-Mail-Adresse ein",country:"W\xE4hle ein Land / eine Region aus",phone:"Eine g\xFCltige Telefonnummer eingeben",first_name:"Gib einen g\xFCltigen Vornamen ein",last_name:"Gib einen g\xFCltigen Nachnamen ein",address1:"Gib eine g\xFCltige Adresse ein",address2:"Gib eine g\xFCltige Wohnung, ein g\xFCltiges Zimmer usw. ein",city:"Eine g\xFCltige Stadt eingeben",zone:"Ein g\xFCltiges Bundesland / eine g\xFCltige Provinz ausw\xE4hlen",postal_code:"Gib eine g\xFCltige Postleitzahl ein",billing_address:"Ung\xFCltige Rechnungsadresse",shipping_address:"Ung\xFCltige Lieferadresse",payment_method:"Ung\xFCltige Zahlungsmethode",discount:"Ung\xFCltiger Rabatt",emirate:"G\xFCltiges Emirat eingeben"},emojis:{first_name:"Vorname darf keine Emojis enthalten",last_name:"Nachname darf keine Emojis enthalten",city:"Stadt darf keine Emojis enthalten",address1:"Adresszeile darf keine Emojis enthalten",address2:"Zweite Adresszeile darf keine Emojis enthalten",postal_code:"Postleitzahl darf keine Emojis enthalten",phone:"Telefonnummer darf keine Emojis enthalten"},too_long:{address1:"Adresszeile ist zu lang",address2:"Zweite Adresszeile ist zu lang",first_name:"Vorname ist zu lang",last_name:"Nachname ist zu lang",city:"Stadt ist zu lang"},url:{first_name:"Vorname darf keine URL enthalten",last_name:"Nachname darf keine URL enthalten"},html_tags:{first_name:"Der Vorname darf keine HTML-Tags enthalten",last_name:"Der Nachname darf keine HTML-Tags enthalten",city:"Stadt darf keine HTML-Tags enthalten",address1:"Adresszeile darf keine HTML-Tags enthalten",address2:"Zweite Adresszeile darf keine HTML-Tags enthalten"},currency:{mismatch:"Dein Warenkorb und deine W\xE4hrung wurden anhand deines Versandlands aktualisiert."},address_unserviceable:"%{shopName} liefert derzeit nicht an diese Adresse. Verwende eine andere Adresse, um deinen Kauf abzuschlie\xDFen."},subscriptions:{cancellation_policy:"Stornierungsrichtlinie",policy_not_found:"Die Abonnement-Richtlinie konnte nicht gefunden werden. Aktualisiere die Seite oder kontaktiere uns, um weitere Informationen zu erhalten."},shipping_methods:{connect_shipping_methods:"%{methodOne} und %{methodTwo}",choose_delivery_strategy:"Eine Zustellmethode ausw\xE4hlen"},shop_promise_delivery:{same_day:"Zustellung am selben Tag",next_day:"Zustellung am n\xE4chsten Tag",two_day:"2-Tages-Zustellung"},action:{view:"%{content} anzeigen"},express_checkout:"Express-Checkout",delivery_promises:{connect_delivery_promises:"%{promiseOne} und %{promiseTwo}"},managed_markets:{terms_and_conditions:"Gesch\xE4ftsbedingungen des eingetragenen H\xE4ndlers",privacy_policy:"Datenschutzerkl\xE4rung des eingetragenen H\xE4ndlers",policy_not_found:"Die Richtlinie konnte nicht gefunden werden. Aktualisiere die Seite oder kontaktiere uns, um weitere Informationen zu erhalten"},pay_with_button_content:"Mit %{wallet} bezahlen",show_more_options:"Mehr anzeigen",hide_more_options:"Mehr ausblenden",google_pay_in_progress_scrim:{continue_purchase:"Setze deinen Kauf in %{wallet} fort",cancel:"Abbrechen"}}}
12,je,Qr=class extends Error{constructor(t,e){const r=`i18n: Missing or invalid translation '${t}' in '${e}'`;super(r)}},Zi=class extends Error{constructor(t,e,r){const n=`i18n: Missing translation template key '${t}' for '${e}' in '${r}'`;super(n)}},ts=class extends Error{constructor(t,e,r){const n=`i18n: Invalid pluralization for '${t}':'${e}' in '${r}'`;super(n)}};function xe(){return je==null&&(je=es(Ji)),je}function es(t){const e=(i,o)=>typeof i!="string"&&o.count!==void 0,r=(i,o)=>{let s=o===1?"one":"other";return o===0&&typeof i!="string"&&i.zero!==void 0&&(s="zero"),s},n=(i,o={})=>{const s=i.match(/%\{.+?\}/g);return s?s.reduce((l,d)=>{const u=d.replace(/%\{(.*)\}/,"$1");return o[u]?l.replace(d,o[u]):(g.notify(new Zi(u,i,a)),l)},i):i},a=rs();return{locale:a,translate(i,o={}){const s=i.split(".");let l=t[a];try{for(const d of s)switch(typeof l){case"object":l=l[d];break;case"string":case"undefined":throw new Qr(i,a)}if(e(l,o)){if(typeof l=="string")throw new ts(i,l,a);l=l[r(l,o.count)]}if(typeof l!="string")throw new Qr(i,a);return n(l,o)}catch(d){return g.notify(d),o.defaultValue??i}}}}function rs(){return"de"}function Xr(t){t&&t.src&&console.error(`Failed to load portable wallets script ${t.src}`);const e=document.querySelectorAll("shopify-accelerated-checkout .shopify-payment-button__skeleton, shopify-accelerated-checkout-cart .wallet-cart-button__skeleton"),r=document.getElementById("shopify-buyer-consent");for(let n=0;n<e.length;n++)e[n].remove();r&&r.remove()}function cn(t){!(t instanceof ErrorEvent)||!(typeof t.message=="string"&&t.message.includes("import.meta"))||!(typeof t.filename=="string"&&t.filename.includes("portable-wallets"))||(window.removeEventListener("error",cn),window.Shopify.PaymentButton.failedToLoad=t,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",window.Shopify.PaymentButton.init):window.Shopify.PaymentButton.init())}window.addEventListener("error",cn);var or=[];function Z(t,e,r){if(window.customElements==null)return g.leaveBreadcrumb("customElements is null on window"),Xr(),!1;try{const n=e;return window.customElements.get(t)||(window.customElements.define(t,n),r?.isChildCustomElement&&or.push(t)),!0}catch(n){return g.notify(n),Xr(),!1}}function ge(){const t=new URLSearchParams(window.location.search);return function(e){return!!t.get(e)}}function Pr(){try{const t=window.__WALLET_TIMEOUT_MULTIPLIER;if(t==null)return 1;const e=Number(t);return!Number.isFinite(e)||e<1?1:Math.min(e,10)}catch{return 1}}function Me(){const t=window.Shopify?.CartType;if(t===S.CartAjax)return S.CartAjax;if(t===S.CartPage)return S.CartPage;const e=window.ShopifyAnalytics?.meta?.page?.pageType;if(e)switch(e.toLowerCase()){case"product":return S.ProductPage;case"cart":return S.CartPage}const r=document.querySelector("#shop-js-analytics");if(r)try{const n=JSON.parse(r.textContent||"{}");if(n.pageType)switch(n.pageType.toLowerCase()){case"product":return S.ProductPage;case"cart":return S.CartPage}}catch(n){console.error("Error parsing JSON script tag:",n)}return S.Unknown}function it(t){return Number(t).toFixed(2)}function Ir(t){return Jt(t?.id)}function Jt(t){if(t?.includes("gid://shopify/Cart/"))return t.replace("gid://shopify/Cart/","").split("?")[0]}function ot(){let t;return[new Promise(e=>t=e),t]}function dn(){return!!document.querySelector('[data-source-attribution="shopify.shop-promise-pdp"]')}function jt(){return new Date().getTime()}function kr(t){return t.find(e=>e.code==="VALIDATION_CUSTOM"&&!!e.message)}function Jr(){const t=window.navigator.userAgent,e=t.includes("iPhone OS 26_0"),r=t.includes("Version/26.0"),n=t.includes("iPhone OS");return e||r&&n}function as(t){return t.title==="Default Title"?t.product.title:`${t.product.title} - ${t.title}`}function un(t,e){return t.map(r=>{let n=as(r.merchandise);r.quantity>1&&(n=`${r.quantity} \xD7 ${n}`),r.isNestedLine&&(n=`\u2937 ${n}`);const a=it(r.totalAmount.amount);return e(n,a)})}function ns(){return window.scheduler?.yield?window.scheduler.yield():new Promise(t=>{window.scheduler?.postTask?window.scheduler.postTask(t):setTimeout(t,0)})}var os=class extends HTMLElement{originalStyle={position:"",overflow:"",top:""};scrollPosition=0;formerFocus=null;connectedCallback(){this.shadowRoot||this.attachShadow({mode:"open"}),this.formerFocus=document.activeElement;const t=xe();this.render(t);const e=this.shadowRoot,r=e.getElementById("modal");e.querySelectorAll("button").forEach(a=>a.addEventListener("click",this.closeModal.bind(this))),e.getElementById("overlay")?.addEventListener("click",a=>this.handleOutsideClick(a,r)),document.addEventListener("keydown",this.handleEscapeKey.bind(this));const n=document.createElement("style");n.textContent=Bo,e.appendChild(n),this.applyScrollLock(),this.trapFocus(r,e),Z("svg-icon",Uo)}trapFocus(t,e){if(!t)return;const r=t.querySelectorAll("a[href], button"),n=Array.from(r),a=n[0],i=n[n.length-1];t.addEventListener("keydown",o=>
12{o.key==="Tab"&&!o.shiftKey&&e.activeElement===i&&(o.preventDefault(),a.focus()),o.key==="Tab"&&o.shiftKey&&e.activeElement===a&&(o.preventDefault(),i.focus())}),a.focus()}handleOutsideClick(t,e){e&&(e.contains(t.target)||this.closeModal())}handleEscapeKey(t){t.key==="Escape"&&this.closeModal()}closeModal(){this.removeScrollLock(),this.remove(),this.formerFocus&&"focus"in this?.formerFocus&&typeof this.formerFocus.focus=="function"&&this.formerFocus?.focus()}applyScrollLock(){this.originalStyle={position:document.body.style.position,overflow:document.body.style.overflow,top:document.body.style.top},document.body.style.overflow="hidden",Jr()&&(this.scrollPosition=window.scrollY,document.body.style.position="fixed",document.body.style.top=`-${this.scrollPosition}px`)}removeScrollLock(){document.body.style.overflow=this.originalStyle?.overflow??"",Jr()&&(document.body.style.position=this.originalStyle?.position??"",document.body.style.top=this.originalStyle?.top??"",window.scrollTo({top:this.scrollPosition,behavior:"instant"}))}render(t){const e=this.getAttribute("title"),r=this.getAttribute("has-close-button"),n=t.translate("error_dialogs.checkout.button_text"),a=`
13      <footer>
14        <button type="button" id="close-button" tabindex="0">${n}</button>
15      </footer>
16    `;this.shadowRoot.innerHTML=`
17      <div id="overlay">
18        <div id="modal" role="dialog" aria-modal="true" aria-labelledby="title">
19          <header>
20            <h2 id="title">
21              <span class="capitalize">${e}</span>
22            </h2>
23            <button type="button" id="close-icon" aria-label=${n} tabindex="0">
24              <svg-icon color="gray"></svg-icon>
25            </button>
26          </header>
27          <div id="content">
28            <p><slot></slot></p>
29          </div>
30          ${r?a:""}
31        </div>
32      </div>
33    `}},is="@keyframes topLevelModalLoadingSkeleton{50%{opacity:1}75%{opacity:.5}to{opacity:1}}top-level-modal .text-skeleton{background-color:#dedede;width:100%;height:14px;margin-bottom:7px;animation:4s -.168s infinite topLevelModalLoadingSkeleton;display:inline-block;text-decoration:none!important}top-level-modal .text-skeleton:last-of-type{width:50%}";function ze({type:t="button",label:e=void 0}={}){const r=document.createElement("button");return r.type=t,e&&r.setAttribute("aria-label",e),r}function Lt(t,e){for(const[r,n]of Object.entries(e))t.setAttribute(r,n)}function qt(t,e){for(const[r,n]of Object.entries(e))t.style.setProperty(r,n)}function hn(){return`
34    <style>${is}</style>
35    <span class="text-skeleton">&nbsp;</span>
36    <span class="text-skeleton">&nbsp;</span>
37    <span class="text-skeleton">&nbsp;</span>
38    <span class="text-skeleton">&nbsp;</span>
39    <span class="text-skeleton">&nbsp;</span>
40  `}function ss(){const t=document.querySelector("top-level-modal");t&&"closeModal"in t&&typeof t.closeModal=="function"&&t.closeModal()}function pn(t){ss();const e=document.createElement("top-level-modal");return Lt(e,{"data-testid":"top-level-modal",title:t}),e}function ls(t,e){t.innerHTML=`<div style="text-align: center;">${e}</div>`}function xt(t,e){const r=document.createElement("top-level-modal");r.textContent=e,Lt(r,{"data-testid":"top-level-modal","has-close-button":"true",title:t}),document.body?.appendChild(r)}function Tr(t,e,r){const n=pn(t);e instanceof Promise?(n.innerHTML=hn(),e.then(a=>{a&&a!==""?n.innerHTML=a:n.innerHTML=r??""}).catch(()=>{n.innerHTML=r??""})):n.innerHTML=e,document.body?.appendChild(n)}function X(t,e){xt(e.translate("error_dialogs.wallet.title",{wallet:t}),e.translate("error_dialogs.wallet.generic_error",{wallet:t}))}function yt(t){xt(t.translate("error_dialogs.checkout.title"),t.translate("error_dialogs.checkout.generic_error"))}function Et(t,e){xt(t.translate("error_dialogs.checkout.title"),e)}function At(t,e){e===F.GiftCardRecipientInvalid?xt(t.translate("error_dialogs.checkout.title"),t.translate("error_dialogs.product.gift_card_recipient_validation_error")):yt(t)}function st(t){xt(t.translate("error_dialogs.checkout.title"),t.translate("error_dialogs.product.out_of_stock"))}Z("top-level-modal",os);var re=class extends HTMLElement{disconnectedCallback(){}get buyerCountry(){return this.getAttribute("buyer-country")}get buyerCurrency(){const t=this.getAttribute("buyer-currency");if(t==null)throw new Error("WalletElement buyer-currency is null");return t}get accessToken(){return this.getAttribute("access-token")}get disabled(){return this.hasAttribute("disabled")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get hasSellingPlan(){const t=this.getAttribute("has-selling-plan");return t==="true"||t===""}set hasSellingPlan(t){t?this.setAttribute("has-selling-plan",""):this.removeAttribute("has-selling-plan")}get isShippingRequired(){const t=this.getAttribute("requires-shipping");return t==="true"||t===""}set isShippingRequired(t){t?this.setAttribute("requires-shipping",""):this.removeAttribute("requires-shipping")}get pciEnabled(){return this.hasAttribute("pci-enabled")}},cs="#more-payment-options-link{cursor:pointer}
40#more-payment-options-link[aria-disabled=true]{cursor:default;opacity:.6}";function ds(t,e,r){return(e=hs(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function ta(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Zr(Object(r),!0).forEach(function(n){ds(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Zr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function us(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hs(t){var e=us(t,"string");return typeof e=="symbol"?e:e+""}var ps="https://monorail-edge.shopifysvc.com",ms="/v1/produce";function gs(){if(typeof crypto<"u"&&crypto&&typeof crypto.randomUUID=="function")return crypto.randomUUID();const t=new Array(36);for(let e=0;e<36;e++)t[e]=Math.floor(Math.random()*16);return t[14]=4,t[19]=t[19]&=-5,t[19]=t[19]|=8,t[8]=t[13]=t[18]=t[23]="-",t.map(e=>e.toString(16)).join("")}function fs(t,e=!0){return t&&Object.keys(t).length&&e?Object.keys(t).map(r=>({[ys(r)]:t[r]})).reduce((r,n)=>ta(ta({},r),n)):t}function ys(t){return t.split(/(?=[A-Z])/).join("_").toLowerCase()}function bs(t){const e={"Content-Type":"application/json; charset=utf-8","X-Monorail-Edge-Event-Created-At-Ms":(t&&t.eventCreatedAtMs||Date.now()).toString(),"X-Monorail-Edge-Event-Sent-At-Ms":Date.now().toString(),"X-Monorail-Edge-Client-Message-Id":(t&&t.clientMessageId||gs()).toString()};return t&&t.userAgent&&(e["User-Agent"]=t.userAgent),t&&t.remoteIp&&(e["X-Forwarded-For"]=t.remoteIp),t&&t.deviceInstallId&&(e["X-Monorail-Edge-Device-Install-Id"]=t.deviceInstallId),t&&t.client&&(e["X-Monorail-Edge-Client"]=t.client),t&&t.clientOs&&(e["X-Monorail-Edge-Client-OS"]=t.clientOs),e}async function ws({endpoint:t,event:e,keepalive:r}){var n,a,i,o,s;const l=e.metadata?{clientMessageId:(n=e.metadata)===null||n===void 0?void 0:n.clientMessageId,eventCreatedAtMs:(a=e.metadata)===null||a===void 0?void 0:a.eventCreatedAtMs,consent:(i=e.metadata)===null||i===void 0?void 0:i.consent,consent_provider:(o=e.metadata)===null||o===void 0?void 0:o.consent_provider,consent_version:(s=e.metadata)===null||s===void 0?void 0:s.consent_version}:void 0;return fetch(t??ps+ms,{method:"post",headers:bs(e.metadata),body:JSON.stringify({schema_id:e.schemaId,payload:e.payload,metadata:l&&fs(l,!0)}),keepalive:r})}var qe={NO_VALUE:"",ACCEPTED:"1",DECLINED:"0"},V={PREFERENCES:"p",ANALYTICS:"a",MARKETING:"m",SALE_OF_DATA:"t"},at={MARKETING:"m",ANALYTICS:"a",PREFERENCES:"p",SALE_OF_DATA:"s"},Ht={MARKETING:"marketing",ANALYTICS:"analytics",PREFERENCES:"preferences",SALE_OF_DATA:"sale_of_data",EMAIL:"email"},nt={HEADLESS_STOREFRONT:"headlessStorefront",ROOT_DOMAIN:"rootDomain",CHECKOUT_ROOT_DOMAIN:"checkoutRootDomain",STOREFRONT_ROOT_DOMAIN:"storefrontRootDomain",STOREFRONT_ACCESS_TOKEN:"storefrontAccessToken",IS_EXTENSION_TOKEN:"isExtensionToken",METAFIELDS:"metafields",CUSTOMER_ACCOUNT_REQUEST_INFO:"customerAccountRequestInfo"},Dr=()=>typeof window>"u",Mt=()=>typeof __CtaTestEnv__>"u"?!1:__CtaTestEnv__==="true",ae=class{};ae.warn=t=>
40{Mt()||console.warn(t)},ae.error=t=>{Mt()||console.error(t)},ae.info=t=>{Mt()||console.info(t)},ae.debug=t=>{Mt()||console.debug(t)},ae.trace=t=>{Mt()||console.trace(t)};function fe(t){try{return decodeURIComponent(t)}catch{return""}}var _s="_tracking_consent";function Es(){try{return document.cookie}catch{return!1}}function mn(t,e=!1){const r=Es()?document.cookie.split("; "):[];for(let n=0;n<r.length;n++){const[a,i]=r[n].split("=");if(t===fe(a))return fe(i)}if(e&&t==="_tracking_consent"&&!window.localStorage.getItem("tracking_consent_fetched"))return Mt()?void 0:(console.debug("_tracking_consent missing"),As(),window.localStorage.setItem("tracking_consent_fetched","true"),mn(t,!1))}function As(t="/"){const e=new XMLHttpRequest;e.open("HEAD",t,!1),e.withCredentials=!0,e.send()}function Cs(){return mn(_s)}var vs="customer_privacy_api_events/2.0",gn=class ue{constructor(){if(ue.instance)return ue.instance;ue.instance=this}produce(e,r){if(!Dr())try{const n={schema_id:vs,payload:{shop_domain:window.location.host,method_name:e,call_details:r||null}},a={accept:"*/*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8","content-type":"application/json; charset=utf-8","x-monorail-edge-event-created-at-ms":String(Date.now()),"x-monorail-edge-event-sent-at-ms":String(Date.now())};if(window.location.host.endsWith("spin.dev"))console.log("Monorail event from consent API:",a,n);else return fetch("https://monorail-edge.shopifysvc.com/v1/produce",{headers:a,body:JSON.stringify(n),method:"POST",mode:"cors",credentials:"omit"})}catch{}}};gn.instance=void 0;var Ss="_cmp";function Ps(){let t;if(ks()?t=Ye(Is)||Ye(ea):t=Ye(ea),!t){let e;try{e=sessionStorage.getItem("consentHeader")}catch{}return e||void 0}try{t=decodeURIComponent(t)}catch{}return t}function Ye(t){try{return t()}catch{return}}function ea(){var t,e;if(!yn()&&!Ds()){const a=new gn;let i="failed_to_fetch";try{i=navigator.userAgent}catch{}a.produce("navigationServerTiming",JSON.stringify({failed:!0,userAgent:i})),Ts()}const r=(t=performance)===null||t===void 0||(e=t.getEntriesByType)===null||e===void 0?void 0:e.call(t,"navigation");if(!r)return;const n=r.map(fn).find(a=>a);if(n)try{sessionStorage.setItem("consentHeader",n)}catch{}return n}var ra=void 0;function Is(){var t,e;const r=(t=performance)===null||t===void 0||(e=t.getEntriesByType)===null||e===void 0?void 0:e.call(t,"resource");let n=ra;for(let a=r.length-1;a>=0;a--){let i=fn(r[a]);if(i){n=i;break}}return ra=n,n}function fn(t){var e,r;if(t)return(e=t.serverTiming)===null||e===void 0||(r=e.find(n=>n.name==Ss))===null||r===void 0?void 0:r.description}function Rr(){return window}function ks(){var t,e;const r=Rr();return(r==null||(t=r.Shopify)===null||t===void 0||(e=t.customerPrivacy)===null||e===void 0?void 0:e.backendConsentEnabled)===!0}function yn(){var t,e;const r=Rr();return r==null||(t=r.Shopify)===null||t===void 0||(e=t.customerPrivacy)===null||e===void 0?void 0:e.serverTimingSupportVerified}function Ts(){if(yn())return;const t=Rr();t.Shopify||(t.Shopify={}),t.Shopify.customerPrivacy||(t.Shopify.customerPrivacy={}),t.Shopify.customerPrivacy.serverTimingSupportVerified=!0}function Ds(){try{const t=performance.getEntriesByType("navigation")[0].serverTiming;return!(!t||t.length==0)}catch{return!1}}var Rs="_cs";function Ns(){return new URLSearchParams(window.location.search).get(Rs)||void 0}function Os(){var t,e;const r=(t=window.Shopify)===null||t===void 0||(e=t.customerPrivacy)===null||e===void 0?void 0:e.cachedConsent;return r?fe(r):void 0}var Ls;function aa(){if(Dr())return Ls;{var t,e;const r=(t=window.Shopify)===null||t===void 0||(e=t.customerPrivacy)===null||e===void 0?void 0:e.injectedConsent;return r?fe(r):void 0}}function xs(){let t;if(Dr()?t=aa():t=Os()||aa()||Ns()||Cs()||Ps(),t!==void 0)return zs(t)}function Ms(){try{return xs()||void 0}catch{return}}function zs(t){if(t.slice(0,1)=="%")try{t=decodeURIComponent(t)}catch{}const e=t.slice(0,1);if(e=="{")return Fs(t);if(e=="3")return Us(t)}function Fs(t){var e;let r;try{r=JSON.parse(t)}catch{return}if(r.v==="2.1"&&(e=r.con)!==null&&e!==void 0&&e.CMP)return r}function Us(t){const e=t.slice(1).split("_"),[r,n,a,i,o]=e;let s;try{s=e[5]?JSON.parse(e.slice(5).join("_")):void 0}catch{}let l;if(o){const h=o.replace(/\*/g,"/").replace(/-/g,"+"),p=atob(h);let y="";for(let _=0;_<p.length;
40_++){const v=p.charCodeAt(_).toString(16);y+=v.length===1?"0"+v:v}l=[8,13,18,23].reduce((_,v)=>_.slice(0,v)+"-"+_.slice(v),y)}function d(h){const p=r.split(".")[0];return p.includes(h.toLowerCase())?qe.DECLINED:p.includes(h.toUpperCase())?qe.ACCEPTED:qe.NO_VALUE}function u(h){return r.includes(h.replace("t","s").toUpperCase())}return{v:"3",con:{CMP:{[at.ANALYTICS]:d(at.ANALYTICS),[at.PREFERENCES]:d(at.PREFERENCES),[at.MARKETING]:d(at.MARKETING),[at.SALE_OF_DATA]:d(at.SALE_OF_DATA)}},region:n||"",cus:s,purposes:{[V.ANALYTICS]:u(V.ANALYTICS),[V.PREFERENCES]:u(V.PREFERENCES),[V.MARKETING]:u(V.MARKETING),[V.SALE_OF_DATA]:u(V.SALE_OF_DATA)},sale_of_data_region:i=="t",display_banner:a=="t",consent_id:l}}function Fe(t){const e=Ms();if(!e||!e.purposes)return!0;const r=e.purposes[t];return typeof r=="boolean"?r:!0}function Bs(){return Fe(V.PREFERENCES)}function Gs(){return Fe(V.ANALYTICS)}function Hs(){return Fe(V.MARKETING)}function $s(){return Fe(V.SALE_OF_DATA)}var bn=[Ht.MARKETING,Ht.ANALYTICS,Ht.PREFERENCES,Ht.SALE_OF_DATA],Lp=[...bn,Ht.EMAIL,nt.ROOT_DOMAIN,nt.CHECKOUT_ROOT_DOMAIN,nt.STOREFRONT_ROOT_DOMAIN,nt.STOREFRONT_ACCESS_TOKEN,nt.HEADLESS_STOREFRONT,nt.IS_EXTENSION_TOKEN,nt.METAFIELDS,nt.CUSTOMER_ACCOUNT_REQUEST_INFO],xp=bn.map(t=>`"${t}"`).join(", ");function Vs(){return Gs()}function Ws(){return Bs()}function js(){return Hs()}function qs(){return $s()}function Ys(){return js()}function Ks(){return Vs()}function Qs(){return Ws()}function Xs(){return qs()}function Js(){const t=[];return Ks()&&t.push("analytics"),Ys()&&t.push("marketing"),Xs()&&t.push("sale_of_data"),Qs()&&t.push("preferences"),t}function Zs(t,e){if(e==="v1"){const r=Js();return{...t,metadata:{...t?.metadata,consent:r,consent_provider:"consent-tracking-api",consent_version:e}}}else throw new tl(e||"unknown")}var tl=class Qa extends Error{constructor(e){super(`Version ${e} is not supported by the consent-tracking-api provider`),this.name="MonorailConsentTrackingApiProviderVersionError",Object.setPrototypeOf(this,Qa.prototype)}},el=["Chrome-Lighthouse","Googlebot"];function _n(){const t=navigator.userAgent;return el.some(e=>t.includes(e))}async function rl(t){if(_n())return;const e=Zs(t,"v1");let r;try{r=await ws({event:e})}catch{}if(!r?.ok)try{E.counter({name:C.MonorailProduceError,value:1,attributes:{schemaId:e.schemaId}})}catch{}}var al="shopify_wallet_checkout_track/6.3";async function G(t){const e=await An();e&&await En({schemaId:al,payload:{app_name:"storefront",page_type:Me(),checkout_one:!0,event:t.event,event_subtype:t.eventSubtype,checkout_token:t.checkoutToken,instrument_id:t.instrumentId,ttl:t.ttl,error_reason:t.errorReason,uniq_token:e?.uniqToken??"",visit_token:e?.visitToken??"",micro_session_id:e?.microSessionId??"",micro_session_count:e?.microSessionCount??0,shop_id:e?.shopId??0,theme_id:e?.themeId,theme_city_hash:e?.themeCityHash??"",content_language:e?.contentLanguage??"",referer:e?.referer}},t)}async function En(t,e){g.leaveBreadcrumb(`monorail event produced to ${t.schemaId}`,{schemaId:t.schemaId,payload:e});try{await rl(t)}catch(r){g.notify(new Cn(`Failed to send monorail event: ${r}`,{cause:r}),{metadata:{request:{monorail:{payload:JSON.stringify(t)}}}})}}async function An(){return window?.ShopifyAnalytics?.lib?.trekkie||await new Promise(t=>{const e=setInterval(()=>{window?.ShopifyAnalytics?.lib?.trekkie&&(clearInterval(e),t())},100),r=setTimeout(()=>{clearInterval(e),clearTimeout(r),t()},7e3)}),window.ShopifyAnalytics?.lib?.trekkie?.defaultAttributes}var Cn=class extends Error{};Cn.prototype.name="MonorailError";var z=(function(t){return t.CartInitCalled="portable_wallets_cart_init_called",t.ClickSheetCancelled="portable_wallets_instrument_click_sheet_cancelled",t.ClickSheetFailed="portable_wallets_instrument_click_sheet_failure",t.ClickSheetSuccess="portable_wallets_instrument_click_sheet_success",t.SheetFailed="portable_wallets_instrument_sheet_failed",t.AuthorizationAttempt="portable_wallets_authorization_attempt",t.AuthorizationComplete="portable_wallets_authorization_complete",t.InitCalled="portable_wallets_init_called",t.InitFailed="portable_wallets_init_failed",t.InitSuccess="portable_wallets_init_success",t.UpdateFailed="portable_wallets_instrument_update_failed",t.InstrumentLoaded="portable_wallets_instrument_loaded",t.InstrumentLoadFailed="portable_wallets_instrument_load_failed",t.FirstVisible="portable_wallets_first_visible",t.FirstVisibleNotAvailable="portable_wallets_first_visible_not_available",t.SheetLoaded="portable_wallets_sheet_loaded",t.ShopPayButtonInView="portable_wallets_shop_pay_button_in_view",t.RecoveryFlowInitiated="portable_wallets_recovery_flow_initiated",t})({}),nl="checkout_next_performance_metrics/1.0",ol={api_client_id:0,checkout_token:"",source_design:"portable_wallets",source_type:"cart"};async function il({eventName:t,eventValue:e,eventUnit:r="ms"}){const n=await An();if(!n)return;const{shop_id:a,cartId:i}
40=vr(),o={schemaId:nl,payload:{...ol,shop_id:a,source_id:i??"",locale:n.contentLanguage??"",device_type:sl()?"mobile":"desktop",browser:window.navigator.userAgent,step:Me(),event_name:t,event_value:e.toString(),event_unit:r,event_type:"component_load",frontend_event_timestamp_epoch_ms:jt()}};await En(o,{eventName:t,eventValue:e,eventUnit:r})}function sl(){return/Mobi|Android/i.test(window.navigator.userAgent)}var L=(function(t){return t.ButtonDisplay="buttonDisplay",t.LoadInstrument="loadInstrument",t.LoadSdk="loadSDK",t.AuthorizationLatency="authorizationLatency",t.SheetLoad="sheetLoad",t.StyleExtract="styleExtract",t})({}),ll="first-contentful-paint";function vn(){return!!window.performance?.mark&&!!window.performance?.measure}function cl(){return!!window.performance?.now&&!!window.performance?.getEntriesByName}function dl(){if(cl())try{const t=window.performance.getEntriesByName(ll,"paint")[0]?.startTime;return t===void 0?void 0:window.performance.now()-t}catch{return}}function Nt(t,e){return zt(t,e),()=>j(t,e)}function zt(t,e){vn()&&window.performance.mark(`${t}-${e}-start`)}function j(t,e){if(vn())try{const r=`${t}-${e}-start`,n=`${t}-${e}-end`,a=`${t}-${e}-duration`;return window.performance.mark(n),(window.performance.measure(a,r,n)??window.performance.getEntriesByName(a,"measure")?.[0])?.duration??void 0}catch{return}}var ul=class extends Error{};ul.prototype.name="BenchmarkError";var na={[S.Checkout]:"bwp_checkout_widget_click",[S.CartAjax]:"bwp_cart_widget_click",[S.CartPage]:"bwp_cart_widget_click",[S.ProductPage]:"bwp_widget_click",[S.Unknown]:"bwp_widget_click"};function hl({apiClientId:t,skus:e,pageType:r}){if(!window.Shopify?.analytics)return;const n=r&&na[r]||"bwp_widget_click";n===na[S.Checkout]&&window.Shopify.analytics.publish(`shopify:app:pixels:load:${t}`,{},{sendTo:"PIXEL-LOADER"}),e&&window.Shopify.analytics.publish(n,{skus:e},{sendTo:t})}var Ke=new Set,oa=!1,Q={register:t=>{oa||(oa=!0,t.forEach(e=>Ke.add(e)))},enabled:t=>Ke.has(t),allEnabled:()=>Array.from(Ke),reset:()=>{}},ia="61de4ecc",Sn="1172c16a",pl="a1d1f9a1",ml="f5afabb3",gl="370070f3",Pn="fefb6171",fl=typeof window<"u"&&window.ApplePaySession!==void 0;function yl(){return fl?"native":Q.enabled(Pn)?"sdk":"native"}function I(t){return{pageType:Sr(),...t.instrument===m.ApplePay&&{sessionMode:yl()},...t}}function bl(){const t=Sr()===S.CartPage?z.CartInitCalled:z.InitCalled;G({event:t})}function wl(t){const e=t?"Failed":"Success",r=Bl(t)?`[${t.name}]: ${t.code}`:void 0,n=z[`Init${e}`];G({event:n,eventSubtype:r}),E.counter({name:C.InitCompleted,value:1,attributes:I({result:e.toLowerCase(),eventType:r,recoveredFailure:!!window.Shopify?.PaymentButton?.failedToLoad})})}function _l({instrumentOrComponentName:t,result:e,measurement:r}){G({event:e==="success"?z.InstrumentLoaded:z.InstrumentLoadFailed,instrumentId:t,ttl:r}),E.counter({name:C.InstrumentLoaded,value:1,attributes:I({instrument:t,result:e})}),r!=null&&(E.histogram({name:C.InstrumentLoadTime,value:r,attributes:I({instrument:t,result:e}),unit:"ms"}),E.histogram({name:C.InstrumentLoadTimeFromPageLoad,value:window.performance.now(),attributes:I({instrument:t,result:e}),unit:"ms"}))}function El({instrumentOrComponentName:t}){if(_n())return;const e=dl();if(e===void 0)return;const r=Math.round(e);E.histogram({name:C.ButtonRenderTimeFromFcp,value:r,attributes:I({instrument:t}),unit:"ms"}),il({eventName:C.ButtonRenderTimeFromFcp,eventValue:r})}function Al({instrument:t,measurement:e,result:r}){const n=r==="success"?It.InstrumentSdkLoaded:It.InstrumentSdkFailed;G({event:n,instrumentId:t,ttl:e,errorReason:r==="success"?void 0:r}),e!=null&&E.histogram({name:It.InstrumentSdkLoaded,value:e,attributes:I({instrument:t,result:r}),unit:"ms"})}function Cl({instrument:t,result:e,reason:r}){const n=e==="success"?It.InstrumentSdkEligible:It.InstrumentSdkNotEligible;G({event:n,instrumentId:t}),E.counter({name:It.InstrumentSdkEligible,value:1,attributes:I({instrument:t,reason:r,result:e})})}function vl({instrument:t,result:e,reason:r}){E.counter({name:C.InstrumentLoadEligibility,value:1,attributes:I({instrument:t,result:e,reason:r})})}function Sl(t){E.counter({name:C.ButtonRender,value:1,attributes:I({result:"success",instrument:t})})}function Pl(t){E.counter({name:C.ButtonRender,value:1,attributes:I({result:"failed",instrument:t})})}function Il({instrument:t,result:e,webPixelMetaData:r,reason:n}){G({event:e==="success"?z.ClickSheetSuccess:z.ClickSheetFailed,instrumentId:t}),E.counter({name:C.SheetClicked,value:1,attributes:I({instrument:t,result:e,...n&&{reason:n}})}),t===m.BuyWithPrime&&r&&hl(r)}function kl({instrument:t,request:e,error:r}){G({event:`${z.UpdateFailed}-${e}`,instrumentId:t}),r&&c.log({body:"Update failed with error",attributes:{instrument:t,request:e,error:String(r)}}),E.counter({name:C.UpdateFailed,value:1,attributes:I({instrument:t,request:e})})}function Tl({errorCode:t}){E.counter({name:C.PayPalTokenCreationError,value:1,attributes:I({errorCode:t})})}function Dl(t){G({event:z.ClickSheetCancelled,instrumentId:t}),E.counter({name:C.SheetCancelled,value:1,attributes:I({instrument:t})})}function Rl(t,e,r){G({event:z.SheetFailed,instrumentId:t,errorReason:e?.message??String(e)}),E.counter({name:C.SheetFailed,value:1,attributes:I({instrument:t,...r&&{reason:r}})})}function Nl(t){G({event:z.AuthorizationAttempt,instrumentId:t}),E.counter({name:C.AuthorizationAttempt,value:1,attributes:I({instrument:t})})}function Ol({instrument:t,measurement:e,result:r}){G({event:z.AuthorizationComplete,eventSubtype:r,ttl:e,instrumentId:t}),e!=null&&E.histogram({name:C.AuthorizationComplete,value:e,attributes:I({instrument:t,result:r}),unit:"ms"})}function Ll({instrument:t,reason:e,stage:r}){E.counter({name:C.Decelerated,value:1,attributes:I({instrument:t,reason:e,...r&&{stage:r}}
40)}),c.log({body:"Checkout decelerate",attributes:{instrument:t,reason:e,...r&&{stage:r}}}),c.flushTelemetry()}function xl({reason:t}){E.counter({name:C.CartTokenMissing,value:1,attributes:{reason:t}})}function Ml({success:t}){E.counter({name:C.RemovePersonalDataResult,value:1,attributes:I({success:t})})}function zl(){E.counter({name:C.WalletConfigDeveloperError,value:1})}function Fl(){E.counter({name:C.LegacyCartCookie,value:1})}function Ul(){window.setInterval(()=>{In()},1e3)}function Bl(t){return t instanceof Error&&t.name==="DeveloperError"}function In(){E.exportMetrics(),E.exportLogs()}function Gl(t){const{body:e,attributes:r}=t;E.log({body:e,attributes:ln(r)})}function Hl({usedBackwardsCompatibility:t}){E.counter({name:C.StyleBackwardsCompatibility,value:1,attributes:{usedBackwardsCompatibility:t}})}function $l({measurement:t,pageType:e,stylesWritten:r}){E.histogram({name:C.StyleBackwardsCompatibilityExecutionTime,value:t,attributes:I({pageType:e,stylesWritten:r}),unit:"ms"})}function Vl({rule:t,count:e,pageType:r}){E.counter({name:C.StyleBackwardsCompatibilityRules,value:e,attributes:I({rule:t,pageType:r})})}function Wl({retries:t}){E.counter({name:C.AmazonPayLoadRetries,value:1,attributes:{retries:t}})}function jl({instrument:t}){E.counter({name:C.DynamicTaxFailed,value:1,attributes:I({instrument:t})}),c.log({body:"Dynamic tax failed",attributes:{instrument:t}})}function ql({instrument:t,measurement:e}){E.histogram({name:C.SheetLoaded,value:e,attributes:I({instrument:t}),unit:"ms"})}function Yl({instrument:t,errorName:e}
40){E.counter({name:C.UnrecoverableCartError,value:1,attributes:I({instrument:t,errorName:e})}),c.log({body:"Unrecoverable error detected",attributes:{instrument:t,errorName:e}})}function Kl({instrument:t,error:e}){E.counter({name:C.PaymentCompletedAfterAbort,value:1,attributes:I({instrument:t,error:e})})}function Ql(){E.counter({name:C.GooglePayNullCartOnAuthorize,value:1,attributes:I({instrument:m.GooglePay})})}function Xl({instrument:t,errorName:e,methodName:r}){E.counter({name:C.WalletSessionAbortError,value:1,attributes:I({instrument:t,errorName:e,methodName:r})}),c.log({body:`Wallet session abort error: ${e}`,attributes:{instrument:t,methodName:r}})}function Jl({instrument:t,retryCount:e,retryDuration:r,success:n,totalAmountChange:a,...i}){E.histogram({name:C.CartPaymentUpdateRetryResult,value:r,attributes:I({instrument:t,retryCount:e,success:n,totalAmountChange:a}),unit:"ms"}),c.log({body:"Cart payment update retry completed",attributes:{instrument:t,retryCount:e,retryDuration:r,success:n,totalAmountChange:a,...i}})}function Zl({reason:t}){E.counter({name:C.ProductFormError,value:1,attributes:I({reason:t})})}function tc({instrument:t}){c.log({body:"Cart payment update timed out",attributes:{instrument:t}})}function ec({instrument:t}){c.log({body:"DELIVERY_WRONG_NUMBER_OF_LINES error detected and filtered out",attributes:{instrument:t}}),E.counter({name:C.DeliveryWrongNumberOfLines,value:1,attributes:I({instrument:t})})}function rc({cartRequiresShipping:t}){c.log({body:"Digital physical mismatch detected",attributes:{url:window.location.href,cartRequiresShipping:t}}),E.counter({name:C.DigitalPhysicalMismatch,value:1,attributes:I({cartRequiresShipping:t})})}function ac({instrument:t,errorCode:e,errorField:r,countryCode:n,zip:a,province:i,city:o}){E.counter({name:C.AddressFieldError,value:1,attributes:I({instrument:t,errorCode:e,errorField:r})}),c.log({body:"Address field error from wallet payment sheet",attributes:{instrument:t,errorCode:e,errorField:r,countryCode:n,zip:a,province:i,city:o}})}function nc({result:t,error:e,attempt:r}){c.log({body:"Cardsink deposit result",attributes:{result:t,error:e,attempt:r}}),E.counter({name:C.CardsinkDepositResult,value:1,attributes:I({result:t,attempt:r})})}function oc({instrument:t,error:e,endpoint:r,sourceId:n}){c.log({body:"Failed to fetch Wallets Platform Config",attributes:{instrument:t,endpoint:r,sourceId:n,error:e}}),E.counter({name:C.WalletsPlatformConfigResult,value:1,attributes:I({instrument:t})})}var c={initStarted:A(bl),initCompleted:A(wl),instrumentLoaded:A(_l),recordWalletsLoadedFromFCP:A(El),instrumentLoadEligibility:A(vl),instrumentSDKLoaded:A(Al),instrumentSDKEligible:A(Cl),renderSucceeded:A(Sl),renderFailed:A(Pl),sheetClicked:A(Il),sheetCancelled:A(Dl),sheetFailed:A(Rl),updateFailed:A(kl),authorizationAttempt:A(Nl),authorizationComplete:A(Ol),startExporter:A(Ul),decelerated:A(Ll),cartTokenMissing:A(xl),removePersonalDataResult:A(Ml),walletConfigDeveloperError:A(zl),legacyCartCookie:A(Fl),flushTelemetry:A(In),styleBackwardsCompatibility:A(Hl),styleBackwardsCompatibilityExecutionTime:A($l),styleBackwardsCompatibilityRules:A(Vl),amazonPaySDKLoadRetries:A(Wl),dynamicTaxFailed:A(jl),sheetLoaded:A(ql),unrecoverableCartError:A(Yl),paymentCompletedAfterAbort:A(Kl),googlePayNullCartOnAuthorize:A(Ql),log:A(Gl,{logErrors:!1}),paypalTokenCreationError:A(Tl),walletSessionAbortError:A(Xl),cartPaymentUpdateRetryResult:A(Jl),productFormError:A(Zl),updateCartPaymentTimeout:A(tc),deliveryWrongNumberOfLines:A(ec),digitalPhysicalMismatch:A(rc),cardsinkDepositResult:A(nc),addressFieldError:A(ac),walletsPlatformConfigRequestFailure:A(oc)};function A(t,{logErrors:e=!0}={}){return(...r)=>{try{t(...r)}catch(n){e&&c.log({body:"Error calling telemetry function",attributes:{error:`${n}`}})}}}function ct(t,e=S.Unknown){const r={instrument:t,pageType:e};g.leaveBreadcrumb(`${t} handleClick`,r,"log"),c.log({body:`${t} handleClick`,attributes:r})}function ic(t){const e=r=>{r.persisted&&(t(),window.removeEventListener("pageshow",e))};window.addEventListener("pageshow",e)}function kn({type:t,form:e}){if(!e)return[];const r=document.querySelectorAll(`[name^="${t}"][form^="${CSS.escape(e.getAttribute("id")||"")}"]`),n=e.querySelectorAll(`[name^="${t}"]`),a=Array.from(r).concat(Array.from(n)),i={};return a.forEach(o=>{const s=sc(o),l=lc(o);s&&typeof l<"u"&&l.trim()!==""&&(i[s]=l)}),Object.entries(i??{}).map(([o,s])=>({key:o,value:s}))}function ne({page:t,element:e}){const r=t==="product"?'[data-shopify="payment-button"]':'[data-shopify="dynamic-checkout-cart"]';return sa(sa(e,r)||document.querySelector(r),"form")}var ft=Element.prototype;function sa(t,e){if(ft.matches=ft.matches||ft.webkitMatchesSelector||ft.msMatchesSelector||ft.mozMatchesSelector,!t||ft.matches.call(t,e))return t;let r=t;for(;r&&r!==document.body;)if(r=r.parentElement,r&&ft.matches.call(r,e))return r;return null}function sc(t){const e=t.getAttribute("name");if(e===null)return null;const r=e.indexOf("["),n=e.lastIndexOf("]");return r===-1||n===-1?null:e.substring(r+1,n)}function lc(t){if(!(["radio","checkbox"].includes(t.type)&&!t.checked))try{return t.value===""||typeof t.value>"u"?void 0:t.value}catch{return}}function Tn(t){return Dn(ne({page:"product",element:t}))?.[0]??null}function cc(t){return Dn(ne({page:"product",element:t}))}function Dn(t){const e=Rn(t);return e?[e,...uc(t)]:null}function Rn(t){const e=t?.elements;if(!e)return g.leaveBreadcrumb("[ProductForm] No form elements found"),c.productFormError({reason:"missing_form_elements"}),c.log({body:"Product form error: missing form elements",attributes:{}}),null;const r=ye(e,"id");return!r||isNaN(Number(r))||Number(r)<=0?(g.leaveBreadcrumb("[ProductForm] Invalid variant ID found",{variantId:r}),c.productFormError({reason:"invalid_variant_id"}),c.log({body:"Product form error: invalid variant ID",attributes:{variantId:r??"null"}}),null):{variantId:r,quantity:Number(ye(e,"quantity")??"1"),merchandiseId:`gid://shopify/ProductVariant/${r}`,sellingPlanId:hc(e),lineItemProperties:kn({type:"properties",form:t})}}function dc(t){const e=t?.elements;return e?!!ye(e,"selling_plan"):!1}function uc(t){try{const e=new FormData(t??void 0),r=new Map;for(const[n,a]of e.entries()){if(!n.startsWith("shopify-additional-items["))continue;const i=n.split(/[[\]]{1,2}/),o=Number(i[1])-1;r.has(o)||r.set(o,{});const s=r.get(o);switch(i[2]){case"id":s.variantId=a.toString(),s.merchandiseId=`gid://shopify/ProductVariant/${a.toString()}`;break;case"quantity":s.quantity=Number(a??1);break;case"selling_plan":s.sellingPlanId=`gid://shopify/SellingPlan/${a.toString()}`;break;case"properties":s.lineItemProperties=JSON.parse(a);break;case"parent_id":s.parent={merchandiseId:`gid://shopify/ProductVariant/${a.toString()}`}}}return[...r.values()].map(n=>{if(!n.variantId)throw new Error("Missing variant ID for additional item");return{quantity:1,lineItemProperties:[],...n}})}catch(e){return console.error("[Accelerated Checkout] Could not read additional items from the product form. Check that your shopify-additional-items fields are correctly defined.",e),[]}}function ye(t,e){let r=t.namedItem(e);if(r instanceof HTMLSelectElement)try{return r.value??null}catch{return null}if(r&&"length"in r&&(r=r.item(0)),r instanceof HTMLInputElement||r instanceof HTMLSelectElement)try{return r.value??null}catch{return null}return null}function hc(t){const e=ye(t,"selling_plan");if(!(!e||e==="undefined"))return`gid://shopify/SellingPlan/${e}`}var pc=class{element;apiClient;instrumentName;constructor(t,e,r){this.element=t,this.apiClient=e,this.instrumentName=r}async getInitialCart(t,e,r){const n=cc(this.element);if(!n)throw new Nr(`[${this.instrumentName}] unable to find product form`,{groupingHash:"unable-to-find-product-form"});const a=_r(Zo),i={lines:[...n],discountCodes:a?[a]:[],instrumentName:t},{data:o,errors:s,abortReason:l,decelerationReason:d}=await this.apiClient.createCart(i,e,r);return{cart:o,errors:s,abortReason:l,decelerationReason:d}}},Nr=class extends J{get useHashPrefix(){return!0}};Nr.prototype.name="ProductFormError";var mc={firstName:"firstName",lastName:"lastName",address1:"address1",address2:"address2",city:"city",province:"province",postalCode:"zip",phoneNumber:"phone",companyName:"company",country:"country"},ir=["firstName","lastName","address1","address2","city","province","postalCode","phoneNumber","companyName","country"];function he(t,e){return`${t}.${mc[e]}`}function vt(t,e){const r={};
40for(const n of ir)r[n]=[{code:e,field:he(t,n)}];return r}function Nn(t){return{required:vt(t,"ADDRESS_FIELD_IS_REQUIRED"),invalid:{...vt(t,"ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN"),postalCode:[{code:"ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN",field:he(t,"postalCode")},{code:"INVALID_ZIP_CODE_FOR_COUNTRY",field:he(t,"postalCode")},{code:"INVALID_ZIP_CODE_FOR_PROVINCE",field:he(t,"postalCode")}]},emojis:vt(t,"ADDRESS_FIELD_CONTAINS_EMOJIS"),tooLong:vt(t,"ADDRESS_FIELD_IS_TOO_LONG"),htmlTags:vt(t,"ADDRESS_FIELD_CONTAINS_HTML_TAGS"),containsUrl:vt(t,"ADDRESS_FIELD_CONTAINS_URL")}}var gc={firstName:"DELIVERY_FIRST_NAME_REQUIRED",lastName:"DELIVERY_LAST_NAME_REQUIRED",address1:"DELIVERY_ADDRESS1_REQUIRED",address2:"DELIVERY_ADDRESS2_REQUIRED",city:"DELIVERY_CITY_REQUIRED",province:"DELIVERY_ZONE_REQUIRED_FOR_COUNTRY",postalCode:"DELIVERY_POSTAL_CODE_REQUIRED",phoneNumber:"DELIVERY_PHONE_NUMBER_REQUIRED",companyName:"DELIVERY_COMPANY_REQUIRED",country:"DELIVERY_COUNTRY_REQUIRED"},fc={firstName:"DELIVERY_FIRST_NAME_INVALID",lastName:"DELIVERY_LAST_NAME_INVALID",address1:"DELIVERY_ADDRESS1_INVALID",address2:"DELIVERY_ADDRESS2_INVALID",city:"DELIVERY_CITY_INVALID",province:"DELIVERY_ZONE_NOT_FOUND",postalCode:"DELIVERY_POSTAL_CODE_INVALID",phoneNumber:"DELIVERY_PHONE_NUMBER_INVALID",companyName:"DELIVERY_COMPANY_INVALID",country:"DELIVERY_COUNTRY_INVALID"};function yc(){const t=Nn("deliveryAddress");for(const e of ir)t.required[e]=[{code:gc[e]},...t.required[e]];t.required.country=[...t.required.country,{code:"ADDRESS_FIELD_IS_REQUIRED",field:"deliveryAddress.countryCode"}],t.required.province=[...t.required.province,{code:"ADDRESS_FIELD_IS_REQUIRED",field:"deliveryAddress.provinceCode"}];for(const e of ir){const r=fc[e];r&&(t.invalid[e]=[{code:r},...t.invalid[e]])}return t.invalid.country=[...t.invalid.country,{code:"Variable $buyerIdentity of type CartBuyerIdentityInput! was provided invalid value for countryCode"},{code:"INVALID",field:"deliveryAddress.country"},{code:"INVALID",field:"deliveryAddress.countryCode"}],t.invalid.postalCode=[...t.invalid.postalCode,{code:"DELIVERY_INVALID_POSTAL_CODE_FOR_COUNTRY"},{code:"DELIVERY_INVALID_POSTAL_CODE_FOR_ZONE"}],t.invalid.phoneNumber=[...t.invalid.phoneNumber,{code:"INVALID",field:"buyerIdentity.phone"}],t}var f=yc();function bc(){const t=Nn("billingAddress");return{...t,invalid:{...t.invalid,generic:[{code:"INVALID_PAYMENT",field:"billingAddress"},{code:"ADDRESS_FIELD_IS_REQUIRED",field:"billingAddress"},{code:"UNSPECIFIED_ADDRESS_ERROR",field:"billingAddress"}]}}}var b=bc(),Zt={invalid:[{code:"INVALID",field:"buyerIdentity.email"}],required:[{code:"BUYER_IDENTITY_EMAIL_REQUIRED"}]},On=[{code:"INVALID_DELIVERY_OPTION"},{code:"INVALID_DELIVERY_GROUP"},{code:"DELIVERY_DETAIL_CHANGED"},{code:"DELIVERY_NO_DELIVERY_AVAILABLE"},{code:"NO_DELIVERY_GROUP_SELECTED"}],Ln=[{code:"INVALID_PAYMENT",field:"amount"},{code:"INVALID_PAYMENT",field:"payment.amount"},{code:"INVALID_PAYMENT",field:"payment"}],Or=[{code:"TAXES_DELIVERY_GROUP_ID_NOT_FOUND"},{code:"TAXES_LINE_ID_NOT_FOUND"},{code:"TAXES_MUST_BE_DEFINED"},{code:"PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT"}],Lr=[{code:"MERCHANDISE_OUT_OF_STOCK"},{code:"MERCHANDISE_PRODUCT_NOT_PUBLISHED"}],xn=[{code:"MERCHANDISE_NOT_APPLICABLE"},{code:"MERCHANDISE_NOT_ENOUGH_STOCK_AVAILABLE"},{code:"DELIVERY_NO_DELIVERY_AVAILABLE_FOR_MERCHANDISE_LINE"},{code:"INVALID",field:"quantity"}],Mn={code:"PAYMENTS_METHOD_REQUIRED"},wc={code:"PAYMENTS_METHOD_UNAVAILABLE"},be={code:"VALIDATION_CUSTOM"},zn={code:"MERCHANDISE_LINE_TRANSFORMERS_RUN_ERROR"},Fn=[wc,zn],_c=[...Fn,Mn],Ec=[...f.required.firstName,...f.required.lastName,...f.required.address1,...f.required.address2,...f.required.phoneNumber,...f.required.companyName,...Zt.required],we={code:"CAPTCHA_COMPLETION_REQUIRED"},_e={code:"LOCALIZATION_EXTENSION_FIELD_ERROR"},la={code:"BUYER_IDENTITY_CONTACT_INFO_DOES_NOT_MATCH_CUSTOMER_PROFILE"},Ee={code:"Variable $language of type LanguageCode was provided invalid value"},Ae={code:"Variable $country of type CountryCode was provided invalid value"}
40,Ce={code:"Variable $cartId of type ID! was provided invalid value"},sr={code:"DISCOUNT_NOT_APPLICABLE"},ca={code:"PAYMENTS_COUNTRY_INVALID"},da={code:"INVALID_PAYMENT_EMPTY_CART"},ve={code:"PAYMENT_METHOD_NOT_SUPPORTED"},Se={code:"REDIRECT_TO_CHECKOUT_REQUIRED"},Ac={code:"INVALID",field:"quantity"},Cc={code:"VARIANT_REQUIRES_SELLING_PLAN"},vc={code:"SELLING_PLAN_NOT_APPLICABLE"},Sc={code:"INVALID",field:"merchandiseId"},Pc={code:"NO_RESPONSE"},Ic={code:"INVALID",field:"input"},kc={code:"MERCHANDISE_NOT_APPLICABLE"},Tc={code:"NO_DELIVERY_GROUP_SELECTED"},Dc={code:"GIFT_CARD_RECIPIENT_INVALID"},Pe={code:"TAXES_INCLUSIVITY_MISMATCH"},ua={code:"ERROR"},ha=[{code:"DELIVERY_WRONG_NUMBER_OF_LINES"},{code:"DELIVERY_ADDRESS_REQUIRED"},{code:"DELIVERY_NO_DELIVERY_AVAILABLE_FOR_MERCHANDISE_LINE"}],Rc=[{code:"PENDING_PROCESS"},{code:"PENDING_DELIVERY_GROUPS"}],Nc=[{code:"PENDING_DELIVERY_GROUPS"}],Oc=[{code:"PENDING_PROCESS"}],Lc={building:[...Ec,...ha,...Rc],authorized:ha};function Yt(t,e){const r=e.field?t.field===e.field:!0,n=t.code===e.code;return r&&n}function Un(t,e){return t.length>0&&e.length>0&&t.some(r=>e.some(n=>Yt(r,n)))}function Pt({code:t,field:e}){return`${t}${e?`:${e}`:""}`}var Bn=class extends J{#t;get stack(){return this.#t}set stack(t){this.#t=t}constructor(t){t instanceof Error?(super(`[${t.name}] ${t.message}`,{cause:t.cause,groupingHash:t instanceof J?t.groupingHash:void 0}),this.stack=t.stack):super(`[HandleCreateCartError] ${String(t)}`)}};Bn.prototype.name="HandleCreateCartError";async function dt({element:t,instrumentName:e,dataSource:r,isShippingRequired:n}){const{supportsSubscriptions:a,supportsDeferredPurchaseOptions:i}=t;try{const{cart:o,errors:s,abortReason:l,decelerationReason:d}=await r.getInitialCart(e,a??!0,i??!0);ic(()=>{t&&(t.disabled=!1)});const u=kr(s),h=Mc(s),p=h||u;if(h&&c.unrecoverableCartError({instrument:e,errorName:h}),!o&&!p)throw new Error(`[${e}] Failed to create cart: ${JSON.stringify(s)}`);if(o){if(!o.id)throw new Error(`[${e}] received invalid cart`);if(!o.checkoutUrl)throw new Error(`[${e}] Created cart with no checkout URL`)}if(s.length>0&&!p)throw new Error(`Errors present after cart creation: ${JSON.stringify(s)}`);return{cart:o,customValidationError:u,decelerationReason:zc(o,n)??d,abortReason:l,...h?{unrecoverableError:h}:{}}}catch(o){if(o instanceof Dt)return{cart:null,customValidationError:void 0,unrecoverableError:F.IgnoredResponseError,abortReason:void 0,decelerationReason:void 0};if(o instanceof Nr)return{cart:null,customValidationError:void 0,unrecoverableError:F.ProductFormError,abortReason:void 0,decelerationReason:void 0};throw new Bn(o)}finally{t&&(t.disabled=!1)}}var xc=[{matcher:Ac,unrecoverableError:F.InvalidQuantity},{matcher:Cc,unrecoverableError:F.VariantRequiresSellingPlan},{matcher:vc,unrecoverableError:F.SellingPlanNotApplicable},{matcher:Sc,unrecoverableError:F.MerchandiseIdInvalid},{matcher:Pc,unrecoverableError:F.NoResponse},{matcher:Ic,unrecoverableError:F.InvalidInput},{matcher:kc,unrecoverableError:F.MerchandiseNotApplicable},{matcher:zn,unrecoverableError:F.MerchandiseLineTransformersRunError},{matcher:Dc,unrecoverableError:F.GiftCardRecipientInvalid}];function Mc(t){if(t.length!==1)return null;const[e]=t;return e.code==="VALIDATION_CUSTOM"&&e.message?null:xc.find(({matcher:r})=>Yt(e,r))?.unrecoverableError||null}function zc(t,e){if(t&&e!==void 0){const r=t.lineItems.some(n=>n.merchandise.requiresShipping);if(e!==r)return c.digitalPhysicalMismatch({cartRequiresShipping:r}),"digital_physical_mismatch"}}var Fc={force_shop_pay_product:"direct_checkout_product",force_shop_pay_cart:"direct_checkout_cart"};function et(t,e="no_redirect_for_checkout"){c.flushTelemetry();const r=new URL(t);switch(e){case"skip_shop_pay":r.searchParams.set("skip_shop_pay","true");break;case"no_redirect_for_checkout":r.searchParams.set("storefront_wallet","true");break;case"force_shop_pay_cart":case"force_shop_pay_product":case"force_shop_pay":{r.searchParams.set("payment","shop_pay");const n=Fc[e];n&&r.searchParams.set("redirect_source",n);break}}window.location.assign(r.toString())}var Uc={currency_changed:D.CURRENCY_CHANGE,captcha_required:D.CAPTCHA_REQUIRED,not_enough_stock:D.NOT_ENOUGH_STOCK,dynamic_tax:D.WALLET_PROCESSING_FAILED,payment_method_not_applicable:D.PAYMENT_METHOD_NOT_APPLICABLE,invalid_payment_deferred_payment_required:D.INVALID_PAYMENT_DEFERRED_PAYMENT_REQUIRED,localization_extension_field_error:D.LOCALIZATION_EXTENSION_FIELD_ERROR,account_info_mismatch:D.WALLET_PROCESSING_FAILED,invalid_language:D.WALLET_PROCESSING_FAILED,invalid_country:D.WALLET_PROCESSING_FAILED,missing_cart_id:D.WALLET_PROCESSING_FAILED,redirect_to_checkout_required:D.WALLET_PROCESSING_FAILED,invalid_payment_amount:D.WALLET_PROCESSING_FAILED,price_increased:D.PRICE_INCREASED,unsupported_apple_pay_payment_method:D.UNSUPPORTED_APPLE_PAY_PAYMENT_METHOD,unsupported_google_pay_payment_method:D.UNSUPPORTED_GOOGLE_PAY_PAYMENT_METHOD,custom_validation:D.WALLET_PROCESSING_FAILED,discount_not_applicable:D.WALLET_PROCESSING_FAILED,cart_empty:D.WALLET_PROCESSING_FAILED,payments_country_invalid:D.PAYMENTS_COUNTRY_INVALID,generic_error:D.WALLET_PROCESSING_FAILED,nested_line_subscription:D.WALLET_PROCESSING_FAILED,nested_line_deferred_payment:D.WALLET_PROCESSING_FAILED,cardsink_deposit_failed:D.WALLET_PROCESSING_FAILED,digital_physical_mismatch:D.WALLET_PROCESSING_FAILED,subscription_review_required:D.SUBSCRIPTION_REVIEW_REQUIRED,subscription_review_required_banner_less:D.SUBSCRIPTION_REVIEW_REQUIRED_BANNER_LESS,shipping_country_unavailable:D.SHIPPING_COUNTRY_UNAVAILABLE,cart_throttled:null};function Qe({cart:t,warnings:e}){const r=t&&t.lineItems.length>0&&t.lineItems.every(n=>n.quantity===0);if(e?.includes("MERCHANDISE_OUT_OF_STOCK")&&(r||!t))return"out_of_stock"}function se({warnings:t,cart:e,cartStatus:r,errors:n,supportsSubscriptions:a,supportsDeferredPurchaseOptions:i}){for(const s of n||[]){if(s.code==="PAYMENT_METHOD_NOT_APPLICABLE")return"payment_method_not_applicable";if(s.code==="INVALID_PAYMENT_DEFERRED_PAYMENT_REQUIRED")return"invalid_payment_deferred_payment_required"}if(r==="CartThrottled")return"cart_throttled";if(!t||t.length===0)return pa(a??!0,i??!0,e);if(t.includes("MERCHANDISE_NOT_ENOUGH_STOCK"))return"not_enough_stock";const o=e?.lineItems.some(s=>s.quantity>0);return t.includes("MERCHANDISE_OUT_OF_STOCK")&&o?"not_enough_stock":pa(a??!0,i??!0,e)}function pa(t,e,r){if(!t&&r?.lineItems.some(n=>n.sellingPlanAllocation?.sellingPlan.billingPolicy))return"nested_line_subscription";if(!e&&r?.lineItems.some(n=>n.sellingPlanAllocation?.remainingBalanceChargeAmount&&!n.sellingPlanAllocation?.sellingPlan.billingPolicy))return"nested_line_deferred_payment"}function xr({currentCartTotal:t,initialBuyerCurrency:e}){const r=t.amount;return!(!r||Number(r)===0||e.toUpperCase()===t.currencyCode.toUpperCase())}function Gn({previousCart:t,currentCart:e}){if(!t||!e)return;const r=parseFloat(t.totalAmount.amount),n=parseFloat(e.totalAmount.amount);let a;return n>r?a="inc":n<r?a="dec":a="eq",a}function N({checkoutUrl:t,instrumentName:e,reason:r,stage:n,forceLegacySplitShippingMode:a=!1}){if(!t)throw new Error("Invalid Checkout URL");const i=new URL(t),o=Uc[r];o&&i.searchParams.set(o,"true"),a&&i.searchParams.set("wallet_deceleration","true"),c.decelerated({instrument:e,reason:r,stage:n}),et(i.toString())}function ma(t){return t.key===" "||t.code==="Space"}var Bc=class extends re{name=m.MoreOptions;anchor;i18n;dataSource;classNames;setI18n;setDataSource;setClassNames;static get observedAttributes(){return["disabled"]}constructor(){super(),[this.i18n,this.setI18n]=ot(),[this.dataSource,this.setDataSource]=ot(),[this.classNames,this.setClassNames]=ot()}get pageType(){return this.getAttribute("page-type")||S.Unknown}get walletInstrumentName(){return this.getAttribute("wallet-instrument-name")||null}connectedCallback(){this.anchor||this.render()}attributeChangedCallback(t,e,r){e!==r&&t==="disabled"&&this.anchor&&this.setAccessibilityAttributes()}async handleClick(t){if(t.preventDefault(),this.disabled||!this.anchor)return;this.disabled=!0,ct(this.name,this.pageType);const[e,r]=await Promise.all([this.i18n,this.dataSource]);try{const{decelerationReason:n,cart:a,customValidationError:i,unrecoverableError:o,abortReason:s}=await dt({element:this,instrumentName:m.MoreOptions,dataSource:r});if(o){c.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),c.log({body:"Unrecoverable error detected in More Options sheet clicked",attributes:{unrecoverableError:o}}),At(e,o);return}if(i){c.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),c.log({body:"Custom validation error detected in More Options sheet clicked",attributes:{errorMessage:i?.message}}),Et(e,i.message);return}if(s==="out_of_stock"){c.sheetClicked({instrument:this.name,result:"rejected",reason:"out_of_stock"}),st(e);return}if(n){c.sheetClicked({instrument:m.MoreOptions,result:"success",reason:"deceleration"}),N({checkoutUrl:a?.checkoutUrl??"",instrumentName:m.MoreOptions,reason:n});return}c.sheetClicked({instrument:m.MoreOptions,result:"success"}),et(a?.checkoutUrl??"",this.walletInstrumentName===m.ShopPay?"skip_shop_pay":"allow_redirect")}catch(n){c.sheetClicked({instrument:m.MoreOptions,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in More Options sheet clicked",attributes:{error:String(n)}}),g.notify(n),yt(e)}}handleKeyDown(t){ma(t)&&t.preventDefault()}handleKeyUp(t){ma(t)&&(t.preventDefault(),!(this.disabled||!this.anchor)&&this.anchor.click())}async render(){const t=await this.i18n,e=await this.classNames;
40this.anchor=document.createElement("a"),this.anchor.textContent=t.translate("more_payment_options"),this.anchor.className=e,this.anchor.setAttribute("id","more-payment-options-link"),this.anchor.onclick=n=>this.handleClick(n),this.anchor.onkeydown=n=>this.handleKeyDown(n),this.anchor.onkeyup=n=>this.handleKeyUp(n),this.setAccessibilityAttributes(),this.appendChild(this.anchor);const r=document.createElement("style");r.textContent=cs,this.appendChild(r)}setAccessibilityAttributes(){this.anchor&&(this.disabled?(this.anchor.removeAttribute("href"),this.anchor.role="link",this.anchor.setAttribute("aria-disabled","true")):(this.anchor.removeAttribute("role"),this.anchor.removeAttribute("aria-disabled"),this.anchor.href="#"))}};function Mr(t,e,r){if(or?.length){const n=or.join(",");t.querySelectorAll(n).forEach(a=>{r===null?a.removeAttribute(e):a.setAttribute(e,r)})}}function Gc(t,e){try{const r=JSON.parse(t??"[]");if(!(r instanceof Array))throw new q({code:"invalid-wallet-configs",message:`[${e}] invalid walletConfigs found`});return r}catch(r){throw new q({code:"invalid-wallet-configs",message:`[${e}] Error while parsing walletConfigs JSON: ${r}`},{cause:r})}}function Hc(t,e){try{return t?JSON.parse(t):null}catch(r){throw new q({code:"invalid-wallet-config",message:`[${e}] Error while parsing walletConfig JSON: ${r}`},{cause:r})}}function Ie(t,e){if(!e)return!1;const r=e.getWalletParamsEligibility();if(!r.eligible)return c.instrumentLoadEligibility({instrument:e.getInstrumentName(),result:"failed",reason:r.reason}),!1;const n=e.getLoadEligibility(t);return n.eligible?(c.instrumentLoadEligibility({instrument:e.getInstrumentName(),result:"success",reason:void 0}),!0):(c.instrumentLoadEligibility({instrument:e.getInstrumentName(),result:"failed",reason:n.reason}),!1)}function $c(t,e){return e.filter(r=>Ie(t,r))}async function Hn({walletInstrument:t,instanceNumber:e}){const r=t.getInstrumentName(),n=Nt(L.LoadSdk,`${r}:${e}`);try{await t.loadWalletSDK(),c.instrumentSDKLoaded({instrument:r,measurement:n(),result:"success"})}catch(i){return g.leaveBreadcrumb("Failed to load wallet SDK",{instrumentName:r,instanceNumber:e},"error"),g.notify(i),c.log({body:"Error loading wallet SDK",attributes:{instrumentName:r,instanceNumber:e,error:String(i),walletParams:JSON.stringify(t.walletParams)}}),c.instrumentSDKLoaded({instrument:r,measurement:n(),result:"failed"}),null}let a;try{a=t.getPartnerSDKEligibility()}catch(i){g.notify(i),a={eligible:!1,reason:"uncaught exception"}}return a.eligible?(c.instrumentSDKEligible({instrument:r,result:"success"}),t):(c.instrumentSDKEligible({instrument:r,reason:a.reason,result:"failed"}),null)}function wt(t,...e){try{const r=window[t];if(typeof r=="function")return new r(...e)}catch{}return null}var Kt=G,ga="https://content.global-e.com/shopper-terms",Vc="https://content.global-e.com/shopper-terms-v2",Wc="https://content.global-e.com/privacy-policy",zr=class extends re{apiClient;i18n;policy;isFetchingPolicy=!1;intersectionObserver=null;managedMarketsTermsLink=ga;connectedCallback(){this.mountIntersectionObserver(),Q.register(this.getEnabledFlags()),this.i18n&&this.setupManagedMarketsHandlers(this.i18n)}disconnectedCallback(){super.disconnectedCallback(),this.cleanupManagedMarketsHandlers()}get shopId(){return this.getAttribute("shop-id")}get cartId(){return this.getAttribute("cart-id")}get walletConfigs(){return this.getAttribute("wallet-configs")}get recommendedWallet(){return this.getAttribute("recommended")}get fallbackWallet(){return this.getAttribute("fallback")}get variantParams(){try{return JSON.parse(this.getAttribute("variant-params")??"[]")}catch(t){throw new q({code:"invalid-variant-params",message:`variant-params must be a valid JSON string. Received variant-params: ${this.getAttribute("variant-params")}, received error: ${t}`})}}get styleExtractorDisabled(){return this.hasAttribute("disable-compat")}get onlySdk(){return this.hasAttribute("only-sdk")}get debug(){return this.hasAttribute("debug")}triggerLoadedEvent(){document.dispatchEvent(new Event("shopify:payment_button:loaded",{bubbles:!0,cancelable:!0}))}async attributeChangedCallback(t,e,r){e!==r&&Mr(this,t,r)}showBuyerConsent(t,e){t&&window.Shopify?.PaymentButton?.showBuyerConsent?.(r=>this.onClickSubscriptionPolicy(r,t,e))}hideBuyerConsent(){window.Shopify?.PaymentButton?.hideBuyerConsent?.()}clearUI(){this.innerHTML=""}setupManagedMarketsHandlers(t){const e=document.getElementById("shopify-buyer-consent")?.getAttribute("data-consent-type");if(e!=="managed-markets"&&e!=="managed-markets-v2")return;const r=document.getElementById("shopify-managed-markets-terms-and-conditions-button"),n=document.getElementById("shopify-managed-markets-privacy-policy-button");!r||!n||(this.managedMarketsTermsLink=e==="managed-markets"?ga:Vc,this.i18n=t,document.addEventListener("click",this.handleManagedMarketsClick,!0))}cleanupManagedMarketsHandlers(){document.removeEventListener("click",this.handleManagedMarketsClick,!0)}handleManagedMarketsClick=t=>{if(!this.i18n)return;const e=t.target;if(e.id==="shopify-managed-markets-terms-and-conditions-button"){t.preventDefault(),t.stopImmediatePropagation(),this.showModalWithIframe(this.managedMarketsTermsLink,this.i18n.translate("managed_markets.terms_and_conditions"),this.i18n);return}e.id==="shopify-managed-markets-privacy-policy-button"&&(t.preventDefault(),t.stopImmediatePropagation(),this.showModalWithIframe(Wc,this.i18n.translate("managed_markets.privacy_policy"),this.i18n))};showModalWithIframe(t,e,r){const n=r.translate("managed_markets.policy_not_found"),a=1e4*Pr(),i=800,o=pn(e);document.body.appendChild(o);const s=document.createElement("div");qt(s,{position:"relative",width:"100%"});const l=document.createElement("iframe");Lt(l,{width:"100%",height:"100%",title:e,frameborder:"no"}),qt(l,{border:"none","min-height":"50vh",display:"none"});const d=document.createElement("div");d.className="skeleton-overlay",d.innerHTML=hn(),qt(d,{background:"white"}),s.appendChild(l),s.appendChild(d),o.appendChild(s);let u=!1,h=!1,p=!1;const y=()=>{!p&&u&&h&&(d.remove(),l.style.display="block")},_=setTimeout(()=>{u||(p=!0,ls(o,n))},a);l.addEventListener("load",()=>{clearTimeout(_),u=!0,y()}),setTimeout(()=>{h=!0,y()},i),l.src=t}getEnabledFlags(){const t=this.getAttribute("enabled-flags");if(!t)return[];try{return JSON.parse(t)}catch{return console.warn("Invalid enabled-flags attribute value:",t),[]}}async onClickSubscriptionPolicy(t,e,r){if(t.preventDefault(),this.isFetchingPolicy)return;if(this.policy){this.showPolicy(this.policy,r);return}this.isFetchingPolicy=!0;
40const n=this.fetchSubscriptionPolicy(e).then(a=>(this.policy=a,a)).catch(a=>(g.notify(a),r.translate("subscriptions.policy_not_found"))).finally(()=>{this.isFetchingPolicy=!1});this.showPolicy(n,r)}async fetchSubscriptionPolicy(t){const e=await t.fetchSubscriptionPolicy();return this.policy=e,e}showPolicy(t,e){Tr(e.translate("subscriptions.cancellation_policy"),t,e.translate("subscriptions.policy_not_found"))}mountIntersectionObserver(){this.intersectionObserver=wt("IntersectionObserver",this.handleIntersection),this.intersectionObserver?this.intersectionObserver.observe(this):Kt({event:z.FirstVisibleNotAvailable})}handleIntersection=(t,e)=>{t.some(r=>r.isIntersecting)&&(this.apiClient&&this.apiClient.setVisible(),e.disconnect(),Kt({event:z.FirstVisible}))}};function Fr(t){on({shop_id:t.shopId??"unknown",cartId:t.cartId??void 0,debug:t.debug,enabledFlags:Q.allEnabled().join(","),pageType:t.pageType})}var Ur=class{element;onFormChanged;addToCartMutationObserver;addToCartForm;addToCartButtons;constructor(t,e){this.element=t,this.onFormChanged=e,this.addToCartMutationObserver=null,this.addToCartForm=null,this.addToCartButtons=[]}setupMutationObservers(){if(this.findAndSetAddToCartButtons(),!this.addToCartForm)return;this.syncComponentStateWithForm();const t=new MutationObserver(()=>this.reobserveOnFormChanges());this.addToCartMutationObserver=new MutationObserver(()=>this.syncComponentStateWithForm()),t.observe(this.addToCartForm,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),this.observeAddToCartButtons()}syncComponentStateWithForm(){if(!this.addToCartForm){this.onFormChanged({disabled:!0,hasSellingPlan:!1});return}const t=Rn(this.addToCartForm),e=!!(this.addToCartButtons.length>0&&this.addToCartButtons.every(r=>r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true"));this.onFormChanged({disabled:e||t===null,hasSellingPlan:dc(this.addToCartForm),variantId:t?.variantId,sellingPlanId:t?.sellingPlanId})}observeAddToCartButtons(){this.addToCartButtons.forEach(t=>{this.addToCartMutationObserver.observe(t,{attributes:!0})})}reobserveOnFormChanges(){this.addToCartMutationObserver?.disconnect(),this.findAndSetAddToCartButtons(),this.observeAddToCartButtons(),this.syncComponentStateWithForm()}findAndSetAddToCartButtons(){if(this.addToCartForm=ne({page:"product",element:this.element}),this.addToCartForm){const t=this.addToCartForm.querySelectorAll("[type=submit]");t instanceof NodeList&&(this.addToCartButtons=[...t])}}};function jc(t,e,r){try{const n=JSON.parse(t??"{}"),a=JSON.parse(e??JSON.stringify(Wa));if(n===null||Object.keys(n).length===0){if(!(a instanceof Object))throw c.walletConfigDeveloperError(),new q({code:"invalid-fallback-wallet-config",message:`[${r}] Invalid fallback wallet configs JSON`});return{recommendedWallet:null,fallbackWallet:a}}return{recommendedWallet:n,fallbackWallet:a}}catch(n){throw c.walletConfigDeveloperError(),new q({code:"invalid-recommended-fallback-config",message:`[${r}] Error while parsing recommended/fallback JSON: ${n}`},{cause:n})}}var qc=".shopify-payment-button__button--hidden{visibility:hidden}.shopify-payment-button__button{height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,44px), 55px);min-height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,44px), 55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius,0px);color:#fff;cursor:pointer;text-align:center;border:none;width:100%;font-size:1em;font-weight:500;line-height:1;transition:background .2s ease-in-out;display:block;box-shadow:0 0 #0000}.shopify-payment-button__button[disabled]{opacity:.6;cursor:default}.shopify-payment-button__button--unbranded{background-color:#1990c6;padding:1em 2em}.shopify-payment-button__button--unbranded:hover:not([disabled]){background-color:#136f99}.shopify-payment-button__more-options{cursor:pointer;text-align:center;background:0 0;border:0;width:100%;margin-top:1em;font-size:1em;text-decoration:underline;display:block}.shopify-payment-button__more-options.shopify-payment-button__skeleton{width:50%;margin-left:25%;margin-right:25%;border-radius:4px!important;height:auto!important;min-height:0!important}.shopify-payment-button__button.shopify-payment-button__button--branded{z-index:1;flex-direction:column;display:flex;position:relative}.shopify-payment-button__button.shopify-payment-button__button--branded .shopify-cleanslate{flex-direction:column!important;flex:1!important;display:flex!important}.shopify-payment-button__button.button.loading{color:#0000;position:relative}.shopify-payment-button__button.button.loading>.loading-overlay__spinner{align-items:center;height:100%;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.shopify-payment-button__button.button.loading>.loading-overlay__spinner .spinner{width:fit-content}.button.loading>.loading-overlay__spinner .path{stroke:#fff}.shopify-payment-button__button .loading-overlay__spinner{width:1.8rem;display:inline-block}.shopify-payment-button__button .spinner{animation:1.4s linear infinite shopify-rotator}@keyframes shopify-rotator{0%{transform:rotate(0)}to{transform:rotate(270deg)}}.shopify-payment-button__button .path{stroke-dasharray:280;stroke-dashoffset:0;transform-origin:50%;
40stroke:#121212;animation:1.4s ease-in-out infinite shopify-dash}@media screen and (forced-colors:active){.shopify-payment-button__button .path{stroke:canvastext}}@keyframes shopify-dash{0%{stroke-dashoffset:280px}50%{stroke-dashoffset:75px;transform:rotate(135deg)}to{stroke-dashoffset:280px;transform:rotate(450deg)}}#shopify-buyer-consent{width:100%;margin-top:1em;display:inline-block}#shopify-buyer-consent.hidden{display:none}#shopify-subscription-policy-button,#shopify-managed-markets-terms-and-conditions-button,#shopify-managed-markets-privacy-policy-button{font-size:inherit;cursor:pointer;background:0 0;border:none;padding:0;text-decoration:underline}#shopify-subscription-policy-button:before,#shopify-managed-markets-terms-and-conditions-button:before,#shopify-managed-markets-privacy-policy-button:before{box-shadow:none}@keyframes acceleratedCheckoutLoadingSkeleton{50%{opacity:var(--shopify-accelerated-checkout-skeleton-animation-opacity-start,1)}75%{opacity:var(--shopify-accelerated-checkout-skeleton-animation-opacity-end,.5)}to{opacity:var(--shopify-accelerated-checkout-skeleton-animation-opacity-start,1)}}.shopify-payment-button__skeleton{animation:acceleratedCheckoutLoadingSkeleton var(--shopify-accelerated-checkout-skeleton-animation-duration,4s) var(--shopify-accelerated-checkout-skeleton-animation-timing-function,ease) infinite;background-color:var(--shopify-accelerated-checkout-skeleton-background-color,#dedede);box-sizing:border-box;height:var(--shopify-accelerated-checkout-button-block-size,inherit);border-radius:var(--shopify-accelerated-checkout-button-border-radius,inherit);min-height:25px;max-height:55px;animation-delay:-.168s;text-decoration:none!important}",Yc=".accelerated-checkout-button{height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,44px), 55px);min-height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,44px), 55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius,0px);box-shadow:var(--shopify-accelerated-checkout-button-box-shadow)}:host([page-type=cart_page]){height:100%;display:block}:host([page-type=cart_page]) .accelerated-checkout-button{border-radius:var(--shopify-accelerated-checkout-button-border-radius,4px);width:100%;height:100%;min-height:0;box-shadow:var(--shopify-accelerated-checkout-button-box-shadow)}:host([page-type=product]) .accelerated-checkout-button{min-width:150px}@media (forced-colors:active){.accelerated-checkout-button,:host([page-type=cart_page]) .accelerated-checkout-button{border:1px solid #0000!important}}",kt=class{red;green;blue;opacity;constructor(t,e,r,n){this.red=t||0,this.green=e||0,this.blue=r||0,this.opacity=typeof n>"u"?1:n}getLuminance(){const t=this.red&255,e=this.green&255,r=this.blue&255;return t*.2126+e*.7152+r*.0722}isDark(){return this.opacity===0?!1:this.getLuminance()/this.opacity<70}blendWith(t,e){this.opacity=1-(1-t.opacity)*(1-e.opacity),this.red=this.blend(t.red,e.red,t,e),this.green=this.blend(t.green,e.green,t,e),this.blue=this.blend(t.blue,e.blue,t,e)}blend(t,e,r,n){return Math.round(t*r.opacity/this.opacity+e*n.opacity*(1-r.opacity)/this.opacity)}};function Kc(t){const e=[...t];let r=new kt(0,0,0,0),n=new kt(255,255,255,1),a=e.shift();for(;a;)r.opacity>0&&a.opacity>0?(n=new kt(0,0,0,0),n.blendWith(a,r)):a.opacity>0?n=a:n=r,r=n,a=e.shift();return n}var lr=new kt(255,255,255,1);function Qc(t){const e=[];let r=t;for(;r.parentElement;){r=r.parentElement;const n=window.getComputedStyle(r).backgroundColor,a=Jc(n);if(n&&e.push(a),a.opacity===1)break}try{return Kc(e.reverse())}catch(n){return g.notify(new Br(`[BackgroundDetection] Failed to blend colors for element ${t.outerHTML}`,{cause:n})),lr}}var Xc=new kt(0,0,0,0);function Jc(t){if(!t)return lr;if(t==="transparent")return Xc;try{const e=t.split("(")[1].split(")")[0].replace(" ","").split(",");return new kt(Number(e[0]),Number(e[1]),Number(e[2]),typeof e[3]>"u"?1:Number(e[3]))}catch(e){g.notify(new Br(`[BackgroundDetection] Failed to convert rgbString to array ${t}`,{cause:e}))}return lr}var Br=class extends Error{};Br.prototype.name="ColorProcessingError";var ut=class extends re{name=m.Unknown;i18n;dataSource;apiClient;classNames;containerInstanceNumber;supportsSubscriptions;
40supportsDeferredPurchaseOptions;onRendered;onRenderFailed;setI18n;setDataSource;setApiClient;setClassNames;setContainerInstanceNumber;parsedWalletParams;#t;#e;constructor(){super(),this.onRendered=()=>{},this.onRenderFailed=()=>{},this.supportsSubscriptions=!1,this.supportsDeferredPurchaseOptions=!1,[this.i18n,this.setI18n]=ot(),[this.dataSource,this.setDataSource]=ot(),[this.apiClient,this.setApiClient]=ot(),[this.classNames,this.setClassNames]=ot(),[this.containerInstanceNumber,this.setContainerInstanceNumber]=ot()}async cleanupOnFailure(t,e){try{await t()}catch(r){g.notify(new $n(`An error occurred requiring cleanup when attempting to render the ${e} instrument: ${r}`,{cause:r}));const n=await this.containerInstanceNumber;c.instrumentLoaded({instrumentOrComponentName:e,result:"failed",measurement:j(L.ButtonDisplay,`${e}:${n}`)}),this.parentElement?.remove(),this.onRenderFailed()}}attributeChangedCallback(t,e,r,n){e!==r&&t==="disabled"&&n&&(r===""?(n.setAttribute("aria-disabled","true"),n.setAttribute("disabled","")):(n.removeAttribute("aria-disabled"),n.removeAttribute("disabled")))}disconnectedCallback(){this.#e?.disconnect(),this.#e=void 0}get pageType(){return this.getAttribute("page-type")||S.Unknown}get buttonTheme(){return Qc(this).isDark()?"LIGHT":"DARK"}get isCTA(){return this.hasAttribute("call-to-action")}get walletParams(){if(this.parsedWalletParams===void 0)try{this.parsedWalletParams=JSON.parse(this.getAttribute("wallet-params")??"{}")}catch(t){throw new q({code:"invalid-wallet-params",message:`[${this.name}] Error while parsing wallet-params JSON: ${t}`},{cause:t})}return this.parsedWalletParams}async initializeShadowStyles(t,e=""){const r=document.createElement("style");r.innerHTML=[Yc,e].join(`
41`),t.appendChild(r)}async ensureLightDOMIsNotEmpty(){this.textContent="\xA0"}
41dispatchWalletEvent({eventName:t,detail:e={}}){this.parentElement?.dispatchEvent(new CustomEvent(t,{detail:e}))}getOrCreateShadowRoot(){return this.#t||(this.#t=this.attachShadow({mode:"closed"})),this.guardAgainstTPOOverlays(this.#t),this.#t}clearShadowRoot(){this.#t&&(this.#t.innerHTML="")}guardAgainstTPOOverlays(t){this.#e||!window.TPOConfigs||(c.log({body:"Guard against TPO overlay triggered"}),this.#e=new MutationObserver(e=>{for(const r of e)for(const n of Array.from(r.addedNodes))n instanceof HTMLElement&&n.classList.contains("tpo-buy-it-now-btn")&&n.remove()}),this.#e.observe(t,{childList:!0,subtree:!0}))}},$n=class extends Error{};$n.prototype.name="CleanupOnFailureError";var Zc=class extends ut{name=m.BuyItNow;button=null;static get observedAttributes(){return["disabled"]}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}attributeChangedCallback(t,e,r){super.attributeChangedCallback(t,e,r,this.button)}async handleClick(){if(this.disabled||!this.button||this.button.getAttribute("aria-disabled"))return;this.disabled=!0,ct(this.name,this.pageType);const[t,e]=await Promise.all([this.i18n,this.dataSource]);try{const{decelerationReason:r,cart:n,customValidationError:a,unrecoverableError:i,abortReason:o}=await dt({element:this,instrumentName:this.name,dataSource:e});if(i){c.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),At(t,i);return}if(o==="out_of_stock"){c.sheetClicked({instrument:this.name,result:"rejected",reason:"out_of_stock"}),st(t);return}if(a){c.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),Et(t,a.message);return}if(r){c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),N({checkoutUrl:n?.checkoutUrl??"",instrumentName:this.name,reason:r});return}c.sheetClicked({instrument:this.name,result:"success"}),et(n?.checkoutUrl??"","allow_redirect")}catch(r){g.notify(r),c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in Buy It Now Button click",attributes:{error:String(r)}}),yt(t)}}async render(){this.button||(this.button=ze());const t=await this.classNames;this.button.textContent=(await this.i18n).translate("instruments_copy.checkout.buy_now"),this.button.className=t,this.disabled&&this.button.setAttribute("aria-disabled","true"),this.button.onclick=()=>this.handleClick(),this.appendChild(this.button),this.onRendered?.()}},td=1e3,ed=()=>td*Pr();function rd(){const t=navigator.userAgent,e=t.indexOf("Android")>-1,r=t.indexOf("Chrome/")>-1,n=parseInt((/Chrome\/([0-9]+)/.exec(t)||["0","0"])[1],10);return e&&r&&n===114}function ad(t){let e=()=>{},r;const n=new Promise((o,s)=>{e=s}),a=Promise.race([t,n]).finally(()=>clearTimeout(r)),i=()=>e(new Error("timed out"));try{r=setTimeout(i,ed())}catch{i()}return a}
41var ht=class{static walletName(){throw new Error("Must define walletName for WalletInstrument subclass")}walletParams;supportsSubscriptions;supportsDeferredPurchaseOptions;constructor(t){this.walletParams=t.wallet_params,this.supportsSubscriptions=t.supports_subs??!1,this.supportsDeferredPurchaseOptions=t.supports_def_opts??!1}async createWebComponent({walletContainer:t,dataSource:e,i18n:r,apiClient:n,containerInstanceNumber:a,classNames:i="",callToAction:o,pageType:s=S.ProductPage,slot:l="button",onRendered:d=()=>{},onRenderFailed:u=()=>{}}){const h=this.getWebComponentName();if(!Z(h,this.getWebComponentClass(),{isChildCustomElement:!0}))throw new W(`Failed to define custom element ${h}, aborting execution`);try{await ad(customElements.whenDefined(h))}catch{throw new W(`Timeout waiting for custom element ${h} to be defined`)}const p=document.createElement(h);if(!(p instanceof ut))throw new W(`Failed to create web component instance for ${h}, element is not a WalletButtonElement`);const y={"access-token":t.accessToken??"","buyer-country":t.buyerCountry??"","buyer-currency":t.buyerCurrency,"wallet-params":JSON.stringify(this.walletParams??{}),"page-type":s,slot:l};try{t.disabled&&p.setAttribute("disabled",""),Lt(p,y),t.isShippingRequired&&p.setAttribute("requires-shipping",""),t.hasSellingPlan&&p.setAttribute("has-selling-plan",""),t.pciEnabled&&p.setAttribute("pci-enabled","")}catch(_){throw _ instanceof Error&&_.message.includes("setAttribute is not a function")&&rd()?new W(_.message):_}if(o&&p.setAttribute("call-to-action",""),typeof p.setDataSource!="function")throw new W(`Custom element ${h} is not properly upgraded, aborting execution`);return p.setDataSource(e),p.setApiClient(n),p.setI18n(r),p.setClassNames(i),p.setContainerInstanceNumber(a),p.supportsSubscriptions=this.supportsSubscriptions,p.supportsDeferredPurchaseOptions=this.supportsDeferredPurchaseOptions,p.onRendered=d,p.onRenderFailed=u,p}getWalletParamsEligibility(){return{eligible:!0}}loadWalletSDK(){return Promise.resolve()}getLoadEligibility(t){return{eligible:!0}}getPartnerSDKEligibility(){return{eligible:!0}}isInIframe(){return typeof window>"u"||window.self!==window.top}},nd=class extends ht{static walletName(){return"buy_it_now"}getWebComponentName(){return"shopify-buy-it-now-button"}getInstrumentName(){return m.BuyItNow}getWebComponentClass(){return Zc}},od="shopify-paypal-button[disabled]{opacity:.5;cursor:not-allowed}shopify-paypal-button div.paypal-buttons>iframe{box-shadow:none;z-index:auto!important;border-radius:0!important}",id="::slotted(div){height:100%}:host([page-type=cart_page]) ::slotted(div){justify-content:center;width:100%;min-width:100px;display:flex}:host([page-type=cart_page]) .accelerated-checkout-button{justify-content:center;display:flex;overflow:hidden}";async function Tt(t){const{cartId:e,cartClient:r,instrumentName:n,abortSignal:a}=t;try{if(!e)throw new Error(`[${n}] provided no cart ID when updating buyer identity`);if(!r)throw new Error(`[${n}] provided invalid cart client when updating buyer identity`);return await r.updateCartBuyerIdentity(t,a)}catch(i){throw c.updateFailed({instrument:n,request:"updateBuyerIdentity",error:i}),i}}async function Gr({cartId:t,totalAmount:e,paymentMethod:r,billingAddress:n,cartClient:a,instrumentName:i,abortSignal:o,hasSellingPlan:s,canUsePaymentMethodForFreeOrder:l}){try{if(!t)throw new Error(`[${i}] provided no cart ID when updating payment`);if(!e)throw new Error(`[${i}] provided no total amount when updating payment`);if(!r)throw new Error(`[${i}] provided no apple pay wallet content when updating payment`);if(!a)throw new Error(`[${i}] provided invalid cart client when updating payment`);const d={freePaymentMethod:{billingAddress:n}};return await a.updateCartPayment(t,{amount:{amount:e.amount,currencyCode:e.currencyCode},...Number(e.amount)<=0&&!l&&!s?d:r},i,o)}catch(d){throw c.updateFailed({instrument:i,request:"updatePayment",error:d}),d}}function Vn(t){return window[Wn(t)]}function Wn(t){return`paypal-${t.replace(/[^a-zA-Z0-9]/g,"")}`}var sd="GENERIC_ERROR",ld="NO_PENDING_TASK",cd="WALLET_SERVICE_DISABLED",dd="FAILED_TO_ENQUEUE_BACKGROUND_JOB",ud="REQUEST_MISSING_VALID_MERCHANDISE_SOURCE",hd="THROTTLE_EXCEEDED",pd="INTERNAL_SERVER_ERROR",md=[sd,ld,cd,dd,ud,hd,pd];function fa(t){return t?.map(e=>({code:e.extensions?.code,isLoggable:md.includes(e.extensions?.code)})).find(({code:e,isLoggable:r})=>e==="RESTRICTED_WALLET_ACCOUNT"||r)}function ke(t){if(!t)return null;const e=getComputedStyle(t).borderRadius;return e.includes("px")?parseInt(e,10):null}function cr(t){if(!t)return null;const e=getComputedStyle(t).height;return e.includes("px")?parseInt(e,10):null}var gd=["cart_throttled","payment_method_not_applicable","invali
41d_payment_deferred_payment_required","nested_line_subscription","nested_line_deferred_payment"],Xe="PAYPAL_CALLBACK_HANDLED_ERROR",fd=["Can not set name for cross-domain window","too much recursion"],yd=class extends ut{name=m.PayPal;abortController=null;cartId;sdkButtonsComponent=void 0;container=null;resizeObserver=null;buttonHeight;rendering=!1;pendingResize=!1;prevBorderRadius=0;prevHeight=0;#t=!1;#e="";#r=0;#n;connectedCallback(){this.resizeObserver=wt("ResizeObserver",()=>this.onResize()),this.cleanupOnFailure(this.render.bind(this),this.name),window.addEventListener("pageshow",this.onPageShowHandler)}async disconnectedCallback(){window.removeEventListener("pageshow",this.onPageShowHandler),super.disconnectedCallback(),this.innerHTML="",this.clearShadowRoot(),await this.teardownPayPalButton(),this.resizeObserver?.disconnect()}onPageShowHandler=t=>{t.persisted&&!this.rendering&&(this.rendering=!0,this.cleanupOnFailure(async()=>{await this.teardownPayPalButton(),this.container&&(this.container.innerHTML=""),await this.renderFromPayPalSDK()},this.name))};async teardownPayPalButton(){try{await this.sdkButtonsComponent?.close().catch(()=>{})}catch{}finally{this.sdkButtonsComponent=void 0}}async onResize(){const t=ke(this.container),e=this.getHeight(),r=t!==null&&this.prevBorderRadius!==t||this.prevHeight!==e;!this.rendering&&r?(this.rendering=!0,await this.teardownPayPalButton(),this.container.innerHTML="",await this.cleanupOnFailure(()=>this.renderFromPayPalSDK(),this.name)):this.rendering&&r&&(this.pendingResize=!0)}async render(){const t=this.getOrCreateShadowRoot(),e=document.createElement("div");e.className=_t.BUTTON;const r=document.createElement("style");r.innerHTML=od,this.appendChild(r),await this.initializeShadowStyles(t,id),t.appendChild(e),this.container=e,await ns();const n=this.renderFromPayPalSDK();this.resizeObserver?.observe(this.container),await n}getHeight(){const t=cr(this.container);return t?t>=25&&t<=55?t:t<25?(console.debug("[PayPalButton] Container height is less than the minimum height of the PayPal button. Using the minimum height of 25px."),25):(console.debug("[PayPalButton] Container height is greater than the maximum height of the PayPal button. Using the maximum height of 55px."),55):44}async renderFromPayPalSDK(){if(!this.container)throw new Error("button container not set when attempting to render");this.rendering=!0;const t=this.requiresBillingAgreement(),e=this.isVaultWithPurchaseOrder(),r=async()=>this.createToken({apiClientPromise:this.apiClient,requiresBillingAgreement:t,isVaultWithPurchaseOrder:e});let n,a;t&&!e?a=r:n=r;const i=ke(this.container),o=this.getHeight();this.prevHeight=o;const s={color:"gold",label:this.isCTA?"pay":"paypal",disableMaxWidth:!0,height:o,shape:"sharp"};i&&i>0&&(s.borderRadius=i,this.prevBorderRadius=i);const l=await this.i18n;this.sdkButtonsComponent=Vn(this.walletParams.sdkUrl)?.Buttons?.({fundingSource:"paypal",style:s,createOrder:n,createBillingAgreement:a,onApprove:async u=>{await this.onApprove(u)},onCancel:()=>{this.cancelPaymentSheet("Payment sheet cancelled")},onClick:this.onClick.bind(this),onError:u=>{this.onError(u,l)}});let d=!1;try{await this.sdkButtonsComponent?.render(this.container),d=!0}catch(u){c.renderFailed(this.name),c.log({body:"PayPal Button not able to render into container.",attributes:{pageType:this.pageType,error:u?.toString()}})}finally{this.rendering=!1}d?this.onRendered?.():this.onRenderFailed?.(),this.pendingResize&&(this.pendingResize=!1,await this.onResize())}cancelPaymentSheet(t){this.#t=!0,c.sheetCancelled(this.name),this.abortController?.abort(`[PayPal] ${t}`)}async onClick(t,e){if(this.disabled)return e.reject();ct(this.name,this.pageType),this.#t=!1,this.abortController=wt("AbortController");
41const r=this.getBoundingClientRect(),n=r.left+r.width/2,a=r.top+r.height/2,i=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1,clientX:n,clientY:a,screenX:window.screenX+n,screenY:window.screenY+a});this.dispatchEvent(i);const[o,s]=await Promise.all([this.dataSource,this.i18n]);try{const{decelerationReason:l,cart:d,customValidationError:u,unrecoverableError:h,abortReason:p}=await dt({element:this,instrumentName:this.name,dataSource:o});return h?(c.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),c.log({body:"Unrecoverable error detected in PayPal sheet clicked",attributes:{unrecoverableError:h}}),At(s,h),e.reject()):p==="out_of_stock"?(c.sheetClicked({instrument:this.name,result:"rejected",reason:"out_of_stock"}),st(s),e.reject()):u?(c.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),c.log({body:"Custom validation error detected in PayPal sheet clicked",attributes:{errorMessage:u?.message}}),Et(s,u.message),e.reject()):this.hasSellingPlanConflict(d)?(c.sheetClicked({instrument:this.name,result:"success",reason:"redirected_to_checkout"}),et(d?.checkoutUrl??""),e.reject()):this.isVaultWithPurchaseOrder()&&Number(d.totalAmount.amount)<=0?(c.sheetClicked({instrument:this.name,result:"success",reason:"redirected_to_checkout"}),et(d.checkoutUrl),e.reject()):l?(c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),N({checkoutUrl:d?.checkoutUrl??"",instrumentName:this.name,reason:l}),e.reject()):(this.cartId=d.id,this.#e=d.checkoutUrl,e.resolve())}catch(l){return c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in PayPal sheet clicked",attributes:{error:String(l),location:"onClick",...this.cartId&&{cartId:Jt(this.cartId)}}}),g.notify(l),yt(s),e.reject()}}async createToken({apiClientPromise:t,requiresBillingAgreement:e,isVaultWithPurchaseOrder:r}){const n=++this.#r;this.#n=void 0;const a=await t;try{if(!this.cartId)throw new Error("cartId not found when creating token");const i=await a.paypalTokenCreate({cartId:this.cartId,billingAgreement:e,isVaultWithPurchaseOrder:r});return c.sheetClicked({instrument:this.name,result:"success"}),n===this.#r&&(this.#n=i.authAssertionContext?{orderId:i.token,value:i.authAssertionContext}:void 0),i.token}catch(i){throw this.#t||(i instanceof W?c.sheetClicked({instrument:this.name,result:"rejected",reason:"silenced_error"}):(c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in PayPal sheet clicked",attributes:{error:String(i),location:"createToken",...this.cartId&&{cartId:Jt(this.cartId)}}}),g.notify(i))),yt(await this.i18n),new Error(Xe)}}async onApprove({orderID:t,payerID:e,billingToken:r}){try{if(c.authorizationAttempt(this.name),zt(L.AuthorizationLatency,this.name),!this.cartId)throw new Error("Cart not found");const n=await this.apiClient,a=this.isVaultWithPurchaseOrder(),i=this.requiresBillingAgreement()&&!a?r??t:t,o=this.#n?.orderId===t?this.#n.value:void 0,{billingAddress:s,destinationAddress:l,expiresAt:d,email:u,remoteOrderId:h,payerApprovedAmount:p}=o?await n.paypalBuyerDetailsFetch(i,this.cartId,o):await n.paypalBuyerDetailsFetch(i,this.cartId),y=h??t,_=y===t?o:void 0;if(this.isShippingRequired&&!this.isShippingCountrySupported(l?.country)){N({checkoutUrl:this.#e,instrumentName:this.name,reason:"shipping_country_unavailable"});return}const v=await Tt({cartId:this.cartId,cartClient:n,instrumentName:this.name,emailAddress:u,streetAddress:l});if(!v?.data)throw new Error("Cart not found");if(await this.decelerateOrAbort(v,{detectCurrencyChange:!1}))return;const{id:T,totalAmount:w,checkoutUrl:P}=v.data,k=this.parseAddress({billingAddress:s,destinationAddress:l}),O=await Gr({abortSignal:this.abortController?.signal,cartClient:n,cartId:T,instrumentName:m.PayPal,billingAddress:k,paymentMethod:{walletPaymentMethod:{paypalWalletContent:{..._&&{authAssertionContext:_},billingAddress:k,email:u,expiresAt:d,payerId:e,token:y,acceptedSubscriptionTerms:!1,vaultingAgreement:!1,merchantId:this.walletParams.merchantId,currencyCode:this.buyerCurrency,...p&&{payerApprovedAmount:p},...a&&{isVaultWithPurchaseOrder:a}}}},canUsePaymentMethodForFreeOrder:!0,totalAmount:w});if(await this.decelerateOrAbort(O))return;c.authorizationComplete({instrument:this.name,result:"success",measurement:j(L.AuthorizationLatency,this.name)}),et(P)}catch(n){throw this.#t||(c.authorizationComplete({instrument:this.name,result:"failed",measurement:j(L.AuthorizationLatency,this.name)}),g.notify(n)),yt(await this.i18n),new Error(Xe)}}onError(t,e){if(this.#t||t.message.includes(Xe))return;if(t.message==="Window is closed, can not determine type"){this.cancelPaymentSheet("Window Closed Error");return}if(t.message==="Detected popup close"){this.cancelPaymentSheet("Popup Closed Error");return}t.message==="RESTRICTED_WALLET_ACCOUNT"?c.log({body:`PayPal modal closed due to error: ${t}`}):fd.some(n=>t.message.includes(n))?c.log({body:"Internal PayPal error occurred"}):g.notify(new jn(t)),c.sheetFailed(this.name,t),this.abortController?.abort("[PayPal] Error occurred");const r=e.translate("brand.paypal");X(r,e)}requiresBillingAgreement(){return!!(this.walletParams.hasManagedSellingPlanState||this.walletParams.requiresBillingAgreement)}isVaultWithPurchaseOrder(){const t=this.walletParams.gatewayType==="CONNECTED"&&Q.enabled(ml),e=this.walletParams.gatewayType==="MANAGED"&&Q.enabled(gl);
41return this.requiresBillingAgreement()&&(t||e)}get serviceableCountries(){const t=this.walletParams.serviceableCountryCodes;return!Array.isArray(t)||t.length===0?null:new Set(t)}isShippingCountrySupported(t){const e=this.serviceableCountries;return!e||!t?!0:e.has(t)}async decelerateOrAbort(t,{detectCurrencyChange:e=!0}={}){if(t.abortReason==="out_of_stock")return await this.handleOutOfStock(),!0;if(Un(t.errors,Lr))return await this.handleOutOfStock(),!0;if(!t.data)return!1;const{totalAmount:r,checkoutUrl:n}=t.data;let a;return t.decelerationReason&&gd.includes(t.decelerationReason)?a=t.decelerationReason:e&&xr({currentCartTotal:r,initialBuyerCurrency:this.buyerCurrency})&&(a="currency_changed"),a?(N({checkoutUrl:n,instrumentName:this.name,reason:a}),!0):!1}async handleOutOfStock(){c.authorizationComplete({instrument:this.name,result:"failed",measurement:j(L.AuthorizationLatency,this.name)}),st(await this.i18n)}hasSellingPlanConflict(t){const{hasManagedSellingPlanState:e}=this.walletParams;return e==null||!t?!1:t.lineItems.some(r=>r.sellingPlanAllocation!=null)!==e}parseAddress({billingAddress:t,destinationAddress:e}){const r=t??e;return r.country?r:this.buyerCountry?{...r,country:this.buyerCountry}:(g.notify(new Error("PayPal address missing country and buyer country is not set")),{...r,country:"ZZ"})}},jn=class extends J{#t;get stack(){return this.#t}set stack(t){this.#t=t}get useHashPrefix(){return!0}constructor(t){super(t.message,{cause:t.cause}),this.stack=t.stack}};jn.prototype.name="PayPalError";function Ue(t,e){const r=e instanceof Event?e.type:String(e);return new W(`Error loading ${t} script: ${r}`)}var bd=class pe extends ht{static paypalSDKPromiseByUrl=new Map;static walletName(){return"paypal"}constructor(e){super(e)}getWebComponentName(){return"shopify-paypal-button"}getInstrumentName(){return m.PayPal}getWebComponentClass(){return yd}getWalletParamsEligibility(){return typeof this.walletParams?.sdkUrl!="string"||this.walletParams.sdkUrl.length===0?{eligible:!1,reason:"walletParams.sdkUrl is missing or invalid"}:{eligible:!0}}loadWalletSDK(){let e=pe.paypalSDKPromiseByUrl.get(this.walletParams.sdkUrl);if(e)return c.log({body:"Returning cached PayPal SDK promise",attributes:{sdkUrl:this.walletParams.sdkUrl}}),e;const r=document.createElement("script");return r.setAttribute("src",this.walletParams.sdkUrl),e=new Promise((n,a)=>{r.setAttribute("data-namespace",Wn(this.walletParams.sdkUrl)),r.onload=()=>n(),r.onerror=i=>{pe.paypalSDKPromiseByUrl.delete(this.walletParams.sdkUrl),r&&document.body?.contains(r)&&document.body.removeChild(r),a(Ue("PayPal",i))},document.body.appendChild(r)}),pe.paypalSDKPromiseByUrl.set(this.walletParams.sdkUrl,e),e}getLoadEligibility(){return this.isInIframe()?{eligible:!1,reason:"cannot be loaded in an iframe"}:{eligible:!0}}getPartnerSDKEligibility(){try{return Vn(this.walletParams.sdkUrl)?.Buttons?.().isEligible()?{eligible:!0}:{eligible:!1,reason:"PayPal SDK not eligible"}}catch(e){throw new q({code:"paypal-sdk-eligibility-check-failed",message:`PayPal SDK 'isEligible' method failed unexpectedly: ${e}`})}}},wd=".apple-pay-button{cursor:pointer;border:none;justify-content:center;align-items:center;width:100%;display:flex;padding:0!important;&:hover:not(:disabled){filter:brightness(92%)}&:disabled{opacity:.5;cursor:not-allowed}}.apple-pay-button svg{flex-shrink:0;height:100%}.apple-pay--content{white-space:pre;flex-grow:1;justify-content:center;align-items:center;width:100%;height:100%;font-family:San Francisco,sans-serif;font-size:16px;display:flex}.apple-pay--light{color:#000;background:#fff;& svg{fill:#000}}.apple-pay--dark{color:#fff;background:#000;& svg{fill:#fff}}",dr={UK:"GB",JA:"JP"},_d=new Set(["EG","AE"]),qn=["AS","GU","MP","PR","VI"];qn.forEach(t=>{dr[t]="US"});var Ed=/^[A-Z]{1,2}[0-9]{1,2}[A-Z]?$/,Ad=/^[A-Z][0-9][A-Z]$/;function Cd({postalCode:t,countryCode:e}){let r=t;const n=t.trim().toUpperCase();return e==="CA"&&Ad.test(n)?r=`${n} 0Z0`:e==="GB"&&Ed.test(n)&&(r=`${n} 0ZZ`),r}function le(t,{applyPostalCodePadding:e}){const r=t.countryCode,n={firstName:t.givenName||void 0,lastName:t.familyName||void 0,address1:t?.addressLines?.[0],address2:t?.addressLines?.[1]||void 0,city:t.locality||void 0,zip:t.postalCode||void 0,province:t.administrativeArea||t.subLocality||void 0,country:vd(t.countryCode),phone:t.phoneNumber||void 0};return r&&_d.has(r.toUpperCase())&&(n.province=t.locality||void 0,n.city=t.administrativeArea||t.subLocality||void 0),e&&n.zip&&(n.zip=Cd({postalCode:n.zip,countryCode:n.country})),n.country==="HK"&&(n.zip=void 0,n.province=t.postalCode),r&&qn.includes(r)&&(n.province=r),n.lastName||(n.lastName=n.firstName),n}function vd(t){if(!t)return"ZZ";const e=t.toUpperCase();return Object.keys(dr).includes(e)?dr[e]:e}function Sd(t,e){return t.map(r=>{const{title:n,deliveryPromise:a}=kd(r,e);return{title:n,estimatedCost:{amount:Id(r),currencyCode:r[0].estimatedCost.currencyCode},handle:Qn(r),deliveryPromise:a}})}function Pd(t,e){return t.map(r=>{const{title:n,description:a}=Td(r,e);return{title:n,description:a,handle:Qn(r)}})}function Yn({deliveryGroups:t}){return t.map(e=>e.deliveryOptions.filter(({deliveryMethodType:r})=>r==="SHIPPING").map(r=>({...r,groupType:e.groupType}))).reduce((e,r)=>e.flatMap(n=>r.map(a=>[...n,a])),[[]])}function Id(t){return t.reduce((e,r)=>e+Number(r.estimatedCost.amount),0).toFixed(2)}function kd(t,e){const r=[...t.filter(i=>i.groupType===Rt.OneTimePurchase),...t.filter(i=>i.groupType===Rt.Subscription)],n=[...new Set(r.map(({title:i})=>i))].filter(i=>!!i),a=[...new Set(r.map(({deliveryPromise:i})=>i))].filter(i=>!!i);return{title:Kn(n,e),deliveryPromise:a.reduce((i,o)=>i?e.translate("delivery_promises.connect_delivery_promises",{promiseOne:i,promiseTwo:o}):o,"")}}function Td(t,e){const r=[...t.filter(a=>a.groupType===Rt.OneTimePurchase),...t.filter(a=>
41a.groupType===Rt.Subscription)],n=r.map(Dd).filter(Boolean).join(", ");return{title:Kn(r.map(({title:a})=>a).filter(a=>!!a),e),description:n}}function Kn(t,e){return t.reduce((r,n)=>r?e.translate("shipping_methods.connect_shipping_methods",{methodOne:r,methodTwo:n}):n,"")}function Dd(t){const e=Number(t.estimatedCost.amount).toFixed(2),r=t.estimatedCost.currencyCode,n=t.deliveryPromise;return n?`(${n}) ${e} ${r}`:`${e} ${r}`}function Qn(t){return t.map(e=>e.handle).join(",")}function Xn({deliveryGroups:t,i18n:e}){const r=t.some(n=>n.groupType===Rt.Subscription);return t.map(n=>{let a=e.translate("order_summary.shipping");return r&&(a=n.groupType===Rt.Subscription?e.translate("order_summary.shipping_subscription"):e.translate("order_summary.shipping_one_time_purchase")),{label:a,amount:it(n.selectedDeliveryOption?.estimatedCost.amount||0)}})}function Rd(t,e){return $t({label:t,possibleLines:[e]})[0]}function Nd({subtotal:t,deliveryGroups:e,duties:r,taxes:n,discountApplications:a,i18n:i,formattedRecurringTotals:o,lineItems:s}){const l=$t({label:i.translate("order_summary.subtotal"),possibleLines:[t]}),d=Xn({deliveryGroups:e,i18n:i}),u=$t({label:i.translate("order_summary.duties"),possibleLines:[r]}),h=$t({label:i.translate("order_summary.taxes"),possibleLines:[n]}),p=o.map(v=>({label:v,amount:"0.00",type:"pending"})),y=p.length?[{label:i.translate("order_summary.subscriptions.recurring_total_tooltip_line"),amount:"0.00",type:"pending"}]:[],_=a?.flatMap(v=>$t({label:v.title??v.code??i.translate("order_summary.discount"),possibleLines:["totalAllocatedAmount"in v?v.totalAllocatedAmount:v.discountedAmount],isDiscount:!0}))??[];return[...un(s,(v,T)=>({label:v,amount:T,type:"final"})),...l,...d,...u,...h,..._,...p,...y]}function $t({label:t,possibleLines:e,isDiscount:r=!1}){return e.filter(n=>n?.amount!==void 0).map(n=>({label:t,amount:r?`-${it(n.amount)}`:it(n.amount)}))}function ya(t,e){if(!t.length)return[];const r=Yn({deliveryGroups:t});return Sd(r,e).map(n=>({label:n.title||"",amount:n.estimatedCost.amount,identifier:n.handle,detail:n.deliveryPromise??""}))}var Od=["decelerate","abort","show_error","complete","update"],Te=class extends J{};Te.prototype.name="UnhandledActionError";var Jn=class{getMergedPaymentSheetAction({result:t,errorActions:e}){const r=new Map;e.forEach(a=>{a.matchers.forEach(i=>{const o=t.errors.find(s=>Yt(s,i));o&&r.set(o,a.generateAction)})});let n;for(const a of t.errors){const i=r.get(a);if(i){n=i();break}}return{firstPaymentSheetAction:n,prioritizedPaymentSheetAction:this.generatePrioritizedPaymentSheetAction(r,t.errors)}}getUnhandledErrors(t,e){const r=e.flatMap(a=>a.matchers),n=t.filter(a=>!r.some(i=>Yt(a,i)));return this.filterIncidentalErrors(n,t)}decelerateOrAbort({reason:t,instrumentName:e,errorOrWarning:r,checkoutUrl:n,requestType:a}){return n?{action:"decelerate",redirectUrl:n,reason:t}:{action:"abort",effects:[()=>{g.notify(new Error(`[${e}] unexpected ${r} received in ${a} response, aborting`))}]}}filterIncidentalErrors(t,e){return e.length>t.length?t.filter(r=>!Oc.some(n=>Yt(r,n))):t}generatePrioritizedPaymentSheetAction=(t,e)=>{let r;const n=[],a=[],i=[],o=e.filter(l=>l.code!=="PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT").some(l=>t.get(l)!==void 0);for(const l of t.keys())if(!(l.code==="PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT"&&o)){const d=t.get(l)();d.effects&&a.push(...d.effects),d.action!=="complete"&&d.errors&&i.push(...d.errors),n.push(d)}const s=(l=>Od.map(d=>l.find(u=>u.action===d)).find(d=>!!d))(n);return s&&(r=s,r.effects=a,r.action!=="complete"&&(r.errors=i)),r}},Ld=class extends Jn{i18n;constructor(t){super(),this.i18n=t}mapMutationResultToPaymentSheetAction({result:t,context:e,checkoutUrl:r,requestType:n}){const a=this.mapCustomValidationFunctionErrorToAction(t.errors);if(a)return a;const i=this.getErrorActions({shippingCountryCode:e?.shippingCountryCode,shippingZip:e?.shippingZip,shippingProvince:e?.shippingProvince,shippingCity:e?.shippingCity,billingCountryCode:e?.billingCountryCode,billingZip:e?.billingZip,billingProvince:e?.billingProvince,billingCity:e?.billingCity,checkoutUrl:r,requestType:n}),o=t.errors,s=this.processUnhandledErrors({errors:o,errorActions:i,resultType:"mutation"}),{firstPaymentSheetAction:l}=this.getMergedPaymentSheetAction({result:t,errorActions:i});return!l&&t.data?.deliveryGroups.length===0&&e?.shippingRequired?{action:"show_error",errors:[new ApplePayError("addressUnserviceable")]}:l||s||{action:"update",errors:[]}}mapCompletionResultToPaymentSheetAction({result:t,context:e,checkoutUrl:r}){if(!t.data)throw new Ja(m.ApplePay);switch(t.data.__typename){case"SubmitSuccess":return{action:"complete",redirectUrl:t.data.redirectUrl};case"SubmitAlreadyAccepted":case"SubmitThrottled":case"SubmitFailed":{const n=this.mapCustomValidationFunctionErrorToAction(t.errors);if(n)return n;const a=this.getErrorActions({shippingCountryCode:e?.shippingCountryCode,shippingZip:e?.shippingZip,shippingProvince:e?.shippingProvince,shippingCity:e?.shippingCity,billingCountryCode:e?.billingCountryCode,billingZip:e?.billingZip,billingProvince:e?.billingProvince,billingCity:e?.billingCity,checkoutUrl:r,requestType:"completion"}),i=t.errors;this.processUnhandledErrors({errors:i,errorActions:a,resultType:"completion"});const{prioritizedPaymentSheetAction:o}=this.getMergedPaymentSheetAction({result:t,errorActions:a});return o||this.createGenericAbortAction()}default:throw new Error(`[${m.ApplePay}] unknown completion result type: ${t.data.__typename}`)}}decelerateOrAbort(...t){const e=super.decelerateOrAbort(...t);return e.action==="abort"&&e.effects?.push(()=>{X(this.i18n.translate("brand.apple_pay"),this.i18n)}),e}getAbortActions(){return[{matchers:Lr,generateAction:()=>({action:"abort",effects:[()=>st(this.i18n)]})},{matchers:Fn,generateAction:()=>({action:"abort",effects:[()=>X(this.i18n.translate("brand.apple_pay"),this.i18n)]})}]}getDecelerateActions({checkoutUrl:t,requestType:e}){return[{matchers:[we],generateAction:()=>this.decelerateOrAbort({reason:"captcha_required",instrumentName:m.ApplePay,errorOrWarning:we.code,checkoutUrl:t,requestType:e})},{matchers:[_e],generateAction:()=>this.decelerateOrAbort({reason:"localization_extension_field_error",instrumentName:m.ApplePay,errorOrWarning:_e.code,checkoutUrl:t,requestType:e})},{matchers:[la],generateAction:()=>this.decelerateOrAbort({reason:"account_info_mismatch",instrumentName:m.ApplePay,errorOrWarning:la.code,checkoutUrl:t,requestType:e})},{matchers:[Ee],generateAction:()=>this.decelerateOrAbort({reason:"invalid_language",instrumentName:m.ApplePay,errorOrWarning:Ee.code,checkoutUrl:t,requestType:e})},{matchers:[Ae],generateAction:()=>this.decelerateOrAbort({reason:"invalid_country",instrumentName:m.ApplePay,errorOrWarning:Ae.code,checkoutUrl:t,requestType:e})},{matchers:[ca],generateAction:()=>this.decelerateOrAbort({reason:"payments_country_invalid",instrumentName:m.ApplePay,errorOrWarning:ca.code,checkoutUrl:t,requestType:e})},{matchers:[da],generateAction:()=>this.decelerateOrAbort({reason:"cart_empty",instrumentName:m.ApplePay,errorOrWarning:da.code,checkoutUrl:t,requestType:e})},{matchers:[Ce],generateAction:()=>this.decelerateOrAbort({reason:"missing_cart_id",instrumentName:m.ApplePay,errorOrWarning:Ce.code,checkoutUrl:t,requestType:e})},{matchers:[Se],generateAction:()=>this.decelerateOrAbort({reason:"redirect_to_checkout_required",instrumentName:m.ApplePay,errorOrWarning:Se.code,checkoutUrl:t,requestType:e})},{matchers:[ve],generateAction:()=>this.decelerateOrAbort({reason:"unsupported_apple_pay_payment_method",instrumentName:m.ApplePay,errorOrWarning:ve.code,checkoutUrl:t,requestType:e})},{matchers:[be],generateAction:()=>this.decelerateOrAbort({reason:"custom_validation",instrumentName:m.ApplePay,errorOrWarning:be.code,checkoutUrl:t,requestType:e})},{matchers:Ln,generateAction:()=>this.decelerateOrAbort({reason:"invalid_payment_amount",instrumentName:m.ApplePay,errorOrWarning:"INVALID_PAYMENT",checkoutUrl:t,requestType:e})},{matchers:Or,generateAction:()=>this.decelerateOrAbort({reason:"dynamic_tax",instrumentName:m.ApplePay,errorOrWarning:"TAX_NEW_TAX_MUST_BE_ACCEPTED",checkoutUrl:t,requestType:e})},{matchers:[Pe],generateAction:()=>this.decelerateOrAbort({reason:"generic_error",instrumentName:m.ApplePay,errorOrWarning:Pe.code,checkoutUrl:t,requestType:e})},{matchers:[ua],generateAction:()=>this.decelerateOrAbort({reason:"generic_error",instrumentName:m.ApplePay,errorOrWarning:ua.code,checkoutUrl:t,requestType:e})},{matchers:xn,generateAction:()=>this.decelerateOrAbort({reason:"not_enough_stock",instrumentName:m.ApplePay,errorOrWarning:"MERCHANDISE_NOT_ENOUGH_STOCK",checkoutUrl:t,requestType:e})}]}getShowErrorActions({shippingCountryCode:t,shippingZip:e,shippingProvince:r,shippingCity:n,billingCountryCode:a,billingZip:i,billingProvince:o,billingCity:s}
41){const l=(d,u)=>()=>{const h=u.startsWith("billingAddress");c.addressFieldError({instrument:m.ApplePay,errorCode:d,errorField:u,countryCode:h?a:t,zip:h?i:e,province:h?o:r,city:h?s:n})};return[{matchers:Zt.required,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","emailAddress",this.i18n.translate("errors.missing.email"))]})},{matchers:Zt.invalid,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","emailAddress",this.i18n.translate("errors.invalid.email"))]})},{matchers:f.required.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.missing.first_name"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.firstName")]})},{matchers:f.invalid.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.invalid.first_name"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.firstName")]})},{matchers:f.required.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.missing.last_name"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.lastName")]})},{matchers:f.invalid.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.invalid.last_name"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.lastName")]})},{matchers:On,generateAction:()=>({action:"show_error",errors:[new ApplePayError("addressUnserviceable")]})},{matchers:f.required.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.missing.address1"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.address1")]})},{matchers:f.invalid.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address1"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.address1")]})},{matchers:f.emojis.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.emojis.last_name"))]})},{matchers:f.emojis.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.emojis.first_name"))]})},{matchers:f.tooLong.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.too_long.address1"))]})},{matchers:f.tooLong.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.too_long.address2"))]})},{matchers:f.tooLong.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.too_long.first_name"))]})},{matchers:f.tooLong.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.too_long.last_name"))]})},{matchers:f.tooLong.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.too_long.city"))]})},{matchers:f.containsUrl.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.url.first_name"))]})},{matchers:f.containsUrl.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.url.last_name"))]})},{matchers:f.htmlTags.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address1"))]})},{matchers:f.htmlTags.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address2"))]})},{matchers:f.htmlTags.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.html_tags.city"))]})},{matchers:f.htmlTags.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.html_tags.first_name"))]})},{matchers:f.htmlTags.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.html_tags.last_name"))]})},{matchers:f.emojis.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.emojis.city"))]})},{matchers:f.emojis.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address1"))]})},{matchers:f.emojis.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address2"))]})},{matchers:f.emojis.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.emojis.postal_code"))]})},{matchers:f.required.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.missing.address2"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.address2")]})}
41,{matchers:f.invalid.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address2"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.address2")]})},{matchers:f.required.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.missing.city"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.city")]})},{matchers:f.invalid.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.invalid.city"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.city")]})},{matchers:f.invalid.province,generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.invalid.zone"),this.i18n.translate("errors.invalid.emirate"),"shippingContactInvalid",t)],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.province")]})},{matchers:f.required.province,generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.missing.zone"),this.i18n.translate("errors.missing.emirate"),"shippingContactInvalid",t)],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.province")]})},{matchers:f.required.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.missing.postal_code"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.zip")]})},{matchers:f.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.invalid.postal_code"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.zip")]})},{matchers:f.required.country,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","country",this.i18n.translate("errors.missing.country"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.country")]})},{matchers:f.invalid.phoneNumber,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","phoneNumber",this.i18n.translate("errors.invalid.phone"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.phone")]})},{matchers:f.invalid.country,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","country",this.i18n.translate("errors.invalid.country"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.country")]})},{matchers:f.required.phoneNumber,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","phoneNumber",this.i18n.translate("errors.missing.phone"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.phone")]})},{matchers:b.invalid.generic,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid")],effects:[l("INVALID_PAYMENT","billingAddress")]})},{matchers:b.required.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.missing.first_name"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.firstName")]})},{matchers:b.required.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.missing.last_name"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.lastName")]})},{matchers:b.required.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.missing.address1"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.address1")]})},{matchers:b.required.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.missing.address2"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.address2")]})},{matchers:b.required.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.missing.city"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.city")]})},{matchers:b.required.phoneNumber,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","phoneNumber",this.i18n.translate("errors.missing.phone"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.phone")]})},{matchers:b.required.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","postalCode",this.i18n.translate("errors.missing.postal_code"))],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.zip")]})},{matchers:b.required.province,generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.missing.zone"),this.i18n.translate("errors.missing.emirate"),"billingContactInvalid",a)],effects:[l("ADDRESS_FIELD_IS_REQUIRED","billingAddress.province")]})},{matchers:b.emojis.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.emojis.first_name"))]})},{matchers:b.htmlTags.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.html_tags.first_name"))]})}
41,{matchers:b.invalid.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.invalid.first_name"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.firstName")]})},{matchers:b.emojis.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.emojis.last_name"))]})},{matchers:b.htmlTags.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.html_tags.last_name"))]})},{matchers:b.invalid.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.invalid.last_name"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.lastName")]})},{matchers:b.emojis.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address1"))]})},{matchers:b.htmlTags.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address1"))]})},{matchers:b.invalid.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address1"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.address1")]})},{matchers:b.emojis.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address2"))]})},{matchers:b.htmlTags.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address2"))]})},{matchers:b.invalid.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address2"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.address2")]})},{matchers:b.emojis.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.emojis.city"))]})},{matchers:b.htmlTags.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.html_tags.city"))]})},{matchers:b.invalid.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.invalid.city"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.city")]})},{matchers:b.emojis.phoneNumber,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","phoneNumber",this.i18n.translate("errors.emojis.phone"))]})},{matchers:b.invalid.phoneNumber,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","phoneNumber",this.i18n.translate("errors.invalid.phone"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.phone")]})},{matchers:b.emojis.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","postalCode",this.i18n.translate("errors.emojis.postal_code"))]})},{matchers:b.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","postalCode",this.i18n.translate("errors.invalid.postal_code"))],effects:[l("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.zip")]})},{matchers:[Mn],generateAction:()=>({action:"show_error",errors:[new ApplePayError("unknown")]})},{matchers:[sr],generateAction:()=>({action:"show_error",errors:[new ApplePayError("couponCodeInvalid",void 0,this.i18n.translate("errors.invalid.discount"))]})}]}getErrorActions({shippingCountryCode:t,shippingZip:e,shippingProvince:r,shippingCity:n,billingCountryCode:a,billingZip:i,billingProvince:o,billingCity:s,checkoutUrl:l,requestType:d}){return[...this.getAbortActions(),...this.getDecelerateActions({checkoutUrl:l,requestType:d}
41),...this.getShowErrorActions({shippingCountryCode:t,shippingZip:e,shippingProvince:r,shippingCity:n,billingCountryCode:a,billingZip:i,billingProvince:o,billingCity:s})]}processUnhandledErrors({errors:t,errorActions:e,resultType:r}){const n=this.getUnhandledErrors(t,e);return n.forEach(a=>{g.notify(new Te(`[${m.ApplePay}] ${r} result error not handled: ${Pt(a)}`,{groupingHash:`UnhandledActionError:${m.ApplePay}:${Pt(a)}`}))}),n.length>0?this.createGenericAbortAction():null}createGenericAbortAction(){return{action:"abort",effects:[()=>{X(this.i18n.translate("brand.apple_pay"),this.i18n)}]}}mapCustomValidationFunctionErrorToAction(t){const e=kr(t);return e?{action:"abort",effects:[()=>{const r=this.i18n.translate("brand.apple_pay");Tr(this.i18n.translate("error_dialogs.wallet.title",{wallet:r}),e.message)}]}:null}createApplePayZoneError(t,e,r,n){const a=n==="AE"?"subLocality":"administrativeArea";return new ApplePayError(r,a,n==="AE"?e:t)}},ba=["name","postalAddress"];function xd({shippingRequired:t,walletParams:e,buyerCurrency:r}){const{phoneRequired:n,emailRequired:a}=e,i=[...a?["email"]:[],...n?["phone"]:[]],o=t?[...ba,...i]:i;return{countryCode:e.countryCode,currencyCode:r,merchantCapabilities:e.merchantCapabilities,supportedNetworks:e.supportedNetworks,total:{type:"pending",label:e.merchantName,amount:"1.00"},requiredBillingContactFields:ba,requiredShippingContactFields:o,shippingType:e.shippingType}}function Zn(t){const e=[],r=[],n=[];for(const a of t)a.targetType==="SHIPPING_LINE"?e.push(a):a.targetType==="LINE_ITEM"&&(a.targetSelection==="ALL"?r.push(a):n.push(a));return{shipping:e,order:r,product:n}}function Md(t){const{shipping:e,order:r,product:n}=Zn(t.discountApplications);return[...e,...r,...n]}var zd=t=>{const e=t.lineItems.flatMap(r=>r.discountAllocations);return[...t.discountCodes.filter(r=>r.applicable&&t.discountAllocations.findIndex(n=>n.code===r.code)===-1&&e.findIndex(n=>n.code===r.code)===-1).map(r=>({code:r.code,discountedAmount:{amount:"0",currencyCode:t.totalAmount.currencyCode}})),...t.discountAllocations,...e]},to=class extends J{get useHashPrefix(){return!0}get autogenerateHash(){return!0}};to.prototype.name="ApplePaySessionCreationError";var eo=t=>{const e=t.lineItems.reduce((r,n)=>r+Number(n.subtotalAmount.amount),0);return{amount:String(e),currencyCode:t.totalAmount.currencyCode}};function Fd(t,e){return t.reduce((r,n)=>{if(!n.sellingPlanAllocation)return r;const{sellingPlanAllocation:{sellingPlan:a,priceAdjustments:i},quantity:o}=n;if(!a.recurringDeliveries||!a.billingPolicy)return r;const s=Ud({billingPolicy:a.billingPolicy,i18n:e});if(i.length===0){const l=ce({price:Number(n.subtotalAmount.amount)*o,currencyCode:n.subtotalAmount.currencyCode,locale:e.locale});return[...r,e.translate("order_summary.subscriptions.recurring_totals",{fixedPrice:l,interval:s})]}else if(i.length===1){const l=ce({price:Number(i[0].price.amount)*o,currencyCode:i[0].price.currencyCode,locale:e.locale});return[...r,e.translate("order_summary.subscriptions.recurring_totals",{fixedPrice:l,interval:s})]}else if(i.length===2){const l=ce({price:Number(i[0].price.amount)*o,currencyCode:i[0].price.currencyCode,locale:e.locale}),d=ce({price:Number(i[1].price.amount)*o,currencyCode:i[1].price.currencyCode,locale:e.locale}),u=a.priceAdjustments[0].orderCount;return[...r,e.translate("order_summary.subscriptions.recurring_totals_with_policies",{count:u,fixedPrice:l,recurringPrice:d,interval:s})]}return r},[])}function ce({price:t,currencyCode:e,locale:r}){return Intl.NumberFormat(r,{style:"currency",currency:e,currencyDisplay:"narrowSymbol"}).format(t)}function Ud({billingPolicy:t,i18n:e}){const{interval:r,intervalCount:n}=t,a={YEAR:"order_summary.subscriptions.recurring_total_intervals.year",MONTH:"order_summary.subscriptions.recurring_total_intervals.month",WEEK:"order_summary.subscriptions.recurring_total_intervals.week",DAY:"order_summary.subscriptions.recurring_total_intervals.day"}[r];if(!a)throw new Error(`Unknown selling plan interval provided: ${r}`);return e.translate(a,{count:n})}var Be="GraphQL Client",ro="An error occurred while fetching from the API. Review 'graphQLErrors' for details.",ao="Response returned unexpected Content-Type:",no="An unknown error has occurred. The API did not return a data object or any errors in its response.",ur={json:"application/json",multipart:"multipart/mixed"},Bd="X-SDK-Variant",Gd="X-SDK-Version",Hd="shopify-graphql-client",$d="1.4.2",oo=1e3,Vd=[429,503],io=/@(defer)\b/i,Wd=/boundary="?([^=";]+)"?/i,wa=`\r
42\r
43`;function rt(t,e=Be){return t.startsWith(`${e}`)?t:`${e}: ${t}`}function Ct(t){return t instanceof Error?t.message:JSON.stringify(t)}function so(t){return t instanceof Error&&t.cause?t.cause:void 0}function lo(t){return t.flatMap(({errors:e})=>e??[])}function co({client:t,retries:e}){if(e!==void 0&&(typeof e!="number"||e<0||e>3))throw new Error(`${t}: The provided "retries" value (${e}
43) is invalid - it cannot be less than 0 or greater than 3`)}function B(t,e){return e&&(typeof e!="object"||Array.isArray(e)||typeof e=="object"&&Object.keys(e).length>0)?{[t]:e}:{}}function uo(t,e){if(t.length===0)return e;const r={[t.pop()]:e};return t.length===0?r:uo(t,r)}function ho(t,e){return Object.keys(e||{}).reduce((r,n)=>(typeof e[n]=="object"||Array.isArray(e[n]))&&t[n]?(r[n]=ho(t[n],e[n]),r):(r[n]=e[n],r),Array.isArray(t)?[...t]:{...t})}function po([t,...e]){return e.reduce(ho,{...t})}function jd({clientLogger:t,customFetchApi:e=fetch,client:r=Be,defaultRetryWaitTime:n=oo,retriableCodes:a=Vd}){const i=async(o,s,l)=>{const d=s+1,u=l+1;let h;try{if(h=await e(...o),t({type:"HTTP-Response",content:{requestParams:o,response:h}}),!h.ok&&a.includes(h.status)&&d<=u)throw new Error;const p=h?.headers.get("X-Shopify-API-Deprecated-Reason")||"";return p&&t({type:"HTTP-Response-GraphQL-Deprecation-Notice",content:{requestParams:o,deprecationNotice:p}}),h}catch(p){if(d<=u){const y=h?.headers.get("Retry-After");return await qd(y?parseInt(y,10):n),t({type:"HTTP-Retry",content:{requestParams:o,lastResponse:h,retryAttempt:s,maxRetries:l}}),i(o,d,l)}throw new Error(rt(`${l>0?`Attempted maximum number of ${l} network retries. Last message - `:""}${Ct(p)}`,r))}};return i}async function qd(t){return new Promise(e=>setTimeout(e,t))}function Yd({headers:t,url:e,customFetchApi:r=fetch,retries:n=0,logger:a}){co({client:Be,retries:n});const i={headers:t,url:e,retries:n},o=Kd(a),s=Qd(jd({customFetchApi:r,clientLogger:o,defaultRetryWaitTime:oo}),i);return{config:i,fetch:s,request:Xd(s),requestStream:nu(s)}}function Kd(t){return e=>{t&&t(e)}}async function mo(t){const{errors:e,data:r,extensions:n}=await t.json();return{...B("data",r),...B("extensions",n),headers:t.headers,...e||!r?{errors:{networkStatusCode:t.status,message:rt(e?ro:no),...B("graphQLErrors",e),response:t}}:{}}}function Qd(t,{url:e,headers:r,retries:n}){return async(a,i={})=>{const{variables:o,headers:s,url:l,retries:d,keepalive:u,signal:h}=i,p=JSON.stringify({query:a,variables:o});co({client:Be,retries:d});const y=Object.entries({...r,...s}).reduce((_,[v,T])=>(_[v]=Array.isArray(T)?T.join(", "):T.toString(),_),{});return!y["X-SDK-Variant"]&&!y["X-SDK-Version"]&&(y[Bd]=Hd,y[Gd]=$d),t([l??e,{method:"POST",headers:y,body:p,signal:h,keepalive:u}],1,d??n)}}function Xd(t){return async(...e)=>{if(io.test(e[0]))throw new Error(rt("This operation will result in a streamable response - use requestStream() instead."));let r=null;try{r=await t(...e);const{status:n,statusText:a}=r,i=r.headers.get("content-type")||"";return r.ok?i.includes(ur.json)?await mo(r):{errors:{networkStatusCode:n,message:rt(`${ao} ${i}`),response:r}}:{errors:{networkStatusCode:n,message:rt(a),response:r}}}catch(n){return{errors:{message:Ct(n),...r==null?{}:{networkStatusCode:r.status,response:r}}}}}}async function*Jd(t){const e=new TextDecoder;if(t.body[Symbol.asyncIterator])for await(const r of t.body)yield e.decode(r);else{const r=t.body.getReader();let n;try{for(;!(n=await r.read()).done;)yield e.decode(n.value)}finally{r.cancel()}}}function Zd(t,e){return{async*[Symbol.asyncIterator](){try{let r="";for await(const n of t)if(r+=n,r.indexOf(e)>-1){const a=r.lastIndexOf(e),i=r.slice(0,a).split(e).filter(o=>o.trim().length>0).map(o=>o.slice(o.indexOf(wa)+wa.length).trim());i.length>0&&(yield i),r=r.slice(a+e.length),r.trim()==="--"&&(r="")}}catch(r){throw new Error(`Error occured while processing stream payload - ${Ct(r)}`)}}}}function tu(t){return{async*[Symbol.asyncIterator](){try{yield{...await mo(t),hasNext:!1}}catch(e){yield{errors:{message:rt(Ct(e)),networkStatusCode:t.status,response:t},hasNext:!1}}}}}function eu(t){return t.map(e=>{try{return JSON.parse(e)}catch(r){throw new Error(`Error in parsing multipart response - ${Ct(r)}`)}}).map(e=>{const{data:r,incremental:n,hasNext:a,extensions:i,errors:o}=e;if(!n)return{data:r||{},...B("errors",o),...B("extensions",i),hasNext:a};const s=n.map(({data:l,path:d,errors:u})=>({data:l&&d?uo(d,l):{},...B("errors",u)}));return{data:s.length===1?s[0].data:po([...s.map(({data:l})=>l)]),...B("errors",lo(s)),hasNext:a}})}function ru(t,e){if(t.length>0)throw new Error(ro,{cause:{graphQLErrors:t}});if(Object.keys(e).length===0)throw new Error(no)}function au(t,e){const r=(e??"").match(Wd),n=`--${r?r[1]:"-"}`;if(!t.body?.getReader&&!t.body?.[Symbol.asyncIterator])throw new Error("API multipart response did not return an iterable body",{cause:t});const a=Jd(t);let i={},o;return{async*[Symbol.asyncIterator](){try{let s=!0;for await(const l of Zd(a,n)){const d=eu(l);o=d.find(h=>h.extensions)?.extensions??o;const u=lo(d);i=po([i,...d.map(({data:h})=>h)]),s=d.slice(-1)[0].hasNext,ru(u,i),yield{...B("data",i),...B("extensions",o),hasNext:s}}if(s)throw new Error("Response stream terminated unexpectedly")}catch(s){const l=so(s);yield{...B("data",i),...B("extensions",o),errors:{message:rt(Ct(s)),networkStatusCode:t.status,...B("graphQLErrors",l?.graphQLErrors),response:t},hasNext:!1}}}}}function nu(t){return async(...e)=>{if(!io.test(e[0]))throw new Error(rt("This operation does not result in a streamable response - use request() instead."));try{const r=await t(...e),{statusText:n}=r;if(!r.ok)throw new Error(n,{cause:r});const a=r.headers.get("content-type")||"";switch(!0){case a.includes(ur.json):return tu(r);case a.includes(ur.multipart):return au(r,a);default:throw new Error(`${ao} ${a}`,{cause:r})}}catch(r){return{async*[Symbol.asyncIterator](){const n=so(r);yield{errors:{message:rt(Ct(r)),...B("networkStatusCode",n?.status),...B("response",n)},hasNext:!1}}}}}}var ou="mutation cartCreate($input:CartInput!$country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){result:cartCreate(input:$input){cart{...CartParts}errors:userErrors{...on CartUserError{message field code}}warnings:warnings{...on CartWarning{code}}}}",iu="mutation cartUpdateDeliveryAddressAndContact($cartId:ID!$addressInput
43:[CartSelectableAddressInput!]!$buyerIdentityInput:CartBuyerIdentityInput!$country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){buyerIdentityUpdateResult:cartBuyerIdentityUpdate(cartId:$cartId buyerIdentity:$buyerIdentityInput){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}addressUpdateResult:cartDeliveryAddressesReplace(addresses:$addressInput cartId:$cartId){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...PreparedCartFragment}",su="mutation cartAttributesUpdate($cartId:ID!$attributes:[AttributeInput!]!$country:CountryCode=CA$language:LanguageCode=EN)@inContext(country:$country language:$language){result:cartAttributesUpdate(cartId:$cartId attributes:$attributes){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...PreparedCartFragment}",lu="mutation cartBillingAddressUpdate($cartId:ID!$billingAddress:MailingAddressInput$country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){result:cartBillingAddressUpdate(cartId:$cartId billingAddress:$billingAddress){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...PreparedCartFragment}",cu="mutation cartSelectedDeliveryOptionsUpdate($cartId:ID!$selectedDeliveryOptions:[CartSelectedDeliveryOptionInput!]!$country:CountryCode=CA$language:LanguageCode=EN)@inContext(country:$country language:$language){result:cartSelectedDeliveryOptionsUpdate(cartId:$cartId selectedDeliveryOptions:$selectedDeliveryOptions){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...PreparedCartFragment}
43",du="mutation applePaySessionCreate($validationUrl:URL!){applePaySessionCreate(validationUrl:$validationUrl){...@defer{applePaySession{body}}}}",uu="mutation PayPalBuyerDetailsFetch($token:String!$cartId:ID$authAssertionContext:String){paypalBuyerDetailsFetch(token:$token cartId:$cartId authAssertionContext:$authAssertionContext){...@defer{paypalDetails{email expiresAt remoteOrderId destinationAddress{...on MailingAddress{address1 address2 city company country firstName lastName phone province zip}}billingAddress{...on MailingAddress{address1 address2 city company country firstName lastName phone province zip}}payerApprovedAmount{currencyCode amount}}}}}",hu="mutation PayPalTokenCreate($cartId:ID!$billingAgreement:Boolean!){paypalTokenCreate(cartId:$cartId billingAgreement:$billingAgreement){...@defer{paypalToken{authAssertionContext token}}}}",pu="mutation PayPalVaultWithPurchaseOrderTokenCreate($cartId:ID!$billingAgreement:Boolean!){paypalTokenCreate(cartId:$cartId billingAgreement:$billingAgreement isVaultWithPurchaseOrder:true){...@defer{paypalToken{authAssertionContext token}}}}",mu="query cartQuery($id:ID!$country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){cart(id:$id){...CartParts}}",gu="query limitedCartQuery($id:ID!$country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){cart(id:$id){id lines(first:50){edges{node{merchandise{...on ProductVariant{requiresShipping}}sellingPlanAllocation{sellingPlan{id}}}}}}}",fu="query subscriptionPolicyQuery($country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){shop{subscriptionPolicy(sanitized:true){body}}}",yu="mutation cartPaymentUpdate($cartId:ID!$input:CartPaymentInput!$country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){result:cartPaymentUpdate(cartId:$cartId payment:$input){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...PreparedCartFragment}",Je="fragment CartParts on Cart{id checkoutUrl deliveryGroups(first:10){edges{node{id groupType selectedDeliveryOption{code title handle deliveryPromise deliveryMethodType estimatedCost{amount currencyCode}}deliveryOptions{code title handle deliveryPromise deliveryMethodType estimatedCost{amount currencyCode}}}}}cost{subtotalAmount{amount currencyCode}totalAmount{amount currencyCode}totalTaxAmount{amount currencyCode}totalDutyAmount{amount currencyCode}}discountAllocations{discountedAmount{amount currencyCode}...on CartCodeDiscountAllocation{code}...on CartAutomaticDiscountAllocation{title}...on CartCustomDiscountAllocation{title}}discountApplications{targetType targetSelection totalAllocatedAmount{amount currencyCode}...on CartCodeDiscountApplication{code}...on CartAutomaticDiscountApplication{title}...on CartCustomDiscountApplication{title}}discountCodes{code applicable}lines(first:10){edges{node{...on CartLine{parentRelationship{parent{id}}}quantity cost{subtotalAmount{amount currencyCode}totalAmount{amount currencyCode}}discountAllocations{discountedAmount{amount currencyCode}...on CartCodeDiscountAllocation{code}...on CartAutomaticDiscountAllocation{title}...on CartCustomDiscountAllocation{title}}merchandise{...on ProductVariant{requiresShipping title product{title}}}sellingPlanAllocation{remainingBalanceChargeAmount{amount}priceAdjustments{price{amount currencyCode}}sellingPlan{billingPolicy{...on SellingPlanRecurringBillingPolicy{interval intervalCount}}priceAdjustments{orderCount}recurringDeliveries}}}}}}",_a="fragment CartErrorParts on CartUserError{message field code}",bu="fragment PreparedCartFragment on Mutation{preparedCart:cartPrepareForCompletion(cartId:$cartId){result{__typename ...on CartStatusReady{cart{...CartParts}}...on CartStatusNotReady{cart{...CartParts}errors{code message}}...on CartThrottled{cart{...CartParts}pollAfter}}errors:userErrors{...CartErrorParts}}}",wu="mutation cartSubmitForCompletion($cartId:ID!$attemptToken:String!$country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){cartSubmitForCompletion(cartId:$cartId attemptToken:$attemptToken){result{__typename ...on SubmitSuccess{redirectUrl}...on SubmitThrottled{pollAfterV2:pollAfter}...on SubmitFailed{errors{code message}checkoutUrl}}errors:userErrors{...on CartUserError{code field message}}}}",_u="mutation cartRemovePersonalData($cartId:ID!){cartRemovePersonalData(cartId:$cartId){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}";async function Eu(t,e){if(!e.errors)return;const r=Nu(e.errors,t),n=await Ru(e.errors.response),a=e.errors.response?.headers?.get("content-type")||void 0,i=[];if(e.errors.graphQLErrors)for(const o of e.errors.graphQLErrors)o.code&&i.push(o.code);return{operationName:t,statusCode:e.errors.networkStatusCode,contentType:a,message:r,responseBody:n,errorCodes:i,problemExplanations:Au(e.errors.graphQLErrors??[])}}function Ze(t){return typeof t=="object"&&t!==null}function Au(t){const e=[];for(const r of t){if(!Ze(r))continue;const{extensions:n}=r;if(!Ze(n))continue;const{problems:a}=n;if(Array.isArray(a))for(const i of a){if(!Ze(i))continue;const{explanation:o}=i;
43typeof o=="string"&&e.push(o)}}return e}var Cu=[/API multipart response did not return an iterable body/,/Error in parsing multipart response/,/GraphQL Client: Response returned unexpected Content-Type:/,/GraphQL Client: (?:null|undefined) is not an object/i,/GraphQL Client: [A-Za-z_$][\w$]* is not defined/i,/GraphQL Client: Can't find variable: [A-Za-z_$][\w$]*/i,/GraphQL Client: HTTP error! status: \d{3}/,/Internal error/,/Throttled/,/Request blocked/,/Network request failed/,/Load failed/,/The string did not match the expected pattern/,/Failed to fetch/,/when attempting to fetch resource/,/GraphQL Client: İptal edildi$/],vu=[/signal is aborted/i,/fetch is aborted/i,/operation was aborted/i,/\[Apple Pay\] Payment sheet cancelled/],Su=[/timed?.out/i,/error occured while processing stream payload/i,/response stream terminated/i],Pu=/provided invalid value/,Iu=/Integer out of bounds/,ku=["quantity","sellingPlanId","attributes"];function Tu(t){return Pu.test(t)?ku.find(e=>t.includes(e))??null:null}function Du(t,{hasBeenVisible:e=!1}={}){if(t.statusCode&&t.statusCode!==200)return{isIgnorable:!0,reason:`statusCode-${t.statusCode}`};if(t.message){if(Su.some(n=>n.test(t.message)))return{isIgnorable:!0,reason:"timeout"};if(vu.some(n=>n.test(t.message)))return{isIgnorable:!0,reason:"abort"};if(Cu.some(n=>n.test(t.message)))return{isIgnorable:!0,reason:"message"};const r=Tu(t.message);if(r)return{isIgnorable:!0,reason:`graphql-input-validation-${r}`}}return t.problemExplanations.some(r=>Iu.test(r))?{isIgnorable:!0,reason:"graphql-input-validation-integer-out-of-bounds"}:e?{isIgnorable:!1,reason:void 0}:{isIgnorable:!0,reason:"component-not-visible"}}async function Ru(t){if(!t||t.bodyUsed)return"";try{return(await t.text()).slice(0,1024)}catch(e){return console.error("Failed to read response body:",e),""}}function Nu(t,e){if(!t)return"";const r=t.graphQLErrors?.map(a=>a.message).join(", ")??"",n=`${t.message}${r.length>0?` - ${r}`:""}`;return`GraphQL response error for ${e}: ${t.networkStatusCode?`with status ${t.networkStatusCode} => ${n}`:`=> ${n}`}`}var hr="UNKNOWN";function Ou({url:t,accessToken:e}){return{headers:{"Content-Type":"application/json",Accept:"application/json","X-Shopify-Storefront-Access-Token":e,"X-SDK-Variant":"portable-wallets"},url:t,retries:0,customFetchApi:(r,n)=>(g.leaveBreadcrumb(`Request ${n?.method||hr}: ${r}`,{url:r,method:n?.method},"request"),fetch(r,n)),logger:r=>{try{switch(r.type){case"HTTP-Response":{const[n,a]=r.content.requestParams,{status:i,statusText:o,headers:s,type:l}=r.content.response;g.leaveBreadcrumb(`Response ${a?.method||hr}: ${n}`,{statusCode:i,statusText:o,requestId:Lu(s),responseHeaders:xu(s),responseType:l,url:n,method:a?.method,headers:a?.headers},"log");break}case"HTTP-Retry":{const{retryAttempt:n,maxRetries:a,lastResponse:i,requestParams:[o,s]=[]}=r.content;g.leaveBreadcrumb(`GraphQL Retry Attempt ${n}/${a}: ${o}`,{retryAttempt:n,maxRetries:a,url:o,method:s?.method,lastResponseStatus:i?.status},"log");break}case"HTTP-Response-GraphQL-Deprecation-Notice":{const{deprecationNotice:n,requestParams:a}=r.content,[i,o]=a||[];g.leaveBreadcrumb(`GraphQL Deprecation Notice: ${i}`,{deprecationNotice:n,url:i,method:o?.method},"log");break}default:{const n=r;g.leaveBreadcrumb(`GraphQL Logger: ${n.type}`,{type:n.type,content:n.content},"log")}}}catch{}}}}function Lu(t){return t.get("x-request-id")||hr}function xu(t){if("fromEntries"in Object)return Object.fromEntries(t);const e={};for(const[r,n]of t.entries())e[r]=n;return e}function go(t){return t.trim().toUpperCase()}function fo(t){return t?.trim()?go(t):void 0}function Mu({streetAddress:t,validateAddress:e}){return[{selected:!0,oneTimeUse:!0,validationStrategy:e?"STRICT":"COUNTRY_CODE_ONLY",address:{deliveryAddress:zu(t)}}]}function zu(t){return{address1:t.address1,address2:t.address2,city:t.city,firstName:t.firstName,lastName:t.lastName,phone:t.phone,zip:t.zip,company:t.company,countryCode:fo(t.country),provinceCode:t.province}}var Fu="unstable",Ge=class{OPERATION_NAME_REGEX=/[^ ]+ (\w+)/;LANGUAGES_WITH_REGION=["zh-CN","zh-TW","pt-BR","pt-PT"];client;country;url;locale;lastValidCart=null;hasBeenVisible=!1;checkoutState="building";constructor({accessToken:t,country:e,locale:r,apiVersion:n=Fu}){if(!t||!e)throw new q({code:"invalid-webcomponent",message:"accelerated checkout rendered without required webcomponent attributes"});if(!r)throw new Error("StorefrontApiClient constructed with no locale");this.country=go(e),this.locale=r,this.url=`/api/${n}/graphql.json`,this.client=Yd(Ou({url:this.url,accessToken:t}))}async createCart(t,e,r){const n=await this.request([ou,Je],{input:{lines:t.lines.map(i=>({merchandiseId:i.merchandiseId,quantity:i.quantity,sellingPlanId:i.sellingPlanId,attributes:this.stringifyAttributes(i.lineItemProperties),parent:i.parent})),discountCodes:t.discountCodes,buyerIdentity:t.buyerIdentity},country:this.country,language:this.formatLanguage(this.locale)},{instrumentName:t.instrumentName,startingCheckout:!0,operationName:"
43createCart"});n.errors&&await this.onError({operationName:"createCart",response:n});const a=n.data?.result;if(a){a.errors.length>0&&this.onResultError(a.errors);const i=this.parseMutationWarnings(n.data?.result?.warnings);i.length>0&&this.onResultWarnings(i);const o=a.cart?this.parseCartResponse(a.cart):null;return o&&(this.lastValidCart=o),{data:o,errors:this.parseMutationErrors({result:n,key:"result",operationName:"cartCreate"}),decelerationReason:se({cart:o,warnings:i,supportsSubscriptions:e,supportsDeferredPurchaseOptions:r}),abortReason:Qe({cart:o,warnings:i})}}throw new tt("Cart create operation returned no response")}async updateCartBillingAddress(t,e){const{cartId:r,billingAddress:n,instrumentName:a}=t;return this.requestUpdatedCart(lu,{cartId:r,billingAddress:n},{instrumentName:a,operationName:"updateCartBillingAddress",abortSignal:e})}async updateCartBuyerIdentity(t,e){const{cartId:r,instrumentName:n,validateAddress:a=!1,streetAddress:i}=t;this.checkoutState=a?"authorized":"building";const{deliveryAddressPreferences:o,...s}=Uu(t);return await this.requestUpdatedCart(iu,{cartId:r,buyerIdentityInput:s,addressInput:i?Mu({streetAddress:i,validateAddress:a}):[]},{instrumentName:n,operationName:"cartUpdateDeliveryAddressAndContact",abortSignal:e})}async updateSelectedDeliveryOptions(t,e,r,n){return await this.requestUpdatedCart(cu,{cartId:t,selectedDeliveryOptions:e},{instrumentName:r,operationName:"updateSelectedDeliveryOptions",abortSignal:n})}async applePaySessionCreate(t){const e=await this.requestStream([du],{validationUrl:t.toString()},{instrumentName:m.ApplePay,operationName:"applePaySessionCreate"});for await(const r of e){r.errors&&await this.onError({operationName:"applePaySessionCreate",response:r});const n=r.data?.applePaySessionCreate?.applePaySession?.body;if(n)return n}throw new tt("Apple Pay session create operation returned no response")}async paypalBuyerDetailsFetch(t,e,r){const n=await this.requestStream([uu],{token:t,cartId:e,authAssertionContext:r},{instrumentName:m.PayPal,operationName:"paypalBuyerDetailsFetch"});for await(const a of n){if(a.hasNext)continue;if(a.errors){if(a.errors.graphQLErrors){const o=fa(a.errors.graphQLErrors);if(o?.code)throw new W(o.code)}
43await this.onError({operationName:"paypalBuyerDetailsFetch",response:a})}const i=a.data?.paypalBuyerDetailsFetch?.paypalDetails;if(i)return i}throw new tt("PayPal buyer details fetch operation returned no response")}async paypalTokenCreate({cartId:t,billingAgreement:e,isVaultWithPurchaseOrder:r=!1}){const n=r?pu:hu,a=await this.requestStream([n],{cartId:t,billingAgreement:e},{instrumentName:m.PayPal,operationName:"paypalTokenCreate"});for await(const i of a){if(i.errors){if(i.errors.graphQLErrors){const s=fa(i.errors.graphQLErrors);if(s?.code)throw s.isLoggable&&(c.log({body:`PayPal Token Create ${s.code} Error`}),c.paypalTokenCreationError({errorCode:s.code})),new W(s.code)}await this.onError({operationName:"paypalTokenCreate",response:i})}const o=i.data?.paypalTokenCreate?.paypalToken;if(o?.token)return{token:o.token,...o.authAssertionContext&&{authAssertionContext:o.authAssertionContext}}}throw new tt("PayPal token create operation returned no response")}async fetchLimitedCart({id:t,startingCheckout:e,instrumentName:r}){const n=await this.request([gu],{id:t},{instrumentName:r,startingCheckout:e});if(n.errors&&await this.onError({operationName:"limitedCartQuery",response:n}),!n.data?.cart)throw new rn("Limited cart query returned no response");return g.leaveBreadcrumb("limitedCartQuery response",{operationName:"limitedCartQuery",body:n.data?.cart},"log"),{id:n.data.cart.id,shippingRequired:n.data.cart.lines.edges.some(a=>a.node.merchandise.requiresShipping),sellingPlan:n.data.cart.lines.edges.some(a=>a.node.sellingPlanAllocation!=null)}}async fetchCart({id:t,startingCheckout:e,instrumentName:r}){const n=this.formatLanguage(this.locale),a=await this.request([mu,Je],{id:t,country:this.country,language:n},{instrumentName:r,startingCheckout:e,operationName:"fetchCart"});if(a.errors&&await this.onError({operationName:"fetchCart",response:a}),!a.data)throw new tt("Fetch cart operation returned no data in response");const i=a.data.cart;if(g.leaveBreadcrumb("Fetch cart response",{body:i},"log"),i){const o=this.parseCartResponse(i);return this.lastValidCart=o,o}throw new tt("Fetch cart operation returned no response")}async updateCartPayment(t,e,r,n){return this.checkoutState="authorized",this.requestUpdatedCart(yu,{cartId:t,input:e},{instrumentName:r,operationName:"updateCartPayment",abortSignal:n})}async updateCartAttributes({cartId:t,attributes:e,instrumentName:r,startingCheckout:n}){const a={cartId:t,attributes:e};return await this.requestUpdatedCart(su,a,{instrumentName:r,operationName:"updateCartAttributes",startingCheckout:n})}async submitForCompletion(t,e,r){const n=this.formatLanguage(this.locale),a=await this.request([wu],{cartId:t,attemptToken:e,country:this.country,language:n},{instrumentName:r,operationName:"submitForCompletion"});return a.errors&&await this.handleGraphQLErrorResponse("submitForCompletion",a),{data:a.data?.cartSubmitForCompletion?.result,errors:this.parseCompletionErrors(a)}}async fetchSubscriptionPolicy(){const{data:t}=await this.request([fu],{country:this.country,language:this.formatLanguage(this.locale)},{operationName:"fetchSubscriptionPolicy"});return t?.shop?.subscriptionPolicy?.body}async cartRemovePersonalData({cartId:t,instrumentName:e}){let r,n,a;try{const o=await this.request([_u,_a],{cartId:t},{instrumentName:e,keepalive:!0});r=this.parseMutationWarnings(o.data?.cartRemovePersonalData?.warnings),n=this.parseMutationErrors({result:o,key:"cartRemovePersonalData",operationName:"cartRemovePersonalData"})}catch(o){a=String(o)}const i=!(r?.length||n?.length||a);c.removePersonalDataResult({success:i}),i||c.log({body:"cartRemovePersonalData failed",attributes:{cartId:t,warnings:r,errors:n,exception:a}})}setVisible(){this.hasBeenVisible=!0}generateURLWithOperationName(t){const e=t.match(this.OPERATION_NAME_REGEX);if(e){const r=this.url.includes("?")?"&":"?",n=`operation_name=${e[1]}`;return`${this.url}${r}${n}`}return this.url}async request(t,e,r){return this.client.request(t.join(""),{variables:e,headers:Ea(r),url:this.generateURLWithOperationName(t[0]),keepalive:r.keepalive})}async requestStream(t,e,r){return this.client.requestStream(t.join(""),{variables:e,headers:Ea(r),url:this.generateURLWithOperationName(t[0]),signal:r.abortSignal})}async requestUpdatedCart(t,e,r){const n=this.formatLanguage(this.locale),a=await this.request([t,Je,_a,bu],{...e,country:this.country,language:n},r);a.errors&&await this.onError({operationName:r.operationName,response:a,abortSignal:r.abortSignal});const i=this.extractMutationErrors(a,r),o=this.parsePreparedCartMutationErrors(a.errors,i,r.operationName),s=this.extractMutationWarnings(a),l=a.data?.preparedCart?.result,d=a.data?.result?.cart??l?.cart;if(d){const p=this.parseCartResponse(d);return this.lastValidCart=p,{data:p,errors:o,abortReason:Qe({cart:p,warnings:s}),decelerationReason:se({warnings:s,cart:p,cartStatus:l?.__typename,errors:o})}}const u=i.length>0,h=s.length>0;if(this.lastValidCart&&(u||h))return u&&this.onResultError(i),h&&this.onResultWarnings(s),{data:this.lastValidCart,errors:o,abortReason:Qe({warnings:s}),decelerationReason:se({warnings:s,errors:o})};if(c.log({body:"Cart update response missing body",attributes:{operationName:r.operationName,hasData:!!a.data,hasResultCart:!!a.data?.result?.cart,hasPreparedCart:!!a.data?.preparedCart,responseErrors:a.errors?.graphQLErrors?.map(p=>p.message)??[],preparedCartResultTypename:l?.__typename??"null",hasLastValidCart:!!this.lastValidCart,aggregatedErrorCount:i.length}}),this.lastValidCart&&a.data?.preparedCart&&l==null)return c.log({body:"Cart prepare returned null result, falling back to last valid cart",attributes:{operationName:r.operationName}}),{data:this.lastValidCart,errors:o,decelerationReason:se({warnings:s,cart:this.lastValidCart})};throw new tt("Cart update operation returned no response")}async handleGraphQLErrorResponse(t,e){const r=await Eu(t,e);if(!r)return;const{message:n,...a}=r,{isIgnorable:i,reason:o}=Du(r,{hasBeenVisible:this.hasBeenVisible});if(g.leaveBreadcrumb(n,{ignored:i,ignoredReason:o,hasData:!!e.data,...a},"error"),i)throw c.log({body:"Ignored GraphQL response error",attributes:{message:n,reason:o,...a}}),new Dt(n,{reason:o,errorDetails:a});return{message:n,errorDetails:a}}async onError({operationName:t,response:e,abortSignal:r}){if(r?.aborted)throw c.log({body:"Request aborted",attributes:{operationName:t,reason:r.reason}}),new Dt("Request aborted",{reason:"abort",errorDetails:{operationName:t}});const n=await this.handleGraphQLErrorResponse(t,e);if(!n)return;const{message:a,errorDetails:i}=n;throw new Ne(a,{errorDetails:i}
43)}onResultError(t){g.leaveBreadcrumb("GraphQL result error",t,"error")}onResultWarnings(t){g.leaveBreadcrumb("GraphQL result warnings",t,"error")}formatLanguage(t){return t.includes("-")?this.LANGUAGES_WITH_REGION.includes(t)?t.toUpperCase().replace("-","_"):t.split("-")[0].toUpperCase():t.toUpperCase()}parseCartResponse(t){const e=t.lines.edges.map(n=>{const a=n.node,i="parentRelationship"in a&&a.parentRelationship?.parent?.id!==void 0;return{quantity:a.quantity,totalAmount:{amount:a.cost.totalAmount.amount,currencyCode:a.cost.totalAmount.currencyCode},subtotalAmount:{amount:a.cost.subtotalAmount?.amount,currencyCode:a.cost.subtotalAmount?.currencyCode},merchandise:{requiresShipping:a.merchandise.requiresShipping,title:a.merchandise.title,product:{title:a.merchandise.product.title}},discountAllocations:a.discountAllocations,sellingPlanAllocation:a.sellingPlanAllocation,isNestedLine:i}}),r=t.deliveryGroups.edges.map(n=>n.node);return{id:t.id,totalAmount:t.cost.totalAmount,subtotalAmount:t.cost.subtotalAmount??void 0,totalTaxAmount:t.cost.totalTaxAmount??void 0,totalDutyAmount:t.cost.totalDutyAmount??void 0,discountAllocations:t.discountAllocations,discountApplications:t.discountApplications,discountCodes:t.discountCodes,lineItems:e,deliveryGroups:r,checkoutUrl:t.checkoutUrl}}parseGraphQlErrors(t){return t?.graphQLErrors?.map(e=>({code:e.message.replace(/\(Expected.*\)/,"").trim()}))??[]}parseErrorIntoCartError({message:t,code:e,field:r}){let n;if(r&&r.length===1)n=r.at(0);else if(r&&r.length>1){const a=r[r.length-1];n=["billingAddress","deliveryAddress"].includes(a)?a:r.slice(-2).filter(i=>!i.match(/^\d+$/)).join(".")}return{code:e===null?void 0:e,field:n,message:t}}parseMutationErrors({result:t,key:e,operationName:r}){const n=this.parseGraphQlErrors(t.errors),a=t.data?.[e]?.errors?.map(this.parseErrorIntoCartError).filter(o=>o)||[],i=[...n,...a];return i.length>0&&g.leaveBreadcrumb(`GraphQL errors on mutation '${r}'`,i,"error"),i}parseMutationWarnings(t){return!t||t.length===0?[]:t.map(e=>e.code)}stringifyAttributes(t){return t&&t.map(e=>({key:e.key,value:typeof e.value=="string"?e.value:JSON.stringify(e.value)}))}extractUpdateMutationErrors(t){const e=Object.values(t).flatMap(a=>a?.errors??[]);if(this.checkoutState!=="building")return e;const r=[],n=e.filter(a=>Nc.some(i=>i.code===a.code)?(r.push(a.code),!1):!0);return r.length>0&&g.leaveBreadcrumb("Filtered errors on update mutation",r,"log"),n}extractPreparedCartMutationErrors(t,e){const r=t?.errors??[];if(t?.result?.__typename==="CartStatusNotReady"){const n=[];r.push(...t.result.errors.filter(a=>Lc[this.checkoutState].some(i=>i.code===a.code)?(n.push(a.code),!1):!0)),n.includes("DELIVERY_WRONG_NUMBER_OF_LINES")&&c.deliveryWrongNumberOfLines({instrument:e}),n.length>0&&g.leaveBreadcrumb("Filtered errors on mutation prepareCart",n,"log")}return r}extractMutationErrors(t,{instrumentName:e,operationName:r}){if(!t.data)return[];const{preparedCart:n,__typename:a,...i}=t.data,o=this.extractUpdateMutationErrors(i),s=this.extractPreparedCartMutationErrors(t.data?.preparedCart,e);return s.length>0&&r==="updateCartAttributes"?(c.log({body:"Update cart attributes errors from prepareCart mutation",attributes:{instrumentName:e,errors:JSON.stringify(s)}}),o):[...o,...s]}extractMutationWarnings(t){if(!t.data)return[];const{preparedCart:e,__typename:r,...n}=t.data;return Object.values(n).map(a=>this.parseMutationWarnings(a?.warnings??[])).flat()}parsePreparedCartMutationErrors(t,e,r){const n=this.parseGraphQlErrors(t),a=e.map(this.parseErrorIntoCartError).filter(o=>o),i=[...n,...a];return i.length>0&&g.leaveBreadcrumb(`GraphQL errors on mutation '${r}'`,i,"error"),i}parseCompletionErrors(t){const e=this.parseGraphQlErrors(t.errors);let r=[];t.data?.cartSubmitForCompletion?.result?.__typename==="SubmitFailed"&&(r=t.data.cartSubmitForCompletion.result.errors.map(a=>({code:a.code}))??[]);const n=[...e,...r];return n.length>0?g.leaveBreadcrumb("GraphQL errors on completion",n,"error"):t.errors&&g.leaveBreadcrumb("Errors on submitForCompletion",{errors:t.errors,hasData:!!t.data,hasResult:!!t.data?.cartSubmitForCompletion?.result},"error"),n}};function Uu({emailAddress:t,countryCode:e,phone:r,streetAddress:n,validateAddress:a,preferences:i}){return{email:t,countryCode:fo(e??n?.country),phone:r??n?.phone,deliveryAddressPreferences:n?[{deliveryAddressValidationStrategy:a?"STRICT":"COUNTRY_CODE_ONLY",deliveryAddress:n}]:[],preferences:i}}function Ea({instrumentName:t,startingCheckout:e}){const r={};return t&&(r["X-Wallet-Name"]=`${t}`),e&&(r["X-Start-Wallet-Checkout"]=`${e}`),r}async function yo({cartId:t,cartClient:e,instrumentName:r,selectedDeliveryOptions:n,abortSignal:a}){try{if(!t)throw new Error(`[${r}] provided no cart ID when updating shipping method`);
43if(!e)throw new Error(`[${r}] provided invalid cart client when updating shipping method`);return await e.updateSelectedDeliveryOptions(t,n,r,a)}catch(i){throw c.updateFailed({instrument:r,request:"updateSelectedDeliveryOptions",error:i}),i}}async function bo({cartId:t,token:e,cartClient:r,instrumentName:n}){try{if(!t)throw new Error(`[${n}] provided no cart ID when submitting for completion`);if(!r)throw new Error(`[${n}] provided invalid cart client when submitting for completion`);if(!e)throw new Error(`[${n}] provided no token when submitting for completion`);return await r.submitForCompletion(t,e,n)}catch(a){throw c.updateFailed({instrument:n,request:"submitForCompletion",error:a}),a}}function wo({selectedDeliveryOptionHandles:t,deliveryGroups:e,instrumentName:r}){return e.map(n=>{const a=n.deliveryOptions.filter(i=>t.includes(i.handle));if(!a.length)return{deliveryGroupId:"",deliveryOptionHandle:""};if(a.length>1)throw new _o(`[${r}] found multiple delivery options with selectedDeliverOptionHandle in group: ${n.id}`,{groupingHash:"getSelectedDeliveryOptions::MultipleOptions"});return{deliveryGroupId:n.id,deliveryOptionHandle:a[0].handle}}).filter(n=>!!n.deliveryGroupId)}var _o=class extends J{};_o.prototype.name="GetSelectedDeliveryOptionsError";async function Bu(t){const{cartClient:e,instrumentName:r,abortSignal:n}=t;try{if(!t.cartId)throw new Error(`[${r}] provided no cart ID when updating billing address`);if(!e)throw new Error(`[${r}] provided invalid cart client when updating billing address`);return await e.updateCartBillingAddress(t,n)}catch(a){throw c.updateFailed({instrument:r,request:"updateBillingAddress",error:a}),a}}function Qt({result:t,instrument:e}){const r=t.errors??[];Un(r,Or)&&c.dynamicTaxFailed({instrument:e})}var Aa=t=>{if(t?.countryCode?.toUpperCase()!=="US")return!1;const e=(t.iso3166AdministrativeArea||t.administrativeArea||"").toUpperCase();return e==="US-CA"||e==="CA"},Gu=class{#t=null;#e;#r;#n;constructor(){this.#e=new Promise((t,e)=>{this.#r=t,this.#n=e}),this.#e.catch(()=>{})}async fetch(){if(this.#t)return this.#t;try{return await this.#e,this.#t??void 0}catch{return}}getLatest(){return this.#t}update(t){t!==null&&(this.#t=t,this.#r())}reject(){this.#n()}},Ca=["cart_throttled","not_enough_stock","payment_method_not_applicable","account_info_mismatch","price_increased","nested_line_subscription","nested_line_deferred_payment","digital_physical_mismatch"],Hu=class{name=m.ApplePay;accessToken;button;buyerCountry;cartContainer;apiClient;dataSource;i18n;merchantName;session;paymentSheetActionGenerator;cancelled;buyerCurrency;customerAccountEmail;abortController=null;isPersonalDataCleared=!1;
43isSheetLoaded=!1;walletParams;constructor({accessToken:t,buyerCountry:e,buyerCurrency:r,button:n,i18n:a,merchantName:i,dataSource:o,apiClient:s,walletParams:l}){this.accessToken=t,this.buyerCountry=e,this.button=n,this.cartContainer=new Gu,this.apiClient=s,this.dataSource=o,this.i18n=a,this.merchantName=i,this.cancelled=!1,this.buyerCurrency=r,this.customerAccountEmail=l.customerAccountEmail,this.walletParams=l;try{this.session=new ApplePaySession(6,xd({shippingRequired:this.isShippingRequired,walletParams:l,buyerCurrency:r}))}catch(d){throw new to(String(d),{cause:d})}this.session.onvalidatemerchant=this.onvalidatemerchant,this.session.onshippingcontactselected=this.onshippingcontactselected,this.session.onshippingmethodselected=this.onshippingmethodselected,this.session.onpaymentmethodselected=this.onpaymentmethodselected,this.session.oncancel=this.oncancel,this.session.onpaymentauthorized=this.onpaymentauthorized,this.paymentSheetActionGenerator=new Ld(a)}begin(){g.leaveBreadcrumb("ApplePay Session begin",{shippingRequired:this.isShippingRequired,buyerCurrency:this.buyerCurrency,walletParams:this.walletParams},"log"),this.abortController=wt("AbortController"),this.session.begin()}onvalidatemerchant=async t=>{try{g.leaveBreadcrumb("ApplePay onvalidatemerchant: Starting merchant validation",{validationURL:t.validationURL},"log");const e=new URL(t.validationURL),r=this.getMerchantSession(e);r.catch(()=>{}),g.leaveBreadcrumb("ApplePay onvalidatemerchant: Calling handleCreateCart",{},"log");const n=await dt({element:this.button,instrumentName:this.name,dataSource:this.dataSource,isShippingRequired:this.isShippingRequired});g.leaveBreadcrumb("ApplePay onvalidatemerchant: handleCreateCart result",{hasCart:!!n.cart,cartId:n.cart?.id??"null"},"log");const a=await this.handleCreateCartResult({createCartResult:n,stage:"onValidateMerchant::createCart"});if(a===void 0){this.cartContainer.reject();return}this.cartContainer.update(a),on({cart_token:Ir(a)});const i=await r;if(g.leaveBreadcrumb("ApplePay Session completeMerchantValidation",{session:i},"log"),this.sessionIsTerminated()){c.sheetClicked({instrument:this.name,result:"rejected",reason:"cancelled"});return}this.withActiveSession("completeMerchantValidation",()=>this.session.completeMerchantValidation(i)),c.sheetClicked({instrument:this.name,result:"success"})}catch(e){this.cartContainer.reject(),c.sheetClicked({instrument:m.ApplePay,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in Apple Pay sheet clicked",attributes:{error:String(e),location:"onvalidatemerchant"}}),this.terminateSession({error:e})}};onshippingcontactselected=async t=>{const e=await this.#t();if(e!==void 0)try{const r=le(t.shippingContact,{applyPostalCodePadding:!0}),n=await Tt({cartId:e.id,streetAddress:r,cartClient:this.apiClient,instrumentName:this.name,...this.abortController?.signal?{abortSignal:this.abortController.signal}:{}});if(await this.decelerateOrAbort({result:n,stage:"onShippingContactSelected::updateBuyerIdentity"}))return;await this.applyPaymentSheetActions({result:n,onProceed:a=>this.completeShippingContactSelection({fallbackCart:e,updatedCart:n.data,errors:a}),context:{shippingRequired:this.isShippingRequired,shippingCountryCode:r.country,shippingZip:r.zip??void 0,shippingProvince:r.province??void 0,shippingCity:r.city??void 0},checkoutUrl:e.checkoutUrl,requestType:"onShippingContactSelected::updateBuyerIdentity",afterAuthorization:!1})}catch(r){this.terminateSession({error:r})}};onshippingmethodselected=async t=>{const e=await this.#t();if(e!==void 0){g.leaveBreadcrumb("ApplePay onshippingmethodselected: START",{cartId:e.id,shippingMethodId:t.shippingMethod.identifier},"log");try{const r=t.shippingMethod.identifier.split(","),n=wo({selectedDeliveryOptionHandles:r,deliveryGroups:e.deliveryGroups,instrumentName:this.name});if(n.length===0){this.handleShippingMethodNotFoundInCart(r,e);return}const a=await yo({cartId:e.id,cartClient:this.apiClient,instrumentName:this.name,selectedDeliveryOptions:n,abortSignal:this.abortController?.signal});if(await this.decelerateOrAbort({result:a,stage:"onShippingMethodSelected::updateSelectedDeliveryOptions"}))return;await this.applyPaymentSheetActions({result:a,onProceed:()=>this.completeShippingMethodSelection(a.data),context:{shippingRequired:this.isShippingRequired,shippingCountryCode:void 0},checkoutUrl:e.checkoutUrl,requestType:"onShippingMethodSelected::updateSelectedDeliveryOptions",afterAuthorization:!1}),this.onSheetLoaded()}catch(r){this.terminateSession({error:r})}}};onpaymentmethodselected=async t=>{let e=await this.#t();if(e!==void 0){g.leaveBreadcrumb("ApplePay onpaymentmethodselected: START",{cartId:e.id},"log");try{const{billingContact:r}=t.paymentMethod;if(!this.isShippingRequired&&r){const o=le(r,{applyPostalCodePadding:!1}),s=await Tt({cartId:e.id,countryCode:o.country,cartClient:this.apiClient,instrumentName:this.name,abortSignal:this.abortController?.signal});if(await this.decelerateOrAbort({result:s,stage:"onPaymentMethodSelected::updateBuyerIdentity"}))return;await this.applyPaymentSheetActions({result:s,onProceed:()=>{this.cartContainer.update(s.data)},context:{shippingRequired:this.isShippingRequired,shippingCountryCode:o.country,shippingZip:o.zip??void 0,shippingProvince:o.province??void 0,shippingCity:o.city??void 0},checkoutUrl:e.checkoutUrl,requestType:"onPaymentMethodSelected::updateBuyerIdentity",afterAuthorization:!1});const l=await this.#t();if(l===void 0)return;e=l;const d=await Bu({billingAddress:o,cartId:e.id,cartClient:this.apiClient,instrumentName:this.name,abortSignal:this.abortController?.signal});if(await this.decelerateOrAbort({result:d,stage:"onPaymentMethodSelected::updateBillingAddress"}))return;await this.applyPaymentSheetActions({result:d,onProceed:()=>{this.cartContainer.update(d.data)},context:{shippingRequired:this.isShippingRequired,shippingCountryCode:o.country,billingCountryCode:o.country,billingZip:o.zip??void 0,billingProvince:o.province??void 0,billingCity:o.city??void 0},checkoutUrl:e.checkoutUrl,requestType:"onPaymentMethodSelected::updateBillingAddress",afterAuthorization:!1})}const n=await this.#t();if(n===void 0)return;e=n;const{newTotal:a,newLineItems:i}=this.getNewTotalAndLineItems(e);if(g.leaveBreadcrumb("ApplePay Session completePaymentMethodSelection",{newTotal:a,newLineItems:i},"log"),this.sessionIsTerminated())return;this.withActiveSession("completePaymentMethodSelection",()=>this.session.completePaymentMethodSelection({newTotal:a,newLineItems:i})),this.isShippingRequired||this.onSheetLoaded()}catch(r){this.terminateSession({error:r})}}};oncancel=()=>{this.cancelled=!0,this.cartContainer.reject(),this.removePersonalData(),j(L.SheetLoad,this.name),c.sheetCancelled(this.name),this.button.disabled=!1,this.abortController?.abort("[Apple Pay] Payment sheet cancelled")};onpaymentauthorized=async t=>{const e=await this.#t();if(e===void 0)return;g.leaveBreadcrumb("ApplePay onpaymentauthorized: START",{cartId:e.id,hasToken:!!t.payment.token},"log"),c.authorizationAttempt(this.name),zt(L.AuthorizationLatency,this.name);const r=async w=>{switch(w.effects?.forEach(P=>P()),w.action){case"complete":{const P=ApplePaySession.STATUS_SUCCESS;try{await this.completePayment(P),et(w.redirectUrl)}catch(k){this.terminateSession({error:k,afterAuthorization:!0})}break}case"show_error":{const P=w.errors??[];try{await this.completePayment(ApplePaySession.STATUS_FAILURE,P)}catch(k){this.terminateSession({error:k,afterAuthorization:!0})}break}case"abort":this.terminateSession({afterAuthorization:!0});break;case"decelerate":try{await this.completePayment(ApplePaySession.STATUS_FAILURE),Kt({event:z.RecoveryFlowInitiated,checkoutToken:Jt(e.id),instrumentId:this.name}),N({checkoutUrl:w.redirectUrl,instrumentName:this.name,reason:w.reason,stage:"onPaymentAuthorized::submitForCompletion"})}catch(P){this.terminateSession({error:P,afterAuthorization:!0})}break;default:this.terminateSession({error:new Error(`[${this.name}] completion action not handled: ${w.action}`),afterAuthorization:!0})}},{token:n,billingContact:a,shippingContact:i}=t.payment;let o=null,s=null;try{if(!a){await this.completePayment(ApplePaySession.STATUS_FAILURE);return}if(o=le({...a,phoneNumber:i?.phoneNumber},{applyPostalCodePadding:!1}),this.isShippingRequired){if(!i){await this.completePayment(ApplePaySession.STATUS_FAILURE);return}s=le(i,{applyPostalCodePadding:!0})}}catch(w){this.terminateSession({error:w,afterAuthorization:!0});return}const l=s?.zip??void 0,d=s?.province??void 0,u=s?.city??void 0,h=o?.zip??void 0,p=o?.province??void 0,y=o?.city??void 0,_=async()=>{let w=await this.#t();if(w!==void 0)try{const P=this.isShippingRequired?{validateAddress:!0,streetAddress:s}:{},k=this.customerAccountEmail??i?.emailAddress,O=await Tt({cartId:w.id,emailAddress:k,cartClient:this.apiClient,instrumentName:this.name,...P});Qt({result:O,instrument:this.name});const x=Gn({currentCart:O.data,previousCart:w});if(O.data&&x!=="inc"&&(this.cartContainer.update(O.data),w=O.data),x==="inc"&&(O.decelerationReason||="price_increased"),await this.decelerateOrAbort({result:O,stage:"onPaymentAuthorized::updateBuyerIdentity"}))return;const U=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction({result:O,context:{shippingRequired:this.isShippingRequired,shippingCountryCode:s?.country,shippingZip:l,shippingProvince:d,shippingCity:u,billingCountryCode:o?.country,billingZip:h,billingProvince:p,billingCity:y},checkoutUrl:w.checkoutUrl,requestType:"onPaymentAuthorized::updateBuyerIdentity"});U.effects?.forEach(M=>M()),await this.handlePaymentSheetAction({paymentSheetAction:U,onProceed:async M=>{M&&M.length>0?await this.completePayment(ApplePaySession.STATUS_FAILURE,M):await v()},afterAuthorization:!0,stage:"onPaymentAuthorized::updateBuyerIdentity"})}catch(P){this.terminateSession({error:P,afterAuthorization:!0})}},v=async()=>{const w=await this.#t();if(w!==void 0)try{const P=w.lineItems.some(x=>!!x.sellingPlanAllocation),k=await Gr({cartId:w.id,totalAmount:w.totalAmount,paymentMethod:{walletPaymentMethod:{applePayWalletContent:{billingAddress:o,data:n.paymentData.data,header:n.paymentData.header,lastDigits:n.paymentMethod.displayName.split(" ")[1],signature:n.paymentData.signature,version:n.paymentData.version}}},canUsePaymentMethodForFreeOrder:!1,billingAddress:o,cartClient:this.apiClient,instrumentName:this.name,hasSellingPlan:P,abortSignal:this.abortController?.signal});if(Qt({result:k,instrument:this.name}),await this.decelerateOrAbort({result:k,stage:"onPaymentAuthorized::updatePayment"}))return;const O=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction({result:k,context:{shippingRequired:this.isShippingRequired,shippingCountryCode:s?.country,shippingZip:l,shippingProvince:d,shippingCity:u,billingCountryCode:o?.country,billingZip:h,billingProvince:p,billingCity:y},checkoutUrl:w.checkoutUrl,requestType:"onPaymentAuthorized::updatePayment"});O.effects?.forEach(x=>x()),await this.handlePaymentSheetAction({paymentSheetAction:O,onProceed:async x=>{x&&x.length>0?await this.completePayment(ApplePaySession.STATUS_FAILURE,x):await T()},afterAuthorization:!0,stage:"onPaymentAuthorized::updatePayment"})}catch(P){this.terminateSession({error:P,afterAuthorization:!0})}},T=async()=>{const w=await this.#t();if(w!==void 0)try{const P=Q.enabled(pl);if(this.button.hasSellingPlan&&(Aa(i)||Aa(a))&&P){await this.completePayment(ApplePaySession.STATUS_SUCCESS),Kt({event:z.RecoveryFlowInitiated,checkoutToken:Jt(w.id),instrumentId:this.name}),N({checkoutUrl:w.checkoutUrl??"",instrumentName:this.name,reason:"subscription_review_required",stage:"onPaymentAuthorized::submitForCompletion",forceLegacySplitShippingMode:!0});return}const k=await bo({cartId:w.id,token:n.transactionIdentifier,cartClient:this.apiClient,instrumentName:this.name});Qt({result:k,instrument:this.name}),k.errors?.some(x=>x.code==="ERROR")&&(g.leaveBreadcrumb("ApplePay Generic ERROR encountered during completion",{errorCodes:k.errors},"error"),c.log({body:"[ApplePay] Generic ERROR code encountered during completion",attributes:{errorCodes:k.errors}}));const O=this.paymentSheetActionGenerator.mapCompletionResultToPaymentSheetAction({result:k,context:{shippingRequired:this.isShippingRequired,shippingCountryCode:s?.country,shippingZip:l,shippingProvince:d,shippingCity:u,billingCountryCode:o?.country,billingZip:h,billingProvince:p,billingCity:y},checkoutUrl:k.data&&"checkoutUrl"in k.data&&k.data.checkoutUrl?k.data.checkoutUrl:w.checkoutUrl});await r(O)}catch(P){this.terminateSession({error:P,afterAuthorization:!0})}};await _()};terminateSession=async({error:t,afterAuthorization:e=!1,decelerationReason:r}={})=>
43{if(this.button.disabled=!1,!(this.cancelled&&!e))try{t&&g.notify(t),e?c.authorizationComplete({instrument:this.name,measurement:j(L.AuthorizationLatency,this.name),result:"failed"}):(j(L.SheetLoad,this.name),c.sheetFailed(this.name,t,r)),g.leaveBreadcrumb("ApplePay Session abort",{afterAuthorization:e},"log");try{this.withActiveSession("abort",()=>this.session.abort()),this.abortController?.abort("[Apple Pay] Payment sheet terminated")}catch{}if(t){const n=this.i18n.translate("brand.apple_pay");X(n,this.i18n)}}finally{await this.removePersonalData()}};handleShippingMethodNotFoundInCart(t,e){const r=ya(e.deliveryGroups,this.i18n);g.leaveBreadcrumb("ApplePay Session selected shipping method(s) not found in current cart, updating payment sheet",{attemptedDeliveryOptionHandles:t,currentShippingMethods:r},"log"),this.completeShippingMethodSelection(e)}async applyPaymentSheetActions({result:t,onProceed:e,context:r,checkoutUrl:n,requestType:a,afterAuthorization:i}){const o=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction({result:t,context:r,checkoutUrl:n,requestType:a});o.effects?.forEach(s=>s()),!this.sessionIsTerminated()&&await this.handlePaymentSheetAction({paymentSheetAction:o,onProceed:e,afterAuthorization:i,stage:a})}getMostRecentNonNullCart=(t,e)=>t?(this.cartContainer.update(t),t):e;handleNullCart=t=>{if(!t)throw new Error(`[${this.name}] no cart returned on mutation, aborting`);return t};completeShippingContactSelection=({fallbackCart:t,updatedCart:e,errors:r})=>{try{const n=this.getMostRecentNonNullCart(e,t),{newTotal:a,newLineItems:i}=this.getNewTotalAndLineItems(n),o=ya(n.deliveryGroups,this.i18n);g.leaveBreadcrumb("ApplePay Session completeShippingContactSelection",{errors:r,newTotal:a,newLineItems:i,newShippingMethods:o},"log"),this.withActiveSession("completeShippingContactSelection",()=>this.session.completeShippingContactSelection({errors:r??[],newTotal:a,newLineItems:i,newShippingMethods:o}))}catch(n){this.terminateSession({error:n})}};completeShippingMethodSelection=t=>{try{const e=this.handleNullCart(t);this.cartContainer.update(e);const{newTotal:r,newLineItems:n}=this.getNewTotalAndLineItems(e);g.leaveBreadcrumb("ApplePay Session completeShippingContactSelection",{newTotal:r,newLineItems:n},"log"),this.withActiveSession("completeShippingMethodSelection",()=>this.session.completeShippingMethodSelection({newTotal:r,newLineItems:n}))}catch(e){this.terminateSession({error:e})}};sessionIsTerminated=()=>this.cancelled||this.abortController?.signal.aborted===!0;#t=async()=>{if(this.sessionIsTerminated())return;const t=await this.cartContainer.fetch();if(!this.sessionIsTerminated())return t};async getMerchantSession(t){const e=await new Ge({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale,apiVersion:"unstable"}).applePaySessionCreate(t);return JSON.parse(e)}abortPaymentSheetAndShowOutOfStockModal({stage:t}){this.terminateSession({afterAuthorization:t.includes("onPaymentAuthorized")}),st(this.i18n)}emitPaymentCompleteTelemetry(t){c.authorizationComplete({instrument:this.name,measurement:j(L.AuthorizationLatency,this.name),result:t===ApplePaySession.STATUS_SUCCESS?"success":"failed"})}async completePayment(t,e=void 0){g.leaveBreadcrumb("ApplePay Session completePayment",{status:t,errors:e},"log");let r=!1;this.withActiveSession("completePayment",()=>{this.session.completePayment({status:t,errors:e}),r=!0}),this.emitPaymentCompleteTelemetry(t),!r&&t===ApplePaySession.STATUS_SUCCESS&&c.paymentCompletedAfterAbort({instrument:this.name,error:"Session already terminated"})}getNewTotalAndLineItems(t){return{newTotal:Rd(this.merchantName,t.totalAmount),newLineItems:Nd({subtotal:eo(t),discountApplications:Q.enabled(Sn)?Md(t):zd(t),deliveryGroups:t.deliveryGroups,duties:t.totalDutyAmount,taxes:t.totalTaxAmount,i18n:this.i18n,formattedRecurringTotals:Fd(t.lineItems,this.i18n),lineItems:t.lineItems})}}async decelerateOrAbort({result:t,stage:e}){return t.abortReason==="out_of_stock"?(c.sheetClicked({instrument:this.name,result:"rejected",reason:"out_of_stock"}),this.abortPaymentSheetAndShowOutOfStockModal({stage:e}),!0):this.decelerateIfNeeded({result:t,stage:e})}async decelerateIfNeeded({result:t,stage:e}){if(!t.data)return!1;const{checkoutUrl:r,totalAmount:n}=t.data;let a;if(t.decelerationReason&&Ca.includes(t.decelerationReason)?a=t.decelerationReason:xr({currentCartTotal:n,initialBuyerCurrency:this.buyerCurrency})&&(a="currency_changed"),a){c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"});try{await this.terminateSession({decelerationReason:a})}finally{N({checkoutUrl:r,instrumentName:this.name,reason:a,stage:e})}return!0}return!1}get isShippingRequired(){return this.button.isShippingRequired}async handleCreateCartResult({createCartResult:t,stage:e}){const{cart:r,unrecoverableError:n,customValidationError:a,decelerationReason:i}=t;if(n){g.leaveBreadcrumb("ApplePay Session unrecoverable error",{unrecoverableError:n},"error"),c.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),this.withActiveSession("abort",()=>this.session.abort()),this.abortController?.abort(`[Apple Pay] Unrecoverable error ${n}`),At(this.i18n,n);return}if(a){g.leaveBreadcrumb("ApplePay Session custom validation error",{customValidationError:a},"error"),c.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),this.withActiveSession("abort",()=>this.session.abort()),this.abortController?.abort("[Apple Pay] Custom validation error"),Et(this.i18n,a.message);return}if(i&&Ca.includes(i)){c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),this.cartContainer.update(r);try{await this.terminateSession({decelerationReason:i})}finally{N({checkoutUrl:r?.checkoutUrl??"",instrumentName:this.name,reason:i,stage:e})}return}return this.handleNullCart(r)}async removePersonalData(){const t=this.cartContainer.getLatest();this.isPersonalDataCleared||!t||(this.abortController?.signal.aborted===!1&&this.abortController.abort("[Apple Pay] Payment session cleared for other reason"),await this.apiClient.cartRemovePersonalData({cartId:t.id,instrumentName:this.name}),this.isPersonalDataCleared=!0)}
43onSheetLoaded(){if(this.isSheetLoaded)return;this.isSheetLoaded=!0;const t=j(L.SheetLoad,this.name);t&&(Kt({event:z.SheetLoaded,ttl:t}),c.sheetLoaded({instrument:this.name,measurement:t}))}withActiveSession(t,e){if(this.abortController?.signal?.aborted){c.walletSessionAbortError({instrument:this.name,errorName:"SessionAlreadyTerminated",methodName:t});return}try{return e()}catch(r){if(r instanceof Error&&r.name==="InvalidAccessError"){c.walletSessionAbortError({instrument:this.name,errorName:"InvalidAccessError",methodName:t});return}throw r}}async handlePaymentSheetAction({paymentSheetAction:t,onProceed:e,afterAuthorization:r,stage:n}){switch(t.action){case"abort":this.terminateSession({afterAuthorization:r});break;case"show_error":await e(t.errors);break;case"update":await e(t.errors);break;case"decelerate":try{await this.terminateSession({afterAuthorization:r})}finally{N({instrumentName:this.name,checkoutUrl:t.redirectUrl,reason:t.reason,stage:n})}break;default:throw new Error(`Missing handler for payment sheet action "${t.action}"`)}}};function Hr({translate:t,logoElement:e,setAriaHidden:r}){const n=document.createElement("div");return t("buy_with_button_content",{wallet:"LOGO_PLACEHOLDER"}).split(new RegExp("(LOGO_PLACEHOLDER)")).filter(Boolean).forEach(a=>{let i;a==="LOGO_PLACEHOLDER"?i=e:(i=document.createElement("span"),i.innerText=a,r&&i.setAttribute("aria-hidden","true")),n.appendChild(i)}),n}var De=new Map;function $u({instrumentName:t,logoType:e="LIGHT",logoContent:r}){const n=De.get(t)||{};n[e]||(n[e]=r,De.set(t,n))}function te({instrumentName:t,logoType:e="LIGHT"}){const r=De.get(t)?.[e];if(!r)throw new Error(`${t} ${e} logo not loaded`);return r}var Vu=class extends ut{name=m.ApplePay;button=null;static get observedAttributes(){return["disabled"]}get merchantName(){return this.walletParams.merchantName}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}attributeChangedCallback(t,e,r){super.attributeChangedCallback(t,e,r,this.button)}async handleClick(t){if(t.preventDefault(),this.disabled||!this.button||this.button.hasAttribute("aria-disabled"))return;this.disabled=!0,ct(this.name,this.pageType);const[e,r,n]=await Promise.all([this.i18n,this.dataSource,this.apiClient]);zt(L.SheetLoad,this.name);let a;try{if(a=new Hu({accessToken:this.accessToken,buyerCountry:this.buyerCountry,buyerCurrency:this.buyerCurrency,button:this,i18n:e,merchantName:this.merchantName,dataSource:r,apiClient:n,walletParams:this.walletParams}),!a)throw new Error("missing ApplePaySession");a.begin()}catch(i){g.leaveBreadcrumb("Failed to create ApplePay Session",{error:i},"error"),a||(c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in Apple Pay session creation",attributes:{error:String(i),location:"handleClick"}})),a?.terminateSession(),X(e.translate("brand.apple_pay"),e),this.disabled=!1}}async render(){const t=this.getOrCreateShadowRoot(),{translate:e}=await this.i18n,r=te({instrumentName:m.ApplePay}),n=new DOMParser().parseFromString(r,"image/svg+xml").documentElement;if(!this.button){const a=this.isCTA?e("buy_with_button_content",{wallet:e("brand.apple_pay")}):e("brand.apple_pay");if(this.button=ze({label:a}),this.button.onclick=i=>this.handleClick(i),this.button.classList.add("apple-pay-button",Xo[this.buttonTheme],_t.BUTTON),this.isCTA){const i=Hr({translate:e,logoElement:n,setAriaHidden:!0});i.classList.add("apple-pay--content"),this.button.appendChild(i)}else this.button.appendChild(n);this.initializeShadowStyles(t,wd),t.appendChild(this.button),this.ensureLightDOMIsNotEmpty(),this.onRendered?.()}this.disabled&&(this.button.setAttribute("disabled",""),this.button.setAttribute("aria-disabled","true"))}};function $r(t){return function(e,r,n){const a=n.value;return n.value=function(...i){const o=a.apply(this,i);return o.eligible||console.debug(`[DEBUG] ${t} could not be rendered. Reason: ${o.reason}`),o},n}}async function Ot({svg:t,instrumentName:e,logoType:r="LIGHT"}){if(De.get(e)?.[r])return;let n,a,i;try{if(i=Wu(t),n=await fetch(i,{headers:{Accept:"image/svg+xml"}}),!n.ok)throw new Error(`Failed to fetch SVG: ${n.status} ${n.statusText}`);if(a=await n.text(),!a||!a.includes("<svg"))throw new Error("Invalid SVG content received");$u({instrumentName:e,logoType:r,logoContent:a})}catch(o){const s=o instanceof Error?o.message:String(o);throw g.leaveBreadcrumb("SVG fetch failed",{error:s,responseStatus:n?.status,responseHeaders:n?.headers,responseBody:a?.slice(0,100),assetUrl:i}),new W("SVG fetch failed",{cause:s})}}function Wu(t){const e=new URL(import.meta.url);return new URL(`assets/${t}`,e).href}function Vr(t,e,r,n){var a=arguments.length,i=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(a<3?o(i):a>3?o(e,r,i):o(e,r))||i);return a>
433&&i&&Object.defineProperty(e,r,i),i}var Wr=class St extends ht{static applePaySDKPromise;static walletName(){return"apple_pay"}companyFieldRequired;constructor(e){super(e),this.companyFieldRequired=!!this.walletParams.companyRequired}getWebComponentName(){return"shopify-apple-pay-button"}getWebComponentClass(){return Vu}getInstrumentName(){return m.ApplePay}getLoadEligibility(){return this.isInIframe()?{eligible:!1,reason:"cannot be loaded in an iframe"}:{eligible:!0}}getPartnerSDKEligibility(){if(typeof window>"u"||window.ApplePaySession===void 0)return{eligible:!1,reason:"window or ApplePaySession is undefined"};try{if(!window.ApplePaySession.supportsVersion?.(6))return{eligible:!1,reason:"SDK does not meet minimum version requirement"};if(!window.ApplePaySession.canMakePayments?.())return{eligible:!1,reason:"failed SDK eligibility check"}}catch{return{eligible:!1,reason:"error in SDK eligibility checks"}}return{eligible:!0}}async loadWalletSDK(){await Promise.all([this.loadAppleLogo(),this.loadApplePaySDK()])}loadApplePaySDK(){if(typeof window>"u"||window.ApplePaySession!==void 0||!Q.enabled(Pn))return Promise.resolve();if(St.applePaySDKPromise)return St.applePaySDKPromise;const e=document.createElement("script");return e.setAttribute("src",Jo),St.applePaySDKPromise=new Promise((r,n)=>{e.onload=()=>r(),e.onerror=a=>{St.applePaySDKPromise=void 0,e.remove(),n(Ue("Apple Pay",a))},document.body.appendChild(e)}),St.applePaySDKPromise}async loadAppleLogo(){await Ot({svg:"apple-pay-logo.svg",instrumentName:m.ApplePay})}};Vr([$r("Apple Pay")],Wr.prototype,"getLoadEligibility",null),Vr([$r("Apple Pay")],Wr.prototype,"getPartnerSDKEligibility",null);var ju=".buy-with-prime-button{opacity:1;border-width:0;justify-content:center;align-items:center;gap:5px;width:100%;height:100%;padding:12px 10px 8px;display:flex}.buy-with-prime-button:hover:enabled{background-color:#0684eb!important}.buy-with-prime-button:focus{box-shadow:0 0 0 2px #1a98ff, inset 0 0 0 2px rgb(var(--color-background))!important;outline:none!important}.buy-with-prime-button:active,.buy-with-prime-button:hover:enabled:active{box-shadow:none!important;background-color:#0066cd!important}.buy-with-prime-button>svg{min-width:85px}",ee=class extends Error{};ee.prototype.name="MissingAccessTokenError";var He=class extends Error{};He.prototype.name="FetchingWalletsPlatformConfigError";var $e=class extends Error{};$e.prototype.name="EmptyLineItemsWalletsPlatformConfigError";var qu="2025-01-01";async function Eo({configOptionsEndpoint:t,checkoutUrl:e,sourceId:r,accessToken:n,instrument:a}){try{const i=JSON.stringify({checkout_url:e,checkout_cancel_url:window.location.href,cart_id:r}),o=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":n,"X-Shopify-Checkout-Version":qu},body:i});if(o.ok)return o.json();const s=await o.json();throw s.error?new Error(s.error):new Error(`Could not fetch wallets platform configs: [${o.status}] ${o.statusText}`)}catch(i){const o=Yu(i);throw o==="empty_line_items"?new $e(`[Fetch Pay Config][${a}] No eligible line items provided in the config request.`):(c.walletsPlatformConfigRequestFailure({endpoint:t,instrument:a,error:o,sourceId:r}),new He(`[Fetch Pay Config][${a}] ${o}`,{cause:i}))}}function Yu(t){if(t instanceof Error)return t.message;try{if(t instanceof Object)return JSON.stringify(t)}catch(e){g.leaveBreadcrumb("Could not safely extract Wallets Platform error message due to JSON stringify error",{stringifyError:String(e)},"error")}return String(t)}var Ku={[S.Checkout]:"Checkout",[S.CartAjax]:"Cart",[S.CartPage]:"Cart",[S.ProductPage]:"Product",[S.Unknown]:"Product"},Qu=class pr extends ut{static OPTIMUS_CONFIG_REST_API_URL=`${window.location.origin}/wallets/config/optimus`;static EXPECTED_ERRORS=[He,ee,$e];name=m.BuyWithPrime;button=null;apiClientId="";connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name),this.handleOnSendCheckoutAction=this.handleOnSendCheckoutAction.bind(this)}async createButton(){const{translate:e}=await this.i18n,r=ze({label:e("brand.buy_with_prime")});return r.type="button",r.className="buy-with-prime-button",this.applyEnabledStyles(r),r}applyEnabledStyles(e){e.innerHTML=te({instrumentName:m.BuyWithPrime}),e.disabled=!1,qt(e,{"background-color":"#1A98FF",color:"#FFFFFF",cursor:"pointer"})}applyDisabledStyles(e){e.innerHTML=te({instrumentName:m.BuyWithPrime,logoType:"DARK"}),e.disabled=!0,qt(e,{"background-color":"#C0E3FF",color:"#7292AC",cursor:"not-allowed"})}async handleClick(){if(!this.button)return;ct(this.name,this.pageType);const[e,r]=await Promise.all([this.i18n,this.dataSource]);let n;try{this.applyDisabledStyles(this.button);let a=this.walletParams;
43if(this.apiClientId=this.apiClientId||a.appId||"",n=this.apiClientId?{apiClientId:this.apiClientId,pageType:this.pageType}:void 0,!a.createCheckoutSessionConfig){const{cart:s,decelerationReason:l,customValidationError:d,unrecoverableError:u}=await dt({element:this,instrumentName:this.name,dataSource:r});if(u){c.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error",webPixelMetaData:n}),At(e,u);return}if(d){c.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error",webPixelMetaData:n}),Et(e,d.message);return}if(l){c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration",webPixelMetaData:n}),N({checkoutUrl:s?.checkoutUrl??"",instrumentName:this.name,reason:l});return}if(!this.accessToken)throw new ee("[Fetch Pay Config] could not fetch pay configs since required accessToken is missing.");a={...await Eo({configOptionsEndpoint:pr.OPTIMUS_CONFIG_REST_API_URL,checkoutUrl:s?.checkoutUrl??"",sourceId:Ir(s)??"",accessToken:this.accessToken,instrument:this.name})}}a.placement=this.getPlacement();const i=this.extractSKUs(a);n&&i&&(n.skus=i),delete a.checkoutSupportsSplitCart,delete a.appId;const o=a;this.pciEnabled&&(o.onSendCheckoutAction=this.handleOnSendCheckoutAction),window.amazon.buywithprime.initCheckout({amazonPayOptions:o}),c.sheetClicked({instrument:this.name,result:"success",webPixelMetaData:n})}catch(a){n&&(n.skus=n.skus||[]),pr.EXPECTED_ERRORS.some(s=>a instanceof s)?c.sheetClicked({instrument:this.name,result:"rejected",reason:"expected_error",webPixelMetaData:n}):(c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error",webPixelMetaData:n}),c.log({body:"Unhandled error detected in Buy with Prime sheet clicked",attributes:{error:String(a),location:"handleClick"}}),g.notify(a));const i=a instanceof Error?a.name:"unknown",{translate:o}=e;xt(o("error_dialogs.wallet.title",{wallet:o("brand.buy_with_prime")}),this.getModalContent(i,o))}finally{this.applyEnabledStyles(this.button)}}getModalContent(e,r){return e==="EmptyLineItemsWalletsPlatformConfigError"?r("error_dialogs.wallet.eligibility_error",{wallet:r("brand.buy_with_prime")}):r("error_dialogs.wallet.generic_error",{wallet:r("brand.buy_with_prime")})}extractSKUs(e){return e.createCheckoutSessionConfig?.payloadJSON?JSON.parse(e.createCheckoutSessionConfig.payloadJSON).cartDetails.lineItems.map(r=>r&&r.sku).filter(r=>r):[]}getPlacement(){return this.pageType&&Ku[this.pageType]||"Other"}async render(){const e=this.getOrCreateShadowRoot();this.button||(this.button=await this.createButton(),this.button.onclick=()=>this.handleClick(),this.button.classList.add("buy-with-prime-button"),this.getPlacement().includes("Checkout")||this.button.classList.add(_t.BUTTON),await this.initializeShadowStyles(e,ju),e.appendChild(this.button),this.onRendered?.())}buildBwpEventData(e){const r={};return e.createCheckoutSessionConfig&&(r.skus=this.extractSKUs(e),r.apiClientId=this.apiClientId),r}async handleOnSendCheckoutAction(e){const{eventName:r,redirect:n,redirectUrl:a,requestPayload:i}=e;if(n&&a){this.dispatchWalletEvent({eventName:"wallet-redirect",detail:{redirectUrl:a,requestPayload:i}});return}switch(r){case"initCheckout":{const o=this.walletParams;this.dispatchWalletEvent({eventName:"wallet-clicked",detail:{bwpEventData:this.buildBwpEventData(o)}});break}case"initChange":this.dispatchWalletEvent({eventName:"wallet-clicked"});break;case"cancelCheckout":this.dispatchWalletEvent({eventName:"wallet-cancel"})}}};async function Ao({fn:t,maxRetries:e=3,delay:r=1e3,retryPolicyFn:n=()=>!0,onFinishedFn:a=()=>{}}){const i=()=>new Promise(l=>{setTimeout(l,r)});let o=0;const s=async()=>{try{return await t()}catch(l){if(o++,o<e&&n(l))return await i(),s();throw l}};try{return await s()}finally{a(o)}}async function Xu(t){return new Promise((e,r)=>{if(document.querySelector(`script[src="${t}"]`)&&window.amazon){e();return}const n=document.createElement("script");n.src=t,n.onload=()=>{window.amazon?e():r(new Error("Amazon SDK not present after loading"))},n.onerror=a=>{r(Ue("Amazon",a))},document.head.append(n)})}async function Co({sdkUrl:t=Er,maxRetries:e=3}){return Ao({fn:()=>Xu(t),maxRetries:e,delay:200,retryPolicyFn:()=>!0,onFinishedFn:r=>{c.amazonPaySDKLoadRetries({retries:r})}})}var Ju=class mr extends ht{static MAX_RETRIES=3;static SDK_URL=Er;static walletName(){return"buy_with_prime"}constructor(e){super(e)}getWebComponentName(){return"shopify-buy-with-prime-button"}getInstrumentName(){return m.BuyWithPrime}getWebComponentClass(){return Qu}async loadWalletSDK(){await Co({sdkUrl:mr.SDK_URL,maxRetries:mr.MAX_RETRIES}),await this.loadLogos()}async loadLogos(){await Promise.all([this.loadPrimeLogo(),this.loadPrimeLogoDark()])}async loadPrimeLogo(){await Ot({svg:"prime-logo.svg",instrumentName:m.BuyWithPrime})}async loadPrimeLogoDark(){await Ot({svg:"prime-logo-dark.svg",instrumentName:m.BuyWithPrime,logoType:"DARK"})}},Zu="shopify-amazon-pay-button div[role=button][slot=amazon-pay-slot][data-testid=amazon-pay-button]{border-radius:0!important;width:100%!important}",th=":host([page-type=cart_page]) .accelerated-checkout-button{justify-content:center;display:flex;overflow:hidden}",va="amazon-pay-slot",eh=class gr extends ut{static CV2_CONFIG_REST_API_URL=`${window.location.origin}/wallets/config/amazon_pay`;static EXPECTED_ERRORS=[He,ee,$e];name=m.AmazonPay;resizeObserver=null;#t=0;#e=0;#r=!1;#n=null;#a=null;#i=null;sdkButton=null;connectedCallback(){this.resizeObserver=wt("ResizeObserver",()=>this.onResize()),this.cleanupOnFailure(this.render.bind(this),this.name)}async disconnectedCallback(){super.disconnectedCallback(),this.innerHTML="",this.clearShadowRoot(),this.teardownAmazonButtonContainer(),this.resizeObserver?.disconnect()}async handleClick(e){ct(this.name,this.pageType);const[r,n]=await Promise.all([this.i18n,this.dataSource]);try{const{cart:a,decelerationReason:i,customValidationError:o,unrecoverableError:s}=await dt({element:this,instrumentName:this.name,dataSource:n});if(s){c.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),At(r,s);return}if(o){c.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),Et(r,o.message);return}if(i){c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),N({checkoutUrl:a?.checkoutUrl??"",instrumentName:this.name,reason:i});return}const{totalAmount:{amount:l},checkoutUrl:d}=a;let u=this.walletParams;if(!u.createCheckoutSessionConfig){if(!this.accessToken)throw new ee("[Fetch Pay Config] could not fetch pay configs since required accessToken is missing.");u={...await Eo({configOptionsEndpoint:gr.CV2_CONFIG_REST_API_URL,checkoutUrl:d,sourceId:Ir(a)??"",accessToken:this.accessToken,instrument:this.name}),placement:this.pageType===S.ProductPage?"Product":"Cart"}}delete u.appId,e.initCheckout({...u,...Number(l)!==0&&{estimatedOrderAmount:{amount:l,currencyCode:this.buyerCurrency}}}),c.sheetClicked({instrument:this.name,result:"success"})}catch(a){gr.EXPECTED_ERRORS.some(o=>a instanceof o)?c.sheetClicked({instrument:this.name,result:"rejected",reason:"expected_error"}):(c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in Amazon Pay sheet clicked",attributes:{error:String(a),location:"handleClick"}}),g.notify(a));const i=r.translate("brand.amazon_pay");X(i,r)}}createContainer({containerID:e,height:r}){const n=document.createElement("div");return n.id=e,n.style.display="flex",n.style.minWidth="140px",r!=null&&(n.style.height=`${r}px`),n.slot=va,n.setAttribute("data-testid","amazon-pay-button"),n}async onResize(){const e=ke(this.#n)||0,r=cr(this.#n)||0,n=this.#t!==e||this.#e!==r;!this.#r&&n&&(this.teardownAmazonButtonContainer(),await this.cleanupOnFailure(()=>this.renderFromAmazonSDK(),this.name))}async render(){const e=this.getOrCreateShadowRoot();try{const r=document.createElement("slot");r.name=va;const n=document.createElement("style");n.textContent=Zu,this.appendChild(n),await this.initializeShadowStyles(e,th);const a=await this.containerInstanceNumber;this.#a=`AcceleratedCheckoutAmazonPayButtonContainer${this.pageType}${a}`,this.#n=document.createElement("div"),this.#n.classList.add(_t.BUTTON),this.#n.appendChild(r),e.a
43ppendChild(this.#n),this.resizeObserver?.observe(this.#n),await this.renderFromAmazonSDK()}catch(r){g.notify(r)}}async renderFromAmazonSDK(){this.#r=!0;const e=cr(this.#n)||0;this.#i=this.createContainer({containerID:this.#a,height:e}),this.appendChild(this.#i);const r=ke(this.#n)||0,n={buttonBorderRadius:`${r}px`};let a=!1;try{if(this.sdkButton=window.amazon.Pay.renderButton(`#${this.#a}`,{...this.walletParams,style:n,placement:this.pageType===S.ProductPage?"Product":"Cart"}),this.sdkButton){const i=this.sdkButton;this.sdkButton.onClick(()=>this.handleClick(i))}else c.log({body:"Amazon Pay Button rendered null SDK button",attributes:{pageType:this.pageType,containerID:this.#a}});this.#e=e,this.#t=r,c.renderSucceeded(this.name),a=!0}catch(i){c.renderFailed(this.name);const o=`Amazon Pay Button not able to render into container #${this.#a}.`;console.error(o),c.log({body:o,attributes:{pageType:this.pageType,containerID:this.#a,error:i?.toString()}})}finally{this.#r=!1}a&&this.sdkButton?this.onRendered?.():this.onRenderFailed?.()}teardownAmazonButtonContainer(){this.#i?.remove(),this.#i=null}},rh=class yr extends ht{static MAX_RETRIES=3;static SDK_URL=Er;static walletName(){return"amazon_pay"}constructor(e){super(e)}getWebComponentName(){return"shopify-amazon-pay-button"}getInstrumentName(){return m.AmazonPay}getWebComponentClass(){return eh}async loadWalletSDK(){await Co({sdkUrl:yr.SDK_URL,maxRetries:yr.MAX_RETRIES})}getLoadEligibility(e){return e.getRootNode()instanceof ShadowRoot?{eligible:!1,reason:"Cannot load Amazon Pay within Shadow DOM"}:{eligible:!0}}},tr={Purple:{D80:"#1B163B",D60:"#322C7D",D50:"#4524DB",P40:"#5433EB",L30:"#6445ED",L20:"#9C83F8",L10:"#DBD1FF",L5:"#EEEAFF",L2:"#F7F5FF"},Grayscale:{D100:"#000000",D93:"#121212",D90:"#1A1A1A",D80:"#2A2A2A",D70:"#404040",D60:"#656667",D50:"#6F7071",L40:"#A6A8A9",L20:"#C9CBCC",L10:"#E1E4E5",L6:"#EEF0F1",L5:"#F2F4F5",L0:"#FFFFFF"},Green:{D90:"#002E24",D80:"#004839",D70:"#008552",L30:"#92D08D",L20:"#BAEBCB",L10:"#D2F2DE",L5:"#E4F6EB"},Poppy:{D80:"#481609",D70:"#832711",D50:"#D92A0F",L40:"#F05D38",L20:"#FF967D",L10:"#FFD2C2",L4:"#FFECE9"},Ochre:{D90:"#443600",D70:"#8C6E01",D60:"#C29D05",L50:"#E3BE2B",L30:"#F8DB67",L20:"#FFEC9F",L10:"#FFF4CB",L6:"#FFF9E2"},Brand:{Aqua:"#8DC0C6",Lime:"#C7DE00",Magenta:"#D354FF",Olive:"#8B8F01",Sage:"#D8E59D",Sand:"#F4F4ED",Violet:"#A327C2"},transparent:"transparent"},ah={0:0,none:0,px:1,2:2,4:4,8:8,10:10,12:12,16:16,20:20,24:24,32:32,36:36,40:40,48:48,64:64,auto:"auto"},Sa="gravity-font-faces",nh=`
44@font-face {
45  font-family: 'GTStandard-M';
46  src: url('https://cdn.shopify.com/shop-assets/static_uploads/shoplift/GTStandard-MRegular.woff2')
47    format('woff2');
48  font-style: normal;
49  font-weight: 450;
50  font-display: fallback;
51}
52
53@font-face {
54  font-family: 'GTStandard-M';
55  src: url('https://cdn.shopify.com/shop-assets/static_uploads/shoplift/GTStandard-MMedium.woff2')
56    format('woff2');
57  font-style: normal;
58  font-weight: 500;
59  font-display: fallback;
60}
61
62@font-face {
63  font-family: 'GTStandard-M';
64  src: url('https://cdn.shopify.com/shop-assets/static_uploads/shoplift/GTStandard-MSemibold.woff2')
65    format('woff2');
66  font-style: normal;
67  font-weight: 600;
68  font-display: fallback;
69}`,oh=class extends HTMLElement{static get observedAttributes(){return["disabled"]}connectedCallback(){this._loadFonts(),this._updateButton()}attributeChangedCallback(){this._updateButton()}_loadFonts(){if(document.querySelector(`style[data-description="${Sa}"], style[data-description="shop-js-font-faces"]`))return;let t=document.head??document.documentElement;if(!t)return;let e=document.createElement("style");e.dataset.description=Sa,e.appendChild(document.createTextNode(nh)),t.appendChild(e)}_updateButton(){let t=this._getOrCreateShadowRoot();t.innerHTML=sh,this.hasAttribute("disabled")&&t.querySelector("button")?.setAttribute("disabled","")}_getOrCreateShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}};function ih(){window.customElements&&(customElements.get("gravity-button")||customElements.define("gravity-button",oh))}var sh=`
70<style>
71  * {
72    box-sizing: border-box;
73    border-width: 0;
74    border-style: solid;
75    border-color: currentColor;
76    --focused-box-shadow: 0 0 0 3px #DBD1FF, 0 0 #0000;
77  }
78
79  button {
80    text-transform: none;
81    -webkit-appearance: button;
82    background-color: transparent;
83    background-image: none;
84    font-family: GTStandard-M;
85    font-feature-settings: inherit;
86    font-variation-settings: inherit;
87    font-size: 100%;
88    font-weight: inherit;
89    line-height: inherit;
90    letter-spacing: inherit;
91    color: inherit;
92    margin: 0;
93    padding: 0;
94    cursor: pointer;
95  }
96
97  button:disabled {
98    cursor: default;
99    opacity: 0.5;
100  }
101
102  .gravity-button {
103    position: relative;
104    display: flex;
105    min-height: var(--gravity-button-min-height);
106    height: var(--gravity-button-height);
107    width: var(--gravity-button-width, 260px);
108    justify-content: center;
109    color: ${tr.Grayscale.L0};
110    align-items: center;
111    overflow: visible;
112    padding: var(--gravity-button-padding, ${ah[16]}px 10px);
113    border-radius: var(--gravity-button-border-radius);
114    border: none;
115    background-color: ${tr.Purple.P40};
116    transition: all;
117  }
118
119  .gravity-button:not([disabled]):focus-visible {
120    box-shadow: var(--focused-base-box-shadow, var(--focused-box-shadow));
121    outline: var(--focused-base-outline, 2px solid transparent);
122    outline-offset: var(--focused-base-outline-offset, 2px);
123  }
124
125  .gravity-button:not([disabled]):hover {
126    background-color: ${tr.Purple.D50};
127  }
128</style>
129
130<button class="gravity-button">
131  <slot id="button-content"></slot>
132</button>
133`,lh=".button-content{white-space:nowrap;justify-content:center;align-items:center;gap:3px;width:100%;height:100%;display:flex;container:bc/inline-size}.button-content>span{font-size:16px}.ShopPromise>.separator{margin:0 8px}@container bc (width<=300px){.ShopPromise{display:none!important}}gravity-button{display:block}shop-pay-iframe-content{height:100%}.credit-card-iframe-container{visibility:hidden;opacity:0;width:0;height:100%;transition:width .35s cubic-bezier(.33,0,0,1) .2s;position:relative;left:0}shop-pay-iframe-content,.credit-card-iframe-container>iframe.credit-card-iframe{pointer-events:none;-webkit-user-select:none;user-select:none}.credit-card-iframe-visible{opacity:1;visibility:visible;width:72px}.credit-card-iframe{object-position:left top;object-fit:none;width:80px;height:100%;position:absolute;top:0;left:0}",ch=".accelerated-checkout-button{height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,44px), 55px);min-height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,44px), 55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius,0px);box-shadow:var(--shopify-accelerated-checkout-button-box-shadow)}:host([page-type=cart_page]){height:100%;display:block}:host([page-type=cart_page]) .accelerated-checkout-button{border-radius:var(--shopify-accelerated-checkout-button-border-radius,4px);width:100%;height:100%;min-height:0;box-shadow:var(--shopify-accelerated-checkout-button-box-shadow)}:host([page-type=product]) .accelerated-checkout-button{min-width:150px}@media (forced-colors:active){.accelerated-checkout-button,:host([page-type=cart_page]) .accelerated-checkout-button{border:1px solid #0000!important}}.accelerated-checkout-button{--gravity-button-height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,44px), 55px);--gravity-button-min-height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,44px), 55px);--gravity-button-border-radius:var(--shopify-accelerated-checkout-button-border-radius,0px);--gravity-button-padding:0px 10px;--gravity-button-width:100%}:host([page-type=cart_page]) .accelerated-checkout-button{--gravity-button-height:100%;--gravity-button-min-height:100%;--gravity-button-border-radius:var(--shopify-accelerated-checkout-button-border-radius,4px);--gravity-button-width:100%}",jr=class extends Error{constructor(){super("deliveryEstimates is null or undefined")}};jr.prototype.name="DeliveryEstimatesResponseIsNullError";var me=class extends Error{constructor(){super("window.Shopify.ShopPromise.deliveryPromiseAPIClient is undefined")}};me.prototype.name="DeliveryPromiseAPIClientError";var dh=15,uh=200,hh=class{storefrontAPIToken;constructor(t){this.storefrontAPIToken=t}async fetchDeliveryPromise({variant:t,sellingPlanId:e}){const r=await Ao({fn:async()=>this.fetchDeliveryOptions(t,e),maxRetries:dh,delay:uh,retryPolicyFn:n=>
133n instanceof me}).catch(n=>{if(n instanceof me)throw n;return null});if(!r)throw new jr;return r}async fetchDeliveryOptions(t,e){const r={variantId:t,sellingPlanId:e},n=window?.Shopify?.ShopPromise?.deliveryPromiseAPIClient;if(!n)throw new me;return n(r,this.storefrontAPIToken)}};function ph(t,e){switch(t){case 0:return e?.translate("shop_promise_delivery.same_day")||null;case 1:return e?.translate("shop_promise_delivery.next_day")||null;case 2:return e?.translate("shop_promise_delivery.two_day")||null;default:return null}}var Pa="delivery-promise:postal-code-changed",mh=class extends re{lastFetchedProductVariantId;lastFetchSellingPlan;lastFetchPostalCode;fetching=!1;i18n=null;daysToDelivery;formObserver=null;async connectedCallback(){this.formObserver=new Ur(this,({variantId:t,sellingPlanId:e})=>{this.fetchDeliveryPromise(t,e)}),this.formObserver.setupMutationObservers(),window.addEventListener(Pa,this.handlePostalCodeChange)}disconnectedCallback(){window.removeEventListener(Pa,this.handlePostalCodeChange)}setTranslations(t){this.i18n=t,this.render()}async fetchDeliveryPromise(t,e,r=""){if(!(!t||!this.accessToken)&&!(t===this.lastFetchedProductVariantId&&e===this.lastFetchSellingPlan&&r===this.lastFetchPostalCode))try{this.lastFetchedProductVariantId=t,this.lastFetchSellingPlan=e,this.lastFetchPostalCode=r;const n=await new hh(this.accessToken).fetchDeliveryPromise({variant:t,sellingPlanId:e||""}),a=Tn(this),i=n?.selectedShippingOption?.brandedPromise?.handle;if(a?.sellingPlanId!==e||a?.variantId!==t||this.lastFetchPostalCode!==r||i!=="shop_promise")return;this.daysToDelivery=n?.selectedShippingOption?.maxCalendarDaysToDelivery,this.render()}catch(n){n instanceof jr&&(this.daysToDelivery=null)}}render(){const t=ph(this.daysToDelivery,this.i18n);this.classList.add("ShopPromise"),this.innerHTML=t?`<span class="separator">|</span><span>${t}</span>`:""}handlePostalCodeChange=t=>{const e=t.detail?.postalCode??"";this.fetchDeliveryPromise(this.lastFetchedProductVariantId,this.lastFetchSellingPlan,e)}};function gh({flow:t="default"}){const e=new URLSearchParams({target_origin:window.location.origin,flow:t});return`${window.location.origin}/services/login_with_shop/authorize?${e.toString()}`}function fh(t,e,r){const n=r??window.location.origin;if(t.origin!==n||!e)return!1;try{return t.source===e.contentWindow}catch{return!1}}var yh=class fr extends re{static iframeCreated=!1;_userRecognized;iframe=null;iframeContainer=null;iframeCreationStart=null;iframeOrigin=null;shopLogo=null;iframeState="hidden";impressionTracked=!1;pendingAnimation=!1;get userRecognized(){return this._userRecognized}async createIframe(){if(this.iframeContainer)return this.iframeC
133ontainer;const e=jt();return this.iframeCreationStart=e,this.iframeContainer=document.createElement("div"),this.iframeContainer.classList.add("credit-card-iframe-container"),this.iframeContainer.setAttribute("data-test-id","shop-pay-iframe-container"),this.iframe=document.createElement("iframe"),this.iframe.src=gh({flow:"shop_pay_button"}),this.iframe.setAttribute("scrolling","no"),this.iframe.setAttribute("frameborder","no"),this.iframe.setAttribute("loading","lazy"),this.iframe.setAttribute("allowtransparency","true"),this.iframe.setAttribute("allowfullscreen","false"),this.iframe.classList.add("credit-card-iframe"),this.iframeContainer.appendChild(this.iframe),this.iframeContainer}async connectedCallback(){if(fr.iframeCreated)return;const e=this.querySelector(".credit-card-iframe-container");e&&e.remove(),fr.iframeCreated=!0;const r=await this.createIframe();this.appendChild(r),this.setupMessageListener()}disconnectedCallback(){this.cleanup()}setShopLogo(e){this.shopLogo=e}setDisabled(e){this.disabled=e,e&&this.iframeState!=="personalized"&&this.hideIframe()}hasPersonalizationOccurred(){return this.iframeState==="personalized"}triggerAnimation(e){const r=this.style.display!=="none";if(!(this.disabled||this.iframeState==="personalized"||!r)){if(this.iframeState==="loaded"){this.trackButtonImpression();return}if(this.iframeState==="ready"){this.showIframe(e);return}this.pendingAnimation=!0}}stopPendingAnimation(){this.pendingAnimation=!1}resetToOriginalState(){this.iframeState="hidden",this.pendingAnimation=!1,this.iframeC
133ontainer?.classList.remove("credit-card-iframe-visible")}trackButtonImpression(){this.impressionTracked||(G({event:z.ShopPayButtonInView,instrumentId:m.ShopPay,eventSubtype:this.userRecognized?"personalized":"not_personalized"}),this.impressionTracked=!0)}setupMessageListener(){window.addEventListener("message",this.handleMessage)}handleMessage=e=>{if(fh(e,this.iframe,e.origin)&&e.data?.type==="loaded"&&(this.iframeOrigin!==e.origin&&(this.iframeOrigin=e.origin),e.data.type==="loaded")){const r=e.data.recognized===!0;if(this._userRecognized=r,this.iframeCreationStart){const n=jt()-this.iframeCreationStart,a={instrument:m.ShopPay,pageType:Sr()};E.histogram({name:C.ShopPayPersonalizedIframeLoadTime,value:n,attributes:a,unit:"ms"}),E.histogram({name:C.ShopPayPersonalizedIframeLoadTimeFromPageLoad,value:window.performance.now(),attributes:a,unit:"ms"})}if(r){this.handleRecognizedUser();return}this.handleUnrecognizedUser()}};handleRecognizedUser(){const e=this.iframeState==="hidden";e&&(this.iframeState="ready"),this.style.display!=="none"&&e&&!this.disabled&&this.pendingAnimation&&(this.pendingAnimation=!1,this.showIframe())}handleUnrecognizedUser(){this.iframeState="loaded",this.pendingAnimation&&this.trackButtonImpression(),this.cleanup()}animateIn(){this.disabled||!this.iframeContainer||this.iframeState!=="ready"||!this.shopLogo||(this.iframeContainer.classList.add("credit-card-iframe-visible"),this.sendMessageToIframe(),this.iframeState="personalized")}showIframe(e){if(this.trackButtonImpression(),!e){this.animateIn();return}const r=setTimeout(()=>{this.animateIn()},500);return()=>clearTimeout(r)}hideIframe(){this.iframeState!=="hidden"&&this.iframeState!=="personalized"&&(this.iframeState="hidden",this.iframeC
133ontainer?.classList.remove("credit-card-iframe-visible"))}cleanup(){window.removeEventListener("message",this.handleMessage),this.iframeContainer?.remove(),this.iframeContainer=null,this.iframe=null,this.iframeOrigin=null,this.shopLogo=null}sendMessageToIframe(){if(!this.iframe?.contentWindow||!this.iframeOrigin)return;const e={timestamp:jt(),type:"animate-in"};this.iframe.contentWindow.postMessage(e,this.iframeOrigin)}};function bh(t){const e=t.querySelector(".button-content span");if(!e)return 0;const r=window.getComputedStyle(e);return parseFloat(r.fontSize)}function Ia(){const t=window.TPOConfigs,e=window.optionizeSettings;return!!(t||e)}var de=220,wh=class{cachedFontSize=null;cachedWidth=0;element;formObserver=null;formState={disabled:!1,variantId:void 0};initialWidth=null;isCTA;lockedNonPersonalized=!1;onFormStateChange;pendingFormStateUpdate=null;personalized;resizeObserver=null;shopPromiseEligible;shopPromiseProductPageContent;constructor({element:t,isCTA:e,onFormStateChange:r,personalized:n,shopPromiseEligible:a,shopPromiseProductPageContent:i}){this.element=t,this.isCTA=e,this.onFormStateChange=r,this.personalized=n,this.shopPromiseEligible=a,this.shopPromiseProductPageContent=i,this.personalized&&(Ia()||(this.formObserver=new Ur(this.element,({disabled:o,variantId:s})=>{this.formState={disabled:o,variantId:s},this.scheduleFormStateChange()}),this.formObserver.setupMutationObservers(),this.resizeObserver=wt("ResizeObserver",o=>this.handleResize(o)),this.resizeObserver?.observe(this.element)))}cleanup(){this.formObserver?.addToCartMutationObserver?.disconnect(),this.resizeObserver?.disconnect(),this.pendingFormStateUpdate!==null&&(cancelAnimationFrame(this.pendingFormStateUpdate),this.pendingFormStateUpdate=null)}shouldRender(){if(!this.personalized||Ia())return!1;const t=this.cachedWidth;if(this.lockedNonPersonalized)return!1;const e=this.shopPromiseEligible&&this.shopPromiseProductPageContent,r=this.formState.disabled&&this.formState.variantId!==void 0;if(e||r||t<de)return!1;if(this.isCTA){const n=this.getFontSizeCached();if(n<10||n>18)return!1}return!0}getFontSizeCached(){return this.cachedFontSize!==null?this.cachedFontSize:(this.cachedFontSize=bh(this.element),this.cachedFontSize)}scheduleFormStateChange(){this.pendingFormStateUpdate===null&&(this.pendingFormStateUpdate=requestAnimationFrame(()=>{this.pendingFormStateUpdate=null,this.onFormStateChange?.()}))}get locked(){return this.lockedNonPersonalized}get soldOut(){return this.formState.disabled&&this.formState.variantId!==void 0}handleResize(t){const e=t[0]?.contentRect.width??0;if(this.cachedWidth=e,this.initialWidth===null&&e>0){this.initialWidth=e,this.initialWidth<de&&(this.lockedNonPersonalized=!0),this.scheduleFormStateChange();return}if(this.initialWidth!==null&&this.initialWidth>=de&&e>0&&e<de&&!this.lockedNonPersonalized){this.lockedNonPersonalized=!0,this.scheduleFormStateChange();return}this.scheduleFormStateChange()}},_h=class extends ut{name=m.ShopPay;button=null;shopPromiseProductPageContent=null;shopPromiseEligible=!1;shopLogo=null;buttonContentDiv=null;iframeContent=null;iframeRenderEligibility=null;intersectionObserver=null;inView=!1;impressionTracked=!1;static get observedAttributes(){return["disabled"]}connectedCallback(){this.shopPromiseEligible=dn(),this.setupIntersectionObserver(),this.cleanupOnFailure(async()=>{ih(),await this.render()},this.name)}disconnectedCallback(){super.disconnectedCallback(),this.intersectionObserver?.disconnect(),this.intersectionObserver=null,this.iframeRenderEligibility?.cleanup(),this.iframeRenderEligibility=null}attributeChangedCallback(t,e,r){super.attributeChangedCallback(t,e,r,this.button),t==="disabled"&&this.onDisabledChanged(r)}setupIntersectionObserver(){if("IntersectionObserver"in window){const t=(this.button?.offsetHeight??46)*-1;this.intersectionObserver=new IntersectionObserver(e=>{e.forEach(r=>
133{r.isIntersecting&&!this.inView&&(this.inView=!0,this.onButtonInView(!0),this.intersectionObserver?.unobserve(this))})},{threshold:.1,rootMargin:`${t}px`}),this.intersectionObserver.observe(this)}else this.inView=!0,this.onButtonInView()}onButtonInView(t){const e=this.iframeRenderEligibility?.shouldRender();if(e&&this.iframeContent){this.iframeContent.triggerAnimation(t);return}if(e){this.createAndAttachIframe();return}this.impressionTracked||(G({event:z.ShopPayButtonInView,instrumentId:m.ShopPay,eventSubtype:"not_personalized"}),this.impressionTracked=!0)}onDisabledChanged(t){this.iframeContent?.setDisabled(t!==null)}async addButtonContent(){if(!this.button)return;let t;const e=await this.i18n,r=te({instrumentName:m.ShopPay}),n=new DOMParser().parseFromString(r,"image/svg+xml").documentElement;this.shopLogo=n,this.isCTA?t=Hr({translate:e.translate,logoElement:n,setAriaHidden:!1}):(t=document.createElement("div"),t.appendChild(n)),t.classList.add("button-content"),this.shopPromiseEligible&&!this.shopPromiseProductPageContent&&(this.shopPromiseProductPageContent=document.createElement("shop-promise-product-page-content"),this.shopPromiseProductPageContent.setTranslations(e),this.shopPromiseProductPageContent.setAttribute("access-token",this.accessToken||""),t.appendChild(this.shopPromiseProductPageContent));const a=this.getAttribute("personalized")==="true",i=()=>{const o=this.iframeContent,s=this.iframeRenderEligibility,l=s?.shouldRender()||!1;if(!o){l&&this.createAndAttachIframe();return}if(!l){if(o.hasPersonalizationOccurred()&&s?.soldOut&&!s?.locked){o.style.display="";return}o.style.display="none",s?.locked?o.resetToOriginalState():o.stopPendingAnimation();return}o.style.display="",this.inView&&o.triggerAnimation()};this.iframeRenderEligibility=new wh({element:this.button,isCTA:this.isCTA,onFormStateChange:i,personalized:a,shopPromiseEligible:this.shopPromiseEligible,shopPromiseProductPageContent:this.shopPromiseProductPageContent}),this.buttonContentDiv=t,this.button.appendChild(t)}
133createAndAttachIframe(){!this.buttonContentDiv||this.iframeContent||(this.iframeContent=document.createElement("shop-pay-iframe-content"),this.iframeContent.setShopLogo(this.shopLogo),this.iframeContent.setDisabled(this.disabled),this.shopLogo.insertAdjacentElement("afterend",this.iframeContent),this.inView&&this.iframeContent.triggerAnimation())}handleIframeRenderLogic(){if(!this.iframeRenderEligibility)return;const t=this.iframeRenderEligibility.shouldRender();if(!this.iframeContent&&t){this.createAndAttachIframe();return}this.iframeContent&&(this.iframeContent.style.display=t?"":"none",t&&this.inView?this.iframeContent.triggerAnimation():t||this.iframeContent.stopPendingAnimation())}getShopPayBehavior(){return this.pageType===S.ProductPage?"force_shop_pay_product":this.pageType===S.CartPage?"force_shop_pay_cart":"force_shop_pay"}async handleClick(t){if(t.preventDefault(),this.disabled||!this.button||this.button.getAttribute("disabled"))return;this.disabled=!0,ct(this.name,this.pageType);const[e,r]=await Promise.all([this.i18n,this.dataSource]);try{const{decelerationReason:n,cart:a,customValidationError:i,unrecoverableError:o}=await dt({element:this,instrumentName:m.ShopPay,dataSource:r});if(o){c.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),c.log({body:"Unrecoverable error detected in Shop Pay Button click",attributes:{pageType:this.pageType,error:o}}),At(e,o);return}if(i){c.log({body:"Custom validation error detected in Shop Pay Button click",attributes:{pageType:this.pageType,errorCode:i.code,errorMessage:i.message}}),c.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),Et(e,i.message);return}if(n){c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),N({checkoutUrl:a?.checkoutUrl??"",instrumentName:this.name,reason:n});return}c.sheetClicked({instrument:this.name,result:"success"}),et(a?.checkoutUrl??"",this.getShopPayBehavior())}catch(n){g.notify(new vo(`An error occurred when attempting to create a cart using the Shop Pay Button. Details: ${n}`,{cause:n})),c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in Shop Pay sheet clicked",attributes:{error:String(n),location:"handleClick"}}),yt(e)}}async render(){const t=this.getOrCreateShadowRoot();if(t.innerHTML)return;this.button||(this.button=document.createElement("gravity-button"));const e=document.createElement("style");e.innerHTML=[ch,lh].join(`
134`),t.appendChild(e),await this.addButtonContent(),this.disabled&&this.button.setAttribute("disabled",""),this.button.classList.add(_t.BUTTON),this.button.onclick=r=>this.handleClick(r),t.appendChild(this.button),this.ensureLightDOMIsNotEmpty(),this.handleIframeRenderLogic(),this.onRendered()}};Z("shop-promise-product-page-content",mh),Z("shop-pay-iframe-content",yh);var vo=class extends Error{};vo.prototype.name="ShopPayButtonError";var So=class extends ht{static walletName(){return"shop_pay"}constructor(t){super(t)}getWebComponentName(){return"shop-pay-wallet-button"}getWebComponentClass(){return _h}getInstrumentName(){return m.ShopPay}async createWebComponent(t){const e=await super.createWebComponent(t);return this.walletParams?.personalized&&e.setAttribute("personalized","true"),e}async loadWalletSDK(){await this.loadLogo()}getLoadEligibility(){return{eligible:!0}}async loadLogo(){await Ot({svg:"shop-logo.svg",instrumentName:m.ShopPay})}};Vr([$r("Shop Pay")],So.prototype,"getLoadEligibility",null);var Eh="dialog#scrim{color:#fff;background:#0009;border:none;justify-content:center;align-items:center;width:100%;max-width:100%;height:100%;max-height:100%;margin:0;padding:0;display:flex;position:fixed;inset:0;overflow:hidden}#content{box-sizing:border-box;text-align:center;flex-direction:column;align-items:center;gap:20px;width:100%;max-width:393px;padding:0 21px;display:flex}#message{margin:0;font-family:inherit;font-size:16px;line-height:1.5}#cancel-button{color:inherit;cursor:pointer;background:0 0;border:none;padding:0;font-family:inherit;font-size:17px;line-height:1.5;text-decoration:underline}#cancel-button:focus-visible{outline-offset:2px;border-radius:2px;outline:2px solid #fff}",Po=class extends HTMLElement{onCancel;originalFocus=null;returnFocusTo=null;originalStyle={position:"",overflow:"",top:""};scrollPosition=0;connectedCallback(){this.shadowRoot||this.attachShadow({mode:"open"}),this.originalFocus=this.returnFocusTo??document.activeElement,this.render(),this.applyScrollLock();const t=this.shadowRoot,e=document.createElement("style");e.textContent=Eh,t.appendChild(e);const r=t.getElementById("cancel-button");r||g.leaveBreadcrumb("Google Pay in-progress scrim: cancel button not found after render",{hasDialog:!!t.getElementById("scrim")},"error"),r?.addEventListener("click",this.handleCancelClick);const n=t.getElementById("scrim");if(n){n.addEventListener("cancel",this.handleDialogCancel),n.addEventListener("close",this.handleDialogClose);try{n.setAttribute("aria-modal","true"),n.showModal()}catch{n.setAttribute("open",""),document.addEventListener("keydown",this.handleEscapeKey),this.trapFocus(n)}}else g.leaveBreadcrumb("Google Pay in-progress scrim: dialog element not found after render",{hasCancelButton:!!r},"error");r?.focus()}disconnectedCallback(){document.removeEventListener("keydown",this.handleEscapeKey),this.removeScrollLock()}dismiss=()=>{this.removeScrollLock(),this.isConnected&&this.remove();const t=this.onCancel;this.onCancel=void 0,t?.(),this.restoreFocus()};handleCancelClick=()=>{this.dismiss()};handleDialogCancel=t=>{t.preventDefault(),this.dismiss()};handleDialogClose=()=>{this.dismiss()};handleEscapeKey=t=>{t.key==="Escape"&&(t.preventDefault(),this.dismiss())};trapFocus(t){const e=Array.from(t.querySelectorAll("a[href], button"));if(e.length===0)return;const r=e[0],n=e[e.length-1],a=this.shadowRoot;t.addEventListener("keydown",i=>{i.key==="Tab"&&(i.shiftKey?a.activeElement===r&&(i.preventDefault(),n.focus()):a.activeElement===n&&(i.preventDefault(),r.focus()))})}render(){const t=this.getAttribute("message")??"",e=this.getAttribute("cancel-label")??"Cancel",r=document.createElement("dialog");r.id="scrim",r.setAttribute("role","alertdialog"),r.setAttribute("aria-labelledby","message");const n=document.createElement("div");n.id="content";const a=document.createElement("p");a.id="message",a.textContent=t;
134const i=document.createElement("button");i.type="button",i.id="cancel-button",i.textContent=e,n.append(a,i),r.appendChild(n);const o=this.shadowRoot;for(;o.firstChild;)o.removeChild(o.firstChild);o.appendChild(r)}applyScrollLock(){this.originalStyle={position:document.body.style.position,overflow:document.body.style.overflow,top:document.body.style.top},document.body.style.overflow="hidden"}removeScrollLock(){document.body.style.overflow=this.originalStyle?.overflow??""}restoreFocus(){this.originalFocus&&"focus"in this.originalFocus&&typeof this.originalFocus.focus=="function"&&this.originalFocus.focus()}},Re="google-pay-in-progress-scrim";function Ah({i18n:t,onCancel:e,returnFocusTo:r}){Ch();const n=document.createElement(Re);return Lt(n,{"data-testid":Re,message:t.translate("google_pay_in_progress_scrim.continue_purchase",{wallet:t.translate("brand.google_pay")}),"cancel-label":t.translate("google_pay_in_progress_scrim.cancel")}),e&&(n.onCancel=e),n.returnFocusTo=r??null,document.body.appendChild(n),n}function ka(){document.querySelectorAll("gpay-graypane").forEach(t=>t.remove())}function Ch(){const t=document.querySelector(Re);t instanceof Po?t.dismiss():t&&t.remove()}Z(Re,Po);var vh=".button{border:none;justify-content:center;align-items:center;width:100%;display:flex;&:hover:not(:disabled){filter:brightness(92%);cursor:pointer}&:disabled{opacity:.5;cursor:not-allowed}&:focus-visible{outline:none;box-shadow:inset 0 0 0 2px #1773b0,inset 0 0 0 3px #f8f8f8!important}}.logo-only>svg{width:50px}.dark{color:#fff;background:#000}.light{color:#000;background:#fff;outline:1px solid #3c4043}@media (forced-colors:active){.light{outline:none}}@media (prefers-contrast:high),(forced-colors:active){.button:focus-visible{outline-offset:.1rem;outline:.2rem solid}}.content{white-space:pre;justify-content:center;align-items:center;display:flex}";function er({cart:t,i18n:e,transactionId:r}){const n=eo(t),a={label:e.translate("order_summary.subtotal"),type:"SUBTOTAL",price:it(n.amount)},i=Xn({deliveryGroups:t.deliveryGroups,i18n:e}).map(d=>Sh({lineItem:d,type:"LINE_ITEM"})),o=Ph(t,e),s=[...un(t.lineItems,(d,u)=>({label:d,type:"LINE_ITEM",price:u})),a,...i,...o];if(t.totalDutyAmount){const d={label:e.translate("order_summary.duties"),type:"LINE_ITEM",price:it(t.totalDutyAmount.amount)};s.push(d)}if(t.totalTaxAmount){const d={label:e.translate("order_summary.taxes"),t
134ype:"TAX",price:it(t.totalTaxAmount.amount)};s.push(d)}const l={totalPrice:t.totalAmount.amount,currencyCode:t.totalAmount.currencyCode,totalPriceStatus:"ESTIMATED",totalPriceLabel:e.translate("order_summary.total"),displayItems:s};return r&&(l.transactionId=r),l}function Sh({lineItem:t,type:e,status:r="FINAL"}){return{label:t.label,type:e,price:t.amount,status:r}}function Ph(t,e){let r;if(Q.enabled(Sn)){const{product:n,order:a,shipping:i}=Zn(t.discountApplications);r=[...n,...a,...i]}else r=[...t.lineItems.flatMap(n=>n.discountAllocations),...t.discountAllocations];return r.map(n=>{const a=n.title??n.code,i="totalAllocatedAmount"in n?n.totalAllocatedAmount.amount:Number(n.discountedAmount.amount);return{label:a??e.translate("order_summary.discount"),type:"LINE_ITEM",price:`-${it(i)}`}})}function Ih(t=8){const e=Math.ceil(t/2),r=new Uint8Array(e);return crypto.getRandomValues(r),Array.from(r,n=>n.toString(16).padStart(2,"0")).join("").slice(0,t)}function kh(){try{const t=window.ShopifyAnalytics?.lib?.trekkie?.defaultAttributes?.microSessionId;return t?`pw-${t}-${Ih()}`:void 0}catch{return}}var Io=["PAYMENT_AUTHORIZATION"],Th=Io.concat(["SHIPPING_ADDRESS","SHIPPING_OPTION"]),Dh=["PAN_ONLY"];function Rh({walletParams:t,isShippingRequired:e,hasSellingPlan:r,i18n:n,buyerCurrency:a,authJwt:i,transactionId:o}){const s=r,l={totalPrice:"0.01",currencyCode:a,totalPriceStatus:"ESTIMATED",totalPriceLabel:n.translate("order_summary.total"),displayItems:[{label:n.translate("order_summary.subtotal"),type:"SUBTOTAL",price:"0.01"}],...s&&{checkoutOption:"CONTINUE_TO_REVIEW"}};o&&(l.transactionId=o);const d={...t.paymentData,shippingAddressRequired:e,shippingOptionRequired:e,transactionInfo:l};return d.merchantInfo.authJwt=i,e||delete d.shippingAddressParameters,d.callbackIntents=e?Th:Io,r&&Nh(d),d}function Nh(t){t.allowedPaymentMethods.forEach(e=>{e.parameters.allowedAuthMethods=e.parameters.allowedAuthMethods.filter(r=>Dh.includes(r))})}var Oh=class extends Jn{i18n;brandName;completionResult;constructor(t){super(),this.i18n=t,this.brandName=this.i18n.translate("brand.google_pay"),this.completionResult=void 0}mapMutationResultToPaymentSheetAction({result:t,checkoutUrl:e,requestType:r,shippingCountryCode:n,shippingZip:a,shippingProvince:i,shippingCity:o,billingCountryCode:s,billingZip:l,billingProvince:d,billingCity:u}){const h=this.mapCustomValidationFunctionErrorToAction(t.errors);if(h)return h;const p=this.getErrorActions({checkoutUrl:e,requestType:r,shippingCountryCode:n,shippingZip:a,shippingProvince:i,shippingCity:o,billingCountryCode:s,billingZip:l,billingProvince:d,billingCity:u}),y=t.errors,_=this.getUnhandledErrors(y,p);_.forEach(T=>{g.notify(new Te(`[${m.GooglePay}] mutation result error not handled: ${Pt(T)}`,{groupingHash:`UnhandledActionError:${m.GooglePay}:${Pt(T)}`}))});const{firstPaymentSheetAction:v}=this.getMergedPaymentSheetAction({result:t,errorActions:p});return v||(_.length>0?{action:"abort"}:{action:"update",errors:[]})}mapCompletionResultToPaymentSheetAction({result:t,checkoutUrl:e,requestType:r,shippingCountryCode:n,shippingZip:a,shippingProvince:i,shippingCity:o,billingCountryCode:s,billingZip:l,billingProvince:d,billingCity:u}){if(!t.data)throw new Ja(m.GooglePay);switch(this.completionResult=t,t.data.__typename){case"SubmitSuccess":return{action:"complete",redirectUrl:t.data.redirectUrl};case"SubmitAlreadyAccepted":case"SubmitThrottled":case"SubmitFailed":{const h=this.mapCustomValidationFunctionErrorToAction(t.errors);if(h)return h;const p=this.getErrorActions({checkoutUrl:e,requestType:r,shippingCountryCode:n,shippingZip:a,shippingProvince:i,shippingCity:o,billingCountryCode:s,billingZip:l,billingProvince:d,billingCity:u}),y=t.errors;this.getUnhandledErrors(y,p).forEach(v=>{g.notify(new Te(`[${m.GooglePay}] completion result error not handled: ${Pt(v)}`,{groupingHash:`UnhandledActionError:${m.GooglePay}:${Pt(v)}`}))});const{prioritizedPaymentSheetAction:_}=this.getMergedPaymentSheetAction({result:t,errorActions:p});return _||(X(this.brandName,this.i18n),{action:"abort"})}default:throw new Error(`[${m.GooglePay}] unknown completion result type: ${t.data.__typename}`)}}getErrorActions({checkoutUrl:t,requestType:e,shippingCountryCode:r,shippingZip:n,shippingProvince:a,shippingCity:i,billingCountryCode:o,billingZip:s,billingProvince:l,billingCity:d}){const u=(h,p)=>()=>{const y=p.startsWith("billingAddress");c.addressFieldError({instrument:m.GooglePay,errorCode:h,errorField:p,countryCode:y?o:r,zip:y?s:n,province:y?l:a,city:y?d:i})};return[{matchers:[we],generateAction:()=>this.decelerateOrAbort({reason:"captcha_required",instrumentName:m.GooglePay,errorOrWarning:we.code,checkoutUrl:t,requestType:e})},{matchers:[Ee],generateAction:()=>this.decelerateOrAbort({reason:"invalid_language",instrumentName:m.GooglePay,errorOrWarning:Ee.code,checkoutUrl:t,requestType:e})},{matchers:[Ae],generateAction:()=>this.decelerateOrAbort({reason:"invalid_country",instrumentName:m.GooglePay,errorOrWarning:Ae.code,checkoutUrl:t,requestType:e})},{matchers:[Ce],generateAction:()=>this.decelerateOrAbort({reason:"missing_cart_id",instrumentName:m.GooglePay,errorOrWarning:Ce.code,checkoutUrl:t,requestType:e})},{matchers:[Se],generateAction:()=>this.decelerateOrAbort({reason:"redirect_to_checkout_required",instrumentName:m.GooglePay,errorOrWarning:Se.code,checkoutUrl:t,requestType:e})},{matchers:Or,generateAction:()=>this.decelerateOrAbort({reason:"dynamic_tax",instrumentName:m.GooglePay,errorOrWarning:"TAX_NEW_TAX_MUST_BE_ACCEPTED",checkoutUrl:t,requestType:e})},{matchers:[Pe],generateAction:()=>this.decelerateOrAbort({reason:"generic_error",instrumentName:m.GooglePay,errorOrWarning:Pe.code,checkoutUrl:t,requestType:e})},{matchers:[ve],generateAction:()=>this.decelerateOrAbort({reason:"unsupported_google_pay_payment_method",instrumentName:m.GooglePay,errorOrWarning:ve.code,checkoutUrl:t,requestType:e})},{matchers:Ln,generateAction:()=>this.decelerateOrAbort({reason:"invalid_payment_amount",instrumentName:m.GooglePay,errorOrWarning:"INVALID_PAYMENT",checkoutUrl:t,requestType:e})},{matchers:[be],generateAction:()=>this.decelerateOrAbort({reason:"custom_validation",instrumentName:m.GooglePay,errorOrWarning:be.code,checkoutUrl:t,requestType:e})},{matchers:[sr],generateAction:()=>this.decelerateOrAbort({reason:"discount_not_applicable",instrumentName:m.GooglePay,errorOrWarning:sr.code,checkoutUrl:t,requestType:e})},{matchers:_c,generateAction:()=>({action:"abort",effects:[()=>X(this.brandName,this.i18n)]})},{matchers:Lr,generateAction:()=>({action:"abort",effects:[()=>st(this.i18n)]})},{matchers:xn,generateAction:()=>this.decelerateOrAbort({reason:"not_enough_stock",instrumentName:m.GooglePay,errorOrWarning:"MERCHANDISE_NOT_ENOUGH_STOCK",checkoutUrl:t,requestType:e})},{matchers:On,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_UNSERVICEABLE",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.shipping_address")}]})}
134,{matchers:f.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.postal_code")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.zip")]})},{matchers:[Tc],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_OPTION_INVALID",intent:"SHIPPING_OPTION",message:this.i18n.translate("errors.missing.shipping_option")}]})},{matchers:Zt.invalid,generateAction:()=>({action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.email")}]})},{matchers:Zt.required,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.email")}]})},{matchers:f.required.address2,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.address2")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.address2")]})},{matchers:f.invalid.address2,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.address2")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.address2")]})},{matchers:f.required.city,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.city")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.city")]})},{matchers:f.invalid.city,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.city")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.city")]})},{matchers:f.required.province,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.zone")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.province")]})},{matchers:f.invalid.province,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.zone")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.province")]})},{matchers:f.required.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.postal_code")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.zip")]})},{matchers:f.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.postal_code")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.zip")]})},{matchers:f.required.phoneNumber,generateAction:()=>({action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.phone")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.phone")]})},{matchers:f.invalid.phoneNumber,generateAction:()=>({action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.phone")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.phone")]})},{matchers:f.invalid.country,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.country")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.country")]})},{matchers:f.required.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.first_name")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.firstName")]})}
134,{matchers:f.invalid.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.first_name")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.firstName")]})},{matchers:f.required.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.last_name")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.lastName")]})},{matchers:f.invalid.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.last_name")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.lastName")]})},{matchers:f.required.address1,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.address1")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.address1")]})},{matchers:f.invalid.address1,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.address1")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.address1")]})},{matchers:f.emojis.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.last_name")}]})},{matchers:f.emojis.city,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.city")}]})},{matchers:f.emojis.address1,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.address1")}]})},{matchers:f.emojis.address2,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.address2")}]})},{matchers:f.emojis.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.postal_code")}]})},{matchers:f.tooLong.address1,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.address1")}]})},{matchers:f.tooLong.address2,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.address2")}]})},{matchers:f.tooLong.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.first_name")}]})},{matchers:f.tooLong.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.last_name")}]})},{matchers:f.tooLong.city,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.city")}]})},{matchers:f.containsUrl.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.url.first_name")}]})},{matchers:f.containsUrl.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.url.last_name")}]})},{matchers:f.htmlTags.address1,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.address1")}]})},{matchers:f.htmlTags.address2,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.address2")}]})},{matchers:f.htmlTags.city,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.city")}]})},{matchers:f.htmlTags.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.first_name")}]})},{matchers:f.htmlTags.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.last_name")}]})}
134,{matchers:b.invalid.generic,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.billing_address")}],effects:[u("INVALID_PAYMENT","billingAddress")]})},{matchers:[_e],generateAction:()=>this.decelerateOrAbort({reason:"localization_extension_field_error",instrumentName:m.GooglePay,errorOrWarning:_e.code,checkoutUrl:t,requestType:e})},{matchers:b.required.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.first_name")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.firstName")]})},{matchers:b.required.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.last_name")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.lastName")]})},{matchers:b.required.address1,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.address1")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.address1")]})},{matchers:b.required.address2,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.address2")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.address2")]})},{matchers:b.required.city,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.city")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.city")]})},{matchers:b.required.phoneNumber,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.phone")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.phone")]})},{matchers:b.required.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.postal_code")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.zip")]})},{matchers:b.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.postal_code")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.zip")]})},{matchers:b.required.province,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.zone")}],effects:[u("ADDRESS_FIELD_IS_REQUIRED","billingAddress.province")]})},{matchers:b.emojis.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.first_name")}]})},{matchers:b.htmlTags.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.html_tags.first_name")}]})},{matchers:b.invalid.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.first_name")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.firstName")]})},{matchers:b.emojis.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.last_name")}]})},{matchers:b.htmlTags.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.html_tags.last_name")}]})},{matchers:b.invalid.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.last_name")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.lastName")]})},{matchers:b.emojis.address1,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.address1")}]})},{matchers:b.htmlTags.address1,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.html_tags.address1")}]})}
134,{matchers:b.invalid.address1,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.address1")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.address1")]})},{matchers:b.emojis.address2,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.address2")}]})},{matchers:b.htmlTags.address2,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.html_tags.address2")}]})},{matchers:b.invalid.address2,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.address2")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.address2")]})},{matchers:b.emojis.city,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.city")}]})},{matchers:b.htmlTags.city,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.html_tags.city")}]})},{matchers:b.invalid.city,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.city")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.city")]})},{matchers:b.emojis.phoneNumber,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.phone")}]})},{matchers:b.invalid.phoneNumber,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.phone")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.phone")]})},{matchers:b.emojis.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.postal_code")}]})},{matchers:b.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.postal_code")}],effects:[u("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.zip")]})}]}mapCustomValidationFunctionErrorToAction(t){const e=kr(t);return e?(Tr(this.i18n.translate("error_dialogs.wallet.title",{wallet:this.brandName}),e.message),{action:"abort"}):null}};function Lh({deliveryGroups:t,i18n:e}){const r=Pd(Yn({deliveryGroups:t}),e),n=r.map(({handle:i,title:o,description:s})=>({id:i,label:o??"",description:s})),a=t.map(({selectedDeliveryOption:i})=>i?.handle).join(",");return{shippingOptions:n,defaultSelectedOptionId:r.find(({handle:i})=>i===a)?.handle}}function rr(t){const e=t.iso3166AdministrativeArea||void 0,r=t.countryCode==="AE"?t.administrativeArea:t.locality;let n,a;if(t.name){const[i,...o]=(t.name||"").split(" ");o.length===0?a=i:a=o.join(" "),n=i}return{firstName:n,lastName:a,address1:t.address1,address2:t.address2,city:r,province:e,country:t.countryCode,phone:t.phoneNumber,zip:t.postalCode}}var br=class extends Error{};br.prototype.name="GooglePayError";function ko(t){const e=t.auth;if(!(Array.isArray(e)&&e.length>0))return{result:"error",reason:"invalidAuthParams"};const r=jt();for(const n of e)if(r<n.expiresAt*1e3)return{result:"success",jwt:n.jwt};return{result:"error",reason:"authJwtExpired"}}var xh=["https://checkout.pci.shopifyinc.com/sessions","https://checkout.pci.shopifyinc.ninja/sessions"],bt=class extends Error{#t;#e;constructor(t,e,r){super(t),this.#t=e,this.#e=r}get statusCode(){return this.#t}get responseBody(){return this.#e}};bt.prototype.name="CardsinkError";function Mh(t){if(!xh.includes(t))throw new bt(`Untrusted cardsink url: ${t}`)}async function zh({cardsinkUrl:t,payload:e,clientIdentificationJwt:r,abortSignal:n}){Mh(t);const a={"Content-Type":"application/json"};r&&(a["Shopify-Identification-Signature"]=r);let i;try{i=await fetch(t,{method:"POST",headers:a,body:JSON.stringify(e),signal:n})}catch(s){throw new bt(`Network error while calling Cardsink: ${s instanceof Error?s.message:String(s)}`)}if(!i.ok){const s=await i.text().catch(()=>"Unable to read response body");throw new bt(`Cardsink request failed with status ${i.status}`,i.status,s)}let o;try{o=await i.json()}catch(s){throw new bt(`Failed to parse Cardsink response: ${s instanceof Error?s.message:String(s)}`,i.status)}return o}var ar=1,Fh=500;async function Uh(t,e,r){let n="";for(let a=0;a<=ar;a++)try{const i=await zh({cardsinkUrl:t.cardsinkUrl,payload:e,clientIdentificationJwt:t.callerIdentificationJwt,abortSignal:r});return c.cardsinkDepositResult({result:"success",attempt:a}),{sessionId:i.id}}catch(i){if(n=i instanceof bt?i.message:"Cardsink deposit failed with unexpected error",a<ar){if(r?.aborted)break;await new Promise(o=>setTimeout(o,Fh))}}return c.cardsinkDepositResult({result:r?.aborted?"cancelled":"failed",error:n,attempt:ar}),{error:n}}var Bh=27e3,Ta="Google Pay Timeout",Gh=class{name=m.GooglePay;walletParams;cart=null;isShippingRequired;hasSellingPlan;dataSource;button;paymentsClient;i18n;actionGenerator;cartClient;initialBuyerCurrency;cardsinkUrl;cardsinkCallerIdentificationJwt;dismissLoadingScrim;#t=kh();get transactionId(){return this.#t}terminalCartCreationError;#e;#r;#n;constructor({walletParams:t,isShippingRequired:e,hasSellingPlan:r,dataSource:n,button:a,i18n:i,cartClient:o,buyerCurrency:s,abortController:l,cardsinkUrl:d,cardsinkCallerIdentificationJwt:u}){this.walletParams=t,this.isShippingRequired=e,this.hasSellingPlan=r,this.dataSource=n,this.button=a,this.i18n=i,this.cartClient=o,this.initialBuyerCurrency=s,this.cardsinkUrl=d,this.cardsinkCallerIdentificationJwt=u,this.#e=t.customerAccountEmail,this.#r=l;const h=ko(this.walletParams);if(h.result==="error")throw g.leaveBreadcrumb("Google Pay Invalid AuthJwt detected on click",{reason:h.reason,walletParams:this.walletParams},"error"),new br(h.reason);this.#n=h.jwt;const p={environment:this.walletParams.environment,merchantInfo:{...this.walletParams.paymentData.merchantInfo,authJwt:this.#n},paymentDataCallbacks:{onPaymentDataChanged:this.isShippingRequired?this.onPaymentDataChanged:void 0,onPaymentAuthorized:this.onPaymentAuthorized}};this.paymentsClient=new window.google.payments.api.PaymentsClient(p),this.actionGenerator=new Oh(this.i18n)}async handleClick(){if(!this.isShippingRequired)throw new W("Google Pay checkout started for digital cart");const t=Rh({walletParams:this.walletParams,isShippingRequired:this.isShippingRequired,hasSellingPlan:this.hasSellingPlan,i18n:this.i18n,buyerCurrency:this.initialBuyerCurrency,authJwt:this.#n,transactionId:this.transactionId});await this.paymentsClient.loadPaymentData(t)}onPaymentDataChanged=async t=>{const{callbackTrigger:e,shippingAddress:r,shippingOptionData:n}=t,{translate:a}=this.i18n;switch(g.leaveBreadcrumb("Google Pay onPaymentDataChanged",{callbackTrigger:e},"log"),e){case"INITIALIZE":{if(!this.cart)try{const{cart:o,customValidationError:s,decelerationReason:l,unrecoverableError:d}=await dt({element:this.button,instrumentName:m.GooglePay,dataSource:this.dataSource,isShippingRequired:this.isShippingRequired});if(s||d)return c.sheetClicked({instrument:this.name,result:"rejected",reason:s?"custom_validation_error":"unrecoverable_error"}),this.terminalCartCreationError=s?s.message:Hh(this.i18n,d),this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:this.terminalCartCreationError,intent:"SHIPPING_ADDRESS"}});if(this.cart=o,this.#r?.signal?.aborted)return this.showPaymentDataRequestError({error:{intent:"SHIPPING_ADDRESS",reason:"OTHER_ERROR",message:""}});if(l)return c.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),N({checkoutUrl:o?.checkoutUrl??"",instrumentName:this.name,reason:l,stage:"onValidateMerchant::createCart"}),this.showPaymentDataRequestError({error:{intent:"SHIPPING_ADDRESS",reason:"OTHER_ERROR",message:""}});c.sheetClicked({instrument:this.name,result:"success"})}catch(o){return c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),this.logTelemetry("Unhandled error detected in Google Pay sheet clicked",{error:String(o),location:"onPaymentDataChanged_INITIALIZE"}),this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"})}let i=!1;if(r)try{return await this.handleShippingAddressChange(this.cart.id,r)}catch{i=!0}return{newTransactionInfo:er({cart:this.cart,i18n:this.i18n,transactionId:this.transactionId}),...i?this.showPaymentDataRequestError():{}}}case"SHIPPING_ADDRESS":return this.terminalCartCreationError?this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:this.terminalCartCreationError,intent:"SHIPPING_ADDRESS"}}):this.cart?r?this.handleShippingAddressChange(this.cart.id,r):{newTransactionInfo:er({cart:this.cart,i18n:this.i18n,transactionId:this.transactionId})}:this.showPaymentDataRequestError({intent:e});case"SHIPPING_OPTION":{if(!this.cart)return this.showPaymentDataRequestError({intent:e});
134if(!n||!n.id)return{error:{reason:"SHIPPING_OPTION_INVALID",message:a("shipping_methods.choose_delivery_strategy"),intent:"SHIPPING_OPTION"}};const i=await this.handleDeliveryOptionChange(n.id.split(","));return i.data?(this.cart=i.data,i.abortReason==="out_of_stock"?this.showPaymentDataRequestError({error:{intent:"SHIPPING_OPTION",reason:"OTHER_ERROR",message:this.i18n.translate("error_dialogs.product.out_of_stock")}}):i.decelerationReason?(N({checkoutUrl:this.cart.checkoutUrl??"",instrumentName:this.name,reason:i.decelerationReason}),this.showPaymentDataRequestError({error:{intent:"SHIPPING_OPTION",reason:"OTHER_ERROR",message:""}})):this.handlePaymentDataRequestUpdate({result:i,intent:e,checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentDataChanged::updateCartDeliveryOptions",shippingCountryCode:r?.countryCode,shippingZip:r?.postalCode||void 0,shippingProvince:r?.iso3166AdministrativeArea||void 0,shippingCity:r?.locality||void 0})):this.showPaymentDataRequestError({intent:e})}default:return this.logException(`Payment data changed callback returned unexpected intent: ${e}`,{severity:"warning"}),this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"})}};onPaymentAuthorized=async t=>{if(this.dismissLoadingScrim?.(),c.authorizationAttempt(this.name),zt(L.AuthorizationLatency,this.name),!this.cart)return c.googlePayNullCartOnAuthorize(),this.handlePaymentAuthorizationError({reason:"null_cart_on_authorize"});const e=t.paymentMethodData.info?.billingAddress,r=t.shippingAddress,{signature:n,signedMessage:a,protocolVersion:i}=JSON.parse(t.paymentMethodData.tokenizationData.token);if(!e)return this.handlePaymentAuthorizationError({error:{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_AUTHORIZATION",message:this.i18n.translate("errors.invalid.billing_address")},reason:"missing_billing_address"});if(this.isShippingRequired&&!r)return this.handlePaymentAuthorizationError({error:{reason:"SHIPPING_ADDRESS_INVALID",intent:"PAYMENT_AUTHORIZATION",message:this.i18n.translate("errors.invalid.shipping_address")},reason:"missing_shipping_address"});const o=r?.postalCode||void 0,s=r?.iso3166AdministrativeArea||void 0,l=r?.locality||void 0,d=e?.postalCode||void 0,u=e?.iso3166AdministrativeArea||void 0,h=e?.locality||void 0,p=await Uh({cardsinkUrl:this.cardsinkUrl,callerIdentificationJwt:this.cardsinkCallerIdentificationJwt},{payment_data_source:"google-pay-ecv1",encrypted_payment_data:{protocol_version:i,signature:n,signed_message:a},name:e.name??""},this.#r?.signal);if(this.#r?.signal?.aborted)return this.handlePaymentAuthorizationError({reason:"cardsink_deposit_cancelled"});if(!("sessionId"in p))return g.notify(new bt(p.error),{severity:"warning"}),N({checkoutUrl:this.cart.checkoutUrl??"",instrumentName:this.name,reason:"cardsink_deposit_failed"}),{transactionState:"SUCCESS"};const{sessionId:y}=p,_=async()=>{const w=this.#e??t.email,P=this.isShippingRequired?{validateAddress:!0,streetAddress:rr(r)}:{};return await Tt({cartClient:this.cartClient,cartId:this.cart.id,instrumentName:this.name,emailAddress:w,abortSignal:this.#r?.signal,...P})},v=async()=>{const w=rr(e),P={billingAddress:w,sessionId:y,signature:"",signedMessage:"",protocolVersion:""};return await Gr({cartId:this.cart.id,totalAmount:this.cart.totalAmount,paymentMethod:{walletPaymentMethod:{googlePayWalletContent:P}},canUsePaymentMethodForFreeOrder:!1,billingAddress:w,cartClient:this.cartClient,instrumentName:this.name,hasSellingPlan:this.hasSellingPlan,abortSignal:this.#r?.signal})},T=setTimeout(()=>{this.#r?.abort(Ta)},Bh);try{const w=await _(),P=Gn({currentCart:w.data,previousCart:this.cart});w.data&&(this.cart=w.data);const k=this.handleIntermediatePaymentAuthorizationResult({result:w,checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentAuthorized::updateBuyerIdentity",shippingCountryCode:r?.countryCode,shippingZip:o,shippingProvince:s,shippingCity:l,billingCountryCode:e?.countryCode,billingZip:d,billingProvince:u,billingCity:h});if(k)return clearTimeout(T),k;const O=await v();P==="inc"&&(O.decelerationReason||="price_increased");const x=this.handleIntermediatePaymentAuthorizationResult({result:O,checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentAuthorized::updateCartPayment",shippingCountryCode:r?.countryCode,shippingZip:o,shippingProvince:s,shippingCity:l,billingCountryCode:e?.countryCode,billingZip:d,billingProvince:u,billingCity:h});if(x)return clearTimeout(T),x;
134if(clearTimeout(T),this.#r?.signal?.aborted)return this.handlePaymentAuthorizationError({reason:"aborted_before_completion"});if(this.hasSellingPlan)return N({checkoutUrl:this.cart.checkoutUrl??"",instrumentName:this.name,reason:"subscription_review_required_banner_less",forceLegacySplitShippingMode:!0}),{transactionState:"SUCCESS"};const U=await bo({cartId:this.cart.id,token:n,cartClient:this.cartClient,instrumentName:this.name});Qt({result:U,instrument:this.name});const M=this.actionGenerator.mapCompletionResultToPaymentSheetAction({result:U,checkoutUrl:U.data&&"checkoutUrl"in U.data&&U.data.checkoutUrl?U.data.checkoutUrl:this.cart.checkoutUrl,requestType:"completion",shippingCountryCode:r?.countryCode,shippingZip:o,shippingProvince:s,shippingCity:l,billingCountryCode:e?.countryCode,billingZip:d,billingProvince:u,billingCity:h});return this.handlePaymentAuthorizationResult(M)}catch(w){clearTimeout(T);const P=w instanceof Error?w.message:String(w);return P?.includes(Ta)?(this.logTelemetry("Google Pay onPaymentAuthorized timed out",{requestType:"onPaymentAuthorized"}),this.handlePaymentAuthorizationError({status:"timeout",reason:"timeout"})):(!(w instanceof Dt)&&!this.#r?.signal?.aborted&&(this.logTelemetry("Google Pay authorization exception",{error:P}),this.logException(P)),this.handlePaymentAuthorizationError({reason:"unhandled_exception"}))}};showPaymentDataRequestError({error:t,intent:e="SHIPPING_ADDRESS"}={}){return t?{error:t}:{error:{intent:e,reason:"OTHER_ERROR",message:this.i18n.translate("error_dialogs.wallet.generic_error",{wallet:this.i18n.translate("brand.google_pay")})}}}handlePaymentAuthorizationError({error:t,status:e="failed",reason:r}={}){return this.emitAuthorizationCompleteMetric(e),this.logTelemetry("Google Pay authorization failed",{status:e,...r&&{reason:r},...t&&{errorReason:t.reason,errorMessage:t.message,errorIntent:t.intent}}),{transactionState:"ERROR",...this.showPaymentDataRequestError({error:t,intent:"PAYMENT_AUTHORIZATION"})}}handlePaymentDataRequestUpdate({result:t,intent:e,checkoutUrl:r,requestType:n,shippingCountryCode:a,shippingZip:i,shippingProvince:o,shippingCity:s,billingCountryCode:l,billingZip:d,billingProvince:u,billingCity:h}){const p=this.actionGenerator.mapMutationResultToPaymentSheetAction({result:t,checkoutUrl:r,requestType:n,shippingCountryCode:a,shippingZip:i,shippingProvince:o,shippingCity:s,billingCountryCode:l,billingZip:d,billingProvince:u,billingCity:h});switch(p.effects?.forEach(y=>y()),p.action){case"update":{const y=p,{data:_,decelerationReason:v}=t;if(!_)return this.showPaymentDataRequestError({intent:e});if(v)return N({checkoutUrl:_.checkoutUrl,instrumentName:this.name,reason:v}),this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:"",intent:"OFFER"}});if(this.isShippingRequired&&_.deliveryGroups.length===0)return this.showPaymentDataRequestError({error:{reason:"SHIPPING_ADDRESS_INVALID",message:this.i18n.translate("errors.address_unserviceable",{shopName:this.walletParams.paymentData.merchantInfo.merchantName}),intent:"SHIPPING_ADDRESS"}});const T=this.isShippingRequired?Lh({deliveryGroups:_.deliveryGroups,i18n:this.i18n}):void 0;if(this.isShippingRequired&&_.deliveryGroups.length>0&&(T?.shippingOptions.length??0)===0){const w=_.deliveryGroups.reduce((P,k)=>P+(k.deliveryOptions?.length??0),0);this.logTelemetry("Google Pay resolved with no shipping options",{location:"handlePaymentDataRequestUpdate",intent:e,deliveryGroupCount:String(_.deliveryGroups.length),deliveryOptionCount:String(w),...a&&{destinationCountry:a},...o&&{destinationRegion:o}}),g.leaveBreadcrumb("Google Pay resolved with no shipping options",{deliveryGroupCount:_.deliveryGroups.length,deliveryOptionCount:w,intent:e,...this.transactionId&&{transactionId:this.transactionId},...a&&{destinationCountry:a},...o&&{destinationRegion:o}},"log")}return{newTransactionInfo:er({cart:_,i18n:this.i18n,transactionId:this.transactionId}),newShippingOptionParameters:T,error:y.errors?.[0]}}case"show_error":return{error:p.errors?.[0]};case"decelerate":return N({checkoutUrl:p.redirectUrl,instrumentName:this.name,reason:p.reason}),this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:"",intent:"OFFER"}});case"abort":return this.showPaymentDataRequestError({intent:e});default:return this.logException("Payment sheet update returned unexpected action (see request tab for details)",{metadata:{request:{action:p.action,intent:e}}}),this.showPaymentDataRequestError({intent:e})}}handleIntermediatePaymentAuthorizationResult({result:t,checkoutUrl:e,requestType:r,shippingCountryCode:n,shippingZip:a,shippingProvince:i,shippingCity:o,billingCountryCode:s,billingZip:l,billingProvince:d,billingCity:u}){if(Qt({result:t,instrument:this.name}),t.abortReason==="out_of_stock")return st(this.i18n),{transactionState:"SUCCESS"};if(t.decelerationReason)return N({checkoutUrl:t.data?.checkoutUrl??"",instrumentName:this.name,reason:t.decelerationReason}),{transactionState:"SUCCESS"};const h=this.actionGenerator.mapMutationResultToPaymentSheetAction({result:t,checkoutUrl:e,requestType:r,shippingCountryCode:n,shippingZip:a,shippingProvince:i,shippingCity:o,billingCountryCode:s,billingZip:l,billingProvince:d,billingCity:u});switch(h.effects?.forEach(p=>p()),h.action){case"show_error":return this.handlePaymentAuthorizationError({error:h.errors?.[0],reason:`${r}_show_error`});case"abort":return this.handlePaymentAuthorizationError({error:h.errors?.at(0),reason:`${r}_abort`});case"decelerate":return this.emitAuthorizationCompleteMetric("success"),N({checkoutUrl:h.redirectUrl,instrumentName:this.name,reason:h.reason}),{transactionState:"SUCCESS"};default:return}}handlePaymentAuthorizationResult=async t=>
134{switch(t.effects?.forEach(e=>e()),t.action){case"complete":return this.emitAuthorizationCompleteMetric("success"),et(t.redirectUrl),{transactionState:"SUCCESS"};case"show_error":return this.handlePaymentAuthorizationError({error:t.errors?.[0],reason:"completion_show_error"});case"decelerate":return N({checkoutUrl:t.redirectUrl,instrumentName:this.name,reason:t.reason}),this.emitAuthorizationCompleteMetric("failed"),this.logTelemetry("Google Pay authorization failed",{status:"failed",reason:"completion_decelerate"}),{transactionState:"SUCCESS"};default:return this.emitAuthorizationCompleteMetric("failed"),this.logTelemetry("Google Pay authorization failed",{status:"failed",reason:"completion_abort"}),{transactionState:"SUCCESS"}}};handleCurrencyChange(t,e){xr({currentCartTotal:e,initialBuyerCurrency:this.initialBuyerCurrency})&&N({checkoutUrl:t,instrumentName:this.name,reason:"currency_changed"})}async handleShippingAddressChange(t,e){let r=await Tt({cartClient:this.cartClient,cartId:t,streetAddress:e?rr(e):{},instrumentName:m.GooglePay,abortSignal:this.#r?.signal});if(!r.data)return this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"});if(this.cart=r.data,r.abortReason==="out_of_stock")return this.showPaymentDataRequestError({error:{intent:"SHIPPING_ADDRESS",reason:"OTHER_ERROR",message:this.i18n.translate("error_dialogs.product.out_of_stock")}});if(r.decelerationReason)return N({checkoutUrl:this.cart.checkoutUrl??"",instrumentName:this.name,reason:r.decelerationReason}),this.showPaymentDataRequestError({error:{intent:"SHIPPING_ADDRESS",reason:"OTHER_ERROR",message:""}});const n=this.cart.deliveryGroups.map(({selectedDeliveryOption:a,deliveryOptions:i})=>a?.handle&&a.deliveryMethodType!=="LOCAL"?a.handle:i.filter(({deliveryMethodType:o})=>o==="SHIPPING")[0]?.handle).filter(Boolean);if(n.length>0){if(r=await this.handleDeliveryOptionChange(n),!r.data)return this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"});this.cart=r.data}return this.handleCurrencyChange(this.cart.checkoutUrl,this.cart.totalAmount),this.handlePaymentDataRequestUpdate({result:r,intent:"SHIPPING_ADDRESS",checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentDataChanged::updateBuyerIdentity",shippingCountryCode:e?.countryCode,shippingZip:e?.postalCode||void 0,shippingProvince:e?.iso3166AdministrativeArea||void 0,shippingCity:e?.locality||void 0})}async handleDeliveryOptionChange(t){const e=wo({deliveryGroups:this.cart.deliveryGroups,instrumentName:m.GooglePay,selectedDeliveryOptionHandles:t});return await yo({cartClient:this.cartClient,cartId:this.cart.id,instrumentName:m.GooglePay,selectedDeliveryOptions:e,abortSignal:this.#r?.signal})}logTelemetry(t,e={}){c.log({body:t,attributes:{instrument:this.name,...this.transactionId&&{transactionId:this.transactionId},...e}})}logException(t,{severity:e,metadata:r}={}){g.notify(new br(t),{severity:e??"error",metadata:r})}emitAuthorizationCompleteMetric(t){c.authorizationComplete({instrument:this.name,measurement:j(L.AuthorizationLatency,this.name),result:t})}};function Hh(t,e){switch(e){case F.VariantRequiresSellingPlan:case F.SellingPlanNotApplicable:case F.InvalidQuantity:case F.MerchandiseIdInvalid:case F.IgnoredResponseError:case F.NoResponse:return t.translate("error_dialogs.checkout.generic_error");default:return t.translate("error_dialogs.checkout.generic_error")}}var $h={LIGHT:"light",DARK:"dark"};function Vh(){return/SamsungBrowser\//.test(navigator.userAgent)}var Wh=class extends ut{name=m.GooglePay;paymentsClient=null;button=null;static get observedAttributes(){return["disabled"]}attributeChangedCallback(t,e,r){super.attributeChangedCallback(t,e,r,this.button)}async connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}handleClick=async()=>{if(this.disabled)return;this.disabled=!0,ct(this.name,this.pageType);const t=wt("AbortController");let e=!1,r=null,n=!1;const a=()=>{r&&(r.onCancel=void 0,r.dismiss(),ka(),r=null)};try{await this.createPaymentsClient(t),e=!0,Vh()&&(r=Ah({i18n:await this.i18n,returnFocusTo:this.button,onCancel:()=>{n=!0,t?.abort("[Google Pay] User cancelled via Shopify scrim"),c.sheetCancelled(m.GooglePay),ka(),this.disabled=!1,r=null}}),this.paymentsClient.dismissLoadingScrim=a),await this.paymentsClient.handleClick()}catch(i){if(a(),n)return;if(this.disabled=!1,i.statusCode==="CANCELED"){t?.abort("[Google Pay] Payment sheet cancelled"),c.sheetCancelled(m.GooglePay);return}t?.abort("[Google Pay] Payment sheet failure"),this.expectedError(i)?c.sheetClicked({instrument:this.name,result:"failed",reason:"expected_error"}):g.notify(i),e||(c.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),c.log({body:"Unhandled error detected in Google Pay client creation",attributes:{error:String(i),location:"handleClick"}}));const o=await this.i18n,s=o.translate("brand.google_pay");X(s,o)}finally{a()}};async createPaymentsClient(t){this.paymentsClient=new Gh({walletParams:this.walletParams,isShippingRequired:this.isShippingRequired,hasSellingPlan:this.hasSellingPlan,dataSource:await this.dataSource,button:this,cartClient:await this.apiClient,i18n:await this.i18n,buyerCurrency:this.buyerCurrency,abortController:t,cardsinkUrl:this.walletParams.cardsinkUrl,cardsinkCallerIdentificationJwt:this.walletParams.cardsinkCallerIdentificationJwt})}async render(){const t=this.getOrCreateShadowRoot();if(this.button)return;await this.initializeShadowStyles(t,vh);const{translate:e}=await this.i18n,r=this.isCTA?e("buy_with_button_content",{wallet:e("brand.google_pay")}):e("brand.google_pay"),n=ze({label:r});this.disabled&&n.setAttribute("disabled",""),n.classList.add("button",_t.BUTTON,$h[this.buttonTheme]),n.onclick=this.handleClick,await this.renderButtonContent(n,e),this.button=n,t.appendChild(n),this.ensureLightDOMIsNotEmpty(),this.onRendered()}async renderButtonContent(t,e){const r=te({instrumentName:m.GooglePay,logoType:this.buttonTheme}),n=new DOMParser().parseFromString(r,"image/svg+xml").documentElement;if(t.style.font=window.getComputedStyle(this).font,this.isCTA){const a=Hr({translate:e,logoElement:n,setAriaHidden:!0});a.classList.add("content"),t.appendChild(a)}else t.classList.add("logo-only"),t.appendChild(n)}expectedError(t){const e=typeof t=="string"?t:t?.message;return e==="failed to open window"||e==="(0 , $jscomp.asyncExecutePromiseGeneratorProgram) is not a function"}},jh=class Vt extends ht{static googlePaySDKPromise;static walletName(){return"google_pay"}constructor(e){super(e)}getWebComponentName(){return"shopify-google-pay-button"}getInstrumentName(){return m.GooglePay}getWebComponentClass(){return Wh}async loadWalletSDK(){if(Vt.googlePaySDKPromise)return Vt.googlePaySDKPromise;const e=document.createElement("script");e.setAttribute("src",this.walletParams.sdkUrl);const r=new Promise((n,a)=>{e.onload=()=>n(),e.onerror=i=>{e.remove(),a(Ue("Google Pay",i))},document.body.appendChild(e)});return Vt.googlePaySDKPromise=Promise.all([r,this.loadLogos()]),Vt.googlePaySDKPromise}getLoadEligibility(){const e=ko(this.walletParams);switch(e.result){case"success":return{eligible:!0};case"error":return{eligible:!1,reason:e.reason}}}getPartnerSDKEligibility(){return{eligible:!0}}async loadLogos(){return Promise.all([this.loadGooglePayLogo(),this.loadGooglePayLogoDark()])}async loadGooglePayLogo(){await Ot({svg:"google-pay-logo.svg",instrumentName:m.GooglePay})}async loadGooglePayLogoDark(){await Ot({svg:"google-pay-logo-dark.svg",instrumentName:m.GooglePay,logoType:"DARK"})}},qh=new Map([nd,bd,Wr,jh,Ju,rh,So].map(t=>[t.walletName(),e=>new t(e)]));function Xt(t){if(!t)return null;const e=qh.get(t.name);return e?e(t):(console.debug(`Can't build wallet with name ${t.name}`),null)}function Yh(t){return t.map(e=>Xt(e)).filter(e=>e!=null)}var To="*{box-sizing:border-box}
134.wallet-button-fade-in{animation:.3s cubic-bezier(.1,.79,1,1) animation-fade-in}@keyframes animation-fade-in{0%{opacity:0}to{opacity:1}}button[aria-disabled=true]{opacity:.5;cursor:not-allowed}";function Kh({styleId:t,styles:e,cssFileName:r}){window.Shopify?.PaymentButton?.isStorefrontPortableWallets&&(Qh({styleId:t,styles:e,cssFileName:r})||Xh({styleId:t,styles:e}))}function Qh({styleId:t}){const e=document.querySelector(`style#${t}`),r=document.querySelector(`link#${t}`);return!!(e||r)}function Xh({styleId:t,styles:e}){const r=document.createElement("style");r.id=t,r.innerHTML=e,document.head.insertBefore(r,document.head.firstChild)}var K={buttonBlockSize:"--shopify-accelerated-checkout-button-block-size",buttonBorderRadius:"--shopify-accelerated-checkout-button-border-radius",buttonBoxShadow:"--shopify-accelerated-checkout-button-box-shadow",inlineAlignment:"--shopify-accelerated-checkout-inline-alignment"};function Da(t){let e=0,r=0,n=0;const a=t.split(/\s+/);for(let i=0;i<a.length;i++){const o=a[i];o!==">"&&(o.includes("#")&&(e+=(o.match(/#/g)||[]).length),o.includes(".")&&(r+=(o.match(/\./g)||[]).length),o.includes("[")&&(r+=(o.match(/\[/g)||[]).length),o.includes(":")&&(r+=(o.match(/:[^:]/g)||[]).length),/^[A-Za-z]/.test(o)&&(n+=1))}return[e,r,n]}function Jh(t,e){for(let r=0;r<3;r++)if(t[r]!==e[r])return e[r]-t[r];return 0}function Ra(t){return[...t].sort((e,r)=>Jh(Da(e.selector),Da(r.selector)))}var Zh=/\.cart__dynamic-checkout-buttons|\.dynamic-checkout-buttons\s*(>\s*)?li(?![a-zA-Z0-9_.:#-])/,tp=/\.cart__dynamic-checkout-buttons|\.dynamic-checkout-buttons\s*\[role="?button"?\](?![:\w-])/,ep=/\.additional-checkout-buttons\s*(?:div\s*)?\[role="?button"?\](?![:\w-])/,Do=/\[data-shopify-buttoncontainer\](?![:\w-])/,Ro=/.dynamic-checkout-buttons .shopify-payment-button__button/,rp=/(?!.*\.shopify-cleanslate)\.shopify-payment-button__button(?:--branded)?(?![\w-:.#>])/,ap=/\.(shopify-payment-button|shopify-payment-button__button|shopify-payment-button__button--branded)\s*\[role="?button"?\](?![:\w-])/,np=/(?:only\s+)?(?:screen\s+and\s+)?\((?:min|max)-(?:width|height):\s*\d+px\)/,op=[tp,Do,Zh,ep,Ro],ip=[rp,ap,Ro],sp=.001;function Na(t){return t.split(",").map(e=>e.trim())}function No(t){const e=t.pageType,r=e===S.ProductPage?ip:op,n=document.styleSheets;if(typeof n?.[Symbol.iterator]!="function")return"";const a=[...n].filter(lp),i=new Set;function o(U){for(const M of r){const H=U.match(M);if(H)return i.add(H[0]),!0}return!1}const s=[],l=[];a.forEach(U=>{try{for(const M of U.cssRules)if(M instanceof CSSMediaRule){const H=M;if(!np.test(H.conditionText))continue;for(const Ft of H.cssRules){if(!(Ft instanceof CSSStyleRule))continue;const oe=Na(Ft.selectorText);for(const qr of oe)o(qr)&&l.push({selector:qr,conditionText:H.conditionText,...za(Ft)})}}else if(M instanceof CSSStyleRule){const H=M,Ft=Na(H.selectorText);for(const oe of Ft)o(oe)&&s.push({selector:oe,...za(H)})}}catch(M){ge()("shopify-support-debug")&&(console.debug(`[shopify-support-debug] stylesheet origin: ${U.href}`),console.debug(M))}});const d=ge()("shopify-support-debug");d&&console.table(Array.from(i));const u=s.reverse(),h=l.reverse(),p=Ra(u),y=Ra(h),_={},v=Oa(e)?document.querySelector(".cart__blocks .button"):document.querySelector(".product-form__buttons .button");v&&(_.boxShadow=getComputedStyle(v,":before").boxShadow);for(const U of p){const M=["height","minHeight","borderRadius","marginTop"];Oa(e)&&U.selector.match(Do)&&M.push("justifyContent");for(const H of M)_[H]=hp({rule:U,property:H,currentPropertyValue:_[H]})}const{height:T,borderRadius:w,minHeight:P,marginTop:k,justifyContent:O,boxShadow:x}=_;return d&&console.table([{property:"height",value:T},{property:"borderRadius",value:w},{property:"minHeight",value:P},{property:"marginTop",value:k},{property:"justifyContent",value:O},{property:"boxShadow",value:x}]),e===S.ProductPage?Ma({styles:{height:T,minHeight:P,borderRadius:w,marginTop:k,boxShadow:x},mediaRules:y,element:t}):Ma({styles:{borderRadius:w,boxShadow:x,justifyContent:O},mediaRules:y,element:t})}function Oo({element:t,styles:e,debug:r=!1}){if(!e)return;mp(e,t,r);const n=`global-${t.tagName.toLowerCase()}-styles`;if(document.head.querySelector(`style#${n}`)==null){const a=document.createElement("style");a.id=n,a.innerHTML=e,document.head.appendChild(a)}}function lp(t){const e=t.ownerNode instanceof HTMLLinkElement&&(t.ownerNode.getAttribute("crossorigin")==="anonymous"||t.ownerNode.getAttribute("crossorigin")==="");return t.href==null||t.href.startsWith(window.location.origin)||e}function Oa(t){return t===S.CartPage||t===S.CartAjax}function La({height:t,minHeight:e}){let r=t,n=e;return(r?.includes(`var(${K.buttonBlockSize}`)||r==="auto")&&(r=null),(n?.includes(`var(${K.buttonBlockSize}`)||n==="auto")&&(n=null),r===n?r:n&&r?`max(${r},${n})`:r||n}function xa({existingProperties:t,mediaCondition:e,selector:r,styles:n}){const a={...n};t.forEach(i=>
134{delete a[i]});for(const[i,o]of Object.entries(a))o?.startsWith(`var(${i}`)&&delete a[i];for(const[i,o]of Object.entries(a))(o==null||o==="")&&delete a[i];return Object.keys(a).length===0?"":cp({mediaCondition:e,selector:r,styles:a})}function cp({mediaCondition:t,selector:e,styles:r}){let n=`${t?`@media ${t} { `:""}${e} {`;for(const[a,i]of Object.entries(r))i&&(n+=`
135  ${a}: ${i};`);return n+=`
136}`,t&&(n+="}"),n+=`
137`,n}function Ma({styles:t,element:e,mediaRules:r}){const{height:n,minHeight:a,borderRadius:i,marginTop:o,justifyContent:s,boxShadow:l}=t,d=e.tagName.toLowerCase(),u=getComputedStyle(e),h=new Set;for(const y of Object.values(K))u.getPropertyValue(y)&&h.add(y);let p=xa({existingProperties:h,selector:d,styles:{[K.buttonBlockSize]:La({height:n,minHeight:a}),[K.buttonBorderRadius]:i,[K.buttonBoxShadow]:l,[K.inlineAlignment]:s,"margin-top":o,display:o?"block":void 0}});return r.forEach(y=>{(y.height||y.minHeight||y.borderRadius||y.boxShadow||y.justifyContent||y.marginTop)&&(p+=xa({existingProperties:h,mediaCondition:y.conditionText,selector:d,styles:{[K.buttonBlockSize]:La({height:y.height,minHeight:y.minHeight}),[K.buttonBorderRadius]:y.borderRadius,[K.buttonBoxShadow]:y.boxShadow,[K.inlineAlignment]:y.justifyContent,"margin-top":y.marginTop,display:y.marginTop?"block":void 0}}))}),p.trim()}var dp=[["height"],["minHeight","min-height"],["borderRadius","border-radius"],["marginTop","margin-top"],["justifyContent","justify-content"]];function za(t){return dp.reduce((e,[r,n])=>(e[r]=up({rule:t,property:n??r}),e),{})}function up({rule:t,property:e}){const r=t.style.getPropertyValue(e);return r!==""&&t.style.getPropertyPriority(e)?`${r} !important`:r||null}function hp({rule:t,property:e,currentPropertyValue:r}){const n=t[e];return!r?.includes("!important")&&n?.includes("!important")?n:r??n}function pp(t){const e=/(--[\w-]+)\s*:/g;let r;const n={};for(;(r=e.exec(t))!==null;){const a=r[1];n[a]=(n[a]||0)+1}return{properties:n,mediaQueryCount:(t.match(/@media\s+([^{]+)/g)||[]).length,marginTopCount:(t.match(/margin-top\s*:/g)||[]).length}}function mp(t,e,r){const n=window.ShopifyAnalytics?.lib?.trekkie?.defaultAttributes?.themeId;if(n&&(r&&c.log({body:"Style backwards compatibility used",attributes:{themeId:`${n}`}}),Math.random()<sp)){const a=pp(t);for(const[i,o]of Object.entries(a.properties))c.styleBackwardsCompatibilityRules({rule:i,count:o,pageType:e.pageType});a.mediaQueryCount>0&&c.styleBackwardsCompatibilityRules({rule:"@media",count:a.mediaQueryCount,pageType:e.pageType}),a.marginTopCount>0&&c.styleBackwardsCompatibilityRules({rule:"margin-top",count:a.marginTopCount,pageType:e.pageType}),c.log({body:"Style backwards compatibility details",attributes:{themeId:`${n}`,pageType:e.pageType,stylesString:t.length>2e3?t.substring(0,2e3):t}})}}var gp=2e3,fp=()=>gp*Pr(),wr=class extends Error{};wr.prototype.name="AcceleratedCheckoutError";var yp=class xo extends zr{static instanceCount=0;instanceNumber=++xo.instanceCount;pageType=S.ProductPage;formObserver;dataSource;wrapper;shopPromiseEligible=!1;didInitiateRender=!1;didRecordWalletsLoadedFromFCP=!1;#t;static get observedAttributes(){return["access-token","disabled","has-selling-plan","requires-shipping"]}async connectedCallback(){super.connectedCallback();try{if(this.wrapper?.children?.length||this.didInitiateRender)return;if(!this.validateRenderingSurface()){this.clearUI();return}this.instanceNumber===1&&(Fr(this),c.initStarted(),Kh({styleId:"shopify-accelerated-checkout-styles",styles:qc,cssFileName:"AcceleratedCheckout.css"}),this.extractStyles()),this.shopPromiseEligible=dn();const e=Nt(L.ButtonDisplay,`dc:${this.instanceNumber}`);this.i18n=xe(),this.setupFormObserver(),this.didInitiateRender=!0;const r=await this.loadWallet(),n=r.getInstrumentName();this.apiClient=new Ge({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale}),this.dataSource=new pc(this,this.apiClient,n);const a=await this.getWebComponentInstance({wallet:r,instrumentName:n,dataSource:this.dataSource,i18n:this.i18n,apiClient:this.apiClient,buttonDisplayBenchmark:e});
137this.render(a,n),c.initCompleted(),this.instanceNumber===1&&this.triggerLoadedEvent()}catch(e){if(this.clearUI(),c.initCompleted(e),e instanceof Error&&e.name==="DeveloperError")throw e;g.notify(new wr(`An error occurred while attempting to render AcceleratedCheckout: ${e}`,{cause:e}))}}async attributeChangedCallback(e,r,n){r!==n&&(Mr(this,e,n),e==="has-selling-plan"&&n===""?this.showBuyerConsent(this.apiClient,this.i18n):e==="has-selling-plan"&&n===null&&this.hideBuyerConsent())}async getWebComponentInstance({wallet:e,instrumentName:r,dataSource:n,i18n:a,apiClient:i,buttonDisplayBenchmark:o}){const s=await e.createWebComponent({walletContainer:this,dataSource:n,i18n:a,apiClient:i,classNames:bp(r),callToAction:"true",pageType:this.pageType,containerInstanceNumber:this.instanceNumber,supportsSubscriptions:e.supportsSubscriptions,supportsDeferredPurchaseOptions:e.supportsDeferredPurchaseOptions,onRendered:()=>{c.instrumentLoaded({instrumentOrComponentName:r,result:"success",measurement:o()}),this.recordWalletsLoadedFromFCP(r)}});if(!s)throw new wr(`No web component instance found for instrument ${r}`);return s}async render(e,r){this.clearUI();const n=this.getOrCreateShadowRoot(),a=document.createElement("style");a.innerHTML=To,n.appendChild(a),this.wrapper=document.createElement("div"),this.wrapper.className="wallet-button-fade-in wallet-button-wrapper";const i=document.createElement("slot");i.name="button",this.wrapper.appendChild(i);const o=document.createElement("slot");o.name="promise",this.wrapper.appendChild(o);const s=document.createElement("slot");s.name="more-options",this.wrapper.appendChild(s),n?.appendChild(this.wrapper),this.hasSellingPlan?this.showBuyerConsent(this.apiClient,this.i18n):this.hideBuyerConsent(),this.setupManagedMarketsHandlers(this.i18n);const l=new DocumentFragment;e&&l.appendChild(e);const d=this.getShopPromiseSlot();d&&l.appendChild(d);const u=this.getMorePaymentOptionsLink(r);u&&l.appendChild(u),this.appendChild(l)}recordWalletsLoadedFromFCP(e){this.didRecordWalletsLoadedFromFCP||!this.isPageLoadRender()||(this.didRecordWalletsLoadedFromFCP=!0,c.recordWalletsLoadedFromFCP({instrumentOrComponentName:e}))}isPageLoadRender(){return Me()===S.ProductPage}getMorePaymentOptionsLink(e){if(e===m.BuyItNow)return null;const r=document.createElement("more-payment-options-link");return Lt(r,{"buyer-country":this.buyerCountry??"","access-token":this.accessToken??"","page-type":this.pageType,"wallet-instrument-name":e,slot:"more-options"}),r.disabled=this.disabled,r.setDataSource(this.dataSource),r.setI18n(this.i18n),r.setClassNames(nr.MORE_PAYMENT_OPTION_BUTTON),r}getShopPromiseSlot(){if(!this.shopPromiseEligible)return null;const e=document.createElement("div");return e.setAttribute("data-shopify","shop-promise-payment-button-slot"),e.style.height="100%",e.slot="promise",e}validateRenderingSurface(){return ne({page:"product",element:this})!=null}async loadWallet(){const e=this.recommendedWallet,r=jc(e,this.fallbackWallet,"AcceleratedCheckout");return await _p(this,{...r,instanceNumber:this.instanceNumber})}setupFormObserver(){this.formObserver||(this.formObserver=new Ur(this,({disabled:e,hasSellingPlan:r})=>{this.disabled=e,this.hasSellingPlan=r,this.isShippingRequired=wp(this,this.variantParams)}),this.formObserver.setupMutationObservers())}getOrCreateShadowRoot(){return this.#t||(this.#t=this.attachShadow({mode:"closed"})),this.#t}extractStyles(){if(this.styleExtractorDisabled){ge()("shopify-support-debug")&&console.debug("[shopify-support-debug] styling backward compatibility disabled"),c.styleBackwardsCompatibility({usedBackwardsCompatibility:!1});return}const e=Nt(L.StyleExtract,`dc:${this.instanceNumber}`),r=No(this);r&&Oo({element:this,styles:r,debug:this.debug});const n=e();n&&c.styleBackwardsCompatibilityExecutionTime({measurement:n,pageType:this.pageType,stylesWritten:!!r}),c.styleBackwardsCompatibility({usedBackwardsCompatibility:!!r})}};function bp(t){return t===m.BuyItNow?nr.UNBRANDED_BUTTON:nr.BRANDED_BUTTON}function wp(t,e){const r=Tn(t);return!!e.find(n=>n.id===Number(r?.variantId))?.requiresShipping}async function _p(t,{recommendedWallet:e,fallbackWallet:r,instanceNumber:n}){const a=e?Xt(e):null,i=Xt(r),o=async s=>{const l=Hn({walletInstrument:s,instanceNumber:n}),d="timeout",u=fp(),h=await Promise.race([l,new Promise(p=>setTimeout(()=>p(d),u))]);if(h===d)c.instrumentSDKLoaded({instrument:s.getInstrumentName(),measurement:u,result:"timeout"});else if(h instanceof ht)return h;return null};if(Ie(t,a)){const s=await o(a);if(s)return s}if(Ie(t,i)){const s=await o(i);if(s)return s}return Xt(Wa)}Z("shopify-accelerated-checkout",yp),Z("more-payment-options-link",Bc,{isChildCustomElement:!0});var Ep=t=>{if(typeof PerformanceObserver>"u"||!PerformanceObserver.supportedEntryTypes?.includes("resource"))return null;const e=new PerformanceObserver(r=>{r.getEntriesByType("resource").some(n=>n.name.includes(ie.CartUpdate)||n.name.includes(ie.CartChange)||n.name.includes(ie.CartAdd)||n.name.includes(ie.CartClear))&&t()});return e.observe({entryTypes:["resource"]}),e},Ap=".wallet-cart-button__skeleton{animation:acceleratedCheckoutLoadingSkeleton var(--shopify-accelerated-checkout-skeleton-animation-duration,4s) var(--shopify-accelerated-checkout-skeleton-animation-timing-function,ease) infinite;background-color:var(--shopify-accelerated-checkout-skeleton-background-color,#dedede);animation-delay:-.168s}.wallet-button-wrapper{width:100%;container:wrapper/inline-size}.wallet-cart-grid{justify-content:center;column-gap:10px;row-gap:var(--shopify-accelerated-checkout-row-gap,8px);grid-template-columns:repeat(auto-fit,minmax(min(100px,100%),1fr));margin:0;padding:0;display:grid}.wallet-cart-button-container{position:relative}.wallet-cart-button-container,.wallet-cart-button{min-width:100px;height:clamp(25px, var(--shopify-accelerated-checkout-button-inline-size,var(--shopify-accelerated-checkout-button-block-size,42px)), 55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius,4px);text-align:center;list-style-type:none!important}.wallet-cart-button{width:100%}.wallet-cart-grid.wallet-cart-grid--vertical,.additional-checkout-buttons--vertical .wallet-cart-grid{row-gap:var(--shopify-accelerated-checkout-row-gap,8px);grid-template-columns:1fr;margin:0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button-container,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button-container:first-child,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}.wallet-cart-grid.wallet-cart-grid--horizontal,.additional-checkout-buttons--horizontal .wallet-cart-grid{grid-template-columns:none;grid-auto-columns:1fr;grid-auto-flow:column;justify-content:stretch}.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button-container,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button-container,.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button{min-width:0}@container wrapper (width<210px){.wallet-cart-grid{grid-template-columns:1fr}.wallet-cart-button-container,.wallet-cart-button{min-width:0}.wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *)>.wallet-cart-button-container:nth-child(n+3){display:none}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))~.wallet-cart-drawer-toggle{display:block}}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(7)){grid-template-columns:1fr}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(7))>.wallet-cart-button-container{min-width:0}@container wrapper (width>=210px) and (width<320px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-of-type(odd):last-child,shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-of-type(odd):last-child,:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:last-child:nth-child(2n),shopify-accelerated-checkout-cart[
137shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:last-child:nth-child(2n){justify-self:var(--shopify-accelerated-checkout-inline-alignment,center);grid-column:1/-1;width:calc(50% - 5px)}.wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *)>.wallet-cart-button-container:nth-child(n+5){display:none}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5))~.wallet-cart-drawer-toggle{display:block}:host([shop-pay-emphasis]) .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:nth-child(n+4),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:nth-child(n+4){display:none}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4))~.wallet-cart-drawer-toggle,shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4))~.wallet-cart-drawer-toggle{display:block}}@container wrapper (width>=320px) and (width<430px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(4)):not(:has(>.wallet-cart-button-container:nth-of-type(5))),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(4)):not(:has(>.wallet-cart-button-container:nth-of-type(5))){grid-template-columns:repeat(2,1fr)}}@container wrapper (width>=320px) and (width<540px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))){grid-template-columns:repeat(6,1fr)}:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container,shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container{grid-column:span 2;justify-self:stretch;width:auto}:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(4),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(4){grid-column:2/span 2}}@container wrapper (width>=430px) and (width<650px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))){grid-template-columns:repeat(3,1fr)}}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)) .wallet-cart-button-container:first-child,shopify-accelerated-checkout-cart[
137shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)) .wallet-cart-button-container:first-child{grid-column:1/-1}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4)),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4)){grid-template-columns:repeat(auto-fit,minmax(max(100px,33.3333% - 6.66667px),1fr))}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(4))),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(4))),:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))){grid-template-columns:repeat(auto-fit,minmax(max(100px,50% - 5px),1fr))}@container wrapper (width>=320px){:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))){grid-template-columns:repeat(6,1fr)}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:not(:first-child),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:not(:first-child){grid-column:span 2}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-child(5),shopify-accelerated-checkout-cart[
137shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-child(5){grid-column:2/span 2}:host([shop-pay-emphasis]) .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(n+4),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(n+4){display:none}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5))~.wallet-cart-drawer-toggle,shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5))~.wallet-cart-drawer-toggle{display:block}:host([shop-pay-emphasis]) .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6))>.wallet-cart-button-container:nth-child(n+5),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6))>.wallet-cart-button-container:nth-child(n+5){display:none}}.wallet-cart-drawer-toggle{cursor:pointer;text-align:center;width:100%;padding:var(--shopify-accelerated-checkout-row-gap,8px) 0 0;color:inherit;background:0 0;border:none;font-size:.875em;text-decoration:underline;display:none}::slotted(.wallet-cart-drawer-toggle){cursor:pointer;text-align:center;width:100%;color:inherit;background:0 0;border:none;padding:0;font-size:.875em;text-decoration:underline}.wallet-cart-drawer-toggle--skeleton{animation:acceleratedCheckoutLoadingSkeleton var(--shopify-accelerated-checkout-skeleton-animation-duration,4s) var(--shopify-accelerated-checkout-skeleton-animation-timing-function,ease) infinite;background-color:var(--shopify-accelerated-checkout-skeleton-background-color,#dedede);width:140px;height:20px;margin:var(--shopify-accelerated-checkout-row-gap,8px) auto 0;color:#0000;border-radius:4px;text-decoration:none;animation-delay:-.168s;overflow:hidden}@media screen and (width<=750px){.wallet-cart-button-container,.wallet-cart-button{min-width:0}}@supports not (display:grid){.wallet-cart-grid{flex-direction:column;display:flex}.wallet-cart-button-container{width:100%}}.screen-reader-text{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}",Cp=".wallet-cart-button__skeleton{animation:acceleratedCheckoutLoadingSkeleton var(--shopify-accelerated-checkout-skeleton-animation-duration,4s) var(--shopify-accelerated-checkout-skeleton-animation-timing-function,ease) infinite;background-color:var(--shopify-accelerated-checkout-skeleton-background-color,#dedede);animation-delay:-.168s}.wallet-button-wrapper{width:100%;container:wrapper/inline-size}.wallet-cart-grid{justify-content:center;column-gap:10px;row-gap:var(--shopify-accelerated-checkout-row-gap,8px);grid-template-columns:repeat(auto-fit,minmax(min(100px,100%),1fr));margin:0;padding:0;display:grid}.wallet-cart-button-container{position:relative}.wallet-cart-button-container,.wallet-cart-button{min-width:100px;height:clamp(25px, var(--shopify-accelerated-checkout-button-inline-size,var(--shopify-accelerated-checkout-button-block-size,42px)), 55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius,4px);text-align:center;list-style-type:none!important}.wallet-cart-button{width:100%}.wallet-cart-grid.wallet-cart-grid--vertical,.additional-checkout-buttons--vertical .wallet-cart-grid{row-gap:var(--shopify-accelerated-checkout-row-gap,8px);grid-template-columns:1fr;margin:0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button-container,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button-container:first-child,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}.wallet-cart-grid.wallet-cart-grid--horizontal,.additional-checkout-buttons--horizontal .wallet-cart-grid{grid-template-columns:none;grid-auto-columns:1fr;grid-auto-flow:column;justify-content:stretch}.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button-container,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button-container,.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button{min-width:0}@container wrapper (width<210px){.wallet-cart-grid{grid-template-columns:1fr}.wallet-cart-button-container,.wallet-cart-button{min-width:0}.wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *)>.wallet-cart-button-container:nth-child(n+3){display:none}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))~.wallet-cart-drawer-toggle{display:block}}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(7)){grid-template-columns:1fr}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(7))>.wallet-cart-button-container{min-width:0}@container wrapper (width>=210px) and (width<320px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-of-type(odd):last-child,shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-of-type(odd):last-child,:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:last-child:nth-child(2n),shopify-accelerated-checkout-cart[
137shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:last-child:nth-child(2n){justify-self:var(--shopify-accelerated-checkout-inline-alignment,center);grid-column:1/-1;width:calc(50% - 5px)}.wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *)>.wallet-cart-button-container:nth-child(n+5){display:none}.wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5))~.wallet-cart-drawer-toggle{display:block}:host([shop-pay-emphasis]) .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:nth-child(n+4),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3))>.wallet-cart-button-container:nth-child(n+4){display:none}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4))~.wallet-cart-drawer-toggle,shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4))~.wallet-cart-drawer-toggle{display:block}}@container wrapper (width>=320px) and (width<430px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(4)):not(:has(>.wallet-cart-button-container:nth-of-type(5))),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(4)):not(:has(>.wallet-cart-button-container:nth-of-type(5))){grid-template-columns:repeat(2,1fr)}}@container wrapper (width>=320px) and (width<540px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))){grid-template-columns:repeat(6,1fr)}:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container,shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container{grid-column:span 2;justify-self:stretch;width:auto}:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(4),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(4){grid-column:2/span 2}}@container wrapper (width>=430px) and (width<650px){:host(:not([shop-pay-emphasis])) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))),shopify-accelerated-checkout-cart:not([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))){grid-template-columns:repeat(3,1fr)}}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)) .wallet-cart-button-container:first-child,shopify-accelerated-checkout-cart[
137shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)) .wallet-cart-button-container:first-child{grid-column:1/-1}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4)),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(4)){grid-template-columns:repeat(auto-fit,minmax(max(100px,33.3333% - 6.66667px),1fr))}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(4))),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):not(:has(>.wallet-cart-button-container:nth-of-type(4))),:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6))){grid-template-columns:repeat(auto-fit,minmax(max(100px,50% - 5px),1fr))}@container wrapper (width>=320px){:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7))){grid-template-columns:repeat(6,1fr)}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:not(:first-child),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:not(:first-child){grid-column:span 2}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-child(5),shopify-accelerated-checkout-cart[
137shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6)):not(:has(>.wallet-cart-button-container:nth-of-type(7)))>.wallet-cart-button-container:nth-child(5){grid-column:2/span 2}:host([shop-pay-emphasis]) .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(n+4),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5)):not(:has(>.wallet-cart-button-container:nth-of-type(6)))>.wallet-cart-button-container:nth-child(n+4){display:none}:host([shop-pay-emphasis]) .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5))~.wallet-cart-drawer-toggle,shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(5))~.wallet-cart-drawer-toggle{display:block}:host([shop-pay-emphasis]) .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6))>.wallet-cart-button-container:nth-child(n+5),shopify-accelerated-checkout-cart[shop-pay-emphasis] .wallet-cart-grid--collapsed:not(.wallet-cart-grid--vertical):not(.wallet-cart-grid--horizontal):not(.additional-checkout-buttons--vertical *):not(.additional-checkout-buttons--horizontal *):has(>.wallet-cart-button-container:nth-of-type(3)):has(>.wallet-cart-button-container:nth-of-type(6))>.wallet-cart-button-container:nth-child(n+5){display:none}}.wallet-cart-drawer-toggle{cursor:pointer;text-align:center;width:100%;padding:var(--shopify-accelerated-checkout-row-gap,8px) 0 0;color:inherit;background:0 0;border:none;font-size:.875em;text-decoration:underline;display:none}::slotted(.wallet-cart-drawer-toggle){cursor:pointer;text-align:center;width:100%;color:inherit;background:0 0;border:none;padding:0;font-size:.875em;text-decoration:underline}.wallet-cart-drawer-toggle--skeleton{animation:acceleratedCheckoutLoadingSkeleton var(--shopify-accelerated-checkout-skeleton-animation-duration,4s) var(--shopify-accelerated-checkout-skeleton-animation-timing-function,ease) infinite;background-color:var(--shopify-accelerated-checkout-skeleton-background-color,#dedede);width:140px;height:20px;margin:var(--shopify-accelerated-checkout-row-gap,8px) auto 0;color:#0000;border-radius:4px;text-decoration:none;animation-delay:-.168s;overflow:hidden}@media screen and (width<=750px){.wallet-cart-button-container,.wallet-cart-button{min-width:0}}@supports not (display:grid){.wallet-cart-grid{flex-direction:column;display:flex}.wallet-cart-button-container{width:100%}}.screen-reader-text{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}",vp=".wallet-cart-button__skeleton{animation:acceleratedCheckoutLoadingSkeleton var(--shopify-accelerated-checkout-skeleton-animation-duration,4s) var(--shopify-accelerated-checkout-skeleton-animation-timing-function,ease) infinite;background-color:var(--shopify-accelerated-checkout-skeleton-background-color,#dedede);animation-delay:-.168s}.wallet-button-wrapper{width:100%;container:wrapper/inline-size}.wallet-cart-grid{justify-content:var(--shopify-accelerated-checkout-inline-alignment,start);flex-direction:row;margin:0 -5px -5px;padding:0;display:flex}.wallet-cart-button-container{margin:0 5px 5px;position:relative}.wallet-cart-button-container,.wallet-cart-button{width:auto;min-width:100px;height:clamp(25px, var(--shopify-accelerated-checkout-button-inline-size,var(--shopify-accelerated-checkout-button-block-size,42px)), 55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius,4px);text-align:center;flex:1 1 0;list-style-type:none!important}.wallet-cart-grid.wallet-cart-grid--vertical,.additional-checkout-buttons--vertical .wallet-cart-grid{flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button-container,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button-container:first-child,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}.wallet-cart-grid.wallet-cart-grid--horizontal,.additional-checkout-buttons--horizontal .wallet-cart-grid{justify-content:stretch}.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button-container,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button-container,.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button{min-width:0}@container wrapper (width>=100px) and (width<=500px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))) .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))) .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))) .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}}@container wrapper (width<=210px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))) .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))) .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))) .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}}@container wrapper (width<=320px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))) .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))) .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))) .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}}@container wrapper (width<=430px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))) .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))) .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))) .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}}@container wrapper (width<=540px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))) .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))) .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))) .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(6)){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(6)) .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(6)) .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(6)) .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}@media screen and (width<=750px){.wallet-cart-grid{justify-content:stretch}.wallet-cart-button-container,.wallet-cart-button{min-width:0}}@supports (not (container-type:inline-size)) or (not selector(:has(*))){.wallet-cart-grid{flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-button-container:first-child{margin:0}.wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}}.screen-reader-text{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}",Sp=".wallet-cart-button__skeleton{animation:acceleratedCheckoutLoadingSkeleton var(--shopify-accelerated-checkout-skeleton-animation-duration,4s) var(--shopify-accelerated-checkout-skeleton-animation-timing-function,ease) infinite;background-color:var(--shopify-accelerated-checkout-skeleton-background-color,#dedede);animation-delay:-.168s}.wallet-button-wrapper{width:100%;container:wrapper/inline-size}.wallet-cart-grid{justify-content:var(--shopify-accelerated-checkout-inline-alignment,start);flex-direction:row;margin:0 -5px -5px;padding:0;display:flex}.wallet-cart-button-container{margin:0 5px 5px;position:relative}.wallet-cart-button-container,.wallet-cart-button{width:auto;min-width:100px;height:clamp(25px, var(--shopify-accelerated-checkout-button-inline-size,var(--shopify-accelerated-checkout-button-block-size,42px)), 55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius,4px);text-align:center;flex:1 1 0;list-style-type:none!important}.wallet-cart-grid.wallet-cart-grid--vertical,.additional-checkout-buttons--vertical .wallet-cart-grid{flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button-container,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button-container:first-child,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid.wallet-cart-grid--vertical .wallet-cart-button,.additional-checkout-buttons--vertical .wallet-cart-grid .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}.wallet-cart-grid.wallet-cart-grid--horizontal,.additional-checkout-buttons--horizontal .wallet-cart-grid{justify-content:stretch}.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button-container,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button-container,.wallet-cart-grid.wallet-cart-grid--horizontal .wallet-cart-button,.additional-checkout-buttons--horizontal .wallet-cart-grid .wallet-cart-button{min-width:0}@container wrapper (width>=100px) and (width<=500px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).wallet-cart-grid:not(:has(>.wallet-cart-b
137utton-container:nth-of-type(2))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))) .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))) .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:first-of-type).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))) .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}}@container wrapper (width<=210px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))) .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))) .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(2)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(3))) .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}}@container wrapper (width<=320px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))) .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))) .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(3)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(4))) .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}}@container wrapper (width<=430px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))) .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))) .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(4)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(5))) .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}}@container wrapper (width<=540px){.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))) .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))) .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(5)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(6))) .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(6)){flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(6)) .wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(6)) .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(6)) .wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}@media screen and (width<=750px){.wallet-cart-grid{justify-content:stretch}.wallet-cart-button-container,.wallet-cart-button{min-width:0}}@supports (not (container-type:inline-size)) or (not selector(:has(*))){.wallet-cart-grid{flex-direction:column;justify-content:flex-start;margin:0}.wallet-cart-button-container{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px);margin:var(--shopify-accelerated-checkout-row-gap,8px) 0 0 0}.wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-button{width:100%;height:clamp(25px, var(--shopify-accelerated-checkout-button-block-size,54px), 55px)}}.screen-reader-text{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}";function Pp(t){const e=ne({page:"cart",element:t});return kn({type:"attributes",form:e})}var Ip=class{element;cartToken;apiClient;constructor(t,e,r){this.element=t,this.cartToken=e,this.apiClient=r}async getInitialCart(t){try{const e=`gid://shopify/Cart/${this.cartToken}`,r=Pp(this.element);let n,a=[];if(r.length){const i=await this.apiClient.updateCartAttributes({cartId:e,attributes:r,instrumentName:t,startingCheckout:!0});n=i.data,a=i.errors}else n=await this.apiClient.fetchCart({id:e,instrumentName:t,startingCheckout:!0});return{cart:n,errors:a}}
137catch(e){if(e instanceof tt)return{cart:null,errors:[{code:"NO_RESPONSE"}]};throw e}}},kp=class Lo extends zr{static instanceCount=0;instanceNumber=++Lo.instanceCount;pageType=S.CartPage;cartObserver=null;dataSource=null;wrapper;didInitiateRender=!1;didDeferRenderUntilCartChange=!1;didRecordWalletsLoadedFromFCP=!1;didRenderAnyWallet=!1;#t;constructor(){super()}static get observedAttributes(){return["access-token","has-selling-plan","requires-shipping","shop-pay-emphasis"]}createDataSource(){if(!this.cartToken){c.cartTokenMissing({reason:"createDataSource"});return}this.apiClient=new Ge({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale}),this.dataSource=new Ip(this,this.cartToken,this.apiClient)}async createWebComponents({shouldRefetchCartAttributes:e}){if(!this.walletConfigs)throw new q({code:"invalid-wallet-configs",message:"[AcceleratedCheckoutCart] walletConfigs does not exist"});const r=Gc(this.walletConfigs,"AcceleratedCheckoutCart");if(!(r instanceof Array))throw new q({code:"invalid-wallet-configs",message:"[AcceleratedCheckoutCart] invalid walletConfigs found"});const n=L.ButtonDisplay,a=s=>`${s}:${this.instanceNumber}`,i=await Tp(this,{walletConfigs:r,startButtonDisplayBenchmark:s=>zt(n,a(s))});if(this.createDataSource(),!this.dataSource)return[];e&&await this.updateAttributes();const o=new Set(i.map((s,l)=>l));return await Promise.all(i.map(async(s,l)=>{const d=s.getInstrumentName();return await s.createWebComponent({walletContainer:this,dataSource:this.dataSource,i18n:this.i18n,apiClient:this.apiClient,pageType:this.pageType,containerInstanceNumber:this.instanceNumber,slot:`button-${s.getInstrumentName()}`,supportsSubscriptions:s.supportsSubscriptions,supportsDeferredPurchaseOptions:s.supportsDeferredPurchaseOptions,onRendered:(()=>{let u=!1;return()=>{u||(u=!0,c.instrumentLoaded({instrumentOrComponentName:d,result:"success",measurement:j(n,a(d))}),this.settleWalletRender(l,o,"success"))}})(),onRenderFailed:()=>this.settleWalletRender(l,o,"failed")})}))}async cartChangedCallback(){try{if(!this.dataSource&&this.cartToken){this.didDeferRenderUntilCartChange=!0,await this.render({shouldRefetchCartAttributes:!0}),c.initCompleted();return}else if(!this.cartToken){c.cartTokenMissing({reason:"cartChangedCallback"});return}await this.updateAttributes()}catch(e){this.clearUI(),g.notify(e)}}async updateAttributes(){if(!this.cartToken||!this.apiClient)return;const e=await this.apiClient.fetchLimitedCart({id:`gid://shopify/Cart/${this.cartToken}`,instrumentName:m.Unknown});this.hasSellingPlan=e.sellingPlan??!1,this.isShippingRequired=e.shippingRequired??!1}async connectedCallback(){super.connectedCallback();try{if(this.didInitiateRender)return;if(this.instanceNumber===1&&Fr(this),c.initStarted(),this.cartObserver=Ep(()=>this.cartChangedCallback()),!this.cartObserver){c.log({body:"Cart observer unavailable - PerformanceObserver not supported"}),this.clearUI();return}if(!this.cartToken){c.cartTokenMissing({reason:"connectedCallback"});return}await this.render({shouldRefetchCartAttributes:!1}),c.initCompleted()}catch(e){this.clearUI(),c.initCompleted(e),g.notify(e)}}disconnectedCallback(){super.disconnectedCallback(),this.cartObserver?.disconnect()}async attributeChangedCallback(e,r,n){r!==n&&(Mr(this,e,n),e==="has-selling-plan"&&n===""?this.showBuyerConsent(this.apiClient,this.i18n):e==="has-selling-plan"&&n===null&&this.hideBuyerConsent())}get cartToken(){return _r("cart")}async render({shouldRefetchCartAttributes:e}){if(this.i18n=xe(),this.hasLegacyCartCookie()){c.legacyCartCookie(),this.clearUI();return}this.didInitiateRender=!0;const r=Nt(L.ButtonDisplay,`cart:${this.instanceNumber}`),n=await this.createWebComponents({shouldRefetchCartAttributes:e});if(this.clearUI(),this.hasSellingPlan?this.showBuyerConsent(this.apiClient,this.i18n):this.hideBuyerConsent(),this.setupManagedMarketsHandlers(this.i18n),n.length===0)return;const a=new DocumentFragment,i=this.getOrCreateShadowRoot(),o=Q.enabled(ia)?Ap:vp,s=document.createElement("style");s.innerHTML=[To,o].join(`
138`),i.appendChild(s),this.extractStyles(),this.wrapper=document.createElement("div"),this.wrapper.className="wallet-button-fade-in wallet-button-wrapper";const l=document.createElement("h2");l.className="screen-reader-text",l.textContent=this.i18n.translate("express_checkout"),this.wrapper.appendChild(l);const d=document.createElement("div");d.className=`wallet-cart-grid ${_t.CONTAINER}
138`,Object.entries(Dp).forEach(([u,h])=>{document.querySelector(u)&&d.classList.add(h)}),n.forEach(u=>{const h=document.createElement("div"),p=document.createElement("div"),y=document.createElement("slot");y.name=`button-${u.name}`,h.className="wallet-cart-button-container",p.className="wallet-cart-button",h.setAttribute("data-testid","grid-cell"),h.appendChild(p),p.appendChild(y),d.appendChild(h),a.appendChild(u)}),this.wrapper.appendChild(d),i.appendChild(this.wrapper),this.appendChild(a),c.instrumentLoaded({instrumentOrComponentName:"AcceleratedCheckoutCart",result:"success",measurement:r()})}settleWalletRender(e,r,n){r.delete(e)&&(n==="success"&&(this.didRenderAnyWallet=!0),!(r.size>0||this.didRecordWalletsLoadedFromFCP)&&(!this.didRenderAnyWallet||!this.isConnected||!this.isPageLoadRender()||(this.didRecordWalletsLoadedFromFCP=!0,c.recordWalletsLoadedFromFCP({instrumentOrComponentName:"AcceleratedCheckoutCart"}))))}isPageLoadRender(){return!this.didDeferRenderUntilCartChange&&Me()===S.CartPage}getOrCreateShadowRoot(){return this.#t||(this.#t=this.attachShadow({mode:"closed"})),this.#t}hasLegacyCartCookie(){return this.cartToken?this.cartToken?.match(/^[a-z0-9]+$/):!1}extractStyles(){if(this.styleExtractorDisabled){ge()("shopify-support-debug")&&console.debug("[shopify-support-debug] styling backward compatibility disabled"),c.styleBackwardsCompatibility({usedBackwardsCompatibility:!1});return}const e=Nt(L.StyleExtract,`cart:${this.instanceNumber}`),r=No(this);if(r){Oo({element:this,styles:r,debug:this.debug});const a=this.getOrCreateShadowRoot(),i=Q.enabled(ia),o=document.createElement("style");o.innerHTML=i?Cp:Sp,a.appendChild(o)}const n=e();n&&c.styleBackwardsCompatibilityExecutionTime({measurement:n,pageType:this.pageType,stylesWritten:!!r}),c.styleBackwardsCompatibility({usedBackwardsCompatibility:!!r})}};async function Tp(t,{walletConfigs:e,startButtonDisplayBenchmark:r=()=>{}}){const n=$c(t,Yh(e));return(await Promise.all(n.map(a=>(r(a.getInstrumentName()),Hn({walletInstrument:a,instanceNumber:t.instanceNumber}))))).filter(a=>a!=null)}var Dp={".additional-checkout-buttons--vertical shopify-accelerated-checkout-cart":"wallet-cart-grid--vertical",".additional-checkout-buttons--horizontal shopify-accelerated-checkout-cart":"wallet-cart-grid--horizontal"};Z("shopify-accelerated-checkout-cart",kp);var Rp=class{getInitialCart(){throw new Error('[NoOpDataSource] Unexpected call to "getCart"')}},Np=class Mo extends zr{static instanceCount=0;instanceNumber=++Mo.instanceCount;pageType=S.Checkout;get walletConfig(){return this.getAttribute("wallet-config")}async connectedCallback(){super.connectedCallback();try{if(this.i18n=xe(),this.children.length)return;this.instanceNumber===1&&(Fr(this),c.initStarted());const e=Nt(L.ButtonDisplay,`dc:${this.instanceNumber}`),r=Hc(this.walletConfig,"WalletButton");if(!r)throw new Ka("[WalletButton] No config provided.");const n=Xt(r);if(!n)return;if(!await this.eligibleToShow(n)){this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"failure",message:"ineligible"}}));return}if(this.onlySdk){c.initCompleted(),this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"success"}}));return}const a=n.getInstrumentName();this.apiClient=new Ge({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale});const i=await this.createWebComponent(n,this.i18n,this.apiClient,a,e);this.innerHTML="",this.appendChild(i),c.initCompleted(),this.instanceNumber===1&&this.triggerLoadedEvent()}catch(e){this.innerHTML="",this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"failure",message:Op(e)}})),c.initCompleted(e),g.notify(e)}}async createWebComponent(e,r,n,a,i){const o=await e.createWebComponent({walletContainer:this,dataSource:new Rp,i18n:r,apiClient:n,containerInstanceNumber:this.instanceNumber,pageType:this.pageType});return o.onRendered=()=>{this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"success"}})),c.instrumentLoaded({instrumentOrComponentName:a,result:"success",measurement:i()})},o}async eligibleToShow(e){return!(!Ie(this,e)||(await e.loadWalletSDK(),!e.getPartnerSDKEligibility().eligible))}};function Op(t){if(t instanceof Error)return t.message;try{return JSON.stringify(t)??String(t)}catch{return String(t)}}Z("shopify-wallet-button",Np),Ko(g,{metadata:{custom:{"notify-origin":"window-onerror"}}}),Qo(g,{metadata:{custom:{"notify-origin":"unhandled-promise-rejection-handler"}}}),c.startExporter();

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.