import{aB as t,d as e,B as n,aC as i,aD as s,aE as o,_ as a,aF as r,Q as l,aG as h,O as p,aH as c,aI as m,p as d,M as u,aJ as y,aK as f,aL as _,aM as b,aN as g,aO as v,aP as C,P as w,aQ as k,aR as x,ad as P,ae as L,$ as T,g as S,e as q,I as M,ah as I,o as A,b as B,f as O,c as F,aS as $,aT as z,W as E,k as R,aU as N,aV as j,H as V,J as H,aA as Z}from"./chunk.common_a0168284.esm.js";const U=(t,e)=>e.every((e=>e in t));function J(e,n){return null!=e&&("cart"===(null==e?void 0:e.type)?function(e,n){const i=U(e,["min_price","max_price","price","eligible","number_of_payment_terms","available_loan_types"]);i||n(t.Cart,JSON.stringify(e))}(e,n):function(e,n){var i;const s=U(e,["variants","max_price","min_price","number_of_payment_terms"]),o=(null===(i=e.variants)||void 0===i?void 0:i.length)>0&&U(e.variants[0],["id","price","eligible","available_loan_types","available"]);s&&o||n(t.Product,JSON.stringify(e))}(e,n),U(e,["min_price","max_price"]))}function W(e,n){return null!=e&&(e.type===t.Cart?function(e,n){const i=U(e,["min_price","max_price","price_per_term","eligible","number_of_payment_terms","full_price","financing_plans"]);if(!i)return null==n||n(t.Cart,JSON.stringify(e)),!1;return!0}(e,n):e.type===t.Checkout?function(e,n){const i=U(e,["min_price","max_price","price_per_term","eligible","number_of_payment_terms","full_price","financing_plans"]);if(!i)return null==n||n(t.Checkout,JSON.stringify(e)),!1;return!0}(e,n):function(e,n){var i;const s=U(e,["variants","max_price","min_price","financing_plans"]),o=(null===(i=e.variants)||void 0===i?void 0:i.length)>0&&U(e.variants[0],["id","price_per_term","eligible","full_price","available"]);if(!s||!o)return null==n||n(t.Product,JSON.stringify(e)),!1;return!0}(e,n))}class D extends HTMLElement{constructor(){super(),this.s_a=!1,this.s_b=document.createElement("div"),this.attachShadow({mode:"open"})}static get observedAttributes(){return["variant-id","shopify-meta"]}connectedCallback(){var t;const e=this.s_c();this.shadowRoot||n.notify(new Error("ShopifyPaymentTerms: shadowRoot is null.")),null===(t=this.shadowRoot)||void 0===t||t.appendChild(e),this.s_b=e,this.s_a=!0}attributeChangedCallback(){var t;if(this.s_a){const e=this.s_c();null===(t=this.shadowRoot)||void 0===t||t.replaceChild(e,this.s_b),this.s_b=e}}disconnectedCallback(){var t,e;(null===(t=this.shadowRoot)||void 0===t?void 0:t.contains(this.s_b))&&(null===(e=this.shadowRoot)||void 0===e||e.removeChild(this.s_b))}s_c(){const t=this.getAttribute("shopify-meta"),e=this.getAttribute("variant-id"),n=Boolean(t&&W(JSON.parse(t))),i=document.createElement(n?"shop-pay-installments-banner":"shop-pay-banner");return e&&i.setAttribute("variant-id",e),t&&i.setAttribute("shopify-meta",t),i}}const G='\n \n

\n \n \n

\n',Q=t=>``,Y="Affirm",K="\n#shopify-payment-terms-modal .visually-hidden {\n border: 0;\n clip: rect(0, 0, 0, 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n}\n\n#shopify-payment-terms-modal .modal-wrapper {\n max-width: 432px;\n}\n\n#shopify-payment-terms-modal p {\n font-size: 18px;\n line-height: 150%;\n}\n\n#shopify-payment-terms-modal section {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,\n Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';\n}\n\n#shopify-payment-terms-modal .price {\n color: rgb(90, 49, 244);\n font-weight: 600;\n display: inline-flex;\n flex-direction: column;\n line-height: 1;\n align-items: center;\n}\n\n#shopify-payment-terms-modal .price__icon {\n width: 43px;\n height: 10px;\n}\n\n#shopify-payment-terms-modal .list {\n list-style: none;\n padding: 0;\n margin: 0;\n}\n\n#shopify-payment-terms-modal .list-item__subheading {\n font-size: 14px;\n line-height: 140%;\n color: rgba(0, 0, 0, 0.7);\n}\n\n#shopify-payment-terms-modal .btn__close--icon {\n display: inline-flex;\n flex-shrink: 0;\n padding: 16px;\n border-radius: 6px;\n}\n\n#shopify-payment-terms-modal .btn__close--icon:hover,\n#shopify-payment-terms-modal .btn__close--icon:active,\n#shopify-payment-terms-modal .btn__close--icon:focus {\n background-color: rgb(244, 241, 254);\n color: rgb(63, 34, 171);\n}\n\n#shopify-payment-terms-modal .help_text {\n margin-bottom: 19px;\n margin-top: 16px;\n font-size: 11px;\n line-height: 14px;\n color: rgba(0, 0, 0, 0.6);\n}\n\n#shopify-payment-terms-modal .help_text small {\n color: inherit;\n letter-spacing: 0.04rem;\n font-weight: 300;\n font-size: 11px;\n}\n\n#shopify-payment-terms-modal .help_text__link {\n color: rgba(0, 0, 0, 0.6);\n text-decoration: underline;\n}\n\n#shopify-payment-terms-modal .help_text__link:hover,\n#shopify-payment-terms-modal .help_text__link:active,\n#shopify-payment-terms-modal .help_text__link:focus {\n color: rgb(63, 34, 171);\n}\n\n#shopify-payment-terms-modal .tagline__bold {\n font-weight: 700;\n}\n\n#shopify-payment-terms-modal footer, #shopify-payment-terms-cover footer {\n text-align: center;\n}\n\n#shopify-payment-terms-modal .shop-pay-logo-wrapper,\n#shopify-payment-terms-cover .shop-pay-logo-wrapper {\n margin-bottom: 12px;\n}\n\n#shopify-payment-terms-modal .close__icon {\n width: 13px;\n height: 13px;\n}\n\n.affirm-logo,\n#shopify-payment-terms-modal .affirm-logo,\n#shopify-payment-terms-cover .affirm-logo {\n width: 39px;\n height: 21px;\n padding-left: 4px;\n box-sizing: content-box;\n}\n\n.affirm-logo-inline,\n#shopify-payment-terms-modal .affirm-logo-inline,\n#shopify-payment-terms-cover .affirm-logo-inline {\n margin-bottom: -6px;\n padding-left: 0px;\n}\n\n.affirm-text,\n#shopify-payment-terms-modal .affirm-text,\n#shopify-payment-terms-cover .affirm-text {\n display: flex;\n font-size: 12px;\n font-weight: 300;\n line-height: 150%;\n color: rgba(0, 0, 0, 0.6);\n justify-content: center;\n align-items: center;\n}\n\n.affirm-text small,\n#shopify-payment-terms-modal .affirm-text small,\n#shopify-payment-terms-cover .affirm-text small {\n font-size: 11px;\n letter-spacing: 0.04rem;\n line-height: 14px;\n}\n",X="Failed to construct 'HTMLElement': This instance is already constructed";class tt{constructor(t){this.s_d=t=>{this.s_e&&t.target!==this.s_f()&&!this.s_g(t)&&(t.preventDefault(),t.stopPropagation(),this.s_e.focus())},this.s_h=t=>{this.s_i&&t.target===this.s_j&&this.s_i.focus()},this.s_k=t}lock(){const t=this.s_k.querySelectorAll('a[href], button:not([disabled]):not([tabindex="-1"]');this.s_i=t[0],this.s_e=t[t.length-1],this.s_j=this.s_l(),this.s_k.appendChild(this.s_j),this.s_k.addEventListener("focus",this.s_h,!0),document.addEventListener("focus",this.s_d,!0)}release(t={}){this.s_k.removeEventListener("focus",this.s_h,!0),document.removeEventListener("focus",this.s_d,!0),this.s_m(),t instanceof HTMLElement&&t.focus()}s_l(){const t=document.createElement("button");return t.setAttribute("aria-hidden","true"),t.className="visually-hidden",t}s_m(){this.s_j&&this.s_k.removeChild(this.s_j)}s_g(t){const e=t.composedPath().find((t=>t instanceof Element&&t.ariaModal));return Boolean(e)}s_f(){const t=this.s_k.getRootNode();return t instanceof ShadowRoot?t.host:null}}function et(t){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}).format(t)}function nt(){var t,e,n;switch(null===(n=null===(e=null===(t=window.Shopify)||void 0===t?void 0:t.theme)||void 0===e?void 0:e.name)||void 0===n?void 0:n.toLowerCase()){case"boundless":case"brooklyn":return".cart__subtotal";case"dawn":return".totals__subtotal-value, .sections.cart.new_subtotal";case"debut":return".cart-subtotal__price";case"express":return".cart__subtotal, .cart-drawer__subtotal-value";case"minimal":return".h5.cart__subtotal-price";case"narrative":return".cart-subtotal__price, .cart-drawer__subtotal-number";case"simple":return".cart__subtotal.h3";case"supply":return".h1.cart-subtotal--price";case"venture":return".CartSubtotal"}return null}function it(){document.querySelector("[data-cart-subtotal]")||console.warn("[Shop Pay Installments] Cart price updates may not be handled automatically for this theme. To ensure the price shown in the Shop Pay Installments banner is updated correctly, follow the instructions found here: https://shopify.dev/themes/pricing-payments/installments#updating-the-banner-with-cart-total-changes")}function st(t){var e,n,i;const s="#FFF";if(!t)return s;const o=t.host.parentElement&&(null===(e=getComputedStyle(t.host.parentElement).getPropertyValue("--payment-terms-background-color"))||void 0===e?void 0:e.trim()),a=null===(n=getComputedStyle(document.documentElement).getPropertyValue("--payment-terms-background-color"))||void 0===n?void 0:n.trim(),r=null===(i=getComputedStyle(document.documentElement).getPropertyValue("--color-body"))||void 0===i?void 0:i.trim(),l=o||a||r;return l&&CSS.supports("color",l)?l:s}function ot(t){return parseFloat(t.replace(/[^0-9.]/g,""))}function at(t){const e=t.querySelector('select[name^="id"]')||t.querySelector('[name^="id"]');return e?Number(e.value):function(){const t=new URL(document.location.href).searchParams.get("variant");return t?Number(t):void 0}()}function rt(t){const e='';return t.isEnglish()?t.translate("modal.partnership",{affirmLogo:e}):t.translate("modal.partnership_disclaimer",{affirmLogo:e})}function lt(t,e,n){return{subTitle:t.translate("modal.subtitle.dynamic_pdp",{count:e,priceWithoutInterest:n}),legalCopy:t.translate("modal.legal.dynamic_pdp")}}function ht(t,e){return t.map((({pricePerTerm:t,apr:n,numberOfPaymentTerms:i,loanType:s})=>{const o=ot(t)*i,a=ot(e);return{pricePerTerm:t,apr:n,numberOfPaymentTerms:i,interest:et(0===n?0:o-a),totalPriceWithInterest:et(0===n?a:o),loanType:s}}))}function pt(t,e,n,i){const o=t.translate("modal.title"),a=t.translate("modal.sample_plan_contents.check_eligibility"),r=t.translate("modal.sample_plan_contents.interest"),l=t.translate("modal.sample_plan_contents.total"),h=t.translate("modal.sample_plan_contents.processing"),p=t.translate("modal.sample_plan_contents.processing_time"),c=rt(t),m=t.translate("modal.new_window"),d=t.translate("modal.close");return`\n \n
\n
\n
\n

