@primer-io/primer-js 0.1.5 → 0.1.6

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.
@@ -0,0 +1,2370 @@
1
+ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs((je,$i)=>{(function(i,t){typeof je=="object"&&typeof $i=="object"?$i.exports=t():typeof define=="function"&&define.amd?define([],t):typeof je=="object"?je.Primer=t():i.Primer=t()})(je,()=>(()=>{"use strict";let i;var t,e,r={};r.d=(a,d)=>{for(var c in d)r.o(d,c)&&!r.o(a,c)&&Object.defineProperty(a,c,{enumerable:!0,get:d[c]})},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:()=>js,PaymentFlow:()=>zs,PrimerClientError:()=>sr,ThreeDSecureStatus:()=>Bs,TokenType:()=>Ks,isStripeOptionsDropInWithFullMandateText:()=>qs,PaymentInstrumentType:()=>Pe,ErrorCode:()=>Gs,EventTypes:()=>Ws,CheckoutUXFlow:()=>Fs,HeadlessManagerType:()=>Zs,PaymentMethodType:()=>we,Primer:()=>Xs});let s={LEGACY:"legacy",V_2_4:"2.4"},l=s.V_2_4,f=l;class m extends Error{static from(d,c=!1){if(d instanceof m)return d;let E=new m(d instanceof Error?d.message:String(d),c);return d instanceof Error&&d.stack&&(E.stack=d.stack,Object.assign(E,d)),E}markAsReported(){this.isReported=!0}constructor(d,c=!1){super(d),function(E,x,C){x in E?Object.defineProperty(E,x,{value:C,enumerable:!0,configurable:!0,writable:!0}):E[x]=C}(this,"isReported",void 0),this.isReported=c,this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}let _="https://analytics.production.data.primer.io/sdk-logs";var w=function(a){return a.REQUEST_START="REQUEST_START",a.REQUEST_END="REQUEST_END",a}({}),A=function(a){return a.START="START",a.END="END",a}({});let O={createHeadless:"HEADLESS_LOADING",showUniversalCheckout:"DROP_IN_LOADING",showVaultManager:"VAULT_MANAGER_LOADING",preloadPrimer:"PRELOAD_PRIMER_LOADING"};var H=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 ht(){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 ps={get(a,d){let c;try{switch(a){case"PRIMER_SDK_VERSION":c="v2.53.6";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||d}}.get("PRIMER_SDK_VERSION");async function Ki(a,d,c){return{...c,createdAt:Date.now(),device:await ht(),eventType:a,properties:d,sdkVersion:ps,sdkType:"WEB"}}let Gi=Symbol.for("__primerAnalytics__"),xe={providers:new Map,timers:new Map,eventsQueue:new Map};if(typeof window<"u"){let a=window[Gi];a?xe=a:window[Gi]=xe}let ji=()=>xe.providers,ti=()=>xe.timers,Se=()=>xe.eventsQueue,rr=new Map;function ei(a,d=!1,c=1){rr.has(a)&&(clearTimeout(rr.get(a)),rr.delete(a));let E=()=>{let C=Se().get(a);if(C?.length){let b=!0,S=[],L=0,M=0;for(;M<C.length;){let D=C[M],F=new Blob([JSON.stringify(D)]).size;if(F>64e3){console.error("Event size exceeds maximum payload size and will be skipped:",D),M++;continue}if(L+F>64e3&&S.length>0){try{b=navigator.sendBeacon(a,JSON.stringify(S))}catch(B){b=!1,console.error("Unable to send events",B)}if(!b)break;S=[],L=0}S.push(D),L+=F,M++}if(S.length>0&&b)try{b=navigator.sendBeacon(a,JSON.stringify(S))}catch(D){b=!1,console.error("Unable to send events",D)}b?Se().delete(a):c<5?setTimeout(()=>ei(a,d,c+1),500*Math.pow(2,c)):console.error("Max retry attempts reached. Events will not be sent.")}};if(d)return void E();let x=setTimeout(E,500);rr.set(a,x)}let qi=!1;function ri({url:a=_,...d}){typeof document>"u"||qi||(document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"){let x=ne(d.checkoutSessionId);x.messageEvent({messageType:"VISIBILITY_CHANGE",message:"Checkout visibility is hidden (tab or window change, redirect or being closed)."}),ei(x.url,!0)}}),qi=!0);let c=x=>async C=>{if(typeof navigator>"u")return;let b=function L(M,D,F=new WeakSet,B=0,lt=10){if(B>lt||F.has(M))return M;F.add(M);let dt=rt=>typeof rt=="object"&&rt!==null?L(rt,D,F,B+1,lt):D(rt);return Array.isArray(M)?M.map(dt):Object.fromEntries(Object.entries(M).map(([rt,de])=>[rt,dt(de)]))}(await Ki(x,C,d),L=>{var M;return typeof(M=typeof L=="function"?L.name||"function":L)=="string"&&M.length>5120?`${M.slice(0,5120)}...`:M});Se().has(a)||Se().set(a,[]),Se().get(a)?.push(b),ei(a)},E={crashEvent:c(H.CRASH_EVENT),messageEvent:c(H.MESSAGE_EVENT),networkCallEvent:c(H.NETWORK_CALL_EVENT),sdkFunctionEvent:c(H.SDK_FUNCTION_EVENT),timerStart:({id:x,...C})=>{let b=`${d.checkoutSessionId}|${x}`,S=performance?.now?performance.now():Date.now();return ti().set(b,{start:S}),c(H.TIMER_EVENT)({...C,id:x,timerType:A.START})},timerEnd:({id:x,...C})=>{let b=`${d.checkoutSessionId}|${x}`,{start:S}=ti().get(b)??{};ti().delete(b);let L=performance?.now?performance.now():Date.now();return c(H.TIMER_EVENT)({...C,id:x,timerType:A.END,duration:S?L-S:void 0})},v1Event:c(H.V1_EVENT),url:a};return ji().set(d.checkoutSessionId,E),ne(d.checkoutSessionId)}function ne(a){return new Proxy({},{get:(d,c)=>(ji().get(a)??ri({checkoutSessionId:a}))[c]})}let ii=(a,d,c,E)=>({callType:c?w.REQUEST_END:w.REQUEST_START,id:a,errorBody:c?.error&&JSON.stringify(c.error,Object.getOwnPropertyNames(c.error)),method:d.method,responseCode:c?.status,url:d.url,duration:E});function ms(a){return a?new Promise(d=>{setTimeout(d,a)}):Promise.resolve()}async function Wi(a,d,c,E=ms){let x=0,C={enabled:d?.enabled??!1,maxRetries:8,initialBackoff:100,retryNetworkErrors:!0,retry500Errors:!1,maxJitter:100};if(!C.enabled)return a();for(;;)try{let b=await a();if(x){let S=`Request succeeded after ${x} retries.`;typeof b=="object"&&b&&"status"in b&&(S+=` Status code: ${b.status}`),c?.({messageType:"RETRY_SUCCESS",message:S,severity:"INFO"})}return b}catch(b){let S=x>=C.maxRetries,L=b.isNetworkError&&!C.retryNetworkErrors,M=b.status&&b.status>=500&&!C.retry500Errors;if(S||L||M){let B=`Failed after ${x} retries. `;throw S?B+=`Reached maximum retries (${C.maxRetries}).`:L?B+="Network error encountered and retryNetworkErrors is disabled.":M&&(B+="HTTP 500 error encountered and retry500Errors is disabled."),B+=` Last error: ${b.message}`,c?.({messageType:"RETRY_FAILED",message:B,severity:"ERROR",errorBody:JSON.stringify(b,Object.getOwnPropertyNames(b))}),Error(B,{cause:b})}x++;let D=Math.min(C.initialBackoff*Math.pow(2,x-1)+Math.random()*C.maxJitter,Number.MAX_SAFE_INTEGER),F="Unknown error";b.isNetworkError?F="Network error":b.status&&(F=`HTTP ${b.status} error`),c?.({messageType:"RETRY",message:`Retry attempt ${x}/${C.maxRetries} due to: ${F}. Error details: ${b.message}. Waiting for ${D.toFixed(2)}ms before next attempt.`,severity:"WARN",errorBody:JSON.stringify(b,Object.getOwnPropertyNames(b))}),await E(D)}}let oi={cache:new Map};typeof window<"u"&&((t=window)[e="__primerCache__"]??(t[e]=oi),oi=window.__primerCache__);let et=()=>oi.cache;function Zi(){if(et().size<=30)return;let a=Date.now();for(let[d,c]of et())c.exp<a&&et().delete(d);if(et().size>50)for(let[d]of et()){if(et().size<=50)break;et().delete(d)}}let ai=()=>Xi.randomUUID?.()||hs(),hs=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(a^us()>>a/4).toString(16)),us=()=>(Xi.getRandomValues?.(new Uint8Array(1))[0]??16*Math.random())&15,Xi=typeof crypto<"u"?crypto:{},fs=(a,d,c)=>gs(a,"get",d,c),gs=async(a,d,c,E,x)=>{let C=ai(),b=performance?.now(),S=ne(a),L={method:d,url:c,body:x};S.networkCallEvent(ii(C,L));try{let M=await fetch(c,{body:x,method:d,headers:{"content-type":"application/json","x-request-id":C,...E}});if(!M.ok){let B=Error(`HTTP error! status: ${M.status}`);throw B.status=M.status,B}let D=await M.json();if(c.includes("client-sdk/configuration")){let{primerAccountId:B,clientSession:{clientSessionId:lt,customer:dt}}=D;S=ri({checkoutSessionId:a,clientSessionId:lt,customerId:dt?.customerId,primerAccountId:B,url:S.url})}let F=performance?.now();return S.networkCallEvent(ii(C,L,{data:D},F-b)),{data:D,headers:M.headers,status:M.status,source:"NETWORK"}}catch(M){let D=performance?.now();throw Object.assign(M,{isNetworkError:M instanceof TypeError}),S.networkCallEvent(ii(C,L,{error:M},D-b)),M}},ys=(a,d)=>new Promise((c,E)=>{let x=setTimeout(()=>{let C=Error("Request timed out");C.isNetworkError=!0,E(C)},d);a.then(c).catch(E).finally(()=>clearTimeout(x))}),vs=(a,d)=>{let{headers:c,retryConfig:E,cacheConfig:x,timeout:C=15e3,checkoutSessionId:b}=d,S=ne(b);return function(L){if(!L)return lt=>lt();let{key:M,refresh:D=!1,usePrimerSessionCacheTtlHeader:F=!1,ttl:B=36e5}=L;return async lt=>{let dt=Date.now(),rt=et().get(M);if(!D&&rt&&rt.exp>dt)return rt.promise;rt&&et().delete(M);let de=lt().then(Te=>{let yo=B;return F&&(yo=1e3*(Number(Te.headers.get("x-primer-session-cache-ttl"))||0)),function({key:vo,ttl:bo=36e5},Js){bo?et().set(vo,{promise:Promise.resolve({...Js,source:"CACHE"}),exp:Date.now()+bo}):et().delete(vo)}({key:M,ttl:yo},Te),Zi(),Te},Te=>{throw et().delete(M),Te});return et().set(M,{promise:de,exp:dt+B}),Zi(),de}}(x)(()=>Wi(()=>ys(fs(b,a,c),C),E,L=>S.messageEvent({...L,url:a})))},le=typeof Buffer=="function",Ji=typeof TextDecoder=="function"?new TextDecoder:void 0,Qi=typeof TextEncoder=="function"?new TextEncoder:void 0,Me=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),ir=(a=>{let d={};return a.forEach((c,E)=>d[c]=E),d})(Me),bs=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,j=String.fromCharCode.bind(String),to=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):a=>new Uint8Array(Array.prototype.slice.call(a,0)),eo=a=>a.replace(/=/g,"").replace(/[+\/]/g,d=>d=="+"?"-":"_"),ro=a=>a.replace(/[^A-Za-z0-9\+\/]/g,""),io=typeof btoa=="function"?a=>btoa(a):le?a=>Buffer.from(a,"binary").toString("base64"):a=>{let d,c,E,x,C="",b=a.length%3;for(let S=0;S<a.length;){if((c=a.charCodeAt(S++))>255||(E=a.charCodeAt(S++))>255||(x=a.charCodeAt(S++))>255)throw TypeError("invalid character found");C+=Me[(d=c<<16|E<<8|x)>>18&63]+Me[d>>12&63]+Me[d>>6&63]+Me[63&d]}return b?C.slice(0,b-3)+"===".substring(b):C},si=le?a=>Buffer.from(a).toString("base64"):a=>{let d=[];for(let c=0,E=a.length;c<E;c+=4096)d.push(j.apply(null,a.subarray(c,c+4096)));return io(d.join(""))},ld=(a,d=!1)=>d?eo(si(a)):si(a),Es=a=>{if(a.length<2){var d=a.charCodeAt(0);return d<128?a:d<2048?j(192|d>>>6)+j(128|63&d):j(224|d>>>12&15)+j(128|d>>>6&63)+j(128|63&d)}var d=65536+(a.charCodeAt(0)-55296)*1024+(a.charCodeAt(1)-56320);return j(240|d>>>18&7)+j(128|d>>>12&63)+j(128|d>>>6&63)+j(128|63&d)},Cs=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,As=a=>a.replace(Cs,Es),oo=le?a=>Buffer.from(a,"utf8").toString("base64"):Qi?a=>si(Qi.encode(a)):a=>io(As(a)),_s=(a,d=!1)=>d?eo(oo(a)):oo(a),xs=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Ss=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 j((d>>>10)+55296)+j((1023&d)+56320);case 3:return j((15&a.charCodeAt(0))<<12|(63&a.charCodeAt(1))<<6|63&a.charCodeAt(2));default:return j((31&a.charCodeAt(0))<<6|63&a.charCodeAt(1))}},Ms=a=>a.replace(xs,Ss),ao=typeof atob=="function"?a=>atob(ro(a)):le?a=>Buffer.from(a,"base64").toString("binary"):a=>{if(a=a.replace(/\s+/g,""),!bs.test(a))throw TypeError("malformed base64.");a+="==".slice(2-(3&a.length));let d,c="",E,x;for(let C=0;C<a.length;)d=ir[a.charAt(C++)]<<18|ir[a.charAt(C++)]<<12|(E=ir[a.charAt(C++)])<<6|(x=ir[a.charAt(C++)]),c+=E===64?j(d>>16&255):x===64?j(d>>16&255,d>>8&255):j(d>>16&255,d>>8&255,255&d);return c},so=le?a=>to(Buffer.from(a,"base64")):a=>to(ao(a).split("").map(d=>d.charCodeAt(0))),dd=a=>so(no(a)),Ps=le?a=>Buffer.from(a,"base64").toString("utf8"):Ji?a=>Ji.decode(so(a)):a=>Ms(ao(a)),no=a=>ro(a.replace(/[-_]/g,d=>d=="-"?"+":"/")),ws=a=>Ps(no(a)),cd=a=>({value:a,enumerable:!1,writable:!0,configurable:!0}),lo={encode:_s,decode:ws},Ts={encode:function(a,d={}){let{urlSafe:c=!1}=d;return lo.encode(a,c)},decode:lo.decode},co="The provided `clientToken`",ks=`${co} has expired`,Ns=`${co} is malformed`,Is=(a,d,c)=>({"primer-client-token":a,"primer-sdk-client":"WEB","primer-sdk-version":"v2.53.6","primer-sdk-checkout-session-id":d,...c&&{"x-api-version":c}});async function Ls(a,d,c){let{accessToken:E,configurationUrl:x,analyticsUrlV2:C}=function(M){let D=function(B){try{let[lt,dt]=B.split(".");return JSON.parse(Ts.decode(dt||lt))}catch{throw Error(Ns)}}(M),F=1e3*D.exp;if(Date.now()>F)throw Error(`${ks}. Expiration date: ${new Date(F).toISOString()}`);return D}(a),b=ri({checkoutSessionId:d,url:C}),S=f,L=S!==s.LEGACY?S:"2.3";b.timerStart({id:"CONFIGURATION_LOADING"});try{let{data:M,source:D}=await vs(`${x}/?withDisplayMetadata=true`,{checkoutSessionId:d,headers:Is(E,d,L),retryConfig:{enabled:!0},cacheConfig:c});return b.timerEnd({id:"CONFIGURATION_LOADING",context:{source:D}}),M}catch(M){let D=M instanceof Error?M.message:"Unknown error occurred";throw Error(`Failed to initialize client: ${D}`)}}function po(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 or({checkoutSessionId:a,analytics:d,error:c,reporter:E}){d?.crashEvent?d.crashEvent({...po(c),reporter:E}):a&&ni(a,c,E)}async function ni(a,d,c){let E=await Ki(H.CRASH_EVENT,{...po(d),reporter:c},{checkoutSessionId:a});try{await fetch(_,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)})}catch(x){console.error("Failed to post crash event",x)}}let mo=Symbol.for("initGlobalErrorMonitoringLoaded"),ho=(a,d)=>{typeof window<"u"&&window[mo]||(window[mo]=!0,window.addEventListener("error",c=>{!Rs(c)&&$s(c)&&or({checkoutSessionId:a,analytics:d,error:c.error,reporter:"window.onerror"})}),window.addEventListener("unhandledrejection",c=>{let E=c.reason||Error("Unhandled promise rejection");Os(E)&&or({checkoutSessionId:a,analytics:d,error:E,reporter:"unhandledrejection"})}))},Rs=a=>a.message==="Script error."||!a.filename||a.lineno===0,$s=a=>{let d=a.filename;return!!(d&&li(d))&&!!new m(a.error).isReported||!1},Os=a=>{if(a&&typeof a=="object"&&"stack"in a&&typeof a.stack=="string"){let d=m.from(a);return!d.isReported&&(!!("fileName"in a&&typeof a.fileName=="string"&&li(a.fileName))||Ds(d.stack).some(li))}return!1},li=a=>{try{return new URL(a,window.location.origin).hostname.endsWith(".primer.io")}catch{return!1}},Ds=a=>{if(!a)return[];let d=a.split(`
2
+ `),c=[],E=/^\s*at\s+(?:.*?\s+)?\(?(.+?):\d+:\d+\)?$/;for(let x of d){let C=x.match(E);if(C&&C[1])c.push(C[1]);else{let b=/@(.*?):\d+:\d+$/,S=x.match(b);S&&S[1]&&c.push(S[1])}}return c};function uo(a,d,c){return document.querySelector(`${a}[${d}^="${c}"]`)}async function fo(a,d,c,E,x,C){let{analytics:b,name:S=d,retryConfig:L}=C;await Wi(()=>new Promise((M,D)=>{let F=uo(a,c,d)||function(B,lt){let dt=document.createElement(B);return Object.entries(lt).forEach(([rt,de])=>dt.setAttribute(rt,de)),dt}(a,{...E,[c]:d});F.onload=()=>{b?.sdkFunctionEvent({name:S,params:[`${a.charAt(0).toUpperCase()+a.slice(1)} loaded successfully: ${d}`]}),M()},F.onerror=()=>{F.remove(),D(Error(`${x}: ${d}`))},F.parentNode||document.head.appendChild(F)}),L,M=>b?.messageEvent({...M,url:d}))}async function go(a){return i||(i=Promise.all([function(d,c={}){return uo("script","src",d)&&window.__Primer?(c.analytics?.sdkFunctionEvent({name:c.name??d,params:["Script already loaded"]}),Promise.resolve()):fo("script",d,"src",{...c.attributes,async:"",crossorigin:"anonymous"},"Can't load Primer SDK",c)}("https://sdk.primer.io/web/v2.53.6/PrimerCoreSDK.min.js",{analytics:a,name:"loadPrimerScript"}),function(d,c={}){return Array.from(document.styleSheets).some(E=>E.href===d)?(c.analytics?.sdkFunctionEvent({name:c.name??d,params:["Stylesheet already loaded"]}),Promise.resolve()):fo("link",d,"href",{...c.attributes,rel:"stylesheet"},"Can't load Primer SDK's Stylesheet",c)}("https://sdk.primer.io/web/v2.53.6/Checkout.css",{analytics:a,name:"loadPrimerCss"})]).then(()=>{let d=window.__Primer;return delete window.__Primer,d}).catch(d=>{throw i=void 0,d}))}let Vs=async()=>{let a=ai();try{let d=ne(a);try{ho(a,d),d.sdkFunctionEvent({name:"preloadPrimer"}),d.timerStart({id:O.preloadPrimer}),await go(d),d.timerEnd({id:O.preloadPrimer})}catch(c){let E=m.from(c);throw E.isReported||(or({checkoutSessionId:a,analytics:d,error:E,reporter:"preloadPrimer level 1"}),E.markAsReported()),E}}catch(d){let c=m.from(d);throw c.isReported||(ni(a,c,"preloadPrimer level 0"),c.markAsReported()),c}},Hs=di("createHeadless"),Us=di("showUniversalCheckout"),Ys=di("showVaultManager");function di(a){return async(...[d,c,...E])=>{var x;(x=c?.apiVersion)||console.warn(`[Primer SDK] No API version was explicitly set. Defaulting to '${l}'.`),f=x??l;let C=ai();try{let b=ne(C);try{ho(C,b),b.sdkFunctionEvent({name:a,params:[d,c,...E]}),b.timerStart({id:O[a]});let[S,L]=await Promise.all([Ls(d,C,c?.clientSessionCachingEnabled?{key:d,usePrimerSessionCacheTtlHeader:!0}:void 0),go(b)]);return L[a](S,C,d,c,...E)}catch(S){let L=m.from(S);throw L.isReported||(or({checkoutSessionId:C,analytics:b,error:L,reporter:"lazyLoad level 1"}),L.markAsReported()),L}}catch(b){let S=m.from(b);throw S.isReported||(ni(C,S,"lazyLoad level 0"),S.markAsReported()),S}}}var Fs=function(a){return a.CHECKOUT="CHECKOUT",a.HEADLESS_CHECKOUT="HEADLESS_CHECKOUT",a.MANAGE_PAYMENT_METHODS="MANAGE_PAYMENT_METHODS",a}({}),zs=function(a){return a.DEFAULT="DEFAULT",a.PREFER_VAULT="PREFER_VAULT",a}({}),Bs=function(a){return a.SUCCESS="AUTH_SUCCESS",a.FAILED="AUTH_FAILED",a.SKIPPED="SKIPPED",a.CHALLENGE="CHALLENGE",a}({});let Pe={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"},we={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"},Ks={SINGLE_USE:"SINGLE_USE",MULTI_USE:"MULTI_USE"};Pe.PAYPAL_VAULTED,we.PAYPAL,Pe.KLARNA_CUSTOMER_TOKEN,we.KLARNA,Pe.AUTOMATED_CLEARING_HOUSE,we.STRIPE_ACH,Pe.CARD,we.PAYMENT_CARD;var Gs=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 ar(a,d,c){return d in a?Object.defineProperty(a,d,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[d]=c,a}class sr extends m{static fromErrorCode(d,c){return new sr(d,c)}constructor(d,c){super(c.message),ar(this,"code",void 0),ar(this,"diagnosticsId",void 0),ar(this,"data",void 0),ar(this,"isFromDeveloper",void 0),this.code=d,this.diagnosticsId=c.diagnosticsId??null,this.data=c.data,this.isFromDeveloper=c.isFromDeveloper??!1,this.name="PrimerClientError",Error.captureStackTrace&&Error.captureStackTrace(this,sr)}}var js=function(a){return a.PAYMENT_METHOD="PAYMENT_METHOD",a.CHECK="CHECK",a}({});let qs=a=>{let d=a?.mandateData;return!!d&&"fullMandateText"in d};var Ws=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}({}),Zs=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.6",createHeadless:Hs,showUniversalCheckout:Us,showVaultManager:Ys,preloadPrimer:Vs};return o})())});import{createComponent as Nn}from"@lit/react";import In from"react";var nr=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 ce=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)}dispatchOnCheckoutComplete(t){this.dispatchEvent("primer-oncheckout-complete",{payment:t})}dispatchOnCheckoutFailure(t,e){this.dispatchEvent("primer-oncheckout-failure",{error:t,payment:e})}dispatchFormSubmitSuccess(t){this.dispatchEvent("primer-card-submit-success",{result:t})}dispatchFormSubmitErrors(t){this.dispatchEvent("primer-card-submit-errors",{errors:t})}};var Lt=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 pe=class{constructor(t,e,r,o){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,l)=>{this.unsubscribe&&(this.unsubscribe!==l&&(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,l)),this.unsubscribe=l},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 Lt(this.context,this.host,this.t,this.subscribe))}};var lr=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 ci=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},q=class extends lr{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[l,{consumerHost:f}]of this.subscriptions)s.has(l)||(s.add(l),f.dispatchEvent(new Lt(this.context,f,l,!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 ci(this.context,this.host))}};function P({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new pe(this,{context:i,callback:o=>{e.set.call(this,o)},subscribe:t})}):e.constructor.addInitializer(o=>{new pe(o,{context:i,callback:s=>{o[r]=s},subscribe:t})})}}var dr="cardNetworksContext";var me="clientOptionsContext";var he="computedStylesContext";var ct="headlessInstanceContext";var cr="klarnaCategoriesContext";var Q="managerContext";var ue="paymentMethodsContext";var G="sdkStateContext";var fe="vaultManagerContext";var Ao="vaultManagerCvvContext";var k=class k{static log(t,...e){k.enabled&&console.log(`%c${k.brandTag}%c ${t}`,k.brandStyle,k.styles.log,...e)}static info(t,...e){k.enabled&&console.info(`%c${k.brandTag}%c ${t}`,k.brandStyle,k.styles.info,...e)}static warn(t,...e){k.enabled&&console.warn(`%c${k.brandTag}%c ${t}`,k.brandStyle,k.styles.warn,...e)}static error(t,...e){k.enabled&&console.error(`%c${k.brandTag}%c ${t}`,k.brandStyle,k.styles.error,...e)}static debug(t,...e){k.enabled&&console.debug(`%c${k.brandTag}%c ${t}`,k.brandStyle,k.styles.debug,...e)}static table(t,e){k.enabled&&console.table(t,e)}static time(t){k.enabled&&console.time(`${k.brandTag} ${t}`)}static timeEnd(t){k.enabled&&console.timeEnd(`${k.brandTag} ${t}`)}};k.enabled=!0,k.defaultFont="font-family: Consolas, monospace; font-size: 12px;",k.brandTag="[PRIMER]",k.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+k.defaultFont,k.styles={log:"color: #4CAF50; "+k.defaultFont,info:"color: #2196F3; "+k.defaultFont,warn:"color: #FF9800; "+k.defaultFont,error:"color: #F44336; "+k.defaultFont,debug:"color: #9C27B0; "+k.defaultFont};var N=k;function tn(i,t,e,r){let o=i,s=e;return{dispatch:l=>{let f=t(o,l,s);o=f,r(f)},getState:()=>Object.freeze({...o}),setCallbacks:l=>{s={...s,...l}}}}function ke(i){return(t,e,r)=>{let o=i[e.type];if(!o)throw new Error(`No handler for action type: ${e.type}`);return o(t,e,r)}}var Yt=class{constructor(t,e,r,o,s=()=>{this.host.requestUpdate()}){this.host=t;this.stateHandler=s;this.host.addController(this),this._dispatcher=tn(e,r,o,l=>{this.stateHandler(l)})}get currentState(){return this._dispatcher.getState()}dispatch(t){this._dispatcher.dispatch(t)}setCallbacks(t){this._dispatcher.setCallbacks(t)}hostConnected(){}hostDisconnected(){}},pr=class{constructor(t){this.host=t;this._controllers=[];"addController"in this.host&&this.host.addController(this)}addController(t){this._controllers.push(t)}hostConnected(){this._controllers.forEach(t=>{t.hostConnected&&t.hostConnected()})}hostDisconnected(){this._controllers.forEach(t=>{t.hostDisconnected&&t.hostDisconnected()})}};var hr={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},en={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,t)=>(N.error(t.payload.message),{...i,isProcessing:!1,error:t.payload}),SET_FAILURE:(i,t)=>({...i,isProcessing:!1,failure:t.payload}),COMPLETE_LOADING:i=>({...i,isLoading:!1}),RESET:()=>hr,RESET_ERROR:i=>({...i,error:null,failure:null})},rn=ke(en),mr=class extends Yt{constructor(t){super(t,hr,rn,null,e=>{t.sdkContextController.setSdkState(e),t.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"})}resetError(){this.dispatch({type:"RESET_ERROR"})}forceCompleteLoading(){this.currentState.isLoading&&(N.warn("Force completing loading state"),this.completeLoading())}};var ur=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 q(t,{context:G,initialValue:hr}),this.paymentMethodsProvider=new q(t,{context:ue,initialValue:null}),this.paymentManagerProvider=new q(t,{context:Q,initialValue:new Map}),this.cardNetworksContext=new q(t,{context:dr,initialValue:null}),this.vaultManagerProvider=new q(t,{context:fe,initialValue:null}),this.vaultManagerCvvProvider=new q(t,{context:Ao,initialValue:null}),this.clientOptionsContext=new q(t,{context:me,initialValue:null}),this.klarnaCategoriesProvider=new q(t,{context:cr,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new q(t,{context:ct,initialValue:null}),this.computedStylesProvider=new q(t,{context:he,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 Ft=class Ft{constructor(t){(this.host=t).addController(this)}processCustomStyles(t){try{let e=JSON.parse(t);this.applyStyles(e)}catch(e){N.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||N.warn(`Rejected potentially unsafe CSS value: ${t}`),r}getCssVarName(t){let e=Ft.cssVarCache.get(t);return e||(e="--"+t.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),Ft.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)){N.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 Ft.cssVarCache.keys()){let e=Ft.cssVarCache.get(t);e&&this.host.style.removeProperty(e)}}hostDisconnected(){}};Ft.cssVarCache=new Map;var fr=Ft;var gr=globalThis,yr=gr.ShadowRoot&&(gr.ShadyCSS===void 0||gr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,pi=Symbol(),_o=new WeakMap,Ne=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==pi)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(yr&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=_o.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&_o.set(e,t))}return t}toString(){return this.cssText}},xo=i=>new Ne(typeof i=="string"?i:i+"",void 0,pi),g=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,o,s)=>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[s+1],i[0]);return new Ne(e,i,pi)},mi=(i,t)=>{if(yr)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=gr.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},vr=yr?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return xo(e)})(i):i;var{is:on,defineProperty:an,getOwnPropertyDescriptor:sn,getOwnPropertyNames:nn,getOwnPropertySymbols:ln,getPrototypeOf:dn}=Object,Rt=globalThis,So=Rt.trustedTypes,cn=So?So.emptyScript:"",pn=Rt.reactiveElementPolyfillSupport,Ie=(i,t)=>i,Le={toAttribute(i,t){switch(t){case Boolean:i=i?cn: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}},ge=(i,t)=>!on(i,t),Mo={attribute:!0,type:String,converter:Le,reflect:!1,hasChanged:ge};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Rt.litPropertyMetadata??(Rt.litPropertyMetadata=new WeakMap);var Ct=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=Mo){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&&an(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:s}=sn(this.prototype,t)??{get(){return this[e]},set(l){this[e]=l}};return{get(){return o?.call(this)},set(l){let f=o?.call(this);s.call(this,l),this.requestUpdate(t,f,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Mo}static _$Ei(){if(this.hasOwnProperty(Ie("elementProperties")))return;let t=dn(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Ie("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ie("properties"))){let e=this.properties,r=[...nn(e),...ln(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(vr(o))}else t!==void 0&&e.push(vr(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 mi(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:Le).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),l=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Le;this._$Em=o,this[o]=l.fromAttribute(e,s.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??ge)(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){}};Ct.elementStyles=[],Ct.shadowRootOptions={mode:"open"},Ct[Ie("elementProperties")]=new Map,Ct[Ie("finalized")]=new Map,pn?.({ReactiveElement:Ct}),(Rt.reactiveElementVersions??(Rt.reactiveElementVersions=[])).push("2.0.4");var $t={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},R=Symbol(),V=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??Po,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(l){s=!0,r=l}if(this.p===o){if(e===R)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)}}},Po=(i,t)=>i===t||i.length===t.length&&i.every((e,r)=>!ge(e,t[r]));var mn={SET_LOADING:(i,t)=>({...i,isLoading:t.payload}),SET_UPDATING:(i,t)=>({...i,isUpdating:t.payload}),INITIALIZE_VAULT_MANAGER:(i,t,e)=>({...i,enabled:t.vaultEnabled,cvvRecapture:t.cvvRecapture,deleteVaultedPaymentMethod:e.deleteVaultedPaymentMethod,startVaultedPaymentFlow:e.startVaultedPaymentFlow,createCvvInput:e.createCvvInput}),UPDATE_PAYMENT_METHODS:(i,t)=>({...i,vaultedPaymentMethods:t.payload,isLoading:!1,isUpdating:!1}),SET_ERROR:i=>({...i,isLoading:!1,isUpdating:!1}),DISABLE:i=>({...i,enabled:!1}),RESET:()=>wo},hn={INITIALIZE_CVV:(i,t,e)=>({...i,setCvvInput:e.setCvvInput,setSelectedVaultedPaymentMethod:e.setSelectedVaultedPaymentMethod}),SET_FORM_DIRTY:(i,t)=>({...i,formIsDirty:t.payload}),SET_CVV_INPUT:(i,t)=>({...i,cvvInput:t.payload}),SET_SELECTED_VAULTED_PAYMENT_METHOD:(i,t)=>({...i,selectedVaultedPaymentMethod:t.payload}),RESET_CVV:()=>To},un=ke(mn),fn=ke(hn),wo={enabled:!1,isLoading:!1,isUpdating:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:null,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},To={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}},hi=class extends Yt{constructor(t,e){super(t,wo,un,e,r=>{t.sdkContextController.setVaultManager(r)})}setLoading(t){this.dispatch({type:"SET_LOADING",payload:t})}setUpdating(t){this.dispatch({type:"SET_UPDATING",payload:t})}initializeVaultManager(t,e,r){this.dispatch({type:"INITIALIZE_VAULT_MANAGER",payload:t,vaultEnabled:e,cvvRecapture:r})}updatePaymentMethods(t){this.dispatch({type:"UPDATE_PAYMENT_METHODS",payload:t})}setError(t){this.dispatch({type:"SET_ERROR",payload:t})}disable(){this.dispatch({type:"DISABLE"})}reset(){this.dispatch({type:"RESET"})}},ui=class extends Yt{constructor(t,e){super(t,To,fn,e,r=>{t.sdkContextController.setVaultManagerCvv(r)})}initializeCvv(t){this.dispatch({type:"INITIALIZE_CVV",createCvvInput:t})}setFormDirty(t){this.dispatch({type:"SET_FORM_DIRTY",payload:t})}setCvvInputState(t){this.dispatch({type:"SET_CVV_INPUT",payload:t})}setSelectedPaymentMethod(t){this.dispatch({type:"SET_SELECTED_VAULTED_PAYMENT_METHOD",payload:t})}resetCvv(){this.dispatch({type:"RESET_CVV"})}},Re=class extends pr{constructor(e){super(e);this._vaultManager=null;this._options=null;this.deleteVaultedPaymentMethod=async e=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");try{this.coreController.updatePaymentMethods(this.vaultManagerState.vaultedPaymentMethods),await this._vaultManager.deleteVaultedPaymentMethod(e),await this.fetchVaultedPaymentMethods()}catch(r){throw this.coreController.setError(r instanceof Error?r:new Error("Failed to delete payment method")),r}};this.setCvvInput=e=>{this.itemController.setCvvInputState(e)};this.startVaultedPaymentFlow=async()=>{if(!this._vaultManager)throw new Error("Vault manager not initialized");let e=this.vaultItemState.selectedVaultedPaymentMethod,r=this.vaultManagerState.cvvRecapture,o=this.vaultItemState.cvvInput;if(!e||r&&(!o||o.metadata.error)){this.itemController.setFormDirty(!0);return}this.host.sdkStateController.startProcessing();try{await this._vaultManager.startPaymentFlow(e.id,r?{cvv:o.valueToken}:void 0)}catch(s){N.error("VaultManagerController: Error starting vaulted payment flow",s),this.coreController.setError(s instanceof Error?s:new Error("Failed to start vaulted payment flow")),this.host.sdkStateController.stopProcessing()}};this.setSelectedVaultedPaymentMethod=e=>{this.itemController.setSelectedPaymentMethod(e),this.itemController.setFormDirty(!1)};this.coreController=new hi(e,{deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod.bind(this),startVaultedPaymentFlow:this.startVaultedPaymentFlow.bind(this),createCvvInput:this.createCvvInput.bind(this)}),this.itemController=new ui(e,{setCvvInput:this.setCvvInput.bind(this),setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod.bind(this)}),this.addController(this.coreController),this.addController(this.itemController),new V(this.host,{task:async([r,o])=>{if(!r||!o?.vaultEnabled)return this.coreController.disable(),R;this.coreController.setLoading(!0);try{this.coreController.initializeVaultManager(r,o.vaultEnabled,!!o.captureVaultedCardCvv),this.itemController.initializeCvv(r.createCvvInput),await this.fetchVaultedPaymentMethods(!0),N.log("VaultManagerController: Vault initialized successfully",{coreState:this.coreController.currentState,cvvState:this.itemController.currentState})}catch(s){N.error("VaultManagerController: Failed to initialize vault",s),this.coreController.setError(s instanceof Error?s:new Error("Unknown error"))}return this._vaultManager},args:()=>[this.vaultManager,this.options]})}initializeVaultManager(e,r){this.vaultManager=e,this.options=r??null}get vaultManager(){return this._vaultManager}set vaultManager(e){this._vaultManager=e,this.host.requestUpdate()}get options(){return this._options}set options(e){this._options=e,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(e){if(!this._vaultManager)throw new Error("Vault manager not initialized");try{e||this.coreController.setUpdating(!0);let r=await this._vaultManager.fetchVaultedPaymentMethods();return N.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(e){if(!this._vaultManager)throw new Error("Vault manager not initialized");return this._vaultManager.createCvvInput(e)}};var $e="lit-localize-status";var ko=i=>typeof i!="string"&&"strTag"in i,br=(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 Oe=i=>ko(i)?br(i.strings,i.values):i;var T=Oe,No=!1;function fi(i){if(No)throw new Error("lit-localize can only be configured once");T=i,No=!0}var gi=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener($e,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener($e,this.__litLocalizeEventHandler)}},gn=i=>i.addController(new gi(i)),Io=gn;var z=()=>(i,t)=>(i.addInitializer(Io),i);var De=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 At=[];for(let i=0;i<256;i++)At[i]=(i>>4&15).toString(16)+(i&15).toString(16);function Lo(i){let t=0,e=8997,r=0,o=33826,s=0,l=40164,f=0,m=52210;for(let _=0;_<i.length;_++)e^=i.charCodeAt(_),t=e*435,r=o*435,s=l*435,f=m*435,s+=e<<8,f+=o<<8,r+=t>>>16,e=t&65535,s+=r>>>16,o=r&65535,m=f+(s>>>16)&65535,l=s&65535;return At[m>>8]+At[m&255]+At[l>>8]+At[l&255]+At[o>>8]+At[o&255]+At[e>>8]+At[e&255]}var yn="",vn="h",bn="s";function Ro(i,t){return(t?vn:bn)+Lo(typeof i=="string"?i:i.join(yn))}var $o=new WeakMap,Oo=new Map;function Do(i,t,e){if(i){let r=e?.id??En(t),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return br(o.strings,t.values,o.values);{let s=$o.get(o);return s===void 0&&(s=o.values,$o.set(o,s)),{...o,values:s.map(l=>t.values[l])}}}}return Oe(t)}function En(i){let t=typeof i=="string"?i:i.strings,e=Oo.get(t);return e===void 0&&(e=Ro(t,typeof i!="string"&&!("strTag"in i)),Oo.set(t,e)),e}function yi(i){window.dispatchEvent(new CustomEvent($e,{detail:i}))}var Cr="",vi,Vo,Ar,bi,Ho,zt=new De;zt.resolve();var Er=0,Uo=i=>(fi((t,e)=>Do(Ho,t,e)),Cr=Vo=i.sourceLocale,Ar=new Set(i.targetLocales),Ar.add(i.sourceLocale),bi=i.loadLocale,{getLocale:Cn,setLocale:An}),Cn=()=>Cr,An=i=>{if(i===(vi??Cr))return zt.promise;if(!Ar||!bi)throw new Error("Internal error");if(!Ar.has(i))throw new Error("Invalid locale code");Er++;let t=Er;return vi=i,zt.settled&&(zt=new De),yi({status:"loading",loadingLocale:i}),(i===Vo?Promise.resolve({templates:void 0}):bi(i)).then(r=>{Er===t&&(Cr=i,vi=void 0,Ho=r.templates,yi({status:"ready",readyLocale:i}),zt.resolve())},r=>{Er===t&&(yi({status:"error",errorLocale:i,errorMessage:r.toString()}),zt.reject(r))}),zt.promise};var Ei="en",Ci=["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"],Yo="You must call `loadLocale` first to set up the localized template.",Fo,_r,zo=i=>{let t=Uo({sourceLocale:Ei,targetLocales:Ci,loadLocale:i});Fo=t.getLocale,_r=t.setLocale};var Ai=i=>{zo(i)},_i=i=>{if(!_r)throw new Error(Yo);return _r(i)};var Ve=new Set(Ci);Ve.add(Ei);var xi=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let t=i.replace("_","-");if(Ve.has(t))return!0;let e=t.split("-")[0];return!!Ve.has(e)},Si=i=>{if(i==="en")return"en-GB";let t=i.replace("_","-");if(Ve.has(t))return t;let e=t.split("-")[0];return Ve.has(e)?e:"en-GB"};var Ue=globalThis,xr=Ue.trustedTypes,Bo=xr?xr.createPolicy("lit-html",{createHTML:i=>i}):void 0,Pi="$lit$",_t=`lit$${Math.random().toFixed(9).slice(2)}$`,wi="?"+_t,_n=`<${wi}>`,Gt=document,Ye=()=>Gt.createComment(""),Fe=i=>i===null||typeof i!="object"&&typeof i!="function",Ti=Array.isArray,Zo=i=>Ti(i)||typeof i?.[Symbol.iterator]=="function",Mi=`[
3
+ \f\r]`,He=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ko=/-->/g,Go=/>/g,Bt=RegExp(`>|${Mi}(?:([^\\s"'>=/]+)(${Mi}*=${Mi}*(?:[^
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),jo=/'/g,qo=/"/g,Xo=/^(?:script|style|textarea|title)$/i,ki=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),h=ki(1),St=ki(2),Bp=ki(3),xt=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),Wo=new WeakMap,Kt=Gt.createTreeWalker(Gt,129);function Jo(i,t){if(!Ti(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Bo!==void 0?Bo.createHTML(t):t}var Qo=(i,t)=>{let e=i.length-1,r=[],o,s=t===2?"<svg>":t===3?"<math>":"",l=He;for(let f=0;f<e;f++){let m=i[f],_,w,A=-1,O=0;for(;O<m.length&&(l.lastIndex=O,w=l.exec(m),w!==null);)O=l.lastIndex,l===He?w[1]==="!--"?l=Ko:w[1]!==void 0?l=Go:w[2]!==void 0?(Xo.test(w[2])&&(o=RegExp("</"+w[2],"g")),l=Bt):w[3]!==void 0&&(l=Bt):l===Bt?w[0]===">"?(l=o??He,A=-1):w[1]===void 0?A=-2:(A=l.lastIndex-w[2].length,_=w[1],l=w[3]===void 0?Bt:w[3]==='"'?qo:jo):l===qo||l===jo?l=Bt:l===Ko||l===Go?l=He:(l=Bt,o=void 0);let H=l===Bt&&i[f+1].startsWith("/>")?" ":"";s+=l===He?m+_n:A>=0?(r.push(_),m.slice(0,A)+Pi+m.slice(A)+_t+H):m+_t+(A===-2?f:H)}return[Jo(i,s+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},ze=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let s=0,l=0,f=t.length-1,m=this.parts,[_,w]=Qo(t,e);if(this.el=i.createElement(_,r),Kt.currentNode=this.el.content,e===2||e===3){let A=this.el.content.firstChild;A.replaceWith(...A.childNodes)}for(;(o=Kt.nextNode())!==null&&m.length<f;){if(o.nodeType===1){if(o.hasAttributes())for(let A of o.getAttributeNames())if(A.endsWith(Pi)){let O=w[l++],H=o.getAttribute(A).split(_t),ht=/([.?@])?(.*)/.exec(O);m.push({type:1,index:s,name:ht[2],strings:H,ctor:ht[1]==="."?Mr:ht[1]==="?"?Pr:ht[1]==="@"?wr:qt}),o.removeAttribute(A)}else A.startsWith(_t)&&(m.push({type:6,index:s}),o.removeAttribute(A));if(Xo.test(o.tagName)){let A=o.textContent.split(_t),O=A.length-1;if(O>0){o.textContent=xr?xr.emptyScript:"";for(let H=0;H<O;H++)o.append(A[H],Ye()),Kt.nextNode(),m.push({type:2,index:++s});o.append(A[O],Ye())}}}else if(o.nodeType===8)if(o.data===wi)m.push({type:2,index:s});else{let A=-1;for(;(A=o.data.indexOf(_t,A+1))!==-1;)m.push({type:7,index:s}),A+=_t.length-1}s++}}static createElement(t,e){let r=Gt.createElement("template");return r.innerHTML=t,r}};function jt(i,t,e=i,r){if(t===xt)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,s=Fe(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=jt(i,o._$AS(i,t.values),o,r)),t}var Sr=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??Gt).importNode(e,!0);Kt.currentNode=o;let s=Kt.nextNode(),l=0,f=0,m=r[0];for(;m!==void 0;){if(l===m.index){let _;m.type===2?_=new ye(s,s.nextSibling,this,t):m.type===1?_=new m.ctor(s,m.name,m.strings,this,t):m.type===6&&(_=new Tr(s,this,t)),this._$AV.push(_),m=r[++f]}l!==m?.index&&(s=Kt.nextNode(),l++)}return Kt.currentNode=Gt,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++}},ye=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=jt(this,t,e),Fe(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==xt&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Zo(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&&Fe(this._$AH)?this._$AA.nextSibling.data=t:this.T(Gt.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=ze.createElement(Jo(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let s=new Sr(o,this),l=s.u(this.options);s.p(e),this.T(l),this._$AH=s}}_$AC(t){let e=Wo.get(t.strings);return e===void 0&&Wo.set(t.strings,e=new ze(t)),e}k(t){Ti(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(Ye()),this.O(Ye()),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))}},qt=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,l=!1;if(s===void 0)t=jt(this,t,e,0),l=!Fe(t)||t!==this._$AH&&t!==xt,l&&(this._$AH=t);else{let f=t,m,_;for(t=s[0],m=0;m<s.length-1;m++)_=jt(this,f[r+m],e,m),_===xt&&(_=this._$AH[m]),l||(l=!Fe(_)||_!==this._$AH[m]),_===u?t=u:t!==u&&(t+=(_??"")+s[m+1]),this._$AH[m]=_}l&&!o&&this.j(t)}j(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Mr=class extends qt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===u?void 0:t}},Pr=class extends qt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==u)}},wr=class extends qt{constructor(t,e,r,o,s){super(t,e,r,o,s),this.type=5}_$AI(t,e=this){if((t=jt(this,t,e,0)??u)===xt)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)}},Tr=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){jt(this,t)}},ta={M:Pi,P:_t,A:wi,C:1,L:Qo,R:Sr,D:Zo,V:jt,I:ye,H:qt,N:Pr,U:wr,B:Mr,F:Tr},xn=Ue.litHtmlPolyfillSupport;xn?.(ze,ye),(Ue.litHtmlVersions??(Ue.litHtmlVersions=[])).push("3.2.1");var ea=(i,t,e)=>{let r=e?.renderBefore??t,o=r._$litPart$;if(o===void 0){let s=e?.renderBefore??null;r._$litPart$=o=new ye(t.insertBefore(Ye(),s),s,void 0,e??{})}return o._$AI(i),o};var y=class extends Ct{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=ea(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return xt}};y._$litElement$=!0,y.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:y});var Sn=globalThis.litElementPolyfillSupport;Sn?.({LitElement:y});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");var v=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var Mn={attribute:!0,type:String,converter:Le,reflect:!1,hasChanged:ge},Pn=(i=Mn,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:l}=e;return{set(f){let m=t.get.call(this);t.set.call(this,f),this.requestUpdate(l,m,i)},init(f){return f!==void 0&&this.P(l,void 0,i),f}}}if(r==="setter"){let{name:l}=e;return function(f){let m=this[l];t.call(this,f),this.requestUpdate(l,m,i)}}throw Error("Unsupported decorator location: "+r)};function p(i){return(t,e)=>typeof e=="object"?Pn(i,t,e):((r,o,s)=>{let l=o.hasOwnProperty(s);return o.constructor.createProperty(s,l?{...r,wrapped:!0}:r),l?Object.getOwnPropertyDescriptor(o,s):void 0})(i,t,e)}function I(i){return p({...i,state:!0,attribute:!1})}var Wt=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function Ot(i,t){return(e,r,o)=>{let s=l=>l.renderRoot?.querySelector(i)??null;if(t){let{get:l,set:f}=typeof r=="object"?e:o??(()=>{let m=Symbol();return{get(){return this[m]},set(_){this[m]=_}}})();return Wt(e,r,{get(){let m=l.call(this);return m===void 0&&(m=s(this),(m!==null||this.hasUpdated)&&f.call(this,m)),m}})}return Wt(e,r,{get(){return s(this)}})}}function U(i,t,e){return i?t(i):e?.(i)}var $=g`
5
+ * {
6
+ box-sizing: border-box;
7
+ }
8
+ `,ra=g`
9
+ :host {
10
+ display: block;
11
+ isolation: isolate;
12
+ position: relative;
13
+ width: 100%;
14
+ //Keep the CSS loader in the same position - check css-loader-inline.ts
15
+ min-height: 64px;
16
+ }
17
+ `;var ia="https://sdk.primer.io/web/v2-latest/Primer.min.js";var kr=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 oa=typeof window<"u"&&typeof window.document<"u";function wn(i){return document.querySelector(`script[src^="${i}"]`)}function Tn(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 aa(i,t=!1){if(!oa)throw new Error("Cannot load script in server environment");let e=wn(i)??Tn(i,t);return new Promise((r,o)=>{e.onload=()=>{r()},e.onerror=()=>{o()},e.parentNode||document.head.appendChild(e)})}var Nr=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 V(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new V(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.currentState.isLoading&&(N.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(),N.info("SDK instance cleaned up")}catch(t){N.error("Error cleaning up SDK instance:",t)}this.currentSdkInstance=null}async _loadV2Sdk(t=ia){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){N.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await aa(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(this.isDisconnected)return N.warn("Component disconnected, aborting SDK initialization"),R;if(!t||!e)return R;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window,o=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:l=>{this.isDisconnected||(N.info("Configuration payment methods:",l),this.paymentsList=l)},onCheckoutComplete:({payment:l})=>{this.isDisconnected||(N.info("Payment completed:",l),this.host.sdkStateController.completeProcessing(),this.host.primerEventsController.dispatchOnCheckoutComplete(l))},onCheckoutFail:(l,f)=>{this.isDisconnected||(N.error("Payment failed:",l),this.host.sdkStateController.setFailure(l.code||"UNKNOWN_ERROR",l.message||"Unknown error occurred"),this.host.primerEventsController.dispatchOnCheckoutFailure(l,f.payment))},onBeforePaymentCreate:(l,f)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),f?.continuePaymentCreation())},onPaymentMethodAction:(l,f)=>{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(),R;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&&(N.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([t,e])=>{if(this.isDisconnected)return R;if(!t||!e.length)return R;let r=new Map,o=new Map;try{for(let l of e){if(this.isDisconnected)break;let f=await this.initializePaymentMethodManager(l)();l&&f&&(r.set(l.type,l),o.set(l.type,f))}if(this.isDisconnected)return R;let s=new kr(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(s),this.host.primerEventsController.dispatchPaymentMethods(s),N.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("KLARNA",{onPaymentMethodCategoriesChange:s=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:s,isLoading:!1})}});return o?{type:e,manager:o}:null}try{if(r==="CARD"){let s=await this.createPaymentMethodManager(e,{onCardNetworksChange:async l=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(l)},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 N.error(`Failed to initialize manager for ${e}:`,o),null}}}};var Ir=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 kn=Eo({"../../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")});Ai(i=>kn(`../../localization/lit-localize/locales/${i}.ts`));var Lr={LOADER_DISABLED:"loader-disabled",CUSTOM_STYLES:"custom-styles",CLIENT_TOKEN:"client-token",JS_INIT:"js-initialized"},it=class extends y{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 ur(this),this.sdkStateController=new mr(this),this.primerEventsController=new ce(this),this.styleProcessingController=new fr(this),this.vaultManagerController=new Re(this),this.cardNetworkController=new nr(this),this.achPaymentEventsController=new Ir(this),new Nr(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,o){e===Lr.CUSTOM_STYLES?this.styleProcessingController.processCustomStyles(o):super.attributeChangedCallback(e,r,o)}disconnectedCallback(){this._loadingTimeoutId&&(window.clearTimeout(this._loadingTimeoutId),this._loadingTimeoutId=null),this.sdkStateController?.currentState.isLoading&&this.sdkStateController.forceCompleteLoading(),super.disconnectedCallback()}willUpdate(e){e.has("options")&&(this.options?.locale&&(xi(this.options?.locale)?this.locale=Si(this.options?.locale):N.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),_i(this.locale||"en-GB"))}updated(){let e=getComputedStyle(this);this.sdkContextController.setComputedStyles(e),this.checkLoadingStateChange()}checkLoadingStateChange(){let e=this.sdkStateController?.currentState.isLoading||!1;this.previousLoadingState&&!e&&(this.jsInitialized=!0),this.previousLoadingState=e,e&&!this._loadingTimeoutId?this._loadingTimeoutId=window.setTimeout(()=>{this.sdkStateController?.currentState.isLoading&&(N.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.currentState,r=e.isLoading,o=e.error,s=!r&&!o;return h`
18
+ ${U(r,()=>u)}
19
+ ${U(o,()=>h`<primer-checkout-error></primer-checkout-error>`)}
20
+ ${U(s,()=>h`
21
+ <slot name="main" @slotchange=${this.onSlotChange}></slot>
22
+ ${U(this.hasAssignedContent,()=>u,()=>h`<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)}};it.styles=[$,ra],n([p({type:String,attribute:Lr.CUSTOM_STYLES})],it.prototype,"customStyles",2),n([p({type:String,attribute:Lr.CLIENT_TOKEN})],it.prototype,"clientToken",2),n([p({type:Object})],it.prototype,"options",2),n([p({type:Boolean,reflect:!0,attribute:Lr.JS_INIT})],it.prototype,"_jsInitialized",2),n([Ot("slot")],it.prototype,"defaultSlot",2),n([I()],it.prototype,"previousLoadingState",2),it=n([z(),v("primer-checkout")],it);var Eh=Nn({tagName:"primer-checkout",elementClass:it,react:In});import{createComponent as Ln}from"@lit/react";import Rn from"react";var sa=g`
25
+ :host {
26
+ display: flex;
27
+ flex-direction: column;
28
+ align-items: center;
29
+ gap: var(--primer-space-xsmall);
30
+ }
31
+
32
+ p {
33
+ margin: 0;
34
+
35
+ color: var(--primer-color-text-primary);
36
+ text-align: center;
37
+ font-size: var(--primer-typography-body-large-size);
38
+ font-family: var(--primer-typography-body-large-font);
39
+ font-weight: var(--primer-typography-body-large-weight);
40
+ line-height: var(--primer-typography-body-large-line-height);
41
+ letter-spacing: var(--primer-typography-body-large-letter-spacing);
42
+ }
43
+
44
+ p.secondary {
45
+ color: var(--primer-color-text-secondary);
46
+ text-align: center;
47
+ font-family: var(--primer-typography-body-medium-font, Inter);
48
+ font-size: var(--primer-typography-body-medium-size);
49
+ font-weight: var(--primer-typography-body-medium-weight);
50
+ line-height: var(--primer-typography-body-medium-line-height);
51
+ letter-spacing: var(--primer-typography-body-medium-letter-spacing);
52
+ }
53
+ `;var Mt=class extends y{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?h`
54
+ <!-- Successful view -->
55
+ <primer-icon
56
+ size="lg"
57
+ name="successful-check"
58
+ color="var(--primer-color-icon-positive)"
59
+ >
60
+ </primer-icon>
61
+ <p>Checkout complete!</p>
62
+ <p class="secondary">
63
+ You'll be redirected to the order confirmation page soon.
64
+ </p>
65
+ `:h`
66
+ <primer-icon
67
+ size="lg"
68
+ name="failure-icon"
69
+ color="var(--primer-color-icon-negative)"
70
+ >
71
+ </primer-icon>
72
+ <p>Payment failed</p>
73
+ ${this.description?h`<p class="secondary">${this.description}</p>`:h`<p class="secondary">Something went wrong.</p>`}
74
+ `}};Mt.styles=[sa],n([p({type:String,reflect:!0})],Mt.prototype,"type",2),n([p({type:String,reflect:!0})],Mt.prototype,"description",2),Mt=n([v("primer-checkout-state")],Mt);var Ih=Ln({tagName:"primer-checkout-state",elementClass:Mt,react:Rn});import{createComponent as $n}from"@lit/react";import On from"react";var na=g`
75
+ :host {
76
+ display: block;
77
+ }
78
+
79
+ .collapsable {
80
+ width: 100%;
81
+ }
82
+
83
+ /* Make the button display with full width */
84
+ primer-button::part(button) {
85
+ width: 100%;
86
+ }
87
+
88
+ .collapsable-wrapper {
89
+ display: grid;
90
+ grid-template-rows: 0fr;
91
+ transition: grid-template-rows var(--primer-animation-duration)
92
+ var(--primer-animation-easing);
93
+ overflow: hidden;
94
+ border-top: none;
95
+ margin-top: -1px;
96
+ }
97
+
98
+ .collapsable-wrapper.expanded {
99
+ grid-template-rows: 1fr;
100
+ }
101
+
102
+ .collapsable-content {
103
+ min-height: 0;
104
+ overflow: hidden;
105
+ padding: var(--primer-space-medium, 12px) 0;
106
+ }
107
+
108
+ .icon-container {
109
+ display: flex;
110
+ align-items: center;
111
+ justify-content: center;
112
+ transition: transform var(--primer-animation-duration)
113
+ var(--primer-animation-easing);
114
+ font-size: 0.75em;
115
+ }
116
+
117
+ .icon-container.expanded {
118
+ transform: rotate(180deg);
119
+ }
120
+
121
+ /* Disable animation for users who prefer reduced motion */
122
+ @media (prefers-reduced-motion: reduce) {
123
+ .collapsable-wrapper,
124
+ .icon-container {
125
+ transition: none;
126
+ }
127
+ }
128
+ `;var la=g`
129
+ :host {
130
+ display: contents;
131
+ }
132
+
133
+ button {
134
+ align-items: center;
135
+ border-radius: var(--primer-radius-medium);
136
+ border: none;
137
+ cursor: pointer;
138
+ display: flex;
139
+ font-family: var(--primer-typography-title-large-font);
140
+ font-size: var(--primer-typography-title-large-size);
141
+ font-weight: var(--primer-typography-title-large-weight);
142
+ gap: var(--primer-space-small);
143
+ justify-content: center;
144
+ letter-spacing: var(--primer-typography-title-large-letter-spacing);
145
+ line-height: var(--primer-typography-title-large-line-height);
146
+ outline: none;
147
+ padding: var(--primer-space-medium) var(--primer-space-medium);
148
+ position: relative;
149
+ transition: all 0.2s ease-in-out;
150
+ }
151
+
152
+ .button-content {
153
+ display: flex;
154
+ height: 100%;
155
+ align-items: center;
156
+ gap: var(--primer-space-small);
157
+ justify-content: center;
158
+ transition: opacity var(--primer-animation-duration)
159
+ var(--primer-animation-easing);
160
+ }
161
+
162
+ /* Reduce opacity of text during loading for better focus on the spinner */
163
+ .button-content.loading {
164
+ opacity: 0.65;
165
+ }
166
+
167
+ :host([selectable]) button {
168
+ justify-content: space-between;
169
+ }
170
+
171
+ /* Primary variant */
172
+ :host([variant='primary']) button {
173
+ background-color: var(--primer-color-brand);
174
+ /* This is correct (color-background for color) because Button is kind of a special component */
175
+ color: var(--primer-color-background-outlined-default);
176
+ }
177
+ :host([variant='primary']:not([disabled]):not([loading])) button:hover {
178
+ filter: brightness(105%);
179
+ }
180
+ :host([variant='primary']:not([disabled]):not([loading])) button:active {
181
+ filter: brightness(98%);
182
+ }
183
+ :host([variant='primary']) button:focus-visible {
184
+ outline: 2px solid var(--primer-color-brand);
185
+ outline-offset: 2px;
186
+ }
187
+
188
+ /* Disabled state for primary button */
189
+ :host([variant='primary'][disabled]:not([loading])) button,
190
+ :host([variant='primary']:not([loading])) button:disabled {
191
+ color: var(--primer-color-text-disabled);
192
+ background-color: var(--primer-color-background-outlined-disabled);
193
+ cursor: not-allowed;
194
+ }
195
+
196
+ /* Loading state for primary button - OVERRIDES disabled styles with higher specificity */
197
+ :host([variant='primary'][loading]) button {
198
+ background-color: var(--primer-color-brand);
199
+ opacity: 0.8;
200
+ color: var(--primer-color-background-outlined-default);
201
+ cursor: wait;
202
+ }
203
+
204
+ /* Secondary variant */
205
+ :host([variant='secondary']) button {
206
+ background-color: var(--primer-color-background-outlined-default);
207
+ color: var(--primer-color-text-primary);
208
+ border: 1px solid var(--primer-color-border-outlined-default);
209
+ }
210
+ :host([variant='secondary']:not([disabled]):not([loading])) button:hover {
211
+ background-color: var(--primer-color-background-outlined-hover);
212
+ }
213
+ :host([variant='secondary']:not([disabled]):not([loading])) button:active {
214
+ background-color: var(--primer-color-background-outlined-active);
215
+ }
216
+ :host([variant='secondary']) button:focus-visible {
217
+ outline: 2px solid var(--primer-color-border-outlined-focus);
218
+ outline-offset: 2px;
219
+ }
220
+
221
+ /* Disabled state for secondary button */
222
+ :host([variant='secondary'][disabled]:not([loading])) button,
223
+ :host([variant='secondary']:not([loading])) button:disabled {
224
+ background-color: var(--primer-color-background-outlined-disabled);
225
+ border-color: var(--primer-color-border-outlined-disabled);
226
+ color: var(--primer-color-text-disabled);
227
+ cursor: not-allowed;
228
+ }
229
+
230
+ /* Loading state for secondary button - OVERRIDES disabled styles */
231
+ :host([variant='secondary'][loading]) button {
232
+ background-color: var(--primer-color-gray-100);
233
+ border-color: var(--primer-color-gray-300);
234
+ color: var(--primer-color-gray-600);
235
+ cursor: wait;
236
+ }
237
+
238
+ /* Tertiary variant */
239
+ :host([variant='tertiary']) button {
240
+ background-color: var(--primer-color-background-transparent-default);
241
+ border: 1px solid var(--primer-color-border-transparent-default);
242
+ color: var(--primer-color-text-primary);
243
+ border-radius: var(--primer-radius-small);
244
+ padding: var(--primer-space-xxsmall) var(--primer-space-xxsmall);
245
+ }
246
+ :host([variant='tertiary']:not([disabled]):not([loading])) button:hover {
247
+ border-radius: var(--primer-radius-small);
248
+ background-color: var(--primer-color-background-transparent-hover);
249
+ border: 1px solid var(--primer-color-border-transparent-hover);
250
+ color: var(--primer-color-text-primary);
251
+ }
252
+ :host([variant='tertiary']:not([disabled]):not([loading])) button:active {
253
+ background-color: var(--primer-color-background-transparent-active);
254
+ border-color: var(--primer-color-border-transparent-active);
255
+ border-radius: var(--primer-radius-small);
256
+ color: var(--primer-color-text-primary);
257
+ }
258
+ :host([variant='tertiary']) button:focus-visible {
259
+ border-radius: var(--primer-radius-small);
260
+ background-color: var(--primer-color-background-transparent-focus);
261
+ outline: 2px solid var(--primer-color-border-transparent-focus);
262
+ outline-offset: 2px;
263
+ }
264
+
265
+ /* Disabled state for tertiary button */
266
+ :host([variant='tertiary'][disabled]:not([loading])) button,
267
+ :host([variant='tertiary']:not([loading])) button:disabled {
268
+ background-color: var(--primer-color-border-transparent-disabled);
269
+ color: var(--primer-color-text-disabled);
270
+ cursor: not-allowed;
271
+ }
272
+
273
+ /* Loading state for tertiary button - OVERRIDES disabled styles */
274
+ :host([variant='tertiary'][loading]) button {
275
+ background-color: var(--primer-color-gray-100);
276
+ color: var(--primer-color-gray-600);
277
+ cursor: wait;
278
+ }
279
+
280
+ /* Checked state styling */
281
+ :host([selectionState='checked']) button {
282
+ border: 1px solid var(--primer-color-brand);
283
+ background-color: var(--primer-color-gray-100);
284
+ }
285
+
286
+ /* Loading state - center spinner with content */
287
+ :host([loading]) primer-spinner {
288
+ margin-right: var(--primer-space-xsmall);
289
+ }
290
+
291
+ /* Special case for tertiary variant loading state spinner size */
292
+ :host([variant='tertiary'][loading]) primer-spinner {
293
+ transform: scale(0.85);
294
+ }
295
+ `;var tt=class extends y{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:h`
296
+ <primer-icon
297
+ name="checkmark"
298
+ size="sm"
299
+ color="var(--primer-color-icon-primary)"
300
+ ></primer-icon>
301
+ `}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)"),h`
302
+ <primer-spinner
303
+ size="small"
304
+ color="${e}"
305
+ compact
306
+ ></primer-spinner>
307
+ `}render(){return h`
308
+ <button
309
+ type=${this.buttonType}
310
+ ?disabled=${this.disabled||this.loading}
311
+ @click=${this.handleClick}
312
+ part="button"
313
+ aria-checked=${this.selectionState==="checked"}
314
+ aria-busy=${this.loading}
315
+ >
316
+ ${this.renderSpinner()}
317
+ <span class="button-content ${this.loading?"loading":""}">
318
+ <slot></slot>
319
+ </span>
320
+ ${this.renderCheckmark()}
321
+ </button>
322
+ `}};tt.styles=[$,la],n([p({type:String,reflect:!0})],tt.prototype,"variant",2),n([p({type:Boolean,reflect:!0})],tt.prototype,"disabled",2),n([p({type:Boolean,reflect:!0})],tt.prototype,"loading",2),n([p({type:String,attribute:"type"})],tt.prototype,"buttonType",2),n([p({type:String,reflect:!0})],tt.prototype,"selectionState",2),n([p({type:Boolean,reflect:!0})],tt.prototype,"selectable",2),tt=n([v("primer-button")],tt);var W=class extends y{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 h`
323
+ <div class="collapsable">
324
+ <primer-button
325
+ variant=${this.buttonVariant}
326
+ buttonType="button"
327
+ @click=${this.toggleExpanded}
328
+ aria-expanded=${this.isExpanded}
329
+ aria-controls="collapsable-content"
330
+ aria-label=${r}
331
+ >
332
+ <span>${o}</span>
333
+ </primer-button>
334
+
335
+ <div
336
+ class="collapsable-wrapper ${this.isExpanded?"expanded":""}"
337
+ id="collapsable-content"
338
+ role="region"
339
+ aria-labelledby="collapsable-header"
340
+ >
341
+ <div class="collapsable-content">
342
+ <slot></slot>
343
+ </div>
344
+ </div>
345
+ </div>
346
+ `}};W.styles=[na],n([p({type:String})],W.prototype,"header",2),n([p({type:Boolean})],W.prototype,"expanded",2),n([p({type:String})],W.prototype,"expandText",2),n([p({type:String})],W.prototype,"collapseText",2),n([p({type:String})],W.prototype,"ariaLabel",2),n([p({type:String})],W.prototype,"buttonVariant",2),n([I()],W.prototype,"isExpanded",2),W=n([v("primer-collapsable")],W);var eu=$n({tagName:"primer-collapsable",elementClass:W,react:On});import{createComponent as Dn}from"@lit/react";import Vn from"react";var da=g`
347
+ :host {
348
+ display: contents;
349
+ }
350
+
351
+ .backdrop {
352
+ position: absolute;
353
+ top: 0;
354
+ left: 0;
355
+ background-color: rgba(0, 0, 0, 0.5);
356
+ z-index: 1000;
357
+ display: flex;
358
+ justify-content: center;
359
+ align-items: center;
360
+ width: 100vw;
361
+ height: 100vh;
362
+ }
363
+
364
+ .dialog {
365
+ background-color: white;
366
+ padding: var(--primer-space-medium);
367
+ border-radius: var(--primer-radius-medium);
368
+ max-width: 600px;
369
+ }
370
+
371
+ .header {
372
+ display: flex;
373
+ justify-content: flex-end;
374
+ }
375
+ `;var Rr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Be=i=>(...t)=>({_$litDirective$:i,values:t}),ve=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 Z=Be(class extends ve{constructor(i){if(super(i),i.type!==Rr.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 xt}});var Zt=class extends y{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return h`
376
+ <div
377
+ class=${Z({backdrop:!0})}
378
+ @click=${t=>{t.preventDefault()}}
379
+ >
380
+ <div class="dialog">
381
+ <div class="header">
382
+ <primer-button variant="tertiary" @click=${this._handleCloseClick}>
383
+ <primer-icon name="close"></primer-icon>
384
+ </primer-button>
385
+ </div>
386
+ <div class="content">
387
+ <slot></slot>
388
+ </div>
389
+ </div>
390
+ </div>
391
+ `}};Zt.styles=[da],Zt=n([v("primer-dialog")],Zt);var Cu=Dn({tagName:"primer-dialog",elementClass:Zt,react:Vn});import{createComponent as Hn}from"@lit/react";import Un from"react";var ca=g`
392
+ :host {
393
+ display: block;
394
+ width: 100%;
395
+ box-sizing: border-box;
396
+ }
397
+
398
+ .error-message {
399
+ display: flex;
400
+ align-items: flex-start;
401
+ padding: var(--primer-space-medium);
402
+ background-color: var(--primer-color-red-100);
403
+ border-radius: var(--primer-radius-medium);
404
+ border: 1px solid var(--primer-color-border-outlined-error);
405
+ margin-top: var(--primer-space-small);
406
+ box-sizing: border-box;
407
+ width: 100%;
408
+
409
+ /* Add animation properties */
410
+ opacity: 1;
411
+ transform: translateY(0);
412
+ transition:
413
+ opacity var(--primer-animation-duration) var(--primer-animation-easing),
414
+ transform var(--primer-animation-duration) var(--primer-animation-easing);
415
+ }
416
+
417
+ .error-message.hidden {
418
+ opacity: 0;
419
+ transform: translateY(-var(--primer-space-medium));
420
+ pointer-events: none;
421
+ }
422
+
423
+ .error-icon {
424
+ flex-shrink: 0;
425
+ margin-right: var(--primer-space-medium);
426
+ color: var(--primer-color-icon-negative);
427
+ }
428
+
429
+ .error-content {
430
+ flex: 1;
431
+ font-family: var(--primer-typography-body-medium-font);
432
+ font-size: var(--primer-typography-body-medium-size);
433
+ font-weight: var(--primer-typography-body-medium-weight);
434
+ line-height: var(--primer-typography-body-medium-line-height);
435
+ letter-spacing: var(--primer-typography-body-medium-letter-spacing);
436
+ color: var(--primer-color-text-negative);
437
+ }
438
+
439
+ /* Respect user's preference for reduced motion */
440
+ @media (prefers-reduced-motion: reduce) {
441
+ .error-message {
442
+ transition: opacity var(--primer-animation-duration)
443
+ var(--primer-animation-easing);
444
+ transform: none;
445
+ }
446
+
447
+ .error-message.hidden {
448
+ transform: none;
449
+ }
450
+ }
451
+ `;var pa={pencil:St`
452
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
453
+ <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"/>
454
+ </svg>
455
+ `,trash:St`
456
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
457
+ <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"/>
458
+ <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"/>
459
+ <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"/>
460
+ </svg>
461
+ `,"successful-check":St`
462
+ <svg
463
+ viewBox="0 0 56 56"
464
+ fill="none"
465
+ xmlns="http://www.w3.org/2000/svg"
466
+ >
467
+ <g id="icon/check-circle-large">
468
+ <path
469
+ id="vector"
470
+ fill-rule="evenodd"
471
+ clip-rule="evenodd"
472
+ d="M20.1762 29.5746L24.8429 34.2413C25.295 34.7007 26.0387 34.7007 26.4908 34.2413L35.8241 24.9079C36.2835 24.4559 36.2835 23.7121 35.8241 23.26C35.372 22.8007 34.6283 22.8007 34.1762 23.26L25.6668 31.7694L21.8241 27.9267C21.372 27.4673 20.6283 27.4673 20.1762 27.9267C19.7168 28.3788 19.7168 29.1225 20.1762 29.5746ZM28.0002 47.4173C38.3106 47.4173 46.6668 39.0611 46.6668 28.7507C46.6668 18.4402 38.3106 10.084 28.0002 10.084C17.6897 10.084 9.3335 18.4402 9.3335 28.7507C9.3335 39.0611 17.6897 47.4173 28.0002 47.4173Z"
473
+ />
474
+ </g>
475
+ </svg>
476
+ `,"failure-icon":St`
477
+ <svg
478
+ viewBox="0 0 40 40"
479
+ fill="none"
480
+ xmlns="http://www.w3.org/2000/svg"
481
+ >
482
+ <path
483
+ fill-rule="evenodd"
484
+ clip-rule="evenodd"
485
+ 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"
486
+ />
487
+ </svg>
488
+ `,"payment-card":St`
489
+ <svg width="28" height="21" viewBox="0 0 28 21" fill="none" xmlns="http://www.w3.org/2000/svg">
490
+ <rect y="0.748047" width="28" height="20" rx="2" fill="#E0E0E0"/>
491
+ <rect y="6.74805" width="28" height="4" fill="#212121"/>
492
+ <rect x="19" y="13.748" width="6" height="4" rx="0.933333" fill="white"/>
493
+ </svg>
494
+ `,"chevron-down":St`
495
+ <svg width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg">
496
+ <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"/>
497
+ </svg>`,checkmark:St`
498
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
499
+ <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"/>
500
+ </svg>
501
+ `,close:St`
502
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
503
+ <path
504
+ 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"
505
+ fill="#212121"
506
+ />
507
+ </svg>
508
+ `};var ma=g`
509
+ :host {
510
+ display: inline-block;
511
+ line-height: 0; /* so you don’t get extra space around the icon */
512
+ }
513
+
514
+ /* Styling svgs rendered by passing *name* attribute - from our library file */
515
+ :host([size='sm']) svg {
516
+ width: 20px;
517
+ height: 20px;
518
+ }
519
+
520
+ :host([size='md']) svg {
521
+ width: 42px;
522
+ height: 42px;
523
+ }
524
+
525
+ :host([size='lg']) svg {
526
+ width: 56px;
527
+ height: 56px;
528
+ }
529
+
530
+ svg {
531
+ /* --internal used for abstracting away the icon component */
532
+ fill: var(--internal-icon-color, currentColor);
533
+ }
534
+
535
+ /* For slotted icons */
536
+ :host([size='sm']) ::slotted(svg) {
537
+ width: 20px;
538
+ height: 20px;
539
+ }
540
+
541
+ :host([size='lg']) ::slotted(svg) {
542
+ width: 56px;
543
+ height: 56px;
544
+ }
545
+
546
+ ::slotted(svg) {
547
+ /* --internal used for abstracting away the icon component */
548
+ fill: var(--internal-icon-color, currentColor);
549
+ }
550
+ `;var ft=class extends y{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let e=this.name?pa[this.name]:null;return h`
551
+ <div style="--internal-icon-color: ${this.color}">
552
+ ${e||h`<slot></slot>`}
553
+ </div>
554
+ `}};ft.styles=[ma],n([p({type:String,reflect:!0})],ft.prototype,"color",2),n([p({type:String,reflect:!0})],ft.prototype,"size",2),n([p({reflect:!0})],ft.prototype,"name",2),ft=n([v("primer-icon")],ft);var pt=class extends y{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 h`
555
+ <div
556
+ part="error-message"
557
+ class=${Z(e)}
558
+ aria-live="assertive"
559
+ aria-atomic="true"
560
+ >
561
+ <div part="error-icon" class="error-icon">
562
+ <primer-icon
563
+ name="failure-icon"
564
+ size="sm"
565
+ color="var(--primer-color-icon-negative)"
566
+ ></primer-icon>
567
+ </div>
568
+ <div part="error-content" class="error-content">${this.message}</div>
569
+ </div>
570
+ `}};pt.styles=[ca],n([p({type:String})],pt.prototype,"message",2),n([p({type:Boolean,reflect:!0})],pt.prototype,"visible",2),n([p({type:String,reflect:!0})],pt.prototype,"role",2),n([I()],pt.prototype,"showMessage",2),pt=n([v("primer-error-message")],pt);var Wu=Hn({tagName:"primer-error-message",elementClass:pt,react:Un});import{createComponent as Yn}from"@lit/react";import Fn from"react";var tf=Yn({tagName:"primer-icon",elementClass:ft,react:Fn});import{createComponent as Kn}from"@lit/react";import Gn from"react";var ha=g`
571
+ :host {
572
+ display: contents;
573
+ }
574
+
575
+ input {
576
+ width: 100%;
577
+ padding: 0;
578
+ border: none;
579
+ height: var(--primer-typography-body-large-line-height);
580
+ font-size: var(--primer-typography-body-large-size);
581
+ font-family: var(--primer-typography-body-large-font);
582
+ color: var(--primer-color-text-primary);
583
+ background-color: transparent;
584
+ outline: none;
585
+ }
586
+
587
+ input::placeholder {
588
+ color: var(--primer-color-text-placeholder);
589
+ font-size: var(--primer-typography-body-large-size);
590
+ font-family: var(--primer-typography-body-large-font);
591
+ }
592
+
593
+ :host([disabled]) input {
594
+ color: var(--primer-color-text-disabled);
595
+ cursor: not-allowed;
596
+ }
597
+
598
+ :host([disabled]) input::placeholder {
599
+ color: var(--primer-color-text-disabled);
600
+ }
601
+ `;var zn=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function Bn(i){return zn.includes(i)}var Y=class extends y{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 h`
602
+ <input
603
+ part="input"
604
+ class=${r}
605
+ .value=${this.value}
606
+ .type=${this.type}
607
+ ?disabled=${this.disabled}
608
+ ?required=${this.required}
609
+ ?readonly=${this.readonly}
610
+ placeholder=${this.placeholder}
611
+ pattern=${this.pattern}
612
+ minlength=${this.minlength??""}
613
+ maxlength=${this.maxlength??""}
614
+ min=${this.min}
615
+ max=${this.max}
616
+ step=${this.step}
617
+ autocomplete=${this.autocomplete}
618
+ name=${this.name}
619
+ id=${this.id}
620
+ @input=${this.handleInput}
621
+ @change=${this.handleChange}
622
+ @focus=${this.handleFocus}
623
+ @blur=${this.handleBlur}
624
+ @invalid=${this.handleInvalid}
625
+ />
626
+ `}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};Y.styles=[ha],n([Ot("input")],Y.prototype,"inputElement",2),n([p({type:String,reflect:!0})],Y.prototype,"value",2),n([p({type:String,reflect:!0})],Y.prototype,"placeholder",2),n([p({type:Boolean,reflect:!0})],Y.prototype,"disabled",2),n([p({type:String,reflect:!0})],Y.prototype,"name",2),n([p({type:String,reflect:!0,converter:{fromAttribute:e=>!e||!Bn(e)?(e&&e!=="text"&&N.warn(`Invalid input type: ${e}. Defaulting to 'text'.`),"text"):e}})],Y.prototype,"type",2),n([p({type:Boolean,reflect:!0})],Y.prototype,"required",2),n([p({type:Boolean,reflect:!0})],Y.prototype,"readonly",2),n([p({type:String,reflect:!0})],Y.prototype,"pattern",2),n([p({type:Number,reflect:!0})],Y.prototype,"minlength",2),n([p({type:Number,reflect:!0})],Y.prototype,"maxlength",2),n([p({type:String,reflect:!0})],Y.prototype,"min",2),n([p({type:String,reflect:!0})],Y.prototype,"max",2),n([p({type:String,reflect:!0})],Y.prototype,"step",2),n([p({type:String,reflect:!0})],Y.prototype,"autocomplete",2),n([p({type:String,reflect:!0})],Y.prototype,"id",2),n([I()],Y.prototype,"hasFocus",2),n([I()],Y.prototype,"hasError",2),Y=n([v("primer-input")],Y);var uf=Kn({tagName:"primer-input",elementClass:Y,react:Gn});import{createComponent as jn}from"@lit/react";import qn from"react";var ua=g`
627
+ :host {
628
+ display: contents;
629
+ }
630
+
631
+ :host(:not([active])) {
632
+ display: none;
633
+ }
634
+
635
+ .error {
636
+ color: var(--primer-color-text-negative);
637
+ font-size: var(--primer-typography-body-small-size);
638
+ line-height: var(--primer-typography-body-small-line-height);
639
+ display: block;
640
+ font-family: var(--primer-typography-body-small-font);
641
+ }
642
+ `;var Pt=class extends y{constructor(){super(...arguments);this.for="";this.active=!0}render(){return h`
643
+ <span
644
+ class="error"
645
+ role="alert"
646
+ aria-live="polite"
647
+ id="${this.for||""}"
648
+ >
649
+ <slot></slot>
650
+ </span>
651
+ `}};Pt.styles=[ua],n([p({type:String,reflect:!0})],Pt.prototype,"for",2),n([p({type:Boolean,reflect:!0})],Pt.prototype,"active",2),Pt=n([v("primer-input-error")],Pt);var Mf=jn({tagName:"primer-input-error",elementClass:Pt,react:qn});import{createComponent as Wn}from"@lit/react";import Zn from"react";var fa=g`
652
+ :host {
653
+ display: inline-block;
654
+ font-weight: var(--primer-typography-body-small-weight);
655
+ font-size: var(--primer-typography-body-small-size);
656
+ letter-spacing: var(--primer-typography-body-small-letter-spacing);
657
+ line-height: var(--primer-typography-body-small-line-height);
658
+ color: var(--primer-color-text-primary);
659
+ font-family: var(--primer-typography-body-small-font);
660
+ }
661
+
662
+ :host([disabled]) {
663
+ color: var(--primer-color-text-disabled);
664
+ }
665
+ `;var wt=class extends y{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return h`<label for=${this.for}><slot></slot></label>`}};wt.styles=[fa],n([p({type:String,reflect:!0})],wt.prototype,"for",2),n([p({type:Boolean,reflect:!0})],wt.prototype,"disabled",2),wt=n([v("primer-input-label")],wt);var Vf=Wn({tagName:"primer-input-label",elementClass:wt,react:Zn});import{createComponent as Xn}from"@lit/react";import Jn from"react";var ga=g`
666
+ * {
667
+ box-sizing: border-box;
668
+ }
669
+ :host {
670
+ display: block;
671
+ width: 100%;
672
+ }
673
+
674
+ .input-slot.focus-within,
675
+ .input-slot:focus-within {
676
+ outline: 2px solid var(--primer-color-border-outlined-focus);
677
+ outline-offset: -2px;
678
+ }
679
+
680
+ :host([has-error]) .input-slot.focus-within,
681
+ :host([has-error]) .input-slot:focus-within {
682
+ outline: 2px solid var(--primer-color-border-outlined-error);
683
+ background-color: var(--primer-color-background-outlined-error);
684
+ }
685
+
686
+ :host([has-error]) .input-slot {
687
+ border-color: var(--primer-color-border-outlined-error);
688
+ background-color: var(--primer-color-background-outlined-error);
689
+ }
690
+
691
+ .input-wrapper {
692
+ display: flex;
693
+ flex-direction: column;
694
+ gap: var(--primer-space-xsmall);
695
+ }
696
+
697
+ .input-slot {
698
+ padding: var(--primer-space-medium) var(--primer-space-medium);
699
+ border: 1px solid var(--primer-color-border-outlined-default);
700
+ border-radius: var(--primer-radius-small);
701
+ background-color: var(--primer-color-background-outlined-default);
702
+ height: calc(
703
+ var(--primer-typography-body-large-line-height) +
704
+ var(--primer-space-medium) + var(--primer-space-medium) + 2px
705
+ );
706
+ display: flex;
707
+ cursor: text; /* Indicate text input interactivity */
708
+ /* 2px is the border width */
709
+ }
710
+
711
+ .input-slot ::slotted(*) {
712
+ width: 100%;
713
+ }
714
+
715
+ .input-slot:hover {
716
+ border-color: var(--primer-color-border-outlined-hover);
717
+ background-color: var(--primer-color-background-outlined-hover);
718
+ }
719
+
720
+ .input-slot:active {
721
+ border-color: var(--primer-color-border-outlined-active);
722
+ background-color: var(--primer-color-background-outlined-active);
723
+ }
724
+
725
+ .input-slot:disabled {
726
+ background-color: var(--primer-color-background-outlined-disabled);
727
+ border-color: var(--primer-color-border-outlined-disabled);
728
+ cursor: not-allowed;
729
+ }
730
+ `;var vt=class extends y{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 h`
731
+ <div class="input-wrapper">
732
+ <slot name="label"></slot>
733
+ <div class="${Z(e)}" @click="${this.handleWrapperClick}">
734
+ <slot name="input"></slot>
735
+ </div>
736
+ <slot name="error"></slot>
737
+ </div>
738
+ `}};vt.styles=[ga],n([p({type:Boolean})],vt.prototype,"focusWithin",2),n([p({type:Boolean,reflect:!0,attribute:"has-error"})],vt.prototype,"hasError",2),n([Ot('slot[name="input"]')],vt.prototype,"inputSlot",2),vt=n([v("primer-input-wrapper")],vt);var Xf=Xn({tagName:"primer-input-wrapper",elementClass:vt,react:Jn});import{createComponent as Qn}from"@lit/react";import tl from"react";var ya=g`
739
+ :host {
740
+ display: none;
741
+ }
742
+ `;var Dt=class extends y{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(l=>s.appendChild(l))}render(){return h`<slot @slotchange=${this._handleSlotChange}></slot>`}};Dt.styles=[ya],n([I()],Dt.prototype,"id",2),Dt=n([v("primer-portal")],Dt);var dg=Qn({tagName:"primer-portal",elementClass:Dt,react:tl});import{createComponent as el}from"@lit/react";import rl from"react";var va=g`
743
+ :host {
744
+ display: inline-flex;
745
+ align-items: center;
746
+ justify-content: center;
747
+ }
748
+
749
+ .spinner-container {
750
+ display: flex;
751
+ align-items: center;
752
+ justify-content: center;
753
+ width: var(--spinner-size, var(--primer-size-medium));
754
+ height: var(--spinner-size, var(--primer-size-medium));
755
+ }
756
+
757
+ .spinner-container:not(.compact) {
758
+ margin: var(--primer-space-small) 0;
759
+ }
760
+
761
+ .spinner-container.compact {
762
+ margin: 0;
763
+ }
764
+
765
+ .spinner {
766
+ animation: spinner-rotate 1.2s linear infinite;
767
+ width: 100%;
768
+ height: 100%;
769
+ color: var(--spinner-color, var(--primer-color-loader));
770
+ }
771
+
772
+ .path {
773
+ fill: currentColor;
774
+ transform-origin: center;
775
+ transition: fill var(--primer-animation-duration, 200ms)
776
+ var(--primer-animation-easing, ease);
777
+ }
778
+
779
+ @keyframes spinner-rotate {
780
+ 0% {
781
+ transform: rotate(0deg);
782
+ }
783
+ 100% {
784
+ transform: rotate(360deg);
785
+ }
786
+ }
787
+ `;var Ni={small:16,medium:24,large:32},bt=class extends y{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in Ni)return Ni[this.size];let e=parseInt(this.size,10);return isNaN(e)?Ni.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`),h`
788
+ <div class="spinner-container ${this.compact?"compact":""}">
789
+ <svg
790
+ class="spinner"
791
+ width="${e}"
792
+ height="${e}"
793
+ viewBox="${o}"
794
+ fill="none"
795
+ xmlns="http://www.w3.org/2000/svg"
796
+ role="status"
797
+ aria-label="Loading"
798
+ >
799
+ <path
800
+ d="M4.27827 10.002C4.27827 6.84166 6.84019 4.27973 10.0005 4.27973C10.7676 4.27973 11.3894 3.6579 11.3894 2.89084C11.3894 2.12378 10.7676 1.50195 10.0005 1.50195C5.30607 1.50195 1.50049 5.30753 1.50049 10.002C1.50049 14.6964 5.30607 18.502 10.0005 18.502C14.6949 18.502 18.5005 14.6964 18.5005 10.002C18.5005 9.23489 17.8787 8.61306 17.1116 8.61306C16.3445 8.61306 15.7227 9.23489 15.7227 10.002C15.7227 13.1622 13.1608 15.7242 10.0005 15.7242C6.84019 15.7242 4.27827 13.1622 4.27827 10.002Z"
801
+ fill="currentColor"
802
+ class="path"
803
+ />
804
+ </svg>
805
+ </div>
806
+ `}};bt.styles=[va],n([p({type:String})],bt.prototype,"color",2),n([p({type:String})],bt.prototype,"size",2),n([p({type:Boolean})],bt.prototype,"compact",2),bt=n([v("primer-spinner")],bt);var Cg=el({tagName:"primer-spinner",elementClass:bt,react:rl});import{createComponent as il}from"@lit/react";import ol from"react";var ba=g`
807
+ :host {
808
+ display: flex;
809
+ flex-direction: column;
810
+ gap: var(--primer-space-medium);
811
+ width: 100%;
812
+ }
813
+
814
+ h2 {
815
+ margin: 0;
816
+ padding: 0;
817
+ border-radius: var(--primer-radius-medium);
818
+ font-weight: var(--primer-typography-title-xlarge-weight);
819
+ font-size: var(--primer-typography-title-xlarge-size);
820
+ letter-spacing: var(--primer-typography-title-xlarge-letter-spacing);
821
+ line-height: var(--primer-typography-title-xlarge-line-height);
822
+ font-family: var(--primer-typography-title-xlarge-font);
823
+ }
824
+
825
+ p {
826
+ margin: 0;
827
+ padding: 0;
828
+ border-radius: var(--primer-radius-medium);
829
+ font-weight: var(--primer-typography-body-medium-weight);
830
+ font-size: var(--primer-typography-body-medium-size);
831
+ letter-spacing: var(--primer-typography-body-medium-letter-spacing);
832
+ line-height: var(--primer-typography-body-medium-line-height);
833
+ font-family: var(--primer-typography-body-medium-font);
834
+ }
835
+
836
+ form {
837
+ display: flex;
838
+ flex-direction: column;
839
+ gap: var(--primer-space-medium);
840
+ width: 100%;
841
+ }
842
+
843
+ .form-row {
844
+ display: flex;
845
+ gap: var(--primer-space-small);
846
+ width: 100%;
847
+ }
848
+
849
+ .form-row primer-input-wrapper {
850
+ flex: 1;
851
+ }
852
+
853
+ .error-message {
854
+ color: var(--primer-color-text-negative);
855
+ background-color: var(--primer-color-red-100);
856
+ padding: var(--primer-space-small);
857
+ border-radius: var(--primer-radius-small);
858
+ font-weight: var(--primer-typography-body-medium-weight);
859
+ font-size: var(--primer-typography-body-medium-size);
860
+ letter-spacing: var(--primer-typography-body-medium-letter-spacing);
861
+ line-height: var(--primer-typography-body-medium-line-height);
862
+ font-family: var(--primer-typography-body-medium-font);
863
+ }
864
+
865
+ .loading-container {
866
+ display: flex;
867
+ flex-direction: column;
868
+ align-items: center;
869
+ justify-content: center;
870
+ gap: var(--primer-space-medium);
871
+ padding: var(--primer-space-large);
872
+ }
873
+
874
+ .button-group {
875
+ display: flex;
876
+ gap: var(--primer-space-small);
877
+ margin-top: var(--primer-space-medium);
878
+ }
879
+
880
+ /* Apply responsive styles for small screens */
881
+ @media (max-width: 600px) {
882
+ .form-row {
883
+ flex-direction: column;
884
+ gap: var(--primer-space-medium);
885
+ }
886
+
887
+ .button-group {
888
+ flex-direction: column;
889
+ }
890
+ }
891
+ `;function Ea(){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 $r=class{constructor(t,e){this.formState=Ea();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=Ea(),this.host.requestUpdate()}isValidFieldName(t){return!!t&&["firstName","lastName","emailAddress"].includes(t)}hostConnected(){}hostDisconnected(){}};var ot=class extends y{constructor(){super(...arguments);this.formController=new $r(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 V(this,{task:async([e])=>e!=="STRIPE_ACH"?R: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 h`
892
+ <h2>
893
+ ${T("payWithAch",{id:"payWithAch"})}
894
+ </h2>
895
+ <p>
896
+ ${T("stripe_ach_user_details_collection_subtitle_label",{id:"stripe_ach_user_details_collection_subtitle_label"})}
897
+ </p>
898
+
899
+ <form @submit=${r=>r.preventDefault()}>
900
+ <div class="form-row">
901
+ <primer-input-wrapper
902
+ .hasError=${this.formController.hasError.firstName}
903
+ >
904
+ <primer-input-label slot="label">
905
+ ${T("stripe_ach_user_details_collection_first_name_label",{id:"stripe_ach_user_details_collection_first_name_label"})}
906
+ </primer-input-label>
907
+ <primer-input
908
+ slot="input"
909
+ .value=${this.formController.formState.firstName.value}
910
+ @input=${r=>this._handleInput(r,"firstName")}
911
+ @blur=${()=>this._handleBlur("firstName")}
912
+ ?disabled=${this.isSubmitting}
913
+ ></primer-input>
914
+ <primer-input-error slot="error">
915
+ ${this.formController.hasError.firstName?this.formController.formState.firstName.error:u}
916
+ </primer-input-error>
917
+ </primer-input-wrapper>
918
+ <primer-input-wrapper
919
+ .hasError=${this.formController.hasError.lastName}
920
+ >
921
+ <primer-input-label slot="label">
922
+ ${T("stripe_ach_user_details_collection_last_name_label",{id:"stripe_ach_user_details_collection_last_name_label"})}
923
+ </primer-input-label>
924
+ <primer-input
925
+ slot="input"
926
+ .value=${this.formController.formState.lastName.value}
927
+ @input=${r=>this._handleInput(r,"lastName")}
928
+ @blur=${()=>this._handleBlur("lastName")}
929
+ ?disabled=${this.isSubmitting}
930
+ >
931
+ </primer-input>
932
+ <primer-input-error slot="error">
933
+ ${this.formController.hasError.lastName?this.formController.formState.lastName.error:u}
934
+ </primer-input-error>
935
+ </primer-input-wrapper>
936
+ </div>
937
+ <primer-input-wrapper
938
+ .hasError=${this.formController.hasError.emailAddress}
939
+ >
940
+ <primer-input-label slot="label">
941
+ ${T("stripe_ach_user_details_collection_email_address_label",{id:"stripe_ach_user_details_collection_email_address_label"})}
942
+ </primer-input-label>
943
+ <primer-input
944
+ slot="input"
945
+ type="email"
946
+ .value=${this.formController.formState.emailAddress.value}
947
+ @input=${r=>this._handleInput(r,"emailAddress")}
948
+ @blur=${()=>this._handleBlur("emailAddress")}
949
+ ?disabled=${this.isSubmitting}
950
+ ></primer-input>
951
+ <primer-input-error slot="error">
952
+ ${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:u}
953
+ </primer-input-error>
954
+ </primer-input-wrapper>
955
+ <p>
956
+ ${T("stripe_ach_user_details_collection_data_usage_label",{id:"stripe_ach_user_details_collection_data_usage_label"})}
957
+ </p>
958
+ <primer-button
959
+ buttonType="submit"
960
+ variant="primary"
961
+ @click=${()=>this._handleSubmitButtonClick(e)}
962
+ ?disabled=${this.isSubmitting}
963
+ ?loading=${this.isSubmitting}
964
+ >
965
+ ${T("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}
966
+ </primer-button>
967
+ </form>
968
+ `}renderMandate(){return h`
969
+ <h2>
970
+ ${T("payWithAch",{id:"payWithAch"})}
971
+ </h2>
972
+
973
+ <p>
974
+ ${this.clientOptions?.stripe?.mandateData.fullMandateText??T("stripe_ach_mandate_template_web",{id:"stripe_ach_mandate_template_web"}).replace(/\{merchantName\}/g,this.clientOptions?.stripe?.mandateData.merchantName??"Merchant")}
975
+ </p>
976
+
977
+ <div class="button-group">
978
+ <primer-button
979
+ variant="primary"
980
+ @click=${this._handleConfirmMandate.bind(this)}
981
+ ?disabled=${this.isSubmitting}
982
+ ?loading=${this.isSubmitting}
983
+ >
984
+ ${T("stripe_ach_mandate_accept_button",{id:"stripe_ach_mandate_accept_button"})}
985
+ </primer-button>
986
+
987
+ <primer-button
988
+ variant="tertiary"
989
+ @click=${this._handleDeclineMandate.bind(this)}
990
+ ?disabled=${this.isSubmitting}
991
+ >
992
+ ${T("stripe_ach_mandate_cancel_payment_button",{id:"stripe_ach_mandate_cancel_payment_button"})}
993
+ </primer-button>
994
+ </div>
995
+ `}render(){return this._paymentMethodManagerTask.render({complete:e=>e?this.screen==="form"?this.renderForm(e):this.renderMandate():u})}};ot.styles=[$,ba],n([p({type:Object})],ot.prototype,"paymentMethod",2),n([P({context:Q,subscribe:!0}),p({attribute:!1})],ot.prototype,"paymentManagers",2),n([P({context:G,subscribe:!0}),p({attribute:!1})],ot.prototype,"sdkState",2),n([P({context:me,subscribe:!0}),p({attribute:!1})],ot.prototype,"clientOptions",2),n([I()],ot.prototype,"screen",2),n([I()],ot.prototype,"isSubmitting",2),ot=n([v("primer-ach-payment"),z()],ot);var Gg=il({tagName:"primer-ach-payment",elementClass:ot,react:ol});import{createComponent as al}from"@lit/react";import sl from"react";var Or="card-form-context";var Ca=g`
996
+ :host {
997
+ display: contents;
998
+ }
999
+
1000
+ form {
1001
+ display: flex;
1002
+ flex-direction: column;
1003
+ gap: var(--primer-space-medium);
1004
+ width: 100%;
1005
+ }
1006
+
1007
+ .card-form {
1008
+ display: flex;
1009
+ flex-direction: column;
1010
+ gap: var(--primer-space-medium);
1011
+ margin-bottom: var(--primer-space-medium);
1012
+ }
1013
+
1014
+ .card-form-row {
1015
+ display: flex;
1016
+ gap: var(--primer-space-small);
1017
+ }
1018
+ `;var gt=class extends y{constructor(){super(...arguments);this.hideLabels=!1;this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new q(this,{context:Or,initialValue:null});this.eventsController=new ce(this);this.setupCardFormTask=new V(this,{task:async([e])=>{if(!e?.manager)return R;let{manager:r}=e,{cardNumberInput:o,expiryInput:s,cvvInput:l}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:s,cvvInput:l,setCardholderName:f=>r.setCardholderName(f),setCardNetwork:f=>{this.selectedCardNetwork=f},validate:()=>r.validate(),submit:f=>r.submit(f),hideLabels:this.hideLabels}),!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()}}updated(e){super.updated(e),e.has("hideLabels")&&this.cardFormProvider.value&&this.cardFormProvider.setValue({...this.cardFormProvider.value,hideLabels:this.hideLabels})}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("type")==="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===$t.ERROR||this.setupCardFormTask.status===$t.INITIAL?u:h`
1019
+ <form @submit=${this.handleFormSubmit}>
1020
+ <slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
1021
+ ${this.setupCardFormTask.render({complete:()=>U(this.hasAssignedContent,()=>u,()=>h`
1022
+ <div class="card-form">
1023
+ <primer-input-card-number></primer-input-card-number>
1024
+ <div class="card-form-row">
1025
+ <primer-input-card-expiry></primer-input-card-expiry>
1026
+ <primer-input-cvv></primer-input-cvv>
1027
+ </div>
1028
+ <primer-input-card-holder-name></primer-input-card-holder-name>
1029
+ </div>
1030
+ <primer-card-form-submit></primer-card-form-submit>
1031
+ `)})}
1032
+ </form>
1033
+ `}};gt.styles=[$,Ca],n([p({type:Boolean,attribute:"hide-labels",reflect:!0})],gt.prototype,"hideLabels",2),n([I()],gt.prototype,"hasAssignedContent",2),n([I()],gt.prototype,"selectedCardNetwork",2),n([P({context:Q,subscribe:!0}),p({type:Object})],gt.prototype,"paymentManagers",2),gt=n([v("primer-card-form"),z()],gt);var uy=al({tagName:"primer-card-form",elementClass:gt,react:sl});import{createComponent as nl}from"@lit/react";import ll from"react";var Aa=g`
1034
+ :host {
1035
+ display: contents;
1036
+ }
1037
+ `;var at=class extends y{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:T("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 h`
1038
+ <primer-button
1039
+ type="submit"
1040
+ variant=${this.variant}
1041
+ ?disabled=${this.disabled}
1042
+ @click=${this.handleClick}
1043
+ .loading=${!!this.sdkState?.isProcessing}
1044
+ data-submit
1045
+ >
1046
+ ${this.buttonText}${r}
1047
+ </primer-button>
1048
+ `}};at.styles=[$,Aa],n([p({type:String})],at.prototype,"buttonText",1),n([P({context:ct,subscribe:!0}),p({type:Object})],at.prototype,"headlessInstance",2),n([P({context:me,subscribe:!0}),p({type:Object})],at.prototype,"clientOptions",2),n([P({context:G,subscribe:!0}),p()],at.prototype,"sdkState",2),n([p({type:String})],at.prototype,"variant",2),n([p({type:Boolean})],at.prototype,"disabled",2),at=n([v("primer-card-form-submit"),z()],at);var $y=nl({tagName:"primer-card-form-submit",elementClass:at,react:ll});import{createComponent as ml}from"@lit/react";import hl from"react";var{I:Vy}=ta;var _a=i=>i.strings===void 0;var Ke=(i,t)=>{let e=i._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),Ke(r,t);return!0},Dr=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},xa=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),pl(t)}};function dl(i){this._$AN!==void 0?(Dr(this),this._$AM=i,xa(this)):this._$AM=i}function cl(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++)Ke(r[s],!1),Dr(r[s]);else r!=null&&(Ke(r,!1),Dr(r));else Ke(this,i)}var pl=i=>{i.type==Rr.CHILD&&(i._$AP??(i._$AP=cl),i._$AQ??(i._$AQ=dl))},Vr=class extends ve{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),xa(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Ke(this,t),Dr(this))}setValue(t){if(_a(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 Ri=()=>new Li,Li=class{},Ii=new WeakMap,Hr=Be(class extends Vr{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=Ii.get(t);e===void 0&&(e=new WeakMap,Ii.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"?Ii.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 Sa=g`
1049
+ :host {
1050
+ display: flex;
1051
+ align-items: center;
1052
+ position: relative;
1053
+ }
1054
+
1055
+ .network-selector {
1056
+ display: flex;
1057
+ align-items: center;
1058
+ cursor: pointer;
1059
+ background: none;
1060
+ padding: unset;
1061
+ border: none;
1062
+ transition: opacity var(--primer-animation-duration)
1063
+ var(--primer-animation-easing);
1064
+ outline: none;
1065
+ gap: var(--primer-space-xsmall);
1066
+ }
1067
+
1068
+ .network-selector:hover {
1069
+ opacity: 0.8;
1070
+ }
1071
+
1072
+ .network-selector:focus-visible {
1073
+ outline: 2px solid var(--primer-color-focus);
1074
+ border-radius: var(--primer-radius-xsmall);
1075
+ }
1076
+
1077
+ .network-icon {
1078
+ width: var(--primer-size-large);
1079
+ object-fit: contain;
1080
+ }
1081
+
1082
+ .caret {
1083
+ margin-left: var(--primer-space-xsmall);
1084
+ transition: transform var(--primer-animation-duration)
1085
+ var(--primer-animation-easing);
1086
+ color: var(--primer-color-icon-primary);
1087
+ }
1088
+
1089
+ .caret.open {
1090
+ transform: rotate(180deg);
1091
+ }
1092
+
1093
+ .dropdown {
1094
+ position: absolute;
1095
+ top: 100%;
1096
+ right: 0;
1097
+ width: max-content;
1098
+ min-width: calc(var(--primer-size-xxxlarge) * 3);
1099
+ background: var(--primer-color-gray-000);
1100
+ border-radius: var(--primer-radius-small);
1101
+ box-shadow: 0 var(--primer-space-xxsmall) var(--primer-space-large)
1102
+ rgba(0, 0, 0, 0.15);
1103
+ z-index: 10;
1104
+ overflow: hidden;
1105
+ border: 1px solid var(--primer-color-border-outlined-default);
1106
+ }
1107
+
1108
+ .dropdown:not(.open) {
1109
+ display: none;
1110
+ }
1111
+
1112
+ .dropdown.open {
1113
+ display: block;
1114
+ max-height: calc(var(--primer-size-xxxlarge) * 4);
1115
+ overflow-y: auto;
1116
+ }
1117
+
1118
+ .network-option {
1119
+ display: flex;
1120
+ align-items: center;
1121
+ padding: var(--primer-space-small) var(--primer-space-medium);
1122
+ cursor: pointer;
1123
+ transition: background-color var(--primer-animation-duration)
1124
+ var(--primer-animation-easing);
1125
+ position: relative;
1126
+ outline: none;
1127
+ background-color: transparent;
1128
+ }
1129
+
1130
+ /* Only apply hover effect when not in keyboard navigation mode */
1131
+ .network-option:hover {
1132
+ background-color: var(--primer-color-gray-100);
1133
+ }
1134
+
1135
+ /* Apply focused style only when the focused class is present (keyboard navigation) */
1136
+ .network-option.focused {
1137
+ background-color: var(--primer-color-gray-100);
1138
+ }
1139
+
1140
+ .network-option:focus-visible {
1141
+ outline: 2px solid var(--primer-color-focus);
1142
+ outline-offset: -2px;
1143
+ }
1144
+
1145
+ .network-option-icon {
1146
+ width: var(--primer-size-medium);
1147
+ height: var(--primer-size-small);
1148
+ margin-right: var(--primer-space-small);
1149
+ object-fit: contain;
1150
+ }
1151
+
1152
+ .network-name {
1153
+ font-size: var(--primer-typography-body-medium-size);
1154
+ font-family: var(--primer-typography-body-medium-font);
1155
+ line-height: var(--primer-typography-body-medium-line-height);
1156
+ letter-spacing: var(--primer-typography-body-medium-letter-spacing);
1157
+ white-space: nowrap;
1158
+ color: var(--primer-color-text-primary);
1159
+ flex: 1;
1160
+ }
1161
+
1162
+ .checkmark {
1163
+ margin-left: var(--primer-space-small);
1164
+ color: var(--primer-color-brand);
1165
+ width: var(--primer-size-small);
1166
+ height: var(--primer-size-small);
1167
+ }
1168
+ `;var st=class extends y{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=Ri();this.dropdownRef=Ri();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 h`<primer-spinner size="small" compact></primer-spinner>`;let e=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&e.length===0)return h`<primer-icon name="payment-card"></primer-icon>`;let r=this.getDetectedNetwork()||(e.length>0?e[0]:null);if(!r)return h`<primer-icon name="payment-card" size="sm"></primer-icon>`;let o=e.length>1;return h`
1169
+ <button
1170
+ ${Hr(this.buttonRef)}
1171
+ class="network-selector"
1172
+ @click=${this.toggleDropdown}
1173
+ @keydown=${s=>{(s.key===" "||s.key==="Enter")&&o&&(s.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
1174
+ aria-label=${o?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`}
1175
+ aria-expanded=${o?this.isDropdownOpen:u}
1176
+ aria-haspopup=${o?"true":u}
1177
+ aria-controls=${o?"network-dropdown":u}
1178
+ >
1179
+ <img
1180
+ class="network-icon"
1181
+ src=${this.getNetworkIconUrl(r)}
1182
+ alt=${r.displayName}
1183
+ />
1184
+ ${U(o,()=>h`
1185
+ <primer-icon
1186
+ class="caret ${this.isDropdownOpen?"open":""}"
1187
+ name="chevron-down"
1188
+ ></primer-icon>
1189
+ `,()=>u)}
1190
+ </button>
1191
+
1192
+ ${U(this.isDropdownOpen,()=>h`
1193
+ <div
1194
+ ${Hr(this.dropdownRef)}
1195
+ id="network-dropdown"
1196
+ class="dropdown open"
1197
+ role="listbox"
1198
+ aria-label="Select card network"
1199
+ >
1200
+ ${e.map((s,l)=>h`
1201
+ <div
1202
+ ${Hr(f=>this.setNetworkOptionRef(f,l))}
1203
+ class="network-option ${this.isKeyboardNavigation&&l===this.focusedNetworkIndex?"focused":""}"
1204
+ @click=${f=>this.selectNetwork(f,s)}
1205
+ @keydown=${f=>{(f.key==="Enter"||f.key===" ")&&this.selectNetwork(f,s)}}
1206
+ role="option"
1207
+ aria-selected=${s.network===r.network}
1208
+ tabindex="${l===this.focusedNetworkIndex?"0":"-1"}"
1209
+ >
1210
+ <img
1211
+ class="network-option-icon"
1212
+ src=${this.getNetworkIconUrl(s)}
1213
+ alt=${s.displayName}
1214
+ />
1215
+ <span class="network-name">${s.displayName}</span>
1216
+ ${U(s.network===r.network,()=>h`
1217
+ <primer-icon
1218
+ class="checkmark"
1219
+ name="checkmark"
1220
+ ></primer-icon>
1221
+ `,()=>u)}
1222
+ </div>
1223
+ `)}
1224
+ </div>
1225
+ `,()=>u)}
1226
+ `}};st.styles=[$,Sa],n([P({context:dr,subscribe:!0})],st.prototype,"cardNetworks",2),n([P({context:ct,subscribe:!0})],st.prototype,"headlessUtils",2),n([I()],st.prototype,"selectedCardNetwork",2),n([I()],st.prototype,"isDropdownOpen",2),n([I()],st.prototype,"focusedNetworkIndex",2),n([I()],st.prototype,"isKeyboardNavigation",2),st=n([v("primer-card-network-selector")],st);var gv=ml({tagName:"primer-card-network-selector",elementClass:st,react:hl});import{createComponent as ul}from"@lit/react";import fl from"react";function Ma(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=`
1227
+ input[data-custom-input]::placeholder {
1228
+ color: var(--primer-color-text-placeholder);
1229
+ font-size: var(--primer-typography-body-large-size);
1230
+ font-family: var(--primer-typography-body-large-font);
1231
+ }
1232
+ input[data-custom-input]:focus {
1233
+ outline: none;
1234
+ }
1235
+ `,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function Pa(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 wa(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 Ur=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 V(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 R;await this.host.updateComplete;let e=this.getTargetContainer();return e?t==="cardholderName"?this.setupStandardInput(e):this.setupHostedIframeInput(t,e):R}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,Ma(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=Pa(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,wa(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 X=class extends y{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:T(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 Ur(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===$t.ERROR)return u;let e=this.getError();return h`
1236
+ <primer-input-wrapper
1237
+ .focusWithin="${this.hostedInputController.isFocused}"
1238
+ .hasError=${!!e}
1239
+ @wrapper-click="${this.handleWrapperClick}"
1240
+ >
1241
+ ${U(!this.cardFormContext?.hideLabels,()=>h`<primer-input-label slot="label"
1242
+ >${this.label}</primer-input-label
1243
+ >`,()=>u)}
1244
+ <div
1245
+ slot="input"
1246
+ class="card-input-slot"
1247
+ id="${this.config.containerSelector.substring(1)}"
1248
+ aria-label="${this.ariaLabel}"
1249
+ ></div>
1250
+ ${U(e,()=>h`
1251
+ <primer-input-error slot="error">
1252
+ ${T(e,{id:e})}
1253
+ </primer-input-error>
1254
+ `,()=>u)}
1255
+ </primer-input-wrapper>
1256
+ `}};n([P({context:Or,subscribe:!0})],X.prototype,"cardFormContext",2),n([P({context:he,subscribe:!0}),p()],X.prototype,"computedStyles",2),n([p({type:String})],X.prototype,"label",1),n([p({type:String})],X.prototype,"placeholder",1),n([p({type:String,attribute:"aria-label"})],X.prototype,"ariaLabel",1);var Ta=g`
1257
+ :host {
1258
+ display: contents;
1259
+ }
1260
+ `;var Vt=g`
1261
+ .card-input-slot {
1262
+ display: flex;
1263
+ }
1264
+ `;var Xt=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:e=>this.handleInput(e)};this.childUpdated()}handleInput(e){this.cardFormContext?.setCardholderName?.(e)}render(){return this.renderInput()}};Xt.styles=[$,Vt,Ta],Xt=n([v("primer-input-card-holder-name"),z()],Xt);var eb=ul({tagName:"primer-input-card-holder-name",elementClass:Xt,react:fl});import{createComponent as gl}from"@lit/react";import yl from"react";var ka=g`
1265
+ :host {
1266
+ display: contents;
1267
+ }
1268
+ `;var Jt=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()}};Jt.styles=[$,Vt,ka],Jt=n([v("primer-input-card-expiry"),z()],Jt);var yb=gl({tagName:"primer-input-card-expiry",elementClass:Jt,react:yl});import{createComponent as vl}from"@lit/react";import bl from"react";var Na=g`
1269
+ :host {
1270
+ display: contents;
1271
+ }
1272
+ `;var Qt=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()}};Qt.styles=[$,Vt,Na],Qt=n([v("primer-input-cvv"),z()],Qt);var Lb=vl({tagName:"primer-input-cvv",elementClass:Qt,react:bl});import{createComponent as El}from"@lit/react";import Cl from"react";var Ia=g`
1273
+ :host {
1274
+ display: contents;
1275
+ }
1276
+
1277
+ .card-number-container {
1278
+ display: flex;
1279
+ align-items: center;
1280
+ width: 100%;
1281
+ position: relative;
1282
+ gap: var(--primer-space-small);
1283
+ }
1284
+
1285
+ #cardNumber {
1286
+ flex: 1;
1287
+ display: flex;
1288
+ width: 100%;
1289
+ }
1290
+
1291
+ .network-selector-container {
1292
+ display: flex;
1293
+ align-items: center;
1294
+ z-index: 2;
1295
+ }
1296
+ `;var te=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(e){let{network:r}=e.detail;this.cardFormContext&&this.cardFormContext.setCardNetwork(r)}renderInput(){if(this.hostedInputController.setupTask.status===$t.ERROR)return u;let e=this.getError();return h`
1297
+ <primer-input-wrapper
1298
+ .focusWithin="${this.hostedInputController.isFocused}"
1299
+ .hasError=${!!e}
1300
+ >
1301
+ ${U(!this.cardFormContext?.hideLabels,()=>h`<primer-input-label slot="label"
1302
+ >${this.label}</primer-input-label
1303
+ >`,()=>u)}
1304
+ <div
1305
+ slot="input"
1306
+ class="card-number-container"
1307
+ aria-label="${this.ariaLabel}"
1308
+ >
1309
+ <div id="${this.config.containerSelector.substring(1)}"></div>
1310
+ <div class="network-selector-container">
1311
+ <primer-card-network-selector
1312
+ @network-selected=${this.handleNetworkSelected}
1313
+ ></primer-card-network-selector>
1314
+ </div>
1315
+ </div>
1316
+ ${U(e,r=>h`
1317
+ <primer-input-error slot="error">
1318
+ ${T(r,{id:r})}
1319
+ </primer-input-error>
1320
+ `,()=>u)}
1321
+ </primer-input-wrapper>
1322
+ `}render(){return this.renderInput()}};te.styles=[$,Vt,Ia],te=n([v("primer-input-card-number"),z()],te);var Jb=El({tagName:"primer-input-number",elementClass:te,react:Cl});import{createComponent as Al}from"@lit/react";import _l from"react";var La=g`
1323
+ :host {
1324
+ height: calc(
1325
+ var(--primer-typography-title-large-line-height) +
1326
+ calc(2 * var(--primer-space-medium))
1327
+ );
1328
+ display: flex;
1329
+
1330
+ /* Default value for the background color CSS variable */
1331
+ --dynamic-payment-button-bg-color: var(
1332
+ --primer-color-background-outlined-default
1333
+ );
1334
+ }
1335
+
1336
+ primer-button {
1337
+ width: 100%;
1338
+ height: 100%;
1339
+ }
1340
+
1341
+ primer-button::part(button) {
1342
+ background-color: var(--dynamic-payment-button-bg-color);
1343
+ border: 1px solid var(--primer-color-border-outlined-default);
1344
+ color: var(--primer-color-text-primary);
1345
+ flex: 1;
1346
+ padding: 1px;
1347
+ }
1348
+
1349
+ .image-container {
1350
+ display: flex;
1351
+ justify-content: center;
1352
+ height: 100%;
1353
+ }
1354
+ /* Target the img specifically inside our component */
1355
+ img {
1356
+ height: 100%;
1357
+ }
1358
+ `;function Ge(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}var mt=class extends y{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new V(this,{task:async([e,r])=>!e||!r?R:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new V(this,{task:async([e,r])=>{if(!e||!r)return R;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}:R},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new V(this,{task:async([e,r])=>!e||!r?R:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?Ge(e):"";return r==="payWith"&&(r="pay_with"),T(r,{id:r})}start(){this._paymentMethodManagerTask.value&&(this.open=!0)}renderDialog(){return this.open?h`
1359
+ <primer-portal>
1360
+ <primer-dialog @primer-dialog-close="${()=>this.open=!1}">
1361
+ <primer-ach-payment
1362
+ .paymentMethod=${this.paymentMethod}
1363
+ @primer-ach-error=${()=>this.open=!1}
1364
+ @primer-ach-mandate-confirmed=${()=>this.open=!1}
1365
+ @primer-ach-mandate-declined=${()=>this.open=!1}
1366
+ ></primer-ach-payment>
1367
+ </primer-dialog>
1368
+ </primer-portal>
1369
+ `:u}render(){return this._setupTasks.render({error:()=>u,complete:({assetsConfig:e})=>(this.style.setProperty("--dynamic-payment-button-bg-color",e.backgroundColor),h`
1370
+ <primer-button
1371
+ @click="${()=>this.start()}"
1372
+ class=${Z({loading:!!this.sdkState?.isProcessing,reverse:!0})}
1373
+ title="${T("pay_with",{id:"pay_with"})} ${e.name}"
1374
+ >
1375
+ <span class="image-container">
1376
+ <img src="${e.iconUrl}" alt="${e.name}" />
1377
+ </span>
1378
+ ${e.displayName}
1379
+ </primer-button>
1380
+ ${this.renderDialog()}
1381
+ `)})}};mt.styles=[$,La],n([p({type:Object})],mt.prototype,"paymentMethod",2),n([P({context:Q,subscribe:!0})],mt.prototype,"paymentManagers",2),n([P({context:G,subscribe:!0})],mt.prototype,"sdkState",2),n([P({context:ct,subscribe:!0})],mt.prototype,"headlessUtils",2),n([I()],mt.prototype,"open",2),mt=n([v("primer-dynamic-payment"),z()],mt);var AE=Al({tagName:"primer-dynamic-payment",elementClass:mt,react:_l});import{createComponent as xl}from"@lit/react";import Sl from"react";var Ra=g`
1382
+ :host {
1383
+ display: block;
1384
+ width: 100%;
1385
+ }
1386
+ `;var Tt=class extends y{constructor(){super(...arguments);this.showProcessingErrors=!0}get shouldShowError(){return!this.sdkState||this.sdkState.isProcessing?!1:!!(this.sdkState.failure&&this.showProcessingErrors)}render(){return this.sdkState?h`
1387
+ <primer-error-message
1388
+ message="${T(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
1389
+ ?visible="${this.shouldShowError}"
1390
+ ></primer-error-message>
1391
+ `:u}};Tt.styles=[Ra],n([P({context:G,subscribe:!0}),I()],Tt.prototype,"sdkState",2),n([p({type:Boolean,attribute:"show-processing-errors"})],Tt.prototype,"showProcessingErrors",2),Tt=n([v("primer-error-message-container")],Tt);var YE=xl({tagName:"primer-error-message-container",elementClass:Tt,react:Sl});import{createComponent as Ml}from"@lit/react";import Pl from"react";var $a=g`
1392
+ :host {
1393
+ display: contents;
1394
+ }
1395
+
1396
+ .klarna-container {
1397
+ display: flex;
1398
+ flex-direction: column;
1399
+ width: 100%;
1400
+ transition: all var(--primer-animation-duration)
1401
+ var(--primer-animation-easing);
1402
+ }
1403
+
1404
+ .klarna-container.expanded {
1405
+ border-radius: var(--primer-radius-medium);
1406
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
1407
+ background-color: var(--primer-color-background-outlined-default);
1408
+ border: 1px solid var(--primer-color-border-outlined-default);
1409
+ padding: var(--primer-space-large);
1410
+ }
1411
+
1412
+ .klarna-button-header {
1413
+ padding: 0;
1414
+ display: flex;
1415
+ align-items: center;
1416
+ justify-content: space-between;
1417
+ width: 100%;
1418
+ gap: var(--primer-space-small);
1419
+ }
1420
+
1421
+ .klarna-accordion-icon {
1422
+ position: absolute;
1423
+ right: var(--primer-space-medium);
1424
+ font-size: var(--primer-typography-body-small-size);
1425
+ font-weight: var(--primer-typography-title-large-weight);
1426
+ color: var(--primer-color-text-secondary);
1427
+ transition: all var(--primer-animation-duration)
1428
+ var(--primer-animation-easing);
1429
+ display: inline-flex;
1430
+ align-items: center;
1431
+ justify-content: center;
1432
+ width: 24px;
1433
+ height: 24px;
1434
+ margin-left: var(--primer-space-small);
1435
+ }
1436
+
1437
+ .klarna-accordion-icon.expanded {
1438
+ transform: rotate(180deg);
1439
+ }
1440
+
1441
+ .klarna-expanded-content {
1442
+ width: 100%;
1443
+ display: grid;
1444
+ grid-template-rows: 0fr;
1445
+ transition: grid-template-rows var(--primer-animation-duration)
1446
+ var(--primer-animation-easing);
1447
+ }
1448
+
1449
+ .klarna-expanded-content.visible {
1450
+ margin-top: var(--primer-space-large);
1451
+ border-top: 1px solid var(--primer-color-border-outlined-default);
1452
+ grid-template-rows: 1fr;
1453
+ }
1454
+
1455
+ .klarna-accordion-content {
1456
+ overflow: hidden;
1457
+ }
1458
+
1459
+ @keyframes fadeIn {
1460
+ from {
1461
+ opacity: 0;
1462
+ transform: translateY(-10px);
1463
+ }
1464
+ to {
1465
+ opacity: 1;
1466
+ transform: translateY(0);
1467
+ }
1468
+ }
1469
+
1470
+ .category-selection {
1471
+ display: flex;
1472
+ flex-wrap: wrap;
1473
+ gap: var(--primer-space-small);
1474
+ margin: var(--primer-space-large) 0;
1475
+ }
1476
+
1477
+ .category-button {
1478
+ padding: var(--primer-space-medium) var(--primer-space-large);
1479
+ border-radius: var(--primer-radius-base);
1480
+ background-color: var(--primer-color-background-outlined-loading);
1481
+ border: 1px solid var(--primer-color-border-outlined-default);
1482
+ font-size: var(--primer-typography-body-medium-size);
1483
+ cursor: pointer;
1484
+ transition: all var(--primer-animation-duration)
1485
+ var(--primer-animation-easing);
1486
+ flex: 1;
1487
+ min-width: 100px;
1488
+ text-align: center;
1489
+ }
1490
+
1491
+ .category-button.selected {
1492
+ background-color: var(--primer-color-background-outlined-default);
1493
+ border-color: var(--primer-color-brand);
1494
+ color: var(--primer-color-brand);
1495
+ font-weight: var(--primer-typography-title-large-weight);
1496
+ }
1497
+
1498
+ .category-button:hover:not(.selected) {
1499
+ background-color: var(--primer-color-background-outlined-hover);
1500
+ }
1501
+
1502
+ .klarna-category-container {
1503
+ min-height: 74px;
1504
+ width: 100%;
1505
+ border-radius: var(--primer-radius-small);
1506
+ border: 1px solid var(--primer-color-border-outlined-default);
1507
+ background-color: var(--primer-color-background-outlined-default);
1508
+ padding: var(--primer-space-medium);
1509
+ margin-bottom: var(--primer-space-large);
1510
+ transition: height var(--primer-animation-duration)
1511
+ var(--primer-animation-easing);
1512
+ overflow: hidden;
1513
+ }
1514
+
1515
+ .klarna-button::part(button) {
1516
+ display: flex;
1517
+ flex: 1;
1518
+ gap: var(--primer-space-small);
1519
+ height: calc(
1520
+ var(--primer-typography-title-large-line-height) +
1521
+ calc(2 * var(--primer-space-medium))
1522
+ );
1523
+ width: 100%;
1524
+ }
1525
+
1526
+ .klarna-button primer-icon {
1527
+ margin-right: var(--primer-space-medium);
1528
+ }
1529
+
1530
+ .klarna-button:hover {
1531
+ background-color: var(--primer-color-background-outlined-hover);
1532
+ border-color: var(--primer-color-border-outlined-hover);
1533
+ }
1534
+
1535
+ .klarna-pay-button {
1536
+ padding: var(--primer-space-medium) var(--primer-space-large);
1537
+ display: flex;
1538
+ align-items: center;
1539
+ justify-content: center;
1540
+ border-radius: var(--primer-radius-small);
1541
+ background-color: var(--primer-color-brand);
1542
+ color: var(--primer-color-background-outlined-default);
1543
+ border: none;
1544
+ font-size: var(--primer-typography-body-medium-size);
1545
+ font-weight: var(--primer-typography-body-medium-weight);
1546
+ width: 100%;
1547
+ cursor: pointer;
1548
+ transition: all var(--primer-animation-duration)
1549
+ var(--primer-animation-easing);
1550
+ }
1551
+
1552
+ .klarna-pay-button:hover:not(.disabled) {
1553
+ filter: brightness(105%);
1554
+ }
1555
+
1556
+ .klarna-pay-button.loading {
1557
+ opacity: 0.7;
1558
+ pointer-events: none;
1559
+ }
1560
+
1561
+ .klarna-pay-button.disabled {
1562
+ opacity: 0.5;
1563
+ cursor: not-allowed;
1564
+ filter: brightness(85%);
1565
+ }
1566
+
1567
+ .loading {
1568
+ text-align: center;
1569
+ font-size: var(--primer-typography-body-medium-size);
1570
+ color: var(--primer-color-text-secondary);
1571
+ padding: var(--primer-space-medium);
1572
+ }
1573
+
1574
+ .error {
1575
+ color: var(--primer-color-text-negative);
1576
+ font-size: var(--primer-typography-body-medium-size);
1577
+ padding: var(--primer-space-medium);
1578
+ text-align: center;
1579
+ border: 1px solid var(--primer-color-border-outlined-error);
1580
+ background-color: var(--primer-color-background-outlined-default);
1581
+ border-radius: var(--primer-radius-small);
1582
+ }
1583
+ `;var J=class extends y{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=T("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new V(this,{task:async([e,r])=>{if(!e||!r)return R;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){N.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){N.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?h`<div class="loading">
1584
+ <primer-spinner size="small"></primer-spinner>
1585
+ </div>`:h`
1586
+ <div class="category-selection">
1587
+ ${e.map(o=>h`
1588
+ <button
1589
+ class=${Z({"category-button":!0,selected:o.id===this.selectedCategory})}
1590
+ @click=${()=>{this.selectCategory(o.id)}}
1591
+ >
1592
+ ${o.name}
1593
+ </button>
1594
+ `)}
1595
+ </div>
1596
+ `}renderExpandedContent(){return h`
1597
+ ${this.renderCategorySelection()}
1598
+ ${this.selectedCategory?h`
1599
+ <div
1600
+ id="klarna-category-container"
1601
+ class="klarna-category-container"
1602
+ ></div>
1603
+ `:u}
1604
+
1605
+ <button
1606
+ class=${Z({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
1607
+ ?disabled=${!this.selectedCategory||this.sdkState?.isProcessing}
1608
+ @click=${()=>this.startKlarnaPayment()}
1609
+ >
1610
+ ${T("confirm",{id:"confirm"})}
1611
+ </button>
1612
+ `}render(){return this._paymentMethodManagerTask.render({error:e=>{let r=e instanceof Error?e.message:"Unknown error in Klarna";return h`<div class="error">
1613
+ Error loading Klarna: ${r}
1614
+ </div>`},complete:({manager:e,klarnaIcon:r})=>e?h`
1615
+ <div class="klarna-container ${this.isExpanded?"expanded":""}">
1616
+ <div class="klarna-button-header">
1617
+ <primer-button
1618
+ buttonType="button"
1619
+ variant="secondary"
1620
+ class="klarna-button"
1621
+ @click=${this.toggleExpand}
1622
+ aria-expanded=${this.isExpanded}
1623
+ aria-controls="collapsable-content"
1624
+ aria-label=${this.headerAriaLabel}
1625
+ >
1626
+ <img src=${r} alt="Klarna logo" />
1627
+ <span>${T("pay_with",{id:"pay_with"})} Klarna</span>
1628
+ <span
1629
+ class="klarna-accordion-icon ${this.isExpanded?"expanded":""}"
1630
+ >
1631
+
1632
+ </span>
1633
+ </primer-button>
1634
+ </div>
1635
+
1636
+ <div
1637
+ class="klarna-expanded-content ${this.isExpanded?"visible":""}"
1638
+ >
1639
+ <div class="klarna-accordion-content">
1640
+ ${this.renderExpandedContent()}
1641
+ </div>
1642
+ </div>
1643
+ </div>
1644
+ `:u})}};J.styles=[$,$a],n([P({context:Q,subscribe:!0}),p()],J.prototype,"paymentManagers",2),n([P({context:G,subscribe:!0}),p()],J.prototype,"sdkState",2),n([P({context:ct,subscribe:!0}),p({type:Object})],J.prototype,"headlessUtils",2),n([P({context:cr,subscribe:!0}),p()],J.prototype,"klarnaCategories",2),n([I()],J.prototype,"selectedCategory",2),n([I()],J.prototype,"isExpanded",2),n([I()],J.prototype,"headerAriaLabel",2),n([Ot("#klarna-category-container")],J.prototype,"klarnaContainer",2),J=n([v("primer-klarna"),z()],J);var mC=Ml({tagName:"primer-klarna",elementClass:J,react:Pl});import{createComponent as wl}from"@lit/react";import Tl from"react";var Oa=g`
1645
+ :host {
1646
+ height: calc(
1647
+ var(--primer-typography-title-large-line-height) +
1648
+ calc(2 * var(--primer-space-medium))
1649
+ );
1650
+ display: flex;
1651
+ }
1652
+
1653
+ .native-button-container {
1654
+ width: 100%;
1655
+ height: 100%;
1656
+ flex: 1;
1657
+ }
1658
+ `;var Et=class extends y{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new V(this,{args:()=>[this.paymentMethod?.type],task:async([e])=>{if(!e)return R;let r=this.paymentManagers.get(e)?.manager;if(!r)throw new Error(`No manager found for payment method type ${e}`);return r}}),new V(this,{args:()=>[this.loadManagerTask.value],task:async([e])=>{if(!e)return R;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),s=e.createButton(),l=this.createRenderOptions(o);return await s.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,l),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:()=>h`
1659
+ <!-- The native button container is rendered first -->
1660
+ <div class="native-button-container" id="${this._buttonId}"></div>
1661
+ `,pending:()=>u})}};Et.styles=[$,Oa],n([p({type:Object})],Et.prototype,"paymentMethod",2),n([P({context:Q,subscribe:!0}),p()],Et.prototype,"paymentManagers",2),n([P({context:he,subscribe:!0}),p()],Et.prototype,"computedStyles",2),Et=n([v("primer-native-payment")],Et);var kC=wl({tagName:"primer-native-payment",elementClass:Et,react:Tl});import{createComponent as kl}from"@lit/react";import Nl from"react";var Da=g`
1662
+ :host {
1663
+ display: contents;
1664
+ }
1665
+ `;var kt=class extends y{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 h`<primer-card-form></primer-card-form>`;case"NATIVE":return h`<primer-native-payment
1666
+ .paymentMethod=${e}
1667
+ ></primer-native-payment>`;case"REDIRECT":return h`<primer-redirect-payment
1668
+ .paymentMethod=${e}
1669
+ ></primer-redirect-payment>`;case"KLARNA":return h`<primer-klarna></primer-klarna>`;case"ACH":return h`
1670
+ <primer-dynamic-payment
1671
+ .paymentMethod=${e}
1672
+ ></primer-dynamic-payment>
1673
+ `;default:return u}}};kt.styles=[Da],n([p({type:String})],kt.prototype,"type",2),n([P({context:ue,subscribe:!0}),p()],kt.prototype,"paymentMethods",2),kt=n([v("primer-payment-method")],kt);var KC=kl({tagName:"primer-payment-method",elementClass:kt,react:Nl});import{createComponent as Il}from"@lit/react";import Ll from"react";var be=class extends y{render(){return h`
1674
+ <primer-checkout-state type="complete"></primer-checkout-state>
1675
+ `}};be=n([v("primer-checkout-complete")],be);var tA=Il({tagName:"primer-checkout-complete",elementClass:be,react:Ll});import{createComponent as Rl}from"@lit/react";import $l from"react";var ee=class extends y{constructor(){super(...arguments);this.sdkState=null}render(){return h`
1676
+ <primer-checkout-state
1677
+ type="failure"
1678
+ description=${this.sdkState?.error?.message||""}
1679
+ ></primer-checkout-state>
1680
+ `}};n([P({context:G,subscribe:!0}),p()],ee.prototype,"sdkState",2),ee=n([v("primer-checkout-error")],ee);var mA=Rl({tagName:"primer-checkout-error",elementClass:ee,react:$l});import{createComponent as Ol}from"@lit/react";import Dl from"react";var Va=g`
1681
+ :host {
1682
+ display: contents;
1683
+ }
1684
+
1685
+ .primer-main-list {
1686
+ display: flex;
1687
+ flex-direction: column;
1688
+ gap: var(--primer-space-small);
1689
+ }
1690
+
1691
+ .primer-is-processing {
1692
+ opacity: 0.5;
1693
+ pointer-events: none;
1694
+ }
1695
+
1696
+ primer-vault-manager {
1697
+ margin-bottom: var(--primer-space-xlarge);
1698
+ }
1699
+ `;var Nt=class extends y{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?h`
1700
+ <slot name="checkout-complete">
1701
+ <primer-checkout-complete></primer-checkout-complete>
1702
+ </slot>
1703
+ `:h`
1704
+ <slot name="payments" @slotchange=${this.onSlotChange}></slot>
1705
+ ${U(this.hasAssignedContent,()=>u,()=>h`
1706
+ <div
1707
+ class=${Z({"primer-is-processing":!!this.sdkState?.isProcessing})}
1708
+ >
1709
+ <primer-vault-manager></primer-vault-manager>
1710
+ <primer-show-other-payments>
1711
+ <div slot="other-payments" class="primer-main-list">
1712
+ ${this.paymentMethods?.toArray().map(e=>h`
1713
+ <primer-payment-method
1714
+ type=${e.type}
1715
+ ></primer-payment-method>
1716
+ `)}
1717
+ </div>
1718
+ </primer-show-other-payments>
1719
+ <primer-error-message-container></primer-error-message-container>
1720
+ </div>
1721
+ `)}
1722
+ `}};Nt.styles=[$,Va],n([P({context:ue,subscribe:!0}),p()],Nt.prototype,"paymentMethods",2),n([P({context:G,subscribe:!0}),p()],Nt.prototype,"sdkState",2),Nt=n([v("primer-main")],Nt);var IA=Ol({tagName:"primer-main",elementClass:Nt,react:Dl});import{createComponent as Vl}from"@lit/react";import Hl from"react";var Ha=g`
1723
+ :host {
1724
+ height: calc(
1725
+ var(--primer-typography-title-large-line-height) +
1726
+ calc(2 * var(--primer-space-medium))
1727
+ );
1728
+ display: flex;
1729
+
1730
+ /* Default value for the background color CSS variable */
1731
+ --redirect-payment-button-bg-color: var(
1732
+ --primer-color-background-outlined-default
1733
+ );
1734
+ }
1735
+
1736
+ primer-button {
1737
+ width: 100%;
1738
+ height: 100%;
1739
+ }
1740
+
1741
+ primer-button::part(button) {
1742
+ background-color: var(--redirect-payment-button-bg-color);
1743
+ border: 1px solid var(--primer-color-border-outlined-default);
1744
+ color: var(--primer-color-text-primary);
1745
+ flex: 1;
1746
+ padding: var(--primer-space-small);
1747
+ display: flex;
1748
+ align-items: center;
1749
+ justify-content: center;
1750
+ gap: var(--primer-space-small);
1751
+ }
1752
+
1753
+ /* Default layout: icon on the left (START) */
1754
+ primer-button {
1755
+ display: flex;
1756
+ flex-direction: row;
1757
+ }
1758
+
1759
+ /* When icon position is END */
1760
+ primer-button.icon-end {
1761
+ flex-direction: row-reverse;
1762
+ }
1763
+
1764
+ .image-container {
1765
+ display: flex;
1766
+ justify-content: center;
1767
+ align-items: center;
1768
+ min-width: 100px;
1769
+ height: 100%;
1770
+ }
1771
+
1772
+ .button-text {
1773
+ font-family: var(--primer-typography-font-family);
1774
+ font-size: var(--primer-typography-title-small-font-size);
1775
+ font-weight: var(--primer-typography-title-small-font-weight);
1776
+ line-height: var(--primer-typography-title-small-line-height);
1777
+ letter-spacing: var(--primer-typography-title-small-letter-spacing);
1778
+ white-space: nowrap;
1779
+ overflow: hidden;
1780
+ text-overflow: ellipsis;
1781
+ }
1782
+
1783
+ /* Target the img specifically inside our component */
1784
+ img {
1785
+ max-width: 100px;
1786
+ width: 100%;
1787
+ height: auto;
1788
+ object-fit: cover;
1789
+ max-height: 100%;
1790
+ }
1791
+
1792
+ /* For image container sizing */
1793
+ .image-container {
1794
+ flex-shrink: 0;
1795
+ flex-grow: 1;
1796
+ }
1797
+ `;var yt=class extends y{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new V(this,{task:async([e,r])=>!e||!r?R:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new V(this,{task:async([e,r])=>{if(!e||!r)return R;let o=r.getPaymentMethodConfiguration(e);if(!o)return R;let s=o.displayMetadata.button.backgroundColor.colored??o.displayMetadata.button.backgroundColor.light,l=o.displayMetadata.button.iconPositionRelativeToText||"START";return{backgroundColor:s,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 V(this,{task:async([e,r])=>!e||!r?R:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?Ge(e):"";return r==="payWith"&&(r="pay_with"),T(r,{id:r})}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);let r={loading:!!this.sdkState?.isProcessing,"icon-end":e.iconPosition==="END","image-only":!e.displayName},o=e.displayName?h`
1798
+ <span class="image-container">
1799
+ <img src="${e.iconUrl}" alt="${e.name}" />
1800
+ </span>
1801
+ <span class="button-text">${e.displayName}</span>
1802
+ `:h`
1803
+ <span class="image-container">
1804
+ <img src="${e.iconUrl}" alt="${e.name}" />
1805
+ </span>
1806
+ `;return h`
1807
+ <primer-button
1808
+ @click="${()=>this.startRedirectPayment()}"
1809
+ class=${Z(r)}
1810
+ title="${T("pay_with",{id:"pay_with"})} ${e.name}"
1811
+ >
1812
+ ${o}
1813
+ </primer-button>
1814
+ `}})}};yt.styles=[$,Ha],n([p({type:Object})],yt.prototype,"paymentMethod",2),n([P({context:Q,subscribe:!0})],yt.prototype,"paymentManagers",2),n([P({context:G,subscribe:!0})],yt.prototype,"sdkState",2),n([P({context:ct,subscribe:!0})],yt.prototype,"headlessUtils",2),yt=n([v("primer-redirect-payment"),z()],yt);var e_=Vl({tagName:"primer-redirect-payment",elementClass:yt,react:Hl});import{createComponent as Ul}from"@lit/react";import Yl from"react";var Ua=g`
1815
+ :host {
1816
+ display: block;
1817
+ margin-top: var(--primer-space-medium);
1818
+ margin-bottom: var(--primer-space-medium);
1819
+ }
1820
+
1821
+ .other-payment-methods-container {
1822
+ width: 100%;
1823
+ }
1824
+
1825
+ .other-payment-methods-content {
1826
+ padding: var(--primer-space-medium) 0;
1827
+ }
1828
+
1829
+ .primer-loader {
1830
+ display: flex;
1831
+ justify-content: center;
1832
+ align-items: center;
1833
+ }
1834
+ `;var Ht=class extends y{constructor(){super(...arguments);this.vaultManager=null}render(){return this.vaultManager?.isLoading?u:!this.vaultManager||!this.vaultManager.enabled?h`<slot name="other-payments"></slot>`:h`
1835
+ <div class="other-payment-methods-container">
1836
+ <primer-collapsable
1837
+ buttonVariant="secondary"
1838
+ .expanded="${this.vaultManager?.vaultedPaymentMethods.length===0}"
1839
+ .header="${T("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
1840
+ >
1841
+ <div class="other-payment-methods-content">
1842
+ <slot name="other-payments"></slot>
1843
+ </div>
1844
+ </primer-collapsable>
1845
+ </div>
1846
+ `}};Ht.styles=[Ua],n([P({context:fe,subscribe:!0}),p({type:Object,attribute:!1})],Ht.prototype,"vaultManager",2),Ht=n([v("primer-show-other-payments")],Ht);var A_=Ul({tagName:"primer-show-other-payments",elementClass:Ht,react:Yl});import{createComponent as Fl}from"@lit/react";import zl from"react";var P_=Fl({tagName:"primer-button",elementClass:tt,react:zl});import{createComponent as sd}from"@lit/react";import nd from"react";var Bl=Co(Oi(),1),Ee=Co(Oi(),1);function Di(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function Kl(i){return i?i===i.toUpperCase()?Di(i):i:""}function Ya(i,t){return[i,t].filter(Boolean).join(" ")}function Gl(i,t){return!i||!t?"":`Expires ${i}/${t.slice(-2)}`}function Fa(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function jl(i){let t=i.paymentInstrumentData,e=Kl(t.network),r=t.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${e} ${Fa(r)}`:e)||" Card"}`,s=Gl(t.expirationMonth,t.expirationYear);return{description:o,secondaryDescription:s}}function ql(i){let t=i.paymentInstrumentData,e=t.externalPayerInfo?.email||"",r=t.externalPayerInfo?.firstName||"",o=t.externalPayerInfo?.lastName||"",s=i.userDescription||e||"PayPal Account",l=Ya(r,o);return{description:s,secondaryDescription:l}}function Wl(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"),l=Ya(r,o);return{description:s,secondaryDescription:l}}function Zl(i){let t=i.paymentInstrumentData,e=t.accountNumberLastFourDigits||"",r=t.bankName||"",o=t.accountType||"",s=i.userDescription;s||(r&&e?s=`${r} ${Fa(e)}`:r?s=r:s="Bank Account");let l=o?`${Di(o)} Account`:"";return{description:s,secondaryDescription:l}}function Xl(i){let t=i.paymentInstrumentType,e=Di(t.replace(/_/g," "));return{description:i.userDescription||e}}var Jl={[Ee.PaymentInstrumentType.CARD]:jl,[Ee.PaymentInstrumentType.PAYPAL_VAULTED]:ql,[Ee.PaymentInstrumentType.KLARNA_CUSTOMER_TOKEN]:Wl,[Ee.PaymentInstrumentType.AUTOMATED_CLEARING_HOUSE]:Zl};function za(i){try{let t=Jl[i.paymentInstrumentType];return t?t(i):Xl(i)}catch(t){return N.error("FormatUtils",`Error formatting payment method ${i.id}:`,t),{description:i.userDescription||i.id||"Payment Method"}}}var Ba=g`
1847
+ :host {
1848
+ display: block;
1849
+ width: 100%;
1850
+ position: relative;
1851
+ }
1852
+
1853
+ .vault-manager {
1854
+ display: flex;
1855
+ flex-direction: column;
1856
+ position: relative;
1857
+ }
1858
+
1859
+ .vault-manager-content {
1860
+ display: flex;
1861
+ flex-direction: column;
1862
+ width: 100%;
1863
+ position: relative;
1864
+ }
1865
+
1866
+ /* Content container using CSS Grid for height animation */
1867
+ .content-container {
1868
+ display: grid;
1869
+ grid-template-rows: 1fr;
1870
+ transition: grid-template-rows var(--primer-animation-duration)
1871
+ var(--primer-animation-easing);
1872
+ width: 100%;
1873
+ position: relative;
1874
+ }
1875
+
1876
+ /* Required to make grid animation work - ensures content can expand/collapse properly */
1877
+ .content-container > * {
1878
+ min-height: 0;
1879
+ overflow: hidden;
1880
+ }
1881
+
1882
+ /* Submit button container */
1883
+ .submit-button-container {
1884
+ display: grid;
1885
+ grid-template-rows: 1fr;
1886
+ transition: grid-template-rows var(--primer-animation-duration)
1887
+ var(--primer-animation-easing);
1888
+ overflow: hidden;
1889
+ margin-top: var(--primer-space-small);
1890
+ width: 100%;
1891
+ }
1892
+
1893
+ /* Ensure the submit button has full width */
1894
+ .submit-button {
1895
+ width: 100%;
1896
+ }
1897
+
1898
+ /* Make sure pay button inside the submit component is full width */
1899
+ primer-vault-payment-submit::part(button),
1900
+ ::slotted(primer-button) {
1901
+ width: 100%;
1902
+ }
1903
+
1904
+ /* Payment methods list */
1905
+ .payment-methods-list {
1906
+ display: flex;
1907
+ flex-direction: column;
1908
+ gap: var(--primer-space-small);
1909
+ width: 100%;
1910
+ position: relative;
1911
+ }
1912
+
1913
+ /* Delete confirmation container */
1914
+ .delete-confirmation-container {
1915
+ width: 100%;
1916
+ position: relative;
1917
+ }
1918
+
1919
+ /* Loading overlay styles */
1920
+ .loading-overlay {
1921
+ position: absolute;
1922
+ top: 0;
1923
+ left: 0;
1924
+ width: 100%;
1925
+ height: 100%;
1926
+ display: flex;
1927
+ align-items: center;
1928
+ justify-content: center;
1929
+ background-color: rgba(255, 255, 255, 0.7);
1930
+ z-index: 10;
1931
+ border-radius: var(--primer-radius-medium);
1932
+ backdrop-filter: blur(2px);
1933
+ opacity: 0; /* Start invisible */
1934
+ }
1935
+
1936
+ /* Add styles for when updating is active */
1937
+ .is-updating {
1938
+ pointer-events: none; /* Prevent interaction when updating */
1939
+ }
1940
+
1941
+ /*
1942
+ * Component-specific styles to ensure smooth animations
1943
+ * These components need display:block to work with the grid layout
1944
+ */
1945
+ primer-vault-payment-method-item,
1946
+ primer-vault-empty-state,
1947
+ primer-vault-delete-confirmation {
1948
+ display: block;
1949
+ width: 100%;
1950
+ }
1951
+
1952
+ /* Disable animations for reduced motion preference */
1953
+ @media (prefers-reduced-motion: reduce) {
1954
+ .content-container,
1955
+ .submit-button-container,
1956
+ primer-vault-payment-method-item,
1957
+ primer-vault-payment-submit,
1958
+ primer-vault-empty-state,
1959
+ primer-vault-delete-confirmation {
1960
+ transition: none;
1961
+ }
1962
+ }
1963
+ `;var We=globalThis,Yr=We.trustedTypes,Ka=Yr?Yr.createPolicy("lit-html",{createHTML:i=>i}):void 0,Hi="$lit$",It=`lit$${Math.random().toFixed(9).slice(2)}$`,Ui="?"+It,Ql=`<${Ui}>`,oe=document,Fr=()=>oe.createComment(""),Ze=i=>i===null||typeof i!="object"&&typeof i!="function",Yi=Array.isArray,Xa=i=>Yi(i)||typeof i?.[Symbol.iterator]=="function",Vi=`[
1964
+ \f\r]`,qe=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ga=/-->/g,ja=/>/g,re=RegExp(`>|${Vi}(?:([^\\s"'>=/]+)(${Vi}*=${Vi}*(?:[^
1965
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),qa=/'/g,Wa=/"/g,Ja=/^(?:script|style|textarea|title)$/i,Fi=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),U_=Fi(1),Y_=Fi(2),F_=Fi(3),Xe=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),Za=new WeakMap,ie=oe.createTreeWalker(oe,129);function Qa(i,t){if(!Yi(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ka!==void 0?Ka.createHTML(t):t}var ts=(i,t)=>{let e=i.length-1,r=[],o,s=t===2?"<svg>":t===3?"<math>":"",l=qe;for(let f=0;f<e;f++){let m=i[f],_,w,A=-1,O=0;for(;O<m.length&&(l.lastIndex=O,w=l.exec(m),w!==null);)O=l.lastIndex,l===qe?w[1]==="!--"?l=Ga:w[1]!==void 0?l=ja:w[2]!==void 0?(Ja.test(w[2])&&(o=RegExp("</"+w[2],"g")),l=re):w[3]!==void 0&&(l=re):l===re?w[0]===">"?(l=o??qe,A=-1):w[1]===void 0?A=-2:(A=l.lastIndex-w[2].length,_=w[1],l=w[3]===void 0?re:w[3]==='"'?Wa:qa):l===Wa||l===qa?l=re:l===Ga||l===ja?l=qe:(l=re,o=void 0);let H=l===re&&i[f+1].startsWith("/>")?" ":"";s+=l===qe?m+Ql:A>=0?(r.push(_),m.slice(0,A)+Hi+m.slice(A)+It+H):m+It+(A===-2?f:H)}return[Qa(i,s+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Je=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let s=0,l=0,f=t.length-1,m=this.parts,[_,w]=ts(t,e);if(this.el=i.createElement(_,r),ie.currentNode=this.el.content,e===2||e===3){let A=this.el.content.firstChild;A.replaceWith(...A.childNodes)}for(;(o=ie.nextNode())!==null&&m.length<f;){if(o.nodeType===1){if(o.hasAttributes())for(let A of o.getAttributeNames())if(A.endsWith(Hi)){let O=w[l++],H=o.getAttribute(A).split(It),ht=/([.?@])?(.*)/.exec(O);m.push({type:1,index:s,name:ht[2],strings:H,ctor:ht[1]==="."?Br:ht[1]==="?"?Kr:ht[1]==="@"?Gr:se}),o.removeAttribute(A)}else A.startsWith(It)&&(m.push({type:6,index:s}),o.removeAttribute(A));if(Ja.test(o.tagName)){let A=o.textContent.split(It),O=A.length-1;if(O>0){o.textContent=Yr?Yr.emptyScript:"";for(let H=0;H<O;H++)o.append(A[H],Fr()),ie.nextNode(),m.push({type:2,index:++s});o.append(A[O],Fr())}}}else if(o.nodeType===8)if(o.data===Ui)m.push({type:2,index:s});else{let A=-1;for(;(A=o.data.indexOf(It,A+1))!==-1;)m.push({type:7,index:s}),A+=It.length-1}s++}}static createElement(t,e){let r=oe.createElement("template");return r.innerHTML=t,r}};function ae(i,t,e=i,r){if(t===Xe)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,s=Ze(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=ae(i,o._$AS(i,t.values),o,r)),t}var zr=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??oe).importNode(e,!0);ie.currentNode=o;let s=ie.nextNode(),l=0,f=0,m=r[0];for(;m!==void 0;){if(l===m.index){let _;m.type===2?_=new Qe(s,s.nextSibling,this,t):m.type===1?_=new m.ctor(s,m.name,m.strings,this,t):m.type===6&&(_=new jr(s,this,t)),this._$AV.push(_),m=r[++f]}l!==m?.index&&(s=ie.nextNode(),l++)}return ie.currentNode=oe,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++}},Qe=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,o){this.type=2,this._$AH=K,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=ae(this,t,e),Ze(t)?t===K||t==null||t===""?(this._$AH!==K&&this._$AR(),this._$AH=K):t!==this._$AH&&t!==Xe&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Xa(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!==K&&Ze(this._$AH)?this._$AA.nextSibling.data=t:this.T(oe.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=Je.createElement(Qa(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let s=new zr(o,this),l=s.u(this.options);s.p(e),this.T(l),this._$AH=s}}_$AC(t){let e=Za.get(t.strings);return e===void 0&&Za.set(t.strings,e=new Je(t)),e}k(t){Yi(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(Fr()),this.O(Fr()),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))}},se=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,s){this.type=1,this._$AH=K,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=K}_$AI(t,e=this,r,o){let s=this.strings,l=!1;if(s===void 0)t=ae(this,t,e,0),l=!Ze(t)||t!==this._$AH&&t!==Xe,l&&(this._$AH=t);else{let f=t,m,_;for(t=s[0],m=0;m<s.length-1;m++)_=ae(this,f[r+m],e,m),_===Xe&&(_=this._$AH[m]),l||(l=!Ze(_)||_!==this._$AH[m]),_===K?t=K:t!==K&&(t+=(_??"")+s[m+1]),this._$AH[m]=_}l&&!o&&this.j(t)}j(t){t===K?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Br=class extends se{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===K?void 0:t}},Kr=class extends se{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==K)}},Gr=class extends se{constructor(t,e,r,o,s){super(t,e,r,o,s),this.type=5}_$AI(t,e=this){if((t=ae(this,t,e,0)??K)===Xe)return;let r=this._$AH,o=t===K&&r!==K||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,s=t!==K&&(r===K||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)}},jr=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){ae(this,t)}},es={M:Hi,P:It,A:Ui,C:1,L:ts,R:zr,D:Xa,V:ae,I:Qe,H:se,N:Kr,U:Gr,B:Br,F:jr},td=We.litHtmlPolyfillSupport;td?.(Je,Qe),(We.litHtmlVersions??(We.litHtmlVersions=[])).push("3.3.0");var Ce={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},tr=i=>(...t)=>({_$litDirective$:i,values:t}),qr=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{I:Z_}=es;var rs=i=>i.strings===void 0;var er=(i,t)=>{let e=i._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),er(r,t);return!0},Wr=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},is=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),id(t)}};function ed(i){this._$AN!==void 0?(Wr(this),this._$AM=i,is(this)):this._$AM=i}function rd(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++)er(r[s],!1),Wr(r[s]);else r!=null&&(er(r,!1),Wr(r));else er(this,i)}var id=i=>{i.type==Ce.CHILD&&(i._$AP??(i._$AP=rd),i._$AQ??(i._$AQ=ed))},Ae=class extends qr{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),is(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(er(this,t),Wr(this))}setValue(t){if(rs(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 Zr=new WeakMap,_e=class{constructor(t,e){this.startPaused=!1,this.disabled=!1,this.clients=new Set,this.pendingComplete=!1,this.host=t,this.defaultOptions=e.defaultOptions||{},this.startPaused=!!e.startPaused,this.disabled=!!e.disabled,this.onComplete=e.onComplete,Zr.set(this.host,this)}async add(t){this.clients.add(t),this.startPaused&&t.webAnimation?.pause(),this.pendingComplete=!0,await t.finished,this.pendingComplete&&!this.isAnimating&&(this.pendingComplete=!1,this.onComplete?.())}remove(t){this.clients.delete(t)}pause(){this.clients.forEach(t=>t.webAnimation?.pause())}play(){this.clients.forEach(t=>t.webAnimation?.play())}cancel(){this.clients.forEach(t=>t.webAnimation?.cancel()),this.clients.clear()}finish(){this.clients.forEach(t=>t.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(t=>t.webAnimation?.playState==="running")}async finished(){await Promise.all(Array.from(this.clients).map(t=>t.finished))}};var os=0,zi=new Map,as=new WeakSet,Bi=()=>new Promise(i=>requestAnimationFrame(i));var ss=(i,t)=>{let e=i-t;return e===0?void 0:e},ns=(i,t)=>{let e=i/t;return e===1?void 0:e},Xr={left:(i,t)=>{let e=ss(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateX(${e}px)`}},top:(i,t)=>{let e=ss(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateY(${e}px)`}},width:(i,t)=>{let e;t===0&&(t=1,e={width:"1px"});let r=ns(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:`scaleX(${r})`}},height:(i,t)=>{let e;t===0&&(t=1,e={height:"1px"});let r=ns(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:`scaleY(${r})`}}},ds={duration:333,easing:"ease-in-out"},cs=["left","top","width","height","opacity","color","background"],ls=new WeakMap,Jr=class extends Ae{constructor(t){if(super(t),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,t.type===Ce.CHILD)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){this.resolveFinished?.(),this.finished=new Promise(t=>{this.l=t})}async resolveFinished(){this.l?.(),this.l=void 0}render(t){return K}getController(){return Zr.get(this.u)}isDisabled(){return this.options.disabled||this.getController()?.disabled}update(t,[e]){let r=this.u===void 0;return r&&(this.u=t.options?.host,this.u.addController(this),this.u.updateComplete.then(o=>this.t=!0),this.element=t.element,ls.set(this.element,this)),this.optionsOrCallback=e,(r||typeof e!="function")&&this.p(e),this.render(e)}p(t){t=t??{};let e=this.getController();e!==void 0&&((t={...e.defaultOptions,...t}).keyframeOptions={...e.defaultOptions.keyframeOptions,...t.keyframeOptions}),t.properties??(t.properties=cs),this.options=t}m(){let t={},e=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(o=>{let s=e[o]??(Xr[o]?void 0:r[o]),l=Number(s);t[o]=isNaN(l)?s+"":l}),t}v(){let t,e=!0;return this.options.guard&&(t=this.options.guard(),e=((r,o)=>{if(Array.isArray(r)){if(Array.isArray(o)&&o.length===r.length&&r.every((s,l)=>s===o[l]))return!1}else if(o===r)return!1;return!0})(t,this._)),this.h=this.t&&!this.isDisabled()&&!this.isAnimating()&&e&&this.element.isConnected,this.h&&(this._=Array.isArray(t)?Array.from(t):t),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 t;this.prepare(),await Bi;let e=this.O(),r=this.j(this.options.keyframeOptions,e),o=this.m();if(this.A!==void 0){let{from:s,to:l}=this.N(this.A,o,e);this.log("measured",[this.A,o,s,l]),t=this.calculateKeyframes(s,l)}else{let s=zi.get(this.options.inId);if(s){zi.delete(this.options.inId);let{from:l,to:f}=this.N(s,o,e);t=this.calculateKeyframes(l,f),t=this.options.in?[{...this.options.in[0],...t[0]},...this.options.in.slice(1),t[1]]:t,os++,t.forEach(m=>m.zIndex=os)}else this.options.in&&(t=[...this.options.in,{}])}this.animate(t,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&&zi.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await Bi(),this.i?.isConnected){let e=this.o&&this.o.parentNode===this.i?this.o:null;if(this.i.insertBefore(this.element,e),this.options.stabilizeOut){let r=this.m();this.log("stabilizing out");let o=this.A.left-r.left,s=this.A.top-r.top;getComputedStyle(this.element).position!=="static"||o===0&&s===0||(this.element.style.position="relative"),o!==0&&(this.element.style.left=o+"px"),s!==0&&(this.element.style.top=s+"px")}}let t=this.j(this.options.keyframeOptions);await this.animate(this.options.out,t),this.element.remove()}prepare(){this.createFinished()}start(){this.options.onStart?.(this)}didFinish(t){t&&this.options.onComplete?.(this),this.A=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}O(){let t=[];for(let e=this.element.parentNode;e;e=e?.parentNode){let r=ls.get(e);r&&!r.isDisabled()&&r&&t.push(r)}return t}get isHostRendered(){let t=as.has(this.u);return t||this.u.updateComplete.then(()=>{as.add(this.u)}),t}j(t,e=this.O()){let r={...ds};return e.forEach(o=>Object.assign(r,o.options.keyframeOptions)),Object.assign(r,t),r}N(t,e,r){t={...t},e={...e};let o=r.map(f=>f.animatingProperties).filter(f=>f!==void 0),s=1,l=1;return o.length>0&&(o.forEach(f=>{f.width&&(s/=f.width),f.height&&(l/=f.height)}),t.left!==void 0&&e.left!==void 0&&(t.left=s*t.left,e.left=s*e.left),t.top!==void 0&&e.top!==void 0&&(t.top=l*t.top,e.top=l*e.top)),{from:t,to:e}}calculateKeyframes(t,e,r=!1){let o={},s={},l=!1,f={};for(let m in e){let _=t[m],w=e[m];if(m in Xr){let A=Xr[m];if(_===void 0||w===void 0)continue;let O=A(_,w);O.transform!==void 0&&(f[m]=O.value,l=!0,o.transform=`${o.transform??""} ${O.transform}`,O.overrideFrom!==void 0&&Object.assign(o,O.overrideFrom))}else _!==w&&_!==void 0&&w!==void 0&&(l=!0,o[m]=_,s[m]=w)}return o.transformOrigin=s.transformOrigin=r?"center center":"top left",this.animatingProperties=f,l?[o,s]:void 0}async animate(t,e=this.options.keyframeOptions){this.start(),this.frames=t;let r=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=t=this.options.onFrames(this),this.log("modified frames",t)),t!==void 0)){this.log("animate",[t,e]),r=!0,this.webAnimation=this.element.animate(t,e);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(t,e){this.shouldLog&&!this.isDisabled()&&console.log(t,this.options.id,e)}},Ut=tr(Jr);var od=["top","right","bottom","left"],Qr=class extends Ae{constructor(t){if(super(t),t.type!==Ce.ELEMENT)throw Error("The `position` directive must be used in attribute position.")}render(t,e){return K}update(t,[e,r]){return this.u===void 0&&(this.u=t.options?.host,this.u.addController(this)),this.S=t.element,this.C=e,this.F=r??["left","top","width","height"],this.render(e,r)}hostUpdated(){this.$()}$(){let t=typeof this.C=="function"?this.C():this.C?.value,e=t.offsetParent;if(t===void 0||!e)return;let r=t.getBoundingClientRect(),o=e.getBoundingClientRect();this.F?.forEach(s=>{let l=od.includes(s)?r[s]-o[s]:r[s];this.S.style[s]=l+"px"})}},ad=tr(Qr);var nt=class extends y{constructor(){super();this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage="";this.animationDuration=300;new _e(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(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=T("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:T("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:T("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 za(r).description||""}catch{return""}}renderLoadingOverlay(){return h`
1966
+ <div
1967
+ class="loading-overlay"
1968
+ ${Ut({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1969
+ >
1970
+ <primer-spinner
1971
+ size="medium"
1972
+ color="var(--primer-color-loader)"
1973
+ ></primer-spinner>
1974
+ </div>
1975
+ `}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return u;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return h`
1976
+ <div class="delete-confirmation-container">
1977
+ <primer-vault-delete-confirmation
1978
+ .isDeleting=${this.isDeleting}
1979
+ .paymentMethodId=${this.deletePaymentMethodId}
1980
+ .paymentMethodName=${e}
1981
+ @confirm-delete=${this.handleConfirmDelete}
1982
+ @cancel-delete=${this.handleCancelDelete}
1983
+ ${Ut({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1984
+ ></primer-vault-delete-confirmation>
1985
+ </div>
1986
+ `}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?u:h`
1987
+ <primer-vault-payment-method-item
1988
+ .paymentMethod=${e}
1989
+ .isEditMode=${this.isEditMode}
1990
+ @delete-payment-method=${this.handleDeletePaymentMethod}
1991
+ ${Ut({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
1992
+ ></primer-vault-payment-method-item>
1993
+ `}renderPaymentMethodList(){let e=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&e.length>0&&!this.deletePaymentMethodId;return h`
1994
+ <div class="payment-methods-list">
1995
+ ${e.map(o=>this.renderPaymentMethodItem(o))}
1996
+ ${U(r,()=>h`
1997
+ <div class="submit-button-container">
1998
+ <primer-vault-payment-submit
1999
+ class="submit-button"
2000
+ @primer-vault-payment-error=${this.handlePaymentError}
2001
+ ${Ut({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2002
+ ></primer-vault-payment-submit>
2003
+ </div>
2004
+ `,()=>u)}
2005
+ </div>
2006
+ `}render(){if(!this.vaultManagerContext?.enabled)return u;let e=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=this.vaultManagerContext.isUpdating;return h`
2007
+ <div class="vault-manager ${o?"is-updating":""}">
2008
+ <primer-vault-manager-header
2009
+ .isEditMode=${this.isEditMode}
2010
+ .hasPaymentMethods=${e}
2011
+ @toggle-edit-mode=${this.handleToggleEditMode}
2012
+ ></primer-vault-manager-header>
2013
+
2014
+ ${U(this.errorMessage,()=>h`
2015
+ <primer-vault-error-message
2016
+ .errorMessage=${this.errorMessage}
2017
+ @close-error=${this.handleCloseError}
2018
+ ${Ut({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2019
+ ></primer-vault-error-message>
2020
+ `,()=>u)}
2021
+
2022
+ <div class="vault-manager-content">
2023
+ ${U(!r&&!e,()=>h`
2024
+ <div class="content-container">
2025
+ <primer-vault-empty-state
2026
+ ${Ut({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
2027
+ ></primer-vault-empty-state>
2028
+ </div>
2029
+ `,()=>u)}
2030
+ ${U(!r&&e,()=>h`
2031
+ <div class="content-container">
2032
+ ${U(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
2033
+ </div>
2034
+ `,()=>u)}
2035
+ </div>
2036
+
2037
+ ${U(o,()=>this.renderLoadingOverlay(),()=>u)}
2038
+ </div>
2039
+ `}};nt.styles=[$,Ba],n([P({context:fe,subscribe:!0}),p({type:Object,attribute:!1})],nt.prototype,"vaultManagerContext",2),n([I()],nt.prototype,"isEditMode",2),n([I()],nt.prototype,"deletePaymentMethodId",2),n([I()],nt.prototype,"isDeleting",2),n([I()],nt.prototype,"errorMessage",2),n([p({type:Number})],nt.prototype,"animationDuration",2),nt=n([v("primer-vault-manager"),z()],nt);var Kx=sd({tagName:"primer-vault-manager",elementClass:nt,react:nd});export{Gg as AchPayment,P_ as Button,uy as CardForm,$y as CardFormSubmit,gv as CardNetworkSelector,Ih as CheckoutState,eu as Collapsable,Cu as Dialog,AE as DynamicPayment,Wu as ErrorMessage,YE as ErrorMessageContainer,tf as Icon,uf as Input,yb as InputCardExpiry,eb as InputCardHolderName,Jb as InputCardNumber,Lb as InputCvv,Mf as InputError,Vf as InputLabel,Xf as InputWrapper,mC as Klarna,kC as NativePayment,KC as PaymentMethod,dg as Portal,Eh as PrimerCheckout,tA as PrimerCheckoutComplete,mA as PrimerCheckoutError,IA as PrimerMain,e_ as RedirectPayment,A_ as ShowOtherPayments,Cg as Spinner,Kx as VaultManager};
2040
+ /*! Bundled license information:
2041
+
2042
+ @lit/context/lib/context-request-event.js:
2043
+ (**
2044
+ * @license
2045
+ * Copyright 2021 Google LLC
2046
+ * SPDX-License-Identifier: BSD-3-Clause
2047
+ *)
2048
+
2049
+ @lit/context/lib/create-context.js:
2050
+ (**
2051
+ * @license
2052
+ * Copyright 2021 Google LLC
2053
+ * SPDX-License-Identifier: BSD-3-Clause
2054
+ *)
2055
+
2056
+ @lit/context/lib/controllers/context-consumer.js:
2057
+ (**
2058
+ * @license
2059
+ * Copyright 2021 Google LLC
2060
+ * SPDX-License-Identifier: BSD-3-Clause
2061
+ *)
2062
+
2063
+ @lit/context/lib/value-notifier.js:
2064
+ (**
2065
+ * @license
2066
+ * Copyright 2021 Google LLC
2067
+ * SPDX-License-Identifier: BSD-3-Clause
2068
+ *)
2069
+
2070
+ @lit/context/lib/controllers/context-provider.js:
2071
+ (**
2072
+ * @license
2073
+ * Copyright 2021 Google LLC
2074
+ * SPDX-License-Identifier: BSD-3-Clause
2075
+ *)
2076
+
2077
+ @lit/context/lib/context-root.js:
2078
+ (**
2079
+ * @license
2080
+ * Copyright 2021 Google LLC
2081
+ * SPDX-License-Identifier: BSD-3-Clause
2082
+ *)
2083
+
2084
+ @lit/context/lib/decorators/provide.js:
2085
+ (**
2086
+ * @license
2087
+ * Copyright 2017 Google LLC
2088
+ * SPDX-License-Identifier: BSD-3-Clause
2089
+ *)
2090
+
2091
+ @lit/context/lib/decorators/consume.js:
2092
+ (**
2093
+ * @license
2094
+ * Copyright 2022 Google LLC
2095
+ * SPDX-License-Identifier: BSD-3-Clause
2096
+ *)
2097
+
2098
+ @lit/reactive-element/css-tag.js:
2099
+ (**
2100
+ * @license
2101
+ * Copyright 2019 Google LLC
2102
+ * SPDX-License-Identifier: BSD-3-Clause
2103
+ *)
2104
+
2105
+ @lit/reactive-element/reactive-element.js:
2106
+ (**
2107
+ * @license
2108
+ * Copyright 2017 Google LLC
2109
+ * SPDX-License-Identifier: BSD-3-Clause
2110
+ *)
2111
+
2112
+ @lit/task/task.js:
2113
+ (**
2114
+ * @license
2115
+ * Copyright 2017 Google LLC
2116
+ * SPDX-License-Identifier: BSD-3-Clause
2117
+ *)
2118
+
2119
+ @lit/localize/internal/locale-status-event.js:
2120
+ (**
2121
+ * @license
2122
+ * Copyright 2021 Google LLC
2123
+ * SPDX-License-Identifier: BSD-3-Clause
2124
+ *)
2125
+
2126
+ @lit/localize/internal/str-tag.js:
2127
+ (**
2128
+ * @license
2129
+ * Copyright 2021 Google LLC
2130
+ * SPDX-License-Identifier: BSD-3-Clause
2131
+ *)
2132
+
2133
+ @lit/localize/internal/types.js:
2134
+ (**
2135
+ * @license
2136
+ * Copyright 2021 Google LLC
2137
+ * SPDX-License-Identifier: BSD-3-Clause
2138
+ *)
2139
+
2140
+ @lit/localize/internal/default-msg.js:
2141
+ (**
2142
+ * @license
2143
+ * Copyright 2021 Google LLC
2144
+ * SPDX-License-Identifier: BSD-3-Clause
2145
+ *)
2146
+
2147
+ @lit/localize/internal/localized-controller.js:
2148
+ (**
2149
+ * @license
2150
+ * Copyright 2021 Google LLC
2151
+ * SPDX-License-Identifier: BSD-3-Clause
2152
+ *)
2153
+
2154
+ @lit/localize/internal/localized-decorator.js:
2155
+ (**
2156
+ * @license
2157
+ * Copyright 2021 Google LLC
2158
+ * SPDX-License-Identifier: BSD-3-Clause
2159
+ *)
2160
+
2161
+ @lit/localize/internal/deferred.js:
2162
+ (**
2163
+ * @license
2164
+ * Copyright 2020 Google LLC
2165
+ * SPDX-License-Identifier: BSD-3-Clause
2166
+ *)
2167
+
2168
+ @lit/localize/internal/fnv1a64.js:
2169
+ (**
2170
+ * @license
2171
+ * Copyright 2014 Travis Webb
2172
+ * SPDX-License-Identifier: MIT
2173
+ *)
2174
+
2175
+ @lit/localize/internal/id-generation.js:
2176
+ (**
2177
+ * @license
2178
+ * Copyright 2020 Google LLC
2179
+ * SPDX-License-Identifier: BSD-3-Clause
2180
+ *)
2181
+
2182
+ @lit/localize/internal/runtime-msg.js:
2183
+ (**
2184
+ * @license
2185
+ * Copyright 2021 Google LLC
2186
+ * SPDX-License-Identifier: BSD-3-Clause
2187
+ *)
2188
+
2189
+ @lit/localize/init/runtime.js:
2190
+ (**
2191
+ * @license
2192
+ * Copyright 2021 Google LLC
2193
+ * SPDX-License-Identifier: BSD-3-Clause
2194
+ *)
2195
+
2196
+ @lit/localize/init/transform.js:
2197
+ (**
2198
+ * @license
2199
+ * Copyright 2021 Google LLC
2200
+ * SPDX-License-Identifier: BSD-3-Clause
2201
+ *)
2202
+
2203
+ @lit/localize/lit-localize.js:
2204
+ (**
2205
+ * @license
2206
+ * Copyright 2020 Google LLC
2207
+ * SPDX-License-Identifier: BSD-3-Clause
2208
+ *)
2209
+
2210
+ lit-html/lit-html.js:
2211
+ (**
2212
+ * @license
2213
+ * Copyright 2017 Google LLC
2214
+ * SPDX-License-Identifier: BSD-3-Clause
2215
+ *)
2216
+
2217
+ lit-element/lit-element.js:
2218
+ (**
2219
+ * @license
2220
+ * Copyright 2017 Google LLC
2221
+ * SPDX-License-Identifier: BSD-3-Clause
2222
+ *)
2223
+
2224
+ lit-html/is-server.js:
2225
+ (**
2226
+ * @license
2227
+ * Copyright 2022 Google LLC
2228
+ * SPDX-License-Identifier: BSD-3-Clause
2229
+ *)
2230
+
2231
+ @lit/reactive-element/decorators/custom-element.js:
2232
+ (**
2233
+ * @license
2234
+ * Copyright 2017 Google LLC
2235
+ * SPDX-License-Identifier: BSD-3-Clause
2236
+ *)
2237
+
2238
+ @lit/reactive-element/decorators/property.js:
2239
+ (**
2240
+ * @license
2241
+ * Copyright 2017 Google LLC
2242
+ * SPDX-License-Identifier: BSD-3-Clause
2243
+ *)
2244
+
2245
+ @lit/reactive-element/decorators/state.js:
2246
+ (**
2247
+ * @license
2248
+ * Copyright 2017 Google LLC
2249
+ * SPDX-License-Identifier: BSD-3-Clause
2250
+ *)
2251
+
2252
+ @lit/reactive-element/decorators/event-options.js:
2253
+ (**
2254
+ * @license
2255
+ * Copyright 2017 Google LLC
2256
+ * SPDX-License-Identifier: BSD-3-Clause
2257
+ *)
2258
+
2259
+ @lit/reactive-element/decorators/base.js:
2260
+ (**
2261
+ * @license
2262
+ * Copyright 2017 Google LLC
2263
+ * SPDX-License-Identifier: BSD-3-Clause
2264
+ *)
2265
+
2266
+ @lit/reactive-element/decorators/query.js:
2267
+ (**
2268
+ * @license
2269
+ * Copyright 2017 Google LLC
2270
+ * SPDX-License-Identifier: BSD-3-Clause
2271
+ *)
2272
+
2273
+ @lit/reactive-element/decorators/query-all.js:
2274
+ (**
2275
+ * @license
2276
+ * Copyright 2017 Google LLC
2277
+ * SPDX-License-Identifier: BSD-3-Clause
2278
+ *)
2279
+
2280
+ @lit/reactive-element/decorators/query-async.js:
2281
+ (**
2282
+ * @license
2283
+ * Copyright 2017 Google LLC
2284
+ * SPDX-License-Identifier: BSD-3-Clause
2285
+ *)
2286
+
2287
+ @lit/reactive-element/decorators/query-assigned-elements.js:
2288
+ (**
2289
+ * @license
2290
+ * Copyright 2021 Google LLC
2291
+ * SPDX-License-Identifier: BSD-3-Clause
2292
+ *)
2293
+
2294
+ @lit/reactive-element/decorators/query-assigned-nodes.js:
2295
+ (**
2296
+ * @license
2297
+ * Copyright 2017 Google LLC
2298
+ * SPDX-License-Identifier: BSD-3-Clause
2299
+ *)
2300
+
2301
+ lit-html/directives/when.js:
2302
+ (**
2303
+ * @license
2304
+ * Copyright 2021 Google LLC
2305
+ * SPDX-License-Identifier: BSD-3-Clause
2306
+ *)
2307
+
2308
+ lit-html/directive.js:
2309
+ (**
2310
+ * @license
2311
+ * Copyright 2017 Google LLC
2312
+ * SPDX-License-Identifier: BSD-3-Clause
2313
+ *)
2314
+
2315
+ lit-html/directives/class-map.js:
2316
+ (**
2317
+ * @license
2318
+ * Copyright 2018 Google LLC
2319
+ * SPDX-License-Identifier: BSD-3-Clause
2320
+ *)
2321
+
2322
+ lit-html/directive-helpers.js:
2323
+ (**
2324
+ * @license
2325
+ * Copyright 2020 Google LLC
2326
+ * SPDX-License-Identifier: BSD-3-Clause
2327
+ *)
2328
+
2329
+ lit-html/async-directive.js:
2330
+ (**
2331
+ * @license
2332
+ * Copyright 2017 Google LLC
2333
+ * SPDX-License-Identifier: BSD-3-Clause
2334
+ *)
2335
+
2336
+ lit-html/directives/ref.js:
2337
+ (**
2338
+ * @license
2339
+ * Copyright 2020 Google LLC
2340
+ * SPDX-License-Identifier: BSD-3-Clause
2341
+ *)
2342
+
2343
+ lit-html/lit-html.js:
2344
+ (**
2345
+ * @license
2346
+ * Copyright 2017 Google LLC
2347
+ * SPDX-License-Identifier: BSD-3-Clause
2348
+ *)
2349
+
2350
+ lit-html/directive.js:
2351
+ (**
2352
+ * @license
2353
+ * Copyright 2017 Google LLC
2354
+ * SPDX-License-Identifier: BSD-3-Clause
2355
+ *)
2356
+
2357
+ lit-html/directive-helpers.js:
2358
+ (**
2359
+ * @license
2360
+ * Copyright 2020 Google LLC
2361
+ * SPDX-License-Identifier: BSD-3-Clause
2362
+ *)
2363
+
2364
+ lit-html/async-directive.js:
2365
+ (**
2366
+ * @license
2367
+ * Copyright 2017 Google LLC
2368
+ * SPDX-License-Identifier: BSD-3-Clause
2369
+ *)
2370
+ */