@frak-labs/components 1.0.3 → 1.0.4
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.B1y3jwHv.js +178 -0
- package/cdn/{ButtonShare.FHUOd26e.js → ButtonShare.elMtdxF3.js} +1 -1
- package/cdn/{ButtonWallet.CN2iHSTB.js → ButtonWallet.BUUPX0gO.js} +1 -1
- package/cdn/GiftIcon.eRNTGQ_r.js +1 -0
- package/cdn/OpenInAppButton.Dgb-qhM8.js +1 -0
- package/cdn/PostPurchase.Cy7-FrRh.js +89 -0
- package/cdn/components.js +1 -1
- package/cdn/formatReward.B1ZyoceC.js +1 -0
- package/cdn/loader.js +154 -14
- package/cdn/replay-V6FXES7X.BoL9fAjx.js +1 -0
- package/cdn/{sharingPage.CvUkxEML.js → sharingPage.BYsqcN9O.js} +1 -1
- package/cdn/useGlobalComponents.TG9kIYSc.js +1 -0
- package/cdn/useLightDomStyles.tjNBKcOr.js +1 -0
- package/cdn/usePlacement.BgMXY5CX.js +58 -0
- package/cdn/useReward.B530suzR.js +1 -0
- package/dist/GiftIcon-BIp9FTJs.js +338 -0
- package/dist/banner.d.ts +8 -0
- package/dist/banner.js +74 -44
- package/dist/buttonShare.js +6 -6
- package/dist/buttonWallet.js +2 -2
- package/dist/{formatReward-Bub6Z6eY.js → formatReward-Cf2KpA3x.js} +1 -1
- package/dist/openInApp.js +9 -26
- package/dist/postPurchase.d.ts +9 -1
- package/dist/postPurchase.js +93 -1382
- package/dist/{sharingPage-DFvQbviS.js → sharingPage-D6fQEXV9.js} +1 -1
- package/dist/useLightDomStyles-DVe5UDg6.js +48 -0
- package/dist/{usePlacement-V7NrKoub.js → usePlacement-DzEuVg_u.js} +7 -7
- package/dist/{useReward-DU3_yP8Q.js → useReward-ClVShg45.js} +1 -1
- package/package.json +3 -3
- package/cdn/Banner.BTj-CQM6.js +0 -162
- package/cdn/OpenInAppButton.C1Yipwka.js +0 -1
- package/cdn/PostPurchase.u0s94KFf.js +0 -52
- package/cdn/formatReward.C7mU9_cV.js +0 -1
- package/cdn/sprinkles.css.ts.vanilla.06k5OzG1.js +0 -1175
- package/cdn/useGlobalComponents.UJmjUUxk.js +0 -1
- package/cdn/useLightDomStyles.Gt7YUMDl.js +0 -1
- package/cdn/usePlacement.BJ7qe-pw.js +0 -58
- package/cdn/useReward.QsQc2c1D.js +0 -1
- package/dist/GiftIcon-c28NnqJ7.js +0 -1502
- package/dist/useLightDomStyles-gbuSWvRx.js +0 -89
- /package/dist/{useGlobalComponents-Cmfszr7v.js → useGlobalComponents-mSs9unyN.js} +0 -0
package/cdn/loader.js
CHANGED
|
@@ -1,14 +1,154 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};
|
|
2
|
-
`);super(c,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,`details`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,`docsPath`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,`metaMessages`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,`shortMessage`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,`version`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,`name`,{enumerable:!0,configurable:!0,writable:!0,value:`BaseError`}),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=i}walk(e){return s(this,e)}};function s(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?s(e.cause,t):t?null:e}var c=class extends o{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:`SizeExceedsPaddingSizeError`})}};function l(e,{dir:t,size:n=32}={}){return typeof e==`string`?u(e,{dir:t,size:n}):d(e,{dir:t,size:n})}function u(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace(`0x`,``);if(r.length>n*2)throw new c({size:Math.ceil(r.length/2),targetSize:n,type:`hex`});return`0x${r[t===`right`?`padEnd`:`padStart`](n*2,`0`)}`}function d(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new c({size:e.length,targetSize:n,type:`bytes`});let r=new Uint8Array(n);for(let i=0;i<n;i++){let a=t===`right`;r[a?i:n-i-1]=e[a?i:e.length-i-1]}return r}var f=class extends o{constructor({max:e,min:t,signed:n,size:r,value:i}){super(`Number "${i}" is not in safe ${r?`${r*8}-bit ${n?`signed`:`unsigned`} `:``}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:`IntegerOutOfRangeError`})}},p=class extends o{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:`SizeOverflowError`})}};function m(e,{size:t}){if(r(e)>t)throw new p({givenSize:r(e),maxSize:t})}const h=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function ee(e,t={}){return typeof e==`number`||typeof e==`bigint`?ne(e,t):typeof e==`string`?ie(e,t):typeof e==`boolean`?te(e,t):g(e,t)}function te(e,t={}){let n=`0x${Number(e)}`;return typeof t.size==`number`?(m(n,{size:t.size}),l(n,{size:t.size})):n}function g(e,t={}){let n=``;for(let t=0;t<e.length;t++)n+=h[e[t]];let r=`0x${n}`;return typeof t.size==`number`?(m(r,{size:t.size}),l(r,{dir:`right`,size:t.size})):r}function ne(e,t={}){let{signed:n,size:r}=t,i=BigInt(e),a;r?a=n?(1n<<BigInt(r)*8n-1n)-1n:2n**(BigInt(r)*8n)-1n:typeof e==`number`&&(a=BigInt(2**53-1));let o=typeof a==`bigint`&&n?-a-1n:0;if(a&&i>a||i<o){let t=typeof e==`bigint`?`n`:``;throw new f({max:a?`${a}${t}`:void 0,min:`${o}${t}`,signed:n,size:r,value:`${e}${t}`})}let s=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?l(s,{size:r}):s}const re=new TextEncoder;function ie(e,t={}){return g(re.encode(e),t)}const ae=new TextEncoder;function oe(e,t={}){return typeof e==`number`||typeof e==`bigint`?le(e,t):typeof e==`boolean`?se(e,t):n(e)?v(e,t):ue(e,t)}function se(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size==`number`?(m(n,{size:t.size}),l(n,{size:t.size})):n}const _={zero:48,nine:57,A:65,F:70,a:97,f:102};function ce(e){if(e>=_.zero&&e<=_.nine)return e-_.zero;if(e>=_.A&&e<=_.F)return e-(_.A-10);if(e>=_.a&&e<=_.f)return e-(_.a-10)}function v(e,t={}){let n=e;t.size&&(m(n,{size:t.size}),n=l(n,{dir:`right`,size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);let i=r.length/2,a=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let n=ce(r.charCodeAt(t++)),i=ce(r.charCodeAt(t++));if(n===void 0||i===void 0)throw new o(`Invalid byte sequence ("${r[t-2]}${r[t-1]}" in "${r}").`);a[e]=n*16+i}return a}function le(e,t){return v(ne(e,t))}function ue(e,t={}){let n=ae.encode(e);return typeof t.size==`number`?(m(n,{size:t.size}),l(n,{dir:`right`,size:t.size})):n}const y=BigInt(2**32-1),de=BigInt(32);function fe(e,t=!1){return t?{h:Number(e&y),l:Number(e>>de&y)}:{h:Number(e>>de&y)|0,l:Number(e&y)|0}}function pe(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=fe(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}const me=(e,t,n)=>e<<n|t>>>32-n,he=(e,t,n)=>t<<n|e>>>32-n,ge=(e,t,n)=>t<<n-32|e>>>64-n,_e=(e,t,n)=>e<<n-32|t>>>64-n;function ve(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function ye(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function b(e,...t){if(!ve(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function be(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 xe(e,t){b(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function Se(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Ce(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const we=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Te(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Ee(e){for(let t=0;t<e.length;t++)e[t]=Te(e[t]);return e}const De=we?e=>e:Ee;typeof Uint8Array.from([]).toHex==`function`&&Uint8Array.fromHex;function Oe(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function ke(e){return typeof e==`string`&&(e=Oe(e)),b(e),e}var Ae=class{};function je(e){let t=t=>e().update(ke(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Me(e){let t=(t,n)=>e(n).update(ke(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}const Ne=BigInt(0),x=BigInt(1),Pe=BigInt(2),Fe=BigInt(7),Ie=BigInt(256),Le=BigInt(113),Re=[],ze=[],Be=[];for(let e=0,t=x,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Re.push(2*(5*r+n)),ze.push((e+1)*(e+2)/2%64);let i=Ne;for(let e=0;e<7;e++)t=(t<<x^(t>>Fe)*Le)%Ie,t&Pe&&(i^=x<<(x<<BigInt(e))-x);Be.push(i)}const Ve=pe(Be,!0),He=Ve[0],Ue=Ve[1],We=(e,t,n)=>n>32?ge(e,t,n):me(e,t,n),Ge=(e,t,n)=>n>32?_e(e,t,n):he(e,t,n);function Ke(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,a=n[i],o=n[i+1],s=We(a,o,1)^n[r],c=Ge(a,o,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=ze[n],a=We(t,i,r),o=Ge(t,i,r),s=Re[n];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=He[r],e[1]^=Ue[r]}Ce(n)}var qe=class e extends Ae{constructor(e,t,n,r=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,ye(n),!(0<e&&e<200))throw Error(`only keccak-f1600 function is supported`);this.state=new Uint8Array(200),this.state32=Se(this.state)}clone(){return this._cloneInto()}keccak(){De(this.state32),Ke(this.state32,this.rounds),De(this.state32),this.posOut=0,this.pos=0}update(e){be(this),e=ke(e),b(e);let{blockLen:t,state:n}=this,r=e.length;for(let i=0;i<r;){let a=Math.min(t-this.pos,r-i);for(let t=0;t<a;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,t&128&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){be(this,!1),b(e),this.finish();let t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw Error(`XOF is not possible for this instance`);return this.writeInto(e)}xof(e){return ye(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(xe(e,this),this.finished)throw Error(`digest() was already called`);return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Ce(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:i,rounds:a,enableXOF:o}=this;return t||=new e(n,r,i,o,a),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const S=(e,t,n)=>je(()=>new qe(t,e,n));S(6,144,224/8),S(6,136,256/8),S(6,104,384/8),S(6,72,512/8),S(1,144,224/8);const Je=S(1,136,256/8);S(1,104,384/8),S(1,72,512/8);const Ye=(e,t,n)=>Me((r={})=>new qe(t,e,r.dkLen===void 0?n:r.dkLen,!0));Ye(31,168,128/8),Ye(31,136,256/8);function Xe(e,t){let r=t||`hex`,i=Je(n(e,{strict:!1})?oe(e):e);return r===`bytes`?i:ee(i)}var Ze=class extends o{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:[`- Address must be a hex value of 20 bytes (40 hex characters).`,`- Address must match its checksum counterpart.`],name:`InvalidAddressError`})}},Qe=class extends Map{constructor(e){super(),Object.defineProperty(this,`maxSize`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),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}};const $e=new Qe(8192);function et(e,t){if($e.has(`${e}.${t}`))return $e.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=Xe(ue(n),`bytes`),i=(t?n.substring(`${t}0x`.length):n).split(``);for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(r[e>>1]&15)>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let a=`0x${i.join(``)}`;return $e.set(`${e}.${t}`,a),a}const tt=/^0x[a-fA-F0-9]{40}$/,C=new Qe(8192);function w(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(C.has(r))return C.get(r);let i=tt.test(e)?e.toLowerCase()===e?!0:n?et(e)===e:!0:!1;return C.set(r,i),i}function nt(e,t){if(!w(e,{strict:!1}))throw new Ze({address:e});if(!w(t,{strict:!1}))throw new Ze({address:t});return e.toLowerCase()===t.toLowerCase()}let T=256,E;function rt(e=11){if(!E||T+e>256*2){E=``,T=0;for(let e=0;e<256;e++)E+=(256+Math.random()*256|0).toString(16).substring(1)}return E.substring(T,T+++e)}const it={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 D=class extends Error{constructor(e,t,n){super(t),this.code=e,this.data=n}toJSON(){return{code:this.code,message:this.message,data:this.data}}},O=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 at(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{}}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{if(new URL(e.origin).origin.toLowerCase()!==new URL(r).origin.toLowerCase())return}catch{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{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 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 ee(e){let t=h(),n=new O;return o.set(t,e=>{e.error?n.reject(new D(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 te(e,t){let n=h();return o.set(n,e=>{e.error?o.delete(n):t(e.result)}),p({id:n,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{o.delete(n)}),()=>{o.delete(n)}}function g(){n.removeEventListener(`message`,f),o.clear()}return{request:ee,listen:te,sendLifecycle:m,cleanup:g}}function ot(e){return new TextEncoder().encode(JSON.stringify(e))}function st(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}const ct=`frak-client-id`;function lt(){return typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}function k(){if(typeof window>`u`||!window.localStorage)return lt();let e=localStorage.getItem(ct);return e||(e=lt(),localStorage.setItem(ct,e)),e}function ut({domain:e}={}){return Xe(ee((e??window.location.host).replace(`www.`,``)))}function A(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function j(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 dt(e){return A(ot(e))}function ft(e,t,n,r,i,a){let o=dt(pt({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})),s=new URL(e);return s.pathname=`/sso`,s.searchParams.set(`p`,o),s.toString()}function pt(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}}}const mt=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,ht=`frak-sso`;async function gt(e,t){let{metadata:n,customizations:r,walletUrl:i}=e.config;if(t.openInSameWindow??!!t.redirectUrl)return await e.request({method:`frak_openSso`,params:[t,n.name,r?.css]});let a=t.ssoPopupUrl??ft(i??`https://wallet.frak.id`,t,ut(),n.name,k(),r?.css),o=window.open(a,ht,mt);if(!o)throw Error(`Popup was blocked. Please allow popups for this site.`);return o.focus(),await e.request({method:`frak_openSso`,params:[t,n.name,r?.css]})??{}}function M(e,t,n){if(e)try{e.openPanel?.track(t,n)}catch{}}const _t=`https://backend.frak.id`;function vt(e){return e.includes(`localhost:3000`)||e.includes(`localhost:3010`)}function yt(e){return vt(e)?`https://localhost:3030`:e.includes(`wallet-dev.frak.id`)||e.includes(`wallet.gcp-dev.frak.id`)?`https://backend.gcp-dev.frak.id`:_t}function N(e){if(e)return yt(e);if(typeof window<`u`){let e=window.FrakSetup?.client?.config?.walletUrl;if(e)return yt(e)}return _t}var bt=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}};const P=new bt(1024),F=new bt(1024),xt=3e4,I=new bt(1024);async function L(e,{cacheKey:t,cacheTime:n=xt}){if(n>0){let e=F.get(t);if(e&&Date.now()-e.created<n)return e.data}let r=I.get(t);if(r&&Date.now()-r<1e3)throw Error(`Cache: ${t} recently failed, backing off`);let i=P.get(t);i||(i=e(),P.set(t,i));try{let e=await i;return F.set(t,{data:e,created:Date.now()}),I.delete(t),e}catch(e){throw I.set(t,Date.now()),e}finally{P.delete(t)}}function St(e){return{clear:()=>{P.delete(e),F.delete(e)},has:(t=xt)=>{let n=F.get(e);return n?Date.now()-n.created<t:!1}}}function Ct(){P.clear(),F.clear(),I.clear()}function wt(e){return`r`in e&&!(`v`in e)}function R(e){return`v`in e&&e.v===2}const Tt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Et(e){return typeof e==`string`&&Tt.test(e)}function Dt(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 Ot(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 kt(e){if(!Et(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`&&w(e.w);if(!t&&!n||t&&!Et(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(Dt(e.m),a),a+=16,i.setUint32(a,e.t,!1),a+=4,t&&(r.set(Dt(e.c),a),a+=16),n&&(r.set(v(e.w),a),a+=20),r}function At(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=Ot(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=Ot(e.subarray(a,a+16)),a+=16),r){let t=g(e.subarray(a,a+20),{size:20});if(!w(t))return null;c.w=t,a+=20}return c}const z=`fCtx`;function jt(e){if(e)try{if(R(e)){let t=kt(e);return t?A(t):void 0}return A(v(e.r))}catch{}}function Mt(e){if(!(!e||e.length===0))try{let t=j(e);if(t.length!==20)return At(t)||void 0;let n=g(t,{size:20});if(w(n))return{r:n}}catch{}}function Nt({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(z);return t?Mt(t):null}const Pt=`frak`;function Ft(e,t){let n=R(e);return{utm_source:t.utmSource??Pt,utm_medium:t.utmMedium??`referral`,utm_campaign:t.utmCampaign??(n?e.m:void 0),utm_content:t.utmContent,utm_term:t.utmTerm,via:t.via??Pt,ref:t.ref??(n?e.c:void 0)}}function It(e,t,n){let r=Ft(t,n??{});for(let[t,n]of Object.entries(r))n===void 0||n===``||e.searchParams.has(t)||e.searchParams.set(t,n)}function Lt({url:e,context:t,attribution:n}){if(!e)return null;let r=jt(t);if(!r)return null;let i=new URL(e);return i.searchParams.set(z,r),It(i,t,n),i.toString()}function Rt(e){let t=new URL(e);return t.searchParams.delete(z),t.toString()}function zt({url:e,context:t}){if(!window.location?.href||typeof window>`u`)return;let n=e??window.location.href,r;r=t===null?Rt(n):Lt({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}const Bt={compress:jt,decompress:Mt,parse:Nt,update:Lt,remove:Rt,replaceUrl:zt},B=`__frakSdkConfig`,Vt=`frak-config-cache`,V=`frak-merchant-id`,H={key:Vt},U=typeof window<`u`;function W(){return{isResolved:!1,merchantId:``}}let G=null;function Ht(){if(!U)return null;try{let e=localStorage.getItem(H.key);if(!e)return null;let t=JSON.parse(e);return t.config?.isResolved?(G=t,t):null}catch{return null}}function Ut(){return(G??Ht())?.config}function Wt(){let e=G??Ht();return e?Date.now()-e.timestamp<3e4:!1}function Gt(e){if(!(!U||!e.isResolved))try{let t={config:e,timestamp:Date.now()};localStorage.setItem(H.key,JSON.stringify(t)),G=t}catch{}}function Kt(){if(U){G=null;try{localStorage.removeItem(H.key)}catch{}}}function qt(){U&&(window[B]||(window[B]=Ut()??W()))}qt();function Jt(){return U?window[B]??W():W()}function Yt(e){U&&window.dispatchEvent(new CustomEvent(`frak:config`,{detail:e}))}function Xt(e){return e??(U?window.location.hostname:``)}async function Zt(e,t,n){try{let r=N(t),i=n?`&lang=${encodeURIComponent(n)}`:``,a=await fetch(`${r}/user/merchant/resolve?domain=${encodeURIComponent(e)}${i}`);if(!a.ok)return;let o=await a.json();if(U)try{sessionStorage.setItem(V,o.merchantId)}catch{}return o}catch{return}}const K={getConfig:Jt,get isResolved(){return Jt().isResolved},get isCacheFresh(){return Wt()},setCacheScope(e,t){H.key=`${Vt}:${`${e}:${t??``}`}`,G=null},setConfig(e){if(U&&(window[B]=e),Gt(e),Yt(e),U&&e.merchantId)try{sessionStorage.setItem(V,e.merchantId)}catch{}},reset(){let e=Ut()??W();U&&(window[B]=e),Yt(e)},clearCache(){if(Kt(),Ct(),U)try{sessionStorage.removeItem(V)}catch{}},resolve(e,t,n){let r=Xt(e);return r?L(async()=>{let e=await Zt(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=Jt();if(e.isResolved&&e.merchantId)return e.merchantId;if(U)try{return sessionStorage.getItem(V)??void 0}catch{}},async resolveMerchantId(e,t){return K.getMerchantId()||(await K.resolve(e,t))?.merchantId}};function Qt(){return()=>{}}var $t=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{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 null}}async fetch(e,t,n={}){let r=`${this.baseUrl}${e}`;return this.post(r,t,n,0)}},en=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.0`,this.api=new $t({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()),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}},tn=Object.defineProperty,nn=(e,t)=>()=>(e&&(t=e(e=0)),t),rn=(e,t)=>{for(var n in t)tn(e,n,{get:t[n],enumerable:!0})};function an(e,t){if(typeof document>`u`||typeof window>`u`)return;q&&q();let n=e.maxEventsPerChunk??200,r=e.flushIntervalMs??1e4,i=e.maxPayloadBytes??1048576,a=[],o=0,s=null;function c(e){if(a.length===0)return;let n=JSON.stringify(a);if(new TextEncoder().encode(n).length>i){if(a.length>1){let t=Math.floor(a.length/2),n=a.slice(0,t),r=a.slice(t),i=e&&n.some(e=>e.type===2);a=n,c(i),a=r,c(!1);return}a=[];return}let r=a[0].timestamp,s=a[a.length-1].timestamp;try{t({chunk_index:o,events_count:a.length,is_full_snapshot:e,started_at:new Date(r).toISOString(),ended_at:new Date(s).toISOString(),payload:n}),o+=1,a=[]}catch(e){throw e}}function l(e){let t=e||a.some(e=>e.type===2);a.length>=n?c(t):e&&a.length>0&&c(!0)}let u=e.maskAllText!==!1,d=e.unmaskTextSelector,f=Qt({emit(e,t){a.push(e),l(!!t)},checkoutEveryNms:r,maskAllInputs:e.maskAllInputs??!0,maskTextSelector:u?`*`:`[data-openpanel-replay-mask]`,maskTextFn:u&&d?(e,t)=>t?.closest(d)?e:e.replace(/\S/g,`*`):void 0,blockSelector:e.blockSelector??`[data-openpanel-replay-block]`,blockClass:e.blockClass,ignoreSelector:e.ignoreSelector});s=setInterval(()=>{a.length>0&&c(a.some(e=>e.type===2))},r);function p(){document.visibilityState===`hidden`&&a.length>0&&c(a.some(e=>e.type===2))}function m(){a.length>0&&c(a.some(e=>e.type===2))}document.addEventListener(`visibilitychange`,p),window.addEventListener(`pagehide`,m),q=()=>{a.length>0&&c(a.some(e=>e.type===2)),s&&=(clearInterval(s),null),document.removeEventListener(`visibilitychange`,p),window.removeEventListener(`pagehide`,m),f?.(),q=null}}function on(){q&&q()}var q,sn=nn(()=>{q=null}),cn={};rn(cn,{startReplayRecorder:()=>an,stopReplayRecorder:()=>on});var ln=nn(()=>{sn()}),un=typeof document<`u`?document.currentScript:null;function dn(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var fn=class extends en{constructor(e){if(super({sdk:`web`,sdkVersion:`1.3.0`,...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=un,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=()=>{e(null)},document.head.appendChild(n)})}return await Promise.resolve().then(()=>(ln(),cn))}catch{return 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[dn(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{}}};function pn(e){return st(j(e))}const J=`nexus-wallet-backup`,mn=`frakwallet://`;function hn(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}function gn(e){return`intent://${e.slice(13)}#Intent;scheme=frakwallet;end`}function _n(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=hn()&&vn(e)?gn(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function vn(e){return e.startsWith(mn)}const Y={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function X(e){return e&&e in Y?e:`eur`}function yn(e){return e?Y[e]??Y.eur:Y.eur}function bn(e,t){let n=yn(t),r=X(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function xn(e){return e?`${e}Amount`:`eurAmount`}const Z={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`}};function Sn({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);r.id=Z.id,r.name=Z.name,r.allow=Z.allow,r.style.zIndex=Z.style.zIndex.toString(),Cn({iframe:r,isVisible:!1});let i=t?.walletUrl??e??`https://wallet.frak.id`,a=k();return Tn(i),Tn(N(i)),r.src=`${i}/listener?clientId=${encodeURIComponent(a)}`,new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function Cn({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 wn(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{return null}}function Tn(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{}}function En(){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 Dn=En();function On(){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 kn=On();function An(e){Dn&&e.startsWith(`https://`)?window.location.href=`x-safari-https://${e.slice(8)}`:Dn&&e.startsWith(`http://`)?window.location.href=`x-safari-http://${e.slice(7)}`:window.location.href=`https://backend.frak.id/common/social?u=${encodeURIComponent(e)}`}function jn({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}function Mn(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}})}).catch(e=>{}),n.searchParams.delete(`sso`),window.history.replaceState({},``,n.toString()))}var Nn=class e{config;iframe;isSetupDone=!1;lastResponse=null;lastRequest=null;constructor(e,t){this.config=e,this.iframe=t,this.lastRequest=null,this.lastResponse=null}setLastResponse(e,t){this.lastResponse={message:e,response:t,timestamp:Date.now()}}setLastRequest(e){this.lastRequest={event:e,timestamp:Date.now()}}updateSetupStatus(e){this.isSetupDone=e}base64Encode(e){try{return btoa(JSON.stringify(e))}catch{return btoa(`Failed to encode data`)}}getIframeStatus(){return this.iframe?{loading:this.iframe.hasAttribute(`loading`),url:this.iframe.src,readyState:this.iframe.contentDocument?.readyState?+(this.iframe.contentDocument.readyState===`complete`):-1,contentWindow:!!this.iframe.contentWindow,isConnected:this.iframe.isConnected}:null}getNavigatorInfo(){return navigator?{userAgent:navigator.userAgent,language:navigator.language,onLine:navigator.onLine,screenWidth:window.screen.width,screenHeight:window.screen.height,pixelRatio:window.devicePixelRatio}:null}gatherDebugInfo(e){let t=this.getIframeStatus(),n=this.getNavigatorInfo(),r=`Unknown`;return e instanceof D?r=`FrakRpcError: ${e.code} '${e.message}'`:e instanceof Error?r=e.message:typeof e==`string`&&(r=e),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):`no-config`,navigatorInfo:n?this.base64Encode(n):`no-navigator`,iframeStatus:t?this.base64Encode(t):`not-iframe`,lastRequest:this.lastRequest?this.base64Encode(this.lastRequest):`No Frak request logged`,lastResponse:this.lastResponse?this.base64Encode(this.lastResponse):`No Frak response logged`,clientStatus:this.isSetupDone?`setup`:`not-setup`,error:r}}static empty(){return new e}formatDebugInfo(e){let t=this.gatherDebugInfo(e);return`
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
`.trim()}};const Pn=(()=>{if(typeof navigator>`u`)return!1;let e=navigator.userAgent;if(!(/iPhone|iPad|iPod/i.test(e)||/Macintosh/i.test(e)&&navigator.maxTouchPoints>1))return!1;let t=e.toLowerCase();return t.includes(`instagram`)||t.includes(`fban`)||t.includes(`fbav`)||t.includes(`facebook`)})();function Fn(e){e?localStorage.setItem(J,e):localStorage.removeItem(J)}function In(e,t){try{let n=new URL(e);if(!n.searchParams.has(`u`))return e;let r=zn(window.location.href,t);return n.searchParams.delete(`u`),n.searchParams.append(`u`,r),n.toString()}catch{return e}}function Ln(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 Rn(e){return e.includes(`/common/social`)}function zn(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 Bn(e,t,n,r,i){if(i){let e=In(t,r);window.open(e,`_blank`);return}if(vn(t)){let i=In(t,r);_n(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(Pn&&Rn(t))Ln(r);else{let e=In(t,r);window.location.href=e}}function Vn({iframe:e,targetOrigin:t}){let n=new O;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`:Fn(a.backup);break;case`remove-backup`:localStorage.removeItem(J);break;case`show`:case`hide`:Cn({iframe:e,isVisible:i===`show`});break;case`redirect`:Bn(e,a.baseRedirectUrl,t,a.mergeToken,a.openInNewTab);break}},isConnected:n.promise}}function Hn({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=typeof navigator<`u`?navigator.language?.split(`-`)[0]:void 0,i=e.metadata.lang??(r===`en`||r===`fr`?r:void 0),a=e.domain??(typeof window<`u`?window.location.hostname:``);K.setCacheScope(a,i),K.reset();let o=K.isCacheFresh?void 0:K.resolve(e.domain,e.walletUrl,i),s=Vn({iframe:t,targetOrigin:n}),c=new O,l=Date.now(),u=new Nn(e,t);if(!t.contentWindow)throw new D(it.configError,`The iframe does not have a content window`);let d=at({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await s.isConnected)throw new D(it.clientNotConnected,`The iframe provider isn't connected yet`);return await c.promise,t}},{onRequest(e,t){return u.setLastRequest(e),t},onResponse(e,t){return u.setLastResponse(e,t),t}}],lifecycleHandlers:{iframeLifecycle:(e,t)=>{s.handleEvent(e)}}}),f=Un(d,s),p=async()=>{f(),d.cleanup(),t.remove(),Ct(),K.clearCache(),K.reset()},m;{m=new fn({apiUrl:`https://op-api.gcp.frak.id`,clientId:`f305d11d-b93b-487c-80d4-92deb7903e98`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>(e!==`track`||!t?.properties||`sdkVersion`in t.properties||(t.properties={...t.properties,sdkVersion:`1.0.2`,userAnonymousClientId:k()}),!0)}),m.setGlobalProperties({sdkVersion:`1.0.2`,userAnonymousClientId:k()}),m.init(),m.track(`sdk_initialized`,{sdkVersion:`1.0.2`});let e=!1,t=setTimeout(()=>{e||(e=!0,m?.track(`sdk_iframe_handshake_failed`,{reason:`timeout`}))},3e4);s.isConnected.then(()=>{e||(e=!0,clearTimeout(t),m?.track(`sdk_iframe_connected`,{handshake_duration_ms:Date.now()-l}))}).catch(()=>{e||(e=!0,clearTimeout(t),m?.track(`sdk_iframe_handshake_failed`,{reason:`unknown`}))})}let h=Wn({config:e,rpcClient:d,lifecycleManager:s,configPromise:o,contextSent:c,openPanel:m}).then(()=>u.updateSetupStatus(!0)).catch(e=>{throw c.reject(e),e});return{config:e,debugInfo:u,waitForConnection:s.isConnected,waitForSetup:h,request:d.request,listenerRequest:d.listen,destroy:p,openPanel:m}}function Un(e,t){let n,r,i=()=>e.sendLifecycle({clientLifecycle:`heartbeat`});async function a(){i(),n=setInterval(i,250),r=setTimeout(()=>{o()},3e4),await t.isConnected,o()}function o(){n&&clearInterval(n),r&&clearTimeout(r)}return a(),o}async function Wn({config:e,rpcClient:t,lifecycleManager:n,configPromise:r,contextSent:i,openPanel:a}){await n.isConnected,Mn(t,n.isConnected);let o=new URL(window.location.href),s=o.searchParams.get(`fmt`)??void 0;s&&(o.searchParams.delete(`fmt`),window.history.replaceState({},``,o.toString()));let c=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;K.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})},l=!1,u=e=>{let n=l?void 0:s;l=!0;let r=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,i=k();if(a){let t=a.global??{};a.setGlobalProperties({...t,merchantId:e.merchantId,domain:e.domain??``})}t.sendLifecycle({clientLifecycle:`resolved-config`,data:{merchantId:e.merchantId,domain:e.domain??``,allowedDomains:e.allowedDomains??[],sourceUrl:window.location.href,...i&&{sdkAnonymousId:i},...n&&{pendingMergeToken:n},...r&&{sdkConfig:r}}})};K.isResolved&&(u(K.getConfig()),i.resolve()),r&&(c(await r),u(K.getConfig()),i.resolve());async function d(){let n=e.customizations?.css;n&&t.sendLifecycle({clientLifecycle:`modal-css`,data:{cssLink:n}})}async function f(){let n=e.customizations?.i18n;n&&t.sendLifecycle({clientLifecycle:`modal-i18n`,data:{i18n:n}})}async function p(){if(typeof window>`u`)return;let e=window.localStorage.getItem(J);e&&t.sendLifecycle({clientLifecycle:`restore-backup`,data:{backup:e}})}(await Promise.allSettled([d(),f(),p()])).some(e=>e.status===`rejected`)&&a?.track(`sdk_iframe_handshake_failed`,{reason:`asset_push`})}async function Gn({config:e}){let t=Kn(e),n=await Sn({config:t});if(!n)return;let r=Hn({config:t,iframe:n});if(await r.waitForSetup,await r.waitForConnection)return r}function Kn(e){let t=X(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}var qn=t({DEEP_LINK_SCHEME:()=>mn,DebugInfoGatherer:()=>Nn,FrakContextManager:()=>Bt,base64urlDecode:()=>j,base64urlEncode:()=>A,baseIframeProps:()=>Z,clearAllCache:()=>Ct,compressJsonToB64:()=>dt,computeLegacyProductId:()=>ut,createIFrameFrakClient:()=>Hn,createIframe:()=>Sn,decompressJsonFromB64:()=>pn,findIframeInOpener:()=>wn,formatAmount:()=>bn,generateSsoUrl:()=>ft,getBackendUrl:()=>N,getCache:()=>St,getClientId:()=>k,getCurrencyAmountKey:()=>xn,getSupportedCurrency:()=>X,getSupportedLocale:()=>yn,isChromiumAndroid:()=>hn,isFrakDeepLink:()=>vn,isIOS:()=>Dn,isInAppBrowser:()=>kn,isV1Context:()=>wt,isV2Context:()=>R,locales:()=>Y,mergeAttribution:()=>jn,redirectToExternalBrowser:()=>An,sdkConfigStore:()=>K,setupClient:()=>Gn,ssoPopupFeatures:()=>mt,ssoPopupName:()=>ht,toAndroidIntentUrl:()=>gn,trackEvent:()=>M,triggerDeepLinkWithFallback:()=>_n,withCache:()=>L});function Jn(){return rt(96)}async function Yn(e,t,n){return await e.request({method:`frak_displayEmbeddedWallet`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function Q(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 Xn(e,t,n){return await e.request({method:`frak_displaySharingPage`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function Zn(e){if(typeof window>`u`)return;let t=k();if(!t)return;let n=await K.resolveMerchantId();if(!n)return;let r=`frak-identity-ensured-${n}`;if(!window.sessionStorage.getItem(r))try{let i=N();(await fetch(`${i}/user/identity/ensure`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"x-wallet-sdk-auth":e,"x-frak-client-id":t},body:JSON.stringify({merchantId:n})})).ok&&window.sessionStorage.setItem(r,`1`)}catch{}}async function Qn(e,t){return L(()=>e.request({method:`frak_getMerchantInformation`}),{cacheKey:`frak_getMerchantInformation`,cacheTime:t?.cacheTime})}async function $n(e,t){return L(()=>e.request({method:`frak_getMergeToken`}),{cacheKey:`frak_getMergeToken`,cacheTime:t?.cacheTime})}async function er(e,t){return L(()=>e.request({method:`frak_getUserReferralStatus`}),{cacheKey:`frak_getUserReferralStatus`,cacheTime:t?.cacheTime})}async function tr(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}async function nr(e,t){try{await e.request({method:`frak_sendInteraction`,params:[t,{clientId:k()}]})}catch{}}function rr(e,t,n){return R(t)?(M(e,`user_referred_started`,{referrerClientId:t.c,referrerWallet:t.w,walletStatus:n?.key}),nr(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referrerWallet:t.w,referralTimestamp:t.t}),!0):wt(t)?(M(e,`user_referred_started`,{referrer:t.r,walletStatus:n?.key}),nr(e,{type:`arrival`,referrerWallet:t.r}),!0):!1}function ir(e,t){let n=k();return!n&&!t?null:{v:2,m:e,t:Math.floor(Date.now()/1e3),...n?{c:n}:{},...t?{w:t}:{}}}function ar(e,t){return R(e)?e.w&&t?.wallet?nt(e.w,t.wallet):e.c?k()===e.c:!1:wt(e)&&t?.wallet?nt(e.r,t.wallet):!1}function or(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;if(ar(n,t))return`self-referral`;if(!rr(e,n,t))return`no-referrer`;let i=R(n)?n.m:r?.merchantId,a=r?.alwaysAppendUrl&&i?ir(i,t?.wallet):null;return Bt.replaceUrl({url:window.location?.href,context:a}),M(e,`user_referred_completed`,{status:`success`}),`success`}async function sr(e,{options:t}={}){let n=Bt.parse({url:window.location.href}),r=await dr(e);try{return or(e,{walletStatus:r,frakContext:n,options:t})}catch{}}const cr=`frak:referral-success`;async function lr(e){try{await sr(e)===`success`&&window.dispatchEvent(new Event(cr))}catch{}}async function ur(e){if(typeof window>`u`)return;let t=window.sessionStorage.getItem(`frak-wallet-interaction-token`),n=k();if(!t&&!n)return;let r=e.merchantId??await K.resolveMerchantId();if(!r)return;let i={Accept:`application/json`,"Content-Type":`application/json`};t&&(i[`x-wallet-sdk-auth`]=t),n&&(i[`x-frak-client-id`]=n);let a=N();await fetch(`${a}/user/track/purchase`,{method:`POST`,headers:i,body:JSON.stringify({customerId:e.customerId,orderId:e.orderId,token:e.token,merchantId:r})})}function dr(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(fr(e,t),t));let n=new O,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{fr(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function fr(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),Zn(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function pr(e,{metadata:t,login:n}){return $(e,{steps:{login:n??{}},metadata:t})}function $(e,t){function n(n){return $(e,{...t,steps:{...t.steps,sendTransaction:n}})}function r(n){return $(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function i(n,r){return $(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 Q(e,t,r)}return{params:t,sendTx:n,reward:r,sharing:i,display:a}}async function mr(e,{tx:t,metadata:n}){return(await Q(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}async function hr(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 Q(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??Jn(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}var gr=t({REFERRAL_SUCCESS_EVENT:()=>cr,displayEmbeddedWallet:()=>Yn,displayModal:()=>Q,displaySharingPage:()=>Xn,ensureIdentity:()=>Zn,getMerchantInformation:()=>Qn,getMergeToken:()=>$n,getUserReferralStatus:()=>er,modalBuilder:()=>pr,openSso:()=>gt,prepareSso:()=>tr,processReferral:()=>or,referralInteraction:()=>sr,sendInteraction:()=>nr,sendTransaction:()=>mr,setupReferral:()=>lr,siweAuthenticate:()=>hr,trackPurchaseStatus:()=>ur,watchWalletStatus:()=>dr});async function _r(e,t){if(!window.FrakSetup?.client)return;let n=window.FrakSetup?.modalWalletConfig??{};await Yn(window.FrakSetup.client,e?{...n,metadata:{...n.metadata,targetInteraction:e}}:n,t)}function vr(){`vibrate`in navigator&&navigator.vibrate(10)}function yr(e,t){vr(),_r(e,t)}const br=`frak:client`;function xr(){let e=new CustomEvent(br);window.dispatchEvent(e)}function Sr(e,t){if(window.FrakSetup?.client&&e===`add`){t();return}(e===`add`?window.addEventListener:window.removeEventListener)(br,t,!1)}function Cr(){return window.FrakSetup.core={...qn,...gr},window.FrakSetup?.client?Promise.resolve():L(()=>wr(),{cacheKey:`frak-sdk-init`,cacheTime:1/0}).catch(e=>{M(window.FrakSetup?.client,`sdk_init_failed`,{reason:e instanceof Error?e.message:typeof e==`string`?e:`unknown`,config_missing:!window.FrakSetup?.config})})}async function wr(){if(!window.FrakSetup?.config)throw Error(`[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set.`);let e=await Gn({config:window.FrakSetup.config});if(!e)throw Error(`[Frak SDK] Failed to create client`);window.FrakSetup.client=e,xr(),lr(e),Tr()}function Tr(){let e=new URLSearchParams(window.location.search).get(`frakAction`);e&&e===`share`&&yr()}function Er(e){document.readyState===`complete`||document.readyState===`interactive`?setTimeout(e,1):document.addEventListener(`DOMContentLoaded`,e)}const Dr=new Set;function Or(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 kr(e){if(typeof CSSStyleSheet!=`function`)return e;let t;try{t=new CSSStyleSheet,t.replaceSync(e)}catch{return e}let n=``;for(let e=0;e<t.cssRules.length;e++){let r=t.cssRules[e].cssText;Dr.has(r)||(Dr.add(r),n+=`${r}\n`)}return n}function Ar(e,t){let n=`frak-base-${e}`;if(document.getElementById(n))return;let r=kr(t);if(!r)return;let i=document.createElement(`style`);i.id=n,i.textContent=r,document.head.appendChild(i)}function jr(e,t,n){Or(`frak-placement-${e}-${t}`,n)}const Mr={injectBase:Ar,injectPlacement:jr};Mr.injectBase(`fouce`,`frak-button-share:not(:defined), frak-button-wallet:not(:defined), frak-open-in-app:not(:defined), frak-post-purchase:not(:defined), frak-banner:not(:defined) { display: none !important; }`),Er(Cr);const Nr={"button-share":()=>import(`./ButtonShare.FHUOd26e.js`),"button-wallet":()=>import(`./ButtonWallet.CN2iHSTB.js`),"open-in-app":()=>import(`./OpenInAppButton.C1Yipwka.js`),"post-purchase":()=>import(`./PostPurchase.u0s94KFf.js`),banner:()=>import(`./Banner.BTj-CQM6.js`)},Pr=new MutationObserver(e=>{for(let{addedNodes:t}of e)for(let e of Array.from(t))e.nodeType===Node.ELEMENT_NODE&&Fr(e)});async function Fr(e){let t=e instanceof Element?e.tagName.toLowerCase():``,n=t?.startsWith(`frak-`),r=Array.from(e.querySelectorAll(`:not(:defined)`)).map(e=>e.tagName.toLowerCase()).filter(e=>e.startsWith(`frak-`));n&&!customElements.get(t)&&r.push(t);let i=[...new Set(r)];await Promise.allSettled(i.map(e=>Ir(e)))}async function Ir(e){if(customElements.get(e))return Promise.resolve();try{let t=e.replace(/^frak-/i,``);if(!(t in Nr))throw Error(`Component ${e} is not supported.`);await Nr[t]()}catch{}}Fr(document.body),Pr.observe(document.documentElement,{subtree:!0,childList:!0});export{D as C,it as S,mn as _,yr as a,K as b,cr as c,Qn as d,Xn as f,kn as g,_n as h,Sr as i,er as l,xn as m,Er as n,_r as o,An as p,Cr as r,ur as s,Mr as t,$n as u,bn as v,M as x,X as y};
|
|
1
|
+
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};const n=`.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
|
+
}`;function r(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 i(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 a(e,t,n){r(`frak-placement-${e}-${t}`,n)}const o={injectBase:i,injectPlacement:a};function s(e){document.readyState===`complete`||document.readyState===`interactive`?setTimeout(e,1):document.addEventListener(`DOMContentLoaded`,e)}const c={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 l=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}}},u=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 d(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 d(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{}}async function f(e){let t={origin:r,source:null};for(let n of i)n.onRequest&&await n.onRequest(e,t);return e}async function p(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 m(e){try{if(new URL(e.origin).origin.toLowerCase()!==new URL(r).origin.toLowerCase())return}catch{return}if(s(e.data)){await d(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 p(e.data,r)}catch{return}let n=o.get(e.data.id);n&&n(t)}async function h(e){let n=e;try{n=await f(e)}catch(e){throw e}t.postMessage(n,r)}function g(e){t.postMessage(e,r)}function _(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}n.addEventListener(`message`,m);function v(e){let t=_(),n=new u;return o.set(t,e=>{e.error?n.reject(new l(e.error.code,e.error.message,e.error.data)):n.resolve(e.result),o.delete(t)}),h({id:t,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{o.delete(t),n.reject(e)}),n.promise}function y(e,t){let n=_();return o.set(n,e=>{e.error?o.delete(n):t(e.result)}),h({id:n,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{o.delete(n)}),()=>{o.delete(n)}}function b(){n.removeEventListener(`message`,m),o.clear()}return{request:v,listen:y,sendLifecycle:g,cleanup:b}}function f(e){return new TextEncoder().encode(JSON.stringify(e))}function p(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}const m=`frak-client-id`;function h(){return typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}function g(){if(typeof window>`u`||!window.localStorage)return h();let e=localStorage.getItem(m);return e||(e=h(),localStorage.setItem(m,e)),e}var _=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}};const v=new _(1024),y=new _(1024),b=new _(1024);async function x(e,{cacheKey:t,cacheTime:n=3e4}){if(n>0){let e=y.get(t);if(e&&Date.now()-e.created<n)return e.data}let r=b.get(t);if(r&&Date.now()-r<1e3)throw Error(`Cache: ${t} recently failed, backing off`);let i=v.get(t);i||(i=e(),v.set(t,i));try{let e=await i;return y.set(t,{data:e,created:Date.now()}),b.delete(t),e}catch(e){throw b.set(t,Date.now()),e}finally{v.delete(t)}}function S(){v.clear(),y.clear(),b.clear()}const C=`https://backend.frak.id`;function ee(e){return e.includes(`localhost:3000`)||e.includes(`localhost:3010`)}function te(e){return ee(e)?`https://localhost:3030`:e.includes(`wallet-dev.frak.id`)||e.includes(`wallet.gcp-dev.frak.id`)?`https://backend.gcp-dev.frak.id`:C}function w(e){if(e)return te(e);if(typeof window<`u`){let e=window.FrakSetup?.client?.config?.walletUrl;if(e)return te(e)}return C}const T=`__frakSdkConfig`,ne=`frak-config-cache`,E=`frak-merchant-id`,D={key:ne},O=typeof window<`u`;function k(){return{isResolved:!1,merchantId:``}}let A=null;function re(){if(!O)return null;try{let e=localStorage.getItem(D.key);if(!e)return null;let t=JSON.parse(e);return t.config?.isResolved?(A=t,t):null}catch{return null}}function ie(){return(A??re())?.config}function ae(){let e=A??re();return e?Date.now()-e.timestamp<3e4:!1}function oe(e){if(!(!O||!e.isResolved))try{let t={config:e,timestamp:Date.now()};localStorage.setItem(D.key,JSON.stringify(t)),A=t}catch{}}function se(){if(O){A=null;try{localStorage.removeItem(D.key)}catch{}}}function ce(){O&&(window[T]||(window[T]=ie()??k()))}ce();function j(){return O?window[T]??k():k()}function le(e){O&&window.dispatchEvent(new CustomEvent(`frak:config`,{detail:e}))}function ue(e){return e??(O?window.location.hostname:``)}async function de(e,t,n){try{let r=w(t),i=n?`&lang=${encodeURIComponent(n)}`:``,a=await fetch(`${r}/user/merchant/resolve?domain=${encodeURIComponent(e)}${i}`);if(!a.ok)return;let o=await a.json();if(O)try{sessionStorage.setItem(E,o.merchantId)}catch{}return o}catch{return}}const M={getConfig:j,get isResolved(){return j().isResolved},get isCacheFresh(){return ae()},setCacheScope(e,t){D.key=`${ne}:${`${e}:${t??``}`}`,A=null},setConfig(e){if(O&&(window[T]=e),oe(e),le(e),O&&e.merchantId)try{sessionStorage.setItem(E,e.merchantId)}catch{}},reset(){let e=ie()??k();O&&(window[T]=e),le(e)},clearCache(){if(se(),S(),O)try{sessionStorage.removeItem(E)}catch{}},resolve(e,t,n){let r=ue(e);return r?x(async()=>{let e=await de(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=j();if(e.isResolved&&e.merchantId)return e.merchantId;if(O)try{return sessionStorage.getItem(E)??void 0}catch{}},async resolveMerchantId(e,t){return M.getMerchantId()||(await M.resolve(e,t))?.merchantId}};function N(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function P(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 fe(e){return N(f(e))}function pe(e,t,n,r,i,a){let o=fe(me({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})),s=new URL(e);return s.pathname=`/sso`,s.searchParams.set(`p`,o),s.toString()}function me(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}}}const he=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,ge=`frak-sso`;async function _e(e,t){let{metadata:n,customizations:r,walletUrl:i}=e.config;if(t.openInSameWindow??!!t.redirectUrl)return await e.request({method:`frak_openSso`,params:[t,n.name,r?.css]});let a=t.ssoPopupUrl??pe(i??`https://wallet.frak.id`,t,await M.resolveMerchantId()??``,n.name,g(),r?.css),o=window.open(a,ge,he);if(!o)throw Error(`Popup was blocked. Please allow popups for this site.`);return o.focus(),await e.request({method:`frak_openSso`,params:[t,n.name,r?.css]})??{}}function F(e,t,n){if(e)try{e.openPanel?.track(t,n)}catch{}}const ve=/^0x[a-fA-F0-9]{40}$/;function I(e){return typeof e==`string`&&ve.test(e)}function ye(e,t){return e.toLowerCase()===t.toLowerCase()}function be(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 xe=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Se(e){let t=`0x`;for(let n=0;n<20;n++)t+=xe[e[n]];return t}function Ce(e){return`r`in e&&!(`v`in e)}function L(e){return`v`in e&&e.v===2}const we=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Te(e){return typeof e==`string`&&we.test(e)}function Ee(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 De(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 Oe(e){if(!Te(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`&&I(e.w);if(!t&&!n||t&&!Te(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(Ee(e.m),a),a+=16,i.setUint32(a,e.t,!1),a+=4,t&&(r.set(Ee(e.c),a),a+=16),n&&(r.set(be(e.w),a),a+=20),r}function ke(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=De(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=De(e.subarray(a,a+16)),a+=16),r){let t=Se(e.subarray(a,a+20));if(!I(t))return null;c.w=t,a+=20}return c}const R=`fCtx`;function z(e){if(e)try{if(L(e)){let t=Oe(e);return t?N(t):void 0}return N(be(e.r))}catch{}}function Ae(e){if(!(!e||e.length===0))try{let t=P(e);if(t.length!==20)return ke(t)||void 0;let n=Se(t);if(I(n))return{r:n}}catch{}}function je({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(R);return t?Ae(t):null}const Me=`frak`;function Ne(e,t){let n=L(e);return{utm_source:t.utmSource??Me,utm_medium:t.utmMedium??`referral`,utm_campaign:t.utmCampaign??(n?e.m:void 0),utm_content:t.utmContent,utm_term:t.utmTerm,via:t.via??Me,ref:t.ref??(n?e.c:void 0)}}function Pe(e,t,n){let r=Ne(t,n??{});for(let[t,n]of Object.entries(r))n===void 0||n===``||e.searchParams.has(t)||e.searchParams.set(t,n)}function Fe({url:e,context:t,attribution:n}){if(!e)return null;let r=z(t);if(!r)return null;let i=new URL(e);return i.searchParams.set(R,r),Pe(i,t,n),i.toString()}function Ie(e){let t=new URL(e);return t.searchParams.delete(R),t.toString()}function Le({url:e,context:t}){if(!window.location?.href||typeof window>`u`)return;let n=e??window.location.href,r;r=t===null?Ie(n):Fe({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}const B={compress:z,decompress:Ae,parse:je,update:Fe,remove:Ie,replaceUrl:Le};var Re=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{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 null}}async fetch(e,t,n={}){let r=`${this.baseUrl}${e}`;return this.post(r,t,n,0)}},ze=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 Re({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}},Be=typeof document<`u`?document.currentScript:null;function Ve(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var He=class extends ze{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=Be,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=()=>{e(null)},document.head.appendChild(n)})}return await import(`./replay-V6FXES7X.BoL9fAjx.js`)}catch{return 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[Ve(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 V=`nexus-wallet-backup`,H=`frakwallet://`;function Ue(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}})}).catch(e=>{}),n.searchParams.delete(`sso`),window.history.replaceState({},``,n.toString()))}function We(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}const Ge=H.replace(`://`,``);function Ke(e){return`intent://${e.slice(13)}#Intent;scheme=${Ge};end`}function U(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=We()&&qe(e)?Ke(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function qe(e){return e.startsWith(H)}const W={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`}};function Je({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);r.id=W.id,r.name=W.name,r.allow=W.allow,r.style.zIndex=W.style.zIndex.toString(),Ye({iframe:r,isVisible:!1});let i=t?.walletUrl??e??`https://wallet.frak.id`,a=g();return Ze(i),Ze(w(i)),r.src=`${i}/listener?clientId=${encodeURIComponent(a)}`,new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function Ye({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 Xe(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{return null}}function Ze(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 Qe=(()=>{if(typeof navigator>`u`)return!1;let e=navigator.userAgent;if(!(/iPhone|iPad|iPod/i.test(e)||/Macintosh/i.test(e)&&navigator.maxTouchPoints>1))return!1;let t=e.toLowerCase();return t.includes(`instagram`)||t.includes(`fban`)||t.includes(`fbav`)||t.includes(`facebook`)})();function $e(e){e?localStorage.setItem(V,e):localStorage.removeItem(V)}function G(e,t){try{let n=new URL(e);if(!n.searchParams.has(`u`))return e;let r=nt(window.location.href,t);return n.searchParams.delete(`u`),n.searchParams.append(`u`,r),n.toString()}catch{return e}}function et(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 tt(e){return e.includes(`/common/social`)}function nt(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 rt(e,t,n,r,i){if(i){let e=G(t,r);window.open(e,`_blank`);return}if(qe(t)){let i=G(t,r);U(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(Qe&&tt(t))et(r);else{let e=G(t,r);window.location.href=e}}function it({iframe:e,targetOrigin:t}){let n=new u;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`:$e(a.backup);break;case`remove-backup`:localStorage.removeItem(V);break;case`show`:case`hide`:Ye({iframe:e,isVisible:i===`show`});break;case`redirect`:rt(e,a.baseRedirectUrl,t,a.mergeToken,a.openInNewTab);break}},isConnected:n.promise}}function at({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=typeof navigator<`u`?navigator.language?.split(`-`)[0]:void 0,i=e.metadata.lang??(r===`en`||r===`fr`?r:void 0),a=e.domain??(typeof window<`u`?window.location.hostname:``);M.setCacheScope(a,i),M.reset();let o=M.isCacheFresh?void 0:M.resolve(e.domain,e.walletUrl,i),s=it({iframe:t,targetOrigin:n}),f=new u,p=Date.now();if(!t.contentWindow)throw new l(c.configError,`The iframe does not have a content window`);let m=d({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await s.isConnected)throw new l(c.clientNotConnected,`The iframe provider isn't connected yet`);return await f.promise,t}}],lifecycleHandlers:{iframeLifecycle:(e,t)=>{s.handleEvent(e)}}}),h=ot(m,s),_=async()=>{h(),m.cleanup(),t.remove(),S(),M.clearCache(),M.reset()},v;{v=new He({apiUrl:`https://op-api.gcp.frak.id`,clientId:`f305d11d-b93b-487c-80d4-92deb7903e98`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>(e!==`track`||!t?.properties||`sdkVersion`in t.properties||(t.properties={...t.properties,sdkVersion:`1.1.0`,userAnonymousClientId:g()}),!0)}),v.setGlobalProperties({sdkVersion:`1.1.0`,userAnonymousClientId:g()}),v.init(),v.track(`sdk_initialized`,{sdkVersion:`1.1.0`});let e=!1,t=setTimeout(()=>{e||(e=!0,v?.track(`sdk_iframe_handshake_failed`,{reason:`timeout`}))},3e4);s.isConnected.then(()=>{e||(e=!0,clearTimeout(t),v?.track(`sdk_iframe_connected`,{handshake_duration_ms:Date.now()-p}))}).catch(()=>{e||(e=!0,clearTimeout(t),v?.track(`sdk_iframe_handshake_failed`,{reason:`unknown`}))})}let y=st({config:e,rpcClient:m,lifecycleManager:s,configPromise:o,contextSent:f,openPanel:v}).then(()=>{}).catch(e=>{throw f.reject(e),e});return{config:e,waitForConnection:s.isConnected,waitForSetup:y,request:m.request,listenerRequest:m.listen,destroy:_,openPanel:v}}function ot(e,t){let n,r,i=()=>e.sendLifecycle({clientLifecycle:`heartbeat`});async function a(){i(),n=setInterval(i,250),r=setTimeout(()=>{o()},3e4),await t.isConnected,o()}function o(){n&&clearInterval(n),r&&clearTimeout(r)}return a(),o}async function st({config:e,rpcClient:t,lifecycleManager:n,configPromise:r,contextSent:i,openPanel:a}){await n.isConnected,Ue(t,n.isConnected);let o=new URL(window.location.href),s=o.searchParams.get(`fmt`)??void 0;s&&(o.searchParams.delete(`fmt`),window.history.replaceState({},``,o.toString()));let c=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;M.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})},l=!1,u=e=>{let n=l?void 0:s;l=!0;let r=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,i=g();if(a){let t=a.global??{};a.setGlobalProperties({...t,merchantId:e.merchantId,domain:e.domain??``})}t.sendLifecycle({clientLifecycle:`resolved-config`,data:{merchantId:e.merchantId,domain:e.domain??``,allowedDomains:e.allowedDomains??[],sourceUrl:window.location.href,...i&&{sdkAnonymousId:i},...n&&{pendingMergeToken:n},...r&&{sdkConfig:r}}})};M.isResolved&&(u(M.getConfig()),i.resolve()),r&&(c(await r),u(M.getConfig()),i.resolve());async function d(){let n=e.customizations?.css;n&&t.sendLifecycle({clientLifecycle:`modal-css`,data:{cssLink:n}})}async function f(){let n=e.customizations?.i18n;n&&t.sendLifecycle({clientLifecycle:`modal-i18n`,data:{i18n:n}})}async function p(){if(typeof window>`u`)return;let e=window.localStorage.getItem(V);e&&t.sendLifecycle({clientLifecycle:`restore-backup`,data:{backup:e}})}(await Promise.allSettled([d(),f(),p()])).some(e=>e.status===`rejected`)&&a?.track(`sdk_iframe_handshake_failed`,{reason:`asset_push`})}function ct(){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 K=ct();function lt(){return typeof navigator>`u`?!1:K?!0:/Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function ut(){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 dt=ut();function ft(e){K&&e.startsWith(`https://`)?window.location.href=`x-safari-https://${e.slice(8)}`:K&&e.startsWith(`http://`)?window.location.href=`x-safari-http://${e.slice(7)}`:window.location.href=`https://backend.frak.id/common/social?u=${encodeURIComponent(e)}`}function pt(e){return p(P(e))}const q={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function J(e){return e&&e in q?e:`eur`}function mt(e){return e?q[e]??q.eur:q.eur}function ht(e,t){let n=mt(t),r=J(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function gt(e){return e?`${e}Amount`:`eurAmount`}async function _t({config:e}){let t=vt(e),n=await Je({config:t});if(!n)return;let r=at({config:t,iframe:n});if(await r.waitForSetup,await r.waitForConnection)return r}function vt(e){let t=J(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}function yt({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}var bt=t({DEEP_LINK_SCHEME:()=>H,FrakContextManager:()=>B,base64urlDecode:()=>P,base64urlEncode:()=>N,baseIframeProps:()=>W,clearAllCache:()=>S,compressJsonToB64:()=>fe,createIFrameFrakClient:()=>at,decompressJsonFromB64:()=>pt,findIframeInOpener:()=>Xe,formatAmount:()=>ht,generateSsoUrl:()=>pe,getBackendUrl:()=>w,getClientId:()=>g,getCurrencyAmountKey:()=>gt,getSupportedCurrency:()=>J,isIOS:()=>K,isInAppBrowser:()=>dt,isMobile:()=>lt,mergeAttribution:()=>yt,redirectToExternalBrowser:()=>ft,sdkConfigStore:()=>M,setupClient:()=>_t,ssoPopupFeatures:()=>he,ssoPopupName:()=>ge,trackEvent:()=>F,triggerDeepLinkWithFallback:()=>U,withCache:()=>x});async function xt(e,t,n){return await e.request({method:`frak_displayEmbeddedWallet`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function Y(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 St(e,t,n){return await e.request({method:`frak_displaySharingPage`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function Ct(e){if(typeof window>`u`)return;let t=g();if(!t)return;let n=await M.resolveMerchantId();if(!n)return;let r=`frak-identity-ensured-${n}`;if(!window.sessionStorage.getItem(r))try{let i=w();(await fetch(`${i}/user/identity/ensure`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"x-wallet-sdk-auth":e,"x-frak-client-id":t},body:JSON.stringify({merchantId:n})})).ok&&window.sessionStorage.setItem(r,`1`)}catch{}}async function wt(e,t){return x(()=>e.request({method:`frak_getMerchantInformation`}),{cacheKey:`frak_getMerchantInformation`,cacheTime:t?.cacheTime})}async function Tt(e,t){return x(()=>e.request({method:`frak_getMergeToken`}),{cacheKey:`frak_getMergeToken`,cacheTime:t?.cacheTime})}async function Et(e,t){return x(()=>e.request({method:`frak_getUserReferralStatus`}),{cacheKey:`frak_getUserReferralStatus`,cacheTime:t?.cacheTime})}async function Dt(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}async function X(e,t){try{await e.request({method:`frak_sendInteraction`,params:[t,{clientId:g()}]})}catch{}}function Ot(e,t,n){return L(t)?(F(e,`user_referred_started`,{referrerClientId:t.c,referrerWallet:t.w,walletStatus:n?.key}),X(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referrerWallet:t.w,referralTimestamp:t.t}),!0):Ce(t)?(F(e,`user_referred_started`,{referrer:t.r,walletStatus:n?.key}),X(e,{type:`arrival`,referrerWallet:t.r}),!0):!1}function kt(e,t){let n=g();return!n&&!t?null:{v:2,m:e,t:Math.floor(Date.now()/1e3),...n?{c:n}:{},...t?{w:t}:{}}}function At(e,t){return L(e)?e.w&&t?.wallet?ye(e.w,t.wallet):e.c?g()===e.c:!1:Ce(e)&&t?.wallet?ye(e.r,t.wallet):!1}function jt(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;if(At(n,t))return`self-referral`;if(!Ot(e,n,t))return`no-referrer`;let i=L(n)?n.m:r?.merchantId,a=r?.alwaysAppendUrl&&i?kt(i,t?.wallet):null;return B.replaceUrl({url:window.location?.href,context:a}),F(e,`user_referred_completed`,{status:`success`}),`success`}async function Mt(e,{options:t}={}){let n=B.parse({url:window.location.href}),r=await Q(e);try{return jt(e,{walletStatus:r,frakContext:n,options:t})}catch{}}const Z=`frak:referral-success`;async function Nt(e){try{await Mt(e)===`success`&&window.dispatchEvent(new Event(Z))}catch{}}async function Pt(e){if(typeof window>`u`)return;let t=window.sessionStorage.getItem(`frak-wallet-interaction-token`),n=g();if(!t&&!n)return;let r=e.merchantId??await M.resolveMerchantId();if(!r)return;let i={Accept:`application/json`,"Content-Type":`application/json`};t&&(i[`x-wallet-sdk-auth`]=t),n&&(i[`x-frak-client-id`]=n);let a=w();await fetch(`${a}/user/track/purchase`,{method:`POST`,headers:i,body:JSON.stringify({customerId:e.customerId,orderId:e.orderId,token:e.token,merchantId:r})})}function Q(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(Ft(e,t),t));let n=new u,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{Ft(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function Ft(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),Ct(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function It(e,{metadata:t,login:n}){return $(e,{steps:{login:n??{}},metadata:t})}function $(e,t){function n(n){return $(e,{...t,steps:{...t.steps,sendTransaction:n}})}function r(n){return $(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function i(n,r){return $(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 Y(e,t,r)}return{params:t,sendTx:n,reward:r,sharing:i,display:a}}async function Lt(e,{tx:t,metadata:n}){return(await Y(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function Rt(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 zt(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 Y(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??Rt(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}var Bt=t({REFERRAL_SUCCESS_EVENT:()=>Z,displayEmbeddedWallet:()=>xt,displayModal:()=>Y,displaySharingPage:()=>St,ensureIdentity:()=>Ct,getMerchantInformation:()=>wt,getMergeToken:()=>Tt,getUserReferralStatus:()=>Et,modalBuilder:()=>It,openSso:()=>_e,prepareSso:()=>Dt,processReferral:()=>jt,referralInteraction:()=>Mt,sendInteraction:()=>X,sendTransaction:()=>Lt,setupReferral:()=>Nt,siweAuthenticate:()=>zt,trackPurchaseStatus:()=>Pt,watchWalletStatus:()=>Q});async function Vt(e,t){if(!window.FrakSetup?.client)return;let n=window.FrakSetup?.modalWalletConfig??{};await xt(window.FrakSetup.client,e?{...n,metadata:{...n.metadata,targetInteraction:e}}:n,t)}function Ht(){`vibrate`in navigator&&navigator.vibrate(10)}function Ut(e,t){Ht(),Vt(e,t)}const Wt=`frak:client`;function Gt(){let e=new CustomEvent(Wt);window.dispatchEvent(e)}function Kt(e,t){if(window.FrakSetup?.client&&e===`add`){t();return}(e===`add`?window.addEventListener:window.removeEventListener)(Wt,t,!1)}function qt(){return window.FrakSetup.core={...bt,...Bt},window.FrakSetup?.client?Promise.resolve():x(()=>Jt(),{cacheKey:`frak-sdk-init`,cacheTime:1/0}).catch(e=>{F(window.FrakSetup?.client,`sdk_init_failed`,{reason:e instanceof Error?e.message:typeof e==`string`?e:`unknown`,config_missing:!window.FrakSetup?.config})})}async function Jt(){if(!window.FrakSetup?.config)throw Error(`[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set.`);let e=await _t({config:window.FrakSetup.config});if(!e)throw Error(`[Frak SDK] Failed to create client`);window.FrakSetup.client=e,Gt(),Nt(e),Yt()}function Yt(){let e=new URLSearchParams(window.location.search).get(`frakAction`);e&&e===`share`&&Ut()}o.injectBase(`shared`,n),o.injectBase(`fouce`,`frak-button-share:not(:defined), frak-button-wallet:not(:defined), frak-open-in-app:not(:defined), frak-post-purchase:not(:defined), frak-banner:not(:defined) { display: none !important; }`),s(qt);const Xt={"button-share":()=>import(`./ButtonShare.elMtdxF3.js`),"button-wallet":()=>import(`./ButtonWallet.BUUPX0gO.js`),"open-in-app":()=>import(`./OpenInAppButton.Dgb-qhM8.js`),"post-purchase":()=>import(`./PostPurchase.Cy7-FrRh.js`),banner:()=>import(`./Banner.B1y3jwHv.js`)},Zt=new MutationObserver(e=>{for(let{addedNodes:t}of e)for(let e of Array.from(t))e.nodeType===Node.ELEMENT_NODE&&Qt(e)});async function Qt(e){let t=e instanceof Element?e.tagName.toLowerCase():``,n=t?.startsWith(`frak-`),r=Array.from(e.querySelectorAll(`:not(:defined)`)).map(e=>e.tagName.toLowerCase()).filter(e=>e.startsWith(`frak-`));n&&!customElements.get(t)&&r.push(t);let i=[...new Set(r)];await Promise.allSettled(i.map(e=>$t(e)))}async function $t(e){if(customElements.get(e))return Promise.resolve();try{let t=e.replace(/^frak-/i,``);if(!(t in Xt))throw Error(`Component ${e} is not supported.`);await Xt[t]()}catch{}}Qt(document.body),Zt.observe(document.documentElement,{subtree:!0,childList:!0});export{s as C,l as S,n as T,H as _,Pt as a,F as b,Tt as c,ft as d,ht as f,U as g,J as h,Vt as i,wt as l,lt as m,Kt as n,St as o,gt as p,Ut as r,Et as s,qt as t,Z as u,dt as v,o as w,c as x,M as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){return()=>{}}var t=null;function n(n,r){if(typeof document>`u`||typeof window>`u`)return;t&&t();let i=n.maxEventsPerChunk??200,a=n.flushIntervalMs??1e4,o=n.maxPayloadBytes??1048576,s=[],c=0,l=null;function u(e){if(s.length===0)return;let t=JSON.stringify(s);if(new TextEncoder().encode(t).length>o){if(s.length>1){let t=Math.floor(s.length/2),n=s.slice(0,t),r=s.slice(t),i=e&&n.some(e=>e.type===2);s=n,u(i),s=r,u(!1);return}s=[];return}let n=s[0].timestamp,i=s[s.length-1].timestamp;try{r({chunk_index:c,events_count:s.length,is_full_snapshot:e,started_at:new Date(n).toISOString(),ended_at:new Date(i).toISOString(),payload:t}),c+=1,s=[]}catch(e){throw e}}function d(e){let t=e||s.some(e=>e.type===2);s.length>=i?u(t):e&&s.length>0&&u(!0)}let f=n.maskAllText!==!1,p=n.unmaskTextSelector,m=e({emit(e,t){s.push(e),d(!!t)},checkoutEveryNms:a,maskAllInputs:n.maskAllInputs??!0,maskTextSelector:f?`*`:`[data-openpanel-replay-mask]`,maskTextFn:f&&p?(e,t)=>t?.closest(p)?e:e.replace(/\S/g,`*`):void 0,blockSelector:n.blockSelector??`[data-openpanel-replay-block]`,blockClass:n.blockClass,ignoreSelector:n.ignoreSelector});l=setInterval(()=>{s.length>0&&u(s.some(e=>e.type===2))},a);function h(){document.visibilityState===`hidden`&&s.length>0&&u(s.some(e=>e.type===2))}function g(){s.length>0&&u(s.some(e=>e.type===2))}document.addEventListener(`visibilitychange`,h),window.addEventListener(`pagehide`,g),t=()=>{s.length>0&&u(s.some(e=>e.type===2)),l&&=(clearInterval(l),null),document.removeEventListener(`visibilitychange`,h),window.removeEventListener(`pagehide`,g),m?.(),t=null}}function r(){t&&t()}export{n as startReplayRecorder,r as stopReplayRecorder};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{o as e}from"./loader.js";async function t(t,n,r){window.FrakSetup?.client&&await e(window.FrakSetup.client,{...r?.link&&{link:r.link},...r?.products?.length&&{products:r.products},...t&&{metadata:{targetInteraction:t}}},n)}export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{y as e}from"./loader.js";import{l as t,o as n,s as r}from"./usePlacement.BgMXY5CX.js";function i(){let[i,a]=r(0);return t(()=>{let e=e=>{a(e=>e+1)};return window.addEventListener(`frak:config`,e),a(e=>e+1),()=>window.removeEventListener(`frak:config`,e)},[]),n(()=>e.getConfig().components,[i])}export{i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{w as e}from"./loader.js";import{l as t,r as n}from"./usePlacement.BgMXY5CX.js";function r(r,i,a,o,s){t(()=>{s&&e.injectBase(`shared`,s),e.injectBase(r,o??n)},[r]),t(()=>{!i||!a||e.injectPlacement(r,i,a)},[r,i,a])}export{r as t};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import{C as e,n as t,t as n,y as r}from"./loader.js";var i,a,o,s,c,l,u,d,f,p,m,h={},g=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v=Array.isArray;function y(e,t){for(var n in t)e[n]=t[n];return e}function b(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function x(e,t,n){var r,a,o,s={};for(o in t)o==`key`?r=t[o]:o==`ref`?a=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?i.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 S(e,s,r,a,null)}function S(e,t,n,r,i){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++o,__i:-1,__u:0};return i==null&&a.vnode!=null&&a.vnode(s),s}function C(e){return e.children}function w(e,t){this.props=e,this.context=t}function T(e,t){if(t==null)return e.__?T(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`?T(e):null}function E(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],o=y({},t);o.__v=t.__v+1,a.vnode&&a.vnode(o),F(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??T(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,re(r,o,i),t.__e=t.__=null,o.__e!=n&&D(o)}}function D(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}),D(e)}function O(e){(!e.__d&&(e.__d=!0)&&s.push(e)&&!k.__r++||c!=a.debounceRendering)&&((c=a.debounceRendering)||l)(k)}function k(){try{for(var e,t=1;s.length;)s.length>t&&s.sort(u),e=s.shift(),t=s.length,E(e)}finally{s.length=k.__r=0}}function ee(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,_,v,y,b=r&&r.__k||g,x=t.length;for(c=A(n,t,b,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&b[p.__i]||h,p.__i=d,v=F(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&L(f.ref,null,p),u.push(p.ref,p.__c||m,p)),_==null&&m!=null&&(_=m),(y=!!(4&p.__u))||f.__k===p.__k?c=j(p,c,e,y):typeof p.type==`function`&&v!==void 0?c=v:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=_,c}function A(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]=S(null,o,null,null,null):v(o)?o=e.__k[a]=S(C,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=S(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=T(s)),oe(s,s));return r}function j(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=j(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=T(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function M(e,t){return t||=[],e==null||typeof e==`boolean`||(v(e)?e.some(function(e){M(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`||_.test(t)?n:n+`px`}function N(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(d,`$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.u=r.u:(n.u=f,e.addEventListener(t,a?m:p,a)):e.removeEventListener(t,a?m:p,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 P(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=f++;else if(t.t<n.u)return;return n(a.event?a.event(t):t)}}}function F(e,t,n,r,i,o,s,c,l,u){var d,f,p,m,h,_,x,S,T,E,D,O,k,A,j,M=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),o=[c=t.__e=n.__e]),(d=a.__b)&&d(t);n:if(typeof M==`function`)try{if(S=t.props,T=M.prototype&&M.prototype.render,E=(d=M.contextType)&&r[d.__c],D=d?E?E.props.value:d.__:r,n.__c?x=(f=t.__c=n.__c).__=f.__E:(T?t.__c=f=new M(S,D):(t.__c=f=new w(S,D),f.constructor=M,f.render=se),E&&E.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),T&&f.__s==null&&(f.__s=f.state),T&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=y({},f.__s)),y(f.__s,M.getDerivedStateFromProps(S,f.__s))),m=f.props,h=f.state,f.__v=t,p)T&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),T&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(T&&M.getDerivedStateFromProps==null&&S!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(S,D),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(S,f.__s,D)){t.__v!=n.__v&&(f.props=S,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),g.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(S,f.__s,D),T&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,_)})}if(f.context=D,f.props=S,f.__P=e,f.__e=!1,O=a.__r,k=0,T)f.state=f.__s,f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),g.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++k<25);f.state=f.__s,f.getChildContext!=null&&(r=y(y({},r),f.getChildContext())),T&&!p&&f.getSnapshotBeforeUpdate!=null&&(_=f.getSnapshotBeforeUpdate(m,h)),A=d!=null&&d.type===C&&d.key==null?ie(d.props.children):d,c=ee(e,v(A)?A:[A],t,n,r,i,o,s,c,l,u),f.base=t.__e,t.__u&=-161,f.__h.length&&s.push(f),x&&(f.__E=f.__=null)}catch(e){if(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[o.indexOf(c)]=null,t.__e=c}else{for(j=o.length;j--;)b(o[j]);I(t)}else t.__e=n.__e,t.__k=n.__k,e.then||I(t);a.__e(e,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=ae(n.__e,t,n,r,i,o,s,l,u);return(d=a.diffed)&&d(t),128&t.__u?void 0:c}function I(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(I))}function re(e,t,n){for(var r=0;r<n.length;r++)L(n[r],n[++r],n[++r]);a.__c&&a.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){a.__e(e,t.__v)}})}function ie(e){return typeof e!=`object`||!e||e.__b>0?e:v(e)?e.map(ie):y({},e)}function ae(e,t,n,r,o,s,c,l,u){var d,f,p,m,g,_,y,x=n.props||h,S=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((g=s[d])&&`setAttribute`in g==!!C&&(C?g.localName==C:g.nodeType==3)){e=g,s[d]=null;break}}if(e==null){if(C==null)return document.createTextNode(S);e=document.createElementNS(o,C,S.is&&S),l&&=(a.__m&&a.__m(t,s),!1),s=null}if(C==null)x===S||l&&e.data==S||(e.data=S);else{if(s&&=i.call(e.childNodes),!l&&s!=null)for(x={},d=0;d<e.attributes.length;d++)x[(g=e.attributes[d]).name]=g.value;for(d in x)g=x[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in S||d==`value`&&`defaultValue`in S||d==`checked`&&`defaultChecked`in S||N(e,d,null,g,o);for(d in S)g=S[d],d==`children`?m=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?_=g:d==`checked`?y=g:l&&typeof g!=`function`||x[d]===g||N(e,d,g,x[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,v(m)?m:[m],t,n,r,C==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:n.__k&&T(n,0),l,u),s!=null)for(d=s.length;d--;)b(s[d]);l||(d=`value`,C==`progress`&&_==null?e.removeAttribute(`value`):_!=null&&(_!==e[d]||C==`progress`&&!_||C==`option`&&_!=x[d])&&N(e,d,_,x[d],o),d=`checked`,y!=null&&y!=e[d]&&N(e,d,y,x[d],o))}return e}function L(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){a.__e(e,n)}}function oe(e,t,n){var r,i;if(a.unmount&&a.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||L(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){a.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&oe(r[i],t,n||typeof e.type!=`function`);n||b(e.__e),e.__c=e.__=e.__e=void 0}function se(e,t,n){return this.constructor(e,n)}function R(e,t,n){var r,o,s,c;t==document&&(t=document.documentElement),a.__&&a.__(e,t),o=(r=typeof n==`function`)?null:n&&n.__k||t.__k,s=[],c=[],F(t,e=(!r&&n||t).__k=x(C,null,[e]),o||h,h,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?i.call(t.childNodes):null,s,!r&&n?n:o?o.__e:t.firstChild,r,c),re(s,e,c)}function ce(e,t){R(e,t,ce)}function z(e,t,n){var r,a,o,s,c=y({},e.props);for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)o==`key`?r=t[o]:o==`ref`?a=t[o]:c[o]=t[o]===void 0&&s!=null?s[o]:t[o];return arguments.length>2&&(c.children=arguments.length>3?i.call(arguments,2):n),S(e.type,c,r||e.key,a||e.ref,null)}i=g.slice,a={__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}},o=0,w.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=y({},this.state);typeof e==`function`&&(e=e(y({},n),this.props)),e&&y(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),O(this))},w.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),O(this))},w.prototype.render=C,s=[],l=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=function(e,t){return e.__v.__b-t.__v.__b},k.__r=0,d=/(PointerCapture)$|Capture$/i,f=0,p=P(!1),m=P(!0);function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(this,arguments)}function V(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}var le=[`context`,`children`],ue=[`useFragment`];function de(e,t,n,r){function i(){var t,n=Reflect.construct(HTMLElement,[],i);return n._vdomComponent=e,r&&r.shadow?(n._root=n.attachShadow({mode:r.mode||`open`,serializable:(t=r.serializable)!=null&&t}),r.adoptedStyleSheets&&(n._root.adoptedStyleSheets=r.adoptedStyleSheets)):n._root=n,n}return(i.prototype=Object.create(HTMLElement.prototype)).constructor=i,i.prototype.connectedCallback=function(){pe.call(this,r)},i.prototype.attributeChangedCallback=me,i.prototype.disconnectedCallback=he,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),i.observedAttributes=n,e.formAssociated&&(i.formAssociated=!0),n.forEach(function(e){Object.defineProperty(i.prototype,e,{get:function(){return this._vdom?this._vdom.props[e]:this._props[e]},set:function(t){this._vdom?this.attributeChangedCallback(e,null,t):(this._props||={},this._props[e]=t);var n=typeof t;t!=null&&n!==`string`&&n!==`boolean`&&n!==`number`||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,i),i}function fe(e){this.getChildContext=function(){return e.context};var t=e.children;return z(t,V(e,le))}function pe(e){var t=new CustomEvent(`_preact`,{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=x(fe,B({},this._props,{context:t.detail.context}),_e(this,this._vdomComponent,e)),(this.hasAttribute(`hydrate`)?ce:R)(this._vdom,this._root)}function H(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():``})}function me(e,t,n){if(this._vdom){var r={};r[e]=n??=void 0,r[H(e)]=n,this._vdom=z(this._vdom,r),R(this._vdom,this._root)}}function he(){R(this._vdom=null,this._root)}function ge(e,t){var n=this,r=e.useFragment,i=V(e,ue);return x(r?C:`slot`,B({},i,{ref:function(e){e?(n.ref=e,n._listener||(n._listener=function(e){e.stopPropagation(),e.detail.context=t},e.addEventListener(`_preact`,n._listener))):n.ref.removeEventListener(`_preact`,n._listener)}}))}function _e(e,t,n){if(e.nodeType===3)return e.data;if(e.nodeType!==1)return null;var r=[],i={},a=0,o=e.attributes,s=e.childNodes;for(a=o.length;a--;)o[a].name!==`slot`&&(i[o[a].name]=o[a].value,i[H(o[a].name)]=o[a].value);for(a=s.length;a--;){var c=_e(s[a],null,n),l=s[a].slot;l?i[l]=x(ge,{name:l},c):r[a]=c}var u=!(!n||!n.shadow),d=t?x(ge,{useFragment:!u},r):r;return!u&&t&&(e.innerHTML=``),x(t||e.nodeName.toLowerCase(),i,d)}function ve(t,r,i=[],a={shadow:!0}){typeof window<`u`&&(e(n),customElements.get(r)||de(t,r,i,a))}var ye=0;Array.isArray;function be(e,t,n,r,i,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:--ye,__i:-1,__u:0,__source:i,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return a.vnode&&a.vnode(u),u}var U,W,G,xe,K=0,Se=[],q=a,Ce=q.__b,we=q.__r,Te=q.diffed,Ee=q.__c,De=q.unmount,Oe=q.__;function J(e,t){q.__h&&q.__h(W,e,K||t),K=0;var n=W.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Y(e){return K=1,ke(Ie,e)}function ke(e,t,n){var r=J(U++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ie(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=W,!W.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};W.__f=!0;var a=W.shouldComponentUpdate,o=W.componentWillUpdate;W.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)},W.shouldComponentUpdate=i}return r.__N||r.__}function X(e,t){var n=J(U++,3);!q.__s&&Fe(n.__H,t)&&(n.__=e,n.u=t,W.__H.__h.push(n))}function Ae(e){return K=5,Z(function(){return{current:e}},[])}function Z(e,t){var n=J(U++,7);return Fe(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function je(e,t){return K=8,Z(function(){return e},t)}function Me(){for(var e;e=Se.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Q),t.__h.some($),t.__h=[]}catch(n){t.__h=[],q.__e(n,e.__v)}}}q.__b=function(e){W=null,Ce&&Ce(e)},q.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Oe&&Oe(e,t)},q.__r=function(e){we&&we(e),U=0;var t=(W=e.__c).__H;t&&(G===W?(t.__h=[],W.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Q),t.__h.some($),t.__h=[],U=0)),G=W},q.diffed=function(e){Te&&Te(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Se.push(t)!==1&&xe===q.requestAnimationFrame||((xe=q.requestAnimationFrame)||Pe)(Me)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),G=W=null},q.__c=function(e,t){t.some(function(e){try{e.__h.some(Q),e.__h=e.__h.filter(function(e){return!e.__||$(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],q.__e(n,e.__v)}}),Ee&&Ee(e,t)},q.unmount=function(e){De&&De(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Q(e)}catch(e){t=e}}),n.__H=void 0,t&&q.__e(t,n.__v))};var Ne=typeof requestAnimationFrame==`function`;function Pe(e){var t,n=function(){clearTimeout(r),Ne&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ne&&(t=requestAnimationFrame(n))}function Q(e){var t=W,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),W=t}function $(e){var t=W;e.__c=e.__(),W=t}function Fe(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Ie(e,t){return typeof t==`function`?t(e):t}function Le(){let[e,n]=Y(()=>window.FrakSetup?.config?.waitForBackendConfig===!1?!0:r.isResolved),[i,a]=Y(()=>r.getConfig().hidden??!1),[o,s]=Y(()=>!!window.FrakSetup?.client);return X(()=>{let e=r.getConfig();e.isResolved&&(n(!0),a(e.hidden??!1)),window.FrakSetup?.client&&s(!0);let i=e=>{let t=e.detail;t.isResolved&&n(!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:e,isHidden:i,isClientReady:o}}const Re=`
|
|
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 ze(e,t){return t?`${Re}\n${e}\n${t}`:`${Re}\n${e}`}const Be=`
|
|
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 Ve(e){return r.getConfig().placements?.[e]}function He(e){let[t,n]=Y(0);return X(()=>{let e=e=>{n(e=>e+1)};return window.addEventListener(`frak:config`,e),n(e=>e+1),()=>window.removeEventListener(`frak:config`,e)},[]),Z(()=>e?Ve(e):void 0,[e,t])}export{Ae as a,je as c,ve as d,M as f,w as g,a as h,Le as i,X as l,C as m,ze as n,Z as o,x as p,Be as r,Y as s,He as t,be as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as e,l as t,p as n}from"./loader.js";import{l as r,s as i}from"./usePlacement.BgMXY5CX.js";import{n as a}from"./formatReward.B1ZyoceC.js";function o(e,t){switch(e.payoutType){case`fixed`:return e.amount[t];case`tiered`:return e.tiers.reduce((e,n)=>Math.max(e,n.amount[t]),0);case`percentage`:return 0}}function s({rewards:t},r,i){let s=(i?t.filter(e=>e.interactionTypeKey===i):t).map(e=>e.referrer).filter(e=>e!==void 0);if(s.length===0)return;let c=n(e(r)),l=s[0],u=o(l,c);for(let e=1;e<s.length;e++){let t=o(s[e],c);t>u&&(l=s[e],u=t)}if(u<=0){let e=s.find(e=>e.payoutType===`percentage`);if(!e)return;l=e}return a(l,r)}function c(e,n){let[a,o]=i(void 0);return r(()=>{if(!e)return;let r=window.FrakSetup?.client;r&&t(r).then(e=>{let t=r.config.metadata?.currency,i=s(e,t,n);i&&o(i)}).catch(()=>{})},[e,n]),{reward:a}}export{c as t};
|