@frak-labs/components 1.0.13-beta.e8417060 → 1.0.13-beta.f4d2e52a
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/cdn/Banner.wcjTUyP1.js +183 -0
- package/cdn/ButtonShare.CMTO7zcA.js +1 -0
- package/cdn/ButtonWallet.Cwauxojx.js +40 -0
- package/cdn/{GiftIcon.BNDwDbDO.js → GiftIcon.CSjsnRQh.js} +1 -1
- package/cdn/OpenInAppButton.G3VjbH1_.js +1 -0
- package/cdn/PostPurchase.DFHeDsq_.js +89 -0
- package/cdn/components.js +1 -1
- package/cdn/defaults.DNO3nf63.js +58 -0
- package/cdn/embeddedWallet.BR3BC6DE.js +1 -0
- package/cdn/loader.js +164 -1
- package/cdn/rewards.usw1vliR.js +1 -0
- package/cdn/useGlobalComponents.CcNSI-MX.js +1 -0
- package/cdn/useLightDomStyles.mqw3cSdZ.js +1 -0
- package/cdn/useReward.BK8q8FQH.js +1 -0
- package/package.json +16 -4
- package/cdn/Banner.Dwv3SwJ0.js +0 -183
- package/cdn/ButtonShare.DY9Ka4RB.js +0 -1
- package/cdn/ButtonWallet.BhbqAhiZ.js +0 -40
- package/cdn/OpenInAppButton.DlBi9Mf3.js +0 -1
- package/cdn/PostPurchase.BPJlXLUK.js +0 -89
- package/cdn/actions-L7o384oB.Dja0yGBh.js +0 -1
- package/cdn/clientReady.BLJ9Ej95.js +0 -11
- package/cdn/defaults.DSdJs5_D.js +0 -58
- package/cdn/embeddedWallet.BInGUCcH.js +0 -1
- package/cdn/rewards.9mTF4_ef.js +0 -1
- package/cdn/sharedBaseCss.css.BDzFcWnD.js +0 -154
- package/cdn/sharingPage.CJ1nMtYf.js +0 -1
- package/cdn/sharingPageProducts.IEGuIULv.js +0 -1
- package/cdn/styleManager.Cun1-fKi.js +0 -1
- package/cdn/useGlobalComponents.CshV-GdK.js +0 -1
- package/cdn/useLightDomStyles.YYgCzrwE.js +0 -1
- package/cdn/useReward.Bh_mHVwG.js +0 -1
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import{a as e,d as t,f as n,h as r,m as i,n as a,r as o,s,t as c,u as l}from"./defaults.DSdJs5_D.js";import{t as u}from"./useReward.Bh_mHVwG.js";import{t as d}from"./embeddedWallet.BInGUCcH.js";function f(e){return i(`svg`,{fill:`none`,height:`1em`,viewBox:`0 0 28 28`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[i(`title`,{children:`Gift icon`}),i(`path`,{d:`m23.14 14v11.43h-18.29v-11.43m9.14 11.43v-17.14m0 0h-5.14c-0.76 0-1.48-0.3-2.02-0.84s-0.84-1.26-0.84-2.020.3-1.480.84-2.02 1.26-0.84 2.02-0.84c4 0 5.14 5.71 5.14 5.71zm0 0h5.14c0.76 0 1.48-0.3 2.02-0.84s0.84-1.260.84-2.02-0.3-1.48-0.84-2.02-1.26-0.84-2.02-0.84c-4 0-5.14 5.71-5.14 5.71zm-11.43 0h22.86v5.71h-22.86z`,stroke:`#fff`,"stroke-linecap":`round`,"stroke-linejoin":`round`})]})}function p(){`vibrate`in navigator?navigator.vibrate(10):console.log(`Vibration not supported`)}function m(e,t){p(),d(e,t)}function h({placement:d,classname:p=``,useReward:h,targetInteraction:g}){let _=e(),v=a(d),y=l(()=>v?.targetInteraction===void 0?g:v.targetInteraction,[v?.targetInteraction,g]),b=l(()=>h===!0,[h]),{shouldRender:x,isHidden:S,isClientReady:C}=s(),{reward:w}=u(b&&C,y),[T,E]=t(`right`);if(n(()=>{let e=v?.components?.buttonWallet?.position,t=window.FrakSetup?.modalWalletConfig?.metadata?.position;E(e??t??`right`)},[v?.components?.buttonWallet?.position]),!x||S)return null;let D=[`button`,`button__fadeIn`,T===`left`?`button__left`:`button__right`,p].filter(Boolean).join(` `);return i(r,{children:[i(`style`,{children:o(`
|
|
2
|
-
.button {
|
|
3
|
-
all: unset;
|
|
4
|
-
position: fixed;
|
|
5
|
-
bottom: 20px;
|
|
6
|
-
z-index: 2000000;
|
|
7
|
-
display: flex;
|
|
8
|
-
justify-content: center;
|
|
9
|
-
align-items: center;
|
|
10
|
-
background-color: #3e557e;
|
|
11
|
-
width: 45px;
|
|
12
|
-
height: 45px;
|
|
13
|
-
border-radius: 50%;
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
text-align: center;
|
|
16
|
-
font-size: 24px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.button__left {
|
|
20
|
-
left: 20px;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.button__right {
|
|
24
|
-
right: 20px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.reward {
|
|
28
|
-
position: absolute;
|
|
29
|
-
top: -4px;
|
|
30
|
-
right: 27px;
|
|
31
|
-
padding: 2px 3px;
|
|
32
|
-
border-radius: 5px;
|
|
33
|
-
background: #ff3f3f;
|
|
34
|
-
font-size: 9px;
|
|
35
|
-
color: #fff;
|
|
36
|
-
font-weight: 600;
|
|
37
|
-
white-space: nowrap;
|
|
38
|
-
line-height: 9px;
|
|
39
|
-
}
|
|
40
|
-
`,v?.components?.buttonWallet?.css)}),i(`button`,{type:`button`,"aria-label":c[_].buttonWallet.ariaLabel,part:`button`,disabled:!C,class:D,onClick:()=>{m(y,d)},children:[i(f,{}),w&&i(`span`,{class:`reward`,children:w})]})]})}export{h as ButtonWallet};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{R as e,h as t,i as n,l as r}from"./clientReady.BLJ9Ej95.js";import{a as i,m as a,n as o,s,t as c,u as l}from"./defaults.DSdJs5_D.js";import{t as u}from"./useLightDomStyles.YYgCzrwE.js";function d(n=`wallet`,i){let a=window.FrakSetup?.client;a&&e(a,`open_in_app_clicked`,{path:n,placement:i}),r(`${t}${n}`,{onFallback:()=>{a&&e(a,`app_not_installed`,{path:n,placement:i})}})}function f(){return{isMobile:l(()=>n(),[])}}function p({placement:e,text:t,classname:n=``}){let r=i(),l=o(e),{shouldRender:p,isHidden:m,isClientReady:h}=s(),{isMobile:g}=f();u(`frak-open-in-app`,e,l?.components?.openInApp?.css);let _=l?.components?.openInApp?.text??t??c[r].openInApp.text;if(!g||!p||m)return null;let v=()=>{d(void 0,e)},y=[`button`,`button__fadeIn`,n].filter(Boolean).join(` `);return a(`button`,{type:`button`,"aria-label":c[r].openInApp.ariaLabel,disabled:!h,class:y,onClick:v,children:_})}export{p as OpenInAppButton};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./sharedBaseCss.css.BDzFcWnD.js";import{H as t,R as n,W as r}from"./clientReady.BLJ9Ej95.js";import{l as i,p as a,r as o}from"./actions-L7o384oB.Dja0yGBh.js";import{t as s}from"./sharingPage.CJ1nMtYf.js";import{n as c}from"./sharingPageProducts.IEGuIULv.js";import{a as ee,d as l,f as u,l as te,m as d,n as f,p,s as m,t as h,u as g}from"./defaults.DSdJs5_D.js";import{r as ne,t as re}from"./GiftIcon.BNDwDbDO.js";import{t as ie}from"./useGlobalComponents.CshV-GdK.js";import{t as ae}from"./useLightDomStyles.YYgCzrwE.js";import{i as oe,n as _,r as v}from"./rewards.9mTF4_ef.js";var y=`PostPurchase_card__5fv5lh0`,se=`PostPurchase_cardLayout__5fv5lh1`,ce=`PostPurchase_cardLeft__5fv5lh2`,b=`PostPurchase_cardRight__5fv5lh3`,x=`PostPurchase_cta__5fv5lh6 sharedBaseCss_buttonReset__7cswil0`,le=`PostPurchase_customImage__5fv5lha`,ue=`PostPurchase_frakLogo__5fv5lhb`,de=`PostPurchase_giftIcon__5fv5lh8`,fe=`PostPurchase_icon__5fv5lh7`,pe=`PostPurchase_imageWrapper__5fv5lh9`,me=`PostPurchase_message__5fv5lh5`;function he(e,t,n){let r=e?.isReferred?`referee`:`referrer`,i=_(t.rewards,{targetInteraction:`purchase`,currency:n,audience:r});if(!i)return null;let{campaign:a}=i,o=e?.isReferred&&a.referee?`referee`:`referrer`;return{variant:o,reward:o===`referee`?a.referee:a.referrer,merchantDomain:t.onChainMetadata.domain}}function S({customerId:_,orderId:S,token:C,sharingUrl:ge,merchantId:w,placement:T,classname:E=``,variant:D,badgeText:O,referrerText:k,refereeText:A,ctaText:j,preview:M,previewVariant:N,products:P,imageUrl:F}){let I=!!M,{shouldRender:L,isHidden:R,isClientReady:z}=m(),B=f(T),V=ee();ae(`frak-post-purchase`,T,B?.components?.postPurchase?.css,`.PostPurchase_card__5fv5lh0 {
|
|
2
|
-
padding: 16px;
|
|
3
|
-
border-radius: 12px;
|
|
4
|
-
background-color: var(--surface-background__pbq4akc);
|
|
5
|
-
border: 1px solid var(--border-default__pbq4akv);
|
|
6
|
-
}
|
|
7
|
-
.PostPurchase_cardLayout__5fv5lh1 {
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: row;
|
|
10
|
-
align-items: center;
|
|
11
|
-
gap: 32px;
|
|
12
|
-
}
|
|
13
|
-
.PostPurchase_cardLeft__5fv5lh2 {
|
|
14
|
-
flex-grow: 1;
|
|
15
|
-
min-width: 0;
|
|
16
|
-
display: flex;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
gap: 8px;
|
|
19
|
-
}
|
|
20
|
-
.PostPurchase_cardRight__5fv5lh3 {
|
|
21
|
-
flex-shrink: 0;
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
align-items: flex-end;
|
|
25
|
-
gap: 8px;
|
|
26
|
-
text-align: right;
|
|
27
|
-
}
|
|
28
|
-
.PostPurchase_badge__5fv5lh4 {
|
|
29
|
-
align-self: flex-start;
|
|
30
|
-
background-color: #FFF534;
|
|
31
|
-
border-radius: 4px;
|
|
32
|
-
padding: 4px 8px;
|
|
33
|
-
font-size: 12px;
|
|
34
|
-
font-weight: 600;
|
|
35
|
-
line-height: 12px;
|
|
36
|
-
color: var(--text-primary__pbq4ak0);
|
|
37
|
-
}
|
|
38
|
-
.PostPurchase_message__5fv5lh5 {
|
|
39
|
-
margin: 0;
|
|
40
|
-
font-size: 16px;
|
|
41
|
-
line-height: 22px;
|
|
42
|
-
color: var(--text-primary__pbq4ak0);
|
|
43
|
-
font-weight: 600;
|
|
44
|
-
}
|
|
45
|
-
.PostPurchase_cta__5fv5lh6 {
|
|
46
|
-
display: inline-flex;
|
|
47
|
-
align-items: center;
|
|
48
|
-
justify-content: center;
|
|
49
|
-
gap: 4px;
|
|
50
|
-
padding: 12px 16px;
|
|
51
|
-
border-radius: 9999px;
|
|
52
|
-
background-color: var(--text-primary__pbq4ak0);
|
|
53
|
-
color: var(--text-onAction__pbq4ak6);
|
|
54
|
-
font-size: 12px;
|
|
55
|
-
font-weight: bold;
|
|
56
|
-
text-transform: uppercase;
|
|
57
|
-
}
|
|
58
|
-
.PostPurchase_cta__5fv5lh6:disabled {
|
|
59
|
-
opacity: 0.7;
|
|
60
|
-
cursor: default;
|
|
61
|
-
}
|
|
62
|
-
.PostPurchase_icon__5fv5lh7 {
|
|
63
|
-
margin: -2px 0;
|
|
64
|
-
}
|
|
65
|
-
.PostPurchase_giftIcon__5fv5lh8 {
|
|
66
|
-
display: block;
|
|
67
|
-
flex-shrink: 0;
|
|
68
|
-
}
|
|
69
|
-
.PostPurchase_imageWrapper__5fv5lh9 {
|
|
70
|
-
flex-shrink: 0;
|
|
71
|
-
display: flex;
|
|
72
|
-
align-items: center;
|
|
73
|
-
justify-content: center;
|
|
74
|
-
width: 80px;
|
|
75
|
-
height: 80px;
|
|
76
|
-
overflow: hidden;
|
|
77
|
-
}
|
|
78
|
-
.PostPurchase_customImage__5fv5lha {
|
|
79
|
-
max-width: 100%;
|
|
80
|
-
max-height: 100%;
|
|
81
|
-
width: auto;
|
|
82
|
-
height: auto;
|
|
83
|
-
object-fit: contain;
|
|
84
|
-
display: block;
|
|
85
|
-
}
|
|
86
|
-
.PostPurchase_frakLogo__5fv5lhb {
|
|
87
|
-
display: block;
|
|
88
|
-
margin-left: auto;
|
|
89
|
-
}`,e);let[H,_e]=l(null),[U,W]=l(!1);u(()=>{I||!z||!_||!S||!C||o({customerId:_,orderId:S,token:C,merchantId:w}).catch(()=>{})},[I,z,_,S,C,w]),u(()=>{if(I||!z||U)return;let e=window.FrakSetup?.client;e&&Promise.all([i(e),a(e)]).then(([t,n])=>{W(!0),_e(he(t,n,e.config.metadata?.currency))}).catch(e=>{if(e instanceof r&&e.code===t.configError){W(!0);return}console.warn(`[Frak] Post-purchase context error`,e)})},[I,z,U]);let G=te(null),K=D??H?.variant??(I?N??`referrer`:void 0),q=ge??H?.merchantDomain,J=g(()=>{if(!H?.reward)return;let e=window.FrakSetup?.client?.config?.metadata?.currency;return oe(H.reward,e)},[H?.reward]),ve=ie(),Y=B?.components?.postPurchase??ve?.postPurchase,X=O??Y?.badgeText,Z=F??Y?.imageUrl,Q=g(()=>{let e=h[V].postPurchase;return{message:K===`referee`?J?v(A??Y?.refereeText??e.refereeText,J):A??Y?.refereeNoRewardText??e.refereeNoRewardText:J?v(k??Y?.referrerText??e.referrerText,J):k??Y?.referrerNoRewardText??e.referrerNoRewardText,cta:J?v(j??Y?.ctaText??e.ctaText,J):j??Y?.ctaNoRewardText??e.ctaNoRewardText}},[V,K,J,Y,k,A,j]);u(()=>{K&&G.current!==K&&z&&(!I&&(!L||R)||(n(window.FrakSetup?.client,`post_purchase_impression`,{placement:T,variant:K,has_reward:!!H?.reward}),G.current=K))},[K,L,R,z,I,T,H?.reward]);let $=g(()=>c(P),[P]),ye=p(()=>{K&&(n(window.FrakSetup?.client,`post_purchase_clicked`,{placement:T,variant:K}),s(void 0,T,{link:q,products:$}))},[K,T,q,$]);return!K||!I&&(!L||R||!H)?null:d(`div`,{className:[y,E].filter(Boolean).join(` `),children:d(`div`,{class:se,children:[d(`div`,{class:ce,children:[X&&d(`span`,{class:`PostPurchase_badge__5fv5lh4`,children:X}),d(`p`,{class:me,children:Q.message}),d(`button`,{type:`button`,className:`${x} button`,disabled:!I&&!z,onClick:I?void 0:ye,children:[Q.cta,d(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:`${fe} button`,children:d(`path`,{d:`M13.9 11.14C13.99 11.05 14.15 11.11 14.15 11.24V11.64C14.15 13.05 12.63 14.19 10.75 14.19C8.87 14.19 7.34 13.05 7.34 11.64V11.24C7.34 11.11 7.51 11.05 7.59 11.14C8.35 11.93 9.48 12.43 10.75 12.43C12.01 12.43 13.15 11.93 13.9 11.14ZM1.85 9.65C1.85 9.51 2.01 9.44 2.1 9.54C2.85 10.32 3.99 10.82 5.25 10.82C5.52 10.82 5.79 10.8 6.04 10.76C6.26 10.72 6.47 10.88 6.47 11.1V12.17C6.47 12.32 6.37 12.45 6.22 12.48C5.92 12.55 5.59 12.59 5.25 12.59C3.37 12.59 1.85 11.45 1.85 10.04V9.65ZM10.75 6.21C12.63 6.21 14.15 7.35 14.15 8.75C14.15 10.16 12.63 11.3 10.75 11.3C8.87 11.3 7.34 10.16 7.34 8.75C7.34 7.35 8.87 6.21 10.75 6.21ZM1.85 6.85C1.85 6.71 2.01 6.65 2.1 6.74C2.85 7.53 3.99 8.03 5.25 8.03C5.52 8.03 5.79 8 6.04 7.96C6.26 7.92 6.47 8.09 6.47 8.3V9.37C6.47 9.52 6.37 9.65 6.22 9.69C5.92 9.75 5.59 9.79 5.25 9.79C3.37 9.79 1.85 8.65 1.85 7.24V6.85ZM5.25 1.81C7.13 1.81 8.66 2.95 8.66 4.36C8.66 5.76 7.13 6.9 5.25 6.9C3.37 6.9 1.85 5.76 1.85 4.36C1.85 2.95 3.37 1.81 5.25 1.81Z`,fill:`currentColor`})})]})]}),d(`div`,{class:b,children:[Z?d(`span`,{class:pe,children:d(`img`,{src:Z,alt:``,class:le})}):d(re,{className:de,width:80,height:80}),d(ne,{className:ue,width:42,height:24})]})]})})}export{S as PostPurchase};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,D as t,I as n,O as r,P as i,R as a,S as o,U as s,b as c,x as l,z as u}from"./clientReady.BLJ9Ej95.js";async function d(e,t,n){return await e.request({method:`frak_displayEmbeddedWallet`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function f(e,{steps:t,metadata:n},r){return await e.request({method:`frak_displayModal`,params:r?[t,n,e.config.metadata,r]:[t,n,e.config.metadata]})}async function p(e,t,n){return await e.request({method:`frak_displaySharingPage`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function m(n,r){if(typeof window>`u`)return;let a=await c().catch(()=>void 0);if(!a)return;let o=await t.resolveMerchantId();if(!o)return;let s=`frak-identity-ensured-${o}-${a}`;if(!window.sessionStorage.getItem(s))try{let t=i(r),c=await e({op:`frak-ensure-v1`,merchantId:o,anonymousId:a});(await fetch(`${t}/user/identity/ensure`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"x-wallet-sdk-auth":n,"x-frak-client-id":a},body:JSON.stringify({merchantId:o,...c&&{proof:c}})})).ok&&window.sessionStorage.setItem(s,`1`)}catch{}}async function h(e,t){return n(()=>e.request({method:`frak_getMerchantInformation`}),{cacheKey:`frak_getMerchantInformation`,cacheTime:t?.cacheTime})}async function g(t,r){return n(async()=>{let n=await c().catch(()=>void 0),r=n?await e({op:`frak-merge-v1`,merchantId:t.config.metadata.merchantId??``,anonymousId:n}):null;return t.request({method:`frak_getMergeToken`,params:r?[r]:void 0})},{cacheKey:`frak_getMergeToken`,cacheTime:r?.cacheTime})}async function _(e,t){return n(()=>e.request({method:`frak_getUserReferralStatus`}),{cacheKey:`frak_getUserReferralStatus`,cacheTime:t?.cacheTime})}async function v(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}async function y(e,t){try{let n=await c().catch(()=>void 0);await e.request({method:`frak_sendInteraction`,params:[t,{clientId:n}]})}catch{console.warn(`[Frak SDK] Failed to send interaction:`,t.type)}}function b(e,t,n){return o(t)?(a(e,`user_referred_started`,{referrer_client_id:t.c,referrer_wallet:t.w,wallet_status:n?.key}),y(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referrerWallet:t.w,referralTimestamp:t.t}),!0):r(t)?(a(e,`user_referred_started`,{referrer:t.r,wallet_status:n?.key}),y(e,{type:`arrival`,referrerWallet:t.r}),!0):!1}function x(e,t,n){return!t&&!n?null:{v:2,m:e,t:Math.floor(Date.now()/1e3),...t?{c:t}:{},...n?{w:n}:{}}}function S(e,t,n){return o(e)?e.w&&n?.wallet?u(e.w,n.wallet):e.c?t===e.c:!1:r(e)&&n?.wallet?u(e.r,n.wallet):!1}async function C(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;let i=await c().catch(()=>void 0);if(S(n,i,t))return`self-referral`;if(!b(e,n,t))return`no-referrer`;let s=o(n)?n.m:r?.merchantId,u=r?.alwaysAppendUrl&&s?x(s,i,t?.wallet):null;return l.replaceUrl({url:window.location?.href,context:u}),a(e,`user_referred_completed`,{status:`success`}),`success`}async function w(e,{options:t}={}){let n=l.parse({url:window.location.href}),r=await O(e);try{return await C(e,{walletStatus:r,frakContext:n,options:t})}catch(e){console.warn(`Error processing referral`,{error:e})}}const T=`frak:referral-success`;async function E(e){try{await w(e)===`success`&&window.dispatchEvent(new Event(T))}catch(e){console.warn(`[Frak] Referral setup failed`,e)}}async function D(e){if(typeof window>`u`){console.warn(`[Frak] No window found, can't track purchase`);return}let n=window.sessionStorage.getItem(`frak-wallet-interaction-token`),r=await c().catch(()=>void 0);if(!n&&!r){console.warn(`[Frak] No identity found, skipping purchase check`);return}let a=e.merchantId??await t.resolveMerchantId();if(!a){console.warn(`[Frak] No merchant id found, skipping purchase check`);return}let o={Accept:`application/json`,"Content-Type":`application/json`};n&&(o[`x-wallet-sdk-auth`]=n),r&&(o[`x-frak-client-id`]=r);let s=i();await fetch(`${s}/user/track/purchase`,{method:`POST`,headers:o,body:JSON.stringify({customerId:e.customerId,orderId:e.orderId,token:e.token,merchantId:a})})}function O(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(k(e,t),t));let n=new s,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{k(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function k(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),m(t.interactionToken,e.config.walletUrl)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function A(e,{metadata:t,login:n}){return j(e,{steps:{login:n??{}},metadata:t})}function j(e,t){function n(n){return j(e,{...t,steps:{...t.steps,sendTransaction:n}})}function r(n){return j(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function i(n,r){return j(e,{...t,steps:{...t.steps,final:{...r,action:{key:`sharing`,options:n}}}})}async function a(n,r){return n&&(t.metadata=n(t.metadata??{})),await f(e,t,r)}return{params:t,sendTx:n,reward:r,sharing:i,display:a}}async function M(e,{tx:t,metadata:n}){return(await f(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function N(e=96){let t=Math.ceil(e/2),n=``;if(typeof crypto<`u`&&crypto.getRandomValues){let e=new Uint8Array(t);crypto.getRandomValues(e);for(let t=0;t<e.length;t++)n+=e[t].toString(16).padStart(2,`0`)}else for(let e=0;e<t;e++)n+=(Math.random()*256|0).toString(16).padStart(2,`0`);return n.substring(0,e)}async function P(e,{siwe:t,metadata:n}){let r=e.config?.domain??window.location.host,i=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`;return(await f(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??N(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}export{w as _,M as a,T as c,f as d,g as f,v as g,p as h,E as i,_ as l,m,C as n,O as o,h as p,D as r,P as s,A as t,d as u,y as v};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,t=new TextEncoder;function n(t,n){if(!e.test(t))throw Error(`${n} must be a UUID string, got: ${t}`);return s(t.replace(/-/g,``))}function r(e,t,n){if(!Number.isInteger(n)||n<0)throw Error(`ts must be a non-negative integer: ${n}`);let r=BigInt(n);for(let n=7;n>=0;n--)e[t+n]=Number(r&255n),r>>=8n}function i(e){if(e.binding.length!==0&&e.binding.length!==32)throw Error(`binding must be empty or 32 bytes, got ${e.binding.length}`);let i=t.encode(e.op),a=new Uint8Array(i.length+32+32+8),o=0;return a.set(i,o),o+=i.length,a.set(n(e.merchantId,`merchantId`),o),o+=16,a.set(n(e.anonymousId,`anonymousId`),o),o+=16,a.set(e.binding,o),o+=32,r(a,o,e.ts),a}function a(e){if(e.length<16)throw Error(`deriveClientIdFromHash requires at least 16 bytes, got ${e.length}`);let t=e.slice(0,16);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=o(t);return[n.slice(0,8),n.slice(8,12),n.slice(12,16),n.slice(16,20),n.slice(20,32)].join(`-`)}function o(e){return Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function s(e){return Uint8Array.from(e.match(/../g)??[],e=>Number.parseInt(e,16))}function c(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function l(e){if(e.pk.length!==65)throw Error(`pk must be 65 bytes, got ${e.pk.length}`);if(e.sig.length!==64)throw Error(`sig must be 64 bytes, got ${e.sig.length}`);let t=new Uint8Array(138);return t[0]=e.v,t.set(e.pk,1),r(t,66,e.ts),t.set(e.sig,74),c(t)}function u(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}function d(e,t=``){if(typeof e!=`number`){let n=t&&`"${t}" `;throw TypeError(`${n}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){let n=t&&`"${t}" `;throw RangeError(`${n}expected integer >= 0, got ${e}`)}}function f(e,t,n=``){let r=u(e),i=e?.length,a=t!==void 0;if(!r||a&&i!==t){let o=n&&`"${n}" `,s=a?` of length ${t}`:``,c=r?`length=${i}`:`type=${typeof e}`,l=o+`expected Uint8Array`+s+`, got `+c;throw r?RangeError(l):TypeError(l)}return e}function p(e){if(typeof e!=`function`||typeof e.create!=`function`)throw TypeError(`Hash must wrapped by utils.createHasher`);if(d(e.outputLen),d(e.blockLen),e.outputLen<1)throw Error(`"outputLen" must be >= 1`);if(e.blockLen<1)throw Error(`"blockLen" must be >= 1`)}function m(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function h(e,t){f(e,void 0,`digestInto() output`);let n=t.outputLen;if(e.length<n)throw RangeError(`"digestInto() output" expected to be of length >=`+n)}function g(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function _(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function v(e,t){return e<<32-t|e>>>t}const y=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,b=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function x(e){if(f(e),y)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=b[e[n]];return t}const S={_0:48,_9:57,A:65,F:70,a:97,f:102};function C(e){if(e>=S._0&&e<=S._9)return e-S._0;if(e>=S.A&&e<=S.F)return e-(S.A-10);if(e>=S.a&&e<=S.f)return e-(S.a-10)}function w(e){if(typeof e!=`string`)throw TypeError(`hex string expected, got `+typeof e);if(y)try{return Uint8Array.fromHex(e)}catch(e){throw e instanceof SyntaxError?RangeError(e.message):e}let t=e.length,n=t/2;if(t%2)throw RangeError(`hex string expected, got unpadded hex of length `+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=C(e.charCodeAt(i)),a=C(e.charCodeAt(i+1));if(n===void 0||a===void 0){let t=e[i]+e[i+1];throw RangeError(`hex string expected, got non-hex character "`+t+`" at index `+i)}r[t]=n*16+a}return r}function T(...e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];f(r),t+=r.length}let n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){let i=e[t];n.set(i,r),r+=i.length}return n}function E(e,t={}){let n=(t,n)=>e(n).update(t).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=t=>e(t),Object.assign(n,t),Object.freeze(n)}function ee(e=32){d(e,`bytesLength`);let t=typeof globalThis==`object`?globalThis.crypto:null;if(typeof t?.getRandomValues!=`function`)throw Error(`crypto.getRandomValues must be defined`);if(e>65536)throw RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}const te=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function ne(e,t,n){return e&t^~e&n}function re(e,t,n){return e&t^e&n^t&n}var ie=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,r){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=_(this.buffer)}update(e){m(this),f(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=_(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){m(this),h(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,g(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;n.setBigUint64(r-8,BigInt(this.length*8),i),this.process(n,0);let o=_(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen must be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}};const D=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ae=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),O=new Uint32Array(64);var oe=class extends ie{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)O[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=O[e-15],n=O[e-2],r=v(t,7)^v(t,18)^t>>>3,i=v(n,17)^v(n,19)^n>>>10;O[e]=i+O[e-7]+r+O[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=v(o,6)^v(o,11)^v(o,25),u=l+t+ne(o,s,c)+ae[e]+O[e]|0,d=(v(n,2)^v(n,13)^v(n,22))+re(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){g(O)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),g(this.buffer)}},se=class extends oe{A=D[0]|0;B=D[1]|0;C=D[2]|0;D=D[3]|0;E=D[4]|0;F=D[5]|0;G=D[6]|0;H=D[7]|0;constructor(){super(32)}};const ce=E(()=>new se,te(1)),k=(e,t,n)=>f(e,t,n),le=d,ue=x,A=(...e)=>T(...e),de=e=>w(e),fe=u,pe=e=>ee(e),me=BigInt(0),he=BigInt(1)
|
|
2
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3
|
-
;function j(e,t=``){if(typeof e!=`boolean`){let n=t&&`"${t}" `;throw TypeError(n+`expected boolean, got type=`+typeof e)}return e}function ge(e){if(typeof e==`bigint`){if(!Te(e))throw RangeError(`positive bigint expected, got `+e)}else le(e);return e}function _e(e,t=``){if(typeof e!=`number`){let n=t&&`"${t}" `;throw TypeError(n+`expected number, got type=`+typeof e)}if(!Number.isSafeInteger(e)){let n=t&&`"${t}" `;throw RangeError(n+`expected safe integer, got `+e)}}function ve(e){let t=ge(e).toString(16);return t.length&1?`0`+t:t}function ye(e){if(typeof e!=`string`)throw TypeError(`hex string expected, got `+typeof e);return e===``?me:BigInt(`0x`+e)}function be(e){return ye(x(e))}function xe(e){return ye(x(we(f(e)).reverse()))}function Se(e,t){if(d(t),t===0)throw RangeError(`zero length`);e=ge(e);let n=e.toString(16);if(n.length>t*2)throw RangeError(`number too large`);return w(n.padStart(t*2,`0`))}function Ce(e,t){return Se(e,t).reverse()}function we(e){return Uint8Array.from(k(e))}const Te=e=>typeof e==`bigint`&&me<=e;function Ee(e,t,n){return Te(e)&&Te(t)&&Te(n)&&t<=e&&e<n}function De(e,t,n,r){if(!Ee(t,n,r))throw RangeError(`expected valid `+e+`: `+n+` <= n < `+r+`, got `+t)}function Oe(e){if(e<me)throw Error(`expected non-negative bigint, got `+e);let t;for(t=0;e>me;e>>=he,t+=1);return t}const ke=e=>(he<<BigInt(e))-he;function Ae(e,t,n){if(d(e,`hashLen`),d(t,`qByteLen`),typeof n!=`function`)throw TypeError(`hmacFn must be a function`);let r=e=>new Uint8Array(e),i=Uint8Array.of(),a=Uint8Array.of(0),o=Uint8Array.of(1),s=r(e),c=r(e),l=0,u=()=>{s.fill(1),c.fill(0),l=0},f=(...e)=>n(c,A(s,...e)),p=(e=i)=>{c=f(a,e),s=f(),e.length!==0&&(c=f(o,e),s=f())},m=()=>{if(l++>=1e3)throw Error(`drbg: tried max amount of iterations`);let e=0,n=[];for(;e<t;){s=f();let t=s.slice();n.push(t),e+=s.length}return A(...n)};return(e,t)=>{u(),p(e);let n;for(;(n=t(m()))===void 0;)p();return u(),n}}function M(e,t={},n={}){if(Object.prototype.toString.call(e)!==`[object Object]`)throw TypeError(`expected valid options object`);function r(t,n,r){if(!r&&n!==`function`&&!Object.hasOwn(e,t))throw TypeError(`param "${t}" is invalid: expected own property`);let i=e[t];if(r&&i===void 0)return;let a=typeof i;if(a!==n||i===null)throw TypeError(`param "${t}" is invalid: expected ${n}, got ${a}`)}let i=(e,t)=>Object.entries(e).forEach(([e,n])=>r(e,n,t));i(t,!1),i(n,!0)}
|
|
4
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5
|
-
const N=BigInt(0),P=BigInt(1),F=BigInt(2),je=BigInt(3),Me=BigInt(4),Ne=BigInt(5),Pe=BigInt(7),Fe=BigInt(8),Ie=BigInt(9),Le=BigInt(16);function I(e,t){if(t<=N)throw Error(`mod: expected positive modulus, got `+t);let n=e%t;return n>=N?n:t+n}function Re(e,t){if(e===N)throw Error(`invert: expected non-zero number`);if(t<=N)throw Error(`invert: expected positive modulus, got `+t);let n=I(e,t),r=t,i=N,a=P,o=P,s=N;for(;n!==N;){let e=r/n,t=r-n*e,c=i-o*e,l=a-s*e;r=n,n=t,i=o,a=s,o=c,s=l}if(r!==P)throw Error(`invert: does not exist`);return I(i,t)}function ze(e,t,n){let r=e;if(!r.eql(r.sqr(t),n))throw Error(`Cannot find square root`)}function Be(e,t){let n=e,r=(n.ORDER+P)/Me,i=n.pow(t,r);return ze(n,i,t),i}function Ve(e,t){let n=e,r=(n.ORDER-Ne)/Fe,i=n.mul(t,F),a=n.pow(i,r),o=n.mul(t,a),s=n.mul(n.mul(o,F),a),c=n.mul(o,n.sub(s,n.ONE));return ze(n,c,t),c}function He(e){let t=$e(e),n=Ue(e),r=n(t,t.neg(t.ONE)),i=n(t,r),a=n(t,t.neg(r)),o=(e+Pe)/Le;return((e,t)=>{let n=e,s=n.pow(t,o),c=n.mul(s,r),l=n.mul(s,i),u=n.mul(s,a),d=n.eql(n.sqr(c),t),f=n.eql(n.sqr(l),t);s=n.cmov(s,c,d),c=n.cmov(u,l,f);let p=n.eql(n.sqr(c),t),m=n.cmov(s,c,p);return ze(n,m,t),m})}function Ue(e){if(e<je)throw Error(`sqrt is not defined for small field`);let t=e-P,n=0;for(;t%F===N;)t/=F,n++;let r=F,i=$e(e);for(;Ye(i,r)===1;)if(r++>1e3)throw Error(`Cannot find square root: probably non-prime P`);if(n===1)return Be;let a=i.pow(r,t),o=(t+P)/F;return function(e,r){let i=e;if(i.is0(r))return r;if(Ye(i,r)!==1)throw Error(`Cannot find square root`);let s=n,c=i.mul(i.ONE,a),l=i.pow(r,t),u=i.pow(r,o);for(;!i.eql(l,i.ONE);){if(i.is0(l))return i.ZERO;let e=1,t=i.sqr(l);for(;!i.eql(t,i.ONE);)if(e++,t=i.sqr(t),e===s)throw Error(`Cannot find square root`);let n=P<<BigInt(s-e-1),r=i.pow(c,n);s=e,c=i.sqr(r),l=i.mul(l,c),u=i.mul(u,r)}return u}}function We(e){return e%Me===je?Be:e%Fe===Ne?Ve:e%Le===Ie?He(e):Ue(e)}const Ge=[`create`,`isValid`,`is0`,`neg`,`inv`,`sqrt`,`sqr`,`eql`,`add`,`sub`,`mul`,`pow`,`div`,`addN`,`subN`,`mulN`,`sqrN`];function Ke(e){if(M(e,Ge.reduce((e,t)=>(e[t]=`function`,e),{ORDER:`bigint`,BYTES:`number`,BITS:`number`})),_e(e.BYTES,`BYTES`),_e(e.BITS,`BITS`),e.BYTES<1||e.BITS<1)throw Error(`invalid field: expected BYTES/BITS > 0`);if(e.ORDER<=P)throw Error(`invalid field: expected ORDER > 1, got `+e.ORDER);return e}function qe(e,t,n){let r=e;if(n<N)throw Error(`invalid exponent, negatives unsupported`);if(n===N)return r.ONE;if(n===P)return t;let i=r.ONE,a=t;for(;n>N;)n&P&&(i=r.mul(i,a)),a=r.sqr(a),n>>=P;return i}function Je(e,t,n=!1){let r=e,i=Array(t.length).fill(n?r.ZERO:void 0),a=t.reduce((e,t,n)=>r.is0(t)?e:(i[n]=e,r.mul(e,t)),r.ONE),o=r.inv(a);return t.reduceRight((e,t,n)=>r.is0(t)?e:(i[n]=r.mul(e,i[n]),r.mul(e,t)),o),i}function Ye(e,t){let n=e,r=(n.ORDER-P)/F,i=n.pow(t,r),a=n.eql(i,n.ONE),o=n.eql(i,n.ZERO),s=n.eql(i,n.neg(n.ONE));if(!a&&!o&&!s)throw Error(`invalid Legendre symbol result`);return a?1:o?0:-1}function Xe(e,t){if(t!==void 0&&le(t),e<=N)throw Error(`invalid n length: expected positive n, got `+e);if(t!==void 0&&t<1)throw Error(`invalid n length: expected positive bit length, got `+t);let n=Oe(e);if(t!==void 0&&t<n)throw Error(`invalid n length: expected bit length (${n}) >= n.length (${t})`);let r=t===void 0?n:t;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}const Ze=new WeakMap;var Qe=class{ORDER;BITS;BYTES;isLE;ZERO=N;ONE=P;_lengths;_mod;constructor(e,t={}){if(e<=P)throw Error(`invalid field: expected ORDER > 1, got `+e);let n;this.isLE=!1,typeof t==`object`&&t&&(typeof t.BITS==`number`&&(n=t.BITS),typeof t.sqrt==`function`&&Object.defineProperty(this,"sqrt",{value:t.sqrt,enumerable:!0}),typeof t.isLE==`boolean`&&(this.isLE=t.isLE),t.allowedLengths&&(this._lengths=Object.freeze(t.allowedLengths.slice())),typeof t.modFromBytes==`boolean`&&(this._mod=t.modFromBytes));let{nBitLength:r,nByteLength:i}=Xe(e,n);if(i>2048)throw Error(`invalid field: expected ORDER of <= 2048 bytes`);this.ORDER=e,this.BITS=r,this.BYTES=i,Object.freeze(this)}create(e){return I(e,this.ORDER)}isValid(e){if(typeof e!=`bigint`)throw TypeError(`invalid field element: expected bigint, got `+typeof e);return N<=e&&e<this.ORDER}is0(e){return e===N}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&P)===P}neg(e){return I(-e,this.ORDER)}eql(e,t){return e===t}sqr(e){return I(e*e,this.ORDER)}add(e,t){return I(e+t,this.ORDER)}sub(e,t){return I(e-t,this.ORDER)}mul(e,t){return I(e*t,this.ORDER)}pow(e,t){return qe(this,e,t)}div(e,t){return I(e*Re(t,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,t){return e+t}subN(e,t){return e-t}mulN(e,t){return e*t}inv(e){return Re(e,this.ORDER)}sqrt(e){let t=Ze.get(this);return t||Ze.set(this,t=We(this.ORDER)),t(this,e)}toBytes(e){return this.isLE?Ce(e,this.BYTES):Se(e,this.BYTES)}fromBytes(e,t=!1){k(e);let{_lengths:n,BYTES:r,isLE:i,ORDER:a,_mod:o}=this;if(n){if(e.length<1||!n.includes(e.length)||e.length>r)throw Error(`Field.fromBytes: expected `+n+` bytes, got `+e.length);let t=new Uint8Array(r);t.set(e,i?0:t.length-e.length),e=t}if(e.length!==r)throw Error(`Field.fromBytes: expected `+r+` bytes, got `+e.length);let s=i?xe(e):be(e);if(o&&(s=I(s,a)),!t&&!this.isValid(s))throw Error(`invalid field element: outside of range 0..ORDER`);return s}invertBatch(e){return Je(this,e)}cmov(e,t,n){return j(n,`condition`),n?t:e}};Object.freeze(Qe.prototype);function $e(e,t={}){return new Qe(e,t)}function et(e){if(typeof e!=`bigint`)throw Error(`field order must be bigint`);if(e<=P)throw Error(`field order must be greater than 1`);let t=Oe(e-P);return Math.ceil(t/8)}function tt(e){let t=et(e);return t+Math.ceil(t/2)}function nt(e,t,n=!1){k(e);let r=e.length,i=et(t),a=Math.max(tt(t),16);if(r<a||r>1024)throw Error(`expected `+a+`-1024 bytes of input, got `+r);let o=I(n?xe(e):be(e),t-P)+P;return n?Ce(o,i):Se(o,i)}
|
|
6
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
7
|
-
const L=BigInt(0),R=BigInt(1);function rt(e,t){let n=t.negate();return e?n:t}function it(e,t){let n=Je(e.Fp,t.map(e=>e.Z));return t.map((t,r)=>e.fromAffine(t.toAffine(n[r])))}function at(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error(`invalid window size, expected [1..`+t+`], got W=`+e)}function ot(e,t){at(e,t);let n=Math.ceil(t/e)+1,r=2**(e-1),i=2**e;return{windows:n,windowSize:r,mask:ke(e),maxNumber:i,shiftBy:BigInt(e)}}function st(e,t,n){let{windowSize:r,mask:i,maxNumber:a,shiftBy:o}=n,s=Number(e&i),c=e>>o;s>r&&(s-=a,c+=R);let l=t*r,u=l+Math.abs(s)-1,d=s===0,f=s<0,p=t%2!=0;return{nextN:c,offset:u,isZero:d,isNeg:f,isNegF:p,offsetF:l}}const ct=new WeakMap,lt=new WeakMap;function ut(e){return lt.get(e)||1}function dt(e){if(e!==L)throw Error(`invalid wNAF`)}var ft=class{BASE;ZERO;Fn;bits;constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,n=this.ZERO){let r=e;for(;t>L;)t&R&&(n=n.add(r)),r=r.double(),t>>=R;return n}precomputeWindow(e,t){let{windows:n,windowSize:r}=ot(t,this.bits),i=[],a=e,o=a;for(let e=0;e<n;e++){o=a,i.push(o);for(let e=1;e<r;e++)o=o.add(a),i.push(o);a=o.double()}return i}wNAF(e,t,n){if(!this.Fn.isValid(n))throw Error(`invalid scalar`);let r=this.ZERO,i=this.BASE,a=ot(e,this.bits);for(let e=0;e<a.windows;e++){let{nextN:o,offset:s,isZero:c,isNeg:l,isNegF:u,offsetF:d}=st(n,e,a);n=o,c?i=i.add(rt(u,t[d])):r=r.add(rt(l,t[s]))}return dt(n),{p:r,f:i}}wNAFUnsafe(e,t,n,r=this.ZERO){let i=ot(e,this.bits);for(let e=0;e<i.windows&&n!==L;e++){let{nextN:a,offset:o,isZero:s,isNeg:c}=st(n,e,i);if(n=a,!s){let e=t[o];r=r.add(c?e.negate():e)}}return dt(n),r}getPrecomputes(e,t,n){let r=ct.get(t);return r||(r=this.precomputeWindow(t,e),e!==1&&(typeof n==`function`&&(r=n(r)),ct.set(t,r))),r}cached(e,t,n){let r=ut(e);return this.wNAF(r,this.getPrecomputes(r,e,n),t)}unsafe(e,t,n,r){let i=ut(e);return i===1?this._unsafeLadder(e,t,r):this.wNAFUnsafe(i,this.getPrecomputes(i,e,n),t,r)}createCache(e,t){at(t,this.bits),lt.set(e,t),ct.delete(e)}hasCache(e){return ut(e)!==1}};function pt(e,t,n,r){let i=t,a=e.ZERO,o=e.ZERO;for(;n>L||r>L;)n&R&&(a=a.add(i)),r&R&&(o=o.add(i)),i=i.double(),n>>=R,r>>=R;return{p1:a,p2:o}}function mt(e,t,n){if(t){if(t.ORDER!==e)throw Error(`Field.ORDER must match order: Fp == p, Fn == n`);return Ke(t),t}else return $e(e,{isLE:n})}function ht(e,t,n={},r){if(r===void 0&&(r=e===`edwards`),!t||typeof t!=`object`)throw Error(`expected valid ${e} CURVE object`);for(let e of[`p`,`n`,`h`]){let n=t[e];if(!(typeof n==`bigint`&&n>L))throw Error(`CURVE.${e} must be positive bigint`)}let i=mt(t.p,n.Fp,r),a=mt(t.n,n.Fn,r),o=[`Gx`,`Gy`,`a`,e===`weierstrass`?`b`:`d`];for(let e of o)if(!i.isValid(t[e]))throw Error(`CURVE.${e} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:a}}function gt(e,t){return function(n){let r=e(n);return{secretKey:r,publicKey:t(r)}}}var _t=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(e,t){if(p(e),f(t,void 0,`key`),this.iHash=e.create(),typeof this.iHash.update!=`function`)throw Error(`Expected instance of class which extends utils.Hash`);this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,r=new Uint8Array(n);r.set(t.length>n?e.create().update(t).digest():t);for(let e=0;e<r.length;e++)r[e]^=54;this.iHash.update(r),this.oHash=e.create();for(let e=0;e<r.length;e++)r[e]^=106;this.oHash.update(r),g(r)}update(e){return m(this),this.iHash.update(e),this}digestInto(e){m(this),h(e,this),this.finished=!0;let t=e.subarray(0,this.outputLen);this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:a,outputLen:o}=this;return e=e,e.finished=r,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const vt=(()=>{let e=((e,t,n)=>new _t(e,t).update(n).digest());return e.create=(e,t)=>new _t(e,t),e})(),yt=(e,t)=>(e+(e>=0?t:-t)/Ct)/t
|
|
8
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
9
|
-
;function bt(e,t,n){De(`scalar`,e,B,n);let[[r,i],[a,o]]=t,s=yt(o*e,n),c=yt(-i*e,n),l=e-s*r-c*a,u=-s*i-c*o,d=l<B,f=u<B;d&&(l=-l),f&&(u=-u);let p=ke(Math.ceil(Oe(n)/2))+V;if(l<B||l>=p||u<B||u>=p)throw Error(`splitScalar (endomorphism): failed for k`);return{k1neg:d,k1:l,k2neg:f,k2:u}}function xt(e){if(![`compact`,`recovered`,`der`].includes(e))throw Error(`Signature format must be "compact", "recovered", or "der"`);return e}function St(e,t){M(e);let n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return j(n.lowS,`lowS`),j(n.prehash,`prehash`),n.format!==void 0&&xt(n.format),n}const z={Err:class extends Error{constructor(e=``){super(e)}},_tlv:{encode:(e,t)=>{let{Err:n}=z;if(_e(e,`tag`),e<0||e>255)throw new n(`tlv.encode: wrong tag`);if(typeof t!=`string`)throw TypeError(`"data" expected string, got type=`+typeof t);if(t.length&1)throw new n(`tlv.encode: unpadded data`);let r=t.length/2,i=ve(r);if(i.length/2&128)throw new n(`tlv.encode: long form length too big`);let a=r>127?ve(i.length/2|128):``;return ve(e)+a+i+t},decode(e,t){let{Err:n}=z;t=k(t,void 0,`DER data`);let r=0;if(e<0||e>255)throw new n(`tlv.encode: wrong tag`);if(t.length<2||t[r++]!==e)throw new n(`tlv.decode: wrong tlv`);let i=t[r++],a=!!(i&128),o=0;if(!a)o=i;else{let e=i&127;if(!e)throw new n(`tlv.decode(long): indefinite length not supported`);if(e>4)throw new n(`tlv.decode(long): byte length is too big`);let a=t.subarray(r,r+e);if(a.length!==e)throw new n(`tlv.decode: length bytes not complete`);if(a[0]===0)throw new n(`tlv.decode(long): zero leftmost byte`);for(let e of a)o=o<<8|e;if(r+=e,o<128)throw new n(`tlv.decode(long): not minimal encoding`)}let s=t.subarray(r,r+o);if(s.length!==o)throw new n(`tlv.decode: wrong value length`);return{v:s,l:t.subarray(r+o)}}},_int:{encode(e){let{Err:t}=z;if(ge(e),e<B)throw new t(`integer: negative integers are not allowed`);let n=ve(e);if(Number.parseInt(n[0],16)&8&&(n=`00`+n),n.length&1)throw new t(`unexpected DER parsing assertion: unpadded hex`);return n},decode(e){let{Err:t}=z;if(e.length<1)throw new t(`invalid signature integer: empty`);if(e[0]&128)throw new t(`invalid signature integer: negative`);if(e.length>1&&e[0]===0&&!(e[1]&128))throw new t(`invalid signature integer: unnecessary leading zero`);return be(e)}},toSig(e){let{Err:t,_int:n,_tlv:r}=z,i=k(e,void 0,`signature`),{v:a,l:o}=r.decode(48,i);if(o.length)throw new t(`invalid signature: left bytes after parsing`);let{v:s,l:c}=r.decode(2,a),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t(`invalid signature: left bytes after parsing`);return{r:n.decode(s),s:n.decode(l)}},hexFromSig(e){let{_tlv:t,_int:n}=z,r=t.encode(2,n.encode(e.r))+t.encode(2,n.encode(e.s));return t.encode(48,r)}};Object.freeze(z._tlv),Object.freeze(z._int),Object.freeze(z);const B=BigInt(0),V=BigInt(1),Ct=BigInt(2),wt=BigInt(3),Tt=BigInt(4);function Et(e,t={}){let n=ht(`weierstrass`,e,t),r=n.Fp,i=n.Fn,a=n.CURVE,{h:o,n:s}=a;M(t,{},{allowInfinityPoint:`boolean`,clearCofactor:`function`,isTorsionFree:`function`,fromBytes:`function`,toBytes:`function`,endo:`object`});let{endo:c,allowInfinityPoint:l}=t;if(c&&(!r.is0(a.a)||typeof c.beta!=`bigint`||!Array.isArray(c.basises)))throw Error(`invalid endo: expected "beta": bigint and "basises": array`);let u=Ot(r,i);function d(){if(!r.isOdd)throw Error(`compression is not supported: Field does not have .isOdd()`)}function f(e,t,n){if(l&&t.is0())return Uint8Array.of(0);let{x:i,y:a}=t.toAffine(),o=r.toBytes(i);return j(n,`isCompressed`),n?(d(),A(Dt(!r.isOdd(a)),o)):A(Uint8Array.of(4),o,r.toBytes(a))}function p(e){k(e,void 0,`Point`);let{publicKey:t,publicKeyUncompressed:n}=u,i=e.length,a=e[0],o=e.subarray(1);if(l&&i===1&&a===0)return{x:r.ZERO,y:r.ZERO};if(i===t&&(a===2||a===3)){let e=r.fromBytes(o);if(!r.isValid(e))throw Error(`bad point: is not on curve, wrong x`);let t=g(e),n;try{n=r.sqrt(t)}catch(e){let t=e instanceof Error?`: `+e.message:``;throw Error(`bad point: is not on curve, sqrt error`+t)}d();let i=r.isOdd(n);return(a&1)==1!==i&&(n=r.neg(n)),{x:e,y:n}}else if(i===n&&a===4){let e=r.BYTES,t=r.fromBytes(o.subarray(0,e)),n=r.fromBytes(o.subarray(e,e*2));if(!_(t,n))throw Error(`bad point: is not on curve`);return{x:t,y:n}}else throw Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${n}`)}let m=t.toBytes===void 0?f:t.toBytes,h=t.fromBytes===void 0?p:t.fromBytes;function g(e){let t=r.sqr(e),n=r.mul(t,e);return r.add(r.add(n,r.mul(e,a.a)),a.b)}function _(e,t){let n=r.sqr(t),i=g(e);return r.eql(n,i)}if(!_(a.Gx,a.Gy))throw Error(`bad curve params: generator point`);let v=r.mul(r.pow(a.a,wt),Tt),y=r.mul(r.sqr(a.b),BigInt(27));if(r.is0(r.add(v,y)))throw Error(`bad curve params: a or b`);function b(e,t,n=!1){if(!r.isValid(t)||n&&r.is0(t))throw Error(`bad point coordinate ${e}`);return t}function x(e){if(!(e instanceof w))throw Error(`Weierstrass Point expected`)}function S(e){if(!c||!c.basises)throw Error(`no endo`);return bt(e,c.basises,i.ORDER)}function C(e,t,n,i,a){return n=new w(r.mul(n.X,e),n.Y,n.Z),t=rt(i,t),n=rt(a,n),t.add(n)}class w{static BASE=new w(a.Gx,a.Gy,r.ONE);static ZERO=new w(r.ZERO,r.ONE,r.ZERO);static Fp=r;static Fn=i;X;Y;Z;constructor(e,t,n){this.X=b(`x`,e),this.Y=b(`y`,t,!0),this.Z=b(`z`,n),Object.freeze(this)}static CURVE(){return a}static fromAffine(e){let{x:t,y:n}=e||{};if(!e||!r.isValid(t)||!r.isValid(n))throw Error(`invalid affine point`);if(e instanceof w)throw Error(`projective point not allowed`);return r.is0(t)&&r.is0(n)?w.ZERO:new w(t,n,r.ONE)}static fromBytes(e){let t=w.fromAffine(h(k(e,void 0,`point`)));return t.assertValidity(),t}static fromHex(e){return w.fromBytes(de(e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return E.createCache(this,e),t||this.multiply(wt),this}assertValidity(){let e=this;if(e.is0()){if(t.allowInfinityPoint&&r.is0(e.X)&&r.eql(e.Y,r.ONE)&&r.is0(e.Z))return;throw Error(`bad point: ZERO`)}let{x:n,y:i}=e.toAffine();if(!r.isValid(n)||!r.isValid(i))throw Error(`bad point: x or y not field elements`);if(!_(n,i))throw Error(`bad point: equation left != right`);if(!e.isTorsionFree())throw Error(`bad point: not in prime-order subgroup`)}hasEvenY(){let{y:e}=this.toAffine();if(!r.isOdd)throw Error(`Field doesn't support isOdd`);return!r.isOdd(e)}equals(e){x(e);let{X:t,Y:n,Z:i}=this,{X:a,Y:o,Z:s}=e,c=r.eql(r.mul(t,s),r.mul(a,i)),l=r.eql(r.mul(n,s),r.mul(o,i));return c&&l}negate(){return new w(this.X,r.neg(this.Y),this.Z)}double(){let{a:e,b:t}=a,n=r.mul(t,wt),{X:i,Y:o,Z:s}=this,c=r.ZERO,l=r.ZERO,u=r.ZERO,d=r.mul(i,i),f=r.mul(o,o),p=r.mul(s,s),m=r.mul(i,o);return m=r.add(m,m),u=r.mul(i,s),u=r.add(u,u),c=r.mul(e,u),l=r.mul(n,p),l=r.add(c,l),c=r.sub(f,l),l=r.add(f,l),l=r.mul(c,l),c=r.mul(m,c),u=r.mul(n,u),p=r.mul(e,p),m=r.sub(d,p),m=r.mul(e,m),m=r.add(m,u),u=r.add(d,d),d=r.add(u,d),d=r.add(d,p),d=r.mul(d,m),l=r.add(l,d),p=r.mul(o,s),p=r.add(p,p),d=r.mul(p,m),c=r.sub(c,d),u=r.mul(p,f),u=r.add(u,u),u=r.add(u,u),new w(c,l,u)}add(e){x(e);let{X:t,Y:n,Z:i}=this,{X:o,Y:s,Z:c}=e,l=r.ZERO,u=r.ZERO,d=r.ZERO,f=a.a,p=r.mul(a.b,wt),m=r.mul(t,o),h=r.mul(n,s),g=r.mul(i,c),_=r.add(t,n),v=r.add(o,s);_=r.mul(_,v),v=r.add(m,h),_=r.sub(_,v),v=r.add(t,i);let y=r.add(o,c);return v=r.mul(v,y),y=r.add(m,g),v=r.sub(v,y),y=r.add(n,i),l=r.add(s,c),y=r.mul(y,l),l=r.add(h,g),y=r.sub(y,l),d=r.mul(f,v),l=r.mul(p,g),d=r.add(l,d),l=r.sub(h,d),d=r.add(h,d),u=r.mul(l,d),h=r.add(m,m),h=r.add(h,m),g=r.mul(f,g),v=r.mul(p,v),h=r.add(h,g),g=r.sub(m,g),g=r.mul(f,g),v=r.add(v,g),m=r.mul(h,v),u=r.add(u,m),m=r.mul(y,v),l=r.mul(_,l),l=r.sub(l,m),m=r.mul(_,h),d=r.mul(y,d),d=r.add(d,m),new w(l,u,d)}subtract(e){return x(e),this.add(e.negate())}is0(){return this.equals(w.ZERO)}multiply(e){let{endo:n}=t;if(!i.isValidNot0(e))throw RangeError(`invalid scalar: out of range`);let r,a,o=e=>E.cached(this,e,e=>it(w,e));if(n){let{k1neg:t,k1:i,k2neg:s,k2:c}=S(e),{p:l,f:u}=o(i),{p:d,f}=o(c);a=u.add(f),r=C(n.beta,l,d,t,s)}else{let{p:t,f:n}=o(e);r=t,a=n}return it(w,[r,a])[0]}multiplyUnsafe(e){let{endo:n}=t,r=this,a=e;if(!i.isValid(a))throw RangeError(`invalid scalar: out of range`);if(a===B||r.is0())return w.ZERO;if(a===V)return r;if(E.hasCache(this))return this.multiply(a);if(n){let{k1neg:e,k1:t,k2neg:i,k2:o}=S(a),{p1:s,p2:c}=pt(w,r,t,o);return C(n.beta,s,c,e,i)}else return E.unsafe(r,a)}toAffine(e){let t=this,n=e,{X:i,Y:a,Z:o}=t;if(r.eql(o,r.ONE))return{x:i,y:a};let s=t.is0();n??=s?r.ONE:r.inv(o);let c=r.mul(i,n),l=r.mul(a,n),u=r.mul(o,n);if(s)return{x:r.ZERO,y:r.ZERO};if(!r.eql(u,r.ONE))throw Error(`invZ was invalid`);return{x:c,y:l}}isTorsionFree(){let{isTorsionFree:e}=t;return o===V?!0:e?e(w,this):E.unsafe(this,s).is0()}clearCofactor(){let{clearCofactor:e}=t;return o===V?this:e?e(w,this):this.multiplyUnsafe(o)}isSmallOrder(){return o===V?this.is0():this.clearCofactor().is0()}toBytes(e=!0){return j(e,`isCompressed`),this.assertValidity(),m(w,this,e)}toHex(e=!0){return ue(this.toBytes(e))}toString(){return`<Point ${this.is0()?`ZERO`:this.toHex()}>`}}let T=i.BITS,E=new ft(w,t.endo?Math.ceil(T/2):T);return T>=8&&w.BASE.precompute(8),Object.freeze(w.prototype),Object.freeze(w),w}function Dt(e){return Uint8Array.of(e?2:3)}function Ot(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function kt(e,t={}){let{Fn:n}=e,r=t.randomBytes===void 0?pe:t.randomBytes,i=Object.assign(Ot(e.Fp,n),{seed:Math.max(tt(n.ORDER),16)});function a(e){try{let t=n.fromBytes(e);return n.isValidNot0(t)}catch{return!1}}function o(t,n){let{publicKey:r,publicKeyUncompressed:a}=i;try{let i=t.length;return n===!0&&i!==r||n===!1&&i!==a?!1:!!e.fromBytes(t)}catch{return!1}}function s(e){return e=e===void 0?r(i.seed):e,nt(k(e,i.seed,`seed`),n.ORDER)}function c(t,r=!0){return e.BASE.multiply(n.fromBytes(t)).toBytes(r)}function l(e){let{secretKey:t,publicKey:r,publicKeyUncompressed:a}=i,o=n._lengths;if(!fe(e))return;let s=k(e,void 0,`key`).length,c=s===r||s===a,l=s===t||!!o?.includes(s);if(!(c&&l))return c}function u(t,r,i=!0){if(l(t)===!0)throw Error(`first arg must be private key`);if(l(r)===!1)throw Error(`second arg must be public key`);let a=n.fromBytes(t);return e.fromBytes(r).multiply(a).toBytes(i)}let d={isValidSecretKey:a,isValidPublicKey:o,randomSecretKey:s},f=gt(s,c);return Object.freeze(d),Object.freeze(i),Object.freeze({getPublicKey:c,getSharedSecret:u,keygen:f,Point:e,utils:d,lengths:i})}function At(e,t,n={}){let r=t;p(r),M(n,{},{hmac:`function`,lowS:`boolean`,randomBytes:`function`,bits2int:`function`,bits2int_modN:`function`}),n=Object.assign({},n);let i=n.randomBytes===void 0?pe:n.randomBytes,a=n.hmac===void 0?(e,t)=>vt(r,e,t):n.hmac,{Fp:o,Fn:s}=e,{ORDER:c,BITS:l}=s,{keygen:u,getPublicKey:d,getSharedSecret:f,utils:m,lengths:h}=kt(e,n),g={prehash:!0,lowS:typeof n.lowS!=`boolean`||n.lowS,format:`compact`,extraEntropy:!1},_=c*Ct+V<o.ORDER;function v(e){return e>c>>V}function y(e,t){if(!s.isValidNot0(t))throw Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}function b(){if(_)throw Error(`"recovered" sig type is not supported for cofactor >2 curves`)}function x(e,t){xt(t);let n=h.signature;return k(e,t===`compact`?n:t===`recovered`?n+1:void 0)}class S{r;s;recovery;constructor(e,t,n){if(this.r=y(`r`,e),this.s=y(`s`,t),n!=null){if(b(),![0,1,2,3].includes(n))throw Error(`invalid recovery id`);this.recovery=n}Object.freeze(this)}static fromBytes(e,t=g.format){x(e,t);let n;if(t===`der`){let{r:t,s:n}=z.toSig(k(e));return new S(t,n)}t===`recovered`&&(n=e[0],t=`compact`,e=e.subarray(1));let r=h.signature/2,i=e.subarray(0,r),a=e.subarray(r,r*2);return new S(s.fromBytes(i),s.fromBytes(a),n)}static fromHex(e,t){return this.fromBytes(de(e),t)}assertRecovery(){let{recovery:e}=this;if(e==null)throw Error(`invalid recovery id: must be present`);return e}addRecoveryBit(e){return new S(this.r,this.s,e)}recoverPublicKey(t){let{r:n,s:r}=this,i=this.assertRecovery(),a=i===2||i===3?n+c:n;if(!o.isValid(a))throw Error(`invalid recovery id: sig.r+curve.n != R.x`);let l=o.toBytes(a),u=e.fromBytes(A(Dt((i&1)==0),l)),d=s.inv(a),f=w(k(t,void 0,`msgHash`)),p=s.create(-f*d),m=s.create(r*d),h=e.BASE.multiplyUnsafe(p).add(u.multiplyUnsafe(m));if(h.is0())throw Error(`invalid recovery: point at infinify`);return h.assertValidity(),h}hasHighS(){return v(this.s)}toBytes(e=g.format){if(xt(e),e===`der`)return de(z.hexFromSig(this));let{r:t,s:n}=this,r=s.toBytes(t),i=s.toBytes(n);return e===`recovered`?(b(),A(Uint8Array.of(this.assertRecovery()),r,i)):A(r,i)}toHex(e){return ue(this.toBytes(e))}}Object.freeze(S.prototype),Object.freeze(S);let C=n.bits2int===void 0?function(e){if(e.length>8192)throw Error(`input is too large`);let t=be(e),n=e.length*8-l;return n>0?t>>BigInt(n):t}:n.bits2int,w=n.bits2int_modN===void 0?function(e){return s.create(C(e))}:n.bits2int_modN,T=ke(l);function E(e){return De(`num < 2^`+l,e,B,T),s.toBytes(e)}function ee(e,t){return k(e,void 0,`message`),t?k(r(e),void 0,`prehashed message`):e}function te(t,n,r){let{lowS:a,prehash:o,extraEntropy:c}=St(r,g);t=ee(t,o);let l=w(t),u=s.fromBytes(n);if(!s.isValidNot0(u))throw Error(`invalid private key`);let d=[E(u),E(l)];if(c!=null&&c!==!1){let e=c===!0?i(h.secretKey):c;d.push(k(e,void 0,`extraEntropy`))}let f=A(...d),p=l;function m(t){let n=C(t);if(!s.isValidNot0(n))return;let r=s.inv(n),i=e.BASE.multiply(n).toAffine(),o=s.create(i.x);if(o===B)return;let c=s.create(r*s.create(p+o*u));if(c===B)return;let l=(i.x===o?0:2)|Number(i.y&V),d=c;return a&&v(c)&&(d=s.neg(c),l^=1),new S(o,d,_?void 0:l)}return{seed:f,k2sig:m}}function ne(e,t,n={}){let{seed:i,k2sig:o}=te(e,t,n);return Ae(r.outputLen,s.BYTES,a)(i,o).toBytes(n.format)}function re(t,n,r,i={}){let{lowS:a,prehash:o,format:c}=St(i,g);if(r=k(r,void 0,`publicKey`),n=ee(n,o),!fe(t)){let e=t instanceof S?`, use sig.toBytes()`:``;throw Error(`verify expects Uint8Array signature`+e)}x(t,c);try{let i=S.fromBytes(t,c),o=e.fromBytes(r);if(a&&i.hasHighS())return!1;let{r:l,s:u}=i,d=w(n),f=s.inv(u),p=s.create(d*f),m=s.create(l*f),h=e.BASE.multiplyUnsafe(p).add(o.multiplyUnsafe(m));return!h.is0()&&s.create(h.x)===l}catch{return!1}}function ie(e,t,n={}){let{prehash:r}=St(n,g);return t=ee(t,r),S.fromBytes(e,`recovered`).recoverPublicKey(t).toBytes()}return Object.freeze({keygen:u,getPublicKey:d,getSharedSecret:f,utils:m,lengths:h,Point:e,sign:ne,verify:re,recoverPublicKey:ie,Signature:S,hash:r})}
|
|
10
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
11
|
-
const H=At(Et({p:BigInt(`0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff`),n:BigInt(`0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551`),h:BigInt(1),a:BigInt(`0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc`),b:BigInt(`0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b`),Gx:BigInt(`0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296`),Gy:BigInt(`0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5`)}),ce),jt=`pkcs8`,Mt=jt,Nt=`spki`;function U(){let e=globalThis?.crypto?.subtle;if(typeof e==`object`&&e)return e;throw Error(`crypto.subtle must be defined`)}function Pt(e,t){return async function(n){let r=await e();return{secretKey:r,publicKey:await t(r)}}}function Ft(e){let t=e.match(/[0-9a-f]{2}/gi);if(!t||t.length*2!==e.length)throw Error(`invalid hex`);return Uint8Array.from(t,e=>Number.parseInt(e,16))}function It(e,t){if(t.type!==e)throw Error(`invalid key type, expected ${e}`)}function Lt(e,t,n,r){let i=t?[`deriveBits`]:[`sign`],a=t?[]:[`verify`],o=(e,t)=>t===`jwk`?e:new Uint8Array(e),s={async import(t,n){let r=await U().importKey(n,t,e,!0,a);return It(`public`,r),r},async export(e,t){It(`public`,e);let n=await U().exportKey(t,e);return o(n,t)},async convert(e,t,n){return s.export(await s.import(e,t),n)}},c={async import(n,a){let o=U(),s;if(a===`raw`){let t=n,a=Ft(r),c=new Uint8Array(a.length+t.length);c.set(a,0),c.set(t,a.length),s=await o.importKey(jt,c,e,!0,i)}else t&&a===`jwk`&&(n={...n,key_ops:i}),s=await o.importKey(a,n,e,!0,i);return It(`private`,s),s},async export(e,t){let r=U();if(It(`private`,e),t===`raw`){let t=(await r.exportKey(`jwk`,e)).d.replace(/-/g,`+`).replace(/_/g,`/`),i=t.length%4?`=`.repeat(4-t.length%4):``,a=atob(t+i),o=Uint8Array.from(a,e=>e.charCodeAt(0)),s=new Uint8Array(n);return s.set(o,n-o.length),s}let i=await r.exportKey(t,e);return o(i,t)},async convert(e,t,n){return c.export(await c.import(e,t),n)}};async function l(e,t={}){let n=t.formatSec??Mt,r=t.formatPub??Nt,i=n===`jwk`?{...e}:await c.convert(e,n,`jwk`);return delete i.d,i.key_ops=a,r===`jwk`?i:s.convert(i,`jwk`,r)}async function u(t=Mt){let n=await U().generateKey(e,!0,i);return c.export(n.privateKey,t)}let d;return{pub:s,priv:c,async isSupported(){if(d!==void 0)return d;try{let n=U(),r=await n.generateKey(e,!0,i);return await c.export(r.privateKey,`jwk`),t&&await n.deriveBits({name:typeof e==`string`?e:e.name,public:r.publicKey},r.privateKey,8),d=!0}catch{return d=!1}},getPublicKey:l,keygen:Pt(u,l),utils:Object.freeze({randomSecretKey:u,convertPublicKey:s.convert,convertSecretKey:c.convert})}}function Rt(e,t){return{async sign(n,r,i={}){let a=await e.priv.import(r,i.formatSec??Mt),o=await U().sign(t,a,n);return new Uint8Array(o)},async verify(n,r,i,a={}){let o=await e.pub.import(i,a.formatPub??Nt);return await U().verify(t,o,n,r)}}}function zt(e,t,n){return{async getSharedSecret(r,i,a={}){let o=await e.priv.import(r,a.formatSec===void 0?Mt:a.formatSec),s=await e.pub.import(i,a.formatPub===void 0?Nt:a.formatPub),c=await U().deriveBits({name:typeof t==`string`?t:t.name,public:s},o,8*n);return new Uint8Array(c)}}}function Bt(e,t,n,r){let i={name:`ECDH`,namedCurve:e},a=Lt({name:`ECDSA`,namedCurve:e},!1,n,r),o=Lt(i,!0,n,r);return Object.freeze({name:e,isSupported:a.isSupported,getPublicKey:a.getPublicKey,keygen:Pt(a.utils.randomSecretKey,a.getPublicKey),...Rt(a,{name:`ECDSA`,hash:{name:t}}),...zt(o,i,n),utils:Object.freeze({...a.utils,async convertSecretKey(e,t,n){let r=t===`jwk`?e:void 0;return Array.isArray(r?.key_ops)&&r.key_ops.length===1&&r.key_ops[0]===`deriveBits`?o.utils.convertSecretKey(e,t,n):a.utils.convertSecretKey(e,t,n)}})})}const Vt=Bt(`P-256`,`SHA-256`,32,`3041020100301306072a8648ce3d020106082a8648ce3d030107042730250201010420`),Ht={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006,userRejected:-32007};var Ut=class extends Error{code;data;constructor(e,t,n){super(t),this.code=e,this.data=n}toJSON(){return{code:this.code,message:this.message,data:this.data}}},Wt=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve=e=>{this._resolve?.(e)};reject=e=>{this._reject?.(e)}};function Gt(e){let{emittingTransport:t,listeningTransport:n,targetOrigin:r,middleware:i=[],lifecycleHandlers:a}=e,o=new Map;function s(e){return typeof e!=`object`||!e?!1:`clientLifecycle`in e||`iframeLifecycle`in e}function c(e){return typeof e!=`object`||!e?!1:`id`in e&&`topic`in e&&`data`in e}async function l(e){try{`clientLifecycle`in e&&a?.clientLifecycle?await a.clientLifecycle(e,{origin:r,source:null}):`iframeLifecycle`in e&&a?.iframeLifecycle&&await a.iframeLifecycle(e,{origin:r,source:null})}catch(e){console.error(`[RPC Client] Lifecycle handler error:`,e)}}async function u(e){let t={origin:r,source:null};for(let n of i)n.onRequest&&await n.onRequest(e,t);return e}async function d(e,t){let n={origin:r,source:null},a=t;for(let t of i)t.onResponse&&(a=await t.onResponse(e,a,n));return a}async function f(e){try{let t=new URL(e.origin).origin.toLowerCase(),n=new URL(r).origin.toLowerCase();if(t!==n){console.log(`Not expected origin`,t,n);return}}catch(e){console.error(`[RPC Client] Invalid origin`,e);return}if(s(e.data)){await l(e.data);return}if(!c(e.data))return;let t;try{let n=e.data.data,r=n instanceof Uint8Array||ArrayBuffer.isView(n)?{result:n}:n;t=await d(e.data,r)}catch(e){console.error(`[RPC Client] Middleware error on response:`,e);return}let n=o.get(e.data.id);n&&n(t)}async function p(e){let n=e;try{n=await u(e)}catch(e){throw console.error(`[RPC Client] Middleware error on request:`,e),e}t.postMessage(n,r)}function m(e){t.postMessage(e,r)}function h(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}n.addEventListener(`message`,f);function g(e){let t=h(),n=new Wt;return o.set(t,e=>{e.error?n.reject(new Ut(e.error.code,e.error.message,e.error.data)):n.resolve(e.result),o.delete(t)}),p({id:t,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{o.delete(t),n.reject(e)}),n.promise}function _(e,t){let n=h();return o.set(n,e=>{e.error?(console.error(`[RPC Client] Listener error:`,e.error),o.delete(n)):t(e.result)}),p({id:n,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{console.error(`[RPC Client] Failed to send listener request:`,e),o.delete(n)}),()=>{o.delete(n)}}function v(){n.removeEventListener(`message`,f),o.clear()}return{request:g,listen:_,sendLifecycle:m,cleanup:v}}function Kt(e){return new TextEncoder().encode(JSON.stringify(e))}function qt(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}const Jt=`https://backend.frak.id`;function Yt(e){return e.includes(`localhost:3000`)||e.includes(`localhost:3010`)}function Xt(e){return Yt(e)?`https://localhost:3030`:e.includes(`wallet-dev.frak.id`)||e.includes(`wallet.gcp-dev.frak.id`)?`https://backend.gcp-dev.frak.id`:Jt}function Zt(e){if(e)return Xt(e);if(typeof window<`u`){let e=window.FrakSetup?.client?.config?.walletUrl;if(e)return Xt(e)}return Jt}var Qt=class extends Map{maxSize;constructor(e){super(),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;e!==void 0&&super.delete(e)}return this}};let W;function $t(){return W||={promiseCache:new Qt(1024),responseCache:new Qt(1024),failureCache:new Qt(1024)},W}async function en(e,{cacheKey:t,cacheTime:n=3e4}){let{promiseCache:r,responseCache:i,failureCache:a}=$t();if(n>0){let e=i.get(t);if(e&&Date.now()-e.created<n)return e.data}let o=a.get(t);if(o&&Date.now()-o<1e3)throw Error(`Cache: ${t} recently failed, backing off`);let s=r.get(t);s||(s=e(),r.set(t,s));try{let e=await s;return i.set(t,{data:e,created:Date.now()}),a.delete(t),e}catch(e){throw a.set(t,Date.now()),e}finally{r.delete(t)}}function tn(){W&&(W.promiseCache.clear(),W.responseCache.clear(),W.failureCache.clear())}const G=`__frakSdkConfig`,nn=`frak-config-cache`,rn=`frak-merchant-id`,an={key:nn},K=typeof window<`u`;function on(){return{isResolved:!1,merchantId:``}}let q=null;function sn(){if(!K)return null;try{let e=localStorage.getItem(an.key);if(!e)return null;let t=JSON.parse(e);return t.config?.isResolved?(q=t,t):null}catch{return null}}function cn(){return(q??sn())?.config}function ln(){let e=q??sn();return e?Date.now()-e.timestamp<3e4:!1}function un(e){if(!(!K||!e.isResolved))try{let t={config:e,timestamp:Date.now()};localStorage.setItem(an.key,JSON.stringify(t)),q=t}catch{}}function dn(){if(K){q=null;try{localStorage.removeItem(an.key)}catch{}}}function fn(){K&&(window[G]||(window[G]=cn()??on()))}function pn(){return K?(fn(),window[G]??on()):on()}function mn(e){K&&window.dispatchEvent(new CustomEvent(`frak:config`,{detail:e}))}function hn(e){return e??(K?window.location.hostname:``)}async function gn(e,t,n){try{let r=Zt(t),i=n?`&lang=${encodeURIComponent(n)}`:``,a=await fetch(`${r}/user/merchant/resolve?domain=${encodeURIComponent(e)}${i}`);if(!a.ok){console.warn(`[Frak SDK] Merchant lookup failed for domain ${e}: ${a.status}`);return}let o=await a.json();if(K)try{sessionStorage.setItem(rn,o.merchantId)}catch{}return o}catch(e){console.warn(`[Frak SDK] Failed to fetch merchant config:`,e);return}}const J={getConfig:pn,get isResolved(){return pn().isResolved},get isCacheFresh(){return ln()},setCacheScope(e,t){let n=`${e}:${t??``}`;an.key=`${nn}:${n}`,q=null},setConfig(e){if(K&&(window[G]=e),un(e),mn(e),K&&e.merchantId)try{sessionStorage.setItem(rn,e.merchantId)}catch{}},reset(){let e=cn()??on();K&&(window[G]=e),mn(e)},clearCache(){if(dn(),tn(),K)try{sessionStorage.removeItem(rn)}catch{}},resolve(e,t,n){let r=hn(e);return r?en(async()=>{let e=await gn(r,t,n);if(!e)throw Error(`Config resolution returned empty`);return e},{cacheKey:`sdkConfig:${r}:${n??``}`,cacheTime:1/0}).catch(()=>void 0):Promise.resolve(void 0)},getMerchantId(){let e=pn();if(e.isResolved&&e.merchantId)return e.merchantId;if(K)try{return sessionStorage.getItem(rn)??void 0}catch{}},async resolveMerchantId(e,t){return J.getMerchantId()||(await J.resolve(e,t))?.merchantId}};async function _n(e){return a(ce(e))}const vn=`frak-client-id`,yn=`frak-client-key`,bn=`frak-client-id-legacy`,xn={formatSec:`raw`,formatPub:`raw`};let Sn=null;function Cn(){return Sn??=Vt.isSupported().then(e=>e?Vt:H).catch(()=>H),Sn}const wn=()=>typeof window<`u`&&!!window.localStorage;let Tn=null;function En(e){let t=o(e);if(Tn?.keyHex===t)return Tn.publicKey;let n=H.getPublicKey(e,!1);return Tn={keyHex:t,publicKey:n},n}function Dn(){if(wn())return localStorage.getItem(bn)??void 0}function On(){wn()&&localStorage.removeItem(bn)}function kn(){let e=localStorage.getItem(yn);if(!e)return null;if(!/^[0-9a-f]{64}$/i.test(e))throw Error(`[Frak SDK] Corrupt client key`);return s(e)}async function An(){if(!wn())throw Error(`[Frak SDK] No window/localStorage available to derive a client id`);if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`[Frak SDK] crypto.getRandomValues unavailable, cannot derive a client id`);let e=localStorage.getItem(vn);try{let t=kn(),n=t??H.utils.randomSecretKey(),r=await _n(En(n));if(t){e!==r&&localStorage.setItem(vn,r);let t=Dn();return{clientId:r,...t&&{pendingLegacyId:t}}}return e&&localStorage.setItem(bn,e),localStorage.setItem(yn,o(n)),localStorage.setItem(vn,r),{clientId:r,...e&&{pendingLegacyId:e}}}catch(e){throw localStorage.removeItem(yn),Tn=null,e}}async function Y(e){if(!wn())return null;try{let t=kn();if(!t)return null;let n=e.ts??Math.floor(Date.now()/1e3),r=i({op:e.op,merchantId:e.merchantId,anonymousId:e.anonymousId,binding:e.binding??new Uint8Array,ts:n}),a=await Cn()===Vt?await Vt.sign(r,t,xn):H.sign(r,t,{prehash:!0});return l({v:1,pk:En(t),ts:n,sig:a})}catch{return null}}async function jn({legacyId:e,derivedId:t,walletUrl:n}){if(!(typeof window>`u`)){if(!e||e===t){On();return}try{let r=await J.resolveMerchantId();if(!r)return;let i=await Y({op:`frak-merge-v1`,merchantId:r,anonymousId:t});if(!i)return;let a=Zt(n),o=await fetch(`${a}/user/identity/merge/initiate`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({sourceAnonymousId:t,merchantId:r,proof:i})});if(!o.ok){o.status<500&&On();return}let{mergeToken:s}=await o.json();if(!s)return;let c=await fetch(`${a}/user/identity/merge/execute`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({mergeToken:s,targetAnonymousId:e,merchantId:r})});if(c.ok){On();return}c.status<500&&On()}catch{}}}let X=null,Mn=null;async function Nn(e){return X||Mn||(Mn=An().then(({clientId:t,pendingLegacyId:n})=>(X=t,n&&jn({legacyId:n,derivedId:t,walletUrl:e}),t)),Mn)}function Pn(){if(X)return X;Nn().catch(()=>{})}async function Fn(){return X||Nn()}function Z(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function In(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(e.length+(t===0?0:4-t),`=`)),e=>e.charCodeAt(0))}function Ln(e){return Z(Kt(e))}function Rn(e,t,n,r,i,a,o){let s=Ln(zn({redirectUrl:t.redirectUrl,directExit:t.directExit,lang:t.lang,merchantId:n,metadata:{name:r,css:a,logoUrl:t.metadata?.logoUrl,homepageLink:t.metadata?.homepageLink},clientId:i,proof:o})),c=new URL(e);return c.pathname=`/sso`,c.searchParams.set(`p`,s),c.toString()}function zn(e){return{r:e.redirectUrl,cId:e.clientId,d:e.directExit,l:e.lang,m:e.merchantId,md:{n:e.metadata?.name,css:e.metadata?.css,l:e.metadata?.logoUrl,h:e.metadata?.homepageLink},pf:e.proof}}function Bn(e){return{...e,directExit:e.directExit??!e.redirectUrl}}async function Vn(e,t){let{metadata:n,customizations:r,walletUrl:i}=e.config,a=Pn()??await Fn().catch(()=>void 0),o=await J.resolveMerchantId()??``,s=a&&o?await Y({op:`frak-sso-v1`,merchantId:o,anonymousId:a}):null;return{ssoUrl:Rn(i??`https://wallet.frak.id`,Bn(t),o,n.name,a,r?.css,s??void 0)}}const Hn=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,Un=`frak-sso`;async function Wn(e,t){let{metadata:n,customizations:r}=e.config;if(`ssoUrl`in t)return Gn(t.ssoUrl),await e.request({method:`frak_openSso`,params:[{},n.name,r?.css]})??{};let i=Bn(t);return i.openInSameWindow??!!i.redirectUrl?await e.request({method:`frak_openSso`,params:[i,n.name,r?.css]}):(Gn(i.ssoPopupUrl??(await Vn(e,i)).ssoUrl),await e.request({method:`frak_openSso`,params:[i,n.name,r?.css]})??{})}function Gn(e){let t=window.open(e,Un,Hn);if(!t)throw Error(`Popup was blocked. Please allow popups for this site.`);t.focus()}function Kn(e,t,n){if(!e){console.debug(`[Frak] No client provided, skipping event tracking`);return}try{e.openPanel?.track(t,n)}catch(e){console.debug(`[Frak] Failed to track event:`,t,e)}}function qn(e,t){let n=e.get(t);if(n!==null)return n;let r=t.toLowerCase();for(let[t,n]of e)if(t.toLowerCase()===r)return n;return null}function Jn(e,t){let n=t.toLowerCase(),r=[...e.keys()].filter(e=>e.toLowerCase()===n);for(let t of r)e.delete(t)}const Yn=/^0x[a-fA-F0-9]{40}$/;function Xn(e){return typeof e==`string`&&Yn.test(e)}function Zn(e,t){return e.toLowerCase()===t.toLowerCase()}function Qn(e){let t=new Uint8Array(20);for(let n=0;n<20;n++){let r=Number.parseInt(e.substring(2+n*2,4+n*2),16);if(Number.isNaN(r))throw Error(`Invalid address: ${e}`);t[n]=r}return t}const $n=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function er(e){let t=`0x`;for(let n=0;n<20;n++)t+=$n[e[n]];return t}function tr(e){return`r`in e&&!(`v`in e)}function nr(e){return`v`in e&&e.v===2}const rr=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ir(e){return typeof e==`string`&&rr.test(e)}function ar(e){let t=e.replace(/-/g,``),n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=Number.parseInt(t.substring(e*2,e*2+2),16);return n}function or(e){let t=``;for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,`0`);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20,32)}`}function sr(e){if(!ir(e.m)||!Number.isInteger(e.t)||e.t<0||e.t>4294967295)return null;let t=typeof e.c==`string`&&e.c.length>0,n=typeof e.w==`string`&&Xn(e.w);if(!t&&!n||t&&!ir(e.c))return null;let r=new Uint8Array(21+(t?16:0)+(n?20:0)),i=new DataView(r.buffer,r.byteOffset,r.byteLength),a=0;return r[a++]=2|(t?16:0)|(n?32:0),r.set(ar(e.m),a),a+=16,i.setUint32(a,e.t,!1),a+=4,t&&(r.set(ar(e.c),a),a+=16),n&&(r.set(Qn(e.w),a),a+=20),r}function cr(e){if(e.length<21)return null;let t=e[0];if((t&15)!=2||t&192)return null;let n=(t&16)!=0,r=(t&32)!=0;if(!n&&!r)return null;let i=21+(n?16:0)+(r?20:0);if(e.length!==i)return null;let a=1,o=or(e.subarray(a,a+16));a+=16;let s=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(a,!1);a+=4;let c={v:2,m:o,t:s};if(n&&(c.c=or(e.subarray(a,a+16)),a+=16),r){let t=er(e.subarray(a,a+20));if(!Xn(t))return null;c.w=t,a+=20}return c}const lr=`fCtx`;function ur(e){if(e)try{if(nr(e)){let t=sr(e);return t?Z(t):void 0}return Z(Qn(e.r))}catch(t){console.error(`Error compressing Frak context`,{e:t,context:e})}}function dr(e){if(!(!e||e.length===0))try{let t=In(e);if(t.length!==20)return cr(t)||void 0;let n=er(t);if(Xn(n))return{r:n}}catch(t){console.error(`Error decompressing Frak context`,{e:t,context:e})}}function fr({url:e}){if(!e)return null;let t=qn(new URL(e).searchParams,lr);return t?dr(t):null}function pr(e){return{utm_source:e.utmSource??`frak`,utm_medium:e.utmMedium??void 0,utm_campaign:e.utmCampaign??void 0,utm_content:e.utmContent,utm_term:e.utmTerm,via:e.via??void 0,ref:e.ref??void 0}}function mr(e,t){let n=pr(t??{});for(let[t,r]of Object.entries(n))r!==void 0&&r!==``&&(e.searchParams.has(t)||e.searchParams.set(t,r))}function hr({url:e,context:t,attribution:n}){if(!e)return null;let r=ur(t);if(!r)return null;let i=new URL(e);return Jn(i.searchParams,lr),i.searchParams.set(lr,r),mr(i,n),i.toString()}function gr(e){let t=new URL(e);return Jn(t.searchParams,lr),t.toString()}function _r({url:e,context:t}){if(!window.location?.href||typeof window>`u`){console.error(`No window found, can't update context`);return}let n=e??window.location.href,r;r=t===null?gr(n):hr({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}const vr={compress:ur,decompress:dr,parse:fr,update:hr,remove:gr,replaceUrl:_r},yr={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function br(e){return e&&e in yr?e:`eur`}function xr(e){return e?yr[e]??yr.eur:yr.eur}function Sr(e,t){let n=xr(t),r=br(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function Cr(e){return e?`${e}Amount`:`eurAmount`}var wr=class{constructor(e){this.baseUrl=e.baseUrl,this.headers={"Content-Type":`application/json`,...e.defaultHeaders},this.maxRetries=e.maxRetries??3,this.initialRetryDelay=e.initialRetryDelay??500}async resolveHeaders(){let e={};for(let[t,n]of Object.entries(this.headers)){let r=await n;r!==null&&(e[t]=r)}return e}addHeader(e,t){this.headers[e]=t}async post(e,t,n,r){try{let r=await fetch(e,{method:`POST`,headers:await this.resolveHeaders(),body:t?JSON.stringify(t??{}):void 0,keepalive:!0,...n});if(r.status===401)return null;if(r.status!==200&&r.status!==202)throw Error(`HTTP error! status: ${r.status}`);let i=await r.text();return i?JSON.parse(i):null}catch(i){if(r<this.maxRetries){let i=this.initialRetryDelay*2**r;return await new Promise(e=>setTimeout(e,i)),this.post(e,t,n,r+1)}return console.error(`Max retries reached:`,i),null}}async fetch(e,t,n={}){let r=`${this.baseUrl}${e}`;return this.post(r,t,n,0)}},Tr=class{constructor(e){this.groups=[],this.queue=[],this.options=e;let t={"openpanel-client-id":e.clientId};e.clientSecret&&(t[`openpanel-client-secret`]=e.clientSecret),t[`openpanel-sdk-name`]=e.sdk||`node`,t[`openpanel-sdk-version`]=e.sdkVersion||`1.3.1`,this.api=new wr({baseUrl:e.apiUrl||`https://api.openpanel.dev`,defaultHeaders:t})}init(){}ready(){this.options.disabled=!1,this.options.waitForProfile=!1,this.flush()}shouldQueue(e){return!!(this.options.disabled||this.options.waitForProfile&&!this.profileId||e.type===`replay`&&!this.sessionId)}addQueue(e){e.type===`track`&&(e.payload.properties={...e.payload.properties??{},__timestamp:new Date().toISOString()}),this.queue.push(e)}async send(e){if(this.options.filter&&!this.options.filter(e))return Promise.resolve();if(this.shouldQueue(e))return this.addQueue(e),Promise.resolve();let t=await this.api.fetch(`/track`,e,{keepalive:e.type!==`replay`});this.deviceId=t?.deviceId;let n=!!this.sessionId;return this.sessionId=t?.sessionId,!n&&this.sessionId&&this.flush(),t}setGlobalProperties(e){this.global={...this.global,...e}}track(e,t){this.log(`track event`,e,t);let{groups:n,profileId:r,...i}=t??{},a=[...new Set([...this.groups,...n??[]])];return this.send({type:`track`,payload:{name:e,profileId:r??this.profileId,groups:a.length>0?a:void 0,properties:{...this.global??{},...i}}})}identify(e){if(this.log(`identify user`,e),e.profileId&&(this.profileId=e.profileId,this.flush()),e.profileId&&Object.keys(e).length>1)return this.send({type:`identify`,payload:{...e,properties:{...this.global,...e.properties}}})}upsertGroup(e){return this.log(`upsert group`,e),this.send({type:`group`,payload:e})}setGroup(e){return this.log(`set group`,e),this.groups.includes(e)||(this.groups=[...this.groups,e]),this.send({type:`assign_group`,payload:{groupIds:[e],profileId:this.profileId}})}setGroups(e){return this.log(`set groups`,e),this.groups=[...new Set([...this.groups,...e])],this.send({type:`assign_group`,payload:{groupIds:e,profileId:this.profileId}})}alias(e){}increment(e){return this.send({type:`increment`,payload:e})}decrement(e){return this.send({type:`decrement`,payload:e})}revenue(e,t){let n=t?.deviceId;return delete t?.deviceId,this.track(`revenue`,{...t??{},...n?{__deviceId:n}:{},__revenue:e})}getDeviceId(){return this.deviceId??``}getSessionId(){return this.sessionId??``}fetchDeviceId(){return Promise.resolve(this.deviceId??``)}clear(){this.profileId=void 0,this.groups=[],this.deviceId=void 0,this.sessionId=void 0}buildFlushPayload(e){if(e.type===`replay`)return e.payload;if(e.type===`track`){let t=`groups`in e.payload?e.payload.groups??[]:[],n=[...new Set([...this.groups,...t])];return{...e.payload,profileId:e.payload.profileId??this.profileId,groups:n.length>0?n:void 0}}return e.type===`identify`||e.type===`increment`||e.type===`decrement`||e.type===`assign_group`?{...e.payload,profileId:e.payload.profileId??this.profileId}:e.payload}flush(){let e=[];for(let t of this.queue){if(this.shouldQueue(t)){e.push(t);continue}let n=this.buildFlushPayload(t);this.send({...t,payload:n})}this.queue=e}log(...e){this.options.debug&&console.log(`[OpenPanel.dev]`,...e)}},Er=typeof document<`u`?document.currentScript:null;function Dr(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var Or=class extends Tr{constructor(e){if(super({sdk:`web`,sdkVersion:`1.4.1`,...e}),this.options=e,this.lastPath=``,this.pendingRevenues=[],!this.isServer()){try{let e=sessionStorage.getItem(`openpanel-pending-revenues`);if(e){let t=JSON.parse(e);Array.isArray(t)&&(this.pendingRevenues=t)}}catch{this.pendingRevenues=[]}if(this.setGlobalProperties({__referrer:document.referrer}),this.options.trackScreenViews&&(this.trackScreenViews(),setTimeout(()=>this.screenView(),0)),this.options.trackOutgoingLinks&&this.trackOutgoingLinks(),this.options.trackAttributes&&this.trackAttributes(),this.options.sessionReplay?.enabled){let e=this.options.sessionReplay.sampleRate??1;Math.random()<e&&this.loadReplayModule().then(e=>{e&&e.startReplayRecorder(this.options.sessionReplay,e=>{this.send({type:`replay`,payload:{...e}})})})}}}async loadReplayModule(){try{if(typeof __OPENPANEL_REPLAY_URL__<`u`){let e=Er,t=this.options.sessionReplay?.scriptUrl||e?.src?.replace(`.js`,`-replay.js`)||`https://openpanel.dev/op1-replay.js`;return window.__openpanel_replay?window.__openpanel_replay:new Promise(e=>{let n=document.createElement(`script`);n.src=t,n.onload=()=>{e(window.__openpanel_replay??null)},n.onerror=()=>{console.warn(`[OpenPanel] Failed to load replay script from`,t),e(null)},document.head.appendChild(n)})}return await import(`./replay-V6FXES7X.CgBxdfNp.js`)}catch(e){return console.warn(`[OpenPanel] Failed to load replay module`,e),null}}debounce(e,t){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(e,t)}isServer(){return typeof document>`u`}trackOutgoingLinks(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`a`);if(n&&t){let e=n.getAttribute(`href`);if(e?.startsWith(`http`))try{let r=new URL(e),i=window.location.hostname;r.hostname!==i&&super.track(`link_out`,{href:e,text:n.innerText||n.getAttribute(`title`)||t.getAttribute(`alt`)||t.getAttribute(`title`)})}catch{}}})}trackScreenViews(){if(this.isServer())return;let e=history.pushState;history.pushState=function(...t){let n=e.apply(this,t);return window.dispatchEvent(new Event(`pushstate`)),window.dispatchEvent(new Event(`locationchange`)),n};let t=history.replaceState;history.replaceState=function(...e){let n=t.apply(this,e);return window.dispatchEvent(new Event(`replacestate`)),window.dispatchEvent(new Event(`locationchange`)),n},window.addEventListener(`popstate`,()=>{window.dispatchEvent(new Event(`locationchange`))});let n=()=>this.debounce(()=>this.screenView(),50);this.options.trackHashChanges?window.addEventListener(`hashchange`,n):window.addEventListener(`locationchange`,n)}trackAttributes(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`button`),r=t.closest(`a`),i=n?.getAttribute(`data-track`)?n:r?.getAttribute(`data-track`)?r:null;if(i){let e={};for(let t of i.attributes)t.name.startsWith(`data-`)&&t.name!==`data-track`&&(e[Dr(t.name.replace(/^data-/,``))]=t.value);let t=i.getAttribute(`data-track`);t&&super.track(t,e)}})}track(e,t){return super.track(e,{...t,__path:this.lastPath})}screenView(e,t){if(this.isServer())return;let n,r;typeof e==`string`?(n=e,r=t):(n=window.location.href,r=e),this.lastPath!==n&&(this.lastPath=n,super.track(`screen_view`,{...r??{},__path:n,__title:document.title}))}async flushRevenue(){let e=this.pendingRevenues.map(e=>super.revenue(e.amount,e.properties));await Promise.all(e),this.clearRevenue()}clearRevenue(){if(this.pendingRevenues=[],!this.isServer())try{sessionStorage.removeItem(`openpanel-pending-revenues`)}catch{}}pendingRevenue(e,t){if(this.pendingRevenues.push({amount:e,properties:t}),!this.isServer())try{sessionStorage.setItem(`openpanel-pending-revenues`,JSON.stringify(this.pendingRevenues))}catch{}}};const kr=`nexus-wallet-backup`,Ar=`frakwallet://`;function jr(e){let t=e?.split(`-`)[0]?.toLowerCase();return t===`en`||t===`fr`?t:void 0}function Mr(){return(typeof document<`u`?jr(document.documentElement.lang):void 0)||(typeof navigator<`u`?jr(navigator.language):void 0)}function Nr(e,t){if(typeof window>`u`)return;let n=new URL(window.location.href),r=n.searchParams.get(`sso`);r&&(t.then(()=>{e.sendLifecycle({clientLifecycle:`sso-redirect-complete`,data:{compressed:r}}),console.log(`[SSO URL Listener] Forwarded compressed SSO data to iframe`)}).catch(e=>{console.error(`[SSO URL Listener] Failed to forward SSO data:`,e)}),n.searchParams.delete(`sso`),window.history.replaceState({},``,n.toString()),console.log(`[SSO URL Listener] SSO parameter detected and URL cleaned`))}function Pr(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}const Fr=Ar.replace(`://`,``);function Ir(e){return`intent://${e.slice(13)}#Intent;scheme=${Fr};end`}function Lr(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=Pr()&&Rr(e)?Ir(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function Rr(e){return e.startsWith(Ar)}function zr(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent;return!!(/iPhone|iPad|iPod/i.test(e)||/Macintosh/i.test(e)&&navigator.maxTouchPoints>1)}const Q=zr();function Br(){return typeof navigator>`u`?!1:Q?!0:/Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function Vr(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase();return e.includes(`instagram`)||e.includes(`fban`)||e.includes(`fbav`)||e.includes(`facebook`)}const Hr=Vr();function Ur(e){Q&&e.startsWith(`https://`)?window.location.href=`x-safari-https://${e.slice(8)}`:Q&&e.startsWith(`http://`)?window.location.href=`x-safari-http://${e.slice(7)}`:window.location.href=`https://backend.frak.id/common/social?u=${encodeURIComponent(e)}`}const $={id:`frak-wallet`,name:`frak-wallet`,title:`Frak Wallet`,allow:`publickey-credentials-get *; clipboard-write; web-share *`,style:{width:`0`,height:`0`,border:`0`,position:`absolute`,zIndex:2000001,top:`-1000px`,left:`-1000px`,colorScheme:`auto`}};async function Wr({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);r.id=$.id,r.name=$.name,r.allow=$.allow,r.style.zIndex=$.style.zIndex.toString(),Kr({iframe:r,isVisible:!1});let i=t?.walletUrl??e??`https://wallet.frak.id`,a=await Nn(i).catch(e=>{console.warn(`[Frak SDK] Unable to derive a client id`,e)});return Jr(i),Jr(Zt(i)),r.src=Gr({walletUrl:i,clientId:a,preload:t?.preload}),new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function Gr({walletUrl:e,clientId:t,preload:n}){let r=t?`${e}/listener?clientId=${encodeURIComponent(t)}`:`${e}/listener`;return!n||n.length===0?r:`${r}#preload=${n.join(`,`)}`}function Kr({iframe:e,isVisible:t}){if(!t){e.style.width=`0`,e.style.height=`0`,e.style.border=`0`,e.style.position=`fixed`,e.style.top=`-1000px`,e.style.left=`-1000px`;return}e.style.position=`fixed`,e.style.top=`0`,e.style.left=`0`,e.style.width=`100%`,e.style.height=`100%`,e.style.pointerEvents=`auto`}function qr(e=`/listener`){if(!window.opener)return null;let t=t=>{try{return t.location.origin===window.location.origin&&t.location.pathname===e}catch{return!1}};if(t(window.opener))return window.opener;try{let e=window.opener.frames;for(let n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}catch(t){return console.error(`[findIframeInOpener] Error finding iframe with pathname ${e}:`,t),null}}function Jr(e){if(!(typeof document>`u`))try{let t=new URL(e).origin,n=`link[rel="preconnect"][data-frak-preconnect="${t}"]`;if(document.head.querySelector(n))return;let r=document.createElement(`link`);r.rel=`preconnect`,r.href=t,r.crossOrigin=``,r.dataset.frakPreconnect=t,document.head.appendChild(r)}catch{}}const Yr=Q&&Hr;function Xr(e){e?localStorage.setItem(kr,e):localStorage.removeItem(kr)}function Zr(e,t){try{let n=new URL(e);if(!n.searchParams.has(`u`))return e;let r=ei(window.location.href,t);return n.searchParams.delete(`u`),n.searchParams.append(`u`,r),n.toString()}catch{return e}}function Qr(e){let t=new URL(window.location.href);e&&t.searchParams.set(`fmt`,e);let n=t.protocol===`http:`?`x-safari-http`:`x-safari-https`;window.location.href=`${n}://${t.host}${t.pathname}${t.search}${t.hash}`}function $r(e){return e.includes(`/common/social`)}function ei(e,t){if(!t)return e;try{let n=new URL(e);return n.searchParams.set(`fmt`,t),n.toString()}catch{return`${e}${e.includes(`?`)?`&`:`?`}fmt=${encodeURIComponent(t)}`}}function ti(e,t,n,r,i){if(i){let e=Zr(t,r);window.open(e,`_blank`);return}if(Rr(t)){let i=Zr(t,r);Lr(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(Yr&&$r(t))Qr(r);else{let e=Zr(t,r);window.location.href=e}}function ni({iframe:e,targetOrigin:t}){let n=new Wt;return{handleEvent:r=>{if(!(`iframeLifecycle`in r))return;let{iframeLifecycle:i,data:a}=r;switch(i){case`connected`:n.resolve(!0);break;case`do-backup`:Xr(a.backup);break;case`remove-backup`:localStorage.removeItem(kr);break;case`show`:case`hide`:Kr({iframe:e,isVisible:i===`show`});break;case`redirect`:ti(e,a.baseRedirectUrl,t,a.mergeToken,a.openInNewTab);break}},isConnected:n.promise}}async function ri({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=e.metadata.lang??Mr(),i=e.domain??(typeof window<`u`?window.location.hostname:``);J.setCacheScope(i,r),J.reset();let a=J.isCacheFresh?void 0:J.resolve(e.domain,e.walletUrl,r),o=await Fn().catch(()=>void 0),s=ni({iframe:t,targetOrigin:n}),c=new Wt,l=Date.now();if(!t.contentWindow)throw new Ut(Ht.configError,`The iframe does not have a content window`);let u=Gt({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await s.isConnected)throw new Ut(Ht.clientNotConnected,`The iframe provider isn't connected yet`);return await c.promise,t}}],lifecycleHandlers:{iframeLifecycle:(e,t)=>{s.handleEvent(e)}}}),d=ii(u,s),f=async()=>{d(),u.cleanup(),t.remove(),tn(),J.clearCache(),J.reset()},p;{console.log(`[Frak SDK] Initializing OpenPanel`),p=new Or({apiUrl:`https://op-api.gcp.frak.id`,clientId:`6eacc8d7-49ac-4936-95e9-81ef29449570`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>(e!==`track`||!t?.properties||`sdk_version`in t.properties||(t.properties={...t.properties,sdk_version:`1.2.1`,...o&&{user_anonymous_client_id:o}}),!0)}),p.setGlobalProperties({sdk_version:`1.2.1`,...o&&{user_anonymous_client_id:o}}),p.init(),p.track(`sdk_initialized`,{sdk_version:`1.2.1`});let e=!1,t=setTimeout(()=>{e||(e=!0,p?.track(`sdk_iframe_handshake_failed`,{reason:`timeout`}))},3e4);s.isConnected.then(()=>{e||(e=!0,clearTimeout(t),p?.track(`sdk_iframe_connected`,{handshake_duration_ms:Date.now()-l}))}).catch(()=>{e||(e=!0,clearTimeout(t),p?.track(`sdk_iframe_handshake_failed`,{reason:`unknown`}))})}let m=li({config:e,rpcClient:u,lifecycleManager:s,configPromise:a,contextSent:c,openPanel:p,clientId:o}).then(()=>{}).catch(e=>{throw c.reject(e),e});return{config:e,waitForConnection:s.isConnected,waitForSetup:m,request:u.request,listenerRequest:u.listen,destroy:f,openPanel:p}}function ii(e,t){let n,r,i=()=>e.sendLifecycle({clientLifecycle:`heartbeat`});async function a(){i(),n=setInterval(i,250),r=setTimeout(()=>{o(),console.log(`Heartbeat timeout: connection failed`)},3e4),await t.isConnected,o()}function o(){n&&clearInterval(n),r&&clearTimeout(r)}return a(),o}function ai(e){return e.hasRawSdkConfig?{name:e.name,logoUrl:e.logoUrl,homepageLink:e.homepageLink,lang:e.lang,currency:e.currency,hidden:e.hidden,css:e.css,translations:e.translations,placements:e.placements,attribution:e.attribution}:e.attribution?{attribution:e.attribution}:void 0}function oi(e,t){if(!e)return;let n=e.global??{};e.setGlobalProperties({...n,merchant_id:t.merchantId,domain:t.domain??``})}async function si(e){if(!(typeof crypto>`u`||!crypto.subtle))try{let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return new Uint8Array(t)}catch{return}}async function ci({merchantId:e,anonymousId:t,pendingMergeToken:n}){let r=n?await si(n):void 0;if(n&&!r){let n=await Y({op:`frak-install-v1`,merchantId:e,anonymousId:t});return n?{anonymousId:t,proofs:{install:n}}:void 0}let[i,a]=await Promise.all([r?Y({op:`frak-merge-v1`,merchantId:e,anonymousId:t,binding:r}):Promise.resolve(null),Y({op:`frak-install-v1`,merchantId:e,anonymousId:t})]);if(!(!i&&!a))return{anonymousId:t,proofs:{...i&&{merge:i},...a&&{install:a}}}}async function li({config:e,rpcClient:t,lifecycleManager:n,configPromise:r,contextSent:i,openPanel:a,clientId:o}){await n.isConnected,Nr(t,n.isConnected);let s=new URL(window.location.href),c=s.searchParams.get(`fmt`)??void 0;c&&(s.searchParams.delete(`fmt`),window.history.replaceState({},``,s.toString()));let l=t=>{let n=t?.merchantId??e.metadata.merchantId??``,r=t?.domain??``,i=t?.allowedDomains??[],a=t?.sdkConfig,o=a?.attribution||e.attribution?{...e.attribution,...a?.attribution}:void 0;J.setConfig(a?{isResolved:!0,merchantId:n,domain:r,allowedDomains:i,hasRawSdkConfig:!0,name:a.name??e.metadata.name,logoUrl:a.logoUrl??e.metadata.logoUrl,homepageLink:a.homepageLink??e.metadata.homepageLink,lang:a.lang??e.metadata.lang,currency:a.currency??e.metadata.currency,hidden:a.hidden,css:a.css,translations:a.translations,placements:a.placements,components:a.components,attribution:o}:{isResolved:!0,merchantId:n,domain:r,allowedDomains:i,name:e.metadata.name,logoUrl:e.metadata.logoUrl,homepageLink:e.metadata.homepageLink,lang:e.metadata.lang,currency:e.metadata.currency,attribution:o})},u=!1,d=Promise.resolve(),f=e=>{let n=u?void 0:c;u=!0;let r=ai(e),i=o,s=window.location.href;return oi(a,e),d=d.then(async()=>{t.sendLifecycle({clientLifecycle:`resolved-config`,data:{merchantId:e.merchantId,domain:e.domain??``,allowedDomains:e.allowedDomains??[],sourceUrl:s,...i&&{sdkAnonymousId:i},...n&&{pendingMergeToken:n},...r&&{sdkConfig:r},...i&&{sdkIdentity:await ci({merchantId:e.merchantId,anonymousId:i,pendingMergeToken:n})}}})}).catch(e=>{console.error(`Failed to send lifecycle config`,e)}),d};J.isResolved&&f(J.getConfig()).then(i.resolve),r&&(l(await r),f(J.getConfig()).then(i.resolve));async function p(){let n=e.customizations?.css;n&&t.sendLifecycle({clientLifecycle:`modal-css`,data:{cssLink:n}})}async function m(){let n=e.customizations?.i18n;n&&t.sendLifecycle({clientLifecycle:`modal-i18n`,data:{i18n:n}})}async function h(){if(typeof window>`u`)return;let e=window.localStorage.getItem(kr);e&&t.sendLifecycle({clientLifecycle:`restore-backup`,data:{backup:e}})}(await Promise.allSettled([p(),m(),h()])).some(e=>e.status===`rejected`)&&a?.track(`sdk_iframe_handshake_failed`,{reason:`asset_push`})}function ui(e){return qt(In(e))}async function di({config:e}){let t=fi(e),n=await Wr({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=await ri({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function fi(e){let t=br(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}function pi({perCall:e,defaults:t,productUtmContent:n}){if(e===null)return;let r=e!==void 0,i=t!==void 0&&Object.keys(t).length>0;if(!r&&!i&&(n===void 0||n===``))return;let a={...t,...e??{}},o=n??e?.utmContent;return o!==void 0&&o!==``?a.utmContent=o:delete a.utmContent,a}const mi=`frak:client`;function hi(){let e=new CustomEvent(mi);window.dispatchEvent(e)}function gi(e,t){if(window.FrakSetup?.client&&e===`add`){t();return}(e===`add`?window.addEventListener:window.removeEventListener)(mi,t,!1)}export{Z as A,qn as B,Y as C,J as D,Vn as E,tn as F,Ht as H,en as I,Hn as L,Jn as M,Wn as N,tr as O,Zt as P,Kn as R,nr as S,Un as T,Wt as U,Pn as V,Ut as W,Cr as _,Gr as a,Fn as b,di as c,ri as d,ui as f,Ur as g,Ar as h,Br as i,Rn as j,Ln as k,Lr as l,pi as m,gi as n,Hr as o,Mr as p,$ as r,qr as s,hi as t,Q as u,Sr as v,In as w,vr as x,br as y,Zn as z};
|
package/cdn/defaults.DSdJs5_D.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import{D as e,n as t,p as n}from"./clientReady.BLJ9Ej95.js";var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_={},v=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,b=Array.isArray;function x(e,t){for(var n in t)e[n]=t[n];return e}function S(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function C(e,t,n){var i,a,o,s={};for(o in t)o==`key`?i=t[o]:o==`ref`?a=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?r.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return w(e,s,i,a,null)}function w(e,t,n,r,o){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++a,__i:-1,__u:0};return o==null&&i.vnode!=null&&i.vnode(s),s}function T(e){return e.children}function E(e,t){this.props=e,this.context=t}function D(e,t){if(t==null)return e.__?D(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?D(e):null}function O(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],a=[],o=x({},t);o.__v=t.__v+1,i.vnode&&i.vnode(o),ie(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??D(t),!!(32&t.__u),a),o.__v=t.__v,o.__.__k[o.__i]=o,oe(r,o,a),t.__e=t.__=null,o.__e!=n&&k(o)}}function k(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),k(e)}function A(e){(!e.__d&&(e.__d=!0)&&o.push(e)&&!j.__r++||s!=i.debounceRendering)&&((s=i.debounceRendering)||c)(j)}function j(){try{for(var e,t=1;o.length;)o.length>t&&o.sort(l),e=o.shift(),t=o.length,O(e)}finally{o.length=j.__r=0}}function ee(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,y,b=r&&r.__k||v,x=t.length;for(c=M(n,t,b,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&b[p.__i]||_,p.__i=d,g=ie(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&I(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),(y=!!(4&p.__u))||f.__k===p.__k?(c=N(p,c,e,y),y&&f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function M(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=w(null,o,null,null,null):b(o)?o=e.__k[a]=w(T,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=w(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=te(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=D(s)),le(s,s));return r}function N(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=N(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=D(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function P(e,t){return t||=[],e==null||typeof e==`boolean`||(b(e)?e.some(function(e){P(e,t)}):t.push(e)),t}function te(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ne(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||y.test(t)?n:n+`px`}function F(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ne(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ne(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(p,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[f]=r[f]:(n[f]=m,e.addEventListener(t,a?g:h,a)):e.removeEventListener(t,a?g:h,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function re(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[d]==null)t[d]=m++;else if(t[d]<n[f])return;return n(i.event?i.event(t):t)}}}function ie(e,t,n,r,a,o,s,c,l,u){var d,f,p,m,h,g,_,y,C,w,D,O,k,A,j,M,N=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),o=[c=t.__e=n.__e]),(d=i.__b)&&d(t);n:if(typeof N==`function`){f=s.length;try{if(C=t.props,w=N.prototype&&N.prototype.render,D=(d=N.contextType)&&r[d.__c],O=d?D?D.props.value:d.__:r,n.__c?y=(p=t.__c=n.__c).__=p.__E:(w?t.__c=p=new N(C,O):(t.__c=p=new E(C,O),p.constructor=N,p.render=ue),D&&D.sub(p),p.state||={},p.__n=r,m=p.__d=!0,p.__h=[],p._sb=[]),w&&p.__s==null&&(p.__s=p.state),w&&N.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=x({},p.__s)),x(p.__s,N.getDerivedStateFromProps(C,p.__s))),h=p.props,g=p.state,p.__v=t,m)w&&N.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),w&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(w&&N.getDerivedStateFromProps==null&&C!==h&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(C,O),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&!1===p.shouldComponentUpdate(C,p.__s,O)){t.__v!=n.__v&&(p.props=C,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),v.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p);break n}p.componentWillUpdate!=null&&p.componentWillUpdate(C,p.__s,O),w&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(h,g,_)})}if(p.context=O,p.props=C,p.__P=e,p.__e=!1,k=i.__r,A=0,w)p.state=p.__s,p.__d=!1,k&&k(t),d=p.render(p.props,p.state,p.context),v.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,k&&k(t),d=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++A<25);p.state=p.__s,p.getChildContext!=null&&(r=x(x({},r),p.getChildContext())),w&&!m&&p.getSnapshotBeforeUpdate!=null&&(_=p.getSnapshotBeforeUpdate(h,g)),j=d!=null&&d.type===T&&d.key==null?se(d.props.children):d,c=ee(e,b(j)?j:[j],t,n,r,a,o,s,c,l,u),p.base=t.__e,t.__u&=-161,p.__h.length&&s.push(p),y&&(p.__E=p.__=null)}catch(e){if(s.length=f,t.__v=null,l||o!=null){if(e.then){for(t.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o!=null&&(o[o.indexOf(c)]=null),t.__e=c}else if(o!=null)for(M=o.length;M--;)S(o[M])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||ae(t),i.__e(e,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=ce(n.__e,t,n,r,a,o,s,l,u);return(d=i.diffed)&&d(t),128&t.__u?void 0:c}function ae(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ae))}function oe(e,t,n){for(var r=0;r<n.length;r++)I(n[r],n[++r],n[++r]);i.__c&&i.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){i.__e(e,t.__v)}})}function se(e){return typeof e!=`object`||!e||e.__b>0?e:b(e)?e.map(se):e.constructor===void 0?x({},e):null}function ce(e,t,n,a,o,s,c,l,u){var d,f,p,m,h,g,v,y=n.props||_,x=t.props,C=t.type;if(C==`svg`?o=`http://www.w3.org/2000/svg`:C==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||=`http://www.w3.org/1999/xhtml`,s!=null){for(d=0;d<s.length;d++)if((h=s[d])&&`setAttribute`in h==!!C&&(C?h.localName==C:h.nodeType==3)){e=h,s[d]=null;break}}if(e==null){if(C==null)return document.createTextNode(x);e=document.createElementNS(o,C,x.is&&x),l&&=(i.__m&&i.__m(t,s),!1),s=null}if(C==null)y===x||l&&e.data==x||(e.data=x);else{if(s=C==`textarea`&&x.defaultValue!=null?null:s&&r.call(e.childNodes),!l&&s!=null)for(y={},d=0;d<e.attributes.length;d++)y[(h=e.attributes[d]).name]=h.value;for(d in y)h=y[d],d==`dangerouslySetInnerHTML`?p=h:d==`children`||d in x||d==`value`&&`defaultValue`in x||d==`checked`&&`defaultChecked`in x||F(e,d,null,h,o);for(d in x)h=x[d],d==`children`?m=h:d==`dangerouslySetInnerHTML`?f=h:d==`value`?g=h:d==`checked`?v=h:l&&typeof h!=`function`||y[d]===h||F(e,d,h,y[d],o);if(f)l||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(p&&(e.innerHTML=``),ee(t.type==`template`?e.content:e,b(m)?m:[m],t,n,a,C==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:n.__k&&D(n,0),l,u),s!=null)for(d=s.length;d--;)S(s[d]);l&&C!=`textarea`||(d=`value`,C==`progress`&&g==null?e.removeAttribute(`value`):g!=null&&(g!==e[d]||C==`progress`&&!g||C==`option`&&g!=y[d])&&F(e,d,g,y[d],o),d=`checked`,v!=null&&v!=e[d]&&F(e,d,v,y[d],o))}return e}function I(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){i.__e(e,n)}}function le(e,t,n){var r,a;if(i.unmount&&i.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||I(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){i.__e(e,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(a=0;a<r.length;a++)r[a]&&le(r[a],t,n||typeof e.type!=`function`);n||S(e.__e),e.__c=e.__=e.__e=void 0}function ue(e,t,n){return this.constructor(e,n)}r=v.slice,i={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},a=0,E.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=x({},this.state);typeof e==`function`&&(e=e(x({},n),this.props)),e&&x(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),A(this))},E.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),A(this))},E.prototype.render=T,o=[],c=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,l=function(e,t){return e.__v.__b-t.__v.__b},j.__r=0,u=Math.random().toString(8),d=`__d`+u,f=`__a`+u,p=/(PointerCapture)$|Capture$/i,m=0,h=re(!1),g=re(!0);var de=0;Array.isArray;function fe(e,t,n,r,a,o){t||={};var s,c,l=t;if(`ref`in l)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--de,__i:-1,__u:0,__source:a,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return i.vnode&&i.vnode(u),u}var L,R,z,pe,B=0,me=[],V=i,he=V.__b,ge=V.__r,_e=V.diffed,ve=V.__c,ye=V.unmount,be=V.__;function H(e,t){V.__h&&V.__h(R,e,B||t),B=0;var n=R.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function U(e){return B=1,xe(Oe,e)}function xe(e,t,n){var r=H(L++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Oe(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=R,!R.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};R.__f=!0;var a=R.shouldComponentUpdate,o=R.componentWillUpdate;R.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},R.shouldComponentUpdate=i}return r.__N||r.__}function W(e,t){var n=H(L++,3);!V.__s&&J(n.__H,t)&&(n.__=e,n.u=t,R.__H.__h.push(n))}function Se(e,t){var n=H(L++,4);!V.__s&&J(n.__H,t)&&(n.__=e,n.u=t,R.__h.push(n))}function Ce(e){return B=5,G(function(){return{current:e}},[])}function G(e,t){var n=H(L++,7);return J(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function we(e,t){return B=8,G(function(){return e},t)}function Te(){for(var e;e=me.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(K),t.__h.some(q),t.__h=[]}catch(n){t.__h=[],V.__e(n,e.__v)}}}V.__b=function(e){R=null,he&&he(e)},V.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),be&&be(e,t)},V.__r=function(e){ge&&ge(e),L=0;var t=(R=e.__c).__H;t&&(z===R?(t.__h=[],R.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(K),t.__h.some(q),t.__h=[],L=0)),z=R},V.diffed=function(e){_e&&_e(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(me.push(t)!==1&&pe===V.requestAnimationFrame||((pe=V.requestAnimationFrame)||De)(Te)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),z=R=null},V.__c=function(e,t){t.some(function(e){try{e.__h.some(K),e.__h=e.__h.filter(function(e){return!e.__||q(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],V.__e(n,e.__v)}}),ve&&ve(e,t)},V.unmount=function(e){ye&&ye(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{K(e)}catch(e){t=e}}),n.__H=void 0,t&&V.__e(t,n.__v))};var Ee=typeof requestAnimationFrame==`function`;function De(e){var t,n=function(){clearTimeout(r),Ee&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ee&&(t=requestAnimationFrame(n))}function K(e){var t=R,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),R=t}function q(e){var t=R;e.__c=e.__(),R=t}function J(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Oe(e,t){return typeof t==`function`?t(e):t}function ke(e,t){for(var n in t)e[n]=t[n];return e}function Ae(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function Y(e,t){var n=t(),r=U({t:{__:n,u:t}}),i=r[0].t,a=r[1];return Se(function(){i.__=n,i.u=t,X(i)&&a({t:i})},[e,n,t]),W(function(){return X(i)&&a({t:i}),e(function(){X(i)&&a({t:i})})},[e]),n}function X(e){try{return!((t=e.__)===(n=e.u())&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}var t,n}function je(e,t){this.props=e,this.context=t}(je.prototype=new E).isPureReactComponent=!0,je.prototype.shouldComponentUpdate=function(e,t){return Ae(this.props,e)||Ae(this.state,t)};var Me=i.__b;i.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Me&&Me(e)},typeof Symbol<`u`&&Symbol.for;var Ne=i.__e;i.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k||[]),i.__c(e,t)}Ne(e,t,n,r)};var Pe=i.unmount;function Fe(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=ke({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Fe(e,t,n)})),e}function Ie(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Ie(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Z(){this.__u=0,this.o=null,this.__b=null}function Le(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Q(){this.i=null,this.l=null}i.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Pe&&Pe(e)},(Z.prototype=new E).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=Le(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=Ie(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},Z.prototype.componentWillUnmount=function(){this.o=[]},Z.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=Fe(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&C(T,null,e.fallback);return i&&(i.__u&=-33),[C(T,null,t.__a?null:e.children),i]};var Re=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Q.prototype=new E).__a=function(e){var t=this,n=Le(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),Re(t,e,r)):i()};n?n(a):a()}},Q.prototype.render=function(e){this.i=null,this.l=new Map;var t=P(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Q.prototype.componentDidUpdate=Q.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Re(e,n,t)})};var ze=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,Be=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ve=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,He=/[A-Z0-9]/g,Ue=typeof document<`u`,We=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};E.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(E.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Ge=i.event;i.event=function(e){return Ge&&(e=Ge(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Ke={configurable:!0,get:function(){return this.class}},qe=i.vnode;i.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||Ue&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||We(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:Ve.test(a)&&(a=s):s=a=`oninput`:i&&Be.test(a)?a=a.replace(He,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=P(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=P(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",Ke)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=ze,qe&&qe(e)};var Je=i.__r;i.__r=function(e){Je&&Je(e),e.__c};var Ye=i.diffed;i.diffed=function(e){Ye&&Ye(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};function Xe(){let[n,r]=U(()=>window.FrakSetup?.config?.waitForBackendConfig===!1||e.isResolved),[i,a]=U(()=>e.getConfig().hidden??!1),[o,s]=U(()=>!!window.FrakSetup?.client);return W(()=>{let n=e.getConfig();n.isResolved&&(r(!0),a(n.hidden??!1)),window.FrakSetup?.client&&s(!0);let i=e=>{let t=e.detail;t.isResolved&&r(!0),a(t.hidden??!1)};window.addEventListener(`frak:config`,i);let o=()=>s(!0);return t(`add`,o),()=>{window.removeEventListener(`frak:config`,i),t(`remove`,o)}},[]),{shouldRender:n,isHidden:i,isClientReady:o}}function $(e){return typeof window>`u`?()=>{}:(window.addEventListener(`frak:config`,e),()=>window.removeEventListener(`frak:config`,e))}function Ze(){return Y($,()=>e.getConfig().lang??n()??`en`)}const Qe=`
|
|
2
|
-
:host {
|
|
3
|
-
display: contents;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
:host([hidden]) {
|
|
7
|
-
display: none;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.button:disabled {
|
|
11
|
-
opacity: 0.7;
|
|
12
|
-
cursor: default;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.button__fadeIn {
|
|
16
|
-
animation: frak-fadeIn 300ms ease-in;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@keyframes frak-fadeIn {
|
|
20
|
-
from {
|
|
21
|
-
opacity: 0;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
to {
|
|
25
|
-
opacity: 1;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
`;function $e(e,t){return t?`${Qe}\n${e}\n${t}`:`${Qe}\n${e}`}const et=`
|
|
29
|
-
:where(frak-button-share, frak-open-in-app) {
|
|
30
|
-
display: contents;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
:where(frak-button-share .button, frak-open-in-app .button) {
|
|
34
|
-
display: flex;
|
|
35
|
-
align-items: center;
|
|
36
|
-
justify-content: center;
|
|
37
|
-
gap: 10px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
:where(frak-button-share .button:disabled, frak-open-in-app .button:disabled) {
|
|
41
|
-
opacity: 0.7;
|
|
42
|
-
cursor: default;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
:where(frak-button-share .button__fadeIn, frak-open-in-app .button__fadeIn) {
|
|
46
|
-
animation: frak-fadeIn 300ms ease-in;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@keyframes frak-fadeIn {
|
|
50
|
-
from {
|
|
51
|
-
opacity: 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
to {
|
|
55
|
-
opacity: 1;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
`;function tt(t){return e.getConfig().placements?.[t]}function nt(e){return Y($,we(()=>e?tt(e):void 0,[e]))}const rt={en:{buttonShare:{text:`Share & earn {REWARD}!`},postPurchase:{refereeText:`You just earned {REWARD}! Share with friends to earn even more.`,refereeNoRewardText:`You just earned a reward! Share with friends to earn even more.`,referrerText:`Earn {REWARD} by sharing this with your friends!`,referrerNoRewardText:`Share this with your friends and earn rewards!`,ctaText:`Share & earn {REWARD}`,ctaNoRewardText:`Share & earn`},openInApp:{text:`Open in App`,ariaLabel:`Open in Frak Wallet app`},buttonWallet:{ariaLabel:`Open wallet`},banner:{referralTitleReward:`Earn {REWARD} on purchases`,referralTitle:`You've been referred!`,referralDescription:`Earn rewards after your purchase via the Frak partner app.`,referralCta:`Got it`,inappTitle:`Open in your browser`,inappDescription:`For a better experience and to earn your rewards, open this page in your default browser.`,inappCta:`Open browser`,dismissLabel:`Dismiss`}},fr:{buttonShare:{text:`Partagez et gagnez {REWARD} !`},postPurchase:{refereeText:`Vous venez de gagner {REWARD} ! Partagez avec vos amis pour gagner encore plus.`,refereeNoRewardText:`Vous venez de gagner une récompense ! Partagez avec vos amis pour gagner encore plus.`,referrerText:`Gagnez {REWARD} en partageant avec vos amis !`,referrerNoRewardText:`Partagez avec vos amis et gagnez des récompenses !`,ctaText:`Partagez et gagnez {REWARD}`,ctaNoRewardText:`Partagez et gagnez`},openInApp:{text:`Ouvrir dans l'app`,ariaLabel:`Ouvrir dans l'app Frak Wallet`},buttonWallet:{ariaLabel:`Ouvrir le porte-monnaie`},banner:{referralTitleReward:`Gagnez {REWARD} sur vos achats`,referralTitle:`Vous avez été parrainé !`,referralDescription:`Gagnez des récompenses après votre achat via l'application partenaire Frak.`,referralCta:`J'ai compris`,inappTitle:`Ouvrez dans votre navigateur`,inappDescription:`Pour une meilleure expérience et pour gagner vos récompenses, ouvrez cette page dans votre navigateur par défaut.`,inappCta:`Ouvrir le navigateur`,dismissLabel:`Fermer`}}};export{Ze as a,Y as c,U as d,W as f,T as h,et as i,Ce as l,fe as m,nt as n,$ as o,we as p,$e as r,Xe as s,rt as t,G as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as e}from"./actions-L7o384oB.Dja0yGBh.js";async function t(t,n){if(!window.FrakSetup?.client){console.error(`Frak client not found`);return}let r=window.FrakSetup?.modalWalletConfig??{};await e(window.FrakSetup.client,t?{...r,metadata:{...r.metadata,targetInteraction:t}}:r,n)}export{t};
|
package/cdn/rewards.9mTF4_ef.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,v as t,y as n}from"./clientReady.BLJ9Ej95.js";function r(e){return Array.isArray(e)?e:e.conditions}function i(e){if(typeof e==`number`)return e;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);return Number.isFinite(t)?t:void 0}}function a(e,t,n){let o=[];for(let s of r(e)){if(`logic`in s){o.push(...a(s,t,n));continue}if(s.field===t&&n.has(s.operator)){let e=i(s.value);e!=null&&o.push(e)}}return o}const o=new Set([`gt`,`gte`,`between`]),s=new Set([`gt`,`gte`]);function c(e){let t=a(e,`purchase.amount`,o);return t.length>0?Math.min(...t):void 0}function l(e){let t=a(e,`time.timestamp`,s);if(t.length!==0)return new Date(Math.min(...t)*1e3)}function u(e,t){switch(e.payoutType){case`fixed`:return e.amount[t];case`percentage`:return e.maxAmount?.[t]??0;case`tiered`:return e.tiers.reduce((e,n)=>`amount`in n?Math.max(e,n.amount[t]):e,0)}}function d(e){return e.payoutType===`percentage`?e.percent:e.payoutType===`tiered`?e.tiers.reduce((e,t)=>`percent`in t?Math.max(e,t.percent):e,0):0}function f(e,t){let n=u(e,t);return n>0?n:d(e)*1e-6}function p(r,i){let a=n(i),o=e(a);switch(r.payoutType){case`fixed`:return t(Math.round(r.amount[o]),a);case`percentage`:return`${r.percent} %`;case`tiered`:{let e=u(r,o);if(e>0)return t(Math.round(e),a);let n=d(r);return n>0?`${n} %`:t(0,a)}}}function m(t,r){if(t&&!(f(t,e(n(r)))<=0))return p(t,r)}function h(e,t){return t?e.replaceAll(`{REWARD}`,t):e.replaceAll(`{REWARD}`,``)}function g(e,t){return e.expiresAt!=null&&new Date(e.expiresAt).getTime()<=t}function _(e,t){let n=l(e.conditions);return n==null||n.getTime()<=t}function v(e,t){return t===`referee`?e.referee:e.referrer}function y(e,t,n){let r=v(e,n);return r?f(r,t):0}function b(t,r={}){let i=(r.now??new Date).getTime(),a=r.audience??`referrer`,o=e(n(r.currency)),s=(r.targetInteraction?t.filter(e=>e.interactionTypeKey===r.targetInteraction):t).filter(e=>!g(e,i)),c=s.filter(e=>_(e,i));if(c.length>0)return{campaign:c.reduce((e,t)=>y(t,o,a)>y(e,o,a)?t:e),status:`live`};let u=s.map(e=>({campaign:e,startsAt:l(e.conditions)})).filter(e=>e.startsAt!=null);if(u.length===0)return;let d=u.reduce((e,t)=>t.startsAt.getTime()<e.startsAt.getTime()?t:e);return{campaign:d.campaign,status:`upcoming`,startsAt:d.startsAt}}function x(e,n={}){let r=b(e,n);if(!r)return;let i=v(r.campaign,n.audience??`referrer`);if(!i)return;let a=m(i,n.currency);if(!a)return;let o=c(r.campaign.conditions),s=o==null?void 0:t(o,n.currency),l=r.campaign.defaultLockupSeconds,u=l&&l>0?Math.round(l/86400):void 0;return{formatted:a,payoutType:i.payoutType,minPurchaseAmount:s,lockupDurationDays:u,referrerReward:r.campaign.referrer,refereeReward:r.campaign.referee,minPurchaseValue:o??void 0}}export{m as i,b as n,h as r,x as t};
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
const e=`.reset_base__1831jhd0 {
|
|
2
|
-
margin: 0;
|
|
3
|
-
padding: 0;
|
|
4
|
-
border: 0;
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
font-size: 100%;
|
|
7
|
-
font: inherit;
|
|
8
|
-
vertical-align: baseline;
|
|
9
|
-
-webkit-tap-highlight-color: transparent;
|
|
10
|
-
}
|
|
11
|
-
.reset_focusRing__1831jhd1 {
|
|
12
|
-
outline: 2px solid transparent;
|
|
13
|
-
outline-offset: 2px;
|
|
14
|
-
}
|
|
15
|
-
.reset_focusRing__1831jhd1:focus-visible {
|
|
16
|
-
outline-color: currentColor;
|
|
17
|
-
}
|
|
18
|
-
.reset_fieldAppearance__1831jhd2 {
|
|
19
|
-
appearance: none;
|
|
20
|
-
background-color: transparent;
|
|
21
|
-
}
|
|
22
|
-
.reset_visuallyHidden__1831jhd3 {
|
|
23
|
-
position: absolute;
|
|
24
|
-
width: 1px;
|
|
25
|
-
height: 1px;
|
|
26
|
-
padding: 0;
|
|
27
|
-
margin: -1px;
|
|
28
|
-
overflow: hidden;
|
|
29
|
-
clip: rect(0, 0, 0, 0);
|
|
30
|
-
white-space: nowrap;
|
|
31
|
-
border-width: 0;
|
|
32
|
-
}
|
|
33
|
-
.reset_element_ul__1831jhd4 {
|
|
34
|
-
list-style: none;
|
|
35
|
-
}
|
|
36
|
-
.reset_element_ol__1831jhd5 {
|
|
37
|
-
list-style: none;
|
|
38
|
-
}
|
|
39
|
-
.reset_element_button__1831jhd6 {
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
}
|
|
42
|
-
.reset_element_a__1831jhd7 {
|
|
43
|
-
text-decoration: none;
|
|
44
|
-
color: inherit;
|
|
45
|
-
}
|
|
46
|
-
.reset_element_table__1831jhdb {
|
|
47
|
-
border-collapse: collapse;
|
|
48
|
-
border-spacing: 0;
|
|
49
|
-
}
|
|
50
|
-
.reset_element_img__1831jhdc {
|
|
51
|
-
display: block;
|
|
52
|
-
max-width: 100%;
|
|
53
|
-
}:root {
|
|
54
|
-
--text-primary__pbq4ak0: #000000;
|
|
55
|
-
--text-secondary__pbq4ak1: #525252;
|
|
56
|
-
--text-tertiary__pbq4ak2: #a3a3a3;
|
|
57
|
-
--text-disabled__pbq4ak3: #a3a3a3;
|
|
58
|
-
--text-action__pbq4ak4: #0043ef;
|
|
59
|
-
--text-actionHover__pbq4ak5: #0036bf;
|
|
60
|
-
--text-onAction__pbq4ak6: #ffffff;
|
|
61
|
-
--text-error__pbq4ak7: #e31c31;
|
|
62
|
-
--text-success__pbq4ak8: #09be67;
|
|
63
|
-
--text-warning__pbq4ak9: #ec7e00;
|
|
64
|
-
--surface-primary__pbq4aka: #0043ef;
|
|
65
|
-
--surface-secondary__pbq4akb: #f2f6fe;
|
|
66
|
-
--surface-background__pbq4akc: #ffffff;
|
|
67
|
-
--surface-background2__pbq4akd: #f9fafb;
|
|
68
|
-
--surface-elevated__pbq4ake: #ffffff;
|
|
69
|
-
--surface-muted__pbq4akf: #f7f7f7;
|
|
70
|
-
--surface-tertiary__pbq4akg: #f7f7f7;
|
|
71
|
-
--surface-overlay__pbq4akh: #000000b2;
|
|
72
|
-
--surface-disabled__pbq4aki: #e2e2e2;
|
|
73
|
-
--surface-primaryHover__pbq4akj: #0036bf;
|
|
74
|
-
--surface-primaryPressed__pbq4akk: #00288f;
|
|
75
|
-
--surface-secondaryHover__pbq4akl: #e5ecfd;
|
|
76
|
-
--surface-secondaryPressed__pbq4akm: #ccd9fc;
|
|
77
|
-
--surface-error__pbq4akn: #fce8ea;
|
|
78
|
-
--surface-success__pbq4ako: #f3fcf7;
|
|
79
|
-
--surface-warning__pbq4akp: #fef9f2;
|
|
80
|
-
--border-subtle__pbq4akq: #f5f5f5;
|
|
81
|
-
--border-focus__pbq4akr: #a3a3a3;
|
|
82
|
-
--border-error__pbq4aks: #e31c31;
|
|
83
|
-
--border-success__pbq4akt: #09be67;
|
|
84
|
-
--border-warning__pbq4aku: #ec7e00;
|
|
85
|
-
--border-default__pbq4akv: #e2e2e2;
|
|
86
|
-
--icon-primary__pbq4akw: #000000;
|
|
87
|
-
--icon-secondary__pbq4akx: #525252;
|
|
88
|
-
--icon-tertiary__pbq4aky: #a3a3a3;
|
|
89
|
-
--icon-disabled__pbq4akz: #a3a3a3;
|
|
90
|
-
--icon-action__pbq4ak10: #0043ef;
|
|
91
|
-
--icon-actionHover__pbq4ak11: #0036bf;
|
|
92
|
-
--icon-onAction__pbq4ak12: #ffffff;
|
|
93
|
-
--icon-error__pbq4ak13: #e31c31;
|
|
94
|
-
--icon-success__pbq4ak14: #09be67;
|
|
95
|
-
--icon-warning__pbq4ak15: #ec7e00;
|
|
96
|
-
}
|
|
97
|
-
[data-theme='dark'] {
|
|
98
|
-
--text-primary__pbq4ak0: #ffffff;
|
|
99
|
-
--text-secondary__pbq4ak1: #f7f7f7;
|
|
100
|
-
--text-tertiary__pbq4ak2: #f5f5f5;
|
|
101
|
-
--text-disabled__pbq4ak3: #a3a3a3;
|
|
102
|
-
--text-action__pbq4ak4: #668ef5;
|
|
103
|
-
--text-actionHover__pbq4ak5: #0036bf;
|
|
104
|
-
--text-onAction__pbq4ak6: #ffffff;
|
|
105
|
-
--text-error__pbq4ak7: #e9495a;
|
|
106
|
-
--text-success__pbq4ak8: #09be67;
|
|
107
|
-
--text-warning__pbq4ak9: #ec7e00;
|
|
108
|
-
--surface-primary__pbq4aka: #0043ef;
|
|
109
|
-
--surface-secondary__pbq4akb: #00288f;
|
|
110
|
-
--surface-background__pbq4akc: #000000;
|
|
111
|
-
--surface-background2__pbq4akd: #000000;
|
|
112
|
-
--surface-elevated__pbq4ake: #262626;
|
|
113
|
-
--surface-muted__pbq4akf: #525252;
|
|
114
|
-
--surface-tertiary__pbq4akg: #737373;
|
|
115
|
-
--surface-overlay__pbq4akh: #000000b2;
|
|
116
|
-
--surface-disabled__pbq4aki: #e2e2e2;
|
|
117
|
-
--surface-primaryHover__pbq4akj: #0036bf;
|
|
118
|
-
--surface-primaryPressed__pbq4akk: #00288f;
|
|
119
|
-
--surface-secondaryHover__pbq4akl: #e5ecfd;
|
|
120
|
-
--surface-secondaryPressed__pbq4akm: #ccd9fc;
|
|
121
|
-
--surface-error__pbq4akn: #b61627;
|
|
122
|
-
--surface-success__pbq4ako: #05723e;
|
|
123
|
-
--surface-warning__pbq4akp: #8e4c00;
|
|
124
|
-
--border-subtle__pbq4akq: #737373;
|
|
125
|
-
--border-focus__pbq4akr: #a3a3a3;
|
|
126
|
-
--border-error__pbq4aks: #e31c31;
|
|
127
|
-
--border-success__pbq4akt: #09be67;
|
|
128
|
-
--border-warning__pbq4aku: #ec7e00;
|
|
129
|
-
--border-default__pbq4akv: #525252;
|
|
130
|
-
--icon-primary__pbq4akw: #ffffff;
|
|
131
|
-
--icon-secondary__pbq4akx: #f7f7f7;
|
|
132
|
-
--icon-tertiary__pbq4aky: #f7f7f7;
|
|
133
|
-
--icon-disabled__pbq4akz: #a3a3a3;
|
|
134
|
-
--icon-action__pbq4ak10: #0043ef;
|
|
135
|
-
--icon-actionHover__pbq4ak11: #0036bf;
|
|
136
|
-
--icon-onAction__pbq4ak12: #ffffff;
|
|
137
|
-
--icon-error__pbq4ak13: #e31c31;
|
|
138
|
-
--icon-success__pbq4ak14: #09be67;
|
|
139
|
-
--icon-warning__pbq4ak15: #ec7e00;
|
|
140
|
-
}.sharedBaseCss_buttonReset__7cswil0 {
|
|
141
|
-
margin: 0;
|
|
142
|
-
border: 0;
|
|
143
|
-
appearance: none;
|
|
144
|
-
background-color: transparent;
|
|
145
|
-
box-sizing: border-box;
|
|
146
|
-
font-family: inherit;
|
|
147
|
-
-webkit-tap-highlight-color: transparent;
|
|
148
|
-
cursor: pointer;
|
|
149
|
-
outline: 2px solid transparent;
|
|
150
|
-
outline-offset: 2px;
|
|
151
|
-
}
|
|
152
|
-
.sharedBaseCss_buttonReset__7cswil0:focus-visible {
|
|
153
|
-
outline-color: currentColor;
|
|
154
|
-
}`;export{e as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e}from"./actions-L7o384oB.Dja0yGBh.js";async function t(t,n,r){if(!window.FrakSetup?.client){console.error(`Frak client not found`);return}await e(window.FrakSetup.client,{...r?.link&&{link:r.link},...r?.products?.length&&{products:r.products},...t&&{metadata:{targetInteraction:t}}},n)}export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as e}from"./clientReady.BLJ9Ej95.js";function t(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function n(e){if(!e)return null;if(Array.isArray(e))return e;if(typeof e!=`string`)return null;try{let t=JSON.parse(e);return Array.isArray(t)?t:null}catch{return null}}function r(e){if(!e||typeof e!=`object`)return null;let n=e,r=typeof n.title==`string`?n.title.trim():``;if(r===``)return null;let i={title:r};return typeof n.imageUrl==`string`&&t(n.imageUrl)&&(i.imageUrl=n.imageUrl),typeof n.link==`string`&&t(n.link)&&(i.link=n.link),typeof n.utmContent==`string`&&n.utmContent!==``&&(i.utmContent=n.utmContent),i}function i(e){let t=n(e);if(!t)return;let i=[];for(let e of t){let t=r(e);t&&i.push(t)}return i.length>0?i:void 0}function a(t){if(!t)return;let n;try{n=e(t)}catch{return}if(n!==null)return i(n)}export{i as n,a as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,t){let n=document.getElementById(e);if(n){n.textContent!==t&&(n.textContent=t);return}let r=document.createElement(`style`);r.id=e,r.textContent=t,document.head.appendChild(r)}function t(e,t){let n=`frak-base-${e}`;if(document.getElementById(n)||!t)return;let r=document.createElement(`style`);r.id=n,r.textContent=t,document.head.appendChild(r)}function n(t,n,r){e(`frak-placement-${t}-${n}`,r)}const r={injectBase:t,injectPlacement:n};export{r as t};
|