@primer-io/primer-js 0.1.8 → 0.2.0
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.
- package/dist/chunks/{ar.5AY75F5J.js → ar.6MRFCKX4.js} +1 -1
- package/dist/chunks/{bg.2EL2HTYI.js → bg.HRSMU7Y5.js} +1 -1
- package/dist/chunks/{ca.WZI7CBFW.js → ca.3FSHJL7U.js} +1 -1
- package/dist/chunks/chunk.I6YWTZRK.js +1 -0
- package/dist/chunks/{cs.GBLLNC3E.js → cs.WAO4WFS3.js} +1 -1
- package/dist/chunks/{da.CDEFQG44.js → da.4OFYGDVA.js} +1 -1
- package/dist/chunks/{de.UHURA2HV.js → de.3FZS52IN.js} +1 -1
- package/dist/chunks/{el.BY5NGYDF.js → el.A4R7VG5T.js} +1 -1
- package/dist/chunks/en-GB.ILZ7SXSW.js +1 -0
- package/dist/chunks/en.7GZJA7MN.js +1 -0
- package/dist/chunks/{es-AR.EYNC6EAZ.js → es-AR.QKHDL4JV.js} +1 -1
- package/dist/chunks/{es-MX.OIO2YURF.js → es-MX.GG7MJMG2.js} +1 -1
- package/dist/chunks/{es.CNNIJYLX.js → es.FEZ6BF3S.js} +1 -1
- package/dist/chunks/{et-EE.4ZF6CLB6.js → et-EE.FJLPTMF3.js} +1 -1
- package/dist/chunks/{fi-FI.4ZXWRRYI.js → fi-FI.DM5R27A5.js} +1 -1
- package/dist/chunks/{fr.TZM5I4K2.js → fr.YZV52NTA.js} +1 -1
- package/dist/chunks/{he.DWEZBG4A.js → he.6SCF3XZZ.js} +1 -1
- package/dist/chunks/{hr.BV4PC324.js → hr.PPDZ7AAS.js} +1 -1
- package/dist/chunks/{hu.MTEKSS3J.js → hu.6WOPSGLW.js} +1 -1
- package/dist/chunks/{id.SJSTOPSC.js → id.NS22WGWL.js} +1 -1
- package/dist/chunks/{it.IISTMHN5.js → it.42TO3R4G.js} +1 -1
- package/dist/chunks/{ja.IBQ3ID5C.js → ja.UEGHEUAP.js} +1 -1
- package/dist/chunks/{ko.KZVQLI4V.js → ko.HTMDY6RY.js} +1 -1
- package/dist/chunks/{lt-LT.RKBB7CZ6.js → lt-LT.4U3GBQTQ.js} +1 -1
- package/dist/chunks/{lt.TLM7OCXP.js → lt.73ME4TDM.js} +1 -1
- package/dist/chunks/{lv-LV.H5TJC2T4.js → lv-LV.JRWO2BF6.js} +1 -1
- package/dist/chunks/{lv.G4SRVBAC.js → lv.KROS45TV.js} +1 -1
- package/dist/chunks/{ms.ATTITA66.js → ms.HE3SWJFQ.js} +1 -1
- package/dist/chunks/{nb.5EE7XOA7.js → nb.TR6TEKBY.js} +1 -1
- package/dist/chunks/{nl.TY2SYTKZ.js → nl.V5QP6OXL.js} +1 -1
- package/dist/chunks/{nl_NL.GB5BQ5PG.js → nl_NL.FCVWIF3Y.js} +1 -1
- package/dist/chunks/{pl.5PRBSG4K.js → pl.DQZDG7LR.js} +1 -1
- package/dist/chunks/{pt-BR.5XRZB5WW.js → pt-BR.CR4ROBVE.js} +1 -1
- package/dist/chunks/{pt.TA5H5JUJ.js → pt.JRWVFJPX.js} +1 -1
- package/dist/chunks/{ro.PSZKGHRP.js → ro.NRMWYY3F.js} +1 -1
- package/dist/chunks/{ru.3QZY7ZIT.js → ru.OWSKHXVO.js} +1 -1
- package/dist/chunks/{sk.FAQFYLGM.js → sk.YGBRNNWT.js} +1 -1
- package/dist/chunks/{sl.QRSCQXJP.js → sl.IRTDTNTP.js} +1 -1
- package/dist/chunks/{sr-RS.TKMMG7FK.js → sr-RS.AWGLHKVE.js} +1 -1
- package/dist/chunks/{sv.HZ3E6V5F.js → sv.O4BXFGNF.js} +1 -1
- package/dist/chunks/{th.AY6M42B4.js → th.GZCEBRT2.js} +1 -1
- package/dist/chunks/{tr.TFKBPYMO.js → tr.ZDILMEEO.js} +1 -1
- package/dist/chunks/{uk-UA.3TU67RSI.js → uk-UA.JUUBOEW3.js} +1 -1
- package/dist/chunks/{vi.NLXELMXV.js → vi.IN7CFTLL.js} +1 -1
- package/dist/chunks/zf.YT47ULXR.js +1 -0
- package/dist/chunks/{zh-CN.VEOQJ3EU.js → zh-CN.RBRAS4RP.js} +1 -1
- package/dist/chunks/{zh-HK.ZEXSW7FF.js → zh-HK.4CK7LBWM.js} +1 -1
- package/dist/chunks/{zh-TW.MMVWEQMZ.js → zh-TW.374TMWNJ.js} +1 -1
- package/dist/custom-elements.json +2237 -3279
- package/dist/primer-loader.d.ts +1087 -756
- package/dist/primer-loader.js +780 -1025
- package/dist/primer-react-wrappers.js +426 -671
- package/dist/web-types.json +1 -1
- package/package.json +8 -1
- package/dist/chunks/chunk.G45OCYEN.js +0 -1
- package/dist/chunks/en-GB.UBLLAUVW.js +0 -1
- package/dist/chunks/en.BKAVPUID.js +0 -1
- package/dist/chunks/zf.U5XPENNR.js +0 -1
|
@@ -1,11 +1,10 @@
|
|
|
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]`,
|
|
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`
|
|
1
|
+
import{a as $r,b as s}from"./chunks/chunk.I6YWTZRK.js";import{createComponent as ra}from"@lit/react";import ia from"react";var ge=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],a=r?.items??[];this.updateCardNetworksState({detectedCardNetwork:o,selectableCardNetworks:a,isLoading:!1})}};var Ut=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-change",t)}dispatchPaymentMethods(t){this.dispatchEvent("primer:methods-update",t)}dispatchCheckoutInitialized(t){this.dispatchEvent("primer:ready",t)}dispatchCardNetworkChange(t){this.dispatchEvent("primer:card-network-change",t)}dispatchFormSubmitSuccess(t){this.dispatchEvent("primer:card-success",{result:t})}dispatchFormSubmitErrors(t){this.dispatchEvent("primer:card-error",{errors:t})}};var ht=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 Ht=class{constructor(t,e,r,o){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(a,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=a,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(a,n)),this.unsubscribe=n},this.host=t,e.context!==void 0){let a=e;this.context=a.context,this.callback=a.callback,this.subscribe=a.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 ht(this.context,this.host,this.t,this.subscribe))}};var ye=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 or=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},L=class extends ye{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=o=>{if(o.context!==this.context)return;let a=o.contextTarget??o.composedPath()[0];a!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,a,o.subscribe))},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let a=new Set;for(let[n,{consumerHost:c}]of this.subscriptions)a.has(n)||(a.add(n),c.dispatchEvent(new ht(this.context,c,n,!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 or(this.context,this.host))}};function g({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new Ht(this,{context:i,callback:o=>{e.set.call(this,o)},subscribe:t})}):e.constructor.addInitializer(o=>{new Ht(o,{context:i,callback:a=>{o[r]=a},subscribe:t})})}}var ve="cardNetworksContext";var zt="clientOptionsContext";var Ft="computedStylesContext";var B="headlessInstanceContext";var be="klarnaCategoriesContext";var O="managerContext";var Bt="paymentMethodsContext";var T="sdkStateContext";var Kt="vaultManagerContext";var Rr="vaultManagerCvvContext";var b=class b{static log(t,...e){b.enabled&&console.log(`%c${b.brandTag}%c ${t}`,b.brandStyle,b.styles.log,...e)}static info(t,...e){b.enabled&&console.info(`%c${b.brandTag}%c ${t}`,b.brandStyle,b.styles.info,...e)}static warn(t,...e){b.enabled&&console.warn(`%c${b.brandTag}%c ${t}`,b.brandStyle,b.styles.warn,...e)}static error(t,...e){b.enabled&&console.error(`%c${b.brandTag}%c ${t}`,b.brandStyle,b.styles.error,...e)}static debug(t,...e){b.enabled&&console.debug(`%c${b.brandTag}%c ${t}`,b.brandStyle,b.styles.debug,...e)}static table(t,e){b.enabled&&console.table(t,e)}static time(t){b.enabled&&console.time(`${b.brandTag} ${t}`)}static timeEnd(t){b.enabled&&console.timeEnd(`${b.brandTag} ${t}`)}};b.enabled=!0,b.defaultFont="font-family: Consolas, monospace; font-size: 12px;",b.brandTag="[PRIMER]",b.brandStyle="background: #24292e; color: #ffffff; padding: 2px 6px; border-radius: 3px; font-weight: bold; margin-right: 4px; "+b.defaultFont,b.styles={log:"color: #4CAF50; "+b.defaultFont,info:"color: #2196F3; "+b.defaultFont,warn:"color: #FF9800; "+b.defaultFont,error:"color: #F44336; "+b.defaultFont,debug:"color: #9C27B0; "+b.defaultFont};var y=b;function vo(i,t,e,r){let o=i,a=e;return{dispatch:n=>{let c=t(o,n,a);o=c,r(c)},getState:()=>Object.freeze({...o}),setCallbacks:n=>{a={...a,...n}}}}function Jt(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 _t=class{constructor(t,e,r,o,a=()=>{this.host.requestUpdate()}){this.host=t;this.stateHandler=a;this.host.addController(this),this._dispatcher=vo(e,r,o,n=>{this.stateHandler(n)})}get currentState(){return this._dispatcher.getState()}dispatch(t){this._dispatcher.dispatch(t)}setCallbacks(t){this._dispatcher.setCallbacks(t)}hostConnected(){}hostDisconnected(){}},Ce=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 Ee={isSuccessful:!1,isProcessing:!1,isLoading:!1,error:null,failure:null},bo={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)=>(y.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:()=>Ee,RESET_ERROR:i=>({...i,error:null,failure:null})},Co=Jt(bo),xe=class extends _t{constructor(t){super(t,Ee,Co,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&&(y.warn("Force completing loading state"),this.completeLoading())}};var Se=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 L(t,{context:T,initialValue:Ee}),this.paymentMethodsProvider=new L(t,{context:Bt,initialValue:null}),this.paymentManagerProvider=new L(t,{context:O,initialValue:new Map}),this.cardNetworksContext=new L(t,{context:ve,initialValue:null}),this.vaultManagerProvider=new L(t,{context:Kt,initialValue:null}),this.vaultManagerCvvProvider=new L(t,{context:Rr,initialValue:null}),this.clientOptionsContext=new L(t,{context:zt,initialValue:null}),this.klarnaCategoriesProvider=new L(t,{context:be,initialValue:{categories:[],isLoading:!0}}),this.headlessUtilsProvider=new L(t,{context:B,initialValue:null}),this.computedStylesProvider=new L(t,{context:Ft,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 At=class At{constructor(t){(this.host=t).addController(this)}processCustomStyles(t){try{let e=JSON.parse(t);this.applyStyles(e)}catch(e){y.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||y.warn(`Rejected potentially unsafe CSS value: ${t}`),r}getCssVarName(t){let e=At.cssVarCache.get(t);return e||(e="--"+t.replace(/([A-Z])/g,(r,o)=>"-"+o.toLowerCase()),At.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)){y.warn(`Skipping invalid CSS property name: ${r}`);continue}if(!this.isValidCssValue(o))continue;let a=this.getCssVarName(r);e.push([a,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 At.cssVarCache.keys()){let e=At.cssVarCache.get(t);e&&this.host.style.removeProperty(e)}}hostDisconnected(){}};At.cssVarCache=new Map;var _e=At;var Ae=globalThis,we=Ae.ShadowRoot&&(Ae.ShadyCSS===void 0||Ae.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Dr=Symbol(),Or=new WeakMap,Pe=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Dr)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(we&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Or.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Or.set(e,t))}return t}toString(){return this.cssText}},Vr=i=>new Pe(typeof i=="string"?i:i+"",void 0,Dr);var ar=(i,t)=>{if(we)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=Ae.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},Me=we?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Vr(e)})(i):i;var{is:xo,defineProperty:Eo,getOwnPropertyDescriptor:So,getOwnPropertyNames:_o,getOwnPropertySymbols:Ao,getPrototypeOf:Po}=Object,ut=globalThis,Yr=ut.trustedTypes,wo=Yr?Yr.emptyScript:"",Mo=ut.reactiveElementPolyfillSupport,Zt=(i,t)=>i,sr={toAttribute(i,t){switch(t){case Boolean:i=i?wo: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}},ke=(i,t)=>!xo(i,t),Ur={attribute:!0,type:String,converter:sr,reflect:!1,hasChanged:ke};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),ut.litPropertyMetadata??(ut.litPropertyMetadata=new WeakMap);var Pt=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=Ur){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&&Eo(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:a}=So(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get(){return o?.call(this)},set(n){let c=o?.call(this);a.call(this,n),this.requestUpdate(t,c,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ur}static _$Ei(){if(this.hasOwnProperty(Zt("elementProperties")))return;let t=Po(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Zt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Zt("properties"))){let e=this.properties,r=[..._o(e),...Ao(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(Me(o))}else t!==void 0&&e.push(Me(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 ar(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 a=(r.converter?.toAttribute!==void 0?r.converter:sr).toAttribute(e,r.type);this._$Em=t,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(t,e){let r=this.constructor,o=r._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let a=r.getPropertyOptions(o),n=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:sr;this._$Em=o,this[o]=n.fromAttribute(e,a.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??ke)(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,a]of this._$Ep)this[o]=a;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,a]of r)a.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],a)}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){}};Pt.elementStyles=[],Pt.shadowRootOptions={mode:"open"},Pt[Zt("elementProperties")]=new Map,Pt[Zt("finalized")]=new Map,Mo?.({ReactiveElement:Pt}),(ut.reactiveElementVersions??(ut.reactiveElementVersions=[])).push("2.0.4");var ft={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},x=Symbol(),_=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??Hr,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 a=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(n){a=!0,r=n}if(this.p===o){if(e===x)this.i=0;else{if(a===!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)}}},Hr=(i,t)=>i===t||i.length===t.length&&i.every((e,r)=>!ke(e,t[r]));var ko={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:()=>zr},To={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:()=>Fr},Lo=Jt(ko),No=Jt(To),zr={enabled:!1,isLoading:!1,isUpdating:!1,cvvRecapture:!1,vaultedPaymentMethods:[],createCvvInput:null,deleteVaultedPaymentMethod:()=>Promise.resolve(),startVaultedPaymentFlow:()=>Promise.resolve()},Fr={cvvInput:null,formIsDirty:!1,setCvvInput:()=>{},selectedVaultedPaymentMethod:null,setSelectedVaultedPaymentMethod:()=>{}},nr=class extends _t{constructor(t,e){super(t,zr,Lo,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"})}},lr=class extends _t{constructor(t,e){super(t,Fr,No,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"})}},Xt=class extends Ce{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(a){y.error("VaultManagerController: Error starting vaulted payment flow",a),this.coreController.setError(a instanceof Error?a: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 nr(e,{deleteVaultedPaymentMethod:this.deleteVaultedPaymentMethod.bind(this),startVaultedPaymentFlow:this.startVaultedPaymentFlow.bind(this),createCvvInput:this.createCvvInput.bind(this)}),this.itemController=new lr(e,{setCvvInput:this.setCvvInput.bind(this),setSelectedVaultedPaymentMethod:this.setSelectedVaultedPaymentMethod.bind(this)}),this.addController(this.coreController),this.addController(this.itemController),new _(this.host,{task:async([r,o])=>{if(!r||!o?.vaultEnabled)return this.coreController.disable(),x;this.coreController.setLoading(!0);try{this.coreController.initializeVaultManager(r,o.vaultEnabled,!!o.captureVaultedCardCvv),this.itemController.initializeCvv(r.createCvvInput),await this.fetchVaultedPaymentMethods(!0),y.log("VaultManagerController: Vault initialized successfully",{coreState:this.coreController.currentState,cvvState:this.itemController.currentState})}catch(a){y.error("VaultManagerController: Failed to initialize vault",a),this.coreController.setError(a instanceof Error?a: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 y.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 Qt="lit-localize-status";var Br=i=>typeof i!="string"&&"strTag"in i,Te=(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 te=i=>Br(i)?Te(i.strings,i.values):i;var v=te,Kr=!1;function dr(i){if(Kr)throw new Error("lit-localize can only be configured once");v=i,Kr=!0}var pr=class{constructor(t){this.__litLocalizeEventHandler=e=>{e.detail.status==="ready"&&this.host.requestUpdate()},this.host=t}hostConnected(){window.addEventListener(Qt,this.__litLocalizeEventHandler)}hostDisconnected(){window.removeEventListener(Qt,this.__litLocalizeEventHandler)}},Io=i=>i.addController(new pr(i)),Gr=Io;var M=()=>(i,t)=>(i.addInitializer(Gr),i);var ee=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 tt=[];for(let i=0;i<256;i++)tt[i]=(i>>4&15).toString(16)+(i&15).toString(16);function jr(i){let t=0,e=8997,r=0,o=33826,a=0,n=40164,c=0,f=52210;for(let S=0;S<i.length;S++)e^=i.charCodeAt(S),t=e*435,r=o*435,a=n*435,c=f*435,a+=e<<8,c+=o<<8,r+=t>>>16,e=t&65535,a+=r>>>16,o=r&65535,f=c+(a>>>16)&65535,n=a&65535;return tt[f>>8]+tt[f&255]+tt[n>>8]+tt[n&255]+tt[o>>8]+tt[o&255]+tt[e>>8]+tt[e&255]}var $o="",Ro="h",Oo="s";function qr(i,t){return(t?Ro:Oo)+jr(typeof i=="string"?i:i.join($o))}var Wr=new WeakMap,Jr=new Map;function Zr(i,t,e){if(i){let r=e?.id??Do(t),o=i[r];if(o){if(typeof o=="string")return o;if("strTag"in o)return Te(o.strings,t.values,o.values);{let a=Wr.get(o);return a===void 0&&(a=o.values,Wr.set(o,a)),{...o,values:a.map(n=>t.values[n])}}}}return te(t)}function Do(i){let t=typeof i=="string"?i:i.strings,e=Jr.get(t);return e===void 0&&(e=qr(t,typeof i!="string"&&!("strTag"in i)),Jr.set(t,e)),e}function cr(i){window.dispatchEvent(new CustomEvent(Qt,{detail:i}))}var Ne="",mr,Xr,Ie,hr,Qr,wt=new ee;wt.resolve();var Le=0,ti=i=>(dr((t,e)=>Zr(Qr,t,e)),Ne=Xr=i.sourceLocale,Ie=new Set(i.targetLocales),Ie.add(i.sourceLocale),hr=i.loadLocale,{getLocale:Vo,setLocale:Yo}),Vo=()=>Ne,Yo=i=>{if(i===(mr??Ne))return wt.promise;if(!Ie||!hr)throw new Error("Internal error");if(!Ie.has(i))throw new Error("Invalid locale code");Le++;let t=Le;return mr=i,wt.settled&&(wt=new ee),cr({status:"loading",loadingLocale:i}),(i===Xr?Promise.resolve({templates:void 0}):hr(i)).then(r=>{Le===t&&(Ne=i,mr=void 0,Qr=r.templates,cr({status:"ready",readyLocale:i}),wt.resolve())},r=>{Le===t&&(cr({status:"error",errorLocale:i,errorMessage:r.toString()}),wt.reject(r))}),wt.promise};var ur="en",fr=["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"],ei="You must call `loadLocale` first to set up the localized template.",ri,$e,ii=i=>{let t=ti({sourceLocale:ur,targetLocales:fr,loadLocale:i});ri=t.getLocale,$e=t.setLocale};var gr=i=>{ii(i)},yr=i=>{if(!$e)throw new Error(ei);return $e(i)};var re=new Set(fr);re.add(ur);var vr=i=>{if(typeof i!="string")return!1;if(i==="en")return!0;let t=i.replace("_","-");if(re.has(t))return!0;let e=t.split("-")[0];return!!re.has(e)},br=i=>{if(i==="en")return"en-GB";let t=i.replace("_","-");if(re.has(t))return t;let e=t.split("-")[0];return re.has(e)?e:"en-GB"};var Re=globalThis,Oe=Re.ShadowRoot&&(Re.ShadyCSS===void 0||Re.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Cr=Symbol(),oi=new WeakMap,ie=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Cr)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(Oe&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=oi.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&oi.set(e,t))}return t}toString(){return this.cssText}},ai=i=>new ie(typeof i=="string"?i:i+"",void 0,Cr),m=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,o,a)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+i[a+1],i[0]);return new ie(e,i,Cr)},si=(i,t)=>{if(Oe)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),o=Re.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=e.cssText,i.appendChild(r)}},xr=Oe?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return ai(e)})(i):i;var{is:Uo,defineProperty:Ho,getOwnPropertyDescriptor:zo,getOwnPropertyNames:Fo,getOwnPropertySymbols:Bo,getPrototypeOf:Ko}=Object,gt=globalThis,ni=gt.trustedTypes,Go=ni?ni.emptyScript:"",jo=gt.reactiveElementPolyfillSupport,oe=(i,t)=>i,ae={toAttribute(i,t){switch(t){case Boolean:i=i?Go: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}},De=(i,t)=>!Uo(i,t),li={attribute:!0,type:String,converter:ae,reflect:!1,useDefault:!1,hasChanged:De};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),gt.litPropertyMetadata??(gt.litPropertyMetadata=new WeakMap);var et=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=li){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(t,r,e);o!==void 0&&Ho(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){let{get:o,set:a}=zo(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:o,set(n){let c=o?.call(this);a?.call(this,n),this.requestUpdate(t,c,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??li}static _$Ei(){if(this.hasOwnProperty(oe("elementProperties")))return;let t=Ko(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(oe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(oe("properties"))){let e=this.properties,r=[...Fo(e),...Bo(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(xr(o))}else t!==void 0&&e.push(xr(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 si(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)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,r);if(o!==void 0&&r.reflect===!0){let a=(r.converter?.toAttribute!==void 0?r.converter:ae).toAttribute(e,r.type);this._$Em=t,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(t,e){let r=this.constructor,o=r._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let a=r.getPropertyOptions(o),n=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:ae;this._$Em=o,this[o]=n.fromAttribute(e,a.type)??this._$Ej?.get(o)??null,this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){let o=this.constructor,a=this[t];if(r??(r=o.getPropertyOptions(t)),!((r.hasChanged??De)(a,e)||r.useDefault&&r.reflect&&a===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:o,wrapped:a},n){r&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,n??e??this[t]),a!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),o===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){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,a]of this._$Ep)this[o]=a;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,a]of r){let{wrapped:n}=a,c=this[o];n!==!0||this._$AL.has(o)||c===void 0||this.C(o,void 0,a,c)}}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._$EM()}catch(r){throw t=!1,this._$EM(),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)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}};et.elementStyles=[],et.shadowRootOptions={mode:"open"},et[oe("elementProperties")]=new Map,et[oe("finalized")]=new Map,jo?.({ReactiveElement:et}),(gt.reactiveElementVersions??(gt.reactiveElementVersions=[])).push("2.1.0");var ne=globalThis,Ve=ne.trustedTypes,di=Ve?Ve.createPolicy("lit-html",{createHTML:i=>i}):void 0,Sr="$lit$",rt=`lit$${Math.random().toFixed(9).slice(2)}$`,_r="?"+rt,qo=`<${_r}>`,Tt=document,le=()=>Tt.createComment(""),de=i=>i===null||typeof i!="object"&&typeof i!="function",Ar=Array.isArray,fi=i=>Ar(i)||typeof i?.[Symbol.iterator]=="function",Er=`[
|
|
2
|
+
\f\r]`,se=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,pi=/-->/g,ci=/>/g,Mt=RegExp(`>|${Er}(?:([^\\s"'>=/]+)(${Er}*=${Er}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),mi=/'/g,hi=/"/g,gi=/^(?:script|style|textarea|title)$/i,Pr=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),d=Pr(1),ot=Pr(2),Vd=Pr(3),it=Symbol.for("lit-noChange"),p=Symbol.for("lit-nothing"),ui=new WeakMap,kt=Tt.createTreeWalker(Tt,129);function yi(i,t){if(!Ar(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return di!==void 0?di.createHTML(t):t}var vi=(i,t)=>{let e=i.length-1,r=[],o,a=t===2?"<svg>":t===3?"<math>":"",n=se;for(let c=0;c<e;c++){let f=i[c],S,k,A=-1,N=0;for(;N<f.length&&(n.lastIndex=N,k=n.exec(f),k!==null);)N=n.lastIndex,n===se?k[1]==="!--"?n=pi:k[1]!==void 0?n=ci:k[2]!==void 0?(gi.test(k[2])&&(o=RegExp("</"+k[2],"g")),n=Mt):k[3]!==void 0&&(n=Mt):n===Mt?k[0]===">"?(n=o??se,A=-1):k[1]===void 0?A=-2:(A=n.lastIndex-k[2].length,S=k[1],n=k[3]===void 0?Mt:k[3]==='"'?hi:mi):n===hi||n===mi?n=Mt:n===pi||n===ci?n=se:(n=Mt,o=void 0);let mt=n===Mt&&i[c+1].startsWith("/>")?" ":"";a+=n===se?f+qo:A>=0?(r.push(S),f.slice(0,A)+Sr+f.slice(A)+rt+mt):f+rt+(A===-2?c:mt)}return[yi(i,a+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},pe=class i{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let a=0,n=0,c=t.length-1,f=this.parts,[S,k]=vi(t,e);if(this.el=i.createElement(S,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&&f.length<c;){if(o.nodeType===1){if(o.hasAttributes())for(let A of o.getAttributeNames())if(A.endsWith(Sr)){let N=k[n++],mt=o.getAttribute(A).split(rt),fe=/([.?@])?(.*)/.exec(N);f.push({type:1,index:a,name:fe[2],strings:mt,ctor:fe[1]==="."?Ue:fe[1]==="?"?He:fe[1]==="@"?ze:Nt}),o.removeAttribute(A)}else A.startsWith(rt)&&(f.push({type:6,index:a}),o.removeAttribute(A));if(gi.test(o.tagName)){let A=o.textContent.split(rt),N=A.length-1;if(N>0){o.textContent=Ve?Ve.emptyScript:"";for(let mt=0;mt<N;mt++)o.append(A[mt],le()),kt.nextNode(),f.push({type:2,index:++a});o.append(A[N],le())}}}else if(o.nodeType===8)if(o.data===_r)f.push({type:2,index:a});else{let A=-1;for(;(A=o.data.indexOf(rt,A+1))!==-1;)f.push({type:7,index:a}),A+=rt.length-1}a++}}static createElement(t,e){let r=Tt.createElement("template");return r.innerHTML=t,r}};function Lt(i,t,e=i,r){if(t===it)return t;let o=r!==void 0?e._$Co?.[r]:e._$Cl,a=de(t)?void 0:t._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),a===void 0?o=void 0:(o=new a(i),o._$AT(i,e,r)),r!==void 0?(e._$Co??(e._$Co=[]))[r]=o:e._$Cl=o),o!==void 0&&(t=Lt(i,o._$AS(i,t.values),o,r)),t}var Ye=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??Tt).importNode(e,!0);kt.currentNode=o;let a=kt.nextNode(),n=0,c=0,f=r[0];for(;f!==void 0;){if(n===f.index){let S;f.type===2?S=new Gt(a,a.nextSibling,this,t):f.type===1?S=new f.ctor(a,f.name,f.strings,this,t):f.type===6&&(S=new Fe(a,this,t)),this._$AV.push(S),f=r[++c]}n!==f?.index&&(a=kt.nextNode(),n++)}return kt.currentNode=Tt,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++}},Gt=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,o){this.type=2,this._$AH=p,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=Lt(this,t,e),de(t)?t===p||t==null||t===""?(this._$AH!==p&&this._$AR(),this._$AH=p):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):fi(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!==p&&de(this._$AH)?this._$AA.nextSibling.data=t:this.T(Tt.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=pe.createElement(yi(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{let a=new Ye(o,this),n=a.u(this.options);a.p(e),this.T(n),this._$AH=a}}_$AC(t){let e=ui.get(t.strings);return e===void 0&&ui.set(t.strings,e=new pe(t)),e}k(t){Ar(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,o=0;for(let a of t)o===e.length?e.push(r=new i(this.O(le()),this.O(le()),this,this.options)):r=e[o],r._$AI(a),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))}},Nt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,a){this.type=1,this._$AH=p,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=p}_$AI(t,e=this,r,o){let a=this.strings,n=!1;if(a===void 0)t=Lt(this,t,e,0),n=!de(t)||t!==this._$AH&&t!==it,n&&(this._$AH=t);else{let c=t,f,S;for(t=a[0],f=0;f<a.length-1;f++)S=Lt(this,c[r+f],e,f),S===it&&(S=this._$AH[f]),n||(n=!de(S)||S!==this._$AH[f]),S===p?t=p:t!==p&&(t+=(S??"")+a[f+1]),this._$AH[f]=S}n&&!o&&this.j(t)}j(t){t===p?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Ue=class extends Nt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===p?void 0:t}},He=class extends Nt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==p)}},ze=class extends Nt{constructor(t,e,r,o,a){super(t,e,r,o,a),this.type=5}_$AI(t,e=this){if((t=Lt(this,t,e,0)??p)===it)return;let r=this._$AH,o=t===p&&r!==p||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,a=t!==p&&(r===p||o);o&&this.element.removeEventListener(this.name,this,r),a&&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)}},Fe=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){Lt(this,t)}},bi={M:Sr,P:rt,A:_r,C:1,L:vi,R:Ye,D:fi,V:Lt,I:Gt,H:Nt,N:He,U:ze,B:Ue,F:Fe},Wo=ne.litHtmlPolyfillSupport;Wo?.(pe,Gt),(ne.litHtmlVersions??(ne.litHtmlVersions=[])).push("3.3.0");var Ci=(i,t,e)=>{let r=e?.renderBefore??t,o=r._$litPart$;if(o===void 0){let a=e?.renderBefore??null;r._$litPart$=o=new Gt(t.insertBefore(le(),a),a,void 0,e??{})}return o._$AI(i),o};var ce=globalThis,h=class extends et{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=Ci(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return it}};h._$litElement$=!0,h.finalized=!0,ce.litElementHydrateSupport?.({LitElement:h});var Jo=ce.litElementPolyfillSupport;Jo?.({LitElement:h});(ce.litElementVersions??(ce.litElementVersions=[])).push("4.2.0");var u=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var Zo={attribute:!0,type:String,converter:ae,reflect:!1,hasChanged:De},Xo=(i=Zo,t,e)=>{let{kind:r,metadata:o}=e,a=globalThis.litPropertyMetadata.get(o);if(a===void 0&&globalThis.litPropertyMetadata.set(o,a=new Map),r==="setter"&&((i=Object.create(i)).wrapped=!0),a.set(e.name,i),r==="accessor"){let{name:n}=e;return{set(c){let f=t.get.call(this);t.set.call(this,c),this.requestUpdate(n,f,i)},init(c){return c!==void 0&&this.C(n,void 0,i,c),c}}}if(r==="setter"){let{name:n}=e;return function(c){let f=this[n];t.call(this,c),this.requestUpdate(n,f,i)}}throw Error("Unsupported decorator location: "+r)};function l(i){return(t,e)=>typeof e=="object"?Xo(i,t,e):((r,o,a)=>{let n=o.hasOwnProperty(a);return o.constructor.createProperty(a,r),n?Object.getOwnPropertyDescriptor(o,a):void 0})(i,t,e)}function C(i){return l({...i,state:!0,attribute:!1})}var It=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function yt(i,t){return(e,r,o)=>{let a=n=>n.renderRoot?.querySelector(i)??null;if(t){let{get:n,set:c}=typeof r=="object"?e:o??(()=>{let f=Symbol();return{get(){return this[f]},set(S){this[f]=S}}})();return It(e,r,{get(){let f=n.call(this);return f===void 0&&(f=a(this),(f!==null||this.hasUpdated)&&c.call(this,f)),f}})}return It(e,r,{get(){return a(this)}})}}function P(i,t,e){return i?t(i):e?.(i)}var E=m`
|
|
5
4
|
* {
|
|
6
5
|
box-sizing: border-box;
|
|
7
6
|
}
|
|
8
|
-
`,
|
|
7
|
+
`,xi=m`
|
|
9
8
|
:host {
|
|
10
9
|
display: block;
|
|
11
10
|
isolation: isolate;
|
|
@@ -14,14 +13,14 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
14
13
|
//Keep the CSS loader in the same position - check css-loader-inline.ts
|
|
15
14
|
min-height: 64px;
|
|
16
15
|
}
|
|
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
|
-
${
|
|
19
|
-
${
|
|
20
|
-
${
|
|
16
|
+
`;var Ei="https://sdk.primer.io/web/v2-latest/Primer.min.js";var Be=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 Ke=class{constructor(t){this.paymentMethods=null;this.headlessInstance=t}setPaymentMethods(t){this.paymentMethods=t}async refreshSession(){if(!this.headlessInstance){y.error("PrimerJS: Cannot refresh session: Headless instance not available");return}try{await this.headlessInstance.refreshClientSession()}catch(t){throw y.error("PrimerJS: Error refreshing client session:",t),t}}getPaymentMethods(){return this.paymentMethods?this.paymentMethods.toArray():(y.warn("PrimerJS: Payment methods not available"),[])}handlePaymentStart(){this.onPaymentStart&&this.onPaymentStart()}handleBeforePaymentCreate(t,e){if(this.onPaymentPrepare){let r={continuePaymentCreation:()=>{y.info("PrimerJS: Payment creation continuing"),e.continuePaymentCreation()},abortPaymentCreation:()=>{y.info("PrimerJS: Payment creation aborted"),e.abortPaymentCreation()}};this.onPaymentPrepare(t,r)}else y.info("PrimerJS: No payment prepare handler, continuing by default"),e.continuePaymentCreation()}handlePaymentComplete(t){this.onPaymentComplete&&this.onPaymentComplete({payment:t,status:"success"})}handlePaymentFailure(t,e){this.onPaymentComplete&&this.onPaymentComplete({payment:e||null,status:"error",error:t})}};var Si=typeof window<"u"&&typeof window.document<"u";function Qo(i){return document.querySelector(`script[src^="${i}"]`)}function ta(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 _i(i,t=!1){if(!Si)throw new Error("Cannot load script in server environment");let e=Qo(i)??ta(i,t);return new Promise((r,o)=>{e.onload=()=>{r()},e.onerror=()=>{o()},e.parentNode||document.head.appendChild(e)})}var Ge=class{constructor(t){this.createPaymentMethodManager=null;this._paymentsList=[];this.currentSdkInstance=null;this.primerJS=null;this.loadingTimeout=null;this.isDisconnected=!1;(this.host=t).addController(this),this.isDisconnected=!1,this.sdkInstanceTask=new _(t,{args:()=>[this.host.clientToken,this.host.options],task:this.initializeHeadless()}),new _(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&&(y.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(),y.info("SDK instance cleaned up")}catch(t){y.error("Error cleaning up SDK instance:",t)}this.currentSdkInstance=null,this.primerJS=null}async _loadV2Sdk(t=Ei){if(window.Primer&&typeof window.Primer.preloadPrimer=="function"){y.info("SDK already loaded, skipping load script"),await window.Primer.preloadPrimer();return}await _i(t),await window.Primer.preloadPrimer()}initializeHeadless(){return async([t,e])=>{if(this.isDisconnected)return y.warn("Component disconnected, aborting SDK initialization"),x;if(!t||!e)return x;this.cleanupResources();try{await this._loadV2Sdk();let{Primer:r}=window;this.primerJS=new Ke(null);let o=await r.createHeadless(t,{...e,onAvailablePaymentMethodsLoad:n=>{this.isDisconnected||(y.info("Configuration payment methods:",n),this.paymentsList=n)},onCheckoutComplete:({payment:n})=>{this.isDisconnected||(y.info("Payment completed:",n),this.host.sdkStateController.completeProcessing(),this.primerJS&&this.primerJS.handlePaymentComplete(n))},onCheckoutFail:(n,c)=>{this.isDisconnected||(y.error("Payment failed:",n),this.host.sdkStateController.setFailure(n.code||"UNKNOWN_ERROR",n.message||"Unknown error occurred"),this.primerJS&&this.primerJS.handlePaymentFailure(n,c.payment))},onBeforePaymentCreate:(n,c)=>{this.isDisconnected||(this.host.sdkStateController.startProcessing(),this.primerJS?this.primerJS.handleBeforePaymentCreate(n,c):c?.continuePaymentCreation())},onPaymentMethodAction:(n,c)=>{this.isDisconnected||n==="PAYMENT_METHOD_UNSELECTED"&&this.host.sdkStateController.stopProcessing()},onPaymentCreationStart:()=>{this.isDisconnected||(this.host.sdkStateController.resetError(),this.primerJS&&this.primerJS.handlePaymentStart())}});if(this.createPaymentMethodManager=o.createPaymentMethodManager.bind(o),this.currentSdkInstance=o,this.primerJS&&Object.defineProperty(this.primerJS,"headlessInstance",{value:o,writable:!1}),await o.start(),this.isDisconnected)return this.cleanupResources(),x;this.host.sdkContextController.setClientOptions(e),this.primerJS&&this.host.primerEventsController.dispatchCheckoutInitialized(this.primerJS);let a=o.getSDKUtilities();return this.host.sdkContextController.setHeadlessUtils(a),this.host.vaultManagerController.initializeVaultManager(o.createVaultManager(),{vaultEnabled:e.vault?.enabled,captureVaultedCardCvv:!!a.getPaymentMethodConfiguration("PAYMENT_CARD")?.options.captureVaultedCardCvv}),o}catch(r){throw r instanceof Error&&(y.error("SDK initialization error:",r),this.host.sdkStateController.setError(r)),this.cleanupResources(),r}}}initializeLitContext(){return async([t,e])=>{if(this.isDisconnected)return x;if(!t||!e.length)return x;let r=new Map,o=new Map;try{for(let n of e){if(this.isDisconnected)break;let c=await this.initializePaymentMethodManager(n)();n&&c&&(r.set(n.type,n),o.set(n.type,c))}if(this.isDisconnected)return x;let a=new Be(r);return this.host.sdkContextController.setPaymentManagers(o),this.host.sdkContextController.setPaymentMethods(a),this.primerJS&&this.primerJS.setPaymentMethods(a),this.host.primerEventsController.dispatchPaymentMethods(a),y.info("Initialized payment methods:",a.toArray()),r}catch(a){if(a instanceof Error)throw this.host.sdkStateController.setError(a),a;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:a=>{this.isDisconnected||this.host.sdkContextController.setKlarnaCategories({categories:a,isLoading:!1})}});return o?{type:e,manager:o}:null}try{if(r==="CARD"){let a=await this.createPaymentMethodManager(e,{onCardNetworksChange:async n=>{this.isDisconnected||await this.host.cardNetworkController.processCardNetworkChangeEvent(n)},onCardNetworksLoading:()=>{this.isDisconnected||this.host.cardNetworkController.setCardNetworksLoading()}});return a?{type:e,manager:a}:null}let o=await this.createPaymentMethodManager(e);return o?{type:e,manager:o}:null}catch(o){return y.error(`Failed to initialize manager for ${e}:`,o),null}}}};var je=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 ea=$r({"../../localization/lit-localize/locales/ar.ts":()=>import("./chunks/ar.6MRFCKX4.js"),"../../localization/lit-localize/locales/bg.ts":()=>import("./chunks/bg.HRSMU7Y5.js"),"../../localization/lit-localize/locales/ca.ts":()=>import("./chunks/ca.3FSHJL7U.js"),"../../localization/lit-localize/locales/cs.ts":()=>import("./chunks/cs.WAO4WFS3.js"),"../../localization/lit-localize/locales/da.ts":()=>import("./chunks/da.4OFYGDVA.js"),"../../localization/lit-localize/locales/de.ts":()=>import("./chunks/de.3FZS52IN.js"),"../../localization/lit-localize/locales/el.ts":()=>import("./chunks/el.A4R7VG5T.js"),"../../localization/lit-localize/locales/en-GB.ts":()=>import("./chunks/en-GB.ILZ7SXSW.js"),"../../localization/lit-localize/locales/en.ts":()=>import("./chunks/en.7GZJA7MN.js"),"../../localization/lit-localize/locales/es-AR.ts":()=>import("./chunks/es-AR.QKHDL4JV.js"),"../../localization/lit-localize/locales/es-MX.ts":()=>import("./chunks/es-MX.GG7MJMG2.js"),"../../localization/lit-localize/locales/es.ts":()=>import("./chunks/es.FEZ6BF3S.js"),"../../localization/lit-localize/locales/et-EE.ts":()=>import("./chunks/et-EE.FJLPTMF3.js"),"../../localization/lit-localize/locales/fi-FI.ts":()=>import("./chunks/fi-FI.DM5R27A5.js"),"../../localization/lit-localize/locales/fr.ts":()=>import("./chunks/fr.YZV52NTA.js"),"../../localization/lit-localize/locales/he.ts":()=>import("./chunks/he.6SCF3XZZ.js"),"../../localization/lit-localize/locales/hr.ts":()=>import("./chunks/hr.PPDZ7AAS.js"),"../../localization/lit-localize/locales/hu.ts":()=>import("./chunks/hu.6WOPSGLW.js"),"../../localization/lit-localize/locales/id.ts":()=>import("./chunks/id.NS22WGWL.js"),"../../localization/lit-localize/locales/it.ts":()=>import("./chunks/it.42TO3R4G.js"),"../../localization/lit-localize/locales/ja.ts":()=>import("./chunks/ja.UEGHEUAP.js"),"../../localization/lit-localize/locales/ko.ts":()=>import("./chunks/ko.HTMDY6RY.js"),"../../localization/lit-localize/locales/lt-LT.ts":()=>import("./chunks/lt-LT.4U3GBQTQ.js"),"../../localization/lit-localize/locales/lt.ts":()=>import("./chunks/lt.73ME4TDM.js"),"../../localization/lit-localize/locales/lv-LV.ts":()=>import("./chunks/lv-LV.JRWO2BF6.js"),"../../localization/lit-localize/locales/lv.ts":()=>import("./chunks/lv.KROS45TV.js"),"../../localization/lit-localize/locales/ms.ts":()=>import("./chunks/ms.HE3SWJFQ.js"),"../../localization/lit-localize/locales/nb.ts":()=>import("./chunks/nb.TR6TEKBY.js"),"../../localization/lit-localize/locales/nl.ts":()=>import("./chunks/nl.V5QP6OXL.js"),"../../localization/lit-localize/locales/nl_NL.ts":()=>import("./chunks/nl_NL.FCVWIF3Y.js"),"../../localization/lit-localize/locales/pl.ts":()=>import("./chunks/pl.DQZDG7LR.js"),"../../localization/lit-localize/locales/pt-BR.ts":()=>import("./chunks/pt-BR.CR4ROBVE.js"),"../../localization/lit-localize/locales/pt.ts":()=>import("./chunks/pt.JRWVFJPX.js"),"../../localization/lit-localize/locales/ro.ts":()=>import("./chunks/ro.NRMWYY3F.js"),"../../localization/lit-localize/locales/ru.ts":()=>import("./chunks/ru.OWSKHXVO.js"),"../../localization/lit-localize/locales/sk.ts":()=>import("./chunks/sk.YGBRNNWT.js"),"../../localization/lit-localize/locales/sl.ts":()=>import("./chunks/sl.IRTDTNTP.js"),"../../localization/lit-localize/locales/sr-RS.ts":()=>import("./chunks/sr-RS.AWGLHKVE.js"),"../../localization/lit-localize/locales/sv.ts":()=>import("./chunks/sv.O4BXFGNF.js"),"../../localization/lit-localize/locales/th.ts":()=>import("./chunks/th.GZCEBRT2.js"),"../../localization/lit-localize/locales/tr.ts":()=>import("./chunks/tr.ZDILMEEO.js"),"../../localization/lit-localize/locales/uk-UA.ts":()=>import("./chunks/uk-UA.JUUBOEW3.js"),"../../localization/lit-localize/locales/vi.ts":()=>import("./chunks/vi.IN7CFTLL.js"),"../../localization/lit-localize/locales/zf.ts":()=>import("./chunks/zf.YT47ULXR.js"),"../../localization/lit-localize/locales/zh-CN.ts":()=>import("./chunks/zh-CN.RBRAS4RP.js"),"../../localization/lit-localize/locales/zh-HK.ts":()=>import("./chunks/zh-HK.4CK7LBWM.js"),"../../localization/lit-localize/locales/zh-TW.ts":()=>import("./chunks/zh-TW.374TMWNJ.js")});gr(i=>ea(`../../localization/lit-localize/locales/${i}.ts`));var qe={LOADER_DISABLED:"loader-disabled",CUSTOM_STYLES:"custom-styles",CLIENT_TOKEN:"client-token",JS_INIT:"js-initialized"},V=class extends h{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 Se(this),this.sdkStateController=new xe(this),this.primerEventsController=new Ut(this),this.styleProcessingController=new _e(this),this.vaultManagerController=new Xt(this),this.cardNetworkController=new ge(this),this.achPaymentEventsController=new je(this),new Ge(this)}set jsInitialized(e){this.requestUpdate(),this._jsInitialized=e}get jsInitialized(){return this._jsInitialized}attributeChangedCallback(e,r,o){e===qe.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&&(vr(this.options?.locale)?this.locale=br(this.options?.locale):y.warn("\u{1F30E}\u2757 Unsupported locale provided:",this.options?.locale,"- Falling back to default locale `en-GB`")),yr(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&&(y.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,a=!r&&!o;return d`
|
|
17
|
+
${P(r,()=>p)}
|
|
18
|
+
${P(o,()=>d`<primer-checkout-error></primer-checkout-error>`)}
|
|
19
|
+
${P(a,()=>d`
|
|
21
20
|
<slot name="main" @slotchange=${this.onSlotChange}></slot>
|
|
22
|
-
${
|
|
23
|
-
`,()=>
|
|
24
|
-
`}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};
|
|
21
|
+
${P(this.hasAssignedContent,()=>p,()=>d`<primer-main></primer-main>`)}
|
|
22
|
+
`,()=>p)}
|
|
23
|
+
`}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};V.styles=[E,xi],s([l({type:String,attribute:qe.CUSTOM_STYLES})],V.prototype,"customStyles",2),s([l({type:String,attribute:qe.CLIENT_TOKEN})],V.prototype,"clientToken",2),s([l({type:Object})],V.prototype,"options",2),s([l({type:Boolean,reflect:!0,attribute:qe.JS_INIT})],V.prototype,"_jsInitialized",2),s([yt("slot")],V.prototype,"defaultSlot",2),s([C()],V.prototype,"previousLoadingState",2),V=s([M(),u("primer-checkout")],V);var oa=ra({tagName:"primer-checkout",elementClass:V,react:ia});import{createComponent as aa}from"@lit/react";import sa from"react";var Ai=m`
|
|
25
24
|
:host {
|
|
26
25
|
display: flex;
|
|
27
26
|
flex-direction: column;
|
|
@@ -50,7 +49,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
50
49
|
line-height: var(--primer-typography-body-medium-line-height);
|
|
51
50
|
letter-spacing: var(--primer-typography-body-medium-letter-spacing);
|
|
52
51
|
}
|
|
53
|
-
`;var
|
|
52
|
+
`;var at=class extends h{constructor(){super(...arguments);this.type="complete"}render(){return this.type==="complete"?d`
|
|
54
53
|
<!-- Successful view -->
|
|
55
54
|
<primer-icon
|
|
56
55
|
size="lg"
|
|
@@ -62,7 +61,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
62
61
|
<p class="secondary">
|
|
63
62
|
You'll be redirected to the order confirmation page soon.
|
|
64
63
|
</p>
|
|
65
|
-
`:
|
|
64
|
+
`:d`
|
|
66
65
|
<primer-icon
|
|
67
66
|
size="lg"
|
|
68
67
|
name="failure-icon"
|
|
@@ -70,8 +69,8 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
70
69
|
>
|
|
71
70
|
</primer-icon>
|
|
72
71
|
<p>Payment failed</p>
|
|
73
|
-
${this.description?
|
|
74
|
-
`}};
|
|
72
|
+
${this.description?d`<p class="secondary">${this.description}</p>`:d`<p class="secondary">Something went wrong.</p>`}
|
|
73
|
+
`}};at.styles=[Ai],s([l({type:String,reflect:!0})],at.prototype,"type",2),s([l({type:String,reflect:!0})],at.prototype,"description",2),at=s([u("primer-checkout-state")],at);var na=aa({tagName:"primer-checkout-state",elementClass:at,react:sa});import{createComponent as la}from"@lit/react";import da from"react";var Pi=m`
|
|
75
74
|
:host {
|
|
76
75
|
display: block;
|
|
77
76
|
}
|
|
@@ -125,201 +124,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
125
124
|
transition: none;
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
|
-
`;var
|
|
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`
|
|
127
|
+
`;var D=class extends h{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 d`
|
|
323
128
|
<div class="collapsable">
|
|
324
129
|
<primer-button
|
|
325
130
|
variant=${this.buttonVariant}
|
|
@@ -343,7 +148,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
343
148
|
</div>
|
|
344
149
|
</div>
|
|
345
150
|
</div>
|
|
346
|
-
`}};
|
|
151
|
+
`}};D.styles=[Pi],s([l({type:String})],D.prototype,"header",2),s([l({type:Boolean})],D.prototype,"expanded",2),s([l({type:String})],D.prototype,"expandText",2),s([l({type:String})],D.prototype,"collapseText",2),s([l({type:String})],D.prototype,"ariaLabel",2),s([l({type:String})],D.prototype,"buttonVariant",2),s([C()],D.prototype,"isExpanded",2),D=s([u("primer-collapsable")],D);var pa=la({tagName:"primer-collapsable",elementClass:D,react:da});import{createComponent as ca}from"@lit/react";import ma from"react";var wi=m`
|
|
347
152
|
:host {
|
|
348
153
|
display: contents;
|
|
349
154
|
}
|
|
@@ -372,9 +177,9 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
372
177
|
display: flex;
|
|
373
178
|
justify-content: flex-end;
|
|
374
179
|
}
|
|
375
|
-
`;var
|
|
180
|
+
`;var vt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},st=i=>(...t)=>({_$litDirective$:i,values:t}),jt=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=st(class extends jt{constructor(i){if(super(i),i.type!==vt.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 it}});var $t=class extends h{_handleCloseClick(){this.dispatchEvent(new CustomEvent("primer-dialog-close",{bubbles:!0,composed:!0}))}render(){return d`
|
|
376
181
|
<div
|
|
377
|
-
class=${
|
|
182
|
+
class=${I({backdrop:!0})}
|
|
378
183
|
@click=${t=>{t.preventDefault()}}
|
|
379
184
|
>
|
|
380
185
|
<div class="dialog">
|
|
@@ -388,7 +193,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
388
193
|
</div>
|
|
389
194
|
</div>
|
|
390
195
|
</div>
|
|
391
|
-
`}}
|
|
196
|
+
`}};$t.styles=[wi],$t=s([u("primer-dialog")],$t);var ha=ca({tagName:"primer-dialog",elementClass:$t,react:ma});import{createComponent as ua}from"@lit/react";import fa from"react";var Mi=m`
|
|
392
197
|
:host {
|
|
393
198
|
display: block;
|
|
394
199
|
width: 100%;
|
|
@@ -448,17 +253,33 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
448
253
|
transform: none;
|
|
449
254
|
}
|
|
450
255
|
}
|
|
451
|
-
`;var
|
|
256
|
+
`;var j=class extends h{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 p;let e={"error-message":!0,hidden:!this.visible};return d`
|
|
257
|
+
<div
|
|
258
|
+
part="error-message"
|
|
259
|
+
class=${I(e)}
|
|
260
|
+
aria-live="assertive"
|
|
261
|
+
aria-atomic="true"
|
|
262
|
+
>
|
|
263
|
+
<div part="error-icon" class="error-icon">
|
|
264
|
+
<primer-icon
|
|
265
|
+
name="failure-icon"
|
|
266
|
+
size="sm"
|
|
267
|
+
color="var(--primer-color-icon-negative)"
|
|
268
|
+
></primer-icon>
|
|
269
|
+
</div>
|
|
270
|
+
<div part="error-content" class="error-content">${this.message}</div>
|
|
271
|
+
</div>
|
|
272
|
+
`}};j.styles=[Mi],s([l({type:String})],j.prototype,"message",2),s([l({type:Boolean,reflect:!0})],j.prototype,"visible",2),s([l({type:String,reflect:!0})],j.prototype,"role",2),s([C()],j.prototype,"showMessage",2),j=s([u("primer-error-message")],j);var ga=ua({tagName:"primer-error-message",elementClass:j,react:fa});import{createComponent as ya}from"@lit/react";import va from"react";var ki={pencil:ot`
|
|
452
273
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
453
274
|
<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
275
|
</svg>
|
|
455
|
-
`,trash:
|
|
276
|
+
`,trash:ot`
|
|
456
277
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
457
278
|
<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
279
|
<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
280
|
<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
281
|
</svg>
|
|
461
|
-
`,"successful-check":
|
|
282
|
+
`,"successful-check":ot`
|
|
462
283
|
<svg
|
|
463
284
|
viewBox="0 0 56 56"
|
|
464
285
|
fill="none"
|
|
@@ -473,7 +294,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
473
294
|
/>
|
|
474
295
|
</g>
|
|
475
296
|
</svg>
|
|
476
|
-
`,"failure-icon":
|
|
297
|
+
`,"failure-icon":ot`
|
|
477
298
|
<svg
|
|
478
299
|
viewBox="0 0 40 40"
|
|
479
300
|
fill="none"
|
|
@@ -485,27 +306,27 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
485
306
|
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
307
|
/>
|
|
487
308
|
</svg>
|
|
488
|
-
`,"payment-card":
|
|
309
|
+
`,"payment-card":ot`
|
|
489
310
|
<svg width="28" height="21" viewBox="0 0 28 21" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
490
311
|
<rect y="0.748047" width="28" height="20" rx="2" fill="#E0E0E0"/>
|
|
491
312
|
<rect y="6.74805" width="28" height="4" fill="#212121"/>
|
|
492
313
|
<rect x="19" y="13.748" width="6" height="4" rx="0.933333" fill="white"/>
|
|
493
314
|
</svg>
|
|
494
|
-
`,"chevron-down":
|
|
315
|
+
`,"chevron-down":ot`
|
|
495
316
|
<svg width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
496
317
|
<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:
|
|
318
|
+
</svg>`,checkmark:ot`
|
|
498
319
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
499
320
|
<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
321
|
</svg>
|
|
501
|
-
`,close:
|
|
322
|
+
`,close:ot`
|
|
502
323
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
503
324
|
<path
|
|
504
325
|
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
326
|
fill="#212121"
|
|
506
327
|
/>
|
|
507
328
|
</svg>
|
|
508
|
-
`};var
|
|
329
|
+
`};var Ti=m`
|
|
509
330
|
:host {
|
|
510
331
|
display: inline-block;
|
|
511
332
|
line-height: 0; /* so you don’t get extra space around the icon */
|
|
@@ -547,27 +368,11 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
547
368
|
/* --internal used for abstracting away the icon component */
|
|
548
369
|
fill: var(--internal-icon-color, currentColor);
|
|
549
370
|
}
|
|
550
|
-
`;var
|
|
371
|
+
`;var J=class extends h{constructor(){super(...arguments);this.color="var(--primer-color-icon-primary)";this.size="lg"}render(){let e=this.name?ki[this.name]:null;return d`
|
|
551
372
|
<div style="--internal-icon-color: ${this.color}">
|
|
552
|
-
${e||
|
|
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>
|
|
373
|
+
${e||d`<slot></slot>`}
|
|
569
374
|
</div>
|
|
570
|
-
`}};
|
|
375
|
+
`}};J.styles=[Ti],s([l({type:String,reflect:!0})],J.prototype,"color",2),s([l({type:String,reflect:!0})],J.prototype,"size",2),s([l({reflect:!0})],J.prototype,"name",2),J=s([u("primer-icon")],J);var ba=ya({tagName:"primer-icon",elementClass:J,react:va});import{createComponent as Ea}from"@lit/react";import Sa from"react";var Li=m`
|
|
571
376
|
:host {
|
|
572
377
|
display: contents;
|
|
573
378
|
}
|
|
@@ -598,7 +403,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
598
403
|
:host([disabled]) input::placeholder {
|
|
599
404
|
color: var(--primer-color-text-disabled);
|
|
600
405
|
}
|
|
601
|
-
`;var
|
|
406
|
+
`;var Ca=["text","password","email","number","tel","url","search","date","time","datetime-local","month","week","color"];function xa(i){return Ca.includes(i)}var w=class extends h{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 d`
|
|
602
407
|
<input
|
|
603
408
|
part="input"
|
|
604
409
|
class=${r}
|
|
@@ -623,7 +428,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
623
428
|
@blur=${this.handleBlur}
|
|
624
429
|
@invalid=${this.handleInvalid}
|
|
625
430
|
/>
|
|
626
|
-
`}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};
|
|
431
|
+
`}addEventListener(e,r,o){super.addEventListener(e,r,o)}removeEventListener(e,r,o){super.removeEventListener(e,r,o)}};w.styles=[Li],s([yt("input")],w.prototype,"inputElement",2),s([l({type:String,reflect:!0})],w.prototype,"value",2),s([l({type:String,reflect:!0})],w.prototype,"placeholder",2),s([l({type:Boolean,reflect:!0})],w.prototype,"disabled",2),s([l({type:String,reflect:!0})],w.prototype,"name",2),s([l({type:String,reflect:!0,converter:{fromAttribute:e=>!e||!xa(e)?(e&&e!=="text"&&y.warn(`Invalid input type: ${e}. Defaulting to 'text'.`),"text"):e}})],w.prototype,"type",2),s([l({type:Boolean,reflect:!0})],w.prototype,"required",2),s([l({type:Boolean,reflect:!0})],w.prototype,"readonly",2),s([l({type:String,reflect:!0})],w.prototype,"pattern",2),s([l({type:Number,reflect:!0})],w.prototype,"minlength",2),s([l({type:Number,reflect:!0})],w.prototype,"maxlength",2),s([l({type:String,reflect:!0})],w.prototype,"min",2),s([l({type:String,reflect:!0})],w.prototype,"max",2),s([l({type:String,reflect:!0})],w.prototype,"step",2),s([l({type:String,reflect:!0})],w.prototype,"autocomplete",2),s([l({type:String,reflect:!0})],w.prototype,"id",2),s([C()],w.prototype,"hasFocus",2),s([C()],w.prototype,"hasError",2),w=s([u("primer-input")],w);var _a=Ea({tagName:"primer-input",elementClass:w,react:Sa});import{createComponent as Aa}from"@lit/react";import Pa from"react";var Ni=m`
|
|
627
432
|
:host {
|
|
628
433
|
display: contents;
|
|
629
434
|
}
|
|
@@ -639,7 +444,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
639
444
|
display: block;
|
|
640
445
|
font-family: var(--primer-typography-body-small-font);
|
|
641
446
|
}
|
|
642
|
-
`;var
|
|
447
|
+
`;var nt=class extends h{constructor(){super(...arguments);this.for="";this.active=!0}render(){return d`
|
|
643
448
|
<span
|
|
644
449
|
class="error"
|
|
645
450
|
role="alert"
|
|
@@ -648,7 +453,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
648
453
|
>
|
|
649
454
|
<slot></slot>
|
|
650
455
|
</span>
|
|
651
|
-
`}};
|
|
456
|
+
`}};nt.styles=[Ni],s([l({type:String,reflect:!0})],nt.prototype,"for",2),s([l({type:Boolean,reflect:!0})],nt.prototype,"active",2),nt=s([u("primer-input-error")],nt);var wa=Aa({tagName:"primer-input-error",elementClass:nt,react:Pa});import{createComponent as Ma}from"@lit/react";import ka from"react";var Ii=m`
|
|
652
457
|
:host {
|
|
653
458
|
display: inline-block;
|
|
654
459
|
font-weight: var(--primer-typography-body-small-weight);
|
|
@@ -662,7 +467,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
662
467
|
:host([disabled]) {
|
|
663
468
|
color: var(--primer-color-text-disabled);
|
|
664
469
|
}
|
|
665
|
-
`;var
|
|
470
|
+
`;var lt=class extends h{constructor(){super(...arguments);this.for="";this.disabled=!1}render(){return d`<label for=${this.for}><slot></slot></label>`}};lt.styles=[Ii],s([l({type:String,reflect:!0})],lt.prototype,"for",2),s([l({type:Boolean,reflect:!0})],lt.prototype,"disabled",2),lt=s([u("primer-input-label")],lt);var Ta=Ma({tagName:"primer-input-label",elementClass:lt,react:ka});import{createComponent as La}from"@lit/react";import Na from"react";var $i=m`
|
|
666
471
|
* {
|
|
667
472
|
box-sizing: border-box;
|
|
668
473
|
}
|
|
@@ -727,19 +532,19 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
727
532
|
border-color: var(--primer-color-border-outlined-disabled);
|
|
728
533
|
cursor: not-allowed;
|
|
729
534
|
}
|
|
730
|
-
`;var
|
|
535
|
+
`;var Z=class extends h{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 a=o.querySelector("primer-input");if(a)return a}return null}render(){let e={"input-slot":!0,"focus-within":this.focusWithin};return d`
|
|
731
536
|
<div class="input-wrapper">
|
|
732
537
|
<slot name="label"></slot>
|
|
733
|
-
<div class="${
|
|
538
|
+
<div class="${I(e)}" @click="${this.handleWrapperClick}">
|
|
734
539
|
<slot name="input"></slot>
|
|
735
540
|
</div>
|
|
736
541
|
<slot name="error"></slot>
|
|
737
542
|
</div>
|
|
738
|
-
`}};
|
|
543
|
+
`}};Z.styles=[$i],s([l({type:Boolean})],Z.prototype,"focusWithin",2),s([l({type:Boolean,reflect:!0,attribute:"has-error"})],Z.prototype,"hasError",2),s([yt('slot[name="input"]')],Z.prototype,"inputSlot",2),Z=s([u("primer-input-wrapper")],Z);var Ia=La({tagName:"primer-input-wrapper",elementClass:Z,react:Na});import{createComponent as $a}from"@lit/react";import Ra from"react";var Ri=m`
|
|
739
544
|
:host {
|
|
740
545
|
display: none;
|
|
741
546
|
}
|
|
742
|
-
`;var
|
|
547
|
+
`;var bt=class extends h{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 a=this.getContainer();o.forEach(n=>a.appendChild(n))}render(){return d`<slot @slotchange=${this._handleSlotChange}></slot>`}};bt.styles=[Ri],s([C()],bt.prototype,"id",2),bt=s([u("primer-portal")],bt);var Oa=$a({tagName:"primer-portal",elementClass:bt,react:Ra});import{createComponent as Da}from"@lit/react";import Va from"react";var Oi=m`
|
|
743
548
|
:host {
|
|
744
549
|
display: inline-flex;
|
|
745
550
|
align-items: center;
|
|
@@ -784,7 +589,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
784
589
|
transform: rotate(360deg);
|
|
785
590
|
}
|
|
786
591
|
}
|
|
787
|
-
`;var
|
|
592
|
+
`;var wr={small:16,medium:24,large:32},X=class extends h{constructor(){super(...arguments);this.color="var(--primer-color-loader)";this.size="medium";this.compact=!1}getSize(){if(this.size in wr)return wr[this.size];let e=parseInt(this.size,10);return isNaN(e)?wr.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`),d`
|
|
788
593
|
<div class="spinner-container ${this.compact?"compact":""}">
|
|
789
594
|
<svg
|
|
790
595
|
class="spinner"
|
|
@@ -803,34 +608,228 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
803
608
|
/>
|
|
804
609
|
</svg>
|
|
805
610
|
</div>
|
|
806
|
-
`}};
|
|
611
|
+
`}};X.styles=[Oi],s([l({type:String})],X.prototype,"color",2),s([l({type:String})],X.prototype,"size",2),s([l({type:Boolean})],X.prototype,"compact",2),X=s([u("primer-spinner")],X);var Ya=Da({tagName:"primer-spinner",elementClass:X,react:Va});import{createComponent as Ua}from"@lit/react";import Ha from"react";var Di=m`
|
|
807
612
|
:host {
|
|
808
|
-
display:
|
|
809
|
-
flex-direction: column;
|
|
810
|
-
gap: var(--primer-space-medium);
|
|
811
|
-
width: 100%;
|
|
613
|
+
display: contents;
|
|
812
614
|
}
|
|
813
615
|
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
padding: 0;
|
|
616
|
+
button {
|
|
617
|
+
align-items: center;
|
|
817
618
|
border-radius: var(--primer-radius-medium);
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
font-
|
|
619
|
+
border: none;
|
|
620
|
+
cursor: pointer;
|
|
621
|
+
display: flex;
|
|
622
|
+
font-family: var(--primer-typography-title-large-font);
|
|
623
|
+
font-size: var(--primer-typography-title-large-size);
|
|
624
|
+
font-weight: var(--primer-typography-title-large-weight);
|
|
625
|
+
gap: var(--primer-space-small);
|
|
626
|
+
justify-content: center;
|
|
627
|
+
letter-spacing: var(--primer-typography-title-large-letter-spacing);
|
|
628
|
+
line-height: var(--primer-typography-title-large-line-height);
|
|
629
|
+
outline: none;
|
|
630
|
+
padding: var(--primer-space-medium) var(--primer-space-medium);
|
|
631
|
+
position: relative;
|
|
632
|
+
transition: all 0.2s ease-in-out;
|
|
823
633
|
}
|
|
824
634
|
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
635
|
+
.button-content {
|
|
636
|
+
display: flex;
|
|
637
|
+
height: 100%;
|
|
638
|
+
align-items: center;
|
|
639
|
+
gap: var(--primer-space-small);
|
|
640
|
+
justify-content: center;
|
|
641
|
+
transition: opacity var(--primer-animation-duration)
|
|
642
|
+
var(--primer-animation-easing);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
/* Reduce opacity of text during loading for better focus on the spinner */
|
|
646
|
+
.button-content.loading {
|
|
647
|
+
opacity: 0.65;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
:host([selectable]) button {
|
|
651
|
+
justify-content: space-between;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/* Primary variant */
|
|
655
|
+
:host([variant='primary']) button {
|
|
656
|
+
background-color: var(--primer-color-brand);
|
|
657
|
+
/* This is correct (color-background for color) because Button is kind of a special component */
|
|
658
|
+
color: var(--primer-color-background-outlined-default);
|
|
659
|
+
}
|
|
660
|
+
:host([variant='primary']:not([disabled]):not([loading])) button:hover {
|
|
661
|
+
filter: brightness(105%);
|
|
662
|
+
}
|
|
663
|
+
:host([variant='primary']:not([disabled]):not([loading])) button:active {
|
|
664
|
+
filter: brightness(98%);
|
|
665
|
+
}
|
|
666
|
+
:host([variant='primary']) button:focus-visible {
|
|
667
|
+
outline: 2px solid var(--primer-color-brand);
|
|
668
|
+
outline-offset: 2px;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/* Disabled state for primary button */
|
|
672
|
+
:host([variant='primary'][disabled]:not([loading])) button,
|
|
673
|
+
:host([variant='primary']:not([loading])) button:disabled {
|
|
674
|
+
color: var(--primer-color-text-disabled);
|
|
675
|
+
background-color: var(--primer-color-background-outlined-disabled);
|
|
676
|
+
cursor: not-allowed;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
/* Loading state for primary button - OVERRIDES disabled styles with higher specificity */
|
|
680
|
+
:host([variant='primary'][loading]) button {
|
|
681
|
+
background-color: var(--primer-color-brand);
|
|
682
|
+
opacity: 0.8;
|
|
683
|
+
color: var(--primer-color-background-outlined-default);
|
|
684
|
+
cursor: wait;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/* Secondary variant */
|
|
688
|
+
:host([variant='secondary']) button {
|
|
689
|
+
background-color: var(--primer-color-background-outlined-default);
|
|
690
|
+
color: var(--primer-color-text-primary);
|
|
691
|
+
border: 1px solid var(--primer-color-border-outlined-default);
|
|
692
|
+
}
|
|
693
|
+
:host([variant='secondary']:not([disabled]):not([loading])) button:hover {
|
|
694
|
+
background-color: var(--primer-color-background-outlined-hover);
|
|
695
|
+
}
|
|
696
|
+
:host([variant='secondary']:not([disabled]):not([loading])) button:active {
|
|
697
|
+
background-color: var(--primer-color-background-outlined-active);
|
|
698
|
+
}
|
|
699
|
+
:host([variant='secondary']) button:focus-visible {
|
|
700
|
+
outline: 2px solid var(--primer-color-border-outlined-focus);
|
|
701
|
+
outline-offset: 2px;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/* Disabled state for secondary button */
|
|
705
|
+
:host([variant='secondary'][disabled]:not([loading])) button,
|
|
706
|
+
:host([variant='secondary']:not([loading])) button:disabled {
|
|
707
|
+
background-color: var(--primer-color-background-outlined-disabled);
|
|
708
|
+
border-color: var(--primer-color-border-outlined-disabled);
|
|
709
|
+
color: var(--primer-color-text-disabled);
|
|
710
|
+
cursor: not-allowed;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/* Loading state for secondary button - OVERRIDES disabled styles */
|
|
714
|
+
:host([variant='secondary'][loading]) button {
|
|
715
|
+
background-color: var(--primer-color-gray-100);
|
|
716
|
+
border-color: var(--primer-color-gray-300);
|
|
717
|
+
color: var(--primer-color-gray-600);
|
|
718
|
+
cursor: wait;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/* Tertiary variant */
|
|
722
|
+
:host([variant='tertiary']) button {
|
|
723
|
+
background-color: var(--primer-color-background-transparent-default);
|
|
724
|
+
border: 1px solid var(--primer-color-border-transparent-default);
|
|
725
|
+
color: var(--primer-color-text-primary);
|
|
726
|
+
border-radius: var(--primer-radius-small);
|
|
727
|
+
padding: var(--primer-space-xxsmall) var(--primer-space-xxsmall);
|
|
728
|
+
}
|
|
729
|
+
:host([variant='tertiary']:not([disabled]):not([loading])) button:hover {
|
|
730
|
+
border-radius: var(--primer-radius-small);
|
|
731
|
+
background-color: var(--primer-color-background-transparent-hover);
|
|
732
|
+
border: 1px solid var(--primer-color-border-transparent-hover);
|
|
733
|
+
color: var(--primer-color-text-primary);
|
|
734
|
+
}
|
|
735
|
+
:host([variant='tertiary']:not([disabled]):not([loading])) button:active {
|
|
736
|
+
background-color: var(--primer-color-background-transparent-active);
|
|
737
|
+
border-color: var(--primer-color-border-transparent-active);
|
|
738
|
+
border-radius: var(--primer-radius-small);
|
|
739
|
+
color: var(--primer-color-text-primary);
|
|
740
|
+
}
|
|
741
|
+
:host([variant='tertiary']) button:focus-visible {
|
|
742
|
+
border-radius: var(--primer-radius-small);
|
|
743
|
+
background-color: var(--primer-color-background-transparent-focus);
|
|
744
|
+
outline: 2px solid var(--primer-color-border-transparent-focus);
|
|
745
|
+
outline-offset: 2px;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/* Disabled state for tertiary button */
|
|
749
|
+
:host([variant='tertiary'][disabled]:not([loading])) button,
|
|
750
|
+
:host([variant='tertiary']:not([loading])) button:disabled {
|
|
751
|
+
background-color: var(--primer-color-border-transparent-disabled);
|
|
752
|
+
color: var(--primer-color-text-disabled);
|
|
753
|
+
cursor: not-allowed;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/* Loading state for tertiary button - OVERRIDES disabled styles */
|
|
757
|
+
:host([variant='tertiary'][loading]) button {
|
|
758
|
+
background-color: var(--primer-color-gray-100);
|
|
759
|
+
color: var(--primer-color-gray-600);
|
|
760
|
+
cursor: wait;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/* Checked state styling */
|
|
764
|
+
:host([selectionState='checked']) button {
|
|
765
|
+
border: 1px solid var(--primer-color-brand);
|
|
766
|
+
background-color: var(--primer-color-gray-100);
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/* Loading state - center spinner with content */
|
|
770
|
+
:host([loading]) primer-spinner {
|
|
771
|
+
margin-right: var(--primer-space-xsmall);
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
/* Special case for tertiary variant loading state spinner size */
|
|
775
|
+
:host([variant='tertiary'][loading]) primer-spinner {
|
|
776
|
+
transform: scale(0.85);
|
|
777
|
+
}
|
|
778
|
+
`;var Y=class extends h{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?p:d`
|
|
779
|
+
<primer-icon
|
|
780
|
+
name="checkmark"
|
|
781
|
+
size="sm"
|
|
782
|
+
color="var(--primer-color-icon-primary)"
|
|
783
|
+
></primer-icon>
|
|
784
|
+
`}renderSpinner(){if(!this.loading)return p;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)"),d`
|
|
785
|
+
<primer-spinner
|
|
786
|
+
size="small"
|
|
787
|
+
color="${e}"
|
|
788
|
+
compact
|
|
789
|
+
></primer-spinner>
|
|
790
|
+
`}render(){return d`
|
|
791
|
+
<button
|
|
792
|
+
type=${this.buttonType}
|
|
793
|
+
?disabled=${this.disabled||this.loading}
|
|
794
|
+
@click=${this.handleClick}
|
|
795
|
+
part="button"
|
|
796
|
+
aria-checked=${this.selectionState==="checked"}
|
|
797
|
+
aria-busy=${this.loading}
|
|
798
|
+
>
|
|
799
|
+
${this.renderSpinner()}
|
|
800
|
+
<span class="button-content ${this.loading?"loading":""}">
|
|
801
|
+
<slot></slot>
|
|
802
|
+
</span>
|
|
803
|
+
${this.renderCheckmark()}
|
|
804
|
+
</button>
|
|
805
|
+
`}};Y.styles=[E,Di],s([l({type:String,reflect:!0})],Y.prototype,"variant",2),s([l({type:Boolean,reflect:!0})],Y.prototype,"disabled",2),s([l({type:Boolean,reflect:!0})],Y.prototype,"loading",2),s([l({type:String,attribute:"type"})],Y.prototype,"buttonType",2),s([l({type:String,reflect:!0})],Y.prototype,"selectionState",2),s([l({type:Boolean,reflect:!0})],Y.prototype,"selectable",2),Y=s([u("primer-button")],Y);var za=Ua({tagName:"primer-button",elementClass:Y,react:Ha});import{createComponent as Fa}from"@lit/react";import Ba from"react";var Vi=m`
|
|
806
|
+
:host {
|
|
807
|
+
display: flex;
|
|
808
|
+
flex-direction: column;
|
|
809
|
+
gap: var(--primer-space-medium);
|
|
810
|
+
width: 100%;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
h2 {
|
|
814
|
+
margin: 0;
|
|
815
|
+
padding: 0;
|
|
816
|
+
border-radius: var(--primer-radius-medium);
|
|
817
|
+
font-weight: var(--primer-typography-title-xlarge-weight);
|
|
818
|
+
font-size: var(--primer-typography-title-xlarge-size);
|
|
819
|
+
letter-spacing: var(--primer-typography-title-xlarge-letter-spacing);
|
|
820
|
+
line-height: var(--primer-typography-title-xlarge-line-height);
|
|
821
|
+
font-family: var(--primer-typography-title-xlarge-font);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
p {
|
|
825
|
+
margin: 0;
|
|
826
|
+
padding: 0;
|
|
827
|
+
border-radius: var(--primer-radius-medium);
|
|
828
|
+
font-weight: var(--primer-typography-body-medium-weight);
|
|
829
|
+
font-size: var(--primer-typography-body-medium-size);
|
|
830
|
+
letter-spacing: var(--primer-typography-body-medium-letter-spacing);
|
|
831
|
+
line-height: var(--primer-typography-body-medium-line-height);
|
|
832
|
+
font-family: var(--primer-typography-body-medium-font);
|
|
834
833
|
}
|
|
835
834
|
|
|
836
835
|
form {
|
|
@@ -888,12 +887,12 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
888
887
|
flex-direction: column;
|
|
889
888
|
}
|
|
890
889
|
}
|
|
891
|
-
`;function
|
|
890
|
+
`;function Yi(){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 We=class{constructor(t,e){this.formState=Yi();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=Yi(),this.host.requestUpdate()}isValidFieldName(t){return!!t&&["firstName","lastName","emailAddress"].includes(t)}hostConnected(){}hostDisconnected(){}};var U=class extends h{constructor(){super(...arguments);this.formController=new We(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 _(this,{task:async([e])=>e!=="STRIPE_ACH"?x: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 d`
|
|
892
891
|
<h2>
|
|
893
|
-
${
|
|
892
|
+
${v("payWithAch",{id:"payWithAch"})}
|
|
894
893
|
</h2>
|
|
895
894
|
<p>
|
|
896
|
-
${
|
|
895
|
+
${v("stripe_ach_user_details_collection_subtitle_label",{id:"stripe_ach_user_details_collection_subtitle_label"})}
|
|
897
896
|
</p>
|
|
898
897
|
|
|
899
898
|
<form @submit=${r=>r.preventDefault()}>
|
|
@@ -902,7 +901,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
902
901
|
.hasError=${this.formController.hasError.firstName}
|
|
903
902
|
>
|
|
904
903
|
<primer-input-label slot="label">
|
|
905
|
-
${
|
|
904
|
+
${v("stripe_ach_user_details_collection_first_name_label",{id:"stripe_ach_user_details_collection_first_name_label"})}
|
|
906
905
|
</primer-input-label>
|
|
907
906
|
<primer-input
|
|
908
907
|
slot="input"
|
|
@@ -912,14 +911,14 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
912
911
|
?disabled=${this.isSubmitting}
|
|
913
912
|
></primer-input>
|
|
914
913
|
<primer-input-error slot="error">
|
|
915
|
-
${this.formController.hasError.firstName?this.formController.formState.firstName.error:
|
|
914
|
+
${this.formController.hasError.firstName?this.formController.formState.firstName.error:p}
|
|
916
915
|
</primer-input-error>
|
|
917
916
|
</primer-input-wrapper>
|
|
918
917
|
<primer-input-wrapper
|
|
919
918
|
.hasError=${this.formController.hasError.lastName}
|
|
920
919
|
>
|
|
921
920
|
<primer-input-label slot="label">
|
|
922
|
-
${
|
|
921
|
+
${v("stripe_ach_user_details_collection_last_name_label",{id:"stripe_ach_user_details_collection_last_name_label"})}
|
|
923
922
|
</primer-input-label>
|
|
924
923
|
<primer-input
|
|
925
924
|
slot="input"
|
|
@@ -930,7 +929,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
930
929
|
>
|
|
931
930
|
</primer-input>
|
|
932
931
|
<primer-input-error slot="error">
|
|
933
|
-
${this.formController.hasError.lastName?this.formController.formState.lastName.error:
|
|
932
|
+
${this.formController.hasError.lastName?this.formController.formState.lastName.error:p}
|
|
934
933
|
</primer-input-error>
|
|
935
934
|
</primer-input-wrapper>
|
|
936
935
|
</div>
|
|
@@ -938,7 +937,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
938
937
|
.hasError=${this.formController.hasError.emailAddress}
|
|
939
938
|
>
|
|
940
939
|
<primer-input-label slot="label">
|
|
941
|
-
${
|
|
940
|
+
${v("stripe_ach_user_details_collection_email_address_label",{id:"stripe_ach_user_details_collection_email_address_label"})}
|
|
942
941
|
</primer-input-label>
|
|
943
942
|
<primer-input
|
|
944
943
|
slot="input"
|
|
@@ -949,11 +948,11 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
949
948
|
?disabled=${this.isSubmitting}
|
|
950
949
|
></primer-input>
|
|
951
950
|
<primer-input-error slot="error">
|
|
952
|
-
${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:
|
|
951
|
+
${this.formController.hasError.emailAddress?this.formController.formState.emailAddress.error:p}
|
|
953
952
|
</primer-input-error>
|
|
954
953
|
</primer-input-wrapper>
|
|
955
954
|
<p>
|
|
956
|
-
${
|
|
955
|
+
${v("stripe_ach_user_details_collection_data_usage_label",{id:"stripe_ach_user_details_collection_data_usage_label"})}
|
|
957
956
|
</p>
|
|
958
957
|
<primer-button
|
|
959
958
|
buttonType="submit"
|
|
@@ -962,16 +961,16 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
962
961
|
?disabled=${this.isSubmitting}
|
|
963
962
|
?loading=${this.isSubmitting}
|
|
964
963
|
>
|
|
965
|
-
${
|
|
964
|
+
${v("stripe_ach_user_details_collection_continue_button",{id:"stripe_ach_user_details_collection_continue_button"})}
|
|
966
965
|
</primer-button>
|
|
967
966
|
</form>
|
|
968
|
-
`}renderMandate(){return
|
|
967
|
+
`}renderMandate(){return d`
|
|
969
968
|
<h2>
|
|
970
|
-
${
|
|
969
|
+
${v("payWithAch",{id:"payWithAch"})}
|
|
971
970
|
</h2>
|
|
972
971
|
|
|
973
972
|
<p>
|
|
974
|
-
${this.clientOptions?.stripe?.mandateData.fullMandateText??
|
|
973
|
+
${this.clientOptions?.stripe?.mandateData.fullMandateText??v("stripe_ach_mandate_template_web",{id:"stripe_ach_mandate_template_web"}).replace(/\{merchantName\}/g,this.clientOptions?.stripe?.mandateData.merchantName??"Merchant")}
|
|
975
974
|
</p>
|
|
976
975
|
|
|
977
976
|
<div class="button-group">
|
|
@@ -981,7 +980,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
981
980
|
?disabled=${this.isSubmitting}
|
|
982
981
|
?loading=${this.isSubmitting}
|
|
983
982
|
>
|
|
984
|
-
${
|
|
983
|
+
${v("stripe_ach_mandate_accept_button",{id:"stripe_ach_mandate_accept_button"})}
|
|
985
984
|
</primer-button>
|
|
986
985
|
|
|
987
986
|
<primer-button
|
|
@@ -989,10 +988,10 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
989
988
|
@click=${this._handleDeclineMandate.bind(this)}
|
|
990
989
|
?disabled=${this.isSubmitting}
|
|
991
990
|
>
|
|
992
|
-
${
|
|
991
|
+
${v("stripe_ach_mandate_cancel_payment_button",{id:"stripe_ach_mandate_cancel_payment_button"})}
|
|
993
992
|
</primer-button>
|
|
994
993
|
</div>
|
|
995
|
-
`}render(){return this._paymentMethodManagerTask.render({complete:e=>e?this.screen==="form"?this.renderForm(e):this.renderMandate():
|
|
994
|
+
`}render(){return this._paymentMethodManagerTask.render({complete:e=>e?this.screen==="form"?this.renderForm(e):this.renderMandate():p})}};U.styles=[E,Vi],s([l({type:Object})],U.prototype,"paymentMethod",2),s([g({context:O,subscribe:!0}),l({attribute:!1})],U.prototype,"paymentManagers",2),s([g({context:T,subscribe:!0}),l({attribute:!1})],U.prototype,"sdkState",2),s([g({context:zt,subscribe:!0}),l({attribute:!1})],U.prototype,"clientOptions",2),s([C()],U.prototype,"screen",2),s([C()],U.prototype,"isSubmitting",2),U=s([u("primer-ach-payment"),M()],U);var Ka=Fa({tagName:"primer-ach-payment",elementClass:U,react:Ba});import{createComponent as Ga}from"@lit/react";import ja from"react";var Je="card-form-context";var Ui=m`
|
|
996
995
|
:host {
|
|
997
996
|
display: contents;
|
|
998
997
|
}
|
|
@@ -1015,10 +1014,10 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1015
1014
|
display: flex;
|
|
1016
1015
|
gap: var(--primer-space-small);
|
|
1017
1016
|
}
|
|
1018
|
-
`;var
|
|
1017
|
+
`;var q=class extends h{constructor(){super(...arguments);this.hideLabels=!1;this.hasAssignedContent=!1;this.selectedCardNetwork=null;this.paymentManagers=new Map;this.cardFormProvider=new L(this,{context:Je,initialValue:null});this.eventsController=new Ut(this);this.setupCardFormTask=new _(this,{task:async([e])=>{if(!e?.manager)return x;let{manager:r}=e,{cardNumberInput:o,expiryInput:a,cvvInput:n}=r.createHostedInputs();return this.cardFormProvider.setValue({cardNumberInput:o,expiryInput:a,cvvInput:n,setCardholderName:c=>r.setCardholderName(c),setCardNetwork:c=>{this.selectedCardNetwork=c},validate:()=>r.validate(),submit:c=>r.submit(c),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",a=r==="primer-button";return o&&(e.getAttribute("type")==="submit"||e.hasAttribute("data-submit"))||a&&(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===ft.ERROR||this.setupCardFormTask.status===ft.INITIAL?p:d`
|
|
1019
1018
|
<form @submit=${this.handleFormSubmit}>
|
|
1020
1019
|
<slot name="card-form-content" @slotchange=${this.onSlotChange}></slot>
|
|
1021
|
-
${this.setupCardFormTask.render({complete:()=>
|
|
1020
|
+
${this.setupCardFormTask.render({complete:()=>P(this.hasAssignedContent,()=>p,()=>d`
|
|
1022
1021
|
<div class="card-form">
|
|
1023
1022
|
<primer-input-card-number></primer-input-card-number>
|
|
1024
1023
|
<div class="card-form-row">
|
|
@@ -1030,11 +1029,11 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1030
1029
|
<primer-card-form-submit></primer-card-form-submit>
|
|
1031
1030
|
`)})}
|
|
1032
1031
|
</form>
|
|
1033
|
-
`}};
|
|
1032
|
+
`}};q.styles=[E,Ui],s([l({type:Boolean,attribute:"hide-labels",reflect:!0})],q.prototype,"hideLabels",2),s([C()],q.prototype,"hasAssignedContent",2),s([C()],q.prototype,"selectedCardNetwork",2),s([g({context:O,subscribe:!0}),l({type:Object})],q.prototype,"paymentManagers",2),q=s([u("primer-card-form"),M()],q);var qa=Ga({tagName:"primer-card-form",elementClass:q,react:ja});import{createComponent as Wa}from"@lit/react";import Ja from"react";var Hi=m`
|
|
1034
1033
|
:host {
|
|
1035
1034
|
display: contents;
|
|
1036
1035
|
}
|
|
1037
|
-
`;var
|
|
1036
|
+
`;var H=class extends h{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:v("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}`:p;return d`
|
|
1038
1037
|
<primer-button
|
|
1039
1038
|
type="submit"
|
|
1040
1039
|
variant=${this.variant}
|
|
@@ -1045,7 +1044,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1045
1044
|
>
|
|
1046
1045
|
${this.buttonText}${r}
|
|
1047
1046
|
</primer-button>
|
|
1048
|
-
`}};
|
|
1047
|
+
`}};H.styles=[E,Hi],s([l({type:String})],H.prototype,"buttonText",1),s([g({context:B,subscribe:!0}),l({type:Object})],H.prototype,"headlessInstance",2),s([g({context:zt,subscribe:!0}),l({type:Object})],H.prototype,"clientOptions",2),s([g({context:T,subscribe:!0}),l()],H.prototype,"sdkState",2),s([l({type:String})],H.prototype,"variant",2),s([l({type:Boolean})],H.prototype,"disabled",2),H=s([u("primer-card-form-submit"),M()],H);var Za=Wa({tagName:"primer-card-form-submit",elementClass:H,react:Ja});import{createComponent as es}from"@lit/react";import rs from"react";var{I:bf}=bi;var zi=i=>i.strings===void 0;var me=(i,t)=>{let e=i._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),me(r,t);return!0},Ze=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},Fi=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),ts(t)}};function Xa(i){this._$AN!==void 0?(Ze(this),this._$AM=i,Fi(this)):this._$AM=i}function Qa(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 a=e;a<r.length;a++)me(r[a],!1),Ze(r[a]);else r!=null&&(me(r,!1),Ze(r));else me(this,i)}var ts=i=>{i.type==vt.CHILD&&(i._$AP??(i._$AP=Qa),i._$AQ??(i._$AQ=Xa))},Ct=class extends jt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Fi(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(me(this,t),Ze(this))}setValue(t){if(zi(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 Tr=()=>new kr,kr=class{},Mr=new WeakMap,Xe=st(class extends Ct{render(i){return p}update(i,[t]){let e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=i.options?.host,this.rt(this.ct=i.element)),p}rt(i){if(this.isConnected||(i=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=Mr.get(t);e===void 0&&(e=new WeakMap,Mr.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,i),i!==void 0&&this.G.call(this.ht,i)}else this.G.value=i}get lt(){return typeof this.G=="function"?Mr.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Bi=m`
|
|
1049
1048
|
:host {
|
|
1050
1049
|
display: flex;
|
|
1051
1050
|
align-items: center;
|
|
@@ -1168,67 +1167,67 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1168
1167
|
width: var(--primer-size-small);
|
|
1169
1168
|
height: var(--primer-size-small);
|
|
1170
1169
|
}
|
|
1171
|
-
`;var
|
|
1170
|
+
`;var z=class extends h{constructor(){super(...arguments);this.cardNetworks=null;this.headlessUtils=null;this.selectedCardNetwork=null;this.isDropdownOpen=!1;this.focusedNetworkIndex=0;this.isKeyboardNavigation=!1;this.buttonRef=Tr();this.dropdownRef=Tr();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 d`<primer-spinner size="small" compact></primer-spinner>`;let e=this.getSelectableNetworks();if(!this.getDetectedNetwork()&&e.length===0)return d`<primer-icon name="payment-card" size="sm"></primer-icon>`;let r=this.getDetectedNetwork()||(e.length>0?e[0]:null);if(!r)return d`<primer-icon name="payment-card" size="sm"></primer-icon>`;let o=e.length>1;return d`
|
|
1172
1171
|
<button
|
|
1173
|
-
${
|
|
1172
|
+
${Xe(this.buttonRef)}
|
|
1174
1173
|
class="network-selector"
|
|
1175
1174
|
@click=${this.toggleDropdown}
|
|
1176
|
-
@keydown=${
|
|
1175
|
+
@keydown=${a=>{(a.key===" "||a.key==="Enter")&&o&&(a.preventDefault(),this.isDropdownOpen=!this.isDropdownOpen,this.isDropdownOpen&&(this.focusedNetworkIndex=this.getSelectedNetworkIndex()))}}
|
|
1177
1176
|
aria-label=${o?`Selected card network: ${r.displayName}. Click to change.`:`Card network: ${r.displayName}`}
|
|
1178
|
-
aria-expanded=${o?this.isDropdownOpen:
|
|
1179
|
-
aria-haspopup=${o?"true":
|
|
1180
|
-
aria-controls=${o?"network-dropdown":
|
|
1177
|
+
aria-expanded=${o?this.isDropdownOpen:p}
|
|
1178
|
+
aria-haspopup=${o?"true":p}
|
|
1179
|
+
aria-controls=${o?"network-dropdown":p}
|
|
1181
1180
|
>
|
|
1182
1181
|
<img
|
|
1183
1182
|
class="network-icon"
|
|
1184
1183
|
src=${this.getNetworkIconUrl(r)}
|
|
1185
1184
|
alt=${r.displayName}
|
|
1186
1185
|
/>
|
|
1187
|
-
${
|
|
1186
|
+
${P(o,()=>d`
|
|
1188
1187
|
<primer-icon
|
|
1189
1188
|
class="caret ${this.isDropdownOpen?"open":""}"
|
|
1190
1189
|
size="sm"
|
|
1191
1190
|
name="chevron-down"
|
|
1192
1191
|
></primer-icon>
|
|
1193
|
-
`,()=>
|
|
1192
|
+
`,()=>p)}
|
|
1194
1193
|
</button>
|
|
1195
1194
|
|
|
1196
|
-
${
|
|
1195
|
+
${P(this.isDropdownOpen,()=>d`
|
|
1197
1196
|
<div
|
|
1198
|
-
${
|
|
1197
|
+
${Xe(this.dropdownRef)}
|
|
1199
1198
|
id="network-dropdown"
|
|
1200
1199
|
class="dropdown open"
|
|
1201
1200
|
role="listbox"
|
|
1202
1201
|
aria-label="Select card network"
|
|
1203
1202
|
>
|
|
1204
|
-
${e.map((
|
|
1203
|
+
${e.map((a,n)=>d`
|
|
1205
1204
|
<div
|
|
1206
|
-
${
|
|
1207
|
-
class="network-option ${this.isKeyboardNavigation&&
|
|
1208
|
-
@click=${
|
|
1209
|
-
@keydown=${
|
|
1205
|
+
${Xe(c=>this.setNetworkOptionRef(c,n))}
|
|
1206
|
+
class="network-option ${this.isKeyboardNavigation&&n===this.focusedNetworkIndex?"focused":""}"
|
|
1207
|
+
@click=${c=>this.selectNetwork(c,a)}
|
|
1208
|
+
@keydown=${c=>{(c.key==="Enter"||c.key===" ")&&this.selectNetwork(c,a)}}
|
|
1210
1209
|
role="option"
|
|
1211
|
-
aria-selected=${
|
|
1212
|
-
tabindex="${
|
|
1210
|
+
aria-selected=${a.network===r.network}
|
|
1211
|
+
tabindex="${n===this.focusedNetworkIndex?"0":"-1"}"
|
|
1213
1212
|
>
|
|
1214
1213
|
<img
|
|
1215
1214
|
class="network-option-icon"
|
|
1216
|
-
src=${this.getNetworkIconUrl(
|
|
1217
|
-
alt=${
|
|
1215
|
+
src=${this.getNetworkIconUrl(a)}
|
|
1216
|
+
alt=${a.displayName}
|
|
1218
1217
|
/>
|
|
1219
|
-
<span class="network-name">${
|
|
1220
|
-
${
|
|
1218
|
+
<span class="network-name">${a.displayName}</span>
|
|
1219
|
+
${P(a.network===r.network,()=>d`
|
|
1221
1220
|
<primer-icon
|
|
1222
1221
|
class="checkmark"
|
|
1223
1222
|
name="checkmark"
|
|
1224
1223
|
size="sm"
|
|
1225
1224
|
></primer-icon>
|
|
1226
|
-
`,()=>
|
|
1225
|
+
`,()=>p)}
|
|
1227
1226
|
</div>
|
|
1228
1227
|
`)}
|
|
1229
1228
|
</div>
|
|
1230
|
-
`,()=>
|
|
1231
|
-
`}};
|
|
1229
|
+
`,()=>p)}
|
|
1230
|
+
`}};z.styles=[E,Bi],s([g({context:ve,subscribe:!0})],z.prototype,"cardNetworks",2),s([g({context:B,subscribe:!0})],z.prototype,"headlessUtils",2),s([C()],z.prototype,"selectedCardNetwork",2),s([C()],z.prototype,"isDropdownOpen",2),s([C()],z.prototype,"focusedNetworkIndex",2),s([C()],z.prototype,"isKeyboardNavigation",2),z=s([u("primer-card-network-selector")],z);var is=es({tagName:"primer-card-network-selector",elementClass:z,react:rs});import{createComponent as os}from"@lit/react";import as from"react";function Ki(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=`
|
|
1232
1231
|
input[data-custom-input]::placeholder {
|
|
1233
1232
|
color: var(--primer-color-text-placeholder);
|
|
1234
1233
|
font-size: var(--primer-typography-body-large-size);
|
|
@@ -1237,44 +1236,44 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1237
1236
|
input[data-custom-input]:focus {
|
|
1238
1237
|
outline: none;
|
|
1239
1238
|
}
|
|
1240
|
-
`,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function
|
|
1239
|
+
`,t.shadowRoot?t.shadowRoot.appendChild(e):t.appendChild(e)}}function Gi(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 ji(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 Qe=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 _(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 x;await this.host.updateComplete;let e=this.getTargetContainer();return e?t==="cardholderName"?this.setupStandardInput(e):this.setupHostedIframeInput(t,e):x}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,Ki(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(a=>requestAnimationFrame(()=>a())),this._hostedInput=t;let r=Gi(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",a=>{this._meta=a,ji(this._meta,a)&&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 $=class extends h{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:v(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 Qe(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===ft.ERROR)return p;let e=this.getError();return d`
|
|
1241
1240
|
<primer-input-wrapper
|
|
1242
1241
|
.focusWithin="${this.hostedInputController.isFocused}"
|
|
1243
1242
|
.hasError=${!!e}
|
|
1244
1243
|
@wrapper-click="${this.handleWrapperClick}"
|
|
1245
1244
|
>
|
|
1246
|
-
${
|
|
1245
|
+
${P(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
|
|
1247
1246
|
>${this.label}</primer-input-label
|
|
1248
|
-
>`,()=>
|
|
1247
|
+
>`,()=>p)}
|
|
1249
1248
|
<div
|
|
1250
1249
|
slot="input"
|
|
1251
1250
|
class="card-input-slot"
|
|
1252
1251
|
id="${this.config.containerSelector.substring(1)}"
|
|
1253
1252
|
aria-label="${this.ariaLabel}"
|
|
1254
1253
|
></div>
|
|
1255
|
-
${
|
|
1254
|
+
${P(e,()=>d`
|
|
1256
1255
|
<primer-input-error slot="error">
|
|
1257
|
-
${
|
|
1256
|
+
${v(e,{id:e})}
|
|
1258
1257
|
</primer-input-error>
|
|
1259
|
-
`,()=>
|
|
1258
|
+
`,()=>p)}
|
|
1260
1259
|
</primer-input-wrapper>
|
|
1261
|
-
`}};
|
|
1260
|
+
`}};s([g({context:Je,subscribe:!0})],$.prototype,"cardFormContext",2),s([g({context:Ft,subscribe:!0}),l()],$.prototype,"computedStyles",2),s([l({type:String})],$.prototype,"label",1),s([l({type:String})],$.prototype,"placeholder",1),s([l({type:String,attribute:"aria-label"})],$.prototype,"ariaLabel",1);var qi=m`
|
|
1262
1261
|
:host {
|
|
1263
1262
|
display: contents;
|
|
1264
1263
|
}
|
|
1265
|
-
`;var
|
|
1264
|
+
`;var xt=m`
|
|
1266
1265
|
.card-input-slot {
|
|
1267
1266
|
display: flex;
|
|
1268
1267
|
}
|
|
1269
|
-
`;var
|
|
1268
|
+
`;var Rt=class extends ${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()}};Rt.styles=[E,xt,qi],Rt=s([u("primer-input-card-holder-name"),M()],Rt);var ss=os({tagName:"primer-input-card-holder-name",elementClass:Rt,react:as});import{createComponent as ns}from"@lit/react";import ls from"react";var Wi=m`
|
|
1270
1269
|
:host {
|
|
1271
1270
|
display: contents;
|
|
1272
1271
|
}
|
|
1273
|
-
`;var
|
|
1272
|
+
`;var Ot=class extends ${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()}};Ot.styles=[E,xt,Wi],Ot=s([u("primer-input-card-expiry"),M()],Ot);var ds=ns({tagName:"primer-input-card-expiry",elementClass:Ot,react:ls});import{createComponent as ps}from"@lit/react";import cs from"react";var Ji=m`
|
|
1274
1273
|
:host {
|
|
1275
1274
|
display: contents;
|
|
1276
1275
|
}
|
|
1277
|
-
`;var
|
|
1276
|
+
`;var Dt=class extends ${constructor(){super();this.config={inputType:"cvv",containerSelector:"#cvv",errorName:"cvv-card",translations:{label:"CVV",placeholder:"123"}};this.childUpdated()}render(){return this.renderInput()}};Dt.styles=[E,xt,Ji],Dt=s([u("primer-input-cvv"),M()],Dt);var ms=ps({tagName:"primer-input-cvv",elementClass:Dt,react:cs});import{createComponent as hs}from"@lit/react";import us from"react";var Zi=m`
|
|
1278
1277
|
:host {
|
|
1279
1278
|
display: contents;
|
|
1280
1279
|
}
|
|
@@ -1298,14 +1297,14 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1298
1297
|
align-items: center;
|
|
1299
1298
|
z-index: 2;
|
|
1300
1299
|
}
|
|
1301
|
-
`;var
|
|
1300
|
+
`;var Vt=class extends ${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===ft.ERROR)return p;let e=this.getError();return d`
|
|
1302
1301
|
<primer-input-wrapper
|
|
1303
1302
|
.focusWithin="${this.hostedInputController.isFocused}"
|
|
1304
1303
|
.hasError=${!!e}
|
|
1305
1304
|
>
|
|
1306
|
-
${
|
|
1305
|
+
${P(!this.cardFormContext?.hideLabels,()=>d`<primer-input-label slot="label"
|
|
1307
1306
|
>${this.label}</primer-input-label
|
|
1308
|
-
>`,()=>
|
|
1307
|
+
>`,()=>p)}
|
|
1309
1308
|
<div
|
|
1310
1309
|
slot="input"
|
|
1311
1310
|
class="card-number-container"
|
|
@@ -1318,13 +1317,13 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1318
1317
|
></primer-card-network-selector>
|
|
1319
1318
|
</div>
|
|
1320
1319
|
</div>
|
|
1321
|
-
${
|
|
1320
|
+
${P(e,r=>d`
|
|
1322
1321
|
<primer-input-error slot="error">
|
|
1323
|
-
${
|
|
1322
|
+
${v(r,{id:r})}
|
|
1324
1323
|
</primer-input-error>
|
|
1325
|
-
`,()=>
|
|
1324
|
+
`,()=>p)}
|
|
1326
1325
|
</primer-input-wrapper>
|
|
1327
|
-
`}render(){return this.renderInput()}};
|
|
1326
|
+
`}render(){return this.renderInput()}};Vt.styles=[E,xt,Zi],Vt=s([u("primer-input-card-number"),M()],Vt);var fs=hs({tagName:"primer-input-number",elementClass:Vt,react:us});import{createComponent as gs}from"@lit/react";import ys from"react";var Xi=m`
|
|
1328
1327
|
:host {
|
|
1329
1328
|
height: calc(
|
|
1330
1329
|
var(--primer-typography-title-large-line-height) +
|
|
@@ -1360,7 +1359,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1360
1359
|
img {
|
|
1361
1360
|
height: 100%;
|
|
1362
1361
|
}
|
|
1363
|
-
`;function
|
|
1362
|
+
`;function he(i){return i.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}var K=class extends h{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.open=!1;this._paymentMethodManagerTask=new _(this,{task:async([e,r])=>!e||!r?x:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new _(this,{task:async([e,r])=>{if(!e||!r)return x;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}:x},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new _(this,{task:async([e,r])=>!e||!r?x:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?he(e):"";return r==="payWith"&&(r="pay_with"),v(r,{id:r})}start(){this._paymentMethodManagerTask.value&&(this.open=!0)}renderDialog(){return this.open?d`
|
|
1364
1363
|
<primer-portal>
|
|
1365
1364
|
<primer-dialog @primer-dialog-close="${()=>this.open=!1}">
|
|
1366
1365
|
<primer-ach-payment
|
|
@@ -1371,11 +1370,11 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1371
1370
|
></primer-ach-payment>
|
|
1372
1371
|
</primer-dialog>
|
|
1373
1372
|
</primer-portal>
|
|
1374
|
-
`:
|
|
1373
|
+
`:p}render(){return this._setupTasks.render({error:()=>p,complete:({assetsConfig:e})=>(this.style.setProperty("--dynamic-payment-button-bg-color",e.backgroundColor),d`
|
|
1375
1374
|
<primer-button
|
|
1376
1375
|
@click="${()=>this.start()}"
|
|
1377
|
-
class=${
|
|
1378
|
-
title="${
|
|
1376
|
+
class=${I({loading:!!this.sdkState?.isProcessing,reverse:!0})}
|
|
1377
|
+
title="${v("pay_with",{id:"pay_with"})} ${e.name}"
|
|
1379
1378
|
>
|
|
1380
1379
|
<span class="image-container">
|
|
1381
1380
|
<img src="${e.iconUrl}" alt="${e.name}" />
|
|
@@ -1383,17 +1382,17 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1383
1382
|
${e.displayName}
|
|
1384
1383
|
</primer-button>
|
|
1385
1384
|
${this.renderDialog()}
|
|
1386
|
-
`)})}};
|
|
1385
|
+
`)})}};K.styles=[E,Xi],s([l({type:Object})],K.prototype,"paymentMethod",2),s([g({context:O,subscribe:!0})],K.prototype,"paymentManagers",2),s([g({context:T,subscribe:!0})],K.prototype,"sdkState",2),s([g({context:B,subscribe:!0})],K.prototype,"headlessUtils",2),s([C()],K.prototype,"open",2),K=s([u("primer-dynamic-payment"),M()],K);var vs=gs({tagName:"primer-dynamic-payment",elementClass:K,react:ys});import{createComponent as bs}from"@lit/react";import Cs from"react";var Qi=m`
|
|
1387
1386
|
:host {
|
|
1388
1387
|
display: block;
|
|
1389
1388
|
width: 100%;
|
|
1390
1389
|
}
|
|
1391
|
-
`;var
|
|
1390
|
+
`;var dt=class extends h{constructor(){super(...arguments);this.showProcessingErrors=!0}get shouldShowError(){return!this.sdkState||this.sdkState.isProcessing?!1:!!(this.sdkState.failure&&this.showProcessingErrors)}render(){return this.sdkState?d`
|
|
1392
1391
|
<primer-error-message
|
|
1393
|
-
message="${
|
|
1392
|
+
message="${v(this.sdkState.failure?.message??"",{id:"tokenizationError"})}"
|
|
1394
1393
|
?visible="${this.shouldShowError}"
|
|
1395
1394
|
></primer-error-message>
|
|
1396
|
-
`:
|
|
1395
|
+
`:p}};dt.styles=[Qi],s([g({context:T,subscribe:!0}),C()],dt.prototype,"sdkState",2),s([l({type:Boolean,attribute:"show-processing-errors"})],dt.prototype,"showProcessingErrors",2),dt=s([u("primer-error-message-container")],dt);var xs=bs({tagName:"primer-error-message-container",elementClass:dt,react:Cs});import{createComponent as Es}from"@lit/react";import Ss from"react";var to=m`
|
|
1397
1396
|
:host {
|
|
1398
1397
|
display: contents;
|
|
1399
1398
|
}
|
|
@@ -1585,38 +1584,38 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1585
1584
|
background-color: var(--primer-color-background-outlined-default);
|
|
1586
1585
|
border-radius: var(--primer-radius-small);
|
|
1587
1586
|
}
|
|
1588
|
-
`;var
|
|
1587
|
+
`;var R=class extends h{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this.klarnaCategories=null;this.selectedCategory=null;this.isExpanded=!1;this.headerAriaLabel=v("pay_with",{id:"pay_with"});this._paymentMethodManagerTask=new _(this,{task:async([e,r])=>{if(!e||!r)return x;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){y.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){y.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?d`<div class="loading">
|
|
1589
1588
|
<primer-spinner size="small"></primer-spinner>
|
|
1590
|
-
</div>`:
|
|
1589
|
+
</div>`:d`
|
|
1591
1590
|
<div class="category-selection">
|
|
1592
|
-
${e.map(o=>
|
|
1591
|
+
${e.map(o=>d`
|
|
1593
1592
|
<button
|
|
1594
|
-
class=${
|
|
1593
|
+
class=${I({"category-button":!0,selected:o.id===this.selectedCategory})}
|
|
1595
1594
|
@click=${()=>{this.selectCategory(o.id)}}
|
|
1596
1595
|
>
|
|
1597
1596
|
${o.name}
|
|
1598
1597
|
</button>
|
|
1599
1598
|
`)}
|
|
1600
1599
|
</div>
|
|
1601
|
-
`}renderExpandedContent(){return
|
|
1600
|
+
`}renderExpandedContent(){return d`
|
|
1602
1601
|
${this.renderCategorySelection()}
|
|
1603
|
-
${this.selectedCategory?
|
|
1602
|
+
${this.selectedCategory?d`
|
|
1604
1603
|
<div
|
|
1605
1604
|
id="klarna-category-container"
|
|
1606
1605
|
class="klarna-category-container"
|
|
1607
1606
|
></div>
|
|
1608
|
-
`:
|
|
1607
|
+
`:p}
|
|
1609
1608
|
|
|
1610
1609
|
<button
|
|
1611
|
-
class=${
|
|
1610
|
+
class=${I({"klarna-pay-button":!0,loading:!!this.sdkState?.isProcessing,disabled:!this.selectedCategory})}
|
|
1612
1611
|
?disabled=${!this.selectedCategory||this.sdkState?.isProcessing}
|
|
1613
1612
|
@click=${()=>this.startKlarnaPayment()}
|
|
1614
1613
|
>
|
|
1615
|
-
${
|
|
1614
|
+
${v("confirm",{id:"confirm"})}
|
|
1616
1615
|
</button>
|
|
1617
|
-
`}render(){return this._paymentMethodManagerTask.render({error:e=>{let r=e instanceof Error?e.message:"Unknown error in Klarna";return
|
|
1616
|
+
`}render(){return this._paymentMethodManagerTask.render({error:e=>{let r=e instanceof Error?e.message:"Unknown error in Klarna";return d`<div class="error">
|
|
1618
1617
|
Error loading Klarna: ${r}
|
|
1619
|
-
</div>`},complete:({manager:e,klarnaIcon:r})=>e?
|
|
1618
|
+
</div>`},complete:({manager:e,klarnaIcon:r})=>e?d`
|
|
1620
1619
|
<div class="klarna-container ${this.isExpanded?"expanded":""}">
|
|
1621
1620
|
<div class="klarna-button-header">
|
|
1622
1621
|
<primer-button
|
|
@@ -1629,7 +1628,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1629
1628
|
aria-label=${this.headerAriaLabel}
|
|
1630
1629
|
>
|
|
1631
1630
|
<img src=${r} alt="Klarna logo" />
|
|
1632
|
-
<span>${
|
|
1631
|
+
<span>${v("pay_with",{id:"pay_with"})} Klarna</span>
|
|
1633
1632
|
<span
|
|
1634
1633
|
class="klarna-accordion-icon ${this.isExpanded?"expanded":""}"
|
|
1635
1634
|
>
|
|
@@ -1646,7 +1645,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1646
1645
|
</div>
|
|
1647
1646
|
</div>
|
|
1648
1647
|
</div>
|
|
1649
|
-
`:
|
|
1648
|
+
`:p})}};R.styles=[E,to],s([g({context:O,subscribe:!0}),l()],R.prototype,"paymentManagers",2),s([g({context:T,subscribe:!0}),l()],R.prototype,"sdkState",2),s([g({context:B,subscribe:!0}),l({type:Object})],R.prototype,"headlessUtils",2),s([g({context:be,subscribe:!0}),l()],R.prototype,"klarnaCategories",2),s([C()],R.prototype,"selectedCategory",2),s([C()],R.prototype,"isExpanded",2),s([C()],R.prototype,"headerAriaLabel",2),s([yt("#klarna-category-container")],R.prototype,"klarnaContainer",2),R=s([u("primer-klarna"),M()],R);var _s=Es({tagName:"primer-klarna",elementClass:R,react:Ss});import{createComponent as As}from"@lit/react";import Ps from"react";var eo=m`
|
|
1650
1649
|
:host {
|
|
1651
1650
|
height: calc(
|
|
1652
1651
|
var(--primer-typography-title-large-line-height) +
|
|
@@ -1660,29 +1659,29 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1660
1659
|
height: 100%;
|
|
1661
1660
|
flex: 1;
|
|
1662
1661
|
}
|
|
1663
|
-
`;var
|
|
1662
|
+
`;var Q=class extends h{constructor(){super();this.paymentManagers=new Map;this.computedStyles=null;this._buttonId="button-container";this.loadManagerTask=new _(this,{args:()=>[this.paymentMethod?.type],task:async([e])=>{if(!e)return x;let r=this.paymentManagers.get(e)?.manager;if(!r)throw new Error(`No manager found for payment method type ${e}`);return r}}),new _(this,{args:()=>[this.loadManagerTask.value],task:async([e])=>{if(!e)return x;await this.updateComplete;let r=this.shadowRoot?.getElementById(this._buttonId);if(!r)return;let o=this.calculateButtonHeight(),a=e.createButton(),n=this.createRenderOptions(o);return await a.render(this.paymentMethod?.type==="GOOGLE_PAY"?this.shadowRoot?.getRootNode():r,n),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:()=>p,complete:()=>d`
|
|
1664
1663
|
<!-- The native button container is rendered first -->
|
|
1665
1664
|
<div class="native-button-container" id="${this._buttonId}"></div>
|
|
1666
|
-
`,pending:()=>
|
|
1665
|
+
`,pending:()=>p})}};Q.styles=[E,eo],s([l({type:Object})],Q.prototype,"paymentMethod",2),s([g({context:O,subscribe:!0}),l()],Q.prototype,"paymentManagers",2),s([g({context:Ft,subscribe:!0}),l()],Q.prototype,"computedStyles",2),Q=s([u("primer-native-payment")],Q);var ws=As({tagName:"primer-native-payment",elementClass:Q,react:Ps});import{createComponent as Ms}from"@lit/react";import ks from"react";var ro=m`
|
|
1667
1666
|
:host {
|
|
1668
1667
|
display: contents;
|
|
1669
1668
|
}
|
|
1670
|
-
`;var
|
|
1669
|
+
`;var pt=class extends h{constructor(){super(...arguments);this.type=void 0;this.paymentMethods=null}render(){if(!this.type)return p;let e=this.paymentMethods?.get(this.type);if(!e)return p;switch(e?.managerType){case"CARD":return d`<primer-card-form></primer-card-form>`;case"NATIVE":return d`<primer-native-payment
|
|
1671
1670
|
.paymentMethod=${e}
|
|
1672
|
-
></primer-native-payment>`;case"REDIRECT":return
|
|
1671
|
+
></primer-native-payment>`;case"REDIRECT":return d`<primer-redirect-payment
|
|
1673
1672
|
.paymentMethod=${e}
|
|
1674
|
-
></primer-redirect-payment>`;case"KLARNA":return
|
|
1673
|
+
></primer-redirect-payment>`;case"KLARNA":return d`<primer-klarna></primer-klarna>`;case"ACH":return d`
|
|
1675
1674
|
<primer-dynamic-payment
|
|
1676
1675
|
.paymentMethod=${e}
|
|
1677
1676
|
></primer-dynamic-payment>
|
|
1678
|
-
`;default:return
|
|
1677
|
+
`;default:return p}}};pt.styles=[ro],s([l({type:String})],pt.prototype,"type",2),s([g({context:Bt,subscribe:!0}),l()],pt.prototype,"paymentMethods",2),pt=s([u("primer-payment-method")],pt);var Ts=Ms({tagName:"primer-payment-method",elementClass:pt,react:ks});import{createComponent as Ls}from"@lit/react";import Ns from"react";var qt=class extends h{render(){return d`
|
|
1679
1678
|
<primer-checkout-state type="complete"></primer-checkout-state>
|
|
1680
|
-
`}};
|
|
1679
|
+
`}};qt=s([u("primer-checkout-complete")],qt);var Is=Ls({tagName:"primer-checkout-complete",elementClass:qt,react:Ns});import{createComponent as $s}from"@lit/react";import Rs from"react";var Yt=class extends h{constructor(){super(...arguments);this.sdkState=null}render(){return d`
|
|
1681
1680
|
<primer-checkout-state
|
|
1682
1681
|
type="failure"
|
|
1683
1682
|
description=${this.sdkState?.error?.message||""}
|
|
1684
1683
|
></primer-checkout-state>
|
|
1685
|
-
`}};
|
|
1684
|
+
`}};s([g({context:T,subscribe:!0}),l()],Yt.prototype,"sdkState",2),Yt=s([u("primer-checkout-error")],Yt);var Os=$s({tagName:"primer-checkout-error",elementClass:Yt,react:Rs});import{createComponent as Ds}from"@lit/react";import Vs from"react";var io=m`
|
|
1686
1685
|
:host {
|
|
1687
1686
|
display: contents;
|
|
1688
1687
|
}
|
|
@@ -1701,20 +1700,20 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1701
1700
|
primer-vault-manager {
|
|
1702
1701
|
margin-bottom: var(--primer-space-xlarge);
|
|
1703
1702
|
}
|
|
1704
|
-
`;var
|
|
1703
|
+
`;var ct=class extends h{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?d`
|
|
1705
1704
|
<slot name="checkout-complete">
|
|
1706
1705
|
<primer-checkout-complete></primer-checkout-complete>
|
|
1707
1706
|
</slot>
|
|
1708
|
-
`:
|
|
1707
|
+
`:d`
|
|
1709
1708
|
<slot name="payments" @slotchange=${this.onSlotChange}></slot>
|
|
1710
|
-
${
|
|
1709
|
+
${P(this.hasAssignedContent,()=>p,()=>d`
|
|
1711
1710
|
<div
|
|
1712
|
-
class=${
|
|
1711
|
+
class=${I({"primer-is-processing":!!this.sdkState?.isProcessing})}
|
|
1713
1712
|
>
|
|
1714
1713
|
<primer-vault-manager></primer-vault-manager>
|
|
1715
1714
|
<primer-show-other-payments>
|
|
1716
1715
|
<div slot="other-payments" class="primer-main-list">
|
|
1717
|
-
${this.paymentMethods?.toArray().map(e=>
|
|
1716
|
+
${this.paymentMethods?.toArray().map(e=>d`
|
|
1718
1717
|
<primer-payment-method
|
|
1719
1718
|
type=${e.type}
|
|
1720
1719
|
></primer-payment-method>
|
|
@@ -1724,7 +1723,7 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1724
1723
|
<primer-error-message-container></primer-error-message-container>
|
|
1725
1724
|
</div>
|
|
1726
1725
|
`)}
|
|
1727
|
-
`}};
|
|
1726
|
+
`}};ct.styles=[E,io],s([g({context:Bt,subscribe:!0}),l()],ct.prototype,"paymentMethods",2),s([g({context:T,subscribe:!0}),l()],ct.prototype,"sdkState",2),ct=s([u("primer-main")],ct);var Ys=Ds({tagName:"primer-main",elementClass:ct,react:Vs});import{createComponent as Us}from"@lit/react";import Hs from"react";var oo=m`
|
|
1728
1727
|
:host {
|
|
1729
1728
|
height: calc(
|
|
1730
1729
|
var(--primer-typography-title-large-line-height) +
|
|
@@ -1799,24 +1798,24 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1799
1798
|
flex-shrink: 0;
|
|
1800
1799
|
flex-grow: 1;
|
|
1801
1800
|
}
|
|
1802
|
-
`;var
|
|
1801
|
+
`;var W=class extends h{constructor(){super(...arguments);this.paymentManagers=new Map;this.sdkState=null;this.headlessUtils=null;this._paymentMethodManagerTask=new _(this,{task:async([e,r])=>!e||!r?x:r.get(e)?.manager,args:()=>[this.paymentMethod?.type,this.paymentManagers]});this._getAssetsTask=new _(this,{task:async([e,r])=>{if(!e||!r)return x;let o=r.getPaymentMethodConfiguration(e);if(!o)return x;let a=o.displayMetadata.button.backgroundColor.colored??o.displayMetadata.button.backgroundColor.light,n=o.displayMetadata.button.iconPositionRelativeToText||"START";return{backgroundColor:a,name:o.name,displayName:this._legacyGetButtonLabel(o.displayMetadata.button.text),iconUrl:o.displayMetadata.button.iconUrl.colored??o.displayMetadata.button.iconUrl.light,iconPosition:n}},args:()=>[this.paymentMethod?.type,this.headlessUtils]});this._setupTasks=new _(this,{task:async([e,r])=>!e||!r?x:{paymentMethodManager:e,assetsConfig:r},args:()=>[this._paymentMethodManagerTask.value,this._getAssetsTask.value]})}_legacyGetButtonLabel(e){if(!e)return;let r=e?he(e):"";return r==="payWith"&&(r="pay_with"),v(r,{id:r})}startRedirectPayment(){this._paymentMethodManagerTask.value&&this._paymentMethodManagerTask.value.start()}render(){return this._setupTasks.render({error:()=>p,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?d`
|
|
1803
1802
|
<span class="image-container">
|
|
1804
1803
|
<img src="${e.iconUrl}" alt="${e.name}" />
|
|
1805
1804
|
</span>
|
|
1806
1805
|
<span class="button-text">${e.displayName}</span>
|
|
1807
|
-
`:
|
|
1806
|
+
`:d`
|
|
1808
1807
|
<span class="image-container">
|
|
1809
1808
|
<img src="${e.iconUrl}" alt="${e.name}" />
|
|
1810
1809
|
</span>
|
|
1811
|
-
`;return
|
|
1810
|
+
`;return d`
|
|
1812
1811
|
<primer-button
|
|
1813
1812
|
@click="${()=>this.startRedirectPayment()}"
|
|
1814
|
-
class=${
|
|
1815
|
-
title="${
|
|
1813
|
+
class=${I(r)}
|
|
1814
|
+
title="${v("pay_with",{id:"pay_with"})} ${e.name}"
|
|
1816
1815
|
>
|
|
1817
1816
|
${o}
|
|
1818
1817
|
</primer-button>
|
|
1819
|
-
`}})}};
|
|
1818
|
+
`}})}};W.styles=[E,oo],s([l({type:Object})],W.prototype,"paymentMethod",2),s([g({context:O,subscribe:!0})],W.prototype,"paymentManagers",2),s([g({context:T,subscribe:!0})],W.prototype,"sdkState",2),s([g({context:B,subscribe:!0})],W.prototype,"headlessUtils",2),W=s([u("primer-redirect-payment"),M()],W);var zs=Us({tagName:"primer-redirect-payment",elementClass:W,react:Hs});import{createComponent as Fs}from"@lit/react";import Bs from"react";var ao=m`
|
|
1820
1819
|
:host {
|
|
1821
1820
|
display: block;
|
|
1822
1821
|
margin-top: var(--primer-space-medium);
|
|
@@ -1836,19 +1835,19 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1836
1835
|
justify-content: center;
|
|
1837
1836
|
align-items: center;
|
|
1838
1837
|
}
|
|
1839
|
-
`;var
|
|
1838
|
+
`;var Et=class extends h{constructor(){super(...arguments);this.vaultManager=null}render(){return this.vaultManager?.isLoading?p:!this.vaultManager||!this.vaultManager.enabled?d`<slot name="other-payments"></slot>`:d`
|
|
1840
1839
|
<div class="other-payment-methods-container">
|
|
1841
1840
|
<primer-collapsable
|
|
1842
1841
|
buttonVariant="secondary"
|
|
1843
1842
|
.expanded="${this.vaultManager?.vaultedPaymentMethods.length===0}"
|
|
1844
|
-
.header="${
|
|
1843
|
+
.header="${v("navigateToPaymentMethods",{id:"navigateToPaymentMethods"})}"
|
|
1845
1844
|
>
|
|
1846
1845
|
<div class="other-payment-methods-content">
|
|
1847
1846
|
<slot name="other-payments"></slot>
|
|
1848
1847
|
</div>
|
|
1849
1848
|
</primer-collapsable>
|
|
1850
1849
|
</div>
|
|
1851
|
-
`}};
|
|
1850
|
+
`}};Et.styles=[ao],s([g({context:Kt,subscribe:!0}),l({type:Object,attribute:!1})],Et.prototype,"vaultManager",2),Et=s([u("primer-show-other-payments")],Et);var Ks=Fs({tagName:"primer-show-other-payments",elementClass:Et,react:Bs});import{createComponent as rn}from"@lit/react";import on from"react";var ue={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"};function Lr(i){return i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()}function Gs(i){return i?i===i.toUpperCase()?Lr(i):i:""}function so(i,t){return[i,t].filter(Boolean).join(" ")}function js(i,t){return!i||!t?"":`Expires ${i}/${t.slice(-2)}`}function no(i){return i?`\u2022\u2022\u2022\u2022 ${i}`:""}function qs(i){let t=i.paymentInstrumentData,e=Gs(t.network),r=t.last4Digits,o=`${i.paymentInstrumentData.cardholderName?i.paymentInstrumentData.cardholderName:""}${(r?` ${e} ${no(r)}`:e)||" Card"}`,a=js(t.expirationMonth,t.expirationYear);return{description:o,secondaryDescription:a}}function Ws(i){let t=i.paymentInstrumentData,e=t.externalPayerInfo?.email||"",r=t.externalPayerInfo?.firstName||"",o=t.externalPayerInfo?.lastName||"",a=i.userDescription||e||"PayPal Account",n=so(r,o);return{description:a,secondaryDescription:n}}function Js(i){let t=i.paymentInstrumentData,e=t.sessionData?.billingAddress?.email||"",r=t.sessionData?.billingAddress?.firstName||"",o=t.sessionData?.billingAddress?.lastName||"",a=i.userDescription||(e?`Klarna - ${e}`:"Klarna Account"),n=so(r,o);return{description:a,secondaryDescription:n}}function Zs(i){let t=i.paymentInstrumentData,e=t.accountNumberLastFourDigits||"",r=t.bankName||"",o=t.accountType||"",a=i.userDescription;a||(r&&e?a=`${r} ${no(e)}`:r?a=r:a="Bank Account");let n=o?`${Lr(o)} Account`:"";return{description:a,secondaryDescription:n}}function Xs(i){let t=i.paymentInstrumentType,e=Lr(t.replace(/_/g," "));return{description:i.userDescription||e}}var Qs={[ue.CARD]:qs,[ue.PAYPAL_VAULTED]:Ws,[ue.KLARNA_CUSTOMER_TOKEN]:Js,[ue.AUTOMATED_CLEARING_HOUSE]:Zs};function lo(i){try{let t=Qs[i.paymentInstrumentType];return t?t(i):Xs(i)}catch(t){return y.error("FormatUtils",`Error formatting payment method ${i.id}:`,t),{description:i.userDescription||i.id||"Payment Method"}}}var po=m`
|
|
1852
1851
|
:host {
|
|
1853
1852
|
display: block;
|
|
1854
1853
|
width: 100%;
|
|
@@ -1965,19 +1964,17 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1965
1964
|
transition: none;
|
|
1966
1965
|
}
|
|
1967
1966
|
}
|
|
1968
|
-
`;var
|
|
1969
|
-
\f\r]`,qe=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ga=/-->/g,ja=/>/g,re=RegExp(`>|${Vi}(?:([^\\s"'>=/]+)(${Vi}*=${Vi}*(?:[^
|
|
1970
|
-
\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`
|
|
1967
|
+
`;var tr=new WeakMap,Wt=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,tr.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 co=0,Nr=new Map,mo=new WeakSet,Ir=()=>new Promise(i=>requestAnimationFrame(i));var ho=(i,t)=>{let e=i-t;return e===0?void 0:e},uo=(i,t)=>{let e=i/t;return e===1?void 0:e},er={left:(i,t)=>{let e=ho(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:`translateX(${e}px)`}},top:(i,t)=>{let e=ho(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=uo(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=uo(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:`scaleY(${r})`}}},go={duration:333,easing:"ease-in-out"},yo=["left","top","width","height","opacity","color","background"],fo=new WeakMap,rr=class extends Ct{constructor(t){if(super(t),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,t.type===vt.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 p}getController(){return tr.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,fo.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=yo),this.options=t}m(){let t={},e=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(o=>{let a=e[o]??(er[o]?void 0:r[o]),n=Number(a);t[o]=isNaN(n)?a+"":n}),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((a,n)=>a===o[n]))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 Ir;let e=this.O(),r=this.j(this.options.keyframeOptions,e),o=this.m();if(this.A!==void 0){let{from:a,to:n}=this.N(this.A,o,e);this.log("measured",[this.A,o,a,n]),t=this.calculateKeyframes(a,n)}else{let a=Nr.get(this.options.inId);if(a){Nr.delete(this.options.inId);let{from:n,to:c}=this.N(a,o,e);t=this.calculateKeyframes(n,c),t=this.options.in?[{...this.options.in[0],...t[0]},...this.options.in.slice(1),t[1]]:t,co++,t.forEach(f=>f.zIndex=co)}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&&Nr.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await Ir(),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,a=this.A.top-r.top;getComputedStyle(this.element).position!=="static"||o===0&&a===0||(this.element.style.position="relative"),o!==0&&(this.element.style.left=o+"px"),a!==0&&(this.element.style.top=a+"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=fo.get(e);r&&!r.isDisabled()&&r&&t.push(r)}return t}get isHostRendered(){let t=mo.has(this.u);return t||this.u.updateComplete.then(()=>{mo.add(this.u)}),t}j(t,e=this.O()){let r={...go};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(c=>c.animatingProperties).filter(c=>c!==void 0),a=1,n=1;return o.length>0&&(o.forEach(c=>{c.width&&(a/=c.width),c.height&&(n/=c.height)}),t.left!==void 0&&e.left!==void 0&&(t.left=a*t.left,e.left=a*e.left),t.top!==void 0&&e.top!==void 0&&(t.top=n*t.top,e.top=n*e.top)),{from:t,to:e}}calculateKeyframes(t,e,r=!1){let o={},a={},n=!1,c={};for(let f in e){let S=t[f],k=e[f];if(f in er){let A=er[f];if(S===void 0||k===void 0)continue;let N=A(S,k);N.transform!==void 0&&(c[f]=N.value,n=!0,o.transform=`${o.transform??""} ${N.transform}`,N.overrideFrom!==void 0&&Object.assign(o,N.overrideFrom))}else S!==k&&S!==void 0&&k!==void 0&&(n=!0,o[f]=S,a[f]=k)}return o.transformOrigin=a.transformOrigin=r?"center center":"top left",this.animatingProperties=c,n?[o,a]: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)}},St=st(rr);var tn=["top","right","bottom","left"],ir=class extends Ct{constructor(t){if(super(t),t.type!==vt.ELEMENT)throw Error("The `position` directive must be used in attribute position.")}render(t,e){return p}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(a=>{let n=tn.includes(a)?r[a]-o[a]:r[a];this.S.style[a]=n+"px"})}},en=st(ir);var F=class extends h{constructor(){super();this.vaultManagerContext=null;this.isEditMode=!1;this.deletePaymentMethodId=null;this.isDeleting=!1;this.errorMessage="";this.animationDuration=300;new Wt(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=v("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:v("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:v("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 lo(r).description||""}catch{return""}}renderLoadingOverlay(){return d`
|
|
1971
1968
|
<div
|
|
1972
1969
|
class="loading-overlay"
|
|
1973
|
-
${
|
|
1970
|
+
${St({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1974
1971
|
>
|
|
1975
1972
|
<primer-spinner
|
|
1976
1973
|
size="medium"
|
|
1977
1974
|
color="var(--primer-color-loader)"
|
|
1978
1975
|
></primer-spinner>
|
|
1979
1976
|
</div>
|
|
1980
|
-
`}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return
|
|
1977
|
+
`}renderDeleteConfirmation(){if(!this.deletePaymentMethodId)return p;let e=this.getPaymentMethodName(this.deletePaymentMethodId);return d`
|
|
1981
1978
|
<div class="delete-confirmation-container">
|
|
1982
1979
|
<primer-vault-delete-confirmation
|
|
1983
1980
|
.isDeleting=${this.isDeleting}
|
|
@@ -1985,30 +1982,30 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
1985
1982
|
.paymentMethodName=${e}
|
|
1986
1983
|
@confirm-delete=${this.handleConfirmDelete}
|
|
1987
1984
|
@cancel-delete=${this.handleCancelDelete}
|
|
1988
|
-
${
|
|
1985
|
+
${St({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1989
1986
|
></primer-vault-delete-confirmation>
|
|
1990
1987
|
</div>
|
|
1991
|
-
`}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?
|
|
1988
|
+
`}renderPaymentMethodItem(e){return this.deletePaymentMethodId===e.id?p:d`
|
|
1992
1989
|
<primer-vault-payment-method-item
|
|
1993
1990
|
.paymentMethod=${e}
|
|
1994
1991
|
.isEditMode=${this.isEditMode}
|
|
1995
1992
|
@delete-payment-method=${this.handleDeletePaymentMethod}
|
|
1996
|
-
${
|
|
1993
|
+
${St({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
1997
1994
|
></primer-vault-payment-method-item>
|
|
1998
|
-
`}renderPaymentMethodList(){let e=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&e.length>0&&!this.deletePaymentMethodId;return
|
|
1995
|
+
`}renderPaymentMethodList(){let e=this.vaultManagerContext?.vaultedPaymentMethods||[],r=!this.isEditMode&&e.length>0&&!this.deletePaymentMethodId;return d`
|
|
1999
1996
|
<div class="payment-methods-list">
|
|
2000
1997
|
${e.map(o=>this.renderPaymentMethodItem(o))}
|
|
2001
|
-
${
|
|
1998
|
+
${P(r,()=>d`
|
|
2002
1999
|
<div class="submit-button-container">
|
|
2003
2000
|
<primer-vault-payment-submit
|
|
2004
2001
|
class="submit-button"
|
|
2005
2002
|
@primer-vault-payment-error=${this.handlePaymentError}
|
|
2006
|
-
${
|
|
2003
|
+
${St({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2007
2004
|
></primer-vault-payment-submit>
|
|
2008
2005
|
</div>
|
|
2009
|
-
`,()=>
|
|
2006
|
+
`,()=>p)}
|
|
2010
2007
|
</div>
|
|
2011
|
-
`}render(){if(!this.vaultManagerContext?.enabled)return
|
|
2008
|
+
`}render(){if(!this.vaultManagerContext?.enabled)return p;let e=this.vaultManagerContext.vaultedPaymentMethods.length>0,r=this.vaultManagerContext.isLoading,o=this.vaultManagerContext.isUpdating;return d`
|
|
2012
2009
|
<div class="vault-manager ${o?"is-updating":""}">
|
|
2013
2010
|
<primer-vault-manager-header
|
|
2014
2011
|
.isEditMode=${this.isEditMode}
|
|
@@ -2016,328 +2013,100 @@ import{a as Eo,b as Qs,c as Co,d as n}from"./chunks/chunk.G45OCYEN.js";var Oi=Qs
|
|
|
2016
2013
|
@toggle-edit-mode=${this.handleToggleEditMode}
|
|
2017
2014
|
></primer-vault-manager-header>
|
|
2018
2015
|
|
|
2019
|
-
${
|
|
2016
|
+
${P(this.errorMessage,()=>d`
|
|
2020
2017
|
<primer-vault-error-message
|
|
2021
2018
|
.errorMessage=${this.errorMessage}
|
|
2022
2019
|
@close-error=${this.handleCloseError}
|
|
2023
|
-
${
|
|
2020
|
+
${St({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2024
2021
|
></primer-vault-error-message>
|
|
2025
|
-
`,()=>
|
|
2022
|
+
`,()=>p)}
|
|
2026
2023
|
|
|
2027
2024
|
<div class="vault-manager-content">
|
|
2028
|
-
${
|
|
2025
|
+
${P(!r&&!e,()=>d`
|
|
2029
2026
|
<div class="content-container">
|
|
2030
2027
|
<primer-vault-empty-state
|
|
2031
|
-
${
|
|
2028
|
+
${St({...this.getAnimationConfig(),properties:["opacity"],in:[{opacity:0},{opacity:1}],out:[{opacity:1},{opacity:0}]})}
|
|
2032
2029
|
></primer-vault-empty-state>
|
|
2033
2030
|
</div>
|
|
2034
|
-
`,()=>
|
|
2035
|
-
${
|
|
2031
|
+
`,()=>p)}
|
|
2032
|
+
${P(!r&&e,()=>d`
|
|
2036
2033
|
<div class="content-container">
|
|
2037
|
-
${
|
|
2034
|
+
${P(this.deletePaymentMethodId,()=>this.renderDeleteConfirmation(),()=>this.renderPaymentMethodList())}
|
|
2038
2035
|
</div>
|
|
2039
|
-
`,()=>
|
|
2036
|
+
`,()=>p)}
|
|
2040
2037
|
</div>
|
|
2041
2038
|
|
|
2042
|
-
${
|
|
2039
|
+
${P(o,()=>this.renderLoadingOverlay(),()=>p)}
|
|
2043
2040
|
</div>
|
|
2044
|
-
`}};
|
|
2041
|
+
`}};F.styles=[E,po],s([g({context:Kt,subscribe:!0}),l({type:Object,attribute:!1})],F.prototype,"vaultManagerContext",2),s([C()],F.prototype,"isEditMode",2),s([C()],F.prototype,"deletePaymentMethodId",2),s([C()],F.prototype,"isDeleting",2),s([C()],F.prototype,"errorMessage",2),s([l({type:Number})],F.prototype,"animationDuration",2),F=s([u("primer-vault-manager"),M()],F);var an=rn({tagName:"primer-vault-manager",elementClass:F,react:on});export{Ka as AchPayment,za as Button,qa as CardForm,Za as CardFormSubmit,is as CardNetworkSelector,na as CheckoutState,pa as Collapsable,ha as Dialog,vs as DynamicPayment,ga as ErrorMessage,xs as ErrorMessageContainer,ba as Icon,_a as Input,ds as InputCardExpiry,ss as InputCardHolderName,fs as InputCardNumber,ms as InputCvv,wa as InputError,Ta as InputLabel,Ia as InputWrapper,_s as Klarna,ws as NativePayment,Ts as PaymentMethod,Oa as Portal,oa as PrimerCheckout,Is as PrimerCheckoutComplete,Os as PrimerCheckoutError,Ys as PrimerMain,zs as RedirectPayment,Ks as ShowOtherPayments,Ya as Spinner,an as VaultManager};
|
|
2045
2042
|
/*! Bundled license information:
|
|
2046
2043
|
|
|
2047
2044
|
@lit/context/lib/context-request-event.js:
|
|
2048
|
-
(**
|
|
2049
|
-
* @license
|
|
2050
|
-
* Copyright 2021 Google LLC
|
|
2051
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2052
|
-
*)
|
|
2053
|
-
|
|
2054
2045
|
@lit/context/lib/create-context.js:
|
|
2055
|
-
(**
|
|
2056
|
-
* @license
|
|
2057
|
-
* Copyright 2021 Google LLC
|
|
2058
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2059
|
-
*)
|
|
2060
|
-
|
|
2061
2046
|
@lit/context/lib/controllers/context-consumer.js:
|
|
2062
|
-
(**
|
|
2063
|
-
* @license
|
|
2064
|
-
* Copyright 2021 Google LLC
|
|
2065
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2066
|
-
*)
|
|
2067
|
-
|
|
2068
2047
|
@lit/context/lib/value-notifier.js:
|
|
2069
|
-
(**
|
|
2070
|
-
* @license
|
|
2071
|
-
* Copyright 2021 Google LLC
|
|
2072
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2073
|
-
*)
|
|
2074
|
-
|
|
2075
2048
|
@lit/context/lib/controllers/context-provider.js:
|
|
2076
|
-
(**
|
|
2077
|
-
* @license
|
|
2078
|
-
* Copyright 2021 Google LLC
|
|
2079
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2080
|
-
*)
|
|
2081
|
-
|
|
2082
2049
|
@lit/context/lib/context-root.js:
|
|
2083
|
-
(**
|
|
2084
|
-
* @license
|
|
2085
|
-
* Copyright 2021 Google LLC
|
|
2086
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2087
|
-
*)
|
|
2088
|
-
|
|
2089
|
-
@lit/context/lib/decorators/provide.js:
|
|
2090
|
-
(**
|
|
2091
|
-
* @license
|
|
2092
|
-
* Copyright 2017 Google LLC
|
|
2093
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2094
|
-
*)
|
|
2095
|
-
|
|
2096
|
-
@lit/context/lib/decorators/consume.js:
|
|
2097
|
-
(**
|
|
2098
|
-
* @license
|
|
2099
|
-
* Copyright 2022 Google LLC
|
|
2100
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2101
|
-
*)
|
|
2102
|
-
|
|
2103
|
-
@lit/reactive-element/css-tag.js:
|
|
2104
|
-
(**
|
|
2105
|
-
* @license
|
|
2106
|
-
* Copyright 2019 Google LLC
|
|
2107
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2108
|
-
*)
|
|
2109
|
-
|
|
2110
|
-
@lit/reactive-element/reactive-element.js:
|
|
2111
|
-
(**
|
|
2112
|
-
* @license
|
|
2113
|
-
* Copyright 2017 Google LLC
|
|
2114
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2115
|
-
*)
|
|
2116
|
-
|
|
2117
|
-
@lit/task/task.js:
|
|
2118
|
-
(**
|
|
2119
|
-
* @license
|
|
2120
|
-
* Copyright 2017 Google LLC
|
|
2121
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2122
|
-
*)
|
|
2123
|
-
|
|
2124
2050
|
@lit/localize/internal/locale-status-event.js:
|
|
2125
|
-
(**
|
|
2126
|
-
* @license
|
|
2127
|
-
* Copyright 2021 Google LLC
|
|
2128
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2129
|
-
*)
|
|
2130
|
-
|
|
2131
2051
|
@lit/localize/internal/str-tag.js:
|
|
2132
|
-
(**
|
|
2133
|
-
* @license
|
|
2134
|
-
* Copyright 2021 Google LLC
|
|
2135
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2136
|
-
*)
|
|
2137
|
-
|
|
2138
2052
|
@lit/localize/internal/types.js:
|
|
2139
|
-
(**
|
|
2140
|
-
* @license
|
|
2141
|
-
* Copyright 2021 Google LLC
|
|
2142
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2143
|
-
*)
|
|
2144
|
-
|
|
2145
2053
|
@lit/localize/internal/default-msg.js:
|
|
2146
|
-
(**
|
|
2147
|
-
* @license
|
|
2148
|
-
* Copyright 2021 Google LLC
|
|
2149
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2150
|
-
*)
|
|
2151
|
-
|
|
2152
2054
|
@lit/localize/internal/localized-controller.js:
|
|
2153
|
-
(**
|
|
2154
|
-
* @license
|
|
2155
|
-
* Copyright 2021 Google LLC
|
|
2156
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2157
|
-
*)
|
|
2158
|
-
|
|
2159
2055
|
@lit/localize/internal/localized-decorator.js:
|
|
2160
|
-
(**
|
|
2161
|
-
* @license
|
|
2162
|
-
* Copyright 2021 Google LLC
|
|
2163
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2164
|
-
*)
|
|
2165
|
-
|
|
2166
|
-
@lit/localize/internal/deferred.js:
|
|
2167
|
-
(**
|
|
2168
|
-
* @license
|
|
2169
|
-
* Copyright 2020 Google LLC
|
|
2170
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2171
|
-
*)
|
|
2172
|
-
|
|
2173
|
-
@lit/localize/internal/fnv1a64.js:
|
|
2174
|
-
(**
|
|
2175
|
-
* @license
|
|
2176
|
-
* Copyright 2014 Travis Webb
|
|
2177
|
-
* SPDX-License-Identifier: MIT
|
|
2178
|
-
*)
|
|
2179
|
-
|
|
2180
|
-
@lit/localize/internal/id-generation.js:
|
|
2181
|
-
(**
|
|
2182
|
-
* @license
|
|
2183
|
-
* Copyright 2020 Google LLC
|
|
2184
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2185
|
-
*)
|
|
2186
|
-
|
|
2187
2056
|
@lit/localize/internal/runtime-msg.js:
|
|
2188
|
-
(**
|
|
2189
|
-
* @license
|
|
2190
|
-
* Copyright 2021 Google LLC
|
|
2191
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2192
|
-
*)
|
|
2193
|
-
|
|
2194
2057
|
@lit/localize/init/runtime.js:
|
|
2195
|
-
(**
|
|
2196
|
-
* @license
|
|
2197
|
-
* Copyright 2021 Google LLC
|
|
2198
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2199
|
-
*)
|
|
2200
|
-
|
|
2201
2058
|
@lit/localize/init/transform.js:
|
|
2059
|
+
@lit/reactive-element/decorators/query-assigned-elements.js:
|
|
2060
|
+
lit-html/directives/when.js:
|
|
2202
2061
|
(**
|
|
2203
2062
|
* @license
|
|
2204
2063
|
* Copyright 2021 Google LLC
|
|
2205
2064
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2206
2065
|
*)
|
|
2207
2066
|
|
|
2208
|
-
@lit/
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2213
|
-
*)
|
|
2214
|
-
|
|
2067
|
+
@lit/context/lib/decorators/provide.js:
|
|
2068
|
+
@lit/reactive-element/reactive-element.js:
|
|
2069
|
+
@lit/task/task.js:
|
|
2070
|
+
@lit/reactive-element/reactive-element.js:
|
|
2215
2071
|
lit-html/lit-html.js:
|
|
2216
|
-
(**
|
|
2217
|
-
* @license
|
|
2218
|
-
* Copyright 2017 Google LLC
|
|
2219
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2220
|
-
*)
|
|
2221
|
-
|
|
2222
2072
|
lit-element/lit-element.js:
|
|
2223
|
-
(**
|
|
2224
|
-
* @license
|
|
2225
|
-
* Copyright 2017 Google LLC
|
|
2226
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2227
|
-
*)
|
|
2228
|
-
|
|
2229
|
-
lit-html/is-server.js:
|
|
2230
|
-
(**
|
|
2231
|
-
* @license
|
|
2232
|
-
* Copyright 2022 Google LLC
|
|
2233
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2234
|
-
*)
|
|
2235
|
-
|
|
2236
2073
|
@lit/reactive-element/decorators/custom-element.js:
|
|
2237
|
-
(**
|
|
2238
|
-
* @license
|
|
2239
|
-
* Copyright 2017 Google LLC
|
|
2240
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2241
|
-
*)
|
|
2242
|
-
|
|
2243
2074
|
@lit/reactive-element/decorators/property.js:
|
|
2244
|
-
(**
|
|
2245
|
-
* @license
|
|
2246
|
-
* Copyright 2017 Google LLC
|
|
2247
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2248
|
-
*)
|
|
2249
|
-
|
|
2250
2075
|
@lit/reactive-element/decorators/state.js:
|
|
2251
|
-
(**
|
|
2252
|
-
* @license
|
|
2253
|
-
* Copyright 2017 Google LLC
|
|
2254
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2255
|
-
*)
|
|
2256
|
-
|
|
2257
2076
|
@lit/reactive-element/decorators/event-options.js:
|
|
2258
|
-
(**
|
|
2259
|
-
* @license
|
|
2260
|
-
* Copyright 2017 Google LLC
|
|
2261
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2262
|
-
*)
|
|
2263
|
-
|
|
2264
2077
|
@lit/reactive-element/decorators/base.js:
|
|
2265
|
-
(**
|
|
2266
|
-
* @license
|
|
2267
|
-
* Copyright 2017 Google LLC
|
|
2268
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2269
|
-
*)
|
|
2270
|
-
|
|
2271
2078
|
@lit/reactive-element/decorators/query.js:
|
|
2272
|
-
(**
|
|
2273
|
-
* @license
|
|
2274
|
-
* Copyright 2017 Google LLC
|
|
2275
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2276
|
-
*)
|
|
2277
|
-
|
|
2278
2079
|
@lit/reactive-element/decorators/query-all.js:
|
|
2279
|
-
(**
|
|
2280
|
-
* @license
|
|
2281
|
-
* Copyright 2017 Google LLC
|
|
2282
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2283
|
-
*)
|
|
2284
|
-
|
|
2285
2080
|
@lit/reactive-element/decorators/query-async.js:
|
|
2286
|
-
(**
|
|
2287
|
-
* @license
|
|
2288
|
-
* Copyright 2017 Google LLC
|
|
2289
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2290
|
-
*)
|
|
2291
|
-
|
|
2292
|
-
@lit/reactive-element/decorators/query-assigned-elements.js:
|
|
2293
|
-
(**
|
|
2294
|
-
* @license
|
|
2295
|
-
* Copyright 2021 Google LLC
|
|
2296
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2297
|
-
*)
|
|
2298
|
-
|
|
2299
2081
|
@lit/reactive-element/decorators/query-assigned-nodes.js:
|
|
2300
|
-
(**
|
|
2301
|
-
* @license
|
|
2302
|
-
* Copyright 2017 Google LLC
|
|
2303
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2304
|
-
*)
|
|
2305
|
-
|
|
2306
|
-
lit-html/directives/when.js:
|
|
2307
|
-
(**
|
|
2308
|
-
* @license
|
|
2309
|
-
* Copyright 2021 Google LLC
|
|
2310
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2311
|
-
*)
|
|
2312
|
-
|
|
2313
2082
|
lit-html/directive.js:
|
|
2083
|
+
lit-html/async-directive.js:
|
|
2314
2084
|
(**
|
|
2315
2085
|
* @license
|
|
2316
2086
|
* Copyright 2017 Google LLC
|
|
2317
2087
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2318
2088
|
*)
|
|
2319
2089
|
|
|
2320
|
-
lit
|
|
2321
|
-
|
|
2322
|
-
* @license
|
|
2323
|
-
* Copyright 2018 Google LLC
|
|
2324
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2325
|
-
*)
|
|
2326
|
-
|
|
2327
|
-
lit-html/directive-helpers.js:
|
|
2090
|
+
@lit/context/lib/decorators/consume.js:
|
|
2091
|
+
lit-html/is-server.js:
|
|
2328
2092
|
(**
|
|
2329
2093
|
* @license
|
|
2330
|
-
* Copyright
|
|
2094
|
+
* Copyright 2022 Google LLC
|
|
2331
2095
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2332
2096
|
*)
|
|
2333
2097
|
|
|
2334
|
-
lit-
|
|
2098
|
+
@lit/reactive-element/css-tag.js:
|
|
2099
|
+
@lit/reactive-element/css-tag.js:
|
|
2335
2100
|
(**
|
|
2336
2101
|
* @license
|
|
2337
|
-
* Copyright
|
|
2102
|
+
* Copyright 2019 Google LLC
|
|
2338
2103
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2339
2104
|
*)
|
|
2340
2105
|
|
|
2106
|
+
@lit/localize/internal/deferred.js:
|
|
2107
|
+
@lit/localize/internal/id-generation.js:
|
|
2108
|
+
@lit/localize/lit-localize.js:
|
|
2109
|
+
lit-html/directive-helpers.js:
|
|
2341
2110
|
lit-html/directives/ref.js:
|
|
2342
2111
|
(**
|
|
2343
2112
|
* @license
|
|
@@ -2345,31 +2114,17 @@ lit-html/directives/ref.js:
|
|
|
2345
2114
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2346
2115
|
*)
|
|
2347
2116
|
|
|
2348
|
-
lit
|
|
2349
|
-
(**
|
|
2350
|
-
* @license
|
|
2351
|
-
* Copyright 2017 Google LLC
|
|
2352
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2353
|
-
*)
|
|
2354
|
-
|
|
2355
|
-
lit-html/directive.js:
|
|
2356
|
-
(**
|
|
2357
|
-
* @license
|
|
2358
|
-
* Copyright 2017 Google LLC
|
|
2359
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
2360
|
-
*)
|
|
2361
|
-
|
|
2362
|
-
lit-html/directive-helpers.js:
|
|
2117
|
+
@lit/localize/internal/fnv1a64.js:
|
|
2363
2118
|
(**
|
|
2364
2119
|
* @license
|
|
2365
|
-
* Copyright
|
|
2366
|
-
* SPDX-License-Identifier:
|
|
2120
|
+
* Copyright 2014 Travis Webb
|
|
2121
|
+
* SPDX-License-Identifier: MIT
|
|
2367
2122
|
*)
|
|
2368
2123
|
|
|
2369
|
-
lit-html/
|
|
2124
|
+
lit-html/directives/class-map.js:
|
|
2370
2125
|
(**
|
|
2371
2126
|
* @license
|
|
2372
|
-
* Copyright
|
|
2127
|
+
* Copyright 2018 Google LLC
|
|
2373
2128
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
2374
2129
|
*)
|
|
2375
2130
|
*/
|