1import.meta;var Xa=Object.defineProperty,Ja=Object.defineProperties,Za=Object.getOwnPropertyDescriptors,bt=Object.getOwnPropertySymbols,Gr=Object.prototype.hasOwnProperty,zr=Object.prototype.propertyIsEnumerable,Kt=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Vr=t=>{throw TypeError(t)},Qt=(t,e,n)=>e in t?Xa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,w=(t,e)=>{for(var n in e||(e={}))Gr.call(e,n)&&Qt(t,n,e[n]);if(bt)for(var n of bt(e))zr.call(e,n)&&Qt(t,n,e[n]);return t},T=(t,e)=>Ja(t,Za(e)),Xt=(t,e)=>{var n={};for(var r in t)Gr.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&bt)for(var r of bt(t))e.indexOf(r)<0&&zr.call(t,r)&&(n[r]=t[r]);return n},c=(t,e,n)=>Qt(t,typeof e!="symbol"?e+"":e,n),qr=(t,e,n)=>e.has(t)||Vr("Cannot "+n),A=(t,e,n)=>(qr(t,e,"read from private field"),n?n.call(t):e.get(t)),O=(t,e,n)=>e.has(t)?Vr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),k=(t,e,n,r)=>(qr(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),te=function(t,e){this[0]=t,this[1]=e},ke=(t,e,n)=>{var r=(o,s,l,d)=>{try{var u=n[o](s),h=(s=u.value)instanceof te,p=u.done;Promise.resolve(h?s[0]:s).then(m=>h?r(o==="return"?o:"next",s[1]?{done:m.done,value:m.value}:m,l,d):l({value:m,done:p})).catch(m=>r("throw",m,l,d))}catch(m){d(m)}},a=o=>i[o]=s=>new Promise((l,d)=>r(o,s,l,d)),i={};return n=n.apply(t,e),i[Kt("asyncIterator")]=()=>i,a("next"),a("throw"),a("return"),i},re=(t,e,n)=>(e=t[Kt("asyncIterator")])?e.call(t):(t=t[Kt("iterator")](),e={},n=(r,a)=>(a=t[r])&&(e[r]=i=>new Promise((o,s,l)=>(i=a.call(t,i),l=i.done,Promise.resolve(i.value).then(d=>o({value:d,done:l}),s)))),n("next"),n("return"),e);const ei=":host{display:flex;align-items:center;justify-content:center}";class ti extends HTMLElement{constructor(){var e,n;super(),c(this,"size"),c(this,"color"),this.size=(e=this.getAttribute("size"))!=null?e:"18px",this.color=(n=this.getAttribute("color"))!=null?n:"gray",this.attachShadow({mode:"open"})}connectedCallback(){this.render();const e=document.createElement("style");e.textContent=ei,this.shadowRoot.appendChild(e)}render(){const e=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 ');e.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 ri="#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}.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 ni(t){return Rn(t).map(e=>e instanceof Error?e:new Nn("[".concat(typeof e,"] ").concat(ai(e).slice(0,10240))))}function Rn(t,e=0){return e>=20?[t,"Truncated cause stack"]:t instanceof Error&&t.cause?[t,...Rn(t.cause,e+1)]:[t]}function ai(t){var e;if(typeof t!="string")try{return(e=JSON.stringify(t))!=null?e:typeof t}catch(n){}return"".concat(t)}
1var Nn=class extends Error{constructor(){super(...arguments),c(this,"name","BugsnagInvalidError")}},Tn=/^\s*at .*(\S+:\d+|\(native\))/m,ii=/^(eval@)?(\[native code])?$/;function oi(t){return t.stack?t.stack.match(Tn)?si(t):li(t):[]}function kn(t){if(t.indexOf(":")===-1)return[t];let e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));return[e[1],e[2]?Number(e[2]):void 0,e[3]?Number(e[3]):void 0]}function si(t){return t.stack.split("\n").filter(e=>!!e.match(Tn)).map(e=>{let n=e.replace(/^\s+/,"").replace(/^.*?\s+/,""),r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],""):n;let a=kn(r?r[1]:n),i=r&&n||void 0,o=["eval","<anonymous>"].indexOf(a[0])>-1?void 0:a[0];return{method:i,file:o,lineNumber:a[1],columnNumber:a[2]}})}function li(t){return t.stack.split("\n").filter(e=>!e.match(ii)).map(e=>{if(e.indexOf("@")===-1&&e.indexOf(":")===-1)return{method:e};let n=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(n),a=r&&r[1]?r[1]:void 0,i=kn(e.replace(n,""));return{method:a,file:i[0],lineNumber:i[1],columnNumber:i[2]}})}var jr="5",ci=class{constructor(t){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");var e,n;this.apiKey=t.apiKey,this.appType=t.appType,this.appId=t.appId,this.appVersion=t.appVersion,this.releaseStage=t.releaseStage,this.locale=t.locale,this.userAgent=t.userAgent,this.metadata=t.metadata,this.onError=t.onError,this.persistedMetadata={},this.endpoints=(e=t.endpoints)!=null?e:{notify:"https://notify.bugsnag.com/",sessions:"https://sessions.bugsnag.com"},this.plugins=(n=t.plugins)!=null?n:[],this.plugins.forEach(r=>r.load(this)),this.leaveBreadcrumb("Bugsnag started",void 0,"state")}addMetadata(t){for(let e of Object.keys(t))this.persistedMetadata[e]=t[e]}leaveBreadcrumb(t,e,n="manual"){this.breadcrumbs.push({name:t,metaData:e,type:n,timestamp:new Date().toISOString()})}notify(t,{errorClass:e,severity:n,severityType:r,handled:a=!0,metadata:i,context:o,groupingHash:s}={}){var l,d;let u=ni(t),h=w(w(w({},this.metadata),this.persistedMetadata),i),p=this.buildBugsnagEvent(u,{errorClass:e,severityType:r,handled:a,severity:n,metadata:h,context:o,groupingHash:s});if(((d=(l=this.onError)==null?void 0:l.call(this,p,t))==null||d)&&this.releaseStage!=="development"){let m=this.sendToBugsnag(p);return this.onPostErrorListeners.forEach(_=>_(p)),m}return Promise.resolve()}addOnPostError(t){this.onPostErrorListeners.push(t)}buildBugsnagEvent(t,{errorClass:e,severity:n="error",severityType:r="handledException",handled:a,metadata:i={},context:o,groupingHash:s}){let l=new Date().toISOString(),{breadcrumbs:d,appId:u,appType:h,appVersion:p,releaseStage:m,locale:_,userAgent:C}=this,E=t.map((P,$)=>({errorClass:$===0&&e!=null?e:P.name,stacktrace:Ln(u,P),message:P.message}));return{payloadVersion:jr,exceptions:E,severity:n,severityReason:{type:r},unhandled:!a,app:{id:u,type:h,version:p,releaseStage:m},device:{time:l,locale:_,userAgent:C},breadcrumbs:d,context:o,metaData:i,groupingHash:s}}async sendToBugsnag(t){let{apiKey:e}=this,n={apiKey:e,notifier:{name:"Bugsnag JavaScript",version:"7.22.2",url:"https://github.com/bugsnag/bugsnag-js"},events:[t]};try{await fetch(this.endpoints.notify,{method:"POST",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":e,"Bugsnag-Payload-Version":jr,"Bugsnag-Sent-At":t.device.time},body:JSON.stringify(n)})}catch(r){console.warn("[bugsnag-light] failed to send an event"),console.warn(r)}}};function Ln(t,e){let n=oi(e).map(r=>{var a,i,o,s;let l=(a=r.file)==null?void 0:a.includes(t);return{method:(i=r.method)!=null?i:"",file:(o=r.file)!=null?o:"",lineNumber:(s=r.lineNumber)!=null?s:0,columnNumber:r.columnNumber,inProject:l}});if(e instanceof Nn){let r=n.findIndex(a=>a.method.endsWith("notify"));r>-1&&(n=n.slice(r+1))}return n}var di=class su extends Error{constructor(e){super(e),c(this,"reason"),this.name="BreadcrumbsPluginFetchError",Object.setPrototypeOf(this,su.prototype)}};function ui(t,{metadata:e}={}){let n=window.onerror;window.onerror=(r,a,i,o,s)=>{s&&t.notify(s,{severityType:"unhandledException",handled:!1,metadata:e}),typeof n=="function"&&n.apply(window.onerror,[r,a,i,o,s])}}function hi(t,{metadata:e}={}){window.addEventListener("unhandledrejection",n=>{n.reason&&!(n.reason instanceof di)&&t.notify(n.reason,{severityType:"unhandledPromiseRejection",handled:!1,metadata:e})})}function lt(t){try{const e=new RegExp("(^| )".concat(t,"=([^;]+)")).exec(document.cookie);if(e){const n=e[2];try{return decodeURIComponent(n)}catch(r){return n}}return null}catch(e){return null}}const ur={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"},pi={DARK:"apple-pay--dark",LIGHT:"apple-pay--light"},mi=44,yi="_shopify_y",xn=6,gi="discount_code",Ar="https://static-na.payments-amazon.com",Cr="".concat(Ar,"/checkout.js"),Mn="https://www.paypal.com",Fn="https://pay.google.com",Ke={CURRENCY_CHANGE:"wallet_currency_change",CAPTCHA_REQUIRED:"wallet_captcha_required",NOT_ENOUGH_STOCK:"wallet_not_enough_stock",CART_NOT_READY:"wallet_cart_not_ready",DYNAMIC_TAX:"wallet_dynamic_tax"},Ct="VALIDATION_CUSTOM",Un="portable-wallets",ve={BUTTON:"accelerated-checkout-button",CONTAINER:"accelerated-checkout-button-container"},Bn="unknown",$n={name:"buy_it_now",wallet_params:{}};function Hn(t){try{return!t.toString().includes("[native code]")}catch(e){return!0}}const Jt=new Map,fi={checkDuplicate({errorClass:t,message:e}){if(Jt.has(t)){const n=Jt.get(t);if(n.has(e))return!0;n.add(e)}else Jt.set(t,new Set([e]));return!1},reset(){}},yt="DeveloperError";
1class ee extends Error{constructor({code:e,message:n},r){const a="An unexpected error happened likely because of customizations made to HTML/JavaScript on this site ".concat(n);super("[".concat(e,"]: ").concat(a),r),c(this,"name",yt),c(this,"code"),this.code=e}}const Gn="SilencedError";class Ot extends Error{constructor(){super(...arguments),c(this,"name",Gn)}}class bi extends Error{constructor(){super(...arguments),c(this,"name","MissingConfigError")}}class ge extends Error{constructor(){super(...arguments),c(this,"name","NoResponseError")}}class Sr extends Error{constructor(e,{errorDetails:n,bugsnagGroupingHash:r}){super(e),c(this,"errorDetails"),c(this,"bugsnagGroupingHash"),this.name="GraphQLResponseError",this.errorDetails=n,this.bugsnagGroupingHash=r}}const zn="IgnoredGraphQLResponseError";class Vn extends Sr{constructor(e,{reason:n,errorDetails:r}){super(e,{errorDetails:r}),c(this,"reason"),this.name=zn,this.reason=n}}function R(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var wi=0;function he(t){return"__private_"+wi+++"_"+t}function xt(t){return Object.entries(t).map(([e,n])=>({key:e,value:{stringValue:String(n)}}))}function _i(t){return Object.entries(t).map(([e,n])=>({key:e,value:qn(n)}))}function qn(t){if(Array.isArray(t))return{arrayValue:{values:t.map(e=>qn(e))}};switch(typeof t){case"boolean":return{boolValue:!!t};case"number":return{doubleValue:Number(t)};case"string":default:return{stringValue:String(t)}}}const Pr=1,Ei=Ai(5,2,12);function Ai(t,e,n){const r=[0];for(let a=0;a<n;a++){const i=Math.floor(t*e**a);r.push(i)}return r}var fe=he("exporter"),X=he("attributes"),V=he("metrics"),be=he("logs");class Ci{constructor({exporter:e,attributes:n}){Object.defineProperty(this,fe,{writable:!0,value:void 0}),Object.defineProperty(this,X,{writable:!0,value:void 0}),Object.defineProperty(this,V,{writable:!0,value:[]}),Object.defineProperty(this,be,{writable:!0,value:[]}),R(this,fe)[fe]=e,R(this,X)[X]=n!=null?n:{}}addAttributes(e){R(this,X)[X]=w(w({},R(this,X)[X]),e)}histogram({name:e,value:n,unit:r,bounds:a,attributes:i,scale:o}){const s=Date.now()*1e6;a?R(this,V)[V].push({name:e,type:"histogram",value:n,unit:r,timeUnixNano:s,attributes:i,bounds:a}):R(this,V)[V].push({name:e,type:"exponential_histogram",value:n,unit:r,timeUnixNano:s,attributes:i,scale:o})}counter({name:e,value:n,unit:r,attributes:a}){const i=Date.now()*1e6;R(this,V)[V].push({name:e,type:"counter",value:n,unit:r,timeUnixNano:i,attributes:a})}gauge({name:e,value:n,unit:r,attributes:a}){const i=Date.now()*1e6;R(this,V)[V].push({name:e,type:"gauge",value:n,unit:r,timeUnixNano:i,attributes:a})}log({body:e,attributes:n}){const r=Date.now()*1e6;R(this,be)[be].push({timeUnixNano:r,body:e,attributes:n})}async exportMetrics(){const e={};R(this,V)[V].forEach(r=>{switch(r.attributes=w(w({},R(this,X)[X]),r.attributes),r.type){case"histogram":Si(e,r);break;case"exponential_histogram":Pi(e,r);break;case"counter":Ii(e,r);break;case"gauge":Di(e,r);break}});const n=Object.values(e);n.length!==0&&(R(this,V)[V]=[],await R(this,fe)[fe].exportMetrics(n))}async exportLogs(){const e=R(this,be)[be].map(n=>{const r={timeUnixNano:n.timeUnixNano,observedTimeUnixNano:n.timeUnixNano,attributes:_i(w(w({},R(this,X)[X]),n.attributes))};return n.body&&(r.body={stringValue:n.body}),r});e.length!==0&&(R(this,be)[be]=[],await R(this,fe)[fe].exportLogs(e))}}function Si(t,e){var n;const{name:r,value:a,unit:i,timeUnixNano:o,attributes:s}=e,l=(n=e.bounds)!==null&&n!==void 0?n:Ei,d=new Array(l.length+1).fill(0);t[r]||(t[r]={name:r,unit:i||"1",histogram:{aggregationTemporality:Pr,dataPoints:[]}});for(let u=0;u<d.length;u++){const h=l[u];if(h===void 0)d[u]=1;else if(a<=h){d[u]=1;break}}t[r].histogram.dataPoints.push({startTimeUnixNano:o,timeUnixNano:o,count:1,sum:a,min:a,max:a,bucketCounts:d,explicitBounds:l,attributes:xt(s!=null?s:{})})}function Pi(t,e){const{name:n,value:r,unit:a,timeUnixNano:i,attributes:o,scale:s}=e;t[n]||(t[n]={name:n,unit:a||"1",exponentialHistogram:{aggregationTemporality:Pr,dataPoints:[]}});const l=r<=0?0:r,d=s||3,u=2**d/Math.log(2),h=Math.ceil(Math.log(r)*u)-1,p=r<=0?1:0,m={offset:0,bucketCounts:[]},_={offset:r>0?h:0,bucketCounts:r>0?[1]:[]};t[n].exponentialHistogram.dataPoints.push({attributes:xt(o!=null?o:{}),startTimeUnixNano:i,timeUnixNano:i,count:1,sum:l,scale:d,zeroCount:p,positive:_,negative:m,min:l,max:l,zeroThreshold:0})}function Ii(t,e){const{name:n,value:r,unit:a,timeUnixNano:i,attributes:o}=e;t[n]||(t[n]={name:n,unit:a||"1",sum:{aggregationTemporality:Pr,isMonotonic:!0,dataPoints:[]}}),t[n].sum.dataPoints.push({startTimeUnixNano:i,timeUnixNano:i,asDouble:r,attributes:xt(o!=null?o:{})})}function Di(t,e){const{name:n,value:r,unit:a,timeUnixNano:i,attributes:o}=e;t[n]||(t[n]={name:n,unit:a||"1",gauge:{dataPoints:[]}}),t[n].gauge.dataPoints.push({startTimeUnixNano:i,timeUnixNano:i,asDouble:r,attributes:xt(o!=null?o:{})})}var Qe=he("url"),we=he("serviceName"),Xe=he("logger"),Je=he("fetchFn");class vi{constructor(e,n,r){Object.defineProperty(this,Qe,{writable:!0,value:void 0}),Object.defineProperty(this,we,{writable:!0,value:void 0}),Object.defineProperty(this,Xe,{writable:!0,value:void 0}),Object.defineProperty(this,Je,{writable:!0,value:void 0}),R(this,Qe)[Qe]=e.replace(/\/v1\/(logs|metrics|traces)\/?$/,""),R(this,we)[we]=n,R(this,Xe)[Xe]=r==null?void 0:r.logger,R(this,Je)[Je]=r==null?void 0:r.fetchFn}async exportMetrics(e){const n={resourceMetrics:[{resource:{attributes:[{key:"service.name",value:{stringValue:R(this,we)[we]}}]},scopeMetrics:[{scope:{name:"open-telemetry-mini-client",version:"1.1.0",attributes:[]},metrics:e}]}]};await this.exportTo(n,"/v1/metrics")}async exportLogs(e){const n={resourceLogs:[{resource:{attributes:[{key:"service.name",value:{stringValue:R(this,we)[we]}}]},scopeLogs:[{scope:{name:"open-telemetry-mini-client",version:"1.1.0",attributes:[]},logRecords:e}]}]};await this.exportTo(n,"/v1/logs")}async exportTo(e,n){var r;const a=await this.exporterFetch()("".concat(R(this,Qe)[Qe]).concat(n),{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if((r=R(this,Xe)[Xe])===null||r===void 0||r.log({status:a.status}),!a.ok){if(a.status===400){const i=await a.text();throw new at("Invalid OpenTelemetry Data: ".concat(i))}if(a.status===429||a.status===503){const i=await a.text(),o=a.headers.get("Retry-After"),s=o?{seconds:Number(o)}:void 0;throw new at("Server did not accept data",{errorData:i,retryAfter:s,body:e})}throw new at("Server responded with ".concat(a.status))}}exporterFetch(){return R(this,Je)[Je]||fetch}}
1class at extends Error{constructor(e,n){super(e),this.metadata=void 0,this.name="OpenTelemetryClientError",this.metadata=n}}const Ri="https://otlp-http-production.shopifysvc.com",Ni="portable_wallets";var Ue;class Ti{constructor(e){O(this,Ue),k(this,Ue,e)}async exportMetrics(e){var n;try{await A(this,Ue).exportMetrics(e)}catch(r){if(r instanceof at){const a=(n=r.metadata)==null?void 0:n.retryAfter;if(a){await new Promise(i=>{setTimeout(()=>{this.exportMetrics(e),i()},a.seconds*1e3)});return}}throw new Wr("Unable to export metrics",{cause:r})}}async exportLogs(e){var n;try{await A(this,Ue).exportLogs(e)}catch(r){if(r instanceof at){const a=(n=r.metadata)==null?void 0:n.retryAfter;if(a){await new Promise(i=>{setTimeout(()=>{this.exportLogs(e),i()},a.seconds*1e3)});return}}throw new Wr("Unable to export logs",{cause:r})}}}Ue=new WeakMap;const ki=new vi(Ri,Ni),Li=new Ti(ki),I=new Ci({exporter:Li}),jn="TelemetryExportError";class Wr extends Error{constructor(){super(...arguments),c(this,"name",jn)}}const Mt="GraphQL Client",Yr=0,Kr=3,Wn="An error occurred while fetching from the API. Review 'graphQLErrors' for details.",Yn="Response returned unexpected Content-Type:",Kn="An unknown error has occurred. The API did not return a data object or any errors in its response.",hr={json:"application/json",multipart:"multipart/mixed"},Qr="X-SDK-Variant",Xr="X-SDK-Version",Oi="shopify-graphql-client",xi="1.3.0",Qn=1e3,Mi=[429,503],Xn=/@(defer)\b/i,Jr="\r\n",Fi=/boundary="?([^=";]+)"?/i,Zr=Jr+Jr;function de(t,e=Mt){return t.startsWith("".concat(e))?t:"".concat(e,": ").concat(t)}function je(t){return t instanceof Error?t.message:JSON.stringify(t)}function Jn(t){return t instanceof Error&&t.cause?t.cause:void 0}function Zn(t){return t.flatMap(({errors:e})=>e!=null?e:[])}function ea({client:t,retries:e}){if(e!==void 0&&(typeof e!="number"||e<Yr||e>Kr))throw new Error("".concat(t,': The provided "retries" value (').concat(e,") is invalid - it cannot be less than ").concat(Yr," or greater than ").concat(Kr))}function z(t,e){return e&&(typeof e!="object"||Array.isArray(e)||typeof e=="object"&&Object.keys(e).length>0)?{[t]:e}:{}}function ta(t,e){if(t.length===0)return e;const n={[t.pop()]:e};return t.length===0?n:ta(t,n)}function ra(t,e){return Object.keys(e||{}).reduce((n,r)=>(typeof e[r]=="object"||Array.isArray(e[r]))&&t[r]?(n[r]=ra(t[r],e[r]),n):(n[r]=e[r],n),Array.isArray(t)?[...t]:w({},t))}function na([t,...e]){return e.reduce(ra,w({},t))}function Ui({clientLogger:t,customFetchApi:e=fetch,client:n=Mt,defaultRetryWaitTime:r=Qn,retriableCodes:a=Mi}){const i=async(o,s,l)=>{const d=s+1,u=l+1;let h;try{if(h=await e(...o),t({type:"HTTP-Response",content:{requestParams:o,response:h}}),!h.ok&&a.includes(h.status)&&d<=u)throw new Error;return h}catch(p){if(d<=u){const m=h==null?void 0:h.headers.get("Retry-After");return await Bi(m?parseInt(m,10):r),t({type:"HTTP-Retry",content:{requestParams:o,lastResponse:h,retryAttempt:s,maxRetries:l}}),i(o,d,l)}throw new Error(de("".concat(l>0?"Attempted maximum number of ".concat(l," network retries. Last message - "):"").concat(je(p)),n))}};return i}async function Bi(t){return new Promise(e=>setTimeout(e,t))}function $i({headers:t,url:e,customFetchApi:n=fetch,retries:r=0,logger:a}){ea({client:Mt,retries:r});const i={headers:t,url:e,retries:r},o=Hi(a),s=Ui({customFetchApi:n,clientLogger:o,defaultRetryWaitTime:Qn}),l=Gi(s,i),d=zi(l),u=Qi(l);return{config:i,fetch:l,request:d,requestStream:u}}function Hi(t){return e=>{t&&t(e)}}async function aa(t){const{errors:e,data:n,extensions:r}=await t.json();return w(T(w(w({},z("data",n)),z("extensions",r)),{headers:t.headers}),e||!n?{errors:T(w({networkStatusCode:t.status,message:de(e?Wn:Kn)},z("graphQLErrors",e)),{response:t})}:{})}function Gi(t,{url:e,headers:n,retries:r}){return async(a,i={})=>{const{variables:o,headers:s,url:l,retries:d,keepalive:u,signal:h}=i,p=JSON.stringify({query:a,variables:o});ea({client:Mt,retries:d});const m=Object.entries(w(w({},n),s)).reduce((C,[E,P])=>(C[E]=Array.isArray(P)?P.join(", "):P.toString(),C),{});!m[Qr]&&!m[Xr]&&(m[Qr]=Oi,m[Xr]=xi);const _=[l!=null?l:e,{method:"POST",headers:m,body:p,signal:h,keepalive:u}];return t(_,1,d!=null?d:r)}}function zi(t){return async(...e)=>{if(Xn.test(e[0]))throw new Error(de("This operation will result in a streamable response - use requestStream() instead."));try{const n=await t(...e),{status:r,statusText:a}=n,i=n.headers.get("content-type")||"";return n.ok?i.includes(hr.json)?aa(n):{errors:{networkStatusCode:r,message:de("".concat(Yn," ").concat(i)),response:n}}:{errors:{networkStatusCode:r,message:de(a),response:n}}}catch(n){return{errors:{message:je(n)}}}}}function Vi(t){return ke(this,null,function*(){const e=new TextDecoder;if(t.body[Symbol.asyncIterator])try{for(var n=re(t.body),r,a,i;r=!(a=yield new te(n.next())).done;r=!1){const o=a.value;yield e.decode(o)}}catch(o){i=[o]}finally{try{r&&(a=n.return)&&(yield new te(a.call(n)))}finally{if(i)throw i[0]}}else{const o=t.body.getReader();let s;try{for(;!(s=yield new te(o.read())).done;)yield e.decode(s.value)}finally{o.cancel()}}})}function qi(t,e){return{[Symbol.asyncIterator](){return ke(this,null,function*(){try{let o="";try{for(var n=re(t),r,a,i;r=!(a=yield new te(n.next())).done;r=!1){const s=a.value;if(o+=s,o.indexOf(e)>-1){const l=o.lastIndexOf(e),d=o.slice(0,l).split(e).filter(u=>u.trim().length>0).map(u=>u.slice(u.indexOf(Zr)+Zr.length).trim());d.length>0&&(yield d),o=o.slice(l+e.length),o.trim()==="--"&&(o="")}}}catch(s){i=[s]}finally{try{r&&(a=n.return)&&(yield new te(a.call(n)))}finally{if(i)throw i[0]}}}catch(o){throw new Error("Error occured while processing stream payload - ".concat(je(o)))}})}}}function ji(t){return{[Symbol.asyncIterator](){return ke(this,null,function*(){const e=yield new te(aa(t));yield T(w({},e),{hasNext:!1})})}}}function Wi(t){return t.map(e=>{try{return JSON.parse(e)}catch(n){throw new Error("Error in parsing multipart response - ".concat(je(n)))}}).map(e=>{const{data:n,incremental:r,hasNext:a,extensions:i,errors:o}=e;if(!r)return T(w(w({data:n||{}},z("errors",o)),z("extensions",i)),{hasNext:a});const s=r.map(({data:l,path:d,errors:u})=>w({data:l&&d?ta(d,l):{}},z("errors",u)));return T(w({data:s.length===1?s[0].data:na([...s.map(({data:l})=>l)])},z("errors",Zn(s))),{hasNext:a})})}function Yi(t,e){if(t.length>0)throw new Error(Wn,{cause:{graphQLErrors:t}});if(Object.keys(e).length===0)throw new Error(Kn)}function Ki(t,e){var n,r;const a=(e!=null?e:"").match(Fi),i="--".concat(a?a[1]:"-");if(!((n=t.body)!=null&&n.getReader)&&!((r=t.body)!=null&&r[Symbol.asyncIterator]))throw new Error("API multipart response did not return an iterable body",{cause:t});const o=Vi(t);let s={},l;return{[Symbol.asyncIterator](){return ke(this,null,function*(){var d,u;
1try{let C=!0;try{for(var h=re(qi(o,i)),p,m,_;p=!(m=yield new te(h.next())).done;p=!1){const E=m.value,P=Wi(E);l=(u=(d=P.find(B=>B.extensions))==null?void 0:d.extensions)!=null?u:l;const $=Zn(P);s=na([s,...P.map(({data:B})=>B)]),C=P.slice(-1)[0].hasNext,Yi($,s),yield T(w(w({},z("data",s)),z("extensions",l)),{hasNext:C})}}catch(E){_=[E]}finally{try{p&&(m=h.return)&&(yield new te(m.call(h)))}finally{if(_)throw _[0]}}if(C)throw new Error("Response stream terminated unexpectedly")}catch(C){const E=Jn(C);yield T(w(w({},z("data",s)),z("extensions",l)),{errors:T(w({message:de(je(C)),networkStatusCode:t.status},z("graphQLErrors",E==null?void 0:E.graphQLErrors)),{response:t}),hasNext:!1})}})}}}function Qi(t){return async(...e)=>{if(!Xn.test(e[0]))throw new Error(de("This operation does not result in a streamable response - use request() instead."));try{const n=await t(...e),{statusText:r}=n;if(!n.ok)throw new Error(r,{cause:n});const a=n.headers.get("content-type")||"";switch(!0){case a.includes(hr.json):return ji(n);case a.includes(hr.multipart):return Ki(n,a);default:throw new Error("".concat(Yn," ").concat(a),{cause:n})}}catch(n){return{[Symbol.asyncIterator](){return ke(this,null,function*(){const r=Jn(n);yield{errors:w(w({message:de(je(n))},z("networkStatusCode",r==null?void 0:r.status)),z("response",r)),hasNext:!1}})}}}}}var y=(t=>(t.InvalidLanguage="Variable $language of type LanguageCode was provided invalid value",t.InvalidCountry="Variable $country of type CountryCode was provided invalid value",t.MissingCartId="Variable $cartId of type ID! was provided invalid value",t.BuyerIdentityInvalidCountry="Variable $buyerIdentity of type CartBuyerIdentityInput! was provided invalid value for countryCode",t.BuyerIdentityInvalidPhone="INVALID: buyerIdentity.phone",t.BuyerIdentityEmailRequired="BUYER_IDENTITY_EMAIL_REQUIRED",t.BuyerIdentityEmailDomainInvalid="BUYER_IDENTITY_EMAIL_DOMAIN_IS_INVALID",t.BuyerIdentityEmailNotExpectedPattern="BUYER_IDENTITY_EMAIL_DOES_NOT_MATCH_EXPECTED_PATTERN",t.BuyerIdentityEmailInvalid="INVALID: buyerIdentity.email",t.CaptchaCompletionRequired="CAPTCHA_COMPLETION_REQUIRED",t.CustomValidation="".concat(Ct),t.DeliveryFirstNameInvalid="DELIVERY_FIRST_NAME_INVALID",t.DeliveryFirstNameRequired="DELIVERY_FIRST_NAME_REQUIRED",t.BuyerIdentityDeliveryFirstNameRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",t.DeliveryFirstNameContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",t.DeliveryFirstNameTooLong="ADDRESS_FIELD_IS_TOO_LONG: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",t.DeliveryFirstNameContainsUrl="ADDRESS_FIELD_CONTAINS_URL: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",t.DeliveryFirstNameContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",t.DeliveryFirstNameDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName",t.DeliveryLastNameInvalid="DELIVERY_LAST_NAME_INVALID",t.DeliveryLastNameRequired="DELIVERY_LAST_NAME_REQUIRED",t.BuyerIdentityDeliveryLastNameRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",t.DeliveryLastNameContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",t.DeliveryLastNameTooLong="ADDRESS_FIELD_IS_TOO_LONG: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",t.DeliveryLastNameContainsUrl="ADDRESS_FIELD_CONTAINS_URL: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",t.DeliveryLastNameContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",t.DeliveryLastNameDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName",t.BuyerIdentityDeliveryAddress1Required="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1",t.DeliveryAddress1Required="DELIVERY_ADDRESS1_REQUIRED",t.DeliveryAddress1Invalid="DELIVERY_ADDRESS1_INVALID",t.DeliveryAddress1TooLong="ADDRESS_FIELD_IS_TOO_LONG: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1",t.DeliveryAddress1ContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1",t.DeliveryAddress1ContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1",t.DeliveryAddress2Required="DELIVERY_ADDRESS2_REQUIRED",t.DeliveryAddress2AddressFieldRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2",t.DeliveryAddress2Invalid="DELIVERY_ADDRESS2_INVALID",t.DeliveryAddress2TooLong="ADDRESS_FIELD_IS_TOO_LONG: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2",t.DeliveryAddress2ContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2",t.DeliveryAddress2ContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2",t.DeliveryCityRequired="DELIVERY_CITY_REQUIRED",t.DeliveryCityAddressFieldRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city",t.DeliveryCityInvali
1d="DELIVERY_CITY_INVALID",t.DeliveryCityTooLong="ADDRESS_FIELD_IS_TOO_LONG: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city",t.DeliveryCityContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city",t.DeliveryCityContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city",t.DeliveryZoneNotFound="DELIVERY_ZONE_NOT_FOUND",t.DeliveryZoneRequiredForCountry="DELIVERY_ZONE_REQUIRED_FOR_COUNTRY",t.DeliveryProvinceRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.province",t.DeliveryPostalCodeInvalid="DELIVERY_POSTAL_CODE_INVALID",t.DeliveryInvalidPostalCodeForZone="DELIVERY_INVALID_POSTAL_CODE_FOR_ZONE",t.DeliveryInvalidPostalCodeForCountry="DELIVERY_INVALID_POSTAL_CODE_FOR_COUNTRY",t.DeliveryPostalCodeRequired="DELIVERY_POSTAL_CODE_REQUIRED",t.DeliveryPostalCodeAddressFieldRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip",t.DeliveryZipInvalidForProvince="INVALID_ZIP_CODE_FOR_PROVINCE",t.BuyerIdentityDeliveryZipInvalidForProvince="INVALID_ZIP_CODE_FOR_PROVINCE: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip",t.DeliveryZipInvalidForCountry="INVALID_ZIP_CODE_FOR_COUNTRY: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip",t.DeliveryPostalCodeContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip",t.DeliveryCountryRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.country",t.DeliveryCountryInvalid="INVALID: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.country",t.DeliveryPhoneNumberRequired="DELIVERY_PHONE_NUMBER_REQUIRED",t.BuyerIdentityDeliveryPhoneNumberRequired="ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.phone",t.DeliveryOptionsPhoneNumberRequired="DELIVERY_OPTIONS_PHONE_NUMBER_REQUIRED",t.DeliveryPhoneNumberInvalid="DELIVERY_PHONE_NUMBER_INVALID",t.DeliveryPhoneDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.phone",t.MerchandiseOutOfStock="MERCHANDISE_OUT_OF_STOCK",t.MerchandiseNotEnoughStock="MERCHANDISE_NOT_ENOUGH_STOCK",t.InvalidQuantity="INVALID: input.lines.0.quantity",t.DeliveryOutOfStockAtOrigin="DELIVERY_OUT_OF_STOCK_AT_ORIGIN_LOCATION",t.DeliveryExternalPromiseUnfulfillable="DELIVERY_EXTERNAL_PROMISE_UNFULFILLABLE",t.MerchandiseNotApplicable="MERCHANDISE_NOT_APPLICABLE",t.MerchandiseVariantNotFound="MERCHANDISE_PRODUCT_VARIANT_NOT_FOUND",t.MerchandiseNotFound="MERCHANDISE_NOT_FOUND",t.MerchandiseNotPublished="MERCHANDISE_PRODUCT_NOT_PUBLISHED",t.MerchandiseNotSupportedForB2B="MERCHANDISE_SELLING_PLANS_NOT_SUPPORTED_FOR_B2B",t.MerchandiseBundleRequiresComponents="MERCHANDISE_BUNDLE_REQUIRES_COMPONENTS",t.MerchandiseGiftCardsNotSupported="MERCHANDISE_GIFT_CARDS_COMPONENTS_NOT_SUPPORTED",t.MerchandiseGiftCardGreaterThanZero="MERCHANDISE_GIFT_CARD_PRICE_MUST_BE_GREATER_THAN_ZERO",t.MerchandiseGiftCardCannotExceedLimit="MERCHANDISE_GIFT_CARD_PRICE_MUST_NOT_EXCEED_LIMIT",t.UnacceptablePaymentsAmount="PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT",t.DiscountNotApplicable="DISCOUNT_NOT_APPLICABLE",t.DeliveryNotAvailable="DELIVERY_NO_DELIVERY_AVAILABLE",t.DeliveryNoStrategyAvailable="DELIVERY_NO_DELIVERY_STRATEGY_AVAILABLE",t.DeliveryNoLocalPickupStrategyAvailable="DELIVERY_LOCAL_PICKUP_NO_DELIVERY_STRATEGY_AVAILABLE",t.DeliveryLineChanged="DELIVERY_DELIVERY_LINE_DETAIL_CHANGED",t.DeliveryLocalPickupLineChanged="DELIVERY_LOCAL_PICKUP_DELIVERY_LINE_DETAIL_CHANGED",t.DeliveryNoDeliveryAvailableForMerchandise="DELIVERY_NO_DELIVERY_STRATEGY_AVAILABLE_FOR_MERCHANDISE_LINE",t.DeliveryFulfillmentConstraintNotSatisfied="DELIVERY_MUST_FULFILL_FROM_CONSTRAINT_NOT_SATISFIED",t.DeliveryFulfillmentLocationConstraint="DELIVERY_MUST_FULFILL_FROM_SAME_LOCATION_CONSTRAINT_NOT_SATISFIED",t.NoDeliveryGroupSelected="NO_DELIVERY_GROUP_SELECTED",t.DeliveryOptionInvalid="INVALID_DELIVERY_OPTION: selectedDeliveryOptions",t.DeliveryGroupInvalid="INVALID_DELIVERY_GROUP: selectedDeliveryOptions",t.DeliveryDetailChanged="DELIVERY_DETAIL_CHANGED",t.PendingDeliveryGroups="PENDING_DELIVERY_GROUPS",t.InvalidPaymentAmount="INVALID_PAYMENT: amount",t.InvalidPaymentPaymentAmount="INVALID_PAYMENT: payment.amount",t.NewTaxMustBeAccepted="TAX_NEW_TAX_MUST_BE_ACCEPTED",t.MerchandiseExpectedPriceMismatch="MERCHANDISE_EXPECTED_PRICE_MISMATCH",t.InvalidPaymentApplePayBillingAddress="INVALID_PAYMENT: payment.walletPaymentMethod.applePayWalletContent.billingAddress",t.InvalidPaymentGooglePayBillingAddress="INVALID_PAYMENT: payment.walletPaymentMethod.googlePayWalletContent.billingAddress",t.InvalidPaymentBillingAddress="INVALID_PAYMENT: payment.freePaymentMethod.billingAddress",t.UnsupportedGooglePayPaymentMethod="PAYMENT_METHOD_NOT_SUPPORTED: payment.walletPaymentMethod.googlePayWalletContent",t.UnsupportedApplePayPaymentMethod="PAYMENT_METHOD_NOT_SUPPORTED: payment.walletPaymentMethod.applePayWalletContent",t))(y||{});const Xi=["DELIVERY_FIRST_NAME_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName"],Ji=["DELIVERY_FIRST_NAME_INVALID","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName"],Zi=["DELIVERY_LAST_NAME_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName"],eo=["DELIVERY_LAST_NAME_INVALID","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName"],to=["DELIVERY_ADDRESS1_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1"],ro=["DELIVERY_ADDRESS2_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2"],no=["DELIVERY_CITY_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city"],ao=["DELIVERY_POSTAL_CODE_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip"],ia=["DELIVERY_POSTAL_CODE_INVALID","INVALID_ZIP_CODE_FOR_COUNTRY: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip","INVALID_ZIP_CODE_FOR_PROVINCE","DELIVERY_INVALID_POSTAL_CODE_FOR_ZONE","DELIVERY_INVALID_POSTAL_CODE_FOR_COUNTRY","INVALID_ZIP_CODE_FOR_PROVINCE: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip"],io=["DELIVERY_PHONE_NUMBER_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.phone"],oo=["INVA
1LID: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.country","Variable $buyerIdentity of type CartBuyerIdentityInput! was provided invalid value for countryCode"],so=["DELIVERY_PHONE_NUMBER_INVALID","INVALID: buyerIdentity.phone","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.phone"],oa=["INVALID_DELIVERY_OPTION: selectedDeliveryOptions","INVALID_DELIVERY_GROUP: selectedDeliveryOptions","DELIVERY_NO_DELIVERY_AVAILABLE","DELIVERY_DETAIL_CHANGED","NO_DELIVERY_GROUP_SELECTED","DELIVERY_NO_DELIVERY_STRATEGY_AVAILABLE","DELIVERY_LOCAL_PICKUP_NO_DELIVERY_STRATEGY_AVAILABLE"],sa=["INVALID_PAYMENT: amount","INVALID_PAYMENT: payment.amount"],Ir=["TAX_NEW_TAX_MUST_BE_ACCEPTED","PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT"],lo=["DELIVERY_DELIVERY_LINE_DETAIL_CHANGED","DELIVERY_LOCAL_PICKUP_DELIVERY_LINE_DETAIL_CHANGED"],co=["INVALID_PAYMENT: payment.freePaymentMethod.billingAddress","INVALID_PAYMENT: payment.walletPaymentMethod.applePayWalletContent.billingAddress"],la=["DELIVERY_NO_DELIVERY_STRATEGY_AVAILABLE_FOR_MERCHANDISE_LINE","DELIVERY_OUT_OF_STOCK_AT_ORIGIN_LOCATION","DELIVERY_MUST_FULFILL_FROM_CONSTRAINT_NOT_SATISFIED","DELIVERY_MUST_FULFILL_FROM_SAME_LOCATION_CONSTRAINT_NOT_SATISFIED","DELIVERY_EXTERNAL_PROMISE_UNFULFILLABLE","MERCHANDISE_OUT_OF_STOCK","MERCHANDISE_PRODUCT_VARIANT_NOT_FOUND","MERCHANDISE_NOT_FOUND","MERCHANDISE_PRODUCT_NOT_PUBLISHED","MERCHANDISE_SELLING_PLANS_NOT_SUPPORTED_FOR_B2B","MERCHANDISE_BUNDLE_REQUIRES_COMPONENTS","MERCHANDISE_GIFT_CARDS_COMPONENTS_NOT_SUPPORTED","MERCHANDISE_GIFT_CARD_PRICE_MUST_BE_GREATER_THAN_ZERO","MERCHANDISE_GIFT_CARD_PRICE_MUST_NOT_EXCEED_LIMIT","INVALID: input.lines.0.quantity","MERCHANDISE_NOT_APPLICABLE"],uo="mutation cartCreate($input:CartInput!$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false)@inContext(country:$country language:$language){result:cartCreate(input:$input){...@defer(if:$withCarrierRates){cart{...CartParts}errors:userErrors{...on CartUserError{message field code}}warnings:warnings{...on CartWarning{code}}}}}",ho="mutation cartAttributesUpdate($cartId:ID!$attributes:[AttributeInput!]!$country:CountryCode=CA$language:LanguageCode=EN$withCarrierRates:Boolean=false$prepareCart:Boolean=false)@inContext(country:$country language:$language){result:cartAttributesUpdate(cartId:$cartId attributes:$attributes){...@defer(if:$withCarrierRates)@skip(if:$prepareCart){cart{...CartParts}errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...@include(if:$prepareCart){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}...PreparedCartFragment}",po="mutation cartBillingAddressUpdate($cartId:ID!$billingAddress:MailingAddressInput$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false$prepareCart:Boolean=false)@inContext(country:$country language:$language){result:cartBillingAddressUpdate(cartId:$cartId billingAddress:$billingAddress){...@defer(if:$withCarrierRates)@skip(if:$prepareCart){cart{...CartParts}errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...@include(if:$prepareCart){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}...PreparedCartFragment}",mo="mutation cartBuyerIdentityUpdate($cartId:ID!$buyerIdentity:CartBuyerIdentityInput!$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false$prepareCart:Boolean=false)@inContext(country:$country language:$language){result:cartBuyerIdentityUpdate(cartId:$cartId buyerIdentity:$buyerIdentity){...@defer(if:$withCarrierRates)@skip(if:$prepareCart){cart{...CartParts}errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...@include(if:$prepareCart){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}...PreparedCartFragment}",yo="mutation cartSelectedDeliveryOptionsUpdate($cartId:ID!$selectedDeliveryOptions:[CartSelectedDeliveryOptionInput!]!$country:CountryCode=CA$language:LanguageCode=EN$withCarrierRates:Boolean=false$prepareCart:Boolean=false)@inContext(country:$country language:$language){result:cartSelectedDeliveryOptionsUpdate(cartId:$cartId selectedDeliveryOptions:$selectedDeliveryOptions){...@defer(if:$withCarrierRates)@skip(if:$prepareCart){cart{...CartParts}errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...@include(if:$prepareCart){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}...PreparedCartFragment}
1",go="mutation applePaySessionCreate($validationUrl:URL!){applePaySessionCreate(validationUrl:$validationUrl){...@defer{applePaySession{body}}}}",fo="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}}}}}}",bo="mutation PayPalTokenCreate($cartId:ID!){paypalTokenCreate(cartId:$cartId){...@defer{paypalToken{token}}}}",wo="query cartQuery($id:ID!$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false)@inContext(country:$country language:$language){cart(id:$id){...@defer(if:$withCarrierRates){...CartParts}}}",_o="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}}}}}}}",Eo="query subscriptionPolicyQuery($country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){shop{subscriptionPolicy(sanitized:true){body}}}",Ao="mutation cartPaymentUpdate($cartId:ID!$input:CartPaymentInput!$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false$prepareCart:Boolean=false)@inContext(country:$country language:$language){result:cartPaymentUpdate(cartId:$cartId payment:$input){...@defer(if:$withCarrierRates)@skip(if:$prepareCart){cart{...CartParts}errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}...@include(if:$prepareCart){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}...PreparedCartFragment}",wt="fragment CartParts on Cart{id checkoutUrl deliveryGroups(first:10 withCarrierRates:$withCarrierRates){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{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}}sellingPlanAllocation{priceAdjustments{price{amount currencyCode}}sellingPlan{billingPolicy{...on SellingPlanRecurringBillingPolicy{interval intervalCount}}priceAdjustments{orderCount}recurringDeliveries}}}}}}",Zt="fragment CartErrorParts on CartUserError{message field code}",en="fragment PreparedCartFragment on Mutation{preparedCart:cartPrepareForCompletion(cartId:$cartId)@include(if:$prepareCart){...@defer{result{__typename ...on CartStatusReady{cart{...CartParts}}...on CartStatusNotReady{cart{...CartParts}errors{code message}}...on CartThrottled{cart{...CartParts}pollAfter}}errors:userErrors{...CartErrorParts}}}}",Co="mutation prepareCart($cartId:ID!$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false$prepareCart:Boolean=true)@inContext(country:$country language:$language){...PreparedCartFragment}",So="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}}}}",Po="mutation cartRemovePersonalData($cartId:ID!){cartRemovePersonalData(cartId:$cartId){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}";async function Io(t,e){var n,r;if(!e.errors)return;const a=ko(e.errors,t),i=await To(e.errors.response),o=((r=(n=e.errors.response)==null?void 0:n.headers)==null?void 0:r.get("content-type"))||void 0,s=[];if(e.errors.graphQLErrors)for(const l of e.errors.graphQLErrors)l.code&&s.push(l.code);return{operationName:t,statusCode:e.errors.networkStatusCode,contentType:o,message:a,responseBody:i,errorCodes:s}}const Do=[/API multipart response did not return an iterable body/],vo=[/signal is aborted/i,/fetch is aborted/i,/operation was aborted/i],Ro=[/timed?.out/i,/error occured while processing stream payload/i,/response stream terminated/i];function No(t){if(t.statusCode&&t.statusCode!==200)return{isIgnorable:!0,reason:"statusCode-".concat(t.statusCode)};if(t.message){if(Ro.some(e=>e.test(t.message)))return{isIgnorable:!0,reason:"timeout"};if(vo.some(e=>e.test(t.message)))return{isIgnorable:!0,reason:"abort"};if(Do.some(e=>e.test(t.message)))return{isIgnorable:!0,reason:"message"}}return{isIgnorable:!1,reason:void 0}}async function To(t){if(!t||t.bodyUsed)return"";try{return(await t.text()).slice(0,1024)}catch(e){return console.error("Failed to read response body:",e),""}}function ko(t,e){var n,r;if(!t)return"";const a=(r=(n=t.graphQLErrors)==null?void 0:n.map(s=>s.message).join(", "))!=null?r:"",i="".concat(t.message).concat(a.length>0?" - ".concat(a):""),o=t.networkStatusCode?"with status ".concat(t.networkStatusCode," => ").concat(i):"=> ".concat(i);return"GraphQL response error for ".concat(e,": ").concat(o)}function Lo(t){const{operationName:e,errorCodes:n}=t,r=n.join("-")||"unknown";return"".concat(e,"-").concat(r)}const tn="UNKNOWN";function Oo({url:t,accessToken:e}){return{headers:{"Content-Type":"application/json",Accept:"application/json","X-Shopify-Storefront-Access-Token":e,"X-SDK-Variant":"portable-wallets"},url:t,retries:0,customFetchApi:(n,r)=>(f.leaveBreadcrumb("Request ".concat((r==null?void 0:r.method)||tn,": ").concat(n),{url:n,method:r==null?void 0:r.method},"request"),fetch(n,r)),logger:n=>
1{if(n.type==="HTTP-Response"){const[r,a]=n.content.requestParams,{status:i,statusText:o,headers:s,type:l}=n.content.response;f.leaveBreadcrumb("Response ".concat((a==null?void 0:a.method)||tn,": ").concat(r),{statusCode:i,statusText:o,responseHeaders:xo(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")}}}}function xo(t){if("fromEntries"in Object)return Object.fromEntries(t);const e={};for(const[n,r]of t.entries())e[n]=r;return e}var b=(t=>(t.BuyItNow="BuyItNow",t.MoreOptions="MoreOptions",t.ApplePay="ApplePay",t.PayPal="PayPal",t.Venmo="Venmo",t.GooglePay="GooglePay",t.ShopPay="ShopPay",t.MetaPay="FacebookPay",t.BuyWithPrime="BuyWithPrime",t.AmazonPay="AmazonPay",t.Unknown="Unknown",t))(b||{}),Ft=(t=>(t.InvalidQuantity="InvalidQuantity",t))(Ft||{}),S=(t=>(t.CartPage="cart_page",t.CartAjax="cart_ajax",t.ProductPage="product",t.Checkout="checkout",t.Unknown="unknown",t))(S||{}),et=(t=>(t.CartChange="/cart/change",t.CartUpdate="/cart/update",t.CartAdd="/cart/add",t.CartClear="/cart/clear",t))(et||{}),De=(t=>(t.OneTimePurchase="ONE_TIME_PURCHASE",t.Subscription="SUBSCRIPTION",t))(De||{});function Mo(t){const e=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<e.length;r++)e[r].remove();n&&n.remove()}function ca(t){!(t instanceof ErrorEvent)||!(typeof t.message=="string"&&t.message.includes("import.meta"))||!(typeof t.filename=="string"&&t.filename.includes("portable-wallets"))||(window.removeEventListener("error",ca),window.Shopify.PaymentButton.failedToLoad=t,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",window.Shopify.PaymentButton.init):window.Shopify.PaymentButton.init())}window.addEventListener("error",ca);function Fo(t,e,n){return(e=Bo(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,r)}return n}function nn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?rn(Object(n),!0).forEach(function(r){Fo(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rn(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Uo(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Bo(t){var e=Uo(t,"string");return typeof e=="symbol"?e:e+""}const $o="https://monorail-edge.shopifysvc.com",Ho="/v1/produce";function Go(){if(typeof crypto<"u"&&crypto&&typeof crypto.randomUUID=="function")return crypto.randomUUID();const t=new Array(36);for(let e=0;e<36;e++)t[e]=Math.floor(Math.random()*16);return t[14]=4,t[19]=t[19]&=-5,t[19]=t[19]|=8,t[8]=t[13]=t[18]=t[23]="-",t.map(e=>e.toString(16)).join("")}function zo(t){const e={"Content-Type":"application/json; charset=utf-8","X-Monorail-Edge-Event-Created-At-Ms":(t&&t.eventCreatedAtMs||Date.now()).toString(),"X-Monorail-Edge-Event-Sent-At-Ms":Date.now().toString(),"X-Monorail-Edge-Client-Message-Id":(t&&t.clientMessageId||Go()).toString()};return t&&t.userAgent&&(e["User-Agent"]=t.userAgent),t&&t.remoteIp&&(e["X-Forwarded-For"]=t.remoteIp),t&&t.deviceInstallId&&(e["X-Monorail-Edge-Device-Install-Id"]=t.deviceInstallId),t&&t.client&&(e["X-Monorail-Edge-Client"]=t.client),t&&t.clientOs&&(e["X-Monorail-Edge-Client-OS"]=t.clientOs),e}async function Vo({endpoint:t,event:e,keepalive:n}){return fetch(t!=null?t:$o+Ho,{method:"post",headers:zo(e.metadata),body:JSON.stringify(nn(nn({schema_id:e.schemaId,payload:e.payload},e.metadata&&{metadata:{client_message_id:e.metadata.clientMessageId,event_created_at_ms:e.metadata.eventCreatedAtMs}}
1),e.consent&&{consent:e.consent,consent_provider:e.consent_provider,consent_version:e.consent_version})),keepalive:n})}const qo="2.1",jo="3",er={NO_VALUE:"",ACCEPTED:"1",DECLINED:"0"},K={PREFERENCES:"p",ANALYTICS:"a",MARKETING:"m",SALE_OF_DATA:"t"},oe={MARKETING:"m",ANALYTICS:"a",PREFERENCES:"p",SALE_OF_DATA:"s"},Wo=()=>typeof __CtaTestEnv__>"u"?!1:__CtaTestEnv__==="true",Yo="_tracking_consent";function da(t,e=!1){const n=document.cookie?document.cookie.split("; "):[];for(let r=0;r<n.length;r++){const[a,i]=n[r].split("=");if(t===decodeURIComponent(a))return decodeURIComponent(i)}if(e&&t==="_tracking_consent"&&!window.localStorage.getItem("tracking_consent_fetched"))return Wo()?void 0:(console.debug("_tracking_consent missing"),Ko(),window.localStorage.setItem("tracking_consent_fetched","true"),da(t,!1))}function Ko(t="/"){const e=new XMLHttpRequest;e.open("HEAD",t,!1),e.withCredentials=!0,e.send()}function Qo(){return da(Yo)}const Xo="_cs";function Jo(){return new URLSearchParams(window.location.search).get(Xo)}function Zo(){const t=Jo()||Qo();if(t!==void 0)return es(t)}function es(t){const e=t.slice(0,1);if(e=="{")return ts(t);if(e=="3")return rs(t)}function ts(t){var e;let n;try{n=JSON.parse(t)}catch(r){return}if(n.v===qo&&(e=n.con)!==null&&e!==void 0&&e.CMP)return n}function rs(t){const e=t.slice(1).split("_"),[n,r,a,i,o]=e;let s;try{s=e[5]?JSON.parse(e.slice(5).join("_")):void 0}catch(h){}let l;if(o){const h=o.replace(/\*/g,"/").replace(/-/g,"+"),p=Array.from(atob(h)).map(m=>m.charCodeAt(0).toString(16).padStart(2,"0")).join("");l=[8,13,18,23].reduce((m,_)=>m.slice(0,_)+"-"+m.slice(_),p)}function d(h){const p=n.split(".")[0];return p.includes(h.toLowerCase())?er.DECLINED:p.includes(h.toUpperCase())?er.ACCEPTED:er.NO_VALUE}function u(h){return n.includes(h.replace("t","s").toUpperCase())}return{v:jo,con:{CMP:{[oe.ANALYTICS]:d(oe.ANALYTICS),[oe.PREFERENCES]:d(oe.PREFERENCES),[oe.MARKETING]:d(oe.MARKETING),[oe.SALE_OF_DATA]:d(oe.SALE_OF_DATA)}},region:r||"",cus:s,purposes:{[K.ANALYTICS]:u(K.ANALYTICS),[K.PREFERENCES]:u(K.PREFERENCES),[K.MARKETING]:u(K.MARKETING),[K.SALE_OF_DATA]:u(K.SALE_OF_DATA)},sale_of_data_region:i=="t",display_banner:a=="t",consent_id:l}}function Ut(t){const e=Zo();if(!e||!e.purposes)return!0;const n=e.purposes[t];return typeof n=="boolean"?n:!0}function ns(){return Ut(K.PREFERENCES)}function as(){return Ut(K.ANALYTICS)}function is(){return Ut(K.MARKETING)}function os(){return Ut(K.SALE_OF_DATA)}function ss(){return as()}function ls(){return ns()}function cs(){return is()}function ds(){return os()}function us(){return cs()}function hs(){return ss()}function ps(){return ls()}function ms(){return ds()}function ys(){const t=[];return hs()&&t.push("analytics"),us()&&t.push("marketing"),ms()&&t.push("sale_of_data"),ps()&&t.push("preferences"),t}function gs(t,e){switch(e){case"v1":{const n=ys();return T(w({},t),{metadata:T(w({},t==null?void 0:t.metadata),{consent:n,consent_provider:"consent-tracking-api",consent_version:e})})}default:throw new Dr(e)}}class Dr extends Error{constructor(e){super("Version ".concat(e," is not supported by the consent-tracking-api provider")),this.name="MonorailConsentTrackingApiProviderVersionError",Object.setPrototypeOf(this,Dr.prototype)}}var v=(t=>(t.ButtonRender="portable_wallets_button_render",t.Decelerated="portable_wallets_decelerated",t.InitCompleted="portable_wallets_init_completed",t.InstrumentLoadEligibility="portable_wallets_instrument_load_eligibility",t.InstrumentLoadTime="portable_wallets_instrument_load_time",t.InstrumentLoadTimeFromPageLoad="portable_wallets_instrument_load_time_from_page_load",t.MonorailProduceError="portable_wallets_monorail_produce_error",t.SheetClicked="portable_wallets_sheet_clicked",t.SheetCancelled="portable_wallets_sheet_cancelled",t.SheetFailed="portable_wallets_sheet_failed",t.UpdateFailed="portable_wallets_update_failed",t.AuthorizationAttempt="portable_wallets_authorization_attempt",t.AuthorizationComplete="portable_wallets_authorization_complete",t.CartTokenMissing="portable_wallets_cart_token_missing",t.RemovePersonalDataResult="portable_wallets_cart_remove_personal_data_result",t.GooglePayNotEligibleWebview="portable_wallets_google_pay_not_eligible_webview",t.WalletConfigDeveloperError="portable_wallets_wallet_config_developer_error",t.LegacyCartCookie="portable_wallets_legacy_cart_cookie",t.StyleBackwardsCompatibility="portable_wallets_style_backwards_compatibility",t.AmazonPayLoadRetries="portable_wallets_amazon_pay_sdk_load_retries",t.DynamicTaxFailed="portable_wallets_dynamic_tax_failed",t.DynamicShippingFailed="portable_wallets_dynamic_
1shipping_failed",t.SheetLoaded="portable_wallets_sheet_loaded",t.ErrorTriggered="portable_wallets_error_triggered",t.AmazonAdExperimentAcceleratedCheckoutButtonClicked="portable_wallets_amazon_ad_experiment_accelerated_checkout_button_clicked",t.AmazonAdExperimentAcceleratedCheckoutButtonSetup="portable_wallets_amazon_ad_experiment_accelerated_checkout_button_setup",t))(v||{}),Pe=(t=>(t.InstrumentSdkLoaded="portable_wallets_instrument_sdk_loaded",t.InstrumentSdkFailed="portable_wallets_instrument_sdk_failed",t.InstrumentSdkEligible="portable_wallets_instrument_sdk_eligible",t.InstrumentSdkNotEligible="portable_wallets_instrument_sdk_not_eligible",t))(Pe||{});const fs=["Chrome-Lighthouse"];function bs(){const t=navigator.userAgent;return fs.some(e=>t.includes(e))}async function ws(t){if(bs())return;const e=gs(t,"v1");let n;try{n=await Vo({event:e})}catch(r){}if(!(n!=null&&n.ok))try{I.counter({name:v.MonorailProduceError,value:1,attributes:{schemaId:e.schemaId}})}catch(r){}}const tr="shopify_wallet_checkout_track/6.2";async function j(t){var e,n,r,a,i,o,s;const l=await _s();if(!l)return;const d={schemaId:tr,payload:{app_name:"storefront",page_type:tl(),checkout_one:!0,event:t.event,event_subtype:t.eventSubtype,checkout_token:t.checkoutToken,instrument_id:t.instrumentId,ttl:t.ttl,error_reason:t.errorReason,uniq_token:(e=l==null?void 0:l.uniqToken)!=null?e:"",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:(i=l==null?void 0:l.shopId)!=null?i:0,theme_id:l==null?void 0:l.themeId,theme_city_hash:(o=l==null?void 0:l.themeCityHash)!=null?o:"",content_language:(s=l==null?void 0:l.contentLanguage)!=null?s:"",referer:l==null?void 0:l.referer}};f.leaveBreadcrumb("monorail event produced to ".concat(tr),{schemaId:tr,payload:t});try{await ws(d)}catch(u){f.notify(new Es("Failed to send monorail event: ".concat(u),{cause:u}),{metadata:{request:{monorail:{payload:JSON.stringify(d)}}}})}}async function _s(){var t,e,n,r,a;return(e=(t=window==null?void 0:window.ShopifyAnalytics)==null?void 0:t.lib)!=null&&e.trekkie||await new Promise(i=>{const o=setInterval(()=>{var l,d;(d=(l=window==null?void 0:window.ShopifyAnalytics)==null?void 0:l.lib)!=null&&d.trekkie&&(clearInterval(o),i())},100),s=setTimeout(()=>{clearInterval(o),clearTimeout(s),i()},7e3)}),(a=(r=(n=window.ShopifyAnalytics)==null?void 0:n.lib)==null?void 0:r.trekkie)==null?void 0:a.defaultAttributes}
1class Es extends Error{constructor(){super(...arguments),c(this,"name","MonorailError")}}var H=(t=>(t.CartInitCalled="portable_wallets_cart_init_called",t.ClickSheetCancelled="portable_wallets_instrument_click_sheet_cancelled",t.ClickSheetFailed="portable_wallets_instrument_click_sheet_failure",t.ClickSheetSuccess="portable_wallets_instrument_click_sheet_success",t.SheetFailed="portable_wallets_instrument_sheet_failed",t.AuthorizationAttempt="portable_wallets_authorization_attempt",t.AuthorizationComplete="portable_wallets_authorization_complete",t.InitCalled="portable_wallets_init_called",t.InitFailed="portable_wallets_init_failed",t.InitSuccess="portable_wallets_init_success",t.UpdateFailed="portable_wallets_instrument_update_failed",t.InstrumentLoaded="portable_wallets_instrument_loaded",t.InstrumentLoadFailed="portable_wallets_instrument_load_failed",t.FirstVisible="portable_wallets_first_visible",t.FirstVisibleNotAvailable="portable_wallets_first_visible_not_available",t))(H||{});const an={[S.Checkout]:"bwp_checkout_widget_click",[S.CartAjax]:"bwp_cart_widget_click",[S.CartPage]:"bwp_cart_widget_click",[S.ProductPage]:"bwp_widget_click",[S.Unknown]:"bwp_widget_click"};function As({apiClientId:t,skus:e,pageType:n}){var r;if(!((r=window.Shopify)!=null&&r.analytics))return;const a=n&&an[n]||"bwp_widget_click";a===an[S.Checkout]&&window.Shopify.analytics.publish("shopify:app:pixels:load:".concat(t),{},{sendTo:"PIXEL-LOADER"}),e&&window.Shopify.analytics.publish(a,{skus:e},{sendTo:t})}let Bt=Cs();function Cs(){return{shopId:Bn,debug:!1,pageType:S.Unknown}}function Ss(t){Object.assign(Bt,t)}function vr(){const t=Bt,{debug:e}=t;return Xt(t,["debug"])}function Ps(){return Bt.debug}function ua(){return Bt.pageType}function U(t){return w({pageType:ua()},t)}function Is(){const t=ua()===S.CartPage?H.CartInitCalled:H.InitCalled;j({event:t})}function Ds(t){var e,n;const r=t?"Failed":"Success",a=t&&js(t)?"[".concat(t.name,"]: ").concat(t.code):void 0,i=H["Init".concat(r)];j({event:i,eventSubtype:a}),I.counter({name:v.InitCompleted,value:1,attributes:U({result:r.toLowerCase(),eventType:a,recoveredFailure:!!((n=(e=window.Shopify)==null?void 0:e.PaymentButton)!=null&&n.failedToLoad)})})}function vs({instrumentOrComponentName:t,result:e,measurement:n}){j({event:e==="success"?H.InstrumentLoaded:H.InstrumentLoadFailed,instrumentId:t,ttl:n}),n!=null&&(I.histogram({name:v.InstrumentLoadTime,value:n,attributes:U({instrument:t}),unit:"ms"}),I.histogram({name:v.InstrumentLoadTimeFromPageLoad,value:window.performance.now(),attributes:U({instrument:t}),unit:"ms"}))}function Rs({instrument:t,measurement:e,result:n}){const r=n==="success"?Pe.InstrumentSdkLoaded:Pe.InstrumentSdkFailed;j({event:r,instrumentId:t,ttl:e,errorReason:n==="success"?void 0:n}),e!=null&&I.histogram({name:Pe.InstrumentSdkLoaded,value:e,attributes:U({instrument:t,result:n}),unit:"ms"})}function Ns({instrument:t,result:e,reason:n}){const r=e==="success"?Pe.InstrumentSdkEligible:Pe.InstrumentSdkNotEligible;j({event:r,instrumentId:t}),I.counter({name:Pe.InstrumentSdkEligible,value:1,attributes:U({instrument:t,reason:n,result:e})})}function Ts({instrument:t,result:e,reason:n}){I.counter({name:v.InstrumentLoadEligibility,value:1,attributes:U({instrument:t,result:e,reason:n})})}function ks(t){I.counter({name:v.ButtonRender,value:1,attributes:U({result:"success",instrument:t})})}function Ls(t){I.counter({name:v.ButtonRender,value:1,attributes:U({result:"failed",instrument:t})})}function Os({instrument:t,result:e,webPixelMetaData:n}){j({event:e==="success"?H.ClickSheetSuccess:H.ClickSheetFailed,instrumentId:t}),I.counter({name:v.SheetClicked,value:1,attributes:U({instrument:t,result:e})}),t===b.BuyWithPrime&&n&&As(n)}function xs(t,e){j({event:"".concat(H.UpdateFailed,"-").concat(e),instrumentId:t}),I.counter({name:v.UpdateFailed,value:1,attributes:U({instrument:t,request:e})})}function Ms(t){j({event:H.ClickSheetCancelled,instrumentId:t}),I.counter({name:v.SheetCancelled,value:1,attributes:U({instrument:t})})}function Fs(t,e){j({event:H.SheetFailed,instrumentId:t,errorReason:e==null?void 0:e.message}),I.counter({name:v.SheetFailed,value:1,attributes:U({instrument:t})})}function Us(t){j({event:H.AuthorizationAttempt,instrumentId:t}),I.counter({name:v.AuthorizationAttempt,value:1,attributes:U({instrument:t})})}function Bs({instrument:t,measurement:e,result:n}){j({event:H.AuthorizationComplete,eventSubtype:n,ttl:e,instrumentId:t}),e!=null&&I.histogram({name:v.AuthorizationComplete,value:e,attributes:U({instrument:t,result:n}),unit:"ms"})}function $s({instrument:t,reason:e}){I.counter({name:v.Decelerated,value:1,attributes:U({instrument:t,reason:e})}),g.flushTelemetry()}function Hs({reason:t}){I.counter({name:v.CartTokenMissing,value:1,attributes:{reason:t}})}function Gs({success:t}){I.counter({name:v.RemovePersonalDataResult,value:1,attributes:U({success:t})})}function zs(){I.counter({name:v.WalletConfigDeveloperError,value:1})}function Vs(){I.counter({name:v.LegacyCartCookie,value:1})}function qs(){window.setInterval(()=>{ha()},1e3)}function js(t){return(t==null?void 0:t.name)===yt}function ha(){I.exportMetrics(),I.exportLogs()}function Ws(t){const{body:e,attributes:n}=t;I.log({body:e,attributes:w(w({},vr()),n)})}function Ys({usedBackwardsCompatibility:t}){I.counter({name:v.StyleBackwardsCompatibility,value:1,attributes:{usedBackwardsCompatibility:t}})}function Ks({retries:t}){I.counter({name:v.AmazonPayLoadRetries,value:1,attributes:{retries:t}})}function Qs({instrument:t}){I.counter({name:v.DynamicTaxFailed,value:1,attributes:{instrument:t}}),g.log({body:"Dynamic tax failed",attributes:{instrument:t}})}function Xs({instrument:t}){I.counter({name:v.DynamicShippingFailed,value:1,attributes:{instrument:t}}),g.log({body:"Dynamic shipping failed",attributes:{instrument:t}})}function Js({instrument:t,measurement:e}){I.histogram({name:v.SheetLoaded,value:e,attributes:U({instrument:t}),unit:"ms"})}function Zs({instrument:t,result:e}){I.counter({name:v.AmazonAdExperimentAcceleratedCheckoutButtonClicked,value:1,attributes:U({instrument:t,result:e})})}function el({instrument:t,result:e}){I.counter({name:v.AmazonAdExperimentAcceleratedCheckoutButtonSetup,value:1,attributes:U({instrument:t,result:e})})}const g={initStarted:D(Is),initCompleted:D(Ds),instrumentLoaded:D(vs),instrumentLoadEligibility:D(Ts),instrumentSDKLoaded:D(Rs),instrumentSDKEligible:D(Ns),renderSucceeded:D(ks),renderFailed:D(Ls),sheetClicked:D(Os),sheetCancelled:D(Ms),sheetFailed:D(Fs),updateFailed:D(xs),authorizationAttempt:D(Us),authorizationComplete:D(Bs),startExporter:D(qs),decelerated:D($s),cartTokenMissing:D(Hs),removePersonalDataResult:D(Gs),walletConfigDeveloperError:D(zs),legacyCartCookie:D(Vs),flushTelemetry:D(ha),styleBackwardsCompatibility:D(Ys),amazonPaySDKLoadRetries:D(Ks),dynamicTaxFailed:D(Qs),dynamicShippingFailed:D(Xs),sheetLoaded:D(Js),amazonAdExperimentAcceleratedCheckoutButtonClicked:D(Zs),amazonAdExperimentAcceleratedCheckoutButtonSetup:D(el),log:D(Ws,{logErrors:!1})};function D(t,{logErrors:e=!0}={}){return(...n)=>{try{t(...n)}catch(r){e&&g.log({body:"Error calling telemetry function",attributes:{error:"".concat(r)}})}}}const tt=[];function pe(t,e,n){if(window.customElements!=null)try{const r=e;window.customElements.get(t)||(window.customElements.define(t,r),n!=null&&n.isChildCustomElement&&tt.push(t))}catch(r){f.notify(r),Mo()}}function St(){const t=new URLSearchParams(window.location.search);return function(e){return!!t.get(e)}}function tl(){var t,e,n,r;const a=(t=window.Shopify)==null?void 0:t.CartType;if(a===S.CartAjax)return S.CartAjax;if(a===S.CartPage)return S.CartPage;const i=(r=(n=(e=window.ShopifyAnalytics)==null?void 0:e.meta)==null?void 0:n.page)==null?void 0:r.pageType;if(i)switch(i.toLowerCase()){case"product":return S.ProductPage;case"cart":return S.CartPage}const o=document.querySelector("#shop-js-analytics");if(o)try{const s=JSON.parse(o.textContent||"{}");
1if(s.pageType)switch(s.pageType.toLowerCase()){case"product":return S.ProductPage;case"cart":return S.CartPage}}catch(s){console.error("Error parsing JSON script tag:",s)}return S.Unknown}function Ie(t){return Number(t).toFixed(2)}function pa(t){if(!(!t||!t.id||!t.id.includes("gid://shopify/Cart/")))return t.id.replace("gid://shopify/Cart/","").split("?")[0]}function se(){let t;return[new Promise(e=>t=e),t]}const rl={force_shop_pay_product:"direct_checkout_product",force_shop_pay_cart:"direct_checkout_cart"};function ue(t,e="no_redirect_for_checkout"){g.flushTelemetry();const n=new URL(t);switch(e){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=rl[e];r&&n.searchParams.set("redirect_source",r);break}}window.location.assign(n.toString())}function ma(){return!!document.querySelector('[data-source-attribution="shopify.shop-promise-pdp"]')}function rt(){return new Date().getTime()}function Rr(t){return t.find(e=>typeof e=="object"&&(e==null?void 0:e.code)===Ct)}const nl={currency_changed:Ke.CURRENCY_CHANGE,captcha_required:Ke.CAPTCHA_REQUIRED,not_enough_stock:Ke.NOT_ENOUGH_STOCK,cart_not_ready:Ke.CART_NOT_READY,dynamic_tax:Ke.DYNAMIC_TAX,cart_throttled:null,out_of_stock:null};function At({warnings:t,cartStatus:e}){if(e==="CartStatusNotReady")return"cart_not_ready";if(e==="CartThrottled")return"cart_throttled";if(!(!t||t.length===0)){if(t.includes("MERCHANDISE_OUT_OF_STOCK"))return"out_of_stock";if(t.includes("MERCHANDISE_NOT_ENOUGH_STOCK"))return"not_enough_stock"}}function Nr({currentCartTotal:t,initialBuyerCurrency:e}){const n=t.amount;return!(!n||Number(n)===0||e.toUpperCase()===t.currencyCode.toUpperCase())}function M({checkoutUrl:t,instrumentName:e,reason:n}){if(!t)throw new Error("Invalid Checkout URL");const r=new URL(t),a=nl[n];a&&r.searchParams.set(a,"true"),g.decelerated({instrument:e,reason:n}),ue(r.toString())}const al="unstable",on="RESTRICTED_WALLET_ACCOUNT";class $t{constructor({accessToken:e,country:n,locale:r,apiVersion:a=al,withCarrierRates:i=!1,cartPrepareMigrationEnabled:o=!1}){if(c(this,"OPERATION_NAME_REGEX",/[^ ]+ (\w+)/),c(this,"client"),c(this,"country"),c(this,"url"),c(this,"locale"),c(this,"withCarrierRates"),c(this,"lastValidCart"),c(this,"cartPrepareMigrationEnabled"),!e||!n)throw new ee({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.withCarrierRates=i,this.cartPrepareMigrationEnabled=o,this.url="/api/".concat(a,"/graphql.json"),this.client=$i(Oo({url:this.url,accessToken:e}))}async createCart(e){var n,r,a;const i=await this.requestStream([uo,wt],{input:{lines:[{merchandiseId:e.merchandiseId,quantity:e.quantity,sellingPlanId:e.sellingPlanId,attributes:e.lineItemProperties}],discountCodes:e.discountCodes,buyerIdentity:e.buyerIdentity},country:this.country,language:this.formatLanguage(this.locale)},{instrumentName:e.instrumentName,startingCheckout:!0,operationName:"createCart"});try{for(var o=re(i),s,l,d;s=!(l=await o.next()).done;s=!1){const u=l.value;u.errors&&await this.onError("createCart",u);const h=(n=u.data)==null?void 0:n.result;if(h&&!u.hasNext){h.errors&&this.onResultError(h.errors);const p=this.parseMutationWarnings((a=(r=u.data)==null?void 0:r.result)==null?void 0:a.warnings);return{data:h.cart?this.parseCartResponse(h.cart):null,errors:this.parseMutationErrors(u,"result"),warnings:p,decelerationReason:At({warnings:p})}}}}catch(u){d=[u]}finally{try{s&&(l=o.return)&&await l.call(o)}finally{if(d)throw d[0]}}throw new ge("Cart create operation returned no response")}async updateCartBillingAddress(e){const{cartId:n,billingAddress:r,instrumentName:a}=e;return this.requestDeferredCart(po,{cartId:n,billingAddress:r},{instrumentName:a,operationName:"updateCartBillingAddress"})}
1async updateCartBuyerIdentity(e,n){const{cartId:r,instrumentName:a}=e;return this.requestDeferredCart(mo,{cartId:r,buyerIdentity:ol(e)},{instrumentName:a,operationName:"updateCartBuyerIdentity",abortSignal:n})}async updateSelectedDeliveryOptions(e,n,r,a){let i=n;const o=rt()+2e4;for(;rt()<o;){const s=await this.requestDeferredCart(yo,{cartId:e,selectedDeliveryOptions:i},{instrumentName:r,operationName:"updateSelectedDeliveryOptions",abortSignal:a});if(!(!this.cartPrepareMigrationEnabled&&s.errors.some(d=>typeof d=="string"&&d.startsWith(y.PendingDeliveryGroups))))return s;const l=s.data.deliveryGroups.flatMap(d=>d.deliveryOptions.map(u=>({deliveryOptionHandle:u.handle,deliveryGroupId:d.id})));i=i.map(d=>{var u;return(u=l.find(h=>h.deliveryOptionHandle===d.deliveryOptionHandle))!=null?u:d})}throw new Error("Selected delivery options update operation timed out")}async applePaySessionCreate(e){var n,r,a;const i=await this.requestStream([go],{validationUrl:e.toString()},{instrumentName:b.ApplePay,operationName:"applePaySessionCreate"});try{for(var o=re(i),s,l,d;s=!(l=await o.next()).done;s=!1){const u=l.value;u.errors&&await this.onError("applePaySessionCreate",u);const h=(a=(r=(n=u.data)==null?void 0:n.applePaySessionCreate)==null?void 0:r.applePaySession)==null?void 0:a.body;if(h)return h}}catch(u){d=[u]}finally{try{s&&(l=o.return)&&await l.call(o)}finally{if(d)throw d[0]}}throw new ge("Apple Pay session create operation returned no response")}async paypalBuyerDetailsFetch(e,n){var r,a;const i=await this.requestStream([fo],{token:e,cartId:n},{instrumentName:b.PayPal,operationName:"paypalBuyerDetailsFetch"});try{for(var o=re(i),s,l,d;s=!(l=await o.next()).done;s=!1){const u=l.value;if(u.hasNext)continue;u.errors&&await this.onError("paypalBuyerDetailsFetch",u);const h=(a=(r=u.data)==null?void 0:r.paypalBuyerDetailsFetch)==null?void 0:a.paypalDetails;if(h)return h}}catch(u){d=[u]}finally{try{s&&(l=o.return)&&await l.call(o)}finally{if(d)throw d[0]}}throw new ge("PayPal buyer details fetch operation returned no response")}async paypalTokenCreate(e){var n,r,a,i;const o=await this.requestStream([bo],{cartId:e},{instrumentName:b.PayPal,operationName:"paypalTokenCreate"});try{for(var s=re(o),l,d,u;l=!(d=await s.next()).done;l=!1){const h=d.value;if(h.errors){if((n=h.errors.graphQLErrors)!=null&&n.find(m=>{var _;return((_=m.extensions)==null?void 0:_.code)===on}))throw new Ot(on);await this.onError("paypalTokenCreate",h)}const p=(i=(a=(r=h.data)==null?void 0:r.paypalTokenCreate)==null?void 0:a.paypalToken)==null?void 0:i.token;if(p)return p}}catch(h){u=[h]}finally{try{l&&(d=s.return)&&await d.call(s)}finally{if(u)throw u[0]}}throw new ge("PayPal token create operation returned no response")}async fetchLimitedCart({id:e,startingCheckout:n,instrumentName:r}){var a,i;const o=await this.request([_o],{id:e},{instrumentName:r,startingCheckout:n});if(o.errors&&await this.onError("limitedCartQuery",o),!((a=o.data)!=null&&a.cart))throw new sl("Limited cart query returned no response");return f.leaveBreadcrumb("limitedCartQuery response",{operationName:"limitedCartQuery",body:(i=o.data)==null?void 0:i.cart},"log"),{id:o.data.cart.id,shippingRequired:o.data.cart.lines.edges.some(s=>s.node.merchandise.requiresShipping),sellingPlan:o.data.cart.lines.edges.some(s=>s.node.sellingPlanAllocation!=null)}}async fetchCart({id:e,startingCheckout:n,instrumentName:r}){var a;const i=this.formatLanguage(this.locale),o=this.cartPrepareMigrationEnabled?"Prepare cart":"Fetch cart",s=this.cartPrepareMigrationEnabled?Co:wo,l=this.cartPrepareMigrationEnabled?[wt,Zt,en]:[wt],d=this.cartPrepareMigrationEnabled?{cartId:e,country:this.country,language:i,withCarrierRates:this.withCarrierRates,prepareCart:!0}:{id:e,country:this.country,language:i,withCarrierRates:this.withCarrierRates},u=await this.requestStream([s,...l],d,{instrumentName:r,startingCheckout:n,operationName:"fetchCart"});try{for(var h=re(u),p,m,_;p=!(m=await h.next()).done;p=!1){const C=m.value;C.errors&&await this.onError("fetchCart",C);let E=null,P;if(!C.data)throw new ge("".concat(o," operation returned no data in response"));if(il(C.data)){const $=C.data.preparedCart;E=(a=$==null?void 0:$.result)==null?void 0:a.cart,P=this.parsePreparedCartMutationErrors(C.errors,this.extractPreparedCartMutationErrors($))}else E=C.data.cart;if(f.leaveBreadcrumb("".concat(o," response"),{operationName:o,body:E,errors:P,hasNext:C.hasNext}
1,"log"),E&&!C.hasNext){const $=this.parseCartResponse(E);return this.lastValidCart=$,$}}}catch(C){_=[C]}finally{try{p&&(m=h.return)&&await m.call(h)}finally{if(_)throw _[0]}}throw new ge("".concat(o," operation returned no response"))}async updateCartPayment(e,n,r,a){var i,o;const s={cartId:e,input:n},{amount:l,currencyCode:d}=n.amount;let u;const h=rt()+1e4;for(;rt()<h;){const p=await this.requestDeferredCart(Ao,s,{instrumentName:r,operationName:"updateCartPayment",abortSignal:a});if(u||(u=p),!this.cartPrepareMigrationEnabled&&p.errors.includes(y.InvalidPaymentAmount)){parseFloat((o=(i=p.data.totalTaxAmount)==null?void 0:i.amount)!=null?o:"0")===0&&await new Promise(m=>setTimeout(m,500)),s.input.amount={amount:p.data.totalAmount.amount,currencyCode:p.data.totalAmount.currencyCode};continue}return(p.data.totalAmount.amount===l||parseFloat(p.data.totalAmount.amount)<=parseFloat(l))&&p.data.totalAmount.currencyCode===d?p:u}throw new Error("Payment update operation timed out")}async updateCartAttributes({cartId:e,attributes:n,instrumentName:r,startingCheckout:a}){const i={cartId:e,attributes:n};return await this.requestDeferredCart(ho,i,{instrumentName:r,operationName:"updateCartAttributes",startingCheckout:a})}async submitForCompletion(e,n,r){var a,i;const o=this.formatLanguage(this.locale),s=await this.request([So],{cartId:e,attemptToken:n,country:this.country,language:o,withCarrierRates:this.withCarrierRates},{instrumentName:r,operationName:"submitForCompletion"});return{data:(i=(a=s.data)==null?void 0:a.cartSubmitForCompletion)==null?void 0:i.result,errors:this.parseCompletionErrors(s)}}async fetchSubscriptionPolicy(){var e,n;const{data:r}=await this.request([Eo],{country:this.country,language:this.formatLanguage(this.locale)},{operationName:"fetchSubscriptionPolicy"});return(n=(e=r==null?void 0:r.shop)==null?void 0:e.subscriptionPolicy)==null?void 0:n.body}async cartRemovePersonalData({cartId:e,shopId:n,instrumentName:r}){var a,i;let o,s,l;try{const u=await this.request([Po,Zt],{cartId:e},{instrumentName:r,keepalive:!0});o=this.parseMutationWarnings((i=(a=u.data)==null?void 0:a.cartRemovePersonalData)==null?void 0:i.warnings),s=this.parseMutationErrors(u,"cartRemovePersonalData")}catch(u){l=u.toString()}const d=!(o!=null&&o.length||s!=null&&s.length||l);g.removePersonalDataResult({success:d}),d||g.log({body:"cartRemovePersonalData failed",attributes:{cartId:e,shopId:n,warnings:o,errors:s,exception:l}})}generateURLWithOperationName(e){const n=e.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(e,n,r){return this.client.request(e.join(""),{variables:n,headers:sn(r),url:this.generateURLWithOperationName(e[0]),keepalive:r.keepalive})}async requestStream(e,n,r){return this.client.requestStream(e.join(""),{variables:n,headers:sn(r),url:this.generateURLWithOperationName(e[0]),signal:r.abortSignal})}async requestDeferredCart(e,n,r){var a,i,o,s,l,d,u,h,p;const m=this.formatLanguage(this.locale),_=await this.requestStream([e,wt,Zt,en],T(w({},n),{country:this.country,language:m,withCarrierRates:this.withCarrierRates,prepareCart:this.cartPrepareMigrationEnabled}),r);try{for(var C=re(_),E,P,$;E=!(P=await C.next()).done;E=!1){const B=P.value;B.errors&&await this.onError(r.operationName,B);const Ye=this.extractMutationErrors(B),N=(i=(a=B.data)==null?void 0:a.preparedCart)==null?void 0:i.result,G=(l=(s=(o=B.data)==null?void 0:o.result)==null?void 0:s.cart)!=null?l:N==null?void 0:N.cart;if(G&&!B.hasNext){let L;this.cartPrepareMigrationEnabled||(L=await this.fetchCart({id:G.id,instrumentName:r.instrumentName,startingCheckout:!1}));const x=this.parseMutationWarnings((u=(d=B.data)==null?void 0:d.result)==null?void 0:u.warnings);return{data:L!=null?L:this.parseCartResponse(G),errors:this.parsePreparedCartMutationErrors(B.errors,Ye),warnings:x,decelerationReason:At({warnings:x,cartStatus:N==null?void 0:N.__typename})}}if(this.lastValidCart&&Ye.length>0){this.onResultError(Ye);const L=this.parseMutationWarnings((p=(h=B.data)==null?void 0:h.result)==null?void 0:p.warnings);return{data:this.lastValidCart,errors:this.parsePreparedCartMutationErrors(B.errors,Ye),warnings:L,decelerationReason:At({warnings:L})}}}}catch(B){$=[B]}finally{try{E&&(P=C.return)&&await P.call(C)}finally{if($)throw $[0]}}throw new ge("Deferred cart operation returned no response")}async onError(e,n){const r=await Io(e,n);if(!r)return;const a=r,{message:i}=a,o=Xt(a,["message"]),{isIgnorable:s,reason:l}=No(r);throw f.leaveBreadcrumb(i,w(w({ignored:s,ignoredReason:l},n),o),"error"),s?new Vn(i,{reason:l,errorDetails:o}):new Sr(i,{errorDetails:o,bugsnagGroupingHash:Lo(o)})}onResultError(e){f.leaveBreadcrumb("GraphQL result error",e,"error")}formatLanguage(e){return e.includes("-")?e.split("-")[0].toUpperCase():e.toUpperCase()}parseCartResponse(e){var n,r,a;const i=e.lines.edges.map(s=>{var l,d;const u=s.node;return{quantity:u.quantity,totalAmount:{amount:u.cost.totalAmount.amount,currencyCode:u.cost.totalAmount.currencyCode},subtotalAmount:{amount:(l=u.cost.subtotalAmount)==null?void 0:l.amount,currencyCode:(d=u.cost.subtotalAmount)==null?void 0:d.currencyCode},merchandise:{requiresShipping:u.merchandise.requiresShipping},discountAllocations:u.discountAllocations,sellingPlanAllocation:u.sellingPlanAllocation}}),o=e.deliveryGroups.edges.map(s=>s.node);return{id:e.id,totalAmount:e.cost.totalAmount,subtotalAmount:(n=e.cost.subtotalAmount)!=null?n:void 0,totalTaxAmount:(r=e.cost.totalTaxAmount)!=null?r:void 0,totalDutyAmount:(a=e.cost.totalDutyAmount)!=null?a:void 0,discountAllocations:e.discountAllocations,discountCodes:e.discountCodes,lineItems:i,deliveryGroups:o,checkoutUrl:e.checkoutUrl}}parseGraphQlErrors(e){var n,r;return(r=(n=e==null?void 0:e.graphQLErrors)==null?void 0:n.map(a=>a.message.replace(/\(Expected.*\)/,"").trim()))!=null?r:[]}parseMutationError(e){return e.code===Ct?{code:Ct,message:e.message}:e.field&&e.field.length>0?"".concat(e.code,": ").concat(e.field.join(".")):e.code}parseMutationErrors(e,n){var r,a,i;const o=this.parseGraphQlErrors(e.errors),s=((i=(a=(r=e.data)==null?void 0:r[n])==null?void 0:a.errors)==null?void 0:i.map(this.parseMutationError).filter(d=>d))||[],l=[...o,...s];return f.leaveBreadcrumb("GraphQL errors on mutation",l,"error"),l}parseMutationWarnings(e){return!e||e.length===0?[]:e.map(n=>n.code)}filterErrors(e){var n;return!((n=e.code)!=null&&n.startsWith("PENDING_DELIVERY_GROUPS")||e.code==="INVALID_PAYMENT")}extractPreparedCartMutationErrors(e){var n,r;const a=(n=e==null?void 0:e.errors)!=null?n:[];return((r=e==null?void 0:e.result)==null?void 0:r.__typename)==="CartStatusNotReady"&&a.push(...e.result.errors),a}extractMutationErrors(e){var n,r,a,i;let o=(a=(r=(n=e.data)==null?void 0:n.result)==null?void 0:r.errors)!=null?a:[];return this.cartPrepareMigrationEnabled&&(o=o.filter(this.filterErrors)),[...o,...this.extractPreparedCartMutationErrors((i=e.data)==null?void 0:i.preparedCart)]}parsePreparedCartMutationErrors(e,n){const r=this.parseGraphQlErrors(e),a=n.map(this.parseMutationError).filter(o=>o),i=[...r,...a];return f.leaveBreadcrumb("GraphQL errors on mutation",i,"error"),i}parseCompletionErrors(e){var n,r,a,i;const o=this.parseGraphQlErrors(e.errors);let s=[];((a=(r=(n=e.data)==null?void 0:n.cartSubmitForCompletion)==null?void 0:r.result)==null?void 0:a.__typename)==="SubmitFailed"&&(s=(i=e.data.cartSubmitForCompletion.result.errors.map(d=>d.code))!=null?i:[]);const l=[...o,...s];return f.leaveBreadcrumb("GraphQL errors on completion",l,"error"),l}}function il(t){return!("cart"in t)}function ol({emailAddress:t,countryCode:e,phone:n,streetAddress:r,validateAddress:a,preferences:i}){return{email:t,countryCode:e!=null?e: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:i}}function sn({instrumentName:t,startingCheckout:e}){const n={};return t&&(n["X-Wallet-Name"]="".concat(t)),e&&(n["X-Start-Wallet-Checkout"]="".concat(e)),n}const ya="LimitedCartQueryError";
1class sl extends Error{constructor(){super(...arguments),c(this,"name",ya)}}const ga=["OpenTelemetryClientError",Gn,jn,zn,yt],ll=["Load failed","Failed to fetch","when attempting to fetch resource","GraphQL mutation failed with status 404","Component closed",...ga],ln=new Map([["TypeError","Illegal constructor"],["BugsnagInvalidError",'"isTrusted":true'],[ya,"Limited cart query returned no response"],["AbortError","Fetch is aborted"]]),cl=["Chrome-Lighthouse"];function dl(t){const e=t.exceptions[0];return ul()?"silenced-user-agent":hl(t)?"empty-stack-trace":pl(e)?"spin":ml()?"monkey-patch":fl(t)?"external-error":wl(t)?"developer-error":bl(e.message)?"discarded-message":_l(t)?"discarded-error-class":El(e)?"discarded-class-message":Al(t)?"unactionable-invalid-error":yl(t)||null}function ul(){return cl.some(t=>navigator.userAgent.includes(t))}function hl(t){return t.exceptions[0].stacktrace.length===0}function pl(t){return t.stacktrace.some(e=>{var n;return(n=e.file)==null?void 0:n.includes("spin.dev")})}function ml(){return[HTMLElement,Event,document.createElement].some(Hn)}function yl(t){const e=t.exceptions.map(n=>n.stacktrace.filter(r=>!gl(r)));return e.some(n=>{var r;return!((r=n[0])!=null&&r.inProject)})?"external-trigger":e.some(n=>n.every(r=>[Mn,Ar,Fn].some(a=>r.file.startsWith(a))))?"wallet-sdk-stack-trace":null}function gl(t){return t.file.includes("native code")||t.file.includes("/cdn/wpm/")}function fl(t){return!t.exceptions[0].stacktrace.some(e=>e.inProject)}function bl(t){return ll.some(e=>t==null?void 0:t.includes(e))}function wl(t){const e=t.exceptions.some(n=>n.errorClass===yt);return e&&console.error(t.exceptions[0]),e}function _l(t){return t.exceptions.some(e=>ga.includes(e.errorClass))}function El(t){const e=t.errorClass,n=t.message;return ln.has(e)&&(n==null?void 0:n.includes(ln.get(e)))}function Al(t){return t.exceptions[0].errorClass==="BugsnagInvalidError"&&t.unhandled}function Cl(t,e){const n=t.exceptions[0];if(!n||!n.message||fi.checkDuplicate(n))return!1;const r=Il(e);Sl(t,r);let a=null;try{a=dl(t)}catch(i){const o=i;console.error(o);const s={errorClass:"UnfilterableError",message:"Could not properly filter error with message: ".concat(o.message),stacktrace:Ln(Un,o)};t.exceptions.unshift(s)}return vl(a),Ps()&&Rl({errorClass:n.errorClass,message:n.message,stacktrace:JSON.stringify(n.stacktrace),filterResult:a,metadata:JSON.stringify(t.metaData)}),a==null}function Sl(t,e){var n,r,a,i,o;const s=(a=(r=(n=window.ShopifyAnalytics)==null?void 0:n.lib)==null?void 0:r.trekkie)==null?void 0:a.defaultAttributes;t.context=window.location.pathname,t.request||(t.request={}),t.request.url=window.location.href,t.device.orientation=(o=(i=window.screen)==null?void 0:i.orientation)==null?void 0:o.type,Dl(t),t.groupingHash=Pl(e),t.metaData=T(w({},t.metaData),{shop:w(w({},vr()),t.metaData.shop),custom:T(w({},t.metaData.custom),{customFetch:Hn(fetch)}),monorail:s}),e[0]instanceof Sr&&(t.metaData.graphql=w({},e[0].errorDetails),e[0]instanceof Vn&&(t.metaData.graphql.reason=e[0].reason))}function Pl(t){for(const e of t)if("bugsnagGroupingHash"in e&&e.bugsnagGroupingHash)return e.bugsnagGroupingHash.toString()}function Il(t){const e=[];let n=t;for(;n instanceof Error&&e.length<20;){e.push(n);const r="cause"in n?n.cause:null;if(!r)break;n=r}return e}function Dl(t){for(const e of t.exceptions)for(const n of e.stacktrace)[Mn,Ar,Fn].some(r=>n.file.startsWith(r))&&(n.inProject=!0)}function vl(t){I.counter({name:v.ErrorTriggered,value:1,attributes:{filterResult:t||"valid-error"}})}function Rl(t){I.log({body:"Bugsnag Error",attributes:w(w({},vr()),t)})}var vn;const Nl={apiKey:"cb577dc231be1c7494db8a63441ef66b",appId:Un,appVersion:"0.0.0-a5ab5e003ceff70dc4a15e932d1b4a055d79c4c6",releaseStage:"production",locale:"en",userAgent:navigator.userAgent,metadata:{user:{id:(vn=lt(yi))!=null?vn:"unknown"}},onError:Cl},f=new ci(Nl);f.addOnPostError(t=>{f.leaveBreadcrumb("Bugsnag Error Notified",{errorClass:t.exceptions[0].errorClass,message:t.exceptions[0].message},"error")});var fa={en:{express_checkout:"Express checkout",instruments_copy:{checkout:{buy_n
1ow:"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"},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."},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:"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",paypal:"PayPal",google_pay:"Google Pay",shop_pay:"Shop Pay"},buy_with_button_content:"Buy 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"},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."}}}};fa.en;let rr;class cn extends Error{constructor(e,n){const r="i18n: Missing or invalid translation '".concat(e,"' in '").concat(n,"'");super(r)}}
1class Tl extends Error{constructor(e,n,r){const a="i18n: Missing translation template key '".concat(e,"' for '").concat(n,"' in '").concat(r,"'");super(a)}}class kl extends Error{constructor(e,n,r){const a="i18n: Invalid pluralization for '".concat(e,"':'").concat(n,"' in '").concat(r,"'");super(a)}}function Ht(){return rr==null&&(rr=Ll(fa)),rr}function Ll(t){const e=(i,o)=>typeof i!="string"&&o.count!=="undefined",n=(i,o)=>{let s=o===1?"one":"other";return o===0&&typeof i!="string"&&i.zero!=="undefined"&&(s="zero"),s},r=(i,o={})=>{const s=i.match(/%\{.+?\}/g);return s?s.reduce((l,d)=>{const u=d.replace(/%\{(.*)\}/,"$1");return o[u]?l.replace(d,o[u]):(f.notify(new Tl(u,i,a)),l)},i):i},a=Ol();return{locale:a,translate(i,o={}){var s;const l=i.split(".");let d=t[a];try{for(const u of l)switch(typeof d){case"object":d=d[u];break;case"string":case"undefined":throw new cn(i,a)}if(e(d,o)){if(typeof d=="string")throw new kl(i,d,a);d=d[n(d,o.count)]}if(typeof d!="string")throw new cn(i,a);return r(d,o)}catch(u){return f.notify(u),(s=o.defaultValue)!=null?s:i}}}}function Ol(){return"en"}class xl extends HTMLElement{constructor(){super(),c(this,"overflow"),c(this,"formerFocus"),this.attachShadow({mode:"open"}),this.overflow="",this.formerFocus=document.activeElement}connectedCallback(){const e=Ht();this.render(e);const n=this.shadowRoot,r=n.getElementById("modal");n.querySelectorAll("button").forEach(o=>o.addEventListener("click",this.closeModal.bind(this)));const a=n.getElementById("overlay");a==null||a.addEventListener("click",o=>this.handleOutsideClick(o,r)),document.addEventListener("keydown",this.handleEscapeKey.bind(this));const i=document.createElement("style");i.textContent=ri,n.appendChild(i),this.overflow=document.body.style.overflow,document.body.style.overflow="hidden",this.trapFocus(r,n),pe("svg-icon",ti)}trapFocus(e,n){if(!e)return;const r=e.querySelectorAll("a[href], button"),a=Array.from(r),i=a[0],o=a[a.length-1];e.addEventListener("keydown",s=>{s.key==="Tab"&&!s.shiftKey&&n.activeElement===o&&(s.preventDefault(),i.focus()),s.key==="Tab"&&s.shiftKey&&n.activeElement===i&&(s.preventDefault(),o.focus())}),i.focus()}handleOutsideClick(e,n){n&&(n.contains(e.target)||this.closeModal())}handleEscapeKey(e){e.key==="Escape"&&this.closeModal()}closeModal(){var e;document.body.style.overflow=this.overflow,this.remove(),this.formerFocus&&"focus"in(this==null?void 0:this.formerFocus)&&typeof this.formerFocus.focus=="function"&&((e=this.formerFocus)==null||e.focus())}render(e){const n=this.getAttribute("title"),r=this.getAttribute("has-close-button"),a=e.translate("error_dialogs.checkout.button_text"),i='\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?i:"","\n </div>\n </div>\n ")}}const Ml="@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 Gt({type:t="button",label:e=void 0}={}){const n=document.createElement("button");return n.type=t,e&&n.setAttribute("aria-label",e),n}function zt(t,e){for(const[n,r]of Object.entries(e))t.setAttribute(n,r)}function dn(t,e){for(const[n,r]of Object.entries(e))t.style.setProperty(n,r)}function Vt(t,e){const n=document.createElement("top-level-modal");n.textContent=e,zt(n,{"data-testid":"top-level-modal","has-close-button":"true",title:t}),document.body.appendChild(n)}function Tr(t,e,n){const r=document.createElement("top-level-modal");zt(r,{"data-testid":"top-level-modal",title:t}),e instanceof Promise?(r.innerHTML="\n <style>".concat(Ml,'</style>
1\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 '),e.then(a=>{a&&a!==""?r.innerHTML=a:r.innerHTML=n!=null?n:""}).catch(()=>{r.innerHTML=n!=null?n:""})):r.innerHTML=e,document.body.appendChild(r)}function Q(t,e){Vt(e.translate("error_dialogs.wallet.title",{wallet:t}),e.translate("error_dialogs.wallet.generic_error",{wallet:t}))}function gt(t){Vt(t.translate("error_dialogs.checkout.title"),t.translate("error_dialogs.checkout.generic_error"))}function Re(t,e){Vt(t.translate("error_dialogs.checkout.title"),e)}function Ne(t,e){switch(e){case Ft.InvalidQuantity:gt(t);break}}pe("top-level-modal",xl);class qt extends HTMLElement{get buyerCountry(){return this.getAttribute("buyer-country")}get recommendedInstrument(){return this.getAttribute("recommended-instrument")}get buyerCurrency(){const e=this.getAttribute("buyer-currency");if(e==null)throw new Error("WalletElement buyer-currency is null");return e}get accessToken(){return this.getAttribute("access-token")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get hasSellingPlan(){const e=this.getAttribute("has-selling-plan");return e==="true"||e===""}set hasSellingPlan(e){e?this.setAttribute("has-selling-plan",""):this.removeAttribute("has-selling-plan")}get isShippingRequired(){const e=this.getAttribute("requires-shipping");return e==="true"||e===""}set isShippingRequired(e){e?this.setAttribute("requires-shipping",""):this.removeAttribute("requires-shipping")}get pciEnabled(){return this.hasAttribute("pci-enabled")}}const Fl="#more-payment-options-link{cursor:pointer}";function Ul(t){const e=n=>{n.persisted&&(t(),window.removeEventListener("pageshow",e))};window.addEventListener("pageshow",e)}class Bl extends Error{constructor(e){e instanceof Error?(super("[".concat(e.name,"] ").concat(e.message),{cause:e.cause}),this.stack=e.stack):super("[HandleCreateCartError] ".concat(String(e))),this.name="HandleCreateCartError"}}async function me({element:t,instrumentName:e,dataSource:n}){try{const r=await n.getInitialCart(e),{cart:a,errors:i,warnings:o}=r;Ul(()=>{t&&(t.disabled=!1)});const s=Rr(i),l=i.length===1&&i[0]===y.InvalidQuantity,d=l||s;if(!a&&!d)throw new Error("[".concat(e,"] Failed to create cart: ").concat(JSON.stringify(i)));if(a){if(!a.id)throw new Error("[".concat(e,"] received invalid cart"));if(!a.checkoutUrl)throw new Error("[".concat(e,"] Created cart with no checkout URL"))}if(i.length>0&&!d)throw new Error("Errors present after cart creation: ".concat(JSON.stringify(i)));return w({cart:a,customValidationError:s,decelerationReason:At({warnings:o})},l?{unrecoverableError:Ft.InvalidQuantity}:{})}catch(r){throw new Bl(r)}finally{t.disabled=!1}}class $l extends qt{constructor(){super(),c(this,"name",b.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]=se(),[this.dataSource,this.setDataSource]=se(),[this.classNames,this.setClassNames]=se()}static get observedAttributes(){return["disabled"]}connectedCallback(){this.anchor||this.render()}attributeChangedCallback(e,n,r){n!==r&&e==="disabled"&&this.anchor&&(r===""?this.anchor.setAttribute("aria-disabled","true"):this.anchor.removeAttribute("aria-disabled"),this.setAccessibilityAttributes())}async handleClick(e){var n,r;if(e.preventDefault(),this.disabled||!this.anchor)return;this.disabled=!0;const[a,i]=await Promise.all([this.i18n,this.dataSource]);try{const{decelerationReason:o,cart:s,customValidationError:l,unrecoverableError:d}=await me({element:this,instrumentName:b.MoreOptions,dataSource:i});if(d){g.sheetClicked({instrument:this.name,result:"failed"}),Ne(a,d);return}if(l){Re(a,l.message);return}if(o){M({checkoutUrl:(n=s==null?void 0:s.checkoutUrl)!=null?n:"",instrumentName:b.MoreOptions,reason:o});return}const u=this.recommendedInstrument===b.ShopPay?"skip_shop_pay":"allow_redirect";g.sheetClicked({instrument:b.MoreOptions,result:"success"}),ue((r=s==null?void 0:s.checkoutUrl)!=null?r:"",u)}catch(o){g.sheetClicked({instrument:b.MoreOptions,result:"failed"}),f.notify(o),gt(a)}}async render(){const e=await this.i18n,n=await this.classNames;
1this.anchor=document.createElement("a"),this.anchor.textContent=e.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=Fl,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=(t=>(t.ButtonDisplay="buttonDisplay",t.LoadInstrument="loadInstrument",t.LoadSdk="loadSDK",t.AuthorizationLatency="authorizationLatency",t.SheetLoad="sheetLoad",t))(F||{});function ba(){var t,e;return!!((t=window.performance)!=null&&t.mark)&&!!((e=window.performance)!=null&&e.measure)}function jt(t,e){return We(t,e),()=>Z(t,e)}function We(t,e){ba()&&window.performance.mark("".concat(t,"-").concat(e,"-start"))}function Z(t,e){var n,r;if(ba())try{const a="".concat(t,"-").concat(e,"-start"),i="".concat(t,"-").concat(e,"-end"),o="".concat(t,"-").concat(e,"-duration");window.performance.mark(i);const s=(r=window.performance.measure(o,a,i))!=null?r:(n=window.performance.getEntriesByName(o,"measure"))==null?void 0:n[0],l=s==null?void 0:s.duration;return l==null?void 0:l}catch(a){return}}function kr(t,e,n){if(tt!=null&&tt.length){const r=tt.join(",");t.querySelectorAll(r).forEach(a=>{n===null?a.removeAttribute(e):a.setAttribute(e,n)})}}function Hl(t,e){try{const n=JSON.parse(t!=null?t:"[]");if(!(n instanceof Array))throw new ee({code:"invalid-wallet-configs",message:"[".concat(e,"] invalid walletConfigs found")});return n}catch(n){throw new ee({code:"invalid-wallet-configs",message:"[".concat(e,"] Error while parsing walletConfigs JSON: ").concat(n)},{cause:n})}}function Gl(t,e){try{return t?JSON.parse(t):null}catch(n){throw new ee({code:"invalid-wallet-config",message:"[".concat(e,"] Error while parsing walletConfig JSON: ").concat(n)},{cause:n})}}function Pt(t,e){var n;const r=e==null?void 0:e.getLoadEligibility(t);return g.instrumentLoadEligibility({instrument:e==null?void 0:e.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 zl(t,e){return e.filter(n=>Pt(t,n))}async function wa({walletInstrument:t,instanceNumber:e}){const n=t.getInstrumentName(),r=jt(F.LoadSdk,"".concat(n,":").concat(e));try{await t.loadWalletSDK(),g.instrumentSDKLoaded({instrument:n,measurement:r(),result:"success"})}catch(i){return f.notify(i),g.instrumentSDKLoaded({instrument:n,measurement:r(),result:"failed"}),null}let a;try{a=t.getPartnerSDKEligibility()}catch(i){f.notify(i),a={eligible:!1,reason:"uncaught exception"}}return a.eligible?(g.instrumentSDKEligible({instrument:n,result:"success"}),t):(g.instrumentSDKEligible({instrument:n,reason:a.reason,result:"failed"}),null)}function qe(t,...e){try{const n=window[t];if(typeof n=="function")return new n(...e)}catch(n){}return null}var Be;class Lr extends qt{constructor(){super(),c(this,"apiClient"),c(this,"i18n"),c(this,"policy"),c(this,"isFetchingPolicy",!1),c(this,"intersectionObserver",null),O(this,Be),this.mountIntersectionObserver()}get shopId(){return this.getAttribute("shop-id")}get cartId(){return this.getAttribute("cart-id")}get walletConfigs(){return this.getAttribute("wallet-configs")}get recommendedWallet(){return this.getAttribute("recommended")}get fallbackWallet(){return this.getAttribute("fallback")}get variantParams(){var e;try{return JSON.parse((e=this.getAttribute("variant-params"))!=null?e:"[]")}catch(n){throw new ee({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(e,n,r){n!==r&&kr(this,e,r)}showBuyerConsent(e,n){var r,a,i;!e||!n||(i=(a=(r=window.Shopify)==null?void 0:r.PaymentButton)==null?void 0:a.showBuyerConsent)==null||i.call(a,o=>this.onClickSubscriptionPolicy(o,e,n))}hideBuyerConsent(){var e,n,r;(r=(n=(e=window.Shopify)==null?void 0:e.PaymentButton)==null?void 0:n.hideBuyerConsent)==null||r.call(n)}clearUI(){this.innerHTML=""}isFlagEnabled(e){return A(this,Be)==null&&k(this,Be,this.getEnabledFlags()),A(this,Be).includes(e)}getEnabledFlags(){const e=this.getAttribute("enabled-flags");if(!e)return[];try{return JSON.parse(e)}catch(n){return console.warn("Invalid enabled-flags attribute value:",e),[]}}async onClickSubscriptionPolicy(e,n,r){if(e.preventDefault(),this.isFetchingPolicy)return;if(this.policy){this.showPolicy(this.policy,r);return}this.isFetchingPolicy=!0;
1const a=this.fetchSubscriptionPolicy(n).then(i=>(this.policy=i,i)).catch(i=>(f.notify(i),r.translate("subscriptions.policy_not_found"))).finally(()=>{this.isFetchingPolicy=!1});this.showPolicy(a,r)}async fetchSubscriptionPolicy(e){const n=await e.fetchSubscriptionPolicy();return this.policy=n,n}showPolicy(e,n){Tr(n.translate("subscriptions.cancellation_policy"),e,n.translate("subscriptions.policy_not_found"))}mountIntersectionObserver(){this.intersectionObserver=qe("IntersectionObserver",this.handleIntersection),this.intersectionObserver?this.intersectionObserver.observe(this):j({event:H.FirstVisibleNotAvailable})}handleIntersection(e,n){e.some(r=>r.isIntersecting)&&(n.disconnect(),j({event:H.FirstVisible}))}}Be=new WeakMap;function Or(t){var e,n;Ss({shopId:(e=t.shopId)!=null?e:Bn,cartId:(n=t.cartId)!=null?n:void 0,debug:t.debug,pageType:t.pageType})}function _a({type:t,form:e}){if(!e)return[];const n=document.querySelectorAll('[name^="'.concat(t,'"][form^="').concat(CSS.escape(e.getAttribute("id")||""),'"]')),r=e.querySelectorAll('[name^="'.concat(t,'"]')),a=[...n,...r],i={};return a.forEach(o=>{const s=Vl(o),l=ql(o);s&&typeof l<"u"&&l.trim()!==""&&(i[s]=l)}),Object.entries(i!=null?i:{}).map(([o,s])=>({key:o,value:s}))}function Wt({page:t,element:e}){const n=t==="product"?'[data-shopify="payment-button"]':'[data-shopify="dynamic-checkout-cart"]',r=un(e,n)||document.querySelector(n);return un(r,"form")}const Ze=Element.prototype;function un(t,e){if(Ze.matches=Ze.matches||Ze.webkitMatchesSelector||Ze.msMatchesSelector||Ze.mozMatchesSelector,!t||t.matches(e))return t;let n=t;for(;n&&n!==document.body;)if(n=n.parentElement,n&&n.matches(e))return n;return null}function Vl(t){const e=t.getAttribute("name");if(e===null)return null;const n=e.indexOf("["),r=e.lastIndexOf("]");return n===-1||r===-1?null:e.substring(n+1,r)}function ql(t){if(!(["radio","checkbox"].includes(t.type)&&!t.checked)&&!(t.value===""||typeof t.value>"u"))return t.value}function xr(t){const e=Wt({page:"product",element:t});return Ea(e)}function Ea(t){var e;const n=t==null?void 0:t.elements;if(!n)return null;const r=It(n,"id");if(!r||isNaN(Number(r)))return null;const a=Number((e=It(n,"quantity"))!=null?e:"1"),i="gid://shopify/ProductVariant/".concat(r),o=Wl(n),s=_a({type:"properties",form:t});return{variantId:r,quantity:a,merchandiseId:i,sellingPlanId:o,lineItemProperties:s}}function jl(t){const e=t==null?void 0:t.elements;return e?!!It(e,"selling_plan"):!1}function It(t,e){var n;const r=t.namedItem(e);return r&&"value"in r&&(n=r.value)!=null?n:null}function Wl(t){const e=It(t,"selling_plan");if(!(!e||e==="undefined"))return"gid://shopify/SellingPlan/".concat(e)}class Aa{constructor(e,n){c(this,"addToCartMutationObserver"),c(this,"addToCartForm"),c(this,"addToCartButtons"),this.element=e,this.onFormChanged=n,this.addToCartMutationObserver=null,this.addToCartForm=null,this.addToCartButtons=[]}setupMutationObservers(){if(this.findAndSetAddToCartButtons(),!this.addToCartForm)return;this.syncComponentStateWithForm();const e=new MutationObserver(()=>this.reobserveOnFormChanges());this.addToCartMutationObserver=new MutationObserver(()=>this.syncComponentStateWithForm()),e.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 e=Ea(this.addToCartForm),n=!!(this.addToCartButtons.length>0&&this.addToCartButtons.every(r=>r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true"));this.onFormChanged({disabled:n||e===null,hasSellingPlan:jl(this.addToCartForm),variantId:e==null?void 0:e.variantId,sellingPlanId:e==null?void 0:e.sellingPlanId})}observeAddToCartButtons(){this.addToCartButtons.forEach(e=>{this.addToCartMutationObserver.observe(e,{attributes:!0})})}reobserveOnFormChanges(){var e;(e=this.addToCartMutationObserver)==null||e.disconnect(),this.findAndSetAddToCartButtons(),this.observeAddToCartButtons(),this.syncComponentStateWithForm()}findAndSetAddToCartButtons(){this.addToCartForm=Wt({page:"product",element:this.element}),this.addToCartForm&&(this.addToCartButtons=[...this.addToCartForm.querySelectorAll("[type=submit]")])}}function Yl(t,e,n){try{const r=JSON.parse(t!=null?t:"{}"),a=JSON.parse(e!=null?e:JSON.stringify($n));if(r===null||Object.keys(r).length===0){if(!(a instanceof Object))throw g.walletConfigDeveloperError(),new ee({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 g.walletConfigDeveloperError(),new ee({code:"invalid-recommended-fallback-config",message:"[".concat(n,"] Error while parsing recommended/fallback JSON: ").concat(r)},{cause:r})}}const Kl=".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{background:none;border:none;padding:0;text-decoration:underline;font-size:inherit;cursor:pointer}#shopify-subscription-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 )}",Ql='.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);min-width:150px}:host([page-type="cart_page"]) .accelerated-checkout-button{height:100%;width:100%;border-radius:var(--shopify-accelerated-checkout-button-border-radius, 4px);box-shadow:var(--shopify-accelerated-checkout-button-box-shadow)}@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}}',Xl=70;class it{constructor(e,n,r,a){c(this,"red"),c(this,"green"),c(this,"blue"),c(this,"opacity"),this.red=e||0,this.green=n||0,this.blue=r||0,this.opacity=typeof a>"u"?1:a}getLuminance(){const e=this.red&255,n=this.green&255,r=this.blue&255;return e*.2126+n*.7152+r*.0722}isDark(){return this.opacity===0?!1:this.getLuminance()/this.opacity<Xl}blendWith(e,n){this.opacity=1-(1-e.opacity)*(1-n.opacity),this.red=this.blend(e.red,n.red,e,n),this.green=this.blend(e.green,n.green,e,n),this.blue=this.blend(e.blue,n.blue,e,n)}blend(e,n,r,a){return Math.round(e*r.opacity/this.opacity+n*a.opacity*(1-r.opacity)/this.opacity)}}function Jl(t){const e=[...t];let n=new it(0,0,0,0),r=new it(255,255,255,1),a=e.shift();for(;a;)n.opacity>0&&a.opacity>0?(r=new it(0,0,0,0),r.blendWith(a,n)):a.opacity>0?r=a:r=n,n=r,a=e.shift();return r}const pr=new it(255,255,255,1);function Zl(t){const e=[];let n=t;for(;n.parentElement;){n=n.parentElement;const r=window.getComputedStyle(n).backgroundColor,a=ec(r);if(r&&e.push(a),a.opacity===1)break}try{return Jl(e.reverse())}catch(r){return f.notify(new Ca("[BackgroundDetection] Failed to blend colors for element ".concat(t.outerHTML),{cause:r})),pr}}function ec(t){if(!t)return pr;try{const e=t.split("(")[1].split(")")[0].replace(" ","").split(",");return new it(Number(e[0]),Number(e[1]),Number(e[2]),typeof e[3]>"u"?1:Number(e[3]))}catch(e){f.notify(new Ca("[BackgroundDetection] Failed to convert rgbString to array ".concat(t),{cause:e}))}return pr}class Ca extends Error{constructor(){super(...arguments),c(this,"name","ColorProcessingError")}}class Te extends qt{constructor(){super(),c(this,"name",b.Unknown),c(this,"i18n"),c(this,"dataSource"),c(this,"apiClient"),c(this,"classNames"),c(this,"containerInstanceNumber"),c(this,"onRendered"),c(this,"setI18n"),c(this,"setDataSource"),c(this,"setApiClient"),c(this,"setClassNames"),c(this,"setContainerInstanceNumber"),c(this,"parsedWalletParams"),this.onRendered=()=>{},[this.i18n,this.setI18n]=se(),[this.dataSource,this.setDataSource]=se(),[this.apiClient,this.setApiClient]=se(),[this.classNames,this.setClassNames]=se(),[this.containerInstanceNumber,this.setContainerInstanceNumber]=se()}async cleanupOnFailure(e,n){var r;try{await e()}catch(a){f.notify(new tc("An error occurred requiring cleanup when attempting to render the ".concat(n," instrument: ").concat(a),{cause:a}));const i=await this.containerInstanceNumber;g.instrumentLoaded({instrumentOrComponentName:n,result:"failed",measurement:Z(F.ButtonDisplay,"".concat(n,":").concat(i))}),(r=this.parentElement)==null||r.remove()}}attributeChangedCallback(e,n,r,a){n!==r&&e==="disabled"&&a&&(r===""?(a.setAttribute("aria-disabled","true"),a.setAttribute("disabled","")):(a.removeAttribute("aria-disabled"),a.removeAttribute("disabled")))}get pageType(){return this.getAttribute("page-type")||S.Unknown}get buttonTheme(){return Zl(this).isDark()?"LIGHT":"DARK"}get isCTA(){return this.hasAttribute("call-to-action")}get walletParams(){var e;if(this.parsedWalletParams===void 0)try{this.parsedWalletParams=JSON.parse((e=this.getAttribute("wallet-params"))!=null?e:"{}")}catch(n){throw new ee({code:"invalid-wallet-params",message:"[".concat(this.name,"] Error while parsing wallet-params JSON: ").concat(n)},{cause:n})}return this.parsedWalletParams}async initializeShadowStyles(e,n=""){const r=document.createElement("style");r.innerHTML=[Ql,n].join("\n"),e.appendChild(r)}async ensureLightDOMIsNotEmpty(){this.textContent="\xA0"}dispatchWalletEvent({eventName:e,detail:n={}}){var r;(r=this.parentElement)==null||r.dispatchEvent(new CustomEvent(e,{detail:n}))}}
1class tc extends Error{constructor(){super(...arguments),c(this,"name","CleanupOnFailureError")}}class rc extends Te{constructor(){super(...arguments),c(this,"name",b.BuyItNow),c(this,"button",null)}static get observedAttributes(){return["disabled"]}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}attributeChangedCallback(e,n,r){super.attributeChangedCallback(e,n,r,this.button)}async handleClick(){var e,n;if(this.disabled||!this.button||this.button.getAttribute("aria-disabled"))return;this.disabled=!0;const[r,a]=await Promise.all([this.i18n,this.dataSource]);try{const{decelerationReason:i,cart:o,customValidationError:s,unrecoverableError:l}=await me({element:this,instrumentName:this.name,dataSource:a});if(l){g.sheetClicked({instrument:this.name,result:"failed"}),Ne(r,l);return}if(g.sheetClicked({instrument:this.name,result:"success"}),s){Re(r,s.message);return}if(i){M({checkoutUrl:(e=o==null?void 0:o.checkoutUrl)!=null?e:"",instrumentName:this.name,reason:i});return}ue((n=o==null?void 0:o.checkoutUrl)!=null?n:"","allow_redirect")}catch(i){f.notify(i),g.sheetClicked({instrument:this.name,result:"failed"}),gt(r)}}async render(){var e;this.button||(this.button=Gt());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),(e=this.onRendered)==null||e.call(this)}}function nc(){const t=navigator.userAgent,e=t.indexOf("Android")>-1,n=t.indexOf("Chrome/")>-1,r=parseInt((/Chrome\/([0-9]+)/.exec(t)||["0","0"])[1],10);return e&&n&&r===114}class ye{constructor(e){c(this,"walletParams"),this.walletParams=e.wallet_params}
1static walletName(){throw new Error("Must define walletName for WalletInstrument subclass")}createWebComponent({walletContainer:e,dataSource:n,i18n:r,apiClient:a,containerInstanceNumber:i,classNames:o="",callToAction:s,pageType:l=S.ProductPage,slot:d="button",onRendered:u=()=>{}}){var h,p,m;const _=this.getWebComponentName();pe(_,this.getWebComponentClass(),{isChildCustomElement:!0});const C=document.createElement(_),E={"access-token":(h=e.accessToken)!=null?h:"","buyer-country":(p=e.buyerCountry)!=null?p:"","buyer-currency":e.buyerCurrency,"wallet-params":JSON.stringify((m=this.walletParams)!=null?m:{}),"page-type":l,slot:d};try{e.disabled&&C.setAttribute("disabled",""),zt(C,E),e.isShippingRequired&&C.setAttribute("requires-shipping",""),e.hasSellingPlan&&C.setAttribute("has-selling-plan",""),e.pciEnabled&&C.setAttribute("pci-enabled","")}catch(P){const $=P;throw $.message.includes("setAttribute is not a function")&&nc()?new Ot($.message):$}return s&&C.setAttribute("call-to-action",""),C.setDataSource(n),C.setApiClient(a),C.setI18n(r),C.setClassNames(o),C.setContainerInstanceNumber(i),C.onRendered=u,C}loadWalletSDK(){return Promise.resolve()}getLoadEligibility(e){return{eligible:!0}}getPartnerSDKEligibility(){return{eligible:!0}}}class ac extends ye{static walletName(){return"buy_it_now"}getWebComponentName(){return"shopify-buy-it-now-button"}getInstrumentName(){return b.BuyItNow}getWebComponentClass(){return rc}}const ic="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}",oc="::slotted(div){height:100%}";async function Fe(t){const{cartId:e,cartClient:n,instrumentName:r,abortSignal:a}=t;try{if(!e)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(t,a)}catch(i){throw g.updateFailed(r,"updateBuyerIdentity"),i}}async function Mr({cartId:t,totalAmount:e,paymentMethod:n,billingAddress:r,cartClient:a,instrumentName:i,abortSignal:o,hasSellingPlan:s,canUsePaymentMethodForFreeOrder:l}){try{if(!t)throw new Error("[".concat(i,"] provided no cart ID when updating payment"));if(!e)throw new Error("[".concat(i,"] provided no total amount when updating payment"));if(!n)throw new Error("[".concat(i,"] provided no apple pay wallet content when updating payment"));if(!a)throw new Error("[".concat(i,"] provided invalid cart client when updating payment"));const d={freePaymentMethod:{billingAddress:r}};return await a.updateCartPayment(t,w({amount:{amount:e.amount,currencyCode:e.currencyCode}},Number(e.amount)<=0&&!l&&!s?d:n),i,o)}catch(d){throw g.updateFailed(i,"updatePayment"),d}}function Sa(t){return window[Pa(t)]}function Pa(t){return"paypal-".concat(t.replace(/[^a-zA-Z0-9]/g,""))}function Dt(t){if(!t)return null;const e=getComputedStyle(t).borderRadius;return e.includes("px")?parseInt(e,10):null}function vt(t){if(!t)return null;const e=getComputedStyle(t).height;return e.includes("px")?parseInt(e,10):null}const nr=25,hn=55,sc=["cart_not_ready","cart_throttled"],ar="PAYPAL_CALLBACK_HANDLED_ERROR";var _e,le;class lc extends Te{constructor(){super(),c(this,"name",b.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,"prevBorderRadius",0),c(this,"prevHeight",0),O(this,_e),O(this,le,!1),k(this,_e,this.attachShadow({mode:"closed"})),this.resizeObserver=qe("ResizeObserver",()=>this.onResize())}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}async disconnectedCallback(){this.innerHTML="",A(this,_e).innerHTML="",await this.teardownPayPalButton(),this.resizeObserver&&this.resizeObserver.disconnect()}async teardownPayPalButton(){var e;try{await((e=this.sdkButtonsComponent)==null?void 0:e.close().catch(()=>{}))}catch(n){}finally{this.sdkButtonsComponent=void 0}}async onResize(){const e=Dt(this.container),n=vt(this.container),r=e!==null&&this.prevBorderRadius!==e||n!==null&&this.prevHeight!==n;!this.rendering&&r&&(await this.teardownPayPalButton(),this.container.innerHTML="",await this.cleanupOnFailure(()=>this.renderFromPayPalSDK(),this.name))}async render(){var e;const n=document.createElement("div");n.className=ve.BUTTON;const r=document.createElement("style");r.innerHTML=ic,this.appendChild(r),await this.initializeShadowStyles(A(this,_e),oc),A(this,_e).appendChild(n),this.container=n,this.renderFromPayPalSDK(),(e=this.resizeObserver)==null||e.observe(this.container)}
1getHeight(){const e=vt(this.container);return e?e>=nr&&e<=hn?e:e<nr?(console.debug("[PayPalButton] Container height is less than the minimum height of the PayPal button. Using the minimum height of 25px."),nr):(console.debug("[PayPalButton] Container height is greater than the maximum height of the PayPal button. Using the maximum height of 55px."),hn):mi}async renderFromPayPalSDK(){var e,n,r;if(!this.container)throw new Error("button container not set when attempting to render");this.rendering=!0;const a=()=>this.createToken(this.apiClient);let i,o;this.requiresBillingAgreement()?o=a:i=a;const s=Dt(this.container),l=this.getHeight();this.prevHeight=l;const d={color:"gold",label:this.isCTA?"pay":"paypal",disableMaxWidth:!0,height:l,shape:"sharp"};s&&s>0&&(d.borderRadius=s,this.prevBorderRadius=s);const u=await this.i18n;this.sdkButtonsComponent=(n=(e=Sa(this.walletParams.sdkUrl))==null?void 0:e.Buttons)==null?void 0:n.call(e,{fundingSource:"paypal",style:d,createOrder:i,createBillingAgreement:o,onApprove:async h=>{await this.onApprove(h)},onCancel:()=>{this.cancelPaymentSheet("Payment sheet cancelled")},onClick:this.onClick.bind(this),onError:h=>{this.onError(h,u)}}),await((r=this.sdkButtonsComponent)==null?void 0:r.render(this.container)),this.rendering=!1,this.onRendered()}cancelPaymentSheet(e){var n;k(this,le,!0),g.sheetCancelled(this.name),(n=this.abortController)==null||n.abort("[PayPal] ".concat(e))}async onClick(e,n){var r,a;if(this.disabled)return n.reject();k(this,le,!1),this.abortController=qe("AbortController");const i=this.getBoundingClientRect(),o=i.left+i.width/2,s=i.top+i.height/2,l=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1,clientX:o,clientY:s,screenX:window.screenX+o,screenY:window.screenY+s});this.dispatchEvent(l);const[d,u]=await Promise.all([this.dataSource,this.i18n]);try{const{decelerationReason:h,cart:p,customValidationError:m,unrecoverableError:_}=await me({element:this,instrumentName:this.name,dataSource:d});if(_)return g.sheetClicked({instrument:this.name,result:"failed"}),Ne(u,_),n.reject();if(m)return Re(u,m.message),n.reject();const{hasManagedSellingPlanState:C}=this.walletParams;return C!=null&&C!==this.hasSellingPlan?(ue((r=p==null?void 0:p.checkoutUrl)!=null?r:""),n.reject()):h?(M({checkoutUrl:(a=p==null?void 0:p.checkoutUrl)!=null?a:"",instrumentName:this.name,reason:h}),n.reject()):(this.cartId=p.id,n.resolve())}catch(h){return g.sheetClicked({instrument:this.name,result:"failed"}),f.notify(h),gt(u),n.reject()}}async createToken(e){const n=await e;try{if(!this.cartId)throw new Error("cartId not found when creating token");const r=await n.paypalTokenCreate(this.cartId);return g.sheetClicked({instrument:this.name,result:"success"}),r}catch(r){throw A(this,le)||(g.sheetClicked({instrument:this.name,result:"failed"}),f.notify(r)),new Error(ar)}}async onApprove({orderID:e,payerID:n,billingToken:r}){var a;try{if(g.authorizationAttempt(this.name),We(F.AuthorizationLatency,this.name),!this.cartId)throw new Error("Cart not found");const i=await this.apiClient,o=this.requiresBillingAgreement()&&r!=null?r:e,{billingAddress:s,destinationAddress:l,expiresAt:d,email:u,remoteOrderId:h}=await i.paypalBuyerDetailsFetch(o,this.cartId),{data:p,decelerationReason:m}=await Fe({cartId:this.cartId,cartClient:i,instrumentName:this.name,emailAddress:u,streetAddress:l});if(!p)throw new Error("Cart not found");const{id:_,checkoutUrl:C,totalAmount:E}=p;if(this.shouldDecelerate(m)){M({checkoutUrl:C,instrumentName:this.name,reason:m});return}const{decelerationReason:P}=await Mr({abortSignal:(a=this.abortController)==null?void 0:a.signal,cartClient:i,cartId:_,instrumentName:b.PayPal,billingAddress:s!=null?s:l,paymentMethod:{walletPaymentMethod:{paypalWalletContent:{billingAddress:s!=null?s:l,email:u,expiresAt:d,payerId:n,token:h!=null?h:e,acceptedSubscriptionTerms:!1,vaultingAgreement:!1,merchantId:this.walletParams.merchantId}}},canUsePaymentMethodForFreeOrder:!0,totalAmount:E});if(this.shouldDecelerate(P)){M({checkoutUrl:C,instrumentName:this.name,reason:P});return}if(Nr({currentCartTotal:E,initialBuyerCurrency:this.buyerCurrency})){M({checkoutUrl:C,instrumentName:this.name,reason:"currency_changed"});return}g.authorizationComplete({instrument:this.name,result:"success",measurement:Z(F.AuthorizationLatency,this.name)}),ue(C)}catch(i){throw A(this,le)||(g.authorizationComplete({instrument:this.name,result:"failed",measurement:Z(F.AuthorizationLatency,this.name)}),f.notify(i)),new Error(ar)}}onError(e,n){if(A(this,le)||e.message.includes(ar))return;if(e.message==="Window is closed, can not determine type"){this.cancelPaymentSheet("Window Closed Error");return}if(e.message==="Detected popup close"){this.cancelPaymentSheet("Popup Closed Error");return}e.message==="RESTRICTED_WALLET_ACCOUNT"?g.log({body:"PayPal modal closed due to error: ".concat(e)}):f.notify(new cc(e));const r=n.translate("brand.paypal");Q(r,n)}requiresBillingAgreement(){return this.walletParams.hasManagedSellingPlanState||this.walletParams.requiresBillingAgreement}shouldDecelerate(e){return!!(e&&sc.includes(e))}}_e=new WeakMap,le=new WeakMap;
1class cc extends Error{constructor(e){e instanceof Error?(super(e.message,{cause:e.cause}),this.stack=e.stack):super(String(e)),this.name="PayPalError"}}const Le=class eu extends ye{static walletName(){return"paypal"}constructor(e){super(e)}getWebComponentName(){return"shopify-paypal-button"}getInstrumentName(){return b.PayPal}getWebComponentClass(){return lc}loadWalletSDK(){let e=eu.paypalSDKPromiseByUrl.get(this.walletParams.sdkUrl);if(e)return e;const n=document.createElement("script");return n.setAttribute("src",this.walletParams.sdkUrl),e=new Promise((r,a)=>{n.setAttribute("data-namespace",Pa(this.walletParams.sdkUrl)),n.onload=()=>r(),n.onerror=i=>{eu.paypalSDKPromiseByUrl.delete(this.walletParams.sdkUrl),n&&document.body.contains(n)&&document.body.removeChild(n),a(i)},document.body.appendChild(n)}),eu.paypalSDKPromiseByUrl.set(this.walletParams.sdkUrl,e),e}getLoadEligibility(){return{eligible:!0}}getPartnerSDKEligibility(){var e,n;try{return(n=(e=Sa(this.walletParams.sdkUrl))==null?void 0:e.Buttons)!=null&&n.call(e).isEligible()?{eligible:!0}:{eligible:!1,reason:"PayPal SDK not eligible"}}catch(r){throw new ee({code:"paypal-sdk-eligibility-check-failed",message:"PayPal SDK 'isEligible' method failed unexpectedly: ".concat(r)})}}};c(Le,"paypalSDKPromiseByUrl",new Map);let mr=Le;const dc=".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}",yr={UK:"GB",JA:"JP"},Ia=["AS","GU","MP","PR","VI"];Ia.forEach(t=>{yr[t]="US"});function _t(t){var e,n;const r=t.countryCode,a={firstName:t.givenName||void 0,lastName:t.familyName||void 0,address1:(e=t==null?void 0:t.addressLines)==null?void 0:e[0],address2:((n=t==null?void 0:t.addressLines)==null?void 0:n[1])||void 0,city:t.locality||void 0,zip:t.postalCode||void 0,province:t.administrativeArea||t.subLocality||void 0,country:uc(t.countryCode),phone:t.phoneNumber||void 0};return a.country==="HK"&&(a.zip=void 0,a.province=t.postalCode),r&&Ia.includes(r)&&(a.province=r),a.lastName||(a.lastName=a.firstName),a}function uc(t){if(!t)return"ZZ";const e=t.toUpperCase();return Object.keys(yr).includes(e)?yr[e]:e}function hc(t,e){return t.map(n=>{const{title:r,deliveryPromise:a}=yc(n,e);return{title:r,estimatedCost:{amount:mc(n),currencyCode:n[0].estimatedCost.currencyCode},handle:va(n),deliveryPromise:a}})}function pc(t,e){return t.map(n=>{const{title:r,description:a}=gc(n,e);return{title:r,description:a,handle:va(n)}})}function Da({deliveryGroups:t}){return t.map(e=>e.deliveryOptions.filter(({deliveryMethodType:n})=>n==="SHIPPING").map(n=>T(w({},n),{groupType:e.groupType}))).reduce((e,n)=>e.flatMap(r=>n.map(a=>[...r,a])),[[]])}function mc(t){return t.reduce((e,n)=>e+Number(n.estimatedCost.amount),0).toFixed(2)}function yc(t,e){const n=t.find(l=>l.groupType===De.OneTimePurchase),r=t.find(l=>l.groupType===De.Subscription),a=[...new Set([n==null?void 0:n.title,r==null?void 0:r.title])].filter(Boolean),i=[...new Set([n==null?void 0:n.deliveryPromise,r==null?void 0:r.deliveryPromise])].filter(Boolean),o=a.length===2?e.translate("shipping_methods.connect_shipping_methods",{methodOne:a[0],methodTwo:a[1]}):a[0],s=i.length===2?e.translate("delivery_promises.connect_delivery_promises",{promiseOne:i[0],promiseTwo:i[1]}):i[0];return{title:o,deliveryPromise:s}}function gc(t,e){const n=t.find(o=>o.groupType===De.OneTimePurchase),r=t.find(o=>o.groupType===De.Subscription),a=t.map(fc).filter(Boolean).join(", ");let i=(n==null?void 0:n.title)||(r==null?void 0:r.title);return n&&r&&(i=e.translate("shipping_methods.connect_shipping_methods",{methodOne:n.title,methodTwo:r.title})),{title:i,description:a}}function fc(t){const e=Number(t.estimatedCost.amount).toFixed(2),n=t.estimatedCost.currencyCode,r=t.deliveryPromise;return r?"(".concat(r,") ").concat(e," ").concat(n):"".concat(e," ").concat(n)}function va(t){return t.map(e=>e.handle).join(",")}function Ra({deliveryGroups:t,i18n:e}){const n=t.some(r=>r.groupType===De.Subscription);return t.map(r=>{var a;let i=e.translate("order_summary.shipping");return n&&(i=r.groupType===De.Subscription?e.translate("order_summary.shipping_subscription"):e.translate("order_summary.shipping_one_time_purchase")),{label:i,amount:Ie(((a=r.selectedDeliveryOption)==null?void 0:a.estimatedCost.amount)||0)}})}function bc(t,e){return nt({label:t,possibleLines:[e]})[0]}function wc({subtotal:t,deliveryGroups:e,duties:n,taxes:r,discountAllocations:a,i18n:i,formattedRecurringTotals:o}){var s;const l=nt({label:i.translate("order_summary.subtotal"),possibleLines:[t]}),d=Ra({deliveryGroups:e,i18n:i}),u=nt({label:i.translate("order_summary.duties"),possibleLines:[n]}),h=nt({label:i.translate("order_summary.taxes"),possibleLines:[r]}),p=o.map(C=>({label:C,amount:"0.00",type:"pending"})),m=p.length?[{label:i.translate("order_summary.subscriptions.recurring_total_tooltip_line"),amount:"0.00",type:"pending"}]:[],_=(s=a==null?void 0:a.flatMap(C=>{var E;const P=(E=C.title)!=null?E:C.code;return nt({label:P!=null?P:i.translate("order_summary.discount"),possibleLines:[C.discountedAmount],isDiscount:!0})}
1))!=null?s:[];return[...l,...d,...u,...h,..._,...p,...m]}function nt({label:t,possibleLines:e,isDiscount:n=!1}){return e.filter(r=>(r==null?void 0:r.amount)!==void 0).map(r=>({label:t,amount:n?"-".concat(Ie(r.amount)):Ie(r.amount)}))}function _c(t,e){if(!t.length)return[];const n=Da({deliveryGroups:t});return hc(n,e).map(r=>{var a;return{label:r.title||"",amount:r.estimatedCost.amount,identifier:r.handle,detail:(a=r.deliveryPromise)!=null?a:""}})}const ir=async({paymentSheetAction:t,onProceed:e,terminateSession:n})=>{switch(t.action){case"abort":n();break;case"show_error":await e(t.errors);break;case"update":await e(t.errors);break;default:throw new Error('Missing handler for payment sheet action "'.concat(t.action,'"'))}},Ec=["decelerate","abort","show_error","complete","update"];class Rt extends Error{constructor(){super(...arguments),c(this,"name","UnhandledActionError")}}class Na{constructor(){c(this,"generatePrioritizedPaymentSheetAction",(e,n)=>{let r;const a=[],i=[],o=[],s=n.filter(d=>d!==y.UnacceptablePaymentsAmount).some(d=>e[d]!==void 0);for(const d of Object.keys(e))if(!(d===y.UnacceptablePaymentsAmount&&s)){const u=e[d]();u.effects&&i.push(...u.effects),u.action!=="complete"&&u.errors&&o.push(...u.errors),a.push(u)}const l=(d=>Ec.map(u=>d.find(h=>h.action===u)).find(u=>!!u))(a);return l&&(r=l,r.effects=i,r.action!=="complete"&&(r.errors=o)),r})}getMergedPaymentSheetAction({result:e,errorActions:n}){const r={};n.forEach(i=>{i.errors.forEach(o=>{e.errors.includes(o)&&(r[o]=i.generateAction)})});let a;for(const i of e.errors){const o=r[i];if(o){a=o();break}}return{firstPaymentSheetAction:a,prioritizedPaymentSheetAction:this.generatePrioritizedPaymentSheetAction(r,e.errors)}}getUnhandledErrors(e,n){const r=n.flatMap(a=>a.errors);return e.filter(a=>!r.includes(a))}decelerateOrAbort({reason:e,instrumentName:n,errorOrWarning:r,result:a}){var i,o;return((i=a==null?void 0:a.data)==null?void 0:i.__typename)==="SubmitFailed"?{action:"decelerate",redirectUrl:(o=a.data)==null?void 0:o.checkoutUrl,reason:e}:{action:"abort",effects:[()=>{var s;f.notify(new Error("[".concat(n,"] unexpected ").concat(r," received in ").concat((s=a==null?void 0:a.data)==null?void 0:s.__typename," response, aborting")))}]}}}class Ac extends Na{constructor(e){super(),c(this,"completionResult"),this.i18n=e,this.completionResult=null}mapMutationResultToPaymentSheetAction(e,n){var r;const a=this.mapCustomValidationFunctionErrorToAction(e.errors);if(a)return a;const i=this.getErrorActions({shippingCountryCode:n==null?void 0:n.shippingCountryCode}),o=e.errors,s=this.getUnhandledErrors(o,i);if(s.forEach(d=>{f.notify(new Rt("[".concat(b.ApplePay,"] mutation result error not handled: ").concat(d)))}),((r=e.data)==null?void 0:r.deliveryGroups.length)===0&&n!=null&&n.shippingRequired)return{action:"show_error",errors:[new ApplePayError("addressUnserviceable")]};const{firstPaymentSheetAction:l}=this.getMergedPaymentSheetAction({result:e,errorActions:i});return l||(s.length>0?{action:"abort"}:{action:"update",errors:[]})}mapCompletionResultToPaymentSheetAction(e,n){if(!e.data)throw new Error("[".concat(b.ApplePay,"] completion returned null result"));switch(this.completionResult=e,e.data.__typename){case"SubmitSuccess":return{action:"complete",redirectUrl:e.data.redirectUrl};case"SubmitAlreadyAccepted":case"SubmitThrottled":case"SubmitFailed":{const r=this.mapCustomValidationFunctionErrorToAction(e.errors);if(r)return r;const a=this.getErrorActions({shippingCountryCode:n==null?void 0:n.shippingCountryCode}),i=e.errors;this.getUnhandledErrors(i,a).forEach(s=>{f.notify(new Error("[".concat(b.ApplePay,"] completion result error not handled: ").concat(s)))});const{prioritizedPaymentSheetAction:o}=this.getMergedPaymentSheetAction({result:e,errorActions:a});return o||{action:"abort"}}default:throw new Error("[".concat(b.ApplePay,"] unknown completion result type: ").concat(e.data.__typename))}}getErrorActions({shippingCountryCode:e}){return[{errors:[y.CaptchaCompletionRequired],generateAction:()=>this.decelerateOrAbort({reason:"captcha_required",instrumentName:b.ApplePay,errorOrWarning:y.CaptchaCompletionRequired,result:this.completionResult})},{errors:[y.InvalidLanguage],generateAction:()=>({action:"abort",effects:[()=>{f.notify(new Error("[".concat(b.ApplePay,"] mutation provided invali
1d language, aborting")))}]})},{errors:[y.InvalidCountry],generateAction:()=>({action:"abort",effects:[()=>{f.notify(new Error("[".concat(b.ApplePay,"] mutation provided invalid country, aborting")))}]})},{errors:[y.MissingCartId],generateAction:()=>({action:"abort",effects:[()=>{f.notify(new Error("[".concat(b.ApplePay,"] mutation provided invalid cart ID, aborting")))}]})},{errors:Ir,generateAction:()=>this.decelerateOrAbort({reason:"dynamic_tax",instrumentName:b.ApplePay,errorOrWarning:y.NewTaxMustBeAccepted,result:this.completionResult})},{errors:sa,generateAction:()=>({action:"abort"})},{errors:[y.MerchandiseNotEnoughStock],generateAction:()=>this.decelerateOrAbort({reason:"not_enough_stock",instrumentName:b.ApplePay,errorOrWarning:y.MerchandiseNotEnoughStock,result:this.completionResult})},{errors:la,generateAction:()=>this.decelerateOrAbort({reason:"out_of_stock",instrumentName:b.ApplePay,errorOrWarning:y.MerchandiseOutOfStock,result:this.completionResult})},{errors:oa,generateAction:()=>({action:"show_error",errors:[new ApplePayError("addressUnserviceable")]})},{errors:[y.BuyerIdentityEmailRequired],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","emailAddress",this.i18n.translate("errors.missing.email"))]})},{errors:Xi,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.missing.first_name"))]})},{errors:Ji,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.invalid.first_name"))]})},{errors:Zi,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.missing.last_name"))]})},{errors:eo,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.invalid.last_name"))]})},{errors:to,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.missing.address1"))]})},{errors:[y.DeliveryAddress1Invalid],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address1"))]})},{errors:ro,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.missing.address2"))]})},{errors:[y.DeliveryAddress2Invalid],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address2"))]})},{errors:no,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.missing.city"))]})},{errors:[y.DeliveryCityInvalid],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.invalid.city"))]})},{errors:[y.DeliveryZoneRequiredForCountry],generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.missing.zone"),this.i18n.translate("errors.missing.emirate"),"shippingContactInvalid",e)]})},{errors:[y.DeliveryZoneNotFound],generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.invalid.zone"),this.i18n.translate("errors.invalid.emirate"),"shippingContactInvalid",e)]})},{errors:ao,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.missing.postal_code"))]})},{errors:ia,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.invalid.postal_code"))]})},{errors:[y.DeliveryCountryRequired],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","country",this.i18n.translate("errors.missing.country"))]})},{errors:io,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","phoneNumber",this.i18n.translate("errors.missing.phone"))]})},{errors:so,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","phoneNumber",this.i18n.translate("errors.invalid.phone"))]})},{errors:oo,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","country",this.i18n.translate("errors.invalid.country"))]})},{errors:co,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid")]})},{errors:[y.UnsupportedApplePayPaymentMethod],generateAction:()=>({action:"abort",effects:[()=>{Q(this.i18n.translate("brand.apple_pay"),this.i18n)},()=>{f.notify(new Rt("[".concat(b.ApplePay,"] payment method is not supported")))}]})},{errors:[y.DeliveryLastNameContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.emojis.last_name"))]})},{errors:[y.DeliveryFirstNameContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.emojis.first_name"))]})},{errors:[y.DeliveryAddress1TooLong],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.too_long.address1"))]})},{errors:[y.DeliveryAddress2TooLong],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.too_long.address2"))]})},{errors:[y.DeliveryFirstNameTooLong],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.too_long.first_name"))]})},{errors:[y.DeliveryLastNameTooLong],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.too_long.last_name"))]})},{errors:[y.DeliveryCityTooLong],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.too_long.city"))]})},{errors:[y.DeliveryFirstNameContainsUrl],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.url.first_name"))]})},{errors:[y.DeliveryLastNameContainsUrl],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.url.last_name"))]})},{errors:[y.DeliveryAddress1ContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address1"))]})},{errors:[y.DeliveryAddress2ContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address2"))]})},{errors:[y.DeliveryCityContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.html_tags.city"))]})},{errors:[y.DeliveryFirstNameContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.html_tags.first_name"))]})},{errors:[y.DeliveryLastNameContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.html_tags.last_name"))]})},{errors:[y.DeliveryCityContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.emojis.city"))]})},{errors:[y.DeliveryAddress1ContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address1"))]})},{errors:[y.DeliveryAddress2ContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address2"))]})},{errors:[y.DeliveryPostalCodeContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.emojis.postal_code"))]})},{errors:[y.BuyerIdentityEmailInvalid],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","emailAddress",this.i18n.translate("errors.invalid.email"))]})},{errors:[y.DiscountNotApplicable],generateAction:()=>({action:"show_error",errors:[new ApplePayError("couponCodeInvalid",void 0,this.i18n.translate("errors.invalid.discount"))]})}]}mapCustomValidationFunctionErrorToAction(e){const n=Rr(e);return n?{action:"abort",effects:[()=>{const r=this.i18n.translate("brand.apple_pay");Tr(this.i18n.translate("error_dialogs.wallet.title",{wallet:r}),n.message)}]}:null}createApplePayZoneError(e,n,r,a){const i=a==="AE"?"subLocality":"administrativeArea";return new ApplePayError(r,i,a==="AE"?n:e)}}const pn=["name","postalAddress"];function Cc({shippingRequired:t,walletParams:e,buyerCurrency:n}){const{phoneRequired:r,emailRequired:a}=e,i=[...a?["email"]:[],...r?["phone"]:[]],o=t?[...pn,...i]:i;return{countryCode:e.countryCode,currencyCode:n,merchantCapabilities:e.merchantCapabilities,supportedNetworks:e.supportedNetworks,total:{type:"pending",label:e.merchantName,amount:"1.00"},requiredBillingContactFields:pn,requiredShippingContactFields:o,shippingType:e.shippingType}}const Sc=t=>{const e=t.lineItems.flatMap(n=>n.discountAllocations);return[...t.discountCodes.filter(n=>n.applicable&&t.discountAllocations.findIndex(r=>r.code===n.code)===-1&&e.findIndex(r=>r.code===n.code)===-1).map(n=>({code:n.code,discountedAmount:{amount:"0",currencyCode:t.totalAmount.currencyCode}})),...t.discountAllocations,...e]},Ta=t=>{const e=t.lineItems.reduce((n,r)=>n+Number(r.subtotalAmount.amount),0);return{amount:String(e),currencyCode:t.totalAmount.currencyCode}};function Pc(t,e){return t.reduce((n,r)=>{if(!r.sellingPlanAllocation)return n;const{sellingPlanAllocation:{sellingPlan:a,priceAdjustments:i},quantity:o}=r;if(!a.recurringDeliveries||!a.billingPolicy)return n;const s=Ic({billingPolicy:a.billingPolicy,i18n:e});if(i.length===0){const l=Et({price:Number(r.subtotalAmount.amount)*o,currencyCode:r.subtotalAmount.currencyCode,locale:e.locale});return[...n,e.translate("order_summary.subscriptions.recurring_totals",{fixedPrice:l,interval:s})]}else if(i.length===1){const l=Et({price:Number(i[0].price.amount)*o,currencyCode:i[0].price.currencyCode,locale:e.locale});return[...n,e.translate("order_summary.subscriptions.recurring_totals",{fixedPrice:l,interval:s})]}else if(i.length===2){const l=Et({price:Number(i[0].price.amount)*o,currencyCode:i[0].price.currencyCode,locale:e.locale}),d=Et({price:Number(i[1].price.amount)*o,currencyCode:i[1].price.currencyCode,locale:e.locale}),u=a.priceAdjustments[0].orderCount;return[...n,e.translate("order_summary.subscriptions.recurring_totals_with_policies",{count:u,fixedPrice:l,recurringPrice:d,interval:s})]}return n},[])}function Et({price:t,currencyCode:e,locale:n}){return Intl.NumberFormat(n,{style:"currency",currency:e,currencyDisplay:"narrowSymbol"}).format(t)}function Ic({billingPolicy:t,i18n:e}){const{interval:n,intervalCount:r}=t,a={YEAR:"order_summary.subscriptions.recurring_total_intervals.year",MONTH:"order_summary.subscriptions.recurring_total_intervals.month",WEEK:"order_summary.subscriptions.recurring_total_intervals.week",DAY:"order_summary.subscriptions.recurring_total_intervals.day"}[n];if(!a)throw new Error("Unknown selling plan interval provided: ".concat(n));return e.translate(a,{count:r})}async function ka({cartId:t,cartClient:e,instrumentName:n,selectedDeliveryOptions:r,abortSignal:a}){try{if(!t)throw new Error("[".concat(n,"] provided no cart ID when updating shipping method"));
1if(!e)throw new Error("[".concat(n,"] provided invalid cart client when updating shipping method"));return await e.updateSelectedDeliveryOptions(t,r,n,a)}catch(i){throw g.updateFailed(n,"updateSelectedDeliveryOptions"),i}}async function La({cartId:t,token:e,cartClient:n,instrumentName:r}){try{if(!t)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(!e)throw new Error("[".concat(r,"] provided no token when submitting for completion"));return await n.submitForCompletion(t,e,r)}catch(a){throw g.updateFailed(r,"submitForCompletion"),a}}function Oa({selectedDeliveryOptionHandles:t,deliveryGroups:e,instrumentName:n}){return e.map(r=>{const a=r.deliveryOptions.filter(i=>t.includes(i.handle));if(!a.length)throw new Error("[".concat(n,"] could not find delivery option for group: ").concat(r.id));if(a.length>1)throw new Error("[".concat(n,"] found multiple delivery options with selectedDeliverOptionHandle in group: ").concat(r.id));return{deliveryGroupId:r.id,deliveryOptionHandle:a[0].handle}})}async function Dc(t){const{cartClient:e,instrumentName:n}=t;try{if(!t.cartId)throw new Error("[".concat(n,"] provided no cart ID when updating billing address"));if(!e)throw new Error("[".concat(n,"] provided invalid cart client when updating billing address"));return await e.updateCartBillingAddress(t)}catch(r){throw g.updateFailed(n,"updateBillingAddress"),r}}function mn(t,e){return t.some(n=>e.includes(n))}function ot({result:t,instrument:e}){var n;const r=(n=t.errors)!=null?n:[];mn(r,Ir)&&g.dynamicTaxFailed({instrument:e}),mn(r,lo)&&g.dynamicShippingFailed({instrument:e})}const yn=["cart_not_ready","cart_throttled","not_enough_stock"];class vc{constructor({accessToken:e,buyerCountry:n,buyerCurrency:r,button:a,i18n:i,merchantName:o,dataSource:s,apiClient:l,walletParams:d}){c(this,"name",b.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,"onvalidatemerchant",async u=>{var h,p,m;try{const _=new URL(u.validationURL),C=this.getMerchantSession(_),{cart:E,decelerationReason:P,customValidationError:$,unrecoverableError:B}=await me({element:this.button,instrumentName:this.name,dataSource:this.dataSource});if(B){g.sheetClicked({instrument:this.name,result:"failed"}),this.session.abort(),(h=this.abortController)==null||h.abort("[Apple Pay] Unrecoverable error ".concat(B)),Ne(this.i18n,B);return}if($){this.session.abort(),(p=this.abortController)==null||p.abort("[Apple Pay] Custom validation error"),Re(this.i18n,$.message);return}this.cart=E;const Ye=await C;if(f.leaveBreadcrumb("ApplePay Session completeMerchantValidation",{session:Ye},"log"),P&&yn.includes(P)){await this.terminateSession(),M({checkoutUrl:(m=E==null?void 0:E.checkoutUrl)!=null?m:"",instrumentName:this.name,reason:P});return}if(this.sessionIsCancelled())return;this.session.completeMerchantValidation(Ye)}catch(_){g.sheetClicked({instrument:b.ApplePay,result:"failed"}),this.terminateSession(_)}}),c(this,"onshippingcontactselected",async u=>{try{const h=_t(u.shippingContact),p=await Fe({cartId:this.cart.id,streetAddress:h,cartClient:this.apiClient,instrumentName:this.name});if(!p.data)throw new Error("Missing cart during Apple Pay Session creation");if(await this.decelerateIfNeeded(p))return;await this.applyPaymentSheetActions(p,m=>this.completeShippingContactSelection(p.data,m),{shippingRequired:this.isShippingRequired,shippingCountryCode:h.country})}catch(h){this.terminateSession(h)}}),c(this,"onshippingmethodselected",async u=>{var h;try{const p=u.shippingMethod.identifier.split(","),m=Oa({selectedDeliveryOptionHandles:p,deliveryGroups:this.cart.deliveryGroups,instrumentName:this.name}),_=await ka({cartId:this.cart.id,cartClient:this.apiClient,instrumentName:this.name,selectedDeliveryOptions:m,abortSignal:(h=this.abortController)==null?void 0:h.signal});if(await this.decelerateIfNeeded(_))return;await this.applyPaymentSheetActions(_,()=>this.completeShippingMethodSelection(_.data),{shippingRequired:this.isShippingRequired,shippingCountryCode:void 0}),this.onSheetLoaded()}catch(p){this.terminateSession(p)}}),c(this,"onpaymentmethodselected",async u=>{try{const{billingContact:h}=u.paymentMethod;if(!this.isShippingRequired&&h){const _=_t(h),C=await Fe({cartId:this.cart.id,countryCode:_.country,cartClient:this.apiClient,instrumentName:this.name});if(!C.data)throw new Error("Missing cart during Apple Pay Session creation");if(await this.decelerateIfNeeded(C))return;await this.applyPaymentSheetActions(C,()=>this.cart=C.data,{shippingRequired:this.isShippingRequired,shippingCountryCode:_.country});const E=await Dc({billingAddress:_,cartId:this.cart.id,cartClient:this.apiClient,instrumentName:this.name});await this.applyPaymentSheetActions(E,()=>this.cart=E.data,{shippingRequired:this.isShippingRequired,shippingCountryCode:_.country})}const{newTotal:p,newLineItems:m}=this.getNewTotalAndLineItems(this.cart);if(f.leaveBreadcrumb("ApplePay Session completePaymentMethodSelection",{newTotal:p,newLineItems:m},"log"),this.sessionIsCancelled())return;this.session.completePaymentMethodSelection({newTotal:p,newLineItems:m}),this.isShippingRequired||this.onSheetLoaded()}catch(h){this.terminateSession(h)}}),c(this,"oncancel",()=>{var u;this.cancelled=!0,this.removePersonalData(),Z(F.SheetLoad,this.name),g.sheetCancelled(this.name),this.button.disabled=!1,(u=this.abortController)==null||u.abort("[Apple Pay] Payment sheet cancelled")}),c(this,"onpaymentauthorized",async u=>{g.authorizationAttempt(this.name),We(F.AuthorizationLatency,this.name);const h=N=>{g.authorizationComplete({instrument:this.name,measurement:Z(F.AuthorizationLatency,this.name),result:"failed"}),this.terminateSession(N)},p=async N=>{var G,L;switch((G=N.effects)==null||G.forEach(x=>x()),N.action){case"complete":{const x=ApplePaySession.STATUS_SUCCESS;try{await this.completePayment(x),ue(N.redirectUrl)}catch(ie){h(ie)}break}case"show_error":{const x=(L=N.errors)!=null?L:[];try{await this.completePayment(ApplePaySession.STATUS_FAILURE,x)}catch(ie){h(ie)}break}case"abort":{try{this.abortPaymentSheetAndShowError(),this.removePersonalData()}catch(x){h(x)}break}case"decelerate":{try{await this.completePayment(ApplePaySession.STATUS_FAILURE),await this.removePersonalData(),M({checkoutUrl:N.redirectUrl,instrumentName:this.name,reason:N.reason})}catch(x){h(x)}break}
1default:h(new Error("[".concat(this.name,"] completion action not handled: ").concat(N.action)))}},{token:m,billingContact:_,shippingContact:C}=u.payment;let E=null,P=null;try{if(!_){await this.completePayment(ApplePaySession.STATUS_FAILURE);return}if(E=_t(T(w({},_),{phoneNumber:C==null?void 0:C.phoneNumber})),this.isShippingRequired){if(!C){await this.completePayment(ApplePaySession.STATUS_FAILURE);return}P=_t(C)}}catch(N){h(N);return}const $=async()=>{var N;try{const G=this.isShippingRequired?{validateAddress:!0,streetAddress:P}:{},L=(N=this.customerAccountEmail)!=null?N:C==null?void 0:C.emailAddress,x=await Fe(w({cartId:this.cart.id,emailAddress:L,cartClient:this.apiClient,instrumentName:this.name},G));if(ot({result:x,instrument:this.name}),await this.decelerateIfNeeded(x))return;const ie=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction(x,{shippingRequired:this.isShippingRequired,shippingCountryCode:P==null?void 0:P.country});await ir({paymentSheetAction:ie,onProceed:async ft=>{ft&&ft.length>0?await this.completePayment(ApplePaySession.STATUS_FAILURE,ft):await B()},terminateSession:h})}catch(G){h(G)}},B=async()=>{var N;try{const G=this.cart.lineItems.some(ie=>!!ie.sellingPlanAllocation),L=await Mr({cartId:this.cart.id,totalAmount:this.cart.totalAmount,paymentMethod:{walletPaymentMethod:{applePayWalletContent:{billingAddress:E,data:m.paymentData.data,header:m.paymentData.header,lastDigits:m.paymentMethod.displayName.split(" ")[1],signature:m.paymentData.signature,version:m.paymentData.version}}},canUsePaymentMethodForFreeOrder:!1,billingAddress:E,cartClient:this.apiClient,instrumentName:this.name,hasSellingPlan:G,abortSignal:(N=this.abortController)==null?void 0:N.signal});if(ot({result:L,instrument:this.name}),await this.decelerateIfNeeded(L))return;const x=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction(L,{shippingRequired:this.isShippingRequired,shippingCountryCode:P==null?void 0:P.country});await ir({paymentSheetAction:x,onProceed:async ie=>{ie&&ie.length>0?await this.completePayment(ApplePaySession.STATUS_FAILURE,ie):await Ye()},terminateSession:h})}catch(G){h(G)}},Ye=async()=>{try{const N=await La({cartId:this.cart.id,token:m.transactionIdentifier,cartClient:this.apiClient,instrumentName:this.name});ot({result:N,instrument:this.name});const G=this.paymentSheetActionGenerator.mapCompletionResultToPaymentSheetAction(N,{shippingRequired:this.isShippingRequired,shippingCountryCode:P==null?void 0:P.country});await p(G)}catch(N){h(N)}};await $()}),c(this,"terminateSession",async u=>{var h;try{this.button.disabled=!1,Z(F.SheetLoad,this.name),u&&f.notify(u),g.sheetFailed(this.name,u);try{f.leaveBreadcrumb("ApplePay Session abort",{},"log"),this.session.abort(),(h=this.abortController)==null||h.abort("[Apple Pay] Payment sheet terminated")}catch(p){console.debug("[DEBUG] InvalidAccessError occurred during Apple Pay terminateSession")}if(u){const p=this.i18n.translate("brand.apple_pay");Q(p,this.i18n)}}finally{await this.removePersonalData()}}),c(this,"getMostRecentNonNullCart",(u,h)=>u?(this.cart=u,u):h),c(this,"handleNullCart",u=>{if(!u)throw new Error("[".concat(this.name,"] no cart returned on mutation, aborting"))}),c(this,"completeShippingContactSelection",(u,h)=>{try{const p=this.getMostRecentNonNullCart(u,this.cart),{newTotal:m,newLineItems:_}=this.getNewTotalAndLineItems(p),C=_c(p.deliveryGroups,this.i18n);f.leaveBreadcrumb("ApplePay Session completeShippingContactSelection",{errors:h,newTotal:m,newLineItems:_,newShippingMethods:C},"log"),this.session.completeShippingContactSelection({errors:h!=null?h:[],newTotal:m,newLineItems:_,newShippingMethods:C})}catch(p){this.terminateSession(p)}}),c(this,"completeShippingMethodSelection",u=>{try{this.handleNullCart(u),this.cart=u;const{newTotal:h,newLineItems:p}=this.getNewTotalAndLineItems(u);f.leaveBreadcrumb("ApplePay Session completeShippingContactSelection",{newTotal:h,newLineItems:p},"log"),this.session.completeShippingMethodSelection({newTotal:h,newLineItems:p})}catch(h){this.terminateSession(h)}}),c(this,"sessionIsCancelled",()=>this.cancelled),this.accessToken=e,this.buyerCountry=n,this.button=a,this.cart=null,this.apiClient=l,this.dataSource=s,this.i18n=i,this.merchantName=o,this.cancelled=!1,this.buyerCurrency=r,this.customerAccountEmail=d.customerAccountEmail,this.session=new ApplePaySession(xn,Cc({shippingRequired:this.isShippingRequired,walletParams:d,buyerCurrency:r})),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 Ac(i)}begin(){f.leaveBreadcrumb("ApplePay Session begin",{},"log"),this.abortController=qe("AbortController"),this.session.begin()}async applyPaymentSheetActions(e,n,r){var a;const i=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction(e,r);(a=i.effects)==null||a.forEach(o=>o()),!this.sessionIsCancelled()&&await ir({paymentSheetAction:i,onProceed:n,terminateSession:this.terminateSession})}async getMerchantSession(e){const n=await new $t({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale,apiVersion:"unstable"}).applePaySessionCreate(e);return JSON.parse(n)}abortPaymentSheetAndShowError(){f.leaveBreadcrumb("ApplePay Session abort",{},"log"),this.session.abort(),this.button.disabled=!1;const e=this.i18n.translate("brand.apple_pay");Q(e,this.i18n),this.emitPaymentCompleteTelemetry(ApplePaySession.STATUS_FAILURE)}emitPaymentCompleteTelemetry(e){g.authorizationComplete({instrument:this.name,measurement:Z(F.AuthorizationLatency,this.name),result:e===ApplePaySession.STATUS_SUCCESS?"success":"failed"})}async completePayment(e,n=void 0){f.leaveBreadcrumb("ApplePay Session completePayment",{status:e,errors:n},"log"),this.session.completePayment({status:e,errors:n}),this.emitPaymentCompleteTelemetry(e)}getNewTotalAndLineItems(e){return{newTotal:bc(this.merchantName,e.totalAmount),newLineItems:wc({subtotal:Ta(e),discountAllocations:Sc(e),deliveryGroups:e.deliveryGroups,duties:e.totalDutyAmount,taxes:e.totalTaxAmount,i18n:this.i18n,formattedRecurringTotals:Pc(this.cart.lineItems,this.i18n)})}}async decelerateIfNeeded(e){if(!e.data)return!1;const{checkoutUrl:n,totalAmount:r}=e.data;let a;if(e.decelerationReason&&yn.includes(e.decelerationReason)?a=e.decelerationReason:Nr
1({currentCartTotal:r,initialBuyerCurrency:this.buyerCurrency})&&(a="currency_changed"),a){try{await this.terminateSession()}finally{M({checkoutUrl:n,instrumentName:this.name,reason:a})}return!0}return!1}get isShippingRequired(){return this.button.isShippingRequired}async removePersonalData(){this.isPersonalDataCleared||!this.cart||(await this.apiClient.cartRemovePersonalData({cartId:this.cart.id,instrumentName:this.name}),this.isPersonalDataCleared=!0)}onSheetLoaded(){if(this.isSheetLoaded)return;this.isSheetLoaded=!0;const e=Z(F.SheetLoad,this.name);e&&g.sheetLoaded({instrument:this.name,measurement:e})}}function Fr({translate:t,logoElement:e,setAriaHidden:n}){const r=document.createElement("div");return t("buy_with_button_content",{wallet:"LOGO_PLACEHOLDER"}).split(new RegExp("(LOGO_PLACEHOLDER)")).filter(Boolean).forEach(a=>{let i;a==="LOGO_PLACEHOLDER"?i=e:(i=document.createElement("span"),i.innerText=a,n&&i.setAttribute("aria-hidden","true")),r.appendChild(i)}),r}var $e;class Rc extends Te{constructor(){super(),c(this,"name",b.ApplePay),c(this,"button",null),O(this,$e),k(this,$e,this.attachShadow({mode:"closed"}))}static get observedAttributes(){return["disabled"]}get merchantName(){return this.walletParams.merchantName}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}attributeChangedCallback(e,n,r){super.attributeChangedCallback(e,n,r,this.button)}async handleClick(e){if(e.preventDefault(),this.disabled||!this.button||this.button.hasAttribute("aria-disabled"))return;this.disabled=!0;const[n,r,a]=await Promise.all([this.i18n,this.dataSource,this.apiClient]);We(F.SheetLoad,this.name);let i;try{if(i=new vc({accessToken:this.accessToken,buyerCountry:this.buyerCountry,buyerCurrency:this.buyerCurrency,button:this,i18n:n,merchantName:this.merchantName,dataSource:r,apiClient:a,walletParams:this.walletParams}),!i)throw new Error("missing ApplePaySession");i.begin(),g.sheetClicked({instrument:this.name,result:"success"})}catch(o){f.notify(o),g.sheetClicked({instrument:this.name,result:"failed"}),i==null||i.terminateSession()}}async render(){var e;const{translate:n}=await this.i18n,r=new DOMParser().parseFromString(Ma.applePayLogo,"image/svg+xml").documentElement;if(!this.button){const a=this.isCTA?n("buy_with_button_content",{wallet:n("brand.apple_pay")}):n("brand.apple_pay");if(this.button=Gt({label:a}),this.button.onclick=i=>this.handleClick(i),this.button.classList.add("apple-pay-button",pi[this.buttonTheme],ve.BUTTON),this.isCTA){const i=Fr({translate:n,logoElement:r,setAriaHidden:!0});i.classList.add("apple-pay--content"),this.button.appendChild(i)}else this.button.appendChild(r);this.initializeShadowStyles(A(this,$e),dc),A(this,$e).appendChild(this.button),this.ensureLightDOMIsNotEmpty(),(e=this.onRendered)==null||e.call(this)}this.disabled&&(this.button.setAttribute("disabled",""),this.button.setAttribute("aria-disabled","true"))}}$e=new WeakMap;function Ur(t){return function(e,n,r){const a=r.value;return r.value=function(...i){const o=a.apply(this,i);return o.eligible||console.debug("[DEBUG] ".concat(t," could not be rendered. Reason: ").concat(o.reason)),o},r}}var Nc=Object.defineProperty,Tc=Object.getOwnPropertyDescriptor,xa=(t,e,n,r)=>{for(var a=Tc(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(a=o(e,n,a)||a);return a&&Nc(e,n,a),a},ce;const Br=(ce=class extends ye{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 Rc}getInstrumentName(){return b.ApplePay}applePayInIframe(){return typeof window>"u"||window.self!==window.top}getLoadEligibility(){return this.applePayInIframe()?{eligible:!1,reason:"cannot be loaded in an iframe"}:{eligible:!0}}getPartnerSDKEligibility(){var t,e,n,r;if(typeof window>"u"||window.ApplePaySession===void 0)return{eligible:!1,reason:"window or ApplePaySession is undefined"};try{if(!((e=(t=window.ApplePaySession).supportsVersion)!=null&&e.call(t,xn)))return{eligible:!1,reason:"SDK does not meet minimum version requirement"};if(!((r=(n=window.ApplePaySession).canMakePayments)!=null&&r.call(n)))return{eligible:!1,reason:"failed SDK eligibility check"}}catch(a){return{eligible:!1,reason:"error in SDK eligibility checks"}}return{eligible:!0}}async loadWalletSDK(){await this.loadAppleLogo()}async loadAppleLogo(){if(ce.applePayLogo=(await import("./apple-pay-logo-BZB6IYWC.js")).default,!ce.applePayLogo)throw new Error("Apple Pay logo is empty")}},c(ce,"applePayLogo",""),ce);xa([Ur("Apple Pay")],Br.prototype,"getLoadEligibility"),xa([Ur("Apple Pay")],Br.prototype,"getPartnerSDKEligibility");let Ma=Br;
1const kc=".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}";class Nt extends Error{constructor(){super(...arguments),c(this,"name","MissingAccessTokenError")}}class $r extends Error{constructor(){super(...arguments),c(this,"name","FetchingWalletsPlatformConfigError")}}class Hr extends Error{constructor(){super(...arguments),c(this,"name","EmptyLineItemsWalletsPlatformConfigError")}}async function Fa({configOptionsEndpoint:t,checkoutUrl:e,sourceId:n,accessToken:r,instrument:a}){try{const i=JSON.stringify({checkout_url:e,checkout_cancel_url:window.location.href,cart_id:n}),o=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":r},body:i});if(o.ok)return o.json();const s=await o.json();throw s.error?new Error(s.error):new Error("Could not fetch wallets platform configs: [".concat(o.status,"] ").concat(o.statusText))}catch(i){const{message:o}=i!=null?i:{};switch(o){case"empty_line_items":throw new Hr("[Fetch Pay Config][".concat(a,"] No eligible line items provided in the config request."));default:throw new $r("[Fetch Pay Config][".concat(a,"] ").concat(o))}}}const Lc={[S.Checkout]:"Checkout",[S.CartAjax]:"Cart",[S.CartPage]:"Cart",[S.ProductPage]:"Product",[S.Unknown]:"Product"};var ut;const Oe=class tu extends Te{constructor(){super(...arguments),c(this,"name",b.BuyWithPrime),c(this,"button",null),c(this,"apiClientId",""),O(this,ut,this.attachShadow({mode:"closed"}))}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name),this.handleOnSendCheckoutAction=this.handleOnSendCheckoutAction.bind(this)}async triggerCheckout(){this.handleClick({showDisabledStyles:!1})}async createButton(){const{translate:e}=await this.i18n,n=Gt({label:e("brand.buy_with_prime")});return n.type="button",n.className="buy-with-prime-button",this.applyEnabledStyles(n),n}applyEnabledStyles(e){e.innerHTML=ct.primeLogo,e.disabled=!1,dn(e,{"background-color":"#1A98FF",color:"#FFFFFF",cursor:"pointer"})}applyDisabledStyles(e){e.innerHTML=ct.primeLogoDark,e.disabled=!0,dn(e,{"background-color":"#C0E3FF",color:"#7292AC",cursor:"not-allowed"})}async handleClick(e={showDisabledStyles:!0}){var n,r,a;if(!this.button)return;const[i,o]=await Promise.all([this.i18n,this.dataSource]);let s=[];try{e.showDisabledStyles&&this.applyDisabledStyles(this.button);let l=this.walletParams;if(this.apiClientId=this.apiClientId||l.appId||"",!l.createCheckoutSessionConfig){const{cart:u,decelerationReason:h,customValidationError:p,unrecoverableError:m}=await me({element:this,instrumentName:this.name,dataSource:o});if(m){g.sheetClicked({instrument:this.name,result:"failed",webPixelMetaData:this.apiClientId?{apiClientId:this.apiClientId,pageType:this.pageType}:void 0}),Ne(i,m);return}if(p){Re(i,p.message);return}if(h){M({checkoutUrl:(n=u==null?void 0:u.checkoutUrl)!=null?n:"",instrumentName:this.name,reason:h});return}if(!this.accessToken)throw new Nt("[Fetch Pay Config] could not fetch pay configs since required accessToken is missing.");l=w({},await Fa({configOptionsEndpoint:tu.OPTIMUS_CONFIG_REST_API_URL,checkoutUrl:(r=u==null?void 0:u.checkoutUrl)!=null?r:"",sourceId:(a=pa(u))!=null?a:"",accessToken:this.accessToken,instrument:this.name}))}l.placement=this.getPlacement(),s=this.extractSKUs(l),delete l.checkoutSupportsSplitCart,delete l.appId;const d=l;this.pciEnabled&&(d.onSendCheckoutAction=this.handleOnSendCheckoutAction),window.amazon.buywithprime.initCheckout({amazonPayOptions:d}),g.sheetClicked({instrument:this.name,result:"success",webPixelMetaData:this.apiClientId?{apiClientId:this.apiClientId,skus:s,pageType:this.pageType}:void 0})}catch(l){tu.EXPECTED_ERRORS.some(h=>l instanceof h)||f.notify(l),g.sheetClicked({instrument:this.name,result:"failed",webPixelMetaData:this.apiClientId?{apiClientId:this.apiClientId,skus:s,pageType:this.pageType}:void 0});const{name:d}=l!=null?l:{name:"unknown"},{translate:u}=i;Vt(u("error_dialogs.wallet.title",{wallet:u("brand.buy_with_prime")}),this.getModalContent(d,u))}finally{this.applyEnabledStyles(this.button)}}getModalContent(e,n){return e==="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(e){var n;return(n=e.createCheckoutSessionConfig)!=null&&n.payloadJSON?JSON.parse(e.createCheckoutSessionConfig.payloadJSON).cartDetails.lineItems.map(r=>r&&r.sku).filter(r=>r):[]}getPlacement(){return this.pageType&&Lc[this.pageType]||"Other"}async render(){var e;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(ve.BUTTON),await this.initializeShadowStyles(A(this,ut),kc),A(this,ut).appendChild(this.button),(e=this.onRendered)==null||e.call(this))}buildBwpEventData(e){const n={};return e.createCheckoutSessionConfig&&(n.skus=this.extractSKUs(e),n.apiClientId=this.apiClientId),n}async handleOnSendCheckoutAction(e){const{eventName:n,redirect:r,redirectUrl:a,requestPayload:i}=e;if(r&&a){this.dispatchWalletEvent({eventName:"wallet-redirect",detail:{redirectUrl:a,requestPayload:i}});return}switch(n){case"initCheckout":{const o=this.walletParams;
1this.dispatchWalletEvent({eventName:"wallet-clicked",detail:{bwpEventData:this.buildBwpEventData(o)}});break}case"initChange":this.dispatchWalletEvent({eventName:"wallet-clicked"});break;case"cancelCheckout":this.dispatchWalletEvent({eventName:"wallet-cancel"});break}}};ut=new WeakMap,c(Oe,"OPTIMUS_CONFIG_REST_API_URL","".concat(window.location.origin,"/wallets/config/optimus")),c(Oe,"EXPECTED_ERRORS",[$r,Nt,Hr]);let gr=Oe;async function Ua({fn:t,maxRetries:e=3,delay:n=1e3,retryPolicyFn:r=()=>!0,onFinishedFn:a=()=>{}}){const i=()=>new Promise(l=>{setTimeout(l,n)});let o=0;const s=async()=>{try{return await t()}catch(l){if(o++,o<e&&r(l))return await i(),s();throw l}};try{return await s()}finally{a(o)}}async function Oc(t){return new Promise((e,n)=>{if(document.querySelector('script[src="'.concat(t,'"]'))&&window.amazon){e();return}const r=document.createElement("script");r.src=t,r.onload=()=>{window.amazon?e():n(new Error("Amazon SDK not present after loading"))},r.onerror=()=>{n(new Ot("Error loading Amazon SDK"))},document.head.append(r)})}async function Ba({sdkUrl:t=Cr,maxRetries:e=3}){return Ua({fn:()=>Oc(t),maxRetries:e,delay:200,retryPolicyFn:()=>!0,onFinishedFn:n=>{g.amazonPaySDKLoadRetries({retries:n})}})}const W=class On extends ye{static walletName(){return"buy_with_prime"}constructor(e){super(e)}getWebComponentName(){return"shopify-buy-with-prime-button"}getInstrumentName(){return b.BuyWithPrime}getWebComponentClass(){return gr}async loadWalletSDK(){await Ba({sdkUrl:On.SDK_URL,maxRetries:On.MAX_RETRIES}),await this.loadLogos()}async loadLogos(){await Promise.all([this.loadPrimeLogo(),this.loadPrimeLogoDark()])}async loadPrimeLogo(){if(On.primeLogo=(await import("./prime-logo-DoVHKBSO.js")).default,!On.primeLogo)throw new Error("Buy with Prime logo is empty")}async loadPrimeLogoDark(){if(On.primeLogoDark=(await import("./prime-logo-dark-DJIA6J0w.js")).default,!On.primeLogoDark)throw new Error("Buy with Prime logo dark is empty")}};c(W,"MAX_RETRIES",3),c(W,"SDK_URL",Cr),c(W,"primeLogo",""),c(W,"primeLogoDark","");let ct=W;const xc="shopify-amazon-pay-button div[role=button][slot=amazon-pay-slot][data-testid=amazon-pay-button]{border-radius:0!important}",gn="amazon-pay-slot";var ht,pt,He,Y,ne,Ee,Ae;const xe=class nu extends Te{constructor(){super(),c(this,"name",b.AmazonPay),c(this,"resizeObserver",null),O(this,ht,0),O(this,pt,0),O(this,He,!1),O(this,Y,null),O(this,ne,null),O(this,Ee,null),O(this,Ae),c(this,"sdkButton",null),k(this,Ae,this.attachShadow({mode:"closed"})),this.resizeObserver=qe("ResizeObserver",()=>this.onResize())}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}async disconnectedCallback(){var e;this.innerHTML="",A(this,Ae).innerHTML="",this.teardownAmazonButtonContainer(),(e=this.resizeObserver)==null||e.disconnect()}async triggerCheckout(){if(!this.sdkButton)throw g.log({body:"Attempted to trigger checkout on uninitialized Amazon Pay SDK button",attributes:{pageType:this.pageType,containerID:A(this,ne)}}),new Error("Attempted to trigger checkout on uninitialized Amazon Pay SDK button");this.handleClick(this.sdkButton)}async handleClick(e){var n,r;const[a,i]=await Promise.all([this.i18n,this.dataSource]);try{const{cart:o,decelerationReason:s,customValidationError:l,unrecoverableError:d}=await me({element:this,instrumentName:this.name,dataSource:i});if(d){g.sheetClicked({instrument:this.name,result:"failed"}),Ne(a,d);return}if(l){Re(a,l.message);return}if(s){M({checkoutUrl:(n=o==null?void 0:o.checkoutUrl)!=null?n:"",instrumentName:this.name,reason:s});return}const{totalAmount:{amount:u},checkoutUrl:h}=o;let p=this.walletParams;if(!p.createCheckoutSessionConfig){if(!this.accessToken)throw new Nt("[Fetch Pay Config] could not fetch pay configs since required accessToken is missing.");p=T(w({},await Fa({configOptionsEndpoint:nu.CV2_CONFIG_REST_API_URL,checkoutUrl:h,sourceId:(r=pa(o))!=null?r:"",accessToken:this.accessToken,instrument:this.name})),{placement:this.pageType===S.ProductPage?"Product":"Cart"})}delete p.appId,e.initCheckout(w(w({},p),Number(u)!==0&&{estimatedOrderAmount:{amount:u,currencyCode:this.buyerCurrency}})),g.sheetClicked({instrument:this.name,result:"success"})}catch(o){nu.EXPECTED_ERRORS.some(l=>o instanceof l)||f.notify(o),g.sheetClicked({instrument:this.name,result:"failed"});const s=a.translate("brand.amazon_pay");Q(s,a)}}createContainer({containerID:e,height:n}){const r=document.createElement("div");return r.id=e,r.style.display="flex",n!=null&&(r.style.height="".concat(n,"px")),r.slot=gn,r.setAttribute("data-testid","amazon-pay-button"),r}async onResize(){const e=Dt(A(this,Y))||0,n=vt(A(this,Y))||0,r=A(this,ht)!==e||A(this,pt)!==n;!A(this,He)&&r&&(this.teardownAmazonButtonContainer(),await this.cleanupOnFailure(()=>this.renderFromAmazonSDK(),this.name))}async render(){var e;try{const n=document.createElement("slot");n.name=gn;const r=document.createElement("style");r.textContent=xc,this.appendChild(r),await this.initializeShadowStyles(A(this,Ae));const a=await this.containerInstanceNumber;k(this,ne,"AcceleratedCheckoutAmazonPayButtonContainer".concat(this.pageType).concat(a)),k(this,Y,document.createElement("div")),A(this,Y).classList.add(ve.BUTTON),A(this,Y).appendChild(n),A(this,Ae).appendChild(A(this,Y)),(e=this.resizeObserver)==null||e.observe(A(this,Y)),await this.renderFromAmazonSDK()}catch(n){f.notify(n)}}async renderFromAmazonSDK(){var e;try{k(this,He,!0);const n=vt(A(this,Y))||0;k(this,Ee,this.createContainer({containerID:A(this,ne),height:n})),this.appendChild(A(this,Ee));const r=Dt(A(this,Y))||0,a={buttonBorderRadius:"".concat(r,"px")};if(this.sdkButton=window.amazon.Pay.renderButton("#".concat(A(this,ne)),T(w({},this.walletParams),{style:a,placement:this.pageType===S.ProductPage?"Product":"Cart"})),this.sdkButton){const i=this.sdkButton;this.sdkButton.onClick(()=>this.handleClick(i))}else g.log({body:"Amazon Pay Button rendered null SDK button",attributes:{pageType:this.pageType,containerID:A(this,ne)}});k(this,pt,n),k(this,ht,r),g.renderSucceeded(this.name),(e=this.onRendered)==null||e.call(this)}catch(n){g.renderFailed(this.name);const r="Amazon Pay Button not able to render into container #".concat(A(this,ne),".");console.error(r),g.log({body:r,attributes:{pageType:this.pageType,containerID:A(this,ne),error:n==null?void 0:n.toString()}})}finally{k(this,He,!1)}}teardownAmazonButtonContainer(){var e;(e=A(this,Ee))==null||e.remove(),k(this,Ee,null)}};
1ht=new WeakMap,pt=new WeakMap,He=new WeakMap,Y=new WeakMap,ne=new WeakMap,Ee=new WeakMap,Ae=new WeakMap,c(xe,"CV2_CONFIG_REST_API_URL","".concat(window.location.origin,"/wallets/config/amazon_pay")),c(xe,"EXPECTED_ERRORS",[$r,Nt,Hr]);let fr=xe;const Me=class ru extends ye{static walletName(){return"amazon_pay"}constructor(e){super(e)}getWebComponentName(){return"shopify-amazon-pay-button"}getInstrumentName(){return b.AmazonPay}getWebComponentClass(){return fr}async loadWalletSDK(){await Ba({sdkUrl:ru.SDK_URL,maxRetries:ru.MAX_RETRIES})}getLoadEligibility(e){return e.getRootNode()instanceof ShadowRoot?{eligible:!1,reason:"Cannot load Amazon Pay within Shadow DOM"}:{eligible:!0}}};c(Me,"MAX_RETRIES",3),c(Me,"SDK_URL",Cr);let br=Me;var or={Purple:{D0:"#4524DB",Primary:"#5433EB"},Grayscale:{White:"#FFFFFF"}},Mc={s:16},Fc=class extends HTMLElement{static get observedAttributes(){return["disabled"]}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this._updateButton()}attributeChangedCallback(){this._updateButton()}_updateButton(){var t;let e=this.shadowRoot;e&&(e.innerHTML=Bc,this.hasAttribute("disabled")&&((t=this.shadowRoot.querySelector("button"))==null||t.setAttribute("disabled","")))}};function Uc(){window.customElements&&(customElements.get("gravity-button")||customElements.define("gravity-button",Fc))}var Bc="\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: inherit;\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(or.Grayscale.White,";
1\n align-items: center;\n overflow: visible;\n padding: var(--gravity-button-padding, ").concat(Mc.s,"px 10px);\n border-radius: var(--gravity-button-border-radius);\n border: none;\n background-color: ").concat(or.Purple.Primary,";\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(or.Purple.D0,';\n }\n</style>\n\n<button class="gravity-button">\n <slot id="button-content"></slot>\n</button>\n');const $c=".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}.ShopPromise>.separator{margin:0 8px}@container bc (width <= 338px){.ShopPromise{display:none!important}}gravity-button{display:block}",Hc='.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);min-width:150px}:host([page-type="cart_page"]) .accelerated-checkout-button{height:100%;width:100%;border-radius:var(--shopify-accelerated-checkout-button-border-radius, 4px);box-shadow:var(--shopify-accelerated-checkout-button-box-shadow)}@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 $a extends Error{constructor(){const e="DeliveryEstimatesResponseIsNullError";super("deliveryEstimates is null or undefined"),this.name=e}}class sr extends Error{constructor(){const e="DeliveryPromiseAPIClientError";super("window.Shopify.ShopPromise.deliveryPromiseAPIClient is undefined"),this.name=e}}const Gc=15,zc=200;class Vc{constructor(e){c(this,"storefrontAPIToken"),this.storefrontAPIToken=e}async fetchDeliveryPromise({variant:e,postalCode:n,defaultPostalCode:r,sellingPlanId:a}){const i=await Ua({fn:async()=>this.fetchDeliveryOptions(e,n,r,a),maxRetries:Gc,delay:zc,retryPolicyFn:o=>o instanceof sr}).catch(o=>{if(o instanceof sr)throw o;return null});if(!i)throw new $a;return i}async fetchDeliveryOptions(e,n,r,a){var i,o;const s={variantId:e,sellingPlanId:a,postalCode:n||r,isPostalCodeOverride:!!n},l=(o=(i=window==null?void 0:window.Shopify)==null?void 0:i.ShopPromise)==null?void 0:o.deliveryPromiseAPIClient;if(!l)throw new sr;return l(s,this.storefrontAPIToken)}}function qc(t,e){switch(t){case 0:return(e==null?void 0:e.translate("shop_promise_delivery.same_day"))||null;case 1:return(e==null?void 0:e.translate("shop_promise_delivery.next_day"))||null;case 2:return(e==null?void 0:e.translate("shop_promise_delivery.two_day"))||null;default:return null}}const jc="delivery_promise_default_address",Wc="delivery_promise_postal_code";class Yc extends qt{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 Aa(this,({variantId:e,sellingPlanId:n})=>{this.fetchDeliveryPromise(e,n)}),this.formObserver.setupMutationObservers()}setTranslations(e){this.i18n=e,this.render()}get postalCode(){try{return JSON.parse(lt(Wc)||"null")||null}catch(e){return null}}get defaultDeliveryAddress(){try{return JSON.parse(lt(jc)||"null")}catch(e){return null}}async fetchDeliveryPromise(e,n){var r,a,i,o;
1if(!(!e||!this.accessToken)&&!(e===this.lastFetchedProductVariantId&&n===this.lastFetchSellingPlan))try{this.lastFetchedProductVariantId=e,this.lastFetchSellingPlan=n;const s=((r=this.defaultDeliveryAddress)==null?void 0:r.zip)||"",l=await new Vc(this.accessToken).fetchDeliveryPromise({variant:e,postalCode:this.postalCode||"",defaultPostalCode:s,sellingPlanId:n||""}),d=xr(this),u=(i=(a=l==null?void 0:l.selectedShippingOption)==null?void 0:a.brandedPromise)==null?void 0:i.handle;if((d==null?void 0:d.sellingPlanId)!==n||(d==null?void 0:d.variantId)!==e||u!=="shop_promise")return;this.daysToDelivery=(o=l==null?void 0:l.selectedShippingOption)==null?void 0:o.maxCalendarDaysToDelivery,this.render()}catch(s){s instanceof $a&&(this.daysToDelivery=null)}}render(){const e=qc(this.daysToDelivery,this.i18n);this.classList.add("ShopPromise"),this.innerHTML=e?'<span class="separator">|</span><span>'.concat(e,"</span>"):""}}var Ce;class Kc extends Te{constructor(){super(),c(this,"name",b.ShopPay),c(this,"button",null),c(this,"shopPromiseProductPageContent",null),c(this,"shopPromiseEligible",!1),O(this,Ce),k(this,Ce,this.attachShadow({mode:"closed"}))}static get observedAttributes(){return["disabled"]}connectedCallback(){this.shopPromiseEligible=ma(),this.cleanupOnFailure(async()=>{Uc(),await this.render()},this.name)}attributeChangedCallback(e,n,r){super.attributeChangedCallback(e,n,r,this.button)}async addButtonContent(){if(!this.button)return;let e;const n=await this.i18n,r=new DOMParser().parseFromString(Ga.shopPayLogoElement,"image/svg+xml").documentElement;this.isCTA?e=Fr({translate:n.translate,logoElement:r,setAriaHidden:!1}):(e=document.createElement("div"),e.appendChild(r)),e.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||""),e.appendChild(this.shopPromiseProductPageContent)),this.button.appendChild(e)}getShopPayBehavior(){return this.pageType===S.ProductPage?"force_shop_pay_product":this.pageType===S.CartPage?"force_shop_pay_cart":"force_shop_pay"}async handleClick(e){var n,r;if(e.preventDefault(),this.disabled||!this.button||this.button.getAttribute("disabled"))return;this.disabled=!0;const[a,i]=await Promise.all([this.i18n,this.dataSource]);try{const{decelerationReason:o,cart:s,customValidationError:l,unrecoverableError:d}=await me({element:this,instrumentName:b.ShopPay,dataSource:i});if(d){g.sheetClicked({instrument:this.name,result:"failed"}),Ne(a,d);return}if(g.sheetClicked({instrument:this.name,result:"success"}),l){Re(a,l.message);return}if(o){M({checkoutUrl:(n=s==null?void 0:s.checkoutUrl)!=null?n:"",instrumentName:this.name,reason:o});return}ue((r=s==null?void 0:s.checkoutUrl)!=null?r:"",this.getShopPayBehavior())}catch(o){f.notify(new Qc("An error occurred when attempting to create a cart using the Shop Pay Button. Details: ".concat(o),{cause:o})),g.sheetClicked({instrument:this.name,result:"failed"}),gt(a)}}async render(){if(A(this,Ce).innerHTML)return;this.button||(this.button=document.createElement("gravity-button"));const e=document.createElement("style");e.innerHTML=[Hc,$c].join("\n"),A(this,Ce).appendChild(e),await this.addButtonContent(),this.disabled&&this.button.setAttribute("disabled",""),this.button.classList.add(ve.BUTTON),this.button.onclick=n=>this.handleClick(n),A(this,Ce).appendChild(this.button),this.ensureLightDOMIsNotEmpty(),this.onRendered()}}Ce=new WeakMap,pe("shop-promise-product-page-content",Yc);
1class Qc extends Error{constructor(){super(...arguments),c(this,"name","ShopPayButtonError")}}var Xc=Object.defineProperty,Jc=Object.getOwnPropertyDescriptor,Zc=(t,e,n,r)=>{for(var a=Jc(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(a=o(e,n,a)||a);return a&&Xc(e,n,a),a},Se;const Ha=(Se=class extends ye{static walletName(){return"shop_pay"}constructor(t){super(t)}getWebComponentName(){return"shop-pay-wallet-button"}getWebComponentClass(){return Kc}getInstrumentName(){return b.ShopPay}async loadWalletSDK(){await this.loadLogo()}getLoadEligibility(){return{eligible:!0}}async loadLogo(){Se.shopPayLogoElement=(await import("./shop-pay-logo-CYhOC7ye.js")).default}},c(Se,"shopPayLogoElement"),Se);Zc([Ur("Shop Pay")],Ha.prototype,"getLoadEligibility");let Ga=Ha;const ed=".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}.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}}.content{display:flex;justify-content:center;align-items:center;white-space:pre}";function lr({cart:t,i18n:e}){const n=Ta(t),r={label:e.translate("order_summary.subtotal"),type:"SUBTOTAL",price:Ie(n.amount)},a=Ra({deliveryGroups:t.deliveryGroups,i18n:e}).map(s=>td({lineItem:s,type:"LINE_ITEM"})),i=rd(t,e),o=[r,...a,...i];if(t.totalDutyAmount){const s={label:e.translate("order_summary.duties"),type:"LINE_ITEM",price:Ie(t.totalDutyAmount.amount)};o.push(s)}if(t.totalTaxAmount){const s={label:e.translate("order_summary.taxes"),t
1ype:"TAX",price:Ie(t.totalTaxAmount.amount)};o.push(s)}return{totalPrice:t.totalAmount.amount,currencyCode:t.totalAmount.currencyCode,totalPriceStatus:"ESTIMATED",totalPriceLabel:e.translate("order_summary.total"),displayItems:o}}function td({lineItem:t,type:e,status:n="FINAL"}){return{label:t.label,type:e,price:t.amount,status:n}}function rd(t,e){return[...t.lineItems.flatMap(n=>n.discountAllocations),...t.discountAllocations].flatMap(n=>{var r;const a=(r=n.title)!=null?r:n.code;return{label:a!=null?a:e.translate("order_summary.discount"),type:"LINE_ITEM",price:"-".concat(Ie(Number(n.discountedAmount.amount)))}})}const za=["PAYMENT_AUTHORIZATION"],nd=za.concat(["SHIPPING_ADDRESS","SHIPPING_OPTION"]),ad=["PAN_ONLY"];function id({walletParams:t,isShippingRequired:e,hasSellingPlan:n,i18n:r,buyerCurrency:a,authJwt:i}){const o={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=T(w({},t.paymentData),{shippingAddressRequired:e,shippingOptionRequired:e,transactionInfo:o});return s.merchantInfo.authJwt=i,e||delete s.shippingAddressParameters,s.callbackIntents=e?nd:za,n&&od(s),s}function od(t){t.allowedPaymentMethods.forEach(e=>{e.parameters.allowedAuthMethods=e.parameters.allowedAuthMethods.filter(n=>ad.includes(n))})}class sd extends Na{constructor(e){super(),c(this,"brandName"),c(this,"completionResult"),this.i18n=e,this.brandName=this.i18n.translate("brand.google_pay"),this.completionResult=void 0}mapMutationResultToPaymentSheetAction(e){const n=this.mapCustomValidationFunctionErrorToAction(e.errors);if(n)return n;const r=this.getErrorActions(),a=e.errors,i=this.getUnhandledErrors(a,r);i.forEach(s=>{f.notify(new Rt("[".concat(b.GooglePay,"] mutation result error not handled: ").concat(s)))});const{firstPaymentSheetAction:o}=this.getMergedPaymentSheetAction({result:e,errorActions:r});return o||(i.length>0?{action:"abort"}:{action:"update",errors:[]})}mapCompletionResultToPaymentSheetAction(e){if(!e.data)throw new Error("[".concat(b.GooglePay,"] completion returned null result"));switch(this.completionResult=e,e.data.__typename){case"SubmitSuccess":return{action:"complete",redirectUrl:e.data.redirectUrl};case"SubmitAlreadyAccepted":case"SubmitThrottled":case"SubmitFailed":{const n=this.mapCustomValidationFunctionErrorToAction(e.errors);if(n)return n;const r=this.getErrorActions(),a=e.errors;this.getUnhandledErrors(a,r).forEach(o=>{f.notify(new Error("[".concat(b.GooglePay,"] completion result error not handled: ").concat(o)))});const{prioritizedPaymentSheetAction:i}=this.getMergedPaymentSheetAction({result:e,errorActions:r});return i||(Q(this.brandName,this.i18n),{action:"abort"})}default:throw new Error("[".concat(b.GooglePay,"] unknown completion result type: ").concat(e.data.__typename))}}getErrorActions(){return[{errors:[y.CaptchaCompletionRequired],generateAction:()=>this.decelerateOrAbort({reason:"captcha_required",instrumentName:b.GooglePay,errorOrWarning:y.CaptchaCompletionRequired,result:this.completionResult})},{errors:[y.InvalidLanguage],generateAction:()=>({action:"abort",effects:[()=>{f.notify(new Error("[".concat(b.GooglePay,"] mutation provided invalid language, aborting")))},()=>Q(this.brandName,this.i18n)]})},{errors:[y.InvalidCountry],generateAction:()=>({action:"abort",effects:[()=>{f.notify(new Error("[".concat(b.GooglePay,"] mutation provided invalid country, aborting")))},()=>Q(this.brandName,this.i18n)]})},{errors:[y.MissingCartId],generateAction:()=>({action:"abort",effects:[()=>{f.notify(new Error("[".concat(b.GooglePay,"] mutation provided invalid cart ID, aborting")))},()=>Q(this.brandName,this.i18n)]})},{errors:Ir,generateAction:()=>this.decelerateOrAbort({reason:"dynamic_tax",instrumentName:b.GooglePay,errorOrWarning:y.NewTaxMustBeAccepted,result:this.completionResult})},{errors:[y.MerchandiseExpectedPriceMismatch,y.DeliveryLineChanged,y.DeliveryLocalPickupLineChanged,...sa],generateAction:()=>({action:"abort",effects:[()=>Q(this.brandName,this.i18n)]})},{errors:[y.UnsupportedGooglePayPaymentMethod],generateAction:()=>({action:"abort",effects:[()=>Q(this.brandName,this.i18n),()=>{f.notify(new Rt("[".concat(b.GooglePay,"] payment method is not supported")))}]})},{errors:[y.MerchandiseNotEnoughStock],generateAction:()=>this.decelerateOrAbort({reason:"not_enough_stock",instrumentName:b.GooglePay,errorOrWarning:y.MerchandiseNotEnoughStock,result:this.completionResult})},{errors:la,generateAction:()=>this.decelerateOrAbort({reason:"out_of_stock",instrumentName:b.GooglePay,errorOrWarning:y.MerchandiseOutOfStock,result:this.completionResult})},{errors:oa,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_UNSERVICEABLE",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.shipping_address")}]})},{errors:ia,generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.postal_code")}]})},{errors:[y.NoDeliveryGroupSelected],generateAction:()=>
1({action:"show_error",errors:[{reason:"SHIPPING_OPTION_INVALID",intent:"SHIPPING_OPTION",message:this.i18n.translate("errors.missing.shipping_option")}]})},{errors:[y.BuyerIdentityEmailDomainInvalid,y.BuyerIdentityEmailNotExpectedPattern,y.BuyerIdentityEmailInvalid],generateAction:()=>({action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.email")}]})},{errors:[y.BuyerIdentityEmailRequired],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.email")}]})},{errors:[y.DeliveryAddress2Required,y.DeliveryAddress2AddressFieldRequired],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.address2")}]})},{errors:[y.DeliveryAddress2Invalid],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.address2")}]})},{errors:[y.DeliveryCityAddressFieldRequired,y.DeliveryCityRequired],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.city")}]})},{errors:[y.DeliveryCityInvalid],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.city")}]})},{errors:[y.DeliveryZoneRequiredForCountry],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.zone")}]})},{errors:[y.DeliveryZoneNotFound],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.zone")}]})},{errors:[y.DeliveryPostalCodeRequired,y.DeliveryPostalCodeAddressFieldRequired],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.postal_code")}]})},{errors:[y.DeliveryPostalCodeInvalid,y.DeliveryInvalidPostalCodeForZone,y.DeliveryInvalidPostalCodeForCountry,y.DeliveryZipInvalidForCountry],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.postal_code")}]})},{errors:[y.DeliveryPhoneNumberRequired],generateAction:()=>({action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.phone_number")}]})},{errors:[y.DeliveryPhoneNumberInvalid,y.BuyerIdentityInvalidPhone,y.DeliveryPhoneDoesNotMatchExpectedPattern],generateAction:()=>({action:"show_error",errors:[{reason:"OTHER_ERROR",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.phone_number")}]})},{errors:[y.BuyerIdentityInvalidCountry,y.DeliveryCountryInvalid],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.country")}]})},{errors:[y.DeliveryFirstNameRequired],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.first_name")}]})},{errors:[y.DeliveryFirstNameInvalid],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.first_name")}]})},{errors:[y.DeliveryLastNameRequired],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.last_name")}]})},{errors:[y.DeliveryLastNameInvalid],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.last_name")}]})},{errors:[y.DeliveryAddress1Required],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.missing.address1")}]})},{errors:[y.DeliveryAddress1Invalid],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.invalid.address1")}]})},{errors:[y.DeliveryLastNameContainsEmojis],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.last_name")}]})},{errors:[y.DeliveryCityContainsEmojis],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.city")}]})},{errors:[y.DeliveryAddress1ContainsEmojis],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.address1")}]})},{errors:[y.DeliveryAddress2ContainsEmojis],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.address2")}]})},{errors:[y.DeliveryPostalCodeContainsEmojis],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.emojis.postal_code")}]})},{errors:[y.DeliveryAddress1TooLong],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.address1")}]})},{errors:[y.DeliveryAddress2TooLong],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.address2")}]})},{errors:[y.DeliveryFirstNameTooLong],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.first_name")}]})},{errors:[y.DeliveryLastNameTooLong],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.last_name")}]})},{errors:[y.DeliveryCityTooLong],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.too_long.city")}]})},{errors:[y.DeliveryFirstNameContainsUrl],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.url.first_name")}]})},{errors:[y.DeliveryLastNameContainsUrl],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.url.last_name")}]})},{errors:[y.DeliveryAddress1ContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.address1")}]})},{errors:[y.DeliveryAddress2ContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.address2")}]})},{errors:[y.DeliveryCityContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.city")}]})},{errors:[y.DeliveryFirstNameContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.first_name")}]})},{errors:[y.DeliveryLastNameContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[{reason:"SHIPPING_ADDRESS_INVALID",intent:"SHIPPING_ADDRESS",message:this.i18n.translate("errors.html_tags.last_name")}]})},{errors:[y.InvalidPaymentGooglePayBillingAddress],generateAction:()=>({action:"show_error",errors:[{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_METHOD",message:this.i18n.translate("errors.invalid.billing_address")}]})}]}mapCustomValidationFunctionErrorToAction(e){const n=Rr(e);return n?(f.notify(new Error("[".concat(b.GooglePay,"] custom validation function error: ").concat(JSON.stringify(e)))),Tr(this.i18n.translate("error_dialogs.wallet.title",{wallet:this.brandName}),n.message),{action:"abort"}):null}}function ld({deliveryGroups:t,i18n:e}){var n;const r=pc(Da({deliveryGroups:t}),e),a=r.map(({handle:o,title:s,description:l})=>({id:o,label:s!=null?s:"",description:l})),i=(n=r.find(o=>{var s;return o.handle.includes(((s=t[0].selectedDeliveryOption)==null?void 0:s.handle)||"")}))==null?void 0:n.handle;return{shippingOptions:a,defaultSelectedOptionId:i}}function cr(t){let e=t.administrativeArea,n=t.locality;t.countryCode==="AE"&&(n=t.administrativeArea,t.administrativeArea in fn&&(e=fn[t.administrativeArea])),t.countryCode==="MX"&&e&&(e=cd(e));let r,a;
1if(t.name){const[i,...o]=(t.name||"").split(" ");o.length===0?a=i:a=o.join(" "),r=i}return{firstName:r,lastName:a,address1:t.address1,address2:t.address2,city:n,province:e,country:t.countryCode,phone:t.phoneNumber,zip:t.postalCode}}const fn={"\u0623\u0628\u0648 \u0638\u0628\u064A":"AZ","\u0625\u0645\u0627\u0631\u0629 \u0627\u0644\u0634\u0627\u0631\u0642\u0629\u0651":"SH",\u0627\u0644\u0641\u062C\u064A\u0631\u0629:"FU",\u0639\u062C\u0645\u0627\u0646:"AJ","\u0631\u0623\u0633 \u0627\u0644\u062E\u064A\u0645\u0629":"RK","\u0625\u0645\u0627\u0631\u0629 \u0631\u0623\u0633 \u0627\u0644\u062E\u064A\u0645\u0629":"RK","\u0623\u0645 \u0627\u0644\u0642\u064A\u0648\u064A\u0646":"UQ","\u0627\u0645 \u0627\u0644\u0642\u064A\u0648\u064A\u0646":"UQ",\u062F\u0628\u064A:"DU","\u0625\u0645\u0627\u0631\u0629 \u062F\u0628\u064A\u0651":"DU"},cd=t=>t==="M\xE9x."?"MEX":t==="Q.R."?"Q ROO":t.replace(/\./g,"").toUpperCase();class dr extends Error{constructor(){super(...arguments),c(this,"name","GooglePayError")}}function Va(t){const e=t.auth;if(!(Array.isArray(e)&&e.length>0))return{result:"error",reason:"invalidAuthParams"};const n=rt();for(const r of e)if(n<r.expiresAt*1e3)return{result:"success",jwt:r.jwt};return{result:"error",reason:"authJwtExpired"}}const dd=27e3,ud="Google Pay Timeout";var mt,ae,Ge;class hd{constructor({walletParams:e,isShippingRequired:n,hasSellingPlan:r,dataSource:a,button:i,i18n:o,cartClient:s,buyerCurrency:l,abortController:d}){c(this,"name",b.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,"terminalCartCreationError"),O(this,mt),O(this,ae),O(this,Ge),c(this,"onPaymentDataChanged",async p=>{var m,_;const{callbackTrigger:C,shippingAddress:E,shippingOptionData:P}=p,{translate:$}=this.i18n;switch(C){case"INITIALIZE":{if(!this.cart)try{const{cart:Ye,customValidationError:N,decelerationReason:G,unrecoverableError:L}=await me({element:this.button,instrumentName:b.GooglePay,dataSource:this.dataSource});if(N||L)return this.terminalCartCreationError=N?N.message:pd(this.i18n,L),this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:this.terminalCartCreationError,intent:"SHIPPING_ADDRESS"}});if(G)return M({checkoutUrl:(m=Ye==null?void 0:Ye.checkoutUrl)!=null?m:"",instrumentName:this.name,reason:G}),this.showPaymentDataRequestError({error:{intent:"SHIPPING_ADDRESS",reason:"OTHER_ERROR",message:""}});this.cart=Ye,g.sheetClicked({instrument:this.name,result:"success"})}catch(Ye){return g.sheetClicked({instrument:this.name,result:"failed"}),this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"})}let B=!1;if(E)try{return await this.handleShippingAddressChange(this.cart.id,E)}catch(Ye){B=!0}return w({newTransactionInfo:lr({cart:this.cart,i18n:this.i18n})},B?this.showPaymentDataRequestError():{})}case"SHIPPING_ADDRESS":return this.terminalCartCreationError?this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:this.terminalCartCreationError,intent:"SHIPPING_ADDRESS"}}):this.cart?E?this.handleShippingAddressChange(this.cart.id,E):{newTransactionInfo:lr({cart:this.cart,i18n:this.i18n})}:this.showPaymentDataRequestError({intent:C});case"SHIPPING_OPTION":{if(!this.cart)return this.showPaymentDataRequestError({intent:C});
1if(!P||!P.id)return{error:{reason:"SHIPPING_OPTION_INVALID",message:$("shipping_methods.choose_delivery_strategy"),intent:"SHIPPING_OPTION"}};const B=await this.handleDeliveryOptionChange(P.id.split(","));return B.data?(this.cart=B.data,B.decelerationReason?(M({checkoutUrl:(_=this.cart.checkoutUrl)!=null?_:"",instrumentName:this.name,reason:B.decelerationReason}),this.showPaymentDataRequestError({error:{intent:"SHIPPING_OPTION",reason:"OTHER_ERROR",message:""}})):this.handlePaymentDataRequestUpdate({result:B,intent:C})):this.showPaymentDataRequestError({intent:C})}default:return this.logException("Payment data changed callback returned unexpected intent: ".concat(C),{severity:"warning"}),this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"})}}),c(this,"onPaymentAuthorized",async p=>{var m,_,C;g.authorizationAttempt(this.name),We(F.AuthorizationLatency,this.name);const E=(m=p.paymentMethodData.info)==null?void 0:m.billingAddress,P=p.shippingAddress,{signature:$,signedMessage:B,protocolVersion:Ye}=JSON.parse(p.paymentMethodData.tokenizationData.token);if(!E)return this.handlePaymentAuthorizationError({error:{reason:"PAYMENT_DATA_INVALID",intent:"PAYMENT_AUTHORIZATION",message:this.i18n.translate("errors.invalid.billing_address")}});if(this.isShippingRequired&&!P)return this.handlePaymentAuthorizationError({error:{reason:"SHIPPING_ADDRESS_INVALID",intent:"PAYMENT_AUTHORIZATION",message:this.i18n.translate("errors.invalid.shipping_address")}});const N=async()=>{var L,x;const ie=(L=A(this,mt))!=null?L:p.email,ft=this.isShippingRequired?{validateAddress:!0,streetAddress:cr(P)}:{};return await Fe(w({cartClient:this.cartClient,cartId:this.cart.id,instrumentName:this.name,emailAddress:ie,abortSignal:(x=A(this,ae))==null?void 0:x.signal},ft))},G=async()=>{var L;const x=cr(E);return await Mr({cartId:this.cart.id,totalAmount:this.cart.totalAmount,paymentMethod:{walletPaymentMethod:{googlePayWalletContent:{billingAddress:x,signature:$,signedMessage:B,protocolVersion:Ye}}},canUsePaymentMethodForFreeOrder:!1,billingAddress:x,cartClient:this.cartClient,instrumentName:this.name,hasSellingPlan:this.hasSellingPlan,abortSignal:(L=A(this,ae))==null?void 0:L.signal})};try{const L=setTimeout(()=>{var ou;(ou=A(this,ae))==null||ou.abort("[Google Pay] Timeout")},dd),x=await N(),ie=this.handleIntermediatePaymentAuthorizationResult(x);if(ie)return ie;const ft=await G(),au=this.handleIntermediatePaymentAuthorizationResult(ft);if(au)return au;if(clearTimeout(L),(C=(_=A(this,ae))==null?void 0:_.signal)!=null&&C.aborted)throw new dr("Abort Controller was not aborted");const iu=await La({cartId:this.cart.id,token:$,cartClient:this.cartClient,instrumentName:this.name});ot({result:iu,instrument:this.name});const du=this.actionGenerator.mapCompletionResultToPaymentSheetAction(iu);return this.handlePaymentAuthorizationResult(du)}catch(L){const{message:x}=L;return x!=null&&x.includes(ud)?this.handlePaymentAuthorizationError({status:"timeout"}):(this.logException(x),this.handlePaymentAuthorizationError())}}),c(this,"handlePaymentAuthorizationResult",async p=>{var m,_;switch((m=p.effects)==null||m.forEach(C=>C()),p.action){case"complete":return this.emitAuthorizationCompleteMetric("success"),ue(p.redirectUrl),{transactionState:"SUCCESS"};case"show_error":return this.handlePaymentAuthorizationError({error:(_=p.errors)==null?void 0:_[0]});case"decelerate":return M({checkoutUrl:p.redirectUrl,instrumentName:this.name,reason:p.reason}),this.emitAuthorizationCompleteMetric("failed"),{transactionState:"SUCCESS"};case"abort":default:return this.emitAuthorizationCompleteMetric("failed"),{transactionState:"SUCCESS"}}}),this.walletParams=e,this.isShippingRequired=n,this.hasSellingPlan=r,this.dataSource=a,this.button=i,this.i18n=o,this.cartClient=s,this.initialBuyerCurrency=l,k(this,mt,e.customerAccountEmail),k(this,ae,d);const u=Va(this.walletParams);if(u.result==="error")throw f.leaveBreadcrumb("Google Pay Invalid AuthJwt detected on click",{reason:u.reason,walletParams:this.walletParams},"error"),new dr(u.reason);k(this,Ge,u.jwt);const h={environment:this.walletParams.environment,merchantInfo:T(w({},this.walletParams.paymentData.merchantInfo),{authJwt:A(this,Ge)}),paymentDataCallbacks:{onPaymentDataChanged:this.isShippingRequired?this.onPaymentDataChanged:void 0,onPaymentAuthorized:this.onPaymentAuthorized}};this.paymentsClient=new window.google.payments.api.PaymentsClient(h),this.actionGenerator=new sd(this.i18n)}async handleClick(){if(!this.isShippingRequired)throw new Ot("Google Pay checkout started for digital cart");
1const e=id({walletParams:this.walletParams,isShippingRequired:this.isShippingRequired,hasSellingPlan:this.hasSellingPlan,i18n:this.i18n,buyerCurrency:this.initialBuyerCurrency,authJwt:A(this,Ge)});await this.paymentsClient.loadPaymentData(e)}showPaymentDataRequestError({error:e,intent:n="SHIPPING_ADDRESS"}={}){return e?{error:e}:{error:{intent:n,reason:"OTHER_ERROR",message:this.i18n.translate("error_dialogs.wallet.generic_error",{wallet:this.i18n.translate("brand.google_pay")})}}}handlePaymentAuthorizationError({error:e,status:n="failed"}={}){return this.emitAuthorizationCompleteMetric(n),w({transactionState:"ERROR"},this.showPaymentDataRequestError({error:e,intent:"PAYMENT_AUTHORIZATION"}))}handlePaymentDataRequestUpdate({result:e,intent:n}){var r,a;const i=this.actionGenerator.mapMutationResultToPaymentSheetAction(e);switch(i.action){case"update":{const o=i,{data:s,decelerationReason:l}=e;return s?l?(M({checkoutUrl:s.checkoutUrl,instrumentName:this.name,reason:l}),this.showPaymentDataRequestError({error:{reason:"OTHER_ERROR",message:"",intent:"OFFER"}})):this.isShippingRequired&&s.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:lr({cart:s,i18n:this.i18n}),newShippingOptionParameters:this.isShippingRequired?ld({deliveryGroups:s.deliveryGroups,i18n:this.i18n}):void 0,error:(r=o.errors)==null?void 0:r[0]}:this.showPaymentDataRequestError({intent:n})}case"show_error":return{error:(a=i.errors)==null?void 0:a[0]};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:i.action,intent:n}}}),this.showPaymentDataRequestError({intent:n})}}handleIntermediatePaymentAuthorizationResult(e){var n,r,a,i;if(ot({result:e,instrument:this.name}),e.decelerationReason)return M({checkoutUrl:(r=(n=e.data)==null?void 0:n.checkoutUrl)!=null?r:"",instrumentName:this.name,reason:e.decelerationReason}),{transactionState:"SUCCESS"};const o=this.actionGenerator.mapMutationResultToPaymentSheetAction(e);if(((a=e.errors)==null?void 0:a.length)>0){const s=o;if(s.action==="show_error")return this.handlePaymentAuthorizationError({error:(i=s.errors)==null?void 0:i[0]})}}handleCurrencyChange(e,n){Nr({currentCartTotal:n,initialBuyerCurrency:this.initialBuyerCurrency})&&M({checkoutUrl:e,instrumentName:this.name,reason:"currency_changed"})}async handleShippingAddressChange(e,n){var r,a;let i=await Fe({cartClient:this.cartClient,cartId:e,streetAddress:n?cr(n):{},instrumentName:b.GooglePay,abortSignal:(r=A(this,ae))==null?void 0:r.signal});if(!i.data)return this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"});if(this.cart=i.data,i.decelerationReason)return M({checkoutUrl:(a=this.cart.checkoutUrl)!=null?a:"",instrumentName:this.name,reason:i.decelerationReason}),this.showPaymentDataRequestError({error:{intent:"SHIPPING_ADDRESS",reason:"OTHER_ERROR",message:""}});const o=this.cart.deliveryGroups.length>0&&(this.cart.deliveryGroups.some(l=>{var d;return((d=l.selectedDeliveryOption)==null?void 0:d.deliveryMethodType)==="LOCAL"})||this.cart.deliveryGroups.every(l=>l.selectedDeliveryOption==null));let s=[];if(o?s=this.cart.deliveryGroups.map(l=>l.deliveryOptions.filter(({deliveryMethodType:d})=>d==="SHIPPING")).map(l=>{var d;return(d=l[0])==null?void 0:d.handle}).filter(Boolean):s=this.cart.deliveryGroups.map(({selectedDeliveryOption:l,deliveryOptions:d})=>{var u;return l!=null&&l.handle?l.handle:(u=d.filter(({deliveryMethodType:h})=>h==="SHIPPING")[0])==null?void 0:u.handle}).filter(Boolean),s.length>0){if(i=await this.handleDeliveryOptionChange(s),!i.data)return this.showPaymentDataRequestError({intent:"SHIPPING_ADDRESS"});this.cart=i.data}return this.handleCurrencyChange(this.cart.checkoutUrl,this.cart.totalAmount),this.handlePaymentDataRequestUpdate({result:i,intent:"SHIPPING_ADDRESS"})}async handleDeliveryOptionChange(e){var n;const r=Oa({deliveryGroups:this.cart.deliveryGroups,instrumentName:b.GooglePay,selectedDeliveryOptionHandles:e});return await ka({cartClient:this.cartClient,cartId:this.cart.id,instrumentName:b.GooglePay,selectedDeliveryOptions:r,abortSignal:(n=A(this,ae))==null?void 0:n.signal})}logException(e,{severity:n,metadata:r}={}
1){f.notify(new dr(e),{severity:n!=null?n:"error",metadata:r})}emitAuthorizationCompleteMetric(e){g.authorizationComplete({instrument:this.name,measurement:Z(F.AuthorizationLatency,this.name),result:e})}}mt=new WeakMap,ae=new WeakMap,Ge=new WeakMap;function pd(t,e){switch(e){case Ft.InvalidQuantity:return t.translate("error_dialogs.checkout.generic_error")}}const md={LIGHT:"light",DARK:"dark"};var ze;class yd extends Te{constructor(){super(),c(this,"name",b.GooglePay),c(this,"paymentsClient",null),c(this,"button",null),O(this,ze),c(this,"handleClick",async()=>{if(this.disabled)return;this.disabled=!0;const e=qe("AbortController");try{await this.createPaymentsClient(e),await this.paymentsClient.handleClick()}catch(n){if(this.disabled=!1,n.statusCode==="CANCELED"){e==null||e.abort("[Google Pay] Payment sheet cancelled"),g.sheetCancelled(b.GooglePay);return}e==null||e.abort("[Google Pay] Payment sheet failure"),f.notify(n),g.sheetClicked({instrument:this.name,result:"failed"});const r=await this.i18n,a=r.translate("brand.google_pay");Q(a,r)}}),k(this,ze,this.attachShadow({mode:"closed"}))}static get observedAttributes(){return["disabled"]}attributeChangedCallback(e,n,r){super.attributeChangedCallback(e,n,r,this.button)}async connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}async createPaymentsClient(e){this.paymentsClient=new hd({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:e})}async render(){if(this.button)return;await this.initializeShadowStyles(A(this,ze),ed);const{translate:e}=await this.i18n,n=this.isCTA?e("buy_with_button_content",{wallet:e("brand.google_pay")}):e("brand.google_pay"),r=Gt({label:n});this.disabled&&r.setAttribute("disabled",""),r.classList.add("button",ve.BUTTON,md[this.buttonTheme]),r.onclick=this.handleClick,await this.renderButtonContent(r,e),this.button=r,A(this,ze).appendChild(r),this.ensureLightDOMIsNotEmpty(),this.onRendered()}async renderButtonContent(e,n){const r=this.buttonTheme==="DARK"?dt.googlePayLogoDark:dt.googlePayLogo,a=new DOMParser().parseFromString(r,"image/svg+xml").documentElement;if(e.style.font=window.getComputedStyle(this).font,this.isCTA){const i=Fr({translate:n,logoElement:a,setAriaHidden:!0});i.classList.add("content"),e.appendChild(i)}else e.classList.add("logo-only"),e.appendChild(a)}}ze=new WeakMap;const q=class Yt extends ye{static walletName(){return"google_pay"}constructor(e){super(e)}getWebComponentName(){return"shopify-google-pay-button"}getInstrumentName(){return b.GooglePay}getWebComponentClass(){return yd}async loadWalletSDK(){if(Yt.googlePaySDKPromise)return Yt.googlePaySDKPromise;const e=document.createElement("script");e.setAttribute("src",this.walletParams.sdkUrl);const n=new Promise((r,a)=>{e.onload=()=>r(),e.onerror=i=>{document.body.removeChild(e),a(i)},document.body.appendChild(e)});return Yt.googlePaySDKPromise=Promise.all([n,this.loadLogos()]),Yt.googlePaySDKPromise}getLoadEligibility(){const e=Va(this.walletParams);switch(e.result){case"success":return{eligible:!0};case"error":return{eligible:!1,reason:e.reason}}}getPartnerSDKEligibility(){return{eligible:!0}}async loadLogos(){return Promise.all([this.loadGooglePayLogo(),this.loadGooglePayLogoDark()])}async loadGooglePayLogo(){if(Yt.googlePayLogo=(await import("./google-pay-logo-BgkSiJGq.js")).default,!Yt.googlePayLogo)throw new Error("Google Pay logo is empty")}async loadGooglePayLogoDark(){if(Yt.googlePayLogoDark=(await import("./google-pay-logo-dark-DmTdfep2.js")).default,!Yt.googlePayLogoDark)throw new Error("Google Pay logo dark is empty")}};c(q,"googlePaySDKPromise"),c(q,"googlePayLogo",""),c(q,"googlePayLogoDark","");let dt=q;const gd=[ac,mr,Ma,dt,ct,br,Ga],fd=new Map(gd.map(t=>[t.walletName(),e=>new t(e)]));function st(t){if(!t)return null;const e=fd.get(t.name);return e?e(t):(console.debug("Can't build wallet with name ".concat(t.name)),null)}function bd(t){return t.map(e=>st(e)).filter(e=>e!=null)}const qa="*{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}";class wd{constructor(e,n,r){this.element=e,this.apiClient=n,this.instrumentName=r}async getInitialCart(e){const n=xr(this.element);if(!n)throw new Error("[".concat(this.instrumentName,"] unable to find product form"));const r=lt(gi),{data:a,errors:i,warnings:o}=await this.apiClient.createCart(T(w({},n),{discountCodes:r?[r]:[],instrumentName:e}));return{cart:a,errors:i,warnings:o}}}function _d({instanceNumber:t,styleId:e,styles:n,cssFileName:r}){var a,i;t===1&&(i=(a=window.Shopify)==null?void 0:a.PaymentButton)!=null&&i.isStorefrontPortableWallets&&(Ed({styleId:e})||Ad({styleId:e,styles:n}))}function Ed({styleId:t}){return!!document.querySelector("style#".concat(t))}function Ad({styleId:t,styles:e}){const n=document.createElement("style");n.id=t,n.innerHTML=e,document.head.appendChild(n)}const J={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 bn(t){let e=0,n=0,r=0;const a=t.split(/\s+/);for(let i=0;i<a.length;i++){const o=a[i];o!==">"&&(o.includes("#")&&(e+=(o.match(/#/g)||[]).length),o.includes(".")&&(n+=(o.match(/\./g)||[]).length),o.includes("[")&&(n+=(o.match(/\[/g)||[]).length),o.includes(":")&&(n+=(o.match(/:[^:]/g)||[]).length),/^[A-Za-z]/.test(o)&&(r+=1))}return[e,n,r]}function Cd(t,e){for(let n=0;n<3;n++)if(t[n]!==e[n])return e[n]-t[n];return 0}function wn(t){return[...t].sort((e,n)=>{const r=bn(e.selector),a=bn(n.selector);return Cd(r,a)})}const Sd=/\.cart__dynamic-checkout-buttons|\.dynamic-checkout-buttons\s*(>\s*)?li(?![a-zA-Z0-9_.:#-])/,Pd=/\.cart__dynamic-checkout-buttons|\.dynamic-checkout-buttons\s*\[role="?button"?\](?![:\w-])/,Id=/\.additional-checkout-buttons\s*(?:div\s*)?\[role="?button"?\](?![:\w-])/,ja=/\[data-shopify-buttoncontainer\](?![:\w-])/,Wa=/.dynamic-checkout-buttons .shopify-payment-button__button/,Dd=/(?!.*\.shopify-cleanslate)\.shopify-payment-button__button(?:--branded)?(?![\w-:.#>])/,vd=/\.(shopify-payment-button|shopify-payment-button__button|shopify-payment-button__button--branded)\s*\[role="?button"?\](?![:\w-])/,Rd=/(?:only\s+)?(?:screen\s+and\s+)?\((?:min|max)-(?:width|height):\s*\d+px\)/,Nd=[Pd,ja,Sd,Id,Wa],Td=[Dd,vd,Wa];function Ya(t){const e=t.pageType,n=[...document.styleSheets].filter(kd),r=[],a=[];n.forEach(N=>{try{const G=[...N.cssRules].filter(x=>x instanceof CSSMediaRule),L=[...N.cssRules].filter(x=>x instanceof CSSStyleRule);a.push(...G.filter(x=>Rd.test(x.conditionText)).flatMap(x=>[...x.cssRules].filter(ie=>ie instanceof CSSStyleRule).flatMap(ie=>ie.selectorText.split(",").map(ft=>ft.trim()).map(ft=>w({selector:ft,conditionText:x.conditionText},Sn(ie)))))),r.push(...L.flatMap(x=>x.selectorText.split(",").map(ie=>ie.trim()).map(ie=>w({selector:ie},Sn(x)))))}catch(G){St()("shopify-support-debug")&&(console.debug("[shopify-support-debug] stylesheet origin: ".concat(N.href)),console.debug(G))}});const i=e===S.ProductPage?Td:Nd,o=new Set;function s(N,G){const L=G.selector.match(N);return L?(o.add(L[0]),!0):!1}const l=r.filter(N=>i.some(G=>s(G,N))).reverse(),d=a.filter(N=>i.some(G=>s(G,N))).reverse(),u=St()("shopify-support-debug");u&&console.table(Array.from(o));const h=wn(l),p=wn(d),m={},_=_n(e)?document.querySelector(".cart__blocks .button"):document.querySelector(".product-form__buttons .button");_&&(m.boxShadow=getComputedStyle(_,":before").boxShadow);for(const N of h){const G=["height","minHeight","borderRadius","marginTop"];_n(e)&&N.selector.match(ja)&&G.push("justifyContent");for(const L of G)m[L]=xd({rule:N,property:L,currentPropertyValue:m[L]})}const{height:C,borderRadius:E,minHeight:P,marginTop:$,justifyContent:B,boxShadow:Ye}=m;return u&&console.table([{property:"height",value:C},{property:"borderRadius",value:E},{property:"minHeight",value:P},{property:"marginTop",value:$},{property:"justifyContent",value:B}
1,{property:"boxShadow",value:Ye}]),e===S.ProductPage?Cn({styles:{height:C,minHeight:P,borderRadius:E,marginTop:$,boxShadow:Ye},mediaRules:p,element:t}):Cn({styles:{borderRadius:E,boxShadow:Ye,justifyContent:B},mediaRules:p,element:t})}function Ka(t,e){var n,r,a;if(g.styleBackwardsCompatibility({usedBackwardsCompatibility:!!e}),!e)return;const i=(a=(r=(n=window.ShopifyAnalytics)==null?void 0:n.lib)==null?void 0:r.trekkie)==null?void 0:a.defaultAttributes,o=i==null?void 0:i.shopId,s=i==null?void 0:i.themeId;o&&s&&g.log({body:"Style backwards compatibility used",attributes:{shopId:"".concat(o),themeId:"".concat(s)}});const l="global-".concat(t.tagName.toLowerCase(),"-styles");if(document.head.querySelector("style#".concat(l))==null){const d=document.createElement("style");d.id=l,d.innerHTML=e,document.head.appendChild(d)}}function kd(t){const e=t.ownerNode instanceof HTMLLinkElement&&(t.ownerNode.getAttribute("crossorigin")==="anonymous"||t.ownerNode.getAttribute("crossorigin")==="");return t.href==null||t.href.startsWith(window.location.origin)||e}function _n(t){return t===S.CartPage||t===S.CartAjax}function En({height:t,minHeight:e}){let n=t,r=e;return(n!=null&&n.includes("var(".concat(J.buttonBlockSize))||n==="auto")&&(n=null),(r!=null&&r.includes("var(".concat(J.buttonBlockSize))||r==="auto")&&(r=null),n===r?n:r&&n?"max(".concat(n,",").concat(r,")"):n||r}function An({existingProperties:t,mediaCondition:e,selector:n,styles:r}){const a=w({},r);for(const i of t)delete a[i];for(const[i,o]of Object.entries(a))o!=null&&o.startsWith("var(".concat(i))&&delete a[i];return Object.keys(a).length===0?"":Ld({mediaCondition:e,selector:n,styles:a})}function Ld({mediaCondition:t,selector:e,styles:n}){let r="".concat(t?"@media ".concat(t," { "):"").concat(e," {");for(const[a,i]of Object.entries(n))i&&(r+="\n ".concat(a,": ").concat(i,";"));return r+="\n}",t&&(r+="}"),r+="\n",r}function Cn({styles:t,element:e,mediaRules:n}){const{height:r,minHeight:a,borderRadius:i,marginTop:o,justifyContent:s,boxShadow:l}=t,d=e.tagName.toLowerCase(),u=getComputedStyle(e),h=new Set;for(const m of Object.values(J))u.getPropertyValue(m)&&h.add(m);let p=An({existingProperties:h,selector:d,styles:{[J.buttonBlockSize]:En({height:r,minHeight:a}),[J.buttonBorderRadius]:i,[J.buttonBoxShadow]:l,[J.inlineAlignment]:s,"margin-top":o,display:o?"block":void 0}});return n.forEach(m=>{(m.height||m.minHeight||m.borderRadius||m.boxShadow||m.justifyContent||m.marginTop)&&(p+=An({existingProperties:h,mediaCondition:m.conditionText,selector:d,styles:{[J.buttonBlockSize]:En({height:m.height,minHeight:m.minHeight}),[J.buttonBorderRadius]:m.borderRadius,[J.buttonBoxShadow]:m.boxShadow,[J.inlineAlignment]:m.justifyContent,"margin-top":m.marginTop,display:m.marginTop?"block":void 0}}))}),p.trim()}function Sn(t){return[["height"],["minHeight","min-height"],["borderRadius","border-radius"],["marginTop","margin-top"],["justifyContent","justify-content"]].reduce((e,[n,r])=>(e[n]=Od({rule:t,property:r!=null?r:n}),e),{})}function Od({rule:t,property:e}){const n=t.style.getPropertyValue(e);return t.style.getPropertyPriority(e)?"".concat(n," !important"):n||null}function xd({rule:t,property:e,currentPropertyValue:n}){const r=t[e];return!(n!=null&&n.includes("!important"))&&r!=null&&r.includes("!important")?r:n!=null?n:r}const Qa="d6d12da0",Pn="0402dc2d",In=2e3;class Dn extends Error{constructor(){super(...arguments),c(this,"name","AcceleratedCheckoutError")}}const Tt=class lu extends Lr{constructor(){super(),c(this,"instanceNumber",++lu.instanceCount),c(this,"pageType",S.ProductPage),c(this,"formObserver"),c(this,"dataSource"),c(this,"wrapper"),c(this,"shopPromiseEligible"),c(this,"didInitiateRender",!1),this.wrapper=document.createElement("div"),_d({instanceNumber:this.instanceNumber,styleId:"shopify-accelerated-checkout",styles:Kl,cssFileName:"AcceleratedCheckout.css"}),this.shopPromiseEligible=ma()}static get observedAttributes(){return["access-token","disabled","has-selling-plan","requires-shipping"]}async connectedCallback(){var e,n;try{if((n=(e=this.wrapper)==null?void 0:e.children)!=null&&n.length||this.didInitiateRender)return;if(!this.validateRenderingSurface()){this.clearUI();return}this.instanceNumber===1&&(Or(this),g.initStarted(),this.extractStyles());const r=jt(F.ButtonDisplay,"dc:".concat(this.instanceNumber));this.i18n=Ht(),this.setupFormObserver(),this.didInitiateRender=!0;const a=await this.loadWallet(),i=a.getInstrumentName();this.apiClient=new $t({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale,withCarrierRates:!0,cartPrepareMigrationEnabled:this.isFlagEnabled(Qa)}),this.dataSource=new wd(this,this.apiClient,i);const o=a.createWebComponent({walletContainer:this,dataSource:this.dataSource,i18n:this.i18n,apiClient:this.apiClient,classNames:Md(i),callToAction:"true",pageType:this.pageType,containerInstanceNumber:this.instanceNumber,onRendered:()=>g.instrumentLoaded({instrumentOrComponentName:i,result:"success",measurement:r()})});if(!o)throw new Dn("No web component instance found for instrument ".concat(i));this.render(o,i),g.initCompleted(),this.instanceNumber===1&&this.triggerLoadedEvent()}catch(r){if(this.clearUI(),g.initCompleted(r),r.name===yt)throw r;f.notify(new Dn("An error occurred while attempting to render AcceleratedCheckout: ".concat(r),{cause:r}))}}async attributeChangedCallback(e,n,r){n!==r&&(kr(this,e,r),e==="has-selling-plan"&&r===""?this.showBuyerConsent(this.apiClient,this.i18n):e==="has-selling-plan"&&r===null&&this.hideBuyerConsent())}async render(e,n){this.clearUI();const r=this.attachShadow({mode:"closed"}),a=document.createElement("style");a.innerHTML=qa,r.appendChild(a),this.wrapper.className="wallet-button-fade-in wallet-button-wrapper";const i=document.createElement("slot");i.name="button",this.wrapper.appendChild(i);const o=document.createElement("slot");o.name="promise",this.wrapper.appendChild(o);const s=document.createElement("slot");s.name="more-options",this.wrapper.appendChild(s),r==null||r.appendChild(this.wrapper),this.hasSellingPlan?this.showBuyerConsent(this.apiClient,this.i18n):this.hideBuyerConsent();const l=new DocumentFragment;l.appendChild(e);const d=this.getShopPromiseSlot();d&&l.appendChild(d);const u=this.getMorePaymentOptionsLink(n);u&&l.appendChild(u),this.appendChild(l)}getMorePaymentOptionsLink(e){var n,r;if(e===b.BuyItNow)return null;const a=document.createElement("more-payment-options-link");return zt(a,{"buyer-country":(n=this.buyerCountry)!=null?n:"","access-token":(r=this.accessToken)!=null?r:"","recommended-instrument":e,slot:"more-options"}),a.disabled=this.disabled,a.setDataSource(this.dataSource),a.setI18n(this.i18n),a.setClassNames(ur.MORE_PAYMENT_OPTION_BUTTON),a}getShopPromiseSlot(){if(!this.shopPromiseEligible)return null;const e=document.createElement("div");return e.setAttribute("data-shopify","shop-promise-payment-button-slot"),e.style.height="100%",e.slot="promise",e}validateRenderingSurface(){return Wt({page:"product",element:this})!=null}async loadWallet(){const e=Yl(this.recommendedWallet,this.fallbackWallet,"AcceleratedCheckout");return await Ud(this,T(w({},e),{instanceNumber:this.instanceNumber}))}setupFormObserver(){this.formObserver||(this.formObserver=new Aa(this,({disabled:e,hasSellingPlan:n})=>{this.disabled=e,this.hasSellingPlan=n,this.isShippingRequired=Fd(this,this.variantParams)}),this.formObserver.setupMutationObservers())}extractStyles(){if(this.styleExtractorDisabled){St()("shopify-support-debug")&&console.debug("[shopify-support-debug] styling backward compatibility disabled");return}const e=Ya(this);e&&Ka(this,e)}};c(Tt,"instanceCount",0);let wr=Tt;function Md(t){return t===b.BuyItNow?ur.UNBRANDED_BUTTON:ur.BRANDED_BUTTON}function Fd(t,e){var n;const r=xr(t);return!!((n=e.find(a=>a.id===Number(r==null?void 0:r.variantId)))!=null&&n.requiresShipping)}async function Ud(t,{recommendedWallet:e,fallbackWallet:n,instanceNumber:r}){const a=e?st(e):null,i=st(n),o=async s=>{const l=wa({walletInstrument:s,instanceNumber:r}),d="timeout",u=await Promise.race([l,new Promise(h=>setTimeout(()=>h(d),In))]);if(u===d)g.instrumentSDKLoaded({instrument:s.getInstrumentName(),measurement:In,result:"timeout"});else if(u instanceof ye)return u;return null};if(Pt(t,a)){const s=await o(a);if(s)return s}if(Pt(t,i)){const s=await o(i);if(s)return s}return st($n)}pe("shopify-accelerated-checkout",wr),pe("more-payment-options-link",$l,{isChildCustomElement:!0});const Bd=t=>{const e=new PerformanceObserver(n=>{n.getEntriesByType("resource").some(r=>r.name.includes(et.CartUpdate)||r.name.includes(et.CartChange)||r.name.includes(et.CartAdd)||r.name.includes(et.CartClear))&&t()});return e.observe({entryTypes:["resource"]}),e},$d=".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;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:150px;height:clamp(25px,var(--shopify-accelerated-checkout-button-inline-size, 42px),55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius, 4px);list-style-type:none!important;text-align:center;flex-shrink:0;flex-grow:0}.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:8px 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)}@container wrapper (width >= 150px) and (width <= 500px){.wallet-cart-grid: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: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:8px 0 0}.wallet-cart-grid: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: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 <= 310px){.wallet-cart-grid: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: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:8px 0 0}.wallet-cart-grid: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: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 <= 470px){.wallet-cart-grid: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: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:8px 0 0}.wallet-cart-grid: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: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 <= 630px){.wallet-cart-grid: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: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:8px 0 0}.wallet-cart-grid: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: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 <= 790px){.wallet-cart-grid: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: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:8px 0 0}.wallet-cart-grid: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: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:has(>.wallet-cart-button-container:nth-of-type(6)){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid: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:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(6)) .wallet-cart-button-container:first-child{margin:0}.wallet-cart-grid: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:flex-start;flex-direction:column;margin:0;max-width:none}.wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0;max-width:none}.wallet-cart-button-container:first-child{margin:0}.wallet
1-cart-button{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px)}}@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:8px 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}",Hd=".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;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:150px;height:clamp(25px,var(--shopify-accelerated-checkout-button-inline-size, 42px),55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius, 4px);list-style-type:none!important;text-align:center;flex-shrink:0;flex-grow:0}.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:8px 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)}@container wrapper (width >= 150px) and (width <= 500px){.wallet-cart-grid: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: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:8px 0 0}.wallet-cart-grid: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: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 <= 310px){.wallet-cart-grid: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: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:8px 0 0}.wallet-cart-grid: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: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 <= 470px){.wallet-cart-grid: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: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:8px 0 0}.wallet-cart-grid: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: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 <= 630px){.wallet-cart-grid: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: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:8px 0 0}.wallet-cart-grid: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: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 <= 790px){.wallet-cart-grid: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: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:8px 0 0}.wallet-cart-grid: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: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:has(>.wallet-cart-button-container:nth-of-type(6)){justify-content:flex-start;flex-direction:column;margin:0}.wallet-cart-grid: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:8px 0 0}.wallet-cart-grid:has(>.wallet-cart-button-container:nth-of-type(6)) .wallet-cart-button-container:first-child{margin:8px 0 0}.wallet-cart-grid: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:flex-start;flex-direction:column;margin:0;max-width:none}.wallet-cart-button-container{width:100%;height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 54px),55px);margin:8px 0 0;max-width:none}.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)}}@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:8px 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 Gd(t){const e=Wt({page:"cart",element:t});return _a({type:"attributes",form:e})}class zd{constructor(e,n,r){this.element=e,this.cartToken=n,this.apiClient=r}async getInitialCart(e){const n="gid://shopify/Cart/".concat(this.cartToken),r=Gd(this.element);let a,i=[];if(r.length){const o=await this.apiClient.updateCartAttributes({cartId:n,attributes:r,instrumentName:e,startingCheckout:!0});a=o.data,i=o.errors}else a=await this.apiClient.fetchCart({id:n,instrumentName:e,startingCheckout:!0});return{cart:a,errors:i}}}var Ve;const kt=class cu extends Lr{constructor(){super(),c(this,"instanceNumber",++cu.instanceCount),c(this,"pageType",S.CartPage),c(this,"cartObserver",null),c(this,"dataSource",null),c(this,"wrapper"),c(this,"didInitiateRender",!1),c(this,"amazonAdExperimentCheckoutButtonListeners",[]),O(this,Ve),this.wrapper=document.createElement("div")}static get observedAttributes(){return["access-token","has-selling-plan","requires-shipping"]}
1createDataSource(){if(!this.cartToken){g.cartTokenMissing({reason:"createDataSource"});return}this.i18n=Ht(),this.apiClient=new $t({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale,withCarrierRates:!0,cartPrepareMigrationEnabled:this.isFlagEnabled(Qa)}),this.dataSource=new zd(this,this.cartToken,this.apiClient)}async createWebComponents({shouldRefetchCartAttributes:e}){if(!this.walletConfigs)throw new ee({code:"invalid-wallet-configs",message:"[AcceleratedCheckoutCart] walletConfigs does not exist"});const n=Hl(this.walletConfigs,"AcceleratedCheckoutCart");if(!(n instanceof Array))throw new ee({code:"invalid-wallet-configs",message:"[AcceleratedCheckoutCart] invalid walletConfigs found"});const r=F.ButtonDisplay,a=o=>"".concat(o,":").concat(this.instanceNumber),i=await Vd(this,{walletConfigs:n,startButtonDisplayBenchmark:o=>We(r,a(o))});return this.createDataSource(),this.dataSource?(e&&await this.updateAttributes(),i.map(o=>{const s=o.getInstrumentName();return o.createWebComponent({walletContainer:this,dataSource:this.dataSource,i18n:this.i18n,apiClient:this.apiClient,pageType:this.pageType,containerInstanceNumber:this.instanceNumber,slot:"button-".concat(o.getInstrumentName()),onRendered:(()=>{let l=!1;return()=>{l||(l=!0,g.instrumentLoaded({instrumentOrComponentName:s,result:"success",measurement:Z(r,a(s))}))}})()})})):[]}async cartChangedCallback(){try{if(!this.dataSource&&this.cartToken){await this.render({shouldRefetchCartAttributes:!0}),g.initCompleted();return}else if(!this.cartToken){g.cartTokenMissing({reason:"cartChangedCallback"});return}await this.updateAttributes()}catch(e){this.clearUI(),f.notify(e)}}async updateAttributes(){var e,n;if(!this.cartToken||!this.apiClient)return;const r=await this.apiClient.fetchLimitedCart({id:"gid://shopify/Cart/".concat(this.cartToken),instrumentName:b.Unknown});this.hasSellingPlan=(e=r.sellingPlan)!=null?e:!1,this.isShippingRequired=(n=r.shippingRequired)!=null?n:!1}async connectedCallback(){try{if(this.didInitiateRender)return;if(this.instanceNumber===1&&Or(this),g.initStarted(),this.cartObserver=Bd(()=>this.cartChangedCallback()),!this.cartToken){g.cartTokenMissing({reason:"connectedCallback"});return}await this.render({shouldRefetchCartAttributes:!1}),g.initCompleted()}catch(e){this.clearUI(),g.initCompleted(e),f.notify(e)}}disconnectedCallback(){var e;(e=this.cartObserver)==null||e.disconnect(),this.isAmazonAdExperimentEnabled()&&this.removeAmazonAdExperimentCheckoutButtonListeners()}async attributeChangedCallback(e,n,r){n!==r&&(kr(this,e,r),e==="has-selling-plan"&&r===""?this.showBuyerConsent(this.apiClient,this.i18n):e==="has-selling-plan"&&r===null&&this.hideBuyerConsent())}get cartToken(){return lt("cart")}async render({shouldRefetchCartAttributes:e}){var n;if(this.hasLegacyCartCookie()){g.legacyCartCookie(),this.clearUI();return}this.didInitiateRender=!0;const r=jt(F.ButtonDisplay,"cart:".concat(this.instanceNumber)),a=await this.createWebComponents({shouldRefetchCartAttributes:e});if(this.clearUI(),a.length===0)return;try{if(this.isAmazonAdExperimentEnabled()){const u=a.find(p=>p.name===b.BuyWithPrime),h=a.find(p=>p.name===b.AmazonPay);g.log({body:"available wallets for amazon ad experiment",attributes:this.getTelemetryAttributes({buyWithPrimeCheckoutButton:!!u,amazonPayCheckoutButton:!!h})}),u?this.accelerateCheckoutButtonsForAmazonAdExperiment(u):h?this.accelerateCheckoutButtonsForAmazonAdExperiment(h):g.amazonAdExperimentAcceleratedCheckoutButtonSetup({instrument:b.Unknown,result:"failed"})}}catch(u){g.log({body:"failed to accelerate checkout buttons for amazon ad experiment",attributes:this.getTelemetryAttributes({error:u instanceof Error?u.message:String(u)})}),f.notify(u,{context:"failed to accelerate checkout buttons for amazon ad experiment"})}const i=new DocumentFragment,o=this.getOrCreateShadowRoot(),s=document.createElement("style");s.innerHTML=[qa,$d].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=((n=this.i18n)==null?void 0:n.translate("express_checkout"))||"",this.wrapper.appendChild(l);const d=document.createElement("div");d.className="wallet-cart-grid ".concat(ve.CONTAINER),qd()&&d.classList.add("wallet-cart-grid--vertical"),a.forEach(u=>{const h=document.createElement("div"),p=document.createElement("div"),m=document.createElement("slot");m.name="button-".concat(u.name),h.className="wallet-cart-button-container",p.className="wallet-cart-button",h.setAttribute("data-testid","grid-cell"),h.appendChild(p),p.appendChild(m),d.appendChild(h),i.appendChild(u)}),this.wrapper.appendChild(d),this.hasSellingPlan?this.showBuyerConsent(this.apiClient,this.i18n):this.hideBuyerConsent(),o.appendChild(this.wrapper),this.appendChild(i),g.instrumentLoaded({instrumentOrComponentName:"AcceleratedCheckoutCart",result:"success",measurement:r()})}getTelemetryAttributes(e={}){return w({isAmazonAdExperimentFlagEnabled:this.isFlagEnabled(Pn),amazonReferralSessionStorageValue:sessionStorage.getItem("shopify_amazon_referral"),cartToken:this.cartToken,cartInstance:this.instanceNumber,hasDataSource:!!this.dataSource},e)}isAmazonAdExperimentEnabled(){return this.isFlagEnabled(Pn)&&sessionStorage.getItem("shopify_amazon_referral")==="mShop"}accelerateCheckoutButtonsForAmazonAdExperiment(e){try{const n=document.getElementsByName("checkout");if(n.length<=0)throw g.log({body:"attempted to accelerate checkout buttons, but none were found",attributes:this.getTelemetryAttributes({walletName:e.name})}),new Error("No checkout buttons found");
1n.forEach(r=>{const a=i=>{try{i.preventDefault(),e.triggerCheckout(),g.amazonAdExperimentAcceleratedCheckoutButtonClicked({instrument:e.name,result:"success"}),g.log({body:"checkout button was clicked and accelerated",attributes:this.getTelemetryAttributes({walletName:e.name})})}catch(o){g.amazonAdExperimentAcceleratedCheckoutButtonClicked({instrument:e.name,result:"failed"}),g.log({body:"checkout button was clicked but failed to accelerate",attributes:this.getTelemetryAttributes({walletName:e.name})}),f.notify(o,{context:"checkout button was clicked but failed to accelerate checkout to ".concat(e.name)})}};r.addEventListener("click",a,!0),this.amazonAdExperimentCheckoutButtonListeners.push({button:r,listener:a})}),g.amazonAdExperimentAcceleratedCheckoutButtonSetup({instrument:e.name,result:"success"})}catch(n){g.amazonAdExperimentAcceleratedCheckoutButtonSetup({instrument:e.name,result:"failed"})}}removeAmazonAdExperimentCheckoutButtonListeners(){try{this.amazonAdExperimentCheckoutButtonListeners.forEach(({button:e,listener:n})=>{e.removeEventListener("click",n,!0)}),this.amazonAdExperimentCheckoutButtonListeners=[]}catch(e){f.notify(e,{context:"failed to remove checkout button event listeners"})}}getOrCreateShadowRoot(){return A(this,Ve)||k(this,Ve,this.attachShadow({mode:"closed"})),A(this,Ve)}hasLegacyCartCookie(){var e;return this.cartToken?(e=this.cartToken)==null?void 0:e.match(/^[a-z0-9]+$/):!1}extractStyles(){if(this.styleExtractorDisabled){St()("shopify-support-debug")&&console.debug("[shopify-support-debug] styling backward compatibility disabled");return}const e=Ya(this);if(e){Ka(this,e);const n=this.getOrCreateShadowRoot(),r=document.createElement("style");r.innerHTML=Hd,n.appendChild(r)}}};Ve=new WeakMap,c(kt,"instanceCount",0);let _r=kt;async function Vd(t,{walletConfigs:e,startButtonDisplayBenchmark:n=()=>{}}){const r=zl(t,bd(e));return(await Promise.all(r.map(a=>(n(a.getInstrumentName()),wa({walletInstrument:a,instanceNumber:t.instanceNumber}))))).filter(a=>a!=null)}function qd(){return!!document.querySelector(".additional-checkout-buttons--vertical shopify-accelerated-checkout-cart")}pe("shopify-accelerated-checkout-cart",_r);class jd{getInitialCart(){throw new Error('[NoOpDataSource] Unexpected call to "getCart"')}}const Lt=class uu extends Lr{constructor(){super(...arguments),c(this,"instanceNumber",++uu.instanceCount),c(this,"pageType",S.Checkout)}get walletConfig(){return this.getAttribute("wallet-config")}async connectedCallback(){var e;try{if(this.children.length)return;this.instanceNumber===1&&(Or(this),g.initStarted());const n=jt(F.ButtonDisplay,"dc:".concat(this.instanceNumber)),r=Gl(this.walletConfig,"WalletButton");if(!r)throw new bi("[WalletButton] No config provided.");const a=st(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){g.initCompleted(),this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"success"}}));return}const i=a.getInstrumentName();this.i18n=Ht(),this.apiClient=new $t({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale});const o=this.createWebComponent(a,this.i18n,this.apiClient,i,n);this.innerHTML="",this.appendChild(o),g.initCompleted(),this.instanceNumber===1&&this.triggerLoadedEvent()}catch(n){this.innerHTML="",this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"failure",message:(e=n.message)!=null?e:"Error loading wallet SDK"}})),g.initCompleted(n),f.notify(n)}}createWebComponent(e,n,r,a,i){const o=e.createWebComponent({walletContainer:this,dataSource:new jd,i18n:n,apiClient:r,containerInstanceNumber:this.instanceNumber,pageType:this.pageType});return o.onRendered=()=>{this.pciEnabled&&this.dispatchEvent(new CustomEvent("wallet-rendered",{detail:{status:"success"}})),g.instrumentLoaded({instrumentOrComponentName:a,result:"success",measurement:i()})},o}async eligibleToShow(e){return!(!Pt(this,e)||(await e.loadWalletSDK(),!e.getPartnerSDKEligibility().eligible))}};c(Lt,"instanceCount",0);let Er=Lt;pe("shopify-wallet-button",Er),ui(f,{metadata:{custom:{"notify-origin":"window-onerror"}}}),hi(f,{metadata:{custom:{"notify-origin":"unhandled-promise-rejection-handler"}}}),g.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.