import.meta;var Ka=Object.defineProperty,Yt=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Gr=t=>{throw TypeError(t)},Xa=(t,e,n)=>e in t?Ka(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,c=(t,e,n)=>Xa(t,typeof e!="symbol"?e+"":e,n),zr=(t,e,n)=>e.has(t)||Gr("Cannot "+n),b=(t,e,n)=>(zr(t,e,"read from private field"),n?n.call(t):e.get(t)),x=(t,e,n)=>e.has(t)?Gr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),L=(t,e,n,r)=>(zr(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),J=function(t,e){this[0]=t,this[1]=e},xe=(t,e,n)=>{var r=(o,s,l,u)=>{try{var d=n[o](s),h=(s=d.value)instanceof J,p=d.done;Promise.resolve(h?s[0]:s).then(g=>h?r(o==="return"?o:"next",s[1]?{done:g.done,value:g.value}:g,l,u):l({value:g,done:p})).catch(g=>r("throw",g,l,u))}catch(g){u(g)}},a=o=>i[o]=s=>new Promise((l,u)=>r(o,s,l,u)),i={};return n=n.apply(t,e),i[Yt("asyncIterator")]=()=>i,a("next"),a("throw"),a("return"),i},Z=(t,e,n)=>(e=t[Yt("asyncIterator")])?e.call(t):(t=t[Yt("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(u=>o({value:u,done:l}),s)))),n("next"),n("return"),e);const Ja=":host{display:flex;align-items:center;justify-content:center}";class Za extends HTMLElement{constructor(){super(...arguments),c(this,"size","18px"),c(this,"color","gray")}connectedCallback(){var e,n;this.attachShadow({mode:"open"}),this.size=(e=this.getAttribute("size"))!=null?e:this.size,this.color=(n=this.getAttribute("color"))!=null?n:this.color,this.render();const r=document.createElement("style");r.textContent=Ja,this.shadowRoot.appendChild(r)}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 \n ')}}const ei="#overlay{position:fixed;width:100%;height:100%;background:#0006;top:0;left:0;z-index:2147483647;animation:modalPop .3s ease-out}#modal{position:fixed;top:20%;left:50%;width:100%;max-width:383px;transform:translate(-50%,-100%);background:#fff;color:#000;border-radius:5px;animation:modalSlideInFromTop .3s forwards}@keyframes modalPop{0%{opacity:0}to{opacity:1}}@keyframes modalSlideInFromTop{0%{transform:translate(-50%,-100%)}to{transform:translate(-50%)}}@keyframes modalSlideInFromBottom{0%{transform:translate(-50%,100%)}to{transform:translate(-50%)}}@media only screen and (max-width: 640px){#modal{top:auto;bottom:0;animation:modalSlideInFromBottom .3s forwards}}#modal footer{padding:0 21px 21px}#modal header{display:flex;justify-content:space-between;padding:21px 21px 16px}#title{font-size:21px;font-weight:600;line-height:25.2px;margin:0}.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 ti(t){return Ln(t).map(e=>e instanceof Error?e:new On("[".concat(typeof e,"] ").concat(ri(e).slice(0,10240))))}function Ln(t,e=0){return e>=20?[t,"Truncated cause stack"]:t instanceof Error&&t.cause?[t,...Ln(t.cause,e+1)]:[t]}function ri(t){var e;if(typeof t=="function")return"".concat(t.name||"anonymous");if(typeof t!="string")try{return(e=JSON.stringify(t))!=null?e:typeof t}catch(n){}return"".concat(t)}var On=class extends Error{constructor(){super(...arguments),c(this,"name","BugsnagInvalidError")}},kn=/^\s*at .*(\S+:\d+|\(native\))/m,ni=/^(eval@)?(\[native code])?$/;function ai(t){return t.stack?t.stack.match(kn)?ii(t):oi(t):[]}function Mn(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 ii(t){return t.stack.split("\n").filter(e=>!!e.match(kn)).map(e=>{let n=e.replace(/^\s+/,"").replace(/^.*?\s+/,""),r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],""):n;let a=Mn(r?r[1]:n),i=r&&n||void 0,o=["eval",""].indexOf(a[0])>-1?void 0:a[0];return{method:i,file:o,lineNumber:a[1],columnNumber:a[2]}})}function oi(t){return t.stack.split("\n").filter(e=>!e.match(ni)).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=Mn(e.replace(n,""));return{method:a,file:i[0],lineNumber:i[1],columnNumber:i[2]}})}var jt="5",si=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"),c(this,"session");var e,n,r;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://error-analytics-production.shopifysvc.com",sessions:"https://error-analytics-sessions-production.shopifysvc.com/observeonly"},this.plugins=(n=t.plugins)!=null?n:[],this.plugins.forEach(a=>a.load(this)),this.leaveBreadcrumb("Bugsnag started",void 0,"state"),((r=t.withSessionTracking)==null||r)&&(this.session={id:this.getRandomUUID(),startedAt:new Date().toISOString(),events:{handled:0,unhandled:0}},this.startSession())}addMetadata(t){for(let e of Object.keys(t))this.persistedMetadata[e]=t[e]}getSessionId(){var t;return(t=this.session)==null?void 0:t.id}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,u;let d=ti(t),h={...this.metadata,...this.persistedMetadata,...i},p=this.buildBugsnagEvent(d,{errorClass:e,severityType:r,handled:a,severity:n,metadata:h,context:o,groupingHash:s});if(((u=(l=this.onError)==null?void 0:l.call(this,p,t))==null||u)&&this.releaseStage!=="development"){this.updateAndAppendSessionInformation(p);let g=this.sendToBugsnag(p);return this.onPostErrorListeners.forEach(A=>A(p,t)),g}return Promise.resolve()}addOnPostError(t){this.onPostErrorListeners.push(t)}updateAndAppendSessionInformation(t){this.session&&(t.unhandled?this.session.events.unhandled++:this.session.events.handled++,t.session=this.session)}buildBugsnagEvent(t,{errorClass:e,severity:n="error",severityType:r="handledException",handled:a,metadata:i={},context:o,groupingHash:s}){let l=new Date().toISOString(),{breadcrumbs:u,appId:d,appType:h,appVersion:p,releaseStage:g,locale:A,userAgent:E}=this,w=t.map((S,G)=>({errorClass:G===0&&e!=null?e:S.name,stacktrace:xn(d,S),message:S.message,type:"browserjs"}));return{payloadVersion:jt,exceptions:w,severity:n,severityReason:{type:r},unhandled:!a,app:{id:d,type:h,version:p,releaseStage:g},device:{time:l,locale:A,userAgent:E},breadcrumbs:u,context:o,metaData:i,groupingHash:s}}async startSession(){var t,e;if(this.releaseStage==="development"){console.log("Skipping error logging session tracking in development mode");return}let{apiKey:n}=this,r={notifier:{name:"Bugsnag JavaScript",version:"7.22.2",url:"https://github.com/bugsnag/bugsnag-js"},app:{version:this.appVersion,releaseStage:this.releaseStage,type:this.appType},device:{id:this.appId,locale:this.locale,userAgent:this.userAgent},sessions:[this.session]};try{await fetch(this.endpoints.sessions,{method:"POST",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":n,"Bugsnag-Payload-Version":jt,"Bugsnag-Sent-At":(e=(t=this.session)==null?void 0:t.startedAt)!=null?e:new Date().toISOString()},body:JSON.stringify(r,Vr())})}catch(a){console.warn("[bugsnag-light] failed to start session"),console.warn(a)}}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":jt,"Bugsnag-Sent-At":t.device.time},body:JSON.stringify(n,Vr())})}catch(r){console.warn("[bugsnag-light] failed to send an event"),console.warn(r)}}getRandomUUID(){try{return crypto.randomUUID()}catch(t){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)})}}};function xn(t,e){let n=ai(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 On){let r=n.findIndex(a=>a.method.endsWith("notify"));r>-1&&(n=n.slice(r+1))}return n}function Vr(){let t=new WeakSet;return function(e,n){if(typeof n=="object"&&n!==null){if(t.has(n))return"[Circular]";t.add(n)}return n}}var li=class wh extends Error{constructor(e){super(e),c(this,"reason"),this.name="BreadcrumbsPluginFetchError",Object.setPrototypeOf(this,wh.prototype)}};function ci(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 di(t,{metadata:e}={}){window.addEventListener("unhandledrejection",n=>{n.reason&&n.reason instanceof Error&&n.reason.stack&&!(n.reason instanceof li)&&t.notify(n.reason,{severityType:"unhandledPromiseRejection",handled:!1,metadata:e})})}function ut(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 lr={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"},ui={DARK:"apple-pay--dark",LIGHT:"apple-pay--light"},hi=44,pi="_shopify_y",Un=6,mi="discount_code",br="https://static-na.payments-amazon.com",wr="".concat(br,"/checkout.js"),Bn="https://www.paypal.com",Hn="https://pay.google.com",le={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",PAYMENT_METHOD_NOT_APPLICABLE:"wallet_payment_method_not_applicable",INVALID_PAYMENT_DEFERRED_PAYMENT_REQUIRED:"wallet_invalid_payment_deferred_payment_required",LOCALIZATION_EXTENSION_FIELD_ERROR:"wallet_localization_extension_field_error"},It="VALIDATION_CUSTOM",$n="portable-wallets",Oe={BUTTON:"accelerated-checkout-button",CONTAINER:"accelerated-checkout-button-container"},Gn="unknown",zn={name:"buy_it_now",wallet_params:{}};function Vn(t){try{return!t.toString().includes("[native code]")}catch(e){return!0}}const Qt=new Map,yi={checkDuplicate({errorClass:t,message:e}){if(Qt.has(t)){const n=Qt.get(t);if(n.has(e))return!0;n.add(e)}else Qt.set(t,new Set([e]));return!1},reset(){}};var pt;class ne extends Error{constructor(e,{groupingHash:n,...r}={}){super(e,r),x(this,pt),c(this,"autogenerateHash",!1),c(this,"useHashPrefix",!1),L(this,pt,n)}get groupingHash(){var e;const n=(e=b(this,pt))!=null?e:this.autogenerateHash?gi(this.message):"";return(this.useHashPrefix?"".concat(this.name,"-").concat(n):n)||void 0}}pt=new WeakMap;function gi(t){return t.toLowerCase().slice(0,100).replace(/[^a-z0-9\s]/g,"").trim().split(/\s+/).slice(0,5).join("-")}const ft="DeveloperError";class X 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",ft),c(this,"code"),this.code=e}}const Wn="SilencedError";class te extends Error{constructor(){super(...arguments),c(this,"name",Wn)}}class fi extends Error{constructor(){super(...arguments),c(this,"name","MissingConfigError")}}class be extends ne{constructor(){super(...arguments),c(this,"name","NoResponseError"),c(this,"useHashPrefix",!0),c(this,"autogenerateHash",!0)}}class _t extends ne{constructor(e,{errorDetails:n}){const r=_t.generateGraphQLGroupingHash(e,n);super(e,{groupingHash:r}),c(this,"errorDetails"),c(this,"useHashPrefix",!0),this.name="GraphQLResponseError",this.errorDetails=n}static generateGraphQLGroupingHash(e,n){const{operationName:r}=n,a=this.getErrorMessageCategoryFromMessage(e);return r?"".concat(r,"-").concat(a):a}static getErrorMessageCategoryFromMessage(e){const n=[[/Variable \$\w+ of type \w+!? was provided invalid value/i,"graphql-input-validation"],[/Cannot read propert(?:y|ies)(?: .+)? of (?:null|undefined)/i,"null-property-access"],[/(?:null|undefined) is not an object/i,"null-not-object"]];for(const[i,o]of n){const s=e.match(i);if(s){const l=s[1];return l?"".concat(o,"-").concat(l):o}}let r=e;const a=[/^GraphQL response error for \w+:\s*(with status \d+\s*=>\s*|=>\s*)?/i,/^GraphQL\s+Client:\s*/i,/^GraphQL\s+response\s+error\s+for\s+\w+:\s*with\s+status\s+\d+\s*=>\s*/i,/An error occurred while fetching from the API. Review 'graphQLErrors' for details./i];for(const i of a)r=r.replace(i,"");return r=r.slice(0,100),r.toLowerCase().replace(/[^a-z0-9\s]/g,"").trim().split(/\s+/).slice(0,5).join("-")||"unknown-error"}}const qn="IgnoredGraphQLResponseError";class Ct extends _t{constructor(e,{reason:n,errorDetails:r}){super(e,{errorDetails:r}),c(this,"reason"),this.name=qn,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 _i=0;function fe(t){return"__private_"+_i+++"_"+t}function Ft(t){return Object.entries(t).map(([e,n])=>({key:e,value:{stringValue:String(n)}}))}function Ei(t){return Object.entries(t).map(([e,n])=>({key:e,value:Yn(n)}))}function Yn(t){if(Array.isArray(t))return{arrayValue:{values:t.map(e=>Yn(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,Ai=bi(5,2,12);function bi(t,e,n){const r=[0];for(let a=0;a{switch(r.attributes={...R(this,Q)[Q],...r.attributes},r.type){case"histogram":Pi(e,r);break;case"exponential_histogram":Si(e,r);break;case"counter":Ii(e,r);break;case"gauge":Ci(e,r);break}});const n=Object.values(e);n.length!==0&&(R(this,V)[V]=[],await R(this,we)[we].exportMetrics(n))}async exportLogs(){const e=R(this,Pe)[Pe].map(n=>{const r={timeUnixNano:n.timeUnixNano,observedTimeUnixNano:n.timeUnixNano,attributes:Ei({...R(this,Q)[Q],...n.attributes})};return n.body&&(r.body={stringValue:n.body}),r});e.length!==0&&(R(this,Pe)[Pe]=[],await R(this,we)[we].exportLogs(e))}}function Pi(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:Ai,u=new Array(l.length+1).fill(0);t[r]||(t[r]={name:r,unit:i||"1",histogram:{aggregationTemporality:Pr,dataPoints:[]}});for(let d=0;d0?h:0,bucketCounts:r>0?[1]:[]};t[n].exponentialHistogram.dataPoints.push({attributes:Ft(o!=null?o:{}),startTimeUnixNano:i,timeUnixNano:i,count:1,sum:l,scale:u,zeroCount:p,positive:A,negative:g,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:Ft(o!=null?o:{})})}function Ci(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:Ft(o!=null?o:{})})}var et=fe("url"),Se=fe("serviceName"),tt=fe("logger"),rt=fe("fetchFn");class Di{constructor(e,n,r){Object.defineProperty(this,et,{writable:!0,value:void 0}),Object.defineProperty(this,Se,{writable:!0,value:void 0}),Object.defineProperty(this,tt,{writable:!0,value:void 0}),Object.defineProperty(this,rt,{writable:!0,value:void 0}),R(this,et)[et]=e.replace(/\/v1\/(logs|metrics|traces)\/?$/,""),R(this,Se)[Se]=n,R(this,tt)[tt]=r==null?void 0:r.logger,R(this,rt)[rt]=r==null?void 0:r.fetchFn}async exportMetrics(e){const n={resourceMetrics:[{resource:{attributes:[{key:"service.name",value:{stringValue:R(this,Se)[Se]}}]},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,Se)[Se]}}]},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,et)[et]).concat(n),{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if((r=R(this,tt)[tt])===null||r===void 0||r.log({status:a.status}),!a.ok){if(a.status===400){const i=await a.text();throw new st("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 st("Server did not accept data",{errorData:i,retryAfter:s,body:e})}throw new st("Server responded with ".concat(a.status))}}exporterFetch(){return R(this,rt)[rt]||fetch}}class st 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",Ti="portable_wallets";var Ve;class Ni{constructor(e){x(this,Ve),L(this,Ve,e)}async exportMetrics(e){var n;try{await b(this,Ve).exportMetrics(e)}catch(r){if(r instanceof st){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 b(this,Ve).exportLogs(e)}catch(r){if(r instanceof st){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})}}}Ve=new WeakMap;const vi=new Di(Ri,Ti),Li=new Ni(vi),P=new wi({exporter:Li}),jn="TelemetryExportError";class Wr extends Error{constructor(){super(...arguments),c(this,"name",jn)}}const Qn="LimitedCartQueryError";class Oi extends Error{constructor(){super(...arguments),c(this,"name",Qn)}}const Kn=["OpenTelemetryClientError",Wn,jn,qn,ft],ki=["Load failed","Failed to fetch","when attempting to fetch resource","GraphQL mutation failed with status 404","Component closed",...Kn],qr=new Map([["TypeError","Illegal constructor"],["BugsnagInvalidError",'"isTrusted":true'],[Qn,"Limited cart query returned no response"],["AbortError","Fetch is aborted"],["SyntaxError","The string did not match the expected pattern."]]),Mi=["chrome-lighthouse","meta-externalads","crawler","spider","scraper","facebookexternalhit","bot"];function xi(t){const e=t.exceptions[0];return Fi()?"silenced-user-agent":Ui(t)?"empty-stack-trace":Bi(e)?"spin":Hi()?"monkey-patch":zi(t)?"external-error":Wi(t)?"developer-error":Vi(e.message)?"discarded-message":qi(t)?"discarded-error-class":Yi(e)?"discarded-class-message":ji(t)?"unactionable-invalid-error":$i(t)||null}function Fi(){const t=navigator.userAgent.toLowerCase();return Mi.some(e=>t.includes(e))}function Ui(t){return t.exceptions[0].stacktrace.length===0}function Bi(t){return t.stacktrace.some(e=>{var n;return(n=e.file)==null?void 0:n.includes("spin.dev")})}function Hi(){return[HTMLElement,Event,document.createElement].some(Vn)}function $i(t){const e=t.exceptions.map(n=>n.stacktrace.filter(r=>!Gi(r)));return e.some(n=>{var r;return!((r=n[0])!=null&&r.inProject)})?"external-trigger":e.some(n=>n.filter(r=>r.inProject).every(r=>[Bn,br,Hn].some(a=>r.file.startsWith(a))))?"wallet-sdk-stack-trace":null}function Gi(t){return t.file.includes("native code")||t.file.includes("/cdn/wpm/")}function zi(t){return!t.exceptions[0].stacktrace.some(e=>e.inProject)}function Vi(t){return ki.some(e=>t==null?void 0:t.includes(e))}function Wi(t){const e=t.exceptions.some(n=>n.errorClass===ft);return e&&console.error(t.exceptions[0]),e}function qi(t){return t.exceptions.some(e=>Kn.includes(e.errorClass))}function Yi(t){const e=t.errorClass,n=t.message;return qr.has(e)&&(n==null?void 0:n.includes(qr.get(e)))}function ji(t){return t.exceptions[0].errorClass==="BugsnagInvalidError"&&t.unhandled}var D=(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.PayPalTokenCreationError="portable_wallets_paypal_token_creation_error",t.AuthorizationAttempt="portable_wallets_authorization_attempt",t.AuthorizationComplete="portable_wallets_authorization_complete",t.CartTokenMissing="portable_wallets_cart_token_missing",t.RemovePersonalDataResult="portable_wallets_cart_remove_personal_data_result",t.GooglePayNotEligibleWebview="portable_wallets_google_pay_not_eligible_webview",t.WalletConfigDeveloperError="portable_wallets_wallet_config_developer_error",t.LegacyCartCookie="portable_wallets_legacy_cart_cookie",t.StyleBackwardsCompatibility="portable_wallets_style_backwards_compatibility",t.StyleBackwardsCompatibilityExecutionTime="portable_wallets_style_backwards_compatibility_execution_time",t.StyleBackwardsCompatibilityRules="portable_wallets_style_backwards_compatibility_rules",t.AmazonPayLoadRetries="portable_wallets_amazon_pay_sdk_load_retries",t.DynamicTaxFailed="portable_wallets_dynamic_tax_failed",t.DynamicShippingFailed="portable_wallets_dynamic_shipping_failed",t.SheetLoaded="portable_wallets_sheet_loaded",t.ErrorTriggered="portable_wallets_error_triggered",t.GooglePayNullCartOnAuthorize="portable_wallets_google_pay_null_cart_on_authorize",t.UnrecoverableCartError="portable_wallets_unrecoverable_cart_error",t.ShopPayPersonalizedIframeLoadTime="portable_wallets_shop_pay_personalized_iframe_load_time",t.ShopPayPersonalizedIframeLoadTimeFromPageLoad="portable_wallets_shop_pay_personalized_iframe_load_time_from_page_load",t.PaymentCompletedAfterAbort="portable_wallets_payment_completed_after_abort",t.WalletSessionAbortError="portable_wallets_wallet_session_abort_error",t))(D||{}),Re=(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))(Re||{}),f=(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))(f||{}),W=(t=>(t.InvalidQuantity="InvalidQuantity",t.VariantRequiresSellingPlan="VariantRequiresSellingPlan",t.SellingPlanNotApplicable="SellingPlanNotApplicable",t.MerchandiseIdInvalid="MerchandiseIdInvalid",t))(W||{}),I=(t=>(t.CartPage="cart_page",t.CartAjax="cart_ajax",t.ProductPage="product",t.Checkout="checkout",t.Unknown="unknown",t))(I||{}),at=(t=>(t.CartChange="/cart/change",t.CartUpdate="/cart/update",t.CartAdd="/cart/add",t.CartClear="/cart/clear",t))(at||{}),Ne=(t=>(t.OneTimePurchase="ONE_TIME_PURCHASE",t.Subscription="SUBSCRIPTION",t))(Ne||{});let Ut=Qi();function Qi(){return{shopId:Gn,debug:!1,pageType:I.Unknown}}function Ki(t){Object.assign(Ut,t)}function Sr(){const{debug:t,...e}=Ut;return e}function Xi(){return Ut.debug}function Ir(){return Ut.pageType}function Ji(t,e){const n=t.exceptions[0];if(!n||!n.message||yi.checkDuplicate(n))return!1;const r=to(e);Zi(t,r);let a=null;try{a=xi(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:xn($n,o)};t.exceptions.unshift(s)}return ao(a),Xi()&&io({errorClass:n.errorClass,message:n.message,stacktrace:JSON.stringify(n.stacktrace),filterResult:a,metadata:JSON.stringify(t.metaData)}),a==null}function Zi(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,ro(t),no(t),t.groupingHash=eo(e);const l=Sr();t.metaData={...t.metaData,shop:{...l,...t.metaData.shop},custom:{...t.metaData.custom,customFetch:Vn(fetch)},error_source:{shop_id:l.shopId},monorail:s},e[0]instanceof _t&&(t.metaData.graphql={...e[0].errorDetails},e[0]instanceof Ct&&(t.metaData.graphql.reason=e[0].reason))}function eo(t){for(const e of t)if("groupingHash"in e&&e.groupingHash)return e.groupingHash.toString()}function to(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 ro(t){for(const e of t.exceptions)for(const n of e.stacktrace)[Bn,br,Hn].some(r=>n.file.startsWith(r))&&(n.inProject=!0)}function no(t){var e;for(const n of t.exceptions)for(const r of n.stacktrace)(e=r.file)!=null&&e.includes("portable-wallets")&&(r.file=r.file.split("#")[0].split("?")[0])}function ao(t){P.counter({name:D.ErrorTriggered,value:1,attributes:{filterResult:t||"valid-error"}})}function io(t){P.log({body:"Bugsnag Error",attributes:{...Sr(),...t}})}var vn;const oo={apiKey:"e6b446c1ebe782e2b2fc7eb8ef0dc791",appId:$n,appVersion:"0.0.0-99c6ae553fc79d1213424066c8425b5ab73e14ff",releaseStage:"production",locale:"en",userAgent:navigator.userAgent,metadata:{user:{id:(vn=ut(pi))!=null?vn:"unknown"}},onError:Ji},_=new si(oo);_.addOnPostError(t=>{_.leaveBreadcrumb("Bugsnag Error Notified",{errorClass:t.exceptions[0].errorClass,message:t.exceptions[0].message},"error")});var Xn={en:{express_checkout:"Express checkout",instruments_copy:{checkout:{buy_now:"Buy it now"}},error_dialogs:{checkout:{title:"Transaction failed",generic_error:"Checkout is currently unavailable due to technical problems. Please try again in a few minutes.",button_text:"Close"},product:{out_of_stock:"This item is no longer available."},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",phone:"Phone number cannot contain emojis"},too_long:{address1:"Address line is too long",address2:"Second address line is too long",first_name:"First name is too long",last_name:"Last name is too long",city:"City is too long"},url:{first_name:"First name cannot contain a URL",last_name:"Last name cannot contain a URL"},html_tags:{first_name:"First name cannot contain HTML tags",last_name:"Last name cannot contain HTML tags",city:"City cannot contain HTML tags",address1:"Address line cannot contain HTML tags",address2:"Second address line cannot contain HTML tags"},currency:{mismatch:"Your cart and currency has been updated based on your shipping country."}}}};Xn.en;let Kt;class Yr extends Error{constructor(e,n){const r="i18n: Missing or invalid translation '".concat(e,"' in '").concat(n,"'");super(r)}}class so extends Error{constructor(e,n,r){const a="i18n: Missing translation template key '".concat(e,"' for '").concat(n,"' in '").concat(r,"'");super(a)}}class lo extends Error{constructor(e,n,r){const a="i18n: Invalid pluralization for '".concat(e,"':'").concat(n,"' in '").concat(r,"'");super(a)}}function Bt(){return Kt==null&&(Kt=co(Xn)),Kt}function co(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,u)=>{const d=u.replace(/%\{(.*)\}/,"$1");return o[d]?l.replace(u,o[d]):(_.notify(new so(d,i,a)),l)},i):i},a=uo();return{locale:a,translate(i,o={}){var s;const l=i.split(".");let u=t[a];try{for(const d of l)switch(typeof u){case"object":u=u[d];break;case"string":case"undefined":throw new Yr(i,a)}if(e(u,o)){if(typeof u=="string")throw new lo(i,u,a);u=u[n(u,o.count)]}if(typeof u!="string")throw new Yr(i,a);return r(u,o)}catch(d){return _.notify(d),(s=o.defaultValue)!=null?s:i}}}}function uo(){return"en"}function jr(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;rt=e),t]}function ea(){return!!document.querySelector('[data-source-attribution="shopify.shop-promise-pdp"]')}function pe(){return new Date().getTime()}function Cr(t){return t.find(e=>typeof e=="object"&&(e==null?void 0:e.code)===It)}class po extends HTMLElement{constructor(){super(...arguments),c(this,"overflow",""),c(this,"formerFocus",null)}connectedCallback(){this.attachShadow({mode:"open"}),this.formerFocus=document.activeElement;const e=Bt();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=ei,n.appendChild(i),this.overflow=document.body.style.overflow,document.body.style.overflow="hidden",this.trapFocus(r,n),ae("svg-icon",Za)}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 \n ");this.shadowRoot.innerHTML='\n
\n
\n \n
\n '.concat(n,'\n
\n \n \n
\n
\n
\n ').concat(r?i:"","\n
\n
\n ")}}const mo="@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 Ht({type:t="button",label:e=void 0}={}){const n=document.createElement("button");return n.type=t,e&&n.setAttribute("aria-label",e),n}function $t(t,e){for(const[n,r]of Object.entries(e))t.setAttribute(n,r)}function Qr(t,e){for(const[n,r]of Object.entries(e))t.style.setProperty(n,r)}function Et(t,e){const n=document.createElement("top-level-modal");n.textContent=e,$t(n,{"data-testid":"top-level-modal","has-close-button":"true",title:t}),document.body.appendChild(n)}function Dr(t,e,n){const r=document.createElement("top-level-modal");$t(r,{"data-testid":"top-level-modal",title:t}),e instanceof Promise?(r.innerHTML="\n \n \n \n \n \n \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 F(t,e){Et(e.translate("error_dialogs.wallet.title",{wallet:t}),e.translate("error_dialogs.wallet.generic_error",{wallet:t}))}function At(t){Et(t.translate("error_dialogs.checkout.title"),t.translate("error_dialogs.checkout.generic_error"))}function ke(t,e){Et(t.translate("error_dialogs.checkout.title"),e)}function Me(t,e){switch(e){case W.InvalidQuantity:case W.VariantRequiresSellingPlan:case W.SellingPlanNotApplicable:case W.MerchandiseIdInvalid:At(t);break}}function ye(t){Et(t.translate("error_dialogs.checkout.title"),t.translate("error_dialogs.product.out_of_stock"))}ae("top-level-modal",po);class bt 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 yo="#more-payment-options-link{cursor:pointer}";function go(t,e,n){return(e=_o(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Kr(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 Xr(t){for(var e=1;ee.toString(16)).join("")}function wo(t,e=!0){return t&&Object.keys(t).length&&e?Object.keys(t).map(n=>({[Po(n)]:t[n]})).reduce((n,r)=>Xr(Xr({},n),r)):t}function Po(t){return t.split(/(?=[A-Z])/).join("_").toLowerCase()}function So(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||bo()).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 Io({endpoint:t,event:e,keepalive:n}){var r,a,i,o,s;const l=e.metadata?{clientMessageId:(r=e.metadata)===null||r===void 0?void 0:r.clientMessageId,eventCreatedAtMs:(a=e.metadata)===null||a===void 0?void 0:a.eventCreatedAtMs,consent:(i=e.metadata)===null||i===void 0?void 0:i.consent,consent_provider:(o=e.metadata)===null||o===void 0?void 0:o.consent_provider,consent_version:(s=e.metadata)===null||s===void 0?void 0:s.consent_version}:void 0;return fetch(t!=null?t:Eo+Ao,{method:"post",headers:So(e.metadata),body:JSON.stringify({schema_id:e.schemaId,payload:e.payload,metadata:l&&wo(l,!0)}),keepalive:n})}const Co="2.1",Do="3",Xt={NO_VALUE:"",ACCEPTED:"1",DECLINED:"0"},Y={PREFERENCES:"p",ANALYTICS:"a",MARKETING:"m",SALE_OF_DATA:"t"},ce={MARKETING:"m",ANALYTICS:"a",PREFERENCES:"p",SALE_OF_DATA:"s"},Ro=()=>typeof __CtaTestEnv__>"u"?!1:__CtaTestEnv__==="true",To="_tracking_consent";function Jr(t){try{return decodeURIComponent(t)}catch(e){return""}}function ta(t,e=!1){const n=document.cookie?document.cookie.split("; "):[];for(let r=0;rg.charCodeAt(0).toString(16).padStart(2,"0")).join("");l=[8,13,18,23].reduce((g,A)=>g.slice(0,A)+"-"+g.slice(A),p)}function u(h){const p=n.split(".")[0];return p.includes(h.toLowerCase())?Xt.DECLINED:p.includes(h.toUpperCase())?Xt.ACCEPTED:Xt.NO_VALUE}function d(h){return n.includes(h.replace("t","s").toUpperCase())}return{v:Do,con:{CMP:{[ce.ANALYTICS]:u(ce.ANALYTICS),[ce.PREFERENCES]:u(ce.PREFERENCES),[ce.MARKETING]:u(ce.MARKETING),[ce.SALE_OF_DATA]:u(ce.SALE_OF_DATA)}},region:r||"",cus:s,purposes:{[Y.ANALYTICS]:d(Y.ANALYTICS),[Y.PREFERENCES]:d(Y.PREFERENCES),[Y.MARKETING]:d(Y.MARKETING),[Y.SALE_OF_DATA]:d(Y.SALE_OF_DATA)},sale_of_data_region:i=="t",display_banner:a=="t",consent_id:l}}function Gt(t){const e=ko();if(!e||!e.purposes)return!0;const n=e.purposes[t];return typeof n=="boolean"?n:!0}function Uo(){return Gt(Y.PREFERENCES)}function Bo(){return Gt(Y.ANALYTICS)}function Ho(){return Gt(Y.MARKETING)}function $o(){return Gt(Y.SALE_OF_DATA)}function Go(){return Bo()}function zo(){return Uo()}function Vo(){return Ho()}function Wo(){return $o()}function qo(){return Vo()}function Yo(){return Go()}function jo(){return zo()}function Qo(){return Wo()}function Ko(){const t=[];return Yo()&&t.push("analytics"),qo()&&t.push("marketing"),Qo()&&t.push("sale_of_data"),jo()&&t.push("preferences"),t}function Xo(t,e){switch(e){case"v1":{const n=Ko();return{...t,metadata:{...t==null?void 0:t.metadata,consent:n,consent_provider:"consent-tracking-api",consent_version:e}}}default:throw new Rr(e)}}class Rr extends Error{constructor(e){super("Version ".concat(e," is not supported by the consent-tracking-api provider")),this.name="MonorailConsentTrackingApiProviderVersionError",Object.setPrototypeOf(this,Rr.prototype)}}const Jo=["Chrome-Lighthouse","Googlebot"];function Zo(){const t=navigator.userAgent;return Jo.some(e=>t.includes(e))}async function es(t){if(Zo())return;const e=Xo(t,"v1");let n;try{n=await Io({event:e})}catch(r){}if(!(n!=null&&n.ok))try{P.counter({name:D.MonorailProduceError,value:1,attributes:{schemaId:e.schemaId}})}catch(r){}}const Jt="shopify_wallet_checkout_track/6.3";async function $(t){var e,n,r,a,i,o,s;const l=await ts();if(!l)return;const u={schemaId:Jt,payload:{app_name:"storefront",page_type:ho(),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}};_.leaveBreadcrumb("monorail event produced to ".concat(Jt),{schemaId:Jt,payload:t});try{await es(u)}catch(d){_.notify(new rs("Failed to send monorail event: ".concat(d),{cause:d}),{metadata:{request:{monorail:{payload:JSON.stringify(u)}}}})}}async function ts(){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,u;(u=(l=window==null?void 0:window.ShopifyAnalytics)==null?void 0:l.lib)!=null&&u.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}class rs extends Error{constructor(){super(...arguments),c(this,"name","MonorailError")}}var M=(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.SheetLoaded="portable_wallets_sheet_loaded",t.ShopPayButtonInView="portable_wallets_shop_pay_button_in_view",t))(M||{});const Zr={[I.Checkout]:"bwp_checkout_widget_click",[I.CartAjax]:"bwp_cart_widget_click",[I.CartPage]:"bwp_cart_widget_click",[I.ProductPage]:"bwp_widget_click",[I.Unknown]:"bwp_widget_click"};function ns({apiClientId:t,skus:e,pageType:n}){var r;if(!((r=window.Shopify)!=null&&r.analytics))return;const a=n&&Zr[n]||"bwp_widget_click";a===Zr[I.Checkout]&&window.Shopify.analytics.publish("shopify:app:pixels:load:".concat(t),{},{sendTo:"PIXEL-LOADER"}),e&&window.Shopify.analytics.publish(a,{skus:e},{sendTo:t})}function T(t){return{pageType:Ir(),...t}}function as(){const t=Ir()===I.CartPage?M.CartInitCalled:M.InitCalled;$({event:t})}function is(t){var e,n;const r=t?"Failed":"Success",a=t&&Is(t)?"[".concat(t.name,"]: ").concat(t.code):void 0,i=M["Init".concat(r)];$({event:i,eventSubtype:a}),P.counter({name:D.InitCompleted,value:1,attributes:T({result:r.toLowerCase(),eventType:a,recoveredFailure:!!((n=(e=window.Shopify)==null?void 0:e.PaymentButton)!=null&&n.failedToLoad)})})}function os({instrumentOrComponentName:t,result:e,measurement:n}){$({event:e==="success"?M.InstrumentLoaded:M.InstrumentLoadFailed,instrumentId:t,ttl:n}),n!=null&&(P.histogram({name:D.InstrumentLoadTime,value:n,attributes:T({instrument:t}),unit:"ms"}),P.histogram({name:D.InstrumentLoadTimeFromPageLoad,value:window.performance.now(),attributes:T({instrument:t}),unit:"ms"}))}function ss({instrument:t,measurement:e,result:n}){const r=n==="success"?Re.InstrumentSdkLoaded:Re.InstrumentSdkFailed;$({event:r,instrumentId:t,ttl:e,errorReason:n==="success"?void 0:n}),e!=null&&P.histogram({name:Re.InstrumentSdkLoaded,value:e,attributes:T({instrument:t,result:n}),unit:"ms"})}function ls({instrument:t,result:e,reason:n}){const r=e==="success"?Re.InstrumentSdkEligible:Re.InstrumentSdkNotEligible;$({event:r,instrumentId:t}),P.counter({name:Re.InstrumentSdkEligible,value:1,attributes:T({instrument:t,reason:n,result:e})})}function cs({instrument:t,result:e,reason:n}){P.counter({name:D.InstrumentLoadEligibility,value:1,attributes:T({instrument:t,result:e,reason:n})})}function ds(t){P.counter({name:D.ButtonRender,value:1,attributes:T({result:"success",instrument:t})})}function us(t){P.counter({name:D.ButtonRender,value:1,attributes:T({result:"failed",instrument:t})})}function hs({instrument:t,result:e,webPixelMetaData:n}){$({event:e==="success"?M.ClickSheetSuccess:M.ClickSheetFailed,instrumentId:t}),P.counter({name:D.SheetClicked,value:1,attributes:T({instrument:t,result:e})}),t===f.BuyWithPrime&&n&&ns(n)}function ps(t,e){$({event:"".concat(M.UpdateFailed,"-").concat(e),instrumentId:t}),P.counter({name:D.UpdateFailed,value:1,attributes:T({instrument:t,request:e})})}function ms({errorCode:t}){P.counter({name:D.PayPalTokenCreationError,value:1,attributes:T({errorCode:t})})}function ys(t){$({event:M.ClickSheetCancelled,instrumentId:t}),P.counter({name:D.SheetCancelled,value:1,attributes:T({instrument:t})})}function gs(t,e){$({event:M.SheetFailed,instrumentId:t,errorReason:e==null?void 0:e.message}),P.counter({name:D.SheetFailed,value:1,attributes:T({instrument:t})})}function fs(t){$({event:M.AuthorizationAttempt,instrumentId:t}),P.counter({name:D.AuthorizationAttempt,value:1,attributes:T({instrument:t})})}function _s({instrument:t,measurement:e,result:n}){$({event:M.AuthorizationComplete,eventSubtype:n,ttl:e,instrumentId:t}),e!=null&&P.histogram({name:D.AuthorizationComplete,value:e,attributes:T({instrument:t,result:n}),unit:"ms"})}function Es({instrument:t,reason:e}){P.counter({name:D.Decelerated,value:1,attributes:T({instrument:t,reason:e})}),y.flushTelemetry()}function As({reason:t}){P.counter({name:D.CartTokenMissing,value:1,attributes:{reason:t}})}function bs({success:t}){P.counter({name:D.RemovePersonalDataResult,value:1,attributes:T({success:t})})}function ws(){P.counter({name:D.WalletConfigDeveloperError,value:1})}function Ps(){P.counter({name:D.LegacyCartCookie,value:1})}function Ss(){window.setInterval(()=>{ra()},1e3)}function Is(t){return(t==null?void 0:t.name)===ft}function ra(){P.exportMetrics(),P.exportLogs()}function Cs(t){const{body:e,attributes:n}=t;P.log({body:e,attributes:{...Sr(),...n}})}function Ds({usedBackwardsCompatibility:t}){P.counter({name:D.StyleBackwardsCompatibility,value:1,attributes:{usedBackwardsCompatibility:t}})}function Rs({measurement:t,pageType:e,stylesWritten:n}){P.histogram({name:D.StyleBackwardsCompatibilityExecutionTime,value:t,attributes:T({pageType:e,stylesWritten:n}),unit:"ms"})}function Ts({rule:t,count:e,pageType:n}){P.counter({name:D.StyleBackwardsCompatibilityRules,value:e,attributes:T({rule:t,pageType:n})})}function Ns({retries:t}){P.counter({name:D.AmazonPayLoadRetries,value:1,attributes:{retries:t}})}function vs({instrument:t}){P.counter({name:D.DynamicTaxFailed,value:1,attributes:{instrument:t}}),y.log({body:"Dynamic tax failed",attributes:{instrument:t}})}function Ls({instrument:t}){P.counter({name:D.DynamicShippingFailed,value:1,attributes:{instrument:t}}),y.log({body:"Dynamic shipping failed",attributes:{instrument:t}})}function Os({instrument:t,measurement:e}){P.histogram({name:D.SheetLoaded,value:e,attributes:T({instrument:t}),unit:"ms"})}function ks({instrument:t,errorName:e}){P.counter({name:D.UnrecoverableCartError,value:1,attributes:T({instrument:t,errorName:e})}),y.log({body:"Unrecoverable error detected",attributes:{instrument:t,errorName:e}})}function Ms({instrument:t,error:e}){P.counter({name:D.PaymentCompletedAfterAbort,value:1,attributes:T({instrument:t,error:e})})}function xs(){P.counter({name:D.GooglePayNullCartOnAuthorize,value:1,attributes:T({instrument:f.GooglePay})})}function Fs({instrument:t,errorName:e,reason:n}){P.counter({name:D.WalletSessionAbortError,value:1,attributes:T({instrument:t,errorName:e,reason:n})}),y.log({body:"Wallet session abort error: ".concat(e),attributes:{instrument:t,reason:n}})}const y={initStarted:C(as),initCompleted:C(is),instrumentLoaded:C(os),instrumentLoadEligibility:C(cs),instrumentSDKLoaded:C(ss),instrumentSDKEligible:C(ls),renderSucceeded:C(ds),renderFailed:C(us),sheetClicked:C(hs),sheetCancelled:C(ys),sheetFailed:C(gs),updateFailed:C(ps),authorizationAttempt:C(fs),authorizationComplete:C(_s),startExporter:C(Ss),decelerated:C(Es),cartTokenMissing:C(As),removePersonalDataResult:C(bs),walletConfigDeveloperError:C(ws),legacyCartCookie:C(Ps),flushTelemetry:C(ra),styleBackwardsCompatibility:C(Ds),styleBackwardsCompatibilityExecutionTime:C(Rs),styleBackwardsCompatibilityRules:C(Ts),amazonPaySDKLoadRetries:C(Ns),dynamicTaxFailed:C(vs),dynamicShippingFailed:C(Ls),sheetLoaded:C(Os),unrecoverableCartError:C(ks),paymentCompletedAfterAbort:C(Ms),googlePayNullCartOnAuthorize:C(xs),log:C(Cs,{logErrors:!1}),paypalTokenCreationError:C(ms),walletSessionAbortError:C(Fs)};function C(t,{logErrors:e=!0}={}){return(...n)=>{try{t(...n)}catch(r){e&&y.log({body:"Error calling telemetry function",attributes:{error:"".concat(r)}})}}}function Us(t){const e=n=>{n.persisted&&(t(),window.removeEventListener("pageshow",e))};window.addEventListener("pageshow",e)}var m=(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(It),t.RedirectToCheckoutRequired="REDIRECT_TO_CHECKOUT_REQUIRED",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.DeliveryCityInvalid="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.MerchandiseIdInvalid="INVALID: input.lines.0.merchandiseId",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.InvalidPaymentPayment="INVALID_PAYMENT: payment",t.NewTaxMustBeAccepted="TAX_NEW_TAX_MUST_BE_ACCEPTED",t.MerchandiseExpectedPriceMismatch="MERCHANDISE_EXPECTED_PRICE_MISMATCH",t.InvalidPaymentApplePayBillingAddress="INVALID_PAYMENT: payment.walletPaymentMethod.applePayWalletContent.billingAddress",t.InvalidPaymentApplePayBillingAddressRequired="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress",t.InvalidPaymentGooglePayBillingAddress="INVALID_PAYMENT: payment.walletPaymentMethod.googlePayWalletContent.billingAddress",t.InvalidPaymentBillingAddress="INVALID_PAYMENT: payment.freePaymentMethod.billingAddress",t.UnspecifiedBillingAddressError="UNSPECIFIED_ADDRESS_ERROR: payment.walletPaymentMethod.applePayWalletContent.billingAddress",t.ApplePayBillingZipInvalidForProvince="INVALID_ZIP_CODE_FOR_PROVINCE: payment.walletPaymentMethod.applePayWalletContent.billingAddress.zip",t.ApplePayBillingZipInvalidForCountry="INVALID_ZIP_CODE_FOR_COUNTRY: payment.walletPaymentMethod.applePayWalletContent.billingAddress.zip",t.GooglePayBillingZipInvalidForProvince="INVALID_ZIP_CODE_FOR_PROVINCE: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.zip",t.GooglePayBillingZipInvalidForCountry="INVALID_ZIP_CODE_FOR_COUNTRY: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.zip",t.FreePaymentBillingZipInvalidForProvince="INVALID_ZIP_CODE_FOR_PROVINCE: payment.freePaymentMethod.billingAddress.zip",t.FreePaymentBillingZipInvalidForCountry="INVALID_ZIP_CODE_FOR_COUNTRY: payment.freePaymentMethod.billingAddress.zip",t.FreePaymentBillingFirstNameRequired="ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.firstName",t.FreePaymentBillingLastNameRequired="ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.lastName",t.FreePaymentBillingAddress1Required="ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.address1",t.FreePaymentBillingAddress2Required="ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.address2",t.FreePaymentBillingCityRequired="ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.city",t.FreePaymentBillingPhoneRequired="ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.phone",t.FreePaymentBillingZipRequired="ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.zip",t.FreePaymentBillingProvinceRequired="ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.province",t.FreePaymentBillingFirstNameDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.firstName",t.FreePaymentBillingLastNameDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.lastName",t.FreePaymentBillingCompanyDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.company",t.FreePaymentBillingAddress1DoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.address1",t.FreePaymentBillingAddress2DoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.address2",t.FreePaymentBillingCityDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.city",t.FreePaymentBillingPhoneDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.phone",t.FreePaymentBillingZipDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.zip",t.ApplePayBillingFirstNameRequired="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.firstName",t.ApplePayBillingLastNameRequired="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.lastName",t.ApplePayBillingAddress1Required="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.address1",t.ApplePayBillingAddress2Required="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.address2",t.ApplePayBillingCityRequired="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.city",t.ApplePayBillingPhoneRequired="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.phone",t.ApplePayBillingZipRequired="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.zip",t.ApplePayBillingProvinceRequired="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.province",t.ApplePayBillingFirstNameContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.applePayWalletContent.billingAddress.firstName",t.ApplePayBillingLastNameContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.applePayWalletContent.billingAddress.lastName",t.ApplePayBillingCompanyContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.applePayWalletContent.billingAddress.company",t.ApplePayBillingAddress1ContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.applePayWalletContent.billingAddress.address1",t.ApplePayBillingAddress2ContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.applePayWalletContent.billingAddress.address2",t.ApplePayBillingCityContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.applePayWalletContent.billingAddress.city",t.ApplePayBillingPhoneContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.applePayWalletContent.billingAddress.phone",t.ApplePayBillingZipContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.applePayWalletContent.billingAddress.zip",t.ApplePayBillingFirstNameContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: payment.walletPaymentMethod.applePayWalletContent.billingAddress.firstName",t.ApplePayBillingLastNameContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: payment.walletPaymentMethod.applePayWalletContent.billingAddress.lastName",t.ApplePayBillingCompanyContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: payment.walletPaymentMethod.applePayWalletContent.billingAddress.company",t.ApplePayBillingAddress1ContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: payment.walletPaymentMethod.applePayWalletContent.billingAddress.address1",t.ApplePayBillingAddress2ContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: payment.walletPaymentMethod.applePayWalletContent.billingAddress.address2",t.ApplePayBillingCityContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: payment.walletPaymentMethod.applePayWalletContent.billingAddress.city",t.ApplePayBillingFirstNameDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.applePayWalletContent.billingAddress.firstName",t.ApplePayBillingLastNameDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.applePayWalletContent.billingAddress.lastName",t.ApplePayBillingCompanyDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.applePayWalletContent.billingAddress.company",t.ApplePayBillingAddress1DoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.applePayWalletContent.billingAddress.address1",t.ApplePayBillingAddress2DoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.applePayWalletContent.billingAddress.address2",t.ApplePayBillingCityDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.applePayWalletContent.billingAddress.city",t.ApplePayBillingPhoneDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.applePayWalletContent.billingAddress.phone",t.ApplePayBillingZipDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.applePayWalletContent.billingAddress.zip",t.GooglePayBillingFirstNameRequired="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.firstName",t.GooglePayBillingLastNameRequired="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.lastName",t.GooglePayBillingAddress1Required="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.address1",t.GooglePayBillingAddress2Required="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.address2",t.GooglePayBillingCityRequired="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.city",t.GooglePayBillingPhoneRequired="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.phone",t.GooglePayBillingZipRequired="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.zip",t.GooglePayBillingProvinceRequired="ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.province",t.GooglePayBillingFirstNameContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.firstName",t.GooglePayBillingLastNameContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.lastName",t.GooglePayBillingCompanyContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.company",t.GooglePayBillingAddress1ContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.address1",t.GooglePayBillingAddress2ContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.address2",t.GooglePayBillingCityContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.city",t.GooglePayBillingPhoneContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.phone",t.GooglePayBillingZipContainsEmojis="ADDRESS_FIELD_CONTAINS_EMOJIS: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.zip",t.GooglePayBillingFirstNameContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.firstName",t.GooglePayBillingLastNameContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.lastName",t.GooglePayBillingCompanyContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.company",t.GooglePayBillingAddress1ContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.address1",t.GooglePayBillingAddress2ContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.address2",t.GooglePayBillingCityContainsHtmlTags="ADDRESS_FIELD_CONTAINS_HTML_TAGS: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.city",t.GooglePayBillingFirstNameDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.firstName",t.GooglePayBillingLastNameDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.lastName",t.GooglePayBillingCompanyDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.company",t.GooglePayBillingAddress1DoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.address1",t.GooglePayBillingAddress2DoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.address2",t.GooglePayBillingCityDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.city",t.GooglePayBillingPhoneDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.phone",t.GooglePayBillingZipDoesNotMatchExpectedPattern="ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.zip",t.UnsupportedGooglePayPaymentMethod="PAYMENT_METHOD_NOT_SUPPORTED: payment.walletPaymentMethod.googlePayWalletContent",t.UnsupportedApplePayPaymentMethod="PAYMENT_METHOD_NOT_SUPPORTED: payment.walletPaymentMethod.applePayWalletContent",t.PaymentMethodNotApplicable="PAYMENT_METHOD_NOT_APPLICABLE: payment",t.InvalidPaymentDeferredPaymentRequired="INVALID_PAYMENT_DEFERRED_PAYMENT_REQUIRED: payment",t.PaymentsMethodRequired="PAYMENTS_METHOD_REQUIRED",t.PaymentsMethodUnavailable="PAYMENTS_METHOD_UNAVAILABLE",t.SellingPlanNotApplicable="SELLING_PLAN_NOT_APPLICABLE: input.lines.0.sellingPlanId",t.VariantRequiresSellingPlan="VARIANT_REQUIRES_SELLING_PLAN: input.lines.0",t.PaymentsCountryInvalid="PAYMENTS_COUNTRY_INVALID",t.LocalizationExtensionFieldError="LOCALIZATION_EXTENSION_FIELD_ERROR",t))(m||{});const Bs=["DELIVERY_FIRST_NAME_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName"],Hs=["DELIVERY_FIRST_NAME_INVALID","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.firstName"],$s=["DELIVERY_LAST_NAME_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName"],Gs=["DELIVERY_LAST_NAME_INVALID","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.lastName"],zs=["DELIVERY_ADDRESS1_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address1"],Vs=["DELIVERY_ADDRESS2_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2"],Ws=["DELIVERY_CITY_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city"],qs=["DELIVERY_POSTAL_CODE_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip"],na=["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"],Ys=["DELIVERY_PHONE_NUMBER_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.phone"],js=["INVALID: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.country","Variable $buyerIdentity of type CartBuyerIdentityInput! was provided invalid value for countryCode"],Qs=["DELIVERY_PHONE_NUMBER_INVALID","INVALID: buyerIdentity.phone","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.phone"],aa=["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"],ia=["INVALID_PAYMENT: amount","INVALID_PAYMENT: payment.amount","INVALID_PAYMENT: payment"],Tr=["TAX_NEW_TAX_MUST_BE_ACCEPTED","PAYMENTS_UNACCEPTABLE_PAYMENT_AMOUNT"],Ks=["DELIVERY_DELIVERY_LINE_DETAIL_CHANGED","DELIVERY_LOCAL_PICKUP_DELIVERY_LINE_DETAIL_CHANGED"],Xs=["INVALID_PAYMENT: payment.freePaymentMethod.billingAddress","INVALID_PAYMENT: payment.walletPaymentMethod.applePayWalletContent.billingAddress","ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress","UNSPECIFIED_ADDRESS_ERROR: payment.walletPaymentMethod.applePayWalletContent.billingAddress"],Js=["INVALID_ZIP_CODE_FOR_PROVINCE: payment.walletPaymentMethod.applePayWalletContent.billingAddress.zip","INVALID_ZIP_CODE_FOR_COUNTRY: payment.walletPaymentMethod.applePayWalletContent.billingAddress.zip","INVALID_ZIP_CODE_FOR_PROVINCE: payment.freePaymentMethod.billingAddress.zip","INVALID_ZIP_CODE_FOR_COUNTRY: payment.freePaymentMethod.billingAddress.zip"],Zs=["INVALID_ZIP_CODE_FOR_PROVINCE: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.zip","INVALID_ZIP_CODE_FOR_COUNTRY: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.zip","INVALID_ZIP_CODE_FOR_PROVINCE: payment.freePaymentMethod.billingAddress.zip","INVALID_ZIP_CODE_FOR_COUNTRY: payment.freePaymentMethod.billingAddress.zip"],oa=["MERCHANDISE_NOT_APPLICABLE","MERCHANDISE_PRODUCT_VARIANT_NOT_FOUND","MERCHANDISE_NOT_FOUND","MERCHANDISE_PRODUCT_NOT_PUBLISHED"],sa=["MERCHANDISE_NOT_ENOUGH_STOCK","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_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"],el=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.firstName","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.firstName"],tl=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.lastName","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.lastName"],rl=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.address1","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.address1"],nl=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.address2","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.address2"],al=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.city","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.city"],il=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.phone","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.phone"],ol=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.zip","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.zip"],sl=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.applePayWalletContent.billingAddress.province","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.province"],ll=["ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.applePayWalletContent.billingAddress.firstName","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.firstName"],cl=["ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.applePayWalletContent.billingAddress.lastName","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.lastName"],dl=["ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.applePayWalletContent.billingAddress.address1","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.address1"],ul=["ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.applePayWalletContent.billingAddress.address2","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.address2"],hl=["ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.applePayWalletContent.billingAddress.city","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.city"],pl=["ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.applePayWalletContent.billingAddress.phone","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.phone"],ml=["ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.applePayWalletContent.billingAddress.zip","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.zip"],yl=[...ia,"REDIRECT_TO_CHECKOUT_REQUIRED",...oa,"PAYMENTS_COUNTRY_INVALID"],gl=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.firstName","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.firstName"],fl=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.lastName","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.lastName"],_l=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.address1","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.address1"],El=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.address2","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.address2"],Al=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.city","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.city"],bl=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.phone","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.phone"],wl=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.zip","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.zip"],Pl=["ADDRESS_FIELD_IS_REQUIRED: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.province","ADDRESS_FIELD_IS_REQUIRED: payment.freePaymentMethod.billingAddress.province"],Sl=["ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.firstName","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.firstName"],Il=["ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.lastName","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.lastName"],Cl=["ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.address1","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.address1"],Dl=["ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.address2","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.address2"],Rl=["ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.city","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.city"],Tl=["ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.phone","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.phone"],Nl=["ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.walletPaymentMethod.googlePayWalletContent.billingAddress.zip","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: payment.freePaymentMethod.billingAddress.zip"],vl=["DELIVERY_POSTAL_CODE_INVALID","DELIVERY_INVALID_POSTAL_CODE_FOR_ZONE","DELIVERY_INVALID_POSTAL_CODE_FOR_COUNTRY","INVALID_ZIP_CODE_FOR_COUNTRY: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip"],Ll=["BUYER_IDENTITY_EMAIL_DOMAIN_IS_INVALID","BUYER_IDENTITY_EMAIL_DOES_NOT_MATCH_EXPECTED_PATTERN","INVALID: buyerIdentity.email"],Ol=["DELIVERY_PHONE_NUMBER_INVALID","INVALID: buyerIdentity.phone","ADDRESS_FIELD_DOES_NOT_MATCH_EXPECTED_PATTERN: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.phone"],kl=["Variable $buyerIdentity of type CartBuyerIdentityInput! was provided invalid value for countryCode","INVALID: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.country"],Ml=["DELIVERY_ADDRESS2_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.address2"],xl=["ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.city","DELIVERY_CITY_REQUIRED"],Fl=["DELIVERY_POSTAL_CODE_REQUIRED","ADDRESS_FIELD_IS_REQUIRED: buyerIdentity.deliveryAddressPreferences.0.deliveryAddress.zip"],Ul=["PAYMENTS_METHOD_REQUIRED","PAYMENTS_METHOD_UNAVAILABLE"],Bl=["MERCHANDISE_EXPECTED_PRICE_MISMATCH","DELIVERY_DELIVERY_LINE_DETAIL_CHANGED","DELIVERY_LOCAL_PICKUP_DELIVERY_LINE_DETAIL_CHANGED",...ia,...Ul,m.CustomValidation,...oa];class Hl extends ne{constructor(e){e instanceof Error?(super("[".concat(e.name,"] ").concat(e.message),{cause:e.cause,groupingHash:e instanceof ne?e.groupingHash:void 0}),this.stack=e.stack):super("[HandleCreateCartError] ".concat(String(e))),this.name="HandleCreateCartError"}}async function _e({element:t,instrumentName:e,dataSource:n}){try{const r=await n.getInitialCart(e),{cart:a,errors:i,abortReason:o,decelerationReason:s}=r;Us(()=>{t&&(t.disabled=!1)});const l=Cr(i),u=Gl(i),d=u||l;if(u&&y.unrecoverableCartError({instrument:e,errorName:u}),!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{cart:a,customValidationError:l,decelerationReason:s,abortReason:o,...u?{unrecoverableError:u}:{}}}catch(r){throw new Hl(r)}finally{t.disabled=!1}}const $l={[m.InvalidQuantity]:W.InvalidQuantity,[m.VariantRequiresSellingPlan]:W.VariantRequiresSellingPlan,[m.SellingPlanNotApplicable]:W.SellingPlanNotApplicable,[m.MerchandiseIdInvalid]:W.MerchandiseIdInvalid};function Gl(t){if(t.length!==1)return null;const[e]=t;return typeof e=="object"?null:$l[e]||null}const zl={force_shop_pay_product:"direct_checkout_product",force_shop_pay_cart:"direct_checkout_cart"};function ge(t,e="no_redirect_for_checkout"){y.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=zl[e];r&&n.searchParams.set("redirect_source",r);break}}window.location.assign(n.toString())}const Vl={currency_changed:le.CURRENCY_CHANGE,captcha_required:le.CAPTCHA_REQUIRED,not_enough_stock:le.NOT_ENOUGH_STOCK,cart_not_ready:le.CART_NOT_READY,dynamic_tax:le.DYNAMIC_TAX,payment_method_not_applicable:le.PAYMENT_METHOD_NOT_APPLICABLE,invalid_payment_deferred_payment_required:le.INVALID_PAYMENT_DEFERRED_PAYMENT_REQUIRED,localization_extension_field_error:le.LOCALIZATION_EXTENSION_FIELD_ERROR,cart_throttled:null};function en({cart:t,warnings:e}){const n=t&&t.lineItems.length>0&&t.lineItems.every(r=>r.quantity===0);if(e!=null&&e.includes("MERCHANDISE_OUT_OF_STOCK")&&n)return"out_of_stock"}function Zt({warnings:t,cart:e,cartStatus:n,errors:r}){if(r!=null&&r.includes(m.PaymentMethodNotApplicable))return"payment_method_not_applicable";if(r!=null&&r.includes(m.InvalidPaymentDeferredPaymentRequired))return"invalid_payment_deferred_payment_required";if(n==="CartStatusNotReady")return"cart_not_ready";if(n==="CartThrottled")return"cart_throttled";if(!t||t.length===0)return;if(t.includes("MERCHANDISE_NOT_ENOUGH_STOCK"))return"not_enough_stock";const a=e==null?void 0:e.lineItems.some(i=>i.quantity>0);if(t.includes("MERCHANDISE_OUT_OF_STOCK")&&a)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 U({checkoutUrl:t,instrumentName:e,reason:n}){if(!t)throw new Error("Invalid Checkout URL");const r=new URL(t),a=Vl[n];a&&r.searchParams.set(a,"true"),y.decelerated({instrument:e,reason:n}),ge(r.toString())}class Wl extends bt{constructor(){super(),c(this,"name",f.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]=de(),[this.dataSource,this.setDataSource]=de(),[this.classNames,this.setClassNames]=de()}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:u,abortReason:d}=await _e({element:this,instrumentName:f.MoreOptions,dataSource:i});if(u){y.sheetClicked({instrument:this.name,result:"failed"}),Me(a,u);return}if(l){ke(a,l.message);return}if(d==="out_of_stock"){y.sheetClicked({instrument:this.name,result:"failed"}),ye(a);return}if(o){U({checkoutUrl:(n=s==null?void 0:s.checkoutUrl)!=null?n:"",instrumentName:f.MoreOptions,reason:o});return}const h=this.recommendedInstrument===f.ShopPay?"skip_shop_pay":"allow_redirect";y.sheetClicked({instrument:f.MoreOptions,result:"success"}),ge((r=s==null?void 0:s.checkoutUrl)!=null?r:"",h)}catch(o){y.sheetClicked({instrument:f.MoreOptions,result:"failed"}),_.notify(o),At(a)}}async render(){const e=await this.i18n,n=await this.classNames;this.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=yo,this.appendChild(r)}setAccessibilityAttributes(){this.anchor&&(this.disabled?(this.anchor.removeAttribute("href"),this.anchor.role="link"):(this.anchor.removeAttribute("role"),this.anchor.href="#"))}}var N=(t=>(t.ButtonDisplay="buttonDisplay",t.LoadInstrument="loadInstrument",t.LoadSdk="loadSDK",t.AuthorizationLatency="authorizationLatency",t.SheetLoad="sheetLoad",t.StyleExtract="styleExtract",t))(N||{});function la(){var t,e;return!!((t=window.performance)!=null&&t.mark)&&!!((e=window.performance)!=null&&e.measure)}function Ke(t,e){return Je(t,e),()=>j(t,e)}function Je(t,e){la()&&window.performance.mark("".concat(t,"-").concat(e,"-start"))}function j(t,e){var n,r;if(la())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 vr(t,e,n){if(it!=null&&it.length){const r=it.join(",");t.querySelectorAll(r).forEach(a=>{n===null?a.removeAttribute(e):a.setAttribute(e,n)})}}function ql(t,e){try{const n=JSON.parse(t!=null?t:"[]");if(!(n instanceof Array))throw new X({code:"invalid-wallet-configs",message:"[".concat(e,"] invalid walletConfigs found")});return n}catch(n){throw new X({code:"invalid-wallet-configs",message:"[".concat(e,"] Error while parsing walletConfigs JSON: ").concat(n)},{cause:n})}}function Yl(t,e){try{return t?JSON.parse(t):null}catch(n){throw new X({code:"invalid-wallet-config",message:"[".concat(e,"] Error while parsing walletConfig JSON: ").concat(n)},{cause:n})}}function Rt(t,e){var n;const r=e==null?void 0:e.getLoadEligibility(t);return y.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 jl(t,e){return e.filter(n=>Rt(t,n))}async function ca({walletInstrument:t,instanceNumber:e}){const n=t.getInstrumentName(),r=Ke(N.LoadSdk,"".concat(n,":").concat(e));try{await t.loadWalletSDK(),y.instrumentSDKLoaded({instrument:n,measurement:r(),result:"success"})}catch(i){return _.leaveBreadcrumb("Failed to load wallet SDK",{instrumentName:n,instanceNumber:e},"error"),_.notify(i),y.instrumentSDKLoaded({instrument:n,measurement:r(),result:"failed"}),null}let a;try{a=t.getPartnerSDKEligibility()}catch(i){_.notify(i),a={eligible:!1,reason:"uncaught exception"}}return a.eligible?(y.instrumentSDKEligible({instrument:n,result:"success"}),t):(y.instrumentSDKEligible({instrument:n,reason:a.reason,result:"failed"}),null)}function ve(t,...e){try{const n=window[t];if(typeof n=="function")return new n(...e)}catch(n){}return null}const da="d6d12da0",Ql="2d75a54c";var We;class Lr extends bt{constructor(){super(...arguments),c(this,"apiClient"),c(this,"i18n"),c(this,"policy"),c(this,"isFetchingPolicy",!1),c(this,"intersectionObserver",null),x(this,We),c(this,"handleIntersection",(e,n)=>{e.some(r=>r.isIntersecting)&&(this.apiClient&&this.apiClient.setVisible(),n.disconnect(),$({event:M.FirstVisible}))})}connectedCallback(){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 publicAssetsEnabled(){return this.isFlagEnabled(Ql)}get variantParams(){var e;try{return JSON.parse((e=this.getAttribute("variant-params"))!=null?e:"[]")}catch(n){throw new X({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&&vr(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 b(this,We)==null&&L(this,We,this.getEnabledFlags()),b(this,We).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;const a=this.fetchSubscriptionPolicy(n).then(i=>(this.policy=i,i)).catch(i=>(_.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){Dr(n.translate("subscriptions.cancellation_policy"),e,n.translate("subscriptions.policy_not_found"))}mountIntersectionObserver(){this.intersectionObserver=ve("IntersectionObserver",this.handleIntersection),this.intersectionObserver?this.intersectionObserver.observe(this):$({event:M.FirstVisibleNotAvailable})}}We=new WeakMap;function Or(t){var e,n;Ki({shopId:(e=t.shopId)!=null?e:Gn,cartId:(n=t.cartId)!=null?n:void 0,debug:t.debug,pageType:t.pageType})}function ua({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=Array.from(n).concat(Array.from(r)),i={};return a.forEach(o=>{const s=Kl(o),l=Xl(o);s&&typeof l<"u"&&l.trim()!==""&&(i[s]=l)}),Object.entries(i!=null?i:{}).map(([o,s])=>({key:o,value:s}))}function zt({page:t,element:e}){const n=t==="product"?'[data-shopify="payment-button"]':'[data-shopify="dynamic-checkout-cart"]',r=tn(e,n)||document.querySelector(n);return tn(r,"form")}const nt=Element.prototype;function tn(t,e){if(nt.matches=nt.matches||nt.webkitMatchesSelector||nt.msMatchesSelector||nt.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 Kl(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 Xl(t){if(!(["radio","checkbox"].includes(t.type)&&!t.checked))try{return t.value===""||typeof t.value>"u"?void 0:t.value}catch(e){return}}function kr(t){const e=zt({page:"product",element:t});return ha(e)}function ha(t){var e;const n=t==null?void 0:t.elements;if(!n)return null;const r=Tt(n,"id");if(!r||isNaN(Number(r))||Number(r)<=0)return null;const a=Number((e=Tt(n,"quantity"))!=null?e:"1"),i="gid://shopify/ProductVariant/".concat(r),o=Zl(n),s=ua({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?!!Tt(e,"selling_plan"):!1}function Tt(t,e){var n,r;let a=t.namedItem(e);if(a instanceof HTMLSelectElement)try{return(n=a.value)!=null?n:null}catch(i){return null}if(a&&"length"in a&&(a=a.item(0)),a instanceof HTMLInputElement||a instanceof HTMLSelectElement)try{return(r=a.value)!=null?r:null}catch(i){return null}return null}function Zl(t){const e=Tt(t,"selling_plan");if(!(!e||e==="undefined"))return"gid://shopify/SellingPlan/".concat(e)}class Mr{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=ha(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(){if(this.addToCartForm=zt({page:"product",element:this.element}),this.addToCartForm){const e=this.addToCartForm.querySelectorAll("[type=submit]");e instanceof NodeList&&(this.addToCartButtons=[...e])}}}function ec(t,e,n){try{const r=JSON.parse(t!=null?t:"{}"),a=JSON.parse(e!=null?e:JSON.stringify(zn));if(r===null||Object.keys(r).length===0){if(!(a instanceof Object))throw y.walletConfigDeveloperError(),new X({code:"invalid-fallback-wallet-config",message:"[".concat(n,"] Invalid fallback wallet configs JSON")});return{recommendedWallet:null,fallbackWallet:a}}return{recommendedWallet:r,fallbackWallet:a}}catch(r){throw y.walletConfigDeveloperError(),new X({code:"invalid-recommended-fallback-config",message:"[".concat(n,"] Error while parsing recommended/fallback JSON: ").concat(r)},{cause:r})}}const tc=".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 )}",rc='.accelerated-checkout-button{height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 44px),55px);min-height:clamp(25px,var(--shopify-accelerated-checkout-button-block-size, 44px),55px);border-radius:var(--shopify-accelerated-checkout-button-border-radius, 0px);box-shadow:var(--shopify-accelerated-checkout-button-box-shadow)}:host([page-type="cart_page"]) .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)}:host([page-type="product"]) .accelerated-checkout-button{min-width:150px}@media (forced-colors: active){.accelerated-checkout-button{border:1px solid transparent!important}:host([page-type="cart_page"]) .accelerated-checkout-button{border:1px solid transparent!important}}',nc=70;class lt{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.opacity0&&a.opacity>0?(r=new lt(0,0,0,0),r.blendWith(a,n)):a.opacity>0?r=a:r=n,n=r,a=e.shift();return r}const cr=new lt(255,255,255,1);function ic(t){const e=[];let n=t;for(;n.parentElement;){n=n.parentElement;const r=window.getComputedStyle(n).backgroundColor,a=oc(r);if(r&&e.push(a),a.opacity===1)break}try{return ac(e.reverse())}catch(r){return _.notify(new pa("[BackgroundDetection] Failed to blend colors for element ".concat(t.outerHTML),{cause:r})),cr}}function oc(t){if(!t)return cr;try{const e=t.split("(")[1].split(")")[0].replace(" ","").split(",");return new lt(Number(e[0]),Number(e[1]),Number(e[2]),typeof e[3]>"u"?1:Number(e[3]))}catch(e){_.notify(new pa("[BackgroundDetection] Failed to convert rgbString to array ".concat(t),{cause:e}))}return cr}class pa extends Error{constructor(){super(...arguments),c(this,"name","ColorProcessingError")}}var ue;class Ee extends bt{constructor(){super(),c(this,"name",f.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"),x(this,ue),this.onRendered=()=>{},[this.i18n,this.setI18n]=de(),[this.dataSource,this.setDataSource]=de(),[this.apiClient,this.setApiClient]=de(),[this.classNames,this.setClassNames]=de(),[this.containerInstanceNumber,this.setContainerInstanceNumber]=de()}async cleanupOnFailure(e,n){var r;try{await e()}catch(a){_.notify(new sc("An error occurred requiring cleanup when attempting to render the ".concat(n," instrument: ").concat(a),{cause:a}));const i=await this.containerInstanceNumber;y.instrumentLoaded({instrumentOrComponentName:n,result:"failed",measurement:j(N.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")||I.Unknown}get buttonTheme(){return ic(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 X({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=[rc,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}))}getOrCreateShadowRoot(){return b(this,ue)||L(this,ue,this.attachShadow({mode:"closed"})),b(this,ue)}clearShadowRoot(){b(this,ue)&&(b(this,ue).innerHTML="")}}ue=new WeakMap;class sc extends Error{constructor(){super(...arguments),c(this,"name","CleanupOnFailureError")}}class lc extends Ee{constructor(){super(...arguments),c(this,"name",f.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,abortReason:u}=await _e({element:this,instrumentName:this.name,dataSource:a});if(l){y.sheetClicked({instrument:this.name,result:"failed"}),Me(r,l);return}if(u==="out_of_stock"){y.sheetClicked({instrument:this.name,result:"failed"}),ye(r);return}if(y.sheetClicked({instrument:this.name,result:"success"}),s){ke(r,s.message);return}if(i){U({checkoutUrl:(e=o==null?void 0:o.checkoutUrl)!=null?e:"",instrumentName:this.name,reason:i});return}ge((n=o==null?void 0:o.checkoutUrl)!=null?n:"","allow_redirect")}catch(i){_.notify(i),y.sheetClicked({instrument:this.name,result:"failed"}),At(r)}}async render(){var e;this.button||(this.button=Ht());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)}}const cc=1e3;function dc(){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}function uc(t){return Promise.race([t,new Promise((e,n)=>setTimeout(()=>n(new Error("timed out")),cc))])}class Ae{constructor(e){c(this,"publicAssetsEnabled",!1),c(this,"walletParams"),this.walletParams=e.wallet_params}static walletName(){throw new Error("Must define walletName for WalletInstrument subclass")}async createWebComponent({walletContainer:e,dataSource:n,i18n:r,apiClient:a,containerInstanceNumber:i,classNames:o="",callToAction:s,pageType:l=I.ProductPage,slot:u="button",onRendered:d=()=>{}}){var h,p,g;const A=this.getWebComponentName();if(!ae(A,this.getWebComponentClass(),{isChildCustomElement:!0}))throw new te("Failed to define custom element ".concat(A,", aborting execution"));try{await uc(customElements.whenDefined(A))}catch(S){throw new te("Timeout waiting for custom element ".concat(A," to be defined"))}const E=document.createElement(A);if(!(E instanceof Ee))throw new te("Failed to create web component instance for ".concat(A,", element is not a WalletButtonElement"));const w={"access-token":(h=e.accessToken)!=null?h:"","buyer-country":(p=e.buyerCountry)!=null?p:"","buyer-currency":e.buyerCurrency,"wallet-params":JSON.stringify((g=this.walletParams)!=null?g:{}),"page-type":l,slot:u};try{e.disabled&&E.setAttribute("disabled",""),$t(E,w),e.isShippingRequired&&E.setAttribute("requires-shipping",""),e.hasSellingPlan&&E.setAttribute("has-selling-plan",""),e.pciEnabled&&E.setAttribute("pci-enabled","")}catch(S){const G=S;throw G.message.includes("setAttribute is not a function")&&dc()?new te(G.message):G}if(s&&E.setAttribute("call-to-action",""),typeof E.setDataSource!="function")throw new te("Custom element ".concat(A," is not properly upgraded, aborting execution"));return E.setDataSource(n),E.setApiClient(a),E.setI18n(r),E.setClassNames(o),E.setContainerInstanceNumber(i),E.onRendered=d,E}loadWalletSDK(){return Promise.resolve()}getLoadEligibility(e){return{eligible:!0}}getPartnerSDKEligibility(){return{eligible:!0}}}class hc extends Ae{static walletName(){return"buy_it_now"}getWebComponentName(){return"shopify-buy-it-now-button"}getInstrumentName(){return f.BuyItNow}getWebComponentClass(){return lc}}const pc="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}",mc='::slotted(div){height:100%}:host([page-type="cart_page"]) ::slotted(div){width:100%;min-width:100px;display:flex;justify-content:center}:host([page-type="cart_page"]) .accelerated-checkout-button{overflow:hidden;display:flex;justify-content:center}';async function Ge(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 y.updateFailed(r,"updateBuyerIdentity"),i}}async function xr({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 u={freePaymentMethod:{billingAddress:r}};return await a.updateCartPayment(t,{amount:{amount:e.amount,currencyCode:e.currencyCode},...Number(e.amount)<=0&&!l&&!s?u:n},i,o)}catch(u){throw y.updateFailed(i,"updatePayment"),u}}function ma(t){return window[ya(t)]}function ya(t){return"paypal-".concat(t.replace(/[^a-zA-Z0-9]/g,""))}const yc="RESTRICTED_WALLET_ACCOUNT",gc="GENERIC_ERROR",fc="NO_PENDING_TASK",_c="WALLET_SERVICE_DISABLED",Ec="FAILED_TO_ENQUEUE_BACKGROUND_JOB",Ac="REQUEST_MISSING_VALID_MERCHANDISE_SOURCE",bc="THROTTLE_EXCEEDED",wc="INTERNAL_SERVER_ERROR",Pc=[gc,fc,_c,Ec,Ac,bc,wc];function rn(t){return t==null?void 0:t.map(e=>{var n,r;return{code:(n=e.extensions)==null?void 0:n.code,isLoggable:Pc.includes((r=e.extensions)==null?void 0:r.code)}}).find(({code:e,isLoggable:n})=>e===yc||n)}function Nt(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 er=25,nn=55,Sc=["cart_not_ready","cart_throttled","payment_method_not_applicable","invalid_payment_deferred_payment_required"],tr="PAYPAL_CALLBACK_HANDLED_ERROR";var he;class Ic extends Ee{constructor(){super(...arguments),c(this,"name",f.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),x(this,he,!1)}connectedCallback(){this.resizeObserver=ve("ResizeObserver",()=>this.onResize()),this.cleanupOnFailure(this.render.bind(this),this.name)}async disconnectedCallback(){var e;this.innerHTML="",this.clearShadowRoot(),await this.teardownPayPalButton(),(e=this.resizeObserver)==null||e.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=Nt(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=this.getOrCreateShadowRoot(),r=document.createElement("div");r.className=Oe.BUTTON;const a=document.createElement("style");a.innerHTML=pc,this.appendChild(a),await this.initializeShadowStyles(n,mc),n.appendChild(r),this.container=r,this.renderFromPayPalSDK(),(e=this.resizeObserver)==null||e.observe(this.container)}getHeight(){const e=vt(this.container);return e?e>=er&&e<=nn?e:ethis.createToken({apiClientPromise:this.apiClient,requiresBillingAgreement:a});let o,s;a?s=i:o=i;const l=Nt(this.container),u=this.getHeight();this.prevHeight=u;const d={color:"gold",label:this.isCTA?"pay":"paypal",disableMaxWidth:!0,height:u,shape:"sharp"};l&&l>0&&(d.borderRadius=l,this.prevBorderRadius=l);const h=await this.i18n;this.sdkButtonsComponent=(n=(e=ma(this.walletParams.sdkUrl))==null?void 0:e.Buttons)==null?void 0:n.call(e,{fundingSource:"paypal",style:d,createOrder:o,createBillingAgreement:s,onApprove:async g=>{await this.onApprove(g)},onCancel:()=>{this.cancelPaymentSheet("Payment sheet cancelled")},onClick:this.onClick.bind(this),onError:g=>{this.onError(g,h)}});let p=!1;try{await((r=this.sdkButtonsComponent)==null?void 0:r.render(this.container)),p=!0}catch(g){y.renderFailed(this.name),y.log({body:"PayPal Button not able to render into container.",attributes:{pageType:this.pageType,error:g==null?void 0:g.toString()}})}finally{this.rendering=!1}p&&this.onRendered()}cancelPaymentSheet(e){var n;L(this,he,!0),y.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();L(this,he,!1),this.abortController=ve("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[u,d]=await Promise.all([this.dataSource,this.i18n]);try{const{decelerationReason:h,cart:p,customValidationError:g,unrecoverableError:A,abortReason:E}=await _e({element:this,instrumentName:this.name,dataSource:u});if(A)return y.sheetClicked({instrument:this.name,result:"failed"}),Me(d,A),n.reject();if(E==="out_of_stock")return y.sheetClicked({instrument:this.name,result:"failed"}),ye(d),n.reject();if(g)return ke(d,g.message),n.reject();const{hasManagedSellingPlanState:w}=this.walletParams;return w!=null&&w!==this.hasSellingPlan?(ge((r=p==null?void 0:p.checkoutUrl)!=null?r:""),n.reject()):h?(U({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 y.sheetClicked({instrument:this.name,result:"failed"}),_.notify(h),At(d),n.reject()}}async createToken({apiClientPromise:e,requiresBillingAgreement:n}){const r=await e;try{if(!this.cartId)throw new Error("cartId not found when creating token");const a=await r.paypalTokenCreate({cartId:this.cartId,billingAgreement:n});return y.sheetClicked({instrument:this.name,result:"success"}),a}catch(a){throw b(this,he)||(y.sheetClicked({instrument:this.name,result:"failed"}),_.notify(a)),new Error(tr)}}async onApprove({orderID:e,payerID:n,billingToken:r}){var a;try{if(y.authorizationAttempt(this.name),Je(N.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:u,email:d,remoteOrderId:h}=await i.paypalBuyerDetailsFetch(o,this.cartId),p=await Ge({cartId:this.cartId,cartClient:i,instrumentName:this.name,emailAddress:d,streetAddress:l});if(!(p!=null&&p.data))throw new Error("Cart not found");if(await this.decelerateOrAbort(p))return;const{id:g,totalAmount:A,checkoutUrl:E}=p.data,w=await xr({abortSignal:(a=this.abortController)==null?void 0:a.signal,cartClient:i,cartId:g,instrumentName:f.PayPal,billingAddress:s!=null?s:l,paymentMethod:{walletPaymentMethod:{paypalWalletContent:{billingAddress:s!=null?s:l,email:d,expiresAt:u,payerId:n,token:h!=null?h:e,acceptedSubscriptionTerms:!1,vaultingAgreement:!1,merchantId:this.walletParams.merchantId}}},canUsePaymentMethodForFreeOrder:!0,totalAmount:A});if(await this.decelerateOrAbort(w))return;y.authorizationComplete({instrument:this.name,result:"success",measurement:j(N.AuthorizationLatency,this.name)}),ge(E)}catch(i){throw b(this,he)||(y.authorizationComplete({instrument:this.name,result:"failed",measurement:j(N.AuthorizationLatency,this.name)}),_.notify(i)),new Error(tr)}}onError(e,n){if(b(this,he)||e.message.includes(tr))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"?y.log({body:"PayPal modal closed due to error: ".concat(e)}):_.notify(new Cc(e));const r=n.translate("brand.paypal");F(r,n)}requiresBillingAgreement(){return this.walletParams.hasManagedSellingPlanState||this.walletParams.requiresBillingAgreement}shouldDecelerate(e){return!!(e&&Sc.includes(e))}async decelerateOrAbort(e){if(e.abortReason==="out_of_stock")return await this.handleOutOfStock(),!0;if(!e.data)return!1;const{totalAmount:n,checkoutUrl:r}=e.data;let a;return this.shouldDecelerate(e.decelerationReason)?a=e.decelerationReason:Nr({currentCartTotal:n,initialBuyerCurrency:this.buyerCurrency})&&(a="currency_changed"),a?(U({checkoutUrl:r,instrumentName:this.name,reason:a}),!0):!1}async handleOutOfStock(){y.authorizationComplete({instrument:this.name,result:"failed",measurement:j(N.AuthorizationLatency,this.name)}),ye(await this.i18n)}}he=new WeakMap;class Cc extends ne{constructor(e){if(e instanceof Error){const n=e.message==="too much recursion"?"PayPalError-too-much-recursion":void 0;super(e.message,{cause:e.cause,groupingHash:n}),this.stack=e.stack}else super(String(e));this.name="PayPalError"}}const Fe=class gh extends Ae{static walletName(){return"paypal"}constructor(e){super(e)}getWebComponentName(){return"shopify-paypal-button"}getInstrumentName(){return f.PayPal}getWebComponentClass(){return Ic}loadWalletSDK(){let e=gh.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",ya(this.walletParams.sdkUrl)),n.onload=()=>r(),n.onerror=i=>{gh.paypalSDKPromiseByUrl.delete(this.walletParams.sdkUrl),n&&document.body.contains(n)&&document.body.removeChild(n),a(i)},document.body.appendChild(n)}),gh.paypalSDKPromiseByUrl.set(this.walletParams.sdkUrl,e),e}getLoadEligibility(){return{eligible:!0}}getPartnerSDKEligibility(){var e,n;try{return(n=(e=ma(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 X({code:"paypal-sdk-eligibility-check-failed",message:"PayPal SDK 'isEligible' method failed unexpectedly: ".concat(r)})}}};c(Fe,"paypalSDKPromiseByUrl",new Map);let dr=Fe;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}",ur={UK:"GB",JA:"JP"},ga=["AS","GU","MP","PR","VI"];ga.forEach(t=>{ur[t]="US"});function wt(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:Rc(t.countryCode),phone:t.phoneNumber||void 0};return a.country==="HK"&&(a.zip=void 0,a.province=t.postalCode),r&&ga.includes(r)&&(a.province=r),a.lastName||(a.lastName=a.firstName),a}function Rc(t){if(!t)return"ZZ";const e=t.toUpperCase();return Object.keys(ur).includes(e)?ur[e]:e}function Tc(t,e){return t.map(n=>{const{title:r,deliveryPromise:a}=Lc(n,e);return{title:r,estimatedCost:{amount:vc(n),currencyCode:n[0].estimatedCost.currencyCode},handle:_a(n),deliveryPromise:a}})}function Nc(t,e){return t.map(n=>{const{title:r,description:a}=Oc(n,e);return{title:r,description:a,handle:_a(n)}})}function fa({deliveryGroups:t}){return t.map(e=>e.deliveryOptions.filter(({deliveryMethodType:n})=>n==="SHIPPING").map(n=>({...n,groupType:e.groupType}))).reduce((e,n)=>e.flatMap(r=>n.map(a=>[...r,a])),[[]])}function vc(t){return t.reduce((e,n)=>e+Number(n.estimatedCost.amount),0).toFixed(2)}function Lc(t,e){const n=t.find(l=>l.groupType===Ne.OneTimePurchase),r=t.find(l=>l.groupType===Ne.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 Oc(t,e){const n=t.find(o=>o.groupType===Ne.OneTimePurchase),r=t.find(o=>o.groupType===Ne.Subscription),a=t.map(kc).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 kc(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 _a(t){return t.map(e=>e.handle).join(",")}function Ea({deliveryGroups:t,i18n:e}){const n=t.some(r=>r.groupType===Ne.Subscription);return t.map(r=>{var a;let i=e.translate("order_summary.shipping");return n&&(i=r.groupType===Ne.Subscription?e.translate("order_summary.shipping_subscription"):e.translate("order_summary.shipping_one_time_purchase")),{label:i,amount:Te(((a=r.selectedDeliveryOption)==null?void 0:a.estimatedCost.amount)||0)}})}function Mc(t,e){return ot({label:t,possibleLines:[e]})[0]}function xc({subtotal:t,deliveryGroups:e,duties:n,taxes:r,discountAllocations:a,i18n:i,formattedRecurringTotals:o}){var s;const l=ot({label:i.translate("order_summary.subtotal"),possibleLines:[t]}),u=Ea({deliveryGroups:e,i18n:i}),d=ot({label:i.translate("order_summary.duties"),possibleLines:[n]}),h=ot({label:i.translate("order_summary.taxes"),possibleLines:[r]}),p=o.map(E=>({label:E,amount:"0.00",type:"pending"})),g=p.length?[{label:i.translate("order_summary.subscriptions.recurring_total_tooltip_line"),amount:"0.00",type:"pending"}]:[],A=(s=a==null?void 0:a.flatMap(E=>{var w;const S=(w=E.title)!=null?w:E.code;return ot({label:S!=null?S:i.translate("order_summary.discount"),possibleLines:[E.discountedAmount],isDiscount:!0})}))!=null?s:[];return[...l,...u,...d,...h,...A,...p,...g]}function ot({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(Te(r.amount)):Te(r.amount)}))}function an(t,e){if(!t.length)return[];const n=fa({deliveryGroups:t});return Tc(n,e).map(r=>{var a;return{label:r.title||"",amount:r.estimatedCost.amount,identifier:r.handle,detail:(a=r.deliveryPromise)!=null?a:""}})}const rr=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,'"'))}},Fc=["decelerate","abort","show_error","complete","update"];class ze extends ne{constructor(){super(...arguments),c(this,"name","UnhandledActionError")}}class Aa{constructor(){c(this,"generatePrioritizedPaymentSheetAction",(e,n)=>{let r;const a=[],i=[],o=[],s=n.filter(u=>u!==m.UnacceptablePaymentsAmount).some(u=>e[u]!==void 0);for(const u of Object.keys(e))if(!(u===m.UnacceptablePaymentsAmount&&s)){const d=e[u]();d.effects&&i.push(...d.effects),d.action!=="complete"&&d.errors&&o.push(...d.errors),a.push(d)}const l=(u=>Fc.map(d=>u.find(h=>h.action===d)).find(d=>!!d))(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;_.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 Uc extends Aa{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,billingCountryCode:n==null?void 0:n.billingCountryCode}),o=e.errors,s=this.getUnhandledErrors(o,i);if(s.forEach(u=>{_.notify(new ze("[".concat(f.ApplePay,"] mutation result error not handled: ").concat(u),{groupingHash:"UnhandledActionError:".concat(f.ApplePay,":").concat(u)}))}),((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",effects:[()=>{F(this.i18n.translate("brand.apple_pay"),this.i18n)}]}:{action:"update",errors:[]})}mapCompletionResultToPaymentSheetAction(e,n){if(!e.data)throw new Error("[".concat(f.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,billingCountryCode:n==null?void 0:n.billingCountryCode}),i=e.errors;this.getUnhandledErrors(i,a).forEach(s=>{_.notify(new ze("[".concat(f.ApplePay,"] completion result error not handled: ").concat(s),{groupingHash:"UnhandledActionError:".concat(f.ApplePay,":").concat(s)}))});const{prioritizedPaymentSheetAction:o}=this.getMergedPaymentSheetAction({result:e,errorActions:a});return o||{action:"abort",effects:[()=>{F(this.i18n.translate("brand.apple_pay"),this.i18n)}]}}default:throw new Error("[".concat(f.ApplePay,"] unknown completion result type: ").concat(e.data.__typename))}}getErrorActions({shippingCountryCode:e,billingCountryCode:n}){return[{errors:[m.CaptchaCompletionRequired],generateAction:()=>this.decelerateOrAbort({reason:"captcha_required",instrumentName:f.ApplePay,errorOrWarning:m.CaptchaCompletionRequired,result:this.completionResult})},{errors:[m.InvalidLanguage],generateAction:()=>({action:"abort",effects:[()=>{_.notify(new Error("[".concat(f.ApplePay,"] mutation provided invalid language, aborting")))}]})},{errors:[m.InvalidCountry],generateAction:()=>({action:"abort",effects:[()=>{_.notify(new Error("[".concat(f.ApplePay,"] mutation provided invalid country, aborting")))}]})},{errors:[m.MissingCartId],generateAction:()=>({action:"abort",effects:[()=>{_.notify(new Error("[".concat(f.ApplePay,"] mutation provided invalid cart ID, aborting")))}]})},{errors:yl,generateAction:()=>({action:"abort",effects:[()=>{F(this.i18n.translate("brand.apple_pay"),this.i18n)}]})},{errors:Tr,generateAction:()=>this.decelerateOrAbort({reason:"dynamic_tax",instrumentName:f.ApplePay,errorOrWarning:m.NewTaxMustBeAccepted,result:this.completionResult})},{errors:sa,generateAction:()=>this.decelerateOrAbort({reason:"not_enough_stock",instrumentName:f.ApplePay,errorOrWarning:m.MerchandiseNotEnoughStock,result:this.completionResult})},{errors:[m.MerchandiseOutOfStock],generateAction:()=>({action:"abort",effects:[()=>ye(this.i18n)]})},{errors:aa,generateAction:()=>({action:"show_error",errors:[new ApplePayError("addressUnserviceable")]})},{errors:[m.BuyerIdentityEmailRequired],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","emailAddress",this.i18n.translate("errors.missing.email"))]})},{errors:Bs,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.missing.first_name"))]})},{errors:Hs,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.invalid.first_name"))]})},{errors:$s,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.missing.last_name"))]})},{errors:Gs,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.invalid.last_name"))]})},{errors:zs,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.missing.address1"))]})},{errors:[m.DeliveryAddress1Invalid],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address1"))]})},{errors:Vs,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.missing.address2"))]})},{errors:[m.DeliveryAddress2Invalid],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address2"))]})},{errors:Ws,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.missing.city"))]})},{errors:[m.DeliveryCityInvalid],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.invalid.city"))]})},{errors:[m.DeliveryZoneRequiredForCountry],generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.missing.zone"),this.i18n.translate("errors.missing.emirate"),"shippingContactInvalid",e)]})},{errors:[m.DeliveryZoneNotFound],generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.invalid.zone"),this.i18n.translate("errors.invalid.emirate"),"shippingContactInvalid",e)]})},{errors:qs,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.missing.postal_code"))]})},{errors:na,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.invalid.postal_code"))]})},{errors:[m.DeliveryCountryRequired],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","country",this.i18n.translate("errors.missing.country"))]})},{errors:Ys,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","phoneNumber",this.i18n.translate("errors.missing.phone"))]})},{errors:Qs,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","phoneNumber",this.i18n.translate("errors.invalid.phone"))]})},{errors:js,generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","country",this.i18n.translate("errors.invalid.country"))]})},{errors:[m.DeliveryProvinceRequired],generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.missing.zone"),this.i18n.translate("errors.missing.emirate"),"shippingContactInvalid",e)]})},{errors:Xs,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid")]})},{errors:Js,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","postalCode",this.i18n.translate("errors.invalid.postal_code"))]})},{errors:el,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.missing.first_name"))]})},{errors:tl,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.missing.last_name"))]})},{errors:rl,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.missing.address1"))]})},{errors:nl,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.missing.address2"))]})},{errors:al,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.missing.city"))]})},{errors:il,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","phoneNumber",this.i18n.translate("errors.missing.phone"))]})},{errors:ol,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","postalCode",this.i18n.translate("errors.missing.postal_code"))]})},{errors:sl,generateAction:()=>({action:"show_error",errors:[this.createApplePayZoneError(this.i18n.translate("errors.missing.zone"),this.i18n.translate("errors.missing.emirate"),"billingContactInvalid",n)]})},{errors:[m.ApplePayBillingFirstNameContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.emojis.first_name"))]})},{errors:[m.ApplePayBillingFirstNameContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.html_tags.first_name"))]})},{errors:ll,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.invalid.first_name"))]})},{errors:[m.ApplePayBillingLastNameContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.emojis.last_name"))]})},{errors:[m.ApplePayBillingLastNameContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.html_tags.last_name"))]})},{errors:cl,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","name",this.i18n.translate("errors.invalid.last_name"))]})},{errors:[m.ApplePayBillingAddress1ContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address1"))]})},{errors:[m.ApplePayBillingAddress1ContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address1"))]})},{errors:dl,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address1"))]})},{errors:[m.ApplePayBillingAddress2ContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address2"))]})},{errors:[m.ApplePayBillingAddress2ContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address2"))]})},{errors:ul,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","addressLines",this.i18n.translate("errors.invalid.address2"))]})},{errors:[m.ApplePayBillingCityContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.emojis.city"))]})},{errors:[m.ApplePayBillingCityContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.html_tags.city"))]})},{errors:hl,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","locality",this.i18n.translate("errors.invalid.city"))]})},{errors:[m.ApplePayBillingPhoneContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","phoneNumber",this.i18n.translate("errors.emojis.phone"))]})},{errors:pl,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","phoneNumber",this.i18n.translate("errors.invalid.phone"))]})},{errors:[m.ApplePayBillingZipContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","postalCode",this.i18n.translate("errors.emojis.postal_code"))]})},{errors:ml,generateAction:()=>({action:"show_error",errors:[new ApplePayError("billingContactInvalid","postalCode",this.i18n.translate("errors.invalid.postal_code"))]})},{errors:[m.UnsupportedApplePayPaymentMethod],generateAction:()=>({action:"abort",effects:[()=>{F(this.i18n.translate("brand.apple_pay"),this.i18n)},()=>{_.notify(new ze("[".concat(f.ApplePay,"] payment method is not supported"),{groupingHash:"UnhandledActionError:".concat(f.ApplePay,":payment_method_not_supported")}))}]})},{errors:[m.PaymentsMethodRequired],generateAction:()=>({action:"show_error",errors:[new ApplePayError("unknown")]})},{errors:[m.CustomValidation],generateAction:()=>({action:"abort",effects:[()=>{F(this.i18n.translate("brand.apple_pay"),this.i18n)}]})},{errors:[m.DeliveryLastNameContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.emojis.last_name"))]})},{errors:[m.DeliveryFirstNameContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.emojis.first_name"))]})},{errors:[m.DeliveryAddress1TooLong],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.too_long.address1"))]})},{errors:[m.DeliveryAddress2TooLong],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.too_long.address2"))]})},{errors:[m.DeliveryFirstNameTooLong],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.too_long.first_name"))]})},{errors:[m.DeliveryLastNameTooLong],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.too_long.last_name"))]})},{errors:[m.DeliveryCityTooLong],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.too_long.city"))]})},{errors:[m.DeliveryFirstNameContainsUrl],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.url.first_name"))]})},{errors:[m.DeliveryLastNameContainsUrl],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.url.last_name"))]})},{errors:[m.DeliveryAddress1ContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address1"))]})},{errors:[m.DeliveryAddress2ContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.html_tags.address2"))]})},{errors:[m.DeliveryCityContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.html_tags.city"))]})},{errors:[m.DeliveryFirstNameContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.html_tags.first_name"))]})},{errors:[m.DeliveryLastNameContainsHtmlTags],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","name",this.i18n.translate("errors.html_tags.last_name"))]})},{errors:[m.DeliveryCityContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","locality",this.i18n.translate("errors.emojis.city"))]})},{errors:[m.DeliveryAddress1ContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address1"))]})},{errors:[m.DeliveryAddress2ContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","addressLines",this.i18n.translate("errors.emojis.address2"))]})},{errors:[m.DeliveryPostalCodeContainsEmojis],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","postalCode",this.i18n.translate("errors.emojis.postal_code"))]})},{errors:[m.BuyerIdentityEmailInvalid],generateAction:()=>({action:"show_error",errors:[new ApplePayError("shippingContactInvalid","emailAddress",this.i18n.translate("errors.invalid.email"))]})},{errors:[m.DiscountNotApplicable],generateAction:()=>({action:"show_error",errors:[new ApplePayError("couponCodeInvalid",void 0,this.i18n.translate("errors.invalid.discount"))]})},{errors:[m.LocalizationExtensionFieldError],generateAction:()=>this.decelerateOrAbort({reason:"localization_extension_field_error",instrumentName:f.ApplePay,errorOrWarning:m.CaptchaCompletionRequired,result:this.completionResult})}]}mapCustomValidationFunctionErrorToAction(e){const n=Cr(e);return n?{action:"abort",effects:[()=>{const r=this.i18n.translate("brand.apple_pay");Dr(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 on=["name","postalAddress"];function Bc({shippingRequired:t,walletParams:e,buyerCurrency:n}){const{phoneRequired:r,emailRequired:a}=e,i=[...a?["email"]:[],...r?["phone"]:[]],o=t?[...on,...i]:i;return{countryCode:e.countryCode,currencyCode:n,merchantCapabilities:e.merchantCapabilities,supportedNetworks:e.supportedNetworks,total:{type:"pending",label:e.merchantName,amount:"1.00"},requiredBillingContactFields:on,requiredShippingContactFields:o,shippingType:e.shippingType}}const Hc=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]};class $c extends ne{constructor(){super(...arguments),c(this,"name","ApplePaySessionCreationError"),c(this,"useHashPrefix",!0),c(this,"autogenerateHash",!0)}}const ba=t=>{const e=t.lineItems.reduce((n,r)=>n+Number(r.subtotalAmount.amount),0);return{amount:String(e),currencyCode:t.totalAmount.currencyCode}};function Gc(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=zc({billingPolicy:a.billingPolicy,i18n:e});if(i.length===0){const l=Pt({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=Pt({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=Pt({price:Number(i[0].price.amount)*o,currencyCode:i[0].price.currencyCode,locale:e.locale}),u=Pt({price:Number(i[1].price.amount)*o,currencyCode:i[1].price.currencyCode,locale:e.locale}),d=a.priceAdjustments[0].orderCount;return[...n,e.translate("order_summary.subscriptions.recurring_totals_with_policies",{count:d,fixedPrice:l,recurringPrice:u,interval:s})]}return n},[])}function Pt({price:t,currencyCode:e,locale:n}){return Intl.NumberFormat(n,{style:"currency",currency:e,currencyDisplay:"narrowSymbol"}).format(t)}function zc({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})}const Vt="GraphQL Client",sn=0,ln=3,wa="An error occurred while fetching from the API. Review 'graphQLErrors' for details.",Pa="Response returned unexpected Content-Type:",Sa="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"},cn="X-SDK-Variant",dn="X-SDK-Version",Vc="shopify-graphql-client",Wc="1.4.1",Ia=1e3,qc=[429,503],Ca=/@(defer)\b/i,un="\r\n",Yc=/boundary="?([^=";]+)"?/i,hn=un+un;function me(t,e=Vt){return t.startsWith("".concat(e))?t:"".concat(e,": ").concat(t)}function Ze(t){return t instanceof Error?t.message:JSON.stringify(t)}function Da(t){return t instanceof Error&&t.cause?t.cause:void 0}function Ra(t){return t.flatMap(({errors:e})=>e!=null?e:[])}function Ta({client:t,retries:e}){if(e!==void 0&&(typeof e!="number"||eln))throw new Error("".concat(t,': The provided "retries" value (').concat(e,") is invalid - it cannot be less than ").concat(sn," or greater than ").concat(ln))}function z(t,e){return e&&(typeof e!="object"||Array.isArray(e)||typeof e=="object"&&Object.keys(e).length>0)?{[t]:e}:{}}function Na(t,e){if(t.length===0)return e;const n={[t.pop()]:e};return t.length===0?n:Na(t,n)}function va(t,e){return Object.keys(e||{}).reduce((n,r)=>(typeof e[r]=="object"||Array.isArray(e[r]))&&t[r]?(n[r]=va(t[r],e[r]),n):(n[r]=e[r],n),Array.isArray(t)?[...t]:{...t})}function La([t,...e]){return e.reduce(va,{...t})}function jc({clientLogger:t,customFetchApi:e=fetch,client:n=Vt,defaultRetryWaitTime:r=Ia,retriableCodes:a=qc}){const i=async(o,s,l)=>{const u=s+1,d=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)&&u<=d)throw new Error;const p=(h==null?void 0:h.headers.get("X-Shopify-API-Deprecated-Reason"))||"";return p&&t({type:"HTTP-Response-GraphQL-Deprecation-Notice",content:{requestParams:o,deprecationNotice:p}}),h}catch(p){if(u<=d){const g=h==null?void 0:h.headers.get("Retry-After");return await Qc(g?parseInt(g,10):r),t({type:"HTTP-Retry",content:{requestParams:o,lastResponse:h,retryAttempt:s,maxRetries:l}}),i(o,u,l)}throw new Error(me("".concat(l>0?"Attempted maximum number of ".concat(l," network retries. Last message - "):"").concat(Ze(p)),n))}};return i}async function Qc(t){return new Promise(e=>setTimeout(e,t))}function Kc({headers:t,url:e,customFetchApi:n=fetch,retries:r=0,logger:a}){Ta({client:Vt,retries:r});const i={headers:t,url:e,retries:r},o=Xc(a),s=jc({customFetchApi:n,clientLogger:o,defaultRetryWaitTime:Ia}),l=Jc(s,i),u=Zc(l),d=od(l);return{config:i,fetch:l,request:u,requestStream:d}}function Xc(t){return e=>{t&&t(e)}}async function Oa(t){const{errors:e,data:n,extensions:r}=await t.json();return{...z("data",n),...z("extensions",r),headers:t.headers,...e||!n?{errors:{networkStatusCode:t.status,message:me(e?wa:Sa),...z("graphQLErrors",e),response:t}}:{}}}function Jc(t,{url:e,headers:n,retries:r}){return async(a,i={})=>{const{variables:o,headers:s,url:l,retries:u,keepalive:d,signal:h}=i,p=JSON.stringify({query:a,variables:o});Ta({client:Vt,retries:u});const g=Object.entries({...n,...s}).reduce((E,[w,S])=>(E[w]=Array.isArray(S)?S.join(", "):S.toString(),E),{});!g[cn]&&!g[dn]&&(g[cn]=Vc,g[dn]=Wc);const A=[l!=null?l:e,{method:"POST",headers:g,body:p,signal:h,keepalive:d}];return t(A,1,u!=null?u:r)}}function Zc(t){return async(...e)=>{if(Ca.test(e[0]))throw new Error(me("This operation will result in a streamable response - use requestStream() instead."));let n=null;try{n=await t(...e);const{status:r,statusText:a}=n,i=n.headers.get("content-type")||"";return n.ok?i.includes(hr.json)?await Oa(n):{errors:{networkStatusCode:r,message:me("".concat(Pa," ").concat(i)),response:n}}:{errors:{networkStatusCode:r,message:me(a),response:n}}}catch(r){return{errors:{message:Ze(r),...n==null?{}:{networkStatusCode:n.status,response:n}}}}}}function ed(t){return xe(this,null,function*(){const e=new TextDecoder;if(t.body[Symbol.asyncIterator])try{for(var n=Z(t.body),r,a,i;r=!(a=yield new J(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 J(a.call(n)))}finally{if(i)throw i[0]}}else{const o=t.body.getReader();let s;try{for(;!(s=yield new J(o.read())).done;)yield e.decode(s.value)}finally{o.cancel()}}})}function td(t,e){return{[Symbol.asyncIterator](){return xe(this,null,function*(){try{let o="";try{for(var n=Z(t),r,a,i;r=!(a=yield new J(n.next())).done;r=!1){const s=a.value;if(o+=s,o.indexOf(e)>-1){const l=o.lastIndexOf(e),u=o.slice(0,l).split(e).filter(d=>d.trim().length>0).map(d=>d.slice(d.indexOf(hn)+hn.length).trim());u.length>0&&(yield u),o=o.slice(l+e.length),o.trim()==="--"&&(o="")}}}catch(s){i=[s]}finally{try{r&&(a=n.return)&&(yield new J(a.call(n)))}finally{if(i)throw i[0]}}}catch(o){throw new Error("Error occured while processing stream payload - ".concat(Ze(o)))}})}}}function rd(t){return{[Symbol.asyncIterator](){return xe(this,null,function*(){yield{...yield new J(Oa(t)),hasNext:!1}})}}}function nd(t){return t.map(e=>{try{return JSON.parse(e)}catch(n){throw new Error("Error in parsing multipart response - ".concat(Ze(n)))}}).map(e=>{const{data:n,incremental:r,hasNext:a,extensions:i,errors:o}=e;if(!r)return{data:n||{},...z("errors",o),...z("extensions",i),hasNext:a};const s=r.map(({data:l,path:u,errors:d})=>({data:l&&u?Na(u,l):{},...z("errors",d)}));return{data:s.length===1?s[0].data:La([...s.map(({data:l})=>l)]),...z("errors",Ra(s)),hasNext:a}})}function ad(t,e){if(t.length>0)throw new Error(wa,{cause:{graphQLErrors:t}});if(Object.keys(e).length===0)throw new Error(Sa)}function id(t,e){var n,r;const a=(e!=null?e:"").match(Yc),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=ed(t);let s={},l;return{[Symbol.asyncIterator](){return xe(this,null,function*(){var u,d;try{let E=!0;try{for(var h=Z(td(o,i)),p,g,A;p=!(g=yield new J(h.next())).done;p=!1){const w=g.value,S=nd(w);l=(d=(u=S.find(k=>k.extensions))==null?void 0:u.extensions)!=null?d:l;const G=Ra(S);s=La([s,...S.map(({data:k})=>k)]),E=S.slice(-1)[0].hasNext,ad(G,s),yield{...z("data",s),...z("extensions",l),hasNext:E}}}catch(w){A=[w]}finally{try{p&&(g=h.return)&&(yield new J(g.call(h)))}finally{if(A)throw A[0]}}if(E)throw new Error("Response stream terminated unexpectedly")}catch(E){const w=Da(E);yield{...z("data",s),...z("extensions",l),errors:{message:me(Ze(E)),networkStatusCode:t.status,...z("graphQLErrors",w==null?void 0:w.graphQLErrors),response:t},hasNext:!1}}})}}}function od(t){return async(...e)=>{if(!Ca.test(e[0]))throw new Error(me("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 rd(n);case a.includes(hr.multipart):return id(n,a);default:throw new Error("".concat(Pa," ").concat(a),{cause:n})}}catch(n){return{[Symbol.asyncIterator](){return xe(this,null,function*(){const r=Da(n);yield{errors:{message:me(Ze(n)),...z("networkStatusCode",r==null?void 0:r.status),...z("response",r)},hasNext:!1}})}}}}}const sd="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}}}}}",ld="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}",cd="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}",dd="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}",ud="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}",hd="mutation applePaySessionCreate($validationUrl:URL!){applePaySessionCreate(validationUrl:$validationUrl){...@defer{applePaySession{body}}}}",pd="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}}}}}}",md="mutation PayPalTokenCreate($cartId:ID!$billingAgreement:Boolean!){paypalTokenCreate(cartId:$cartId billingAgreement:$billingAgreement){...@defer{paypalToken{token}}}}",yd="query cartQuery($id:ID!$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false)@inContext(country:$country language:$language){cart(id:$id){...@defer(if:$withCarrierRates){...CartParts}}}",gd="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}}}}}}}",fd="query subscriptionPolicyQuery($country:CountryCode$language:LanguageCode)@inContext(country:$country language:$language){shop{subscriptionPolicy(sanitized:true){body}}}",_d="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}",St="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}}}}}}",nr="fragment CartErrorParts on CartUserError{message field code}",pn="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}}}}",Ed="mutation prepareCart($cartId:ID!$country:CountryCode$language:LanguageCode$withCarrierRates:Boolean=false$prepareCart:Boolean=true)@inContext(country:$country language:$language){...PreparedCartFragment}",Ad="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}}}}",bd="mutation cartRemovePersonalData($cartId:ID!){cartRemovePersonalData(cartId:$cartId){errors:userErrors{...CartErrorParts}warnings:warnings{...on CartWarning{code}}}}";async function wd(t,e){var n,r;if(!e.errors)return;const a=vd(e.errors,t),i=await Nd(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 Pd=[/API multipart response did not return an iterable body/,/Error in parsing multipart response/,/GraphQL Client: Response returned unexpected Content-Type:/,/Internal error/,/Carrier-calculated rates through @defer is temporarily unavailable/,/Throttled/,/Request blocked/,/Network request failed/],Sd=[/signal is aborted/i,/fetch is aborted/i,/operation was aborted/i,/\[Apple Pay\] Payment sheet cancelled/],Id=[/timed?.out/i,/error occured while processing stream payload/i,/response stream terminated/i],Cd=/provided invalid value/,Dd=["quantity","sellingPlanId","attributes"];function Rd(t){var e;return Cd.test(t)&&(e=Dd.find(n=>t.includes(n)))!=null?e:null}function Td(t,{hasBeenVisible:e=!1}={}){if(t.statusCode&&t.statusCode!==200)return{isIgnorable:!0,reason:"statusCode-".concat(t.statusCode)};if(t.message){if(Id.some(r=>r.test(t.message)))return{isIgnorable:!0,reason:"timeout"};if(Sd.some(r=>r.test(t.message)))return{isIgnorable:!0,reason:"abort"};if(Pd.some(r=>r.test(t.message)))return{isIgnorable:!0,reason:"message"};const n=Rd(t.message);if(n)return{isIgnorable:!0,reason:"graphql-input-validation-".concat(n)}}return e?{isIgnorable:!1,reason:void 0}:{isIgnorable:!0,reason:"component-not-visible"}}async function Nd(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 vd(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)}const mn="UNKNOWN";function Ld({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)=>(_.leaveBreadcrumb("Request ".concat((r==null?void 0:r.method)||mn,": ").concat(n),{url:n,method:r==null?void 0:r.method},"request"),fetch(n,r)),logger:n=>{try{switch(n.type){case"HTTP-Response":{const[r,a]=n.content.requestParams,{status:i,statusText:o,headers:s,type:l}=n.content.response;_.leaveBreadcrumb("Response ".concat((a==null?void 0:a.method)||mn,": ").concat(r),{statusCode:i,statusText:o,responseHeaders:Od(s),responseType:l,url:r,method:a==null?void 0:a.method,headers:a==null?void 0:a.headers,body:a==null?void 0:a.body},"log");break}case"HTTP-Retry":{const{retryAttempt:r,maxRetries:a,lastResponse:i,requestParams:[o,s]=[]}=n.content;_.leaveBreadcrumb("GraphQL Retry Attempt ".concat(r,"/").concat(a,": ").concat(o),{retryAttempt:r,maxRetries:a,url:o,method:s==null?void 0:s.method,lastResponseStatus:i==null?void 0:i.status},"log");break}case"HTTP-Response-GraphQL-Deprecation-Notice":{const{deprecationNotice:r,requestParams:a}=n.content,[i,o]=a||[];_.leaveBreadcrumb("GraphQL Deprecation Notice: ".concat(i),{deprecationNotice:r,url:i,method:o==null?void 0:o.method},"log");break}default:{const r=n;_.leaveBreadcrumb("GraphQL Logger: ".concat(r.type),{type:r.type,content:r.content},"log")}}}catch(r){}}}}function Od(t){if("fromEntries"in Object)return Object.fromEntries(t);const e={};for(const[n,r]of t.entries())e[n]=r;return e}const kd="unstable";class Wt{constructor({accessToken:e,country:n,locale:r,apiVersion:a=kd,withCarrierRates:i=!1,cartPrepareMigrationEnabled:o=!1}){if(c(this,"OPERATION_NAME_REGEX",/[^ ]+ (\w+)/),c(this,"LANGUAGES_WITH_REGION",["zh-CN","zh-TW","pt-BR","pt-PT"]),c(this,"client"),c(this,"country"),c(this,"url"),c(this,"locale"),c(this,"withCarrierRates"),c(this,"lastValidCart"),c(this,"cartPrepareMigrationEnabled"),c(this,"hasBeenVisible",!1),!e||!n)throw new X({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=Kc(Ld({url:this.url,accessToken:e}))}async createCart(e){var n,r,a;const i=await this.requestStream([sd,St],{input:{lines:[{merchandiseId:e.merchandiseId,quantity:e.quantity,sellingPlanId:e.sellingPlanId,attributes:this.stringifyAttributes(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=Z(i),s,l,u;s=!(l=await o.next()).done;s=!1){const d=l.value;d.errors&&await this.onError({operationName:"createCart",response:d});const h=(n=d.data)==null?void 0:n.result;if(h&&!d.hasNext){h.errors.length>0&&this.onResultError(h.errors);const p=this.parseMutationWarnings((a=(r=d.data)==null?void 0:r.result)==null?void 0:a.warnings),g=h.cart?this.parseCartResponse(h.cart):null;return{data:g,errors:this.parseMutationErrors({result:d,key:"result",operationName:"cartCreate"}),warnings:p,decelerationReason:Zt({cart:g,warnings:p}),abortReason:en({cart:g,warnings:p})}}}}catch(d){u=[d]}finally{try{s&&(l=o.return)&&await l.call(o)}finally{if(u)throw u[0]}}throw new be("Cart create operation returned no response")}async updateCartBillingAddress(e){const{cartId:n,billingAddress:r,instrumentName:a}=e;return this.requestDeferredCart(cd,{cartId:n,billingAddress:r},{instrumentName:a,operationName:"updateCartBillingAddress"})}async updateCartBuyerIdentity(e,n){const{cartId:r,instrumentName:a}=e;return this.requestDeferredCart(dd,{cartId:r,buyerIdentity:xd(e)},{instrumentName:a,operationName:"updateCartBuyerIdentity",abortSignal:n})}async updateSelectedDeliveryOptions(e,n,r,a){let i=n;const o=pe()+2e4;for(;pe()typeof u=="string"&&u.startsWith(m.PendingDeliveryGroups))))return s;const l=s.data.deliveryGroups.flatMap(u=>u.deliveryOptions.map(d=>({deliveryOptionHandle:d.handle,deliveryGroupId:u.id})));i=i.map(u=>{var d;return(d=l.find(h=>h.deliveryOptionHandle===u.deliveryOptionHandle))!=null?d:u})}throw new Error("Selected delivery options update operation timed out")}async applePaySessionCreate(e){var n,r,a;const i=await this.requestStream([hd],{validationUrl:e.toString()},{instrumentName:f.ApplePay,operationName:"applePaySessionCreate"});try{for(var o=Z(i),s,l,u;s=!(l=await o.next()).done;s=!1){const d=l.value;d.errors&&await this.onError({operationName:"applePaySessionCreate",response:d});const h=(a=(r=(n=d.data)==null?void 0:n.applePaySessionCreate)==null?void 0:r.applePaySession)==null?void 0:a.body;if(h)return h}}catch(d){u=[d]}finally{try{s&&(l=o.return)&&await l.call(o)}finally{if(u)throw u[0]}}throw new be("Apple Pay session create operation returned no response")}async paypalBuyerDetailsFetch(e,n){var r,a;const i=await this.requestStream([pd],{token:e,cartId:n},{instrumentName:f.PayPal,operationName:"paypalBuyerDetailsFetch"});try{for(var o=Z(i),s,l,u;s=!(l=await o.next()).done;s=!1){const d=l.value;if(d.hasNext)continue;if(d.errors){if(d.errors.graphQLErrors){const p=rn(d.errors.graphQLErrors);if(p!=null&&p.code)throw new te(p.code)}await this.onError({operationName:"paypalBuyerDetailsFetch",response:d})}const h=(a=(r=d.data)==null?void 0:r.paypalBuyerDetailsFetch)==null?void 0:a.paypalDetails;if(h)return h}}catch(d){u=[d]}finally{try{s&&(l=o.return)&&await l.call(o)}finally{if(u)throw u[0]}}throw new be("PayPal buyer details fetch operation returned no response")}async paypalTokenCreate({cartId:e,billingAgreement:n}){var r,a,i;const o=await this.requestStream([md],{cartId:e,billingAgreement:n},{instrumentName:f.PayPal,operationName:"paypalTokenCreate"});try{for(var s=Z(o),l,u,d;l=!(u=await s.next()).done;l=!1){const h=u.value;if(h.errors){if(h.errors.graphQLErrors){const g=rn(h.errors.graphQLErrors);if(g!=null&&g.code)throw g.isLoggable&&(y.log({body:"PayPal Token Create ".concat(g.code," Error")}),y.paypalTokenCreationError({errorCode:g.code})),new te(g.code)}await this.onError({operationName:"paypalTokenCreate",response: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){d=[h]}finally{try{l&&(u=s.return)&&await u.call(s)}finally{if(d)throw d[0]}}throw new be("PayPal token create operation returned no response")}async fetchLimitedCart({id:e,startingCheckout:n,instrumentName:r}){var a,i;const o=await this.request([gd],{id:e},{instrumentName:r,startingCheckout:n});if(o.errors&&await this.onError({operationName:"limitedCartQuery",response:o}),!((a=o.data)!=null&&a.cart))throw new Oi("Limited cart query returned no response");return _.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?Ed:yd,l=this.cartPrepareMigrationEnabled?[St,nr,pn]:[St],u=this.cartPrepareMigrationEnabled?{cartId:e,country:this.country,language:i,withCarrierRates:this.withCarrierRates,prepareCart:!0}:{id:e,country:this.country,language:i,withCarrierRates:this.withCarrierRates},d=await this.requestStream([s,...l],u,{instrumentName:r,startingCheckout:n,operationName:"fetchCart"});try{for(var h=Z(d),p,g,A;p=!(g=await h.next()).done;p=!1){const E=g.value;E.errors&&await this.onError({operationName:"fetchCart",response:E});let w=null,S;if(!E.data)throw new be("".concat(o," operation returned no data in response"));if(Md(E.data)){const G=E.data.preparedCart;w=(a=G==null?void 0:G.result)==null?void 0:a.cart,S=this.parsePreparedCartMutationErrors(E.errors,this.extractPreparedCartMutationErrors(G),"prepareCart")}else w=E.data.cart;if(_.leaveBreadcrumb("".concat(o," response"),{operationName:o,body:w,errors:S,hasNext:E.hasNext},"log"),w&&!E.hasNext){const G=this.parseCartResponse(w);return this.lastValidCart=G,G}}}catch(E){A=[E]}finally{try{p&&(g=h.return)&&await g.call(h)}finally{if(A)throw A[0]}}throw new be("".concat(o," operation returned no response"))}async updateCartPayment(e,n,r,a){var i,o;const s={cartId:e,input:n},{amount:l,currencyCode:u}=n.amount;let d;const h=pe()+1e4;for(;pe()setTimeout(g,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===u?p:d}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(ld,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([Ad],{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([fd],{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 d=await this.request([bd,nr],{cartId:e},{instrumentName:r,keepalive:!0});o=this.parseMutationWarnings((i=(a=d.data)==null?void 0:a.cartRemovePersonalData)==null?void 0:i.warnings),s=this.parseMutationErrors({result:d,key:"cartRemovePersonalData",operationName:"cartRemovePersonalData"})}catch(d){l=d.toString()}const u=!(o!=null&&o.length||s!=null&&s.length||l);y.removePersonalDataResult({success:u}),u||y.log({body:"cartRemovePersonalData failed",attributes:{cartId:e,shopId:n,warnings:o,errors:s,exception:l}})}setVisible(){this.hasBeenVisible=!0}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:yn(r),url:this.generateURLWithOperationName(e[0]),keepalive:r.keepalive})}async requestStream(e,n,r){return this.client.requestStream(e.join(""),{variables:n,headers:yn(r),url:this.generateURLWithOperationName(e[0]),signal:r.abortSignal})}async requestDeferredCart(e,n,r){var a,i,o,s,l,u,d,h,p;const g=this.formatLanguage(this.locale),A=await this.requestStream([e,St,nr,pn],{...n,country:this.country,language:g,withCarrierRates:this.withCarrierRates,prepareCart:this.cartPrepareMigrationEnabled},r);try{for(var E=Z(A),w,S,G;w=!(S=await E.next()).done;w=!1){const k=S.value;k.errors&&await this.onError({operationName:r.operationName,response:k,abortSignal:r.abortSignal});const O=this.extractMutationErrors(k),H=(i=(a=k.data)==null?void 0:a.preparedCart)==null?void 0:i.result,ie=(l=(s=(o=k.data)==null?void 0:o.result)==null?void 0:s.cart)!=null?l:H==null?void 0:H.cart;if(ie&&!k.hasNext){let B;this.cartPrepareMigrationEnabled||(B=await this.fetchCart({id:ie.id,instrumentName:r.instrumentName,startingCheckout:!1}));const v=this.parseMutationWarnings((d=(u=k.data)==null?void 0:u.result)==null?void 0:d.warnings),oe=this.parsePreparedCartMutationErrors(k.errors,O,r.operationName),se=B!=null?B:this.parseCartResponse(ie);return{data:se,errors:oe,warnings:v,abortReason:en({cart:se,warnings:v}),decelerationReason:Zt({warnings:v,cart:se,cartStatus:H==null?void 0:H.__typename,errors:oe})}}if(this.lastValidCart&&O.length>0){this.onResultError(O);const B=this.parseMutationWarnings((p=(h=k.data)==null?void 0:h.result)==null?void 0:p.warnings);return{data:this.lastValidCart,errors:this.parsePreparedCartMutationErrors(k.errors,O,r.operationName),warnings:B,decelerationReason:Zt({warnings:B,cart:this.lastValidCart})}}}}catch(k){G=[k]}finally{try{w&&(S=E.return)&&await S.call(E)}finally{if(G)throw G[0]}}throw new be("Deferred cart operation returned no response")}async onError({operationName:e,response:n,abortSignal:r}){if(r!=null&&r.aborted)throw new Ct("Request aborted",{reason:"abort",errorDetails:{operationName:e}});const a=await wd(e,n);if(!a)return;const{message:i,...o}=a,{isIgnorable:s,reason:l}=Td(a,{hasBeenVisible:this.hasBeenVisible});throw _.leaveBreadcrumb(i,{ignored:s,ignoredReason:l,...n,...o},"error"),s?new Ct(i,{reason:l,errorDetails:o}):new _t(i,{errorDetails:o})}onResultError(e){_.leaveBreadcrumb("GraphQL result error",e,"error")}formatLanguage(e){return e.includes("-")?this.LANGUAGES_WITH_REGION.includes(e)?e.toUpperCase().replace("-","_"):e.split("-")[0].toUpperCase():e.toUpperCase()}parseCartResponse(e){var n,r,a;const i=e.lines.edges.map(s=>{var l,u;const d=s.node;return{quantity:d.quantity,totalAmount:{amount:d.cost.totalAmount.amount,currencyCode:d.cost.totalAmount.currencyCode},subtotalAmount:{amount:(l=d.cost.subtotalAmount)==null?void 0:l.amount,currencyCode:(u=d.cost.subtotalAmount)==null?void 0:u.currencyCode},merchandise:{requiresShipping:d.merchandise.requiresShipping},discountAllocations:d.discountAllocations,sellingPlanAllocation:d.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===It?{code:It,message:e.message}:e.field&&e.field.length>0?"".concat(e.code,": ").concat(e.field.join(".")):e.code}parseMutationErrors({result:e,key:n,operationName:r}){var a,i,o;const s=this.parseGraphQlErrors(e.errors),l=((o=(i=(a=e.data)==null?void 0:a[n])==null?void 0:i.errors)==null?void 0:o.map(this.parseMutationError).filter(d=>d))||[],u=[...s,...l];return u.length>0&&_.leaveBreadcrumb("GraphQL errors on mutation '".concat(r,"'"),u,"error"),u}parseMutationWarnings(e){return!e||e.length===0?[]:e.map(n=>n.code)}stringifyAttributes(e){return e&&e.map(n=>({key:n.key,value:typeof n.value=="string"?n.value:JSON.stringify(n.value)}))}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,r){const a=this.parseGraphQlErrors(e),i=n.map(this.parseMutationError).filter(s=>s),o=[...a,...i];return o.length>0&&_.leaveBreadcrumb("GraphQL errors on mutation '".concat(r,"'"),o,"error"),o}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(u=>u.code))!=null?i:[]);const l=[...o,...s];return l.length>0&&_.leaveBreadcrumb("GraphQL errors on completion",l,"error"),l}}function Md(t){return!("cart"in t)}function xd({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 yn({instrumentName:t,startingCheckout:e}){const n={};return t&&(n["X-Wallet-Name"]="".concat(t)),e&&(n["X-Start-Wallet-Checkout"]="".concat(e)),n}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"));if(!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 y.updateFailed(n,"updateSelectedDeliveryOptions"),i}}async function Ma({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 y.updateFailed(r,"submitForCompletion"),a}}function xa({selectedDeliveryOptionHandles:t,deliveryGroups:e,instrumentName:n}){return e.map(r=>{const a=r.deliveryOptions.filter(i=>t.includes(i.handle));if(!a.length)return{deliveryGroupId:"",deliveryOptionHandle:""};if(a.length>1)throw new Fd("[".concat(n,"] found multiple delivery options with selectedDeliverOptionHandle in group: ").concat(r.id),{groupingHash:"getSelectedDeliveryOptions::MultipleOptions"});return{deliveryGroupId:r.id,deliveryOptionHandle:a[0].handle}}).filter(r=>!!r.deliveryGroupId)}class Fd extends ne{constructor(){super(...arguments),c(this,"name","GetSelectedDeliveryOptionsError")}}async function Ud(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 y.updateFailed(n,"updateBillingAddress"),r}}function gn(t,e){return t.some(n=>e.includes(n))}function ct({result:t,instrument:e}){var n;const r=(n=t.errors)!=null?n:[];gn(r,Tr)&&y.dynamicTaxFailed({instrument:e}),gn(r,Ks)&&y.dynamicShippingFailed({instrument:e})}const fn=["cart_not_ready","cart_throttled","not_enough_stock","payment_method_not_applicable"];class Bd{constructor({accessToken:e,buyerCountry:n,buyerCurrency:r,button:a,i18n:i,merchantName:o,dataSource:s,apiClient:l,walletParams:u}){c(this,"name",f.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 d=>{var h,p,g;try{const A=new URL(d.validationURL),E=this.getMerchantSession(A),{cart:w,decelerationReason:S,customValidationError:G,unrecoverableError:k}=await _e({element:this.button,instrumentName:this.name,dataSource:this.dataSource});if(k){_.leaveBreadcrumb("ApplePay Session unrecoverable error",{unrecoverableError:k},"error"),y.sheetClicked({instrument:this.name,result:"failed"}),this.withActiveSession("abort",()=>this.session.abort()),(h=this.abortController)==null||h.abort("[Apple Pay] Unrecoverable error ".concat(k)),Me(this.i18n,k);return}if(G){_.leaveBreadcrumb("ApplePay Session custom validation error",{customValidationError:G},"error"),this.withActiveSession("abort",()=>this.session.abort()),(p=this.abortController)==null||p.abort("[Apple Pay] Custom validation error"),ke(this.i18n,G.message);return}this.cart=w;const O=await E;if(_.leaveBreadcrumb("ApplePay Session completeMerchantValidation",{session:O},"log"),S&&fn.includes(S)){await this.terminateSession(),U({checkoutUrl:(g=w==null?void 0:w.checkoutUrl)!=null?g:"",instrumentName:this.name,reason:S});return}if(this.sessionIsCancelled())return;this.withActiveSession("completeMerchantValidation",()=>this.session.completeMerchantValidation(O))}catch(A){y.sheetClicked({instrument:f.ApplePay,result:"failed"}),this.terminateSession({error:A})}}),c(this,"onshippingcontactselected",async d=>{if(!this.sessionIsCancelled())try{const h=wt(d.shippingContact),p=await Ge({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.decelerateOrAbort(p))return;await this.applyPaymentSheetActions(p,g=>this.completeShippingContactSelection(p.data,g),{shippingRequired:this.isShippingRequired,shippingCountryCode:h.country})}catch(h){this.terminateSession({error:h})}}),c(this,"onshippingmethodselected",async d=>{var h;if(!this.sessionIsCancelled())try{const p=d.shippingMethod.identifier.split(","),g=xa({selectedDeliveryOptionHandles:p,deliveryGroups:this.cart.deliveryGroups,instrumentName:this.name});if(g.length===0){this.handleShippingMethodNotFoundInCart(p);return}const A=await ka({cartId:this.cart.id,cartClient:this.apiClient,instrumentName:this.name,selectedDeliveryOptions:g,abortSignal:(h=this.abortController)==null?void 0:h.signal});if(await this.decelerateOrAbort(A))return;await this.applyPaymentSheetActions(A,()=>this.completeShippingMethodSelection(A.data),{shippingRequired:this.isShippingRequired,shippingCountryCode:void 0}),this.onSheetLoaded()}catch(p){this.terminateSession({error:p})}}),c(this,"onpaymentmethodselected",async d=>{if(!this.sessionIsCancelled())try{const{billingContact:h}=d.paymentMethod;if(!this.isShippingRequired&&h){const A=wt(h),E=await Ge({cartId:this.cart.id,countryCode:A.country,cartClient:this.apiClient,instrumentName:this.name});if(!E.data)throw new Error("Missing cart during Apple Pay Session creation");if(await this.decelerateOrAbort(E))return;await this.applyPaymentSheetActions(E,()=>this.cart=E.data,{shippingRequired:this.isShippingRequired,shippingCountryCode:A.country});const w=await Ud({billingAddress:A,cartId:this.cart.id,cartClient:this.apiClient,instrumentName:this.name});await this.applyPaymentSheetActions(w,()=>this.cart=w.data,{shippingRequired:this.isShippingRequired,shippingCountryCode:A.country})}const{newTotal:p,newLineItems:g}=this.getNewTotalAndLineItems(this.cart);if(_.leaveBreadcrumb("ApplePay Session completePaymentMethodSelection",{newTotal:p,newLineItems:g},"log"),this.sessionIsCancelled())return;this.withActiveSession("completePaymentMethodSelection",()=>this.session.completePaymentMethodSelection({newTotal:p,newLineItems:g})),this.isShippingRequired||this.onSheetLoaded()}catch(h){this.terminateSession({error:h})}}),c(this,"oncancel",()=>{var d;this.cancelled=!0,this.removePersonalData(),j(N.SheetLoad,this.name),y.sheetCancelled(this.name),this.button.disabled=!1,(d=this.abortController)==null||d.abort("[Apple Pay] Payment sheet cancelled")}),c(this,"onpaymentauthorized",async d=>{y.authorizationAttempt(this.name),Je(N.AuthorizationLatency,this.name);const h=async O=>{var H,ie;switch((H=O.effects)==null||H.forEach(B=>B()),O.action){case"complete":{const B=ApplePaySession.STATUS_SUCCESS;try{await this.completePayment(B),ge(O.redirectUrl)}catch(v){this.terminateSession({error:v,afterAuthorization:!0})}break}case"show_error":{const B=(ie=O.errors)!=null?ie:[];try{await this.completePayment(ApplePaySession.STATUS_FAILURE,B)}catch(v){this.terminateSession({error:v,afterAuthorization:!0})}break}case"abort":{try{this.abortPaymentSheetAndShowError(),this.removePersonalData()}catch(B){this.terminateSession({error:B,afterAuthorization:!0})}break}case"decelerate":{try{await this.completePayment(ApplePaySession.STATUS_FAILURE),await this.removePersonalData(),U({checkoutUrl:O.redirectUrl,instrumentName:this.name,reason:O.reason})}catch(B){this.terminateSession({error:B,afterAuthorization:!0})}break}default:this.terminateSession({error:new Error("[".concat(this.name,"] completion action not handled: ").concat(O.action)),afterAuthorization:!0})}},{token:p,billingContact:g,shippingContact:A}=d.payment;let E=null,w=null;try{if(!g){await this.completePayment(ApplePaySession.STATUS_FAILURE);return}if(E=wt({...g,phoneNumber:A==null?void 0:A.phoneNumber}),this.isShippingRequired){if(!A){await this.completePayment(ApplePaySession.STATUS_FAILURE);return}w=wt(A)}}catch(O){this.terminateSession({error:O,afterAuthorization:!0});return}const S=async()=>{var O;try{const H=this.isShippingRequired?{validateAddress:!0,streetAddress:w}:{},ie=(O=this.customerAccountEmail)!=null?O:A==null?void 0:A.emailAddress,B=await Ge({cartId:this.cart.id,emailAddress:ie,cartClient:this.apiClient,instrumentName:this.name,...H});if(ct({result:B,instrument:this.name}),await this.decelerateOrAbort(B))return;const v=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction(B,{shippingRequired:this.isShippingRequired,shippingCountryCode:w==null?void 0:w.country,billingCountryCode:E==null?void 0:E.country});await rr({paymentSheetAction:v,onProceed:async oe=>{oe&&oe.length>0?await this.completePayment(ApplePaySession.STATUS_FAILURE,oe):await G()},terminateSession:oe=>this.terminateSession({error:oe,afterAuthorization:!0})})}catch(H){this.terminateSession({error:H,afterAuthorization:!0})}},G=async()=>{var O;try{const H=this.cart.lineItems.some(v=>!!v.sellingPlanAllocation),ie=await xr({cartId:this.cart.id,totalAmount:this.cart.totalAmount,paymentMethod:{walletPaymentMethod:{applePayWalletContent:{billingAddress:E,data:p.paymentData.data,header:p.paymentData.header,lastDigits:p.paymentMethod.displayName.split(" ")[1],signature:p.paymentData.signature,version:p.paymentData.version}}},canUsePaymentMethodForFreeOrder:!1,billingAddress:E,cartClient:this.apiClient,instrumentName:this.name,hasSellingPlan:H,abortSignal:(O=this.abortController)==null?void 0:O.signal});if(ct({result:ie,instrument:this.name}),await this.decelerateOrAbort(ie))return;const B=this.paymentSheetActionGenerator.mapMutationResultToPaymentSheetAction(ie,{shippingRequired:this.isShippingRequired,shippingCountryCode:w==null?void 0:w.country,billingCountryCode:E==null?void 0:E.country});await rr({paymentSheetAction:B,onProceed:async v=>{v&&v.length>0?await this.completePayment(ApplePaySession.STATUS_FAILURE,v):await k()},terminateSession:()=>this.terminateSession()})}catch(H){this.terminateSession({error:H,afterAuthorization:!0})}},k=async()=>{try{const O=await Ma({cartId:this.cart.id,token:p.transactionIdentifier,cartClient:this.apiClient,instrumentName:this.name});ct({result:O,instrument:this.name});const H=this.paymentSheetActionGenerator.mapCompletionResultToPaymentSheetAction(O,{shippingRequired:this.isShippingRequired,shippingCountryCode:w==null?void 0:w.country,billingCountryCode:E==null?void 0:E.country});await h(H)}catch(O){this.terminateSession({error:O,afterAuthorization:!0})}};await S()}),c(this,"terminateSession",async({error:d,afterAuthorization:h=!1}={})=>{var p;try{this.button.disabled=!1,d&&_.notify(d),h?y.authorizationComplete({instrument:this.name,measurement:j(N.AuthorizationLatency,this.name),result:"failed"}):(j(N.SheetLoad,this.name),y.sheetFailed(this.name,d)),_.leaveBreadcrumb("ApplePay Session abort",{afterAuthorization:h},"log");try{this.withActiveSession("abort",()=>this.session.abort()),(p=this.abortController)==null||p.abort("[Apple Pay] Payment sheet terminated")}catch(g){}if(d){const g=this.i18n.translate("brand.apple_pay");F(g,this.i18n)}}finally{await this.removePersonalData()}}),c(this,"getMostRecentNonNullCart",(d,h)=>d?(this.cart=d,d):h),c(this,"handleNullCart",d=>{if(!d)throw new Error("[".concat(this.name,"] no cart returned on mutation, aborting"))}),c(this,"completeShippingContactSelection",(d,h)=>{try{const p=this.getMostRecentNonNullCart(d,this.cart),{newTotal:g,newLineItems:A}=this.getNewTotalAndLineItems(p),E=an(p.deliveryGroups,this.i18n);_.leaveBreadcrumb("ApplePay Session completeShippingContactSelection",{errors:h,newTotal:g,newLineItems:A,newShippingMethods:E},"log"),this.withActiveSession("completeShippingContactSelection",()=>this.session.completeShippingContactSelection({errors:h!=null?h:[],newTotal:g,newLineItems:A,newShippingMethods:E}))}catch(p){this.terminateSession({error:p})}}),c(this,"completeShippingMethodSelection",d=>{try{this.handleNullCart(d),this.cart=d;const{newTotal:h,newLineItems:p}=this.getNewTotalAndLineItems(d);_.leaveBreadcrumb("ApplePay Session completeShippingContactSelection",{newTotal:h,newLineItems:p},"log"),this.withActiveSession("completeShippingMethodSelection",()=>this.session.completeShippingMethodSelection({newTotal:h,newLineItems:p}))}catch(h){this.terminateSession({error: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=u.customerAccountEmail;try{this.session=new ApplePaySession(Un,Bc({shippingRequired:this.isShippingRequired,walletParams:u,buyerCurrency:r}))}catch(d){throw new $c(String(d),{cause:d})}this.session.onvalidatemerchant=this.onvalidatemerchant,this.session.onshippingcontactselected=this.onshippingcontactselected,this.session.onshippingmethodselected=this.onshippingmethodselected,this.session.onpaymentmethodselected=this.onpaymentmethodselected,this.session.oncancel=this.oncancel,this.session.onpaymentauthorized=this.onpaymentauthorized,this.paymentSheetActionGenerator=new Uc(i)}begin(){_.leaveBreadcrumb("ApplePay Session begin",{},"log"),this.abortController=ve("AbortController"),this.session.begin()}handleShippingMethodNotFoundInCart(e){var n,r;const a=an((r=(n=this.cart)==null?void 0:n.deliveryGroups)!=null?r:[],this.i18n);_.leaveBreadcrumb("ApplePay Session selected shipping method(s) not found in current cart, updating payment sheet",{attemptedDeliveryOptionHandles:e,currentShippingMethods:a},"log"),this.completeShippingMethodSelection(this.cart)}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 rr({paymentSheetAction:i,onProceed:n,terminateSession:this.terminateSession})}async getMerchantSession(e){const n=await new Wt({accessToken:this.accessToken,country:this.buyerCountry,locale:this.i18n.locale,apiVersion:"unstable"}).applePaySessionCreate(e);return JSON.parse(n)}abortPaymentSheetAndShowError(){_.leaveBreadcrumb("ApplePay Session abort",{},"log"),this.withActiveSession("abort",()=>this.session.abort()),this.button.disabled=!1,this.emitPaymentCompleteTelemetry(ApplePaySession.STATUS_FAILURE)}abortPaymentSheetAndShowOutOfStockModal(){_.leaveBreadcrumb("ApplePay Session abort",{},"log"),this.withActiveSession("abort",()=>this.session.abort()),this.button.disabled=!1,ye(this.i18n),this.emitPaymentCompleteTelemetry(ApplePaySession.STATUS_FAILURE)}emitPaymentCompleteTelemetry(e){y.authorizationComplete({instrument:this.name,measurement:j(N.AuthorizationLatency,this.name),result:e===ApplePaySession.STATUS_SUCCESS?"success":"failed"})}async completePayment(e,n=void 0){_.leaveBreadcrumb("ApplePay Session completePayment",{status:e,errors:n},"log");const r=this.withActiveSession("completePayment",()=>{this.session.completePayment({status:e,errors:n})});this.emitPaymentCompleteTelemetry(e),r===void 0&&e===ApplePaySession.STATUS_SUCCESS&&y.paymentCompletedAfterAbort({instrument:this.name,error:"Session already terminated"})}getNewTotalAndLineItems(e){return{newTotal:Mc(this.merchantName,e.totalAmount),newLineItems:xc({subtotal:ba(e),discountAllocations:Hc(e),deliveryGroups:e.deliveryGroups,duties:e.totalDutyAmount,taxes:e.totalTaxAmount,i18n:this.i18n,formattedRecurringTotals:Gc(this.cart.lineItems,this.i18n)})}}async decelerateOrAbort(e){return e.abortReason==="out_of_stock"?(this.abortPaymentSheetAndShowOutOfStockModal(),!0):this.decelerateIfNeeded(e)}async decelerateIfNeeded(e){if(!e.data)return!1;const{checkoutUrl:n,totalAmount:r}=e.data;let a;if(e.decelerationReason&&fn.includes(e.decelerationReason)?a=e.decelerationReason:Nr({currentCartTotal:r,initialBuyerCurrency:this.buyerCurrency})&&(a="currency_changed"),a){try{await this.terminateSession()}finally{U({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=j(N.SheetLoad,this.name);e&&($({event:M.SheetLoaded,ttl:e}),y.sheetLoaded({instrument:this.name,measurement:e}))}withActiveSession(e,n){var r,a;if((a=(r=this.abortController)==null?void 0:r.signal)!=null&&a.aborted){y.walletSessionAbortError({instrument:this.name,errorName:"SessionAlreadyTerminated",reason:e});return}try{return n()}catch(i){if(i instanceof Error&&i.name==="InvalidAccessError"){y.walletSessionAbortError({instrument:this.name,errorName:"InvalidAccessError",reason:e});return}throw i}}}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}const Lt=new Map;function Le({instrumentName:t,logoType:e="LIGHT",logoContent:n}){const r=Lt.get(t)||{};r[e]||(r[e]=n,Lt.set(t,r))}function ht({instrumentName:t,logoType:e="LIGHT"}){var n;const r=(n=Lt.get(t))==null?void 0:n[e];if(!r)throw new Error("".concat(t," ").concat(e," logo not loaded"));return r}class Hd extends Ee{constructor(){super(...arguments),c(this,"name",f.ApplePay),c(this,"button",null)}static get observedAttributes(){return["disabled"]}get merchantName(){return this.walletParams.merchantName}connectedCallback(){this.cleanupOnFailure(this.render.bind(this),this.name)}attributeChangedCallback(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]);Je(N.SheetLoad,this.name);let i;try{if(i=new Bd({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(),y.sheetClicked({instrument:this.name,result:"success"})}catch(o){_.notify(o),y.sheetClicked({instrument:this.name,result:"failed"}),i==null||i.terminateSession(),F(n.translate("brand.apple_pay"),n),this.disabled=!1}}async render(){var e;const n=this.getOrCreateShadowRoot(),{translate:r}=await this.i18n,a=ht({instrumentName:f.ApplePay}),i=new DOMParser().parseFromString(a,"image/svg+xml").documentElement;if(!this.button){const o=this.isCTA?r("buy_with_button_content",{wallet:r("brand.apple_pay")}):r("brand.apple_pay");if(this.button=Ht({label:o}),this.button.onclick=s=>this.handleClick(s),this.button.classList.add("apple-pay-button",ui[this.buttonTheme],Oe.BUTTON),this.isCTA){const s=Fr({translate:r,logoElement:i,setAriaHidden:!0});s.classList.add("apple-pay--content"),this.button.appendChild(s)}else this.button.appendChild(i);this.initializeShadowStyles(n,Dc),n.appendChild(this.button),this.ensureLightDOMIsNotEmpty(),(e=this.onRendered)==null||e.call(this)}this.disabled&&(this.button.setAttribute("disabled",""),this.button.setAttribute("aria-disabled","true"))}}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}}async function Xe({svg:t,instrumentName:e,logoType:n="LIGHT"}){var r;if((r=Lt.get(e))!=null&&r[n])return;let a,i,o;try{if(o=$d(t),a=await fetch(o,{headers:{Accept:"image/svg+xml"}}),!a.ok)throw new Error("Failed to fetch SVG: ".concat(a.status," ").concat(a.statusText));if(i=await a.text(),!i||!i.includes("