1import.meta;var Qo=Object.defineProperty,pr=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),_n=e=>{throw TypeError(e)},Xo=(e,t,n)=>t in e?Qo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,c=(e,t,n)=>Xo(e,typeof t!="symbol"?t+"":t,n),En=(e,t,n)=>t.has(e)||_n("Cannot "+n),S=(e,t,n)=>(En(e,t,"read from private field"),n?n.call(e):t.get(e)),G=(e,t,n)=>t.has(e)?_n("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),z=(e,t,n,r)=>(En(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),nt=function(e,t){this[0]=e,this[1]=t},Ft=(e,t,n)=>{var r=(i,s,l,d)=>{try{var u=n[i](s),p=(s=u.value)instanceof nt,m=u.done;Promise.resolve(p?s[0]:s).then(g=>p?r(i==="return"?i:"next",s[1]?{done:g.done,value:g.value}:g,l,d):l({value:g,done:m})).catch(g=>r("throw",g,l,d))}catch(g){d(g)}},a=i=>o[i]=s=>new Promise((l,d)=>r(i,s,l,d)),o={};return n=n.apply(e,t),o[pr("asyncIterator")]=()=>o,a("next"),a("throw"),a("return"),o},vt=(e,t,n)=>(t=e[pr("asyncIterator")])?t.call(e):(e=e[pr("iterator")](),t={},n=(r,a)=>(a=e[r])&&(t[r]=o=>new Promise((i,s,l)=>(o=a.call(e,o),l=o.done,Promise.resolve(o.value).then(d=>i({value:d,done:l}),s)))),n("next"),n("return"),t);function Jo(){Array.prototype.flatMap||(Array.prototype.flatMap=function(e,t){const n=[];for(let r=0;r<this.length;r++){const a=e.call(t,this[r],r,this);if(Array.isArray(a))for(const o of a)n.push(o);else n.push(a)}return n})}Jo();const Zo=":host{display:flex;align-items:center;justify-content:center}";class ti extends HTMLElement{constructor(){super(...arguments),c(this,"size","18px"),c(this,"color","gray")}connectedCallback(){var t,n;this.attachShadow({mode:"open"}),this.size=(t=this.getAttribute("size"))!=null?t:this.size,this.color=(n=this.getAttribute("color"))!=null?n:this.color,this.render();const r=document.createElement("style");r.textContent=Zo,this.shadowRoot.appendChild(r)}render(){const t=this.shadowRoot,n='\n width="'.concat(this.size,'"\n height="').concat(this.size,'"\n xmlns="http://www.w3.org/2000/svg"\n aria-hidden="true"\n ');t.innerHTML="\n <svg ".concat(n,' viewBox="0 0 20 20" fill="').concat(this.color,'">\n <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"/>\n </svg>\n ')}}const ei="#overlay{position:fixed;width:100%;height:100%;background:#0006;top:0;left:0;z-index:2147483647;animation:modalPop .3s ease-out}#modal{position:fixed;top:20%;left:50%;width:100%;max-width:383px;transform:translate(-50%,-100%);background:#fff;color:#000;border-radius:5px;animation:modalSlideInFromTop .3s forwards}@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 (max-width: 640px){#modal{top:auto;bottom:0;animation:modalSlideInFromBottom .3s forwards}}#modal footer{padding:0 21px 21px}#modal header{display:flex;justify-content:space-between;padding:21px 21px 16px}#title{font-size:21px;font-weight:600;line-height:25.2px;margin:0;word-wrap:break-word;overflow-wrap:break-word}.capitalize:first-letter{display:inline-block;text-transform:capitalize}#content{text-align:left;padding:0 21px 16px;overflow:auto;max-height:50vh}#modal #content p{margin:0;font-size:14px;line-height:21px}#close-icon,#close-button{cursor:pointer}#close-icon{min-width:24px;background:transparent;padding:0;border:none}#close-button{width:100%;padding:16px 21px;color:#fff;background-color:#1773b0;border:none;border-radius:5px;font-size:14px;line-height:21px;font-family:inherit}#close-button:hover,#close-button:active{background:#136f99}#close-button:active,#close-button:focus{box-shadow:0 0 0 4px #1990c640}";function ri(e){return wa(e).map(t=>t instanceof Error?t:new _a("[".concat(typeof t,"] ").concat(ni(t).slice(0,10240))))}function wa(e,t=0){return t>=20?[e,"Truncated cause stack"]:e instanceof Error&&e.cause?[e,...wa(e.cause,t+1)]:[e]}function ni(e){var t;if(typeof e=="function")return"".concat(e.name||"anonymous");if(typeof e!="string")try{return(t=JSON.stringify(e))!=null?t:typeof e}catch(n){}return"".concat(e)}
1var _a=class extends Error{constructor(){super(...arguments),c(this,"name","BugsnagInvalidError")}},Ea=/^\s*at .*(\S+:\d+|\(native\))/m,ai=/^(eval@)?(\[native code])?$/;function oi(e){return e.stack?e.stack.match(Ea)?ii(e):si(e):[]}function Aa(e){if(e.indexOf(":")===-1)return[e];let t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]?Number(t[2]):void 0,t[3]?Number(t[3]):void 0]}function ii(e){return e.stack.split("\n").filter(t=>!!t.match(Ea)).map(t=>{let n=t.replace(/^\s+/,"").replace(/^.*?\s+/,""),r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],""):n;let a=Aa(r?r[1]:n),o=r&&n||void 0,i=["eval","<anonymous>"].indexOf(a[0])>-1?void 0:a[0];return{method:o,file:i,lineNumber:a[1],columnNumber:a[2]}})}function si(e){return e.stack.split("\n").filter(t=>!t.match(ai)).map(t=>{if(t.indexOf("@")===-1&&t.indexOf(":")===-1)return{method:t};let n=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=t.match(n),a=r&&r[1]?r[1]:void 0,o=Aa(t.replace(n,""));return{method:a,file:o[0],lineNumber:o[1],columnNumber:o[2]}})}var mr="5",li=class{constructor(e){c(this,"breadcrumbs",[]),c(this,"apiKey"),c(this,"plugins"),c(this,"appId"),c(this,"appType"),c(this,"appVersion"),c(this,"releaseStage"),c(this,"locale"),c(this,"userAgent"),c(this,"metadata"),c(this,"persistedMetadata"),c(this,"onError"),c(this,"onPostErrorListeners",[]),c(this,"endpoints"),c(this,"session");var t,n,r;this.apiKey=e.apiKey,this.appType=e.appType,this.appId=e.appId,this.appVersion=e.appVersion,this.releaseStage=e.releaseStage,this.locale=e.locale,this.userAgent=e.userAgent,this.metadata=e.metadata,this.onError=e.onError,this.persistedMetadata={},this.endpoints=(t=e.endpoints)!=null?t:{notify:"https://error-analytics-production.shopifysvc.com",sessions:"https://error-analytics-sessions-production.shopifysvc.com/observeonly"},this.plugins=(n=e.plugins)!=null?n:[],this.plugins.forEach(a=>a.load(this)),this.leaveBreadcrumb("Bugsnag started",void 0,"state"),((r=e.withSessionTracking)==null||r)&&(this.session={id:this.getRandomUUID(),startedAt:new Date().toISOString(),events:{handled:0,unhandled:0}},this.startSession())}addMetadata(e){for(let t of Object.keys(e))this.persistedMetadata[t]=e[t]}getSessionId(){var e;return(e=this.session)==null?void 0:e.id}leaveBreadcrumb(e,t,n="manual"){this.breadcrumbs.push({name:e,metaData:t,type:n,timestamp:new Date().toISOString()})}notify(e,{errorClass:t,severity:n,severityType:r,handled:a=!0,metadata:o,context:i,groupingHash:s}={}){var l,d;let u=ri(e),p={...this.metadata,...this.persistedMetadata,...o},m=this.buildBugsnagEvent(u,{errorClass:t,severityType:r,handled:a,severity:n,metadata:p,context:i,groupingHash:s});if(((d=(l=this.onError)==null?void 0:l.call(this,m,e))==null||d)&&this.releaseStage!=="development"){this.updateAndAppendSessionInformation(m);let g=this.sendToBugsnag(m);return this.onPostErrorListeners.forEach(f=>f(m,e)),g}return Promise.resolve()}addOnPostError(e){this.onPostErrorListeners.push(e)}updateAndAppendSessionInformation(e){this.session&&(e.unhandled?this.session.events.unhandled++:this.session.events.handled++,e.session=this.session)}buildBugsnagEvent(e,{errorClass:t,severity:n="error",severityType:r="handledException",handled:a,metadata:o={},context:i,groupingHash:s}){let l=new Date().toISOString(),{breadcrumbs:d,appId:u,appType:p,appVersion:m,releaseStage:g,locale:f,userAgent:v}=this,E=e.map((_,k)=>({errorClass:k===0&&t!=null?t:_.name,stacktrace:Sa(u,_),message:_.message,type:"browserjs"}));return{payloadVersion:mr,exceptions:E,severity:n,severityReason:{type:r},unhandled:!a,app:{id:u,type:p,version:m,releaseStage:g},device:{time:l,locale:f,userAgent:v},breadcrumbs:d,context:i,metaData:o,groupingHash:s}}async startSession(){var e,t;if(this.releaseStage==="development"){console.log("Skipping error logging session tracking in development mode");return}let{apiKey:n}=this,r={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":n,"Bugsnag-Payload-Version":mr,"Bugsnag-Sent-At":(t=(e=this.session)==null?void 0:e.startedAt)!=null?t:new Date().toISOString()},body:JSON.stringify(r,An())})}catch(a){console.warn("[bugsnag-light] failed to start session"),console.warn(a)}}async sendToBugsnag(e){let{apiKey:t}=this,n={apiKey:t,notifier:{name:"Bugsnag JavaScript",version:"7.22.2",url:"https://github.com/bugsnag/bugsnag-js"},events:[e]};try{await fetch(this.endpoints.notify,{method:"POST",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":t,"Bugsnag-Payload-Version":mr,"Bugsnag-Sent-At":e.device.time},body:JSON.stringify(n,An())})}catch(r){console.warn("[bugsnag-light] failed to send an event"),console.warn(r)}}getRandomUUID(){try{return crypto.randomUUID()}catch(e){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let n=Math.random()*16|0;return(t==="x"?n:n&3|8).toString(16)})}}};function Sa(e,t){let n=oi(t).map(r=>{var a,o,i,s;let l=(a=r.file)==null?void 0:a.includes(e);return{method:(o=r.method)!=null?o:"",file:(i=r.file)!=null?i:"",lineNumber:(s=r.lineNumber)!=null?s:0,columnNumber:r.columnNumber,inProject:l}});if(t instanceof _a){let r=n.findIndex(a=>a.method.endsWith("notify"));r>-1&&(n=n.slice(r+1))}return n}function An(){let e=new WeakSet;return function(t,n){if(typeof n=="object"&&n!==null){if(e.has(n))return"[Circular]";e.add(n)}return n}}
1var ci=class Qp extends Error{constructor(t){super(t),c(this,"reason"),this.name="BreadcrumbsPluginFetchError",Object.setPrototypeOf(this,Qp.prototype)}};function di(e,{metadata:t}={}){let n=window.onerror;window.onerror=(r,a,o,i,s)=>{s&&e.notify(s,{severityType:"unhandledException",handled:!1,metadata:t}),typeof n=="function"&&n.apply(window.onerror,[r,a,o,i,s])}}function ui(e,{metadata:t}={}){window.addEventListener("unhandledrejection",n=>{n.reason&&n.reason instanceof Error&&n.reason.stack&&!(n.reason instanceof ci)&&e.notify(n.reason,{severityType:"unhandledPromiseRejection",handled:!1,metadata:t})})}function we(e){try{const t=new RegExp("(^| )".concat(e,"=([^;]+)")).exec(document.cookie);if(t){const n=t[2];try{return decodeURIComponent(n)}catch(r){return n}}return null}catch(t){return null}}const Tr={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"},hi={DARK:"apple-pay--dark",LIGHT:"apple-pay--light"},pi=44,mi="_shopify_y",va=6,gi="discount_code",Yr="https://static-na.payments-amazon.com",Kr="".concat(Yr,"/checkout.js"),Pa="https://www.paypal.com",Ia="https://pay.google.com",L={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"},ka="VALIDATION_CUSTOM",Ta="portable-wallets",xt={BUTTON:"accelerated-checkout-button",BUTTON_ON_CART:"accelerated-checkout-button-cart",CONTAINER:"accelerated-checkout-button-container"},Da="unknown",Ra={name:"buy_it_now",supports_subs:!0,supports_def_opts:!0,wallet_params:{}};function Na(e){try{return!e.toString().includes("[native code]")}catch(t){return!0}}const gr=new Map,yi={checkDuplicate({errorClass:e,message:t}){if(gr.has(e)){const n=gr.get(e);if(n.has(t))return!0;n.add(t)}else gr.set(e,new Set([t]));return!1},reset(){}};var Se;class ot extends Error{constructor(t,{groupingHash:n,...r}={}){super(t,r),G(this,Se),c(this,"autogenerateHash",!1),c(this,"useHashPrefix",!1),z(this,Se,n)}get groupingHash(){var t;const n=(t=S(this,Se))!=null?t:this.autogenerateHash?fi(this.message):"";return(this.useHashPrefix?"".concat(this.name,"-").concat(n):n)||void 0}}Se=new WeakMap;function fi(e){return e.toLowerCase().slice(0,100).replace(/[^a-z0-9\s]/g,"").trim().split(/\s+/).slice(0,5).join("-")}const Ie="DeveloperError";class rt extends Error{constructor({code:t,message:n},r){const a="An unexpected error happened likely because of customizations made to HTML/JavaScript on this site ".concat(n);super("[".concat(t,"]: ").concat(a),r),c(this,"name",Ie),c(this,"code"),this.code=t}}const Oa="SilencedError";class et extends Error{constructor(){super(...arguments),c(this,"name",Oa)}}class bi extends Error{constructor(){super(...arguments),c(this,"name","MissingConfigError")}}class pt extends ot{constructor(){super(...arguments),c(this,"name","NoResponseError"),c(this,"useHashPrefix",!0),c(this,"autogenerateHash",!0)}}class ke extends ot{constructor(t,{errorDetails:n}){const r=ke.generateGraphQLGroupingHash(t,n);super(t,{groupingHash:r}),c(this,"errorDetails"),c(this,"useHashPrefix",!0),this.name="GraphQLResponseError",this.errorDetails=n}static generateGraphQLGroupingHash(t,n){const{operationName:r}=n,a=this.getErrorMessageCategoryFromMessage(t);return r?"".concat(r,"-").concat(a):a}static getErrorMessageCategoryFromMessage(t){const n=[[/Variable \$\w+ of type \w+!? was provided invali
1d 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"]];for(const[o,i]of n){const s=t.match(o);if(s){const l=s[1];return l?"".concat(i,"-").concat(l):i}}let r=t;const a=[/^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];for(const o of a)r=r.replace(o,"");return r=r.slice(0,100),r.toLowerCase().replace(/[^a-z0-9\s]/g,"").trim().split(/\s+/).slice(0,5).join("-")||"unknown-error"}}const La="IgnoredGraphQLResponseError";class _e extends ke{constructor(t,{reason:n,errorDetails:r}){super(t,{errorDetails:r}),c(this,"reason"),this.name=La,this.reason=n}}class xa extends ot{constructor(t){const n="[".concat(t,"] completion returned null result");super(n,{groupingHash:"".concat(t,"-expected-completion-null-result")})}}function O(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var wi=0;function Et(e){return"__private_"+wi+++"_"+e}function ir(e){return Object.entries(e).map(([t,n])=>({key:t,value:{stringValue:String(n)}}))}function _i(e){return Object.entries(e).map(([t,n])=>({key:t,value:Ma(n)}))}function Ma(e){if(Array.isArray(e))return{arrayValue:{values:e.map(t=>Ma(t))}};switch(typeof e){case"boolean":return{boolValue:!!e};case"number":return{doubleValue:Number(e)};case"string":default:return{stringValue:String(e)}}}const Qr=1,Ei=Ai(5,2,12);function Ai(e,t,n){const r=[0];for(let a=0;a<n;a++){const o=Math.floor(e*t**a);r.push(o)}return r}var Pt=Et("exporter"),Z=Et("attributes"),W=Et("metrics"),It=Et("logs");class Si{constructor({exporter:t,attributes:n}){Object.defineProperty(this,Pt,{writable:!0,value:void 0}),Object.defineProperty(this,Z,{writable:!0,value:void 0}),Object.defineProperty(this,W,{writable:!0,value:[]}),Object.defineProperty(this,It,{writable:!0,value:[]}),O(this,Pt)[Pt]=t,O(this,Z)[Z]=n!=null?n:{}}addAttributes(t){O(this,Z)[Z]={...O(this,Z)[Z],...t}}histogram({name:t,value:n,unit:r,bounds:a,attributes:o,scale:i}){const s=Date.now()*1e6;a?O(this,W)[W].push({name:t,type:"histogram",value:n,unit:r,timeUnixNano:s,attributes:o,bounds:a}):O(this,W)[W].push({name:t,type:"exponential_histogram",value:n,unit:r,timeUnixNano:s,attributes:o,scale:i})}counter({name:t,value:n,unit:r,attributes:a}){const o=Date.now()*1e6;O(this,W)[W].push({name:t,type:"counter",value:n,unit:r,timeUnixNano:o,attributes:a})}gauge({name:t,value:n,unit:r,attributes:a}){const o=Date.now()*1e6;O(this,W)[W].push({name:t,type:"gauge",value:n,unit:r,timeUnixNano:o,attributes:a})}log({body:t,attributes:n}){const r=Date.now()*1e6;O(this,It)[It].push({timeUnixNano:r,body:t,attributes:n})}async exportMetrics(){const t={};O(this,W)[W].forEach(r=>{switch(r.attributes={...O(this,Z)[Z],...r.attributes},r.type){case"histogram":Ci(t,r);break;case"exponential_histogram":vi(t,r);break;case"counter":Pi(t,r);break;case"gauge":Ii(t,r);break}});const n=Object.values(t);n.length!==0&&(O(this,W)[W]=[],await O(this,Pt)[Pt].exportMetrics(n))}async exportLogs(){const t=O(this,It)[It].map(n=>{const r={timeUnixNano:n.timeUnixNano,observedTimeUnixNano:n.timeUnixNano,attributes:_i({...O(this,Z)[Z],...n.attributes})};return n.body&&(r.body={stringValue:n.body}),r});t.length!==0&&(O(this,It)[It]=[],await O(this,Pt)[Pt].exportLogs(t))}}function Ci(e,t){var n;const{name:r,value:a,unit:o,timeUnixNano:i,attributes:s}=t,l=(n=t.bounds)!==null&&n!==void 0?n:Ei,d=new Array(l.length+1).fill(0);e[r]||(e[r]={name:r,unit:o||"1",histogram:{aggregationTemporality:Qr,dataPoints:[]}});for(let u=0;u<d.length;u++){const p=l[u];if(p===void 0)d[u]=1;else if(a<=p){d[u]=1;break}}e[r].histogram.dataPoints.push({startTimeUnixNano:i,timeUnixNano:i,count:1,sum:a,min:a,max:a,bucketCounts:d,explicitBounds:l,attributes:ir(s!=null?s:{})})}function vi(e,t){const{name:n,value:r,unit:a,timeUnixNano:o,attributes:i,scale:s}=t;e[n]||(e[n]={name:n,unit:a||"1",exponentialHistogram:{aggregationTemporality:Qr,dataPoints:[]}});const l=r<=0?0:r,d=s||3,u=2**d/Math.log(2),p=Math.ceil(Math.log(r)*u)-1,m=r<=0?1:0,g={offset:0,bucketCounts:[]},f={offset:r>0?p:0,bucketCounts:r>0?[1]:[]};e[n].exponentialHistogram.dataPoints.push({attributes:ir(i!=null?i:{}),startTimeUnixNano:o,timeUnixNano:o,count:1,sum:l,scale:d,zeroCount:m,positive:f,negative:g,min:l,max:l,zeroThreshold:0})}function Pi(e,t){const{name:n,value:r,unit:a,timeUnixNano:o,attributes:i}=t;e[n]||(e[n]={name:n,unit:a||"1",sum:{aggregationTemporality:Qr,isMonotonic:!0,dataPoints:[]}}),e[n].sum.dataPoints.push({startTimeUnixNano:o,timeUnixNano:o,asDouble:r,attributes:ir(i!=null?i:{})})}function Ii(e,t){const{name:n,value:r,unit:a,timeUnixNano:o,attributes:i}=t;e[n]||(e[n]={name:n,unit:a||"1",gauge:{dataPoints:[]}}),e[n].gauge.dataPoints.push({startTimeUnixNano:o,timeUnixNano:o,asDouble:r,attributes:ir(i!=null?i:{})})}var ie=Et("url"),kt=Et("serviceName"),se=Et("logger"),le=Et("fetchFn");class ki{constructor(t,n,r){Object.defineProperty(this,ie,{writable:!0,value:void 0}),Object.defineProperty(this,kt,{writable:!0,value:void 0}),Object.defineProperty(this,se,{writable:!0,value:void 0}),Object.defineProperty(this,le,{writable:!0,value:void 0}),O(this,ie)[ie]=t.replace(/\/v1\/(logs|metrics|traces)\/?$/,""),O(this,kt)[kt]=n,O(this,se)[se]=r==null?void 0:r.logger,O(this,le)[le]=r==null?void 0:r.fetchFn}async exportMetrics(t){const n={resourceMetrics:[{resource:{attributes:[{key:"service.name",value:{stringValue:O(this,kt)[kt]}}]},scopeMetrics:[{scope:{name:"open-telemetry-mini-client",version:"1.1.0",attributes:[]},metrics:t}]}]};await this.exportTo(n,"/v1/metrics")}async exportLogs(t){const n={resourceLogs:[{resource:{attributes:[{key:"service.name",value:{stringValue:O(this,kt)[kt]}}]},scopeLogs:[{scope:{name:"open-telemetry-mini-client",version:"1.1.0",attributes:[]},logRecords:t}]}]};await this.exportTo(n,"/v1/logs")}async exportTo(t,n){var r;const a=await this.exporterFetch()("".concat(O(this,ie)[ie]).concat(n),{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if((r=O(this,se)[se])===null||r===void 0||r.log({status:a.status}),!a.ok){if(a.status===400){const o=await a.text();throw new pe("Invalid OpenTelemetry Data: ".concat(o))}if(a.status===429||a.status===503){const o=await a.text(),i=a.headers.get("Retry-After"),s=i?{seconds:Number(i)}:void 0;throw new pe("Server did not accept data",{errorData:o,retryAfter:s,body:t})}throw new pe("Server responded with ".concat(a.status))}}exporterFetch(){return O(this,le)[le]||fetch}}
1class pe extends Error{constructor(t,n){super(t),this.metadata=void 0,this.name="OpenTelemetryClientError",this.metadata=n}}const Ti="https://otlp-http-production.shopifysvc.com",Di="portable_wallets";var Xt;class Ri{constructor(t){G(this,Xt),z(this,Xt,t)}async exportMetrics(t){var n;try{await S(this,Xt).exportMetrics(t)}catch(r){if(r instanceof pe){const a=(n=r.metadata)==null?void 0:n.retryAfter;if(a){await new Promise(o=>{setTimeout(()=>{this.exportMetrics(t),o()},a.seconds*1e3)});return}}console.error("Suppressed error while exporting metrics:",r,r instanceof Error?r.cause:void 0)}}async exportLogs(t){var n;try{await S(this,Xt).exportLogs(t)}catch(r){if(r instanceof pe){const a=(n=r.metadata)==null?void 0:n.retryAfter;if(a){await new Promise(o=>{setTimeout(()=>{this.exportLogs(t),o()},a.seconds*1e3)});return}}console.error("Suppressed error while exporting logs:",r,r instanceof Error?r.cause:void 0)}}}Xt=new WeakMap;const Ni=new ki(Ti,Di),Oi=new Ri(Ni),C=new Si({exporter:Oi}),Li="TelemetryExportError",za="LimitedCartQueryError";class xi extends Error{constructor(){super(...arguments),c(this,"name",za)}}const Mi=["log","error","debug","warn","info","table"],Ua=["OpenTelemetryClientError",Oa,Li,La,Ie],zi=["Load failed","Failed to fetch","when attempting to fetch resource","GraphQL mutation failed with status 404","Component closed",'"isTrusted":true',...Ua],Sn=new Map([["TypeError","Illegal constructor"],[za,"Limited cart query returned no response"],["AbortError","Fetch is aborted"]]),Ui=["replaceProperty","replaceWithProxy"],Fi=["chrome-lighthouse","meta-externalads","crawler","spider","scraper","facebookexternalhit","googleother","bot"];function Bi(e){const t=e.exceptions[0];return Hi()?"silenced-user-agent":$i(e)?"empty-stack-trace":Gi(t)?"spin":Vi()?"monkey-patch":Ki(e)?"external-error":qi(e)?"injected-code":Xi(e)?"developer-error":Qi(t.message)?"discarded-message":Ji(e)?"discarded-error-class":Zi(t)?"discarded-class-message":ts(e)?"unactionable-invalid-error":Wi(e)||null}function Hi(){const e=navigator.userAgent.toLowerCase();return Fi.some(t=>e.includes(t))}function $i(e){return e.exceptions[0].stacktrace.length===0}function Gi(e){return e.stacktrace.some(t=>{var n;return(n=t.file)==null?void 0:n.includes("spin.dev")})}function Vi(){return[HTMLElement,Event,document.createElement,URL].some(Na)||ji()}function ji(){return Mi.some(e=>typeof console[e]!="function")}function qi(e){return e.exceptions.some(t=>t.stacktrace.some(n=>n.inProject&&"method"in n&&Ui.some(r=>n.method===r||n.method.endsWith(".".concat(r)))))}function Wi(e){const t=e.exceptions.map(n=>n.stacktrace.filter(r=>!Yi(r)));return t.some(n=>{var r;return!((r=n[0])!=null&&r.inProject)})?"external-trigger":t.some(n=>n.filter(r=>r.inProject).every(r=>[Pa,Yr,Ia].some(a=>r.file.startsWith(a))))?"wallet-sdk-stack-trace":null}function Yi(e){return e.file.includes("native code")||e.file.includes("/cdn/wpm/")}function Ki(e){return!e.exceptions[0].stacktrace.some(t=>t.inProject)}function Qi(e){return zi.some(t=>e==null?void 0:e.includes(t))}function Xi(e){const t=e.exceptions.some(n=>n.errorClass===Ie);return t&&console.error(e.exceptions[0]),t}function Ji(e){return e.exceptions.some(t=>Ua.includes(t.errorClass))}function Zi(e){const t=e.errorClass,n=e.message;return Sn.has(t)&&(n==null?void 0:n.includes(Sn.get(t)))}function ts(e){return e.exceptions[0].errorClass==="BugsnagInvalidError"&&e.unhandled}var I=(e=>(e.ButtonRender="portable_wallets_button_render",e.Decelerated="portable_wallets_decelerated",e.DeliveryWrongNumberOfLines="portable_wallets_delivery_wrong_number_of_lines",e.DigitalPhysicalMismatch="portable_wallets_digital_physical_mismatch",e.InitCompleted="portable_wallets_init_completed",e.InstrumentLoadEligibility="portable_wallets_instrument_load_eligibility",e.InstrumentLoaded="portable_wallets_instrument_loaded",e.InstrumentLoadTime="portable_wallets_instrument_load_time",e.InstrumentLoadTimeFromPageLoad="portable_wallets_instrument_load_time_from_page_load",e.MonorailProduceError="portable_wallets_monorail_produce_error",e.SheetClicked="portable_wallets_sheet_clicked",e.SheetCancelled="portable_wallets_sheet_cancelled",e.SheetFailed="portable_wallets_sheet_failed",e.UpdateFailed="portable_wallets_update_failed",e.PayPalTokenCreationError="portable_wallets_paypal_token_creation_error",e.AuthorizationAttempt="portable_wallets_authorization_attempt",e.AuthorizationComplete="portable_wallets_authorization_complete",e.CartTokenMissing="portable_wallets_cart_token_missing",e.RemovePersonalDataResult="portable_wallets_cart_remove_personal_data_result",e.GooglePayNotEligibleWebview="portable_wallets_google_pay_not_eligible_webview",e.WalletConfigDeveloperError="portable_wallets_wallet_config_developer_error",e.LegacyCartCookie="portable_wallets_legacy_cart_cookie",e.StyleBackwardsCompatibility="portable_wallets_style_backwards_compatibility",e.StyleBackwardsCompatibilityExecutionTime="portable_wallets_style_backwards_compatibility_execution_time",e.StyleBackwardsCompatibilityRules="portable_wallets_style_backwards_compatibility_rules",e.AmazonPayLoadRetries="portable_wallets_amazon_pay_sdk_load_retries",e.DynamicTaxFailed="portable_wallets_dynamic_tax_failed",e.SheetLoaded="portable_wallets_sheet_loaded",e.ErrorTriggered="portable_wallets_error_triggered",e.GooglePayNullCartOnAuthorize="portable_wallets_google_pay_null_cart_on_authorize",e.ApplePayNullCartOnShippingContactSelected="portable_wallets_apple_pay_null_cart_on_shipping_contact_selected",e.UnrecoverableCartError="portable_wallets_unrecoverable_cart_error",e.ShopPayPersonalizedIframeLoadTime="portable_wallets_shop_pay_personalized_iframe_load_time",e.ShopPayPersonalizedIframeLoadTimeFromPageLoad="portable_wallets_shop_pay_personalized_iframe_load_time_from_page_load",e.PaymentCompletedAfterAbort="portable_wallets_payment_completed_after_abort",e.WalletSessionAbortError="portable_wallets_wallet_session_abort_error",e.CartPaymentUpdateRetryResult="portable_wallets_cart_payment_update_retry_result",e.ProductFormError="portable_wallets_product_form_error",e.CardsinkDepositResult="portable_wallets_cardsink_deposit_result",e.AddressFieldError="portable_wallets_address_field_error",e))(I||{}),Rt=(e=>(e.InstrumentSdkLoaded="portable_wallets_instrument_sdk_loaded",e.InstrumentSdkFailed="portable_wallets_instrument_sdk_failed",e.InstrumentSdkEligible="portable_wallets_instrument_sdk_eligible",e.InstrumentSdkNotEligible="portable_wallets_instrument_sdk_not_eligible",e))(Rt||{}),y=(e=>(e.BuyItNow="BuyItNow",e.MoreOptions="MoreOptions",e.ApplePay="ApplePay",e.PayPal="PayPal",e.Venmo="Venmo",e.GooglePay="GooglePay",e.ShopPay="ShopPay",e.MetaPay="FacebookPay",e.BuyWithPrime="BuyWithPrime",e.AmazonPay="AmazonPay",e.Unknown="Unknown",e))(y||{}),H=(e=>(e.InvalidQuantity="InvalidQuantity",e.VariantRequiresSellingPlan="VariantRequiresSellingPlan",e.SellingPlanNotApplicable="SellingPlanNotApplicable",e.MerchandiseIdInvali
1d="MerchandiseIdInvalid",e.IgnoredResponseError="IgnoredGraphQLResponseError",e.NoResponse="NoResponse",e.InvalidInput="InvalidInput",e.MerchandiseNotApplicable="MerchandiseNotApplicable",e.ProductFormError="ProductFormError",e.MerchandiseLineTransformersRunError="MerchandiseLineTransformersRunError",e.GiftCardRecipientInvalid="GiftCardRecipientInvalid",e))(H||{}),T=(e=>(e.CartPage="cart_page",e.CartAjax="cart_ajax",e.ProductPage="product",e.Checkout="checkout",e.Unknown="unknown",e))(T||{}),de=(e=>(e.CartChange="/cart/change",e.CartUpdate="/cart/update",e.CartAdd="/cart/add",e.CartClear="/cart/clear",e))(de||{}),Ot=(e=>(e.OneTimePurchase="ONE_TIME_PURCHASE",e.Subscription="SUBSCRIPTION",e))(Ot||{});let sr=es();function es(){return{shop_id:Da,debug:!1,pageType:T.Unknown}}function Dr(e){Object.assign(sr,e)}function Xr(){const{debug:e,...t}=sr;return t}function Fa(){return sr.debug}function Jr(){return sr.pageType}function rs(e,t){const n=e.exceptions[0];if(!n||!n.message||yi.checkDuplicate(n))return!1;const r=os(t);ns(e,r,t);let a=null;try{a=Bi(e)}catch(i){const s=i;console.error(s);const l={errorClass:"UnfilterableError",message:"Could not properly filter error with message: ".concat(s.message),stacktrace:Sa(Ta,s)};e.exceptions.unshift(l)}cs(a);const o=a==null;return(o||Fa())&&ds({errorClass:n.errorClass,message:n.message,stacktrace:JSON.stringify(n.stacktrace),filterResult:a,metadata:JSON.stringify(e.metaData)}),o}function ns(e,t,n){var r,a,o,i,s;const l=(o=(a=(r=window.ShopifyAnalytics)==null?void 0:r.lib)==null?void 0:a.trekkie)==null?void 0:o.defaultAttributes;e.context=window.location.pathname,e.request||(e.request={}),e.request.url=window.location.href,e.device.orientation=(s=(i=window.screen)==null?void 0:i.orientation)==null?void 0:s.type,is(e),ss(e),e.groupingHash=as(t);const{shop_id:d,...u}=Xr();e.metaData={...e.metaData,shop:{shopId:d,...u,...e.metaData.shop},custom:{...e.metaData.custom,customFetch:Na(fetch),...ls(n)},error_source:{shop_id:d},monorail:l},t[0]instanceof ke&&(e.metaData.graphql={...t[0].errorDetails},t[0]instanceof _e&&(e.metaData.graphql.reason=t[0].reason))}function as(e){for(const t of e)if("groupingHash"in t&&t.groupingHash)return t.groupingHash.toString()}function os(e){const t=[];let n=e;for(;n instanceof Error&&t.length<20;){t.push(n);const r="cause"in n?n.cause:null;if(!r)break;n=r}return t}function is(e){for(const t of e.exceptions)for(const n of t.stacktrace)[Pa,Yr,Ia].some(r=>n.file.startsWith(r))&&(n.inProject=!0)}function ss(e){var t;for(const n of e.exceptions)for(const r of n.stacktrace)(t=r.file)!=null&&t.includes("portable-wallets")&&(r.file=r.file.split("#")[0].split("?")[0])}function ls(e){if(Fa()&&!(!(e instanceof Error)||!e.stack))return{rawStack:e.stack}}function cs(e){C.counter({name:I.ErrorTriggered,value:1,attributes:{filterResult:e||"valid-error"}})}function ds(e){const t=Xr();C.log({body:"Bugsnag Error",attributes:{...t,shop_id:t.shop_id,shopId:t.shop_id,...e}})}var ba;const us={apiKey:"e6b446c1ebe782e2b2fc7eb8ef0dc791",appId:Ta,appVersion:"0.1.59",releaseStage:"production",locale:"en",userAgent:navigator.userAgent,metadata:{user:{id:(ba=we(mi))!=null?ba:"unknown"},app:{release:"3c32342a13c49ea62f140f0982b24a8e3ccdc9e2"}},onError:rs},b=new li(us);b.addOnPostError(e=>{b.leaveBreadcrumb("Bugsnag Error Notified",{errorClass:e.exceptions[0].errorClass,message:e.exceptions[0].message},"error")});const hs={en:{express_checkout:"Express checkout",show_more_options:"Show more",hide_more_options:"Hide more",instruments_copy:{checkout:{buy_now:"Buy it now"}},error_dialogs:{checkout:{title:"Transaction failed",generic_error:"Checkout is currently unavailable due to technical problems. Please try again in a few minutes.",button_text:"Close"},product:{out_of_stock:"This item is no longer available.",gift_card_recipient_validation_error:"The specified gift card recipient is invalid."},wallet:{title:"%{wallet} unavailable",generic_error:"There was an issue with %{wallet}. Try again or use a different payment method.",eligibility_error:"Items that were eligible for %{wallet} are no longer in your cart."}},more_payment_options:"More payment options",action:{view:"View %{content}"},subscriptions:{cancellation_policy:"Cancellation policy",policy_not_found:"The subscription policy could not be found. Refresh the page or contact us for more information."},managed_markets:{terms_and_conditions:"Merchant of Record Terms and Conditions",privacy_policy:"Merchant of Record Privacy Policy",policy_not_found:"The policy could not be found. Refresh the page or contact us for more information"},shipping_methods:{connect_shipping_methods:"%{methodOne} and %{methodTwo}",choose_delivery_strategy:"Choose a delivery method"},delivery_promises:{connect_delivery_promises:"%{promiseOne} and %{promiseTwo}"},order_summary:{total:"Total",subtotal:"Subtotal",duties:"Duties",taxes:"Estimated taxes",shipping:"Shipping",shipping_one_time_purchase:"Shipping (One-time purchase)",shipping_subscription:"Shipping (Subscription)",discount:"Discount",subscriptions:{recurring_total_tooltip_line:"Does not include shipping, tax, duties, or any applicable discounts",recurring_totals:"%{fixedPrice} every %{interval}",recurring_totals_with_policies:{one:"First payment %{fixedPrice}, then %{recurringPrice} every %{interval}",other:"First %{count} payments %{fixedPrice} each, then %{recurringPrice} every %{interval}"},recurring_total_intervals:{day:{one:"day",other:"%{count} days"},month:{one:"month",other:"%{count} months"},week:{one:"week",other:"%{count} weeks"},year:{one:"year",other:"%{count} years"}}}},brand:{amazon_pay:"Amazon Pay",apple_pay:"Apple Pay",buy_with_prime:"Buy with Prime",payp
1al:"PayPal",google_pay:"Google Pay",shop_pay:"Shop Pay"},buy_with_button_content:"Buy with %{wallet}",pay_with_button_content:"Pay with %{wallet}",shop_promise_delivery:{same_day:"Same-day delivery",next_day:"Next-day delivery",two_day:"2-day delivery"},errors:{address_unserviceable:"%{shopName} does not currently deliver to this address. Use a different address to complete your purchase.",missing:{email:"Enter an email address",first_name:"Enter a first name",last_name:"Enter a last name",address1:"Enter an address",address2:"Enter an apartment, suite, etc.",city:"Enter a city",zone:"Select a state / province",country:"Select a country",phone:"Enter a phone number",postal_code:"Enter a ZIP / postal code",shipping_option:"Select a shipping method",emirate:"Enter an emirate"},invalid:{email:"Enter a valid email",first_name:"Enter a valid first name",last_name:"Enter a valid last name",address1:"Enter a valid address",address2:"Enter a valid apartment, suite, etc.",city:"Enter a valid city",zone:"Select a valid state / province",country:"Select a country / region",phone:"Enter a valid phone number",postal_code:"Enter a valid zip / postal code",billing_address:"Invalid billing address",shipping_address:"Invalid shipping address",payment_method:"Invalid payment method",discount:"Invalid discount",emirate:"Enter a valid emirate"},emojis:{first_name:"First name cannot contain emojis",last_name:"Last name cannot contain emojis",city:"City cannot contain emojis",address1:"Address line cannot contain emojis",address2:"Second address line cannot contain emojis",postal_code:"Postal code/zip cannot contain emojis",phone:"Phone number cannot contain emojis"},too_long:{address1:"Address line is too long",address2:"Second address line is too long",first_name:"First name is too long",last_name:"Last name is too long",city:"City is too long"},url:{first_name:"First name cannot contain a URL",last_name:"Last name cannot contain a URL"},html_tags:{first_name:"First name cannot contain HTML tags",last_name:"Last name cannot contain HTML tags",city:"City cannot contain HTML tags",address1:"Address line cannot contain HTML tags",address2:"Second address line cannot contain HTML tags"},currency:{mismatch:"Your cart and currency has been updated based on your shipping country."}}}};let yr;class Cn extends Error{constructor(t,n){const r="i18n: Missing or invalid translation '".concat(t,"' in '").concat(n,"'");super(r)}}class ps extends Error{constructor(t,n,r){const a="i18n: Missing translation template key '".concat(t,"' for '").concat(n,"' in '").concat(r,"'");super(a)}}class ms extends Error{constructor(t,n,r){const a="i18n: Invalid pluralization for '".concat(t,"':'").concat(n,"' in '").concat(r,"'");super(a)}}function lr(){return yr==null&&(yr=gs(hs)),yr}function gs(e){const t=(o,i)=>typeof o!="string"&&i.count!==void 0,n=(o,i)=>{let s=i===1?"one":"other";return i===0&&typeof o!="string"&&o.zero!==void 0&&(s="zero"),s},r=(o,i={})=>{const s=o.match(/%\{.+?\}/g);return s?s.reduce((l,d)=>{const u=d.replace(/%\{(.*)\}/,"$1");return i[u]?l.replace(d,i[u]):(b.notify(new ps(u,o,a)),l)},o):o},a=ys();return{locale:a,translate(o,i={}){var s;const l=o.split(".");let d=e[a];try{for(const u of l)switch(typeof d){case"object":d=d[u];break;case"string":case"undefined":throw new Cn(o,a)}if(t(d,i)){if(typeof d=="string")throw new ms(o,d,a);d=d[n(d,i.count)]}if(typeof d!="string")throw new Cn(o,a);return r(d,i)}catch(u){return b.notify(u),(s=i.defaultValue)!=null?s:o}}}}function ys(){return"en"}function vn(e){const t=document.querySelectorAll("shopify-accelerated-checkout .shopify-payment-button__skeleton, shopify-accelerated-checkout-cart .wallet-cart-button__skeleton"),n=document.getElementById("shopify-buyer-consent");for(let r=0;r<t.length;r++)t[r].remove();n&&n.remove()}function Ba(e){!(e instanceof ErrorEvent)||!(typeof e.message=="string"&&e.message.includes("import.meta"))||!(typeof e.filename=="string"&&e.filename.includes("portable-wallets"))||(window.removeEventListener("error",Ba),window.Shopify.PaymentButton.failedToLoad=e,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",window.Shopify.PaymentButton.init):window.Shopify.PaymentButton.init())}window.addEventListener("error",Ba);const ue=[];function ut(e,t,n){if(window.customElements==null)return b.leaveBreadcrumb("customElements is null on window"),vn(),!1;try{const r=t;return window.customElements.get(e)||(window.customElements.define(e,r),n!=null&&n.isChildCustomElement&&ue.push(e)),!0}catch(r){return b.notify(r),vn(),!1}}function Fe(){const e=new URLSearchParams(window.location.search);return function(t){return!!e.get(t)}}function Zr(){try{const e=window.__WALLET_TIMEOUT_MULTIPLIER;if(e==null)return 1;const t=Number(e);return!Number.isFinite(t)||t<1?1:Math.min(t,10)}catch(e){return 1}}function fs(){var e,t,n,r;const a=(e=window.Shopify)==null?void 0:e.CartType;if(a===T.CartAjax)return T.CartAjax;if(a===T.CartPage)return T.CartPage;const o=(r=(n=(t=window.ShopifyAnalytics)==null?void 0:t.meta)==null?void 0:n.page)==null?void 0:r.pageType;if(o)switch(o.toLowerCase()){case"product":return T.ProductPage;case"cart":return T.CartPage}const i=document.querySelector("#shop-js-analytics");if(i)try{const s=JSON.parse(i.textContent||"{}");
1if(s.pageType)switch(s.pageType.toLowerCase()){case"product":return T.ProductPage;case"cart":return T.CartPage}}catch(s){console.error("Error parsing JSON script tag:",s)}return T.Unknown}function bt(e){return Number(e).toFixed(2)}function Be(e){return He(e==null?void 0:e.id)}function He(e){if(e!=null&&e.includes("gid://shopify/Cart/"))return e.replace("gid://shopify/Cart/","").split("?")[0]}function mt(){let e;return[new Promise(t=>e=t),e]}function Ha(){return!!document.querySelector('[data-source-attribution="shopify.shop-promise-pdp"]')}function ze(){return new Date().getTime()}function tn(e){return e.find(t=>t.code===ka&&!!t.message)}function Pn(){const e=window.navigator.userAgent,t=e.includes("iPhone OS 26_0"),n=e.includes("Version/26.0"),r=e.includes("iPhone OS");return t||n&&r}function bs(e){return e.title==="Default Title"?e.product.title:"".concat(e.product.title," - ").concat(e.title)}function $a(e,t){return e.map(n=>{let r=bs(n.merchandise);n.quantity>1&&(r="".concat(n.quantity," \xD7 ").concat(r)),n.isNestedLine&&(r="\u2937 ".concat(r));const a=bt(n.totalAmount.amount);return t(r,a)})}function ws(){var e;return(e=window.scheduler)!=null&&e.yield?window.scheduler.yield():new Promise(t=>{var n;(n=window.scheduler)!=null&&n.postTask?window.scheduler.postTask(t):setTimeout(t,0)})}class _s extends HTMLElement{constructor(){super(...arguments),c(this,"originalStyle",{position:"",overflow:"",top:""}),c(this,"scrollPosition",0),c(this,"formerFocus",null)}connectedCallback(){this.shadowRoot||this.attachShadow({mode:"open"}),this.formerFocus=document.activeElement;const t=lr();this.render(t);const n=this.shadowRoot,r=n.getElementById("modal");n.querySelectorAll("button").forEach(i=>i.addEventListener("click",this.closeModal.bind(this)));const a=n.getElementById("overlay");a==null||a.addEventListener("click",i=>this.handleOutsideClick(i,r)),document.addEventListener("keydown",this.handleEscapeKey.bind(this));const o=document.createElement("style");o.textContent=ei,n.appendChild(o),this.applyScrollLock(),this.trapFocus(r,n),ut("svg-icon",ti)}trapFocus(t,n){if(!t)return;const r=t.querySelectorAll("a[href], button"),a=Array.from(r),o=a[0],i=a[a.length-1];t.addEventListener("keydown",s=>{s.key==="Tab"&&!s.shiftKey&&n.activeElement===i&&(s.preventDefault(),o.focus()),s.key==="Tab"&&s.shiftKey&&n.activeElement===o&&(s.preventDefault(),i.focus())}),o.focus()}handleOutsideClick(t,n){n&&(n.contains(t.target)||this.closeModal())}handleEscapeKey(t){t.key==="Escape"&&this.closeModal()}closeModal(){var t;this.removeScrollLock(),this.remove(),this.formerFocus&&"focus"in(this==null?void 0:this.formerFocus)&&typeof this.formerFocus.focus=="function"&&((t=this.formerFocus)==null||t.focus())}applyScrollLock(){this.originalStyle={position:document.body.style.position,overflow:document.body.style.overflow,top:document.body.style.top},document.body.style.overflow="hidden",Pn()&&(this.scrollPosition=window.scrollY,document.body.style.position="fixed",document.body.style.top="-".concat(this.scrollPosition,"px"))}removeScrollLock(){var t,n,r,a,o,i;document.body.style.overflow=(n=(t=this.originalStyle)==null?void 0:t.overflow)!=null?n:"",Pn()&&(document.body.style.position=(a=(r=this.originalStyle)==null?void 0:r.position)!=null?a:"",document.body.style.top=(i=(o=this.originalStyle)==null?void 0:o.top)!=null?i:"",window.scrollTo({top:this.scrollPosition,behavior:"instant"}))}render(t){const n=this.getAttribute("title"),r=this.getAttribute("has-close-button"),a=t.translate("error_dialogs.checkout.button_text"),o='\n <footer>\n <button type="button" id="close-button" tabindex="0">'.concat(a,"</button>\n </footer>\n ");this.shadowRoot.innerHTML='\n <div id="overlay">\n <div id="modal" role="dialog" aria-modal="true" aria-labelledby="title">\n <header>\n <h2 id="title">\n <span class="capitalize">'.concat(n,'</span>\n </h2>\n <button type="button" id="close-icon" aria-label=').concat(a,' tabindex="0">\n <svg-icon color="gray"></svg-icon>\n </button>\n </header>\n <div id="content">\n <p><slot></slot></p>\n </div>\n ').concat(r?o:"","\n </div>\n </div>\n ")}}
1const Es="@keyframes topLevelModalLoadingSkeleton{50%{opacity:1}75%{opacity:.5}to{opacity:1}}top-level-modal .text-skeleton{display:inline-block;width:100%;height:14px;margin-bottom:7px;animation:topLevelModalLoadingSkeleton 4s ease infinite;animation-delay:-.168s;text-decoration:none!important;background-color:#dedede}top-level-modal .text-skeleton:last-of-type{width:50%}";function cr({type:e="button",label:t=void 0}={}){const n=document.createElement("button");return n.type=e,t&&n.setAttribute("aria-label",t),n}function Te(e,t){for(const[n,r]of Object.entries(t))e.setAttribute(n,r)}function me(e,t){for(const[n,r]of Object.entries(t))e.style.setProperty(n,r)}function Ga(){return"\n <style>".concat(Es,'</style>\n <span class="text-skeleton"> </span>\n <span class="text-skeleton"> </span>\n <span class="text-skeleton"> </span>\n <span class="text-skeleton"> </span>\n <span class="text-skeleton"> </span>\n ')}function As(){const e=document.querySelector("top-level-modal");e&&"closeModal"in e&&typeof e.closeModal=="function"&&e.closeModal()}function Va(e){As();const t=document.createElement("top-level-modal");return Te(t,{"data-testid":"top-level-modal",title:e}),t}function Ss(e,t){e.innerHTML='<div style="text-align: center;">'.concat(t,"</div>")}function ae(e,t){var n;const r=document.createElement("top-level-modal");r.textContent=t,Te(r,{"data-testid":"top-level-modal","has-close-button":"true",title:e}),(n=document.body)==null||n.appendChild(r)}function en(e,t,n){var r;const a=Va(e);t instanceof Promise?(a.innerHTML=Ga(),t.then(o=>{o&&o!==""?a.innerHTML=o:a.innerHTML=n!=null?n:""}).catch(()=>{a.innerHTML=n!=null?n:""})):a.innerHTML=t,(r=document.body)==null||r.appendChild(a)}function at(e,t){ae(t.translate("error_dialogs.wallet.title",{wallet:e}),t.translate("error_dialogs.wallet.generic_error",{wallet:e}))}function Nt(e){ae(e.translate("error_dialogs.checkout.title"),e.translate("error_dialogs.checkout.generic_error"))}function Mt(e,t){ae(e.translate("error_dialogs.checkout.title"),t)}function zt(e,t){switch(t){case H.GiftCardRecipientInvalid:ae(e.translate("error_dialogs.checkout.title"),e.translate("error_dialogs.product.gift_card_recipient_validation_error"));break;default:Nt(e);break}}function wt(e){ae(e.translate("error_dialogs.checkout.title"),e.translate("error_dialogs.product.out_of_stock"))}ut("top-level-modal",_s);class De 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")}}const Cs="#more-payment-options-link{cursor:pointer}";function vs(e,t,n){return(t=Is(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function In(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function kn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?In(Object(n),!0).forEach(function(r){vs(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):In(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ps(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Is(e){var t=Ps(e,"string");return typeof t=="symbol"?t:t+""}const ks="https://monorail-edge.shopifysvc.com",Ts="/v1/produce";function Ds(){if(typeof crypto<"u"&&crypto&&typeof crypto.randomUUID=="function")return crypto.randomUUID();const e=new Array(36);for(let t=0;t<36;t++)e[t]=Math.floor(Math.random()*16);return e[14]=4,e[19]=e[19]&=-5,e[19]=e[19]|=8,e[8]=e[13]=e[18]=e[23]="-",e.map(t=>t.toString(16)).join("")}function Rs(e,t=!0){return e&&Object.keys(e).length&&t?Object.keys(e).map(n=>({[Ns(n)]:e[n]})).reduce((n,r)=>kn(kn({},n),r)):e}function Ns(e){return e.split(/(?=[A-Z])/).join("_").toLowerCase()}function Os(e){const t={"Content-Type":"application/json; charset=utf-8","X-Monorail-Edge-Event-Created-At-Ms":(e&&e.eventCreatedAtMs||Date.now()).toString(),"X-Monorail-Edge-Event-Sent-At-Ms":Date.now().toString(),"X-Monorail-Edge-Client-Message-Id":(e&&e.clientMessageId||Ds()).toString()};return e&&e.userAgent&&(t["User-Agent"]=e.userAgent),e&&e.remoteIp&&(t["X-Forwarded-For"]=e.remoteIp),e&&e.deviceInstallId&&(t["X-Monorail-Edge-Device-Install-Id"]=e.deviceInstallId),e&&e.client&&(t["X-Monorail-Edge-Client"]=e.client),e&&e.clientOs&&(t["X-Monorail-Edge-Client-OS"]=e.clientOs),t}async function Ls({endpoint:e,event:t,keepalive:n}){var r,a,o,i,s;const l=t.metadata?{clientMessageId:(r=t.metadata)===null||r===void 0?void 0:r.clientMessageId,eventCreatedAtMs:(a=t.metadata)===null||a===void 0?void 0:a.eventCreatedAtMs,consent:(o=t.metadata)===null||o===void 0?void 0:o.consent,consent_provider:(i=t.metadata)===null||i===void 0?void 0:i.consent_provider,consent_version:(s=t.metadata)===null||s===void 0?void 0:s.consent_version}:void 0;return fetch(e!=null?e:ks+Ts,{method:"post",headers:Os(t.metadata),body:JSON.stringify({sc
1hema_id:t.schemaId,payload:t.payload,metadata:l&&Rs(l,!0)}),keepalive:n})}const xs="2.1",Ms="3",fr={NO_VALUE:"",ACCEPTED:"1",DECLINED:"0"},Q={PREFERENCES:"p",ANALYTICS:"a",MARKETING:"m",SALE_OF_DATA:"t"},ht={MARKETING:"m",ANALYTICS:"a",PREFERENCES:"p",SALE_OF_DATA:"s"},rn=()=>typeof window>"u",zs=()=>typeof __CtaTestEnv__>"u"?!1:__CtaTestEnv__==="true";function $e(e){try{return decodeURIComponent(e)}catch(t){return""}}const Us="_tracking_consent";function Fs(){try{return document.cookie}catch(e){return!1}}function ja(e,t=!1){const n=Fs()?document.cookie.split("; "):[];for(let r=0;r<n.length;r++){const[a,o]=n[r].split("=");if(e===$e(a))return $e(o)}if(t&&e==="_tracking_consent"&&!window.localStorage.getItem("tracking_consent_fetched"))return zs()?void 0:(console.debug("_tracking_consent missing"),Bs(),window.localStorage.setItem("tracking_consent_fetched","true"),ja(e,!1))}function Bs(e="/"){const t=new XMLHttpRequest;t.open("HEAD",e,!1),t.withCredentials=!0,t.send()}function Hs(){return ja(Us)}const $s="customer_privacy_api_events/2.0";class Wt{constructor(){if(Wt.instance)return Wt.instance;Wt.instance=this}produce(t,n){if(!rn())try{const r={schema_id:$s,payload:{shop_domain:window.location.host,method_name:t,call_details:n||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,r);else return fetch("https://monorail-edge.shopifysvc.com/v1/produce",{headers:a,body:JSON.stringify(r),method:"POST",mode:"cors",credentials:"omit"})}catch(r){}}}Wt.instance=void 0;const Gs="_cmp";function Vs(){let e;if(qs()?e=br(js)||br(Tn):e=br(Tn),!e){let t;try{t=sessionStorage.getItem("consentHeader")}catch(n){}return t||void 0}try{e=decodeURIComponent(e)}catch(t){}return e}function br(e){try{return e()}catch(t){return}}function Tn(){var e,t;if(!Wa()&&!Ys()){const a=new Wt;let o="failed_to_fetch";try{o=navigator.userAgent}catch(i){}a.produce("navigationServerTiming",JSON.stringify({failed:!0,userAgent:o})),Ws()}const n=(e=performance)===null||e===void 0||(t=e.getEntriesByType)===null||t===void 0?void 0:t.call(e,"navigation");if(!n)return;const r=n.map(qa).find(a=>a);if(r)try{sessionStorage.setItem("consentHeader",r)}catch(a){}return r}let Dn;function js(){var e,t;const n=(e=performance)===null||e===void 0||(t=e.getEntriesByType)===null||t===void 0?void 0:t.call(e,"resource");let r=Dn;for(let a=n.length-1;a>=0;a--){let o=qa(n[a]);if(o){r=o;break}}return Dn=r,r}function qa(e){var t,n;if(e)return(t=e.serverTiming)===null||t===void 0||(n=t.find(r=>r.name==Gs))===null||n===void 0?void 0:n.description}function nn(){return window}function qs(){var e,t;const n=nn();return(n==null||(e=n.Shopify)===null||e===void 0||(t=e.customerPrivacy)===null||t===void 0?void 0:t.backendConsentEnabled)===!0}function Wa(){var e,t;const n=nn();return n==null||(e=n.Shopify)===null||e===void 0||(t=e.customerPrivacy)===null||t===void 0?void 0:t.serverTimingSupportVerified}function Ws(){if(Wa())return;const e=nn();e.Shopify||(e.Shopify={}),e.Shopify.customerPrivacy||(e.Shopify.customerPrivacy={}),e.Shopify.customerPrivacy.serverTimingSupportVerified=!0}function Ys(){try{const e=performance.getEntriesByType("navigation")[0].serverTiming;return!(!e||e.length==0)}catch(e){return!1}}const Ks="_cs";function Qs(){return new URLSearchParams(window.location.search).get(Ks)||void 0}function Xs(){var e,t;const n=(e=window.Shopify)===null||e===void 0||(t=e.customerPrivacy)===null||t===void 0?void 0:t.cachedConsent;return n?$e(n):void 0}let Js;function Rn(){if(rn())return Js;{var e,t;const n=(e=window.Shopify)===null||e===void 0||(t=e.customerPrivacy)===null||t===void 0?void 0:t.injectedConsent;return n?$e(n):void 0}}function Zs(){let e;if(rn()?e=Rn():e=Xs()||Rn()||Qs()||Hs()||Vs(),e!==void 0)return el(e)}function tl(){try{return Zs()||void 0}catch(e){return}}function el(e){if(e.slice(0,1)=="%")try{e=decodeURIComponent(e)}catch(n){}const t=e.slice(0,1);if(t=="{")return rl(e);
1if(t=="3")return nl(e)}function rl(e){var t;let n;try{n=JSON.parse(e)}catch(r){return}if(n.v===xs&&(t=n.con)!==null&&t!==void 0&&t.CMP)return n}function nl(e){const t=e.slice(1).split("_"),[n,r,a,o,i]=t;let s;try{s=t[5]?JSON.parse(t.slice(5).join("_")):void 0}catch(p){}let l;if(i){const p=i.replace(/\*/g,"/").replace(/-/g,"+"),m=atob(p);let g="";for(let f=0;f<m.length;f++){const v=m.charCodeAt(f).toString(16);g+=v.length===1?"0"+v:v}l=[8,13,18,23].reduce((f,v)=>f.slice(0,v)+"-"+f.slice(v),g)}function d(p){const m=n.split(".")[0];return m.includes(p.toLowerCase())?fr.DECLINED:m.includes(p.toUpperCase())?fr.ACCEPTED:fr.NO_VALUE}function u(p){return n.includes(p.replace("t","s").toUpperCase())}return{v:Ms,con:{CMP:{[ht.ANALYTICS]:d(ht.ANALYTICS),[ht.PREFERENCES]:d(ht.PREFERENCES),[ht.MARKETING]:d(ht.MARKETING),[ht.SALE_OF_DATA]:d(ht.SALE_OF_DATA)}},region:r||"",cus:s,purposes:{[Q.ANALYTICS]:u(Q.ANALYTICS),[Q.PREFERENCES]:u(Q.PREFERENCES),[Q.MARKETING]:u(Q.MARKETING),[Q.SALE_OF_DATA]:u(Q.SALE_OF_DATA)},sale_of_data_region:o=="t",display_banner:a=="t",consent_id:l}}function dr(e){const t=tl();if(!t||!t.purposes)return!0;const n=t.purposes[e];return typeof n=="boolean"?n:!0}function al(){return dr(Q.PREFERENCES)}function ol(){return dr(Q.ANALYTICS)}function il(){return dr(Q.MARKETING)}function sl(){return dr(Q.SALE_OF_DATA)}function ll(){return ol()}function cl(){return al()}function dl(){return il()}function ul(){return sl()}function hl(){return dl()}function pl(){return ll()}function ml(){return cl()}function gl(){return ul()}function yl(){const e=[];return pl()&&e.push("analytics"),hl()&&e.push("marketing"),gl()&&e.push("sale_of_data"),ml()&&e.push("preferences"),e}function fl(e,t){switch(t){case"v1":{const n=yl();return{...e,metadata:{...e==null?void 0:e.metadata,consent:n,consent_provider:"consent-tracking-api",consent_version:t}}}default:throw new an(t)}}class an extends Error{constructor(t){super("Version ".concat(t," is not supported by the consent-tracking-api provider")),this.name="MonorailConsentTrackingApiProviderVersionError",Object.setPrototypeOf(this,an.prototype)}}const bl=["Chrome-Lighthouse","Googlebot"];function wl(){const e=navigator.userAgent;return bl.some(t=>e.includes(t))}async function _l(e){if(wl())return;const t=fl(e,"v1");let n;try{n=await Ls({event:t})}catch(r){}if(!(n!=null&&n.ok))try{C.counter({name:I.MonorailProduceError,value:1,attributes:{schemaId:t.schemaId}})}catch(r){}}const wr="shopify_wallet_checkout_track/6.3";async function V(e){var t,n,r,a,o,i,s;const l=await El();if(!l)return;const d={schemaId:wr,payload:{app_name:"storefront",page_type:fs(),checkout_one:!0,event:e.event,event_subtype:e.eventSubtype,checkout_token:e.checkoutToken,instrument_id:e.instrumentId,ttl:e.ttl,error_reason:e.errorReason,uniq_token:(t=l==null?void 0:l.uniqToken)!=null?t:"",visit_token:(n=l==null?void 0:l.visitToken)!=null?n:"",micro_session_id:(r=l==null?void 0:l.microSessionId)!=null?r:"",micro_session_count:(a=l==null?void 0:l.microSessionCount)!=null?a:0,shop_id:(o=l==null?void 0:l.shopId)!=null?o:0,theme_id:l==null?void 0:l.themeId,theme_city_hash:(i=l==null?void 0:l.themeCityHash)!=null?i:"",content_language:(s=l==null?void 0:l.contentLanguage)!=null?s:"",referer:l==null?void 0:l.referer}};b.leaveBreadcrumb("monorail event produced to ".concat(wr),{schemaId:wr,payload:e});try{await _l(d)}catch(u){b.notify(new Al("Failed to send monorail event: ".concat(u),{cause:u}),{metadata:{request:{monorail:{payload:JSON.stringify(d)}}}})}}async function El(){var e,t,n,r,a;return(t=(e=window==null?void 0:window.ShopifyAnalytics)==null?void 0:e.lib)!=null&&t.trekkie||await new Promise(o=>{const i=setInterval(()=>{var l,d;(d=(l=window==null?void 0:window.ShopifyAnalytics)==null?void 0:l.lib)!=null&&d.trekkie&&(clearInterval(i),o())},100),s=setTimeout(()=>{clearInterval(i),clearTimeout(s),o()},7e3)}),(a=(r=(n=window.ShopifyAnalytics)==null?void 0:n.lib)==null?void 0:r.trekkie)==null?void 0:a.defaultAttributes}class Al extends Error{constructor(){super(...arguments),c(this,"name","MonorailError")}}var $=(e=>(e.CartInitCalled="portable_wallets_cart_init_called",e.ClickSheetCancelled="portable_wallets_instrument_click_sheet_cancelled",e.ClickSheetFailed="portable_wallets_instrument_click_sheet_failure",e.ClickSheetSuccess="portable_wallets_instrument_click_sheet_success",e.SheetFailed="portable_wallets_instrument_sheet_failed",e.AuthorizationAttempt="portable_wallets_authorization_attempt",e.AuthorizationComplete="portable_wallets_authorization_complete",e.InitCalled="portable_wallets_init_called",e.InitFailed="portable_wallets_init_failed",e.InitSuccess="portable_wallets_init_success",e.UpdateFailed="portable_wallets_instrument_update_failed",e.InstrumentLoaded="portable_wallets_instrument_loaded",e.InstrumentLoadFailed="portable_wallets_instrument_load_failed",e.FirstVisible="portable_wallets_first_visible",e.FirstVisibleNotAvailable="portable_wallets_first_visible_not_available",e.SheetLoaded="portable_wallets_sheet_loaded",e.ShopPayButtonInView="portable_wallets_shop_pay_button_in_view",e.RecoveryFlowInitiated="portable_wallets_recovery_flow_initiated",e))($||{});const Nn={[T.Checkout]:"bwp_checkout_widget_click",[T.CartAjax]:"bwp_cart_widget_click",[T.CartPage]:"bwp_cart_widget_click",[T.ProductPage]:"bwp_widget_click",[T.Unknown]:"bwp_widget_click"};function Sl({apiClientId:e,skus:t,pageType:n}){var r;if(!((r=window.Shopify)!=null&&r.analytics))return;const a=n&&Nn[n]||"bwp_widget_click";a===Nn[T.Checkout]&&window.Shopify.analytics.publish("shopify:app:pixels:load:".concat(e),{},{sendTo:"PIXEL-LOADER"}),t&&window.Shopify.analytics.publish(a,{skus:t},{sendTo:e})}function R(e){return{pageType:Jr(),...e}}function Cl(){const e=Jr()===T.CartPage?$.CartInitCalled:$.InitCalled;V({event:e})}function vl(e){var t,n;const r=e?"Failed":"Success",a=e&&jl(e)?"[".concat(e.name,"]: ").concat(e.code):void 0,o=$["Init".concat(r)];V({event:o,eventSubtype:a}),C.counter({name:I.InitCompleted,value:1,attributes:R({result:r.toLowerCase(),eventType:a,recoveredFailure:!!((n=(t=window.Shopify)==null?void 0:t.PaymentButton)!=null&&n.failedToLoad)})})}function Pl({instrumentOrComponentName:e,result:t,measurement:n}){V({event:t==="success"?$.InstrumentLoaded:$.InstrumentLoadFailed,instrumentId:e,ttl:n}),C.counter({name:I.InstrumentLoaded,value:1,attributes:R({instrument:e,result:t})}),n!=null&&(C.histogram({name:I.InstrumentLoadTime,value:n,attributes:R({instrument:e,result:t}),unit:"ms"}),C.histogram({name:I.InstrumentLoadTimeFromPageLoad,value:window.performance.now(),attributes:R({instrument:e,result:t}),unit:"ms"}))}function Il({instrument:e,measurement:t,result:n}){const r=n==="success"?Rt.InstrumentSdkLoaded:Rt.InstrumentSdkFailed;V({event:r,instrumentId:e,ttl:t,errorReason:n==="success"?void 0:n}
1),t!=null&&C.histogram({name:Rt.InstrumentSdkLoaded,value:t,attributes:R({instrument:e,result:n}),unit:"ms"})}function kl({instrument:e,result:t,reason:n}){const r=t==="success"?Rt.InstrumentSdkEligible:Rt.InstrumentSdkNotEligible;V({event:r,instrumentId:e}),C.counter({name:Rt.InstrumentSdkEligible,value:1,attributes:R({instrument:e,reason:n,result:t})})}function Tl({instrument:e,result:t,reason:n}){C.counter({name:I.InstrumentLoadEligibility,value:1,attributes:R({instrument:e,result:t,reason:n})})}function Dl(e){C.counter({name:I.ButtonRender,value:1,attributes:R({result:"success",instrument:e})})}function Rl(e){C.counter({name:I.ButtonRender,value:1,attributes:R({result:"failed",instrument:e})})}function Nl({instrument:e,result:t,webPixelMetaData:n,reason:r}){V({event:t==="success"?$.ClickSheetSuccess:$.ClickSheetFailed,instrumentId:e}),C.counter({name:I.SheetClicked,value:1,attributes:R({instrument:e,result:t,...r&&{reason:r}})}),e===y.BuyWithPrime&&n&&Sl(n)}function Ol({instrument:e,request:t,error:n}){V({event:"".concat($.UpdateFailed,"-").concat(t),instrumentId:e}),n&&h.log({body:"Update failed with error",attributes:{instrument:e,request:t,error:String(n)}}),C.counter({name:I.UpdateFailed,value:1,attributes:R({instrument:e,request:t})})}function Ll({errorCode:e}){C.counter({name:I.PayPalTokenCreationError,value:1,attributes:R({errorCode:e})})}function xl(e){V({event:$.ClickSheetCancelled,instrumentId:e}),C.counter({name:I.SheetCancelled,value:1,attributes:R({instrument:e})})}function Ml(e,t,n){V({event:$.SheetFailed,instrumentId:e,errorReason:t==null?void 0:t.message}),C.counter({name:I.SheetFailed,value:1,attributes:R({instrument:e,...n&&{reason:n}})})}function zl(e){V({event:$.AuthorizationAttempt,instrumentId:e}),C.counter({name:I.AuthorizationAttempt,value:1,attributes:R({instrument:e})})}function Ul({instrument:e,measurement:t,result:n}){V({event:$.AuthorizationComplete,eventSubtype:n,ttl:t,instrumentId:e}),t!=null&&C.histogram({name:I.AuthorizationComplete,value:t,attributes:R({instrument:e,result:n}),unit:"ms"})}function Fl({instrument:e,reason:t,stage:n}){C.counter({name:I.Decelerated,value:1,attributes:R({instrument:e,reason:t,...n&&{stage:n}})}),h.log({body:"Checkout decelerate",attributes:{instrument:e,reason:t,...n&&{stage:n}}}),h.flushTelemetry()}function Bl({reason:e}){C.counter({name:I.CartTokenMissing,value:1,attributes:{reason:e}})}function Hl({success:e}){C.counter({name:I.RemovePersonalDataResult,value:1,attributes:R({success:e})})}function $l(){C.counter({name:I.WalletConfigDeveloperError,value:1})}function Gl(){C.counter({name:I.LegacyCartCookie,value:1})}function Vl(){window.setInterval(()=>{Ya()},1e3)}function jl(e){return(e==null?void 0:e.name)===Ie}function Ya(){C.exportMetrics(),C.exportLogs()}function ql(e){const{body:t,attributes:n}=e,r=Xr();C.log({body:t,attributes:{...r,shopId:r.shop_id,appVersion:"0.1.59",...n}})}function Wl({usedBackwardsCompatibility:e}){C.counter({name:I.StyleBackwardsCompatibility,value:1,attributes:{usedBackwardsCompatibility:e}})}function Yl({measurement:e,pageType:t,stylesWritten:n}){C.histogram({name:I.StyleBackwardsCompatibilityExecutionTime,value:e,attributes:R({pageType:t,stylesWritten:n}),unit:"ms"})}function Kl({rule:e,count:t,pageType:n}){C.counter({name:I.StyleBackwardsCompatibilityRules,value:t,attributes:R({rule:e,pageType:n})})}function Ql({retries:e}){C.counter({name:I.AmazonPayLoadRetries,value:1,attributes:{retries:e}})}function Xl({instrument:e}){C.counter({name:I.DynamicTaxFailed,value:1,attributes:R({instrument:e})}),h.log({body:"Dynamic tax failed",attributes:{instrument:e}})}function Jl({instrument:e,measurement:t}){C.histogram({name:I.SheetLoaded,value:t,attributes:R({instrument:e}),unit:"ms"})}function Zl({instrument:e,errorName:t}){C.counter({name:I.UnrecoverableCartError,value:1,attributes:R({instrument:e,errorName:t})}),h.log({body:"Unrecoverable error detected",attributes:{instrument:e,errorName:t}})}function tc({instrument:e,error:t}){C.counter({name:I.PaymentCompletedAfterAbort,value:1,attributes:R({instrument:e,error:t})})}function ec(){C.counter({name:I.GooglePayNullCartOnAuthorize,value:1,attributes:R({instrument:y.GooglePay})})}function rc(){C.counter({name:I.ApplePayNullCartOnShippingContactSelected,value:1,attributes:R({instrument:y.ApplePay}
1)})}function nc({instrument:e,errorName:t,methodName:n}){C.counter({name:I.WalletSessionAbortError,value:1,attributes:R({instrument:e,errorName:t,methodName:n})}),h.log({body:"Wallet session abort error: ".concat(t),attributes:{instrument:e,methodName:n}})}function ac({instrument:e,retryCount:t,retryDuration:n,success:r,totalAmountChange:a,...o}){C.histogram({name:I.CartPaymentUpdateRetryResult,value:n,attributes:R({instrument:e,retryCount:t,success:r,totalAmountChange:a}),unit:"ms"}),h.log({body:"Cart payment update retry completed",attributes:{instrument:e,retryCount:t,retryDuration:n,success:r,totalAmountChange:a,...o}})}function oc({reason:e}){C.counter({name:I.ProductFormError,value:1,attributes:R({reason:e})})}function ic({instrument:e}){h.log({body:"Cart payment update timed out",attributes:{instrument:e}})}function sc({instrument:e}){h.log({body:"DELIVERY_WRONG_NUMBER_OF_LINES error detected and filtered out",attributes:{instrument:e}}),C.counter({name:I.DeliveryWrongNumberOfLines,value:1,attributes:R({instrument:e})})}function lc({cartRequiresShipping:e}){h.log({body:"Digital physical mismatch detected",attributes:{url:window.location.href,cartRequiresShipping:e}}),C.counter({name:I.DigitalPhysicalMismatch,value:1,attributes:R({cartRequiresShipping:e})})}function cc({instrument:e,errorCode:t,errorField:n,countryCode:r}){C.counter({name:I.AddressFieldError,value:1,attributes:R({instrument:e,errorCode:t,errorField:n})}),h.log({body:"Address field error from wallet payment sheet",attributes:{instrument:e,errorCode:t,errorField:n,countryCode:r}})}function dc({result:e,error:t,attempt:n}){h.log({body:"Cardsink deposit result",attributes:{result:e,error:t,attempt:n}}),C.counter({name:I.CardsinkDepositResult,value:1,attributes:R({result:e,attempt:n})})}const h={initStarted:P(Cl),initCompleted:P(vl),instrumentLoaded:P(Pl),instrumentLoadEligibility:P(Tl),instrumentSDKLoaded:P(Il),instrumentSDKEligible:P(kl),renderSucceeded:P(Dl),renderFailed:P(Rl),sheetClicked:P(Nl),sheetCancelled:P(xl),sheetFailed:P(Ml),updateFailed:P(Ol),authorizationAttempt:P(zl),authorizationComplete:P(Ul),startExporter:P(Vl),decelerated:P(Fl),cartTokenMissing:P(Bl),removePersonalDataResult:P(Hl),walletConfigDeveloperError:P($l),legacyCartCookie:P(Gl),flushTelemetry:P(Ya),styleBackwardsCompatibility:P(Wl),styleBackwardsCompatibilityExecutionTime:P(Yl),styleBackwardsCompatibilityRules:P(Kl),amazonPaySDKLoadRetries:P(Ql),dynamicTaxFailed:P(Xl),sheetLoaded:P(Jl),unrecoverableCartError:P(Zl),paymentCompletedAfterAbort:P(tc),googlePayNullCartOnAuthorize:P(ec),applePayNullCartOnShippingContactSelected:P(rc),log:P(ql,{logErrors:!1}),paypalTokenCreationError:P(Ll),walletSessionAbortError:P(nc),cartPaymentUpdateRetryResult:P(ac),productFormError:P(oc),updateCartPaymentTimeout:P(ic),deliveryWrongNumberOfLines:P(sc),digitalPhysicalMismatch:P(lc),cardsinkDepositResult:P(dc),addressFieldError:P(cc)};function P(e,{logErrors:t=!0}={}){return(...n)=>{try{e(...n)}catch(r){t&&h.log({body:"Error calling telemetry function",attributes:{error:"".concat(r)}})}}}function At(e,t=T.Unknown){const n={instrument:e,pageType:t};b.leaveBreadcrumb("".concat(e," handleClick"),n,"log"),h.log({body:"".concat(e," handleClick"),attributes:n})}function uc(e){const t=n=>{n.persisted&&(e(),window.removeEventListener("pageshow",t))};window.addEventListener("pageshow",t)}function Ka({type:e,form:t}){if(!t)return[];const n=document.querySelectorAll('[name^="'.concat(e,'"][form^="').concat(CSS.escape(t.getAttribute("id")||""),'"]')),r=t.querySelectorAll('[name^="'.concat(e,'"]')),a=Array.from(n).concat(Array.from(r)),o={};return a.forEach(i=>{const s=hc(i),l=pc(i);s&&typeof l<"u"&&l.trim()!==""&&(o[s]=l)}),Object.entries(o!=null?o:{}).map(([i,s])=>({key:i,value:s}))}function Re({page:e,element:t}){const n=e==="product"?'[data-shopify="payment-button"]':'[data-shopify="dynamic-checkout-cart"]',r=On(t,n)||document.querySelector(n);return On(r,"form")}const ce=Element.prototype;function On(e,t){if(ce.matches=ce.matches||ce.webkitMatchesSelector||ce.msMatchesSelector||ce.mozMatchesSelector,!e||e.matches(t))return e;let n=e;for(;n&&n!==document.body;)if(n=n.parentElement,n&&n.matches(t))return n;return null}function hc(e){const t=e.getAttribute("name");if(t===null)return null;const n=t.indexOf("["),r=t.lastIndexOf("]");return n===-1||r===-1?null:t.substring(n+1,r)}function pc(e){if(!(["radio","checkbox"].includes(e.type)&&!e.checked))try{return e.value===""||typeof e.value>"u"?void 0:e.value}catch(t){return}}function Qa(e){var t,n;const r=Re({page:"product",element:e});return(n=(t=Xa(r))==null?void 0:t[0])!=null?n:null}function mc(e){const t=Re({page:"product",element:e});return Xa(t)}function Xa(e){const t=Ja(e);return t?[t,...yc(e)]:null}function Ja(e){var t;const n=e==null?void 0:e.elements;if(!n)return b.leaveBreadcrumb("[ProductForm] No form elements found"),h.productFormError({reason:"missing_form_elements"}),h.log({body:"Product form error: missing form elements",attributes:{}}),null;const r=Ge(n,"id");if(!r||isNaN(Number(r))||Number(r)<=0)return b.leaveBreadcrumb("[ProductForm] Invalid variant ID found",{variantId:r}),h.productFormError({reason:"invalid_variant_id"}),h.log({body:"Product form error: invalid variant ID",attributes:{variantId:r!=null?r:"null"}}),null;const a=Number((t=Ge(n,"quantity"))!=null?t:"1"),o="gid://shopify/ProductVariant/".concat(r),i=fc(n),s=Ka({type:"properties",form:e});return{variantId:r,quantity:a,merchandiseId:o,sellingPlanId:i,lineItemProperties:s}}function gc(e){const t=e==null?void 0:e.elements;return t?!!Ge(t,"selling_plan"):!1}function yc(e){try{const t=new FormData(e!=null?e:void 0),n=new Map;for(const[r,a]of t.entries()){if(!r.startsWith("shopify-additional-items["))continue;const o=r.split(/[[\]]{1,2}/),i=Number(o[1])-1;n.has(i)||n.set(i,{});const s=n.get(i);switch(o[2]){case"id":s.variantId=a.toString(),s.merchandiseId="gid://shopify/ProductVariant/".concat(a.toString());break;case"quantity":s.quantity=Number(a!=null?a:1);break;case"selling_plan":s.sellingPlanId="gid://shopify/SellingPlan/".concat(a.toString());break;case"properties":s.lineItemProperties=JSON.parse(a);break;case"parent_id":s.parent={merchandiseId:"gid://shopify/ProductVariant/".concat(a.toString())};break}}return[...n.values()].map(r=>{if(!r.variantId)throw new Error("Missing variant ID for additional item");return{quantity:1,lineItemProperties:[],...r}})}catch(t){return console.error("[Accelerated Checkout] Could not read additional items from the product form. Check that your shopify-additional-items fields are correctly defined.",t),[]}}function Ge(e,t){var n,r;let a=e.namedItem(t);if(a instanceof HTMLSelectElement)try{return(n=a.value)!=null?n:null}catch(o){return null}if(a&&"length"in a&&(a=a.item(0)),a instanceof HTMLInputElement||a instanceof HTMLSelectElement)try{return(r=a.value)!=null?r:null}catch(o){return null}return null}function fc(e){const t=Ge(e,"selling_plan");if(!(!t||t==="undefined"))return"gid://shopify/SellingPlan/".concat(t)}class bc{constructor(t,n,r){this.element=t,this.apiClient=n,this.instrumentName=r}async getInitialCart(t,n,r){const a=mc(this.element);if(!a)throw new Za("[".concat(this.instrumentName,"] unable to find product form"),{groupingHash:"unable-to-find-product-form"});const o=we(gi),i={lines:[...a],discountCodes:o?[o]:[],instrumentName:t},{data:s,errors:l,abortReason:d,decelerationReason:u}=await this.apiClient.createCart(i,n,r);return{cart:s,errors:l,abortReason:d,decelerationReason:u}}}class Za extends ot{constructor(){super(...arguments),c(this,"name","ProductFormError"),c(this,"useHashPrefix",!0)}}const wc={firstName:"firstName",lastName:"lastName",address1:"address1",address2:"address2",city:"city",province:"province",postalCode:"zip",phoneNumber:"phone",companyName:"company",country:"country"},Rr=["firstName","lastName","address1","address2","city","province","postalCode","phoneNumber","companyName","country"];function Ue(e,t){return"".concat(e,".").concat(wc[t])}function Bt(e,t){const n={};for(const r of Rr)n[r]=[{code:t,field:Ue(e,r)}];return n}function to(e){return{required:Bt(e,"ADDRESS_FIELD_IS_REQUIRED"),invalid:{...Bt(e,"ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN"),postalCode:[{code:"ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN",field:Ue(e,"postalCode")},{code:"INVALID_ZIP_CODE_FOR_COUNTRY",field:Ue(e,"postalCode")},{code:"INVALID_ZIP_CODE_FOR_PROVINCE",field:Ue(e,"postalCode")}]},emojis:Bt(e,"ADDRESS_FIELD_CONTAINS_EMOJIS"),tooLong:Bt(e,"ADDRESS_FIELD_IS_TOO_LONG"),htmlTags:Bt(e,"ADDRESS_FIELD_CONTAINS_HTML_TAGS"),containsUrl:Bt(e,"ADDRESS_FIELD_CONTAINS_URL")}}const _c={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"},Ec={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 Ac(){const e=to("deliveryAddress");for(const t of Rr)e.required[t]=[{code:_c[t]},...e.required[t]];e.required.country=[...e.required.country,{code:"ADDRESS_FIELD_IS_REQUIRED",field:"deliveryAddress.countryCode"}],e.required.province=[...e.required.province,{code:"ADDRESS_FIELD_IS_REQUIRED",field:"deliveryAddress.provinceCode"}];for(const t of Rr){const n=Ec[t];n&&(e.invalid[t]=[{code:n}
1,...e.invalid[t]])}return e.invalid.country=[...e.invalid.country,{code:"Variable $buyerIdentity of type CartBuyerIdentityInput! was provided invalid value for countryCode"},{code:"INVALID",field:"deliveryAddress.country"},{code:"INVALID",field:"deliveryAddress.countryCode"}],e.invalid.postalCode=[...e.invalid.postalCode,{code:"DELIVERY_INVALID_POSTAL_CODE_FOR_COUNTRY"},{code:"DELIVERY_INVALID_POSTAL_CODE_FOR_ZONE"}],e.invalid.phoneNumber=[...e.invalid.phoneNumber,{code:"INVALID",field:"buyerIdentity.phone"}],e}const w=Ac();function Sc(){const e=to("billingAddress");return{...e,invalid:{...e.invalid,generic:[{code:"INVALID_PAYMENT",field:"billingAddress"},{code:"ADDRESS_FIELD_IS_REQUIRED",field:"billingAddress"},{code:"UNSPECIFIED_ADDRESS_ERROR",field:"billingAddress"}]}}}const A=Sc(),Ee={invalid:[{code:"INVALID",field:"buyerIdentity.email"}],required:[{code:"BUYER_IDENTITY_EMAIL_REQUIRED"}]},eo=[{code:"INVALID_DELIVERY_OPTION"},{code:"INVALID_DELIVERY_GROUP"},{code:"DELIVERY_DETAIL_CHANGED"},{code:"DELIVERY_NO_DELIVERY_AVAILABLE"},{code:"NO_DELIVERY_GROUP_SELECTED"}],ro=[{code:"INVALID_PAYMENT",field:"amount"},{code:"INVALID_PAYMENT",field:"payment.amount"},{code:"INVALID_PAYMENT",field:"payment"}],on=[{code:"TAXES_DELIVERY_GROUP_ID_NOT_FOUND"},{code:"TAXES_LINE_ID_NOT_FOUND"},{code:"TAXES_MUST_BE_DEFINED"},{code:"PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT"}],sn=[{code:"MERCHANDISE_OUT_OF_STOCK"},{code:"MERCHANDISE_PRODUCT_NOT_PUBLISHED"}],no=[{code:"MERCHANDISE_NOT_APPLICABLE"},{code:"MERCHANDISE_NOT_ENOUGH_STOCK_AVAILABLE"},{code:"DELIVERY_NO_DELIVERY_AVAILABLE_FOR_MERCHANDISE_LINE"},{code:"INVALID",field:"quantity"}],ao={code:"PAYMENTS_METHOD_REQUIRED"},Cc={code:"PAYMENTS_METHOD_UNAVAILABLE"},Ve={code:"VALIDATION_CUSTOM"},oo={code:"MERCHANDISE_LINE_TRANSFORMERS_RUN_ERROR"},io=[Cc,oo],vc=[...io,ao],Pc=[...w.required.firstName,...w.required.lastName,...w.required.address1,...w.required.address2,...w.required.phoneNumber,...w.required.companyName,...Ee.required],je={code:"CAPTCHA_COMPLETION_REQUIRED"},qe={code:"LOCALIZATION_EXTENSION_FIELD_ERROR"},Ln={code:"BUYER_IDENTITY_CONTACT_INFO_DOES_NOT_MATCH_CUSTOMER_PROFILE"},We={code:"Variable $language of type LanguageCode was provided invalid value"},Ye={code:"Variable $country of type CountryCode was provided invalid value"},Ke={code:"Variable $cartId of type ID! was provided invalid value"},Ic={code:"DISCOUNT_NOT_APPLICABLE"},xn={code:"PAYMENTS_COUNTRY_INVALID"},Mn={code:"INVALID_PAYMENT_EMPTY_CART"},Qe={code:"PAYMENT_METHOD_NOT_SUPPORTED"},Xe={code:"REDIRECT_TO_CHECKOUT_REQUIRED"},kc={code:"INVALID",field:"quantity"},Tc={code:"VARIANT_REQUIRES_SELLING_PLAN"},Dc={code:"SELLING_PLAN_NOT_APPLICABLE"},Rc={code:"INVALID",field:"merchandiseId"},Nc={code:"NO_RESPONSE"},Oc={code:"INVALID",field:"input"},Lc={code:"MERCHANDISE_NOT_APPLICABLE"},xc={code:"NO_DELIVERY_GROUP_SELECTED"},Mc={code:"GIFT_CARD_RECIPIENT_INVALID"},Je={code:"TAXES_INCLUSIVITY_MISMATCH"},zn={code:"ERROR"},Un=[{code:"DELIVERY_WRONG_NUMBER_OF_LINES"},{code:"DELIVERY_ADDRESS_REQUIRED"},{code:"DELIVERY_NO_DELIVERY_AVAILABLE_FOR_MERCHANDISE_LINE"}],zc=[{code:"PENDING_PROCESS"},{code:"PENDING_DELIVERY_GROUPS"}],Uc=[{code:"PENDING_DELIVERY_GROUPS"}],Fc=[{code:"PENDING_PROCESS"}],Bc={building:[...Pc,...Un,...zc],authorized:Un};function ge(e,t){const n=t.field?e.field===t.field:!0,r=e.code===t.code;return n&&r}function so(e,t){return e.length>0&&t.length>0&&e.some(n=>t.some(r=>ge(n,r)))}function Ht({code:e,field:t}){return"".concat(e).concat(t?":".concat(t):"")}class Hc extends ot{constructor(t){t instanceof Error?(super("[".concat(t.name,"] ").concat(t.message),{cause:t.cause,groupingHash:t instanceof ot?t.groupingHash:void 0}),this.stack=t.stack):super("[HandleCreateCartError] ".concat(String(t))),this.name="HandleCreateCartError"}}async function dt({element:e,instrumentName:t,dataSource:n,isShippingRequired:r}){const{supportsSubscriptions:a,supportsDeferredPurchaseOptions:o}=e;try{const i=await n.getInitialCart(t,a!=null?a:!0,o!=null?o:!0),{cart:s,errors:l,abortReason:d,decelerationReason:u}=i;uc(()=>{e&&(e.disabled=!1)});const p=tn(l),m=Gc(l),g=m||p;if(m&&h.unrecoverableCartError({instrument:t,errorName:m}),!s&&!g)throw new Error("[".concat(t,"] Failed to create cart: ").concat(JSON.stringify(l)));
1if(s){if(!s.id)throw new Error("[".concat(t,"] received invalid cart"));if(!s.checkoutUrl)throw new Error("[".concat(t,"] Created cart with no checkout URL"))}if(l.length>0&&!g)throw new Error("Errors present after cart creation: ".concat(JSON.stringify(l)));const f=Vc(s,r);return{cart:s,customValidationError:p,decelerationReason:f!=null?f:u,abortReason:d,...m?{unrecoverableError:m}:{}}}catch(i){if(i instanceof _e)return{cart:null,customValidationError:void 0,unrecoverableError:H.IgnoredResponseError,abortReason:void 0,decelerationReason:void 0};if(i instanceof Za)return{cart:null,customValidationError:void 0,unrecoverableError:H.ProductFormError,abortReason:void 0,decelerationReason:void 0};throw new Hc(i)}finally{e&&(e.disabled=!1)}}const $c=[{matcher:kc,unrecoverableError:H.InvalidQuantity},{matcher:Tc,unrecoverableError:H.VariantRequiresSellingPlan},{matcher:Dc,unrecoverableError:H.SellingPlanNotApplicable},{matcher:Rc,unrecoverableError:H.MerchandiseIdInvalid},{matcher:Nc,unrecoverableError:H.NoResponse},{matcher:Oc,unrecoverableError:H.InvalidInput},{matcher:Lc,unrecoverableError:H.MerchandiseNotApplicable},{matcher:oo,unrecoverableError:H.MerchandiseLineTransformersRunError},{matcher:Mc,unrecoverableError:H.GiftCardRecipientInvalid}];function Gc(e){var t;if(e.length!==1)return null;const[n]=e;return n.code===ka&&n.message?null:((t=$c.find(({matcher:r})=>ge(n,r)))==null?void 0:t.unrecoverableError)||null}function Vc(e,t){if(e&&t!==void 0){const n=e.lineItems.some(r=>r.merchandise.requiresShipping);if(t!==n)return h.digitalPhysicalMismatch({cartRequiresShipping:n}),"digital_physical_mismatch"}}const jc={force_shop_pay_product:"direct_checkout_product",force_shop_pay_cart:"direct_checkout_cart"};function _t(e,t="no_redirect_for_checkout"){h.flushTelemetry();const n=new URL(e);switch(t){case"skip_shop_pay":n.searchParams.set("skip_shop_pay","true");break;case"no_redirect_for_checkout":n.searchParams.set("storefront_wallet","true");break;case"force_shop_pay_cart":case"force_shop_pay_product":case"force_shop_pay":{n.searchParams.set("payment","shop_pay");const r=jc[t];r&&n.searchParams.set("redirect_source",r);break}}window.location.assign(n.toString())}const qc={currency_changed:L.CURRENCY_CHANGE,captcha_required:L.CAPTCHA_REQUIRED,not_enough_stock:L.NOT_ENOUGH_STOCK,dynamic_tax:L.WALLET_PROCESSING_FAILED,payment_method_not_applicable:L.PAYMENT_METHOD_NOT_APPLICABLE,invalid_payment_deferred_payment_required:L.INVALID_PAYMENT_DEFERRED_PAYMENT_REQUIRED,localization_extension_field_error:L.LOCALIZATION_EXTENSION_FIELD_ERROR,account_info_mismatch:L.WALLET_PROCESSING_FAILED,invalid_language:L.WALLET_PROCESSING_FAILED,invalid_country:L.WALLET_PROCESSING_FAILED,missing_cart_id:L.WALLET_PROCESSING_FAILED,redirect_to_checkout_required:L.WALLET_PROCESSING_FAILED,invalid_payment_amount:L.WALLET_PROCESSING_FAILED,price_increased:L.PRICE_INCREASED,unsupported_apple_pay_payment_method:L.UNSUPPORTED_APPLE_PAY_PAYMENT_METHOD,unsupported_google_pay_payment_method:L.UNSUPPORTED_GOOGLE_PAY_PAYMENT_METHOD,custom_validation:L.WALLET_PROCESSING_FAILED,cart_empty:L.WALLET_PROCESSING_FAILED,payments_country_invalid:L.PAYMENTS_COUNTRY_INVALID,generic_error:L.WALLET_PROCESSING_FAILED,nested_line_subscription:L.WALLET_PROCESSING_FAILED,nested_line_deferred_payment:L.WALLET_PROCESSING_FAILED,cardsink_deposit_failed:L.WALLET_PROCESSING_FAILED,digital_physical_mismatch:L.WALLET_PROCESSING_FAILED,subscription_review_required:L.SUBSCRIPTION_REVIEW_REQUIRED,cart_throttled:null,stale_cart:null};function Fn({cart:e,warnings:t}){const n=e&&e.lineItems.length>0&&e.lineItems.every(r=>r.quantity===0);if(t!=null&&t.includes("MERCHANDISE_OUT_OF_STOCK")&&n)return"out_of_stock"}function Oe({warnings:e,cart:t,cartStatus:n,errors:r,supportsSubscriptions:a,supportsDeferredPurchaseOptions:o}){for(const s of r||[]){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(n==="CartThrottled")return"cart_throttled";if(!e||e.length===0)return Bn(a!=null?a:!0,o!=null?o:!0,t);if(e.includes("MERCHANDISE_NOT_ENOUGH_STOCK"))return"not_enough_stock";const i=t==null?void 0:t.lineItems.some(s=>s.quantity>0);return e.includes("MERCHANDISE_OUT_OF_STOCK")&&i?"not_enough_stock":Bn(a!=null?a:!0,o!=null?o:!0,t)}function Bn(e,t,n){if(!e&&n!=null&&n.lineItems.some(r=>{var a;return(a=r.sellingPlanAllocation)==null?void 0:a.sellingPlan.billingPolicy}))return"nested_line_subscription";if(!t&&n!=null&&n.lineItems.some(r=>{var a,o;return((a=r.sellingPlanAllocation)==null?void 0:a.remainingBalanceChargeAmount)&&!((o=r.sellingPlanAllocation)!=null&&o.sellingPlan.billingPolicy)}))return"nested_line_deferred_payment"}function ln({currentCartTotal:e,initialBuyerCurrency:t}){const n=e.amount;return!(!n||Number(n)===0||t.toUpperCase()===e.currencyCode.toUpperCase())}function lo({previousCart:e,currentCart:t}){if(!e||!t)return;const n=parseFloat(e.totalAmount.amount),r=parseFloat(t.totalAmount.amount);let a;return r>n?a="inc":r<n?a="dec":a="eq",a}function U({checkoutUrl:e,instrumentName:t,reason:n,stage:r}){if(!e)throw new Error("Invalid Checkout URL");const a=new URL(e),o=qc[n];o&&a.searchParams.set(o,"true"),h.decelerated({instrument:t,reason:n,stage:r}),_t(a.toString())}class Wc extends De{constructor(){super(),c(this,"name",y.MoreOptions),c(this,"anchor"),c(this,"i18n"),c(this,"dataSource"),c(this,"classNames"),c(this,"setI18n"),c(this,"setDataSource"),c(this,"setClassNames"),[this.i18n,this.setI18n]=mt(),[this.dataSource,this.setDataSource]=mt(),[this.classNames,this.setClassNames]=mt()}static get observedAttributes(){return["disabled"]}get pageType(){return this.getAttribute("page-type")||T.Unknown}connectedCallback(){this.anchor||this.render()}attributeChangedCallback(t,n,r){n!==r&&t==="disabled"&&this.anchor&&(r===""?this.anchor.setAttribute("aria-disabled","true"):this.anchor.removeAttribute("aria-disabled"),this.setAccessibilityAttributes())}async handleClick(t){var n,r;if(t.preventDefault(),this.disabled||!this.anchor)return;this.disabled=!0,At(this.name,this.pageType);const[a,o]=await Promise.all([this.i18n,this.dataSource]);try{const{decelerationReason:i,cart:s,customValidationError:l,unrecoverableError:d,abortReason:u}=await dt({element:this,instrumentName:y.MoreOptions,dataSource:o});if(d){h.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),h.log({body:"Unrecoverable error detected in More Options sheet clicked",attributes:{unrecoverableError:d}}),zt(a,d);return}if(l){h.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),h.log({body:"Custom validation error detected in More Options sheet clicked",attributes:{errorMessage:l==null?void 0:l.message}}),Mt(a,l.message);return}if(u==="out_of_stock"){h.sheetClicked({instrument:this.name,result:"rejected",reason:"out_of_stock"}),wt(a);return}if(i){h.sheetClicked({instrument:y.MoreOptions,result:"success",reason:"deceleration"}),U({checkoutUrl:(n=s==null?void 0:s.checkoutUrl)!=null?n:"",instrumentName:y.MoreOptions,reason:i});return}h.sheetClicked({instrument:y.MoreOptions,result:"success"}),_t((r=s==null?void 0:s.checkoutUrl)!=null?r:"","skip_shop_pay")}catch(i){h.sheetClicked({instrument:y.MoreOptions,result:"failed",reason:"unhandled_error"}),h.log({body:"Unhandled error detected in More Options sheet clicked",attributes:{error:String(i)}}),b.notify(i),Nt(a)}}async render(){const t=await this.i18n,n=await this.classNames;
1this.anchor=document.createElement("a"),this.anchor.textContent=t.translate("more_payment_options"),this.anchor.className=n,this.anchor.setAttribute("id","more-payment-options-link"),this.anchor.onclick=a=>this.handleClick(a),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.removeAttribute("role"),this.anchor.href="#"))}}var F=(e=>(e.ButtonDisplay="buttonDisplay",e.LoadInstrument="loadInstrument",e.LoadSdk="loadSDK",e.AuthorizationLatency="authorizationLatency",e.SheetLoad="sheetLoad",e.StyleExtract="styleExtract",e))(F||{});function co(){var e,t;return!!((e=window.performance)!=null&&e.mark)&&!!((t=window.performance)!=null&&t.measure)}function re(e,t){return oe(e,t),()=>X(e,t)}function oe(e,t){co()&&window.performance.mark("".concat(e,"-").concat(t,"-start"))}function X(e,t){var n,r;if(co())try{const a="".concat(e,"-").concat(t,"-start"),o="".concat(e,"-").concat(t,"-end"),i="".concat(e,"-").concat(t,"-duration");window.performance.mark(o);const s=(r=window.performance.measure(i,a,o))!=null?r:(n=window.performance.getEntriesByName(i,"measure"))==null?void 0:n[0],l=s==null?void 0:s.duration;return l==null?void 0:l}catch(a){return}}function cn(e,t,n){if(ue!=null&&ue.length){const r=ue.join(",");e.querySelectorAll(r).forEach(a=>{n===null?a.removeAttribute(t):a.setAttribute(t,n)})}}function Yc(e,t){try{const n=JSON.parse(e!=null?e:"[]");if(!(n instanceof Array))throw new rt({code:"invalid-wallet-configs",message:"[".concat(t,"] invalid walletConfigs found")});return n}catch(n){throw new rt({code:"invalid-wallet-configs",message:"[".concat(t,"] Error while parsing walletConfigs JSON: ").concat(n)},{cause:n})}}function Kc(e,t){try{return e?JSON.parse(e):null}catch(n){throw new rt({code:"invalid-wallet-config",message:"[".concat(t,"] Error while parsing walletConfig JSON: ").concat(n)},{cause:n})}}function Ze(e,t){var n;const r=t==null?void 0:t.getLoadEligibility(e);return h.instrumentLoadEligibility({instrument:t==null?void 0:t.getInstrumentName(),result:r!=null&&r.eligible?"success":"failed",reason:r!=null&&r.eligible||r==null?void 0:r.reason}),(n=r==null?void 0:r.eligible)!=null?n:!1}function Qc(e,t){return t.filter(n=>Ze(e,n))}async function uo({walletInstrument:e,instanceNumber:t}){const n=e.getInstrumentName(),r=re(F.LoadSdk,"".concat(n,":").concat(t));try{await e.loadWalletSDK(),h.instrumentSDKLoaded({instrument:n,measurement:r(),result:"success"})}catch(o){return b.leaveBreadcrumb("Failed to load wallet SDK",{instrumentName:n,instanceNumber:t},"error"),b.notify(o),h.log({body:"Error loading wallet SDK",attributes:{instrumentName:n,instanceNumber:t,error:String(o),walletParams:JSON.stringify(e.walletParams),userAgent:navigator.userAgent}}),h.instrumentSDKLoaded({instrument:n,measurement:r(),result:"failed"}),null}let a;try{a=e.getPartnerSDKEligibility()}catch(o){b.notify(o),a={eligible:!1,reason:"uncaught exception"}}return a.eligible?(h.instrumentSDKEligible({instrument:n,result:"success"}),e):(h.instrumentSDKEligible({instrument:n,reason:a.reason,result:"failed"}),null)}function Lt(e,...t){try{const n=window[e];if(typeof n=="function")return new n(...t)}catch(n){}return null}const Hn=new Set;let $n=!1;const lt={register:e=>{$n||($n=!0,e.forEach(t=>Hn.add(t)))},enabled:e=>Hn.has(e),reset:()=>{}},Gn="https://content.global-e.com/shopper-terms",Xc="https://content.global-e.com/shopper-terms-v2",Jc="https://content.global-e.com/privacy-policy";class dn extends De{constructor(){super(...arguments),c(this,"apiClient"),c(this,"i18n"),c(this,"policy"),c(this,"isFetchingPolicy",!1),c(this,"intersectionObserver",null),c(this,"managedMarketsTermsLink",Gn),c(this,"handleManagedMarketsClick",t=>{if(!this.i18n)return;const n=t.target;if(n.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}n.id==="shopify-managed-markets-privacy-policy-button"&&(t.preventDefault(),t.stopImmediatePropagation(),this.showModalWithIframe(Jc,this.i18n.translate("managed_markets.privacy_policy"),this.i18n))}),c(this,"handleIntersection",(t,n)=>{t.some(r=>r.isIntersecting)&&(this.apiClient&&this.apiClient.setVisible(),n.disconnect(),V({event:$.FirstVisible}))})}connectedCallback(){this.mountIntersectionObserver(),lt.register(this.getEnabledFlags()),this.i18n&&this.setupManagedMarketsHandlers(this.i18n)}disconnectedCallback(){super.disconnectedCallback(),this.cleanupManagedMarketsHandlers()}
1get 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(){var t;try{return JSON.parse((t=this.getAttribute("variant-params"))!=null?t:"[]")}catch(n){throw new rt({code:"invalid-variant-params",message:"variant-params must be a valid JSON string. Received variant-params: ".concat(this.getAttribute("variant-params"),", received error: ").concat(n)})}}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,n,r){n!==r&&cn(this,t,r)}showBuyerConsent(t,n){var r,a,o;t&&((o=(a=(r=window.Shopify)==null?void 0:r.PaymentButton)==null?void 0:a.showBuyerConsent)==null||o.call(a,i=>this.onClickSubscriptionPolicy(i,t,n)))}hideBuyerConsent(){var t,n,r;(r=(n=(t=window.Shopify)==null?void 0:t.PaymentButton)==null?void 0:n.hideBuyerConsent)==null||r.call(n)}clearUI(){this.innerHTML=""}setupManagedMarketsHandlers(t){const n=document.getElementById("shopify-buyer-consent"),r=n==null?void 0:n.getAttribute("data-consent-type");if(r!=="managed-markets"&&r!=="managed-markets-v2")return;const a=document.getElementById("shopify-managed-markets-terms-and-conditions-button"),o=document.getElementById("shopify-managed-markets-privacy-policy-button");!a||!o||(this.managedMarketsTermsLink=r==="managed-markets"?Gn:Xc,this.i18n=t,document.addEventListener("click",this.handleManagedMarketsClick,!0))}cleanupManagedMarketsHandlers(){document.removeEventListener("click",this.handleManagedMarketsClick,!0)}showModalWithIframe(t,n,r){const a=r.translate("managed_markets.policy_not_found"),o=1e4*Zr(),i=800,s=Va(n);document.body.appendChild(s);const l=document.createElement("div");me(l,{position:"relative",width:"100%"});const d=document.createElement("iframe");Te(d,{width:"100%",height:"100%",title:n,frameborder:"no"}),me(d,{border:"none","min-height":"50vh",display:"none"});const u=document.createElement("div");u.className="skeleton-overlay",u.innerHTML=Ga(),me(u,{background:"white"}),l.appendChild(d),l.appendChild(u),s.appendChild(l);let p=!1,m=!1,g=!1;const f=()=>{!g&&p&&m&&(u.remove(),d.style.display="block")},v=setTimeout(()=>{p||(g=!0,Ss(s,a))},o);d.addEventListener("load",()=>{clearTimeout(v),p=!0,f()}),setTimeout(()=>{m=!0,f()},i),d.src=t}getEnabledFlags(){const t=this.getAttribute("enabled-flags");if(!t)return[];try{return JSON.parse(t)}catch(n){return console.warn("Invalid enabled-flags attribute value:",t),[]}}async onClickSubscriptionPolicy(t,n,r){if(t.preventDefault(),this.isFetchingPolicy)return;if(this.policy){this.showPolicy(this.policy,r);return}this.isFetchingPolicy=!0;const a=this.fetchSubscriptionPolicy(n).then(o=>(this.policy=o,o)).catch(o=>(b.notify(o),r.translate("subscriptions.policy_not_found"))).finally(()=>{this.isFetchingPolicy=!1});this.showPolicy(a,r)}async fetchSubscriptionPolicy(t){const n=await t.fetchSubscriptionPolicy();return this.policy=n,n}showPolicy(t,n){en(n.translate("subscriptions.cancellation_policy"),t,n.translate("subscriptions.policy_not_found"))}mountIntersectionObserver(){this.intersectionObserver=Lt("IntersectionObserver",this.handleIntersection),this.intersectionObserver?this.intersectionObserver.observe(this):V({event:$.FirstVisibleNotAvailable})}}function un(e){var t,n;Dr({shop_id:(t=e.shopId)!=null?t:Da,cartId:(n=e.cartId)!=null?n:void 0,debug:e.debug,pageType:e.pageType})}class hn{constructor(t,n){c(this,"addToCartMutationObserver"),c(this,"addToCartForm"),c(this,"addToCartButtons"),this.element=t,this.onFormChanged=n,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=Ja(this.addToCartForm),n=!!(this.addToCartButtons.length>0&&this.addToCartButtons.every(r=>r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true"));this.onFormChanged({disabled:n||t===null,hasSellingPlan:gc(this.addToCartForm),variantId:t==null?void 0:t.variantId,sellingPlanId:t==null?void 0:t.sellingPlanId})}observeAddToCartButtons(){this.addToCartButtons.forEach(t=>{this.addToCartMutationObserver.observe(t,{attributes:!0})})}reobserveOnFormChanges(){var t;(t=this.addToCartMutationObserver)==null||t.disconnect(),this.findAndSetAddToCartButtons(),this.observeAddToCartButtons(),this.syncComponentStateWithForm()}findAndSetAddToCartButtons(){if(this.addToCartForm=Re({page:"product",element:this.element}),this.addToCartForm){const t=this.addToCartForm.querySelectorAll("[type=submit]");t instanceof NodeList&&(this.addToCartButtons=[...t])}}}function Zc(e,t,n){try{const r=JSON.parse(e!=null?e:"{}"),a=JSON.parse(t!=null?t:JSON.stringify(Ra));if(r===null||Object.keys(r).length===0){if(!(a instanceof Object))throw h.walletConfigDeveloperError(),new rt({code:"invalid-fallback-wallet-config",message:"[".concat(n,"] Invalid fallback wallet configs JSON")});
1return{recommendedWallet:null,fallbackWallet:a}}return{recommendedWallet:r,fallbackWallet:a}}catch(r){throw h.walletConfigDeveloperError(),new rt({code:"invalid-recommended-fallback-config",message:"[".concat(n,"] Error while parsing recommended/fallback JSON: ").concat(r)},{cause:r})}}const td=".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);width:100%;border:none;box-shadow:0 0 0 0 transparent;color:#fff;cursor:pointer;display:block;font-size:1em;font-weight:500;line-height:1;text-align:center;transition:background .2s ease-in-out}.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{background:transparent;border:0 none;cursor:pointer;display:block;font-size:1em;margin-top:1em;text-align:center;text-decoration:underline;width:100%}.shopify-payment-button__more-options.shopify-payment-button__skeleton{height:auto!important;min-height:0!important;border-radius:4px!important;width:50%;margin-left:25%;margin-right:25%}.shopify-payment-button__more-options[disabled]{opacity:.6;cursor:default!important}.shopify-payment-button__button.shopify-payment-button__button--branded{display:flex;flex-direction:column;position:relative;z-index:1}.shopify-payment-button__button.shopify-payment-button__button--branded .shopify-cleanslate{flex:1!important;display:flex!important;flex-direction:column!important}.shopify-payment-button__button.button.loading{position:relative;color:transparent}.shopify-payment-button__button.button.loading>.loading-overlay__spinner{top:50%;left:50%;transform:translate(-50%,-50%);position:absolute;height:100%;display:flex;align-items:center}.shopify-payment-button__button.button.loading>.loading-overlay__spinner .spinner{width:-moz-fit-content;width:-webkit-fit-content;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:shopify-rotator 1.4s linear infinite}@keyframes shopify-rotator{0%{transform:rotate(0)}to{transform:rotate(270deg)}}.shopify-payment-button__button .path{stroke-dasharray:280;stroke-dashoffset:0;transform-origin:center;stroke:#121212;animation:shopify-dash 1.4s ease-in-out infinite}@media screen and (forced-colors: active){.shopify-payment-button__button .path{stroke:CanvasText}}@keyframes shopify-dash{0%{stroke-dashoffset:280}50%{stroke-dashoffset:75;transform:rotate(135deg)}to{stroke-dashoffset:280;transform:rotate(450deg)}}#shopify-buyer-consent{margin-top:1em;display:inline-block;width:100%}#shopify-buyer-consent.hidden{display:none}#shopify-subscription-policy-button,#shopify-managed-markets-terms-and-conditions-button,#shopify-managed-markets-privacy-policy-button{background:none;border:none;padding:0;text-decoration:underline;font-size:inherit;cursor:pointer}#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;animation-delay:-.168s;background-color:var(--shopify-accelerated-checkout-skeleton-background-color, #dedede);box-sizing:border-box;text-decoration:none!important;height:var(--shopify-accelerated-checkout-button-block-size, inherit);min-height:25px;max-height:55px;border-radius:var( --shopify-accelerated-checkout-button-border-radius, inherit )}",ed='.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);
1box-shadow:var(--shopify-accelerated-checkout-button-box-shadow)}:host([page-type="cart_page"]){display:block;height:100%}:host([page-type="cart_page"]) .accelerated-checkout-button{height:100%;min-height:0;width:100%;border-radius:var(--shopify-accelerated-checkout-button-border-radius, 4px);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{border:1px solid transparent!important}:host([page-type="cart_page"]) .accelerated-checkout-button{border:1px solid transparent!important}}',rd=70;class Yt{constructor(t,n,r,a){c(this,"red"),c(this,"green"),c(this,"blue"),c(this,"opacity"),this.red=t||0,this.green=n||0,this.blue=r||0,this.opacity=typeof a>"u"?1:a}getLuminance(){const t=this.red&255,n=this.green&255,r=this.blue&255;return t*.2126+n*.7152+r*.0722}isDark(){return this.opacity===0?!1:this.getLuminance()/this.opacity<rd}blendWith(t,n){this.opacity=1-(1-t.opacity)*(1-n.opacity),this.red=this.blend(t.red,n.red,t,n),this.green=this.blend(t.green,n.green,t,n),this.blue=this.blend(t.blue,n.blue,t,n)}blend(t,n,r,a){return Math.round(t*r.opacity/this.opacity+n*a.opacity*(1-r.opacity)/this.opacity)}}function nd(e){const t=[...e];let n=new Yt(0,0,0,0),r=new Yt(255,255,255,1),a=t.shift();for(;a;)n.opacity>0&&a.opacity>0?(r=new Yt(0,0,0,0),r.blendWith(a,n)):a.opacity>0?r=a:r=n,n=r,a=t.shift();return r}const Nr=new Yt(255,255,255,1);function ad(e){const t=[];let n=e;for(;n.parentElement;){n=n.parentElement;const r=window.getComputedStyle(n).backgroundColor,a=id(r);if(r&&t.push(a),a.opacity===1)break}try{return nd(t.reverse())}catch(r){return b.notify(new ho("[BackgroundDetection] Failed to blend colors for element ".concat(e.outerHTML),{cause:r})),Nr}}const od=new Yt(0,0,0,0);function id(e){if(!e)return Nr;if(e==="transparent")return od;try{const t=e.split("(")[1].split(")")[0].replace(" ","").split(",");return new Yt(Number(t[0]),Number(t[1]),Number(t[2]),typeof t[3]>"u"?1:Number(t[3]))}catch(t){b.notify(new ho("[BackgroundDetection] Failed to convert rgbString to array ".concat(e),{cause:t}))}return Nr}class ho extends Error{constructor(){super(...arguments),c(this,"name","ColorProcessingError")}}var it,gt;class St extends De{constructor(){super(),c(this,"name",y.Unknown),c(this,"i18n"),c(this,"dataSource"),c(this,"apiClient"),c(this,"classNames"),c(this,"containerInstanceNumber"),c(this,"supportsSubscriptions"),c(this,"supportsDeferredPurchaseOptions"),c(this,"onRendered"),c(this,"setI18n"),c(this,"setDataSource"),c(this,"setApiClient"),c(this,"setClassNames"),c(this,"setContainerInstanceNumber"),c(this,"parsedWalletParams"),G(this,it),G(this,gt),this.onRendered=()=>{},this.supportsSubscriptions=!1,this.supportsDeferredPurchaseOptions=!1,[this.i18n,this.setI18n]=mt(),[this.dataSource,this.setDataSource]=mt(),[this.apiClient,this.setApiClient]=mt(),[this.classNames,this.setClassNames]=mt(),[this.containerInstanceNumber,this.setContainerInstanceNumber]=mt()}async cleanupOnFailure(t,n){var r;try{await t()}catch(a){b.notify(new sd("An error occurred requiring cleanup when attempting to render the ".concat(n," instrument: ").concat(a),{cause:a}));const o=await this.containerInstanceNumber;h.instrumentLoaded({instrumentOrComponentName:n,result:"failed",measurement:X(F.ButtonDisplay,"".concat(n,":").concat(o))}),(r=this.parentElement)==null||r.remove()}}attributeChangedCallback(t,n,r,a){n!==r&&t==="disabled"&&a&&(r===""?(a.setAttribute("aria-disabled","true"),a.setAttribute("disabled","")):(a.removeAttribute("aria-disabled"),a.removeAttribute("disabled")))}disconnectedCallback(){var t;(t=S(this,gt))==null||t.disconnect(),z(this,gt,void 0)}get pageType(){return this.getAttribute("page-type")||T.Unknown}get buttonTheme(){return ad(this).isDark()?"LIGHT":"DARK"}get isCTA(){return this.hasAttribute("call-to-action")}get walletParams(){var t;if(this.parsedWalletParams===void 0)try{this.parsedWalletParams=JSON.parse((t=this.getAttribute("wallet-params"))!=null?t:"{}")}catch(n){throw new rt({code:"invalid-wallet-params",message:"[".concat(this.name,"] Error while parsing wallet-params JSON: ").concat(n)},{cause:n})}return this.parsedWalletParams}async initializeShadowStyles(t,n=""){const r=document.createElement("style");r.innerHTML=[ed,n].join("\n"),t.appendChild(r)}async ensureLightDOMIsNotEmpty(){this.textContent="\xA0"}
1dispatchWalletEvent({eventName:t,detail:n={}}){var r;(r=this.parentElement)==null||r.dispatchEvent(new CustomEvent(t,{detail:n}))}getOrCreateShadowRoot(){return S(this,it)||z(this,it,this.attachShadow({mode:"closed"})),this.guardAgainstTPOOverlays(S(this,it)),S(this,it)}clearShadowRoot(){S(this,it)&&(S(this,it).innerHTML="")}guardAgainstTPOOverlays(t){S(this,gt)||!window.TPOConfigs||(h.log({body:"Guard against TPO overlay triggered"}),z(this,gt,new MutationObserver(n=>{for(const r of n)for(const a of Array.from(r.addedNodes))a instanceof HTMLElement&&a.classList.contains("tpo-buy-it-now-btn")&&a.remove()})),S(this,gt).observe(t,{childList:!0,subtree:!0}))}}it=new WeakMap,gt=new WeakMap;class sd extends Error{constructor(){super(...arguments),c(this,"name","CleanupOnFailureError")}}class ld extends St{constructor(){super(...arguments),c(this,"name",y.BuyItNow),c(this,"button",null)}static get observedAttributes(){return["disabled"]}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}attributeChangedCallback(t,n,r){super.attributeChangedCallback(t,n,r,this.button)}async handleClick(){var t,n;if(this.disabled||!this.button||this.button.getAttribute("aria-disabled"))return;this.disabled=!0,At(this.name,this.pageType);const[r,a]=await Promise.all([this.i18n,this.dataSource]);try{const{decelerationReason:o,cart:i,customValidationError:s,unrecoverableError:l,abortReason:d}=await dt({element:this,instrumentName:this.name,dataSource:a});if(l){h.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),zt(r,l);return}if(d==="out_of_stock"){h.sheetClicked({instrument:this.name,result:"rejected",reason:"out_of_stock"}),wt(r);return}if(s){h.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),Mt(r,s.message);return}if(o){h.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),U({checkoutUrl:(t=i==null?void 0:i.checkoutUrl)!=null?t:"",instrumentName:this.name,reason:o});return}h.sheetClicked({instrument:this.name,result:"success"}),_t((n=i==null?void 0:i.checkoutUrl)!=null?n:"","allow_redirect")}catch(o){b.notify(o),h.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),h.log({body:"Unhandled error detected in Buy It Now Button click",attributes:{error:String(o)}}),Nt(r)}}async render(){var t;this.button||(this.button=cr());const n=await this.classNames;this.button.textContent=(await this.i18n).translate("instruments_copy.checkout.buy_now"),this.button.className=n,this.disabled&&this.button.setAttribute("aria-disabled","true"),this.button.onclick=()=>this.handleClick(),this.appendChild(this.button),(t=this.onRendered)==null||t.call(this)}}const cd=1e3,dd=()=>cd*Zr();function ud(){const e=navigator.userAgent,t=e.indexOf("Android")>-1,n=e.indexOf("Chrome/")>-1,r=parseInt((/Chrome\/([0-9]+)/.exec(e)||["0","0"])[1],10);return t&&n&&r===114}function hd(e){let t;return Promise.race([e,new Promise((n,r)=>{t=setTimeout(()=>r(new Error("timed out")),dd())})]).finally(()=>clearTimeout(t))}class Ct{constructor(t){c(this,"walletParams"),c(this,"supportsSubscriptions"),c(this,"supportsDeferredPurchaseOptions");var n,r;this.walletParams=t.wallet_params,this.supportsSubscriptions=(n=t.supports_subs)!=null?n:!1,this.supportsDeferredPurchaseOptions=(r=t.supports_def_opts)!=null?r:!1}
1static walletName(){throw new Error("Must define walletName for WalletInstrument subclass")}async createWebComponent({walletContainer:t,dataSource:n,i18n:r,apiClient:a,containerInstanceNumber:o,classNames:i="",callToAction:s,pageType:l=T.ProductPage,slot:d="button",onRendered:u=()=>{}}){var p,m,g;const f=this.getWebComponentName();if(!ut(f,this.getWebComponentClass(),{isChildCustomElement:!0}))throw new et("Failed to define custom element ".concat(f,", aborting execution"));try{await hd(customElements.whenDefined(f))}catch(_){throw new et("Timeout waiting for custom element ".concat(f," to be defined"))}const v=document.createElement(f);if(!(v instanceof St))throw new et("Failed to create web component instance for ".concat(f,", element is not a WalletButtonElement"));const E={"access-token":(p=t.accessToken)!=null?p:"","buyer-country":(m=t.buyerCountry)!=null?m:"","buyer-currency":t.buyerCurrency,"wallet-params":JSON.stringify((g=this.walletParams)!=null?g:{}),"page-type":l,slot:d};try{t.disabled&&v.setAttribute("disabled",""),Te(v,E),t.isShippingRequired&&v.setAttribute("requires-shipping",""),t.hasSellingPlan&&v.setAttribute("has-selling-plan",""),t.pciEnabled&&v.setAttribute("pci-enabled","")}catch(_){const k=_;throw k.message.includes("setAttribute is not a function")&&ud()?new et(k.message):k}if(s&&v.setAttribute("call-to-action",""),typeof v.setDataSource!="function")throw new et("Custom element ".concat(f," is not properly upgraded, aborting execution"));return v.setDataSource(n),v.setApiClient(a),v.setI18n(r),v.setClassNames(i),v.setContainerInstanceNumber(o),v.supportsSubscriptions=this.supportsSubscriptions,v.supportsDeferredPurchaseOptions=this.supportsDeferredPurchaseOptions,v.onRendered=u,v}loadWalletSDK(){return Promise.resolve()}getLoadEligibility(t){return{eligible:!0}}getPartnerSDKEligibility(){return{eligible:!0}}isInIframe(){return typeof window>"u"||window.self!==window.top}}class pd extends Ct{static walletName(){return"buy_it_now"}getWebComponentName(){return"shopify-buy-it-now-button"}getInstrumentName(){return y.BuyItNow}getWebComponentClass(){return ld}}const md="shopify-paypal-button[disabled]{opacity:.5;cursor:not-allowed}shopify-paypal-button div.paypal-buttons>iframe{z-index:auto!important;border-radius:0!important;box-shadow:none}",gd='::slotted(div){height:100%}:host([page-type="cart_page"]) ::slotted(div){width:100%;min-width:100px;display:flex;justify-content:center}:host([page-type="cart_page"]) .accelerated-checkout-button{overflow:hidden;display:flex;justify-content:center}';async function Kt(e){const{cartId:t,cartClient:n,instrumentName:r,abortSignal:a}=e;try{if(!t)throw new Error("[".concat(r,"] provided no cart ID when updating buyer identity"));if(!n)throw new Error("[".concat(r,"] provided invalid cart client when updating buyer identity"));return await n.updateCartBuyerIdentity(e,a)}catch(o){throw h.updateFailed({instrument:r,request:"updateBuyerIdentity",error:o}),o}}async function pn({cartId:e,totalAmount:t,paymentMethod:n,billingAddress:r,cartClient:a,instrumentName:o,abortSignal:i,hasSellingPlan:s,canUsePaymentMethodForFreeOrder:l}){try{if(!e)throw new Error("[".concat(o,"] provided no cart ID when updating payment"));if(!t)throw new Error("[".concat(o,"] provided no total amount when updating payment"));if(!n)throw new Error("[".concat(o,"] provided no apple pay wallet content when updating payment"));if(!a)throw new Error("[".concat(o,"] provided invalid cart client when updating payment"));const d={freePaymentMethod:{billingAddress:r}};return await a.updateCartPayment(e,{amount:{amount:t.amount,currencyCode:t.currencyCode},...Number(t.amount)<=0&&!l&&!s?d:n},o,i)}catch(d){throw h.updateFailed({instrument:o,request:"updatePayment",error:d}),d}}function po(e){return window[mo(e)]}function mo(e){return"paypal-".concat(e.replace(/[^a-zA-Z0-9]/g,""))}const yd="RESTRICTED_WALLET_ACCOUNT",fd="GENERIC_ERROR",bd="NO_PENDING_TASK",wd="WALLET_SERVICE_DISABLED",_d="FAILED_TO_ENQUEUE_BACKGROUND_JOB",Ed="REQUEST_MISSING_VALID_MERCHANDISE_SOURCE",Ad="THROTTLE_EXCEEDED",Sd="INTERNAL_SERVER_ERROR",Cd=[fd,bd,wd,_d,Ed,Ad,Sd];function Vn(e){return e==null?void 0:e.map(t=>{var n,r;return{code:(n=t.extensions)==null?void 0:n.code,isLoggable:Cd.includes((r=t.extensions)==null?void 0:r.code)}}).find(({code:t,isLoggable:n})=>t===yd||n)}function tr(e){if(!e)return null;const t=getComputedStyle(e).borderRadius;return t.includes("px")?parseInt(t,10):null}function Or(e){if(!e)return null;const t=getComputedStyle(e).height;return t.includes("px")?parseInt(t,10):null}const _r=25,jn=55,vd=["cart_throttled","payment_method_not_applicable","invali
1d_payment_deferred_payment_required","nested_line_subscription","nested_line_deferred_payment"],Er="PAYPAL_CALLBACK_HANDLED_ERROR",Pd=["Can not set name for cross-domain window","too much recursion"];var yt;class Id extends St{constructor(){super(...arguments),c(this,"name",y.PayPal),c(this,"abortController",null),c(this,"cartId"),c(this,"sdkButtonsComponent"),c(this,"container",null),c(this,"resizeObserver",null),c(this,"buttonHeight"),c(this,"rendering",!1),c(this,"pendingResize",!1),c(this,"prevBorderRadius",0),c(this,"prevHeight",0),G(this,yt,!1),c(this,"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))})}connectedCallback(){this.resizeObserver=Lt("ResizeObserver",()=>this.onResize()),this.cleanupOnFailure(this.render.bind(this),this.name),window.addEventListener("pageshow",this.onPageShowHandler)}async disconnectedCallback(){var t;window.removeEventListener("pageshow",this.onPageShowHandler),super.disconnectedCallback(),this.innerHTML="",this.clearShadowRoot(),await this.teardownPayPalButton(),(t=this.resizeObserver)==null||t.disconnect()}async teardownPayPalButton(){var t;try{await((t=this.sdkButtonsComponent)==null?void 0:t.close().catch(()=>{}))}catch(n){}finally{this.sdkButtonsComponent=void 0}}async onResize(){const t=tr(this.container),n=this.getHeight(),r=t!==null&&this.prevBorderRadius!==t||this.prevHeight!==n;!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(){var t;const n=this.getOrCreateShadowRoot(),r=document.createElement("div");r.className=xt.BUTTON;const a=document.createElement("style");a.innerHTML=md,this.appendChild(a),await this.initializeShadowStyles(n,gd),n.appendChild(r),this.container=r,await ws(),this.renderFromPayPalSDK(),(t=this.resizeObserver)==null||t.observe(this.container)}getHeight(){const t=Or(this.container);return t?t>=_r&&t<=jn?t:t<_r?(console.debug("[PayPalButton] Container height is less than the minimum height of the PayPal button. Using the minimum height of 25px."),_r):(console.debug("[PayPalButton] Container height is greater than the maximum height of the PayPal button. Using the maximum height of 55px."),jn):pi}async renderFromPayPalSDK(){var t,n,r;if(!this.container)throw new Error("button container not set when attempting to render");this.rendering=!0;const a=this.requiresBillingAgreement(),o=async()=>this.createToken({apiClientPromise:this.apiClient,requiresBillingAgreement:a});let i,s;a?s=o:i=o;const l=tr(this.container),d=this.getHeight();this.prevHeight=d;const u={color:"gold",label:this.isCTA?"pay":"paypal",disableMaxWidth:!0,height:d,shape:"sharp"};l&&l>0&&(u.borderRadius=l,this.prevBorderRadius=l);const p=await this.i18n;this.sdkButtonsComponent=(n=(t=po(this.walletParams.sdkUrl))==null?void 0:t.Buttons)==null?void 0:n.call(t,{fundingSource:"paypal",style:u,createOrder:i,createBillingAgreement:s,onApprove:async g=>{await this.onApprove(g)},onCancel:()=>{this.cancelPaymentSheet("Payment sheet cancelled")},onClick:this.onClick.bind(this),onError:g=>{this.onError(g,p)}});let m=!1;try{await((r=this.sdkButtonsComponent)==null?void 0:r.render(this.container)),m=!0}catch(g){h.renderFailed(this.name),h.log({body:"PayPal Button not able to render into container.",attributes:{pageType:this.pageType,error:g==null?void 0:g.toString()}})}finally{this.rendering=!1}m&&this.onRendered(),this.pendingResize&&(this.pendingResize=!1,await this.onResize())}cancelPaymentSheet(t){var n;z(this,yt,!0),h.sheetCancelled(this.name),(n=this.abortController)==null||n.abort("[PayPal] ".concat(t))}async onClick(t,n){var r,a;if(this.disabled)return n.reject();At(this.name,this.pageType),z(this,yt,!1),this.abortController=Lt("AbortController");const o=this.getBoundingClientRect(),i=o.left+o.width/2,s=o.top+o.height/2,l=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1,
1clientX:i,clientY:s,screenX:window.screenX+i,screenY:window.screenY+s});this.dispatchEvent(l);const[d,u]=await Promise.all([this.dataSource,this.i18n]);try{const{decelerationReason:p,cart:m,customValidationError:g,unrecoverableError:f,abortReason:v}=await dt({element:this,instrumentName:this.name,dataSource:d});return f?(h.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),h.log({body:"Unrecoverable error detected in PayPal sheet clicked",attributes:{unrecoverableError:f}}),zt(u,f),n.reject()):v==="out_of_stock"?(h.sheetClicked({instrument:this.name,result:"rejected",reason:"out_of_stock"}),wt(u),n.reject()):g?(h.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),h.log({body:"Custom validation error detected in PayPal sheet clicked",attributes:{errorMessage:g==null?void 0:g.message}}),Mt(u,g.message),n.reject()):this.hasSellingPlanConflict(m)?(h.sheetClicked({instrument:this.name,result:"success",reason:"redirected_to_checkout"}),_t((r=m==null?void 0:m.checkoutUrl)!=null?r:""),n.reject()):p?(h.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),U({checkoutUrl:(a=m==null?void 0:m.checkoutUrl)!=null?a:"",instrumentName:this.name,reason:p}),n.reject()):(this.cartId=m.id,n.resolve())}catch(p){return h.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),h.log({body:"Unhandled error detected in PayPal sheet clicked",attributes:{error:String(p),location:"onClick",...this.cartId&&{cartId:He(this.cartId)}}}),b.notify(p),Nt(u),n.reject()}}async createToken({apiClientPromise:t,requiresBillingAgreement:n}){const r=await t;try{if(!this.cartId)throw new Error("cartId not found when creating token");const a=await r.paypalTokenCreate({cartId:this.cartId,billingAgreement:n});return h.sheetClicked({instrument:this.name,result:"success"}),a}catch(a){throw S(this,yt)||(a instanceof et?h.sheetClicked({instrument:this.name,result:"rejected",reason:"silenced_error"}):(h.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),h.log({body:"Unhandled error detected in PayPal sheet clicked",attributes:{error:String(a),location:"createToken",...this.cartId&&{cartId:He(this.cartId)}}}),b.notify(a))),Nt(await this.i18n),new Error(Er)}}async onApprove({orderID:t,payerID:n,billingToken:r}){var a;try{if(h.authorizationAttempt(this.name),oe(F.AuthorizationLatency,this.name),!this.cartId)throw new Error("Cart not found");const o=await this.apiClient,i=this.requiresBillingAgreement()&&r!=null?r:t,{billingAddress:s,destinationAddress:l,expiresAt:d,email:u,remoteOrderId:p,payerApprovedAmount:m}=await o.paypalBuyerDetailsFetch(i,this.cartId),g=await Kt({cartId:this.cartId,cartClient:o,instrumentName:this.name,emailAddress:u,streetAddress:l});if(!(g!=null&&g.data))throw new Error("Cart not found");if(await this.decelerateOrAbort(g))return;const{id:f,totalAmount:v,checkoutUrl:E}=g.data,_=this.parseAddress({billingAddress:s,destinationAddress:l}),k=await pn({abortSignal:(a=this.abortController)==null?void 0:a.signal,cartClient:o,cartId:f,instrumentName:y.PayPal,billingAddress:_,paymentMethod:{walletPaymentMethod:{paypalWalletContent:{billingAddress:_,email:u,expiresAt:d,payerId:n,token:p!=null?p:t,acceptedSubscriptionTerms:!1,vaultingAgreement:!1,merchantId:this.walletParams.merchantId,...m&&{payerApprovedAmount:m}}}},canUsePaymentMethodForFreeOrder:!0,totalAmount:v});if(await this.decelerateOrAbort(k))return;h.authorizationComplete({instrument:this.name,result:"success",measurement:X(F.AuthorizationLatency,this.name)}),_t(E)}catch(o){throw S(this,yt)||(h.authorizationComplete({instrument:this.name,result:"failed",measurement:X(F.AuthorizationLatency,this.name)}),b.notify(o)),Nt(await this.i18n),new Error(Er)}}onError(t,n){var r;if(S(this,yt)||t.message.includes(Er))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"?h.log({body:"PayPal modal closed due to error: ".concat(t)}):Pd.some(o=>t.message.includes(o))?h.log({body:"Internal PayPal error occurred"}):b.notify(new kd(t)),h.sheetFailed(this.name,t),(r=this.abortController)==null||r.abort("[PayPal] Error occurred");const a=n.translate("brand.paypal");at(a,n)}requiresBillingAgreement(){return this.walletParams.hasManagedSellingPlanState||this.walletParams.requiresBillingAgreement}async decelerateOrAbort(t){if(t.abortReason==="out_of_stock")return await this.handleOutOfStock(),!0;if(so(t.errors,sn))return await this.handleOutOfStock(),!0;if(!t.data)return!1;const{totalAmount:n,checkoutUrl:r}=t.data;let a;return t.decelerationReason&&vd.includes(t.decelerationReason)?a=t.decelerationReason:ln({currentCartTotal:n,initialBuyerCurrency:this.buyerCurrency})&&(a="currency_changed"),a?(U({checkoutUrl:r,instrumentName:this.name,reason:a}),!0):!1}async handleOutOfStock(){h.authorizationComplete({instrument:this.name,result:"failed",measurement:X(F.AuthorizationLatency,this.name)}),wt(await this.i18n)}hasSellingPlanConflict(t){const{hasManagedSellingPlanState:n}=this.walletParams;return n==null||!t?!1:t.lineItems.some(r=>r.sellingPlanAllocation!=null)!==n}parseAddress({billingAddress:t,destinationAddress:n}){const r=t!=null?t:n;return r.country?r:this.buyerCountry?{...r,country:this.buyerCountry}:(b.notify(new Error("PayPal address missing country and buyer country is not set")),{...r,country:"ZZ"})}}yt=new WeakMap;class kd extends ot{constructor(t){super(t.message,{cause:t.cause}),c(this,"name","PayPalError"),c(this,"useHashPrefix",!0),this.stack=t.stack}}const $t=class Hp extends Ct{static walletName(){return"paypal"}constructor(t){super(t)}getWebComponentName(){return"shopify-paypal-button"}getInstrumentName(){return y.PayPal}getWebComponentClass(){return Id}loadWalletSDK(){let t=Hp.paypalSDKPromiseByUrl.get(this.walletParams.sdkUrl);
1if(t)return h.log({body:"Returning cached PayPal SDK promise",attributes:{sdkUrl:this.walletParams.sdkUrl}}),t;const n=document.createElement("script");return n.setAttribute("src",this.walletParams.sdkUrl),t=new Promise((r,a)=>{n.setAttribute("data-namespace",mo(this.walletParams.sdkUrl)),n.onload=()=>r(),n.onerror=o=>{Hp.paypalSDKPromiseByUrl.delete(this.walletParams.sdkUrl),n&&document.body.contains(n)&&document.body.removeChild(n),a(o)},document.body.appendChild(n)}),Hp.paypalSDKPromiseByUrl.set(this.walletParams.sdkUrl,t),t}getLoadEligibility(){return this.isInIframe()?{eligible:!1,reason:"cannot be loaded in an iframe"}:{eligible:!0}}getPartnerSDKEligibility(){var t,n;try{return(n=(t=po(this.walletParams.sdkUrl))==null?void 0:t.Buttons)!=null&&n.call(t).isEligible()?{eligible:!0}:{eligible:!1,reason:"PayPal SDK not eligible"}}catch(r){throw new rt({code:"paypal-sdk-eligibility-check-failed",message:"PayPal SDK 'isEligible' method failed unexpectedly: ".concat(r)})}}};c($t,"paypalSDKPromiseByUrl",new Map);let Lr=$t;const Td=".apple-pay-button{display:flex;align-items:center;justify-content:center;width:100%;padding:0!important;cursor:pointer;border:none}.apple-pay-button:hover:not(:disabled){filter:brightness(92%)}.apple-pay-button:disabled{opacity:.5;cursor:not-allowed}.apple-pay-button svg{height:100%;flex-shrink:0}.apple-pay--content{font-size:16px;font-family:San Francisco,sans-serif;width:100%;height:100%;flex-grow:1;display:flex;align-items:center;justify-content:center;white-space:pre}.apple-pay--light{background:#fff;color:#000}.apple-pay--light svg{fill:#000}.apple-pay--dark{background:#000;color:#fff}.apple-pay--dark svg{fill:#fff}",xr={UK:"GB",JA:"JP"},Dd=new Set(["EG","AE"]),go=["AS","GU","MP","PR","VI"];go.forEach(e=>{xr[e]="US"});const Rd=/^[A-Z]{1,2}[0-9]{1,2}[A-Z]?$/,Nd=/^[A-Z][0-9][A-Z]$/;function Od({postalCode:e,countryCode:t}){let n=e;const r=e.trim().toUpperCase();return t==="CA"&&Nd.test(r)?n="".concat(r," 0Z0"):t==="GB"&&Rd.test(r)&&(n="".concat(r," 0ZZ")),n}function Le(e,{applyPostalCodePadding:t}){var n,r;const a=e.countryCode,o={firstName:e.givenName||void 0,lastName:e.familyName||void 0,address1:(n=e==null?void 0:e.addressLines)==null?void 0:n[0],address2:((r=e==null?void 0:e.addressLines)==null?void 0:r[1])||void 0,city:e.locality||void 0,zip:e.postalCode||void 0,province:e.administrativeArea||e.subLocality||void 0,country:Ld(e.countryCode),phone:e.phoneNumber||void 0};return a&&Dd.has(a.toUpperCase())&&(o.province=e.locality||void 0,o.city=e.administrativeArea||e.subLocality||void 0),t&&o.zip&&(o.zip=Od({postalCode:o.zip,countryCode:o.country})),o.country==="HK"&&(o.zip=void 0,o.province=e.postalCode),a&&go.includes(a)&&(o.province=a),o.lastName||(o.lastName=o.firstName),o}function Ld(e){if(!e)return"ZZ";const t=e.toUpperCase();return Object.keys(xr).includes(t)?xr[t]:t}function xd(e,t){return e.map(n=>{const{title:r,deliveryPromise:a}=Ud(n,t);return{title:r,estimatedCost:{amount:zd(n),currencyCode:n[0].estimatedCost.currencyCode},handle:fo(n),deliveryPromise:a}})}function Md(e,t){return e.map(n=>{const{title:r,description:a}=Fd(n,t);return{title:r,description:a,handle:fo(n)}})}function yo({deliveryGroups:e}){return e.map(t=>t.deliveryOptions.filter(({deliveryMethodType:n})=>n==="SHIPPING").map(n=>({...n,groupType:t.groupType}))).reduce((t,n)=>t.flatMap(r=>n.map(a=>[...r,a])),[[]])}function zd(e){return e.reduce((t,n)=>t+Number(n.estimatedCost.amount),0).toFixed(2)}function Ud(e,t){const n=e.find(l=>l.groupType===Ot.OneTimePurchase),r=e.find(l=>l.groupType===Ot.Subscription),a=[...new Set([n==null?void 0:n.title,r==null?void 0:r.title])].filter(Boolean),o=[...new Set([n==null?void 0:n.deliveryPromise,r==null?void 0:r.deliveryPromise])].filter(Boolean),i=a.length===2?t.translate("shipping_methods.connect_shipping_methods",{methodOne:a[0],methodTwo:a[1]}):a[0],s=o.length===2?t.translate("delivery_promises.connect_delivery_promises",{promiseOne:o[0],promiseTwo:o[1]}):o[0];return{title:i,deliveryPromise:s}}function Fd(e,t){const n=e.find(i=>i.groupType===Ot.OneTimePurchase),r=e.find(i=>
1i.groupType===Ot.Subscription),a=e.map(Bd).filter(Boolean).join(", ");let o=(n==null?void 0:n.title)||(r==null?void 0:r.title);return n&&r&&(o=t.translate("shipping_methods.connect_shipping_methods",{methodOne:n.title,methodTwo:r.title})),{title:o,description:a}}function Bd(e){const t=Number(e.estimatedCost.amount).toFixed(2),n=e.estimatedCost.currencyCode,r=e.deliveryPromise;return r?"(".concat(r,") ").concat(t," ").concat(n):"".concat(t," ").concat(n)}function fo(e){return e.map(t=>t.handle).join(",")}function bo({deliveryGroups:e,i18n:t}){const n=e.some(r=>r.groupType===Ot.Subscription);return e.map(r=>{var a;let o=t.translate("order_summary.shipping");return n&&(o=r.groupType===Ot.Subscription?t.translate("order_summary.shipping_subscription"):t.translate("order_summary.shipping_one_time_purchase")),{label:o,amount:bt(((a=r.selectedDeliveryOption)==null?void 0:a.estimatedCost.amount)||0)}})}function Hd(e,t){return he({label:e,possibleLines:[t]})[0]}function $d({subtotal:e,deliveryGroups:t,duties:n,taxes:r,discountAllocations:a,i18n:o,formattedRecurringTotals:i,lineItems:s}){var l;const d=he({label:o.translate("order_summary.subtotal"),possibleLines:[e]}),u=bo({deliveryGroups:t,i18n:o}),p=he({label:o.translate("order_summary.duties"),possibleLines:[n]}),m=he({label:o.translate("order_summary.taxes"),possibleLines:[r]}),g=i.map(E=>({label:E,amount:"0.00",type:"pending"})),f=g.length?[{label:o.translate("order_summary.subscriptions.recurring_total_tooltip_line"),amount:"0.00",type:"pending"}]:[],v=(l=a==null?void 0:a.flatMap(E=>{var _;const k=(_=E.title)!=null?_:E.code;return he({label:k!=null?k:o.translate("order_summary.discount"),possibleLines:[E.discountedAmount],isDiscount:!0})}))!=null?l:[];return[...$a(s,(E,_)=>({label:E,amount:_,type:"final"})),...d,...u,...p,...m,...v,...g,...f]}function he({label:e,possibleLines:t,isDiscount:n=!1}){return t.filter(r=>(r==null?void 0:r.amount)!==void 0).map(r=>({label:e,amount:n?"-".concat(bt(r.amount)):bt(r.amount)}))}function qn(e,t){if(!e.length)return[];const n=yo({deliveryGroups:e});return xd(n,t).map(r=>{var a;return{label:r.title||"",amount:r.estimatedCost.amount,identifier:r.handle,detail:(a=r.deliveryPromise)!=null?a:""}})}const Gd=["decelerate","abort","show_error","complete","update"];class Mr extends ot{constructor(){super(...arguments),c(this,"name","UnhandledActionError")}}class wo{constructor(){c(this,"generatePrioritizedPaymentSheetAction",(t,n)=>{let r;const a=[],o=[],i=[],s=n.filter(d=>d.code!=="PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT").some(d=>t.get(d)!==void 0);for(const d of t.keys())if(!(d.code==="PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT"&&s)){const u=t.get(d)();u.effects&&o.push(...u.effects),u.action!=="complete"&&u.errors&&i.push(...u.errors),a.push(u)}const l=(d=>Gd.map(u=>d.find(p=>p.action===u)).find(u=>!!u))(a);return l&&(r=l,r.effects=o,r.action!=="complete"&&(r.errors=i)),r})}getMergedPaymentSheetAction({result:t,errorActions:n}){const r=new Map;n.forEach(o=>{o.matchers.forEach(i=>{const s=t.errors.find(l=>ge(l,i));s&&r.set(s,o.generateAction)})});let a;for(const o of t.errors){const i=r.get(o);if(i){a=i();break}}return{firstPaymentSheetAction:a,prioritizedPaymentSheetAction:this.generatePrioritizedPaymentSheetAction(r,t.errors)}}getUnhandledErrors(t,n){const r=n.flatMap(o=>o.matchers),a=t.filter(o=>!r.some(i=>ge(o,i)));return this.filterIncidentalErrors(a,t)}decelerateOrAbort({reason:t,instrumentName:n,errorOrWarning:r,checkoutUrl:a,requestType:o}){return a?{action:"decelerate",redirectUrl:a,reason:t}:{action:"abort",effects:[()=>{b.notify(new Error("[".concat(n,"] unexpected ").concat(r," received in ").concat(o," response, aborting")))}]}}filterIncidentalErrors(t,n){return n.length>t.length?t.filter(r=>!Fc.some(a=>ge(r,a))):t}}class Vd extends wo{constructor(t){super(),this.i18n=t}mapMutationResultToPaymentSheetAction({result:t,context:n,checkoutUrl:r,requestType:a}){var o;const i=this.mapCustomValidationFunctionErrorToAction(t.errors);if(i)return i;const s=this.getErrorActions({shippingCountryCode:n==null?void 0:n.shippingCountryCode,billingCountryCode:n==null?void 0:n.billingCountryCode,checkoutUrl:r,requestType:a}),l=t.errors,d=this.processUnhandledErrors({errors:l,errorActions:s,resultType:"mutation"}),{firstPaymentSheetAction:u}=this.getMergedPaymentSheetAction({result:t,errorActions:s});return!u&&((o=t.data)==null?void 0:o.deliveryGroups.length)===0&&n!=null&&n.shippingRequired?{action:"show_error",errors:[new ApplePayError("addressUnserviceable")]}:u||d||{action:"update",errors:[]}}mapCompletionResultToPaymentSheetAction({result:t,context:n,checkoutUrl:r}){if(!t.data)throw new xa(y.ApplePay);switch(t.data.__typename){case"SubmitSuccess":return{action:"complete",redirectUrl:t.data.redirectUrl};case"SubmitAlreadyAccepted":case"SubmitThrottled":case"SubmitFailed":{const a=this.mapCustomValidationFunctionErrorToAction(t.errors);if(a)return a;const o=this.getErrorActions({shippingCountryCode:n==null?void 0:n.shippingCountryCode,billingCountryCode:n==null?void 0:n.billingCountryCode,checkoutUrl:r,requestType:"completion"}),i=t.errors;this.processUnhandledErrors({errors:i,errorActions:o,resultType:"completion"});const{prioritizedPaymentSheetAction:s}=this.getMergedPaymentSheetAction({result:t,errorActions:o});return s||this.createGenericAbortAction()}default:throw new Error("[".concat(y.ApplePay,"] unknown completion result type: ").concat(t.data.__typename))}}decelerateOrAbort(...t){var n;const r=super.decelerateOrAbort(...t);return r.action==="abort"&&((n=r.effects)==null||n.push(()=>{at(this.i18n.translate("brand.apple_pay"),this.i18n)})),r}getAbortActions(){return[{matchers:sn,generateAction:()=>({action:"abort",effects:[()=>wt(this.i18n)]})},{matchers:io,generateAction:()=>({action:"abort",effects:[()=>at(this.i18n.translate("brand.apple_pay"),this.i18n)]})}]}getDecelerateActions({checkoutUrl:t,requestType:n}){return[{matchers:[je],generateAction:()=>this.decelerateOrAbort({reason:"captcha_required",instrumentName:y.ApplePay,errorOrWarning:je.code,checkoutUrl:t,requestType:n})},{matchers:[qe],generateAction:()=>this.decelerateOrAbort({reason:"localization_extension_field_error",instrumentName:y.ApplePay,errorOrWarning:qe.code,checkoutUrl:t,requestType:n})},{matchers:[Ln],generateAction:()=>this.decelerateOrAbort({reason:"account_info_mismatch",instrumentName:y.ApplePay,errorOrWarning:Ln.code,checkoutUrl:t,requestType:n})},{matchers:[We],generateAction:()=>this.decelerateOrAbort({reason:"invalid_language",instrumentName:y.ApplePay,errorOrWarning:We.code,checkoutUrl:t,requestType:n})},{matchers:[Ye],generateAction:()=>this.decelerateOrAbort({reason:"invalid_country",instrumentName:y.ApplePay,errorOrWarning:Ye.code,checkoutUrl:t,requestType:n})},{matchers:[xn],generateAction:()=>this.decelerateOrAbort({reason:"payments_country_invalid",instrumentName:y.ApplePay,errorOrWarning:xn.code,checkoutUrl:t,requestType:n})},{matchers:[Mn],generateAction:()=>this.decelerateOrAbort({reason:"cart_empty",instrumentName:y.ApplePay,errorOrWarning:Mn.code,checkoutUrl:t,requestType:n})},{matchers:[Ke],generateAction:()=>this.decelerateOrAbort({reason:"missing_cart_id",instrumentName:y.ApplePay,errorOrWarning:Ke.code,checkoutUrl:t,requestType:n})},{matchers:[Xe],generateAction:()=>this.decelerateOrAbort({reason:"redirect_to_checkout_required",instrumentName:y.ApplePay,errorOrWarning:Xe.code,checkoutUrl:t,requestType:n})},{matchers:[Qe],generateAction:()=>this.decelerateOrAbort({reason:"unsupported_apple_pay_payment_method",instrumentName:y.ApplePay,errorOrWarning:Qe.code,checkoutUrl:t,requestType:n})},{matchers:[Ve],generateAction:()=>this.decelerateOrAbort({reason:"custom_validation",instrumentName:y.ApplePay,errorOrWarning:Ve.code,checkoutUrl:t,requestType:n})},{matchers:ro,generateAction:()=>this.decelerateOrAbort({reason:"invalid_payment_amount",instrumentName:y.ApplePay,errorOrWarning:"INVALID_PAYMENT",checkoutUrl:t,requestType:n})},{matchers:on,generateAction:()=>this.decelerateOrAbort({reason:"dynamic_tax",instrumentName:y.ApplePay,errorOrWarning:"TAX_NEW_TAX_MUST_BE_ACCEPTED",checkoutUrl:t,requestType:n})},{matchers:[Je],generateAction:()=>this.decelerateOrAbort({reason:"generic_error",instrumentName:y.ApplePay,errorOrWarning:Je.code,checkoutUrl:t,requestType:n})},{matchers:[zn],generateAction:()=>this.decelerateOrAbort({reason:"generic_error",instrumentName:y.ApplePay,errorOrWarning:zn.code,checkoutUrl:t,requestType:n})},{matchers:no,generateAction:()=>this.decelerateOrAbort({reason:"not_enough_stock",instrumentName:y.ApplePay,errorOrWarning:"MERCHANDISE_NOT_ENOUGH_STOCK",checkoutUrl:t,requestType:n})}]}getShowErrorActions({shippingCountryCode:t,billingCountryCode:n}){const r=(a,o)=>()=>{const i=o.startsWith("billingAddress")?n:t;h.addressFieldError({instrument:y.ApplePay,errorCode:a,errorField:o,countryCode:i})};return[{matchers:Ee.required,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","emailAddress",this.i18n.translate("errors.missing.email"))]})},{matchers:Ee.invalid,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","emailAddress",this.i18n.translate("errors.invalid.email"))]})},{matchers:w.required.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.missing.first_name"))],effects:[r("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.firstName")]})},{matchers:w.invalid.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.invalid.first_name"))],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.firstName")]})},{matchers:w.required.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.missing.last_name"))],effects:[r("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.lastName")]})},{matchers:w.invalid.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.invalid.last_name"))],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.lastName")]})},{matchers:eo,generateAction:()=>({action:"show_error",errors:[new ApplePayError("addressUnserviceable")]})},{matchers:w.required.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.missing.address1"))],effects:[r("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.address1")]})},{matchers:w.invalid.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address1"))],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.address1")]})},{matchers:w.emojis.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.emojis.last_name"))]})},{matchers:w.emojis.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.emojis.first_name"))]})},{matchers:w.tooLong.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.too_long.address1"))]})},{matchers:w.tooLong.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.too_long.address2"))]})},{matchers:w.tooLong.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.too_long.first_name"))]})},{matchers:w.tooLong.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.too_long.last_name"))]})},{matchers:w.tooLong.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.too_long.city"))]})},{matchers:w.containsUrl.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.url.first_name"))]})},{matchers:w.containsUrl.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.url.last_name"))]})},{matchers:w.htmlTags.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address1"))]})},{matchers:w.htmlTags.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address2"))]})},{matchers:w.htmlTags.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.html_tags.city"))]})},{matchers:w.htmlTags.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.html_tags.first_name"))]})},{matchers:w.htmlTags.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.html_tags.last_name"))]})},{matchers:w.emojis.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.emojis.city"))]})},{matchers:w.emojis.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address1"))]})},{matchers:w.emojis.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address2"))]})},{matchers:w.emojis.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.emojis.postal_code"))]})},{matchers:w.required.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.missing.address2"))],effects:[r("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.address2")]})},{matchers:w.invalid.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address2"))],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.address2")]})},{matchers:w.required.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.missing.city"))],effects:[r("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.city")]})},{matchers:w.invalid.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.invalid.city"))],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.city")]})},{matchers:w.invalid.province,generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.invalid.zone"),this.i18n.translate("errors.invalid.emirate"),"shippingContactInvalid",t)],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.province")]})},{matchers:w.required.province,generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.missing.zone"),this.i18n.translate("errors.missing.emirate"),"shippingContactInvalid",t)],effects:[r("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.province")]})},{matchers:w.required.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.missing.postal_code"))],effects:[r("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.zip")]})},{matchers:w.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.invalid.postal_code"))],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.zip")]})},{match
1ers:w.required.country,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","country",this.i18n.translate("errors.missing.country"))],effects:[r("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.country")]})},{matchers:w.invalid.phoneNumber,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","phoneNumber",this.i18n.translate("errors.invalid.phone"))],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.phone")]})},{matchers:w.invalid.country,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","country",this.i18n.translate("errors.invalid.country"))],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.country")]})},{matchers:w.required.phoneNumber,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","phoneNumber",this.i18n.translate("errors.missing.phone"))],effects:[r("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.phone")]})},{matchers:A.invalid.generic,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid")],effects:[r("INVALID_PAYMENT","billingAddress")]})},{matchers:A.required.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.missing.first_name"))],effects:[r("ADDRESS_FIELD_IS_REQUIRED","billingAddress.firstName")]})},{matchers:A.required.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.missing.last_name"))],effects:[r("ADDRESS_FIELD_IS_REQUIRED","billingAddress.lastName")]})},{matchers:A.required.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.missing.address1"))],effects:[r("ADDRESS_FIELD_IS_REQUIRED","billingAddress.address1")]})},{matchers:A.required.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.missing.address2"))],effects:[r("ADDRESS_FIELD_IS_REQUIRED","billingAddress.address2")]})},{matchers:A.required.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.missing.city"))],effects:[r("ADDRESS_FIELD_IS_REQUIRED","billingAddress.city")]})},{matchers:A.required.phoneNumber,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","phoneNumber",this.i18n.translate("errors.missing.phone"))],effects:[r("ADDRESS_FIELD_IS_REQUIRED","billingAddress.phone")]})},{matchers:A.required.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","postalCode",this.i18n.translate("errors.missing.postal_code"))],effects:[r("ADDRESS_FIELD_IS_REQUIRED","billingAddress.zip")]})},{matchers:A.required.province,generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.missing.zone"),this.i18n.translate("errors.missing.emirate"),"billingContactInvalid",n)],effects:[r("ADDRESS_FIELD_IS_REQUIRED","billingAddress.province")]})},{matchers:A.emojis.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.emojis.first_name"))]})},{matchers:A.htmlTags.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.html_tags.first_name"))]})},{matchers:A.invalid.firstName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.invalid.first_name"))],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.firstName")]})},{matchers:A.emojis.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.emojis.last_name"))]})},{matchers:A.htmlTags.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.html_tags.last_name"))]})},{matchers:A.invalid.lastName,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.invalid.last_name"))],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.lastName")]})},{matchers:A.emojis.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address1"))]})},{matchers:A.htmlTags.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address1"))]})},{matchers:A.invalid.address1,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address1"))],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.address1")]})},{matchers:A.emojis.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address2"))]})},{matchers:A.htmlTags.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address2"))]})},{matchers:A.invalid.address2,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address2"))],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.address2")]})},{matchers:A.emojis.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.emojis.city"))]})},{matchers:A.htmlTags.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.html_tags.city"))]})},{matchers:A.invalid.city,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.invalid.city"))],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.city")]})},{matchers:A.emojis.phoneNumber,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","phoneNumber",this.i18n.translate("errors.emojis.phone"))]})},{matchers:A.invalid.phoneNumber,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","phoneNumber",this.i18n.translate("errors.invalid.phone"))],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.phone")]})},{matchers:A.emojis.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","postalCode",this.i18n.translate("errors.emojis.postal_code"))]})},{matchers:A.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","postalCode",this.i18n.translate("errors.invalid.postal_code"))],effects:[r("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.zip")]})},{matchers:[ao],generateAction:()=>({action:"show_error",errors:[new ApplePayError("unknown")]})},{matchers:[Ic],generateAction:()=>({action:"show_error",errors:[new ApplePayError("couponCodeInvalid",void 0,this.i18n.translate("errors.invalid.discount"))]})}]}getErrorActions({shippingCountryCode:t,billingCountryCode:n,checkoutUrl:r,requestType:a}){return[...this.getAbortActions(),...this.getDecelerateActions({checkoutUrl:r,requestType:a}
1),...this.getShowErrorActions({shippingCountryCode:t,billingCountryCode:n})]}processUnhandledErrors({errors:t,errorActions:n,resultType:r}){const a=this.getUnhandledErrors(t,n);return a.forEach(o=>{b.notify(new Mr("[".concat(y.ApplePay,"] ").concat(r," result error not handled: ").concat(Ht(o)),{groupingHash:"UnhandledActionError:".concat(y.ApplePay,":").concat(Ht(o))}))}),a.length>0?this.createGenericAbortAction():null}createGenericAbortAction(){return{action:"abort",effects:[()=>{at(this.i18n.translate("brand.apple_pay"),this.i18n)}]}}mapCustomValidationFunctionErrorToAction(t){const n=tn(t);return n?{action:"abort",effects:[()=>{const r=this.i18n.translate("brand.apple_pay");en(this.i18n.translate("error_dialogs.wallet.title",{wallet:r}),n.message)}]}:null}createApplePayZoneError(t,n,r,a){const o=a==="AE"?"subLocality":"administrativeArea";return new ApplePayError(r,o,a==="AE"?n:t)}}const Wn=["name","postalAddress"];function jd({shippingRequired:e,walletParams:t,buyerCurrency:n}){const{phoneRequired:r,emailRequired:a}=t,o=[...a?["email"]:[],...r?["phone"]:[]],i=e?[...Wn,...o]:o;return{countryCode:t.countryCode,currencyCode:n,merchantCapabilities:t.merchantCapabilities,supportedNetworks:t.supportedNetworks,total:{type:"pending",label:t.merchantName,amount:"1.00"},requiredBillingContactFields:Wn,requiredShippingContactFields:i,shippingType:t.shippingType}}const qd=e=>{const t=e.lineItems.flatMap(n=>n.discountAllocations);return[...e.discountCodes.filter(n=>n.applicable&&e.discountAllocations.findIndex(r=>r.code===n.code)===-1&&t.findIndex(r=>r.code===n.code)===-1).map(n=>({code:n.code,discountedAmount:{amount:"0",currencyCode:e.totalAmount.currencyCode}})),...e.discountAllocations,...t]};class Wd extends ot{constructor(){super(...arguments),c(this,"name","ApplePaySessionCreationError"),c(this,"useHashPrefix",!0),c(this,"autogenerateHash",!0)}}const _o=e=>{const t=e.lineItems.reduce((n,r)=>n+Number(r.subtotalAmount.amount),0);return{amount:String(t),currencyCode:e.totalAmount.currencyCode}};function Yd(e,t){return e.reduce((n,r)=>{if(!r.sellingPlanAllocation)return n;const{sellingPlanAllocation:{sellingPlan:a,priceAdjustments:o},quantity:i}=r;if(!a.recurringDeliveries||!a.billingPolicy)return n;const s=Kd({billingPolicy:a.billingPolicy,i18n:t});if(o.length===0){const l=xe({price:Number(r.subtotalAmount.amount)*i,currencyCode:r.subtotalAmount.currencyCode,locale:t.locale});return[...n,t.translate("order_summary.subscriptions.recurring_totals",{fixedPrice:l,interval:s})]}else if(o.length===1){const l=xe({price:Number(o[0].price.amount)*i,currencyCode:o[0].price.currencyCode,locale:t.locale});return[...n,t.translate("order_summary.subscriptions.recurring_totals",{fixedPrice:l,interval:s})]}else if(o.length===2){const l=xe({price:Number(o[0].price.amount)*i,currencyCode:o[0].price.currencyCode,locale:t.locale}),d=xe({price:Number(o[1].price.amount)*i,currencyCode:o[1].price.currencyCode,locale:t.locale}),u=a.priceAdjustments[0].orderCount;return[...n,t.translate("order_summary.subscriptions.recurring_totals_with_policies",{count:u,fixedPrice:l,recurringPrice:d,interval:s})]}return n},[])}function xe({price:e,currencyCode:t,locale:n}){return Intl.NumberFormat(n,{style:"currency",currency:t,currencyDisplay:"narrowSymbol"}).format(e)}function Kd({billingPolicy:e,i18n:t}){const{interval:n,intervalCount:r}=e,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"}[n];if(!a)throw new Error("Unknown selling plan interval provided: ".concat(n));return t.translate(a,{count:r})}const ur="GraphQL Client",Yn=0,Kn=3,Eo="An error occurred while fetching from the API. Review 'graphQLErrors' for details.",Ao="Response returned unexpected Content-Type:",So="An unknown error has occurred. The API did not return a data object or any errors in its response.",zr={json:"application/json",multipart:"multipart/mixed"},Qn="X-SDK-Variant",Xn="X-SDK-Version",Qd="shopify-graphql-client",Xd="1.4.2",Co=1e3,Jd=[429,503],vo=/@(defer)\b/i,Jn="\r\n",Zd=/boundary="?([^=";]+)"?/i,Zn=Jn+Jn;
1function ct(e,t=ur){return e.startsWith("".concat(t))?e:"".concat(t,": ").concat(e)}function Ut(e){return e instanceof Error?e.message:JSON.stringify(e)}function Po(e){return e instanceof Error&&e.cause?e.cause:void 0}function Io(e){return e.flatMap(({errors:t})=>t!=null?t:[])}function ko({client:e,retries:t}){if(t!==void 0&&(typeof t!="number"||t<Yn||t>Kn))throw new Error("".concat(e,': The provided "retries" value (').concat(t,") is invalid - it cannot be less than ").concat(Yn," or greater than ").concat(Kn))}function q(e,t){return t&&(typeof t!="object"||Array.isArray(t)||typeof t=="object"&&Object.keys(t).length>0)?{[e]:t}:{}}function To(e,t){if(e.length===0)return t;const n={[e.pop()]:t};return e.length===0?n:To(e,n)}function Do(e,t){return Object.keys(t||{}).reduce((n,r)=>(typeof t[r]=="object"||Array.isArray(t[r]))&&e[r]?(n[r]=Do(e[r],t[r]),n):(n[r]=t[r],n),Array.isArray(e)?[...e]:{...e})}function Ro([e,...t]){return t.reduce(Do,{...e})}function tu({clientLogger:e,customFetchApi:t=fetch,client:n=ur,defaultRetryWaitTime:r=Co,retriableCodes:a=Jd}){const o=async(i,s,l)=>{const d=s+1,u=l+1;let p;try{if(p=await t(...i),e({type:"HTTP-Response",content:{requestParams:i,response:p}}),!p.ok&&a.includes(p.status)&&d<=u)throw new Error;const m=(p==null?void 0:p.headers.get("X-Shopify-API-Deprecated-Reason"))||"";return m&&e({type:"HTTP-Response-GraphQL-Deprecation-Notice",content:{requestParams:i,deprecationNotice:m}}),p}catch(m){if(d<=u){const g=p==null?void 0:p.headers.get("Retry-After");return await eu(g?parseInt(g,10):r),e({type:"HTTP-Retry",content:{requestParams:i,lastResponse:p,retryAttempt:s,maxRetries:l}}),o(i,d,l)}throw new Error(ct("".concat(l>0?"Attempted maximum number of ".concat(l," network retries. Last message - "):"").concat(Ut(m)),n))}};return o}async function eu(e){return new Promise(t=>setTimeout(t,e))}function ru({headers:e,url:t,customFetchApi:n=fetch,retries:r=0,logger:a}){ko({client:ur,retries:r});const o={headers:e,url:t,retries:r},i=nu(a),s=tu({customFetchApi:n,clientLogger:i,defaultRetryWaitTime:Co}),l=au(s,o),d=ou(l),u=hu(l);return{config:o,fetch:l,request:d,requestStream:u}}function nu(e){return t=>{e&&e(t)}}async function No(e){const{errors:t,data:n,extensions:r}=await e.json();return{...q("data",n),...q("extensions",r),headers:e.headers,...t||!n?{errors:{networkStatusCode:e.status,message:ct(t?Eo:So),...q("graphQLErrors",t),response:e}}:{}}}function au(e,{url:t,headers:n,retries:r}){return async(a,o={})=>{const{variables:i,headers:s,url:l,retries:d,keepalive:u,signal:p}=o,m=JSON.stringify({query:a,variables:i});ko({client:ur,retries:d});const g=Object.entries({...n,...s}).reduce((v,[E,_])=>(v[E]=Array.isArray(_)?_.join(", "):_.toString(),v),{});!g[Qn]&&!g[Xn]&&(g[Qn]=Qd,g[Xn]=Xd);const f=[l!=null?l:t,{method:"POST",headers:g,body:m,signal:p,keepalive:u}];return e(f,1,d!=null?d:r)}}function ou(e){return async(...t)=>{if(vo.test(t[0]))throw new Error(ct("This operation will result in a streamable response - use requestStream() instead."));let n=null;try{n=await e(...t);const{status:r,statusText:a}=n,o=n.headers.get("content-type")||"";return n.ok?o.includes(zr.json)?await No(n):{errors:{networkStatusCode:r,message:ct("".concat(Ao," ").concat(o)),response:n}}:{errors:{networkStatusCode:r,message:ct(a),response:n}}}catch(r){return{errors:{message:Ut(r),...n==null?{}:{networkStatusCode:n.status,response:n}}}}}}function iu(e){return Ft(this,null,function*(){const t=new TextDecoder;if(e.body[Symbol.asyncIterator])try{for(var n=vt(e.body),r,a,o;r=!(a=yield new nt(n.next())).done;r=!1){const i=a.value;yield t.decode(i)}}catch(i){o=[i]}finally{try{r&&(a=n.return)&&(yield new nt(a.call(n)))}finally{if(o)throw o[0]}}else{const i=e.body.getReader();let s;try{for(;!(s=yield new nt(i.read())).done;)yield t.decode(s.value)}finally{i.cancel()}}})}function su(e,t){return{[Symbol.asyncIterator](){return Ft(this,null,function*(){try{let i="";try{for(var n=vt(e),r,a,o;r=!(a=yield new nt(n.next())).done;r=!1){const s=a.value;if(i+=s,i.indexOf(t)>-1){const l=i.lastIndexOf(t),d=i.slice(0,l).split(t).filter(u=>u.trim().length>0).map(u=>u.slice(u.indexOf(Zn)+Zn.length).trim());d.length>0&&(yield d),i=i.slice(l+t.length),i.trim()==="--"&&(i="")}}}catch(s){o=[s]}
1finally{try{r&&(a=n.return)&&(yield new nt(a.call(n)))}finally{if(o)throw o[0]}}}catch(i){throw new Error("Error occured while processing stream payload - ".concat(Ut(i)))}})}}}function lu(e){return{[Symbol.asyncIterator](){return Ft(this,null,function*(){try{yield{...yield new nt(No(e)),hasNext:!1}}catch(t){yield{errors:{message:ct(Ut(t)),networkStatusCode:e.status,response:e},hasNext:!1}}})}}}function cu(e){return e.map(t=>{try{return JSON.parse(t)}catch(n){throw new Error("Error in parsing multipart response - ".concat(Ut(n)))}}).map(t=>{const{data:n,incremental:r,hasNext:a,extensions:o,errors:i}=t;if(!r)return{data:n||{},...q("errors",i),...q("extensions",o),hasNext:a};const s=r.map(({data:l,path:d,errors:u})=>({data:l&&d?To(d,l):{},...q("errors",u)}));return{data:s.length===1?s[0].data:Ro([...s.map(({data:l})=>l)]),...q("errors",Io(s)),hasNext:a}})}function du(e,t){if(e.length>0)throw new Error(Eo,{cause:{graphQLErrors:e}});if(Object.keys(t).length===0)throw new Error(So)}function uu(e,t){var n,r;const a=(t!=null?t:"").match(Zd),o="--".concat(a?a[1]:"-");if(!((n=e.body)!=null&&n.getReader)&&!((r=e.body)!=null&&r[Symbol.asyncIterator]))throw new Error("API multipart response did not return an iterable body",{cause:e});const i=iu(e);let s={},l;return{[Symbol.asyncIterator](){return Ft(this,null,function*(){var d,u;try{let v=!0;try{for(var p=vt(su(i,o)),m,g,f;m=!(g=yield new nt(p.next())).done;m=!1){const E=g.value,_=cu(E);l=(u=(d=_.find(j=>j.extensions))==null?void 0:d.extensions)!=null?u:l;const k=Io(_);s=Ro([s,..._.map(({data:j})=>j)]),v=_.slice(-1)[0].hasNext,du(k,s),yield{...q("data",s),...q("extensions",l),hasNext:v}}}catch(E){f=[E]}finally{try{m&&(g=p.return)&&(yield new nt(g.call(p)))}finally{if(f)throw f[0]}}if(v)throw new Error("Response stream terminated unexpectedly")}catch(v){const E=Po(v);yield{...q("data",s),...q("extensions",l),errors:{message:ct(Ut(v)),networkStatusCode:e.status,...q("graphQLErrors",E==null?void 0:E.graphQLErrors),response:e},hasNext:!1}}})}}}function hu(e){return async(...t)=>{if(!vo.test(t[0]))throw new Error(ct("This operation does not result in a streamable response - use request() instead."));try{const n=await e(...t),{statusText:r}=n;if(!n.ok)throw new Error(r,{cause:n});const a=n.headers.get("content-type")||"";switch(!0){case a.includes(zr.json):return lu(n);case a.includes(zr.multipart):return uu(n,a);default:throw new Error("".concat(Ao," ").concat(a),{cause:n})}}catch(n){return{[Symbol.asyncIterator](){return Ft(this,null,function*(){const r=Po(n);yield{errors:{message:ct(Ut(n)),...q("networkStatusCode",r==null?void 0:r.status),...q("response",r)},hasNext:!1}})}}}}}const pu="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}}}}",mu="mutation cartUpdateDeliveryAddressAndContact($cartId:ID!$addressInput:[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}",gu="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}",yu="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}",fu="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}
1",bu="mutation applePaySessionCreate($validationUrl:URL!){applePaySessionCreate(validationUrl:$validationUrl){...@defer{applePaySession{body}}}}",wu="mutation PayPalBuyerDetailsFetch($token:String!$cartId:ID){paypalBuyerDetailsFetch(token:$token cartId:$cartId){...@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}}}}}",_u="mutation PayPalTokenCreate($cartId:ID!$billingAgreement:Boolean!){paypalTokenCreate(cartId:$cartId billingAgreement:$billingAgreement){...@defer{paypalToken{token}}}}",Eu="query cartQuery($id:ID!$country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){cart(id:$id){...CartParts}}",Au="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}}}}}}}",Su="query subscriptionPolicyQuery($country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){shop{subscriptionPolicy(sanitized:true){body}}}",Cu="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}",Ar="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}}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}}}}}}",ta="fragment CartErrorParts on CartUserError{message field code}",vu="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}}}",Pu="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}}}}",Iu="mutation cartRemovePersonalData($cartId:ID!){cartRemovePersonalData(cartId:$cartId){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}";async function ku(e,t){var n,r;if(!t.errors)return;const a=zu(t.errors,e),o=await Mu(t.errors.response),i=((r=(n=t.errors.response)==null?void 0:n.headers)==null?void 0:r.get("content-type"))||void 0,s=[];if(t.errors.graphQLErrors)for(const l of t.errors.graphQLErrors)l.code&&s.push(l.code);return{operationName:e,statusCode:t.errors.networkStatusCode,contentType:i,message:a,responseBody:o,errorCodes:s}}const Tu=[/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,/Internal error/,/Carrier-calculated rates through @defer is temporarily unavailable/,/Throttled/,/Request blocked/,/Network request failed/,/Load failed/,/The string did n
1ot match the expected pattern/,/Failed to fetch/,/when attempting to fetch resource/],Du=[/signal is aborted/i,/fetch is aborted/i,/operation was aborted/i,/\[Apple Pay\] Payment sheet cancelled/],Ru=[/timed?.out/i,/error occured while processing stream payload/i,/response stream terminated/i],Nu=/provided invalid value/,Ou=["quantity","sellingPlanId","attributes"];function Lu(e){var t;return Nu.test(e)&&(t=Ou.find(n=>e.includes(n)))!=null?t:null}function xu(e,{hasBeenVisible:t=!1}={}){if(e.statusCode&&e.statusCode!==200)return{isIgnorable:!0,reason:"statusCode-".concat(e.statusCode)};if(e.message){if(Ru.some(r=>r.test(e.message)))return{isIgnorable:!0,reason:"timeout"};if(Du.some(r=>r.test(e.message)))return{isIgnorable:!0,reason:"abort"};if(Tu.some(r=>r.test(e.message)))return{isIgnorable:!0,reason:"message"};const n=Lu(e.message);if(n)return{isIgnorable:!0,reason:"graphql-input-validation-".concat(n)}}return t?{isIgnorable:!1,reason:void 0}:{isIgnorable:!0,reason:"component-not-visible"}}async function Mu(e){if(!e||e.bodyUsed)return"";try{return(await e.text()).slice(0,1024)}catch(t){return console.error("Failed to read response body:",t),""}}function zu(e,t){var n,r;if(!e)return"";const a=(r=(n=e.graphQLErrors)==null?void 0:n.map(s=>s.message).join(", "))!=null?r:"",o="".concat(e.message).concat(a.length>0?" - ".concat(a):""),i=e.networkStatusCode?"with status ".concat(e.networkStatusCode," => ").concat(o):"=> ".concat(o);return"GraphQL response error for ".concat(t,": ").concat(i)}const Ur="UNKNOWN";function Uu({url:e,accessToken:t}){return{headers:{"Content-Type":"application/json",Accept:"application/json","X-Shopify-Storefront-Access-Token":t,"X-SDK-Variant":"portable-wallets"},url:e,retries:0,customFetchApi:(n,r)=>(b.leaveBreadcrumb("Request ".concat((r==null?void 0:r.method)||Ur,": ").concat(n),{url:n,method:r==null?void 0:r.method},"request"),fetch(n,r)),logger:n=>{try{switch(n.type){case"HTTP-Response":{const[r,a]=n.content.requestParams,{status:o,statusText:i,headers:s,type:l}=n.content.response;b.leaveBreadcrumb("Response ".concat((a==null?void 0:a.method)||Ur,": ").concat(r),{statusCode:o,statusText:i,requestId:Fu(s),responseHeaders:Bu(s),responseType:l,url:r,method:a==null?void 0:a.method,headers:a==null?void 0:a.headers,body:a==null?void 0:a.body},"log");break}case"HTTP-Retry":{const{retryAttempt:r,maxRetries:a,lastResponse:o,requestParams:[i,s]=[]}=n.content;b.leaveBreadcrumb("GraphQL Retry Attempt ".concat(r,"/").concat(a,": ").concat(i),{retryAttempt:r,maxRetries:a,url:i,method:s==null?void 0:s.method,lastResponseStatus:o==null?void 0:o.status},"log");break}case"HTTP-Response-GraphQL-Deprecation-Notice":{const{deprecationNotice:r,requestParams:a}=n.content,[o,i]=a||[];b.leaveBreadcrumb("GraphQL Deprecation Notice: ".concat(o),{deprecationNotice:r,url:o,method:i==null?void 0:i.method},"log");break}default:{const r=n;b.leaveBreadcrumb("GraphQL Logger: ".concat(r.type),{type:r.type,content:r.content},"log")}}}catch(r){}}}}function Fu(e){return e.get("x-request-id")||Ur}function Bu(e){if("fromEntries"in Object)return Object.fromEntries(e);const t={};for(const[n,r]of e.entries())t[n]=r;return t}function Hu({streetAddress:e,validateAddress:t}){return[{selected:!0,oneTimeUse:!0,validationStrategy:t?"STRICT":"COUNTRY_CODE_ONLY",address:{deliveryAddress:$u(e)}}]}function $u(e){return{address1:e.address1,address2:e.address2,city:e.city,firstName:e.firstName,lastName:e.lastName,phone:e.phone,zip:e.zip,company:e.company,countryCode:e.country,provinceCode:e.province}}const Gu="unstable";class hr{constructor({accessToken:t,country:n,locale:r,apiVersion:a=Gu}){if(c(this,"OPERATION_NAME_REGEX",/[^ ]+ (\w+)/),c(this,"LANGUAGES_WITH_REGION",["zh-CN","zh-TW","pt-BR","pt-PT"]),c(this,"client"),c(this,"country"),c(this,"url"),c(this,"locale"),c(this,"lastValidCart"),c(this,"hasBeenVisible",!1),c(this,"checkoutState","building"),!t||!n)throw new rt({code:"invalid-webcomponent",message:"accelerated checkout rendered without required webcomponent attributes"});if(!r)throw new Error("StorefrontApiClient constructed with no locale");this.country=n,this.locale=r,this.url="/api/".concat(a,"/graphql.json"),this.client=ru(Uu({url:this.url,accessToken:t}))}async createCart(t,n,r){var a,o,i;const s=await this.request([pu,Ar],{input:{lines:t.lines.map(d=>({merchandiseId:d.merchandiseId,quantity:d.quantity,sellingPlanId:d.sellingPlanId,attributes:this.stringifyAttributes(d.lineItemProperties),parent:d.parent})),discountCodes:t.discountCodes,buyerIdentity:t.buyerIdentity},country:this.country,language:this.formatLanguage(this.locale)},{instrumentName:t.instrumentName,startingCheckout:!0,operationName:"
1createCart"});s.errors&&await this.onError({operationName:"createCart",response:s});const l=(a=s.data)==null?void 0:a.result;if(l){l.errors.length>0&&this.onResultError(l.errors);const d=this.parseMutationWarnings((i=(o=s.data)==null?void 0:o.result)==null?void 0:i.warnings),u=l.cart?this.parseCartResponse(l.cart):null;return{data:u,errors:this.parseMutationErrors({result:s,key:"result",operationName:"cartCreate"}),warnings:d,decelerationReason:Oe({cart:u,warnings:d,supportsSubscriptions:n,supportsDeferredPurchaseOptions:r}),abortReason:Fn({cart:u,warnings:d})}}throw new pt("Cart create operation returned no response")}async updateCartBillingAddress(t){const{cartId:n,billingAddress:r,instrumentName:a}=t;return this.requestUpdatedCart(yu,{cartId:n,billingAddress:r},{instrumentName:a,operationName:"updateCartBillingAddress"})}async updateCartBuyerIdentity(t,n){const{cartId:r,instrumentName:a,validateAddress:o=!1,streetAddress:i}=t;this.checkoutState=o?"authorized":"building";const{deliveryAddressPreferences:s,...l}=Vu(t);return await this.requestUpdatedCart(mu,{cartId:r,buyerIdentityInput:l,addressInput:i?Hu({streetAddress:i,validateAddress:o}):[]},{instrumentName:a,operationName:"cartUpdateDeliveryAddressAndContact",abortSignal:n})}async updateSelectedDeliveryOptions(t,n,r,a){return await this.requestUpdatedCart(fu,{cartId:t,selectedDeliveryOptions:n},{instrumentName:r,operationName:"updateSelectedDeliveryOptions",abortSignal:a})}async applePaySessionCreate(t){var n,r,a;const o=await this.requestStream([bu],{validationUrl:t.toString()},{instrumentName:y.ApplePay,operationName:"applePaySessionCreate"});try{for(var i=vt(o),s,l,d;s=!(l=await i.next()).done;s=!1){const u=l.value;u.errors&&await this.onError({operationName:"applePaySessionCreate",response:u});const p=(a=(r=(n=u.data)==null?void 0:n.applePaySessionCreate)==null?void 0:r.applePaySession)==null?void 0:a.body;if(p)return p}}catch(u){d=[u]}finally{try{s&&(l=i.return)&&await l.call(i)}finally{if(d)throw d[0]}}throw new pt("Apple Pay session create operation returned no response")}async paypalBuyerDetailsFetch(t,n){var r,a;const o=await this.requestStream([wu],{token:t,cartId:n},{instrumentName:y.PayPal,operationName:"paypalBuyerDetailsFetch"});try{for(var i=vt(o),s,l,d;s=!(l=await i.next()).done;s=!1){const u=l.value;if(u.hasNext)continue;if(u.errors){if(u.errors.graphQLErrors){const m=Vn(u.errors.graphQLErrors);if(m!=null&&m.code)throw new et(m.code)}await this.onError({operationName:"paypalBuyerDetailsFetch",response:u})}const p=(a=(r=u.data)==null?void 0:r.paypalBuyerDetailsFetch)==null?void 0:a.paypalDetails;if(p)return p}}catch(u){d=[u]}finally{try{s&&(l=i.return)&&await l.call(i)}finally{if(d)throw d[0]}}throw new pt("PayPal buyer details fetch operation returned no response")}async paypalTokenCreate({cartId:t,billingAgreement:n}){var r,a,o;const i=await this.requestStream([_u],{cartId:t,billingAgreement:n},{instrumentName:y.PayPal,operationName:"paypalTokenCreate"});try{for(var s=vt(i),l,d,u;l=!(d=await s.next()).done;l=!1){const p=d.value;if(p.errors){if(p.errors.graphQLErrors){const g=Vn(p.errors.graphQLErrors);if(g!=null&&g.code)throw g.isLoggable&&(h.log({body:"PayPal Token Create ".concat(g.code," Error")}),h.paypalTokenCreationError({errorCode:g.code})),new et(g.code)}await this.onError({operationName:"paypalTokenCreate",response:p})}const m=(o=(a=(r=p.data)==null?void 0:r.paypalTokenCreate)==null?void 0:a.paypalToken)==null?void 0:o.token;if(m)return m}}catch(p){u=[p]}finally{try{l&&(d=s.return)&&await d.call(s)}finally{if(u)throw u[0]}}throw new pt("PayPal token create operation returned no response")}async fetchLimitedCart({id:t,startingCheckout:n,instrumentName:r}){var a,o;const i=await this.request([Au],{id:t},{instrumentName:r,startingCheckout:n});if(i.errors&&await this.onError({operationName:"limitedCartQuery",response:i}),!((a=i.data)!=null&&a.cart))throw new xi("Limited cart query returned no response");return b.leaveBreadcrumb("limitedCartQuery response",{operationName:"limitedCartQuery",body:(o=i.data)==null?void 0:o.cart},"log"),{id:i.data.cart.id,shippingRequired:i.data.cart.lines.edges.some(s=>s.node.merchandise.requiresShipping),sellingPlan:i.data.cart.lines.edges.some(s=>s.node.sellingPlanAllocation!=null)}}async fetchCart({id:t,startingCheckout:n,instrumentName:r}){const a=this.formatLanguage(this.locale),o=await this.request([Eu,Ar],{id:t,country:this.country,language:a},{instrumentName:r,startingCheckout:n,operationName:"fetchCart"});if(o.errors&&await this.onError({operationName:"fetchCart",response:o}),!o.data)throw new pt("Fetch cart operation returned no data in response");const i=o.data.cart;if(b.leaveBreadcrumb("Fetch cart response",{body:i},"log"),i){const s=this.parseCartResponse(i);return this.lastValidCart=s,s}throw new pt("Fetch cart operation returned no response")}async updateCartPayment(t,n,r,a){return this.checkoutState="authorized",this.requestUpdatedCart(Cu,{cartId:t,input:n},{instrumentName:r,operationName:"updateCartPayment",abortSignal:a})}async updateCartAttributes({cartId:t,attributes:n,instrumentName:r,startingCheckout:a}){const o={cartId:t,attributes:n};return await this.requestUpdatedCart(gu,o,{instrumentName:r,operationName:"updateCartAttributes",startingCheckout:a})}async submitForCompletion(t,n,r){var a,o;const i=this.formatLanguage(this.locale),s=await this.request([Pu],{cartId:t,attemptToken:n,country:this.country,language:i},{instrumentName:r,operationName:"submitForCompletion"});return s.errors&&await this.handleGraphQLErrorResponse("submitForCompletion",s),{data:(o=(a=s.data)==null?void 0:a.cartSubmitForCompletion)==null?void 0:o.result,errors:this.parseCompletionErrors(s)}}
1async fetchSubscriptionPolicy(){var t,n;const{data:r}=await this.request([Su],{country:this.country,language:this.formatLanguage(this.locale)},{operationName:"fetchSubscriptionPolicy"});return(n=(t=r==null?void 0:r.shop)==null?void 0:t.subscriptionPolicy)==null?void 0:n.body}async cartRemovePersonalData({cartId:t,instrumentName:n}){var r,a;let o,i,s;try{const d=await this.request([Iu,ta],{cartId:t},{instrumentName:n,keepalive:!0});o=this.parseMutationWarnings((a=(r=d.data)==null?void 0:r.cartRemovePersonalData)==null?void 0:a.warnings),i=this.parseMutationErrors({result:d,key:"cartRemovePersonalData",operationName:"cartRemovePersonalData"})}catch(d){s=d.toString()}const l=!(o!=null&&o.length||i!=null&&i.length||s);h.removePersonalDataResult({success:l}),l||h.log({body:"cartRemovePersonalData failed",attributes:{cartId:t,warnings:o,errors:i,exception:s}})}setVisible(){this.hasBeenVisible=!0}generateURLWithOperationName(t){const n=t.match(this.OPERATION_NAME_REGEX);if(n){const r=this.url.includes("?")?"&":"?",a="operation_name=".concat(n[1]);return"".concat(this.url).concat(r).concat(a)}return this.url}async request(t,n,r){return this.client.request(t.join(""),{variables:n,headers:ea(r),url:this.generateURLWithOperationName(t[0]),keepalive:r.keepalive})}async requestStream(t,n,r){return this.client.requestStream(t.join(""),{variables:n,headers:ea(r),url:this.generateURLWithOperationName(t[0]),signal:r.abortSignal})}async requestUpdatedCart(t,n,r){var a,o,i,s,l,d,u,p,m,g,f,v,E;const _=this.formatLanguage(this.locale),k=await this.request([t,Ar,ta,vu],{...n,c
1ountry:this.country,language:_},r);k.errors&&await this.onError({operationName:r.operationName,response:k,abortSignal:r.abortSignal});const j=this.extractMutationErrors(k,r),Ca=this.extractMutationWarnings(k),M=(o=(a=k.data)==null?void 0:a.preparedCart)==null?void 0:o.result,N=(l=(s=(i=k.data)==null?void 0:i.result)==null?void 0:s.cart)!=null?l:M==null?void 0:M.cart;if(N){const D=this.parseCartResponse(N);this.lastValidCart=D;const x=this.parsePreparedCartMutationErrors(k.errors,j,r.operationName);return{data:D,errors:x,warnings:Ca,abortReason:Fn({cart:D,warnings:Ca}),decelerationReason:Oe({warnings:Ca,cart:D,cartStatus:M==null?void 0:M.__typename,errors:x})}}if(this.lastValidCart&&j.length>0)return this.onResultError(j),{data:this.lastValidCart,errors:this.parsePreparedCartMutationErrors(k.errors,j,r.operationName),warnings:Ca,decelerationReason:Oe({warnings:Ca,cart:this.lastValidCart})};if(h.log({body:"Cart update response missing body",attributes:{operationName:r.operationName,hasData:!!k.data,hasResultCart:!!((u=(d=k.data)==null?void 0:d.result)!=null&&u.cart),hasPreparedCart:!!((p=k.data)!=null&&p.preparedCart),responseErrors:(f=(g=(m=k.errors)==null?void 0:m.graphQLErrors)==null?void 0:g.map(D=>D.message))!=null?f:[],preparedCartResultTypename:(v=M==null?void 0:M.__typename)!=null?v:"null",hasLastValidCart:!!this.lastValidCart,aggregatedErrorCount:j.length}}),this.lastValidCart&&(E=k.data)!=null&&E.preparedCart&&M==null)return h.log({body:"Cart prepare returned null result, falling back to last valid cart",attributes:{operationName:r.operationName}}),{data:this.lastValidCart,errors:this.parsePreparedCartMutationErrors(k.errors,j,r.operationName),warnings:Ca,decelerationReason:Oe({warnings:Ca,cart:this.lastValidCart})};throw new pt("Cart update operation returned no response")}async handleGraphQLErrorResponse(t,n){const r=await ku(t,n);if(!r)return;const{message:a,...o}=r,{isIgnorable:i,reason:s}=xu(r,{hasBeenVisible:this.hasBeenVisible});if(b.leaveBreadcrumb(a,{ignored:i,ignoredReason:s,...n,...o},"error"),i)throw h.log({body:"Ignored GraphQL response error",attributes:{message:a,reason:s,...o}}),new _e(a,{reason:s,errorDetails:o});return{message:a,errorDetails:o}}async onError({operationName:t,response:n,abortSignal:r}){if(r!=null&&r.aborted)throw h.log({body:"Request aborted",attributes:{operationName:t,reason:r.reason}}),new _e("Request aborted",{reason:"abort",errorDetails:{operationName:t}});const a=await this.handleGraphQLErrorResponse(t,n);if(!a)return;const{message:o,errorDetails:i}=a;throw new ke(o,{errorDetails:i})}onResultError(t){b.leaveBreadcrumb("GraphQL result error",t,"error")}formatLanguage(t){return t.includes("-")?this.LANGUAGES_WITH_REGION.includes(t)?t.toUpperCase().replace("-","_"):t.split("-")[0].toUpperCase():t.toUpperCase()}parseCartResponse(t){var n,r,a;const o=t.lines.edges.map(s=>{var l,d,u,p;const m=s.node,g="parentRelationship"in m&&((d=(l=m.parentRelationship)==null?void 0:l.parent)==null?void 0:d.id)!==void 0;return{quantity:m.quantity,totalAmount:{amount:m.cost.totalAmount.amount,currencyCode:m.cost.totalAmount.currencyCode},subtotalAmount:{amount:(u=m.cost.subtotalAmount)==null?void 0:u.amount,currencyCode:(p=m.cost.subtotalAmount)==null?void 0:p.currencyCode},merchandise:{requiresShipping:m.merchandise.requiresShipping,title:m.merchandise.title,product:{title:m.merchandise.product.title}},discountAllocations:m.discountAllocations,sellingPlanAllocation:m.sellingPlanAllocation,isNestedLine:g}}),i=t.deliveryGroups.edges.map(s=>s.node);return{id:t.id,totalAmount:t.cost.totalAmount,subtotalAmount:(n=t.cost.subtotalAmount)!=null?n:void 0,totalTaxAmount:(r=t.cost.totalTaxAmount)!=null?r:void 0,totalDutyAmount:(a=t.cost.totalDutyAmount)!=null?a:void 0,discountAllocations:t.discountAllocations,discountCodes:t.discountCodes,lineItems:o,deliveryGroups:i,checkoutUrl:t.checkoutUrl}}parseGraphQlErrors(t){var n,r;return(r=(n=t==null?void 0:t.graphQLErrors)==null?void 0:n.map(a=>({code:a.message.replace(/\(Expected.*\)/,"").trim()})))!=null?r:[]}parseErrorIntoCartError({message:t,code:n,field:r}){let a;if(r&&r.length===1)a=r.at(0);else if(r&&r.length>1){const o=r[r.length-1];a=["billingAddress","deliveryAddress"].includes(o)?o:r.slice(-2).filter(i=>!i.match(/^\d+$/)).join(".")}return{code:n===null?void 0:n,field:a,message:t}}parseMutationErrors({result:t,key:n,operationName:r}){var a,o,i;const s=this.parseGraphQlErrors(t.errors),l=((i=(o=(a=t.data)==null?void 0:a[n])==null?void 0:o.errors)==null?void 0:i.map(this.parseErrorIntoCartError).filter(u=>u))||[],d=[...s,...l];return d.length>0&&b.leaveBreadcrumb("GraphQL errors on mutation '".concat(r,"'"),d,"error"),d}parseMutationWarnings(t){return!t||t.length===0?[]:t.map(n=>n.code)}stringifyAttributes(t){return t&&t.map(n=>({key:n.key,value:typeof n.value=="string"?n.value:JSON.stringify(n.value)}))}extractUpdateMutationErrors(t){const n=Object.values(t).flatMap(o=>{var i;return(i=o==null?void 0:o.errors)!=null?i:[]});if(this.checkoutState!=="building")return n;const r=[],a=n.filter(o=>Uc.some(i=>i.code===o.code)?(r.push(o.code),!1):!0);return r.length>0&&b.leaveBreadcrumb("Filtered errors on update mutation",r,"log"),a}extractPreparedCartMutationErrors(t,n){var r,a;const o=(r=t==null?void 0:t.errors)!=null?r:[];if(((a=t==null?void 0:t.result)==null?void 0:a.__typename)==="CartStatusNotReady"){const i=[];o.push(...t.result.errors.filter(s=>Bc[this.checkoutState].some(l=>l.code===s.code)?(i.push(s.code),!1):!0)),i.includes("DELIVERY_WRONG_NUMBER_OF_LINES")&&h.deliveryWrongNumberOfLines({instrument:n}),i.length>0&&b.leaveBreadcrumb("Filtered errors on mutation prepareCart",i,"log")}return o}extractMutationErrors(t,{instrumentName:n,operationName:r}){var a;if(!t.data)return[];const{preparedCart:o,__typename:i,...s}=t.data,l=this.extractUpdateMutationErrors(s),d=this.extractPreparedCartMutationErrors((a=t.data)==null?void 0:a.preparedCart,n);return d.length>0&&r==="updateCartAttributes"?(h.log({body:"Update cart attributes errors from prepareCart mutation",attributes:{instrumentName:n,errors:JSON.stringify(d)}}),l):[...l,...d]}extractMutationWarnings(t){if(!t.data)return[];const{preparedCart:n,__typename:r,...a}=t.data;return Object.values(a).map(o=>{var i;return this.parseMutationWarnings((i=o==null?void 0:o.warnings)!=null?i:[])}).flat()}parsePreparedCartMutationErrors(t,n,r){const a=this.parseGraphQlErrors(t),o=n.map(this.parseErrorIntoCartError).filter(s=>s),i=[...a,...o];return i.length>0&&b.leaveBreadcrumb("GraphQL errors on mutation '".concat(r,"'"),i,"error"),i}parseCompletionErrors(t){var n,r,a,o,i,s;const l=this.parseGraphQlErrors(t.errors);let d=[];((a=(r=(n=t.data)==null?void 0:n.cartSubmitForCompletion)==null?void 0:r.result)==null?void 0:a.__typename)==="SubmitFailed"&&(d=(o=t.data.cartSubmitForCompletion.result.errors.map(p=>({code:p.code})))!=null?o:[]);const u=[...l,...d];return u.length>0?b.leaveBreadcrumb("GraphQL errors on completion",u,"error"):t.errors&&b.leaveBreadcrumb("Errors on submitForCompletion",{errors:t.errors,hasData:!!t.data,hasResult:!!((s=(i=t.data)==null?void 0:i.cartSubmitForCompletion)!=null&&s.result)},"error"),u}}function Vu({emailAddress:e,countryCode:t,phone:n,streetAddress:r,validateAddress:a,preferences:o}){return{email:e,countryCode:t!=null?t:r==null?void 0:r.country,phone:n!=null?n:r==null?void 0:r.phone,deliveryAddressPreferences:r?[{deliveryAddressValidationStrategy:a?"STRICT":"COUNTRY_CODE_ONLY",deliveryAddress:r}]:[],preferences:o}}function ea({instrumentName:e,startingCheckout:t}){const n={};return e&&(n["X-Wallet-Name"]="".concat(e)),t&&(n["X-Start-Wallet-Checkout"]="".concat(t)),n}async function Oo({cartId:e,cartClient:t,instrumentName:n,selectedDeliveryOptions:r,abortSignal:a}){try{if(!e)throw new Error("[".concat(n,"] provided no cart ID when updating shipping method"));
1if(!t)throw new Error("[".concat(n,"] provided invalid cart client when updating shipping method"));return await t.updateSelectedDeliveryOptions(e,r,n,a)}catch(o){throw h.updateFailed({instrument:n,request:"updateSelectedDeliveryOptions",error:o}),o}}async function Lo({cartId:e,token:t,cartClient:n,instrumentName:r}){try{if(!e)throw new Error("[".concat(r,"] provided no cart ID when submitting for completion"));if(!n)throw new Error("[".concat(r,"] provided invalid cart client when submitting for completion"));if(!t)throw new Error("[".concat(r,"] provided no token when submitting for completion"));return await n.submitForCompletion(e,t,r)}catch(a){throw h.updateFailed({instrument:r,request:"submitForCompletion",error:a}),a}}function xo({selectedDeliveryOptionHandles:e,deliveryGroups:t,instrumentName:n}){return t.map(r=>{const a=r.deliveryOptions.filter(o=>e.includes(o.handle));if(!a.length)return{deliveryGroupId:"",deliveryOptionHandle:""};if(a.length>1)throw new ju("[".concat(n,"] found multiple delivery options with selectedDeliverOptionHandle in group: ").concat(r.id),{groupingHash:"getSelectedDeliveryOptions::MultipleOptions"});return{deliveryGroupId:r.id,deliveryOptionHandle:a[0].handle}}).filter(r=>!!r.deliveryGroupId)}class ju extends ot{constructor(){super(...arguments),c(this,"name","GetSelectedDeliveryOptionsError")}}async function qu(e){const{cartClient:t,instrumentName:n}=e;try{if(!e.cartId)throw new Error("[".concat(n,"] provided no cart ID when updating billing address"));if(!t)throw new Error("[".concat(n,"] provided invalid cart client when updating billing address"));return await t.updateCartBillingAddress(e)}catch(r){throw h.updateFailed({instrument:n,request:"updateBillingAddress",error:r}),r}}function ye({result:e,instrument:t}){var n;const r=(n=e.errors)!=null?n:[];so(r,on)&&h.dynamicTaxFailed({instrument:t})}const Wu="ce346acf",ra="61de4ecc",Sr="c76b40f6",Mo="6d1811c1",na=["cart_throttled","not_enough_stock","payment_method_not_applicable","account_info_mismatch","price_increased","nested_line_subscription","nested_line_deferred_payment","digital_physical_mismatch"];var ft;class Yu{constructor({accessToken:t,buyerCountry:n,buyerCurrency:r,button:a,i18n:o,merchantName:i,dataSource:s,apiClient:l,walletParams:d}){c(this,"name",y.ApplePay),c(this,"accessToken"),c(this,"button"),c(this,"buyerCountry"),c(this,"cart"),c(this,"apiClient"),c(this,"dataSource"),c(this,"i18n"),c(this,"merchantName"),c(this,"session"),c(this,"paymentSheetActionGenerator"),c(this,"cancelled"),c(this,"buyerCurrency"),c(this,"customerAccountEmail"),c(this,"abortController",null),c(this,"isPersonalDataCleared",!1),c(this,"isSheetLoaded",!1),c(this,"walletParams"),G(this,ft,"pending"),c(this,"onvalidatemerchant",async u=>{var p,m;z(this,ft,"started");try{b.leaveBreadcrumb("ApplePay onvalidatemerchant: Starting merchant validation",{validationURL:u.validationURL},"log");const g=new URL(u.validationURL),f=this.getMerchantSession(g);b.leaveBreadcrumb("ApplePay onvalidatemerchant: Calling handleCreateCart",{},"log");let v;if((!lt.enabled(Sr)||!this.isShippingRequired)&&(v=await dt({element:this.button,instrumentName:this.name,dataSource:this.dataSource,isShippingRequired:this.isShippingRequired})),b.leaveBreadcrumb("ApplePay onvalidatemerchant: handleCreateCart result",{hasCart:!!(v!=null&&v.cart),cartId:(m=(p=v==null?void 0:v.cart)==null?void 0:p.id)!=null?m:"null"},"log"),v!==void 0){const _=await this.handleCreateCartResult({createCartResult:v,stage:"onValidateMerchant::createCart"});if(_===void 0)return;this.cart=_,z(this,ft,"cart_created"),Dr({cart_token:Be(_)})}const E=await f;if(b.leaveBreadcrumb("ApplePay Session completeMerchantValidation",{session:E},"log"),this.sessionIsCancelled()){h.sheetClicked({instrument:this.name,result:"rejected",reason:"cancelled"});return}this.withActiveSession("completeMerchantValidation",()=>this.session.completeMerchantValidation(E)),z(this,ft,"completed"),h.sheetClicked({instrument:this.name,result:"success"})}catch(g){h.sheetClicked({instrument:y.ApplePay,result:"failed",reason:"unhandled_error"}),h.log({body:"Unhandled error detected in Apple Pay sheet clicked",attributes:{error:String(g),location:"onvalidatemerchant"}}),this.terminateSession({error:g})}}
1),c(this,"onshippingcontactselected",async u=>{var p,m,g;if(!this.sessionIsCancelled())try{if(!this.cart&<.enabled(Sr)){const E=await dt({element:this.button,instrumentName:this.name,dataSource:this.dataSource,isShippingRequired:this.isShippingRequired}),_=await this.handleCreateCartResult({createCartResult:E,stage:"onShippingContactSelected::createCart"});if(_===void 0)return;if(this.cart=_,this.sessionIsCancelled()){await this.removePersonalData();return}Dr({cart_token:Be(_)})}if(!lt.enabled(Sr)&&!this.cart){b.leaveBreadcrumb("ApplePay onshippingcontactselected: missing cart",{merchantValidationPhase:S(this,ft),sessionCancelled:this.cancelled,hasAbortController:!!this.abortController,aborted:(m=(p=this.abortController)==null?void 0:p.signal.aborted)!=null?m:!1},"error"),h.applePayNullCartOnShippingContactSelected(),this.terminateSession({error:new Error("[".concat(this.name,"] onshippingcontactselected called before cart was set (merchantValidation: ").concat(S(this,ft),")"))});return}const f=Le(u.shippingContact,{applyPostalCodePadding:!0}),v=await Kt({cartId:this.cart.id,streetAddress:f,cartClient:this.apiClient,instrumentName:this.name,...(g=this.abortController)!=null&&g.signal?{abortSignal:this.abortController.signal}:{}});if(await this.decelerateOrAbort({result:v,stage:"onShippingContactSelected::updateBuyerIdentity"}))return;await this.applyPaymentSheetActions({result:v,onProceed:E=>this.completeShippingContactSelection(v.data,E),context:{shippingRequired:this.isShippingRequired,shippingCountryCode:f.country},checkoutUrl:this.cart.checkoutUrl,requestType:"onShippingContactSelected::updateBuyerIdentity",afterAuthorization:!1})}catch(f){this.terminateSession({error:f})}}),c(this,"onshippingmethodselected",async u=>{var p,m,g;if(!this.sessionIsCancelled()){b.leaveBreadcrumb("ApplePay onshippingmethodselected: START",{hasCart:!!this.cart,cartId:(m=(p=this.cart)==null?void 0:p.id)!=null?m:"null",shippingMethodId:u.shippingMethod.identifier},"log");try{const f=u.shippingMethod.identifier.split(","),v=xo({selectedDeliveryOptionHandles:f,deliveryGroups:this.cart.deliveryGroups,instrumentName:this.name});if(v.length===0){this.handleShippingMethodNotFoundInCart(f);return}const E=await Oo({cartId:this.cart.id,cartClient:this.apiClient,instrumentName:this.name,selectedDeliveryOptions:v,abortSignal:(g=this.abortController)==null?void 0:g.signal});if(await this.decelerateOrAbort({result:E,stage:"onShippingMethodSelected::updateSelectedDeliveryOptions"}))return;await this.applyPaymentSheetActions({result:E,onProceed:()=>this.completeShippingMethodSelection(E.data),context:{shippingRequired:this.isShippingRequired,shippingCountryCode:void 0},checkoutUrl:this.cart.checkoutUrl,requestType:"onShippingMethodSelected::updateSelectedDeliveryOptions",afterAuthorization:!1}),this.onSheetLoaded()}catch(f){this.terminateSession({error:f})}}}),c(this,"onpaymentmethodselected",async u=>{var p,m;if(!this.sessionIsCancelled()){b.leaveBreadcrumb("ApplePay onpaymentmethodselected: START",{hasCart:!!this.cart,cartId:(m=(p=this.cart)==null?void 0:p.id)!=null?m:"null"},"log");try{const{billingContact:g}=u.paymentMethod,f=this.cart.id;if(!this.isShippingRequired&&g){const _=Le(g,{applyPostalCodePadding:!1}),k=await Kt({cartId:this.cart.id,countryCode:_.country,cartClient:this.apiClient,instrumentName:this.name});if(await this.decelerateOrAbort({result:k,stage:"onPaymentMethodSelected::updateBuyerIdentity"}))return;await this.applyPaymentSheetActions({result:k,onProceed:()=>{this.cart=k.data},context:{shippingRequired:this.isShippingRequired,shippingCountryCode:_.country},checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentMethodSelected::updateBuyerIdentity",afterAuthorization:!1});const j=await qu({billingAddress:_,cartId:this.cart.id,cartClient:this.apiClient,instrumentName:this.name});if(await this.decelerateOrAbort({result:j,stage:"onPaymentMethodSelected::updateBillingAddress"}))return;await this.applyPaymentSheetActions({result:j,onProceed:()=>{this.cart=j.data},context:{shippingRequired:this.isShippingRequired,shippingCountryCode:_.country},checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentMethodSelected::updateBillingAddress",afterAuthorization:!1}),this.cart||h.log({body:"[ApplePay] Cart is null after onPaymentMethodSelected::updateBillingAddress",attributes:{cartId:f,result:j,walletParams:this.walletParams,isShippingRequired:this.isShippingRequired,session:this.sessionIsCancelled()}})}const{newTotal:v,newLineItems:E}=this.getNewTotalAndLineItems(this.cart);if(b.leaveBreadcrumb("ApplePay Session completePaymentMethodSelection",{newTotal:v,newLineItems:E},"log"),this.sessionIsCancelled())return;this.withActiveSession("completePaymentMethodSelection",()=>this.session.completePaymentMethodSelection({newTotal:v,newLineItems:E})),this.isShippingRequired||this.onSheetLoaded()}catch(g){this.terminateSession({error:g})}}}),c(this,"oncancel",()=>{var u;this.cancelled=!0,this.removePersonalData(),X(F.SheetLoad,this.name),h.sheetCancelled(this.name),this.button.disabled=!1,(u=this.abortController)==null||u.abort("[Apple Pay] Payment sheet cancelled")}),c(this,"onpaymentauthorized",async u=>{var p,m;b.leaveBreadcrumb("ApplePay onpaymentauthorized: START",{hasCart:!!this.cart,cartId:(m=(p=this.cart)==null?void 0:p.id)!=null?m:"null",hasToken:!!u.payment.token},"log"),h.authorizationAttempt(this.name),oe(F.AuthorizationLatency,this.name);const g=async N=>{var D,x,J;switch((D=N.effects)==null||D.forEach(B=>B()),N.action){case"complete":{const B=ApplePaySession.STATUS_SUCCESS;try{await this.completePayment(B),_t(N.redirectUrl)}catch(Np){this.terminateSession({error:Np,afterAuthorization:!0})}break}case"show_error":{const B=(x=N.errors)!=null?x:[];try{await this.completePayment(ApplePaySession.STATUS_FAILURE,B)}catch(Np){this.terminateSession({error:Np,afterAuthorization:!0})}break}case"abort":{try{this.abortPaymentSheetAndShowError(),this.removePersonalData()}catch(B){this.terminateSession({error:B,afterAuthorization:!0})}break}case"decelerate":{try{await this.completePayment(ApplePaySession.STATUS_FAILURE),Ku()?V({event:$.RecoveryFlowInitiated,checkoutToken:He((J=this.cart)==null?void 0:J.id),instrumentId:this.name}):await this.removePersonalData(),U({checkoutUrl:N.redirectUrl,instrumentName:this.name,reason:N.reason,stage:"onPaymentAuthorized::submitForCompletion"})}catch(B){this.terminateSession({error:B,afterAuthorization:!0})}break}
1default:this.terminateSession({error:new Error("[".concat(this.name,"] completion action not handled: ").concat(N.action)),afterAuthorization:!0})}},{token:f,billingContact:v,shippingContact:E}=u.payment;let _=null,k=null;try{if(!v){await this.completePayment(ApplePaySession.STATUS_FAILURE);return}if(_=Le({...v,phoneNumber:E==null?void 0:E.phoneNumber},{applyPostalCodePadding:!1}),this.isShippingRequired){if(!E){await this.completePayment(ApplePaySession.STATUS_FAILURE);return}k=Le(E,{applyPostalCodePadding:!0})}}catch(N){this.terminateSession({error:N,afterAuthorization:!0});return}const j=async()=>{var N,D;try{const x=this.isShippingRequired?{validateAddress:!0,streetAddress:k}:{},J=(N=this.customerAccountEmail)!=null?N:E==null?void 0:E.emailAddress,B=await Kt({cartId:this.cart.id,emailAddress:J,cartClient:this.apiClient,instrumentName:this.name,...x});ye({result:B,instrument:this.name});const Np=lo({currentCart:B.data,previousCart:this.cart});if(B.data&&Np!=="inc"&&(this.cart=B.data),Np==="inc"&&(B.decelerationReason||(B.decelerationReason="price_increased")),await this.decelerateOrAbort({result:B,stage:"onPaymentAuthorized::updateBuyerIdentity"}))return;const Mp=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction({result:B,context:{shippingRequired:this.isShippingRequired,shippingCountryCode:k==null?void 0:k.country,billingCountryCode:_==null?void 0:_.country},checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentAuthorized::updateBuyerIdentity"});(D=Mp.effects)==null||D.forEach(Op=>Op()),await this.handlePaymentSheetAction({paymentSheetAction:Mp,onProceed:async Op=>{Op&&Op.length>0?await this.completePayment(ApplePaySession.STATUS_FAILURE,Op):await Ca()},afterAuthorization:!0,stage:"onPaymentAuthorized::updateBuyerIdentity"})}catch(x){this.terminateSession({error:x,afterAuthorization:!0})}},Ca=async()=>{var N,D;try{const x=this.cart.lineItems.some(Np=>!!Np.sellingPlanAllocation),J=await pn({cartId:this.cart.id,totalAmount:this.cart.totalAmount,paymentMethod:{walletPaymentMethod:{applePayWalletContent:{billingAddress:_,data:f.paymentData.data,header:f.paymentData.header,lastDigits:f.paymentMethod.displayName.split(" ")[1],signature:f.paymentData.signature,version:f.paymentData.version}}},canUsePaymentMethodForFreeOrder:!1,billingAddress:_,cartClient:this.apiClient,instrumentName:this.name,hasSellingPlan:x,abortSignal:(N=this.abortController)==null?void 0:N.signal});if(ye({result:J,instrument:this.name}),await this.decelerateOrAbort({result:J,stage:"onPaymentAuthorized::updatePayment"}))return;const B=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction({result:J,context:{shippingRequired:this.isShippingRequired,shippingCountryCode:k==null?void 0:k.country,billingCountryCode:_==null?void 0:_.country},checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentAuthorized::updatePayment"});(D=B.effects)==null||D.forEach(Np=>Np()),await this.handlePaymentSheetAction({paymentSheetAction:B,onProceed:async Np=>{Np&&Np.length>0?await this.completePayment(ApplePaySession.STATUS_FAILURE,Np):await M()},afterAuthorization:!0,stage:"onPaymentAuthorized::updatePayment"})}catch(x){this.terminateSession({error:x,afterAuthorization:!0})}},M=async()=>{var N;try{const D=await Lo({cartId:this.cart.id,token:f.transactionIdentifier,cartClient:this.apiClient,instrumentName:this.name});ye({result:D,instrument:this.name}),(N=D.errors)!=null&&N.some(J=>J.code==="ERROR")&&(b.leaveBreadcrumb("ApplePay Generic ERROR encountered during completion",{errorCodes:D.errors},"error"),h.log({body:"[ApplePay] Generic ERROR code encountered during completion",attributes:{errorCodes:D.errors}}));const x=this.paymentSheetActionGenerator.mapCompletionResultToPaymentSheetAction({result:D,context:{shippingRequired:this.isShippingRequired,shippingCountryCode:k==null?void 0:k.country,billingCountryCode:_==null?void 0:_.country},checkoutUrl:D.data&&"checkoutUrl"in D.data&&D.data.checkoutUrl?D.data.checkoutUrl:this.cart.checkoutUrl});await g(x)}catch(D){this.terminateSession({error:D,afterAuthorization:!0})}};await j()}),c(this,"terminateSession",async({error:u,afterAuthorization:p=!1,decelerationReason:m}={})=>{var g;try{this.button.disabled=!1,u&&b.notify(u),p?h.authorizationComplete({instrument:this.name,measurement:X(F.AuthorizationLatency,this.name),result:"failed"}):(X(F.SheetLoad,this.name),h.sheetFailed(this.name,u,m)),b.leaveBreadcrumb("ApplePay Session abort",{afterAuthorization:p},"log");try{this.withActiveSession("abort",()=>this.session.abort()),(g=this.abortController)==null||g.abort("[Apple Pay] Payment sheet terminated")}catch(f){}if(u){const f=this.i18n.translate("brand.apple_pay");at(f,this.i18n)}}finally{await this.removePersonalData()}}),c(this,"getMostRecentNonNullCart",(u,p)=>u?(this.cart=u,u):p),c(this,"handleNullCart",u=>{if(!u)throw new Error("[".concat(this.name,"] no cart returned on mutation, aborting"))}),c(this,"completeShippingContactSelection",(u,p)=>{try{const m=this.getMostRecentNonNullCart(u,this.cart),{newTotal:g,newLineItems:f}=this.getNewTotalAndLineItems(m),v=qn(m.deliveryGroups,this.i18n);b.leaveBreadcrumb("ApplePay Session completeShippingContactSelection",{errors:p,newTotal:g,newLineItems:f,newShippingMethods:v},"log"),this.withActiveSession("completeShippingContactSelection",()=>this.session.completeShippingContactSelection({errors:p!=null?p:[],newTotal:g,newLineItems:f,newShippingMethods:v}))}catch(m){this.terminateSession({error:m})}}),c(this,"completeShippingMethodSelection",u=>{try{this.handleNullCart(u),this.cart=u;const{newTotal:p,newLineItems:m}=this.getNewTotalAndLineItems(u);b.leaveBreadcrumb("ApplePay Session completeShippingContactSelection",{newTotal:p,newLineItems:m},"log"),this.withActiveSession("completeShippingMethodSelection",()=>this.session.completeShippingMethodSelection({newTotal:p,newLineItems:m}))}catch(p){this.terminateSession({error:p})}}),c(this,"sessionIsCancelled",()=>this.cancelled),this.accessToken=t,this.buyerCountry=n,this.button=a,this.cart=null,this.apiClient=l,this.dataSource=s,this.i18n=o,this.merchantName=i,this.cancelled=!1,this.buyerCurrency=r,this.customerAccountEmail=d.customerAccountEmail,this.walletParams=d;try{this.session=new ApplePaySession(va,jd({shippingRequired:this.isShippingRequired,walletParams:d,buyerCurrency:r}))}catch(u){throw new Wd(String(u),{cause:u})}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 Vd(o)}begin(){b.leaveBreadcrumb("ApplePay Session begin",{shippingRequired:this.isShippingRequired,buyerCurrency:this.buyerCurrency,walletParams:this.walletParams},"log"),this.abortController=Lt("AbortController"),this.session.begin()}handleShippingMethodNotFoundInCart(t){var n,r;const a=qn((r=(n=this.cart)==null?void 0:n.deliveryGroups)!=null?r:[],this.i18n);b.leaveBreadcrumb("ApplePay Session selected shipping method(s) n
1ot found in current cart, updating payment sheet",{attemptedDeliveryOptionHandles:t,currentShippingMethods:a},"log"),this.completeShippingMethodSelection(this.cart)}async applyPaymentSheetActions({result:t,onProceed:n,context:r,checkoutUrl:a,requestType:o,afterAuthorization:i}){var s;const l=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction({result:t,context:r,checkoutUrl:a,requestType:o});(s=l.effects)==null||s.forEach(d=>d()),!this.sessionIsCancelled()&&await this.handlePaymentSheetAction({paymentSheetAction:l,onProceed:n,afterAuthorization:i,stage:o})}async getMerchantSession(t){const n=await new hr({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale,apiVersion:"unstable"}).applePaySessionCreate(t);return JSON.parse(n)}abortPaymentSheetAndShowError(){b.leaveBreadcrumb("ApplePay Session abort",{},"log"),this.withActiveSession("abort",()=>this.session.abort()),this.button.disabled=!1,this.emitPaymentCompleteTelemetry(ApplePaySession.STATUS_FAILURE)}abortPaymentSheetAndShowOutOfStockModal(){b.leaveBreadcrumb("ApplePay Session abort",{},"log"),this.withActiveSession("abort",()=>this.session.abort()),this.button.disabled=!1,wt(this.i18n),this.emitPaymentCompleteTelemetry(ApplePaySession.STATUS_FAILURE)}emitPaymentCompleteTelemetry(t){h.authorizationComplete({instrument:this.name,measurement:X(F.AuthorizationLatency,this.name),result:t===ApplePaySession.STATUS_SUCCESS?"success":"failed"})}async completePayment(t,n=void 0){b.leaveBreadcrumb("ApplePay Session completePayment",{status:t,errors:n},"log");const r=this.withActiveSession("completePayment",()=>{this.session.completePayment({status:t,errors:n})});this.emitPaymentCompleteTelemetry(t),r===void 0&&t===ApplePaySession.STATUS_SUCCESS&&h.paymentCompletedAfterAbort({instrument:this.name,error:"Session already terminated"})}getNewTotalAndLineItems(t){return{newTotal:Hd(this.merchantName,t.totalAmount),newLineItems:$d({subtotal:_o(t),discountAllocations:qd(t),deliveryGroups:t.deliveryGroups,duties:t.totalDutyAmount,taxes:t.totalTaxAmount,i18n:this.i18n,formattedRecurringTotals:Yd(this.cart.lineItems,this.i18n),lineItems:t.lineItems})}}async decelerateOrAbort({result:t,stage:n}){return t.abortReason==="out_of_stock"?(h.sheetClicked({instrument:this.name,result:"rejected",reason:"out_of_stock"}),this.abortPaymentSheetAndShowOutOfStockModal(),!0):this.decelerateIfNeeded({result:t,stage:n})}async decelerateIfNeeded({result:t,stage:n}){if(!t.data)return!1;const{checkoutUrl:r,totalAmount:a}=t.data;let o;if(t.decelerationReason&&na.includes(t.decelerationReason)?o=t.decelerationReason:ln({currentCartTotal:a,initialBuyerCurrency:this.buyerCurrency})&&(o="currency_changed"),o){h.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"});try{await this.terminateSession({decelerationReason:o})}finally{U({checkoutUrl:r,instrumentName:this.name,reason:o,stage:n})}return!0}return!1}get isShippingRequired(){return this.button.isShippingRequired}async handleCreateCartResult({createCartResult:t,stage:n}){var r,a,o;if(!t)return;const{cart:i,unrecoverableError:s,customValidationError:l,decelerationReason:d}=t;if(s){b.leaveBreadcrumb("ApplePay Session unrecoverable error",{unrecoverableError:s},"error"),h.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),this.withActiveSession("abort",()=>this.session.abort()),(r=this.abortController)==null||r.abort("[Apple Pay] Unrecoverable error ".concat(s)),zt(this.i18n,s);return}if(l){b.leaveBreadcrumb("ApplePay Session custom validation error",{customValidationError:l},"error"),h.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),this.withActiveSession("abort",()=>this.session.abort()),(a=this.abortController)==null||a.abort("[Apple Pay] Custom validation error"),Mt(this.i18n,l.message);return}if(d&&na.includes(d)){h.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),this.cart=i!=null?i:null;try{await this.terminateSession({decelerationReason:d})}finally{U({checkoutUrl:(o=i==null?void 0:i.checkoutUrl)!=null?o:"",instrumentName:this.name,reason:d,stage:n})}return}return i}async removePersonalData(){var t;this.isPersonalDataCleared||!this.cart||(((t=this.abortController)==null?void 0:t.signal.aborted)===!1&&this.abortController.abort("[Apple Pay] Payment session cleared for other reason"),await this.apiClient.cartRemovePersonalData({cartId:this.cart.id,instrumentName:this.name}),this.isPersonalDataCleared=!0)}
1onSheetLoaded(){if(this.isSheetLoaded)return;this.isSheetLoaded=!0;const t=X(F.SheetLoad,this.name);t&&(V({event:$.SheetLoaded,ttl:t}),h.sheetLoaded({instrument:this.name,measurement:t}))}withActiveSession(t,n){var r,a;if((a=(r=this.abortController)==null?void 0:r.signal)!=null&&a.aborted){h.walletSessionAbortError({instrument:this.name,errorName:"SessionAlreadyTerminated",methodName:t});return}try{return n()}catch(o){if(o instanceof Error&&o.name==="InvalidAccessError"){h.walletSessionAbortError({instrument:this.name,errorName:"InvalidAccessError",methodName:t});return}throw o}}async handlePaymentSheetAction({paymentSheetAction:t,onProceed:n,afterAuthorization:r,stage:a}){switch(t.action){case"abort":this.terminateSession({afterAuthorization:r});break;case"show_error":await n(t.errors);break;case"update":await n(t.errors);break;case"decelerate":try{await this.terminateSession({afterAuthorization:r})}finally{U({instrumentName:this.name,checkoutUrl:t.redirectUrl,reason:t.reason,stage:a})}break;default:throw new Error('Missing handler for payment sheet action "'.concat(t.action,'"'))}}}ft=new WeakMap;function Ku(){return lt.enabled(Wu)}function mn({translate:e,logoElement:t,setAriaHidden:n}){const r=document.createElement("div");return e("buy_with_button_content",{wallet:"LOGO_PLACEHOLDER"}).split(new RegExp("(LOGO_PLACEHOLDER)")).filter(Boolean).forEach(a=>{let o;a==="LOGO_PLACEHOLDER"?o=t:(o=document.createElement("span"),o.innerText=a,n&&o.setAttribute("aria-hidden","true")),r.appendChild(o)}),r}const er=new Map;function Qu({instrumentName:e,logoType:t="LIGHT",logoContent:n}){const r=er.get(e)||{};r[t]||(r[t]=n,er.set(e,r))}function Ae({instrumentName:e,logoType:t="LIGHT"}){var n;const r=(n=er.get(e))==null?void 0:n[t];if(!r)throw new Error("".concat(e," ").concat(t," logo not loaded"));return r}class Xu extends St{constructor(){super(...arguments),c(this,"name",y.ApplePay),c(this,"button",null)}static get observedAttributes(){return["disabled"]}get merchantName(){return this.walletParams.merchantName}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}attributeChangedCallback(t,n,r){super.attributeChangedCallback(t,n,r,this.button)}async handleClick(t){if(t.preventDefault(),this.disabled||!this.button||this.button.hasAttribute("aria-disabled"))return;this.disabled=!0,At(this.name,this.pageType);const[n,r,a]=await Promise.all([this.i18n,this.dataSource,this.apiClient]);oe(F.SheetLoad,this.name);let o;try{if(o=new Yu({accessToken:this.accessToken,buyerCountry:this.buyerCountry,buyerCurrency:this.buyerCurrency,button:this,i18n:n,merchantName:this.merchantName,dataSource:r,apiClient:a,walletParams:this.walletParams}),!o)throw new Error("missing ApplePaySession");o.begin()}catch(i){b.leaveBreadcrumb("Failed to create ApplePay Session",{error:i},"error"),o||(h.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),h.log({body:"Unhandled error detected in Apple Pay session creation",attributes:{error:String(i),location:"handleClick"}})),o==null||o.terminateSession(),at(n.translate("brand.apple_pay"),n),this.disabled=!1}}async render(){var t;const n=this.getOrCreateShadowRoot(),{translate:r}=await this.i18n,a=Ae({instrumentName:y.ApplePay}),o=new DOMParser().parseFromString(a,"image/svg+xml").documentElement;if(!this.button){const i=this.isCTA?r("buy_with_button_content",{wallet:r("brand.apple_pay")}):r("brand.apple_pay");if(this.button=cr({label:i}),this.button.onclick=s=>this.handleClick(s),this.button.classList.add("apple-pay-button",hi[this.buttonTheme],xt.BUTTON),this.isCTA){const s=mn({translate:r,logoElement:o,setAriaHidden:!0});s.classList.add("apple-pay--content"),this.button.appendChild(s)}else this.button.appendChild(o);this.initializeShadowStyles(n,Td),n.appendChild(this.button),this.ensureLightDOMIsNotEmpty(),(t=this.onRendered)==null||t.call(this)}this.disabled&&(this.button.setAttribute("disabled",""),this.button.setAttribute("aria-disabled","true"))}}function gn(e){return function(t,n,r){const a=r.value;return r.value=function(...o){const i=a.apply(this,o);return i.eligible||console.debug("[DEBUG] ".concat(e," could not be rendered. Reason: ").concat(i.reason)),i},r}}async function ne({svg:e,instrumentName:t,logoType:n="LIGHT"}){var r;if((r=er.get(t))!=null&&r[n])return;let a,o,i;try{if(i=Ju(e),a=await fetch(i,{headers:{Accept:"image/svg+xml"}}),!a.ok)throw new Error("Failed to fetch SVG: ".concat(a.status," ").concat(a.statusText));if(o=await a.text(),!o||!o.includes("<svg"))throw new Error("Invalid SVG content received");Qu({instrumentName:t,logoType:n,logoContent:o})}catch(s){const l=s instanceof Error?s.message:String(s);throw b.leaveBreadcrumb("SVG fetch failed",{error:l,responseStatus:a==null?void 0:a.status,responseHeaders:a==null?void 0:a.headers,responseBody:o==null?void 0:o.slice(0,100),assetUrl:i}),new et("SVG fetch failed",{cause:l})}}function Ju(e){const t=new URL(import.meta.url);return new URL("assets/".concat(e),t).href}var Zu=Object.defineProperty,th=Object.getOwnPropertyDescriptor,zo=(e,t,n,r)=>{for(var a=th(t,n),o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=i(t,n,a)||a);return a&&Zu(t,n,a),a};class yn extends Ct{constructor(t){super(t),c(this,"companyFieldRequired"),this.companyFieldRequired=!!this.walletParams.companyRequired}static walletName(){return"apple_pay"}getWebComponentName(){return"shopify-apple-pay-button"}getWebComponentClass(){return Xu}getInstrumentName(){return y.ApplePay}getLoadEligibility(){return this.isInIframe()?{eligible:!1,reason:"cannot be loaded in an iframe"}:{eligible:!0}}getPartnerSDKEligibility(){var t,n,r,a;if(typeof window>"u"||window.ApplePaySession===void 0)return{eligible:!1,reason:"window or ApplePaySession is undefined"};try{if(!((n=(t=window.ApplePaySession).supportsVersion)!=null&&n.call(t,va)))return{eligible:!1,reason:"SDK does not meet minimum version requirement"};if(!((a=(r=window.ApplePaySession).canMakePayments)!=null&&a.call(r)))return{eligible:!1,reason:"failed SDK eligibility check"}}catch(o){return{eligible:!1,reason:"error in SDK eligibility checks"}}return{eligible:!0}}async loadWalletSDK(){await this.loadAppleLogo()}async loadAppleLogo(){await ne({svg:"apple-pay-logo.svg",instrumentName:y.ApplePay}
1)}}zo([gn("Apple Pay")],yn.prototype,"getLoadEligibility"),zo([gn("Apple Pay")],yn.prototype,"getPartnerSDKEligibility");const eh=".buy-with-prime-button{width:100%;height:100%;padding:12px 10px 8px;display:flex;align-items:center;justify-content:center;gap:5px;opacity:1;border-width:0px}.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{background-color:#0066cd!important;box-shadow:none!important}.buy-with-prime-button>svg{min-width:85px}";class rr extends Error{constructor(){super(...arguments),c(this,"name","MissingAccessTokenError")}}class fn extends Error{constructor(){super(...arguments),c(this,"name","FetchingWalletsPlatformConfigError")}}class bn extends Error{constructor(){super(...arguments),c(this,"name","EmptyLineItemsWalletsPlatformConfigError")}}async function Uo({configOptionsEndpoint:e,checkoutUrl:t,sourceId:n,accessToken:r,instrument:a}){try{const o=JSON.stringify({checkout_url:t,checkout_cancel_url:window.location.href,cart_id:n}),i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":r},body:o});if(i.ok)return i.json();const s=await i.json();throw s.error?new Error(s.error):new Error("Could not fetch wallets platform configs: [".concat(i.status,"] ").concat(i.statusText))}catch(o){const{message:i}=o!=null?o:{};switch(i){case"empty_line_items":throw new bn("[Fetch Pay Config][".concat(a,"] No eligible line items provided in the config request."));default:throw new fn("[Fetch Pay Config][".concat(a,"] ").concat(i))}}}const rh={[T.Checkout]:"Checkout",[T.CartAjax]:"Cart",[T.CartPage]:"Cart",[T.ProductPage]:"Product",[T.Unknown]:"Product"},Gt=class qp extends St{constructor(){super(...arguments),c(this,"name",y.BuyWithPrime),c(this,"button",null),c(this,"apiClientId","")}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name),this.handleOnSendCheckoutAction=this.handleOnSendCheckoutAction.bind(this)}async createButton(){const{translate:t}=await this.i18n,n=cr({label:t("brand.buy_with_prime")});return n.type="button",n.className="buy-with-prime-button",this.applyEnabledStyles(n),n}applyEnabledStyles(t){const n=Ae({instrumentName:y.BuyWithPrime});t.innerHTML=n,t.disabled=!1,me(t,{"background-color":"#1A98FF",color:"#FFFFFF",cursor:"pointer"})}applyDisabledStyles(t){const n=Ae({instrumentName:y.BuyWithPrime,logoType:"DARK"});t.innerHTML=n,t.disabled=!0,me(t,{"background-color":"#C0E3FF",color:"#7292AC",cursor:"not-allowed"})}async handleClick(){var t,n,r;if(!this.button)return;At(this.name,this.pageType);const[a,o]=await Promise.all([this.i18n,this.dataSource]);let i;try{this.applyDisabledStyles(this.button);let s=this.walletParams;if(this.apiClientId=this.apiClientId||s.appId||"",i=this.apiClientId?{apiClientId:this.apiClientId,pageType:this.pageType}:void 0,!s.createCheckoutSessionConfig){const{cart:u,decelerationReason:p,customValidationError:m,unrecoverableError:g}=await dt({element:this,instrumentName:this.name,dataSource:o});if(g){h.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error",webPixelMetaData:i}),zt(a,g);return}if(m){h.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error",webPixelMetaData:i}),Mt(a,m.message);return}if(p){h.sheetClicked({instrument:this.name,result:"success",reason:"deceleration",webPixelMetaData:i}),U({checkoutUrl:(t=u==null?void 0:u.checkoutUrl)!=null?t:"",instrumentName:this.name,reason:p});return}if(!this.accessToken)throw new rr("[Fetch Pay Config] could not fetch pay configs since required accessToken is missing.");s={...await Uo({configOptionsEndpoint:qp.OPTIMUS_CONFIG_REST_API_URL,checkoutUrl:(n=u==null?void 0:u.checkoutUrl)!=null?n:"",sourceId:(r=Be(u))!=null?r:"",accessToken:this.accessToken,instrument:this.name})}}s.placement=this.getPlacement();const l=this.extractSKUs(s);i&&l&&(i.skus=l),delete s.checkoutSupportsSplitCart,delete s.appId;const d=s;this.pciEnabled&&(d.onSendCheckoutAction=this.handleOnSendCheckoutAction),window.amazon.buywithprime.initCheckout({amazonPayOptions:d}),h.sheetClicked({instrument:this.name,result:"success",webPixelMetaData:i})}catch(s){i&&(i.skus=i.skus||[]),qp.EXPECTED_ERRORS.some(u=>s instanceof u)?h.sheetClicked({instrument:this.name,result:"rejected",reason:"expected_error",webPixelMetaData:i}):(h.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error",webPixelMetaData:i}),h.log({body:"Unhandled error detected in Buy with Prime sheet clicked",attributes:{error:String(s),location:"handleClick"}}),b.notify(s));const{name:l}=s!=null?s:{name:"unknown"},{translate:d}=a;ae(d("error_dialogs.wallet.title",{wallet:d("brand.buy_with_prime")}),this.getModalContent(l,d))}finally{this.applyEnabledStyles(this.button)}}getModalContent(t,n){return t==="EmptyLineItemsWalletsPlatformConfigError"?n("error_dialogs.wallet.eligibility_error",{wallet:n("brand.buy_with_prime")}):n("error_dialogs.wallet.generic_error",{wallet:n("brand.buy_with_prime")})}extractSKUs(t){var n;return(n=t.createCheckoutSessionConfig)!=null&&n.payloadJSON?JSON.parse(t.createCheckoutSessionConfig.payloadJSON).cartDetails.lineItems.map(r=>r&&r.sku).filter(r=>r):[]}getPlacement(){return this.pageType&&rh[this.pageType]||"Other"}async render(){var t;const n=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(xt.BUTTON),await this.initializeShadowStyles(n,eh),n.appendChild(this.button),(t=this.onRendered)==null||t.call(this))}buildBwpEventData(t){const n={};return t.createCheckoutSessionConfig&&(n.skus=this.extractSKUs(t),n.apiClientId=this.apiClientId),n}async handleOnSendCheckoutAction(t){const{eventName:n,redirect:r,redirectUrl:a,requestPayload:o}=t;if(r&&a){this.dispatchWalletEvent({eventName:"wallet-redirect",detail:{redirectUrl:a,requestPayload:o}});return}switch(n){case"initCheckout":{const i=this.walletParams;
1this.dispatchWalletEvent({eventName:"wallet-clicked",detail:{bwpEventData:this.buildBwpEventData(i)}});break}case"initChange":this.dispatchWalletEvent({eventName:"wallet-clicked"});break;case"cancelCheckout":this.dispatchWalletEvent({eventName:"wallet-cancel"});break}}};c(Gt,"OPTIMUS_CONFIG_REST_API_URL","".concat(window.location.origin,"/wallets/config/optimus")),c(Gt,"EXPECTED_ERRORS",[fn,rr,bn]);let Fr=Gt;async function Fo({fn:e,maxRetries:t=3,delay:n=1e3,retryPolicyFn:r=()=>!0,onFinishedFn:a=()=>{}}){const o=()=>new Promise(l=>{setTimeout(l,n)});let i=0;const s=async()=>{try{return await e()}catch(l){if(i++,i<t&&r(l))return await o(),s();throw l}};try{return await s()}finally{a(i)}}async function nh(e){return new Promise((t,n)=>{if(document.querySelector('script[src="'.concat(e,'"]'))&&window.amazon){t();return}const r=document.createElement("script");r.src=e,r.onload=()=>{window.amazon?t():n(new Error("Amazon SDK not present after loading"))},r.onerror=a=>{const o=a instanceof Event?a.type:String(a);n(new et("Error loading Amazon SDK: ".concat(o)))},document.head.append(r)})}async function Bo({sdkUrl:e=Kr,maxRetries:t=3}){return Fo({fn:()=>nh(e),maxRetries:t,delay:200,retryPolicyFn:()=>!0,onFinishedFn:n=>{h.amazonPaySDKLoadRetries({retries:n})}})}const Vt=class Gp extends Ct{static walletName(){return"buy_with_prime"}constructor(t){super(t)}getWebComponentName(){return"shopify-buy-with-prime-button"}getInstrumentName(){return y.BuyWithPrime}getWebComponentClass(){return Fr}async loadWalletSDK(){await Bo({sdkUrl:Gp.SDK_URL,maxRetries:Gp.MAX_RETRIES}),await this.loadLogos()}async loadLogos(){await Promise.all([this.loadPrimeLogo(),this.loadPrimeLogoDark()])}async loadPrimeLogo(){await ne({svg:"prime-logo.svg",instrumentName:y.BuyWithPrime})}async loadPrimeLogoDark(){await ne({svg:"prime-logo-dark.svg",instrumentName:y.BuyWithPrime,logoType:"DARK"})}};c(Vt,"MAX_RETRIES",3),c(Vt,"SDK_URL",Kr);let Br=Vt;const ah="shopify-amazon-pay-button div[role=button][slot=amazon-pay-slot][data-testid=amazon-pay-button]{border-radius:0!important;width:100%!important}",oh=':host([page-type="cart_page"]) .accelerated-checkout-button{overflow:hidden;display:flex;justify-content:center}',aa="amazon-pay-slot";var Ce,ve,Jt,Y,st,Dt;const jt=class Vp extends St{constructor(){super(...arguments),c(this,"name",y.AmazonPay),c(this,"resizeObserver",null),G(this,Ce,0),G(this,ve,0),G(this,Jt,!1),G(this,Y,null),G(this,st,null),G(this,Dt,null),c(this,"sdkButton",null)}connectedCallback(){this.resizeObserver=Lt("ResizeObserver",()=>this.onResize()),this.cleanupOnFailure(this.render.bind(this),this.name)}async disconnectedCallback(){var t;super.disconnectedCallback(),this.innerHTML="",this.clearShadowRoot(),this.teardownAmazonButtonContainer(),(t=this.resizeObserver)==null||t.disconnect()}async handleClick(t){var n,r;At(this.name,this.pageType);const[a,o]=await Promise.all([this.i18n,this.dataSource]);try{const{cart:i,decelerationReason:s,customValidationError:l,unrecoverableError:d}=await dt({element:this,instrumentName:this.name,dataSource:o});if(d){h.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),zt(a,d);return}if(l){h.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),Mt(a,l.message);return}if(s){h.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),U({checkoutUrl:(n=i==null?void 0:i.checkoutUrl)!=null?n:"",instrumentName:this.name,reason:s});return}const{totalAmount:{amount:u},checkoutUrl:p}=i;let m=this.walletParams;if(!m.createCheckoutSessionConfig){if(!this.accessToken)throw new rr("[Fetch Pay Config] could not fetch pay configs since required accessToken is missing.");m={...await Uo({configOptionsEndpoint:Vp.CV2_CONFIG_REST_API_URL,checkoutUrl:p,sourceId:(r=Be(i))!=null?r:"",accessToken:this.accessToken,instrument:this.name}),placement:this.pageType===T.ProductPage?"Product":"Cart"}}delete m.appId,t.initCheckout({...m,...Number(u)!==0&&{estimatedOrderAmount:{amount:u,currencyCode:this.buyerCurrency}}}),h.sheetClicked({instrument:this.name,result:"success"})}catch(i){Vp.EXPECTED_ERRORS.some(l=>i instanceof l)?h.sheetClicked({instrument:this.name,result:"rejected",reason:"expected_error"}):(h.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),h.log({body:"Unhandled error detected in Amazon Pay sheet clicked",attributes:{error:String(i),location:"handleClick"}}),b.notify(i));const s=a.translate("brand.amazon_pay");at(s,a)}}createContainer({containerID:t,height:n}){const r=document.createElement("div");return r.id=t,r.style.display="flex",r.style.minWidth="140px",n!=null&&(r.style.height="".concat(n,"px")),r.slot=aa,r.setAttribute("data-testid","amazon-pay-button"),r}async onResize(){const t=tr(S(this,Y))||0,n=Or(S(this,Y))||0,r=S(this,Ce)!==t||S(this,ve)!==n;!S(this,Jt)&&r&&(this.teardownAmazonButtonContainer(),await this.cleanupOnFailure(()=>this.renderFromAmazonSDK(),this.name))}async render(){var t;const n=this.getOrCreateShadowRoot();try{const r=document.createElement("slot");r.name=aa;const a=document.createElement("style");a.textContent=ah,this.appendChild(a),await this.initializeShadowStyles(n,oh);const o=await this.containerInstanceNumber;z(this,st,"AcceleratedCheckoutAmazonPayButtonContainer".concat(this.pageType).concat(o)),z(this,Y,document.createElement("div")),S(this,Y).classList.add(xt.BUTTON),S(this,Y).appendChild(r),n.appendChild(S(this,Y)),(t=this.resizeObserver)==null||t.observe(S(this,Y)),await this.renderFromAmazonSDK()}catch(r){b.notify(r)}}async renderFromAmazonSDK(){var t;z(this,Jt,!0);const n=Or(S(this,Y))||0;z(this,Dt,this.createContainer({containerID:S(this,st),height:n})),this.appendChild(S(this,Dt));const r=tr(S(this,Y))||0,a={buttonBorderRadius:"".concat(r,"px")};let o=!1;try{if(this.sdkButton=window.amazon.Pay.renderButton("#".concat(S(this,st)),{...this.walletParams,style:a,placement:this.pageType===T.ProductPage?"Product":"Cart"}),this.sdkButton){const i=this.sdkButton;this.sdkButton.onClick(()=>this.handleClick(i))}else h.log({body:"Amazon Pay Button rendered null SDK button",attributes:{pageType:this.pageType,containerID:S(this,st)}});z(this,ve,n),z(this,Ce,r),h.renderSucceeded(this.name),o=!0}catch(i){h.renderFailed(this.name);const s="Amazon Pay Button not able to render into container #".concat(S(this,st),".");console.error(s),h.log({body:s,attributes:{pageType:this.pageType,containerID:S(this,st),error:i==null?void 0:i.toString()}})}finally{z(this,Jt,!1)}o&&((t=this.onRendered)==null||t.call(this))}teardownAmazonButtonContainer(){var t;(t=S(this,Dt))==null||t.remove(),z(this,Dt,null)}};
1Ce=new WeakMap,ve=new WeakMap,Jt=new WeakMap,Y=new WeakMap,st=new WeakMap,Dt=new WeakMap,c(jt,"CV2_CONFIG_REST_API_URL","".concat(window.location.origin,"/wallets/config/amazon_pay")),c(jt,"EXPECTED_ERRORS",[fn,rr,bn]);let Hr=jt;const qt=class jp extends Ct{static walletName(){return"amazon_pay"}constructor(t){super(t)}getWebComponentName(){return"shopify-amazon-pay-button"}getInstrumentName(){return y.AmazonPay}getWebComponentClass(){return Hr}async loadWalletSDK(){await Bo({sdkUrl:jp.SDK_URL,maxRetries:jp.MAX_RETRIES})}getLoadEligibility(t){return t.getRootNode()instanceof ShadowRoot?{eligible:!1,reason:"Cannot load Amazon Pay within Shadow DOM"}:{eligible:!0}}};c(qt,"MAX_RETRIES",3),c(qt,"SDK_URL",Kr);let $r=qt;var Cr={Purple:{D50:"#4524DB",P40:"#5433EB"},Grayscale:{L0:"#FFFFFF"}},ih={16:16},oa="gravity-font-faces",sh="\n@font-face {\n font-family: 'GTStandard-M';\n src: url('https://cdn.shopify.com/shop-assets/static_uploads/shoplift/GTStandard-MRegular.woff2')\n format('woff2');\n font-style: normal;\n font-weight: 450;\n font-display: fallback;\n}\n\n@font-face {\n font-family: 'GTStandard-M';\n src: url('https://cdn.shopify.com/shop-assets/static_uploads/shoplift/GTStandard-MMedium.woff2')\n format('woff2');\n font-style: normal;\n font-weight: 500;\n font-display: fallback;\n}\n\n@font-face {\n font-family: 'GTStandard-M';\n src: url('https://cdn.shopify.com/shop-assets/static_uploads/shoplift/GTStandard-MSemibold.woff2')\n format('woff2');\n font-style: normal;\n font-weight: 600;\n font-display: fallback;\n}",lh=class extends HTMLElement{static get observedAttributes(){return["disabled"]}connectedCallback(){this._loadFonts(),this._updateButton()}attributeChangedCallback(){this._updateButton()}_loadFonts(){if(document.querySelector('style[data-description="'.concat(oa,'"], style[data-description="shop-js-font-faces"]')))return;let e=document.createElement("style");e.dataset.description=oa,e.appendChild(document.createTextNode(sh)),document.head.appendChild(e)}_updateButton(){var e;let t=this._getOrCreateShadowRoot();t.innerHTML=dh,this.hasAttribute("disabled")&&((e=t.querySelector("button"))==null||e.setAttribute("disabled",""))}_getOrCreateShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}};function ch(){window.customElements&&(customElements.get("gravity-button")||customElements.define("gravity-button",lh))}var dh="\n<style>\n * {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n border-color: currentColor;\n --focused-box-shadow: 0 0 0 3px #DBD1FF, 0 0 #0000;\n }\n\n button {\n text-transform: none;\n -webkit-appearance: button;\n background-color: transparent;\n background-image: none;\n font-family: GTStandard-M;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n font-size: 100%;\n font-weight: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n color: inherit;\n margin: 0;\n padding: 0;\n cursor: pointer;\n }\n\n button:disabled {\n cursor: default;\n opacity: 0.5;\n }\n\n .gravity-button {\n position: relative;\n display: flex;\n min-height: var(--gravity-button-min-height);\n height: var(--gravity-button-height);\n width: var(--gravity-button-width, 260px);\n justify-content: center;\n color: ".concat(Cr.Grayscale.L0,";\n align-items: center;\n overflow: visible;\n padding: var(--gravity-button-padding, ").concat(ih[16],"px 10px);\n border-radius: var(--gravity-button-border-radius);\n border: none;\n background-color: ").concat(Cr.Purple.P40,";\n transition: all;\n }\n\n .gravity-button:not([disabled]):focus-visible {\n box-shadow: var(--focused-base-box-shadow, var(--focused-box-shadow));\n outline: var(--focused-base-outline, 2px solid transparent);\n outline-offset: var(--focused-base-outline-offset, 2px);\n }\n\n .gravity-button:not([disabled]):hover {\n background-color: ").concat(Cr.Purple.D50,';\n }\n</style>\n\n<button class="gravity-button">\n <slot id="button-content"></slot>\n</button>\n');const uh=".button-content{display:flex;align-items:center;justify-content:center;width:100%;height:100%;gap:3px;white-space:nowrap;container-type:inline-size;container-name:bc}.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{position:relative;height:100%;left:0;width:0px;transition:width .35s cubic-bezier(.33,0,0,1) .2s;visibility:hidden;opacity:0}
1shop-pay-iframe-content,.credit-card-iframe-container>iframe.credit-card-iframe{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.credit-card-iframe-visible{width:72px;opacity:1;visibility:visible}.credit-card-iframe{position:absolute;top:0;left:0;object-position:left top;object-fit:none;height:100%;width:80px}",hh='.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"]){display:block;height:100%}:host([page-type="cart_page"]) .accelerated-checkout-button{height:100%;min-height:0;width:100%;border-radius:var(--shopify-accelerated-checkout-button-border-radius, 4px);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{border:1px solid transparent!important}:host([page-type="cart_page"]) .accelerated-checkout-button{border:1px solid transparent!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%}';class Ho extends Error{constructor(){const t="DeliveryEstimatesResponseIsNullError";super("deliveryEstimates is null or undefined"),this.name=t}}class vr extends Error{constructor(){const t="DeliveryPromiseAPIClientError";super("window.Shopify.ShopPromise.deliveryPromiseAPIClient is undefined"),this.name=t}}const ph=15,mh=200;class gh{constructor(t){c(this,"storefrontAPIToken"),this.storefrontAPIToken=t}async fetchDeliveryPromise({variant:t,postalCode:n,defaultPostalCode:r,sellingPlanId:a}){const o=await Fo({fn:async()=>this.fetchDeliveryOptions(t,n,r,a),maxRetries:ph,delay:mh,retryPolicyFn:i=>i instanceof vr}).catch(i=>{if(i instanceof vr)throw i;return null});if(!o)throw new Ho;return o}async fetchDeliveryOptions(t,n,r,a){var o,i;const s={variantId:t,sellingPlanId:a,postalCode:n||r,isPostalCodeOverride:!!n},l=(i=(o=window==null?void 0:window.Shopify)==null?void 0:o.ShopPromise)==null?void 0:i.deliveryPromiseAPIClient;if(!l)throw new vr;return l(s,this.storefrontAPIToken)}}function yh(e,t){switch(e){case 0:return(t==null?void 0:t.translate("shop_promise_delivery.same_day"))||null;case 1:return(t==null?void 0:t.translate("shop_promise_delivery.next_day"))||null;case 2:return(t==null?void 0:t.translate("shop_promise_delivery.two_day"))||null;default:return null}}const fh="delivery_promise_default_address",bh="delivery_promise_postal_code";class wh extends De{constructor(){super(...arguments),c(this,"lastFetchedProductVariantId"),c(this,"lastFetchSellingPlan"),c(this,"fetching",!1),c(this,"i18n",null),c(this,"daysToDelivery"),c(this,"formObserver",null)}async connectedCallback(){this.formObserver=new hn(this,({variantId:t,sellingPlanId:n})=>{this.fetchDeliveryPromise(t,n)}),this.formObserver.setupMutationObservers()}setTranslations(t){this.i18n=t,this.render()}get postalCode(){try{return JSON.parse(we(bh)||"null")||null}catch(t){return null}}get defaultDeliveryAddress(){try{return JSON.parse(we(fh)||"null")}catch(t){return null}}async fetchDeliveryPromise(t,n){var r,a,o,i;if(!(!t||!this.accessToken)&&!(t===this.lastFetchedProductVariantId&&n===this.lastFetchSellingPlan))try{this.lastFetchedProductVariantId=t,this.lastFetchSellingPlan=n;const s=((r=this.defaultDeliveryAddress)==null?void 0:r.zip)||"",l=await new gh(this.accessToken).fetchDeliveryPromise({variant:t,postalCode:this.postalCode||"",defaultPostalCode:s,sellingPlanId:n||""}),d=Qa(this),u=(o=(a=l==null?void 0:l.selectedShippingOption)==null?void 0:a.brandedPromise)==null?void 0:o.handle;if((d==null?void 0:d.sellingPlanId)!==n||(d==null?void 0:d.variantId)!==t||u!=="shop_promise")return;this.daysToDelivery=(i=l==null?void 0:l.selectedShippingOption)==null?void 0:i.maxCalendarDaysToDelivery,this.render()}catch(s){s instanceof Ho&&(this.daysToDelivery=null)}}render(){const t=yh(this.daysToDelivery,this.i18n);this.classList.add("ShopPromise"),this.innerHTML=t?'<span class="separator">|</span><span>'.concat(t,"</span>"):""}}function _h({flow:e="default"}){const t=new URLSearchParams({target_origin:window.location.origin,flow:e});
1return"".concat(window.location.origin,"/services/login_with_shop/authorize?").concat(t.toString())}function Eh(e,t,n){const r=n!=null?n:window.location.origin;if(e.origin!==r||!t)return!1;try{return e.source===t.contentWindow}catch(a){return!1}}const be=class Wp extends De{constructor(){super(...arguments),c(this,"_userRecognized"),c(this,"iframe",null),c(this,"iframeContainer",null),c(this,"iframeCreationStart",null),c(this,"iframeOrigin",null),c(this,"shopLogo",null),c(this,"iframeState","hidden"),c(this,"impressionTracked",!1),c(this,"pendingAnimation",!1),c(this,"handleMessage",t=>{var n;if(Eh(t,this.iframe,t.origin)&&((n=t.data)==null?void 0:n.type)==="loaded"&&(this.iframeOrigin!==t.origin&&(this.iframeOrigin=t.origin),t.data.type==="loaded")){const r=t.data.recognized===!0;if(this._userRecognized=r,this.iframeCreationStart){const a=ze()-this.iframeCreationStart,o={instrument:y.ShopPay,pageType:Jr()};C.histogram({name:I.ShopPayPersonalizedIframeLoadTime,value:a,attributes:o,unit:"ms"}),C.histogram({name:I.ShopPayPersonalizedIframeLoadTimeFromPageLoad,value:window.performance.now(),attributes:o,unit:"ms"})}if(r){this.handleRecognizedUser();return}this.handleUnrecognizedUser()}})}get userRecognized(){return this._userRecognized}async createIframe(){if(this.iframeContainer)return this.iframeC
1ontainer;const t=ze();return this.iframeCreationStart=t,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=_h({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(Wp.iframeCreated)return;const t=this.querySelector(".credit-card-iframe-container");t&&t.remove(),Wp.iframeCreated=!0;const n=await this.createIframe();this.appendChild(n),this.setupMessageListener()}disconnectedCallback(){this.cleanup()}setShopLogo(t){this.shopLogo=t}setDisabled(t){this.disabled=t,t&&this.iframeState!=="personalized"&&this.hideIframe()}hasPersonalizationOccurred(){return this.iframeState==="personalized"}triggerAnimation(t){const n=this.style.display!=="none";if(!(this.disabled||this.iframeState==="personalized"||!n)){if(this.iframeState==="loaded"){this.trackButtonImpression();return}if(this.iframeState==="ready"){this.showIframe(t);return}this.pendingAnimation=!0}}stopPendingAnimation(){this.pendingAnimation=!1}resetToOriginalState(){var t;this.iframeState="hidden",this.pendingAnimation=!1,(t=this.iframeContainer)==null||t.classList.remove("credit-card-iframe-visible")}trackButtonImpression(){this.impressionTracked||(V({event:$.ShopPayButtonInView,instrumentId:y.ShopPay,eventSubtype:this.userRecognized?"personalized":"not_personalized"}),this.impressionTracked=!0)}setupMessageListener(){window.addEventListener("message",this.handleMessage)}handleRecognizedUser(){const t=this.iframeState==="hidden";t&&(this.iframeState="ready"),this.style.display!=="none"&&t&&!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(t){if(this.trackButtonImpression(),!t){this.animateIn();return}const n=setTimeout(()=>{this.animateIn()},500);return()=>clearTimeout(n)}hideIframe(){var t;this.iframeState!=="hidden"&&this.iframeState!=="personalized"&&(this.iframeState="hidden",(t=this.iframeContainer)==null||t.classList.remove("credit-card-iframe-visible"))}cleanup(){var t;window.removeEventListener("message",this.handleMessage),(t=this.iframeContainer)==null||t.remove(),this.iframeC
1ontainer=null,this.iframe=null,this.iframeOrigin=null,this.shopLogo=null}sendMessageToIframe(){var t;if(!((t=this.iframe)!=null&&t.contentWindow)||!this.iframeOrigin)return;const n={timestamp:ze(),type:"animate-in"};this.iframe.contentWindow.postMessage(n,this.iframeOrigin)}};c(be,"iframeCreated",!1);let Gr=be;function Ah(e){const t=e.querySelector(".button-content span");if(!t)return 0;const n=window.getComputedStyle(t);return parseFloat(n.fontSize)}function ia(){const e=window.TPOConfigs,t=window.optionizeSettings;return!!(e||t)}const Me=220;class Sh{constructor({element:t,isCTA:n,onFormStateChange:r,personalized:a,shopPromiseEligible:o,shopPromiseProductPageContent:i}){c(this,"cachedFontSize",null),c(this,"cachedWidth",0),c(this,"element"),c(this,"formObserver",null),c(this,"formState",{disabled:!1,variantId:void 0}),c(this,"initialWidth",null),c(this,"isCTA"),c(this,"lockedNonPersonalized",!1),c(this,"onFormStateChange"),c(this,"pendingFormStateUpdate",null),c(this,"personalized"),c(this,"resizeObserver",null),c(this,"shopPromiseEligible"),c(this,"shopPromiseProductPageContent");var s;this.element=t,this.isCTA=n,this.onFormStateChange=r,this.personalized=a,this.shopPromiseEligible=o,this.shopPromiseProductPageContent=i,this.personalized&&(ia()||(this.formObserver=new hn(this.element,({disabled:l,variantId:d})=>{this.formState={disabled:l,variantId:d},this.scheduleFormStateChange()}),this.formObserver.setupMutationObservers(),this.resizeObserver=Lt("ResizeObserver",l=>this.handleResize(l)),(s=this.resizeObserver)==null||s.observe(this.element)))}cleanup(){var t,n,r;(n=(t=this.formObserver)==null?void 0:t.addToCartMutationObserver)==null||n.disconnect(),(r=this.resizeObserver)==null||r.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 n=this.shopPromiseEligible&&this.shopPromiseProductPageContent,r=this.formState.disabled&&this.formState.variantId!==void 0;if(n||r||t<Me)return!1;if(this.isCTA){const a=this.getFontSizeCached();if(a<10||a>18)return!1}return!0}getFontSizeCached(){return this.cachedFontSize!==null?this.cachedFontSize:(this.cachedFontSize=Ah(this.element),this.cachedFontSize)}scheduleFormStateChange(){this.pendingFormStateUpdate===null&&(this.pendingFormStateUpdate=requestAnimationFrame(()=>{var t;this.pendingFormStateUpdate=null,(t=this.onFormStateChange)==null||t.call(this)}))}get locked(){return this.lockedNonPersonalized}get soldOut(){return this.formState.disabled&&this.formState.variantId!==void 0}handleResize(t){var n,r;const a=(r=(n=t[0])==null?void 0:n.contentRect.width)!=null?r:0;if(this.cachedWidth=a,this.initialWidth===null&&a>0){this.initialWidth=a,this.initialWidth<Me&&(this.lockedNonPersonalized=!0),this.scheduleFormStateChange();return}if(this.initialWidth!==null&&this.initialWidth>=Me&&a>0&&a<Me&&!this.lockedNonPersonalized){this.lockedNonPersonalized=!0,this.scheduleFormStateChange();return}this.scheduleFormStateChange()}}class Ch extends St{constructor(){super(...arguments),c(this,"name",y.ShopPay),c(this,"button",null),c(this,"shopPromiseProductPageContent",null),c(this,"shopPromiseEligible",!1),c(this,"shopLogo",null),c(this,"buttonContentDiv",null),c(this,"iframeContent",null),c(this,"iframeRenderEligibility",null),c(this,"intersectionObserver",null),c(this,"inView",!1),c(this,"impressionTracked",!1)}static get observedAttributes(){return["disabled"]}connectedCallback(){this.shopPromiseEligible=Ha(),this.setupIntersectionObserver(),this.cleanupOnFailure(async()=>{ch(),await this.render()},this.name)}disconnectedCallback(){var t,n;super.disconnectedCallback(),(t=this.intersectionObserver)==null||t.disconnect(),this.intersectionObserver=null,(n=this.iframeRenderEligibility)==null||n.cleanup(),this.iframeRenderEligibility=null}attributeChangedCallback(t,n,r){super.attributeChangedCallback(t,n,r,this.button),t==="disabled"&&this.onDisabledChanged(r)}setupIntersectionObserver(){var t,n;if("IntersectionObserver"in window){const r=((n=(t=this.button)==null?void 0:t.offsetHeight)!=null?n:46)*-1;this.intersectionObserver=new IntersectionObserver(a=>{a.forEach(o=>{var i;
1o.isIntersecting&&!this.inView&&(this.inView=!0,this.onButtonInView(!0),(i=this.intersectionObserver)==null||i.unobserve(this))})},{threshold:.1,rootMargin:"".concat(r,"px")}),this.intersectionObserver.observe(this)}else this.inView=!0,this.onButtonInView()}onButtonInView(t){var n;const r=(n=this.iframeRenderEligibility)==null?void 0:n.shouldRender();if(r&&this.iframeContent){this.iframeContent.triggerAnimation(t);return}if(r){this.createAndAttachIframe();return}this.impressionTracked||(V({event:$.ShopPayButtonInView,instrumentId:y.ShopPay,eventSubtype:"not_personalized"}),this.impressionTracked=!0)}onDisabledChanged(t){var n;(n=this.iframeContent)==null||n.setDisabled(t!==null)}async addButtonContent(){if(!this.button)return;let t;const n=await this.i18n,r=Ae({instrumentName:y.ShopPay}),a=new DOMParser().parseFromString(r,"image/svg+xml").documentElement;this.shopLogo=a,this.isCTA?t=mn({translate:n.translate,logoElement:a,setAriaHidden:!1}):(t=document.createElement("div"),t.appendChild(a)),t.classList.add("button-content"),this.shopPromiseEligible&&!this.shopPromiseProductPageContent&&(this.shopPromiseProductPageContent=document.createElement("shop-promise-product-page-content"),this.shopPromiseProductPageContent.setTranslations(n),this.shopPromiseProductPageContent.setAttribute("access-token",this.accessToken||""),t.appendChild(this.shopPromiseProductPageContent));const o=this.getAttribute("personalized")==="true",i=()=>{const s=this.iframeContent,l=this.iframeRenderEligibility,d=(l==null?void 0:l.shouldRender())||!1;if(!s){d&&this.createAndAttachIframe();return}if(!d){if(s.hasPersonalizationOccurred()&&l!=null&&l.soldOut&&!(l!=null&&l.locked)){s.style.display="";return}s.style.display="none",l!=null&&l.locked?s.resetToOriginalState():s.stopPendingAnimation();return}s.style.display="",this.inView&&s.triggerAnimation()};this.iframeRenderEligibility=new Sh({element:this.button,isCTA:this.isCTA,onFormStateChange:i,personalized:o,shopPromiseEligible:this.shopPromiseEligible,shopPromiseProductPageContent:this.shopPromiseProductPageContent}),this.buttonContentDiv=t,this.button.appendChild(t)}
1createAndAttachIframe(){!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===T.ProductPage?"force_shop_pay_product":this.pageType===T.CartPage?"force_shop_pay_cart":"force_shop_pay"}async handleClick(t){var n,r;if(t.preventDefault(),this.disabled||!this.button||this.button.getAttribute("disabled"))return;this.disabled=!0,At(this.name,this.pageType);const[a,o]=await Promise.all([this.i18n,this.dataSource]);try{const{decelerationReason:i,cart:s,customValidationError:l,unrecoverableError:d}=await dt({element:this,instrumentName:y.ShopPay,dataSource:o});if(d){h.sheetClicked({instrument:this.name,result:"rejected",reason:"unrecoverable_error"}),h.log({body:"Unrecoverable error detected in Shop Pay Button click",attributes:{pageType:this.pageType,error:d}}),zt(a,d);return}if(l){h.log({body:"Custom validation error detected in Shop Pay Button click",attributes:{pageType:this.pageType,errorCode:l.code,errorMessage:l.message}}),h.sheetClicked({instrument:this.name,result:"rejected",reason:"custom_validation_error"}),Mt(a,l.message);return}if(i){h.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),U({checkoutUrl:(n=s==null?void 0:s.checkoutUrl)!=null?n:"",instrumentName:this.name,reason:i});return}h.sheetClicked({instrument:this.name,result:"success"}),_t((r=s==null?void 0:s.checkoutUrl)!=null?r:"",this.getShopPayBehavior())}catch(i){b.notify(new vh("An error occurred when attempting to create a cart using the Shop Pay Button. Details: ".concat(i),{cause:i})),h.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),h.log({body:"Unhandled error detected in Shop Pay sheet clicked",attributes:{error:String(i),location:"handleClick"}}),Nt(a)}}async render(){const t=this.getOrCreateShadowRoot();if(t.innerHTML)return;this.button||(this.button=document.createElement("gravity-button"));const n=document.createElement("style");n.innerHTML=[hh,uh].join("\n"),t.appendChild(n),await this.addButtonContent(),this.disabled&&this.button.setAttribute("disabled",""),this.button.classList.add(xt.BUTTON),this.button.onclick=r=>this.handleClick(r),t.appendChild(this.button),this.ensureLightDOMIsNotEmpty(),this.handleIframeRenderLogic(),this.onRendered()}}ut("shop-promise-product-page-content",wh),ut("shop-pay-iframe-content",Gr);class vh extends Error{constructor(){super(...arguments),c(this,"name","ShopPayButtonError")}}var Ph=Object.defineProperty,Ih=Object.getOwnPropertyDescriptor,kh=(e,t,n,r)=>
1{for(var a=Ih(t,n),o=e.length-1,i;o>=0;o--)(i=e[o])&&(a=i(t,n,a)||a);return a&&Ph(t,n,a),a};class $o extends Ct{static walletName(){return"shop_pay"}constructor(t){super(t)}getWebComponentName(){return"shop-pay-wallet-button"}getWebComponentClass(){return Ch}getInstrumentName(){return y.ShopPay}async createWebComponent(t){var n;const r=await super.createWebComponent(t);return(n=this.walletParams)!=null&&n.personalized&&r.setAttribute("personalized","true"),r}async loadWalletSDK(){await this.loadLogo()}getLoadEligibility(){return{eligible:!0}}async loadLogo(){await ne({svg:"shop-logo.svg",instrumentName:y.ShopPay})}}kh([gn("Shop Pay")],$o.prototype,"getLoadEligibility");const Th=".button{display:flex;justify-content:center;align-items:center;width:100%;border:none}.button:hover:not(:disabled){filter:brightness(92%);cursor:pointer}.button:disabled{opacity:.5;cursor:not-allowed}.button:focus-visible{box-shadow:inset 0 0 0 2px #1773b0,inset 0 0 0 3px #f8f8f8!important;outline:none}.logo-only>svg{width:50px}.dark{background:#000;color:#fff}.light{background:#fff;color:#000;outline:1px solid #3c4043}@media (forced-colors: active){.light{outline:none}}@media (prefers-contrast: high),(forced-colors: active){.button:focus-visible{outline:.2rem solid;outline-offset:.1rem}}.content{display:flex;justify-content:center;align-items:center;white-space:pre}";function wn(){var e,t,n,r;try{const a=(r=(n=(t=(e=window.ShopifyAnalytics)==null?void 0:e.lib)==null?void 0:t.trekkie)==null?void 0:n.defaultAttributes)==null?void 0:r.microSessionId;return a?"pw-".concat(a):void 0}catch(a){return}}function Pr({cart:e,i18n:t}){const n=_o(e),r={label:t.translate("order_summary.subtotal"),type:"SUBTOTAL",price:bt(n.amount)},a=bo({deliveryGroups:e.deliveryGroups,i18n:t}).map(d=>Dh({lineItem:d,type:"LINE_ITEM"})),o=Rh(e,t),i=[...$a(e.lineItems,(d,u)=>({label:d,type:"LINE_ITEM",price:u})),r,...a,...o];if(e.totalDutyAmount){const d={label:t.translate("order_summary.duties"),type:"LINE_ITEM",price:bt(e.totalDutyAmount.amount)};i.push(d)}if(e.totalTaxAmount){const d={label:t.translate("order_summary.taxes"),t
1ype:"TAX",price:bt(e.totalTaxAmount.amount)};i.push(d)}const s=wn(),l={totalPrice:e.totalAmount.amount,currencyCode:e.totalAmount.currencyCode,totalPriceStatus:"ESTIMATED",totalPriceLabel:t.translate("order_summary.total"),displayItems:i};return s&&(l.transactionId=s),l}function Dh({lineItem:e,type:t,status:n="FINAL"}){return{label:e.label,type:t,price:e.amount,status:n}}function Rh(e,t){return[...e.lineItems.flatMap(n=>n.discountAllocations),...e.discountAllocations].flatMap(n=>{var r;const a=(r=n.title)!=null?r:n.code;return{label:a!=null?a:t.translate("order_summary.discount"),type:"LINE_ITEM",price:"-".concat(bt(Number(n.discountedAmount.amount)))}})}const Go=["PAYMENT_AUTHORIZATION"],Nh=Go.concat(["SHIPPING_ADDRESS","SHIPPING_OPTION"]),Oh=["PAN_ONLY"];function Lh({walletParams:e,isShippingRequired:t,hasSellingPlan:n,i18n:r,buyerCurrency:a,authJwt:o}){const i=wn(),s=n&<.enabled(Mo),l={totalPrice:"0.01",currencyCode:a,totalPriceStatus:"ESTIMATED",totalPriceLabel:r.translate("order_summary.total"),displayItems:[{label:r.translate("order_summary.subtotal"),type:"SUBTOTAL",price:"0.01"}],...s&&{checkoutOption:"CONTINUE_TO_REVIEW"}};i&&(l.transactionId=i);const d={...e.paymentData,shippingAddressRequired:t,shippingOptionRequired:t,transactionInfo:l};return d.merchantInfo.authJwt=o,t||delete d.shippingAddressParameters,d.callbackIntents=t?Nh:Go,n&&xh(d),d}function xh(e){e.allowedPaymentMethods.forEach(t=>{t.parameters.allowedAuthMethods=t.parameters.allowedAuthMethods.filter(n=>Oh.includes(n))})}class Mh extends wo{constructor(t){super(),c(this,"brandName"),c(this,"completionResult"),this.i18n=t,this.brandName=this.i18n.translate("brand.google_pay"),this.completionResult=void 0}mapMutationResultToPaymentSheetAction({result:t,checkoutUrl:n,requestType:r,shippingCountryCode:a,billingCountryCode:o}){const i=this.mapCustomValidationFunctionErrorToAction(t.errors);if(i)return i;const s=this.getErrorActions({checkoutUrl:n,requestType:r,shippingCountryCode:a,billingCountryCode:o}),l=t.errors,d=this.getUnhandledErrors(l,s);d.forEach(p=>{b.notify(new Mr("[".concat(y.GooglePay,"] mutation result error not handled: ").concat(Ht(p)),{groupingHash:"UnhandledActionError:".concat(y.GooglePay,":").concat(Ht(p))}))});const{firstPaymentSheetAction:u}=this.getMergedPaymentSheetAction({result:t,errorActions:s});return u||(d.length>0?{action:"abort"}:{action:"update",errors:[]})}mapCompletionResultToPaymentSheetAction({result:t,checkoutUrl:n,requestType:r,shippingCountryCode:a,billingCountryCode:o}){if(!t.data)throw new xa(y.GooglePay);switch(this.completionResult=t,t.data.__typename){case"SubmitSuccess":return{action:"complete",redirectUrl:t.data.redirectUrl};case"SubmitAlreadyAccepted":case"SubmitThrottled":case"SubmitFailed":{const i=this.mapCustomValidationFunctionErrorToAction(t.errors);if(i)return i;const s=this.getErrorActions({checkoutUrl:n,requestType:r,shippingCountryCode:a,billingCountryCode:o}),l=t.errors;this.getUnhandledErrors(l,s).forEach(u=>{b.notify(new Mr("[".concat(y.GooglePay,"] completion result error not handled: ").concat(Ht(u)),{groupingHash:"UnhandledActionError:".concat(y.GooglePay,":").concat(Ht(u))}))});const{prioritizedPaymentSheetAction:d}=this.getMergedPaymentSheetAction({result:t,errorActions:s});return d||(at(this.brandName,this.i18n),{action:"abort"})}default:throw new Error("[".concat(y.GooglePay,"] unknown completion result type: ").concat(t.data.__typename))}}getErrorActions({checkoutUrl:t,requestType:n,shippingCountryCode:r,billingCountryCode:a}){const o=(i,s)=>()=>{const l=s.startsWith("billingAddress")?a:r;h.addressFieldError({instrument:y.GooglePay,errorCode:i,errorField:s,countryCode:l})};return[{matchers:[je],generateAction:()=>this.decelerateOrAbort({reason:"captcha_required",instrumentName:y.GooglePay,errorOrWarning:je.code,checkoutUrl:t,requestType:n})},{matchers:[We],generateAction:()=>this.decelerateOrAbort({reason:"invalid_language",instrumentName:y.GooglePay,errorOrWarning:We.code,checkoutUrl:t,requestType:n})},{matchers:[Ye],generateAction:()=>this.decelerateOrAbort({reason:"invalid_country",instrumentName:y.GooglePay,errorOrWarning:Ye.code,checkoutUrl:t,requestType:n})},{matchers:[Ke],generateAction:()=>this.decelerateOrAbort({reason:"missing_cart_id",instrumentName:y.GooglePay,errorOrWarning:Ke.code,checkoutUrl:t,requestType:n})},{matchers:[Xe],generateAction:()=>this.decelerateOrAbort({reason:"redirect_to_checkout_required",instrumentName:y.GooglePay,errorOrWarning:Xe.code,checkoutUrl:t,requestType:n})},{matchers:on,generateAction:()=>this.decelerateOrAbort({reason:"dynamic_tax",instrumentName:y.GooglePay,errorOrWarning:"TAX_NEW_TAX_MUST_BE_ACCEPTED",checkoutUrl:t,requestType:n})},{matchers:[Je],generateAction:()=>this.decelerateOrAbort({reason:"generic_error",instrumentName:y.GooglePay,errorOrWarning:Je.code,checkoutUrl:t,requestType:n})},{matchers:[Qe],generateAction:()=>this.decelerateOrAbort({reason:"unsupported_google_pay_payment_method",instrumentName:y.GooglePay,errorOrWarning:Qe.code,checkoutUrl:t,requestType:n})},{matchers:ro,generateAction:()=>this.decelerateOrAbort({reason:"invalid_payment_amount",instrumentName:y.GooglePay,errorOrWarning:"INVALID_PAYMENT",checkoutUrl:t,requestType:n})},{matchers:[Ve],generateAction:()=>this.decelerateOrAbort({reason:"custom_validation",instrumentName:y.GooglePay,errorOrWarning:Ve.code,checkoutUrl:t,requestType:n})},{matchers:vc,generateAction:()=>({action:"abort",effects:[()=>at(this.brandName,this.i18n)]})},{matchers:sn,generateAction:()=>({action:"abort",effects:[()=>wt(this.i18n)]})},{matchers:no,generateAction:()=>this.decelerateOrAbort({reason:"not_enough_stock",instrumentName:y.GooglePay,errorOrWarning:"MERCHANDISE_NOT_ENOUGH_STOCK",checkoutUrl:t,requestType:n})},{matchers:eo,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_UNSERVICEABLE",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.shipping_address")}]})},{matchers:w.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.postal_code")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.zip")]})},{matchers:[xc],generateAction:()=>
1({action:"show_error",errors:[{reason:"SHIPPING_OPTION_INVALID",intent:"SHIPPING_OPTION",message:this.i18n.translate("errors.missing.shipping_option")}]})},{matchers:Ee.invalid,generateAction:()=>({action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.email")}]})},{matchers:Ee.required,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.email")}]})},{matchers:w.required.address2,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.address2")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.address2")]})},{matchers:w.invalid.address2,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.address2")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.address2")]})},{matchers:w.required.city,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.city")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.city")]})},{matchers:w.invalid.city,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.city")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.city")]})},{matchers:w.required.province,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.zone")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.province")]})},{matchers:w.invalid.province,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.zone")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.province")]})},{matchers:w.required.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.postal_code")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.zip")]})},{matchers:w.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.postal_code")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.zip")]})},{matchers:w.required.phoneNumber,generateAction:()=>({action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.phone")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.phone")]})},{matchers:w.invalid.phoneNumber,generateAction:()=>({action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.phone")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.phone")]})},{matchers:w.invalid.country,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.country")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.country")]})},{matchers:w.required.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.first_name")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.firstName")]})},{matchers:w.invalid.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.first_name")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.firstName")]})},{matchers:w.required.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.last_name")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.lastName")]})},{matchers:w.invalid.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.last_name")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.lastName")]})},{matchers:w.required.address1,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.address1")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","deliveryAddress.address1")]})},{matchers:w.invalid.address1,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.address1")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","deliveryAddress.address1")]})},{matchers:w.emojis.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.last_name")}]})},{matchers:w.emojis.city,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.city")}]})},{matchers:w.emojis.address1,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.address1")}]})},{matchers:w.emojis.address2,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.address2")}]})},{matchers:w.emojis.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.postal_code")}]})},{matchers:w.tooLong.address1,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.address1")}]})},{matchers:w.tooLong.address2,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.address2")}]})},{matchers:w.tooLong.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.first_name")}]})},{matchers:w.tooLong.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.last_name")}]})},{matchers:w.tooLong.city,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.city")}]})},{matchers:w.containsUrl.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.url.first_name")}]})},{matchers:w.containsUrl.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.url.last_name")}]})},{matchers:w.htmlTags.address1,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.address1")}]})},{matchers:w.htmlTags.address2,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.address2")}]})},{matchers:w.htmlTags.city,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.city")}]})},{matchers:w.htmlTags.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.first_name")}]})},{matchers:w.htmlTags.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.last_name")}]})},{matchers:A.invalid.generic,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.billing_address")}],effects:[o("INVALID_PAYMENT","billingAddress")]})},{matchers:[qe],generateAction:()=>this.decelerateOrAbort({reason:"localization_extension_field_error",instrumentName:y.GooglePay,errorOrWarning:qe.code,checkoutUrl:t,requestType:n})},{matchers:A.required.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.first_name")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","billingAddress.firstName")]})},{matchers:A.required.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.last_name")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","billingAddress.lastName")]})},{matchers:A.required.address1,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.address1")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","billingAddress.address1")]})},{matchers:A.required.address2,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.address2")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","billingAddress.address2")]})},{matchers:A.required.city,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.city")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","billingAddress.city")]})},{matchers:A.required.phoneNumber,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.phone")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","billingAddress.phone")]})},{matchers:A.required.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.postal_code")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","billingAddress.zip")]})},{matchers:A.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.postal_code")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.zip")]})},{matchers:A.required.province,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.missing.zone")}],effects:[o("ADDRESS_FIELD_IS_REQUIRED","billingAddress.province")]})},{matchers:A.emojis.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.first_name")}]})},{matchers:A.htmlTags.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.html_tags.first_name")}]})},{matchers:A.invalid.firstName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.first_name")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.firstName")]})},{matchers:A.emojis.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.last_name")}]})},{matchers:A.htmlTags.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.html_tags.last_name")}]})},{matchers:A.invalid.lastName,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.last_name")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.lastName")]})},{matchers:A.emojis.address1,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.address1")}]})},{matchers:A.htmlTags.address1,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.html_tags.address1")}]})},{matchers:A.invalid.address1,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.address1")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.address1")]})},{matchers:A.emojis.address2,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.address2")}]})},{matchers:A.htmlTags.address2,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.html_tags.address2")}]})},{matchers:A.invalid.address2,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.address2")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.address2")]})},{matchers:A.emojis.city,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.city")}]})},{matchers:A.htmlTags.city,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.html_tags.city")}]})},{matchers:A.invalid.city,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.city")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.city")]})},{matchers:A.emojis.phoneNumber,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.phone")}]})},{matchers:A.invalid.phoneNumber,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.phone")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.phone")]})},{matchers:A.emojis.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.emojis.postal_code")}]})},{matchers:A.invalid.postalCode,generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.postal_code")}],effects:[o("ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN","billingAddress.zip")]})}]}mapCustomValidationFunctionErrorToAction(t){const n=tn(t);return n?(en(this.i18n.translate("error_dialogs.wallet.title",{wallet:this.brandName}),n.message),{action:"abort"}):null}}function zh({deliveryGroups:e,i18n:t}){var n;const r=Md(yo({deliveryGroups:e}),t),a=r.map(({handle:i,title:s,description:l})=>({id:i,label:s!=null?s:"",description:l})),o=(n=r.find(i=>{var s;return i.handle.includes(((s=e[0].selectedDeliveryOption)==null?void 0:s.handle)||"")}))==null?void 0:n.handle;return{shippingOptions:a,defaultSelectedOptionId:o}}function Ir(e){const t=e.iso3166AdministrativeArea||void 0,n=e.countryCode==="AE"?e.administrativeArea:e.locality;let r,a;
1if(e.name){const[o,...i]=(e.name||"").split(" ");i.length===0?a=o:a=i.join(" "),r=o}return{firstName:r,lastName:a,address1:e.address1,address2:e.address2,city:n,province:t,country:e.countryCode,phone:e.phoneNumber,zip:e.postalCode}}class sa extends Error{constructor(){super(...arguments),c(this,"name","GooglePayError")}}function Vo(e){const t=e.auth;if(!(Array.isArray(t)&&t.length>0))return{result:"error",reason:"invalidAuthParams"};const n=ze();for(const r of t)if(n<r.expiresAt*1e3)return{result:"success",jwt:r.jwt};return{result:"error",reason:"authJwtExpired"}}const Uh=["https://checkout.pci.shopifyinc.com/sessions","https://checkout.pci.shopifyinc.ninja/sessions"];class Qt extends Error{constructor(t,n,r){super(t),this.statusCode=n,this.responseBody=r,this.name="CardsinkError"}}function Fh(e){if(!Uh.includes(e))throw new Qt("Untrusted cardsink url: ".concat(e))}async function Bh({cardsinkUrl:e,payload:t,clientIdentificationJwt:n,abortSignal:r}){Fh(e);const a={"Content-Type":"application/json"};n&&(a["Shopify-Identification-Signature"]=n);let o;try{o=await fetch(e,{method:"POST",headers:a,body:JSON.stringify(t),signal:r})}catch(s){throw new Qt("Network error while calling Cardsink: ".concat(s instanceof Error?s.message:String(s)))}if(!o.ok){const s=await o.text().catch(()=>"Unable to read response body");throw new Qt("Cardsink request failed with status ".concat(o.status),o.status,s)}let i;try{i=await o.json()}catch(s){throw new Qt("Failed to parse Cardsink response: ".concat(s instanceof Error?s.message:String(s)),o.status)}return i}const kr=1,Hh=500;async function $h(e,t,n){let r="";for(let a=0;a<=kr;a++)try{const o=await Bh({cardsinkUrl:e.cardsinkUrl,payload:t,clientIdentificationJwt:e.callerIdentificationJwt,abortSignal:n});return h.cardsinkDepositResult({result:"success",attempt:a}),{sessionId:o.id}}catch(o){if(r=o instanceof Qt?o.message:"Cardsink deposit failed with unexpected error",a<kr){if(n!=null&&n.aborted)break;await new Promise(i=>setTimeout(i,Hh))}}return h.cardsinkDepositResult({result:"failed",error:r,attempt:kr}),{error:r}}const Gh=27e3,la="Google Pay Timeout";var Pe,K,Zt;class Vh{constructor({walletParams:t,isShippingRequired:n,hasSellingPlan:r,dataSource:a,button:o,i18n:i,cartClient:s,buyerCurrency:l,abortController:d,cardsinkUrl:u,cardsinkCallerIdentificationJwt:p}){c(this,"name",y.GooglePay),c(this,"walletParams"),c(this,"cart",null),c(this,"isShippingRequired"),c(this,"hasSellingPlan"),c(this,"dataSource"),c(this,"button"),c(this,"paymentsClient"),c(this,"i18n"),c(this,"actionGenerator"),c(this,"cartClient"),c(this,"initialBuyerCurrency"),c(this,"cardsinkUrl"),c(this,"cardsinkCallerIdentificationJwt"),c(this,"terminalCartCreationError"),G(this,Pe),G(this,K),G(this,Zt),c(this,"onPaymentDataChanged",async f=>{var v,E;const{callbackTrigger:_,shippingAddress:k,shippingOptionData:j}=f,{translate:Ca}=this.i18n;switch(b.leaveBreadcrumb("Google Pay onPaymentDataChanged",{callbackTrigger:_},"log"),_){case"INITIALIZE":{if(!this.cart)try{const{cart:N,customValidationError:D,decelerationReason:x,unrecoverableError:J}=await dt({element:this.button,instrumentName:y.GooglePay,dataSource:this.dataSource,isShippingRequired:this.isShippingRequired});if(D||J)return h.sheetClicked({instrument:this.name,result:"rejected",reason:D?"custom_validation_error":"unrecoverable_error"}),this.terminalCartCreationError=D?D.message:jh(this.i18n,J),this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:this.terminalCartCreationError,intent:"SHIPPING_ADDRESS"}});if(this.cart=N,x)return h.sheetClicked({instrument:this.name,result:"success",reason:"deceleration"}),U({checkoutUrl:(v=N==null?void 0:N.checkoutUrl)!=null?v:"",instrumentName:this.name,reason:x,stage:"onValidateMerchant::createCart"}),this.showPaymentDataRequestError({error:{intent:"SHIPPING_ADDRESS",reason:"OTHER_ERROR",message:""}});h.sheetClicked({instrument:this.name,result:"success"})}catch(N){return h.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),this.logTelemetry("Unhandled error detected in Google Pay sheet clicked",{error:String(N),location:"onPaymentDataChanged_INITIALIZE"}),this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"})}let M=!1;if(k)try{return await this.handleShippingAddressChange(this.cart.id,k)}catch(N){M=!0}return{newTransactionInfo:Pr({cart:this.cart,i18n:this.i18n}),...M?this.showPaymentDataRequestError():{}}}case"SHIPPING_ADDRESS":return this.terminalCartCreationError?this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:this.terminalCartCreationError,intent:"SHIPPING_ADDRESS"}}):this.cart?k?this.handleShippingAddressChange(this.cart.id,k):{newTransactionInfo:Pr({cart:this.cart,i18n:this.i18n})}:this.showPaymentDataRequestError({intent:_});case"SHIPPING_OPTION":{if(!this.cart)return this.showPaymentDataRequestError({intent:_});
1if(!j||!j.id)return{error:{reason:"SHIPPING_OPTION_INVALID",message:Ca("shipping_methods.choose_delivery_strategy"),intent:"SHIPPING_OPTION"}};const M=await this.handleDeliveryOptionChange(j.id.split(","));return M.data?(this.cart=M.data,M.abortReason==="out_of_stock"?this.showPaymentDataRequestError({error:{intent:"SHIPPING_OPTION",reason:"OTHER_ERROR",message:this.i18n.translate("error_dialogs.product.out_of_stock")}}):M.decelerationReason?(U({checkoutUrl:(E=this.cart.checkoutUrl)!=null?E:"",instrumentName:this.name,reason:M.decelerationReason}),this.showPaymentDataRequestError({error:{intent:"SHIPPING_OPTION",reason:"OTHER_ERROR",message:""}})):this.handlePaymentDataRequestUpdate({result:M,intent:_,checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentDataChanged::updateCartDeliveryOptions",shippingCountryCode:k==null?void 0:k.countryCode})):this.showPaymentDataRequestError({intent:_})}default:return this.logException("Payment data changed callback returned unexpected intent: ".concat(_),{severity:"warning"}),this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"})}}),c(this,"onPaymentAuthorized",async f=>{var v,E,_,k,j,Ca,M,N,D;if(h.authorizationAttempt(this.name),oe(F.AuthorizationLatency,this.name),!this.cart)return h.googlePayNullCartOnAuthorize(),this.handlePaymentAuthorizationError({reason:"null_cart_on_authorize"});const x=(v=f.paymentMethodData.info)==null?void 0:v.billingAddress,J=f.shippingAddress,{signature:B,signedMessage:Np,protocolVersion:Mp}=JSON.parse(f.paymentMethodData.tokenizationData.token);if(!x)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&&!J)return this.handlePaymentAuthorizationError({error:{reason:"SHIPPING_ADDRESS_INVALID",intent:"PAYMENT_AUTHORIZATION",message:this.i18n.translate("errors.invalid.shipping_address")},reason:"missing_shipping_address"});let Op;if(this.cardsinkUrl){const Ne=await $h({cardsinkUrl:this.cardsinkUrl,callerIdentificationJwt:this.cardsinkCallerIdentificationJwt},{payment_data_source:"google-pay-ecv1",encrypted_payment_data:{protocol_version:Mp,signature:B,signed_message:Np},name:(E=x.name)!=null?E:""},(_=S(this,K))==null?void 0:_.signal);if("sessionId"in Ne)Op=Ne.sessionId;else return b.notify(new Qt(Ne.error),{severity:"warning"}),U({checkoutUrl:(k=this.cart.checkoutUrl)!=null?k:"",instrumentName:this.name,reason:"cardsink_deposit_failed"}),{transactionState:"SUCCESS"}}const Jp=async()=>{var Ne,xp;const Lp=(Ne=S(this,Pe))!=null?Ne:f.email,Up=this.isShippingRequired?{validateAddress:!0,streetAddress:Ir(J)}:{};return await Kt({cartClient:this.cartClient,cartId:this.cart.id,instrumentName:this.name,emailAddress:Lp,abortSignal:(xp=S(this,K))==null?void 0:xp.signal,...Up})},Zp=async()=>{var Ne;const xp=Ir(x);let Lp;return Op?Lp={billingAddress:xp,sessionId:Op,signature:"",signedMessage:"",protocolVersion:""}:Lp={billingAddress:xp,signature:B,signedMessage:Np,protocolVersion:Mp},await pn({cartId:this.cart.id,totalAmount:this.cart.totalAmount,paymentMethod:{walletPaymentMethod:{googlePayWalletContent:Lp}},canUsePaymentMethodForFreeOrder:!1,billingAddress:xp,cartClient:this.cartClient,instrumentName:this.name,hasSellingPlan:this.hasSellingPlan,abortSignal:(Ne=S(this,K))==null?void 0:Ne.signal})},Bp=setTimeout(()=>{var Ne;(Ne=S(this,K))==null||Ne.abort(la)},Gh);try{const Ne=await Jp(),xp=lo({currentCart:Ne.data,previousCart:this.cart});Ne.data&&(this.cart=Ne.data);const Lp=this.handleIntermediatePaymentAuthorizationResult({result:Ne,checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentAuthorized::updateBuyerIdentity",shippingCountryCode:J==null?void 0:J.countryCode,billingCountryCode:x==null?void 0:x.countryCode});if(Lp)return clearTimeout(Bp),Lp;const Up=await Zp();xp==="inc"&&(Up.decelerationReason||(Up.decelerationReason="price_increased"));const Yp=this.handleIntermediatePaymentAuthorizationResult({result:Up,checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentAuthorized::updateCartPayment",shippingCountryCode:J==null?void 0:J.countryCode,billingCountryCode:x==null?void 0:x.countryCode});if(Yp)return clearTimeout(Bp),Yp;if(clearTimeout(Bp),(Ca=(j=S(this,K))==null?void 0:j.signal)!=null&&Ca.aborted)return this.handlePaymentAuthorizationError({reason:"aborted_before_completion"});if(this.hasSellingPlan&<.enabled(Mo))return U({checkoutUrl:(M=this.cart.checkoutUrl)!=null?M:"",instrumentName:this.name,reason:"subscription_review_required"}),{transactionState:"SUCCESS"};const zp=await Lo({cartId:this.cart.id,token:B,cartClient:this.cartClient,instrumentName:this.name});ye({result:zp,instrument:this.name});const tm=this.actionGenerator.mapCompletionResultToPaymentSheetAction({result:zp,checkoutUrl:zp.data&&"checkoutUrl"in zp.data&&zp.data.checkoutUrl?zp.data.checkoutUrl:this.cart.checkoutUrl,requestType:"completion",shippingCountryCode:J==null?void 0:J.countryCode,billingCountryCode:x==null?void 0:x.countryCode});return this.handlePaymentAuthorizationResult(tm)}catch(Ne){clearTimeout(Bp);const{message:xp}=Ne;return xp!=null&&xp.includes(la)?(this.logTelemetry("Google Pay onPaymentAuthorized timed out",{requestType:"onPaymentAuthorized"}),this.handlePaymentAuthorizationError({status:"timeout",reason:"timeout"})):(!(Ne instanceof _e)&&!((D=(N=S(this,K))==null?void 0:N.signal)!=null&&D.aborted)&&(this.logTelemetry("Google Pay authorization exception",{error:xp}),this.logException(xp)),this.handlePaymentAuthorizationError({reason:"unhandled_exception"}))}}),c(this,"handlePaymentAuthorizationResult",async f=>{var v,E;switch((v=f.effects)==null||v.forEach(_=>_()),f.action){case"complete":return this.emitAuthorizationCompleteMetric("success"),_t(f.redirectUrl),{transactionState:"SUCCESS"};case"show_error":return this.handlePaymentAuthorizationError({error:(E=f.errors)==null?void 0:E[0],reason:"completion_show_error"});case"decelerate":return U({checkoutUrl:f.redirectUrl,instrumentName:this.name,reason:f.reason}),this.emitAuthorizationCompleteMetric("failed"),this.logTelemetry("Google Pay authorization failed",{status:"failed",reason:"completion_decelerate"}),{transactionState:"SUCCESS"};case"abort":default:return this.emitAuthorizationCompleteMetric("failed"),this.logTelemetry("Google Pay authorization failed",{status:"failed",reason:"completion_abort"}),{transactionState:"SUCCESS"}}}),this.walletParams=t,this.isShippingRequired=n,this.hasSellingPlan=r,this.dataSource=a,this.button=o,this.i18n=i,this.cartClient=s,this.initialBuyerCurrency=l,this.cardsinkUrl=u,this.cardsinkCallerIdentificationJwt=p,z(this,Pe,t.customerAccountEmail),z(this,K,d);const m=Vo(this.walletParams);if(m.result==="error")throw b.leaveBreadcrumb("Google Pay Invalid AuthJwt detected on click",{reason:m.reason,walletParams:this.walletParams},"error"),new sa(m.reason);z(this,Zt,m.jwt);const g={environment:this.walletParams.environment,merchantInfo:{...this.walletParams.paymentData.merchantInfo,authJwt:S(this,Zt)},paymentDataCallbacks:{onPaymentDataChanged:this.isShippingRequired?this.onPaymentDataChanged:void 0,onPaymentAuthorized:this.onPaymentAuthorized}};this.paymentsClient=new window.google.payments.api.PaymentsClient(g),this.actionGenerator=new Mh(this.i18n)}get transactionId(){return wn()}async handleClick(){if(!this.isShippingRequired)throw new et("Google Pay checkout started for digital cart");const t=Lh({walletParams:this.walletParams,isShippingRequired:this.isShippingRequired,hasSellingPlan:this.hasSellingPlan,i18n:this.i18n,buyerCurrency:this.initialBuyerCurrency,authJwt:S(this,Zt)});await this.paymentsClient.loadPaymentData(t)}showPaymentDataRequestError({error:t,intent:n="SHIPPING_ADDRESS"}={}){return t?{error:t}:{error:{intent:n,reason:"OTHER_ERROR",message:this.i18n.translate("error_dialogs.wallet.generic_error",{wallet:this.i18n.translate("brand.google_pay")})}}}handlePaymentAuthorizationError({error:t,status:n="failed",reason:r}={}){return this.emitAuthorizationCompleteMetric(n),this.logTelemetry("Google Pay authorization failed",{status:n,userAgent:navigator==null?void 0:navigator.userAgent,...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:n,checkoutUrl:r,requestType:a,shippingCountryCode:o,billingCountryCode:i}){var s,l,d;const u=this.actionGenerator.mapMutationResultToPaymentSheetAction({result:t,checkoutUrl:r,requestType:a,shippingCountryCode:o,billingCountryCode:i});
1switch((s=u.effects)==null||s.forEach(p=>p()),u.action){case"update":{const p=u,{data:m,decelerationReason:g}=t;return m?g?(U({checkoutUrl:m.checkoutUrl,instrumentName:this.name,reason:g}),this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:"",intent:"OFFER"}})):this.isShippingRequired&&m.deliveryGroups.length===0?this.showPaymentDataRequestError({error:{reason:"SHIPPING_ADDRESS_INVALID",message:this.i18n.translate("errors.address_unserviceable",{shopName:this.walletParams.paymentData.merchantInfo.merchantName}),intent:"SHIPPING_ADDRESS"}}):{newTransactionInfo:Pr({cart:m,i18n:this.i18n}),newShippingOptionParameters:this.isShippingRequired?zh({deliveryGroups:m.deliveryGroups,i18n:this.i18n}):void 0,error:(l=p.errors)==null?void 0:l[0]}:this.showPaymentDataRequestError({intent:n})}case"show_error":return{error:(d=u.errors)==null?void 0:d[0]};case"decelerate":return U({checkoutUrl:u.redirectUrl,instrumentName:this.name,reason:u.reason}),this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:"",intent:"OFFER"}});case"abort":return this.showPaymentDataRequestError({intent:n});default:return this.logException("Payment sheet update returned unexpected action (see request tab for details)",{metadata:{request:{action:u.action,intent:n}}}),this.showPaymentDataRequestError({intent:n})}}handleIntermediatePaymentAuthorizationResult({result:t,checkoutUrl:n,requestType:r,shippingCountryCode:a,billingCountryCode:o}){var i,s,l,d,u;if(ye({result:t,instrument:this.name}),t.abortReason==="out_of_stock")return wt(this.i18n),{transactionState:"SUCCESS"};if(t.decelerationReason)return U({checkoutUrl:(s=(i=t.data)==null?void 0:i.checkoutUrl)!=null?s:"",instrumentName:this.name,reason:t.decelerationReason}),{transactionState:"SUCCESS"};const p=this.actionGenerator.mapMutationResultToPaymentSheetAction({result:t,checkoutUrl:n,requestType:r,shippingCountryCode:a,billingCountryCode:o});switch((l=p.effects)==null||l.forEach(m=>m()),p.action){case"show_error":return this.handlePaymentAuthorizationError({error:(d=p.errors)==null?void 0:d[0],reason:"".concat(r,"_show_error")});case"abort":return this.handlePaymentAuthorizationError({error:(u=p.errors)==null?void 0:u.at(0),reason:"".concat(r,"_abort")});case"decelerate":return this.emitAuthorizationCompleteMetric("success"),U({checkoutUrl:p.redirectUrl,instrumentName:this.name,reason:p.reason}),{transactionState:"SUCCESS"};default:return}}handleCurrencyChange(t,n){ln({currentCartTotal:n,initialBuyerCurrency:this.initialBuyerCurrency})&&U({checkoutUrl:t,instrumentName:this.name,reason:"currency_changed"})}async handleShippingAddressChange(t,n){var r,a;let o=await Kt({cartClient:this.cartClient,cartId:t,streetAddress:n?Ir(n):{},instrumentName:y.GooglePay,abortSignal:(r=S(this,K))==null?void 0:r.signal});if(!o.data)return this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"});if(this.cart=o.data,o.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(o.decelerationReason)return U({checkoutUrl:(a=this.cart.checkoutUrl)!=null?a:"",instrumentName:this.name,reason:o.decelerationReason}),this.showPaymentDataRequestError({error:{intent:"SHIPPING_ADDRESS",reason:"OTHER_ERROR",message:""}});const i=this.cart.deliveryGroups.map(({selectedDeliveryOption:s,deliveryOptions:l})=>{var d;return s!=null&&s.handle&&s.deliveryMethodType!=="LOCAL"?s.handle:(d=l.filter(({deliveryMethodType:u})=>u==="SHIPPING")[0])==null?void 0:d.handle}).filter(Boolean);if(i.length>0){if(o=await this.handleDeliveryOptionChange(i),!o.data)return this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"});this.cart=o.data}return this.handleCurrencyChange(this.cart.checkoutUrl,this.cart.totalAmount),this.handlePaymentDataRequestUpdate({result:o,intent:"SHIPPING_ADDRESS",checkoutUrl:this.cart.checkoutUrl,requestType:"onPaymentDataChanged::updateBuyerIdentity",shippingCountryCode:n==null?void 0:n.countryCode})}async handleDeliveryOptionChange(t){var n;const r=xo({deliveryGroups:this.cart.deliveryGroups,instrumentName:y.GooglePay,selectedDeliveryOptionHandles:t});return await Oo({cartClient:this.cartClient,cartId:this.cart.id,instrumentName:y.GooglePay,selectedDeliveryOptions:r,abortSignal:(n=S(this,K))==null?void 0:n.signal})}logTelemetry(t,n={}){h.log({body:t,attributes:{instrument:this.name,...this.transactionId&&{transactionId:this.transactionId},...n}})}logException(t,{severity:n,metadata:r}={}){b.notify(new sa(t),{severity:n!=null?n:"error",metadata:r})}emitAuthorizationCompleteMetric(t){h.authorizationComplete({instrument:this.name,measurement:X(F.AuthorizationLatency,this.name),result:t})}}Pe=new WeakMap,K=new WeakMap,Zt=new WeakMap;function jh(e,t){switch(t){case H.VariantRequiresSellingPlan:case H.SellingPlanNotApplicable:case H.InvalidQuantity:case H.MerchandiseIdInvali
1d:case H.IgnoredResponseError:case H.NoResponse:return e.translate("error_dialogs.checkout.generic_error");default:return e.translate("error_dialogs.checkout.generic_error")}}const qh={LIGHT:"light",DARK:"dark"};class Wh extends St{constructor(){super(...arguments),c(this,"name",y.GooglePay),c(this,"paymentsClient",null),c(this,"button",null),c(this,"handleClick",async()=>{if(this.disabled)return;this.disabled=!0,At(this.name,this.pageType);const t=Lt("AbortController");let n=!1;try{await this.createPaymentsClient(t),n=!0,await this.paymentsClient.handleClick()}catch(r){if(this.disabled=!1,r.statusCode==="CANCELED"){t==null||t.abort("[Google Pay] Payment sheet cancelled"),h.sheetCancelled(y.GooglePay);return}t==null||t.abort("[Google Pay] Payment sheet failure"),this.expectedError(r)?h.sheetClicked({instrument:this.name,result:"failed",reason:"expected_error"}):b.notify(r),n||(h.sheetClicked({instrument:this.name,result:"failed",reason:"unhandled_error"}),h.log({body:"Unhandled error detected in Google Pay client creation",attributes:{error:String(r),location:"handleClick"}}));const a=await this.i18n,o=a.translate("brand.google_pay");at(o,a)}})}static get observedAttributes(){return["disabled"]}attributeChangedCallback(t,n,r){super.attributeChangedCallback(t,n,r,this.button)}async connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}async createPaymentsClient(t){this.paymentsClient=new Vh({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,Th);const{translate:n}=await this.i18n,r=this.isCTA?n("buy_with_button_content",{wallet:n("brand.google_pay")}):n("brand.google_pay"),a=cr({label:r});this.disabled&&a.setAttribute("disabled",""),a.classList.add("button",xt.BUTTON,qh[this.buttonTheme]),a.onclick=this.handleClick,await this.renderButtonContent(a,n),this.button=a,t.appendChild(a),this.ensureLightDOMIsNotEmpty(),this.onRendered()}async renderButtonContent(t,n){const r=Ae({instrumentName:y.GooglePay,logoType:this.buttonTheme}),a=new DOMParser().parseFromString(r,"image/svg+xml").documentElement;if(t.style.font=window.getComputedStyle(this).font,this.isCTA){const o=mn({translate:n,logoElement:a,setAriaHidden:!0});o.classList.add("content"),t.appendChild(o)}else t.classList.add("logo-only"),t.appendChild(a)}expectedError(t){const n=typeof t=="string"?t:t==null?void 0:t.message;return n==="failed to open window"||n==="(0 , $jscomp.asyncExecutePromiseGeneratorProgram) is not a function"}}const Tt=class Fp extends Ct{static walletName(){return"google_pay"}constructor(t){super(t)}getWebComponentName(){return"shopify-google-pay-button"}getInstrumentName(){return y.GooglePay}getWebComponentClass(){return Wh}async loadWalletSDK(){if(Fp.googlePaySDKPromise)return Fp.googlePaySDKPromise;const t=document.createElement("script");t.setAttribute("src",this.walletParams.sdkUrl);const n=new Promise((r,a)=>{t.onload=()=>r(),t.onerror=o=>{t.remove(),a(o)},document.body.appendChild(t)});return Fp.googlePaySDKPromise=Promise.all([n,this.loadLogos()]),Fp.googlePaySDKPromise}getLoadEligibility(){const t=Vo(this.walletParams);switch(t.result){case"success":return{eligible:!0};case"error":return{eligible:!1,reason:t.reason}}}getPartnerSDKEligibility(){return{eligible:!0}}async loadLogos(){return Promise.all([this.loadGooglePayLogo(),this.loadGooglePayLogoDark()])}async loadGooglePayLogo(){await ne({svg:"google-pay-logo.svg",instrumentName:y.GooglePay})}async loadGooglePayLogoDark(){await ne({svg:"google-pay-logo-dark.svg",instrumentName:y.GooglePay,logoType:"DARK"})}};c(Tt,"googlePaySDKPromise");let Vr=Tt;const Yh=[pd,Lr,yn,Vr,Br,$r,$o],Kh=new Map(Yh.map(e=>[e.walletName(),t=>new e(t)]));function fe(e){if(!e)return null;const t=Kh.get(e.name);return t?t(e):(console.debug("Can't build wallet with name ".concat(e.name)),null)}function Qh(e){return e.map(t=>fe(t)).filter(t=>t!=null)}const jo="*{box-sizing:border-box}.wallet-button-fade-in{animation:animation-fade-in .3s cubic-bezier(.1,.79,1,1
1)}@keyframes animation-fade-in{0%{opacity:0}to{opacity:1}}button[aria-disabled=true]{opacity:.5;cursor:not-allowed}";function Xh({styleId:e,styles:t,cssFileName:n}){var r,a;(a=(r=window.Shopify)==null?void 0:r.PaymentButton)!=null&&a.isStorefrontPortableWallets&&(Jh({styleId:e})||Zh({styleId:e,styles:t}))}function Jh({styleId:e}){const t=document.querySelector("style#".concat(e)),n=document.querySelector("link#".concat(e));return!!(t||n)}function Zh({styleId:e,styles:t}){const n=document.createElement("style");n.id=e,n.innerHTML=t,document.head.insertBefore(n,document.head.firstChild)}const tt={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 ca(e){let t=0,n=0,r=0;const a=e.split(/\s+/);for(let o=0;o<a.length;o++){const i=a[o];i!==">"&&(i.includes("#")&&(t+=(i.match(/#/g)||[]).length),i.includes(".")&&(n+=(i.match(/\./g)||[]).length),i.includes("[")&&(n+=(i.match(/\[/g)||[]).length),i.includes(":")&&(n+=(i.match(/:[^:]/g)||[]).length),/^[A-Za-z]/.test(i)&&(r+=1))}return[t,n,r]}function tp(e,t){for(let n=0;n<3;n++)if(e[n]!==t[n])return t[n]-e[n];return 0}function da(e){return[...e].sort((t,n)=>{const r=ca(t.selector),a=ca(n.selector);return tp(r,a)})}const ep=/\.cart__dynamic-checkout-buttons|\.dynamic-checkout-buttons\s*(>\s*)?li(?![a-zA-Z0-9_.:#-])/,rp=/\.cart__dynamic-checkout-buttons|\.dynamic-checkout-buttons\s*\[role="?button"?\](?![:\w-])/,np=/\.additional-checkout-buttons\s*(?:div\s*)?\[role="?button"?\](?![:\w-])/,qo=/\[data-shopify-buttoncontainer\](?![:\w-])/,Wo=/.dynamic-checkout-buttons .shopify-payment-button__button/,ap=/(?!.*\.shopify-cleanslate)\.shopify-payment-button__button(?:--branded)?(?![\w-:.#>])/,op=/\.(shopify-payment-button|shopify-payment-button__button|shopify-payment-button__button--branded)\s*\[role="?button"?\](?![:\w-])/,ip=/(?:only\s+)?(?:screen\s+and\s+)?\((?:min|max)-(?:width|height):\s*\d+px\)/,sp=[rp,qo,ep,np,Wo],lp=[ap,op,Wo],cp=.001;function ua(e){return e.split(",").map(t=>t.trim())}function Yo(e){const t=e.pageType,n=t===T.ProductPage?lp:sp,r=[...document.styleSheets].filter(dp),a=new Set;function o(M){for(const N of n){const D=M.match(N);if(D)return a.add(D[0]),!0}return!1}const i=[],s=[];r.forEach(M=>{try{for(const N of M.cssRules)if(N instanceof CSSMediaRule){const D=N;if(!ip.test(D.conditionText))continue;for(const x of D.cssRules){if(!(x instanceof CSSStyleRule))continue;const J=ua(x.selectorText);for(const B of J)o(B)&&s.push({selector:B,conditionText:D.conditionText,...ya(x)})}}else if(N instanceof CSSStyleRule){const D=N,x=ua(D.selectorText);for(const J of x)o(J)&&i.push({selector:J,...ya(D)})}}catch(N){Fe()("shopify-support-debug")&&(console.debug("[shopify-support-debug] stylesheet origin: ".concat(M.href)),console.debug(N))}});const l=Fe()("shopify-support-debug");l&&console.table(Array.from(a));const d=i.reverse(),u=s.reverse(),p=da(d),m=da(u),g={},f=ha(t)?document.querySelector(".cart__blocks .button"):document.querySelector(".product-form__buttons .button");f&&(g.boxShadow=getComputedStyle(f,":before").boxShadow);for(const M of p){const N=["height","minHeight","borderRadius","marginTop"];ha(t)&&M.selector.match(qo)&&N.push("justifyContent");for(const D of N)g[D]=mp({rule:M,property:D,currentPropertyValue:g[D]})}const{height:v,borderRadius:E,minHeight:_,marginTop:k,justifyContent:j,boxShadow:Ca}=g;return l&&console.table([{property:"height",value:v},{property:"borderRadius",value:E},{property:"minHeight",value:_},{property:"marginTop",value:k},{property:"justifyContent",value:j},{property:"boxShadow",value:Ca}]),t===T.ProductPage?ga({styles:{height:v,minHeight:_,borderRadius:E,marginTop:k,boxShadow:Ca},mediaRules:m,element:e}):ga({styles:{borderRadius:E,boxShadow:Ca,justifyContent:j},mediaRules:m,element:e})}function Ko({element:e,styles:t,debug:n=!1}){if(!t)return;yp(t,e,n);const r="global-".concat(e.tagName.toLowerCase(),"-styles");if(document.head.querySelector("style#".concat(r))==null){const a=document.createElement("style");a.id=r,a.innerHTML=t,document.head.appendChild(a)}}function dp(e){const t=e.ownerNode instanceof HTMLLinkElement&&(e.ownerNode.getAttribute("crossorigin")==="anonymous"||e.ownerNode.getAttribute("crossorigin")==="");return e.href==null||e.href.startsWith(window.location.origin)||t}function ha(e){return e===T.CartPage||e===T.CartAjax}function pa({height:e,minHeight:t}){let n=e,r=t;return(n!=null&&n.includes("var(".concat(tt.buttonBlockSize))||n==="auto")&&(n=null),(r!=null&&r.includes("var(".concat(tt.buttonBlockSize))||r==="auto")&&(r=null),n===r?n:r&&n?"max(".concat(n,",").concat(r,")"):n||r}function ma({existingProperties:e,mediaCondition:t,selector:n,styles:r}){const a={...r};e.forEach(o=>{delete a[o]});for(const[o,i]of Object.entries(a))i!=null&&i.startsWith("var(".concat(o))&&delete a[o];for(const[o,i]of Object.entries(a))(i==null||i==="")&&delete a[o];return Object.keys(a).length===0?"":up({mediaCondition:t,selector:n,styles:a})}function up({mediaCondition:e,selector:t,styles:n}){let r="".concat(e?"@media ".concat(e," { "):"").concat(t," {");
1for(const[a,o]of Object.entries(n))o&&(r+="\n ".concat(a,": ").concat(o,";"));return r+="\n}",e&&(r+="}"),r+="\n",r}function ga({styles:e,element:t,mediaRules:n}){const{height:r,minHeight:a,borderRadius:o,marginTop:i,justifyContent:s,boxShadow:l}=e,d=t.tagName.toLowerCase(),u=getComputedStyle(t),p=new Set;for(const g of Object.values(tt))u.getPropertyValue(g)&&p.add(g);let m=ma({existingProperties:p,selector:d,styles:{[tt.buttonBlockSize]:pa({height:r,minHeight:a}),[tt.buttonBorderRadius]:o,[tt.buttonBoxShadow]:l,[tt.inlineAlignment]:s,"margin-top":i,display:i?"block":void 0}});return n.forEach(g=>{(g.height||g.minHeight||g.borderRadius||g.boxShadow||g.justifyContent||g.marginTop)&&(m+=ma({existingProperties:p,mediaCondition:g.conditionText,selector:d,styles:{[tt.buttonBlockSize]:pa({height:g.height,minHeight:g.minHeight}),[tt.buttonBorderRadius]:g.borderRadius,[tt.buttonBoxShadow]:g.boxShadow,[tt.inlineAlignment]:g.justifyContent,"margin-top":g.marginTop,display:g.marginTop?"block":void 0}}))}),m.trim()}const hp=[["height"],["minHeight","min-height"],["borderRadius","border-radius"],["marginTop","margin-top"],["justifyContent","justify-content"]];function ya(e){return hp.reduce((t,[n,r])=>(t[n]=pp({rule:e,property:r!=null?r:n}),t),{})}function pp({rule:e,property:t}){const n=e.style.getPropertyValue(t);return n!==""&&e.style.getPropertyPriority(t)?"".concat(n," !important"):n||null}function mp({rule:e,property:t,currentPropertyValue:n}){const r=e[t];return!(n!=null&&n.includes("!important"))&&r!=null&&r.includes("!important")?r:n!=null?n:r}function gp(e){const t=/(--[\w-]+)\s*:/g;let n;const r={};for(;(n=t.exec(e))!==null;){const l=n[1];r[l]=(r[l]||0)+1}const a=/@media\s+([^{]+)/g,o=(e.match(a)||[]).length,i=/margin-top\s*:/g,s=(e.match(i)||[]).length;return{properties:r,mediaQueryCount:o,marginTopCount:s}}function yp(e,t,n){var r,a,o;const i=(o=(a=(r=window.ShopifyAnalytics)==null?void 0:r.lib)==null?void 0:a.trekkie)==null?void 0:o.defaultAttributes,s=i==null?void 0:i.themeId;if(s&&(n&&h.log({body:"Style backwards compatibility used",attributes:{themeId:"".concat(s)}}),Math.random()<cp)){const l=gp(e);for(const[d,u]of Object.entries(l.properties))h.styleBackwardsCompatibilityRules({rule:d,count:u,pageType:t.pageType});l.mediaQueryCount>0&&h.styleBackwardsCompatibilityRules({rule:"@media",count:l.mediaQueryCount,pageType:t.pageType}),l.marginTopCount>0&&h.styleBackwardsCompatibilityRules({rule:"margin-top",count:l.marginTopCount,pageType:t.pageType}),h.log({body:"Style backwards compatibility details",attributes:{themeId:"".concat(s),pageType:t.pageType,stylesString:e.length>2e3?e.substring(0,2e3):e}})}}const fp=2e3,bp=()=>fp*Zr();class fa extends Error{constructor(){super(...arguments),c(this,"name","AcceleratedCheckoutError")}}var te;const nr=class Kp extends dn{constructor(){super(...arguments),c(this,"instanceNumber",++Kp.instanceCount),c(this,"pageType",T.ProductPage),c(this,"formObserver"),c(this,"dataSource"),c(this,"wrapper"),c(this,"shopPromiseEligible",!1),c(this,"didInitiateRender",!1),G(this,te)}static get observedAttributes(){return["access-token","disabled","has-selling-plan","requires-shipping"]}async connectedCallback(){var t,n;super.connectedCallback();try{if((n=(t=this.wrapper)==null?void 0:t.children)!=null&&n.length||this.didInitiateRender)return;if(!this.validateRenderingSurface()){this.clearUI();return}this.instanceNumber===1&&(un(this),h.initStarted(),Xh({styleId:"shopify-accelerated-checkout-styles",styles:td,cssFileName:"AcceleratedCheckout.css"}),this.extractStyles()),this.shopPromiseEligible=Ha();const r=re(F.ButtonDisplay,"dc:".concat(this.instanceNumber));this.i18n=lr(),this.setupFormObserver(),this.didInitiateRender=!0;const a=await this.loadWallet(),o=a.getInstrumentName();this.apiClient=new hr({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale}),this.dataSource=new bc(this,this.apiClient,o);const i=await this.getWebComponentInstance({wallet:a,instrumentName:o,dataSource:this.dataSource,i18n:this.i18n,apiClient:this.apiClient,buttonDisplayBenchmark:r});this.render(i,o),h.initCompleted(),this.instanceNumber===1&&this.triggerLoadedEvent()}catch(r){if(this.clearUI(),h.initCompleted(r),r.name===Ie)throw r;b.notify(new fa("An error occurred while attempting to render AcceleratedCheckout: ".concat(r),{cause:r}))}}async attributeChangedCallback(t,n,r){n!==r&&(cn(this,t,r),t==="has-selling-plan"&&r===""?this.showBuyerConsent(this.apiClient,this.i18n):t==="has-selling-plan"&&r===null&&this.hideBuyerConsent())}async getWebComponentInstance({wallet:t,instrumentName:n,dataSource:r,i18n:a,apiClient:o,buttonDisplayBenc
1hmark:i}){const s=await t.createWebComponent({walletContainer:this,dataSource:r,i18n:a,apiClient:o,classNames:wp(n),callToAction:"true",pageType:this.pageType,containerInstanceNumber:this.instanceNumber,supportsSubscriptions:t.supportsSubscriptions,supportsDeferredPurchaseOptions:t.supportsDeferredPurchaseOptions,onRendered:()=>h.instrumentLoaded({instrumentOrComponentName:n,result:"success",measurement:i()})});if(!s)throw new fa("No web component instance found for instrument ".concat(n));return s}async render(t,n){this.clearUI();const r=this.getOrCreateShadowRoot(),a=document.createElement("style");a.innerHTML=jo,r.appendChild(a),this.wrapper=document.createElement("div"),this.wrapper.className="wallet-button-fade-in wallet-button-wrapper";const o=document.createElement("slot");o.name="button",this.wrapper.appendChild(o);const i=document.createElement("slot");i.name="promise",this.wrapper.appendChild(i);const s=document.createElement("slot");s.name="more-options",this.wrapper.appendChild(s),r==null||r.appendChild(this.wrapper),this.hasSellingPlan?this.showBuyerConsent(this.apiClient,this.i18n):this.hideBuyerConsent(),this.setupManagedMarketsHandlers(this.i18n);const l=new DocumentFragment;t&&l.appendChild(t);const d=this.getShopPromiseSlot();d&&l.appendChild(d);const u=this.getMorePaymentOptionsLink(n);u&&l.appendChild(u),this.appendChild(l)}getMorePaymentOptionsLink(t){var n,r;if(t===y.BuyItNow)return null;const a=document.createElement("more-payment-options-link");return Te(a,{"buyer-country":(n=this.buyerCountry)!=null?n:"","access-token":(r=this.accessToken)!=null?r:"","page-type":this.pageType,slot:"more-options"}),a.disabled=this.disabled,a.setDataSource(this.dataSource),a.setI18n(this.i18n),a.setClassNames(Tr.MORE_PAYMENT_OPTION_BUTTON),a}getShopPromiseSlot(){if(!this.shopPromiseEligible)return null;const t=document.createElement("div");return t.setAttribute("data-shopify","shop-promise-payment-button-slot"),t.style.height="100%",t.slot="promise",t}validateRenderingSurface(){return Re({page:"product",element:this})!=null}async loadWallet(){const t=this.recommendedWallet,n=Zc(t,this.fallbackWallet,"AcceleratedCheckout");return await Ep(this,{...n,instanceNumber:this.instanceNumber})}setupFormObserver(){this.formObserver||(this.formObserver=new hn(this,({disabled:t,hasSellingPlan:n})=>{this.disabled=t,this.hasSellingPlan=n,this.isShippingRequired=_p(this,this.variantParams)}),this.formObserver.setupMutationObservers())}getOrCreateShadowRoot(){return S(this,te)||z(this,te,this.attachShadow({mode:"closed"})),S(this,te)}extractStyles(){if(this.styleExtractorDisabled){Fe()("shopify-support-debug")&&console.debug("[shopify-support-debug] styling backward compatibility disabled"),h.styleBackwardsCompatibility({usedBackwardsCompatibility:!1});return}const t=re(F.StyleExtract,"dc:".concat(this.instanceNumber)),n=Yo(this);n&&Ko({element:this,styles:n,debug:this.debug});const r=t();r&&h.styleBackwardsCompatibilityExecutionTime({measurement:r,pageType:this.pageType,stylesWritten:!!n}),h.styleBackwardsCompatibility({usedBackwardsCompatibility:!!n})}};te=new WeakMap,c(nr,"instanceCount",0);let jr=nr;function wp(e){return e===y.BuyItNow?Tr.UNBRANDED_BUTTON:Tr.BRANDED_BUTTON}function _p(e,t){var n;const r=Qa(e);return!!((n=t.find(a=>a.id===Number(r==null?void 0:r.variantId)))!=null&&n.requiresShipping)}async function Ep(e,{recommendedWallet:t,fallbackWallet:n,instanceNumber:r}){const a=t?fe(t):null,o=fe(n),i=async s=>{const l=uo({walletInstrument:s,instanceNumber:r}),d="timeout",u=bp(),p=await Promise.race([l,new Promise(m=>setTimeout(()=>m(d),u))]);if(p===d)h.instrumentSDKLoaded({instrument:s.getInstrumentName(),measurement:u,result:"timeout"});else if(p instanceof Ct)return p;return null};if(Ze(e,a)){const s=await i(a);if(s)return s}if(Ze(e,o)){const s=await i(o);if(s)return s}return fe(Ra)}ut("shopify-accelerated-checkout",jr),ut("more-payment-options-link",Wc,{isChildCustomElement:!0});const Ap=e=>{var t;if(typeof PerformanceObserver>"u"||!((t=PerformanceObserver.supportedEntryTypes)!=null&&t.includes("resource")))return null;const n=new PerformanceObserver(r=>{r.getEntriesByType("resource").some(a=>a.name.includes(de.CartUpdate)||a.name.includes(de.CartChange)||a.name.includes(de.CartAdd)||a.name.includes(de.CartClear))&&e()});return n.observe({entryTypes:["resource"]}),n},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;animation-delay:-.168s;background-color:var(--shopify-accelerated-checkout-skeleton-background-color, #dedede)}.wallet-button-wrapper{width:100%;container-type:inline-size;container-name:wrapper}.wallet-cart-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100px,100%),1fr));justify-content:center;column-gap:10px;row-gap:var(--shopify-accelerated-checkout-row-gap, 8px);margin:0;padding:0}.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);list-style-type:none!important;text-align:center}.wallet-cart-button{width:100%}.wallet-cart-grid.wallet-cart-grid--vertical,.additional-checkout-buttons--vertical .wallet-cart-grid{grid-template-columns:1fr;margin:0;row-gap:var(--shopify-accelerated-checkout-row-gap, 8px)}.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{justify-content:stretch;grid-auto-flow:column;grid-template-columns:none;grid-auto-columns:1fr}.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}
1@container wrapper (210px <= width) 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{grid-column:1 / -1;justify-self:var(--shopify-accelerated-checkout-inline-alignment, center);width:calc((100% - 10px)/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))>.wallet-cart-button-container:last-child:nth-child(2n),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))>.wallet-cart-button-container:last-child:nth-child(2n){grid-column:1 / -1;justify-self:var(--shopify-accelerated-checkout-inline-alignment, center);width:calc((100% - 10px)/2)}.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 (320px <= width) 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 (320px <= width) 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 (430px <= width) 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[
1shop-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,calc((100% - 20px) / 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)):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))){grid-template-columns:repeat(auto-fit,minmax(max(100px,calc((100% - 10px)/2)),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(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,calc((100% - 10px)/2)),1fr))}@container wrapper (320px <= width){: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[
1shop-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{display:none;background:transparent;border:none;cursor:pointer;font-size:.875em;text-decoration:underline;text-align:center;width:100%;padding:var(--shopify-accelerated-checkout-row-gap, 8px) 0 0;color:inherit}::slotted(.wallet-cart-drawer-toggle){background:transparent;border:none;cursor:pointer;font-size:.875em;text-decoration:underline;text-align:center;width:100%;padding:0;color:inherit}.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;animation-delay:-.168s;background-color:var(--shopify-accelerated-checkout-skeleton-background-color, #dedede);height:20px;width:140px;margin:var(--shopify-accelerated-checkout-row-gap, 8px) auto 0;border-radius:4px;text-decoration:none;color:transparent;overflow:hidden}@media screen and (max-width: 750px){.wallet-cart-button-container,.wallet-cart-button{min-width:0}}@supports not (display: grid){.wallet-cart-grid{display:flex;flex-direction:column}.wallet-cart-button-container{width:100%}}.screen-reader-text{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}",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;animation-delay:-.168s;background-color:var(--shopify-accelerated-checkout-skeleton-background-color, #dedede)}.wallet-button-wrapper{width:100%;container-type:inline-size;container-name:wrapper}.wallet-cart-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100px,100%),1fr));justify-content:center;column-gap:10px;row-gap:var(--shopify-accelerated-checkout-row-gap, 8px);margin:0;padding:0}.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);list-style-type:none!important;text-align:center}.wallet-cart-button{width:100%}.wallet-cart-grid.wallet-cart-grid--vertical,.additional-checkout-buttons--vertical .wallet-cart-grid{grid-template-columns:1fr;margin:0;row-gap:var(--shopify-accelerated-checkout-row-gap, 8px)}.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{justify-content:stretch;grid-auto-flow:column;grid-template-columns:none;grid-auto-columns:1fr}.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}
1@container wrapper (210px <= width) 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{grid-column:1 / -1;justify-self:var(--shopify-accelerated-checkout-inline-alignment, center);width:calc((100% - 10px)/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))>.wallet-cart-button-container:last-child:nth-child(2n),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))>.wallet-cart-button-container:last-child:nth-child(2n){grid-column:1 / -1;justify-self:var(--shopify-accelerated-checkout-inline-alignment, center);width:calc((100% - 10px)/2)}.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 (320px <= width) 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 (320px <= width) 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 (430px <= width) 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[
1shop-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,calc((100% - 20px) / 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)):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))){grid-template-columns:repeat(auto-fit,minmax(max(100px,calc((100% - 10px)/2)),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(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,calc((100% - 10px)/2)),1fr))}@container wrapper (320px <= width){: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[
1shop-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{display:none;background:transparent;border:none;cursor:pointer;font-size:.875em;text-decoration:underline;text-align:center;width:100%;padding:var(--shopify-accelerated-checkout-row-gap, 8px) 0 0;color:inherit}::slotted(.wallet-cart-drawer-toggle){background:transparent;border:none;cursor:pointer;font-size:.875em;text-decoration:underline;text-align:center;width:100%;padding:0;color:inherit}.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;animation-delay:-.168s;background-color:var(--shopify-accelerated-checkout-skeleton-background-color, #dedede);height:20px;width:140px;margin:var(--shopify-accelerated-checkout-row-gap, 8px) auto 0;border-radius:4px;text-decoration:none;color:transparent;overflow:hidden}@media screen and (max-width: 750px){.wallet-cart-button-container,.wallet-cart-button{min-width:0}}@supports not (display: grid){.wallet-cart-grid{display:flex;flex-direction:column}.wallet-cart-button-container{width:100%}}.screen-reader-text{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}",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;animation-delay:-.168s;background-color:var(--shopify-accelerated-checkout-skeleton-background-color, #dedede)}.wallet-button-wrapper{container-type:inline-size;container-name:wrapper;width:100%}.wallet-cart-grid{margin:0 -5px -5px;padding:0;display:flex;flex-direction:row;justify-content:var(--shopify-accelerated-checkout-inline-alignment, start)}.wallet-cart-button-container{position:relative;margin:0 5px 5px}.wallet-cart-button-container,.wallet-cart-button{width:auto;flex:1 1 0px;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);list-style-type:none!important;text-align:center}.wallet-cart-grid.wallet-cart-grid--vertical,.additional-checkout-buttons--vertical .wallet-cart-grid{justify-content:flex-start;flex-direction:column;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:nth-of-type(1)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(1)).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:nth-of-type(1)).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:nth-of-type(1)).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))){justify-content:flex-start;flex-direction:column;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))){justify-content:flex-start;flex-direction:column;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))){justify-content:flex-start;flex-direction:column;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))){justify-content:flex-start;flex-direction:column;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)){justify-content:flex-start;flex-direction:column;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 (max-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{justify-content:flex-start;flex-direction:column;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{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}",Pp=".wallet-cart-button__skeleton{animation:acceleratedCheckoutLoadingSkeleton var(--shopify-accelerated-checkout-skeleton-animation-duration, 4s) var(--shopify-accelerated-checkout-skeleton-animation-timing-function, ease) infinite;animation-delay:-.168s;background-color:var(--shopify-accelerated-checkout-skeleton-background-color, #dedede)}.wallet-button-wrapper{container-type:inline-size;container-name:wrapper;width:100%}.wallet-cart-grid{margin:0 -5px -5px;padding:0;display:flex;flex-direction:row;justify-content:var(--shopify-accelerated-checkout-inline-alignment, start)}.wallet-cart-button-container{position:relative;margin:0 5px 5px}.wallet-cart-button-container,.wallet-cart-button{width:auto;flex:1 1 0px;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);list-style-type:none!important;text-align:center}.wallet-cart-grid.wallet-cart-grid--vertical,.additional-checkout-buttons--vertical .wallet-cart-grid{justify-content:flex-start;flex-direction:column;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--hor
1izontal):has(>.wallet-cart-button-container:nth-of-type(1)).wallet-cart-grid:not(:has(>.wallet-cart-button-container:nth-of-type(2))){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid:not(.wallet-cart-grid--horizontal):has(>.wallet-cart-button-container:nth-of-type(1)).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:nth-of-type(1)).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:nth-of-type(1)).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))){justify-content:flex-start;flex-direction:column;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))){justify-content:flex-start;flex-direction:column;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))){justify-content:flex-start;flex-direction:column;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))){justify-content:flex-start;flex-direction:column;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)){justify-content:flex-start;flex-direction:column;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 (max-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{justify-content:flex-start;flex-direction:column;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{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}";function Ip(e){const t=Re({page:"cart",element:e});return Ka({type:"attributes",form:t})}class kp{constructor(t,n,r){this.element=t,this.cartToken=n,this.apiClient=r}async getInitialCart(t){try{const n="gid://shopify/Cart/".concat(this.cartToken),r=Ip(this.element);let a,o=[];if(r.length){const i=await this.apiClient.updateCartAttributes({cartId:n,attributes:r,instrumentName:t,startingCheckout:!0});a=i.data,o=i.errors}else a=await this.apiClient.fetchCart({id:n,instrumentName:t,startingCheckout:!0});return{cart:a,errors:o}}
1catch(n){if(n instanceof pt)return{cart:null,errors:[{code:"NO_RESPONSE"}]};throw n}}}var ee;const ar=class $p extends dn{constructor(){super(),c(this,"instanceNumber",++$p.instanceCount),c(this,"pageType",T.CartPage),c(this,"cartObserver",null),c(this,"dataSource",null),c(this,"wrapper"),c(this,"didInitiateRender",!1),G(this,ee)}static get observedAttributes(){return["access-token","has-selling-plan","requires-shipping","shop-pay-emphasis"]}createDataSource(){if(!this.cartToken){h.cartTokenMissing({reason:"createDataSource"});return}this.apiClient=new hr({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale}),this.dataSource=new kp(this,this.cartToken,this.apiClient)}async createWebComponents({shouldRefetchCartAttributes:t}){if(!this.walletConfigs)throw new rt({code:"invalid-wallet-configs",message:"[AcceleratedCheckoutCart] walletConfigs does not exist"});const n=Yc(this.walletConfigs,"AcceleratedCheckoutCart");if(!(n instanceof Array))throw new rt({code:"invalid-wallet-configs",message:"[AcceleratedCheckoutCart] invalid walletConfigs found"});const r=F.ButtonDisplay,a=i=>"".concat(i,":").concat(this.instanceNumber),o=await Tp(this,{walletConfigs:n,startButtonDisplayBenchmark:i=>oe(r,a(i))});return this.createDataSource(),this.dataSource?(t&&await this.updateAttributes(),await Promise.all(o.map(async i=>{const s=i.getInstrumentName();return await i.createWebComponent({walletContainer:this,dataSource:this.dataSource,i18n:this.i18n,apiClient:this.apiClient,pageType:this.pageType,containerInstanceNumber:this.instanceNumber,slot:"button-".concat(i.getInstrumentName()),supportsSubscriptions:i.supportsSubscriptions,supportsDeferredPurchaseOptions:i.supportsDeferredPurchaseOptions,onRendered:(()=>{let l=!1;return()=>{l||(l=!0,h.instrumentLoaded({instrumentOrComponentName:s,result:"success",measurement:X(r,a(s))}))}})()})}))):[]}async cartChangedCallback(){try{if(!this.dataSource&&this.cartToken){await this.render({shouldRefetchCartAttributes:!0}),h.initCompleted();return}else if(!this.cartToken){h.cartTokenMissing({reason:"cartChangedCallback"});return}await this.updateAttributes()}catch(t){this.clearUI(),b.notify(t)}}async updateAttributes(){var t,n;if(!this.cartToken||!this.apiClient)return;const r=await this.apiClient.fetchLimitedCart({id:"gid://shopify/Cart/".concat(this.cartToken),instrumentName:y.Unknown});this.hasSellingPlan=(t=r.sellingPlan)!=null?t:!1,this.isShippingRequired=(n=r.shippingRequired)!=null?n:!1}async connectedCallback(){super.connectedCallback();try{if(this.didInitiateRender)return;if(this.instanceNumber===1&&un(this),h.initStarted(),this.cartObserver=Ap(()=>this.cartChangedCallback()),!this.cartObserver){h.log({body:"Cart observer unavailable - PerformanceObserver not supported",attributes:{userAgent:navigator.userAgent}}),this.clearUI();return}if(!this.cartToken){h.cartTokenMissing({reason:"connectedCallback"});return}await this.render({shouldRefetchCartAttributes:!1}),h.initCompleted()}catch(t){this.clearUI(),h.initCompleted(t),b.notify(t)}}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.cartObserver)==null||t.disconnect()}async attributeChangedCallback(t,n,r){n!==r&&(cn(this,t,r),t==="has-selling-plan"&&r===""?this.showBuyerConsent(this.apiClient,this.i18n):t==="has-selling-plan"&&r===null&&this.hideBuyerConsent())}get cartToken(){return we("cart")}async render({shouldRefetchCartAttributes:t}){if(this.i18n=lr(),this.hasLegacyCartCookie()){h.legacyCartCookie(),this.clearUI();return}this.didInitiateRender=!0;const n=re(F.ButtonDisplay,"cart:".concat(this.instanceNumber)),r=await this.createWebComponents({shouldRefetchCartAttributes:t});if(this.clearUI(),this.hasSellingPlan?this.showBuyerConsent(this.apiClient,this.i18n):this.hideBuyerConsent(),this.setupManagedMarketsHandlers(this.i18n),r.length===0)return;const a=new DocumentFragment,o=this.getOrCreateShadowRoot(),i=lt.enabled(ra)?Sp:vp,s=document.createElement("style");s.innerHTML=[jo,i].join("\n"),o.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 ".concat(xt.CONTAINER),Object.entries(Dp).forEac
1h(([u,p])=>{document.querySelector(u)&&d.classList.add(p)}),r.forEach(u=>{const p=document.createElement("div"),m=document.createElement("div"),g=document.createElement("slot");g.name="button-".concat(u.name),p.className="wallet-cart-button-container",m.className="wallet-cart-button",p.setAttribute("data-testid","grid-cell"),p.appendChild(m),m.appendChild(g),d.appendChild(p),a.appendChild(u)}),this.wrapper.appendChild(d),o.appendChild(this.wrapper),this.appendChild(a),h.instrumentLoaded({instrumentOrComponentName:"AcceleratedCheckoutCart",result:"success",measurement:n()})}getOrCreateShadowRoot(){return S(this,ee)||z(this,ee,this.attachShadow({mode:"closed"})),S(this,ee)}hasLegacyCartCookie(){var t;return this.cartToken?(t=this.cartToken)==null?void 0:t.match(/^[a-z0-9]+$/):!1}extractStyles(){if(this.styleExtractorDisabled){Fe()("shopify-support-debug")&&console.debug("[shopify-support-debug] styling backward compatibility disabled"),h.styleBackwardsCompatibility({usedBackwardsCompatibility:!1});return}const t=re(F.StyleExtract,"cart:".concat(this.instanceNumber)),n=Yo(this);if(n){Ko({element:this,styles:n,debug:this.debug});const a=this.getOrCreateShadowRoot(),o=lt.enabled(ra),i=document.createElement("style");i.innerHTML=o?Cp:Pp,a.appendChild(i)}const r=t();r&&h.styleBackwardsCompatibilityExecutionTime({measurement:r,pageType:this.pageType,stylesWritten:!!n}),h.styleBackwardsCompatibility({usedBackwardsCompatibility:!!n})}};ee=new WeakMap,c(ar,"instanceCount",0);let qr=ar;async function Tp(e,{walletConfigs:t,startButtonDisplayBenchmark:n=()=>{}}){const r=Qc(e,Qh(t));return(await Promise.all(r.map(a=>(n(a.getInstrumentName()),uo({walletInstrument:a,instanceNumber:e.instanceNumber}))))).filter(a=>a!=null)}const 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"};ut("shopify-accelerated-checkout-cart",qr);class Rp{getInitialCart(){throw new Error('[NoOpDataSource] Unexpected call to "getCart"')}}const or=class Xp extends dn{constructor(){super(...arguments),c(this,"instanceNumber",++Xp.instanceCount),c(this,"pageType",T.Checkout)}get walletConfig(){return this.getAttribute("wallet-config")}async connectedCallback(){var t;super.connectedCallback();try{if(this.i18n=lr(),this.children.length)return;this.instanceNumber===1&&(un(this),h.initStarted());const n=re(F.ButtonDisplay,"dc:".concat(this.instanceNumber)),r=Kc(this.walletConfig,"WalletButton");if(!r)throw new bi("[WalletButton] No config provided.");const a=fe(r);if(!a)return;if(!await this.eligibleToShow(a)){this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"failure",message:"ineligible"}}));return}if(this.onlySdk){h.initCompleted(),this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"success"}}));return}const o=a.getInstrumentName();this.apiClient=new hr({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale});const i=await this.createWebComponent(a,this.i18n,this.apiClient,o,n);this.innerHTML="",this.appendChild(i),h.initCompleted(),this.instanceNumber===1&&this.triggerLoadedEvent()}catch(n){this.innerHTML="",this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"failure",message:(t=n.message)!=null?t:"Error loading wallet SDK"}})),h.initCompleted(n),b.notify(n)}}async createWebComponent(t,n,r,a,o){const i=await t.createWebComponent({walletContainer:this,dataSource:new Rp,i18n:n,apiClient:r,containerInstanceNumber:this.instanceNumber,pageType:this.pageType});return i.onRendered=()=>{this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"success"}})),h.instrumentLoaded({instrumentOrComponentName:a,result:"success",measurement:o()})},i}async eligibleToShow(t){return!(!Ze(this,t)||(await t.loadWalletSDK(),!t.getPartnerSDKEligibility().eligible))}};c(or,"instanceCount",0);let Wr=or;ut("shopify-wallet-button",Wr),di(b,{metadata:{custom:{"notify-origin":"window-onerror"}}}),ui(b,{metadata:{custom:{"notify-origin":"unhandled-promise-rejection-handler"}}}),h.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.