@primer-io/primer-js 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- import{a as Gi,b as fn,c as zr,d as n}from"./chunks/chunk.G45OCYEN.js";var wr=fn((zt,vi)=>{(function(i,t){typeof zt=="object"&&typeof vi=="object"?vi.exports=t():typeof define=="function"&&define.amd?define([],t):typeof zt=="object"?zt.Primer=t():i.Primer=t()})(zt,()=>(()=>{"use strict";let i;var t,e,r={};r.d=(a,l)=>{for(var c in l)r.o(l,c)&&!r.o(a,c)&&Object.defineProperty(a,c,{enumerable:!0,get:l[c]})},r.o=(a,l)=>Object.prototype.hasOwnProperty.call(a,l),r.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{SuccessScreenType:()=>pn,PaymentFlow:()=>nn,ThreeDSecureStatus:()=>sn,TokenType:()=>ln,isStripeOptionsDropInWithFullMandateText:()=>cn,PaymentInstrumentType:()=>Ct,ErrorCode:()=>dn,EventTypes:()=>mn,CheckoutUXFlow:()=>an,HeadlessManagerType:()=>un,PaymentMethodType:()=>_t,Primer:()=>hn});let s={LEGACY:"legacy",V_2_4:"2.4"},m=s.V_2_4,C=m;class v extends Error{static from(l,c=!1){if(l instanceof v)return l;let E=new v(l instanceof Error?l.message:String(l),c);return l instanceof Error&&l.stack&&(E.stack=l.stack,Object.assign(E,l)),E}markAsReported(){this.isReported=!0}constructor(l,c=!1){super(l),function(E,A,x){A in E?Object.defineProperty(E,A,{value:x,enumerable:!0,configurable:!0,writable:!0}):E[A]=x}(this,"isReported",void 0),this.isReported=c,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let D="https://analytics.production.data.primer.io/sdk-logs";var F=function(a){return a.REQUEST_START="REQUEST_START",a.REQUEST_END="REQUEST_END",a}({}),$=function(a){return a.START="START",a.END="END",a}({});let te={createHeadless:"HEADLESS_LOADING",showUniversalCheckout:"DROP_IN_LOADING",showVaultManager:"VAULT_MANAGER_LOADING",preloadPrimer:"PRELOAD_PRIMER_LOADING"};var B=function(a){return a.NETWORK_CALL_EVENT="NETWORK_CALL_EVENT",a.CRASH_EVENT="CRASH_EVENT",a.TIMER_EVENT="TIMER_EVENT",a.MESSAGE_EVENT="MESSAGE_EVENT",a.V1_EVENT="V1_EVENT",a.SDK_FUNCTION_EVENT="SDK_FUNCTION_EVENT",a}({});async function tt(){if(typeof navigator>"u"||typeof performance>"u")return;let a=await navigator.getBattery?.();return{memoryFootprint:performance.memory?.usedJSHeapSize,screen:{height:screen?.height,width:screen?.width},userAgent:navigator.userAgent,locale:navigator.language,batteryLevel:a?.level,batteryStatus:a?.charging?"CHARGING":"NOT_CHARGING"}}let ka={get(a,l){let c;try{switch(a){case"PRIMER_SDK_VERSION":c="v2.53.4";break;case"PRIMER_ASSETS_URL":c=process.env.PRIMER_ASSETS_URL;break;case"PRIMER_BUILD_INTEGRATION_BUILDER":c=process.env.PRIMER_BUILD_INTEGRATION_BUILDER}}catch{}return c||l}}.get("PRIMER_SDK_VERSION");async function bi(a,l,c){return{...c,createdAt:Date.now(),device:await tt(),eventType:a,properties:l,sdkVersion:ka,sdkType:"WEB"}}let Ei=Symbol.for("__primerAnalytics__"),bt={providers:new Map,timers:new Map,eventsQueue:new Map};if(typeof window<"u"){let a=window[Ei];a?bt=a:window[Ei]=bt}let xi=()=>bt.providers,Ir=()=>bt.timers,Et=()=>bt.eventsQueue,Bt=new Map;function Lr(a,l=!1,c=1){Bt.has(a)&&(clearTimeout(Bt.get(a)),Bt.delete(a));let E=()=>{let x=Et().get(a);if(x?.length){let b=!0,M=[],N=0,S=0;for(;S<x.length;){let O=x[S],H=new Blob([JSON.stringify(O)]).size;if(H>64e3){console.error("Event size exceeds maximum payload size and will be skipped:",O),S++;continue}if(N+H>64e3&&M.length>0){try{b=navigator.sendBeacon(a,JSON.stringify(M))}catch(Y){b=!1,console.error("Unable to send events",Y)}if(!b)break;M=[],N=0}M.push(O),N+=H,S++}if(M.length>0&&b)try{b=navigator.sendBeacon(a,JSON.stringify(M))}catch(O){b=!1,console.error("Unable to send events",O)}b?Et().delete(a):c<5?setTimeout(()=>Lr(a,l,c+1),500*Math.pow(2,c)):console.error("Max retry attempts reached. Events will not be sent.")}};if(l)return void E();let A=setTimeout(E,500);Bt.set(a,A)}let Ci=!1;function Nr({url:a=D,...l}){typeof document>"u"||Ci||(document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){let A=rt(l.checkoutSessionId);A.messageEvent({messageType:"VISIBILITY_CHANGE",message:"Checkout visibility is hidden (tab or window change, redirect or being closed)."}),Lr(A.url,!0)}}),Ci=!0);let c=A=>async x=>{if(typeof navigator>"u")return;let b=function N(S,O,H=new WeakSet,Y=0,ae=10){if(Y>ae||H.has(S))return S;H.add(S);let ne=ie=>typeof ie=="object"&&ie!==null?N(ie,O,H,Y+1,ae):O(ie);return Array.isArray(S)?S.map(ne):Object.fromEntries(Object.entries(S).map(([ie,ot])=>[ie,ne(ot)]))}(await bi(A,x,l),N=>{var S;return typeof(S=typeof N=="function"?N.name||"function":N)=="string"&&S.length>5120?`${S.slice(0,5120)}...`:S});Et().has(a)||Et().set(a,[]),Et().get(a)?.push(b),Lr(a)},E={crashEvent:c(B.CRASH_EVENT),messageEvent:c(B.MESSAGE_EVENT),networkCallEvent:c(B.NETWORK_CALL_EVENT),sdkFunctionEvent:c(B.SDK_FUNCTION_EVENT),timerStart:({id:A,...x})=>{let b=`${l.checkoutSessionId}|${A}`,M=performance?.now?performance.now():Date.now();return Ir().set(b,{start:M}),c(B.TIMER_EVENT)({...x,id:A,timerType:$.START})},timerEnd:({id:A,...x})=>{let b=`${l.checkoutSessionId}|${A}`,{start:M}=Ir().get(b)??{};Ir().delete(b);let N=performance?.now?performance.now():Date.now();return c(B.TIMER_EVENT)({...x,id:A,timerType:$.END,duration:M?N-M:void 0})},v1Event:c(B.V1_EVENT),url:a};return xi().set(l.checkoutSessionId,E),rt(l.checkoutSessionId)}function rt(a){return new Proxy({},{get:(l,c)=>(xi().get(a)??Nr({checkoutSessionId:a}))[c]})}let Rr=(a,l,c,E)=>({callType:c?F.REQUEST_END:F.REQUEST_START,id:a,errorBody:c?.error&&JSON.stringify(c.error,Object.getOwnPropertyNames(c.error)),method:l.method,responseCode:c?.status,url:l.url,duration:E});function Ta(a){return a?new Promise(l=>{setTimeout(l,a)}):Promise.resolve()}async function _i(a,l,c,E=Ta){let A=0,x={enabled:l?.enabled??!1,maxRetries:8,initialBackoff:100,retryNetworkErrors:!0,retry500Errors:!1,maxJitter:100};if(!x.enabled)return a();for(;;)try{let b=await a();if(A){let M=`Request succeeded after ${A} retries.`;typeof b=="object"&&b&&"status"in b&&(M+=` Status code: ${b.status}`),c?.({messageType:"RETRY_SUCCESS",message:M,severity:"INFO"})}return b}catch(b){let M=A>=x.maxRetries,N=b.isNetworkError&&!x.retryNetworkErrors,S=b.status&&b.status>=500&&!x.retry500Errors;if(M||N||S){let Y=`Failed after ${A} retries. `;throw M?Y+=`Reached maximum retries (${x.maxRetries}).`:N?Y+="Network error encountered and retryNetworkErrors is disabled.":S&&(Y+="HTTP 500 error encountered and retry500Errors is disabled."),Y+=` Last error: ${b.message}`,c?.({messageType:"RETRY_FAILED",message:Y,severity:"ERROR",errorBody:JSON.stringify(b,Object.getOwnPropertyNames(b))}),Error(Y,{cause:b})}A++;let O=Math.min(x.initialBackoff*Math.pow(2,A-1)+Math.random()*x.maxJitter,Number.MAX_SAFE_INTEGER),H="Unknown error";b.isNetworkError?H="Network error":b.status&&(H=`HTTP ${b.status} error`),c?.({messageType:"RETRY",message:`Retry attempt ${A}/${x.maxRetries} due to: ${H}. Error details: ${b.message}. Waiting for ${O.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(b,Object.getOwnPropertyNames(b))}),await E(O)}}let Or={cache:new Map};typeof window<"u"&&((t=window)[e="__primerCache__"]??(t[e]=Or),Or=window.__primerCache__);let re=()=>Or.cache;function Ai(){if(re().size<=30)return;let a=Date.now();for(let[l,c]of re())c.exp<a&&re().delete(l);if(re().size>50)for(let[l]of re()){if(re().size<=50)break;re().delete(l)}}let Dr=()=>Mi.randomUUID?.()||wa(),wa=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(a^Pa()>>a/4).toString(16)),Pa=()=>(Mi.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,Mi=typeof crypto<"u"?crypto:{},Ia=(a,l,c)=>La(a,"get",l,c),La=async(a,l,c,E,A)=>{let x=Dr(),b=performance?.now(),M=rt(a),N={method:l,url:c,body:A};M.networkCallEvent(Rr(x,N));try{let S=await fetch(c,{body:A,method:l,headers:{"content-type":"application/json","x-request-id":x,...E}});if(!S.ok){let Y=Error(`HTTP error! status: ${S.status}`);throw Y.status=S.status,Y}let O=await S.json();if(c.includes("client-sdk/configuration")){let{primerAccountId:Y,clientSession:{clientSessionId:ae,customer:ne}}=O;M=Nr({checkoutSessionId:a,clientSessionId:ae,customerId:ne?.customerId,primerAccountId:Y,url:M.url})}let H=performance?.now();return M.networkCallEvent(Rr(x,N,{data:O},H-b)),{data:O,headers:S.headers,status:S.status,source:"NETWORK"}}catch(S){let O=performance?.now();throw Object.assign(S,{isNetworkError:S instanceof TypeError}),M.networkCallEvent(Rr(x,N,{error:S},O-b)),S}},Na=(a,l)=>new Promise((c,E)=>{let A=setTimeout(()=>{let x=Error("Request timed out");x.isNetworkError=!0,E(x)},l);a.then(c).catch(E).finally(()=>clearTimeout(A))}),Ra=(a,l)=>{let{headers:c,retryConfig:E,cacheConfig:A,timeout:x=15e3,checkoutSessionId:b}=l,M=rt(b);return function(N){if(!N)return ae=>ae();let{key:S,refresh:O=!1,usePrimerSessionCacheTtlHeader:H=!1,ttl:Y=36e5}=N;return async ae=>{let ne=Date.now(),ie=re().get(S);if(!O&&ie&&ie.exp>ne)return ie.promise;ie&&re().delete(S);let ot=ae().then(At=>{let Bi=Y;return H&&(Bi=1e3*(Number(At.headers.get("x-primer-session-cache-ttl"))||0)),function({key:Ki,ttl:ji=36e5},gn){ji?re().set(Ki,{promise:Promise.resolve({...gn,source:"CACHE"}),exp:Date.now()+ji}):re().delete(Ki)}({key:S,ttl:Bi},At),Ai(),At},At=>{throw re().delete(S),At});return re().set(S,{promise:ot,exp:ne+Y}),Ai(),ot}}(A)(()=>_i(()=>Na(Ia(b,a,c),x),E,N=>M.messageEvent({...N,url:a})))},it=typeof Buffer=="function",Si=typeof TextDecoder=="function"?new TextDecoder:void 0,ki=typeof TextEncoder=="function"?new TextEncoder:void 0,xt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),Kt=(a=>{let l={};return a.forEach((c,E)=>l[c]=E),l})(xt),Oa=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,K=String.fromCharCode.bind(String),Ti=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):a=>new Uint8Array(Array.prototype.slice.call(a,0)),wi=a=>a.replace(/=/g,"").replace(/[+\/]/g,l=>l=="+"?"-":"_"),Pi=a=>a.replace(/[^A-Za-z0-9\+\/]/g,""),Ii=typeof btoa=="function"?a=>btoa(a):it?a=>Buffer.from(a,"binary").toString("base64"):a=>{let l,c,E,A,x="",b=a.length%3;for(let M=0;M<a.length;){if((c=a.charCodeAt(M++))>255||(E=a.charCodeAt(M++))>255||(A=a.charCodeAt(M++))>255)throw TypeError("invalid character found");x+=xt[(l=c<<16|E<<8|A)>>18&63]+xt[l>>12&63]+xt[l>>6&63]+xt[63&l]}return b?x.slice(0,b-3)+"===".substring(b):x},$r=it?a=>Buffer.from(a).toString("base64"):a=>{let l=[];for(let c=0,E=a.length;c<E;c+=4096)l.push(K.apply(null,a.subarray(c,c+4096)));return Ii(l.join(""))},ns=(a,l=!1)=>l?wi($r(a)):$r(a),Da=a=>{if(a.length<2){var l=a.charCodeAt(0);return l<128?a:l<2048?K(192|l>>>6)+K(128|63&l):K(224|l>>>12&15)+K(128|l>>>6&63)+K(128|63&l)}var l=65536+(a.charCodeAt(0)-55296)*1024+(a.charCodeAt(1)-56320);return K(240|l>>>18&7)+K(128|l>>>12&63)+K(128|l>>>6&63)+K(128|63&l)},$a=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Va=a=>a.replace($a,Da),Li=it?a=>Buffer.from(a,"utf8").toString("base64"):ki?a=>$r(ki.encode(a)):a=>Ii(Va(a)),Ha=(a,l=!1)=>l?wi(Li(a)):Li(a),Ua=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Ya=a=>{switch(a.length){case 4:var l=((7&a.charCodeAt(0))<<18|(63&a.charCodeAt(1))<<12|(63&a.charCodeAt(2))<<6|63&a.charCodeAt(3))-65536;return K((l>>>10)+55296)+K((1023&l)+56320);case 3:return K((15&a.charCodeAt(0))<<12|(63&a.charCodeAt(1))<<6|63&a.charCodeAt(2));default:return K((31&a.charCodeAt(0))<<6|63&a.charCodeAt(1))}},za=a=>a.replace(Ua,Ya),Ni=typeof atob=="function"?a=>atob(Pi(a)):it?a=>Buffer.from(a,"base64").toString("binary"):a=>{if(a=a.replace(/\s+/g,""),!Oa.test(a))throw TypeError("malformed base64.");a+="==".slice(2-(3&a.length));let l,c="",E,A;for(let x=0;x<a.length;)l=Kt[a.charAt(x++)]<<18|Kt[a.charAt(x++)]<<12|(E=Kt[a.charAt(x++)])<<6|(A=Kt[a.charAt(x++)]),c+=E===64?K(l>>16&255):A===64?K(l>>16&255,l>>8&255):K(l>>16&255,l>>8&255,255&l);return c},Ri=it?a=>Ti(Buffer.from(a,"base64")):a=>Ti(Ni(a).split("").map(l=>l.charCodeAt(0))),ss=a=>Ri(Oi(a)),Fa=it?a=>Buffer.from(a,"base64").toString("utf8"):Si?a=>Si.decode(Ri(a)):a=>za(Ni(a)),Oi=a=>Pi(a.replace(/[-_]/g,l=>l=="-"?"+":"/")),Ba=a=>Fa(Oi(a)),ls=a=>({value:a,enumerable:!1,writable:!0,configurable:!0}),Di={encode:Ha,decode:Ba},Ka={encode:function(a,l={}){let{urlSafe:c=!1}=l;return Di.encode(a,c)},decode:Di.decode},$i="The provided `clientToken`",ja=`${$i} has expired`,Ga=`${$i} is malformed`,qa=(a,l,c)=>({"primer-client-token":a,"primer-sdk-client":"WEB","primer-sdk-version":"v2.53.4","primer-sdk-checkout-session-id":l,...c&&{"x-api-version":c}});async function Wa(a,l,c){let{accessToken:E,configurationUrl:A,analyticsUrlV2:x}=function(S){let O=function(Y){try{let[ae,ne]=Y.split(".");return JSON.parse(Ka.decode(ne||ae))}catch{throw Error(Ga)}}(S),H=1e3*O.exp;if(Date.now()>H)throw Error(`${ja}. Expiration date: ${new Date(H).toISOString()}`);return O}(a),b=Nr({checkoutSessionId:l,url:x}),M=C,N=M!==s.LEGACY?M:"2.3";b.timerStart({id:"CONFIGURATION_LOADING"});try{let{data:S,source:O}=await Ra(`${A}/?withDisplayMetadata=true`,{checkoutSessionId:l,headers:qa(E,l,N),retryConfig:{enabled:!0},cacheConfig:c});return b.timerEnd({id:"CONFIGURATION_LOADING",context:{source:O}}),S}catch(S){let O=S instanceof Error?S.message:"Unknown error occurred";throw Error(`Failed to initialize client: ${O}`)}}function Vi(a){return a instanceof Error?{errorBody:a.message,stacktrace:a.stack}:typeof a=="object"&&a!==null&&"message"in a?{errorBody:String(a.message),stacktrace:"stack"in a?String(a.stack):void 0}:{errorBody:String(a||"Unknown error")}}function jt({checkoutSessionId:a,analytics:l,error:c,reporter:E}){l?.crashEvent?l.crashEvent({...Vi(c),reporter:E}):a&&Vr(a,c,E)}async function Vr(a,l,c){let E=await bi(B.CRASH_EVENT,{...Vi(l),reporter:c},{checkoutSessionId:a});try{await fetch(D,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)})}catch(A){console.error("Failed to post crash event",A)}}let Hi=Symbol.for("initGlobalErrorMonitoringLoaded"),Ui=(a,l)=>{typeof window<"u"&&window[Hi]||(window[Hi]=!0,window.addEventListener("error",c=>{!Za(c)&&Xa(c)&&jt({checkoutSessionId:a,analytics:l,error:c.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",c=>{let E=c.reason||Error("Unhandled promise rejection");Ja(E)&&jt({checkoutSessionId:a,analytics:l,error:E,reporter:"unhandledrejection"})}))},Za=a=>a.message==="Script error."||!a.filename||a.lineno===0,Xa=a=>{let l=a.filename;return!!(l&&Hr(l))&&!!new v(a.error).isReported||!1},Ja=a=>{if(a&&typeof a=="object"&&"stack"in a&&typeof a.stack=="string"){let l=v.from(a);return!l.isReported&&(!!("fileName"in a&&typeof a.fileName=="string"&&Hr(a.fileName))||Qa(l.stack).some(Hr))}return!1},Hr=a=>{try{return new URL(a,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},Qa=a=>{if(!a)return[];let l=a.split(`
2
- `),c=[],E=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(let A of l){let x=A.match(E);if(x&&x[1])c.push(x[1]);else{let b=/@(.*?):\d+:\d+$/,M=A.match(b);M&&M[1]&&c.push(M[1])}}return c};function Yi(a,l,c){return document.querySelector(`${a}[${l}^="${c}"]`)}async function zi(a,l,c,E,A,x){let{analytics:b,name:M=l,retryConfig:N}=x;await _i(()=>new Promise((S,O)=>{let H=Yi(a,c,l)||function(Y,ae){let ne=document.createElement(Y);return Object.entries(ae).forEach(([ie,ot])=>ne.setAttribute(ie,ot)),ne}(a,{...E,[c]:l});H.onload=()=>{b?.sdkFunctionEvent({name:M,params:[`${a.charAt(0).toUpperCase()+a.slice(1)} loaded successfully: ${l}`]}),S()},H.onerror=()=>{H.remove(),O(Error(`${A}: ${l}`))},H.parentNode||document.head.appendChild(H)}),N,S=>b?.messageEvent({...S,url:l}))}async function Fi(a){return i||(i=Promise.all([function(l,c={}){return Yi("script","src",l)&&window.__Primer?(c.analytics?.sdkFunctionEvent({name:c.name??l,params:["Script already loaded"]}),Promise.resolve()):zi("script",l,"src",{...c.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",c)}("https://sdk.primer.io/web/v2.53.4/PrimerCoreSDK.min.js",{analytics:a,name:"loadPrimerScript"}),function(l,c={}){return Array.from(document.styleSheets).some(E=>E.href===l)?(c.analytics?.sdkFunctionEvent({name:c.name??l,params:["Stylesheet already loaded"]}),Promise.resolve()):zi("link",l,"href",{...c.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",c)}("https://sdk.primer.io/web/v2.53.4/Checkout.css",{analytics:a,name:"loadPrimerCss"})]).then(()=>{let l=window.__Primer;return delete window.__Primer,l}).catch(l=>{throw i=void 0,l}))}let en=async()=>{let a=Dr();try{let l=rt(a);try{Ui(a,l),l.sdkFunctionEvent({name:"preloadPrimer"}),l.timerStart({id:te.preloadPrimer}),await Fi(l),l.timerEnd({id:te.preloadPrimer})}catch(c){let E=v.from(c);throw E.isReported||(jt({checkoutSessionId:a,analytics:l,error:E,reporter:"preloadPrimer level 1"}),E.markAsReported()),E}}catch(l){let c=v.from(l);throw c.isReported||(Vr(a,c,"preloadPrimer level 0"),c.markAsReported()),c}},tn=Ur("createHeadless"),rn=Ur("showUniversalCheckout"),on=Ur("showVaultManager");function Ur(a){return async(...[l,c,...E])=>{var A;(A=c?.apiVersion)||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${m}'.`),C=A??m;let x=Dr();try{let b=rt(x);try{Ui(x,b),b.sdkFunctionEvent({name:a,params:[l,c,...E]}),b.timerStart({id:te[a]});let[M,N]=await Promise.all([Wa(l,x,c?.clientSessionCachingEnabled?{key:l,usePrimerSessionCacheTtlHeader:!0}:void 0),Fi(b)]);return N[a](M,x,l,c,...E)}catch(M){let N=v.from(M);throw N.isReported||(jt({checkoutSessionId:x,analytics:b,error:N,reporter:"lazyLoad level 1"}),N.markAsReported()),N}}catch(b){let M=v.from(b);throw M.isReported||(Vr(x,M,"lazyLoad level 0"),M.markAsReported()),M}}}var an=function(a){return a.CHECKOUT="CHECKOUT",a.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",a.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",a}({}),nn=function(a){return a.DEFAULT="DEFAULT",a.PREFER_VAULT="PREFER_VAULT",a}({}),sn=function(a){return a.SUCCESS="AUTH_SUCCESS",a.FAILED="AUTH_FAILED",a.SKIPPED="SKIPPED",a.CHALLENGE="CHALLENGE",a}({});let Ct={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",AUTOMATED_CLEARING_HOUSE:"AUTOMATED_CLEARING_HOUSE",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_ACH:"STRIPE_ACH",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL_ORDER",PAYPAL_VAULTED:"PAYPAL_BILLING_AGREEMENT",GO_CARDLESS:"GOCARDLESS",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME",KLARNA_CUSTOMER_TOKEN:"KLARNA_CUSTOMER_TOKEN"},_t={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",STRIPE_ACH:"STRIPE_ACH",STRIPE_IDEAL:"STRIPE_IDEAL",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",PAYMENT_CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL",GO_CARDLESS:"GOCARDLESS",KLARNA:"KLARNA",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_BANK_TRANSFER:"ADYEN_BANK_TRANSFER",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME"},ln={SINGLE_USE:"SINGLE_USE",MULTI_USE:"MULTI_USE"};Ct.PAYPAL_VAULTED,_t.PAYPAL,Ct.KLARNA_CUSTOMER_TOKEN,_t.KLARNA,Ct.AUTOMATED_CLEARING_HOUSE,_t.STRIPE_ACH,Ct.CARD,_t.PAYMENT_CARD;var dn=function(a){return a.INITIALIZATION_ERROR="INITIALIZATION_ERROR",a.NO_PAYMENT_METHODS="NO_PAYMENT_METHODS",a.PRIMER_TEARDOWN="PRIMER_TEARDOWN",a.PRIMER_SERVER_ERROR="PRIMER_SERVER_ERROR",a.THREE_DS_AUTH_FAILED="THREE_DS_AUTH_FAILED",a.TOKENIZATION_ERROR="TOKENIZATION_ERROR",a.DUPLICATE_PAYMENT_METHOD_ERROR="DUPLICATE_PAYMENT_METHOD_ERROR",a.CARD_NUMBER_ERROR="CARD_NUMBER_ERROR",a.PAYMENT_METHOD_NOT_SETUP="PAYMENT_METHOD_NOT_SETUP",a.PAYMENT_METHOD_NOT_PROVIDED="PAYMENT_METHOD_NOT_PROVIDED",a.PAYMENT_METHOD_NOT_COMPATIBLE="PAYMENT_METHOD_NOT_COMPATIBLE",a.RESUME_ERROR="RESUME_ERROR",a.VALIDATION_ERROR="VALIDATION_ERROR",a.PAYMENT_FAILED="PAYMENT_FAILED",a.PAYMENT_CREATION_ABORTED="PAYMENT_CREATION_ABORTED",a.PAYMENT_CREATION_DISABLED="PAYMENT_CREATION_DISABLED",a.CLIENT_SESSION_UPDATE_ERROR="CLIENT_SESSION_UPDATE_ERROR",a.INVALID_ARGUMENT="INVALID_ARGUMENT",a.VAULT_FETCH="VAULT_FETCH",a.VAULT_DELETE="VAULT_DELETE",a.HEADLESS_VAULT_MANAGER_VALIDATION="HEADLESS_VAULT_MANAGER_VALIDATION",a.CARD_FORM_VALIDATION_UNEXPECTED_FIELD="CARD_FORM_VALIDATION_UNEXPECTED_FIELD",a.MISSING_FIRST_NAME_OR_LAST_NAME="MISSING_FIRST_NAME_OR_LAST_NAME",a.MISSING_EMAIL_ADDRESS="MISSING_EMAIL_ADDRESS",a.INVALID_FLOW="INVALID_FLOW",a}({});function Gt(a,l,c){return l in a?Object.defineProperty(a,l,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[l]=c,a}class Yr extends v{static fromErrorCode(l,c){return new Yr(l,c)}constructor(l,c){super(c.message),Gt(this,"code",void 0),Gt(this,"diagnosticsId",void 0),Gt(this,"data",void 0),Gt(this,"isFromDeveloper",void 0),this.code=l,this.diagnosticsId=c.diagnosticsId??null,this.data=c.data,this.isFromDeveloper=c.isFromDeveloper??!1,this.name="PrimerClientError",Error.captureStackTrace&&Error.captureStackTrace(this,Yr)}}var pn=function(a){return a.PAYMENT_METHOD="PAYMENT_METHOD",a.CHECK="CHECK",a}({});let cn=a=>{let l=a?.mandateData;return!!l&&"fullMandateText"in l};var mn=function(a){return a.CHANGE="change",a.ERROR="error",a.FOCUS="focus",a.BLUR="blur",a.CLICK="click",a.CLOSE="close",a.CONFIRMED_KLARNA_CATEGORY="CONFIRMED_KLARNA_CATEGORY",a.CONFIRMED_KLARNA_CATEGORY_ERROR="CONFIRMED_KLARNA_CATEGORY_ERROR",a.KLARNA_SESSION_UPDATE="KLARNA_SESSION_UPDATE",a.KLARNA_SESSION_REFRESH_ERROR="KLARNA_SESSION_REFRESH_ERROR",a}({}),un=function(a){return a.CARD="CARD",a.NATIVE="NATIVE",a.REDIRECT="REDIRECT",a.KLARNA="KLARNA",a.ACH="ACH",a}({});let hn={SDK_VERSION:"v2.53.4",createHeadless:tn,showUniversalCheckout:rn,showVaultManager:on,preloadPrimer:en};return o})())});var qt=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}setCardNetworksLoading(){let t={detectedCardNetwork:null,selectableCardNetworks:[],isLoading:!0};this.updateCardNetworksState(t)}updateCardNetworksState(t){this.host.primerEventsController.dispatchCardNetworkChange(t),this.host.sdkContextController.setCardNetworks(t)}async processCardNetworkChangeEvent(t){let{detectedCardNetworks:e,selectableCardNetworks:r}=t,o=e.preferred??e.items[0],s=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:o,selectableCardNetworks:s,isLoading:!1})}};var at=class{constructor(t){(this.host=t).addController(this)}hostConnected(){}dispatchEvent(t,e){this.host.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0}))}dispatchSdkState(t){this.dispatchEvent("primer-state-changed",t)}dispatchPaymentMethods(t){this.dispatchEvent("primer-payment-methods-updated",t)}dispatchCheckoutInitialized(t){this.dispatchEvent("primer-checkout-initialized",t)}dispatchCardNetworkChange(t){this.dispatchEvent("primer-card-network-change",t)}dispatchFormSubmitSuccess(t){this.dispatchEvent("primer-card-submit-success",{result:t})}dispatchFormSubmitErrors(t){this.dispatchEvent("primer-card-submit-errors",{errors:t})}};var we=class extends Event{constructor(t,e,r,o){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=o??!1}};var nt=class{constructor(t,e,r,o){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,m)=>{this.unsubscribe&&(this.unsubscribe!==m&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(s,m)),this.unsubscribe=m},this.host=t,e.context!==void 0){let s=e;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=o??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new we(this.context,this.host,this.t,this.subscribe))}};var Wt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:o}=this.subscriptions.get(t);t(this.value,o)}clearCallbacks(){this.subscriptions.clear()}};var Fr=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},j=class extends Wt{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=o=>{if(o.context!==this.context)return;let s=o.contextTarget??o.composedPath()[0];s!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,s,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let s=new Set;for(let[m,{consumerHost:C}]of this.subscriptions)s.has(m)||(s.add(m),C.dispatchEvent(new we(this.context,C,m,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Fr(this.context,this.host))}};function y({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new nt(this,{context:i,callback:o=>{e.set.call(this,o)},subscribe:t})}):e.constructor.addInitializer(o=>{new nt(o,{context:i,callback:s=>{o[r]=s},subscribe:t})})}}var Zt="cardNetworksContext";var Pe="clientOptionsContext";var Ie="computedStylesContext";var G="headlessInstanceContext";var Xt="klarnaCategoriesContext";var Z="managerContext";var st="paymentMethodsContext";var z="sdkStateContext";var X="vaultManagerContext";var Le="vaultManagerCvvContext";var w=class w{static log(t,...e){w.enabled&&console.log(`%c${w.brandTag}%c ${t}`,w.brandStyle,w.styles.log,...e)}static info(t,...e){w.enabled&&console.info(`%c${w.brandTag}%c ${t}`,w.brandStyle,w.styles.info,...e)}static warn(t,...e){w.enabled&&console.warn(`%c${w.brandTag}%c ${t}`,w.brandStyle,w.styles.warn,...e)}static error(t,...e){w.enabled&&console.error(`%c${w.brandTag}%c ${t}`,w.brandStyle,w.styles.error,...e)}static debug(t,...e){w.enabled&&console.debug(`%c${w.brandTag}%c ${t}`,w.brandStyle,w.styles.debug,...e)}static table(t,e){w.enabled&&console.table(t,e)}static time(t){w.enabled&&console.time(`${w.brandTag} ${t}`)}static timeEnd(t){w.enabled&&console.timeEnd(`${w.brandTag} ${t}`)}};w.enabled=!0,w.defaultFont="font-family: Consolas, monospace; font-size: 12px;",w.brandTag="[PRIMER]",w.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+w.defaultFont,w.styles={log:"color: #4CAF50; "+w.defaultFont,info:"color: #2196F3; "+w.defaultFont,warn:"color: #FF9800; "+w.defaultFont,error:"color: #F44336; "+w.defaultFont,debug:"color: #9C27B0; "+w.defaultFont};var P=w;var Jt={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},Qt=class{constructor(t){(this.host=t).addController(this),this._state=Jt}hostConnected(){}reducer(t,e){switch(e.type){case"START_LOADING":return{...t,isLoading:!0};case"START_PROCESSING":return{...t,failure:null,isProcessing:!0};case"STOP_PROCESSING":return{...t,isProcessing:!1};case"COMPLETE_PROCESSING":return{...t,isProcessing:!1,isSuccessful:!0};case"SET_ERROR":return P.error(e.payload.message),{...t,isProcessing:!1,error:e.payload};case"SET_FAILURE":return{...t,isProcessing:!1,failure:e.payload};case"COMPLETE_LOADING":return{...t,isLoading:!1};case"RESET":return Jt;default:return t}}dispatch(t){let e=this.reducer(this._state,t);this._state=e,this.host.sdkContextController.setSdkState(e),this.host.primerEventsController.dispatchSdkState(e)}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}setFailure(t,e,r){this.dispatch({type:"SET_FAILURE",payload:{code:t,message:e,details:r}})}reset(){this.dispatch({type:"RESET"})}forceCompleteLoading(){this._state.isLoading&&(P.warn("Force completing loading state"),this.completeLoading())}get state(){return this._state}};var er=class{constructor(t){this.sdkStateProvider=null;this.paymentMethodsProvider=null;this.paymentManagerProvider=null;this.cardNetworksContext=null;this.vaultManagerCvvProvider=null;this.clientOptionsContext=null;this.headlessUtilsProvider=null;this.klarnaCategoriesProvider=null;this.computedStylesProvider=null;(this.host=t).addController(this),this.sdkStateProvider=new j(t,{context:z,initialValue:Jt}),this.paymentMethodsProvider=new j(t,{context:st,initialValue:null}),this.paymentManagerProvider=new j(t,{context:Z,initialValue:new Map}),this.cardNetworksContext=new j(t,{context:Zt,initialValue:null}),this.vaultManagerProvider=new j(t,{context:X,initialValue:null}),this.vaultManagerCvvProvider=new j(t,{context:Le,initialValue:null}),this.clientOptionsContext=new j(t,{context:Pe,initialValue:null}),this.klarnaCategoriesProvider=new j(t,{context:Xt,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new j(t,{context:G,initialValue:null}),this.computedStylesProvider=new j(t,{context:Ie,initialValue:null})}hostConnected(){}setSdkState(t){this.sdkStateProvider?.setValue(t)}setPaymentMethods(t){this.paymentMethodsProvider?.setValue(t)}setPaymentManagers(t){this.paymentManagerProvider?.setValue(t)}setCardNetworks(t){this.cardNetworksContext?.setValue(t)}setVaultManager(t){this.vaultManagerProvider?.setValue(t)}setKlarnaCategories(t){this.klarnaCategoriesProvider?.setValue(t)}setClientOptions(t){this.clientOptionsContext?.setValue(t)}setHeadlessUtils(t){this.headlessUtilsProvider?.setValue(t)}setComputedStyles(t){this.computedStylesProvider?.setValue(t)}setVaultManagerCvv(t){this.vaultManagerCvvProvider?.setValue(t)}};var Ke=class Ke{constructor(t){(this.host=t).addController(this)}processCustomStyles(t){try{let e=JSON.parse(t);this.applyStyles(e)}catch(e){P.error("Error parsing customStyles property.",e instanceof Error?e:new Error(String(e)))}}isValidCssProperty(t){return/^[a-zA-Z][a-zA-Z0-9]*$/.test(t)}isValidCssValue(t){let r=/^[\w\s#.,%()\-+/!]+$/.test(t);return r||P.warn(`Rejected potentially unsafe CSS value: ${t}`),r}getCssVarName(t){let e=Ke.cssVarCache.get(t);return e||(e="--"+t.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),Ke.cssVarCache.set(t,e)),e}applyStyles(t){let e=[];for(let r of Object.keys(t)){let o=t[r];if(!o)continue;if(!this.isValidCssProperty(r)){P.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(o))continue;let s=this.getCssVarName(r);e.push([s,o])}if(e.length>0)for(let[r,o]of e)this.host.style.setProperty(r,o)}removeStyle(t){let e=this.getCssVarName(t);this.host.style.removeProperty(e)}clearAllStyles(){for(let t of Ke.cssVarCache.keys()){let e=Ke.cssVarCache.get(t);e&&this.host.style.removeProperty(e)}}hostDisconnected(){}};Ke.cssVarCache=new Map;var tr=Ke;var rr=globalThis,ir=rr.ShadowRoot&&(rr.ShadyCSS===void 0||rr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Br=Symbol(),qi=new WeakMap,Mt=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Br)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(ir&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=qi.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&qi.set(e,t))}return t}toString(){return this.cssText}},Wi=i=>new Mt(typeof i=="string"?i:i+"",void 0,Br),h=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,o,s)=>r+(m=>{if(m._$cssResult$===!0)return m.cssText;if(typeof m=="number")return m;throw Error("Value passed to 'css' function must be a 'css' function result: "+m+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[s+1],i[0]);return new Mt(e,i,Br)},Kr=(i,t)=>{if(ir)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=rr.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},or=ir?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Wi(e)})(i):i;var{is:vn,defineProperty:yn,getOwnPropertyDescriptor:bn,getOwnPropertyNames:En,getOwnPropertySymbols:xn,getPrototypeOf:Cn}=Object,Ne=globalThis,Zi=Ne.trustedTypes,_n=Zi?Zi.emptyScript:"",An=Ne.reactiveElementPolyfillSupport,St=(i,t)=>i,kt={toAttribute(i,t){switch(t){case Boolean:i=i?_n:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch{e=null}}return e}},lt=(i,t)=>!vn(i,t),Xi={attribute:!0,type:String,converter:kt,reflect:!1,hasChanged:lt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Ne.litPropertyMetadata??(Ne.litPropertyMetadata=new WeakMap);var be=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Xi){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(t,r,e);o!==void 0&&yn(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:s}=bn(this.prototype,t)??{get(){return this[e]},set(m){this[e]=m}};return{get(){return o?.call(this)},set(m){let C=o?.call(this);s.call(this,m),this.requestUpdate(t,C,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Xi}static _$Ei(){if(this.hasOwnProperty(St("elementProperties")))return;let t=Cn(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(St("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(St("properties"))){let e=this.properties,r=[...En(e),...xn(e)];for(let o of r)this.createProperty(o,e[o])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,o]of e)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let o=this._$Eu(e,r);o!==void 0&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let o of r)e.unshift(or(o))}else t!==void 0&&e.push(or(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Kr(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){let r=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,r);if(o!==void 0&&r.reflect===!0){let s=(r.converter?.toAttribute!==void 0?r.converter:kt).toAttribute(e,r.type);this._$Em=t,s==null?this.removeAttribute(o):this.setAttribute(o,s),this._$Em=null}}_$AK(t,e){let r=this.constructor,o=r._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let s=r.getPropertyOptions(o),m=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:kt;this._$Em=o,this[o]=m.fromAttribute(e,s.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??lt)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,s]of this._$Ep)this[o]=s;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,s]of r)s.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],s)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};be.elementStyles=[],be.shadowRootOptions={mode:"open"},be[St("elementProperties")]=new Map,be[St("finalized")]=new Map,An?.({ReactiveElement:be}),(Ne.reactiveElementVersions??(Ne.reactiveElementVersions=[])).push("2.0.4");var Re={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},I=Symbol(),R=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((t,e)=>{this.o=t,this.h=e}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,r){this.p=0,this.i=0,(this._=t).addController(this);let o=typeof e=="object"?e:{task:e,args:r};this.v=o.task,this.j=o.args,this.m=o.argsEqual??Ji,this.k=o.onComplete,this.A=o.onError,this.autoRun=o.autoRun??!0,"initialValue"in o&&(this.u=o.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,r;t??(t=this.T()),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();let o=++this.p;this.q=new AbortController;let s=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(m){s=!0,r=m}if(this.p===o){if(e===I)this.i=0;else{if(s===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=e,this.l=r}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},Ji=(i,t)=>i===t||i.length===t.length&&i.every((e,r)=>!lt(e,t[r]));var Tt={enabled:!1,isLoading:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:void 0,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},ar={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}};function jr(i,t,e){switch(t.type){case"SET_LOADING":return{...i,isLoading:t.payload};case"INITIALIZE_VAULT_MANAGER":return{...i,enabled:t.vaultEnabled,cvvRecapture:t.cvvRecapture,deleteVaultedPaymentMethod:e.deleteVaultedPaymentMethod,startVaultedPaymentFlow:e.startVaultedPaymentFlow,createCvvInput:e.createCvvInput};case"UPDATE_PAYMENT_METHODS":return{...i,vaultedPaymentMethods:t.payload,isLoading:t.isLoading??!1};case"SET_ERROR":return P.error("VaultManagerController",t.payload.message),{...i,isLoading:!1};case"DISABLE":return{...Tt,enabled:!1};case"RESET":return Tt;default:return i}}function Gr(i,t,e){switch(t.type){case"INITIALIZE_CVV":return{...i,setCvvInput:e.setCvvInput,setSelectedVaultedPaymentMethod:e.setSelectedVaultedPaymentMethod};case"SET_FORM_DIRTY":return{...i,formIsDirty:t.payload};case"SET_CVV_INPUT":return{...i,cvvInput:t.payload};case"SET_SELECTED_VAULTED_PAYMENT_METHOD":return{...i,selectedVaultedPaymentMethod:t.payload};case"RESET_CVV":return ar;default:return i}}var wt=class{constructor(t){this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async t=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:this._vaultManagerState.vaultedPaymentMethods,isLoading:!0}),await this._vaultManager.deleteVaultedPaymentMethod(t),await this.fetchVaultedPaymentMethods()}catch(e){throw this.dispatchVaultManager({type:"SET_ERROR",payload:e instanceof Error?e:new Error("Failed to delete payment method")}),e}};this.setCvvInput=t=>{this.dispatchVaultItem({type:"SET_CVV_INPUT",payload:t})};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let t=this._vaultItemState.selectedVaultedPaymentMethod,e=this._vaultManagerState.cvvRecapture,r=this._vaultItemState.cvvInput;if(!t||e&&(!r||r.metadata.error)){this.dispatchVaultItem({type:"SET_FORM_DIRTY",payload:!0});return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(t.id,e?{cvv:r.valueToken}:void 0)}catch(o){P.error("VaultManagerController: Error starting vaulted payment flow",o),this.dispatchVaultManager({type:"SET_ERROR",payload:o instanceof Error?o:new Error("Failed to start vaulted payment flow")}),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=t=>{this.dispatchVaultItem({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:t}),this.dispatchVaultItem({type:"SET_FORM_DIRTY",payload:!1})};(this.host=t).addController(this),this._vaultManagerState=Tt,this._vaultItemState=ar,new R(this.host,{task:async([e,r])=>{if(!e||!r?.vaultEnabled)return this.dispatchVaultManager({type:"DISABLE"}),I;this.dispatchVaultManager({type:"SET_LOADING",payload:!0});try{this.dispatchVaultManager({type:"INITIALIZE_VAULT_MANAGER",payload:e,vaultEnabled:r.vaultEnabled,cvvRecapture:!!r.captureVaultedCardCvv}),this.dispatchVaultItem({type:"INITIALIZE_CVV",createCvvInput:e.createCvvInput}),await this.fetchVaultedPaymentMethods(),P.log("VaultManagerController: Vault initialized successfully",{coreState:this._vaultManagerState,cvvState:this._vaultItemState})}catch(o){P.error("VaultManagerController: Failed to initialize vault",o),this.dispatchVaultManager({type:"SET_ERROR",payload:o instanceof Error?o:new Error("Unknown error")})}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(t,e){this.vaultManager=t,this.options=e??null}get vaultManager(){return this._vaultManager}set vaultManager(t){this._vaultManager=t,this.host.requestUpdate()}get options(){return this._options}set options(t){this._options=t,this.host.requestUpdate()}hostDisconnected(){this.vaultManager=null,this.dispatchVaultManager({type:"RESET"})}dispatchVaultManager(t){let e={deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod,startVaultedPaymentFlow:this.startVaultedPaymentFlow,createCvvInput:this.vaultManager?.createCvvInput},r=jr(this._vaultManagerState,t,e);this._vaultManagerState=r,this.host.sdkContextController.setVaultManager(r)}dispatchVaultItem(t){let e={setCvvInput:this.setCvvInput,setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod},r=Gr(this._vaultItemState,t,e);this._vaultItemState=r,this.host.sdkContextController.setVaultManagerCvv(r)}async fetchVaultedPaymentMethods(){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:this._vaultManagerState.vaultedPaymentMethods,isLoading:!0});let t=await this._vaultManager.fetchVaultedPaymentMethods();return P.log("VaultManagerController: Fetched payment methods",t),this.dispatchVaultManager({type:"UPDATE_PAYMENT_METHODS",payload:t,isLoading:!1}),t}catch(t){throw this.dispatchVaultManager({type:"SET_ERROR",payload:t instanceof Error?t:new Error("Failed to fetch payment methods")}),t}}};var Pt="lit-localize-status";var Qi=i=>typeof i!="string"&&"strTag"in i,nr=(i,t,e)=>{let r=i[0];for(let o=1;o<i.length;o++)r+=t[e?e[o-1]:o-1],r+=i[o];return r};var It=i=>Qi(i)?nr(i.strings,i.values):i;var _=It,eo=!1;function qr(i){if(eo)throw new Error("lit-localize can only be configured once");_=i,eo=!0}var Wr=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(Pt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(Pt,this.__litLocalizeEventHandler)}},Mn=i=>i.addController(new Wr(i)),to=Mn;var L=()=>(i,t)=>(i.addInitializer(to),i);var Lt=class{constructor(){this.settled=!1,this.promise=new Promise((t,e)=>{this._resolve=t,this._reject=e})}resolve(t){this.settled=!0,this._resolve(t)}reject(t){this.settled=!0,this._reject(t)}};var Ee=[];for(let i=0;i<256;i++)Ee[i]=(i>>4&15).toString(16)+(i&15).toString(16);function ro(i){let t=0,e=8997,r=0,o=33826,s=0,m=40164,C=0,v=52210;for(let D=0;D<i.length;D++)e^=i.charCodeAt(D),t=e*435,r=o*435,s=m*435,C=v*435,s+=e<<8,C+=o<<8,r+=t>>>16,e=t&65535,s+=r>>>16,o=r&65535,v=C+(s>>>16)&65535,m=s&65535;return Ee[v>>8]+Ee[v&255]+Ee[m>>8]+Ee[m&255]+Ee[o>>8]+Ee[o&255]+Ee[e>>8]+Ee[e&255]}var Sn="",kn="h",Tn="s";function io(i,t){return(t?kn:Tn)+ro(typeof i=="string"?i:i.join(Sn))}var oo=new WeakMap,ao=new Map;function no(i,t,e){if(i){let r=e?.id??wn(t),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return nr(o.strings,t.values,o.values);{let s=oo.get(o);return s===void 0&&(s=o.values,oo.set(o,s)),{...o,values:s.map(m=>t.values[m])}}}}return It(t)}function wn(i){let t=typeof i=="string"?i:i.strings,e=ao.get(t);return e===void 0&&(e=io(t,typeof i!="string"&&!("strTag"in i)),ao.set(t,e)),e}function Zr(i){window.dispatchEvent(new CustomEvent(Pt,{detail:i}))}var lr="",Xr,so,dr,Jr,lo,je=new Lt;je.resolve();var sr=0,po=i=>(qr((t,e)=>no(lo,t,e)),lr=so=i.sourceLocale,dr=new Set(i.targetLocales),dr.add(i.sourceLocale),Jr=i.loadLocale,{getLocale:Pn,setLocale:In}),Pn=()=>lr,In=i=>{if(i===(Xr??lr))return je.promise;if(!dr||!Jr)throw new Error("Internal error");if(!dr.has(i))throw new Error("Invalid locale code");sr++;let t=sr;return Xr=i,je.settled&&(je=new Lt),Zr({status:"loading",loadingLocale:i}),(i===so?Promise.resolve({templates:void 0}):Jr(i)).then(r=>{sr===t&&(lr=i,Xr=void 0,lo=r.templates,Zr({status:"ready",readyLocale:i}),je.resolve())},r=>{sr===t&&(Zr({status:"error",errorLocale:i,errorMessage:r.toString()}),je.reject(r))}),je.promise};var Qr="en",ei=["ar","bg","ca","cs","da","de","el","en-GB","es","es-AR","es-MX","et-EE","fi-FI","fr","he","hr","hu","id","it","ja","ko","lt","lt-LT","lv","lv-LV","ms","nb","nl","nl_NL","pl","pt","pt-BR","ro","ru","sk","sl","sr-RS","sv","th","tr","uk-UA","vi","zf","zh-CN","zh-HK","zh-TW"],co="You must call `loadLocale` first to set up the localized template.",mo,pr,uo=i=>{let t=po({sourceLocale:Qr,targetLocales:ei,loadLocale:i});mo=t.getLocale,pr=t.setLocale};var ti=i=>{uo(i)},ri=i=>{if(!pr)throw new Error(co);return pr(i)};var Nt=new Set(ei);Nt.add(Qr);var ii=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let t=i.replace("_","-");if(Nt.has(t))return!0;let e=t.split("-")[0];return!!Nt.has(e)},oi=i=>{if(i==="en")return"en-GB";let t=i.replace("_","-");if(Nt.has(t))return t;let e=t.split("-")[0];return Nt.has(e)?e:"en-GB"};var Ot=globalThis,cr=Ot.trustedTypes,ho=cr?cr.createPolicy("lit-html",{createHTML:i=>i}):void 0,ni="$lit$",xe=`lit$${Math.random().toFixed(9).slice(2)}$`,si="?"+xe,Ln=`<${si}>`,We=document,Dt=()=>We.createComment(""),$t=i=>i===null||typeof i!="object"&&typeof i!="function",li=Array.isArray,Eo=i=>li(i)||typeof i?.[Symbol.iterator]=="function",ai=`[
3
- \f\r]`,Rt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,go=/-->/g,fo=/>/g,Ge=RegExp(`>|${ai}(?:([^\\s"'>=/]+)(${ai}*=${ai}*(?:[^
4
- \f\r"'\`<>=]|("|')|))|$)`,"g"),vo=/'/g,yo=/"/g,xo=/^(?:script|style|textarea|title)$/i,di=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),p=di(1),_e=di(2),Od=di(3),Ce=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),bo=new WeakMap,qe=We.createTreeWalker(We,129);function Co(i,t){if(!li(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ho!==void 0?ho.createHTML(t):t}var _o=(i,t)=>{let e=i.length-1,r=[],o,s=t===2?"<svg>":t===3?"<math>":"",m=Rt;for(let C=0;C<e;C++){let v=i[C],D,F,$=-1,te=0;for(;te<v.length&&(m.lastIndex=te,F=m.exec(v),F!==null);)te=m.lastIndex,m===Rt?F[1]==="!--"?m=go:F[1]!==void 0?m=fo:F[2]!==void 0?(xo.test(F[2])&&(o=RegExp("</"+F[2],"g")),m=Ge):F[3]!==void 0&&(m=Ge):m===Ge?F[0]===">"?(m=o??Rt,$=-1):F[1]===void 0?$=-2:($=m.lastIndex-F[2].length,D=F[1],m=F[3]===void 0?Ge:F[3]==='"'?yo:vo):m===yo||m===vo?m=Ge:m===go||m===fo?m=Rt:(m=Ge,o=void 0);let B=m===Ge&&i[C+1].startsWith("/>")?" ":"";s+=m===Rt?v+Ln:$>=0?(r.push(D),v.slice(0,$)+ni+v.slice($)+xe+B):v+xe+($===-2?C:B)}return[Co(i,s+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Vt=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let s=0,m=0,C=t.length-1,v=this.parts,[D,F]=_o(t,e);if(this.el=i.createElement(D,r),qe.currentNode=this.el.content,e===2||e===3){let $=this.el.content.firstChild;$.replaceWith(...$.childNodes)}for(;(o=qe.nextNode())!==null&&v.length<C;){if(o.nodeType===1){if(o.hasAttributes())for(let $ of o.getAttributeNames())if($.endsWith(ni)){let te=F[m++],B=o.getAttribute($).split(xe),tt=/([.?@])?(.*)/.exec(te);v.push({type:1,index:s,name:tt[2],strings:B,ctor:tt[1]==="."?ur:tt[1]==="?"?hr:tt[1]==="@"?gr:Xe}),o.removeAttribute($)}else $.startsWith(xe)&&(v.push({type:6,index:s}),o.removeAttribute($));if(xo.test(o.tagName)){let $=o.textContent.split(xe),te=$.length-1;if(te>0){o.textContent=cr?cr.emptyScript:"";for(let B=0;B<te;B++)o.append($[B],Dt()),qe.nextNode(),v.push({type:2,index:++s});o.append($[te],Dt())}}}else if(o.nodeType===8)if(o.data===si)v.push({type:2,index:s});else{let $=-1;for(;($=o.data.indexOf(xe,$+1))!==-1;)v.push({type:7,index:s}),$+=xe.length-1}s++}}static createElement(t,e){let r=We.createElement("template");return r.innerHTML=t,r}};function Ze(i,t,e=i,r){if(t===Ce)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,s=$t(t)?void 0:t._$litDirective$;return o?.constructor!==s&&(o?._$AO?.(!1),s===void 0?o=void 0:(o=new s(i),o._$AT(i,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=o:e._$Cl=o),o!==void 0&&(t=Ze(i,o._$AS(i,t.values),o,r)),t}var mr=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,o=(t?.creationScope??We).importNode(e,!0);qe.currentNode=o;let s=qe.nextNode(),m=0,C=0,v=r[0];for(;v!==void 0;){if(m===v.index){let D;v.type===2?D=new dt(s,s.nextSibling,this,t):v.type===1?D=new v.ctor(s,v.name,v.strings,this,t):v.type===6&&(D=new fr(s,this,t)),this._$AV.push(D),v=r[++C]}m!==v?.index&&(s=qe.nextNode(),m++)}return qe.currentNode=We,o}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},dt=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,o){this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Ze(this,t,e),$t(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==Ce&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Eo(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==u&&$t(this._$AH)?this._$AA.nextSibling.data=t:this.T(We.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,o=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Vt.createElement(Co(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let s=new mr(o,this),m=s.u(this.options);s.p(e),this.T(m),this._$AH=s}}_$AC(t){let e=bo.get(t.strings);return e===void 0&&bo.set(t.strings,e=new Vt(t)),e}k(t){li(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,o=0;for(let s of t)o===e.length?e.push(r=new i(this.O(Dt()),this.O(Dt()),this,this.options)):r=e[o],r._$AI(s),o++;o<e.length&&(this._$AR(r&&r._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Xe=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,s){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=u}_$AI(t,e=this,r,o){let s=this.strings,m=!1;if(s===void 0)t=Ze(this,t,e,0),m=!$t(t)||t!==this._$AH&&t!==Ce,m&&(this._$AH=t);else{let C=t,v,D;for(t=s[0],v=0;v<s.length-1;v++)D=Ze(this,C[r+v],e,v),D===Ce&&(D=this._$AH[v]),m||(m=!$t(D)||D!==this._$AH[v]),D===u?t=u:t!==u&&(t+=(D??"")+s[v+1]),this._$AH[v]=D}m&&!o&&this.j(t)}j(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ur=class extends Xe{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===u?void 0:t}},hr=class extends Xe{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==u)}},gr=class extends Xe{constructor(t,e,r,o,s){super(t,e,r,o,s),this.type=5}_$AI(t,e=this){if((t=Ze(this,t,e,0)??u)===Ce)return;let r=this._$AH,o=t===u&&r!==u||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==u&&(r===u||o);o&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},fr=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Ze(this,t)}},Ao={M:ni,P:xe,A:si,C:1,L:_o,R:mr,D:Eo,V:Ze,I:dt,H:Xe,N:hr,U:gr,B:ur,F:fr},Nn=Ot.litHtmlPolyfillSupport;Nn?.(Vt,dt),(Ot.litHtmlVersions??(Ot.litHtmlVersions=[])).push("3.2.1");var Mo=(i,t,e)=>{let r=e?.renderBefore??t,o=r._$litPart$;if(o===void 0){let s=e?.renderBefore??null;r._$litPart$=o=new dt(t.insertBefore(Dt(),s),s,void 0,e??{})}return o._$AI(i),o};var g=class extends be{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;let t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Mo(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ce}};g._$litElement$=!0,g.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:g});var Rn=globalThis.litElementPolyfillSupport;Rn?.({LitElement:g});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var f=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var On={attribute:!0,type:String,converter:kt,reflect:!1,hasChanged:lt},Dn=(i=On,t,e)=>{let{kind:r,metadata:o}=e,s=globalThis.litPropertyMetadata.get(o);if(s===void 0&&globalThis.litPropertyMetadata.set(o,s=new Map),s.set(e.name,i),r==="accessor"){let{name:m}=e;return{set(C){let v=t.get.call(this);t.set.call(this,C),this.requestUpdate(m,v,i)},init(C){return C!==void 0&&this.P(m,void 0,i),C}}}if(r==="setter"){let{name:m}=e;return function(C){let v=this[m];t.call(this,C),this.requestUpdate(m,v,i)}}throw Error("Unsupported decorator location: "+r)};function d(i){return(t,e)=>typeof e=="object"?Dn(i,t,e):((r,o,s)=>{let m=o.hasOwnProperty(s);return o.constructor.createProperty(s,m?{...r,wrapped:!0}:r),m?Object.getOwnPropertyDescriptor(o,s):void 0})(i,t,e)}function T(i){return d({...i,state:!0,attribute:!1})}var Je=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function Oe(i,t){return(e,r,o)=>{let s=m=>m.renderRoot?.querySelector(i)??null;if(t){let{get:m,set:C}=typeof r=="object"?e:o??(()=>{let v=Symbol();return{get(){return this[v]},set(D){this[v]=D}}})();return Je(e,r,{get(){let v=m.call(this);return v===void 0&&(v=s(this),(v!==null||this.hasUpdated)&&C.call(this,v)),v}})}return Je(e,r,{get(){return s(this)}})}}function V(i,t,e){return i?t(i):e?.(i)}var k=h`
1
+ import{a as $o,b as _s,c as Ro,d as s}from"./chunks/chunk.G45OCYEN.js";var Zi=_s((tr,Wi)=>{(function(i,e){typeof tr=="object"&&typeof Wi=="object"?Wi.exports=e():typeof define=="function"&&define.amd?define([],e):typeof tr=="object"?tr.Primer=e():i.Primer=e()})(tr,()=>(()=>{"use strict";let i;var e,t,r={};r.d=(a,d)=>{for(var m in d)r.o(d,m)&&!r.o(a,m)&&Object.defineProperty(a,m,{enumerable:!0,get:d[m]})},r.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d),r.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{SuccessScreenType:()=>ys,PaymentFlow:()=>hs,ThreeDSecureStatus:()=>gs,TokenType:()=>fs,isStripeOptionsDropInWithFullMandateText:()=>bs,PaymentInstrumentType:()=>$t,ErrorCode:()=>vs,EventTypes:()=>Es,CheckoutUXFlow:()=>us,HeadlessManagerType:()=>Cs,PaymentMethodType:()=>Rt,Primer:()=>xs});let n={LEGACY:"legacy",V_2_4:"2.4"},l=n.V_2_4,g=l;class u extends Error{static from(d,m=!1){if(d instanceof u)return d;let C=new u(d instanceof Error?d.message:String(d),m);return d instanceof Error&&d.stack&&(C.stack=d.stack,Object.assign(C,d)),C}markAsReported(){this.isReported=!0}constructor(d,m=!1){super(d),function(C,M,x){M in C?Object.defineProperty(C,M,{value:x,enumerable:!0,configurable:!0,writable:!0}):C[M]=x}(this,"isReported",void 0),this.isReported=m,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let S="https://analytics.production.data.primer.io/sdk-logs";var k=function(a){return a.REQUEST_START="REQUEST_START",a.REQUEST_END="REQUEST_END",a}({}),_=function(a){return a.START="START",a.END="END",a}({});let V={createHeadless:"HEADLESS_LOADING",showUniversalCheckout:"DROP_IN_LOADING",showVaultManager:"VAULT_MANAGER_LOADING",preloadPrimer:"PRELOAD_PRIMER_LOADING"};var Y=function(a){return a.NETWORK_CALL_EVENT="NETWORK_CALL_EVENT",a.CRASH_EVENT="CRASH_EVENT",a.TIMER_EVENT="TIMER_EVENT",a.MESSAGE_EVENT="MESSAGE_EVENT",a.V1_EVENT="V1_EVENT",a.SDK_FUNCTION_EVENT="SDK_FUNCTION_EVENT",a}({});async function he(){if(typeof navigator>"u"||typeof performance>"u")return;let a=await navigator.getBattery?.();return{memoryFootprint:performance.memory?.usedJSHeapSize,screen:{height:screen?.height,width:screen?.width},userAgent:navigator.userAgent,locale:navigator.language,batteryLevel:a?.level,batteryStatus:a?.charging?"CHARGING":"NOT_CHARGING"}}let On={get(a,d){let m;try{switch(a){case"PRIMER_SDK_VERSION":m="v2.53.5";break;case"PRIMER_ASSETS_URL":m=process.env.PRIMER_ASSETS_URL;break;case"PRIMER_BUILD_INTEGRATION_BUILDER":m=process.env.PRIMER_BUILD_INTEGRATION_BUILDER}}catch{}return m||d}}.get("PRIMER_SDK_VERSION");async function ao(a,d,m){return{...m,createdAt:Date.now(),device:await he(),eventType:a,properties:d,sdkVersion:On,sdkType:"WEB"}}let no=Symbol.for("__primerAnalytics__"),It={providers:new Map,timers:new Map,eventsQueue:new Map};if(typeof window<"u"){let a=window[no];a?It=a:window[no]=It}let so=()=>It.providers,ci=()=>It.timers,Nt=()=>It.eventsQueue,cr=new Map;function mi(a,d=!1,m=1){cr.has(a)&&(clearTimeout(cr.get(a)),cr.delete(a));let C=()=>{let x=Nt().get(a);if(x?.length){let E=!0,T=[],O=0,P=0;for(;P<x.length;){let H=x[P],z=new Blob([JSON.stringify(H)]).size;if(z>64e3){console.error("Event size exceeds maximum payload size and will be skipped:",H),P++;continue}if(O+z>64e3&&T.length>0){try{E=navigator.sendBeacon(a,JSON.stringify(T))}catch(B){E=!1,console.error("Unable to send events",B)}if(!E)break;T=[],O=0}T.push(H),O+=z,P++}if(T.length>0&&E)try{E=navigator.sendBeacon(a,JSON.stringify(T))}catch(H){E=!1,console.error("Unable to send events",H)}E?Nt().delete(a):m<5?setTimeout(()=>mi(a,d,m+1),500*Math.pow(2,m)):console.error("Max retry attempts reached. Events will not be sent.")}};if(d)return void C();let M=setTimeout(C,500);cr.set(a,M)}let lo=!1;function ui({url:a=S,...d}){typeof document>"u"||lo||(document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){let M=mt(d.checkoutSessionId);M.messageEvent({messageType:"VISIBILITY_CHANGE",message:"Checkout visibility is hidden (tab or window change, redirect or being closed)."}),mi(M.url,!0)}}),lo=!0);let m=M=>async x=>{if(typeof navigator>"u")return;let E=function O(P,H,z=new WeakSet,B=0,ne=10){if(B>ne||z.has(P))return P;z.add(P);let se=oe=>typeof oe=="object"&&oe!==null?O(oe,H,z,B+1,ne):H(oe);return Array.isArray(P)?P.map(se):Object.fromEntries(Object.entries(P).map(([oe,ht])=>[oe,se(ht)]))}(await ao(M,x,d),O=>{var P;return typeof(P=typeof O=="function"?O.name||"function":O)=="string"&&P.length>5120?`${P.slice(0,5120)}...`:P});Nt().has(a)||Nt().set(a,[]),Nt().get(a)?.push(E),mi(a)},C={crashEvent:m(Y.CRASH_EVENT),messageEvent:m(Y.MESSAGE_EVENT),networkCallEvent:m(Y.NETWORK_CALL_EVENT),sdkFunctionEvent:m(Y.SDK_FUNCTION_EVENT),timerStart:({id:M,...x})=>{let E=`${d.checkoutSessionId}|${M}`,T=performance?.now?performance.now():Date.now();return ci().set(E,{start:T}),m(Y.TIMER_EVENT)({...x,id:M,timerType:_.START})},timerEnd:({id:M,...x})=>{let E=`${d.checkoutSessionId}|${M}`,{start:T}=ci().get(E)??{};ci().delete(E);let O=performance?.now?performance.now():Date.now();return m(Y.TIMER_EVENT)({...x,id:M,timerType:_.END,duration:T?O-T:void 0})},v1Event:m(Y.V1_EVENT),url:a};return so().set(d.checkoutSessionId,C),mt(d.checkoutSessionId)}function mt(a){return new Proxy({},{get:(d,m)=>(so().get(a)??ui({checkoutSessionId:a}))[m]})}let hi=(a,d,m,C)=>({callType:m?k.REQUEST_END:k.REQUEST_START,id:a,errorBody:m?.error&&JSON.stringify(m.error,Object.getOwnPropertyNames(m.error)),method:d.method,responseCode:m?.status,url:d.url,duration:C});function Dn(a){return a?new Promise(d=>{setTimeout(d,a)}):Promise.resolve()}async function po(a,d,m,C=Dn){let M=0,x={enabled:d?.enabled??!1,maxRetries:8,initialBackoff:100,retryNetworkErrors:!0,retry500Errors:!1,maxJitter:100};if(!x.enabled)return a();for(;;)try{let E=await a();if(M){let T=`Request succeeded after ${M} retries.`;typeof E=="object"&&E&&"status"in E&&(T+=` Status code: ${E.status}`),m?.({messageType:"RETRY_SUCCESS",message:T,severity:"INFO"})}return E}catch(E){let T=M>=x.maxRetries,O=E.isNetworkError&&!x.retryNetworkErrors,P=E.status&&E.status>=500&&!x.retry500Errors;if(T||O||P){let B=`Failed after ${M} retries. `;throw T?B+=`Reached maximum retries (${x.maxRetries}).`:O?B+="Network error encountered and retryNetworkErrors is disabled.":P&&(B+="HTTP 500 error encountered and retry500Errors is disabled."),B+=` Last error: ${E.message}`,m?.({messageType:"RETRY_FAILED",message:B,severity:"ERROR",errorBody:JSON.stringify(E,Object.getOwnPropertyNames(E))}),Error(B,{cause:E})}M++;let H=Math.min(x.initialBackoff*Math.pow(2,M-1)+Math.random()*x.maxJitter,Number.MAX_SAFE_INTEGER),z="Unknown error";E.isNetworkError?z="Network error":E.status&&(z=`HTTP ${E.status} error`),m?.({messageType:"RETRY",message:`Retry attempt ${M}/${x.maxRetries} due to: ${z}. Error details: ${E.message}. Waiting for ${H.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(E,Object.getOwnPropertyNames(E))}),await C(H)}}let gi={cache:new Map};typeof window<"u"&&((e=window)[t="__primerCache__"]??(e[t]=gi),gi=window.__primerCache__);let ie=()=>gi.cache;function co(){if(ie().size<=30)return;let a=Date.now();for(let[d,m]of ie())m.exp<a&&ie().delete(d);if(ie().size>50)for(let[d]of ie()){if(ie().size<=50)break;ie().delete(d)}}let fi=()=>mo.randomUUID?.()||Vn(),Vn=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(a^Hn()>>a/4).toString(16)),Hn=()=>(mo.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,mo=typeof crypto<"u"?crypto:{},Un=(a,d,m)=>Yn(a,"get",d,m),Yn=async(a,d,m,C,M)=>{let x=fi(),E=performance?.now(),T=mt(a),O={method:d,url:m,body:M};T.networkCallEvent(hi(x,O));try{let P=await fetch(m,{body:M,method:d,headers:{"content-type":"application/json","x-request-id":x,...C}});if(!P.ok){let B=Error(`HTTP error! status: ${P.status}`);throw B.status=P.status,B}let H=await P.json();if(m.includes("client-sdk/configuration")){let{primerAccountId:B,clientSession:{clientSessionId:ne,customer:se}}=H;T=ui({checkoutSessionId:a,clientSessionId:ne,customerId:se?.customerId,primerAccountId:B,url:T.url})}let z=performance?.now();return T.networkCallEvent(hi(x,O,{data:H},z-E)),{data:H,headers:P.headers,status:P.status,source:"NETWORK"}}catch(P){let H=performance?.now();throw Object.assign(P,{isNetworkError:P instanceof TypeError}),T.networkCallEvent(hi(x,O,{error:P},H-E)),P}},zn=(a,d)=>new Promise((m,C)=>{let M=setTimeout(()=>{let x=Error("Request timed out");x.isNetworkError=!0,C(x)},d);a.then(m).catch(C).finally(()=>clearTimeout(M))}),Fn=(a,d)=>{let{headers:m,retryConfig:C,cacheConfig:M,timeout:x=15e3,checkoutSessionId:E}=d,T=mt(E);return function(O){if(!O)return ne=>ne();let{key:P,refresh:H=!1,usePrimerSessionCacheTtlHeader:z=!1,ttl:B=36e5}=O;return async ne=>{let se=Date.now(),oe=ie().get(P);if(!H&&oe&&oe.exp>se)return oe.promise;oe&&ie().delete(P);let ht=ne().then(Ot=>{let Io=B;return z&&(Io=1e3*(Number(Ot.headers.get("x-primer-session-cache-ttl"))||0)),function({key:No,ttl:Lo=36e5},As){Lo?ie().set(No,{promise:Promise.resolve({...As,source:"CACHE"}),exp:Date.now()+Lo}):ie().delete(No)}({key:P,ttl:Io},Ot),co(),Ot},Ot=>{throw ie().delete(P),Ot});return ie().set(P,{promise:ht,exp:se+B}),co(),ht}}(M)(()=>po(()=>zn(Un(E,a,m),x),C,O=>T.messageEvent({...O,url:a})))},ut=typeof Buffer=="function",uo=typeof TextDecoder=="function"?new TextDecoder:void 0,ho=typeof TextEncoder=="function"?new TextEncoder:void 0,Lt=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),mr=(a=>{let d={};return a.forEach((m,C)=>d[m]=C),d})(Lt),Bn=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,G=String.fromCharCode.bind(String),go=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):a=>new Uint8Array(Array.prototype.slice.call(a,0)),fo=a=>a.replace(/=/g,"").replace(/[+\/]/g,d=>d=="+"?"-":"_"),vo=a=>a.replace(/[^A-Za-z0-9\+\/]/g,""),yo=typeof btoa=="function"?a=>btoa(a):ut?a=>Buffer.from(a,"binary").toString("base64"):a=>{let d,m,C,M,x="",E=a.length%3;for(let T=0;T<a.length;){if((m=a.charCodeAt(T++))>255||(C=a.charCodeAt(T++))>255||(M=a.charCodeAt(T++))>255)throw TypeError("invalid character found");x+=Lt[(d=m<<16|C<<8|M)>>18&63]+Lt[d>>12&63]+Lt[d>>6&63]+Lt[63&d]}return E?x.slice(0,E-3)+"===".substring(E):x},vi=ut?a=>Buffer.from(a).toString("base64"):a=>{let d=[];for(let m=0,C=a.length;m<C;m+=4096)d.push(G.apply(null,a.subarray(m,m+4096)));return yo(d.join(""))},Pl=(a,d=!1)=>d?fo(vi(a)):vi(a),Kn=a=>{if(a.length<2){var d=a.charCodeAt(0);return d<128?a:d<2048?G(192|d>>>6)+G(128|63&d):G(224|d>>>12&15)+G(128|d>>>6&63)+G(128|63&d)}var d=65536+(a.charCodeAt(0)-55296)*1024+(a.charCodeAt(1)-56320);return G(240|d>>>18&7)+G(128|d>>>12&63)+G(128|d>>>6&63)+G(128|63&d)},jn=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Gn=a=>a.replace(jn,Kn),bo=ut?a=>Buffer.from(a,"utf8").toString("base64"):ho?a=>vi(ho.encode(a)):a=>yo(Gn(a)),qn=(a,d=!1)=>d?fo(bo(a)):bo(a),Wn=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Zn=a=>{switch(a.length){case 4:var d=((7&a.charCodeAt(0))<<18|(63&a.charCodeAt(1))<<12|(63&a.charCodeAt(2))<<6|63&a.charCodeAt(3))-65536;return G((d>>>10)+55296)+G((1023&d)+56320);case 3:return G((15&a.charCodeAt(0))<<12|(63&a.charCodeAt(1))<<6|63&a.charCodeAt(2));default:return G((31&a.charCodeAt(0))<<6|63&a.charCodeAt(1))}},Xn=a=>a.replace(Wn,Zn),Eo=typeof atob=="function"?a=>atob(vo(a)):ut?a=>Buffer.from(a,"base64").toString("binary"):a=>{if(a=a.replace(/\s+/g,""),!Bn.test(a))throw TypeError("malformed base64.");a+="==".slice(2-(3&a.length));let d,m="",C,M;for(let x=0;x<a.length;)d=mr[a.charAt(x++)]<<18|mr[a.charAt(x++)]<<12|(C=mr[a.charAt(x++)])<<6|(M=mr[a.charAt(x++)]),m+=C===64?G(d>>16&255):M===64?G(d>>16&255,d>>8&255):G(d>>16&255,d>>8&255,255&d);return m},Co=ut?a=>go(Buffer.from(a,"base64")):a=>go(Eo(a).split("").map(d=>d.charCodeAt(0))),wl=a=>Co(xo(a)),Jn=ut?a=>Buffer.from(a,"base64").toString("utf8"):uo?a=>uo.decode(Co(a)):a=>Xn(Eo(a)),xo=a=>vo(a.replace(/[-_]/g,d=>d=="-"?"+":"/")),Qn=a=>Jn(xo(a)),kl=a=>({value:a,enumerable:!1,writable:!0,configurable:!0}),Ao={encode:qn,decode:Qn},es={encode:function(a,d={}){let{urlSafe:m=!1}=d;return Ao.encode(a,m)},decode:Ao.decode},_o="The provided `clientToken`",ts=`${_o} has expired`,rs=`${_o} is malformed`,is=(a,d,m)=>({"primer-client-token":a,"primer-sdk-client":"WEB","primer-sdk-version":"v2.53.5","primer-sdk-checkout-session-id":d,...m&&{"x-api-version":m}});async function os(a,d,m){let{accessToken:C,configurationUrl:M,analyticsUrlV2:x}=function(P){let H=function(B){try{let[ne,se]=B.split(".");return JSON.parse(es.decode(se||ne))}catch{throw Error(rs)}}(P),z=1e3*H.exp;if(Date.now()>z)throw Error(`${ts}. Expiration date: ${new Date(z).toISOString()}`);return H}(a),E=ui({checkoutSessionId:d,url:x}),T=g,O=T!==n.LEGACY?T:"2.3";E.timerStart({id:"CONFIGURATION_LOADING"});try{let{data:P,source:H}=await Fn(`${M}/?withDisplayMetadata=true`,{checkoutSessionId:d,headers:is(C,d,O),retryConfig:{enabled:!0},cacheConfig:m});return E.timerEnd({id:"CONFIGURATION_LOADING",context:{source:H}}),P}catch(P){let H=P instanceof Error?P.message:"Unknown error occurred";throw Error(`Failed to initialize client: ${H}`)}}function So(a){return a instanceof Error?{errorBody:a.message,stacktrace:a.stack}:typeof a=="object"&&a!==null&&"message"in a?{errorBody:String(a.message),stacktrace:"stack"in a?String(a.stack):void 0}:{errorBody:String(a||"Unknown error")}}function ur({checkoutSessionId:a,analytics:d,error:m,reporter:C}){d?.crashEvent?d.crashEvent({...So(m),reporter:C}):a&&yi(a,m,C)}async function yi(a,d,m){let C=await ao(Y.CRASH_EVENT,{...So(d),reporter:m},{checkoutSessionId:a});try{await fetch(S,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)})}catch(M){console.error("Failed to post crash event",M)}}let Mo=Symbol.for("initGlobalErrorMonitoringLoaded"),To=(a,d)=>{typeof window<"u"&&window[Mo]||(window[Mo]=!0,window.addEventListener("error",m=>{!as(m)&&ns(m)&&ur({checkoutSessionId:a,analytics:d,error:m.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",m=>{let C=m.reason||Error("Unhandled promise rejection");ss(C)&&ur({checkoutSessionId:a,analytics:d,error:C,reporter:"unhandledrejection"})}))},as=a=>a.message==="Script error."||!a.filename||a.lineno===0,ns=a=>{let d=a.filename;return!!(d&&bi(d))&&!!new u(a.error).isReported||!1},ss=a=>{if(a&&typeof a=="object"&&"stack"in a&&typeof a.stack=="string"){let d=u.from(a);return!d.isReported&&(!!("fileName"in a&&typeof a.fileName=="string"&&bi(a.fileName))||ls(d.stack).some(bi))}return!1},bi=a=>{try{return new URL(a,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},ls=a=>{if(!a)return[];let d=a.split(`
2
+ `),m=[],C=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(let M of d){let x=M.match(C);if(x&&x[1])m.push(x[1]);else{let E=/@(.*?):\d+:\d+$/,T=M.match(E);T&&T[1]&&m.push(T[1])}}return m};function Po(a,d,m){return document.querySelector(`${a}[${d}^="${m}"]`)}async function wo(a,d,m,C,M,x){let{analytics:E,name:T=d,retryConfig:O}=x;await po(()=>new Promise((P,H)=>{let z=Po(a,m,d)||function(B,ne){let se=document.createElement(B);return Object.entries(ne).forEach(([oe,ht])=>se.setAttribute(oe,ht)),se}(a,{...C,[m]:d});z.onload=()=>{E?.sdkFunctionEvent({name:T,params:[`${a.charAt(0).toUpperCase()+a.slice(1)} loaded successfully: ${d}`]}),P()},z.onerror=()=>{z.remove(),H(Error(`${M}: ${d}`))},z.parentNode||document.head.appendChild(z)}),O,P=>E?.messageEvent({...P,url:d}))}async function ko(a){return i||(i=Promise.all([function(d,m={}){return Po("script","src",d)&&window.__Primer?(m.analytics?.sdkFunctionEvent({name:m.name??d,params:["Script already loaded"]}),Promise.resolve()):wo("script",d,"src",{...m.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",m)}("https://sdk.primer.io/web/v2.53.5/PrimerCoreSDK.min.js",{analytics:a,name:"loadPrimerScript"}),function(d,m={}){return Array.from(document.styleSheets).some(C=>C.href===d)?(m.analytics?.sdkFunctionEvent({name:m.name??d,params:["Stylesheet already loaded"]}),Promise.resolve()):wo("link",d,"href",{...m.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",m)}("https://sdk.primer.io/web/v2.53.5/Checkout.css",{analytics:a,name:"loadPrimerCss"})]).then(()=>{let d=window.__Primer;return delete window.__Primer,d}).catch(d=>{throw i=void 0,d}))}let ds=async()=>{let a=fi();try{let d=mt(a);try{To(a,d),d.sdkFunctionEvent({name:"preloadPrimer"}),d.timerStart({id:V.preloadPrimer}),await ko(d),d.timerEnd({id:V.preloadPrimer})}catch(m){let C=u.from(m);throw C.isReported||(ur({checkoutSessionId:a,analytics:d,error:C,reporter:"preloadPrimer level 1"}),C.markAsReported()),C}}catch(d){let m=u.from(d);throw m.isReported||(yi(a,m,"preloadPrimer level 0"),m.markAsReported()),m}},ps=Ei("createHeadless"),cs=Ei("showUniversalCheckout"),ms=Ei("showVaultManager");function Ei(a){return async(...[d,m,...C])=>{var M;(M=m?.apiVersion)||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${l}'.`),g=M??l;let x=fi();try{let E=mt(x);try{To(x,E),E.sdkFunctionEvent({name:a,params:[d,m,...C]}),E.timerStart({id:V[a]});let[T,O]=await Promise.all([os(d,x,m?.clientSessionCachingEnabled?{key:d,usePrimerSessionCacheTtlHeader:!0}:void 0),ko(E)]);return O[a](T,x,d,m,...C)}catch(T){let O=u.from(T);throw O.isReported||(ur({checkoutSessionId:x,analytics:E,error:O,reporter:"lazyLoad level 1"}),O.markAsReported()),O}}catch(E){let T=u.from(E);throw T.isReported||(yi(x,T,"lazyLoad level 0"),T.markAsReported()),T}}}var us=function(a){return a.CHECKOUT="CHECKOUT",a.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",a.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",a}({}),hs=function(a){return a.DEFAULT="DEFAULT",a.PREFER_VAULT="PREFER_VAULT",a}({}),gs=function(a){return a.SUCCESS="AUTH_SUCCESS",a.FAILED="AUTH_FAILED",a.SKIPPED="SKIPPED",a.CHALLENGE="CHALLENGE",a}({});let $t={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",AUTOMATED_CLEARING_HOUSE:"AUTOMATED_CLEARING_HOUSE",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_ACH:"STRIPE_ACH",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL_ORDER",PAYPAL_VAULTED:"PAYPAL_BILLING_AGREEMENT",GO_CARDLESS:"GOCARDLESS",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME",KLARNA_CUSTOMER_TOKEN:"KLARNA_CUSTOMER_TOKEN"},Rt={WORLDPAY_IDEAL:"WORLDPAY_IDEAL",STRIPE_ACH:"STRIPE_ACH",STRIPE_IDEAL:"STRIPE_IDEAL",ADYEN_KLARNA:"ADYEN_KLARNA",ADYEN_BANCONTACT_CARD:"ADYEN_BANCONTACT_CARD",PAY_NL_KAARTDIRECT:"PAY_NL_KAARTDIRECT",ADYEN_EPS:"ADYEN_EPS",ADYEN_BANCONTACT_PAYCONIQ:"ADYEN_BANCONTACT_PAYCONIQ",OMISE_PROMPTPAY:"OMISE_PROMPTPAY",OMISE_TRUEMONEY:"OMISE_TRUEMONEY",ADYEN_MULTIBANCO:"ADYEN_MULTIBANCO",PACYPAY_WECHAT:"PACYPAY_WECHAT",PACYPAY_ALIPAY:"PACYPAY_ALIPAY",ADYEN_MBWAY:"ADYEN_MBWAY",XENDIT_DANA:"XENDIT_DANA",XENDIT_SHOPEEPAY:"XENDIT_SHOPEEPAY",ADYEN_PAYSHOP:"ADYEN_PAYSHOP",ADYEN_PAYTRAIL:"ADYEN_PAYTRAIL",CLEARPAY:"CLEARPAY",RAPYD_FAST:"RAPYD_FAST",RAPYD_PROMPTPAY:"RAPYD_PROMPTPAY",RAPYD_GCASH:"RAPYD_GCASH",RAPYD_POLI:"RAPYD_POLI",RAPYD_GRABPAY:"RAPYD_GRABPAY",PRIMER_PAYPAL:"PRIMER_PAYPAL",TWOC2P:"TWOC2P",NETS:"NETS",STRIPE_GIROPAY:"STRIPE_GIROPAY",MOLLIE_GIROPAY:"MOLLIE_GIROPAY",MOLLIE_EPS:"MOLLIE_EPS",PAY_NL_EPS:"PAY_NL_EPS",PAY_NL_P24:"PAY_NL_P24",MOLLIE_P24:"MOLLIE_P24",MOLLIE_SOFORT:"MOLLIE_SOFORT",COINBASE:"COINBASE",OPENNODE:"OPENNODE",MOLLIE_GIFT_CARD:"MOLLIE_GIFTCARD",XFERS_PAYNOW:"XFERS_PAYNOW",PAYMENT_CARD:"PAYMENT_CARD",APPLE_PAY:"APPLE_PAY",GOOGLE_PAY:"GOOGLE_PAY",PAYPAL:"PAYPAL",GO_CARDLESS:"GOCARDLESS",KLARNA:"KLARNA",PAY_NL_IDEAL:"PAY_NL_IDEAL",PAY_NL_SOFORT_BANKING:"PAY_NL_SOFORT_BANKING",PAY_NL_BANCONTACT:"PAY_NL_BANCONTACT",PAY_NL_PAYPAL:"PAY_NL_PAYPAL",PAY_NL_CREDIT_TRANSFER:"PAY_NL_CREDIT_TRANSFER",PAY_NL_DIRECT_DEBIT:"PAY_NL_DIRECT_DEBIT",PAY_NL_GIROPAY:"PAY_NL_GIROPAY",PAY_NL_PAYCONIQ:"PAY_NL_PAYCONIQ",HOOLAH:"HOOLAH",ADYEN_BLIK:"ADYEN_BLIK",ADYEN_MOBILEPAY:"ADYEN_MOBILEPAY",ADYEN_VIPPS:"ADYEN_VIPPS",ADYEN_GIROPAY:"ADYEN_GIROPAY",ADYEN_SOFORT:"ADYEN_SOFORT",ADYEN_IDEAL:"ADYEN_IDEAL",ADYEN_TRUSTLY:"ADYEN_TRUSTLY",ADYEN_ALIPAY:"ADYEN_ALIPAY",ADYEN_TWINT:"ADYEN_TWINT",ADYEN_BANK_TRANSFER:"ADYEN_BANK_TRANSFER",MOLLIE_BANCONTACT:"MOLLIE_BANCONTACT",MOLLIE_IDEAL:"MOLLIE_IDEAL",BUCKAROO_GIROPAY:"BUCKAROO_GIROPAY",BUCKAROO_EPS:"BUCKAROO_EPS",BUCKAROO_SOFORT:"BUCKAROO_SOFORT",BUCKAROO_BANCONTACT:"BUCKAROO_BANCONTACT",BUCKAROO_IDEAL:"BUCKAROO_IDEAL",ATOME:"ATOME"},fs={SINGLE_USE:"SINGLE_USE",MULTI_USE:"MULTI_USE"};$t.PAYPAL_VAULTED,Rt.PAYPAL,$t.KLARNA_CUSTOMER_TOKEN,Rt.KLARNA,$t.AUTOMATED_CLEARING_HOUSE,Rt.STRIPE_ACH,$t.CARD,Rt.PAYMENT_CARD;var vs=function(a){return a.INITIALIZATION_ERROR="INITIALIZATION_ERROR",a.NO_PAYMENT_METHODS="NO_PAYMENT_METHODS",a.PRIMER_TEARDOWN="PRIMER_TEARDOWN",a.PRIMER_SERVER_ERROR="PRIMER_SERVER_ERROR",a.THREE_DS_AUTH_FAILED="THREE_DS_AUTH_FAILED",a.TOKENIZATION_ERROR="TOKENIZATION_ERROR",a.DUPLICATE_PAYMENT_METHOD_ERROR="DUPLICATE_PAYMENT_METHOD_ERROR",a.CARD_NUMBER_ERROR="CARD_NUMBER_ERROR",a.PAYMENT_METHOD_NOT_SETUP="PAYMENT_METHOD_NOT_SETUP",a.PAYMENT_METHOD_NOT_PROVIDED="PAYMENT_METHOD_NOT_PROVIDED",a.PAYMENT_METHOD_NOT_COMPATIBLE="PAYMENT_METHOD_NOT_COMPATIBLE",a.RESUME_ERROR="RESUME_ERROR",a.VALIDATION_ERROR="VALIDATION_ERROR",a.PAYMENT_FAILED="PAYMENT_FAILED",a.PAYMENT_CREATION_ABORTED="PAYMENT_CREATION_ABORTED",a.PAYMENT_CREATION_DISABLED="PAYMENT_CREATION_DISABLED",a.CLIENT_SESSION_UPDATE_ERROR="CLIENT_SESSION_UPDATE_ERROR",a.INVALID_ARGUMENT="INVALID_ARGUMENT",a.VAULT_FETCH="VAULT_FETCH",a.VAULT_DELETE="VAULT_DELETE",a.HEADLESS_VAULT_MANAGER_VALIDATION="HEADLESS_VAULT_MANAGER_VALIDATION",a.CARD_FORM_VALIDATION_UNEXPECTED_FIELD="CARD_FORM_VALIDATION_UNEXPECTED_FIELD",a.MISSING_FIRST_NAME_OR_LAST_NAME="MISSING_FIRST_NAME_OR_LAST_NAME",a.MISSING_EMAIL_ADDRESS="MISSING_EMAIL_ADDRESS",a.INVALID_FLOW="INVALID_FLOW",a}({});function hr(a,d,m){return d in a?Object.defineProperty(a,d,{value:m,enumerable:!0,configurable:!0,writable:!0}):a[d]=m,a}class Ci extends u{static fromErrorCode(d,m){return new Ci(d,m)}constructor(d,m){super(m.message),hr(this,"code",void 0),hr(this,"diagnosticsId",void 0),hr(this,"data",void 0),hr(this,"isFromDeveloper",void 0),this.code=d,this.diagnosticsId=m.diagnosticsId??null,this.data=m.data,this.isFromDeveloper=m.isFromDeveloper??!1,this.name="PrimerClientError",Error.captureStackTrace&&Error.captureStackTrace(this,Ci)}}var ys=function(a){return a.PAYMENT_METHOD="PAYMENT_METHOD",a.CHECK="CHECK",a}({});let bs=a=>{let d=a?.mandateData;return!!d&&"fullMandateText"in d};var Es=function(a){return a.CHANGE="change",a.ERROR="error",a.FOCUS="focus",a.BLUR="blur",a.CLICK="click",a.CLOSE="close",a.CONFIRMED_KLARNA_CATEGORY="CONFIRMED_KLARNA_CATEGORY",a.CONFIRMED_KLARNA_CATEGORY_ERROR="CONFIRMED_KLARNA_CATEGORY_ERROR",a.KLARNA_SESSION_UPDATE="KLARNA_SESSION_UPDATE",a.KLARNA_SESSION_REFRESH_ERROR="KLARNA_SESSION_REFRESH_ERROR",a}({}),Cs=function(a){return a.CARD="CARD",a.NATIVE="NATIVE",a.REDIRECT="REDIRECT",a.KLARNA="KLARNA",a.ACH="ACH",a}({});let xs={SDK_VERSION:"v2.53.5",createHeadless:ps,showUniversalCheckout:cs,showVaultManager:ms,preloadPrimer:ds};return o})())});var gr=class{constructor(e){(this.host=e).addController(this)}hostConnected(){}setCardNetworksLoading(){let e={detectedCardNetwork:null,selectableCardNetworks:[],isLoading:!0};this.updateCardNetworksState(e)}updateCardNetworksState(e){this.host.primerEventsController.dispatchCardNetworkChange(e),this.host.sdkContextController.setCardNetworks(e)}async processCardNetworkChangeEvent(e){let{detectedCardNetworks:t,selectableCardNetworks:r}=e,o=t.preferred??t.items[0],n=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:o,selectableCardNetworks:n,isLoading:!1})}};var gt=class{constructor(e){(this.host=e).addController(this)}hostConnected(){}dispatchEvent(e,t){this.host.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}dispatchSdkState(e){this.dispatchEvent("primer-state-changed",e)}dispatchPaymentMethods(e){this.dispatchEvent("primer-payment-methods-updated",e)}dispatchCheckoutInitialized(e){this.dispatchEvent("primer-checkout-initialized",e)}dispatchCardNetworkChange(e){this.dispatchEvent("primer-card-network-change",e)}dispatchFormSubmitSuccess(e){this.dispatchEvent("primer-card-submit-success",{result:e})}dispatchFormSubmitErrors(e){this.dispatchEvent("primer-card-submit-errors",{errors:e})}};var Ne=class extends Event{constructor(e,t,r,o){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=r,this.subscribe=o??!1}};var ft=class{constructor(e,t,r,o){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,l)=>{this.unsubscribe&&(this.unsubscribe!==l&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,l)),this.unsubscribe=l},this.host=e,t.context!==void 0){let n=t;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=t,this.callback=r,this.subscribe=o??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Ne(this.context,this.host,this.t,this.subscribe))}};var fr=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let r=t||!Object.is(e,this.o);this.o=e,r&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:r}]of this.subscriptions)t(this.o,r)},e!==void 0&&(this.value=e)}addCallback(e,t,r){if(!r)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:o}=this.subscriptions.get(e);e(this.value,o)}clearCallbacks(){this.subscriptions.clear()}};var xi=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},q=class extends fr{constructor(e,t,r){super(t.context!==void 0?t.initialValue:r),this.onContextRequest=o=>{if(o.context!==this.context)return;let n=o.contextTarget??o.composedPath()[0];n!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,n,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let n=new Set;for(let[l,{consumerHost:g}]of this.subscriptions)n.has(l)||(n.add(l),g.dispatchEvent(new Ne(this.context,g,l,!0)));o.stopPropagation()},this.host=e,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new xi(this.context,this.host))}};function b({context:i,subscribe:e}){return(t,r)=>{typeof r=="object"?r.addInitializer(function(){new ft(this,{context:i,callback:o=>{t.set.call(this,o)},subscribe:e})}):t.constructor.addInitializer(o=>{new ft(o,{context:i,callback:n=>{o[r]=n},subscribe:e})})}}var vr="cardNetworksContext";var Le="clientOptionsContext";var $e="computedStylesContext";var W="headlessInstanceContext";var yr="klarnaCategoriesContext";var J="managerContext";var vt="paymentMethodsContext";var j="sdkStateContext";var Q="vaultManagerContext";var Re="vaultManagerCvvContext";var N=class N{static log(e,...t){N.enabled&&console.log(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.log,...t)}static info(e,...t){N.enabled&&console.info(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.info,...t)}static warn(e,...t){N.enabled&&console.warn(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.warn,...t)}static error(e,...t){N.enabled&&console.error(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.error,...t)}static debug(e,...t){N.enabled&&console.debug(`%c${N.brandTag}%c ${e}`,N.brandStyle,N.styles.debug,...t)}static table(e,t){N.enabled&&console.table(e,t)}static time(e){N.enabled&&console.time(`${N.brandTag} ${e}`)}static timeEnd(e){N.enabled&&console.timeEnd(`${N.brandTag} ${e}`)}};N.enabled=!0,N.defaultFont="font-family: Consolas, monospace; font-size: 12px;",N.brandTag="[PRIMER]",N.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+N.defaultFont,N.styles={log:"color: #4CAF50; "+N.defaultFont,info:"color: #2196F3; "+N.defaultFont,warn:"color: #FF9800; "+N.defaultFont,error:"color: #F44336; "+N.defaultFont,debug:"color: #9C27B0; "+N.defaultFont};var R=N;function Ss(i,e,t,r){let o=i,n=t;return{dispatch:l=>{let g=e(o,l,n);o=g,r(g)},getState:()=>Object.freeze({...o}),setCallbacks:l=>{n={...n,...l}}}}function Dt(i){return(e,t,r)=>{let o=i[t.type];if(!o)throw new Error(`No handler for action type: ${t.type}`);return o(e,t,r)}}var We=class{constructor(e,t,r,o,n=()=>{this.host.requestUpdate()}){this.host=e;this.stateHandler=n;this.host.addController(this),this._dispatcher=Ss(t,r,o,l=>{this.stateHandler(l)})}get currentState(){return this._dispatcher.getState()}dispatch(e){this._dispatcher.dispatch(e)}setCallbacks(e){this._dispatcher.setCallbacks(e)}hostConnected(){}hostDisconnected(){}},br=class{constructor(e){this.host=e;this._controllers=[];"addController"in this.host&&this.host.addController(this)}addController(e){this._controllers.push(e)}hostConnected(){this._controllers.forEach(e=>{e.hostConnected&&e.hostConnected()})}hostDisconnected(){this._controllers.forEach(e=>{e.hostDisconnected&&e.hostDisconnected()})}};var Cr={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},Ms={START_LOADING:i=>({...i,isLoading:!0}),START_PROCESSING:i=>({...i,failure:null,isProcessing:!0}),STOP_PROCESSING:i=>({...i,isProcessing:!1}),COMPLETE_PROCESSING:i=>({...i,isProcessing:!1,isSuccessful:!0}),SET_ERROR:(i,e)=>(R.error(e.payload.message),{...i,isProcessing:!1,error:e.payload}),SET_FAILURE:(i,e)=>({...i,isProcessing:!1,failure:e.payload}),COMPLETE_LOADING:i=>({...i,isLoading:!1}),RESET:()=>Cr,RESET_ERROR:i=>({...i,error:null,failure:null})},Ts=Dt(Ms),Er=class extends We{constructor(e){super(e,Cr,Ts,null,t=>{e.sdkContextController.setSdkState(t),e.primerEventsController.dispatchSdkState(t)})}startLoading(){this.dispatch({type:"START_LOADING"})}startProcessing(){this.dispatch({type:"START_PROCESSING"})}stopProcessing(){this.dispatch({type:"STOP_PROCESSING"})}completeProcessing(){this.dispatch({type:"COMPLETE_PROCESSING"})}completeLoading(){this.dispatch({type:"COMPLETE_LOADING"})}setError(e){this.dispatch({type:"SET_ERROR",payload:e})}setFailure(e,t,r){this.dispatch({type:"SET_FAILURE",payload:{code:e,message:t,details:r}})}reset(){this.dispatch({type:"RESET"})}resetError(){this.dispatch({type:"RESET_ERROR"})}forceCompleteLoading(){this.currentState.isLoading&&(R.warn("Force completing loading state"),this.completeLoading())}};var xr=class{constructor(e){this.sdkStateProvider=null;this.paymentMethodsProvider=null;this.paymentManagerProvider=null;this.cardNetworksContext=null;this.vaultManagerCvvProvider=null;this.clientOptionsContext=null;this.headlessUtilsProvider=null;this.klarnaCategoriesProvider=null;this.computedStylesProvider=null;(this.host=e).addController(this),this.sdkStateProvider=new q(e,{context:j,initialValue:Cr}),this.paymentMethodsProvider=new q(e,{context:vt,initialValue:null}),this.paymentManagerProvider=new q(e,{context:J,initialValue:new Map}),this.cardNetworksContext=new q(e,{context:vr,initialValue:null}),this.vaultManagerProvider=new q(e,{context:Q,initialValue:null}),this.vaultManagerCvvProvider=new q(e,{context:Re,initialValue:null}),this.clientOptionsContext=new q(e,{context:Le,initialValue:null}),this.klarnaCategoriesProvider=new q(e,{context:yr,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new q(e,{context:W,initialValue:null}),this.computedStylesProvider=new q(e,{context:$e,initialValue:null})}hostConnected(){}setSdkState(e){this.sdkStateProvider?.setValue(e)}setPaymentMethods(e){this.paymentMethodsProvider?.setValue(e)}setPaymentManagers(e){this.paymentManagerProvider?.setValue(e)}setCardNetworks(e){this.cardNetworksContext?.setValue(e)}setVaultManager(e){this.vaultManagerProvider?.setValue(e)}setKlarnaCategories(e){this.klarnaCategoriesProvider?.setValue(e)}setClientOptions(e){this.clientOptionsContext?.setValue(e)}setHeadlessUtils(e){this.headlessUtilsProvider?.setValue(e)}setComputedStyles(e){this.computedStylesProvider?.setValue(e)}setVaultManagerCvv(e){this.vaultManagerCvvProvider?.setValue(e)}};var Ze=class Ze{constructor(e){(this.host=e).addController(this)}processCustomStyles(e){try{let t=JSON.parse(e);this.applyStyles(t)}catch(t){R.error("Error parsing customStyles property.",t instanceof Error?t:new Error(String(t)))}}isValidCssProperty(e){return/^[a-zA-Z][a-zA-Z0-9]*$/.test(e)}isValidCssValue(e){let r=/^[\w\s#.,%()\-+/!]+$/.test(e);return r||R.warn(`Rejected potentially unsafe CSS value: ${e}`),r}getCssVarName(e){let t=Ze.cssVarCache.get(e);return t||(t="--"+e.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),Ze.cssVarCache.set(e,t)),t}applyStyles(e){let t=[];for(let r of Object.keys(e)){let o=e[r];if(!o)continue;if(!this.isValidCssProperty(r)){R.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(o))continue;let n=this.getCssVarName(r);t.push([n,o])}if(t.length>0)for(let[r,o]of t)this.host.style.setProperty(r,o)}removeStyle(e){let t=this.getCssVarName(e);this.host.style.removeProperty(t)}clearAllStyles(){for(let e of Ze.cssVarCache.keys()){let t=Ze.cssVarCache.get(e);t&&this.host.style.removeProperty(t)}}hostDisconnected(){}};Ze.cssVarCache=new Map;var Ar=Ze;var _r=globalThis,Sr=_r.ShadowRoot&&(_r.ShadyCSS===void 0||_r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ai=Symbol(),Oo=new WeakMap,Vt=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Ai)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Sr&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Oo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Oo.set(t,e))}return e}toString(){return this.cssText}},Do=i=>new Vt(typeof i=="string"?i:i+"",void 0,Ai),f=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((r,o,n)=>r+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[n+1],i[0]);return new Vt(t,i,Ai)},_i=(i,e)=>{if(Sr)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),o=_r.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=t.cssText,i.appendChild(r)}},Mr=Sr?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return Do(t)})(i):i;var{is:Ps,defineProperty:ws,getOwnPropertyDescriptor:ks,getOwnPropertyNames:Is,getOwnPropertySymbols:Ns,getPrototypeOf:Ls}=Object,Oe=globalThis,Vo=Oe.trustedTypes,$s=Vo?Vo.emptyScript:"",Rs=Oe.reactiveElementPolyfillSupport,Ht=(i,e)=>i,Ut={toAttribute(i,e){switch(e){case Boolean:i=i?$s:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},yt=(i,e)=>!Ps(i,e),Ho={attribute:!0,type:String,converter:Ut,reflect:!1,hasChanged:yt};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Oe.litPropertyMetadata??(Oe.litPropertyMetadata=new WeakMap);var Ce=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ho){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(e,r,t);o!==void 0&&ws(this.prototype,e,o)}}static getPropertyDescriptor(e,t,r){let{get:o,set:n}=ks(this.prototype,e)??{get(){return this[t]},set(l){this[t]=l}};return{get(){return o?.call(this)},set(l){let g=o?.call(this);n.call(this,l),this.requestUpdate(e,g,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ho}static _$Ei(){if(this.hasOwnProperty(Ht("elementProperties")))return;let e=Ls(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ht("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ht("properties"))){let t=this.properties,r=[...Is(t),...Ns(t)];for(let o of r)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,o]of t)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let o=this._$Eu(t,r);o!==void 0&&this._$Eh.set(o,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let o of r)t.unshift(Mr(o))}else e!==void 0&&t.push(Mr(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return _i(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EC(e,t){let r=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,r);if(o!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:Ut).toAttribute(t,r.type);this._$Em=e,n==null?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(e,t){let r=this.constructor,o=r._$Eh.get(e);if(o!==void 0&&this._$Em!==o){let n=r.getPropertyOptions(o),l=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Ut;this._$Em=o,this[o]=l.fromAttribute(t,n.type),this._$Em=null}}requestUpdate(e,t,r){if(e!==void 0){if(r??(r=this.constructor.getPropertyOptions(e)),!(r.hasChanged??yt)(this[e],t))return;this.P(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),r.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,n]of r)n.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],n)}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EU()}catch(r){throw e=!1,this._$EU(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}};Ce.elementStyles=[],Ce.shadowRootOptions={mode:"open"},Ce[Ht("elementProperties")]=new Map,Ce[Ht("finalized")]=new Map,Rs?.({ReactiveElement:Ce}),(Oe.reactiveElementVersions??(Oe.reactiveElementVersions=[])).push("2.0.4");var De={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},L=Symbol(),D=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((e,t)=>{this.o=e,this.h=t}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(e,t,r){this.p=0,this.i=0,(this._=e).addController(this);let o=typeof t=="object"?t:{task:t,args:r};this.v=o.task,this.j=o.args,this.m=o.argsEqual??Uo,this.k=o.onComplete,this.A=o.onError,this.autoRun=o.autoRun??!0,"initialValue"in o&&(this.u=o.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let e=this.j();if(!Array.isArray(e))throw Error("The args function must return an array");return e}async S(){let e=this.T(),t=this.O;this.O=e,e===t||e===void 0||t!==void 0&&this.m(t,e)||await this.run(e)}async run(e){let t,r;e??(e=this.T()),this.O=e,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();let o=++this.p;this.q=new AbortController;let n=!1;try{t=await this.v(e,{signal:this.q.signal})}catch(l){n=!0,r=l}if(this.p===o){if(t===L)this.i=0;else{if(n===!1){try{this.k?.(t)}catch{}this.i=2,this.o?.(t)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=t,this.l=r}this._.requestUpdate()}}abort(e){this.i===1&&this.q?.abort(e)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(e){switch(this.i){case 0:return e.initial?.();case 1:return e.pending?.();case 2:return e.complete?.(this.value);case 3:return e.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},Uo=(i,e)=>i===e||i.length===e.length&&i.every((t,r)=>!yt(t,e[r]));var Os={SET_LOADING:(i,e)=>({...i,isLoading:e.payload}),SET_UPDATING:(i,e)=>({...i,isUpdating:e.payload}),INITIALIZE_VAULT_MANAGER:(i,e,t)=>({...i,enabled:e.vaultEnabled,cvvRecapture:e.cvvRecapture,deleteVaultedPaymentMethod:t.deleteVaultedPaymentMethod,startVaultedPaymentFlow:t.startVaultedPaymentFlow,createCvvInput:t.createCvvInput}),UPDATE_PAYMENT_METHODS:(i,e)=>({...i,vaultedPaymentMethods:e.payload,isLoading:!1,isUpdating:!1}),SET_ERROR:i=>({...i,isLoading:!1,isUpdating:!1}),DISABLE:i=>({...i,enabled:!1}),RESET:()=>Yo},Ds={INITIALIZE_CVV:(i,e,t)=>({...i,setCvvInput:t.setCvvInput,setSelectedVaultedPaymentMethod:t.setSelectedVaultedPaymentMethod}),SET_FORM_DIRTY:(i,e)=>({...i,formIsDirty:e.payload}),SET_CVV_INPUT:(i,e)=>({...i,cvvInput:e.payload}),SET_SELECTED_VAULTED_PAYMENT_METHOD:(i,e)=>({...i,selectedVaultedPaymentMethod:e.payload}),RESET_CVV:()=>zo},Vs=Dt(Os),Hs=Dt(Ds),Yo={enabled:!1,isLoading:!1,isUpdating:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:null,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},zo={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}},Si=class extends We{constructor(e,t){super(e,Yo,Vs,t,r=>{e.sdkContextController.setVaultManager(r)})}setLoading(e){this.dispatch({type:"SET_LOADING",payload:e})}setUpdating(e){this.dispatch({type:"SET_UPDATING",payload:e})}initializeVaultManager(e,t,r){this.dispatch({type:"INITIALIZE_VAULT_MANAGER",payload:e,vaultEnabled:t,cvvRecapture:r})}updatePaymentMethods(e){this.dispatch({type:"UPDATE_PAYMENT_METHODS",payload:e})}setError(e){this.dispatch({type:"SET_ERROR",payload:e})}disable(){this.dispatch({type:"DISABLE"})}reset(){this.dispatch({type:"RESET"})}},Mi=class extends We{constructor(e,t){super(e,zo,Hs,t,r=>{e.sdkContextController.setVaultManagerCvv(r)})}initializeCvv(e){this.dispatch({type:"INITIALIZE_CVV",createCvvInput:e})}setFormDirty(e){this.dispatch({type:"SET_FORM_DIRTY",payload:e})}setCvvInputState(e){this.dispatch({type:"SET_CVV_INPUT",payload:e})}setSelectedPaymentMethod(e){this.dispatch({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:e})}resetCvv(){this.dispatch({type:"RESET_CVV"})}},Yt=class extends br{constructor(t){super(t);this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async t=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.coreController.updatePaymentMethods(this.vaultManagerState.vaultedPaymentMethods),await this._vaultManager.deleteVaultedPaymentMethod(t),await this.fetchVaultedPaymentMethods()}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to delete payment method")),r}};this.setCvvInput=t=>{this.itemController.setCvvInputState(t)};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let t=this.vaultItemState.selectedVaultedPaymentMethod,r=this.vaultManagerState.cvvRecapture,o=this.vaultItemState.cvvInput;if(!t||r&&(!o||o.metadata.error)){this.itemController.setFormDirty(!0);return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(t.id,r?{cvv:o.valueToken}:void 0)}catch(n){R.error("VaultManagerController: Error starting vaulted payment flow",n),this.coreController.setError(n instanceof Error?n:new Error("Failed to start vaulted payment flow")),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=t=>{this.itemController.setSelectedPaymentMethod(t),this.itemController.setFormDirty(!1)};this.coreController=new Si(t,{deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod.bind(this),startVaultedPaymentFlow:this.startVaultedPaymentFlow.bind(this),createCvvInput:this.createCvvInput.bind(this)}),this.itemController=new Mi(t,{setCvvInput:this.setCvvInput.bind(this),setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod.bind(this)}),this.addController(this.coreController),this.addController(this.itemController),new D(this.host,{task:async([r,o])=>{if(!r||!o?.vaultEnabled)return this.coreController.disable(),L;this.coreController.setLoading(!0);try{this.coreController.initializeVaultManager(r,o.vaultEnabled,!!o.captureVaultedCardCvv),this.itemController.initializeCvv(r.createCvvInput),await this.fetchVaultedPaymentMethods(!0),R.log("VaultManagerController: Vault initialized successfully",{coreState:this.coreController.currentState,cvvState:this.itemController.currentState})}catch(n){R.error("VaultManagerController: Failed to initialize vault",n),this.coreController.setError(n instanceof Error?n:new Error("Unknown error"))}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(t,r){this.vaultManager=t,this.options=r??null}get vaultManager(){return this._vaultManager}set vaultManager(t){this._vaultManager=t,this.host.requestUpdate()}get options(){return this._options}set options(t){this._options=t,this.host.requestUpdate()}get vaultManagerState(){return this.coreController.currentState}get vaultItemState(){return this.itemController.currentState}hostDisconnected(){super.hostDisconnected(),this.vaultManager=null,this.coreController.reset()}async fetchVaultedPaymentMethods(t){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{t||this.coreController.setUpdating(!0);let r=await this._vaultManager.fetchVaultedPaymentMethods();return R.log("VaultManagerController: Fetched payment methods",r),this.coreController.updatePaymentMethods(r),r}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to fetch payment methods")),r}}createCvvInput(t){if(!this._vaultManager)throw new Error("Vault manager not initialized");return this._vaultManager.createCvvInput(t)}};var zt="lit-localize-status";var Fo=i=>typeof i!="string"&&"strTag"in i,Tr=(i,e,t)=>{let r=i[0];for(let o=1;o<i.length;o++)r+=e[t?t[o-1]:o-1],r+=i[o];return r};var Ft=i=>Fo(i)?Tr(i.strings,i.values):i;var A=Ft,Bo=!1;function Ti(i){if(Bo)throw new Error("lit-localize can only be configured once");A=i,Bo=!0}var Pi=class{constructor(e){this.__litLocalizeEventHandler=t=>{t.detail.status==="ready"&&this.host.requestUpdate()},this.host=e}hostConnected(){window.addEventListener(zt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(zt,this.__litLocalizeEventHandler)}},Us=i=>i.addController(new Pi(i)),Ko=Us;var $=()=>(i,e)=>(i.addInitializer(Ko),i);var Bt=class{constructor(){this.settled=!1,this.promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}resolve(e){this.settled=!0,this._resolve(e)}reject(e){this.settled=!0,this._reject(e)}};var xe=[];for(let i=0;i<256;i++)xe[i]=(i>>4&15).toString(16)+(i&15).toString(16);function jo(i){let e=0,t=8997,r=0,o=33826,n=0,l=40164,g=0,u=52210;for(let S=0;S<i.length;S++)t^=i.charCodeAt(S),e=t*435,r=o*435,n=l*435,g=u*435,n+=t<<8,g+=o<<8,r+=e>>>16,t=e&65535,n+=r>>>16,o=r&65535,u=g+(n>>>16)&65535,l=n&65535;return xe[u>>8]+xe[u&255]+xe[l>>8]+xe[l&255]+xe[o>>8]+xe[o&255]+xe[t>>8]+xe[t&255]}var Ys="",zs="h",Fs="s";function Go(i,e){return(e?zs:Fs)+jo(typeof i=="string"?i:i.join(Ys))}var qo=new WeakMap,Wo=new Map;function Zo(i,e,t){if(i){let r=t?.id??Bs(e),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return Tr(o.strings,e.values,o.values);{let n=qo.get(o);return n===void 0&&(n=o.values,qo.set(o,n)),{...o,values:n.map(l=>e.values[l])}}}}return Ft(e)}function Bs(i){let e=typeof i=="string"?i:i.strings,t=Wo.get(e);return t===void 0&&(t=Go(e,typeof i!="string"&&!("strTag"in i)),Wo.set(e,t)),t}function wi(i){window.dispatchEvent(new CustomEvent(zt,{detail:i}))}var wr="",ki,Xo,kr,Ii,Jo,Xe=new Bt;Xe.resolve();var Pr=0,Qo=i=>(Ti((e,t)=>Zo(Jo,e,t)),wr=Xo=i.sourceLocale,kr=new Set(i.targetLocales),kr.add(i.sourceLocale),Ii=i.loadLocale,{getLocale:Ks,setLocale:js}),Ks=()=>wr,js=i=>{if(i===(ki??wr))return Xe.promise;if(!kr||!Ii)throw new Error("Internal error");if(!kr.has(i))throw new Error("Invalid locale code");Pr++;let e=Pr;return ki=i,Xe.settled&&(Xe=new Bt),wi({status:"loading",loadingLocale:i}),(i===Xo?Promise.resolve({templates:void 0}):Ii(i)).then(r=>{Pr===e&&(wr=i,ki=void 0,Jo=r.templates,wi({status:"ready",readyLocale:i}),Xe.resolve())},r=>{Pr===e&&(wi({status:"error",errorLocale:i,errorMessage:r.toString()}),Xe.reject(r))}),Xe.promise};var Ni="en",Li=["ar","bg","ca","cs","da","de","el","en-GB","es","es-AR","es-MX","et-EE","fi-FI","fr","he","hr","hu","id","it","ja","ko","lt","lt-LT","lv","lv-LV","ms","nb","nl","nl_NL","pl","pt","pt-BR","ro","ru","sk","sl","sr-RS","sv","th","tr","uk-UA","vi","zf","zh-CN","zh-HK","zh-TW"],ea="You must call `loadLocale` first to set up the localized template.",ta,Ir,ra=i=>{let e=Qo({sourceLocale:Ni,targetLocales:Li,loadLocale:i});ta=e.getLocale,Ir=e.setLocale};var $i=i=>{ra(i)},Ri=i=>{if(!Ir)throw new Error(ea);return Ir(i)};var Kt=new Set(Li);Kt.add(Ni);var Oi=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let e=i.replace("_","-");if(Kt.has(e))return!0;let t=e.split("-")[0];return!!Kt.has(t)},Di=i=>{if(i==="en")return"en-GB";let e=i.replace("_","-");if(Kt.has(e))return e;let t=e.split("-")[0];return Kt.has(t)?t:"en-GB"};var Gt=globalThis,Nr=Gt.trustedTypes,ia=Nr?Nr.createPolicy("lit-html",{createHTML:i=>i}):void 0,Hi="$lit$",Ae=`lit$${Math.random().toFixed(9).slice(2)}$`,Ui="?"+Ae,Gs=`<${Ui}>`,et=document,qt=()=>et.createComment(""),Wt=i=>i===null||typeof i!="object"&&typeof i!="function",Yi=Array.isArray,da=i=>Yi(i)||typeof i?.[Symbol.iterator]=="function",Vi=`[
3
+ \f\r]`,jt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,oa=/-->/g,aa=/>/g,Je=RegExp(`>|${Vi}(?:([^\\s"'>=/]+)(${Vi}*=${Vi}*(?:[^
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),na=/'/g,sa=/"/g,pa=/^(?:script|style|textarea|title)$/i,zi=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),c=zi(1),Se=zi(2),pc=zi(3),_e=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),la=new WeakMap,Qe=et.createTreeWalker(et,129);function ca(i,e){if(!Yi(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return ia!==void 0?ia.createHTML(e):e}var ma=(i,e)=>{let t=i.length-1,r=[],o,n=e===2?"<svg>":e===3?"<math>":"",l=jt;for(let g=0;g<t;g++){let u=i[g],S,k,_=-1,V=0;for(;V<u.length&&(l.lastIndex=V,k=l.exec(u),k!==null);)V=l.lastIndex,l===jt?k[1]==="!--"?l=oa:k[1]!==void 0?l=aa:k[2]!==void 0?(pa.test(k[2])&&(o=RegExp("</"+k[2],"g")),l=Je):k[3]!==void 0&&(l=Je):l===Je?k[0]===">"?(l=o??jt,_=-1):k[1]===void 0?_=-2:(_=l.lastIndex-k[2].length,S=k[1],l=k[3]===void 0?Je:k[3]==='"'?sa:na):l===sa||l===na?l=Je:l===oa||l===aa?l=jt:(l=Je,o=void 0);let Y=l===Je&&i[g+1].startsWith("/>")?" ":"";n+=l===jt?u+Gs:_>=0?(r.push(S),u.slice(0,_)+Hi+u.slice(_)+Ae+Y):u+Ae+(_===-2?g:Y)}return[ca(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},Zt=class i{constructor({strings:e,_$litType$:t},r){let o;this.parts=[];let n=0,l=0,g=e.length-1,u=this.parts,[S,k]=ma(e,t);if(this.el=i.createElement(S,r),Qe.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(o=Qe.nextNode())!==null&&u.length<g;){if(o.nodeType===1){if(o.hasAttributes())for(let _ of o.getAttributeNames())if(_.endsWith(Hi)){let V=k[l++],Y=o.getAttribute(_).split(Ae),he=/([.?@])?(.*)/.exec(V);u.push({type:1,index:n,name:he[2],strings:Y,ctor:he[1]==="."?$r:he[1]==="?"?Rr:he[1]==="@"?Or:rt}),o.removeAttribute(_)}else _.startsWith(Ae)&&(u.push({type:6,index:n}),o.removeAttribute(_));if(pa.test(o.tagName)){let _=o.textContent.split(Ae),V=_.length-1;if(V>0){o.textContent=Nr?Nr.emptyScript:"";for(let Y=0;Y<V;Y++)o.append(_[Y],qt()),Qe.nextNode(),u.push({type:2,index:++n});o.append(_[V],qt())}}}else if(o.nodeType===8)if(o.data===Ui)u.push({type:2,index:n});else{let _=-1;for(;(_=o.data.indexOf(Ae,_+1))!==-1;)u.push({type:7,index:n}),_+=Ae.length-1}n++}}static createElement(e,t){let r=et.createElement("template");return r.innerHTML=e,r}};function tt(i,e,t=i,r){if(e===_e)return e;let o=r!==void 0?t._$Co?.[r]:t._$Cl,n=Wt(e)?void 0:e._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),n===void 0?o=void 0:(o=new n(i),o._$AT(i,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=o:t._$Cl=o),o!==void 0&&(e=tt(i,o._$AS(i,e.values),o,r)),e}var Lr=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,o=(e?.creationScope??et).importNode(t,!0);Qe.currentNode=o;let n=Qe.nextNode(),l=0,g=0,u=r[0];for(;u!==void 0;){if(l===u.index){let S;u.type===2?S=new bt(n,n.nextSibling,this,e):u.type===1?S=new u.ctor(n,u.name,u.strings,this,e):u.type===6&&(S=new Dr(n,this,e)),this._$AV.push(S),u=r[++g]}l!==u?.index&&(n=Qe.nextNode(),l++)}return Qe.currentNode=et,o}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},bt=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,o){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=tt(this,e,t),Wt(e)?e===h||e==null||e===""?(this._$AH!==h&&this._$AR(),this._$AH=h):e!==this._$AH&&e!==_e&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):da(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==h&&Wt(this._$AH)?this._$AA.nextSibling.data=e:this.T(et.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=Zt.createElement(ca(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(t);else{let n=new Lr(o,this),l=n.u(this.options);n.p(t),this.T(l),this._$AH=n}}_$AC(e){let t=la.get(e.strings);return t===void 0&&la.set(e.strings,t=new Zt(e)),t}k(e){Yi(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,o=0;for(let n of e)o===t.length?t.push(r=new i(this.O(qt()),this.O(qt()),this,this.options)):r=t[o],r._$AI(n),o++;o<t.length&&(this._$AR(r&&r._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},rt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,o,n){this.type=1,this._$AH=h,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=h}_$AI(e,t=this,r,o){let n=this.strings,l=!1;if(n===void 0)e=tt(this,e,t,0),l=!Wt(e)||e!==this._$AH&&e!==_e,l&&(this._$AH=e);else{let g=e,u,S;for(e=n[0],u=0;u<n.length-1;u++)S=tt(this,g[r+u],t,u),S===_e&&(S=this._$AH[u]),l||(l=!Wt(S)||S!==this._$AH[u]),S===h?e=h:e!==h&&(e+=(S??"")+n[u+1]),this._$AH[u]=S}l&&!o&&this.j(e)}j(e){e===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},$r=class extends rt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===h?void 0:e}},Rr=class extends rt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==h)}},Or=class extends rt{constructor(e,t,r,o,n){super(e,t,r,o,n),this.type=5}_$AI(e,t=this){if((e=tt(this,e,t,0)??h)===_e)return;let r=this._$AH,o=e===h&&r!==h||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,n=e!==h&&(r===h||o);o&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Dr=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){tt(this,e)}},ua={M:Hi,P:Ae,A:Ui,C:1,L:ma,R:Lr,D:da,V:tt,I:bt,H:rt,N:Rr,U:Or,B:$r,F:Dr},qs=Gt.litHtmlPolyfillSupport;qs?.(Zt,bt),(Gt.litHtmlVersions??(Gt.litHtmlVersions=[])).push("3.2.1");var ha=(i,e,t)=>{let r=t?.renderBefore??e,o=r._$litPart$;if(o===void 0){let n=t?.renderBefore??null;r._$litPart$=o=new bt(e.insertBefore(qt(),n),n,void 0,t??{})}return o._$AI(i),o};var v=class extends Ce{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;let e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ha(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return _e}};v._$litElement$=!0,v.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:v});var Ws=globalThis.litElementPolyfillSupport;Ws?.({LitElement:v});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var y=i=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(i,e)}):customElements.define(i,e)};var Zs={attribute:!0,type:String,converter:Ut,reflect:!1,hasChanged:yt},Xs=(i=Zs,e,t)=>{let{kind:r,metadata:o}=t,n=globalThis.litPropertyMetadata.get(o);if(n===void 0&&globalThis.litPropertyMetadata.set(o,n=new Map),n.set(t.name,i),r==="accessor"){let{name:l}=t;return{set(g){let u=e.get.call(this);e.set.call(this,g),this.requestUpdate(l,u,i)},init(g){return g!==void 0&&this.P(l,void 0,i),g}}}if(r==="setter"){let{name:l}=t;return function(g){let u=this[l];e.call(this,g),this.requestUpdate(l,u,i)}}throw Error("Unsupported decorator location: "+r)};function p(i){return(e,t)=>typeof t=="object"?Xs(i,e,t):((r,o,n)=>{let l=o.hasOwnProperty(n);return o.constructor.createProperty(n,l?{...r,wrapped:!0}:r),l?Object.getOwnPropertyDescriptor(o,n):void 0})(i,e,t)}function I(i){return p({...i,state:!0,attribute:!1})}var it=(i,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(i,e,t),t);function Ve(i,e){return(t,r,o)=>{let n=l=>l.renderRoot?.querySelector(i)??null;if(e){let{get:l,set:g}=typeof r=="object"?t:o??(()=>{let u=Symbol();return{get(){return this[u]},set(S){this[u]=S}}})();return it(t,r,{get(){let u=l.call(this);return u===void 0&&(u=n(this),(u!==null||this.hasUpdated)&&g.call(this,u)),u}})}return it(t,r,{get(){return n(this)}})}}function U(i,e,t){return i?e(i):t?.(i)}var w=f`
5
5
  * {
6
6
  box-sizing: border-box;
7
7
  }
8
- `,So=h`
8
+ `,ga=f`
9
9
  :host {
10
10
  display: block;
11
11
  isolation: isolate;
@@ -14,14 +14,14 @@ import{a as Gi,b as fn,c as zr,d as n}from"./chunks/chunk.G45OCYEN.js";var wr=fn
14
14
  //Keep the CSS loader in the same position - check css-loader-inline.ts
15
15
  min-height: 64px;
16
16
  }
17
- `;var ko="https://sdk.primer.io/web/v2-latest/Primer.min.js";var vr=class{constructor(t){this._methods=t}get(t){return this._methods.get(t)}toArray(){return Array.from(this._methods.values())}size(){return this._methods.size}};var yr=typeof window<"u"&&typeof window.document<"u";function $n(i){return document.querySelector(`script[src^="${i}"]`)}function Vn(i,t){let e=document.createElement("script");return e.setAttribute("src",i),e.setAttribute("async",""),e.setAttribute("crossorigin","anonymous"),t&&e.setAttribute("type","module"),e}function To(i,t=!1){if(!yr)throw new Error("Cannot load script in server environment");let e=$n(i)??Vn(i,t);return new Promise((r,o)=>{e.onload=()=>{r()},e.onerror=()=>{o()},e.parentNode||document.head.appendChild(e)})}var br=class{constructor(t){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=t).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new R(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new R(t,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(t){this._paymentsList=t,this.host.requestUpdate()}get paymentsList(){return this._paymentsList}hostConnected(){this.isDisconnected=!1,this.host.sdkStateController.startLoading(),this.setupLoadingTimeout()}hostDisconnected(){this.isDisconnected=!0,this.cleanupResources()}setupLoadingTimeout(){this.clearLoadingTimeout(),this.loadingTimeout=setTimeout(()=>{this.host.sdkStateController.state.isLoading&&(P.warn("Loading timeout reached, resetting SDK state"),this.cleanupResources(),this.host.sdkStateController.completeLoading())},1e4)}clearLoadingTimeout(){this.loadingTimeout!==null&&(clearTimeout(this.loadingTimeout),this.loadingTimeout=null)}cleanupResources(){if(this.clearLoadingTimeout(),this.currentSdkInstance)try{this.paymentsList=[],this.createPaymentMethodManager=null,this.host.sdkStateController.reset(),P.info("SDK instance cleaned up")}catch(t){P.error("Error cleaning up SDK instance:",t)}this.currentSdkInstance=null}async _loadV2Sdk(t=ko){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){P.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await To(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(this.isDisconnected)return P.warn("Component disconnected, aborting SDK initialization"),I;if(!t||!e)return I;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window,o=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:m=>{this.isDisconnected||(P.info("Configuration payment methods:",m),this.paymentsList=m)},onCheckoutComplete:({payment:m})=>{this.isDisconnected||(P.info("Payment completed:",m),this.host.sdkStateController.completeProcessing())},onCheckoutFail:(m,C,v)=>{this.isDisconnected||(P.error("Payment failed:",m),this.host.sdkStateController.setFailure(m.code||"UNKNOWN_ERROR",m.message||"Unknown error occurred"),v&&v.showErrorMessage())},onBeforePaymentCreate:(m,C)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),C?.continuePaymentCreation())},onPaymentMethodAction:(m,C)=>{this.isDisconnected||m==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.reset()}});if(this.createPaymentMethodManager=o.createPaymentMethodManager.bind(o),this.currentSdkInstance=o,await o.start(),this.isDisconnected)return this.cleanupResources(),I;this.host.sdkContextController.setClientOptions(e),this.host.primerEventsController.dispatchCheckoutInitialized(o);let s=o.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(s),this.host.vaultManagerController.initializeVaultManager(o.createVaultManager(),{vaultEnabled:e.vault?.enabled,captureVaultedCardCvv:!!s.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),o}catch(r){throw r instanceof Error&&(P.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([t,e])=>{if(this.isDisconnected)return I;if(!t||!e.length)return I;let r=new Map,o=new Map;try{for(let m of e){if(this.isDisconnected)break;let C=await this.initializePaymentMethodManager(m)();m&&C&&(r.set(m.type,m),o.set(m.type,C))}if(this.isDisconnected)return I;let s=new vr(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(s),this.host.primerEventsController.dispatchPaymentMethods(s),P.info("Initialized payment methods:",s.toArray()),r}catch(s){if(s instanceof Error)throw this.host.sdkStateController.setError(s),s;return null}finally{this.clearLoadingTimeout(),this.isDisconnected||this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(t){let{type:e,managerType:r}=t;return async()=>{if(this.isDisconnected||!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let o=await this.createPaymentMethodManager(e,{onPaymentMethodCategoriesChange:s=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:s,isLoading:!1})},onPaymentMethodAction:s=>{this.isDisconnected||s==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.reset()}});return o?{type:e,manager:o}:null}try{if(r==="CARD"){let s=await this.createPaymentMethodManager(e,{onCardNetworksChange:async m=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(m)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return s?{type:e,manager:s}:null}let o=await this.createPaymentMethodManager(e);return o?{type:e,manager:o}:null}catch(o){return P.error(`Failed to initialize manager for ${e}:`,o),null}}}};var Er=class{constructor(t){this.host=t,t.addController(this)}_error(t){let{error:e}=t.detail;this.host.sdkStateController.setFailure("UNKNOWN_ERROR",e.message)}_mandateConfirmed(){this.host.sdkStateController.completeProcessing()}_mandateDeclined(){this.host.sdkStateController.setFailure("UNKNOWN_ERROR","Mandate declined")}hostConnected(){this.host.addEventListener("primer-ach-error",this._error.bind(this)),this.host.addEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.addEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}hostDisconnected(){this.host.removeEventListener("primer-ach-error",this._error.bind(this)),this.host.removeEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.removeEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}};var Hn=Gi({"../../localization/lit-localize/locales/ar.ts":()=>import("./chunks/ar.5AY75F5J.js"),"../../localization/lit-localize/locales/bg.ts":()=>import("./chunks/bg.2EL2HTYI.js"),"../../localization/lit-localize/locales/ca.ts":()=>import("./chunks/ca.WZI7CBFW.js"),"../../localization/lit-localize/locales/cs.ts":()=>import("./chunks/cs.GBLLNC3E.js"),"../../localization/lit-localize/locales/da.ts":()=>import("./chunks/da.CDEFQG44.js"),"../../localization/lit-localize/locales/de.ts":()=>import("./chunks/de.UHURA2HV.js"),"../../localization/lit-localize/locales/el.ts":()=>import("./chunks/el.BY5NGYDF.js"),"../../localization/lit-localize/locales/en-GB.ts":()=>import("./chunks/en-GB.UBLLAUVW.js"),"../../localization/lit-localize/locales/en.ts":()=>import("./chunks/en.BKAVPUID.js"),"../../localization/lit-localize/locales/es-AR.ts":()=>import("./chunks/es-AR.EYNC6EAZ.js"),"../../localization/lit-localize/locales/es-MX.ts":()=>import("./chunks/es-MX.OIO2YURF.js"),"../../localization/lit-localize/locales/es.ts":()=>import("./chunks/es.CNNIJYLX.js"),"../../localization/lit-localize/locales/et-EE.ts":()=>import("./chunks/et-EE.4ZF6CLB6.js"),"../../localization/lit-localize/locales/fi-FI.ts":()=>import("./chunks/fi-FI.4ZXWRRYI.js"),"../../localization/lit-localize/locales/fr.ts":()=>import("./chunks/fr.TZM5I4K2.js"),"../../localization/lit-localize/locales/he.ts":()=>import("./chunks/he.DWEZBG4A.js"),"../../localization/lit-localize/locales/hr.ts":()=>import("./chunks/hr.BV4PC324.js"),"../../localization/lit-localize/locales/hu.ts":()=>import("./chunks/hu.MTEKSS3J.js"),"../../localization/lit-localize/locales/id.ts":()=>import("./chunks/id.SJSTOPSC.js"),"../../localization/lit-localize/locales/it.ts":()=>import("./chunks/it.IISTMHN5.js"),"../../localization/lit-localize/locales/ja.ts":()=>import("./chunks/ja.IBQ3ID5C.js"),"../../localization/lit-localize/locales/ko.ts":()=>import("./chunks/ko.KZVQLI4V.js"),"../../localization/lit-localize/locales/lt-LT.ts":()=>import("./chunks/lt-LT.RKBB7CZ6.js"),"../../localization/lit-localize/locales/lt.ts":()=>import("./chunks/lt.TLM7OCXP.js"),"../../localization/lit-localize/locales/lv-LV.ts":()=>import("./chunks/lv-LV.H5TJC2T4.js"),"../../localization/lit-localize/locales/lv.ts":()=>import("./chunks/lv.G4SRVBAC.js"),"../../localization/lit-localize/locales/ms.ts":()=>import("./chunks/ms.ATTITA66.js"),"../../localization/lit-localize/locales/nb.ts":()=>import("./chunks/nb.5EE7XOA7.js"),"../../localization/lit-localize/locales/nl.ts":()=>import("./chunks/nl.TY2SYTKZ.js"),"../../localization/lit-localize/locales/nl_NL.ts":()=>import("./chunks/nl_NL.GB5BQ5PG.js"),"../../localization/lit-localize/locales/pl.ts":()=>import("./chunks/pl.5PRBSG4K.js"),"../../localization/lit-localize/locales/pt-BR.ts":()=>import("./chunks/pt-BR.5XRZB5WW.js"),"../../localization/lit-localize/locales/pt.ts":()=>import("./chunks/pt.TA5H5JUJ.js"),"../../localization/lit-localize/locales/ro.ts":()=>import("./chunks/ro.PSZKGHRP.js"),"../../localization/lit-localize/locales/ru.ts":()=>import("./chunks/ru.3QZY7ZIT.js"),"../../localization/lit-localize/locales/sk.ts":()=>import("./chunks/sk.FAQFYLGM.js"),"../../localization/lit-localize/locales/sl.ts":()=>import("./chunks/sl.QRSCQXJP.js"),"../../localization/lit-localize/locales/sr-RS.ts":()=>import("./chunks/sr-RS.TKMMG7FK.js"),"../../localization/lit-localize/locales/sv.ts":()=>import("./chunks/sv.HZ3E6V5F.js"),"../../localization/lit-localize/locales/th.ts":()=>import("./chunks/th.AY6M42B4.js"),"../../localization/lit-localize/locales/tr.ts":()=>import("./chunks/tr.TFKBPYMO.js"),"../../localization/lit-localize/locales/uk-UA.ts":()=>import("./chunks/uk-UA.3TU67RSI.js"),"../../localization/lit-localize/locales/vi.ts":()=>import("./chunks/vi.NLXELMXV.js"),"../../localization/lit-localize/locales/zf.ts":()=>import("./chunks/zf.U5XPENNR.js"),"../../localization/lit-localize/locales/zh-CN.ts":()=>import("./chunks/zh-CN.VEOQJ3EU.js"),"../../localization/lit-localize/locales/zh-HK.ts":()=>import("./chunks/zh-HK.ZEXSW7FF.js"),"../../localization/lit-localize/locales/zh-TW.ts":()=>import("./chunks/zh-TW.MMVWEQMZ.js")});ti(i=>Hn(`../../localization/lit-localize/locales/${i}.ts`));var se=class extends g{constructor(){super();this.customStyles="";this.clientToken="";this.options={};this._jsInitialized=!1;this.previousLoadingState=!0;this.hasAssignedContent=!1;this._loadingTimeoutId=null;this.locale="en-GB";this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.sdkContextController=new er(this),this.sdkStateController=new Qt(this),this.primerEventsController=new at(this),this.styleProcessingController=new tr(this),this.vaultManagerController=new wt(this),this.cardNetworkController=new qt(this),this.achPaymentEventsController=new Er(this),new br(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,o){e==="customstyles"?this.styleProcessingController.processCustomStyles(o):super.attributeChangedCallback(e,r,o)}disconnectedCallback(){this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null),this.sdkStateController?.state.isLoading&&this.sdkStateController.forceCompleteLoading(),super.disconnectedCallback()}willUpdate(e){e.has("options")&&(this.options?.locale&&(ii(this.options?.locale)?this.locale=oi(this.options?.locale):P.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),ri(this.locale||"en-GB"))}updated(){let e=getComputedStyle(this);this.sdkContextController.setComputedStyles(e),this.checkLoadingStateChange()}checkLoadingStateChange(){let e=this.sdkStateController?.state.isLoading||!1;this.previousLoadingState&&!e&&(this.jsInitialized=!0),this.previousLoadingState=e,e&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.state.isLoading&&(P.warn("Loading timeout in component, forcing completion"),this.sdkStateController.forceCompleteLoading(),this.jsInitialized=!0),this._loadingTimeoutId=null},1e4):!e&&this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null)}render(){let e=this.sdkStateController.state,r=e.isLoading,o=e.error,s=!r&&!o;return p`
18
- ${V(r,()=>u)}
19
- ${V(o,()=>p`<primer-checkout-error></primer-checkout-error>`)}
20
- ${V(s,()=>p`
17
+ `;var fa="https://sdk.primer.io/web/v2-latest/Primer.min.js";var Vr=class{constructor(e){this._methods=e}get(e){return this._methods.get(e)}toArray(){return Array.from(this._methods.values())}size(){return this._methods.size}};var Hr=typeof window<"u"&&typeof window.document<"u";function Js(i){return document.querySelector(`script[src^="${i}"]`)}function Qs(i,e){let t=document.createElement("script");return t.setAttribute("src",i),t.setAttribute("async",""),t.setAttribute("crossorigin","anonymous"),e&&t.setAttribute("type","module"),t}function va(i,e=!1){if(!Hr)throw new Error("Cannot load script in server environment");let t=Js(i)??Qs(i,e);return new Promise((r,o)=>{t.onload=()=>{r()},t.onerror=()=>{o()},t.parentNode||document.head.appendChild(t)})}var Ur=class{constructor(e){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=e).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new D(e,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new D(e,{args:()=>[this.sdkInstanceTask.value,this.paymentsList],task:this.initializeLitContext()})}set paymentsList(e){this._paymentsList=e,this.host.requestUpdate()}get paymentsList(){return this._paymentsList}hostConnected(){this.isDisconnected=!1,this.host.sdkStateController.startLoading(),this.setupLoadingTimeout()}hostDisconnected(){this.isDisconnected=!0,this.cleanupResources()}setupLoadingTimeout(){this.clearLoadingTimeout(),this.loadingTimeout=setTimeout(()=>{this.host.sdkStateController.currentState.isLoading&&(R.warn("Loading timeout reached, resetting SDK state"),this.cleanupResources(),this.host.sdkStateController.completeLoading())},1e4)}clearLoadingTimeout(){this.loadingTimeout!==null&&(clearTimeout(this.loadingTimeout),this.loadingTimeout=null)}cleanupResources(){if(this.clearLoadingTimeout(),this.currentSdkInstance)try{this.paymentsList=[],this.createPaymentMethodManager=null,this.host.sdkStateController.reset(),R.info("SDK instance cleaned up")}catch(e){R.error("Error cleaning up SDK instance:",e)}this.currentSdkInstance=null}async _loadV2Sdk(e=fa){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){R.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await va(e),await window.Primer.preloadPrimer()}initializeHeadless(){return async([e,t])=>{if(this.isDisconnected)return R.warn("Component disconnected, aborting SDK initialization"),L;if(!e||!t)return L;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window,o=await r.createHeadless(e,{...t,onAvailablePaymentMethodsLoad:l=>{this.isDisconnected||(R.info("Configuration payment methods:",l),this.paymentsList=l)},onCheckoutComplete:({payment:l})=>{this.isDisconnected||(R.info("Payment completed:",l),this.host.sdkStateController.completeProcessing())},onCheckoutFail:(l,g,u)=>{this.isDisconnected||(R.error("Payment failed:",l),this.host.sdkStateController.setFailure(l.code||"UNKNOWN_ERROR",l.message||"Unknown error occurred"),u&&u.showErrorMessage())},onBeforePaymentCreate:(l,g)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),g?.continuePaymentCreation())},onPaymentMethodAction:(l,g)=>{this.isDisconnected||l==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.stopProcessing()},onPaymentCreationStart:()=>{this.isDisconnected||this.host.sdkStateController.resetError()}});if(this.createPaymentMethodManager=o.createPaymentMethodManager.bind(o),this.currentSdkInstance=o,await o.start(),this.isDisconnected)return this.cleanupResources(),L;this.host.sdkContextController.setClientOptions(t),this.host.primerEventsController.dispatchCheckoutInitialized(o);let n=o.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(n),this.host.vaultManagerController.initializeVaultManager(o.createVaultManager(),{vaultEnabled:t.vault?.enabled,captureVaultedCardCvv:!!n.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),o}catch(r){throw r instanceof Error&&(R.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([e,t])=>{if(this.isDisconnected)return L;if(!e||!t.length)return L;let r=new Map,o=new Map;try{for(let l of t){if(this.isDisconnected)break;let g=await this.initializePaymentMethodManager(l)();l&&g&&(r.set(l.type,l),o.set(l.type,g))}if(this.isDisconnected)return L;let n=new Vr(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(n),this.host.primerEventsController.dispatchPaymentMethods(n),R.info("Initialized payment methods:",n.toArray()),r}catch(n){if(n instanceof Error)throw this.host.sdkStateController.setError(n),n;return null}finally{this.clearLoadingTimeout(),this.isDisconnected||this.host.sdkStateController.completeLoading()}}}initializePaymentMethodManager(e){let{type:t,managerType:r}=e;return async()=>{if(this.isDisconnected||!this.createPaymentMethodManager)return null;if(r==="KLARNA"){let o=await this.createPaymentMethodManager("KLARNA",{onPaymentMethodCategoriesChange:n=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:n,isLoading:!1})}});return o?{type:t,manager:o}:null}try{if(r==="CARD"){let n=await this.createPaymentMethodManager(t,{onCardNetworksChange:async l=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(l)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return n?{type:t,manager:n}:null}let o=await this.createPaymentMethodManager(t);return o?{type:t,manager:o}:null}catch(o){return R.error(`Failed to initialize manager for ${t}:`,o),null}}}};var Yr=class{constructor(e){this.host=e,e.addController(this)}_error(e){let{error:t}=e.detail;this.host.sdkStateController.setFailure("UNKNOWN_ERROR",t.message)}_mandateConfirmed(){this.host.sdkStateController.completeProcessing()}_mandateDeclined(){this.host.sdkStateController.setFailure("UNKNOWN_ERROR","Mandate declined")}hostConnected(){this.host.addEventListener("primer-ach-error",this._error.bind(this)),this.host.addEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.addEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}hostDisconnected(){this.host.removeEventListener("primer-ach-error",this._error.bind(this)),this.host.removeEventListener("primer-ach-mandate-confirmed",this._mandateConfirmed.bind(this)),this.host.removeEventListener("primer-ach-mandate-declined",this._mandateDeclined.bind(this))}};var el=$o({"../../localization/lit-localize/locales/ar.ts":()=>import("./chunks/ar.5AY75F5J.js"),"../../localization/lit-localize/locales/bg.ts":()=>import("./chunks/bg.2EL2HTYI.js"),"../../localization/lit-localize/locales/ca.ts":()=>import("./chunks/ca.WZI7CBFW.js"),"../../localization/lit-localize/locales/cs.ts":()=>import("./chunks/cs.GBLLNC3E.js"),"../../localization/lit-localize/locales/da.ts":()=>import("./chunks/da.CDEFQG44.js"),"../../localization/lit-localize/locales/de.ts":()=>import("./chunks/de.UHURA2HV.js"),"../../localization/lit-localize/locales/el.ts":()=>import("./chunks/el.BY5NGYDF.js"),"../../localization/lit-localize/locales/en-GB.ts":()=>import("./chunks/en-GB.UBLLAUVW.js"),"../../localization/lit-localize/locales/en.ts":()=>import("./chunks/en.BKAVPUID.js"),"../../localization/lit-localize/locales/es-AR.ts":()=>import("./chunks/es-AR.EYNC6EAZ.js"),"../../localization/lit-localize/locales/es-MX.ts":()=>import("./chunks/es-MX.OIO2YURF.js"),"../../localization/lit-localize/locales/es.ts":()=>import("./chunks/es.CNNIJYLX.js"),"../../localization/lit-localize/locales/et-EE.ts":()=>import("./chunks/et-EE.4ZF6CLB6.js"),"../../localization/lit-localize/locales/fi-FI.ts":()=>import("./chunks/fi-FI.4ZXWRRYI.js"),"../../localization/lit-localize/locales/fr.ts":()=>import("./chunks/fr.TZM5I4K2.js"),"../../localization/lit-localize/locales/he.ts":()=>import("./chunks/he.DWEZBG4A.js"),"../../localization/lit-localize/locales/hr.ts":()=>import("./chunks/hr.BV4PC324.js"),"../../localization/lit-localize/locales/hu.ts":()=>import("./chunks/hu.MTEKSS3J.js"),"../../localization/lit-localize/locales/id.ts":()=>import("./chunks/id.SJSTOPSC.js"),"../../localization/lit-localize/locales/it.ts":()=>import("./chunks/it.IISTMHN5.js"),"../../localization/lit-localize/locales/ja.ts":()=>import("./chunks/ja.IBQ3ID5C.js"),"../../localization/lit-localize/locales/ko.ts":()=>import("./chunks/ko.KZVQLI4V.js"),"../../localization/lit-localize/locales/lt-LT.ts":()=>import("./chunks/lt-LT.RKBB7CZ6.js"),"../../localization/lit-localize/locales/lt.ts":()=>import("./chunks/lt.TLM7OCXP.js"),"../../localization/lit-localize/locales/lv-LV.ts":()=>import("./chunks/lv-LV.H5TJC2T4.js"),"../../localization/lit-localize/locales/lv.ts":()=>import("./chunks/lv.G4SRVBAC.js"),"../../localization/lit-localize/locales/ms.ts":()=>import("./chunks/ms.ATTITA66.js"),"../../localization/lit-localize/locales/nb.ts":()=>import("./chunks/nb.5EE7XOA7.js"),"../../localization/lit-localize/locales/nl.ts":()=>import("./chunks/nl.TY2SYTKZ.js"),"../../localization/lit-localize/locales/nl_NL.ts":()=>import("./chunks/nl_NL.GB5BQ5PG.js"),"../../localization/lit-localize/locales/pl.ts":()=>import("./chunks/pl.5PRBSG4K.js"),"../../localization/lit-localize/locales/pt-BR.ts":()=>import("./chunks/pt-BR.5XRZB5WW.js"),"../../localization/lit-localize/locales/pt.ts":()=>import("./chunks/pt.TA5H5JUJ.js"),"../../localization/lit-localize/locales/ro.ts":()=>import("./chunks/ro.PSZKGHRP.js"),"../../localization/lit-localize/locales/ru.ts":()=>import("./chunks/ru.3QZY7ZIT.js"),"../../localization/lit-localize/locales/sk.ts":()=>import("./chunks/sk.FAQFYLGM.js"),"../../localization/lit-localize/locales/sl.ts":()=>import("./chunks/sl.QRSCQXJP.js"),"../../localization/lit-localize/locales/sr-RS.ts":()=>import("./chunks/sr-RS.TKMMG7FK.js"),"../../localization/lit-localize/locales/sv.ts":()=>import("./chunks/sv.HZ3E6V5F.js"),"../../localization/lit-localize/locales/th.ts":()=>import("./chunks/th.AY6M42B4.js"),"../../localization/lit-localize/locales/tr.ts":()=>import("./chunks/tr.TFKBPYMO.js"),"../../localization/lit-localize/locales/uk-UA.ts":()=>import("./chunks/uk-UA.3TU67RSI.js"),"../../localization/lit-localize/locales/vi.ts":()=>import("./chunks/vi.NLXELMXV.js"),"../../localization/lit-localize/locales/zf.ts":()=>import("./chunks/zf.U5XPENNR.js"),"../../localization/lit-localize/locales/zh-CN.ts":()=>import("./chunks/zh-CN.VEOQJ3EU.js"),"../../localization/lit-localize/locales/zh-HK.ts":()=>import("./chunks/zh-HK.ZEXSW7FF.js"),"../../localization/lit-localize/locales/zh-TW.ts":()=>import("./chunks/zh-TW.MMVWEQMZ.js")});$i(i=>el(`../../localization/lit-localize/locales/${i}.ts`));var zr={LOADER_DISABLED:"loader-disabled",CUSTOM_STYLES:"custom-styles",CLIENT_TOKEN:"client-token",JS_INIT:"js-initialized"},le=class extends v{constructor(){super();this.customStyles="";this.clientToken="";this.options={};this._jsInitialized=!1;this.previousLoadingState=!0;this.hasAssignedContent=!1;this._loadingTimeoutId=null;this.locale="en-GB";this.onSlotChange=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.sdkContextController=new xr(this),this.sdkStateController=new Er(this),this.primerEventsController=new gt(this),this.styleProcessingController=new Ar(this),this.vaultManagerController=new Yt(this),this.cardNetworkController=new gr(this),this.achPaymentEventsController=new Yr(this),new Ur(this)}set jsInitialized(t){this.requestUpdate(),this._jsInitialized=t}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(t,r,o){t===zr.CUSTOM_STYLES?this.styleProcessingController.processCustomStyles(o):super.attributeChangedCallback(t,r,o)}disconnectedCallback(){this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null),this.sdkStateController?.currentState.isLoading&&this.sdkStateController.forceCompleteLoading(),super.disconnectedCallback()}willUpdate(t){t.has("options")&&(this.options?.locale&&(Oi(this.options?.locale)?this.locale=Di(this.options?.locale):R.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),Ri(this.locale||"en-GB"))}updated(){let t=getComputedStyle(this);this.sdkContextController.setComputedStyles(t),this.checkLoadingStateChange()}checkLoadingStateChange(){let t=this.sdkStateController?.currentState.isLoading||!1;this.previousLoadingState&&!t&&(this.jsInitialized=!0),this.previousLoadingState=t,t&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.currentState.isLoading&&(R.warn("Loading timeout in component, forcing completion"),this.sdkStateController.forceCompleteLoading(),this.jsInitialized=!0),this._loadingTimeoutId=null},1e4):!t&&this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null)}render(){let t=this.sdkStateController.currentState,r=t.isLoading,o=t.error,n=!r&&!o;return c`
18
+ ${U(r,()=>h)}
19
+ ${U(o,()=>c`<primer-checkout-error></primer-checkout-error>`)}
20
+ ${U(n,()=>c`
21
21
  <slot name="main" @slotchange=${this.onSlotChange}></slot>
22
- ${V(this.hasAssignedContent,()=>u,()=>p`<primer-main></primer-main>`)}
23
- `,()=>u)}
24
- `}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};se.styles=[k,So],n([d({type:String,attribute:"custom-styles"})],se.prototype,"customStyles",2),n([d({type:String,attribute:"client-token"})],se.prototype,"clientToken",2),n([d({type:Object})],se.prototype,"options",2),n([d({type:Boolean,reflect:!0,attribute:"js-initialized"})],se.prototype,"_jsInitialized",2),n([Oe("slot")],se.prototype,"defaultSlot",2),n([T()],se.prototype,"previousLoadingState",2),se=n([L(),f("primer-checkout")],se);function Un(i){return document.querySelector(`#${i}`)}function Yn(i,t){let e=document.createElement("style");return e.textContent=i,e.id=t,e}function Ht(i,t,e=!0){if(!yr||Un(t))return;let o=Yn(i,t);e&&document.head.firstChild?document.head.insertBefore(o,document.head.firstChild):document.head.appendChild(o)}var wo=`
22
+ ${U(this.hasAssignedContent,()=>h,()=>c`<primer-main></primer-main>`)}
23
+ `,()=>h)}
24
+ `}addEventListener(t,r,o){super.addEventListener(t,r,o)}removeEventListener(t,r,o){super.removeEventListener(t,r,o)}};le.styles=[w,ga],s([p({type:String,attribute:zr.CUSTOM_STYLES})],le.prototype,"customStyles",2),s([p({type:String,attribute:zr.CLIENT_TOKEN})],le.prototype,"clientToken",2),s([p({type:Object})],le.prototype,"options",2),s([p({type:Boolean,reflect:!0,attribute:zr.JS_INIT})],le.prototype,"_jsInitialized",2),s([Ve("slot")],le.prototype,"defaultSlot",2),s([I()],le.prototype,"previousLoadingState",2),le=s([$(),y("primer-checkout")],le);function tl(i){return document.querySelector(`#${i}`)}function rl(i,e){let t=document.createElement("style");return t.textContent=i,t.id=e,t}function Xt(i,e,t=!0){if(!Hr||tl(e))return;let o=rl(i,e);t&&document.head.firstChild?document.head.insertBefore(o,document.head.firstChild):document.head.appendChild(o)}var ya=`
25
25
  @keyframes primer-css-spinner-rotate {
26
26
  0% {
27
27
  transform: rotate(0deg);
@@ -57,7 +57,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
57
57
  animation: primer-css-spinner-rotate 1.2s linear infinite;
58
58
  z-index: 9999;
59
59
  }
60
- `;var Po=`/**
60
+ `;var ba=`/**
61
61
  * Do not edit directly, this file was auto-generated.
62
62
  */
63
63
 
@@ -165,7 +165,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
165
165
  --primer-color-border-transparent-focus: var(--primer-color-focus);
166
166
  --primer-color-border-transparent-loading: var(--primer-color-border-transparent-disabled);
167
167
  }
168
- `,Io=`/**
168
+ `,Ea=`/**
169
169
  * Do not edit directly, this file was auto-generated.
170
170
  */
171
171
 
@@ -185,7 +185,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
185
185
  --primer-color-blue-500: #3f93e4;
186
186
  --primer-color-blue-900: #4aaeff;
187
187
  }
188
- `;var zn="primer-light-theme-css",Fn="primer-dark-theme-css";function pi(){Ht(Po,zn,!0)}function ci(){Ht(Io,Fn,!0)}function Lo(){pi(),ci()}function No(){Ht(wo,"primer-css-loader-styles",!1)}function Ro(){Lo()}function Bn(){pi()}function Kn(){ci()}var Oo=h`
188
+ `;var il="primer-light-theme-css",ol="primer-dark-theme-css";function Fi(){Xt(ba,il,!0)}function Bi(){Xt(Ea,ol,!0)}function Ca(){Fi(),Bi()}function xa(){Xt(ya,"primer-css-loader-styles",!1)}function Aa(){Ca()}function al(){Fi()}function nl(){Bi()}var _a=f`
189
189
  :host {
190
190
  display: inline-flex;
191
191
  align-items: center;
@@ -230,12 +230,12 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
230
230
  transform: rotate(360deg);
231
231
  }
232
232
  }
233
- `;var mi={small:16,medium:24,large:32},Ae=class extends g{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in mi)return mi[this.size];let e=parseInt(this.size,10);return isNaN(e)?mi.medium:e}render(){let e=this.getSize(),r=20,o=`0 0 ${r} ${r}`;return this.style.setProperty("--spinner-color",this.color),this.style.setProperty("--spinner-size",`${e}px`),p`
233
+ `;var Ki={small:16,medium:24,large:32},Me=class extends v{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in Ki)return Ki[this.size];let t=parseInt(this.size,10);return isNaN(t)?Ki.medium:t}render(){let t=this.getSize(),r=20,o=`0 0 ${r} ${r}`;return this.style.setProperty("--spinner-color",this.color),this.style.setProperty("--spinner-size",`${t}px`),c`
234
234
  <div class="spinner-container ${this.compact?"compact":""}">
235
235
  <svg
236
236
  class="spinner"
237
- width="${e}"
238
- height="${e}"
237
+ width="${t}"
238
+ height="${t}"
239
239
  viewBox="${o}"
240
240
  fill="none"
241
241
  xmlns="http://www.w3.org/2000/svg"
@@ -249,7 +249,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
249
249
  />
250
250
  </svg>
251
251
  </div>
252
- `}};Ae.styles=[Oo],n([d({type:String})],Ae.prototype,"color",2),n([d({type:String})],Ae.prototype,"size",2),n([d({type:Boolean})],Ae.prototype,"compact",2),Ae=n([f("primer-spinner")],Ae);var xr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ut=i=>(...t)=>({_$litDirective$:i,values:t}),pt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var q=Ut(class extends pt{constructor(i){if(super(i),i.type!==xr.ATTRIBUTE||i.name!=="class"||i.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(t=>i[t]).join(" ")+" "}update(i,[t]){if(this.st===void 0){this.st=new Set,i.strings!==void 0&&(this.nt=new Set(i.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(let r in t)t[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(t)}let e=i.element.classList;for(let r of this.st)r in t||(e.remove(r),this.st.delete(r));for(let r in t){let o=!!t[r];o===this.st.has(r)||this.nt?.has(r)||(o?(e.add(r),this.st.add(r)):(e.remove(r),this.st.delete(r)))}return Ce}});var Do=h`
252
+ `}};Me.styles=[_a],s([p({type:String})],Me.prototype,"color",2),s([p({type:String})],Me.prototype,"size",2),s([p({type:Boolean})],Me.prototype,"compact",2),Me=s([y("primer-spinner")],Me);var Fr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Jt=i=>(...e)=>({_$litDirective$:i,values:e}),Et=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var Z=Jt(class extends Et{constructor(i){if(super(i),i.type!==Fr.ATTRIBUTE||i.name!=="class"||i.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(e=>i[e]).join(" ")+" "}update(i,[e]){if(this.st===void 0){this.st=new Set,i.strings!==void 0&&(this.nt=new Set(i.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(let r in e)e[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(e)}let t=i.element.classList;for(let r of this.st)r in e||(t.remove(r),this.st.delete(r));for(let r in e){let o=!!e[r];o===this.st.has(r)||this.nt?.has(r)||(o?(t.add(r),this.st.add(r)):(t.remove(r),this.st.delete(r)))}return _e}});var Sa=f`
253
253
  * {
254
254
  box-sizing: border-box;
255
255
  }
@@ -314,15 +314,15 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
314
314
  border-color: var(--primer-color-border-outlined-disabled);
315
315
  cursor: not-allowed;
316
316
  }
317
- `;var Me=class extends g{constructor(){super(...arguments);this.focusWithin=!1;this.hasError=!1}handleWrapperClick(e){if(e.target!==e.currentTarget)return;let r=this.findSlottedPrimerInput();r?r.focus():this.dispatchEvent(new CustomEvent("wrapper-click",{bubbles:!0,composed:!0}))}findSlottedPrimerInput(){if(!this.inputSlot)return null;let e=this.inputSlot.assignedElements({flatten:!0}),r=e.find(o=>o.tagName.toLowerCase()==="primer-input");if(r)return r;for(let o of e){let s=o.querySelector("primer-input");if(s)return s}return null}render(){let e={"input-slot":!0,"focus-within":this.focusWithin};return p`
317
+ `;var Te=class extends v{constructor(){super(...arguments);this.focusWithin=!1;this.hasError=!1}handleWrapperClick(t){if(t.target!==t.currentTarget)return;let r=this.findSlottedPrimerInput();r?r.focus():this.dispatchEvent(new CustomEvent("wrapper-click",{bubbles:!0,composed:!0}))}findSlottedPrimerInput(){if(!this.inputSlot)return null;let t=this.inputSlot.assignedElements({flatten:!0}),r=t.find(o=>o.tagName.toLowerCase()==="primer-input");if(r)return r;for(let o of t){let n=o.querySelector("primer-input");if(n)return n}return null}render(){let t={"input-slot":!0,"focus-within":this.focusWithin};return c`
318
318
  <div class="input-wrapper">
319
319
  <slot name="label"></slot>
320
- <div class="${q(e)}" @click="${this.handleWrapperClick}">
320
+ <div class="${Z(t)}" @click="${this.handleWrapperClick}">
321
321
  <slot name="input"></slot>
322
322
  </div>
323
323
  <slot name="error"></slot>
324
324
  </div>
325
- `}};Me.styles=[Do],n([d({type:Boolean})],Me.prototype,"focusWithin",2),n([d({type:Boolean,reflect:!0,attribute:"has-error"})],Me.prototype,"hasError",2),n([Oe('slot[name="input"]')],Me.prototype,"inputSlot",2),Me=n([f("primer-input-wrapper")],Me);var $o=h`
325
+ `}};Te.styles=[Sa],s([p({type:Boolean})],Te.prototype,"focusWithin",2),s([p({type:Boolean,reflect:!0,attribute:"has-error"})],Te.prototype,"hasError",2),s([Ve('slot[name="input"]')],Te.prototype,"inputSlot",2),Te=s([y("primer-input-wrapper")],Te);var Ma=f`
326
326
  :host {
327
327
  display: inline-block;
328
328
  font-weight: var(--primer-typography-body-small-weight);
@@ -336,7 +336,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
336
336
  :host([disabled]) {
337
337
  color: var(--primer-color-text-disabled);
338
338
  }
339
- `;var De=class extends g{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return p`<label for=${this.for}><slot></slot></label>`}};De.styles=[$o],n([d({type:String,reflect:!0})],De.prototype,"for",2),n([d({type:Boolean,reflect:!0})],De.prototype,"disabled",2),De=n([f("primer-input-label")],De);var Vo=h`
339
+ `;var He=class extends v{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return c`<label for=${this.for}><slot></slot></label>`}};He.styles=[Ma],s([p({type:String,reflect:!0})],He.prototype,"for",2),s([p({type:Boolean,reflect:!0})],He.prototype,"disabled",2),He=s([y("primer-input-label")],He);var Ta=f`
340
340
  :host {
341
341
  display: contents;
342
342
  }
@@ -503,19 +503,19 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
503
503
  :host([variant='tertiary'][loading]) primer-spinner {
504
504
  transform: scale(0.85);
505
505
  }
506
- `;var le=class extends g{constructor(){super(...arguments);this.variant="primary";this.disabled=!1;this.loading=!1;this.buttonType="button";this.selectionState="default";this.selectable=!1}handleClick(){!this.selectable||this.disabled||this.loading||(this.selectionState=this.selectionState==="default"?"checked":"default",this.dispatchEvent(new CustomEvent("selection-change",{bubbles:!0,composed:!0,detail:{state:this.selectionState}})))}renderCheckmark(){return!this.selectable||this.selectionState!=="checked"||this.loading?u:p`
506
+ `;var de=class extends v{constructor(){super(...arguments);this.variant="primary";this.disabled=!1;this.loading=!1;this.buttonType="button";this.selectionState="default";this.selectable=!1}handleClick(){!this.selectable||this.disabled||this.loading||(this.selectionState=this.selectionState==="default"?"checked":"default",this.dispatchEvent(new CustomEvent("selection-change",{bubbles:!0,composed:!0,detail:{state:this.selectionState}})))}renderCheckmark(){return!this.selectable||this.selectionState!=="checked"||this.loading?h:c`
507
507
  <primer-icon
508
508
  name="checkmark"
509
509
  size="sm"
510
510
  color="var(--primer-color-icon-primary)"
511
511
  ></primer-icon>
512
- `}renderSpinner(){if(!this.loading)return u;let e;return this.variant==="primary"?e="var(--primer-color-background-outlined-default)":(this.variant==="secondary"||this.variant==="tertiary")&&(e="var(--primer-color-gray-900)"),p`
512
+ `}renderSpinner(){if(!this.loading)return h;let t;return this.variant==="primary"?t="var(--primer-color-background-outlined-default)":(this.variant==="secondary"||this.variant==="tertiary")&&(t="var(--primer-color-gray-900)"),c`
513
513
  <primer-spinner
514
514
  size="small"
515
- color="${e}"
515
+ color="${t}"
516
516
  compact
517
517
  ></primer-spinner>
518
- `}render(){return p`
518
+ `}render(){return c`
519
519
  <button
520
520
  type=${this.buttonType}
521
521
  ?disabled=${this.disabled||this.loading}
@@ -530,7 +530,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
530
530
  </span>
531
531
  ${this.renderCheckmark()}
532
532
  </button>
533
- `}};le.styles=[k,Vo],n([d({type:String})],le.prototype,"variant",2),n([d({type:Boolean,reflect:!0})],le.prototype,"disabled",2),n([d({type:Boolean,reflect:!0})],le.prototype,"loading",2),n([d({type:String})],le.prototype,"buttonType",2),n([d({type:String,reflect:!0})],le.prototype,"selectionState",2),n([d({type:Boolean,reflect:!0})],le.prototype,"selectable",2),le=n([f("primer-button")],le);var Ho=h`
533
+ `}};de.styles=[w,Ta],s([p({type:String})],de.prototype,"variant",2),s([p({type:Boolean,reflect:!0})],de.prototype,"disabled",2),s([p({type:Boolean,reflect:!0})],de.prototype,"loading",2),s([p({type:String})],de.prototype,"buttonType",2),s([p({type:String,reflect:!0})],de.prototype,"selectionState",2),s([p({type:Boolean,reflect:!0})],de.prototype,"selectable",2),de=s([y("primer-button")],de);var Pa=f`
534
534
  :host {
535
535
  display: contents;
536
536
  }
@@ -546,7 +546,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
546
546
  display: block;
547
547
  font-family: var(--primer-typography-body-small-font);
548
548
  }
549
- `;var $e=class extends g{constructor(){super(...arguments);this.for="";this.active=!0}render(){return p`
549
+ `;var Ue=class extends v{constructor(){super(...arguments);this.for="";this.active=!0}render(){return c`
550
550
  <span
551
551
  class="error"
552
552
  role="alert"
@@ -555,17 +555,17 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
555
555
  >
556
556
  <slot></slot>
557
557
  </span>
558
- `}};$e.styles=[Ho],n([d({type:String,reflect:!0})],$e.prototype,"for",2),n([d({type:Boolean,reflect:!0})],$e.prototype,"active",2),$e=n([f("primer-input-error")],$e);var Uo={pencil:_e`
558
+ `}};Ue.styles=[Pa],s([p({type:String,reflect:!0})],Ue.prototype,"for",2),s([p({type:Boolean,reflect:!0})],Ue.prototype,"active",2),Ue=s([y("primer-input-error")],Ue);var wa={pencil:Se`
559
559
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
560
560
  <path d="M12.3292 1.82659C12.142 1.63935 11.8779 1.53418 11.6028 1.53418C11.3277 1.53418 11.0636 1.63935 10.8764 1.82659L2.92969 9.77325V13.0666H6.22306L14.1698 5.11992C14.357 4.93268 14.4622 4.66859 14.4622 4.39352C14.4622 4.11844 14.357 3.85435 14.1698 3.66711L12.3292 1.82659ZM5.77375 11.7333H4.26302V10.2225L10.8764 3.60919L12.3871 5.11992L5.77375 11.7333Z" fill="currentColor"/>
561
561
  </svg>
562
- `,trash:_e`
562
+ `,trash:Se`
563
563
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
564
564
  <path d="M13.8333 2.99992H11.5V2.49992C11.5 2.05789 11.3244 1.63397 11.0118 1.32141C10.6993 1.00885 10.2754 0.833252 9.83333 0.833252H6.16667C5.72464 0.833252 5.30072 1.00885 4.98816 1.32141C4.67559 1.63397 4.5 2.05789 4.5 2.49992V2.99992H2.16667C1.98986 2.99992 1.82029 3.07015 1.69526 3.19518C1.57024 3.32021 1.5 3.48978 1.5 3.66659C1.5 3.8434 1.57024 4.01297 1.69526 4.138C1.82029 4.26302 1.98986 4.33326 2.16667 4.33326H2.83333V12.4999C2.83333 12.942 3.00893 13.3659 3.32149 13.6784C3.63405 13.991 4.05797 14.1666 4.5 14.1666H11.5C11.942 14.1666 12.3659 13.991 12.6785 13.6784C12.9911 13.3659 13.1667 12.942 13.1667 12.4999V4.33326H13.8333C14.0101 4.33326 14.1797 4.26302 14.3047 4.138C14.4298 4.01297 14.5 3.8434 14.5 3.66659C14.5 3.48978 14.4298 3.32021 14.3047 3.19518C14.1797 3.07015 14.0101 2.99992 13.8333 2.99992ZM5.83333 2.49992C5.83333 2.32311 5.90357 2.15354 6.0286 2.02851C6.15362 1.90349 6.32319 1.83325 6.5 1.83325H9.5C9.67681 1.83325 9.84638 1.90349 9.9714 2.02851C10.0964 2.15354 10.1667 2.32311 10.1667 2.49992V2.99992H5.83333V2.49992ZM11.8333 12.4999C11.8333 12.6767 11.7631 12.8463 11.6381 12.9713C11.513 13.0964 11.3435 13.1666 11.1667 13.1666H4.83333C4.65652 13.1666 4.48695 13.0964 4.36193 12.9713C4.2369 12.8463 4.16667 12.6767 4.16667 12.4999V4.33326H11.8333V12.4999Z" fill="currentColor"/>
565
565
  <path d="M6.5 10.9999C6.67681 10.9999 6.84638 10.9297 6.9714 10.8047C7.09643 10.6796 7.16667 10.5101 7.16667 10.3333V7.33325C7.16667 7.15644 7.09643 6.98687 6.9714 6.86184C6.84638 6.73682 6.67681 6.66658 6.5 6.66658C6.32319 6.66658 6.15362 6.73682 6.0286 6.86184C5.90357 6.98687 5.83333 7.15644 5.83333 7.33325V10.3333C5.83333 10.5101 5.90357 10.6796 6.0286 10.8047C6.15362 10.9297 6.32319 10.9999 6.5 10.9999Z" fill="currentColor"/>
566
566
  <path d="M9.5 10.9999C9.67681 10.9999 9.84638 10.9297 9.9714 10.8047C10.0964 10.6796 10.1667 10.5101 10.1667 10.3333V7.33325C10.1667 7.15644 10.0964 6.98687 9.9714 6.86184C9.84638 6.73682 9.67681 6.66658 9.5 6.66658C9.32319 6.66658 9.15362 6.73682 9.0286 6.86184C8.90357 6.98687 8.83333 7.15644 8.83333 7.33325V10.3333C8.83333 10.5101 8.90357 10.6796 9.0286 10.8047C9.15362 10.9297 9.32319 10.9999 9.5 10.9999Z" fill="currentColor"/>
567
567
  </svg>
568
- `,"successful-check":_e`
568
+ `,"successful-check":Se`
569
569
  <svg
570
570
  viewBox="0 0 56 56"
571
571
  fill="none"
@@ -580,7 +580,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
580
580
  />
581
581
  </g>
582
582
  </svg>
583
- `,"failure-icon":_e`
583
+ `,"failure-icon":Se`
584
584
  <svg
585
585
  viewBox="0 0 40 40"
586
586
  fill="none"
@@ -592,27 +592,27 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
592
592
  d="M20.0008 23.3333C20.4614 23.3333 20.7873 22.9606 20.7873 22.5V15C20.7873 14.5394 20.4146 14.1666 20.0008 14.1666C19.587 14.1666 19.1675 14.5416 19.1675 15V22.5C19.1675 22.9583 19.5425 23.3333 20.0008 23.3333ZM32.9331 27.3594L22.5269 9.75935C22.0008 8.86821 21.0529 8.33488 20.0008 8.33331C18.9487 8.33331 18.006 8.8656 17.4748 9.75831L7.06331 27.3625C6.53987 28.2463 6.53206 29.3073 7.04134 30.201C7.568 31.1198 8.51904 31.6666 9.58935 31.6666H30.4175C31.4857 31.6666 32.4357 31.1182 32.9597 30.1995C33.4696 29.3073 33.4591 28.2448 32.9331 27.3594ZM18.7977 26.6666C18.7977 25.976 19.3107 25.4166 20.0008 25.4166C20.6935 25.4166 21.2508 25.9739 21.2039 26.6666C21.2039 27.3568 20.6909 27.9166 20.0008 27.9166C19.3576 27.9166 18.7977 27.3568 18.7977 26.6666Z"
593
593
  />
594
594
  </svg>
595
- `,"payment-card":_e`
595
+ `,"payment-card":Se`
596
596
  <svg width="28" height="21" viewBox="0 0 28 21" fill="none" xmlns="http://www.w3.org/2000/svg">
597
597
  <rect y="0.748047" width="28" height="20" rx="2" fill="#E0E0E0"/>
598
598
  <rect y="6.74805" width="28" height="4" fill="#212121"/>
599
599
  <rect x="19" y="13.748" width="6" height="4" rx="0.933333" fill="white"/>
600
600
  </svg>
601
- `,"chevron-down":_e`
601
+ `,"chevron-down":Se`
602
602
  <svg width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg">
603
603
  <path d="M4.41978 4.90118C4.32079 5.02361 4.16188 5.08353 4.00037 5.08353C3.83887 5.08353 3.67996 5.02361 3.55753 4.90118L0.63995 1.9836C0.395733 1.73939 0.395733 1.34382 0.63995 1.09947C0.884167 0.855124 1.27973 0.855254 1.52408 1.09947L4.00037 3.57524L6.47589 1.09973C6.72011 0.855515 7.11567 0.855515 7.36002 1.09973C7.60437 1.34395 7.60424 1.73952 7.36002 1.98386L4.41978 4.90118Z" fill="#212121"/>
604
- </svg>`,checkmark:_e`
604
+ </svg>`,checkmark:Se`
605
605
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
606
606
  <path d="M15.6326 6.12193C15.8983 6.3668 15.8983 6.76276 15.6326 6.98418L8.75546 13.8613C8.53404 14.127 8.13808 14.127 7.89321 13.8613L4.35119 10.3186C4.10706 10.0971 4.10706 9.70118 4.35119 9.45631C4.59531 9.21404 4.99126 9.21404 5.23535 9.45631L8.33606 12.5588L14.7704 6.12193C15.0152 5.87863 15.4112 5.87863 15.6326 6.12193Z" fill="#212121"/>
607
607
  </svg>
608
- `,close:_e`
608
+ `,close:Se`
609
609
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
610
610
  <path
611
611
  d="M14.7551 13.734C15.0479 14.0269 15.0479 14.502 14.7551 14.7949C14.4622 15.0879 13.987 15.0878 13.6941 14.7949L10.0005 11.0738L6.28054 14.7937C5.98767 15.0866 5.51249 15.0866 5.21959 14.7937C4.92668 14.5008 4.92671 14.0256 5.21959 13.7327L8.94075 10.0141L5.21856 6.26604C4.92568 5.97316 4.92568 5.49798 5.21856 5.20508C5.51143 4.91217 5.98661 4.91221 6.27951 5.20508L10.0005 8.95438L13.7204 5.23446C14.0132 4.94159 14.4884 4.94159 14.7813 5.23446C15.0742 5.52734 15.0742 6.00252 14.7813 6.29542L11.0602 10.0141L14.7551 13.734Z"
612
612
  fill="#212121"
613
613
  />
614
614
  </svg>
615
- `};var Yo=h`
615
+ `};var ka=f`
616
616
  :host {
617
617
  display: inline-block;
618
618
  line-height: 0; /* so you don’t get extra space around the icon */
@@ -654,11 +654,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
654
654
  /* --internal used for abstracting away the icon component */
655
655
  fill: var(--internal-icon-color, currentColor);
656
656
  }
657
- `;var Se=class extends g{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let e=this.name?Uo[this.name]:null;return p`
657
+ `;var Pe=class extends v{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let t=this.name?wa[this.name]:null;return c`
658
658
  <div style="--internal-icon-color: ${this.color}">
659
- ${e||p`<slot></slot>`}
659
+ ${t||c`<slot></slot>`}
660
660
  </div>
661
- `}};Se.styles=[Yo],n([d({type:String})],Se.prototype,"color",2),n([d({type:String})],Se.prototype,"size",2),n([d({reflect:!0})],Se.prototype,"name",2),Se=n([f("primer-icon")],Se);var zo=h`
661
+ `}};Pe.styles=[ka],s([p({type:String})],Pe.prototype,"color",2),s([p({type:String})],Pe.prototype,"size",2),s([p({reflect:!0})],Pe.prototype,"name",2),Pe=s([y("primer-icon")],Pe);var Ia=f`
662
662
  :host {
663
663
  display: flex;
664
664
  flex-direction: column;
@@ -687,7 +687,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
687
687
  line-height: var(--primer-typography-body-medium-line-height);
688
688
  letter-spacing: var(--primer-typography-body-medium-letter-spacing);
689
689
  }
690
- `;var Ve=class extends g{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?p`
690
+ `;var Ye=class extends v{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?c`
691
691
  <!-- Successful view -->
692
692
  <primer-icon
693
693
  size="lg"
@@ -699,7 +699,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
699
699
  <p class="secondary">
700
700
  You'll be redirected to the order confirmation page soon.
701
701
  </p>
702
- `:p`
702
+ `:c`
703
703
  <primer-icon
704
704
  size="lg"
705
705
  name="failure-icon"
@@ -707,8 +707,8 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
707
707
  >
708
708
  </primer-icon>
709
709
  <p>Payment failed</p>
710
- ${this.description?p`<p class="secondary">${this.description}</p>`:p`<p class="secondary">Something went wrong.</p>`}
711
- `}};Ve.styles=[zo],n([d({type:String})],Ve.prototype,"type",2),n([d({type:String})],Ve.prototype,"description",2),Ve=n([f("primer-checkout-state")],Ve);var Fo=h`
710
+ ${this.description?c`<p class="secondary">${this.description}</p>`:c`<p class="secondary">Something went wrong.</p>`}
711
+ `}};Ye.styles=[Ia],s([p({type:String})],Ye.prototype,"type",2),s([p({type:String})],Ye.prototype,"description",2),Ye=s([y("primer-checkout-state")],Ye);var Na=f`
712
712
  :host {
713
713
  display: contents;
714
714
  }
@@ -739,7 +739,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
739
739
  :host([disabled]) input::placeholder {
740
740
  color: var(--primer-color-text-disabled);
741
741
  }
742
- `;var jn=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function Gn(i){return jn.includes(i)}var U=class extends g{constructor(){super(...arguments);this.value="";this.placeholder="";this.disabled=!1;this.name="";this.type="text";this.required=!1;this.readonly=!1;this.pattern="";this.min="";this.max="";this.step="";this.autocomplete="";this.id="";this.hasFocus=!1;this.hasError=!1}handleInput(e){e.stopPropagation();let r=e.target;this.value=r.value;let o=new CustomEvent("input",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleChange(e){e.stopPropagation();let r=e.target;this.value=r.value;let o=new CustomEvent("change",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleFocus(){this.hasFocus=!0,this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}handleBlur(){this.hasFocus=!1,this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}handleInvalid(e){e.stopPropagation(),this.hasError=!0,this.dispatchEvent(new Event("invalid",{bubbles:!0,composed:!0}))}focus(e){this.inputElement?.focus(e)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(e,r,o){this.inputElement?.setSelectionRange(e,r,o)}get validity(){return this.inputElement?.validity||{}}get validationMessage(){return this.inputElement?.validationMessage||""}checkValidity(){return this.inputElement?.checkValidity()||!1}reportValidity(){return this.inputElement?.reportValidity()||!1}render(){let e={input:!0,"input--focused":this.hasFocus,"input--disabled":this.disabled,"input--error":this.hasError,"input--readonly":this.readonly},r=Object.entries(e).filter(([,o])=>o).map(([o])=>o).join(" ");return p`
742
+ `;var sl=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function ll(i){return sl.includes(i)}var F=class extends v{constructor(){super(...arguments);this.value="";this.placeholder="";this.disabled=!1;this.name="";this.type="text";this.required=!1;this.readonly=!1;this.pattern="";this.min="";this.max="";this.step="";this.autocomplete="";this.id="";this.hasFocus=!1;this.hasError=!1}handleInput(t){t.stopPropagation();let r=t.target;this.value=r.value;let o=new CustomEvent("input",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleChange(t){t.stopPropagation();let r=t.target;this.value=r.value;let o=new CustomEvent("change",{detail:this.value,bubbles:!0,composed:!0});this.dispatchEvent(o)}handleFocus(){this.hasFocus=!0,this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}handleBlur(){this.hasFocus=!1,this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}handleInvalid(t){t.stopPropagation(),this.hasError=!0,this.dispatchEvent(new Event("invalid",{bubbles:!0,composed:!0}))}focus(t){this.inputElement?.focus(t)}blur(){this.inputElement?.blur()}select(){this.inputElement?.select()}setSelectionRange(t,r,o){this.inputElement?.setSelectionRange(t,r,o)}get validity(){return this.inputElement?.validity||{}}get validationMessage(){return this.inputElement?.validationMessage||""}checkValidity(){return this.inputElement?.checkValidity()||!1}reportValidity(){return this.inputElement?.reportValidity()||!1}render(){let t={input:!0,"input--focused":this.hasFocus,"input--disabled":this.disabled,"input--error":this.hasError,"input--readonly":this.readonly},r=Object.entries(t).filter(([,o])=>o).map(([o])=>o).join(" ");return c`
743
743
  <input
744
744
  part="input"
745
745
  class=${r}
@@ -764,7 +764,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
764
764
  @blur=${this.handleBlur}
765
765
  @invalid=${this.handleInvalid}
766
766
  />
767
- `}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};U.styles=[Fo],n([Oe("input")],U.prototype,"inputElement",2),n([d({type:String,reflect:!0})],U.prototype,"value",2),n([d({type:String,reflect:!0})],U.prototype,"placeholder",2),n([d({type:Boolean,reflect:!0})],U.prototype,"disabled",2),n([d({type:String,reflect:!0})],U.prototype,"name",2),n([d({type:String,reflect:!0,converter:{fromAttribute:e=>!e||!Gn(e)?(e&&e!=="text"&&P.warn(`Invalid input type: ${e}. Defaulting to 'text'.`),"text"):e}})],U.prototype,"type",2),n([d({type:Boolean,reflect:!0})],U.prototype,"required",2),n([d({type:Boolean,reflect:!0})],U.prototype,"readonly",2),n([d({type:String,reflect:!0})],U.prototype,"pattern",2),n([d({type:Number,reflect:!0})],U.prototype,"minlength",2),n([d({type:Number,reflect:!0})],U.prototype,"maxlength",2),n([d({type:String,reflect:!0})],U.prototype,"min",2),n([d({type:String,reflect:!0})],U.prototype,"max",2),n([d({type:String,reflect:!0})],U.prototype,"step",2),n([d({type:String,reflect:!0})],U.prototype,"autocomplete",2),n([d({type:String,reflect:!0})],U.prototype,"id",2),n([T()],U.prototype,"hasFocus",2),n([T()],U.prototype,"hasError",2),U=n([f("primer-input")],U);var Bo=h`
767
+ `}addEventListener(t,r,o){super.addEventListener(t,r,o)}removeEventListener(t,r,o){super.removeEventListener(t,r,o)}};F.styles=[Na],s([Ve("input")],F.prototype,"inputElement",2),s([p({type:String,reflect:!0})],F.prototype,"value",2),s([p({type:String,reflect:!0})],F.prototype,"placeholder",2),s([p({type:Boolean,reflect:!0})],F.prototype,"disabled",2),s([p({type:String,reflect:!0})],F.prototype,"name",2),s([p({type:String,reflect:!0,converter:{fromAttribute:t=>!t||!ll(t)?(t&&t!=="text"&&R.warn(`Invalid input type: ${t}. Defaulting to 'text'.`),"text"):t}})],F.prototype,"type",2),s([p({type:Boolean,reflect:!0})],F.prototype,"required",2),s([p({type:Boolean,reflect:!0})],F.prototype,"readonly",2),s([p({type:String,reflect:!0})],F.prototype,"pattern",2),s([p({type:Number,reflect:!0})],F.prototype,"minlength",2),s([p({type:Number,reflect:!0})],F.prototype,"maxlength",2),s([p({type:String,reflect:!0})],F.prototype,"min",2),s([p({type:String,reflect:!0})],F.prototype,"max",2),s([p({type:String,reflect:!0})],F.prototype,"step",2),s([p({type:String,reflect:!0})],F.prototype,"autocomplete",2),s([p({type:String,reflect:!0})],F.prototype,"id",2),s([I()],F.prototype,"hasFocus",2),s([I()],F.prototype,"hasError",2),F=s([y("primer-input")],F);var La=f`
768
768
  :host {
769
769
  display: block;
770
770
  }
@@ -818,7 +818,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
818
818
  transition: none;
819
819
  }
820
820
  }
821
- `;var oe=class extends g{constructor(){super(...arguments);this.header="";this.expanded=!1;this.expandText="Expand";this.collapseText="Collapse";this.ariaLabel="";this.buttonVariant="primary";this.isExpanded=!1}connectedCallback(){super.connectedCallback(),this.isExpanded=this.expanded}dispatchExpandedChangedEvent(e){this.dispatchEvent(new CustomEvent("expanded-changed",{bubbles:!0,composed:!0,detail:{expanded:e}}))}toggleExpanded(){this.isExpanded=!this.isExpanded,this.dispatchExpandedChangedEvent(this.isExpanded)}expand(){this.isExpanded||(this.isExpanded=!0,this.dispatchExpandedChangedEvent(!0))}collapse(){this.isExpanded&&(this.isExpanded=!1,this.dispatchExpandedChangedEvent(!1))}render(){let e=this.isExpanded?this.collapseText:this.expandText,r=this.ariaLabel||this.header||e,o=this.header||e;return p`
821
+ `;var ae=class extends v{constructor(){super(...arguments);this.header="";this.expanded=!1;this.expandText="Expand";this.collapseText="Collapse";this.ariaLabel="";this.buttonVariant="primary";this.isExpanded=!1}connectedCallback(){super.connectedCallback(),this.isExpanded=this.expanded}dispatchExpandedChangedEvent(t){this.dispatchEvent(new CustomEvent("expanded-changed",{bubbles:!0,composed:!0,detail:{expanded:t}}))}toggleExpanded(){this.isExpanded=!this.isExpanded,this.dispatchExpandedChangedEvent(this.isExpanded)}expand(){this.isExpanded||(this.isExpanded=!0,this.dispatchExpandedChangedEvent(!0))}collapse(){this.isExpanded&&(this.isExpanded=!1,this.dispatchExpandedChangedEvent(!1))}render(){let t=this.isExpanded?this.collapseText:this.expandText,r=this.ariaLabel||this.header||t,o=this.header||t;return c`
822
822
  <div class="collapsable">
823
823
  <primer-button
824
824
  variant=${this.buttonVariant}
@@ -842,7 +842,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
842
842
  </div>
843
843
  </div>
844
844
  </div>
845
- `}};oe.styles=[Bo],n([d({type:String})],oe.prototype,"header",2),n([d({type:Boolean})],oe.prototype,"expanded",2),n([d({type:String})],oe.prototype,"expandText",2),n([d({type:String})],oe.prototype,"collapseText",2),n([d({type:String})],oe.prototype,"ariaLabel",2),n([d({type:String})],oe.prototype,"buttonVariant",2),n([T()],oe.prototype,"isExpanded",2),oe=n([f("primer-collapsable")],oe);var Ko=h`
845
+ `}};ae.styles=[La],s([p({type:String})],ae.prototype,"header",2),s([p({type:Boolean})],ae.prototype,"expanded",2),s([p({type:String})],ae.prototype,"expandText",2),s([p({type:String})],ae.prototype,"collapseText",2),s([p({type:String})],ae.prototype,"ariaLabel",2),s([p({type:String})],ae.prototype,"buttonVariant",2),s([I()],ae.prototype,"isExpanded",2),ae=s([y("primer-collapsable")],ae);var $a=f`
846
846
  :host {
847
847
  display: block;
848
848
  width: 100%;
@@ -902,10 +902,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
902
902
  transform: none;
903
903
  }
904
904
  }
905
- `;var fe=class extends g{constructor(){super(...arguments);this.message="";this.visible=!1;this.role="alert";this.showMessage=!1}updated(e){e.has("visible")&&this.handleVisibilityChange()}handleVisibilityChange(){this.visible?(this.showMessage=!0,this.setAttribute("aria-hidden","false")):setTimeout(()=>{this.showMessage=!1,this.setAttribute("aria-hidden","true")},200)}render(){if(!this.showMessage&&!this.visible)return u;let e={"error-message":!0,hidden:!this.visible};return p`
905
+ `;var ye=class extends v{constructor(){super(...arguments);this.message="";this.visible=!1;this.role="alert";this.showMessage=!1}updated(t){t.has("visible")&&this.handleVisibilityChange()}handleVisibilityChange(){this.visible?(this.showMessage=!0,this.setAttribute("aria-hidden","false")):setTimeout(()=>{this.showMessage=!1,this.setAttribute("aria-hidden","true")},200)}render(){if(!this.showMessage&&!this.visible)return h;let t={"error-message":!0,hidden:!this.visible};return c`
906
906
  <div
907
907
  part="error-message"
908
- class=${q(e)}
908
+ class=${Z(t)}
909
909
  aria-live="assertive"
910
910
  aria-atomic="true"
911
911
  >
@@ -918,11 +918,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
918
918
  </div>
919
919
  <div part="error-content" class="error-content">${this.message}</div>
920
920
  </div>
921
- `}};fe.styles=[Ko],n([d({type:String})],fe.prototype,"message",2),n([d({type:Boolean,reflect:!0})],fe.prototype,"visible",2),n([d({type:String,reflect:!0})],fe.prototype,"role",2),n([T()],fe.prototype,"showMessage",2),fe=n([f("primer-error-message")],fe);var jo=h`
921
+ `}};ye.styles=[$a],s([p({type:String})],ye.prototype,"message",2),s([p({type:Boolean,reflect:!0})],ye.prototype,"visible",2),s([p({type:String,reflect:!0})],ye.prototype,"role",2),s([I()],ye.prototype,"showMessage",2),ye=s([y("primer-error-message")],ye);var Ra=f`
922
922
  :host {
923
923
  display: none;
924
924
  }
925
- `;var Qe=class extends g{constructor(){super(...arguments);this.id="d"+Math.random().toString(36).substring(7)}getContainer(){let e=document.querySelector(`#${this.id}`);return e||(e=document.createElement("div"),e.id=this.id,document.body.appendChild(e),this._setupEventListeners(e)),e}_setupEventListeners(e){["primer-ach-error","primer-ach-bank-details-collected","primer-ach-mandate-confirmed","primer-ach-mandate-declined"].forEach(r=>{e.addEventListener(r,o=>{o.stopPropagation(),this.dispatchEvent(new CustomEvent(r,{bubbles:!0,composed:!0,detail:o.detail}))})})}disconnectedCallback(){super.disconnectedCallback(),this.getContainer().remove()}_handleSlotChange(e){let o=e.target.assignedNodes();if(!o.length)return;let s=this.getContainer();o.forEach(m=>s.appendChild(m))}render(){return p`<slot @slotchange=${this._handleSlotChange}></slot>`}};Qe.styles=[jo],n([T()],Qe.prototype,"id",2),Qe=n([f("primer-portal")],Qe);var Go=h`
925
+ `;var ot=class extends v{constructor(){super(...arguments);this.id="d"+Math.random().toString(36).substring(7)}getContainer(){let t=document.querySelector(`#${this.id}`);return t||(t=document.createElement("div"),t.id=this.id,document.body.appendChild(t),this._setupEventListeners(t)),t}_setupEventListeners(t){["primer-ach-error","primer-ach-bank-details-collected","primer-ach-mandate-confirmed","primer-ach-mandate-declined"].forEach(r=>{t.addEventListener(r,o=>{o.stopPropagation(),this.dispatchEvent(new CustomEvent(r,{bubbles:!0,composed:!0,detail:o.detail}))})})}disconnectedCallback(){super.disconnectedCallback(),this.getContainer().remove()}_handleSlotChange(t){let o=t.target.assignedNodes();if(!o.length)return;let n=this.getContainer();o.forEach(l=>n.appendChild(l))}render(){return c`<slot @slotchange=${this._handleSlotChange}></slot>`}};ot.styles=[Ra],s([I()],ot.prototype,"id",2),ot=s([y("primer-portal")],ot);var Oa=f`
926
926
  :host {
927
927
  display: contents;
928
928
  }
@@ -951,10 +951,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
951
951
  display: flex;
952
952
  justify-content: flex-end;
953
953
  }
954
- `;var ct=class extends g{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return p`
954
+ `;var Ct=class extends v{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return c`
955
955
  <div
956
- class=${q({backdrop:!0})}
957
- @click=${t=>{t.preventDefault()}}
956
+ class=${Z({backdrop:!0})}
957
+ @click=${e=>{e.preventDefault()}}
958
958
  >
959
959
  <div class="dialog">
960
960
  <div class="header">
@@ -967,7 +967,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
967
967
  </div>
968
968
  </div>
969
969
  </div>
970
- `}};ct.styles=[Go],ct=n([f("primer-dialog")],ct);var qo=h`
970
+ `}};Ct.styles=[Oa],Ct=s([y("primer-dialog")],Ct);var Da=f`
971
971
  :host {
972
972
  display: contents;
973
973
  }
@@ -1159,38 +1159,38 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1159
1159
  background-color: var(--primer-color-background-outlined-default);
1160
1160
  border-radius: var(--primer-radius-small);
1161
1161
  }
1162
- `;var J=class extends g{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=_("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new R(this,{task:async([e,r])=>{if(!e||!r)return I;let o=await r.getCDNAssets("KLARNA");return{manager:e.manager,klarnaIcon:o?.assets?.icon?`${o.goatCdnUrl}/${o.assets.icon}`:""}},args:()=>[this.paymentManagers.get("KLARNA"),this.headlessUtils]})}toggleExpand(){this.isExpanded=!this.isExpanded,this.isExpanded||(this.selectedCategory=null)}async startKlarnaPayment(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory))try{await this._paymentMethodManagerTask.value.manager.start({paymentMethodCategoryId:this.selectedCategory})}catch(e){P.error("Failed to start Klarna payment",e)}}async renderSelectedCategory(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory||!this.klarnaContainer))try{this.klarnaContainer.innerHTML="",await this._paymentMethodManagerTask.value.manager.renderCategory({containerId:this.klarnaContainer,paymentMethodCategoryId:this.selectedCategory,onHeightChange:e=>{e>0&&(this.klarnaContainer.style.height=`${e}px`)}})}catch(e){P.error("Failed to render Klarna category",e)}}selectCategory(e){this.selectedCategory=e,this.renderSelectedCategory()}updated(e){e.has("selectedCategory")&&this.selectedCategory&&this.renderSelectedCategory()}renderCategorySelection(){let e=this.klarnaCategories?.categories||[];return this.klarnaCategories?.isLoading||!1?p`<div class="loading">
1162
+ `;var ee=class extends v{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=A("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new D(this,{task:async([t,r])=>{if(!t||!r)return L;let o=await r.getCDNAssets("KLARNA");return{manager:t.manager,klarnaIcon:o?.assets?.icon?`${o.goatCdnUrl}/${o.assets.icon}`:""}},args:()=>[this.paymentManagers.get("KLARNA"),this.headlessUtils]})}toggleExpand(){this.isExpanded=!this.isExpanded,this.isExpanded||(this.selectedCategory=null)}async startKlarnaPayment(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory))try{await this._paymentMethodManagerTask.value.manager.start({paymentMethodCategoryId:this.selectedCategory})}catch(t){R.error("Failed to start Klarna payment",t)}}async renderSelectedCategory(){if(!(!this._paymentMethodManagerTask.value||!this.selectedCategory||!this.klarnaContainer))try{this.klarnaContainer.innerHTML="",await this._paymentMethodManagerTask.value.manager.renderCategory({containerId:this.klarnaContainer,paymentMethodCategoryId:this.selectedCategory,onHeightChange:t=>{t>0&&(this.klarnaContainer.style.height=`${t}px`)}})}catch(t){R.error("Failed to render Klarna category",t)}}selectCategory(t){this.selectedCategory=t,this.renderSelectedCategory()}updated(t){t.has("selectedCategory")&&this.selectedCategory&&this.renderSelectedCategory()}renderCategorySelection(){let t=this.klarnaCategories?.categories||[];return this.klarnaCategories?.isLoading||!1?c`<div class="loading">
1163
1163
  <primer-spinner size="small"></primer-spinner>
1164
- </div>`:e.length<=1?u:p`
1164
+ </div>`:c`
1165
1165
  <div class="category-selection">
1166
- ${e.map(o=>p`
1166
+ ${t.map(o=>c`
1167
1167
  <button
1168
- class=${q({"category-button":!0,selected:o.id===this.selectedCategory})}
1168
+ class=${Z({"category-button":!0,selected:o.id===this.selectedCategory})}
1169
1169
  @click=${()=>{this.selectCategory(o.id)}}
1170
1170
  >
1171
1171
  ${o.name}
1172
1172
  </button>
1173
1173
  `)}
1174
1174
  </div>
1175
- `}renderExpandedContent(){return p`
1175
+ `}renderExpandedContent(){return c`
1176
1176
  ${this.renderCategorySelection()}
1177
- ${this.selectedCategory?p`
1177
+ ${this.selectedCategory?c`
1178
1178
  <div
1179
1179
  id="klarna-category-container"
1180
1180
  class="klarna-category-container"
1181
1181
  ></div>
1182
- `:u}
1182
+ `:h}
1183
1183
 
1184
1184
  <button
1185
- class=${q({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
1185
+ class=${Z({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
1186
1186
  ?disabled=${!this.selectedCategory||this.sdkState?.isProcessing}
1187
1187
  @click=${()=>this.startKlarnaPayment()}
1188
1188
  >
1189
- ${_("confirm",{id:"confirm"})}
1189
+ ${A("confirm",{id:"confirm"})}
1190
1190
  </button>
1191
- `}render(){return this._paymentMethodManagerTask.render({error:e=>{let r=e instanceof Error?e.message:"Unknown error in Klarna";return p`<div class="error">
1191
+ `}render(){return this._paymentMethodManagerTask.render({error:t=>{let r=t instanceof Error?t.message:"Unknown error in Klarna";return c`<div class="error">
1192
1192
  Error loading Klarna: ${r}
1193
- </div>`},complete:({manager:e,klarnaIcon:r})=>e?p`
1193
+ </div>`},complete:({manager:t,klarnaIcon:r})=>t?c`
1194
1194
  <div class="klarna-container ${this.isExpanded?"expanded":""}">
1195
1195
  <div class="klarna-button-header">
1196
1196
  <primer-button
@@ -1203,7 +1203,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1203
1203
  aria-label=${this.headerAriaLabel}
1204
1204
  >
1205
1205
  <img src=${r} alt="Klarna logo" />
1206
- <span>${_("pay_with",{id:"pay_with"})} Klarna</span>
1206
+ <span>${A("pay_with",{id:"pay_with"})} Klarna</span>
1207
1207
  <span
1208
1208
  class="klarna-accordion-icon ${this.isExpanded?"expanded":""}"
1209
1209
  >
@@ -1220,19 +1220,19 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1220
1220
  </div>
1221
1221
  </div>
1222
1222
  </div>
1223
- `:u})}};J.styles=[k,qo],n([y({context:Z,subscribe:!0}),d()],J.prototype,"paymentManagers",2),n([y({context:z,subscribe:!0}),d()],J.prototype,"sdkState",2),n([y({context:G,subscribe:!0}),d({type:Object})],J.prototype,"headlessUtils",2),n([y({context:Xt,subscribe:!0}),d()],J.prototype,"klarnaCategories",2),n([T()],J.prototype,"selectedCategory",2),n([T()],J.prototype,"isExpanded",2),n([T()],J.prototype,"headerAriaLabel",2),n([Oe("#klarna-category-container")],J.prototype,"klarnaContainer",2),J=n([f("primer-klarna"),L()],J);var Wo=h`
1223
+ `:h})}};ee.styles=[w,Da],s([b({context:J,subscribe:!0}),p()],ee.prototype,"paymentManagers",2),s([b({context:j,subscribe:!0}),p()],ee.prototype,"sdkState",2),s([b({context:W,subscribe:!0}),p({type:Object})],ee.prototype,"headlessUtils",2),s([b({context:yr,subscribe:!0}),p()],ee.prototype,"klarnaCategories",2),s([I()],ee.prototype,"selectedCategory",2),s([I()],ee.prototype,"isExpanded",2),s([I()],ee.prototype,"headerAriaLabel",2),s([Ve("#klarna-category-container")],ee.prototype,"klarnaContainer",2),ee=s([y("primer-klarna"),$()],ee);var Va=f`
1224
1224
  :host {
1225
1225
  display: contents;
1226
1226
  }
1227
- `;var He=class extends g{constructor(){super(...arguments);this.type=void 0;this.paymentMethods=null}render(){if(!this.type)return u;let e=this.paymentMethods?.get(this.type);if(!e)return u;switch(e?.managerType){case"CARD":return p`<primer-card-form></primer-card-form>`;case"NATIVE":return p`<primer-native-payment
1228
- .paymentMethod=${e}
1229
- ></primer-native-payment>`;case"REDIRECT":return p`<primer-redirect-payment
1230
- .paymentMethod=${e}
1231
- ></primer-redirect-payment>`;case"KLARNA":return p`<primer-klarna></primer-klarna>`;case"ACH":return p`
1227
+ `;var ze=class extends v{constructor(){super(...arguments);this.type=void 0;this.paymentMethods=null}render(){if(!this.type)return h;let t=this.paymentMethods?.get(this.type);if(!t)return h;switch(t?.managerType){case"CARD":return c`<primer-card-form></primer-card-form>`;case"NATIVE":return c`<primer-native-payment
1228
+ .paymentMethod=${t}
1229
+ ></primer-native-payment>`;case"REDIRECT":return c`<primer-redirect-payment
1230
+ .paymentMethod=${t}
1231
+ ></primer-redirect-payment>`;case"KLARNA":return c`<primer-klarna></primer-klarna>`;case"ACH":return c`
1232
1232
  <primer-dynamic-payment
1233
- .paymentMethod=${e}
1233
+ .paymentMethod=${t}
1234
1234
  ></primer-dynamic-payment>
1235
- `;default:return u}}};He.styles=[Wo],n([d({type:String})],He.prototype,"type",2),n([y({context:st,subscribe:!0}),d()],He.prototype,"paymentMethods",2),He=n([f("primer-payment-method")],He);var Zo=h`
1235
+ `;default:return h}}};ze.styles=[Va],s([p({type:String})],ze.prototype,"type",2),s([b({context:vt,subscribe:!0}),p()],ze.prototype,"paymentMethods",2),ze=s([y("primer-payment-method")],ze);var Ha=f`
1236
1236
  :host {
1237
1237
  display: flex;
1238
1238
  flex-direction: column;
@@ -1317,12 +1317,12 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1317
1317
  flex-direction: column;
1318
1318
  }
1319
1319
  }
1320
- `;function Xo(){return{firstName:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1},lastName:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1},emailAddress:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1}}}var Cr=class{constructor(t,e){this.formState=Xo();this.host=t,this.validate=e,t.addController(this)}get hasError(){return{firstName:this.formState.firstName.dirty&&this.formState.firstName.touched&&!!this.formState.firstName.error,lastName:this.formState.lastName.dirty&&this.formState.lastName.touched&&!!this.formState.lastName.error,emailAddress:this.formState.emailAddress.dirty&&this.formState.emailAddress.touched&&!!this.formState.emailAddress.error}}get formData(){return{firstName:this.formState.firstName.value,lastName:this.formState.lastName.value,emailAddress:this.formState.emailAddress.value}}async setFieldValue(t,e){let r=this.formState[t];r.value=e,r.dirty=!0,r.error="",r.valid=!0;let o=await this.validate(this.formData);this.setValidation(o)}setValidation(t,e=!1){e&&(this.formState.firstName.touched=!0,this.formState.lastName.touched=!0,this.formState.emailAddress.touched=!0,this.formState.firstName.dirty=!0,this.formState.lastName.dirty=!0,this.formState.emailAddress.dirty=!0),t.validationErrors.forEach(r=>{this.isValidFieldName(r.field)&&(this.formState[r.field].error=r.message,this.formState[r.field].valid=r.message==="")}),this.host.dispatchEvent(new CustomEvent("primer-ach-validation",{bubbles:!0,composed:!0,detail:{validation:t}})),this.host.requestUpdate()}setFieldTouched(t){this.formState[t].touched||(this.formState[t].touched=!0,this.host.requestUpdate())}resetForm(){this.formState=Xo(),this.host.requestUpdate()}isValidFieldName(t){return!!t&&["firstName","lastName","emailAddress"].includes(t)}hostConnected(){}hostDisconnected(){}};var de=class extends g{constructor(){super(...arguments);this.formController=new Cr(this,e=>this._paymentMethodManagerTask.value.setAndValidate(e));this.paymentManagers=new Map;this.sdkState=void 0;this.clientOptions=void 0;this.screen="form";this.isSubmitting=!1;this._paymentMethodManagerTask=new R(this,{task:async([e])=>e!=="STRIPE_ACH"?I:this.paymentManagers.get(e)?.manager,args:()=>[this.paymentMethod?.type]})}_handleInput(e,r){let o=e.target;this.formController.setFieldValue(r,o.value)}_handleBlur(e){this.formController.setFieldTouched(e)}_handleError(e){this.dispatchEvent(new CustomEvent("primer-ach-error",{bubbles:!0,composed:!0,detail:{error:e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error occurred")}}))}async _handleSubmitButtonClick(e){if(!this.isSubmitting){this.isSubmitting=!0;try{let r=await e.start(this.formController.formData);if(!r||r.valid)return await this._handleCollectBankAccountDetails(e);r&&this.formController.setValidation(r,!0)}catch(r){this._handleError(r)}finally{this.isSubmitting=!1}}}async _handleCollectBankAccountDetails(e){try{await e.collectBankAccountDetails(),this.screen="mandate",this.dispatchEvent(new CustomEvent("primer-ach-bank-details-collected",{bubbles:!0,composed:!0}))}catch(r){this._handleError(r)}}async _handleConfirmMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.confirmMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-confirmed",{bubbles:!0,composed:!0}))}catch(e){this._handleError(e)}finally{this.isSubmitting=!1}}}async _handleDeclineMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.declineMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-declined",{bubbles:!0,composed:!0}))}catch(e){this._handleError(e)}finally{this.isSubmitting=!1}}}renderForm(e){return p`
1320
+ `;function Ua(){return{firstName:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1},lastName:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1},emailAddress:{value:"",error:"",pristine:!0,touched:!1,dirty:!1,valid:!1}}}var Br=class{constructor(e,t){this.formState=Ua();this.host=e,this.validate=t,e.addController(this)}get hasError(){return{firstName:this.formState.firstName.dirty&&this.formState.firstName.touched&&!!this.formState.firstName.error,lastName:this.formState.lastName.dirty&&this.formState.lastName.touched&&!!this.formState.lastName.error,emailAddress:this.formState.emailAddress.dirty&&this.formState.emailAddress.touched&&!!this.formState.emailAddress.error}}get formData(){return{firstName:this.formState.firstName.value,lastName:this.formState.lastName.value,emailAddress:this.formState.emailAddress.value}}async setFieldValue(e,t){let r=this.formState[e];r.value=t,r.dirty=!0,r.error="",r.valid=!0;let o=await this.validate(this.formData);this.setValidation(o)}setValidation(e,t=!1){t&&(this.formState.firstName.touched=!0,this.formState.lastName.touched=!0,this.formState.emailAddress.touched=!0,this.formState.firstName.dirty=!0,this.formState.lastName.dirty=!0,this.formState.emailAddress.dirty=!0),e.validationErrors.forEach(r=>{this.isValidFieldName(r.field)&&(this.formState[r.field].error=r.message,this.formState[r.field].valid=r.message==="")}),this.host.dispatchEvent(new CustomEvent("primer-ach-validation",{bubbles:!0,composed:!0,detail:{validation:e}})),this.host.requestUpdate()}setFieldTouched(e){this.formState[e].touched||(this.formState[e].touched=!0,this.host.requestUpdate())}resetForm(){this.formState=Ua(),this.host.requestUpdate()}isValidFieldName(e){return!!e&&["firstName","lastName","emailAddress"].includes(e)}hostConnected(){}hostDisconnected(){}};var pe=class extends v{constructor(){super(...arguments);this.formController=new Br(this,t=>this._paymentMethodManagerTask.value.setAndValidate(t));this.paymentManagers=new Map;this.sdkState=void 0;this.clientOptions=void 0;this.screen="form";this.isSubmitting=!1;this._paymentMethodManagerTask=new D(this,{task:async([t])=>t!=="STRIPE_ACH"?L:this.paymentManagers.get(t)?.manager,args:()=>[this.paymentMethod?.type]})}_handleInput(t,r){let o=t.target;this.formController.setFieldValue(r,o.value)}_handleBlur(t){this.formController.setFieldTouched(t)}_handleError(t){this.dispatchEvent(new CustomEvent("primer-ach-error",{bubbles:!0,composed:!0,detail:{error:t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error occurred")}}))}async _handleSubmitButtonClick(t){if(!this.isSubmitting){this.isSubmitting=!0;try{let r=await t.start(this.formController.formData);if(!r||r.valid)return await this._handleCollectBankAccountDetails(t);r&&this.formController.setValidation(r,!0)}catch(r){this._handleError(r)}finally{this.isSubmitting=!1}}}async _handleCollectBankAccountDetails(t){try{await t.collectBankAccountDetails(),this.screen="mandate",this.dispatchEvent(new CustomEvent("primer-ach-bank-details-collected",{bubbles:!0,composed:!0}))}catch(r){this._handleError(r)}}async _handleConfirmMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.confirmMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-confirmed",{bubbles:!0,composed:!0}))}catch(t){this._handleError(t)}finally{this.isSubmitting=!1}}}async _handleDeclineMandate(){if(this._paymentMethodManagerTask.value){this.isSubmitting=!0;try{await this._paymentMethodManagerTask.value.declineMandate(),this.dispatchEvent(new CustomEvent("primer-ach-mandate-declined",{bubbles:!0,composed:!0}))}catch(t){this._handleError(t)}finally{this.isSubmitting=!1}}}renderForm(t){return c`
1321
1321
  <h2>
1322
- ${_("payWithAch",{id:"payWithAch"})}
1322
+ ${A("payWithAch",{id:"payWithAch"})}
1323
1323
  </h2>
1324
1324
  <p>
1325
- ${_("stripe_ach_user_details_collection_subtitle_label",{id:"stripe_ach_user_details_collection_subtitle_label"})}
1325
+ ${A("stripe_ach_user_details_collection_subtitle_label",{id:"stripe_ach_user_details_collection_subtitle_label"})}
1326
1326
  </p>
1327
1327
 
1328
1328
  <form @submit=${r=>r.preventDefault()}>
@@ -1331,7 +1331,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1331
1331
  .hasError=${this.formController.hasError.firstName}
1332
1332
  >
1333
1333
  <primer-input-label slot="label">
1334
- ${_("stripe_ach_user_details_collection_first_name_label",{id:"stripe_ach_user_details_collection_first_name_label"})}
1334
+ ${A("stripe_ach_user_details_collection_first_name_label",{id:"stripe_ach_user_details_collection_first_name_label"})}
1335
1335
  </primer-input-label>
1336
1336
  <primer-input
1337
1337
  slot="input"
@@ -1341,14 +1341,14 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1341
1341
  ?disabled=${this.isSubmitting}
1342
1342
  ></primer-input>
1343
1343
  <primer-input-error slot="error">
1344
- ${this.formController.hasError.firstName?this.formController.formState.firstName.error:u}
1344
+ ${this.formController.hasError.firstName?this.formController.formState.firstName.error:h}
1345
1345
  </primer-input-error>
1346
1346
  </primer-input-wrapper>
1347
1347
  <primer-input-wrapper
1348
1348
  .hasError=${this.formController.hasError.lastName}
1349
1349
  >
1350
1350
  <primer-input-label slot="label">
1351
- ${_("stripe_ach_user_details_collection_last_name_label",{id:"stripe_ach_user_details_collection_last_name_label"})}
1351
+ ${A("stripe_ach_user_details_collection_last_name_label",{id:"stripe_ach_user_details_collection_last_name_label"})}
1352
1352
  </primer-input-label>
1353
1353
  <primer-input
1354
1354
  slot="input"
@@ -1359,7 +1359,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1359
1359
  >
1360
1360
  </primer-input>
1361
1361
  <primer-input-error slot="error">
1362
- ${this.formController.hasError.lastName?this.formController.formState.lastName.error:u}
1362
+ ${this.formController.hasError.lastName?this.formController.formState.lastName.error:h}
1363
1363
  </primer-input-error>
1364
1364
  </primer-input-wrapper>
1365
1365
  </div>
@@ -1367,7 +1367,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1367
1367
  .hasError=${this.formController.hasError.emailAddress}
1368
1368
  >
1369
1369
  <primer-input-label slot="label">
1370
- ${_("stripe_ach_user_details_collection_email_address_label",{id:"stripe_ach_user_details_collection_email_address_label"})}
1370
+ ${A("stripe_ach_user_details_collection_email_address_label",{id:"stripe_ach_user_details_collection_email_address_label"})}
1371
1371
  </primer-input-label>
1372
1372
  <primer-input
1373
1373
  slot="input"
@@ -1378,29 +1378,29 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1378
1378
  ?disabled=${this.isSubmitting}
1379
1379
  ></primer-input>
1380
1380
  <primer-input-error slot="error">
1381
- ${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:u}
1381
+ ${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:h}
1382
1382
  </primer-input-error>
1383
1383
  </primer-input-wrapper>
1384
1384
  <p>
1385
- ${_("stripe_ach_user_details_collection_data_usage_label",{id:"stripe_ach_user_details_collection_data_usage_label"})}
1385
+ ${A("stripe_ach_user_details_collection_data_usage_label",{id:"stripe_ach_user_details_collection_data_usage_label"})}
1386
1386
  </p>
1387
1387
  <primer-button
1388
1388
  buttonType="submit"
1389
1389
  variant="primary"
1390
- @click=${()=>this._handleSubmitButtonClick(e)}
1390
+ @click=${()=>this._handleSubmitButtonClick(t)}
1391
1391
  ?disabled=${this.isSubmitting}
1392
1392
  ?loading=${this.isSubmitting}
1393
1393
  >
1394
- ${_("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}
1394
+ ${A("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}
1395
1395
  </primer-button>
1396
1396
  </form>
1397
- `}renderMandate(){return p`
1397
+ `}renderMandate(){return c`
1398
1398
  <h2>
1399
- ${_("payWithAch",{id:"payWithAch"})}
1399
+ ${A("payWithAch",{id:"payWithAch"})}
1400
1400
  </h2>
1401
1401
 
1402
1402
  <p>
1403
- ${this.clientOptions?.stripe?.mandateData.fullMandateText??_("stripe_ach_mandate_template_web",{id:"stripe_ach_mandate_template_web"}).replace(/\{merchantName\}/g,this.clientOptions?.stripe?.mandateData.merchantName??"Merchant")}
1403
+ ${this.clientOptions?.stripe?.mandateData.fullMandateText??A("stripe_ach_mandate_template_web",{id:"stripe_ach_mandate_template_web"}).replace(/\{merchantName\}/g,this.clientOptions?.stripe?.mandateData.merchantName??"Merchant")}
1404
1404
  </p>
1405
1405
 
1406
1406
  <div class="button-group">
@@ -1410,7 +1410,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1410
1410
  ?disabled=${this.isSubmitting}
1411
1411
  ?loading=${this.isSubmitting}
1412
1412
  >
1413
- ${_("stripe_ach_mandate_accept_button",{id:"stripe_ach_mandate_accept_button"})}
1413
+ ${A("stripe_ach_mandate_accept_button",{id:"stripe_ach_mandate_accept_button"})}
1414
1414
  </primer-button>
1415
1415
 
1416
1416
  <primer-button
@@ -1418,10 +1418,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1418
1418
  @click=${this._handleDeclineMandate.bind(this)}
1419
1419
  ?disabled=${this.isSubmitting}
1420
1420
  >
1421
- ${_("stripe_ach_mandate_cancel_payment_button",{id:"stripe_ach_mandate_cancel_payment_button"})}
1421
+ ${A("stripe_ach_mandate_cancel_payment_button",{id:"stripe_ach_mandate_cancel_payment_button"})}
1422
1422
  </primer-button>
1423
1423
  </div>
1424
- `}render(){return this._paymentMethodManagerTask.render({complete:e=>e?this.screen==="form"?this.renderForm(e):this.renderMandate():u})}};de.styles=[k,Zo],n([d({type:Object})],de.prototype,"paymentMethod",2),n([y({context:Z,subscribe:!0}),d({attribute:!1})],de.prototype,"paymentManagers",2),n([y({context:z,subscribe:!0}),d({attribute:!1})],de.prototype,"sdkState",2),n([y({context:Pe,subscribe:!0}),d({attribute:!1})],de.prototype,"clientOptions",2),n([T()],de.prototype,"screen",2),n([T()],de.prototype,"isSubmitting",2),de=n([f("primer-ach-payment"),L()],de);var Jo=h`
1424
+ `}render(){return this._paymentMethodManagerTask.render({complete:t=>t?this.screen==="form"?this.renderForm(t):this.renderMandate():h})}};pe.styles=[w,Ha],s([p({type:Object})],pe.prototype,"paymentMethod",2),s([b({context:J,subscribe:!0}),p({attribute:!1})],pe.prototype,"paymentManagers",2),s([b({context:j,subscribe:!0}),p({attribute:!1})],pe.prototype,"sdkState",2),s([b({context:Le,subscribe:!0}),p({attribute:!1})],pe.prototype,"clientOptions",2),s([I()],pe.prototype,"screen",2),s([I()],pe.prototype,"isSubmitting",2),pe=s([y("primer-ach-payment"),$()],pe);var Ya=f`
1425
1425
  :host {
1426
1426
  height: calc(
1427
1427
  var(--primer-typography-title-large-line-height) +
@@ -1457,7 +1457,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1457
1457
  img {
1458
1458
  height: 100%;
1459
1459
  }
1460
- `;function ui(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}var ue=class extends g{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new R(this,{task:async([e,r])=>!e||!r?I:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new R(this,{task:async([e,r])=>{if(!e||!r)return I;let o=r.getPaymentMethodConfiguration(e);return o?{backgroundColor:o.displayMetadata.button.backgroundColor.colored,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored||o.displayMetadata.button.iconUrl.light||o.displayMetadata.button.iconUrl.dark}:I},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new R(this,{task:async([e,r])=>!e||!r?I:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?ui(e):"";return r==="payWith"&&(r="pay_with"),_(r,{id:r})}start(){this._paymentMethodManagerTask.value&&(this.open=!0)}renderDialog(){return this.open?p`
1460
+ `;function Qt(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(e,t)=>t.toUpperCase())}var fe=class extends v{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new D(this,{task:async([t,r])=>!t||!r?L:r.get(t)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new D(this,{task:async([t,r])=>{if(!t||!r)return L;let o=r.getPaymentMethodConfiguration(t);return o?{backgroundColor:o.displayMetadata.button.backgroundColor.colored,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored||o.displayMetadata.button.iconUrl.light||o.displayMetadata.button.iconUrl.dark}:L},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new D(this,{task:async([t,r])=>!t||!r?L:{paymentMethodManager:t,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(t){if(!t)return;let r=t?Qt(t):"";return r==="payWith"&&(r="pay_with"),A(r,{id:r})}start(){this._paymentMethodManagerTask.value&&(this.open=!0)}renderDialog(){return this.open?c`
1461
1461
  <primer-portal>
1462
1462
  <primer-dialog @primer-dialog-close="${()=>this.open=!1}">
1463
1463
  <primer-ach-payment
@@ -1468,19 +1468,19 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1468
1468
  ></primer-ach-payment>
1469
1469
  </primer-dialog>
1470
1470
  </primer-portal>
1471
- `:u}render(){return this._setupTasks.render({error:()=>u,complete:({assetsConfig:e})=>(this.style.setProperty("--dynamic-payment-button-bg-color",e.backgroundColor),p`
1471
+ `:h}render(){return this._setupTasks.render({error:()=>h,complete:({assetsConfig:t})=>(this.style.setProperty("--dynamic-payment-button-bg-color",t.backgroundColor),c`
1472
1472
  <primer-button
1473
1473
  @click="${()=>this.start()}"
1474
- class=${q({loading:!!this.sdkState?.isProcessing,reverse:!0})}
1475
- title="${_("pay_with",{id:"pay_with"})} ${e.name}"
1474
+ class=${Z({loading:!!this.sdkState?.isProcessing,reverse:!0})}
1475
+ title="${A("pay_with",{id:"pay_with"})} ${t.name}"
1476
1476
  >
1477
1477
  <span class="image-container">
1478
- <img src="${e.iconUrl}" alt="${e.name}" />
1478
+ <img src="${t.iconUrl}" alt="${t.name}" />
1479
1479
  </span>
1480
- ${e.displayName}
1480
+ ${t.displayName}
1481
1481
  </primer-button>
1482
1482
  ${this.renderDialog()}
1483
- `)})}};ue.styles=[k,Jo],n([d({type:Object})],ue.prototype,"paymentMethod",2),n([y({context:Z,subscribe:!0})],ue.prototype,"paymentManagers",2),n([y({context:z,subscribe:!0})],ue.prototype,"sdkState",2),n([y({context:G,subscribe:!0})],ue.prototype,"headlessUtils",2),n([T()],ue.prototype,"open",2),ue=n([f("primer-dynamic-payment"),L()],ue);var Qo=h`
1483
+ `)})}};fe.styles=[w,Ya],s([p({type:Object})],fe.prototype,"paymentMethod",2),s([b({context:J,subscribe:!0})],fe.prototype,"paymentManagers",2),s([b({context:j,subscribe:!0})],fe.prototype,"sdkState",2),s([b({context:W,subscribe:!0})],fe.prototype,"headlessUtils",2),s([I()],fe.prototype,"open",2),fe=s([y("primer-dynamic-payment"),$()],fe);var za=f`
1484
1484
  :host {
1485
1485
  height: calc(
1486
1486
  var(--primer-typography-title-large-line-height) +
@@ -1504,28 +1504,75 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1504
1504
  border: 1px solid var(--primer-color-border-outlined-default);
1505
1505
  color: var(--primer-color-text-primary);
1506
1506
  flex: 1;
1507
- padding: 1px;
1507
+ padding: var(--primer-space-small);
1508
+ display: flex;
1509
+ align-items: center;
1510
+ justify-content: center;
1511
+ gap: var(--primer-space-small);
1512
+ }
1513
+
1514
+ /* Default layout: icon on the left (START) */
1515
+ primer-button {
1516
+ display: flex;
1517
+ flex-direction: row;
1518
+ }
1519
+
1520
+ /* When icon position is END */
1521
+ primer-button.icon-end {
1522
+ flex-direction: row-reverse;
1508
1523
  }
1509
1524
 
1510
1525
  .image-container {
1511
1526
  display: flex;
1512
1527
  justify-content: center;
1513
- width: 100%;
1528
+ align-items: center;
1529
+ min-width: 100px;
1514
1530
  height: 100%;
1515
1531
  }
1532
+
1533
+ .button-text {
1534
+ font-family: var(--primer-typography-font-family);
1535
+ font-size: var(--primer-typography-title-small-font-size);
1536
+ font-weight: var(--primer-typography-title-small-font-weight);
1537
+ line-height: var(--primer-typography-title-small-line-height);
1538
+ letter-spacing: var(--primer-typography-title-small-letter-spacing);
1539
+ white-space: nowrap;
1540
+ overflow: hidden;
1541
+ text-overflow: ellipsis;
1542
+ }
1543
+
1516
1544
  /* Target the img specifically inside our component */
1517
1545
  img {
1518
- height: 100%;
1546
+ max-width: 100px;
1547
+ width: 100%;
1548
+ height: auto;
1549
+ object-fit: cover;
1550
+ max-height: 100%;
1519
1551
  }
1520
- `;var ve=class extends g{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new R(this,{task:async([e,r])=>!e||!r?I:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new R(this,{task:async([e,r])=>{if(!e||!r)return I;let o=r.getPaymentMethodConfiguration(e);return o?{backgroundColor:o.displayMetadata.button.backgroundColor.colored,name:o.name,iconUrl:o.displayMetadata.button.iconUrl.colored}:I},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new R(this,{task:async([e,r])=>!e||!r?I:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}startRedirectPayment(){this._paymentMethodManagerTask.value&&this._paymentMethodManagerTask.value.start()}render(){return this._setupTasks.render({error:()=>u,complete:({assetsConfig:e})=>(this.style.setProperty("--redirect-payment-button-bg-color",e.backgroundColor),p` <primer-button
1521
- @click="${()=>this.startRedirectPayment()}"
1522
- class=${q({loading:!!this.sdkState?.isProcessing})}
1523
- title="${_("pay_with",{id:"pay_with"})} ${e.name}"
1524
- >
1525
- <span class="image-container">
1526
- <img src="${e.iconUrl}" alt="${e.name}" />
1527
- </span>
1528
- </primer-button>`)})}};ve.styles=[k,Qo],n([d({type:Object})],ve.prototype,"paymentMethod",2),n([y({context:Z,subscribe:!0})],ve.prototype,"paymentManagers",2),n([y({context:z,subscribe:!0})],ve.prototype,"sdkState",2),n([y({context:G,subscribe:!0})],ve.prototype,"headlessUtils",2),ve=n([f("primer-redirect-payment"),L()],ve);var ea=h`
1552
+
1553
+ /* For image container sizing */
1554
+ .image-container {
1555
+ flex-shrink: 0;
1556
+ flex-grow: 1;
1557
+ }
1558
+ `;var be=class extends v{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new D(this,{task:async([t,r])=>!t||!r?L:r.get(t)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new D(this,{task:async([t,r])=>{if(!t||!r)return L;let o=r.getPaymentMethodConfiguration(t);if(!o)return L;let n=o.displayMetadata.button.backgroundColor.colored??o.displayMetadata.button.backgroundColor.light,l=o.displayMetadata.button.iconPositionRelativeToText||"START";return{backgroundColor:n,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored??o.displayMetadata.button.iconUrl.light,iconPosition:l}},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new D(this,{task:async([t,r])=>!t||!r?L:{paymentMethodManager:t,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(t){if(!t)return;let r=t?Qt(t):"";return r==="payWith"&&(r="pay_with"),A(r,{id:r})}startRedirectPayment(){this._paymentMethodManagerTask.value&&this._paymentMethodManagerTask.value.start()}render(){return this._setupTasks.render({error:()=>h,complete:({assetsConfig:t})=>{this.style.setProperty("--redirect-payment-button-bg-color",t.backgroundColor);let r={loading:!!this.sdkState?.isProcessing,"icon-end":t.iconPosition==="END","image-only":!t.displayName},o=t.displayName?c`
1559
+ <span class="image-container">
1560
+ <img src="${t.iconUrl}" alt="${t.name}" />
1561
+ </span>
1562
+ <span class="button-text">${t.displayName}</span>
1563
+ `:c`
1564
+ <span class="image-container">
1565
+ <img src="${t.iconUrl}" alt="${t.name}" />
1566
+ </span>
1567
+ `;return c`
1568
+ <primer-button
1569
+ @click="${()=>this.startRedirectPayment()}"
1570
+ class=${Z(r)}
1571
+ title="${A("pay_with",{id:"pay_with"})} ${t.name}"
1572
+ >
1573
+ ${o}
1574
+ </primer-button>
1575
+ `}})}};be.styles=[w,za],s([p({type:Object})],be.prototype,"paymentMethod",2),s([b({context:J,subscribe:!0})],be.prototype,"paymentManagers",2),s([b({context:j,subscribe:!0})],be.prototype,"sdkState",2),s([b({context:W,subscribe:!0})],be.prototype,"headlessUtils",2),be=s([y("primer-redirect-payment"),$()],be);var Fa=f`
1529
1576
  :host {
1530
1577
  display: contents;
1531
1578
  }
@@ -1544,22 +1591,22 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1544
1591
  primer-vault-manager {
1545
1592
  margin-bottom: var(--primer-space-xlarge);
1546
1593
  }
1547
- `;var Ue=class extends g{constructor(){super(...arguments);this.hasAssignedContent=!1;this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.paymentMethods=null;this.sdkState=null}render(){return this.sdkState?.isSuccessful?p`
1594
+ `;var Fe=class extends v{constructor(){super(...arguments);this.hasAssignedContent=!1;this.onSlotChange=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0,this.requestUpdate()};this.paymentMethods=null;this.sdkState=null}render(){return this.sdkState?.isSuccessful?c`
1548
1595
  <slot name="checkout-complete">
1549
1596
  <primer-checkout-complete></primer-checkout-complete>
1550
1597
  </slot>
1551
- `:p`
1598
+ `:c`
1552
1599
  <slot name="payments" @slotchange=${this.onSlotChange}></slot>
1553
- ${V(this.hasAssignedContent,()=>u,()=>p`
1600
+ ${U(this.hasAssignedContent,()=>h,()=>c`
1554
1601
  <div
1555
- class=${q({"primer-is-processing":!!this.sdkState?.isProcessing})}
1602
+ class=${Z({"primer-is-processing":!!this.sdkState?.isProcessing})}
1556
1603
  >
1557
1604
  <primer-vault-manager></primer-vault-manager>
1558
1605
  <primer-show-other-payments>
1559
1606
  <div slot="other-payments" class="primer-main-list">
1560
- ${this.paymentMethods?.toArray().map(e=>p`
1607
+ ${this.paymentMethods?.toArray().map(t=>c`
1561
1608
  <primer-payment-method
1562
- type=${e.type}
1609
+ type=${t.type}
1563
1610
  ></primer-payment-method>
1564
1611
  `)}
1565
1612
  </div>
@@ -1567,7 +1614,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1567
1614
  <primer-error-message-container></primer-error-message-container>
1568
1615
  </div>
1569
1616
  `)}
1570
- `}};Ue.styles=[k,ea],n([y({context:st,subscribe:!0}),d()],Ue.prototype,"paymentMethods",2),n([y({context:z,subscribe:!0}),d()],Ue.prototype,"sdkState",2),Ue=n([f("primer-main")],Ue);var ta=h`
1617
+ `}};Fe.styles=[w,Fa],s([b({context:vt,subscribe:!0}),p()],Fe.prototype,"paymentMethods",2),s([b({context:j,subscribe:!0}),p()],Fe.prototype,"sdkState",2),Fe=s([y("primer-main")],Fe);var Ba=f`
1571
1618
  :host {
1572
1619
  height: calc(
1573
1620
  var(--primer-typography-title-large-line-height) +
@@ -1581,10 +1628,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1581
1628
  height: 100%;
1582
1629
  flex: 1;
1583
1630
  }
1584
- `;var ke=class extends g{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new R(this,{args:()=>[this.paymentMethod?.type],task:async([e])=>{if(!e)return I;let r=this.paymentManagers.get(e)?.manager;if(!r)throw new Error(`No manager found for payment method type ${e}`);return r}}),new R(this,{args:()=>[this.loadManagerTask.value],task:async([e])=>{if(!e)return I;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),s=e.createButton(),m=this.createRenderOptions(o);return await s.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,m),e}})}calculateButtonHeight(){if(typeof window>"u"||!this.isConnected||!this.computedStyles)return 0;let e=parseFloat(this.computedStyles.getPropertyValue("--primer-typography-title-large-line-height")),r=parseFloat(this.computedStyles.getPropertyValue("--primer-space-medium"));return e+2*r}createRenderOptions(e){let r=this.paymentMethod?.type;return r==="GOOGLE_PAY"?{style:{shadowRoot:!0}}:r==="APPLE_PAY"?{style:{buttonHeight:e}}:r==="PAYPAL"?{style:{buttonHeight:e}}:{style:{buttonHeight:e}}}updated(e){e.has("paymentMethod")&&this.paymentMethod&&(this._buttonId=`button-container-${this.paymentMethod.type}`)}render(){return this.loadManagerTask.render({error:()=>u,complete:()=>p`
1631
+ `;var we=class extends v{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new D(this,{args:()=>[this.paymentMethod?.type],task:async([t])=>{if(!t)return L;let r=this.paymentManagers.get(t)?.manager;if(!r)throw new Error(`No manager found for payment method type ${t}`);return r}}),new D(this,{args:()=>[this.loadManagerTask.value],task:async([t])=>{if(!t)return L;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),n=t.createButton(),l=this.createRenderOptions(o);return await n.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,l),t}})}calculateButtonHeight(){if(typeof window>"u"||!this.isConnected||!this.computedStyles)return 0;let t=parseFloat(this.computedStyles.getPropertyValue("--primer-typography-title-large-line-height")),r=parseFloat(this.computedStyles.getPropertyValue("--primer-space-medium"));return t+2*r}createRenderOptions(t){let r=this.paymentMethod?.type;return r==="GOOGLE_PAY"?{style:{shadowRoot:!0}}:r==="APPLE_PAY"?{style:{buttonHeight:t}}:r==="PAYPAL"?{style:{buttonHeight:t}}:{style:{buttonHeight:t}}}updated(t){t.has("paymentMethod")&&this.paymentMethod&&(this._buttonId=`button-container-${this.paymentMethod.type}`)}render(){return this.loadManagerTask.render({error:()=>h,complete:()=>c`
1585
1632
  <!-- The native button container is rendered first -->
1586
1633
  <div class="native-button-container" id="${this._buttonId}"></div>
1587
- `,pending:()=>u})}};ke.styles=[k,ta],n([d({type:Object})],ke.prototype,"paymentMethod",2),n([y({context:Z,subscribe:!0}),d()],ke.prototype,"paymentManagers",2),n([y({context:Ie,subscribe:!0}),d()],ke.prototype,"computedStyles",2),ke=n([f("primer-native-payment")],ke);var _r="card-form-context";var ra=h`
1634
+ `,pending:()=>h})}};we.styles=[w,Ba],s([p({type:Object})],we.prototype,"paymentMethod",2),s([b({context:J,subscribe:!0}),p()],we.prototype,"paymentManagers",2),s([b({context:$e,subscribe:!0}),p()],we.prototype,"computedStyles",2),we=s([y("primer-native-payment")],we);var Kr="card-form-context";var Ka=f`
1588
1635
  :host {
1589
1636
  display: contents;
1590
1637
  }
@@ -1607,10 +1654,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1607
1654
  display: flex;
1608
1655
  gap: var(--primer-space-small);
1609
1656
  }
1610
- `;var Te=class extends g{constructor(){super(...arguments);this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new j(this,{context:_r,initialValue:null});this.eventsController=new at(this);this.setupCardFormTask=new R(this,{task:async([e])=>{if(!e?.manager)return I;let{manager:r}=e,{cardNumberInput:o,expiryInput:s,cvvInput:m}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:s,cvvInput:m,setCardholderName:C=>r.setCardholderName(C),setCardNetwork:C=>{this.selectedCardNetwork=C},validate:()=>r.validate(),submit:C=>r.submit(C)}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=e=>{let o=e.target.closest("button, primer-button");if(!o)return;this.isSubmitButton(o)&&(e.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=e=>{e.stopPropagation(),this.submitCardPayment()};this.onSlotChange=e=>{let o=e.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0};this.handleFormSubmit=e=>{e.preventDefault(),e.stopPropagation(),this.submitCardPayment()}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleSlotButtonClick),this.addEventListener("primer-form-submit",this.handleDirectSubmit)}disconnectedCallback(){this.removeEventListener("click",this.handleSlotButtonClick),this.removeEventListener("primer-form-submit",this.handleDirectSubmit),super.disconnectedCallback()}isSubmitButton(e){let r=e.tagName.toLowerCase(),o=r==="button",s=r==="primer-button";return o&&(e.getAttribute("type")==="submit"||e.hasAttribute("data-submit"))||s&&(e.getAttribute("buttonType")==="submit"||e.hasAttribute("data-submit"))}async submitCardPayment(){let e=this.cardFormProvider.value;if(!e)return;let r=await e.validate?.();if(r?.valid){let o=await e.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(o)}else{let o=r?.validationErrors;this.cardFormProvider.setValue({...e,errors:o}),this.eventsController.dispatchFormSubmitErrors(o)}}render(){return this.setupCardFormTask.status===Re.ERROR||this.setupCardFormTask.status===Re.INITIAL?u:p`
1657
+ `;var ke=class extends v{constructor(){super(...arguments);this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new q(this,{context:Kr,initialValue:null});this.eventsController=new gt(this);this.setupCardFormTask=new D(this,{task:async([t])=>{if(!t?.manager)return L;let{manager:r}=t,{cardNumberInput:o,expiryInput:n,cvvInput:l}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:n,cvvInput:l,setCardholderName:g=>r.setCardholderName(g),setCardNetwork:g=>{this.selectedCardNetwork=g},validate:()=>r.validate(),submit:g=>r.submit(g)}),!0},args:()=>[this.paymentManagers.get("PAYMENT_CARD")]});this.handleSlotButtonClick=t=>{let o=t.target.closest("button, primer-button");if(!o)return;this.isSubmitButton(o)&&(t.preventDefault(),this.submitCardPayment())};this.handleDirectSubmit=t=>{t.stopPropagation(),this.submitCardPayment()};this.onSlotChange=t=>{let o=t.target.assignedNodes({flatten:!0});this.hasAssignedContent=o.length>0};this.handleFormSubmit=t=>{t.preventDefault(),t.stopPropagation(),this.submitCardPayment()}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleSlotButtonClick),this.addEventListener("primer-form-submit",this.handleDirectSubmit)}disconnectedCallback(){this.removeEventListener("click",this.handleSlotButtonClick),this.removeEventListener("primer-form-submit",this.handleDirectSubmit),super.disconnectedCallback()}isSubmitButton(t){let r=t.tagName.toLowerCase(),o=r==="button",n=r==="primer-button";return o&&(t.getAttribute("type")==="submit"||t.hasAttribute("data-submit"))||n&&(t.getAttribute("buttonType")==="submit"||t.hasAttribute("data-submit"))}async submitCardPayment(){let t=this.cardFormProvider.value;if(!t)return;let r=await t.validate?.();if(r?.valid){let o=await t.submit?.(this.selectedCardNetwork?{cardNetwork:this.selectedCardNetwork}:void 0);this.eventsController.dispatchFormSubmitSuccess(o)}else{let o=r?.validationErrors;this.cardFormProvider.setValue({...t,errors:o}),this.eventsController.dispatchFormSubmitErrors(o)}}render(){return this.setupCardFormTask.status===De.ERROR||this.setupCardFormTask.status===De.INITIAL?h:c`
1611
1658
  <form @submit=${this.handleFormSubmit}>
1612
1659
  <slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
1613
- ${this.setupCardFormTask.render({complete:()=>V(this.hasAssignedContent,()=>u,()=>p`
1660
+ ${this.setupCardFormTask.render({complete:()=>U(this.hasAssignedContent,()=>h,()=>c`
1614
1661
  <div class="card-form">
1615
1662
  <primer-input-card-number></primer-input-card-number>
1616
1663
  <div class="card-form-row">
@@ -1622,7 +1669,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1622
1669
  <primer-card-form-submit></primer-card-form-submit>
1623
1670
  `)})}
1624
1671
  </form>
1625
- `}};Te.styles=[k,ra],n([T()],Te.prototype,"hasAssignedContent",2),n([T()],Te.prototype,"selectedCardNetwork",2),n([y({context:Z,subscribe:!0}),d({type:Object})],Te.prototype,"paymentManagers",2),Te=n([f("primer-card-form"),L()],Te);function ia(i,t){if(i.style.cssText="width: 100%; flex:1; padding: 0; border: none; height: var(--primer-typography-body-large-line-height); font-size: var(--primer-typography-body-large-size); font-family: var(--primer-typography-body-large-font); color: var(--primer-color-text-primary); background-color: transparent; outline: none;",i.setAttribute("data-custom-input",""),!t.shadowRoot?.querySelector("style[data-custom-input-style]")){let e=document.createElement("style");e.setAttribute("data-custom-input-style",""),e.textContent=`
1672
+ `}};ke.styles=[w,Ka],s([I()],ke.prototype,"hasAssignedContent",2),s([I()],ke.prototype,"selectedCardNetwork",2),s([b({context:J,subscribe:!0}),p({type:Object})],ke.prototype,"paymentManagers",2),ke=s([y("primer-card-form"),$()],ke);function ja(i,e){if(i.style.cssText="width: 100%; flex:1; padding: 0; border: none; height: var(--primer-typography-body-large-line-height); font-size: var(--primer-typography-body-large-size); font-family: var(--primer-typography-body-large-font); color: var(--primer-color-text-primary); background-color: transparent; outline: none;",i.setAttribute("data-custom-input",""),!e.shadowRoot?.querySelector("style[data-custom-input-style]")){let t=document.createElement("style");t.setAttribute("data-custom-input-style",""),t.textContent=`
1626
1673
  input[data-custom-input]::placeholder {
1627
1674
  color: var(--primer-color-text-placeholder);
1628
1675
  font-size: var(--primer-typography-body-large-size);
@@ -1631,10 +1678,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1631
1678
  input[data-custom-input]:focus {
1632
1679
  outline: none;
1633
1680
  }
1634
- `,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function Ar(i){return i?{paddingHorizontal:0,placeholder:{color:i.getPropertyValue("--primer-color-text-placeholder").trim(),fontSize:i.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:i.getPropertyValue("--primer-typography-body-large-font").trim()},height:i.getPropertyValue("--primer-typography-body-large-line-height").trim(),fontSize:i.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:i.getPropertyValue("--primer-typography-body-large-font").trim(),color:i.getPropertyValue("--primer-color-text-primary").trim()}:null}function oa(i,t){return i.active===t.active&&i.dirty===t.dirty&&i.error===t.error&&i.errorCode===t.errorCode&&i.submitted===t.submitted&&i.touched===t.touched&&i.valid===t.valid}var Mr=class{constructor(t,e){this._isFocused=!1;this._meta={active:!1,dirty:!1,error:null,errorCode:null,submitted:!1,touched:!1,valid:!1};this._hostedInput=null;this._standardInput=null;this.host=t,this.config=e,this.host.addController(this),this.setupTask=new R(this.host,{args:()=>[this.getHostedInput()],task:this.setupHostedInput.bind(this)}),this.host.addEventListener("wrapper-click",()=>{this.focusInput()})}focusInput(){this._hostedInput?this._hostedInput.focus():this._standardInput&&this._standardInput.focus()}getHostedInput(){let{type:t}=this.config,e=this.host.cardFormContext;return e?{cardNumber:e.cardNumberInput,cvv:e.cvvInput,expire:e.expiryInput,cardholderName:"cardholderName"}[t]:void 0}async setupHostedInput([t]){if(!t)return I;await this.host.updateComplete;let e=this.getTargetContainer();return e?t==="cardholderName"?this.setupStandardInput(e):this.setupHostedIframeInput(t,e):I}getTargetContainer(){return this.host.renderRoot.querySelector(this.config.containerSelector)}setupStandardInput(t){let e=document.createElement("input");return e.type="text",e.placeholder=this.host.placeholder,ia(e,this.host),(this.host.ariaLabel||this.host.label)&&e.setAttribute("aria-label",this.host.ariaLabel??this.host.label),this.setupInputEventListeners(e),t.innerHTML="",t.appendChild(e),this._standardInput=e,!0}setupInputEventListeners(t){t.addEventListener("input",e=>{let r=e.target;this.config.onInput?.(r.value)}),t.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),t.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()})}async setupHostedIframeInput(t,e){await new Promise(s=>requestAnimationFrame(()=>s())),this._hostedInput=t;let r=Ar(this.host.computedStyles),o=r?{style:{input:{base:r}}}:void 0;return t.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),t.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()}),t.addEventListener("change",s=>{this._meta=s,oa(this._meta,s)&&this.host.requestUpdate()}),await t.render(e,{placeholder:this.host.placeholder,ariaLabel:this.host.ariaLabel,...o}),!0}get isFocused(){return this._isFocused}get meta(){return this._meta}hostConnected(){}hostDisconnected(){this._hostedInput=null,this._standardInput=null}};var W=class extends g{constructor(){super();this.cardFormContext=null;this.computedStyles=null;this._userAssignedProps=new Set;this._internalLabel="";this._internalPlaceholder="";this._internalAriaLabel="";this.hostedInputController={}}getTranslatedValue(e){return e?typeof e=="string"?e:_(e.id,{id:e.id}):""}get label(){return this._userAssignedProps.has("label")?this._internalLabel:this.getTranslatedValue(this.config.translations.label)}set label(e){let r=this.label;e!==""?(this._userAssignedProps.add("label"),this._internalLabel=e):(this._userAssignedProps.delete("label"),this._internalLabel=""),this.requestUpdate("label",r)}get placeholder(){return this._userAssignedProps.has("placeholder")?this._internalPlaceholder:this.getTranslatedValue(this.config.translations.placeholder)}set placeholder(e){let r=this.placeholder;this._userAssignedProps.add("placeholder"),this._internalPlaceholder=e,this.requestUpdate("placeholder",r)}get ariaLabel(){return this._userAssignedProps.has("ariaLabel")?this._internalAriaLabel:this.getTranslatedValue(this.config.translations.ariaLabel)||this.getTranslatedValue(this.config.translations.label)}set ariaLabel(e){let r=this.ariaLabel;e!==""?(this._userAssignedProps.add("ariaLabel"),this._internalAriaLabel=e):(this._userAssignedProps.delete("ariaLabel"),this._internalAriaLabel=""),this.requestUpdate("ariaLabel",r)}childUpdated(){Object.defineProperty(this,"hostedInputController",{value:new Mr(this,{type:this.config.inputType,containerSelector:this.config.containerSelector,onInput:this.config.onInput}),writable:!1,configurable:!1})}handleWrapperClick(){this.hostedInputController.focusInput()}getError(){let e=this.hostedInputController.meta;return e.submitted||e.dirty&&e.touched?e.errorCode:null}renderInput(){if(this.hostedInputController.setupTask.status===Re.ERROR)return u;let e=this.getError();return p`
1681
+ `,e.shadowRoot?e.shadowRoot.appendChild(t):e.appendChild(t)}}function jr(i){return i?{paddingHorizontal:0,placeholder:{color:i.getPropertyValue("--primer-color-text-placeholder").trim(),fontSize:i.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:i.getPropertyValue("--primer-typography-body-large-font").trim()},height:i.getPropertyValue("--primer-typography-body-large-line-height").trim(),fontSize:i.getPropertyValue("--primer-typography-body-large-size").trim(),fontFamily:i.getPropertyValue("--primer-typography-body-large-font").trim(),color:i.getPropertyValue("--primer-color-text-primary").trim()}:null}function Ga(i,e){return i.active===e.active&&i.dirty===e.dirty&&i.error===e.error&&i.errorCode===e.errorCode&&i.submitted===e.submitted&&i.touched===e.touched&&i.valid===e.valid}var Gr=class{constructor(e,t){this._isFocused=!1;this._meta={active:!1,dirty:!1,error:null,errorCode:null,submitted:!1,touched:!1,valid:!1};this._hostedInput=null;this._standardInput=null;this.host=e,this.config=t,this.host.addController(this),this.setupTask=new D(this.host,{args:()=>[this.getHostedInput()],task:this.setupHostedInput.bind(this)}),this.host.addEventListener("wrapper-click",()=>{this.focusInput()})}focusInput(){this._hostedInput?this._hostedInput.focus():this._standardInput&&this._standardInput.focus()}getHostedInput(){let{type:e}=this.config,t=this.host.cardFormContext;return t?{cardNumber:t.cardNumberInput,cvv:t.cvvInput,expire:t.expiryInput,cardholderName:"cardholderName"}[e]:void 0}async setupHostedInput([e]){if(!e)return L;await this.host.updateComplete;let t=this.getTargetContainer();return t?e==="cardholderName"?this.setupStandardInput(t):this.setupHostedIframeInput(e,t):L}getTargetContainer(){return this.host.renderRoot.querySelector(this.config.containerSelector)}setupStandardInput(e){let t=document.createElement("input");return t.type="text",t.placeholder=this.host.placeholder,ja(t,this.host),(this.host.ariaLabel||this.host.label)&&t.setAttribute("aria-label",this.host.ariaLabel??this.host.label),this.setupInputEventListeners(t),e.innerHTML="",e.appendChild(t),this._standardInput=t,!0}setupInputEventListeners(e){e.addEventListener("input",t=>{let r=t.target;this.config.onInput?.(r.value)}),e.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),e.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()})}async setupHostedIframeInput(e,t){await new Promise(n=>requestAnimationFrame(()=>n())),this._hostedInput=e;let r=jr(this.host.computedStyles),o=r?{style:{input:{base:r}}}:void 0;return e.addEventListener("focus",()=>{this._isFocused=!0,this.host.requestUpdate()}),e.addEventListener("blur",()=>{this._isFocused=!1,this.host.requestUpdate()}),e.addEventListener("change",n=>{this._meta=n,Ga(this._meta,n)&&this.host.requestUpdate()}),await e.render(t,{placeholder:this.host.placeholder,ariaLabel:this.host.ariaLabel,...o}),!0}get isFocused(){return this._isFocused}get meta(){return this._meta}hostConnected(){}hostDisconnected(){this._hostedInput=null,this._standardInput=null}};var X=class extends v{constructor(){super();this.cardFormContext=null;this.computedStyles=null;this._userAssignedProps=new Set;this._internalLabel="";this._internalPlaceholder="";this._internalAriaLabel="";this.hostedInputController={}}getTranslatedValue(t){return t?typeof t=="string"?t:A(t.id,{id:t.id}):""}get label(){return this._userAssignedProps.has("label")?this._internalLabel:this.getTranslatedValue(this.config.translations.label)}set label(t){let r=this.label;t!==""?(this._userAssignedProps.add("label"),this._internalLabel=t):(this._userAssignedProps.delete("label"),this._internalLabel=""),this.requestUpdate("label",r)}get placeholder(){return this._userAssignedProps.has("placeholder")?this._internalPlaceholder:this.getTranslatedValue(this.config.translations.placeholder)}set placeholder(t){let r=this.placeholder;this._userAssignedProps.add("placeholder"),this._internalPlaceholder=t,this.requestUpdate("placeholder",r)}get ariaLabel(){return this._userAssignedProps.has("ariaLabel")?this._internalAriaLabel:this.getTranslatedValue(this.config.translations.ariaLabel)||this.getTranslatedValue(this.config.translations.label)}set ariaLabel(t){let r=this.ariaLabel;t!==""?(this._userAssignedProps.add("ariaLabel"),this._internalAriaLabel=t):(this._userAssignedProps.delete("ariaLabel"),this._internalAriaLabel=""),this.requestUpdate("ariaLabel",r)}childUpdated(){Object.defineProperty(this,"hostedInputController",{value:new Gr(this,{type:this.config.inputType,containerSelector:this.config.containerSelector,onInput:this.config.onInput}),writable:!1,configurable:!1})}handleWrapperClick(){this.hostedInputController.focusInput()}getError(){let t=this.hostedInputController.meta;return t.submitted||t.dirty&&t.touched?t.errorCode:null}renderInput(){if(this.hostedInputController.setupTask.status===De.ERROR)return h;let t=this.getError();return c`
1635
1682
  <primer-input-wrapper
1636
1683
  .focusWithin="${this.hostedInputController.isFocused}"
1637
- .hasError=${!!e}
1684
+ .hasError=${!!t}
1638
1685
  @wrapper-click="${this.handleWrapperClick}"
1639
1686
  >
1640
1687
  <primer-input-label slot="label">${this.label}</primer-input-label>
@@ -1643,13 +1690,13 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1643
1690
  class="card-input-slot"
1644
1691
  id="${this.config.containerSelector.substring(1)}"
1645
1692
  ></div>
1646
- ${V(e,()=>p`
1693
+ ${U(t,()=>c`
1647
1694
  <primer-input-error slot="error">
1648
- ${_(e,{id:e})}
1695
+ ${A(t,{id:t})}
1649
1696
  </primer-input-error>
1650
- `,()=>u)}
1697
+ `,()=>h)}
1651
1698
  </primer-input-wrapper>
1652
- `}};n([y({context:_r,subscribe:!0})],W.prototype,"cardFormContext",2),n([y({context:Ie,subscribe:!0}),d()],W.prototype,"computedStyles",2),n([d({type:String})],W.prototype,"label",1),n([d({type:String})],W.prototype,"placeholder",1),n([d({type:String,attribute:"aria-label"})],W.prototype,"ariaLabel",1);var aa=h`
1699
+ `}};s([b({context:Kr,subscribe:!0})],X.prototype,"cardFormContext",2),s([b({context:$e,subscribe:!0}),p()],X.prototype,"computedStyles",2),s([p({type:String})],X.prototype,"label",1),s([p({type:String})],X.prototype,"placeholder",1),s([p({type:String,attribute:"aria-label"})],X.prototype,"ariaLabel",1);var qa=f`
1653
1700
  :host {
1654
1701
  display: contents;
1655
1702
  }
@@ -1673,14 +1720,14 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1673
1720
  align-items: center;
1674
1721
  z-index: 2;
1675
1722
  }
1676
- `;var Ye=h`
1723
+ `;var Be=f`
1677
1724
  .card-input-slot {
1678
1725
  display: flex;
1679
1726
  }
1680
- `;var mt=class extends W{constructor(){super();this.config={inputType:"cardNumber",containerSelector:"#cardNumber",errorName:"cardNumber-card",translations:{label:{id:"cardNumber",defaultMessage:"Card Number"},placeholder:"4111 1111 1111 1111",ariaLabel:{id:"cardNumber",defaultMessage:"Card Number"}}};this.childUpdated()}handleNetworkSelected(e){let{network:r}=e.detail;this.cardFormContext&&this.cardFormContext.setCardNetwork(r)}renderInput(){if(this.hostedInputController.setupTask.status===Re.ERROR)return u;let e=this.getError();return p`
1727
+ `;var xt=class extends X{constructor(){super();this.config={inputType:"cardNumber",containerSelector:"#cardNumber",errorName:"cardNumber-card",translations:{label:{id:"cardNumber",defaultMessage:"Card Number"},placeholder:"4111 1111 1111 1111",ariaLabel:{id:"cardNumber",defaultMessage:"Card Number"}}};this.childUpdated()}handleNetworkSelected(t){let{network:r}=t.detail;this.cardFormContext&&this.cardFormContext.setCardNetwork(r)}renderInput(){if(this.hostedInputController.setupTask.status===De.ERROR)return h;let t=this.getError();return c`
1681
1728
  <primer-input-wrapper
1682
1729
  .focusWithin="${this.hostedInputController.isFocused}"
1683
- .hasError=${!!e}
1730
+ .hasError=${!!t}
1684
1731
  >
1685
1732
  <primer-input-label slot="label">${this.label}</primer-input-label>
1686
1733
  <div slot="input" class="card-number-container">
@@ -1691,29 +1738,29 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1691
1738
  ></primer-card-network-selector>
1692
1739
  </div>
1693
1740
  </div>
1694
- ${V(e,r=>p`
1741
+ ${U(t,r=>c`
1695
1742
  <primer-input-error slot="error">
1696
- ${_(r,{id:r})}
1743
+ ${A(r,{id:r})}
1697
1744
  </primer-input-error>
1698
- `,()=>u)}
1745
+ `,()=>h)}
1699
1746
  </primer-input-wrapper>
1700
- `}render(){return this.renderInput()}};mt.styles=[k,Ye,aa],mt=n([f("primer-input-card-number"),L()],mt);var na=h`
1747
+ `}render(){return this.renderInput()}};xt.styles=[w,Be,qa],xt=s([y("primer-input-card-number"),$()],xt);var Wa=f`
1701
1748
  :host {
1702
1749
  display: contents;
1703
1750
  }
1704
- `;var ut=class extends W{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};ut.styles=[k,Ye,na],ut=n([f("primer-input-cvv"),L()],ut);var sa=h`
1751
+ `;var At=class extends X{constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};At.styles=[w,Be,Wa],At=s([y("primer-input-cvv"),$()],At);var Za=f`
1705
1752
  :host {
1706
1753
  display: contents;
1707
1754
  }
1708
- `;var ht=class extends W{constructor(){super();this.config={inputType:"expire",containerSelector:"#expiry",errorName:"expiryDate-card",translations:{label:{id:"cardExpiry",defaultMessage:"Expiry Date"},placeholder:{id:"cardExpiryPlaceholder",defaultMessage:"MM/YY"},ariaLabel:{id:"cardExpiry",defaultMessage:"Expiry Date"}}};this.childUpdated()}render(){return this.renderInput()}};ht.styles=[k,Ye,sa],ht=n([f("primer-input-card-expiry"),L()],ht);var la=h`
1755
+ `;var _t=class extends X{constructor(){super();this.config={inputType:"expire",containerSelector:"#expiry",errorName:"expiryDate-card",translations:{label:{id:"cardExpiry",defaultMessage:"Expiry Date"},placeholder:{id:"cardExpiryPlaceholder",defaultMessage:"MM/YY"},ariaLabel:{id:"cardExpiry",defaultMessage:"Expiry Date"}}};this.childUpdated()}render(){return this.renderInput()}};_t.styles=[w,Be,Za],_t=s([y("primer-input-card-expiry"),$()],_t);var Xa=f`
1709
1756
  :host {
1710
1757
  display: contents;
1711
1758
  }
1712
- `;var gt=class extends W{constructor(){super();this.config={inputType:"cardholderName",containerSelector:"#cardFormName",errorName:"cardholderName",translations:{label:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"},placeholder:{id:"cardholderNamePlaceholder",defaultMessage:"Name on card"},ariaLabel:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"}},onInput:e=>this.handleInput(e)};this.childUpdated()}handleInput(e){this.cardFormContext?.setCardholderName?.(e)}render(){return this.renderInput()}};gt.styles=[k,Ye,la],gt=n([f("primer-input-card-holder-name"),L()],gt);var da=h`
1759
+ `;var St=class extends X{constructor(){super();this.config={inputType:"cardholderName",containerSelector:"#cardFormName",errorName:"cardholderName",translations:{label:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"},placeholder:{id:"cardholderNamePlaceholder",defaultMessage:"Name on card"},ariaLabel:{id:"cardholderNameLabel",defaultMessage:"Cardholder Name"}},onInput:t=>this.handleInput(t)};this.childUpdated()}handleInput(t){this.cardFormContext?.setCardholderName?.(t)}render(){return this.renderInput()}};St.styles=[w,Be,Xa],St=s([y("primer-input-card-holder-name"),$()],St);var Ja=f`
1713
1760
  :host {
1714
1761
  display: contents;
1715
1762
  }
1716
- `;var pe=class extends g{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.clientOptions=null;this.sdkState=null;this.variant="primary";this.disabled=!1;this.handleClick=e=>{if(e.preventDefault(),this.disabled)return;let r=new CustomEvent("primer-form-submit",{bubbles:!0,composed:!0,detail:{source:"primer-card-form-submit"}});this.dispatchEvent(r)}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:_("pay",{id:"pay"})}set buttonText(e){let r=this.buttonText;e!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=e):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}render(){let e=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=e?` ${e}`:u;return p`
1763
+ `;var ce=class extends v{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.clientOptions=null;this.sdkState=null;this.variant="primary";this.disabled=!1;this.handleClick=t=>{if(t.preventDefault(),this.disabled)return;let r=new CustomEvent("primer-form-submit",{bubbles:!0,composed:!0,detail:{source:"primer-card-form-submit"}});this.dispatchEvent(r)}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:A("pay",{id:"pay"})}set buttonText(t){let r=this.buttonText;t!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=t):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}render(){let t=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=t?` ${t}`:h;return c`
1717
1764
  <primer-button
1718
1765
  buttonType="submit"
1719
1766
  variant=${this.variant}
@@ -1724,7 +1771,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1724
1771
  >
1725
1772
  ${this.buttonText}${r}
1726
1773
  </primer-button>
1727
- `}};pe.styles=[k,da],n([d({type:String})],pe.prototype,"buttonText",1),n([y({context:G,subscribe:!0}),d({type:Object})],pe.prototype,"headlessInstance",2),n([y({context:Pe,subscribe:!0}),d({type:Object})],pe.prototype,"clientOptions",2),n([y({context:z,subscribe:!0}),d()],pe.prototype,"sdkState",2),n([d({type:String})],pe.prototype,"variant",2),n([d({type:Boolean})],pe.prototype,"disabled",2),pe=n([f("primer-card-form-submit"),L()],pe);var{I:Sy}=Ao;var pa=i=>i.strings===void 0;var Yt=(i,t)=>{let e=i._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),Yt(r,t);return!0},Sr=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},ca=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),Zn(t)}};function qn(i){this._$AN!==void 0?(Sr(this),this._$AM=i,ca(this)):this._$AM=i}function Wn(i,t=!1,e=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(t)if(Array.isArray(r))for(let s=e;s<r.length;s++)Yt(r[s],!1),Sr(r[s]);else r!=null&&(Yt(r,!1),Sr(r));else Yt(this,i)}var Zn=i=>{i.type==xr.CHILD&&(i._$AP??(i._$AP=Wn),i._$AQ??(i._$AQ=qn))},kr=class extends pt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),ca(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Yt(this,t),Sr(this))}setValue(t){if(pa(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var fi=()=>new gi,gi=class{},hi=new WeakMap,Tr=Ut(class extends kr{render(i){return u}update(i,[t]){let e=t!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=t,this.ht=i.options?.host,this.rt(this.ct=i.element)),u}rt(i){if(this.isConnected||(i=void 0),typeof this.Y=="function"){let t=this.ht??globalThis,e=hi.get(t);e===void 0&&(e=new WeakMap,hi.set(t,e)),e.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),e.set(this.Y,i),i!==void 0&&this.Y.call(this.ht,i)}else this.Y.value=i}get lt(){return typeof this.Y=="function"?hi.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var ma=h`
1774
+ `}};ce.styles=[w,Ja],s([p({type:String})],ce.prototype,"buttonText",1),s([b({context:W,subscribe:!0}),p({type:Object})],ce.prototype,"headlessInstance",2),s([b({context:Le,subscribe:!0}),p({type:Object})],ce.prototype,"clientOptions",2),s([b({context:j,subscribe:!0}),p()],ce.prototype,"sdkState",2),s([p({type:String})],ce.prototype,"variant",2),s([p({type:Boolean})],ce.prototype,"disabled",2),ce=s([y("primer-card-form-submit"),$()],ce);var{I:rE}=ua;var Qa=i=>i.strings===void 0;var er=(i,e)=>{let t=i._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),er(r,e);return!0},qr=i=>{let e,t;do{if((e=i._$AM)===void 0)break;t=e._$AN,t.delete(i),i=e}while(t?.size===0)},en=i=>{for(let e;e=i._$AM;i=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(i))break;t.add(i),cl(e)}};function dl(i){this._$AN!==void 0?(qr(this),this._$AM=i,en(this)):this._$AM=i}function pl(i,e=!1,t=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(r))for(let n=t;n<r.length;n++)er(r[n],!1),qr(r[n]);else r!=null&&(er(r,!1),qr(r));else er(this,i)}var cl=i=>{i.type==Fr.CHILD&&(i._$AP??(i._$AP=pl),i._$AQ??(i._$AQ=dl))},Wr=class extends Et{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),en(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(er(this,e),qr(this))}setValue(e){if(Qa(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var qi=()=>new Gi,Gi=class{},ji=new WeakMap,Zr=Jt(class extends Wr{render(i){return h}update(i,[e]){let t=e!==this.Y;return t&&this.Y!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.Y=e,this.ht=i.options?.host,this.rt(this.ct=i.element)),h}rt(i){if(this.isConnected||(i=void 0),typeof this.Y=="function"){let e=this.ht??globalThis,t=ji.get(e);t===void 0&&(t=new WeakMap,ji.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,i),i!==void 0&&this.Y.call(this.ht,i)}else this.Y.value=i}get lt(){return typeof this.Y=="function"?ji.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var tn=f`
1728
1775
  :host {
1729
1776
  display: flex;
1730
1777
  align-items: center;
@@ -1844,79 +1891,120 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1844
1891
  width: var(--primer-size-small);
1845
1892
  height: var(--primer-size-small);
1846
1893
  }
1847
- `;var ce=class extends g{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=fi();this.dropdownRef=fi();this.networkOptionRefs=[];this.handleClickOutside=e=>{this.isDropdownOpen&&(this.contains(e.target)||(this.isDropdownOpen=!1,this.isKeyboardNavigation=!1))};this.handleMouseMove=()=>{this.isKeyboardNavigation&&(this.isKeyboardNavigation=!1)};this.handleKeyDown=e=>{if(!(!(this.getSelectableNetworks().length>1)||!(this.contains(e.target)||this===e.target||this.isDropdownOpen&&e.target===document.body)))switch(this.isKeyboardNavigation=!0,e.key){case"ArrowDown":e.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex+1)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"ArrowUp":e.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex-1+this.getSelectableNetworks().length)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Enter":case" ":this.isDropdownOpen&&this.focusedNetworkIndex>=0?(e.preventDefault(),this.selectNetwork(e,this.getSelectableNetworks()[this.focusedNetworkIndex])):!this.isDropdownOpen&&this.buttonRef.value===document.activeElement&&(e.preventDefault(),this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Escape":this.isDropdownOpen&&(e.preventDefault(),this.isDropdownOpen=!1,this.buttonRef.value?.focus());break;case"Tab":this.isDropdownOpen&&(this.isDropdownOpen=!1);break}};this.handleDocumentKeyDown=e=>{this.isDropdownOpen&&this.handleKeyDown(e)}}toggleDropdown(e){this.isKeyboardNavigation=!1,e.stopPropagation(),this.getSelectableNetworks().length>1&&(this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}getNetworkIconUrl(e){return this.headlessUtils?.getCardNetworkAsset(e.network)?.cardUrl}getSelectableNetworks(){return this.cardNetworks?.selectableCardNetworks||[]}getDetectedNetwork(){return this.selectedCardNetwork??(this.cardNetworks?.detectedCardNetwork||null)}getSelectedNetworkIndex(){let e=this.getDetectedNetwork();if(!e)return 0;let r=this.getSelectableNetworks().findIndex(o=>o.network===e.network);return r>=0?r:0}selectNetwork(e,r){e.stopPropagation(),this.selectedCardNetwork=r,this.isDropdownOpen=!1,this.buttonRef.value?.focus(),this.cardNetworks&&this.dispatchEvent(new CustomEvent("network-selected",{detail:{network:r.network},bubbles:!0,composed:!0}))}focusNetworkOption(){requestAnimationFrame(()=>{this.networkOptionRefs[this.focusedNetworkIndex]&&this.networkOptionRefs[this.focusedNetworkIndex].focus()})}setNetworkOptionRef(e,r){this.networkOptionRefs[r]=e}connectedCallback(){super.connectedCallback(),setTimeout(()=>{document.addEventListener("click",this.handleClickOutside),document.addEventListener("mousemove",this.handleMouseMove),this.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleDocumentKeyDown)},0)}disconnectedCallback(){document.removeEventListener("click",this.handleClickOutside),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousemove",this.handleMouseMove),this.removeEventListener("keydown",this.handleKeyDown),super.disconnectedCallback()}render(){if(this.cardNetworks?.isLoading)return p`<primer-spinner size="small" compact></primer-spinner>`;let e=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&e.length===0)return p`<primer-icon name="payment-card"></primer-icon>`;let r=this.getDetectedNetwork()||(e.length>0?e[0]:null);if(!r)return p`<primer-icon name="payment-card" size="sm"></primer-icon>`;let o=e.length>1;return p`
1894
+ `;var me=class extends v{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=qi();this.dropdownRef=qi();this.networkOptionRefs=[];this.handleClickOutside=t=>{this.isDropdownOpen&&(this.contains(t.target)||(this.isDropdownOpen=!1,this.isKeyboardNavigation=!1))};this.handleMouseMove=()=>{this.isKeyboardNavigation&&(this.isKeyboardNavigation=!1)};this.handleKeyDown=t=>{if(!(!(this.getSelectableNetworks().length>1)||!(this.contains(t.target)||this===t.target||this.isDropdownOpen&&t.target===document.body)))switch(this.isKeyboardNavigation=!0,t.key){case"ArrowDown":t.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex+1)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"ArrowUp":t.preventDefault(),this.isDropdownOpen?(this.focusedNetworkIndex=(this.focusedNetworkIndex-1+this.getSelectableNetworks().length)%this.getSelectableNetworks().length,this.focusNetworkOption()):(this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Enter":case" ":this.isDropdownOpen&&this.focusedNetworkIndex>=0?(t.preventDefault(),this.selectNetwork(t,this.getSelectableNetworks()[this.focusedNetworkIndex])):!this.isDropdownOpen&&this.buttonRef.value===document.activeElement&&(t.preventDefault(),this.isDropdownOpen=!0,this.focusedNetworkIndex=this.getSelectedNetworkIndex());break;case"Escape":this.isDropdownOpen&&(t.preventDefault(),this.isDropdownOpen=!1,this.buttonRef.value?.focus());break;case"Tab":this.isDropdownOpen&&(this.isDropdownOpen=!1);break}};this.handleDocumentKeyDown=t=>{this.isDropdownOpen&&this.handleKeyDown(t)}}toggleDropdown(t){this.isKeyboardNavigation=!1,t.stopPropagation(),this.getSelectableNetworks().length>1&&(this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}getNetworkIconUrl(t){return this.headlessUtils?.getCardNetworkAsset(t.network)?.cardUrl}getSelectableNetworks(){return this.cardNetworks?.selectableCardNetworks||[]}getDetectedNetwork(){return this.selectedCardNetwork??(this.cardNetworks?.detectedCardNetwork||null)}getSelectedNetworkIndex(){let t=this.getDetectedNetwork();if(!t)return 0;let r=this.getSelectableNetworks().findIndex(o=>o.network===t.network);return r>=0?r:0}selectNetwork(t,r){t.stopPropagation(),this.selectedCardNetwork=r,this.isDropdownOpen=!1,this.buttonRef.value?.focus(),this.cardNetworks&&this.dispatchEvent(new CustomEvent("network-selected",{detail:{network:r.network},bubbles:!0,composed:!0}))}focusNetworkOption(){requestAnimationFrame(()=>{this.networkOptionRefs[this.focusedNetworkIndex]&&this.networkOptionRefs[this.focusedNetworkIndex].focus()})}setNetworkOptionRef(t,r){this.networkOptionRefs[r]=t}connectedCallback(){super.connectedCallback(),setTimeout(()=>{document.addEventListener("click",this.handleClickOutside),document.addEventListener("mousemove",this.handleMouseMove),this.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keydown",this.handleDocumentKeyDown)},0)}disconnectedCallback(){document.removeEventListener("click",this.handleClickOutside),document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousemove",this.handleMouseMove),this.removeEventListener("keydown",this.handleKeyDown),super.disconnectedCallback()}render(){if(this.cardNetworks?.isLoading)return c`<primer-spinner size="small" compact></primer-spinner>`;let t=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&t.length===0)return c`<primer-icon name="payment-card"></primer-icon>`;let r=this.getDetectedNetwork()||(t.length>0?t[0]:null);if(!r)return c`<primer-icon name="payment-card" size="sm"></primer-icon>`;let o=t.length>1;return c`
1848
1895
  <button
1849
- ${Tr(this.buttonRef)}
1896
+ ${Zr(this.buttonRef)}
1850
1897
  class="network-selector"
1851
1898
  @click=${this.toggleDropdown}
1852
- @keydown=${s=>{(s.key===" "||s.key==="Enter")&&o&&(s.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
1899
+ @keydown=${n=>{(n.key===" "||n.key==="Enter")&&o&&(n.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
1853
1900
  aria-label=${o?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`}
1854
- aria-expanded=${o?this.isDropdownOpen:u}
1855
- aria-haspopup=${o?"true":u}
1856
- aria-controls=${o?"network-dropdown":u}
1901
+ aria-expanded=${o?this.isDropdownOpen:h}
1902
+ aria-haspopup=${o?"true":h}
1903
+ aria-controls=${o?"network-dropdown":h}
1857
1904
  >
1858
1905
  <img
1859
1906
  class="network-icon"
1860
1907
  src=${this.getNetworkIconUrl(r)}
1861
1908
  alt=${r.displayName}
1862
1909
  />
1863
- ${V(o,()=>p`
1910
+ ${U(o,()=>c`
1864
1911
  <primer-icon
1865
1912
  class="caret ${this.isDropdownOpen?"open":""}"
1866
1913
  name="chevron-down"
1867
1914
  ></primer-icon>
1868
- `,()=>u)}
1915
+ `,()=>h)}
1869
1916
  </button>
1870
1917
 
1871
- ${V(this.isDropdownOpen,()=>p`
1918
+ ${U(this.isDropdownOpen,()=>c`
1872
1919
  <div
1873
- ${Tr(this.dropdownRef)}
1920
+ ${Zr(this.dropdownRef)}
1874
1921
  id="network-dropdown"
1875
1922
  class="dropdown open"
1876
1923
  role="listbox"
1877
1924
  aria-label="Select card network"
1878
1925
  >
1879
- ${e.map((s,m)=>p`
1926
+ ${t.map((n,l)=>c`
1880
1927
  <div
1881
- ${Tr(C=>this.setNetworkOptionRef(C,m))}
1882
- class="network-option ${this.isKeyboardNavigation&&m===this.focusedNetworkIndex?"focused":""}"
1883
- @click=${C=>this.selectNetwork(C,s)}
1884
- @keydown=${C=>{(C.key==="Enter"||C.key===" ")&&this.selectNetwork(C,s)}}
1928
+ ${Zr(g=>this.setNetworkOptionRef(g,l))}
1929
+ class="network-option ${this.isKeyboardNavigation&&l===this.focusedNetworkIndex?"focused":""}"
1930
+ @click=${g=>this.selectNetwork(g,n)}
1931
+ @keydown=${g=>{(g.key==="Enter"||g.key===" ")&&this.selectNetwork(g,n)}}
1885
1932
  role="option"
1886
- aria-selected=${s.network===r.network}
1887
- tabindex="${m===this.focusedNetworkIndex?"0":"-1"}"
1933
+ aria-selected=${n.network===r.network}
1934
+ tabindex="${l===this.focusedNetworkIndex?"0":"-1"}"
1888
1935
  >
1889
1936
  <img
1890
1937
  class="network-option-icon"
1891
- src=${this.getNetworkIconUrl(s)}
1892
- alt=${s.displayName}
1938
+ src=${this.getNetworkIconUrl(n)}
1939
+ alt=${n.displayName}
1893
1940
  />
1894
- <span class="network-name">${s.displayName}</span>
1895
- ${V(s.network===r.network,()=>p`
1941
+ <span class="network-name">${n.displayName}</span>
1942
+ ${U(n.network===r.network,()=>c`
1896
1943
  <primer-icon
1897
1944
  class="checkmark"
1898
1945
  name="checkmark"
1899
1946
  ></primer-icon>
1900
- `,()=>u)}
1947
+ `,()=>h)}
1901
1948
  </div>
1902
1949
  `)}
1903
1950
  </div>
1904
- `,()=>u)}
1905
- `}};ce.styles=[k,ma],n([y({context:Zt,subscribe:!0})],ce.prototype,"cardNetworks",2),n([y({context:G,subscribe:!0})],ce.prototype,"headlessUtils",2),n([T()],ce.prototype,"selectedCardNetwork",2),n([T()],ce.prototype,"isDropdownOpen",2),n([T()],ce.prototype,"focusedNetworkIndex",2),n([T()],ce.prototype,"isKeyboardNavigation",2),ce=n([f("primer-card-network-selector")],ce);var Xn=zr(wr(),1),ft=zr(wr(),1);function yi(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function Jn(i){return i?i===i.toUpperCase()?yi(i):i:""}function ua(i,t){return[i,t].filter(Boolean).join(" ")}function Qn(i,t){return!i||!t?"":`Expires ${i}/${t.slice(-2)}`}function ha(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function es(i){let t=i.paymentInstrumentData,e=Jn(t.network),r=t.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${e} ${ha(r)}`:e)||" Card"}`,s=Qn(t.expirationMonth,t.expirationYear);return{description:o,secondaryDescription:s}}function ts(i){let t=i.paymentInstrumentData,e=t.externalPayerInfo?.email||"",r=t.externalPayerInfo?.firstName||"",o=t.externalPayerInfo?.lastName||"",s=i.userDescription||e||"PayPal Account",m=ua(r,o);return{description:s,secondaryDescription:m}}function rs(i){let t=i.paymentInstrumentData,e=t.sessionData?.billingAddress?.email||"",r=t.sessionData?.billingAddress?.firstName||"",o=t.sessionData?.billingAddress?.lastName||"",s=i.userDescription||(e?`Klarna - ${e}`:"Klarna Account"),m=ua(r,o);return{description:s,secondaryDescription:m}}function is(i){let t=i.paymentInstrumentData,e=t.accountNumberLastFourDigits||"",r=t.bankName||"",o=t.accountType||"",s=i.userDescription;s||(r&&e?s=`${r} ${ha(e)}`:r?s=r:s="Bank Account");let m=o?`${yi(o)} Account`:"";return{description:s,secondaryDescription:m}}function os(i){let t=i.paymentInstrumentType,e=yi(t.replace(/_/g," "));return{description:i.userDescription||e}}var as={[ft.PaymentInstrumentType.CARD]:es,[ft.PaymentInstrumentType.PAYPAL_VAULTED]:ts,[ft.PaymentInstrumentType.KLARNA_CUSTOMER_TOKEN]:rs,[ft.PaymentInstrumentType.AUTOMATED_CLEARING_HOUSE]:is};function Pr(i){try{let t=as[i.paymentInstrumentType];return t?t(i):os(i)}catch(t){return P.error("FormatUtils",`Error formatting payment method ${i.id}:`,t),{description:i.userDescription||i.id||"Payment Method"}}}var ga=h`
1951
+ `,()=>h)}
1952
+ `}};me.styles=[w,tn],s([b({context:vr,subscribe:!0})],me.prototype,"cardNetworks",2),s([b({context:W,subscribe:!0})],me.prototype,"headlessUtils",2),s([I()],me.prototype,"selectedCardNetwork",2),s([I()],me.prototype,"isDropdownOpen",2),s([I()],me.prototype,"focusedNetworkIndex",2),s([I()],me.prototype,"isKeyboardNavigation",2),me=s([y("primer-card-network-selector")],me);var ml=Ro(Zi(),1),Ke=Ro(Zi(),1);function Xi(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function ul(i){return i?i===i.toUpperCase()?Xi(i):i:""}function rn(i,e){return[i,e].filter(Boolean).join(" ")}function hl(i,e){return!i||!e?"":`Expires ${i}/${e.slice(-2)}`}function on(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function gl(i){let e=i.paymentInstrumentData,t=ul(e.network),r=e.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${t} ${on(r)}`:t)||" Card"}`,n=hl(e.expirationMonth,e.expirationYear);return{description:o,secondaryDescription:n}}function fl(i){let e=i.paymentInstrumentData,t=e.externalPayerInfo?.email||"",r=e.externalPayerInfo?.firstName||"",o=e.externalPayerInfo?.lastName||"",n=i.userDescription||t||"PayPal Account",l=rn(r,o);return{description:n,secondaryDescription:l}}function vl(i){let e=i.paymentInstrumentData,t=e.sessionData?.billingAddress?.email||"",r=e.sessionData?.billingAddress?.firstName||"",o=e.sessionData?.billingAddress?.lastName||"",n=i.userDescription||(t?`Klarna - ${t}`:"Klarna Account"),l=rn(r,o);return{description:n,secondaryDescription:l}}function yl(i){let e=i.paymentInstrumentData,t=e.accountNumberLastFourDigits||"",r=e.bankName||"",o=e.accountType||"",n=i.userDescription;n||(r&&t?n=`${r} ${on(t)}`:r?n=r:n="Bank Account");let l=o?`${Xi(o)} Account`:"";return{description:n,secondaryDescription:l}}function bl(i){let e=i.paymentInstrumentType,t=Xi(e.replace(/_/g," "));return{description:i.userDescription||t}}var El={[Ke.PaymentInstrumentType.CARD]:gl,[Ke.PaymentInstrumentType.PAYPAL_VAULTED]:fl,[Ke.PaymentInstrumentType.KLARNA_CUSTOMER_TOKEN]:vl,[Ke.PaymentInstrumentType.AUTOMATED_CLEARING_HOUSE]:yl};function Xr(i){try{let e=El[i.paymentInstrumentType];return e?e(i):bl(i)}catch(e){return R.error("FormatUtils",`Error formatting payment method ${i.id}:`,e),{description:i.userDescription||i.id||"Payment Method"}}}var an=f`
1906
1953
  :host {
1907
1954
  display: block;
1908
1955
  width: 100%;
1956
+ position: relative;
1909
1957
  }
1910
1958
 
1911
1959
  .vault-manager {
1912
1960
  display: flex;
1913
1961
  flex-direction: column;
1962
+ position: relative;
1914
1963
  }
1915
1964
 
1916
1965
  .vault-manager-content {
1917
1966
  display: flex;
1918
1967
  flex-direction: column;
1919
1968
  width: 100%;
1969
+ position: relative;
1970
+ }
1971
+
1972
+ /* Content container using CSS Grid for height animation */
1973
+ .content-container {
1974
+ display: grid;
1975
+ grid-template-rows: 1fr;
1976
+ transition: grid-template-rows var(--primer-animation-duration)
1977
+ var(--primer-animation-easing);
1978
+ width: 100%;
1979
+ position: relative;
1980
+ }
1981
+
1982
+ /* Required to make grid animation work - ensures content can expand/collapse properly */
1983
+ .content-container > * {
1984
+ min-height: 0;
1985
+ overflow: hidden;
1986
+ }
1987
+
1988
+ /* Submit button container */
1989
+ .submit-button-container {
1990
+ display: grid;
1991
+ grid-template-rows: 1fr;
1992
+ transition: grid-template-rows var(--primer-animation-duration)
1993
+ var(--primer-animation-easing);
1994
+ overflow: hidden;
1995
+ margin-top: var(--primer-space-small);
1996
+ width: 100%;
1997
+ }
1998
+
1999
+ /* Ensure the submit button has full width */
2000
+ .submit-button {
2001
+ width: 100%;
2002
+ }
2003
+
2004
+ /* Make sure pay button inside the submit component is full width */
2005
+ primer-vault-payment-submit::part(button),
2006
+ ::slotted(primer-button) {
2007
+ width: 100%;
1920
2008
  }
1921
2009
 
1922
2010
  /* Payment methods list */
@@ -1925,60 +2013,136 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1925
2013
  flex-direction: column;
1926
2014
  gap: var(--primer-space-small);
1927
2015
  width: 100%;
2016
+ position: relative;
1928
2017
  }
1929
2018
 
1930
2019
  /* Delete confirmation container */
1931
2020
  .delete-confirmation-container {
1932
2021
  width: 100%;
1933
- z-index: 1;
2022
+ position: relative;
2023
+ }
2024
+
2025
+ /* Loading overlay styles */
2026
+ .loading-overlay {
2027
+ position: absolute;
2028
+ top: 0;
2029
+ left: 0;
2030
+ width: 100%;
2031
+ height: 100%;
2032
+ display: flex;
2033
+ align-items: center;
2034
+ justify-content: center;
2035
+ background-color: rgba(255, 255, 255, 0.7);
2036
+ z-index: 10;
2037
+ border-radius: var(--primer-radius-medium);
2038
+ backdrop-filter: blur(2px);
2039
+ opacity: 0; /* Start invisible */
2040
+ }
2041
+
2042
+ /* Add styles for when updating is active */
2043
+ .is-updating {
2044
+ pointer-events: none; /* Prevent interaction when updating */
2045
+ }
2046
+
2047
+ /*
2048
+ * Component-specific styles to ensure smooth animations
2049
+ * These components need display:block to work with the grid layout
2050
+ */
2051
+ primer-vault-payment-method-item,
2052
+ primer-vault-empty-state,
2053
+ primer-vault-delete-confirmation {
2054
+ display: block;
2055
+ width: 100%;
1934
2056
  }
1935
- `;var he=class extends g{constructor(){super(...arguments);this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage=""}handleToggleEditMode(e){this.isEditMode=e.detail,this.deletePaymentMethodId=null}handleDeletePaymentMethod(e){this.deletePaymentMethodId=e.detail}handleCancelDelete(){this.deletePaymentMethodId=null}async handleConfirmDelete(){if(!this.vaultManagerContext?.deleteVaultedPaymentMethod||!this.deletePaymentMethodId){this.errorMessage=_("something_went_wrong_error",{id:"something_went_wrong_error"});return}try{this.isDeleting=!0,await this.vaultManagerContext.deleteVaultedPaymentMethod(this.deletePaymentMethodId),this.deletePaymentMethodId=null}catch(e){this.errorMessage=e instanceof Error?e.message:_("something_went_wrong_error",{id:"something_went_wrong_error"})}finally{this.isDeleting=!1}}handlePaymentError(e){let r=e.detail?.error;this.errorMessage=r instanceof Error?r.message:_("payment_processing_error",{id:"payment_processing_error"})}handleCloseError(){this.errorMessage=""}getPaymentMethodName(e){if(!this.vaultManagerContext)return"";let r=this.vaultManagerContext.vaultedPaymentMethods.find(o=>o.id===e);if(!r)return"";try{return Pr(r).description||""}catch{return""}}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return u;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return p`
2057
+
2058
+ /* Disable animations for reduced motion preference */
2059
+ @media (prefers-reduced-motion: reduce) {
2060
+ .content-container,
2061
+ .submit-button-container,
2062
+ primer-vault-payment-method-item,
2063
+ primer-vault-payment-submit,
2064
+ primer-vault-empty-state,
2065
+ primer-vault-delete-confirmation {
2066
+ transition: none;
2067
+ }
2068
+ }
2069
+ `;var ir=globalThis,Jr=ir.trustedTypes,nn=Jr?Jr.createPolicy("lit-html",{createHTML:i=>i}):void 0,Qi="$lit$",Ie=`lit$${Math.random().toFixed(9).slice(2)}$`,eo="?"+Ie,Cl=`<${eo}>`,st=document,Qr=()=>st.createComment(""),or=i=>i===null||typeof i!="object"&&typeof i!="function",to=Array.isArray,mn=i=>to(i)||typeof i?.[Symbol.iterator]=="function",Ji=`[
2070
+ \f\r]`,rr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,sn=/-->/g,ln=/>/g,at=RegExp(`>|${Ji}(?:([^\\s"'>=/]+)(${Ji}*=${Ji}*(?:[^
2071
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),dn=/'/g,pn=/"/g,un=/^(?:script|style|textarea|title)$/i,ro=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),eC=ro(1),tC=ro(2),rC=ro(3),ar=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),cn=new WeakMap,nt=st.createTreeWalker(st,129);function hn(i,e){if(!to(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return nn!==void 0?nn.createHTML(e):e}var gn=(i,e)=>{let t=i.length-1,r=[],o,n=e===2?"<svg>":e===3?"<math>":"",l=rr;for(let g=0;g<t;g++){let u=i[g],S,k,_=-1,V=0;for(;V<u.length&&(l.lastIndex=V,k=l.exec(u),k!==null);)V=l.lastIndex,l===rr?k[1]==="!--"?l=sn:k[1]!==void 0?l=ln:k[2]!==void 0?(un.test(k[2])&&(o=RegExp("</"+k[2],"g")),l=at):k[3]!==void 0&&(l=at):l===at?k[0]===">"?(l=o??rr,_=-1):k[1]===void 0?_=-2:(_=l.lastIndex-k[2].length,S=k[1],l=k[3]===void 0?at:k[3]==='"'?pn:dn):l===pn||l===dn?l=at:l===sn||l===ln?l=rr:(l=at,o=void 0);let Y=l===at&&i[g+1].startsWith("/>")?" ":"";n+=l===rr?u+Cl:_>=0?(r.push(S),u.slice(0,_)+Qi+u.slice(_)+Ie+Y):u+Ie+(_===-2?g:Y)}return[hn(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},nr=class i{constructor({strings:e,_$litType$:t},r){let o;this.parts=[];let n=0,l=0,g=e.length-1,u=this.parts,[S,k]=gn(e,t);if(this.el=i.createElement(S,r),nt.currentNode=this.el.content,t===2||t===3){let _=this.el.content.firstChild;_.replaceWith(..._.childNodes)}for(;(o=nt.nextNode())!==null&&u.length<g;){if(o.nodeType===1){if(o.hasAttributes())for(let _ of o.getAttributeNames())if(_.endsWith(Qi)){let V=k[l++],Y=o.getAttribute(_).split(Ie),he=/([.?@])?(.*)/.exec(V);u.push({type:1,index:n,name:he[2],strings:Y,ctor:he[1]==="."?ti:he[1]==="?"?ri:he[1]==="@"?ii:dt}),o.removeAttribute(_)}else _.startsWith(Ie)&&(u.push({type:6,index:n}),o.removeAttribute(_));if(un.test(o.tagName)){let _=o.textContent.split(Ie),V=_.length-1;if(V>0){o.textContent=Jr?Jr.emptyScript:"";for(let Y=0;Y<V;Y++)o.append(_[Y],Qr()),nt.nextNode(),u.push({type:2,index:++n});o.append(_[V],Qr())}}}else if(o.nodeType===8)if(o.data===eo)u.push({type:2,index:n});else{let _=-1;for(;(_=o.data.indexOf(Ie,_+1))!==-1;)u.push({type:7,index:n}),_+=Ie.length-1}n++}}static createElement(e,t){let r=st.createElement("template");return r.innerHTML=e,r}};function lt(i,e,t=i,r){if(e===ar)return e;let o=r!==void 0?t._$Co?.[r]:t._$Cl,n=or(e)?void 0:e._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),n===void 0?o=void 0:(o=new n(i),o._$AT(i,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=o:t._$Cl=o),o!==void 0&&(e=lt(i,o._$AS(i,e.values),o,r)),e}var ei=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,o=(e?.creationScope??st).importNode(t,!0);nt.currentNode=o;let n=nt.nextNode(),l=0,g=0,u=r[0];for(;u!==void 0;){if(l===u.index){let S;u.type===2?S=new sr(n,n.nextSibling,this,e):u.type===1?S=new u.ctor(n,u.name,u.strings,this,e):u.type===6&&(S=new oi(n,this,e)),this._$AV.push(S),u=r[++g]}l!==u?.index&&(n=nt.nextNode(),l++)}return nt.currentNode=st,o}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},sr=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,o){this.type=2,this._$AH=K,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=lt(this,e,t),or(e)?e===K||e==null||e===""?(this._$AH!==K&&this._$AR(),this._$AH=K):e!==this._$AH&&e!==ar&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):mn(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==K&&or(this._$AH)?this._$AA.nextSibling.data=e:this.T(st.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=nr.createElement(hn(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(t);else{let n=new ei(o,this),l=n.u(this.options);n.p(t),this.T(l),this._$AH=n}}_$AC(e){let t=cn.get(e.strings);return t===void 0&&cn.set(e.strings,t=new nr(e)),t}k(e){to(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,o=0;for(let n of e)o===t.length?t.push(r=new i(this.O(Qr()),this.O(Qr()),this,this.options)):r=t[o],r._$AI(n),o++;o<t.length&&(this._$AR(r&&r._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},dt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,o,n){this.type=1,this._$AH=K,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=K}_$AI(e,t=this,r,o){let n=this.strings,l=!1;if(n===void 0)e=lt(this,e,t,0),l=!or(e)||e!==this._$AH&&e!==ar,l&&(this._$AH=e);else{let g=e,u,S;for(e=n[0],u=0;u<n.length-1;u++)S=lt(this,g[r+u],t,u),S===ar&&(S=this._$AH[u]),l||(l=!or(S)||S!==this._$AH[u]),S===K?e=K:e!==K&&(e+=(S??"")+n[u+1]),this._$AH[u]=S}l&&!o&&this.j(e)}j(e){e===K?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ti=class extends dt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===K?void 0:e}},ri=class extends dt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==K)}},ii=class extends dt{constructor(e,t,r,o,n){super(e,t,r,o,n),this.type=5}_$AI(e,t=this){if((e=lt(this,e,t,0)??K)===ar)return;let r=this._$AH,o=e===K&&r!==K||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,n=e!==K&&(r===K||o);o&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},oi=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){lt(this,e)}},fn={M:Qi,P:Ie,A:eo,C:1,L:gn,R:ei,D:mn,V:lt,I:sr,H:dt,N:ri,U:ii,B:ti,F:oi},xl=ir.litHtmlPolyfillSupport;xl?.(nr,sr),(ir.litHtmlVersions??(ir.litHtmlVersions=[])).push("3.3.0");var Mt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},lr=i=>(...e)=>({_$litDirective$:i,values:e}),ai=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var{I:pC}=fn;var vn=i=>i.strings===void 0;var dr=(i,e)=>{let t=i._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),dr(r,e);return!0},ni=i=>{let e,t;do{if((e=i._$AM)===void 0)break;t=e._$AN,t.delete(i),i=e}while(t?.size===0)},yn=i=>{for(let e;e=i._$AM;i=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(i))break;t.add(i),Sl(e)}};function Al(i){this._$AN!==void 0?(ni(this),this._$AM=i,yn(this)):this._$AM=i}function _l(i,e=!1,t=0){let r=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(r))for(let n=t;n<r.length;n++)dr(r[n],!1),ni(r[n]);else r!=null&&(dr(r,!1),ni(r));else dr(this,i)}var Sl=i=>{i.type==Mt.CHILD&&(i._$AP??(i._$AP=_l),i._$AQ??(i._$AQ=Al))},Tt=class extends ai{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),yn(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(dr(this,e),ni(this))}setValue(e){if(vn(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var si=new WeakMap,Pt=class{constructor(e,t){this.startPaused=!1,this.disabled=!1,this.clients=new Set,this.pendingComplete=!1,this.host=e,this.defaultOptions=t.defaultOptions||{},this.startPaused=!!t.startPaused,this.disabled=!!t.disabled,this.onComplete=t.onComplete,si.set(this.host,this)}async add(e){this.clients.add(e),this.startPaused&&e.webAnimation?.pause(),this.pendingComplete=!0,await e.finished,this.pendingComplete&&!this.isAnimating&&(this.pendingComplete=!1,this.onComplete?.())}remove(e){this.clients.delete(e)}pause(){this.clients.forEach(e=>e.webAnimation?.pause())}play(){this.clients.forEach(e=>e.webAnimation?.play())}cancel(){this.clients.forEach(e=>e.webAnimation?.cancel()),this.clients.clear()}finish(){this.clients.forEach(e=>e.webAnimation?.finish()),this.clients.clear()}togglePlay(){this.isPlaying?this.pause():this.play()}get isAnimating(){return this.clients.size>0}get isPlaying(){return Array.from(this.clients).some(e=>e.webAnimation?.playState==="running")}async finished(){await Promise.all(Array.from(this.clients).map(e=>e.finished))}};var bn=0,io=new Map,En=new WeakSet,oo=()=>new Promise(i=>requestAnimationFrame(i));var Cn=(i,e)=>{let t=i-e;return t===0?void 0:t},xn=(i,e)=>{let t=i/e;return t===1?void 0:t},li={left:(i,e)=>{let t=Cn(i,e);return{value:t,transform:t==null||isNaN(t)?void 0:`translateX(${t}px)`}},top:(i,e)=>{let t=Cn(i,e);return{value:t,transform:t==null||isNaN(t)?void 0:`translateY(${t}px)`}},width:(i,e)=>{let t;e===0&&(e=1,t={width:"1px"});let r=xn(i,e);return{value:r,overrideFrom:t,transform:r==null||isNaN(r)?void 0:`scaleX(${r})`}},height:(i,e)=>{let t;e===0&&(e=1,t={height:"1px"});let r=xn(i,e);return{value:r,overrideFrom:t,transform:r==null||isNaN(r)?void 0:`scaleY(${r})`}}},_n={duration:333,easing:"ease-in-out"},Sn=["left","top","width","height","opacity","color","background"],An=new WeakMap,di=class extends Tt{constructor(e){if(super(e),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,e.type===Mt.CHILD)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){this.resolveFinished?.(),this.finished=new Promise(e=>{this.l=e})}async resolveFinished(){this.l?.(),this.l=void 0}render(e){return K}getController(){return si.get(this.u)}isDisabled(){return this.options.disabled||this.getController()?.disabled}update(e,[t]){let r=this.u===void 0;return r&&(this.u=e.options?.host,this.u.addController(this),this.u.updateComplete.then(o=>this.t=!0),this.element=e.element,An.set(this.element,this)),this.optionsOrCallback=t,(r||typeof t!="function")&&this.p(t),this.render(t)}p(e){e=e??{};let t=this.getController();t!==void 0&&((e={...t.defaultOptions,...e}).keyframeOptions={...t.defaultOptions.keyframeOptions,...e.keyframeOptions}),e.properties??(e.properties=Sn),this.options=e}m(){let e={},t=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(o=>{let n=t[o]??(li[o]?void 0:r[o]),l=Number(n);e[o]=isNaN(l)?n+"":l}),e}v(){let e,t=!0;return this.options.guard&&(e=this.options.guard(),t=((r,o)=>{if(Array.isArray(r)){if(Array.isArray(o)&&o.length===r.length&&r.every((n,l)=>n===o[l]))return!1}else if(o===r)return!1;return!0})(e,this._)),this.h=this.t&&!this.isDisabled()&&!this.isAnimating()&&t&&this.element.isConnected,this.h&&(this._=Array.isArray(e)?Array.from(e):e),this.h}hostUpdate(){typeof this.optionsOrCallback=="function"&&this.p(this.optionsOrCallback()),this.v()&&(this.A=this.m(),this.i=this.i??this.element.parentNode,this.o=this.element.nextSibling)}async hostUpdated(){if(!this.h||!this.element.isConnected||this.options.skipInitial&&!this.isHostRendered)return;let e;this.prepare(),await oo;let t=this.O(),r=this.j(this.options.keyframeOptions,t),o=this.m();if(this.A!==void 0){let{from:n,to:l}=this.N(this.A,o,t);this.log("measured",[this.A,o,n,l]),e=this.calculateKeyframes(n,l)}else{let n=io.get(this.options.inId);if(n){io.delete(this.options.inId);let{from:l,to:g}=this.N(n,o,t);e=this.calculateKeyframes(l,g),e=this.options.in?[{...this.options.in[0],...e[0]},...this.options.in.slice(1),e[1]]:e,bn++,e.forEach(u=>u.zIndex=bn)}else this.options.in&&(e=[...this.options.in,{}])}this.animate(e,r)}resetStyles(){this.P!==void 0&&(this.element.setAttribute("style",this.P??""),this.P=void 0)}commitStyles(){this.P=this.element.getAttribute("style"),this.webAnimation?.commitStyles(),this.webAnimation?.cancel()}reconnected(){}async disconnected(){if(!this.h||(this.options.id!==void 0&&io.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await oo(),this.i?.isConnected){let t=this.o&&this.o.parentNode===this.i?this.o:null;if(this.i.insertBefore(this.element,t),this.options.stabilizeOut){let r=this.m();this.log("stabilizing out");let o=this.A.left-r.left,n=this.A.top-r.top;getComputedStyle(this.element).position!=="static"||o===0&&n===0||(this.element.style.position="relative"),o!==0&&(this.element.style.left=o+"px"),n!==0&&(this.element.style.top=n+"px")}}let e=this.j(this.options.keyframeOptions);await this.animate(this.options.out,e),this.element.remove()}prepare(){this.createFinished()}start(){this.options.onStart?.(this)}didFinish(e){e&&this.options.onComplete?.(this),this.A=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}O(){let e=[];for(let t=this.element.parentNode;t;t=t?.parentNode){let r=An.get(t);r&&!r.isDisabled()&&r&&e.push(r)}return e}get isHostRendered(){let e=En.has(this.u);return e||this.u.updateComplete.then(()=>{En.add(this.u)}),e}j(e,t=this.O()){let r={..._n};return t.forEach(o=>Object.assign(r,o.options.keyframeOptions)),Object.assign(r,e),r}N(e,t,r){e={...e},t={...t};let o=r.map(g=>g.animatingProperties).filter(g=>g!==void 0),n=1,l=1;return o.length>0&&(o.forEach(g=>{g.width&&(n/=g.width),g.height&&(l/=g.height)}),e.left!==void 0&&t.left!==void 0&&(e.left=n*e.left,t.left=n*t.left),e.top!==void 0&&t.top!==void 0&&(e.top=l*e.top,t.top=l*t.top)),{from:e,to:t}}calculateKeyframes(e,t,r=!1){let o={},n={},l=!1,g={};for(let u in t){let S=e[u],k=t[u];if(u in li){let _=li[u];if(S===void 0||k===void 0)continue;let V=_(S,k);V.transform!==void 0&&(g[u]=V.value,l=!0,o.transform=`${o.transform??""} ${V.transform}`,V.overrideFrom!==void 0&&Object.assign(o,V.overrideFrom))}else S!==k&&S!==void 0&&k!==void 0&&(l=!0,o[u]=S,n[u]=k)}return o.transformOrigin=n.transformOrigin=r?"center center":"top left",this.animatingProperties=g,l?[o,n]:void 0}async animate(e,t=this.options.keyframeOptions){this.start(),this.frames=e;let r=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=e=this.options.onFrames(this),this.log("modified frames",e)),e!==void 0)){this.log("animate",[e,t]),r=!0,this.webAnimation=this.element.animate(e,t);let o=this.getController();o?.add(this);try{await this.webAnimation.finished}catch{}o?.remove(this)}return this.didFinish(r),r}isAnimating(){return this.webAnimation?.playState==="running"||this.webAnimation?.pending}log(e,t){this.shouldLog&&!this.isDisabled()&&console.log(e,this.options.id,t)}},je=lr(di);var Ml=["top","right","bottom","left"],pi=class extends Tt{constructor(e){if(super(e),e.type!==Mt.ELEMENT)throw Error("The `position` directive must be used in attribute position.")}render(e,t){return K}update(e,[t,r]){return this.u===void 0&&(this.u=e.options?.host,this.u.addController(this)),this.S=e.element,this.C=t,this.F=r??["left","top","width","height"],this.render(t,r)}hostUpdated(){this.$()}$(){let e=typeof this.C=="function"?this.C():this.C?.value,t=e.offsetParent;if(e===void 0||!t)return;let r=e.getBoundingClientRect(),o=t.getBoundingClientRect();this.F?.forEach(n=>{let l=Ml.includes(n)?r[n]-o[n]:r[n];this.S.style[n]=l+"px"})}},Tl=lr(pi);var ue=class extends v{constructor(){super();this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage="";this.animationDuration=300;new Pt(this,{defaultOptions:{keyframeOptions:{duration:Number(getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-duration").trim().replace("ms","")),easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim()}}})}getAnimationConfig(){return{keyframeOptions:{duration:this.animationDuration,easing:getComputedStyle(document.documentElement).getPropertyValue("--primer-animation-easing").trim(),fill:"both"}}}handleToggleEditMode(t){this.isEditMode=t.detail,this.deletePaymentMethodId=null}handleDeletePaymentMethod(t){this.deletePaymentMethodId=t.detail}handleCancelDelete(){this.deletePaymentMethodId=null}async handleConfirmDelete(){if(!this.vaultManagerContext?.deleteVaultedPaymentMethod||!this.deletePaymentMethodId){this.errorMessage=A("something_went_wrong_error",{id:"something_went_wrong_error"});return}try{this.isDeleting=!0,await this.vaultManagerContext.deleteVaultedPaymentMethod(this.deletePaymentMethodId),this.deletePaymentMethodId=null}catch(t){this.errorMessage=t instanceof Error?t.message:A("something_went_wrong_error",{id:"something_went_wrong_error"})}finally{this.isDeleting=!1}}handlePaymentError(t){let r=t.detail?.error;this.errorMessage=r instanceof Error?r.message:A("payment_processing_error",{id:"payment_processing_error"})}handleCloseError(){this.errorMessage=""}getPaymentMethodName(t){if(!this.vaultManagerContext)return"";let r=this.vaultManagerContext.vaultedPaymentMethods.find(o=>o.id===t);if(!r)return"";try{return Xr(r).description||""}catch{return""}}renderLoadingOverlay(){return c`
2072
+ <div
2073
+ class="loading-overlay"
2074
+ ${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2075
+ >
2076
+ <primer-spinner
2077
+ size="medium"
2078
+ color="var(--primer-color-loader)"
2079
+ ></primer-spinner>
2080
+ </div>
2081
+ `}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return h;let t=this.getPaymentMethodName(this.deletePaymentMethodId);return c`
1936
2082
  <div class="delete-confirmation-container">
1937
2083
  <primer-vault-delete-confirmation
1938
2084
  .isDeleting=${this.isDeleting}
1939
2085
  .paymentMethodId=${this.deletePaymentMethodId}
1940
- .paymentMethodName=${e}
2086
+ .paymentMethodName=${t}
1941
2087
  @confirm-delete=${this.handleConfirmDelete}
1942
2088
  @cancel-delete=${this.handleCancelDelete}
2089
+ ${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1943
2090
  ></primer-vault-delete-confirmation>
1944
2091
  </div>
1945
- `}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?u:p`
2092
+ `}renderPaymentMethodItem(t){return this.deletePaymentMethodId===t.id?h:c`
1946
2093
  <primer-vault-payment-method-item
1947
- .paymentMethod=${e}
2094
+ .paymentMethod=${t}
1948
2095
  .isEditMode=${this.isEditMode}
1949
2096
  @delete-payment-method=${this.handleDeletePaymentMethod}
2097
+ ${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1950
2098
  ></primer-vault-payment-method-item>
1951
- `}render(){if(!this.vaultManagerContext?.enabled)return u;let e=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=!this.isEditMode&&e&&!r&&!this.deletePaymentMethodId;return p`
1952
- <div class="vault-manager">
2099
+ `}renderPaymentMethodList(){let t=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&t.length>0&&!this.deletePaymentMethodId;return c`
2100
+ <div class="payment-methods-list">
2101
+ ${t.map(o=>this.renderPaymentMethodItem(o))}
2102
+ ${U(r,()=>c`
2103
+ <div class="submit-button-container">
2104
+ <primer-vault-payment-submit
2105
+ class="submit-button"
2106
+ @primer-vault-payment-error=${this.handlePaymentError}
2107
+ ${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2108
+ ></primer-vault-payment-submit>
2109
+ </div>
2110
+ `,()=>h)}
2111
+ </div>
2112
+ `}render(){if(!this.vaultManagerContext?.enabled)return h;let t=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=this.vaultManagerContext.isUpdating;return c`
2113
+ <div class="vault-manager ${o?"is-updating":""}">
1953
2114
  <primer-vault-manager-header
1954
2115
  .isEditMode=${this.isEditMode}
1955
- .hasPaymentMethods=${e}
2116
+ .hasPaymentMethods=${t}
1956
2117
  @toggle-edit-mode=${this.handleToggleEditMode}
1957
2118
  ></primer-vault-manager-header>
1958
2119
 
1959
- ${V(this.errorMessage,()=>p`
2120
+ ${U(this.errorMessage,()=>c`
1960
2121
  <primer-vault-error-message
1961
2122
  .errorMessage=${this.errorMessage}
1962
2123
  @close-error=${this.handleCloseError}
2124
+ ${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1963
2125
  ></primer-vault-error-message>
1964
- `,()=>u)}
2126
+ `,()=>h)}
1965
2127
 
1966
2128
  <div class="vault-manager-content">
1967
- ${V(!r&&!e,()=>p`<primer-vault-empty-state></primer-vault-empty-state>`,()=>u)}
1968
- ${V(!r&&e&&this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>u)}
1969
- ${V(!r&&e&&!this.deletePaymentMethodId,()=>p`
1970
- <div class="payment-methods-list">
1971
- ${this.vaultManagerContext?.vaultedPaymentMethods.map(s=>this.renderPaymentMethodItem(s))}
1972
- ${V(o,()=>p`
1973
- <primer-vault-payment-submit
1974
- @primer-vault-payment-error=${this.handlePaymentError}
1975
- ></primer-vault-payment-submit>
1976
- `,()=>u)}
2129
+ ${U(!r&&!t,()=>c`
2130
+ <div class="content-container">
2131
+ <primer-vault-empty-state
2132
+ ${je({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2133
+ ></primer-vault-empty-state>
1977
2134
  </div>
1978
- `,()=>u)}
2135
+ `,()=>h)}
2136
+ ${U(!r&&t,()=>c`
2137
+ <div class="content-container">
2138
+ ${U(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
2139
+ </div>
2140
+ `,()=>h)}
1979
2141
  </div>
2142
+
2143
+ ${U(o,()=>this.renderLoadingOverlay(),()=>h)}
1980
2144
  </div>
1981
- `}};he.styles=[k,ga],n([y({context:X,subscribe:!0}),d({type:Object,attribute:!1})],he.prototype,"vaultManagerContext",2),n([T()],he.prototype,"isEditMode",2),n([T()],he.prototype,"deletePaymentMethodId",2),n([T()],he.prototype,"isDeleting",2),n([T()],he.prototype,"errorMessage",2),he=n([f("primer-vault-manager"),L()],he);var fa=zr(wr(),1);function va(i){return i.paymentInstrumentType===fa.PaymentInstrumentType.CARD}var ya=h`
2145
+ `}};ue.styles=[w,an],s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1})],ue.prototype,"vaultManagerContext",2),s([I()],ue.prototype,"isEditMode",2),s([I()],ue.prototype,"deletePaymentMethodId",2),s([I()],ue.prototype,"isDeleting",2),s([I()],ue.prototype,"errorMessage",2),s([p({type:Number})],ue.prototype,"animationDuration",2),ue=s([y("primer-vault-manager"),$()],ue);function Mn(i){return i.paymentInstrumentType===Ke.PaymentInstrumentType.CARD}var Tn=f`
1982
2146
  :host {
1983
2147
  display: flex;
1984
2148
  width: 100%;
@@ -1991,30 +2155,19 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
1991
2155
  width: 100%;
1992
2156
  }
1993
2157
 
1994
- /* Styles for edit mode */
1995
- .payment-method-item {
1996
- border: 1px solid var(--primer-color-border-outlined-default);
1997
- background-color: var(--primer-color-background-outlined-default);
1998
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
1999
- padding: var(--primer-space-medium);
2000
- border-radius: var(--primer-radius-medium);
2001
- box-sizing: border-box;
2158
+ .payment-method-container {
2002
2159
  display: flex;
2003
2160
  width: 100%;
2004
- }
2005
-
2006
- /* Hover states */
2007
- .payment-method-item:hover {
2008
- border-color: var(--primer-color-border-outlined-hover);
2009
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.07);
2010
- }
2011
-
2012
- .payment-method-content {
2013
- display: flex;
2014
2161
  align-items: center;
2015
2162
  gap: var(--primer-space-small);
2163
+ }
2164
+
2165
+ /* Target the button part from primer-button using ::part selector */
2166
+ primer-button::part(button) {
2016
2167
  width: 100%;
2017
- position: relative;
2168
+ justify-content: flex-start;
2169
+ display: flex;
2170
+ text-align: left;
2018
2171
  }
2019
2172
 
2020
2173
  /* Card icons */
@@ -2038,10 +2191,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2038
2191
  .payment-method-details {
2039
2192
  flex: 1;
2040
2193
  display: flex;
2041
- gap: var(--primer-space-small);
2042
- align-items: baseline;
2194
+ gap: var(--primer-space-xsmall);
2195
+ align-items: flex-start;
2043
2196
  transition: transform var(--primer-animation-duration)
2044
2197
  var(--primer-animation-easing);
2198
+ margin-left: var(--primer-space-small);
2045
2199
  }
2046
2200
 
2047
2201
  .payment-method-description {
@@ -2054,12 +2208,15 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2054
2208
  .payment-method-secondary-description {
2055
2209
  font-size: var(--primer-typography-body-small-size);
2056
2210
  color: var(--primer-color-text-secondary);
2057
- margin-top: var(--primer-space-xxsmall);
2058
2211
  transition: color var(--primer-animation-duration)
2059
2212
  var(--primer-animation-easing);
2060
2213
  }
2061
2214
 
2062
- /* Delete button - visible only in edit mode */
2215
+ .payment-method-button {
2216
+ flex: 1;
2217
+ }
2218
+
2219
+ /* Delete button - for edit mode */
2063
2220
  .delete-button {
2064
2221
  background-color: transparent;
2065
2222
  border: none;
@@ -2073,15 +2230,11 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2073
2230
  justify-content: center;
2074
2231
  height: var(--primer-size-medium);
2075
2232
  width: var(--primer-size-medium);
2076
- /* The delete button starts invisible */
2077
- opacity: 0;
2078
- transform: translateX(var(--primer-space-small));
2079
- }
2080
-
2081
- /* Delete button is fully visible in stable edit mode (not transitioning) */
2082
- .payment-method-item .delete-button {
2083
- opacity: 1;
2084
- transform: translateX(0);
2233
+ margin-left: var(--primer-space-small);
2234
+ transition:
2235
+ background-color var(--primer-animation-duration)
2236
+ var(--primer-animation-easing),
2237
+ transform var(--primer-animation-duration) var(--primer-animation-easing);
2085
2238
  }
2086
2239
 
2087
2240
  .delete-button:hover {
@@ -2096,51 +2249,52 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2096
2249
  .delete-button primer-icon {
2097
2250
  color: var(--primer-color-red-500);
2098
2251
  }
2099
- `;var ge=class extends g{constructor(){super(...arguments);this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.paymentMethod=null;this.isEditMode=!1;this._getAssetsTask=new R(this,{task:async([e,r,o])=>{if(!e||!r||!o)return I;let s="";if(va(e))s=r.getCardNetworkAsset(e.paymentInstrumentData.network).cardUrl;else{let v=await r.getCDNAssets(e.paymentMethodType);v&&(s=v.assets?.icon?`${v.goatCdnUrl}/${v.assets.icon}`:"")}let m=o.cvvRecapture,C=Pr(e);return{icon:s,shouldShowCVV:m,...C}},args:()=>[this.paymentMethod,this.headlessUtils,this.vaultManagerContext]})}isSelected(){if(!this.vaultManagerContext||!this.paymentMethod)return!1;let e=this.vaultItemContext?.selectedVaultedPaymentMethod;return!!e&&e.id===this.paymentMethod.id}handleClick(){this.isEditMode||!this.vaultManagerContext||!this.paymentMethod||(this.isSelected()?this.vaultItemContext?.setSelectedVaultedPaymentMethod(null):this.vaultItemContext?.setSelectedVaultedPaymentMethod(this.paymentMethod))}handleDeleteClick(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("delete-payment-method",{detail:this.paymentMethod?.id,bubbles:!0,composed:!0}))}renderPaymentMethodContent(e){let r=e.icon?p`<img
2252
+ `;var ve=class extends v{constructor(){super(...arguments);this.vaultManagerContext=null;this.vaultItemContext=null;this.headlessUtils=null;this.paymentMethod=null;this.isEditMode=!1;this._getAssetsTask=new D(this,{task:async([t,r,o])=>{if(!t||!r||!o)return L;let n="";if(Mn(t))n=r.getCardNetworkAsset(t.paymentInstrumentData.network).cardUrl;else{let u=await r.getCDNAssets(t.paymentMethodType);u&&(n=u.assets?.icon?`${u.goatCdnUrl}/${u.assets.icon}`:"")}let l=o.cvvRecapture,g=Xr(t);return{icon:n,shouldShowCVV:l,...g}},args:()=>[this.paymentMethod,this.headlessUtils,this.vaultManagerContext]})}isSelected(){if(!this.vaultManagerContext||!this.paymentMethod)return!1;let t=this.vaultItemContext?.selectedVaultedPaymentMethod;return!!t&&t.id===this.paymentMethod.id}handleClick(){this.isEditMode||!this.vaultManagerContext||!this.paymentMethod||(this.isSelected()?this.vaultItemContext?.setSelectedVaultedPaymentMethod(null):this.vaultItemContext?.setSelectedVaultedPaymentMethod(this.paymentMethod))}handleDeleteClick(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("delete-payment-method",{detail:this.paymentMethod?.id,bubbles:!0,composed:!0}))}renderPaymentMethodContent(t){let r=t.icon?c`<img
2100
2253
  class="payment-method-icon"
2101
- src=${e.icon}
2102
- alt=${e.description}
2103
- />`:p`
2254
+ src=${t.icon}
2255
+ alt=${t.description}
2256
+ />`:c`
2104
2257
  <div class="payment-method-icon payment-method-icon-generic">
2105
2258
  <primer-icon name="payment-card" size="sm"></primer-icon>
2106
2259
  </div>
2107
- `;return p`
2260
+ `;return c`
2108
2261
  ${r}
2109
2262
  <div class="payment-method-details">
2110
- <div class="payment-method-description">${e.description}</div>
2111
- ${e.secondaryDescription?p`<div class="payment-method-secondary-description">
2112
- ${e.secondaryDescription}
2113
- </div>`:u}
2263
+ <div class="payment-method-description">${t.description}</div>
2264
+ ${t.secondaryDescription?c`<div class="payment-method-secondary-description">
2265
+ ${t.secondaryDescription}
2266
+ </div>`:h}
2114
2267
  </div>
2115
- `}render(){return this._getAssetsTask.render({error:()=>u,complete:e=>{let r=this.isSelected()?"checked":"default";return this.isEditMode?p`
2116
- <div class="payment-method-item" @click=${this.handleClick}>
2117
- <div class="payment-method-content">
2118
- ${this.renderPaymentMethodContent(e)}
2119
- <button
2120
- class="delete-button"
2121
- @click=${this.handleDeleteClick}
2122
- aria-label=${`${_("delete",{id:"delete"})} ${e.description}`}
2123
- >
2124
- <primer-icon name="trash" size="sm"></primer-icon>
2125
- </button>
2126
- </div>
2127
- </div>
2128
- `:p`
2268
+ `}render(){return this._getAssetsTask.render({error:()=>h,complete:t=>{let r=this.isSelected()?"checked":"default";return c`
2129
2269
  <div class="payment-method-wrapper">
2130
- <primer-button
2131
- variant="secondary"
2132
- class="payment-method-button"
2133
- selectable
2134
- selectionState=${r}
2135
- @click=${this.handleClick}
2136
- >
2137
- ${this.renderPaymentMethodContent(e)}
2138
- </primer-button>
2139
- ${V(e.shouldShowCVV&&this.isSelected(),()=>p`<primer-vault-cvv-input
2140
- .paymentMethod="${this.paymentMethod}"
2141
- ></primer-vault-cvv-input>`)}
2270
+ <div class="payment-method-container">
2271
+ <primer-button
2272
+ variant="secondary"
2273
+ class="payment-method-button"
2274
+ selectable
2275
+ ?disabled=${this.isEditMode}
2276
+ selectionState=${r}
2277
+ @click=${this.handleClick}
2278
+ >
2279
+ ${this.renderPaymentMethodContent(t)}
2280
+ </primer-button>
2281
+
2282
+ ${this.isEditMode?c`
2283
+ <button
2284
+ class="delete-button"
2285
+ @click=${this.handleDeleteClick}
2286
+ aria-label=${`${A("delete",{id:"delete"})} ${t.description}`}
2287
+ >
2288
+ <primer-icon name="trash" size="sm"></primer-icon>
2289
+ </button>
2290
+ `:h}
2291
+ </div>
2292
+
2293
+ ${U(t.shouldShowCVV&&this.isSelected()&&!this.isEditMode,()=>c`<primer-vault-cvv-input
2294
+ .paymentMethod="${this.paymentMethod}"
2295
+ ></primer-vault-cvv-input>`,()=>h)}
2142
2296
  </div>
2143
- `}})}};ge.styles=[k,ya],n([y({context:X,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.cvvRecapture!==r?.cvvRecapture}})],ge.prototype,"vaultManagerContext",2),n([y({context:Le,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],ge.prototype,"vaultItemContext",2),n([y({context:G,subscribe:!0}),d({type:Object})],ge.prototype,"headlessUtils",2),n([d({type:Object,attribute:!1})],ge.prototype,"paymentMethod",2),n([d({type:Boolean,reflect:!0})],ge.prototype,"isEditMode",2),ge=n([f("primer-vault-payment-method-item"),L()],ge);var ba=h`
2297
+ `}})}};ve.styles=[w,Tn],s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.cvvRecapture!==r?.cvvRecapture}})],ve.prototype,"vaultManagerContext",2),s([b({context:Re,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],ve.prototype,"vaultItemContext",2),s([b({context:W,subscribe:!0}),p({type:Object})],ve.prototype,"headlessUtils",2),s([p({type:Object,attribute:!1})],ve.prototype,"paymentMethod",2),s([p({type:Boolean,reflect:!0})],ve.prototype,"isEditMode",2),ve=s([y("primer-vault-payment-method-item"),$()],ve);var Pn=f`
2144
2298
  :host {
2145
2299
  display: block;
2146
2300
  width: 100%;
@@ -2170,21 +2324,21 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2170
2324
  .edit-button.active {
2171
2325
  color: var(--primer-color-brand);
2172
2326
  }
2173
- `;var ze=class extends g{constructor(){super(...arguments);this.isEditMode=!1;this.hasPaymentMethods=!1}toggleEditMode(){this.dispatchEvent(new CustomEvent("toggle-edit-mode",{detail:!this.isEditMode,bubbles:!0,composed:!0}))}render(){return p`
2327
+ `;var Ge=class extends v{constructor(){super(...arguments);this.isEditMode=!1;this.hasPaymentMethods=!1}toggleEditMode(){this.dispatchEvent(new CustomEvent("toggle-edit-mode",{detail:!this.isEditMode,bubbles:!0,composed:!0}))}render(){return c`
2174
2328
  <div class="vault-manager-header">
2175
- <h3>${_("previouslyUsed",{id:"previouslyUsed"})}</h3>
2329
+ <h3>${A("previouslyUsed",{id:"previouslyUsed"})}</h3>
2176
2330
 
2177
- ${this.hasPaymentMethods?p`
2331
+ ${this.hasPaymentMethods?c`
2178
2332
  <primer-button
2179
2333
  class="edit-button ${this.isEditMode?"active":""}"
2180
2334
  @click=${this.toggleEditMode}
2181
- aria-label=${this.isEditMode?_("confirm",{id:"confirm"}):_("editPaymentMethods",{id:"editPaymentMethods"})}
2335
+ aria-label=${this.isEditMode?A("confirm",{id:"confirm"}):A("editPaymentMethods",{id:"editPaymentMethods"})}
2182
2336
  >
2183
- ${this.isEditMode?p`<primer-icon name="checkmark" size="sm"></primer-icon>`:p`<primer-icon name="pencil" size="sm"></primer-icon>`}
2337
+ ${this.isEditMode?c`<primer-icon name="checkmark" size="sm"></primer-icon>`:c`<primer-icon name="pencil" size="sm"></primer-icon>`}
2184
2338
  </primer-button>
2185
- `:u}
2339
+ `:h}
2186
2340
  </div>
2187
- `}};ze.styles=[k,ba],n([d({type:Boolean})],ze.prototype,"isEditMode",2),n([d({type:Boolean})],ze.prototype,"hasPaymentMethods",2),ze=n([f("primer-vault-manager-header"),L()],ze);var Ea=h`
2341
+ `}};Ge.styles=[w,Pn],s([p({type:Boolean})],Ge.prototype,"isEditMode",2),s([p({type:Boolean})],Ge.prototype,"hasPaymentMethods",2),Ge=s([y("primer-vault-manager-header"),$()],Ge);var wn=f`
2188
2342
  :host {
2189
2343
  display: block;
2190
2344
  width: 100%;
@@ -2255,10 +2409,10 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2255
2409
  opacity: 0.7;
2256
2410
  cursor: not-allowed;
2257
2411
  }
2258
- `;var ye=class extends g{constructor(){super(...arguments);this.isDeleting=!1;this.paymentMethodId="";this.paymentMethodName="";this.vaultManager=null}handleConfirmClick(){this.dispatchEvent(new CustomEvent("confirm-delete",{bubbles:!0,composed:!0}))}handleCancelClick(){this.dispatchEvent(new CustomEvent("cancel-delete",{bubbles:!0,composed:!0}))}render(){let e=this.paymentMethodName;return p`
2412
+ `;var Ee=class extends v{constructor(){super(...arguments);this.isDeleting=!1;this.paymentMethodId="";this.paymentMethodName="";this.vaultManager=null}handleConfirmClick(){this.dispatchEvent(new CustomEvent("confirm-delete",{bubbles:!0,composed:!0}))}handleCancelClick(){this.dispatchEvent(new CustomEvent("cancel-delete",{bubbles:!0,composed:!0}))}render(){let t=this.paymentMethodName;return c`
2259
2413
  <div class="delete-confirmation">
2260
2414
  <div class="delete-message">
2261
- <p class="delete-text">${e}</p>
2415
+ <p class="delete-text">${t}</p>
2262
2416
  </div>
2263
2417
  <div class="delete-actions">
2264
2418
  <button
@@ -2266,18 +2420,18 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2266
2420
  @click=${this.handleConfirmClick}
2267
2421
  ?disabled=${this.isDeleting}
2268
2422
  >
2269
- ${this.isDeleting?_("deleting",{id:"deleting"}):_("confirmVaultedPaymentMethodDeletion",{id:"confirmVaultedPaymentMethodDeletion"})}
2423
+ ${this.isDeleting?A("deleting",{id:"deleting"}):A("confirmVaultedPaymentMethodDeletion",{id:"confirmVaultedPaymentMethodDeletion"})}
2270
2424
  </button>
2271
2425
  <button
2272
2426
  class="delete-cancel"
2273
2427
  @click=${this.handleCancelClick}
2274
2428
  ?disabled=${this.isDeleting}
2275
2429
  >
2276
- ${_("cancel",{id:"cancel"})}
2430
+ ${A("cancel",{id:"cancel"})}
2277
2431
  </button>
2278
2432
  </div>
2279
2433
  </div>
2280
- `}};ye.styles=[k,Ea],n([d({type:Boolean})],ye.prototype,"isDeleting",2),n([d({type:String})],ye.prototype,"paymentMethodId",2),n([d({type:String})],ye.prototype,"paymentMethodName",2),n([y({context:X,subscribe:!0})],ye.prototype,"vaultManager",2),ye=n([f("primer-vault-delete-confirmation"),L()],ye);var xa=h`
2434
+ `}};Ee.styles=[w,wn],s([p({type:Boolean})],Ee.prototype,"isDeleting",2),s([p({type:String})],Ee.prototype,"paymentMethodId",2),s([p({type:String})],Ee.prototype,"paymentMethodName",2),s([b({context:Q,subscribe:!0})],Ee.prototype,"vaultManager",2),Ee=s([y("primer-vault-delete-confirmation"),$()],Ee);var kn=f`
2281
2435
  :host {
2282
2436
  display: block;
2283
2437
  width: 100%;
@@ -2292,13 +2446,13 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2292
2446
  .empty-state p {
2293
2447
  margin: 0;
2294
2448
  }
2295
- `;var vt=class extends g{render(){return p`
2449
+ `;var wt=class extends v{render(){return c`
2296
2450
  <div class="empty-state">
2297
2451
  <p>
2298
- ${_("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
2452
+ ${A("savedPaymentMethodsEmpty",{id:"savedPaymentMethodsEmpty"})}
2299
2453
  </p>
2300
2454
  </div>
2301
- `}};vt.styles=[k,xa],vt=n([f("primer-vault-empty-state"),L()],vt);var Ca=h`
2455
+ `}};wt.styles=[w,kn],wt=s([y("primer-vault-empty-state"),$()],wt);var In=f`
2302
2456
  :host {
2303
2457
  display: block;
2304
2458
  width: 100%;
@@ -2344,7 +2498,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2344
2498
  .error-message button:hover {
2345
2499
  background-color: rgba(0, 0, 0, 0.05);
2346
2500
  }
2347
- `;var et=class extends g{constructor(){super(...arguments);this.errorMessage=""}handleDismiss(){this.dispatchEvent(new CustomEvent("close-error",{bubbles:!0,composed:!0}))}render(){return p`
2501
+ `;var pt=class extends v{constructor(){super(...arguments);this.errorMessage=""}handleDismiss(){this.dispatchEvent(new CustomEvent("close-error",{bubbles:!0,composed:!0}))}render(){return c`
2348
2502
  <div class="error-message">
2349
2503
  <div class="error-content">
2350
2504
  <primer-icon
@@ -2356,16 +2510,16 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2356
2510
  </div>
2357
2511
  <button
2358
2512
  @click=${this.handleDismiss}
2359
- aria-label=${_("closeErrorMessage",{id:"closeErrorMessage"})}
2513
+ aria-label=${A("closeErrorMessage",{id:"closeErrorMessage"})}
2360
2514
  >
2361
2515
  <primer-icon name="close" size="sm"></primer-icon>
2362
2516
  </button>
2363
2517
  </div>
2364
- `}};et.styles=[k,Ca],n([d({type:String})],et.prototype,"errorMessage",2),et=n([f("primer-vault-error-message"),L()],et);var _a=h`
2518
+ `}};pt.styles=[w,In],s([p({type:String})],pt.prototype,"errorMessage",2),pt=s([y("primer-vault-error-message"),$()],pt);var Nn=f`
2365
2519
  :host {
2366
2520
  display: contents;
2367
2521
  }
2368
- `;var Q=class extends g{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.sdkState=null;this.vaultItemContext=null;this.vaultManager=null;this.clientOptions=null;this.variant="primary";this.disabled=!1;this.handleClick=async e=>{if(e.preventDefault(),!this.isButtonDisabled)try{await this.vaultManager?.startVaultedPaymentFlow()}catch(r){let o=new CustomEvent("primer-vault-payment-error",{bubbles:!0,composed:!0,detail:{error:r}});this.dispatchEvent(o)}}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:_("pay",{id:"pay"})}set buttonText(e){let r=this.buttonText;e!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=e):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}get isButtonDisabled(){return!!(this.disabled||!this.vaultItemContext?.selectedVaultedPaymentMethod||this.vaultManager?.isLoading)}render(){let e=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=e?` ${e}`:u;return p`
2522
+ `;var te=class extends v{constructor(){super(...arguments);this._userAssignedProps=new Set;this._internalButtonText="";this.headlessInstance=null;this.sdkState=null;this.vaultItemContext=null;this.vaultManager=null;this.clientOptions=null;this.variant="primary";this.disabled=!1;this.handleClick=async t=>{if(t.preventDefault(),!this.isButtonDisabled)try{await this.vaultManager?.startVaultedPaymentFlow()}catch(r){let o=new CustomEvent("primer-vault-payment-error",{bubbles:!0,composed:!0,detail:{error:r}});this.dispatchEvent(o)}}}get buttonText(){return this._userAssignedProps.has("buttonText")?this._internalButtonText:A("pay",{id:"pay"})}set buttonText(t){let r=this.buttonText;t!==""?(this._userAssignedProps.add("buttonText"),this._internalButtonText=t):(this._userAssignedProps.delete("buttonText"),this._internalButtonText=""),this.requestUpdate("buttonText",r)}get isButtonDisabled(){return!!(this.disabled||!this.vaultItemContext?.selectedVaultedPaymentMethod||this.vaultManager?.isLoading)}render(){let t=this.clientOptions?.submitButton?.amountVisible?this.headlessInstance?.getUIOrderAmount():null,r=t?` ${t}`:h;return c`
2369
2523
  <primer-button
2370
2524
  buttonType="submit"
2371
2525
  variant=${this.variant}
@@ -2376,7 +2530,7 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2376
2530
  >
2377
2531
  ${this.buttonText}${r}
2378
2532
  </primer-button>
2379
- `}};Q.styles=[k,_a],n([d({type:String})],Q.prototype,"buttonText",1),n([y({context:G,subscribe:!0}),d({type:Object})],Q.prototype,"headlessInstance",2),n([y({context:z,subscribe:!0}),d()],Q.prototype,"sdkState",2),n([y({context:Le,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],Q.prototype,"vaultItemContext",2),n([y({context:X,subscribe:!0}),d({type:Object,attribute:!1})],Q.prototype,"vaultManager",2),n([y({context:Pe,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.submitButton?.amountVisible!==r?.submitButton?.amountVisible}})],Q.prototype,"clientOptions",2),n([d({type:String})],Q.prototype,"variant",2),n([d({type:Boolean})],Q.prototype,"disabled",2),Q=n([f("primer-vault-payment-submit"),L()],Q);var Aa=h`
2533
+ `}};te.styles=[w,Nn],s([p({type:String})],te.prototype,"buttonText",1),s([b({context:W,subscribe:!0}),p({type:Object})],te.prototype,"headlessInstance",2),s([b({context:j,subscribe:!0}),p()],te.prototype,"sdkState",2),s([b({context:Re,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.selectedVaultedPaymentMethod?.id!==r?.selectedVaultedPaymentMethod?.id}})],te.prototype,"vaultItemContext",2),s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1})],te.prototype,"vaultManager",2),s([b({context:Le,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.submitButton?.amountVisible!==r?.submitButton?.amountVisible}})],te.prototype,"clientOptions",2),s([p({type:String})],te.prototype,"variant",2),s([p({type:Boolean})],te.prototype,"disabled",2),te=s([y("primer-vault-payment-submit"),$()],te);var Ln=f`
2380
2534
  :host {
2381
2535
  display: block;
2382
2536
  margin-top: var(--primer-space-medium);
@@ -2385,21 +2539,21 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2385
2539
  .cvv-input-container {
2386
2540
  margin-bottom: var(--primer-space-medium);
2387
2541
  }
2388
- `;var ee=class extends g{constructor(){super();this.vaultManagerFormContext=null;this.vaultManagerCvvContext=null;this.computedStyles=null;this.paymentMethod=null;this.cvvError=null;this.cvvInputIsDirty=!1;this.cvvInputIsBlurred=!1;this.cvvInput=null;this._setupCVVIframe=new R(this,{task:async([e,r])=>!e||!r||e.paymentMethodType!=="PAYMENT_CARD"||!e.paymentInstrumentData?.network||r.createCvvInput===void 0?I:{network:e.paymentInstrumentData.network,createCvvInput:r.createCvvInput},args:()=>[this.paymentMethod,this.vaultManagerFormContext]});this.cvvContainerId=`cvv-container-${Math.random().toString(36).substring(2,9)}`,new R(this,{task:async([e])=>{if(!e)return I;await this.updateComplete;let r=this.renderRoot.querySelector(`#${this.cvvContainerId}`);if(!r)return;let o=Ar(this.computedStyles),s=o?{input:{base:o}}:void 0,m={cardNetwork:e.network,container:r,name:"cvv",placeholder:"123",style:s};this.cvvInput=await e.createCvvInput(m),this.cvvInput&&(this.cvvInput.focus(),this.cvvError=this.cvvInput.metadata.error||null,this.vaultManagerCvvContext?.setCvvInput(this.cvvInput),this.cvvInput.addListener("change",()=>{this.onCvvInputChange()}),this.cvvInput.addListener("blur",()=>{this.onBlur()}))},args:()=>[this._setupCVVIframe.value]})}disconnectedCallback(){super.disconnectedCallback(),this.cvvInput&&(this.cvvInput.remove(),this.cvvInput=null,this.cvvError=null,this.vaultManagerCvvContext?.setCvvInput(null))}onCvvInputChange(){!this.cvvInput||!this.vaultManagerCvvContext||(this.cvvInputIsDirty=!0,this.cvvError=this.cvvInput.metadata.error||null)}onBlur(){this.cvvInput&&(this.cvvInputIsBlurred=!0,this.cvvError=this.cvvInput.metadata.error||null)}render(){return this._setupCVVIframe.render({error:()=>u,complete:()=>p`
2542
+ `;var re=class extends v{constructor(){super();this.vaultManagerFormContext=null;this.vaultManagerCvvContext=null;this.computedStyles=null;this.paymentMethod=null;this.cvvError=null;this.cvvInputIsDirty=!1;this.cvvInputIsBlurred=!1;this.cvvInput=null;this._setupCVVIframe=new D(this,{task:async([t,r])=>!t||!r||t.paymentMethodType!=="PAYMENT_CARD"||!t.paymentInstrumentData?.network||r.createCvvInput===null?L:{network:t.paymentInstrumentData.network,createCvvInput:r.createCvvInput},args:()=>[this.paymentMethod,this.vaultManagerFormContext]});this.cvvContainerId=`cvv-container-${Math.random().toString(36).substring(2,9)}`,new D(this,{task:async([t])=>{if(!t)return L;await this.updateComplete;let r=this.renderRoot.querySelector(`#${this.cvvContainerId}`);if(!r)return;let o=jr(this.computedStyles),n=o?{input:{base:o}}:void 0,l={cardNetwork:t.network,container:r,name:"cvv",placeholder:"123",style:n};this.cvvInput=await t.createCvvInput?.(l)??null,this.cvvInput&&(this.cvvInput.focus(),this.cvvError=this.cvvInput.metadata.error||null,this.vaultManagerCvvContext?.setCvvInput(this.cvvInput),this.cvvInput.addListener("change",()=>{this.onCvvInputChange()}),this.cvvInput.addListener("blur",()=>{this.onBlur()}))},args:()=>[this._setupCVVIframe.value]})}disconnectedCallback(){super.disconnectedCallback(),this.cvvInput&&(this.cvvInput.remove(),this.cvvInput=null,this.cvvError=null,this.vaultManagerCvvContext?.setCvvInput(null))}onCvvInputChange(){!this.cvvInput||!this.vaultManagerCvvContext||(this.cvvInputIsDirty=!0,this.cvvError=this.cvvInput.metadata.error||null)}onBlur(){this.cvvInput&&(this.cvvInputIsBlurred=!0,this.cvvError=this.cvvInput.metadata.error||null)}render(){return this._setupCVVIframe.render({error:()=>h,complete:()=>c`
2389
2543
  <div class="cvv-input-container">
2390
2544
  <primer-input-wrapper
2391
2545
  .hasError=${!!this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred)}
2392
2546
  >
2393
2547
  <primer-input-label slot="label">CVV</primer-input-label>
2394
2548
  <div slot="input" id="${this.cvvContainerId}"></div>
2395
- ${V(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>p`
2549
+ ${U(this.cvvError&&(this.vaultManagerCvvContext?.formIsDirty||this.cvvInputIsDirty&&this.cvvInputIsBlurred),()=>c`
2396
2550
  <primer-input-error slot="error">
2397
2551
  ${this.cvvError}
2398
2552
  </primer-input-error>
2399
2553
  `)}
2400
2554
  </primer-input-wrapper>
2401
2555
  </div>
2402
- `})}};ee.styles=[k,Aa],n([y({context:X,subscribe:!0}),d({type:Object,attribute:!1,hasChanged(e,r){return e?.createCvvInput!==r?.createCvvInput}})],ee.prototype,"vaultManagerFormContext",2),n([y({context:Le,subscribe:!0}),d({type:Object,attribute:!1})],ee.prototype,"vaultManagerCvvContext",2),n([y({context:Ie,subscribe:!0}),d()],ee.prototype,"computedStyles",2),n([d({type:Object})],ee.prototype,"paymentMethod",2),n([T()],ee.prototype,"cvvError",2),n([T()],ee.prototype,"cvvInputIsDirty",2),n([T()],ee.prototype,"cvvInputIsBlurred",2),n([T()],ee.prototype,"cvvInput",2),ee=n([f("primer-vault-cvv-input"),L()],ee);var Ma=h`
2556
+ `})}};re.styles=[w,Ln],s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1,hasChanged(t,r){return t?.createCvvInput!==r?.createCvvInput}})],re.prototype,"vaultManagerFormContext",2),s([b({context:Re,subscribe:!0}),p({type:Object,attribute:!1})],re.prototype,"vaultManagerCvvContext",2),s([b({context:$e,subscribe:!0}),p()],re.prototype,"computedStyles",2),s([p({type:Object})],re.prototype,"paymentMethod",2),s([I()],re.prototype,"cvvError",2),s([I()],re.prototype,"cvvInputIsDirty",2),s([I()],re.prototype,"cvvInputIsBlurred",2),s([I()],re.prototype,"cvvInput",2),re=s([y("primer-vault-cvv-input"),$()],re);var $n=f`
2403
2557
  :host {
2404
2558
  display: block;
2405
2559
  margin-top: var(--primer-space-medium);
@@ -2419,37 +2573,36 @@ primer-checkout:not([js-initialized]):not([loader-disabled])::after {
2419
2573
  justify-content: center;
2420
2574
  align-items: center;
2421
2575
  }
2422
- `;var Fe=class extends g{constructor(){super(...arguments);this.isShowingOtherPayments=!1;this.vaultManager=null}handleExpandedChanged(e){this.isShowingOtherPayments=e.detail.expanded}render(){return this.vaultManager?.isLoading?u:!this.vaultManager||!this.vaultManager.enabled||this.vaultManager.vaultedPaymentMethods.length===0?p`<slot name="other-payments"></slot>`:p`
2576
+ `;var ct=class extends v{constructor(){super(...arguments);this.vaultManager=null}render(){return this.vaultManager?.isLoading?h:!this.vaultManager||!this.vaultManager.enabled?c`<slot name="other-payments"></slot>`:c`
2423
2577
  <div class="other-payment-methods-container">
2424
2578
  <primer-collapsable
2425
2579
  buttonVariant="secondary"
2426
- .expanded="${this.isShowingOtherPayments}"
2427
- .header="${_("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
2428
- @expanded-changed="${this.handleExpandedChanged}"
2580
+ .expanded="${this.vaultManager?.vaultedPaymentMethods.length===0}"
2581
+ .header="${A("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
2429
2582
  >
2430
2583
  <div class="other-payment-methods-content">
2431
2584
  <slot name="other-payments"></slot>
2432
2585
  </div>
2433
2586
  </primer-collapsable>
2434
2587
  </div>
2435
- `}};Fe.styles=[Ma],n([T()],Fe.prototype,"isShowingOtherPayments",2),n([y({context:X,subscribe:!0}),d({type:Object,attribute:!1})],Fe.prototype,"vaultManager",2),Fe=n([f("primer-show-other-payments")],Fe);var Ft=class extends g{render(){return p`
2588
+ `}};ct.styles=[$n],s([b({context:Q,subscribe:!0}),p({type:Object,attribute:!1})],ct.prototype,"vaultManager",2),ct=s([y("primer-show-other-payments")],ct);var pr=class extends v{render(){return c`
2436
2589
  <primer-checkout-state type="complete"></primer-checkout-state>
2437
- `}};Ft=n([f("primer-checkout-complete")],Ft);var yt=class extends g{constructor(){super(...arguments);this.sdkState=null}render(){return p`
2590
+ `}};pr=s([y("primer-checkout-complete")],pr);var kt=class extends v{constructor(){super(...arguments);this.sdkState=null}render(){return c`
2438
2591
  <primer-checkout-state
2439
2592
  type="failure"
2440
2593
  description=${this.sdkState?.error?.message||""}
2441
2594
  ></primer-checkout-state>
2442
- `}};n([y({context:z,subscribe:!0}),d()],yt.prototype,"sdkState",2),yt=n([f("primer-checkout-error")],yt);var Sa=h`
2595
+ `}};s([b({context:j,subscribe:!0}),p()],kt.prototype,"sdkState",2),kt=s([y("primer-checkout-error")],kt);var Rn=f`
2443
2596
  :host {
2444
2597
  display: block;
2445
2598
  width: 100%;
2446
2599
  }
2447
- `;var Be=class extends g{constructor(){super(...arguments);this.showProcessingErrors=!0}get shouldShowError(){return!this.sdkState||this.sdkState.isProcessing?!1:!!(this.sdkState.failure&&this.showProcessingErrors)}render(){return this.sdkState?p`
2600
+ `;var qe=class extends v{constructor(){super(...arguments);this.showProcessingErrors=!0}get shouldShowError(){return!this.sdkState||this.sdkState.isProcessing?!1:!!(this.sdkState.failure&&this.showProcessingErrors)}render(){return this.sdkState?c`
2448
2601
  <primer-error-message
2449
- message="${_(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
2602
+ message="${A(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
2450
2603
  ?visible="${this.shouldShowError}"
2451
2604
  ></primer-error-message>
2452
- `:u}};Be.styles=[Sa],n([y({context:z,subscribe:!0}),T()],Be.prototype,"sdkState",2),n([d({type:Boolean,attribute:"show-processing-errors"})],Be.prototype,"showProcessingErrors",2),Be=n([f("primer-error-message-container")],Be);async function i_(){No(),Ro()}export{de as AchPayment,le as Button,Te as CardForm,ut as CardFormCVV,ce as CardFormCardNetworkSelector,mt as CardFormCardNumber,$e as CardFormError,ht as CardFormExpiry,gt as CardFormName,pe as CardFormSubmit,oe as Collapsable,ct as Dialog,ue as DynamicPayment,fe as ErrorMessage,Be as ErrorMessageContainer,vr as InitializedPayments,U as Input,De as InputLabel,Me as InputWrapper,ke as NativePayment,He as PaymentMethod,Qe as Portal,Ft as PrimerCheckoutComplete,se as PrimerCheckoutComponent,yt as PrimerCheckoutFailure,Ve as PrimerCheckoutState,Se as PrimerIcon,J as PrimerKlarna,Ue as PrimerMain,ve as RedirectPayment,Fe as ShowOtherPayments,Ae as Spinner,ee as VaultCvvInput,ye as VaultDeleteConfirmation,vt as VaultEmptyState,et as VaultErrorMessage,he as VaultManager,ze as VaultManagerHeader,ge as VaultPaymentMethodItem,Q as VaultPaymentSubmit,Kn as injectDarkTheme,Bn as injectLightTheme,No as injectLoaderStyles,Ro as injectThemeStyles,i_ as loadPrimer};
2605
+ `:h}};qe.styles=[Rn],s([b({context:j,subscribe:!0}),I()],qe.prototype,"sdkState",2),s([p({type:Boolean,attribute:"show-processing-errors"})],qe.prototype,"showProcessingErrors",2),qe=s([y("primer-error-message-container")],qe);async function M0(){xa(),Aa()}export{pe as AchPayment,de as Button,ke as CardForm,At as CardFormCVV,me as CardFormCardNetworkSelector,xt as CardFormCardNumber,Ue as CardFormError,_t as CardFormExpiry,St as CardFormName,ce as CardFormSubmit,ae as Collapsable,Ct as Dialog,fe as DynamicPayment,ye as ErrorMessage,qe as ErrorMessageContainer,Vr as InitializedPayments,F as Input,He as InputLabel,Te as InputWrapper,we as NativePayment,ze as PaymentMethod,ot as Portal,pr as PrimerCheckoutComplete,le as PrimerCheckoutComponent,kt as PrimerCheckoutFailure,Ye as PrimerCheckoutState,Pe as PrimerIcon,ee as PrimerKlarna,Fe as PrimerMain,be as RedirectPayment,ct as ShowOtherPayments,Me as Spinner,re as VaultCvvInput,Ee as VaultDeleteConfirmation,wt as VaultEmptyState,pt as VaultErrorMessage,ue as VaultManager,Ge as VaultManagerHeader,ve as VaultPaymentMethodItem,te as VaultPaymentSubmit,nl as injectDarkTheme,al as injectLightTheme,xa as injectLoaderStyles,Aa as injectThemeStyles,M0 as loadPrimer};
2453
2606
  /*! Bundled license information:
2454
2607
 
2455
2608
  @lit/context/lib/context-request-event.js:
@@ -2752,4 +2905,32 @@ lit-html/directives/ref.js:
2752
2905
  * Copyright 2020 Google LLC
2753
2906
  * SPDX-License-Identifier: BSD-3-Clause
2754
2907
  *)
2908
+
2909
+ lit-html/lit-html.js:
2910
+ (**
2911
+ * @license
2912
+ * Copyright 2017 Google LLC
2913
+ * SPDX-License-Identifier: BSD-3-Clause
2914
+ *)
2915
+
2916
+ lit-html/directive.js:
2917
+ (**
2918
+ * @license
2919
+ * Copyright 2017 Google LLC
2920
+ * SPDX-License-Identifier: BSD-3-Clause
2921
+ *)
2922
+
2923
+ lit-html/directive-helpers.js:
2924
+ (**
2925
+ * @license
2926
+ * Copyright 2020 Google LLC
2927
+ * SPDX-License-Identifier: BSD-3-Clause
2928
+ *)
2929
+
2930
+ lit-html/async-directive.js:
2931
+ (**
2932
+ * @license
2933
+ * Copyright 2017 Google LLC
2934
+ * SPDX-License-Identifier: BSD-3-Clause
2935
+ *)
2755
2936
  */