${h}

\n

${p}

\n
\n
\n
\n ${mt(c)}\n ${dt()}\n
\n
\n
\n
\n \n \n `}function ct(t,e,n,i,s){return`\n \n `}function mt(t){return`\n
\n \n
\n
\n \n ${t}\n \n
`}function dt(){return''}class ut extends HTMLElement{constructor(t,e,n,i,s,a,r,l){super(),this.s_n=null,this.s_o=!0,this.s_p=!1,this.handleClose=()=>{this.s_q.trackModalAction(this.s_r,o.Close);const t=new Event("shopify_modal_close");this.dispatchEvent(t)},this.handleEscKey=t=>{"Escape"!==t.key&&"Esc"!==t.key||this.handleClose()},this.handleContinueToCheckout=()=>{this.s_o&&this.s_q.trackModalAction(this.s_r,o.ContinueToCheckout)},this.s_s=i,this.s_t=e,this.s_r=s,this.s_q=a,this.s_u=t,this.s_v=n,this.s_w=r,this.s_x=l,this.attachShadow({mode:"open",delegatesFocus:!0})}get focusLockTarget(){return this.rootContainer.querySelector("#shopify-payment-terms-modal")}get rootContainer(){return this.shadowRoot}connectedCallback(){return a(this,void 0,void 0,(function*(){this.s_p||(yield this.s_y(),yield this.s_z(),this.s_A=this.rootContainer.querySelectorAll(".btn__close"),this.s_A&&0!==this.s_A.length&&(this.s_A.forEach((t=>t.addEventListener("click",this.handleClose))),this.s_A[0].focus(),window.addEventListener("keydown",this.handleEscKey),this.s_p=!0))}))}disconnectedCallback(){this.s_A&&(this.s_A.forEach((t=>t.removeEventListener("click",this.handleClose))),window.removeEventListener("keydown",this.handleEscKey))}get price(){return this.getAttribute("price")||""}set price(t){this.setAttribute("price",t)}getModalToken(){return this.s_r}getModalType(){var t;return(null===(t=this.s_s)||void 0===t?void 0:t.length)&&this.s_t?this.s_s.includes(s.Interest)&&this.s_s.includes(s.SplitPay)?r.Adaptive:this.s_s.includes(s.SplitPay)?r.SplitPay:r.InterestOnly:r.Ineligible}determineListItemsByLoanTypes(t){return this.s_n?t&&t.includes(s.Interest)?[this.s_n.translate("modal.split_pay_contents.interest_fees"),this.s_n.translate("modal.split_pay_contents.interest_credit")]:[this.s_n.translate("modal.split_pay_contents.no_interest_fees"),this.s_n.translate("modal.split_pay_contents.no_interest_credit")]:["",""]}determineTextByLoanTypes(t,e,n,i,o,a){if(!this.s_n)return{subTitle:"",legalCopy:""};if(!t||!i)return this.getIneligibleMessage(n,a,o);if(t.includes(s.Interest)&&t.includes(s.SplitPay)){const t=[this.s_n.translate("modal.legal.interest_and_split_pay"),this.s_n.translate("modal.legal.rates_from_apr"),this.s_n.translate("modal.legal.ca_residents_notice")].filter(Boolean).join(" ");return{subTitle:this.s_n.translate("modal.subtitle.interest_and_split_pay",{splitPayLoanRepayment:e}),legalCopy:t}}if(t.includes(s.SplitPay)){const t=[this.s_n.translate("modal.legal.split_pay_only"),this.s_n.translate("modal.legal.ca_residents_notice")].filter(Boolean).join(" ");return{subTitle:this.s_n.translate("modal.subtitle.split_pay_only",{splitPayLoanRepayment:e}),legalCopy:t}}if(t.includes(s.Interest)){const t=[this.s_n.translate("modal.legal.rates_from_apr"),this.s_n.translate("modal.legal.ca_residents_notice")].filter(Boolean).join(" ");return{subTitle:this.s_n.translate("modal.subtitle.interest_only"),legalCopy:t}}return this.getIneligibleMessage(n,a,o)}getIneligibleMessage(t,e,n){if(!this.s_n)return{subTitle:"",legalCopy:""};const s=null==t?void 0:t.minPrice,o=null==t?void 0:t.maxPrice,a=s?ot(s):null,r=e?ot(e):null,l=[this.s_n.translate("modal.legal.ineligible"),this.s_n.translate("modal.legal.ca_residents_notice")].filter(Boolean).join(" ");if(!a||!o)return{subTitle:"",legalCopy:l};if(!r||r{price} with {shopPayLogo}",interest_only_eligible:"Split your purchase into monthly installments with {shopPayLogo}",dynamic_interest_only_eligible:"From {price}/mo with {shopPayLogo}",pay_in_4_or_as_low_as_eligible:"4 interest-free installments, or from {price}/mo with {shopPayLogo}",zero_interest_eligible:"From {price}/mo or 0% APR with {shopPayLogo}",zero_interest_eligible_zero_apr:"From {price}/mo at 0% APR with {shopPayLogo}",non_eligible_min:"Pay in 4 interest-free installments for orders over {minPrice} with {shopPayLogo}",non_eligible_monthly_payments_min:"Split your purchase into monthly installments for orders over {minPrice} with {shopPayLogo}",non_eligible_max:"Split your purchase into installments for orders up to {maxPrice} with {shopPayLogo}"},modal:{title:"Get it now, pay later",subtitle:{interest_and_split_pay:'Choose your payment schedule at checkout – starting at 4 interest-free payments of {splitPayLoanRepayment} every 2 weeks.',interest_only:"Choose your payment schedule at checkout to split your purchase into monthly installments.",split_pay_only:'Select installments at checkout to split your purchase into 4 interest-free payments of {splitPayLoanRepayment} every 2 weeks.',ineligible_min:"For orders over {minPrice}, select installments at checkout to split your purchase into 4 interest-free payments.",ineligible_monthly_payments_min:"For orders over {minPrice}, select installments at checkout to split your purchase into monthly payments.",ineligible_max:"For orders up to {maxPrice}, select installments at checkout to split your purchase into multiple payments.",dynamic_pdp:{one:"Sample plan for {priceWithoutInterest} purchase",other:"Sample plans for {priceWithoutInterest} purchase"}},close:"Close",new_window:"Opens in a new window.",partnership:"Installments in partnership with {affirmLogo}",partnership_disclaimer:"Installments in partnership with {affirmLogo}. Translation services are not provided by Affirm. Affirm and its offerings are only supported in English.",split_pay_contents:{interest_fees:"No hidden fees, ever.",interest_credit:"No impact on your credit score to apply.",no_interest_fees:"No fees, ever.",no_interest_credit:"No impact on your credit score."},sample_plan_contents:{continue_to_checkout:"Continue to checkout",unavailable:"Unavailable",check_eligibility:"By continuing, your information will be shared with Affirm.
Checking your qualification won’t affect your credit. ",apr:"APR",interest:"Interest",total:"Total",processing:"Processing your request",processing_time:"This can take up to a minute...",split_pay_frequency:'{pricePerTerm}  every 2 weeks',other_frequency:'{pricePerTerm}  every month',split_pay_number_of_terms:" for {numberOfTerms} weeks",other_number_of_terms:" for {numberOfTerms} months"},prequal_contents:{unavailable:"Unavailable",check:"Check if you qualify"},legal:{ca_residents_notice:"CA Residents: Loans by Affirm Loan Services, LLC are made or arranged pursuant to a California Finance Lender license.",rates_from_apr:'Rates from 0-36% APR. Payment options through Affirm are subject to an eligibility check, may not be available in all states, and are provided by these lending partners: affirm.com/lenders. Options depend on your purchase amount, and a down payment may be required.',interest_and_split_pay:"The estimated payment amount excludes taxes and shipping.",split_pay_only:"The estimated payment amount excludes taxes and shipping. Payment options are offered by Affirm and are subject to an eligibility check and might not be available in all states.",ineligible:"Payment options are offered by Affirm and are subject to an eligibility check and might not be available in all states.",dynamic_pdp:'The estimated payment amount excludes taxes and shipping. Rates range from 0-36% APR. Payment options through Shop Pay Installments are subject to an eligibility check and are provided by these lending partners: affirm.com/lenders. Options depend on your purchase amount, and a down payment may be required. More options may be available upon approval. State notices to consumers: affirm.com/licenses.'}}};this.s_n=new l({[t]:e})}catch(t){t instanceof Error&&n.notify(t)}}))}s_z(){return a(this,void 0,void 0,(function*(){if(!this.s_n)return;const t=document.createElement("template"),e=this.determineListItemsByLoanTypes(this.s_s),{subTitle:n,legalCopy:i}=this.determineTextByLoanTypes(this.s_s,this.s_u,this.s_v,this.s_t,this.s_x,this.s_w);t.innerHTML=function(t,e,n,i){const s=t.translate("modal.title"),o=t.translate("modal.close"),a=t.translate("modal.new_window"),r=rt(t);return`\n \n \n \n `}(this.s_n,n,i,e),this.rootContainer.appendChild(t.content.cloneNode(!0))}))}}const yt=t=>{const e=999999,n=document.createElement("div"),i=document.createElement("div");if(n.setAttribute("id","shopify-payment-terms-cover"),Object.assign(n.style,{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:e,background:"rgba(0,0,0,.3)"}),Object.assign(i.style,{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:e,background:"white",height:"max-content",width:"432px",maxWidth:"95%",maxHeight:"95%",margin:"auto",borderRadius:"7px",padding:"32px",boxSizing:"border-box",overflow:"auto",transition:"max-height ease-in 300ms"}),window.innerWidth<430&&Object.assign(i.style,{borderRadius:"0px",height:"auto",width:"auto",maxHeight:"100%",maxWidth:"100%"}),i.appendChild(t),i.addEventListener(h,(t=>{if(""===t.detail.height)return i.style.maxHeight="95%",void(i.style.overflow="auto");i.style.maxHeight=t.detail.height,i.style.overflow=t.detail.lockScroll?"hidden":"auto"})),"animate"in i){const t=[{opacity:0},{opacity:1}],e=[{transform:"translateY(-15%)",opacity:0},{transform:"translateY(0)",opacity:1}];i.animate(e,{fill:"forwards",duration:150}),n.animate(t,{fill:"forwards",duration:150})}n.appendChild(i),document.body.appendChild(n),document.body.dataset.paymentTermsInitialStyles=JSON.stringify({overflow:document.body.style.overflow}),document.body.style.overflow="hidden"},ft=()=>{const t=document.querySelector("#shopify-payment-terms-cover");if(t&&(document.body.removeChild(t),document.body.dataset.paymentTermsInitialStyles)){const t=JSON.parse(document.body.dataset.paymentTermsInitialStyles);document.body.style.overflow=t.overflow,document.body.style.position=t.position,delete document.body.dataset.initialStyles}};class _t extends p{constructor({elementName:t,analyticsTraceId:e,flow:n="",flowVersion:i="unspecified",shopId:s,checkoutVersion:o}){super({elementName:t,analyticsTraceId:e,flow:n,flowVersion:i,shopId:s,checkoutVersion:o}),this.s_B={},this.s_C={},this.s_D={},this.s_E=!1,this.s_F=!1}trackModalOpened(e,n,i,s,o,r,l){return a(this,void 0,void 0,(function*(){let a;if(a=e===t.Cart?`${e}-open`:`${n}-open`,this.s_B[a])return;this.s_B[a]=!0;const h=yield c("uniqToken","visitToken","microSessionId","microSessionCount","shopId","currency"),p=Object.assign(Object.assign({},h),{origin:e,modalToken:n,eligibleSpiPlanType:i,price:r,cartPermalink:l,spiPlanDetails:s,variantId:o,shopJsVersion:m});d({schemaId:u.InstallmentsModalOpened,payload:p},h,(()=>{this.s_B[a]=!1}))}))}trackModalAction(t,e,n){return a(this,void 0,void 0,(function*(){const i=`${t}-${e}`;if(this.s_B[i])return;this.s_B[i]=!0;const s=yield c("uniqToken","visitToken","microSessionId","microSessionCount","shopId"),o=Object.assign(Object.assign({},s),{modalToken:t,action:e,cartPermalink:n,shopJsVersion:m});d({schemaId:u.InstallmentsModalUserAction,payload:o},s,(()=>{this.s_B[i]=!1}))}))}trackInstallmentsBannerImpression(t,e,n,i,s,o,r){return a(this,void 0,void 0,(function*(){const a=r?String(r):"cart";if(this.s_C[a])return;this.s_C[a]=!0;const l=yield c("uniqToken","visitToken","shopId","microSessionId","contentLanguage","currency"),h=Object.assign(Object.assign({},l),{origin:t,bannerContent:e,eligible:n,bannerTemplateCodeSignature:i,price:o,shopJsVersion:m,hasPrequalLink:s,analyticsTraceId:this.analyticsTraceId||""});d({schemaId:u.InstallmentsBannerImpression,payload:h},l,(()=>{this.s_C[a]=!1}))}))}trackInstallmentsPrequalPopupPageImpression(t,e){return a(this,void 0,void 0,(function*(){if(this.s_D[e])return;this.s_D[e]=!0;const n={analyticsTraceId:this.analyticsTraceId,sellerId:t,pageType:e};d({schemaId:u.InstallmentsPrequalPopupPageImpression,payload:n},void 0,(()=>{this.s_D[e]=!1}))}))}trackInvalidInstallmentBannerMetadata(t,e){return a(this,void 0,void 0,(function*(){if(this.s_F)return;this.s_F=!0;const n=yield c("uniqToken","visitToken","microSessionId","microSessionCount","shopId"),i=Object.assign(Object.assign({},n),{origin:t,metadata:e,shopJsVersion:m});d({schemaId:u.InstallmentsInvalidMetadata,payload:i},n,(()=>{this.s_F=!1}))}))}trackInstallmentsBannerPrequalInteraction(t,e,n,i,s){return a(this,void 0,void 0,(function*(){if(this.s_E)return;this.s_E=!0;const o=yield c("uniqToken","visitToken","shopId","microSessionId","contentLanguage","currency"),a=Object.assign(Object.assign({},o),{origin:t,bannerContent:e,eligible:n,price:i,shopJsVersion:m,prequalLinkClicked:s,analyticsTraceId:this.analyticsTraceId});d({schemaId:u.InstallmentsBannerPrequalInteraction,payload:a},o,(()=>{this.s_E=!1}))}))}}class bt extends HTMLElement{constructor(){super(),this.s_G="$50",this.s_H="$3000",this.s_I=!1,this.s_t=!1,this.s_J=4,this.s_K=!1,this.s_s=[],this.s_L=t.Product,this.s_M="",this.s_a=!1,this.s_n=null,this.getContent=t=>{if(!this.s_n)return"";const e=Q(this.s_M);if(!this.s_s.length)return this.getIneligibleContent();if(this.s_s.includes(s.SplitPay))return this.s_n.translate("banner.split_pay_eligible",{price:t||"",shopPayLogo:e});return this.s_s.includes(s.Interest)?this.s_n.translate("banner.interest_only_eligible",{shopPayLogo:e}):this.getIneligibleContent()},this.getIneligibleContent=()=>{if(!this.s_n)return"";const t=Q(this.s_M);return this.s_n.translate("banner.non_eligible_min",{shopPayLogo:t,minPrice:this.s_G})},this.updateVariant=t=>{var e;const n=null===(e=this.s_N)||void 0===e?void 0:e.find((e=>Number(e.id)===t));return this.s_t=Boolean(null==n?void 0:n.eligible),this.s_s=(null==n?void 0:n.available_loan_types)||[],this.updateBannerPrice(null==n?void 0:n.price),(null==n?void 0:n.price)||""},this.calculatePricePerTerm=(t,e)=>{const n=e.apr/1200,i=e.installments_count;if(0===n)return et(t/i);return et(t*n*Math.pow(1+n,i)/(Math.pow(1+n,i)-1))},this.updateBannerPrice=t=>{var e;let n;n=this.s_t?this.getContent(t):this.getIneligibleContent();const i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("#shopify-installments-content");i&&(i.innerHTML=n)},this.s_q=new _t({elementName:"shop-pay-banner"}),this.s_O=new _t({elementName:"shopify-installments-modal"}),customElements.get("shopify-installments-modal")||customElements.define("shopify-installments-modal",ut),customElements.get("shop-pay-logo")||customElements.define("shop-pay-logo",y),this.attachShadow({mode:"open"}).innerHTML=G}static get observedAttributes(){return["variant-id","shopify-meta"]}initTranslations(){return a(this,void 0,void 0,(function*(){if(!this.s_n)try{const t=l.getDefaultLanguage(),e={affirm:"Affirm",shopPay:"Shop Pay",banner:{learn_more:"Learn more",view_sample_plans:"View sample plans",prequal:"Check your purchasing power",split_pay_eligible:"Pay in 4 interest-free installments of {price} with {shopPayLogo}",interest_only_eligible:"Split your purchase into monthly installments with {shopPayLogo}",dynamic_interest_only_eligible:"From {price}/mo with {shopPayLogo}",pay_in_4_or_as_low_as_eligible:"4 interest-free installments, or from {price}/mo with {shopPayLogo}",zero_interest_eligible:"From {price}/mo or 0% APR with {shopPayLogo}",zero_interest_eligible_zero_apr:"From {price}/mo at 0% APR with {shopPayLogo}",non_eligible_min:"Pay in 4 interest-free installments for orders over {minPrice} with {shopPayLogo}",non_eligible_monthly_payments_min:"Split your purchase into monthly installments for orders over {minPrice} with {shopPayLogo}",non_eligible_max:"Split your purchase into installments for orders up to {maxPrice} with {shopPayLogo}"},modal:{title:"Get it now, pay later",subtitle:{interest_and_split_pay:'Choose your payment schedule at checkout – starting at 4 interest-free payments of {splitPayLoanRepayment} every 2 weeks.',interest_only:"Choose your payment schedule at checkout to split your purchase into monthly installments.",split_pay_only:'Select installments at checkout to split your purchase into 4 interest-free payments of {splitPayLoanRepayment} every 2 weeks.',ineligible_min:"For orders over {minPrice}, select installments at checkout to split your purchase into 4 interest-free payments.",ineligible_monthly_payments_min:"For orders over {minPrice}, select installments at checkout to split your purchase into monthly payments.",ineligible_max:"For orders up to {maxPrice}, select installments at checkout to split your purchase into multiple payments.",dynamic_pdp:{one:"Sample plan for {priceWithoutInterest} purchase",other:"Sample plans for {priceWithoutInterest} purchase"}},close:"Close",new_window:"Opens in a new window.",partnership:"Installments in partnership with {affirmLogo}",partnership_disclaimer:"Installments in partnership with {affirmLogo}. Translation services are not provided by Affirm. Affirm and its offerings are only supported in English.",split_pay_contents:{interest_fees:"No hidden fees, ever.",interest_credit:"No impact on your credit score to apply.",no_interest_fees:"No fees, ever.",no_interest_credit:"No impact on your credit score."},sample_plan_contents:{continue_to_checkout:"Continue to checkout",unavailable:"Unavailable",check_eligibility:"By continuing, your information will be shared with Affirm.
Checking your qualification won’t affect your credit. ",apr:"APR",interest:"Interest",total:"Total",processing:"Processing your request",processing_time:"This can take up to a minute...",split_pay_frequency:'{pricePerTerm}  every 2 weeks',other_frequency:'{pricePerTerm}  every month',split_pay_number_of_terms:" for {numberOfTerms} weeks",other_number_of_terms:" for {numberOfTerms} months"},prequal_contents:{unavailable:"Unavailable",check:"Check if you qualify"},legal:{ca_residents_notice:"CA Residents: Loans by Affirm Loan Services, LLC are made or arranged pursuant to a California Finance Lender license.",rates_from_apr:'Rates from 0-36% APR. Payment options through Affirm are subject to an eligibility check, may not be available in all states, and are provided by these lending partners: affirm.com/lenders. Options depend on your purchase amount, and a down payment may be required.',interest_and_split_pay:"The estimated payment amount excludes taxes and shipping.",split_pay_only:"The estimated payment amount excludes taxes and shipping. Payment options are offered by Affirm and are subject to an eligibility check and might not be available in all states.",ineligible:"Payment options are offered by Affirm and are subject to an eligibility check and might not be available in all states.",dynamic_pdp:'The estimated payment amount excludes taxes and shipping. Rates range from 0-36% APR. Payment options through Shop Pay Installments are subject to an eligibility check and are provided by these lending partners: affirm.com/lenders. Options depend on your purchase amount, and a down payment may be required. More options may be available upon approval. State notices to consumers: affirm.com/licenses.'}}};this.s_n=new l({[t]:e})}catch(t){t instanceof Error&&n.notify(t)}}))}attributeChangedCallback(){this.s_a&&this.updateBanner()}connectedCallback(){return a(this,void 0,void 0,(function*(){yield this.initTranslations(),this.updateBanner(),this.s_a=!0}))}updateBanner(){try{const e=this.getAttribute("shopify-meta");if(e){const n=JSON.parse(e);this.s_M=st(this.shadowRoot),J(n,this.s_q.trackInvalidInstallmentBannerMetadata.bind(this.s_q))&&(n.type===t.Cart?(this.s_q.trackElementImpression(t.Cart),this.s_L=t.Cart,this.handleCartMeta(n)):(this.s_q.trackElementImpression(t.Product),this.s_L=t.Product,this.handleProductMeta(n))),this.updateLearnMoreButtonAndModal()}}catch(t){t instanceof TypeError&&t.message.match(X)?console.error(t):n.notify(t,(t=>{t.addMetadata("component",this.s_P())})),this.s_Q()}}updateLearnMoreButtonAndModal(){var t;return a(this,void 0,void 0,(function*(){if(!this.s_n)return;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".shopify-installments__learn-more"),n=f();if(e){e.innerHTML=this.s_n.translate("banner.learn_more"),this.s_q.trackInstallmentsBannerImpression(this.s_L,_.PayInFour,this.s_t,b.CustomizedByMerchant,!1,void 0,this.s_R);const t=()=>a(this,void 0,void 0,(function*(){if(this.s_u&&!this.s_I){this.s_I=!0,this.s_O.trackElementImpression(this.s_L);const t={minPrice:this.s_G,maxPrice:this.s_H},s=new ut(this.s_u,this.s_t,t,this.s_s,n,this.s_O,void 0,i.SplitPay);yield s.connectedCallback();const o=new tt(s.focusLockTarget);s.addEventListener("shopify_modal_close",(()=>{this.s_I=!1,ft(),o.release(e)})),yt(s),this.s_S(s,this.s_L),o.lock()}}));this.s_T&&e.removeEventListener("click",this.s_T),this.s_T=t,e.addEventListener("click",t)}}))}handleProductMeta(t){this.s_N=t.variants,this.s_G=t.min_price,this.s_U=ot(this.s_G),this.s_H=t.max_price,this.s_V=ot(this.s_H),this.s_R=Number(this.getAttribute("variant-id")),this.s_u=this.updateVariant(this.s_R),this.s_J=t.number_of_payment_terms;const e=this.s_W();if(e){const t=(n=0)=>{if(n>4)return;const i=at(e);i&&(this.s_R===i?setTimeout((()=>{t(n+1)}),100):(this.s_u=this.updateVariant(i),this.s_R=i,this.updateLearnMoreButtonAndModal()))};this.s_K||(this.s_K=!0,e.addEventListener("change",(()=>{t()})))}}handleCartMeta(t){const e=nt();this.s_G=t.min_price,this.s_U=ot(this.s_G),this.s_H=t.max_price,this.s_V=ot(this.s_H),this.s_s=t.available_loan_types,this.s_t=t.eligible,this.s_u=t.price,this.s_J=t.number_of_payment_terms,this.updateBannerPrice(this.s_u),e||it();new MutationObserver((t=>{t.forEach((t=>{if(t.target.nodeType!==Node.ELEMENT_NODE)return;const n=t.target;if((n.matches("[data-cart-subtotal]")||e&&n.matches(e))&&n.textContent){const t=ot(n.textContent);if(t){this.s_t=this.s_X(t);const e=this.s_Y(t);if(e){const t=et(e);this.s_u=t,this.updateBannerPrice(t)}}}}))})).observe(document,{attributes:!0,childList:!0,subtree:!0})}s_Y(t){if(!isNaN(t))return Math.floor(t/this.s_J*100)/100}s_X(t){return null!=this.s_U&&null!=this.s_V&&t>=this.s_U&&t<=this.s_V}s_S(t,e){this.s_O.trackModalOpened(e,t.getModalToken(),t.getModalType(),JSON.stringify([]),this.s_R,void 0)}s_W(){var t,e,n;return null===(n=null===(e=null===(t=this.shadowRoot)||void 0===t?void 0:t.host.parentNode)||void 0===e?void 0:e.host)||void 0===n?void 0:n.closest("form")}s_Q(){this.shadowRoot&&(this.shadowRoot.innerHTML="")}s_P(){return{name:"shop-pay-banner",shopifyMeta:this.getAttribute("shopify-meta"),variantId:this.getAttribute("variant-id")}}}class gt extends HTMLElement{constructor(t,e,n,i,s,a,r){var l;super(),this.s_n=null,this.s_Z=[],this.s_o=!0,this.s_p=!1,this.handleClose=()=>{this.s_q.trackModalAction(this.s_r,o.Close,this.s_aa);const t=new Event("shopify_modal_close");this.dispatchEvent(t)},this.handleEscKey=t=>{"Escape"!==t.key&&"Esc"!==t.key||this.handleClose()},this.handleContinueToCheckout=()=>{this.s_o&&this.s_q.trackModalAction(this.s_r,o.ContinueToCheckout,this.s_aa)},this.s_r=t,this.s_q=e,this.s_o=null===(l=null==a?void 0:a.available)||void 0===l||l,this.s_ba=n,this.s_w=i,this.s_ca=a,this.s_da=r,this.s_L=s}get focusLockTarget(){return this.querySelector("#shopify-payment-terms-modal")}get rootContainer(){return this}connectedCallback(){return a(this,void 0,void 0,(function*(){this.s_p||(yield this.s_y(),yield this.s_z(),this.s_A=this.querySelectorAll(".btn__close"),this.s_A&&0!==this.s_A.length&&(this.s_A.forEach((t=>t.addEventListener("click",this.handleClose))),this.s_A[0].focus(),this.s_ea&&this.s_ea.addEventListener("click",this.handleContinueToCheckout),window.addEventListener("keydown",this.handleEscKey),this.s_p=!0))}))}disconnectedCallback(){this.s_A&&(this.s_A.forEach((t=>t.removeEventListener("click",this.handleClose))),this.s_ea&&this.s_ea.removeEventListener("click",this.handleContinueToCheckout),window.removeEventListener("keydown",this.handleEscKey))}getModalSamplePlans(){return this.s_Z}getPermalink(){return this.s_aa}getModalToken(){return this.s_r}getModalType(){var t,e,n,i;if(null===(t=this.s_Z)||void 0===t?void 0:t.some((t=>0===t.apr&&t.loanType===s.Interest))){return(null===(e=this.s_Z)||void 0===e?void 0:e.every((t=>0===t.apr)))?r.ZeroInterestOnly:r.ZeroInterest}return(null===(n=this.s_Z)||void 0===n?void 0:n.some((t=>t.loanType===s.SplitPay)))&&(null===(i=this.s_Z)||void 0===i?void 0:i.some((t=>t.loanType===s.Interest)))?r.Adaptive:r.InterestOnly}getButtonText(){var t;return this.s_n?!1===(null===(t=this.s_ca)||void 0===t?void 0:t.available)?this.s_n.translate("modal.sample_plan_contents.unavailable"):this.s_n.translate("modal.sample_plan_contents.continue_to_checkout"):""}s_y(){return a(this,void 0,void 0,(function*(){if(!this.s_n)try{const t=l.getDefaultLanguage(),e={affirm:"Affirm",shopPay:"Shop Pay",banner:{learn_more:"Learn more",view_sample_plans:"View sample plans",prequal:"Check your purchasing power",split_pay_eligible:"Pay in 4 interest-free installments of {price} with {shopPayLogo}",interest_only_eligible:"Split your purchase into monthly installments with {shopPayLogo}",dynamic_interest_only_eligible:"From {price}/mo with {shopPayLogo}",pay_in_4_or_as_low_as_eligible:"4 interest-free installments, or from {price}/mo with {shopPayLogo}",zero_interest_eligible:"From {price}/mo or 0% APR with {shopPayLogo}",zero_interest_eligible_zero_apr:"From {price}/mo at 0% APR with {shopPayLogo}",non_eligible_min:"Pay in 4 interest-free installments for orders over {minPrice} with {shopPayLogo}",non_eligible_monthly_payments_min:"Split your purchase into monthly installments for orders over {minPrice} with {shopPayLogo}",non_eligible_max:"Split your purchase into installments for orders up to {maxPrice} with {shopPayLogo}"},modal:{title:"Get it now, pay later",subtitle:{interest_and_split_pay:'Choose your payment schedule at checkout – starting at 4 interest-free payments of {splitPayLoanRepayment} every 2 weeks.',interest_only:"Choose your payment schedule at checkout to split your purchase into monthly installments.",split_pay_only:'Select installments at checkout to split your purchase into 4 interest-free payments of {splitPayLoanRepayment} every 2 weeks.',ineligible_min:"For orders over {minPrice}, select installments at checkout to split your purchase into 4 interest-free payments.",ineligible_monthly_payments_min:"For orders over {minPrice}, select installments at checkout to split your purchase into monthly payments.",ineligible_max:"For orders up to {maxPrice}, select installments at checkout to split your purchase into multiple payments.",dynamic_pdp:{one:"Sample plan for {priceWithoutInterest} purchase",other:"Sample plans for {priceWithoutInterest} purchase"}},close:"Close",new_window:"Opens in a new window.",partnership:"Installments in partnership with {affirmLogo}",partnership_disclaimer:"Installments in partnership with {affirmLogo}. Translation services are not provided by Affirm. Affirm and its offerings are only supported in English.",split_pay_contents:{interest_fees:"No hidden fees, ever.",interest_credit:"No impact on your credit score to apply.",no_interest_fees:"No fees, ever.",no_interest_credit:"No impact on your credit score."},sample_plan_contents:{continue_to_checkout:"Continue to checkout",unavailable:"Unavailable",check_eligibility:"By continuing, your information will be shared with Affirm.
Checking your qualification won’t affect your credit. ",apr:"APR",interest:"Interest",total:"Total",processing:"Processing your request",processing_time:"This can take up to a minute...",split_pay_frequency:'{pricePerTerm}  every 2 weeks',other_frequency:'{pricePerTerm}  every month',split_pay_number_of_terms:" for {numberOfTerms} weeks",other_number_of_terms:" for {numberOfTerms} months"},prequal_contents:{unavailable:"Unavailable",check:"Check if you qualify"},legal:{ca_residents_notice:"CA Residents: Loans by Affirm Loan Services, LLC are made or arranged pursuant to a California Finance Lender license.",rates_from_apr:'Rates from 0-36% APR. Payment options through Affirm are subject to an eligibility check, may not be available in all states, and are provided by these lending partners: affirm.com/lenders. Options depend on your purchase amount, and a down payment may be required.',interest_and_split_pay:"The estimated payment amount excludes taxes and shipping.",split_pay_only:"The estimated payment amount excludes taxes and shipping. Payment options are offered by Affirm and are subject to an eligibility check and might not be available in all states.",ineligible:"Payment options are offered by Affirm and are subject to an eligibility check and might not be available in all states.",dynamic_pdp:'The estimated payment amount excludes taxes and shipping. Rates range from 0-36% APR. Payment options through Shop Pay Installments are subject to an eligibility check and are provided by these lending partners: affirm.com/lenders. Options depend on your purchase amount, and a down payment may be required. More options may be available upon approval. State notices to consumers: affirm.com/licenses.'}}};this.s_n=new l({[t]:e})}catch(t){t instanceof Error&&n.notify(t)}}))}s_z(){return a(this,void 0,void 0,(function*(){if(!this.s_n)return;const e=document.createElement("template");this.s_Z=ht(this.s_ba,this.s_w);const{subTitle:n,legalCopy:i}=lt(this.s_n,this.s_Z.length,this.s_w);e.innerHTML=pt(this.s_n,n,i,this.s_Z),this.appendChild(e.content.cloneNode(!0));const s=this.getElementsByClassName("navigation-buttons")[0];if(this.s_L===t.Checkout){const t=this.getElementsByClassName("check_eligibility")[0];return s.classList.add("hidden-navigation-buttons"),void t.classList.add("hidden-navigation-buttons")}const o=this.getButtonText();s.innerHTML=ct(window.location.origin,this.s_r,o,this.s_ca,this.s_da),this.s_ea=s.querySelector("shop-pay-button"),this.s_aa=this.s_da?this.s_da.token:g({storeUrl:window.location.origin,variants:this.s_ca?v(this.s_ca.idQuantityMapping):[],paymentOption:C.ShopPayInstallments,source:"installments_modal",sourceToken:this.s_r})}))}}var vt,Ct,wt;class kt extends HTMLElement{constructor(t,e,n,i,s,a,r,l,h,p){super(),vt.add(this),this.s_Z=[],this.s_fa=!1,this.s_ga=x.AuthorizeLoaded,this.s_n=null,this.s_p=!1,this.handleClose=()=>{this.s_q.trackModalAction(this.s_r,o.Close,this.s_aa);const t=new Event("shopify_modal_close");this.dispatchEvent(t);const e=document.querySelector(".prequal");e&&document.body.removeChild(e),this.s_ha()},this.handleEscKey=t=>{"Escape"!==t.key&&"Esc"!==t.key||!this.s_fa?"Escape"!==t.key&&"Esc"!==t.key||this.handleClose():this.s_ia()},this.handleOverlayClose=()=>{var t;null===(t=document.querySelector("installments-prequal-overlay-modal"))||void 0===t||t.remove()},this.handleBuyerOnboardingSuccess=()=>{this.handleOverlayClose(),this.s_ja()},this.handlePrequalFlowSideEffect=t=>{this.s_ka=!0;t.detail.shopPayInstallmentsOnboarded?this.s_ga=x.ResultsPageLoaded:this.s_ga=x.BuyerFormOverlayLoaded,this.s_la&&(this.removeCheckIfYouQualifyButtonLoading(),this.handleLoginCompleted())},this.handleLoginCompleted=()=>{if(this.s_la=!0,this.s_ka)switch(this.s_ga){case x.ResultsPageLoaded:this.s_ja();break;case x.BuyerFormOverlayLoaded:this.s_ma()}else this.addCheckIfYouQualifyButtonLoading()},this.addCheckIfYouQualifyButtonLoading=()=>{const t=P.Branded;this.s_na=L(t),this.s_na.classList.add("shop-status-indicator-loading"),this.s_oa.querySelector("shop-pay-button").classList.add("prequal-hidden-state"),this.s_oa.appendChild(this.s_na),this.s_na.connectedCallback(),this.s_na.setStatus({status:"loading",message:""})},this.removeCheckIfYouQualifyButtonLoading=()=>{this.s_na&&(this.s_oa.querySelector("shop-pay-button").classList.remove("prequal-hidden-state"),this.s_oa.removeChild(this.s_na))},this.s_r=t,this.s_q=e,this.s_pa=p||this.getAttribute(T)||S(),this.s_ca=l,this.s_da=h,this.s_s=n,this.s_t=i,this.s_qa=ot(a),this.s_ra=r,this.s_sa=s,this.s_w=a,this.attachShadow({mode:"open",delegatesFocus:!0})}get focusLockTarget(){return this.rootContainer.querySelector("#shopify-payment-terms-modal")}get rootContainer(){return this.shadowRoot}destroyIframe(){var t;null===(t=this.s_ta)||void 0===t||t.destroy()}connectedCallback(){return a(this,void 0,void 0,(function*(){this.s_p||(yield this.s_y(),yield this.s_z(),q(this,vt,"m",wt).call(this),window.addEventListener("keydown",this.handleEscKey),this.addOverlayEventListeners())}))}addOverlayEventListeners(){window.addEventListener("overlayClose",this.handleOverlayClose),window.addEventListener("buyerOnboardingSuccess",this.handleBuyerOnboardingSuccess),window.addEventListener("closeOverlayAndModal",(()=>{this.handleOverlayClose(),this.handleClose()})),this.s_p=!0}disconnectedCallback(){this.s_ia(),this.s_A&&(this.s_A.forEach((t=>t.removeEventListener("click",this.handleClose))),window.removeEventListener("keydown",this.handleEscKey),this.destroyIframe())}handlePostMessage(t){var e;switch(t.type){case"prequal_ready":null===(e=this.s_ua)||void 0===e||e.postMessage({type:"createprequal",amount:this.s_qa,currency:"USD",sellerId:Number(this.s_ra)});break;case"prequal_success":case"prequal_error":this.s_va();break;case"prequal_missing_information":this.s_wa(),this.s_ma();break;case"close":this.handleClose();break;case"continue_to_checkout":this.s_xa();break;case"resize_iframe":this.s_ya.style.height=t.height0===t.apr&&t.loanType===s.Interest))){return(null===(n=this.s_Z)||void 0===n?void 0:n.every((t=>0===t.apr)))?r.ZeroInterestOnly:r.ZeroInterest}return(null===(i=this.s_Z)||void 0===i?void 0:i.some((t=>t.loanType===s.SplitPay)))&&(null===(o=this.s_Z)||void 0===o?void 0:o.some((t=>t.loanType===s.Interest)))?r.Adaptive:r.InterestOnly}s_ja(){if(this.s_ya)return;this.s_na=L(P.Large);const t=this.s_za.querySelector(".shop-modal-content-processing-loading-container");null==t||t.insertBefore(this.s_na,t.firstChild),this.s_na.setStatus({status:"loading",message:""});const e=(t=>{const e=w.replace("https://","");return`${w}/pay/installments/prequalifications/authorize?shopify_domain=${window.location.hostname}&pay_domain=${e}&analytics_trace_id=${t}&redirect_source=${window.location.origin}`})(this.s_pa);this.s_ya=document.createElement("iframe"),this.s_ya.style.border="none",this.s_ya.src=e,this.s_Aa.appendChild(this.s_ya),this.s_Ba(),this.s_ta||(this.s_ta=this.createListener(new M(this.s_ya))),this.s_ua||(this.s_ua=new I(this.s_ya))}createListener(t){var e;const n=(null===(e=this.ownerDocument)||void 0===e?void 0:e.defaultView)||void 0;return new A(t,[w,B,window.location.origin],this.handlePostMessage.bind(this),n)}s_Ca(){return this.s_ra?Number.parseInt(this.s_ra,10):void 0}s_xa(){var t;const e=this.rootContainer.querySelector("shop-pay-button").shadowRoot,n=null==e?void 0:e.querySelector("shop-pay-button-base"),i=null===(t=null==n?void 0:n.shadowRoot)||void 0===t?void 0:t.querySelector("#shop-pay-button-link");null==i||i.dispatchEvent(new MouseEvent("click")),null==n||n.dispatchEvent(new Event("click")),this.s_q.trackInstallmentsPrequalPopupPageImpression(this.s_Ca(),x.ContinueToCheckoutClicked)}s_ma(){if(document.querySelector(".prequal-buyer-form-overlay"))return;const t=document.createElement("installments-prequal-overlay-modal");t.classList.add("prequal-buyer-form-overlay"),document.body.appendChild(t),this.s_q.trackInstallmentsPrequalPopupPageImpression(this.s_Ca(),x.BuyerFormOverlayLoaded)}s_ha(){const t=document.querySelector(".prequal-buyer-form-overlay");t&&document.body.removeChild(t)}s_Da(){const t=document.querySelector(".prequal");(null==t?void 0:t.requestShow)||n.notify(new Error(`shopLoginButton.requestShow is not defined: ${t}`)),null==t||t.requestShow(""),this.s_fa=!0,this.s_q.trackInstallmentsPrequalPopupPageImpression(this.s_Ca(),x.AuthorizeLoaded)}s_ia(){this.s_fa=!1}s_Ba(){q(this,vt,"m",Ct).call(this,"400px"),this.s_za.classList.remove("prequal-hidden-state"),this.s_Aa.classList.add("prequal-hidden-state"),this.s_Ea.classList.add("opaque-hidden"),this.s_q.trackInstallmentsPrequalPopupPageImpression(this.s_Ca(),x.ResultsPageLoading)}s_va(){var t,e,n,i;q(this,vt,"m",Ct).call(this,""),this.s_Ea.classList.add("prequal-hidden-state"),this.s_za.classList.add("prequal-hidden-state"),this.s_Aa.classList.remove("prequal-hidden-state"),this.s_Fa.innerHTML=(t=window.location.origin,e=this.s_r,n=this.s_ca,i=this.s_da,`\n \n`)}s_wa(){this.s_Ea.classList.remove("opaque-hidden"),this.s_za.classList.add("prequal-hidden-state"),this.s_Aa.classList.add("prequal-hidden-state")}getButtonText(t){return this.s_n?!1===(null==t?void 0:t.available)?this.s_n.translate("modal.prequal_contents.unavailable"):this.s_n.translate("modal.prequal_contents.check"):""}s_y(){return a(this,void 0,void 0,(function*(){if(!this.s_n)try{const t=l.getDefaultLanguage(),e={affirm:"Affirm",shopPay:"Shop Pay",banner:{learn_more:"Learn more",view_sample_plans:"View sample plans",prequal:"Check your purchasing power",split_pay_eligible:"Pay in 4 interest-free installments of {price} with {shopPayLogo}",interest_only_eligible:"Split your purchase into monthly installments with {shopPayLogo}",dynamic_interest_only_eligible:"From {price}/mo with {shopPayLogo}",pay_in_4_or_as_low_as_eligible:"4 interest-free installments, or from {price}/mo with {shopPayLogo}",zero_interest_eligible:"From {price}/mo or 0% APR with {shopPayLogo}",zero_interest_eligible_zero_apr:"From {price}/mo at 0% APR with {shopPayLogo}",non_eligible_min:"Pay in 4 interest-free installments for orders over {minPrice} with {shopPayLogo}",non_eligible_monthly_payments_min:"Split your purchase into monthly installments for orders over {minPrice} with {shopPayLogo}",non_eligible_max:"Split your purchase into installments for orders up to {maxPrice} with {shopPayLogo}"},modal:{title:"Get it now, pay later",subtitle:{interest_and_split_pay:'Choose your payment schedule at checkout – starting at 4 interest-free payments of {splitPayLoanRepayment} every 2 weeks.',interest_only:"Choose your payment schedule at checkout to split your purchase into monthly installments.",split_pay_only:'Select installments at checkout to split your purchase into 4 interest-free payments of {splitPayLoanRepayment} every 2 weeks.',ineligible_min:"For orders over {minPrice}, select installments at checkout to split your purchase into 4 interest-free payments.",ineligible_monthly_payments_min:"For orders over {minPrice}, select installments at checkout to split your purchase into monthly payments.",ineligible_max:"For orders up to {maxPrice}, select installments at checkout to split your purchase into multiple payments.",dynamic_pdp:{one:"Sample plan for {priceWithoutInterest} purchase",other:"Sample plans for {priceWithoutInterest} purchase"}},close:"Close",new_window:"Opens in a new window.",partnership:"Installments in partnership with {affirmLogo}",partnership_disclaimer:"Installments in partnership with {affirmLogo}. Translation services are not provided by Affirm. Affirm and its offerings are only supported in English.",split_pay_contents:{interest_fees:"No hidden fees, ever.",interest_credit:"No impact on your credit score to apply.",no_interest_fees:"No fees, ever.",no_interest_credit:"No impact on your credit score."},sample_plan_contents:{continue_to_checkout:"Continue to checkout",unavailable:"Unavailable",check_eligibility:"By continuing, your information will be shared with Affirm.
Checking your qualification won’t affect your credit. ",apr:"APR",interest:"Interest",total:"Total",processing:"Processing your request",processing_time:"This can take up to a minute...",split_pay_frequency:'{pricePerTerm}  every 2 weeks',other_frequency:'{pricePerTerm}  every month',split_pay_number_of_terms:" for {numberOfTerms} weeks",other_number_of_terms:" for {numberOfTerms} months"},prequal_contents:{unavailable:"Unavailable",check:"Check if you qualify"},legal:{ca_residents_notice:"CA Residents: Loans by Affirm Loan Services, LLC are made or arranged pursuant to a California Finance Lender license.",rates_from_apr:'Rates from 0-36% APR. Payment options through Affirm are subject to an eligibility check, may not be available in all states, and are provided by these lending partners: affirm.com/lenders. Options depend on your purchase amount, and a down payment may be required.',interest_and_split_pay:"The estimated payment amount excludes taxes and shipping.",split_pay_only:"The estimated payment amount excludes taxes and shipping. Payment options are offered by Affirm and are subject to an eligibility check and might not be available in all states.",ineligible:"Payment options are offered by Affirm and are subject to an eligibility check and might not be available in all states.",dynamic_pdp:'The estimated payment amount excludes taxes and shipping. Rates range from 0-36% APR. Payment options through Shop Pay Installments are subject to an eligibility check and are provided by these lending partners: affirm.com/lenders. Options depend on your purchase amount, and a down payment may be required. More options may be available upon approval. State notices to consumers: affirm.com/licenses.'}}};this.s_n=new l({[t]:e})}catch(t){t instanceof Error&&n.notify(t)}}))}s_z(){return a(this,void 0,void 0,(function*(){if(!this.s_n)return;const t=document.createElement("template");this.s_Z=ht(this.s_sa,this.s_w);const{subTitle:e,legalCopy:n}=lt(this.s_n,this.s_Z.length,this.s_w);t.innerHTML=pt(this.s_n,e,n,this.s_Z),this.rootContainer.innerHTML="",this.rootContainer.appendChild(t.content.cloneNode(!0)),this.s_za=this.rootContainer.querySelector(".shop-modal-content-processing"),this.s_Ea=this.rootContainer.querySelector(".modal-wrapper"),this.s_Aa=this.rootContainer.querySelector(".shop-modal-feature-iframe-wrapper"),this.s_oa=this.rootContainer.querySelectorAll(".navigation-buttons")[0],this.s_Fa=this.rootContainer.querySelectorAll(".continue-to-checkout-button")[0],this.s_aa=this.s_da?this.s_da.token:g({storeUrl:window.location.origin,variants:this.s_ca?v(this.s_ca.idQuantityMapping):[],paymentOption:C.ShopPayInstallments,source:"installments_modal",sourceToken:this.s_r})}))}}vt=new WeakSet,Ct=function(t){const e=new CustomEvent(h,{detail:{height:t,lockScroll:""!==t},bubbles:!0});this.dispatchEvent(e)},wt=function(){const t=this.getButtonText(this.s_ca);this.s_oa.innerHTML=ct("",this.s_r,t,this.s_ca,this.s_da);const e=this.s_oa.querySelector("shop-pay-button"),i=e.shadowRoot,s=null==i?void 0:i.querySelector("#shop-pay-button-link");null==s||s.setAttribute("href","#");const o=document.createElement("shop-login-button");o.setAttribute("action",O.Prequal),o.setAttribute("client-id",""),o.setAttribute("version","2"),o.setAttribute("analytics-context",F.Prequal),o.setAttribute("analytics-trace-id",this.s_pa),o.setAttribute("hide-button","true"),o.classList.add("prequal"),o.setAttribute("anchor-to","shop-pay-button"),document.body.appendChild(o),e.addEventListener("click",(()=>{switch(this.s_ga){case x.AuthorizeLoaded:const t=document.querySelector(".prequal");(null==t?void 0:t.requestShow)||n.notify(new Error("checkIfYouQualifyButton clicked: shopLoginButton.requestShow is not defined")),this.s_Da();break;case x.BuyerFormOverlayLoaded:this.s_ma();break;case x.ResultsPageLoaded:this.s_ja()}})),o.addEventListener("prequal_flow_side_effect",this.handlePrequalFlowSideEffect),o.addEventListener("completed",this.handleLoginCompleted),this.s_A=this.rootContainer.querySelectorAll(".btn__close"),this.s_A&&0!==this.s_A.length&&(this.s_A.forEach((t=>t.addEventListener("click",this.handleClose))),this.s_A[0].focus())};class xt extends HTMLElement{constructor(){super(),this.s_G="$50",this.s_H="$3000",this.s_I=!1,this.s_t=!1,this.s_Ga=4,this.s_K=!1,this.s_s=[],this.s_L=t.Product,this.s_M="",this.s_a=!1,this.s_Ha=!0,this.s_n=null,this.getContent=e=>{if(!this.s_n)return"";if(this.s_L===t.Checkout)return"";const n=Q(this.s_M);if(!this.s_s.length)return this.getIneligibleContent();if(this.s_Ia&&this.s_Ja()){return 0===this.s_Ia.apr?this.s_n.translate("banner.zero_interest_eligible_zero_apr",{price:e,shopPayLogo:n}):this.s_n.translate("banner.zero_interest_eligible",{price:e,shopPayLogo:n})}if(this.s_Ia&&this.isInAdaptiveRangeWithoutZeroInterest())return this.s_n.translate("banner.pay_in_4_or_as_low_as_eligible",{price:e,shopPayLogo:n});if(this.s_s.includes(s.SplitPay))return this.s_n.translate("banner.split_pay_eligible",{price:e,shopPayLogo:n});return this.s_s.includes(s.Interest)?this.s_n.translate("banner.dynamic_interest_only_eligible",{price:e,shopPayLogo:n}):this.getIneligibleContent()},this.getIneligibleContent=()=>{if(!this.s_n)return"";const t=Q(this.s_M),e=this.s_x===i.Monthly?this.s_n.translate("banner.non_eligible_monthly_payments_min",{minPrice:this.s_G,shopPayLogo:t}):this.s_n.translate("banner.non_eligible_min",{minPrice:this.s_G,shopPayLogo:t});if(!this.s_Ka)return e;return ot(this.s_Ka)>ot(this.s_H)?this.s_n.translate("banner.non_eligible_max",{maxPrice:this.s_H,shopPayLogo:t}):e},this.updatePDPVariant=(t,e)=>{var n;const i=null===(n=this.s_N)||void 0===n?void 0:n.find((e=>Number(e.id)===t));if(!i||!i.full_price)return this.s_t=!1,this.s_s=[],this.updateBannerPrice(),"";this.s_t=i.eligible,this.s_s=this.s_La(i.full_price,e),this.s_Ha=i.available;const o=ot(i.full_price),a=this.s_Ma(o,e);if(!a)return this.updateBannerPrice(i.price_per_term),i.price_per_term;if(this.s_Ia=this.s_Na(a),this.s_Ia.loan_type===s.SplitPay)return this.updateBannerPrice(i.price_per_term),i.price_per_term;const r=this.calculatePricePerTerm(o,this.s_Ia);return this.updateBannerPrice(r),r},this.calculatePricePerTerm=(t,e)=>{const n=e.apr/1200,i=e.installments_count;if(0===n)return et(t/i);return et(t*n*Math.pow(1+n,i)/(Math.pow(1+n,i)-1))},this.updateBannerPrice=e=>{var n,i;let s;if(s=this.s_t&&e?this.getContent(e):this.getIneligibleContent(),this.s_L===t.Checkout){const t=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelector("#shopify-installments");null==t||t.classList.add("shopify-installments__inline")}const o=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector("#shopify-installments-content");o&&(o.innerHTML=s)},this.s_pa=f(),this.s_q=new _t({elementName:"shop-pay-installments-banner",analyticsTraceId:this.s_pa}),this.s_O=new _t({elementName:"shopify-installments-modal",analyticsTraceId:this.s_pa}),customElements.get("shopify-installments-modal")||customElements.define("shopify-installments-modal",ut),customElements.get("shopify-installments-sample-plans-modal")||customElements.define("shopify-installments-sample-plans-modal",gt),customElements.get("shopify-installments-prequal-modal")||customElements.define("shopify-installments-prequal-modal",kt),customElements.get("shop-pay-logo")||customElements.define("shop-pay-logo",y),this.attachShadow({mode:"open"}).innerHTML=G}static get observedAttributes(){return["variant-id","shopify-meta"]}initTranslations(){return a(this,void 0,void 0,(function*(){if(!this.s_n)try{const t=l.getDefaultLanguage(),e={affirm:"Affirm",shopPay:"Shop Pay",banner:{learn_more:"Learn more",view_sample_plans:"View sample plans",prequal:"Check your purchasing power",split_pay_eligible:"Pay in 4 interest-free installments of {price} with {shopPayLogo}",interest_only_eligible:"Split your purchase into monthly installments with {shopPayLogo}",dynamic_interest_only_eligible:"From {price}/mo with {shopPayLogo}",pay_in_4_or_as_low_as_eligible:"4 interest-free installments, or from {price}/mo with {shopPayLogo}",zero_interest_eligible:"From {price}/mo or 0% APR with {shopPayLogo}",zero_interest_eligible_zero_apr:"From {price}/mo at 0% APR with {shopPayLogo}",non_eligible_min:"Pay in 4 interest-free installments for orders over {minPrice} with {shopPayLogo}",non_eligible_monthly_payments_min:"Split your purchase into monthly installments for orders over {minPrice} with {shopPayLogo}",non_eligible_max:"Split your purchase into installments for orders up to {maxPrice} with {shopPayLogo}"},modal:{title:"Get it now, pay later",subtitle:{interest_and_split_pay:'Choose your payment schedule at checkout – starting at 4 interest-free payments of {splitPayLoanRepayment} every 2 weeks.',interest_only:"Choose your payment schedule at checkout to split your purchase into monthly installments.",split_pay_only:'Select installments at checkout to split your purchase into 4 interest-free payments of {splitPayLoanRepayment} every 2 weeks.',ineligible_min:"For orders over {minPrice}, select installments at checkout to split your purchase into 4 interest-free payments.",ineligible_monthly_payments_min:"For orders over {minPrice}, select installments at checkout to split your purchase into monthly payments.",ineligible_max:"For orders up to {maxPrice}, select installments at checkout to split your purchase into multiple payments.",dynamic_pdp:{one:"Sample plan for {priceWithoutInterest} purchase",other:"Sample plans for {priceWithoutInterest} purchase"}},close:"Close",new_window:"Opens in a new window.",partnership:"Installments in partnership with {affirmLogo}",partnership_disclaimer:"Installments in partnership with {affirmLogo}. Translation services are not provided by Affirm. Affirm and its offerings are only supported in English.",split_pay_contents:{interest_fees:"No hidden fees, ever.",interest_credit:"No impact on your credit score to apply.",no_interest_fees:"No fees, ever.",no_interest_credit:"No impact on your credit score."},sample_plan_contents:{continue_to_checkout:"Continue to checkout",unavailable:"Unavailable",check_eligibility:"By continuing, your information will be shared with Affirm.
Checking your qualification won’t affect your credit. ",apr:"APR",interest:"Interest",total:"Total",processing:"Processing your request",processing_time:"This can take up to a minute...",split_pay_frequency:'{pricePerTerm}  every 2 weeks',other_frequency:'{pricePerTerm}  every month',split_pay_number_of_terms:" for {numberOfTerms} weeks",other_number_of_terms:" for {numberOfTerms} months"},prequal_contents:{unavailable:"Unavailable",check:"Check if you qualify"},legal:{ca_residents_notice:"CA Residents: Loans by Affirm Loan Services, LLC are made or arranged pursuant to a California Finance Lender license.",rates_from_apr:'Rates from 0-36% APR. Payment options through Affirm are subject to an eligibility check, may not be available in all states, and are provided by these lending partners: affirm.com/lenders. Options depend on your purchase amount, and a down payment may be required.',interest_and_split_pay:"The estimated payment amount excludes taxes and shipping.",split_pay_only:"The estimated payment amount excludes taxes and shipping. Payment options are offered by Affirm and are subject to an eligibility check and might not be available in all states.",ineligible:"Payment options are offered by Affirm and are subject to an eligibility check and might not be available in all states.",dynamic_pdp:'The estimated payment amount excludes taxes and shipping. Rates range from 0-36% APR. Payment options through Shop Pay Installments are subject to an eligibility check and are provided by these lending partners: affirm.com/lenders. Options depend on your purchase amount, and a down payment may be required. More options may be available upon approval. State notices to consumers: affirm.com/licenses.'}}};this.s_n=new l({[t]:e})}catch(t){t instanceof Error&&n.notify(t)}}))}attributeChangedCallback(){this.s_a&&this.updateBanner()}connectedCallback(){return a(this,void 0,void 0,(function*(){yield this.initTranslations(),this.updateBanner(),this.s_a=!0}))}isInAdaptiveRangeWithoutZeroInterest(){return this.s_t&&!this.s_Ja()&&2===this.s_s.length&&this.s_s.includes(s.SplitPay)&&this.s_s.includes(s.Interest)}updateBanner(){try{const n=this.getAttribute("shopify-meta");if(n){const o=JSON.parse(n);this.s_M=st(this.shadowRoot);const a=this.s_Oa(o.financing_plans);this.s_x=(e=a)&&(e.includes(s.Interest)&&!e.includes(s.SplitPay)||e.includes(s.ZeroPercent))?i.Monthly:i.SplitPay,W(o,this.s_q.trackInvalidInstallmentBannerMetadata.bind(this.s_q))&&(o.type===t.Cart?(this.s_q.trackElementImpression(t.Cart),this.s_L=t.Cart,this.handleCartOrCheckoutMeta(o)):o.type===t.Checkout?(this.s_q.trackElementImpression(t.Checkout),this.s_L=t.Checkout,this.handleCartOrCheckoutMeta(o)):(this.s_q.trackElementImpression(t.Product),this.s_L=t.Product,this.handleProductMeta(o))),this.updateLearnMoreButtonAndModal()}}catch(t){t instanceof TypeError&&t.message.match(X)?console.error(t):n.notify(t,(t=>{t.addMetadata("component",this.s_P())})),this.s_Q()}var e}s_Ca(){return this.s_ra?Number.parseInt(this.s_ra,10):void 0}updateLearnMoreButtonAndModal(){var e;return a(this,void 0,void 0,(function*(){if(!this.s_n)return;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".shopify-installments__learn-more"),i=f();if(n){const e=1===this.s_s.length&&this.s_s[0]===s.Interest,{s_Ka:o,s_ba:r}=this,l=(null==r?void 0:r.length)&&o&&(this.s_Ja()||e||this.isInAdaptiveRangeWithoutZeroInterest()),h=Boolean(this.s_t&&this.s_Pa);h?n.innerHTML=this.s_n.translate("banner.prequal"):this.s_t&&l?n.innerHTML=this.s_n.translate("banner.view_sample_plans"):n.innerHTML=this.s_n.translate("banner.learn_more"),this.s_q.trackInstallmentsBannerImpression(this.s_L,this.s_Qa(Boolean(l)),this.s_t,b.Standard,h,this.s_Ka,this.s_R),this.s_L===t.Cart&&l&&(this.s_Ra=yield this.s_Sa());const p=()=>a(this,void 0,void 0,(function*(){if(!this.s_u)return;const e=this.s_W(),s=this.s_L===t.Product?function(t){if(!t)return 1;const e=t.elements.quantity;if(e)return Number(e.value);const n=t.getAttribute("id"),i=null==n?void 0:n.replace("product-form-installment-",""),s=document.getElementById(`Quantity-${i}`);return s?Number(s.value):1}(e):void 0;if(!this.s_I){this.s_I=!0,this.s_O.trackElementImpression(this.s_L);const t={minPrice:this.s_G,maxPrice:this.s_H},e=s?this.buildVariantInfo(s):void 0;let a;this.s_Pa&&this.s_t?(a=new kt(i,this.s_O,this.s_s,this.s_t,r||[],o||"",this.s_ra,e,this.s_Ra,this.s_pa),this.s_O.trackInstallmentsBannerPrequalInteraction(this.s_L,this.s_Qa(!1),this.s_t,o||"",!0)):a=l?new gt(i,this.s_O,r,o,this.s_L,e,this.s_Ra):new ut(this.s_u,this.s_t,t,this.s_s,i,this.s_O,this.s_Ka,this.s_x),yield a.connectedCallback();const h=new tt(a.focusLockTarget);a.addEventListener("shopify_modal_close",(()=>{this.s_I=!1,ft(),h.release(n)})),this.s_Pa&&this.s_O.trackInstallmentsPrequalPopupPageImpression(this.s_Ca(),x.IntroPageLoaded),yt(a),this.s_S(a,this.s_L),h.lock()}}));this.s_T&&n.removeEventListener("click",this.s_T),this.s_T=p,n.addEventListener("click",p)}}))}handleProductMeta(t){this.s_N=t.variants,this.s_G=t.min_price,this.s_U=ot(this.s_G),this.s_H=t.max_price,this.s_V=ot(this.s_H),this.s_R=Number(this.getAttribute("variant-id")),this.s_Ka=this.s_Ta(this.s_R),this.s_u=this.updatePDPVariant(this.s_R,t.financing_plans),this.s_ra=t.seller_id,this.s_Pa=t.installments_buyer_prequalification_enabled,this.s_Ua(t.financing_plans,this.s_Ka);const e=this.s_W();if(e){const n=(i=0)=>{if(i>4)return;const s=at(e);s&&(this.s_R===s?setTimeout((()=>{n(i+1)}),100):(this.s_u=this.updatePDPVariant(s,t.financing_plans),this.s_Ka=this.s_Ta(s),this.s_Ua(t.financing_plans,this.s_Ka),this.s_R=s,this.updateLearnMoreButtonAndModal()))};this.s_K||(this.s_K=!0,e.addEventListener("change",(()=>{n()})))}}handleCartOrCheckoutMeta(t){const e=nt();this.s_G=t.min_price,this.s_U=ot(this.s_G),this.s_H=t.max_price,this.s_V=ot(this.s_H),this.s_Ka=t.full_price,this.s_s=this.s_La(this.s_Ka,t.financing_plans),this.s_t=t.eligible,this.s_Ia=this.getFinancingTermForCart(this.s_Ka,t.financing_plans),this.s_ra=t.seller_id,this.s_Pa=t.installments_buyer_prequalification_enabled,this.s_u=this.s_Ia?this.getCartPricePerTerm(this.s_Ka,this.s_Ia):t.price_per_term,this.s_Ga=this.s_Ia?this.s_Ia.installments_count:t.number_of_payment_terms,this.updateBannerPrice(this.s_u),this.s_s.length&&this.s_Ua(t.financing_plans,t.full_price),e||it();new MutationObserver((t=>{t.forEach((t=>{if(t.target.nodeType!==Node.ELEMENT_NODE)return;const n=t.target;if((n.matches("[data-cart-subtotal]")||e&&n.matches(e))&&n.textContent){const t=ot(n.textContent);if(t){this.s_Ka=n.textContent,this.s_t=this.s_X(t);const e=this.s_Y(t);if(e){const t=et(e);this.s_u=t,this.updateBannerPrice(t)}}}}))})).observe(document,{attributes:!0,childList:!0,subtree:!0})}buildVariantInfo(t){return{idQuantityMapping:`${this.s_R}:${t}`,available:this.s_Ha}}getCartPricePerTerm(t,e){const n=ot(t);return this.calculatePricePerTerm(n,e)}getFinancingTermForCart(t,e){const n=ot(t),i=this.s_Ma(n,e);if(i)return this.s_Na(i)}s_Ta(t){var e;const n=null===(e=this.s_N)||void 0===e?void 0:e.find((e=>Number(e.id)===t));return null==n?void 0:n.full_price}s_Sa(){return a(this,void 0,void 0,(function*(){const t=$(window.location.origin);if(t)return z(t)}))}s_Oa(t){const e=t?t[0]:null;if(!e)return[];return e.terms.map((t=>t.loan_type===s.SplitPay?s.SplitPay:0===t.apr?s.ZeroPercent:s.Interest))}s_Ma(t,e){return e.find((e=>{const n=ot(e.min_price),i=ot(e.max_price);return t>=n&&t<=i}))}s_Na(t){const e=t.terms.reduce(((t,e)=>e.installments_count>t.installments_count?e:t));if(this.s_Ja())return e;const n=t.terms.find((t=>t.loan_type===s.SplitPay));return n&&!this.isInAdaptiveRangeWithoutZeroInterest()?n:e}s_Ua(t,e){if(!e)return;const n=ot(e),i=this.s_Ma(n,t);i&&(this.s_ba=this.s_Va(i.terms).map((t=>({pricePerTerm:this.calculatePricePerTerm(n,t),apr:t.apr,numberOfPaymentTerms:t.installments_count,loanType:t.loan_type}))))}s_Va(t){if(t.length<3)return t;if(this.isInAdaptiveRangeWithoutZeroInterest())return[t[0],t[t.length-1]];const e=t.filter((t=>t.loan_type!==s.SplitPay));return e.length<3?e:[e[0],e[e.length-1]]}s_Y(t){if(!isNaN(t))return Math.floor(t/this.s_Ga*100)/100}s_X(t){return null!=this.s_U&&null!=this.s_V&&t>=this.s_U&&t<=this.s_V}s_S(t,e){t instanceof ut?this.s_O.trackModalOpened(e,t.getModalToken(),t.getModalType(),JSON.stringify([]),this.s_R,this.s_Ka):this.s_O.trackModalOpened(e,t.getModalToken(),t.getModalType(),JSON.stringify(t.getModalSamplePlans()),this.s_R,this.s_Ka,t.getPermalink())}s_Qa(t){return t?this.isInAdaptiveRangeWithoutZeroInterest()?_.PayInFourAsLowAs:_.AsLowAs:_.PayInFour}s_Ja(){return this.s_s.includes(s.ZeroPercent)}s_La(t,e){if(!e||0===e.length||!t)return[];const n=ot(t),i=this.s_Ma(n,e);if(!i)return[];const o=new Set;return i.terms.forEach((t=>{t.loan_type===s.SplitPay?o.add(s.SplitPay):0===t.apr?o.add(s.ZeroPercent):o.add(s.Interest)})),Array.from(o)}s_W(){var t,e,n;return null===(n=null===(e=null===(t=this.shadowRoot)||void 0===t?void 0:t.host.parentNode)||void 0===e?void 0:e.host)||void 0===n?void 0:n.closest("form")}s_Q(){this.shadowRoot&&(this.shadowRoot.innerHTML="")}s_P(){return{name:"shop-pay-installments-banner",shopifyMeta:this.getAttribute("shopify-meta"),variantId:this.getAttribute("variant-id")}}}var Pt,Lt,Tt;class St extends E{constructor(){super(),Pt.add(this),Lt.set(this,void 0),customElements.get("shop-pay-logo")||customElements.define("shop-pay-logo",y)}connectedCallback(){const t=document.createElement("template");t.innerHTML='\n\n
\n \n

We need a bit more information.
\n Click continue and a new tab will open so you can provide your information securely.

\n Continue\n
\n',this.attachShadow({mode:"open"}).append(t.content.cloneNode(!0)),q(this,Pt,"m",Tt).call(this)}disconnectedCallback(){var t;null===(t=this.s_Wa)||void 0===t||t.destroy(),this.s_Wa=void 0}attributeChangedCallback(){}handlePostMessage(t){var e,n,i;"close"===t.type&&(null===(e=q(this,Lt,"f"))||void 0===e||e.close(),this.dispatchCustomEvent("overlayClose")),"prequal_buyer_upsert_successful"===t.type&&(null===(n=q(this,Lt,"f"))||void 0===n||n.close(),this.dispatchCustomEvent("buyerOnboardingSuccess")),"error"===t.type&&(null===(i=q(this,Lt,"f"))||void 0===i||i.close(),this.dispatchCustomEvent("closeOverlayAndModal"))}handleContinueButtonClick(){if(q(this,Lt,"f")&&!q(this,Lt,"f").closed)q(this,Lt,"f").focus(),this.addPostMessageEventListener();else{const t=`${k()}/shopify_pay/prequal_authorize?target_origin=${window.location.origin}`;R(this,Lt,N({url:t,width:500,height:750}),"f"),q(this,Lt,"f")&&(q(this,Lt,"f").focus(),this.addPostMessageEventListener())}}addPostMessageEventListener(){q(this,Lt,"f")&&(this.s_Wa=new A(new j(q(this,Lt,"f")),[w],this.handlePostMessage.bind(this)))}}Lt=new WeakMap,Pt=new WeakSet,Tt=function(){var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("#installments-prequal-overlay-continue");e&&(e.onclick=()=>{this.handleContinueButtonClick()})},V()&&(H({bundle:"paymentTerms",bundleLocale:"en"}),Z(),e("shopify-payment-terms",D),e("shop-pay-banner",bt),e("shop-pay-installments-banner",xt),e("installments-prequal-overlay-modal",St)); //# sourceMappingURL=client.payment-terms_42e93cfc.en.esm.js.map