@frak-labs/components 1.0.0 → 1.0.1

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.
Files changed (36) hide show
  1. package/cdn/Banner.CkRQFpJ0.js +162 -0
  2. package/cdn/ButtonShare.D4Fok_jW.js +1 -0
  3. package/cdn/ButtonWallet.BSrHamhP.js +40 -0
  4. package/cdn/OpenInAppButton.ohEljUuI.js +1 -0
  5. package/cdn/PostPurchase.yeMv9kOJ.js +52 -0
  6. package/cdn/components.js +1 -1
  7. package/cdn/formatReward.Ch8HzPk1.js +1 -0
  8. package/cdn/loader.js +2 -2
  9. package/cdn/{sprinkles.css.ts.vanilla.BtFkD4B3.js → sprinkles.css.ts.vanilla.Ct795MMK.js} +2 -2
  10. package/cdn/useGlobalComponents.CLH7id-Y.js +1 -0
  11. package/cdn/useLightDomStyles.DqYouFn3.js +1 -0
  12. package/cdn/usePlacement.Di6eZ4ty.js +58 -0
  13. package/cdn/useReward.DcBtuJDq.js +1 -0
  14. package/cdn/useShareModal.DnHi8iaB.js +1 -0
  15. package/dist/banner.js +40 -7
  16. package/dist/buttonShare.d.ts +9 -1
  17. package/dist/buttonShare.js +23 -10
  18. package/dist/buttonWallet.js +1 -3
  19. package/dist/openInApp.js +12 -8
  20. package/dist/postPurchase.d.ts +15 -1
  21. package/dist/postPurchase.js +51 -12
  22. package/dist/{useLightDomStyles-hgYYZsTy.js → useLightDomStyles-C3lcOwY2.js} +1 -1
  23. package/dist/{usePlacement-LqYjZLX_.js → usePlacement-V7NrKoub.js} +7 -2
  24. package/dist/{useShareModal-DgEf5WWG.js → useShareModal-BEVkLrBP.js} +3 -2
  25. package/package.json +2 -2
  26. package/cdn/Banner.Ws9o79lU.js +0 -64
  27. package/cdn/ButtonShare.BDS1fgma.js +0 -1
  28. package/cdn/ButtonWallet.Be1UyRm8.js +0 -40
  29. package/cdn/OpenInAppButton.Diqt07eo.js +0 -1
  30. package/cdn/PostPurchase.DqFhm-Jn.js +0 -52
  31. package/cdn/formatReward.CXxVsWN3.js +0 -1
  32. package/cdn/useGlobalComponents.BRe8dKO7.js +0 -1
  33. package/cdn/useLightDomStyles.ZFa154u8.js +0 -1
  34. package/cdn/usePlacement.B7jMsQvP.js +0 -58
  35. package/cdn/useReward.qEKeySJG.js +0 -1
  36. package/cdn/useShareModal.B--64ELG.js +0 -1
package/cdn/loader.js CHANGED
@@ -1,5 +1,5 @@
1
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};function n(e,{strict:t=!0}={}){return!e||typeof e!=`string`?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith(`0x`)}function r(e){return n(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const i=`2.47.16`;let a={getDocsUrl:({docsBaseUrl:e,docsPath:t=``,docsSlug:n})=>t?`${e??`https://viem.sh`}${t}${n?`#${n}`:``}`:void 0,version:`viem@${i}`};var o=class e extends Error{constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,o=n.cause instanceof e&&n.cause.docsPath||n.docsPath,s=a.getDocsUrl?.({...n,docsPath:o}),c=[t||`An error occurred.`,``,...n.metaMessages?[...n.metaMessages,``]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...a.version?[`Version: ${a.version}`]:[]].join(`
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 ee=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function te(e,t={}){return typeof e==`number`||typeof e==`bigint`?re(e,t):typeof e==`string`?ae(e,t):typeof e==`boolean`?ne(e,t):h(e,t)}function ne(e,t={}){let n=`0x${Number(e)}`;return typeof t.size==`number`?(m(n,{size:t.size}),l(n,{size:t.size})):n}function h(e,t={}){let n=``;for(let t=0;t<e.length;t++)n+=ee[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 re(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 ie=new TextEncoder;function ae(e,t={}){return h(ie.encode(e),t)}const oe=new TextEncoder;function se(e,t={}){return typeof e==`number`||typeof e==`bigint`?de(e,t):typeof e==`boolean`?ce(e,t):n(e)?ue(e,t):fe(e,t)}function ce(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 g={zero:48,nine:57,A:65,F:70,a:97,f:102};function le(e){if(e>=g.zero&&e<=g.nine)return e-g.zero;if(e>=g.A&&e<=g.F)return e-(g.A-10);if(e>=g.a&&e<=g.f)return e-(g.a-10)}function ue(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=le(r.charCodeAt(t++)),i=le(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 de(e,t){return ue(re(e,t))}function fe(e,t={}){let n=oe.encode(e);return typeof t.size==`number`?(m(n,{size:t.size}),l(n,{dir:`right`,size:t.size})):n}const _=BigInt(2**32-1),pe=BigInt(32);function me(e,t=!1){return t?{h:Number(e&_),l:Number(e>>pe&_)}:{h:Number(e>>pe&_)|0,l:Number(e&_)|0}}function he(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}=me(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}const ge=(e,t,n)=>e<<n|t>>>32-n,_e=(e,t,n)=>t<<n|e>>>32-n,ve=(e,t,n)=>t<<n-32|e>>>64-n,ye=(e,t,n)=>e<<n-32|t>>>64-n;function be(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function xe(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function v(e,...t){if(!be(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 Se(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 Ce(e,t){v(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function we(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Te(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const Ee=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function De(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Oe(e){for(let t=0;t<e.length;t++)e[t]=De(e[t]);return e}const ke=Ee?e=>e:Oe;typeof Uint8Array.from([]).toHex==`function`&&Uint8Array.fromHex;function Ae(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function y(e){return typeof e==`string`&&(e=Ae(e)),v(e),e}var je=class{};function Me(e){let t=t=>e().update(y(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Ne(e){let t=(t,n)=>e(n).update(y(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}const Pe=BigInt(0),b=BigInt(1),Fe=BigInt(2),Ie=BigInt(7),Le=BigInt(256),Re=BigInt(113),ze=[],Be=[],Ve=[];for(let e=0,t=b,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],ze.push(2*(5*r+n)),Be.push((e+1)*(e+2)/2%64);let i=Pe;for(let e=0;e<7;e++)t=(t<<b^(t>>Ie)*Re)%Le,t&Fe&&(i^=b<<(b<<BigInt(e))-b);Ve.push(i)}const He=he(Ve,!0),Ue=He[0],We=He[1],Ge=(e,t,n)=>n>32?ve(e,t,n):ge(e,t,n),Ke=(e,t,n)=>n>32?ye(e,t,n):_e(e,t,n);function qe(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=Ge(a,o,1)^n[r],c=Ke(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=Be[n],a=Ge(t,i,r),o=Ke(t,i,r),s=ze[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]^=Ue[r],e[1]^=We[r]}Te(n)}var Je=class e extends je{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,xe(n),!(0<e&&e<200))throw Error(`only keccak-f1600 function is supported`);this.state=new Uint8Array(200),this.state32=we(this.state)}clone(){return this._cloneInto()}keccak(){ke(this.state32),qe(this.state32,this.rounds),ke(this.state32),this.posOut=0,this.pos=0}update(e){Se(this),e=y(e),v(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){Se(this,!1),v(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 xe(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Ce(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,Te(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 x=(e,t,n)=>Me(()=>new Je(t,e,n));x(6,144,224/8),x(6,136,256/8),x(6,104,384/8),x(6,72,512/8),x(1,144,224/8);const Ye=x(1,136,256/8);x(1,104,384/8),x(1,72,512/8);const Xe=(e,t,n)=>Ne((r={})=>new Je(t,e,r.dkLen===void 0?n:r.dkLen,!0));Xe(31,168,128/8),Xe(31,136,256/8);function Ze(e,t){let r=t||`hex`,i=Ye(n(e,{strict:!1})?se(e):e);return r===`bytes`?i:te(i)}var Qe=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`})}},$e=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 S=new $e(8192);function et(e,t){if(S.has(`${e}.${t}`))return S.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=Ze(fe(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 S.set(`${e}.${t}`,a),a}const tt=/^0x[a-fA-F0-9]{40}$/,C=new $e(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 Qe({address:e});if(!w(t,{strict:!1}))throw new Qe({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 D={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 O=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}}},k=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 it(e){let{emittingTransport:t,listeningTransport:n,targetOrigin:r,middleware:i=[],lifecycleHandlers:a}=e,o=new Map;function s(e){return typeof e!=`object`||!e?!1:`clientLifecycle`in e||`iframeLifecycle`in e}function c(e){return typeof e!=`object`||!e?!1:`id`in e&&`topic`in e&&`data`in e}async function l(e){try{`clientLifecycle`in e&&a?.clientLifecycle?await a.clientLifecycle(e,{origin:r,source:null}):`iframeLifecycle`in e&&a?.iframeLifecycle&&await a.iframeLifecycle(e,{origin:r,source:null})}catch(e){console.error(`[RPC Client] Lifecycle handler error:`,e)}}async function u(e){let t={origin:r,source:null};for(let n of i)n.onRequest&&await n.onRequest(e,t);return e}async function d(e,t){let n={origin:r,source:null},a=t;for(let t of i)t.onResponse&&(a=await t.onResponse(e,a,n));return a}async function f(e){try{let t=new URL(e.origin).origin.toLowerCase(),n=new URL(r).origin.toLowerCase();if(t!==n){console.log(`Not expected origin`,t,n);return}}catch(e){console.error(`[RPC Client] Invalid origin`,e);return}if(s(e.data)){await l(e.data);return}if(!c(e.data))return;let t;try{let n=e.data.data,r=n instanceof Uint8Array||ArrayBuffer.isView(n)?{result:n}:n;t=await d(e.data,r)}catch(e){console.error(`[RPC Client] Middleware error on response:`,e);return}let n=o.get(e.data.id);n&&n(t)}async function p(e){let n=e;try{n=await u(e)}catch(e){throw console.error(`[RPC Client] Middleware error on request:`,e),e}t.postMessage(n,r)}function m(e){t.postMessage(e,r)}function ee(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}n.addEventListener(`message`,f);function te(e){let t=ee(),n=new k;return o.set(t,e=>{e.error?n.reject(new O(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 ne(e,t){let n=ee();return o.set(n,e=>{e.error?(console.error(`[RPC Client] Listener error:`,e.error),o.delete(n)):t(e.result)}),p({id:n,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{console.error(`[RPC Client] Failed to send listener request:`,e),o.delete(n)}),()=>{o.delete(n)}}function h(){n.removeEventListener(`message`,f),o.clear()}return{request:te,listen:ne,sendLifecycle:m,cleanup:h}}function at(e){return new TextEncoder().encode(JSON.stringify(e))}function ot(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}const st=`frak-client-id`;function ct(){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 A(){if(typeof window>`u`||!window.localStorage)return console.warn(`[Frak SDK] No Window / localStorage available to save the clientId`),ct();let e=localStorage.getItem(st);return e||(e=ct(),localStorage.setItem(st,e)),e}function lt({domain:e}={}){return Ze(te((e??window.location.host).replace(`www.`,``)))}function ut(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function dt(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 ft(e){return ut(at(e))}function pt(e,t,n,r,i,a){let o=ft(mt({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 mt(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 ht=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,gt=`frak-sso`;async function _t(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??pt(i??`https://wallet.frak.id`,t,lt(),n.name,A(),r?.css),o=window.open(a,gt,ht);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]})??{}}const vt=`https://backend.frak.id`;function yt(e){return e.includes(`localhost:3000`)||e.includes(`localhost:3010`)}function bt(e){return yt(e)?`https://localhost:3030`:e.includes(`wallet-dev.frak.id`)||e.includes(`wallet.gcp-dev.frak.id`)?`https://backend.gcp-dev.frak.id`:vt}function j(e){if(e)return bt(e);if(typeof window<`u`){let e=window.FrakSetup?.client?.config?.walletUrl;if(e)return bt(e)}return vt}var xt=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 M=new xt(1024),N=new xt(1024),St=3e4,P=new xt(1024);async function F(e,{cacheKey:t,cacheTime:n=St}){if(n>0){let e=N.get(t);if(e&&Date.now()-e.created<n)return e.data}let r=P.get(t);if(r&&Date.now()-r<1e3)throw Error(`Cache: ${t} recently failed, backing off`);let i=M.get(t);i||(i=e(),M.set(t,i));try{let e=await i;return N.set(t,{data:e,created:Date.now()}),P.delete(t),e}catch(e){throw P.set(t,Date.now()),e}finally{M.delete(t)}}function Ct(e){return{clear:()=>{M.delete(e),N.delete(e)},has:(t=St)=>{let n=N.get(e);return n?Date.now()-n.created<t:!1}}}function wt(){M.clear(),N.clear(),P.clear()}function Tt(e){return ot(dt(e))}function I(e){return`r`in e&&!(`v`in e)}function L(e){return`v`in e&&e.v===2}const Et=`fCtx`;function Dt(e){if(e)try{return L(e)?!e.c||!e.m||!e.t?void 0:ft({v:2,c:e.c,m:e.m,t:e.t}):ut(ue(e.r))}catch(t){console.error(`Error compressing Frak context`,{e:t,context:e})}}function Ot(e){if(!(!e||e.length===0))try{let t=Tt(e);if(t&&typeof t==`object`&&t.v===2)return t.c&&t.m&&t.t?{v:2,c:t.c,m:t.m,t:t.t}:void 0;let n=h(dt(e),{size:20});if(w(n))return{r:n}}catch(t){console.error(`Error decompressing Frak context`,{e:t,context:e})}}function kt({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(Et);return t?Ot(t):null}function At({url:e,context:t}){if(!e)return null;let n=Dt(t);if(!n)return null;let r=new URL(e);return r.searchParams.set(Et,n),r.toString()}function jt(e){let t=new URL(e);return t.searchParams.delete(Et),t.toString()}function Mt({url:e,context:t}){if(!window.location?.href||typeof window>`u`){console.error(`No window found, can't update context`);return}let n=e??window.location.href,r;r=t===null?jt(n):At({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}const Nt={compress:Dt,decompress:Ot,parse:kt,update:At,remove:jt,replaceUrl:Mt},R=`__frakSdkConfig`,Pt=`frak-config-cache`,z=`frak-merchant-id`,B={key:Pt},V=typeof window<`u`;function H(){return{isResolved:!1,merchantId:``}}let U=null;function Ft(){if(!V)return null;try{let e=localStorage.getItem(B.key);if(!e)return null;let t=JSON.parse(e);return t.config?.isResolved?(U=t,t):null}catch{return null}}function It(){return(U??Ft())?.config}function Lt(){let e=U??Ft();return e?Date.now()-e.timestamp<3e4:!1}function Rt(e){if(!(!V||!e.isResolved))try{let t={config:e,timestamp:Date.now()};localStorage.setItem(B.key,JSON.stringify(t)),U=t}catch{}}function zt(){if(V){U=null;try{localStorage.removeItem(B.key)}catch{}}}function Bt(){V&&(window[R]||(window[R]=It()??H()))}Bt();function Vt(){return V?window[R]??H():H()}function Ht(e){V&&window.dispatchEvent(new CustomEvent(`frak:config`,{detail:e}))}function Ut(e){return e??(V?window.location.hostname:``)}async function Wt(e,t,n){try{let r=j(t),i=n?`&lang=${encodeURIComponent(n)}`:``,a=await fetch(`${r}/user/merchant/resolve?domain=${encodeURIComponent(e)}${i}`);if(!a.ok){console.warn(`[Frak SDK] Merchant lookup failed for domain ${e}: ${a.status}`);return}let o=await a.json();if(V)try{sessionStorage.setItem(z,o.merchantId)}catch{}return o}catch(e){console.warn(`[Frak SDK] Failed to fetch merchant config:`,e);return}}const W={getConfig:Vt,get isResolved(){return Vt().isResolved},get isCacheFresh(){return Lt()},setCacheScope(e,t){B.key=`${Pt}:${`${e}:${t??``}`}`,U=null},setConfig(e){if(V&&(window[R]=e),Rt(e),Ht(e),V&&e.merchantId)try{sessionStorage.setItem(z,e.merchantId)}catch{}},reset(){let e=It()??H();V&&(window[R]=e),Ht(e)},clearCache(){if(zt(),wt(),V)try{sessionStorage.removeItem(z)}catch{}},resolve(e,t,n){let r=Ut(e);return r?F(async()=>{let e=await Wt(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=Vt();if(e.isResolved&&e.merchantId)return e.merchantId;if(V)try{return sessionStorage.getItem(z)??void 0}catch{}},async resolveMerchantId(e,t){return W.getMerchantId()||(await W.resolve(e,t))?.merchantId}};function G(e,t,n={}){if(!e){console.debug(`[Frak] No client provided, skipping event tracking`);return}try{e.openPanel?.track(t,n)}catch(e){console.debug(`[Frak] Failed to track event:`,t,e)}}function Gt(){return()=>{}}var Kt=class{constructor(e){this.baseUrl=e.baseUrl,this.headers={"Content-Type":`application/json`,...e.defaultHeaders},this.maxRetries=e.maxRetries??3,this.initialRetryDelay=e.initialRetryDelay??500}async resolveHeaders(){let e={};for(let[t,n]of Object.entries(this.headers)){let r=await n;r!==null&&(e[t]=r)}return e}addHeader(e,t){this.headers[e]=t}async post(e,t,n,r){try{let r=await fetch(e,{method:`POST`,headers:await this.resolveHeaders(),body:t?JSON.stringify(t??{}):void 0,keepalive:!0,...n});if(r.status===401)return null;if(r.status!==200&&r.status!==202)throw Error(`HTTP error! status: ${r.status}`);let i=await r.text();return i?JSON.parse(i):null}catch(i){if(r<this.maxRetries){let i=this.initialRetryDelay*2**r;return await new Promise(e=>setTimeout(e,i)),this.post(e,t,n,r+1)}return console.error(`Max retries reached:`,i),null}}async fetch(e,t,n={}){let r=`${this.baseUrl}${e}`;return this.post(r,t,n,0)}},qt=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 Kt({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&&console.log(`[OpenPanel.dev]`,...e)}},Jt=Object.defineProperty,Yt=(e,t)=>()=>(e&&(t=e(e=0)),t),Xt=(e,t)=>{for(var n in t)Jt(e,n,{get:t[n],enumerable:!0})};function Zt(e,t){if(typeof document>`u`||typeof window>`u`)return;K&&K();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 console.error(`[ReplayRecorder] sendChunk failed`,e),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=Gt({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),K=()=>{a.length>0&&c(a.some(e=>e.type===2)),s&&=(clearInterval(s),null),document.removeEventListener(`visibilitychange`,p),window.removeEventListener(`pagehide`,m),f?.(),K=null}}function Qt(){K&&K()}var K,$t=Yt(()=>{K=null}),en={};Xt(en,{startReplayRecorder:()=>Zt,stopReplayRecorder:()=>Qt});var tn=Yt(()=>{$t()}),nn=typeof document<`u`?document.currentScript:null;function rn(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var an=class extends qt{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=nn,t=this.options.sessionReplay?.scriptUrl||e?.src?.replace(`.js`,`-replay.js`)||`https://openpanel.dev/op1-replay.js`;return window.__openpanel_replay?window.__openpanel_replay:new Promise(e=>{let n=document.createElement(`script`);n.src=t,n.onload=()=>{e(window.__openpanel_replay??null)},n.onerror=()=>{console.warn(`[OpenPanel] Failed to load replay script from`,t),e(null)},document.head.appendChild(n)})}return await Promise.resolve().then(()=>(tn(),en))}catch(e){return console.warn(`[OpenPanel] Failed to load replay module`,e),null}}debounce(e,t){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(e,t)}isServer(){return typeof document>`u`}trackOutgoingLinks(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`a`);if(n&&t){let e=n.getAttribute(`href`);if(e?.startsWith(`http`))try{let r=new URL(e),i=window.location.hostname;r.hostname!==i&&super.track(`link_out`,{href:e,text:n.innerText||n.getAttribute(`title`)||t.getAttribute(`alt`)||t.getAttribute(`title`)})}catch{}}})}trackScreenViews(){if(this.isServer())return;let e=history.pushState;history.pushState=function(...t){let n=e.apply(this,t);return window.dispatchEvent(new Event(`pushstate`)),window.dispatchEvent(new Event(`locationchange`)),n};let t=history.replaceState;history.replaceState=function(...e){let n=t.apply(this,e);return window.dispatchEvent(new Event(`replacestate`)),window.dispatchEvent(new Event(`locationchange`)),n},window.addEventListener(`popstate`,()=>{window.dispatchEvent(new Event(`locationchange`))});let n=()=>this.debounce(()=>this.screenView(),50);this.options.trackHashChanges?window.addEventListener(`hashchange`,n):window.addEventListener(`locationchange`,n)}trackAttributes(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`button`),r=t.closest(`a`),i=n?.getAttribute(`data-track`)?n:r?.getAttribute(`data-track`)?r:null;if(i){let e={};for(let t of i.attributes)t.name.startsWith(`data-`)&&t.name!==`data-track`&&(e[rn(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 q=`nexus-wallet-backup`,on=`frakwallet://`;function sn(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}function cn(e){return`intent://${e.slice(13)}#Intent;scheme=frakwallet;end`}function ln(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=sn()&&un(e)?cn(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function un(e){return e.startsWith(on)}const J={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function Y(e){return e&&e in J?e:`eur`}function dn(e){return e?J[e]??J.eur:J.eur}function fn(e,t){let n=dn(t),r=Y(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function pn(e){return e?`${e}Amount`:`eurAmount`}const X={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 mn({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);r.id=X.id,r.name=X.name,r.allow=X.allow,r.style.zIndex=X.style.zIndex.toString(),hn({iframe:r,isVisible:!1});let i=t?.walletUrl??e??`https://wallet.frak.id`,a=A();return r.src=`${i}/listener?clientId=${encodeURIComponent(a)}`,new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function hn({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 gn(e=`/listener`){if(!window.opener)return null;let t=t=>{try{return t.location.origin===window.location.origin&&t.location.pathname===e}catch{return!1}};if(t(window.opener))return window.opener;try{let e=window.opener.frames;for(let n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}catch(t){return console.error(`[findIframeInOpener] Error finding iframe with pathname ${e}:`,t),null}}function _n(){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 vn=_n();function yn(){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 bn=yn();function xn(e){vn&&e.startsWith(`https://`)?window.location.href=`x-safari-https://${e.slice(8)}`:vn&&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 Sn(e,t){if(typeof window>`u`)return;let n=new URL(window.location.href),r=n.searchParams.get(`sso`);r&&(t.then(()=>{e.sendLifecycle({clientLifecycle:`sso-redirect-complete`,data:{compressed:r}}),console.log(`[SSO URL Listener] Forwarded compressed SSO data to iframe`)}).catch(e=>{console.error(`[SSO URL Listener] Failed to forward SSO data:`,e)}),n.searchParams.delete(`sso`),window.history.replaceState({},``,n.toString()),console.log(`[SSO URL Listener] SSO parameter detected and URL cleaned`))}var Cn=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(e){return console.warn(`Failed to encode debug data`,e),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 O?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`
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 dt(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 ft(e){return A(ot(e))}function pt(e,t,n,r,i,a){let o=ft(mt({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 mt(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 ht=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,gt=`frak-sso`;async function _t(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??pt(i??`https://wallet.frak.id`,t,ut(),n.name,k(),r?.css),o=window.open(a,gt,ht);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 j(e,t,n){if(e)try{e.openPanel?.track(t,n)}catch{}}const vt=`https://backend.frak.id`;function yt(e){return e.includes(`localhost:3000`)||e.includes(`localhost:3010`)}function bt(e){return yt(e)?`https://localhost:3030`:e.includes(`wallet-dev.frak.id`)||e.includes(`wallet.gcp-dev.frak.id`)?`https://backend.gcp-dev.frak.id`:vt}function M(e){if(e)return bt(e);if(typeof window<`u`){let e=window.FrakSetup?.client?.config?.walletUrl;if(e)return bt(e)}return vt}var xt=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 N=new xt(1024),P=new xt(1024),St=3e4,F=new xt(1024);async function I(e,{cacheKey:t,cacheTime:n=St}){if(n>0){let e=P.get(t);if(e&&Date.now()-e.created<n)return e.data}let r=F.get(t);if(r&&Date.now()-r<1e3)throw Error(`Cache: ${t} recently failed, backing off`);let i=N.get(t);i||(i=e(),N.set(t,i));try{let e=await i;return P.set(t,{data:e,created:Date.now()}),F.delete(t),e}catch(e){throw F.set(t,Date.now()),e}finally{N.delete(t)}}function Ct(e){return{clear:()=>{N.delete(e),P.delete(e)},has:(t=St)=>{let n=P.get(e);return n?Date.now()-n.created<t:!1}}}function wt(){N.clear(),P.clear(),F.clear()}function Tt(e){return`r`in e&&!(`v`in e)}function L(e){return`v`in e&&e.v===2}const Et=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Dt(e){return typeof e==`string`&&Et.test(e)}function Ot(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 kt(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 At(e){if(!Dt(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&&!Dt(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(Ot(e.m),a),a+=16,i.setUint32(a,e.t,!1),a+=4,t&&(r.set(Ot(e.c),a),a+=16),n&&(r.set(v(e.w),a),a+=20),r}function jt(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=kt(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=kt(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 R=`fCtx`;function Mt(e){if(e)try{if(L(e)){let t=At(e);return t?A(t):void 0}return A(v(e.r))}catch{}}function Nt(e){if(!(!e||e.length===0))try{let t=dt(e);if(t.length!==20)return jt(t)||void 0;let n=g(t,{size:20});if(w(n))return{r:n}}catch{}}function Pt({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(R);return t?Nt(t):null}const Ft=`frak`;function It(e,t){let n=L(e);return{utm_source:t.utmSource??Ft,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??Ft,ref:t.ref??(n?e.c:void 0)}}function Lt(e,t,n){let r=It(t,n??{});for(let[t,n]of Object.entries(r))n===void 0||n===``||e.searchParams.has(t)||e.searchParams.set(t,n)}function Rt({url:e,context:t,attribution:n}){if(!e)return null;let r=Mt(t);if(!r)return null;let i=new URL(e);return i.searchParams.set(R,r),Lt(i,t,n),i.toString()}function zt(e){let t=new URL(e);return t.searchParams.delete(R),t.toString()}function Bt({url:e,context:t}){if(!window.location?.href||typeof window>`u`)return;let n=e??window.location.href,r;r=t===null?zt(n):Rt({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}const z={compress:Mt,decompress:Nt,parse:Pt,update:Rt,remove:zt,replaceUrl:Bt},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=M(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(),wt(),U)try{sessionStorage.removeItem(V)}catch{}},resolve(e,t,n){let r=Xt(e);return r?I(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(dt(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 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(){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 En=Tn();function Dn(){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 On=Dn();function kn(e){En&&e.startsWith(`https://`)?window.location.href=`x-safari-https://${e.slice(8)}`:En&&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 An({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 jn(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 Mn=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
3
  Debug Information:
4
4
  -----------------
5
5
  Timestamp: ${t.timestamp}
@@ -11,4 +11,4 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
11
11
  Last Response: ${t.lastResponse}
12
12
  Client Status: ${t.clientStatus}
13
13
  Error: ${t.error}
14
- `.trim()}};const wn=(()=>{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 Tn(e){e?localStorage.setItem(q,e):localStorage.removeItem(q)}function En(e,t){try{let n=new URL(e);if(!n.searchParams.has(`u`))return e;let r=kn(window.location.href,t);return n.searchParams.delete(`u`),n.searchParams.append(`u`,r),n.toString()}catch{return e}}function Dn(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 On(e){return e.includes(`/common/social`)}function kn(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 An(e,t,n,r,i){if(i){let e=En(t,r);window.open(e,`_blank`);return}if(un(t)){let i=En(t,r);ln(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(wn&&On(t))Dn(r);else{let e=En(t,r);window.location.href=e}}function jn({iframe:e,targetOrigin:t}){let n=new k;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`:Tn(a.backup);break;case`remove-backup`:localStorage.removeItem(q);break;case`show`:case`hide`:hn({iframe:e,isVisible:i===`show`});break;case`redirect`:An(e,a.baseRedirectUrl,t,a.mergeToken,a.openInNewTab);break}},isConnected:n.promise}}function Mn({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:``);W.setCacheScope(a,i),W.reset();let o=W.isCacheFresh?void 0:W.resolve(e.domain,e.walletUrl,i),s=jn({iframe:t,targetOrigin:n}),c=new k,l=new Cn(e,t);if(!t.contentWindow)throw new O(D.configError,`The iframe does not have a content window`);let u=it({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await s.isConnected)throw new O(D.clientNotConnected,`The iframe provider isn't connected yet`);return await c.promise,t}},{onRequest(e,t){return l.setLastRequest(e),t},onResponse(e,t){return l.setLastResponse(e,t),t}}],lifecycleHandlers:{iframeLifecycle:(e,t)=>{s.handleEvent(e)}}}),d=Nn(u,s),f=async()=>{d(),u.cleanup(),t.remove(),wt(),W.clearCache(),W.reset()},p;console.log(`[Frak SDK] Initializing OpenPanel`),p=new an({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.0`,userAnonymousClientId:A()}),!0)}),p.setGlobalProperties({sdkVersion:`1.0.0`,userAnonymousClientId:A()}),p.init();let m=Pn({config:e,rpcClient:u,lifecycleManager:s,configPromise:o,contextSent:c}).then(()=>l.updateSetupStatus(!0)).catch(e=>{throw c.reject(e),e});return{config:e,debugInfo:l,waitForConnection:s.isConnected,waitForSetup:m,request:u.request,listenerRequest:u.listen,destroy:f,openPanel:p}}function Nn(e,t){let n,r,i=()=>e.sendLifecycle({clientLifecycle:`heartbeat`});async function a(){i(),n=setInterval(i,1e3),r=setTimeout(()=>{o(),console.log(`Heartbeat timeout: connection failed`)},3e4),await t.isConnected,o()}function o(){n&&clearInterval(n),r&&clearTimeout(r)}return a(),o}async function Pn({config:e,rpcClient:t,lifecycleManager:n,configPromise:r,contextSent:i}){await n.isConnected,Sn(t,n.isConnected);let a=new URL(window.location.href),o=a.searchParams.get(`fmt`)??void 0;o&&(a.searchParams.delete(`fmt`),window.history.replaceState({},``,a.toString()));let s=t=>{let n=t?.merchantId??e.metadata.merchantId??``,r=t?.domain??``,i=t?.allowedDomains??[],a=t?.sdkConfig;W.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}:{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})},c=!1,l=e=>{let n=c?void 0:o;c=!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}:void 0;t.sendLifecycle({clientLifecycle:`resolved-config`,data:{merchantId:e.merchantId,domain:e.domain??``,allowedDomains:e.allowedDomains??[],sourceUrl:window.location.href,...n&&{pendingMergeToken:n},...r&&{sdkConfig:r}}})};W.isResolved&&(l(W.getConfig()),i.resolve()),r&&(s(await r),l(W.getConfig()),i.resolve());async function u(){let n=e.customizations?.css;n&&t.sendLifecycle({clientLifecycle:`modal-css`,data:{cssLink:n}})}async function d(){let n=e.customizations?.i18n;n&&t.sendLifecycle({clientLifecycle:`modal-i18n`,data:{i18n:n}})}async function f(){if(typeof window>`u`)return;let e=window.localStorage.getItem(q);e&&t.sendLifecycle({clientLifecycle:`restore-backup`,data:{backup:e}})}await Promise.allSettled([u(),d(),f()])}async function Fn({config:e}){let t=In(e),n=await mn({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=Mn({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function In(e){let t=Y(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}var Ln=t({DEEP_LINK_SCHEME:()=>on,DebugInfoGatherer:()=>Cn,FrakContextManager:()=>Nt,base64urlDecode:()=>dt,base64urlEncode:()=>ut,baseIframeProps:()=>X,clearAllCache:()=>wt,compressJsonToB64:()=>ft,computeLegacyProductId:()=>lt,createIFrameFrakClient:()=>Mn,createIframe:()=>mn,decompressJsonFromB64:()=>Tt,findIframeInOpener:()=>gn,formatAmount:()=>fn,generateSsoUrl:()=>pt,getBackendUrl:()=>j,getCache:()=>Ct,getClientId:()=>A,getCurrencyAmountKey:()=>pn,getSupportedCurrency:()=>Y,getSupportedLocale:()=>dn,isChromiumAndroid:()=>sn,isFrakDeepLink:()=>un,isIOS:()=>vn,isInAppBrowser:()=>bn,isV1Context:()=>I,isV2Context:()=>L,locales:()=>J,redirectToExternalBrowser:()=>xn,sdkConfigStore:()=>W,setupClient:()=>Fn,ssoPopupFeatures:()=>ht,ssoPopupName:()=>gt,toAndroidIntentUrl:()=>cn,trackEvent:()=>G,triggerDeepLinkWithFallback:()=>ln,withCache:()=>F});function Rn(){return rt(96)}async function zn(e,t,n){return await e.request({method:`frak_displayEmbeddedWallet`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function Z(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 Bn(e,t,n){return await e.request({method:`frak_displaySharingPage`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function Vn(e){if(typeof window>`u`)return;let t=A();if(!t)return;let n=await W.resolveMerchantId();if(!n)return;let r=`frak-identity-ensured-${n}`;if(!window.sessionStorage.getItem(r))try{let i=j();(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 Hn(e,t){return F(()=>e.request({method:`frak_getMerchantInformation`}),{cacheKey:`frak_getMerchantInformation`,cacheTime:t?.cacheTime})}async function Un(e,t){return F(()=>e.request({method:`frak_getMergeToken`}),{cacheKey:`frak_getMergeToken`,cacheTime:t?.cacheTime})}async function Wn(e,t){return F(()=>e.request({method:`frak_getUserReferralStatus`}),{cacheKey:`frak_getUserReferralStatus`,cacheTime:t?.cacheTime})}async function Gn(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}async function Kn(e,t){try{await e.request({method:`frak_sendInteraction`,params:[t,{clientId:A()}]})}catch{console.warn(`[Frak SDK] Failed to send interaction:`,t.type)}}function qn(e,t,n){let r=typeof window<`u`?window.location.href:void 0;return L(t)?(G(e,`user_referred_started`,{properties:{referrerClientId:t.c,walletStatus:n?.key}}),Kn(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referralTimestamp:t.t,landingUrl:r}),!0):I(t)?(G(e,`user_referred_started`,{properties:{referrer:t.r,walletStatus:n?.key}}),Kn(e,{type:`arrival`,referrerWallet:t.r,landingUrl:r}),!0):!1}function Jn(e){let t=A();return t?{v:2,c:t,m:e,t:Math.floor(Date.now()/1e3)}:null}function Yn(e,t){return L(e)?A()===e.c:I(e)&&t?.wallet?nt(e.r,t.wallet):!1}function Xn(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;if(Yn(n,t))return`self-referral`;if(!qn(e,n,t))return`no-referrer`;let i=L(n)?n.m:r?.merchantId,a=r?.alwaysAppendUrl&&i?Jn(i):null;return Nt.replaceUrl({url:window.location?.href,context:a}),G(e,`user_referred_completed`,{properties:{status:`success`}}),`success`}async function Zn(e,{options:t}={}){let n=Nt.parse({url:window.location.href}),r=await er(e);try{return Xn(e,{walletStatus:r,frakContext:n,options:t})}catch(e){console.warn(`Error processing referral`,{error:e})}}const Q=`frak:referral-success`;async function Qn(e){try{await Zn(e)===`success`&&window.dispatchEvent(new Event(Q))}catch(e){console.warn(`[Frak] Referral setup failed`,e)}}async function $n(e){if(typeof window>`u`){console.warn(`[Frak] No window found, can't track purchase`);return}let t=window.sessionStorage.getItem(`frak-wallet-interaction-token`),n=A();if(!t&&!n){console.warn(`[Frak] No identity found, skipping purchase check`);return}let r=e.merchantId??await W.resolveMerchantId();if(!r){console.warn(`[Frak] No merchant id found, skipping purchase check`);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=j();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 er(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(tr(e,t),t));let n=new k,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{tr(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function tr(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),Vn(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function nr(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 Z(e,t,r)}return{params:t,sendTx:n,reward:r,sharing:i,display:a}}async function rr(e,{tx:t,metadata:n}){return(await Z(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}async function ir(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 Z(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??Rn(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}var ar=t({REFERRAL_SUCCESS_EVENT:()=>Q,displayEmbeddedWallet:()=>zn,displayModal:()=>Z,displaySharingPage:()=>Bn,ensureIdentity:()=>Vn,getMerchantInformation:()=>Hn,getMergeToken:()=>Un,getUserReferralStatus:()=>Wn,modalBuilder:()=>nr,openSso:()=>_t,prepareSso:()=>Gn,processReferral:()=>Xn,referralInteraction:()=>Zn,sendInteraction:()=>Kn,sendTransaction:()=>rr,setupReferral:()=>Qn,siweAuthenticate:()=>ir,trackPurchaseStatus:()=>$n,watchWalletStatus:()=>er});async function or(e,t){if(!window.FrakSetup?.client){console.error(`Frak client not found`);return}let n=window.FrakSetup?.modalWalletConfig??{};await zn(window.FrakSetup.client,e?{...n,metadata:{...n.metadata,targetInteraction:e}}:n,t)}function sr(){`vibrate`in navigator?navigator.vibrate(10):console.log(`Vibration not supported`)}function cr(e,t){sr(),or(e,t)}const lr=`frak:client`;function ur(){let e=new CustomEvent(lr);window.dispatchEvent(e)}function dr(e,t){if(window.FrakSetup?.client&&e===`add`){t();return}(e===`add`?window.addEventListener:window.removeEventListener)(lr,t,!1)}function fr(){return window.FrakSetup.core={...Ln,...ar},window.FrakSetup?.client?Promise.resolve():F(()=>pr(),{cacheKey:`frak-sdk-init`,cacheTime:1/0}).catch(()=>{})}async function pr(){if(!window.FrakSetup?.config)throw Error(`[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set.`);console.log(`[Frak SDK] Starting initialization`);let e=await Fn({config:window.FrakSetup.config});if(!e)throw Error(`[Frak SDK] Failed to create client`);window.FrakSetup.client=e,console.log(`[Frak SDK] Client initialized successfully`),ur(),Qn(e),mr()}function mr(){let e=new URLSearchParams(window.location.search).get(`frakAction`);e&&e===`share`&&(console.log(`[Frak SDK] Auto open query param found`),cr())}function hr(e){document.readyState===`complete`||document.readyState===`interactive`?setTimeout(e,1):document.addEventListener(`DOMContentLoaded`,e)}function gr(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 _r(e,t){gr(`frak-base-${e}`,t)}function vr(e,t,n){gr(`frak-placement-${e}-${t}`,n)}const yr={injectBase:_r,injectPlacement:vr};yr.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; }`),hr(fr);const br={"button-share":()=>import(`./ButtonShare.BDS1fgma.js`),"button-wallet":()=>import(`./ButtonWallet.Be1UyRm8.js`),"open-in-app":()=>import(`./OpenInAppButton.Diqt07eo.js`),"post-purchase":()=>import(`./PostPurchase.DqFhm-Jn.js`),banner:()=>import(`./Banner.Ws9o79lU.js`)},xr=new MutationObserver(e=>{for(let{addedNodes:t}of e)for(let e of Array.from(t))e.nodeType===Node.ELEMENT_NODE&&Sr(e)});async function Sr(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=>Cr(e)))}async function Cr(e){if(customElements.get(e))return Promise.resolve();try{let t=e.replace(/^frak-/i,``);if(!(t in br))throw Error(`Component ${e} is not supported.`);await br[t]()}catch(e){console.error(e)}}Sr(document.body),xr.observe(document.documentElement,{subtree:!0,childList:!0});export{G as C,W as S,O as T,ln as _,cr as a,on as b,$n as c,Un as d,Hn as f,fn as g,bn as h,dr as i,Q as l,xn as m,hr as n,or as o,Bn as p,fr as r,nr as s,yr as t,Wn as u,Y as v,D as w,pn as x,Cn as y};
14
+ `.trim()}};const Nn=(()=>{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 Pn(e){e?localStorage.setItem(J,e):localStorage.removeItem(J)}function Fn(e,t){try{let n=new URL(e);if(!n.searchParams.has(`u`))return e;let r=Rn(window.location.href,t);return n.searchParams.delete(`u`),n.searchParams.append(`u`,r),n.toString()}catch{return e}}function In(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 Ln(e){return e.includes(`/common/social`)}function Rn(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 zn(e,t,n,r,i){if(i){let e=Fn(t,r);window.open(e,`_blank`);return}if(vn(t)){let i=Fn(t,r);_n(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(Nn&&Ln(t))In(r);else{let e=Fn(t,r);window.location.href=e}}function Bn({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`:Pn(a.backup);break;case`remove-backup`:localStorage.removeItem(J);break;case`show`:case`hide`:Cn({iframe:e,isVisible:i===`show`});break;case`redirect`:zn(e,a.baseRedirectUrl,t,a.mergeToken,a.openInNewTab);break}},isConnected:n.promise}}function Vn({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=Bn({iframe:t,targetOrigin:n}),c=new O,l=Date.now(),u=new Mn(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=Hn(d,s),p=async()=>{f(),d.cleanup(),t.remove(),wt(),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.1`,userAnonymousClientId:k()}),!0)}),m.setGlobalProperties({sdkVersion:`1.0.1`,userAnonymousClientId:k()}),m.init(),m.track(`sdk_initialized`,{sdkVersion:`1.0.1`});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=Un({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 Hn(e,t){let n,r,i=()=>e.sendLifecycle({clientLifecycle:`heartbeat`});async function a(){i(),n=setInterval(i,1e3),r=setTimeout(()=>{o()},3e4),await t.isConnected,o()}function o(){n&&clearInterval(n),r&&clearTimeout(r)}return a(),o}async function Un({config:e,rpcClient:t,lifecycleManager:n,configPromise:r,contextSent:i,openPanel:a}){await n.isConnected,jn(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 Wn({config:e}){let t=Gn(e),n=await Sn({config:t});if(!n)return;let r=Vn({config:t,iframe:n});if(await r.waitForSetup,await r.waitForConnection)return r}function Gn(e){let t=X(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}var Kn=t({DEEP_LINK_SCHEME:()=>mn,DebugInfoGatherer:()=>Mn,FrakContextManager:()=>z,base64urlDecode:()=>dt,base64urlEncode:()=>A,baseIframeProps:()=>Z,clearAllCache:()=>wt,compressJsonToB64:()=>ft,computeLegacyProductId:()=>ut,createIFrameFrakClient:()=>Vn,createIframe:()=>Sn,decompressJsonFromB64:()=>pn,findIframeInOpener:()=>wn,formatAmount:()=>bn,generateSsoUrl:()=>pt,getBackendUrl:()=>M,getCache:()=>Ct,getClientId:()=>k,getCurrencyAmountKey:()=>xn,getSupportedCurrency:()=>X,getSupportedLocale:()=>yn,isChromiumAndroid:()=>hn,isFrakDeepLink:()=>vn,isIOS:()=>En,isInAppBrowser:()=>On,isV1Context:()=>Tt,isV2Context:()=>L,locales:()=>Y,mergeAttribution:()=>An,redirectToExternalBrowser:()=>kn,sdkConfigStore:()=>K,setupClient:()=>Wn,ssoPopupFeatures:()=>ht,ssoPopupName:()=>gt,toAndroidIntentUrl:()=>gn,trackEvent:()=>j,triggerDeepLinkWithFallback:()=>_n,withCache:()=>I});function qn(){return rt(96)}async function Jn(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 Yn(e,t,n){return await e.request({method:`frak_displaySharingPage`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function Xn(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=M();(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 Zn(e,t){return I(()=>e.request({method:`frak_getMerchantInformation`}),{cacheKey:`frak_getMerchantInformation`,cacheTime:t?.cacheTime})}async function Qn(e,t){return I(()=>e.request({method:`frak_getMergeToken`}),{cacheKey:`frak_getMergeToken`,cacheTime:t?.cacheTime})}async function $n(e,t){return I(()=>e.request({method:`frak_getUserReferralStatus`}),{cacheKey:`frak_getUserReferralStatus`,cacheTime:t?.cacheTime})}async function er(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}async function tr(e,t){try{await e.request({method:`frak_sendInteraction`,params:[t,{clientId:k()}]})}catch{}}function nr(e,t,n){let r=typeof window<`u`?window.location.href:void 0;return L(t)?(j(e,`user_referred_started`,{referrerClientId:t.c,referrerWallet:t.w,walletStatus:n?.key}),tr(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referrerWallet:t.w,referralTimestamp:t.t,landingUrl:r}),!0):Tt(t)?(j(e,`user_referred_started`,{referrer:t.r,walletStatus:n?.key}),tr(e,{type:`arrival`,referrerWallet:t.r,landingUrl:r}),!0):!1}function rr(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 ir(e,t){return L(e)?e.w&&t?.wallet?nt(e.w,t.wallet):e.c?k()===e.c:!1:Tt(e)&&t?.wallet?nt(e.r,t.wallet):!1}function ar(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;if(ir(n,t))return`self-referral`;if(!nr(e,n,t))return`no-referrer`;let i=L(n)?n.m:r?.merchantId,a=r?.alwaysAppendUrl&&i?rr(i,t?.wallet):null;return z.replaceUrl({url:window.location?.href,context:a}),j(e,`user_referred_completed`,{status:`success`}),`success`}async function or(e,{options:t}={}){let n=z.parse({url:window.location.href}),r=await ur(e);try{return ar(e,{walletStatus:r,frakContext:n,options:t})}catch{}}const sr=`frak:referral-success`;async function cr(e){try{await or(e)===`success`&&window.dispatchEvent(new Event(sr))}catch{}}async function lr(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=M();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 ur(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(dr(e,t),t));let n=new O,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{dr(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function dr(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),Xn(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function fr(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 pr(e,{tx:t,metadata:n}){return(await Q(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}async function mr(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??qn(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}var hr=t({REFERRAL_SUCCESS_EVENT:()=>sr,displayEmbeddedWallet:()=>Jn,displayModal:()=>Q,displaySharingPage:()=>Yn,ensureIdentity:()=>Xn,getMerchantInformation:()=>Zn,getMergeToken:()=>Qn,getUserReferralStatus:()=>$n,modalBuilder:()=>fr,openSso:()=>_t,prepareSso:()=>er,processReferral:()=>ar,referralInteraction:()=>or,sendInteraction:()=>tr,sendTransaction:()=>pr,setupReferral:()=>cr,siweAuthenticate:()=>mr,trackPurchaseStatus:()=>lr,watchWalletStatus:()=>ur});async function gr(e,t){if(!window.FrakSetup?.client)return;let n=window.FrakSetup?.modalWalletConfig??{};await Jn(window.FrakSetup.client,e?{...n,metadata:{...n.metadata,targetInteraction:e}}:n,t)}function _r(){`vibrate`in navigator&&navigator.vibrate(10)}function vr(e,t){_r(),gr(e,t)}const yr=`frak:client`;function br(){let e=new CustomEvent(yr);window.dispatchEvent(e)}function xr(e,t){if(window.FrakSetup?.client&&e===`add`){t();return}(e===`add`?window.addEventListener:window.removeEventListener)(yr,t,!1)}function Sr(){return window.FrakSetup.core={...Kn,...hr},window.FrakSetup?.client?Promise.resolve():I(()=>Cr(),{cacheKey:`frak-sdk-init`,cacheTime:1/0}).catch(e=>{j(window.FrakSetup?.client,`sdk_init_failed`,{reason:e instanceof Error?e.message:typeof e==`string`?e:`unknown`,config_missing:!window.FrakSetup?.config})})}async function Cr(){if(!window.FrakSetup?.config)throw Error(`[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set.`);let e=await Wn({config:window.FrakSetup.config});if(!e)throw Error(`[Frak SDK] Failed to create client`);window.FrakSetup.client=e,br(),cr(e),wr()}function wr(){let e=new URLSearchParams(window.location.search).get(`frakAction`);e&&e===`share`&&vr()}function Tr(e){document.readyState===`complete`||document.readyState===`interactive`?setTimeout(e,1):document.addEventListener(`DOMContentLoaded`,e)}function Er(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 Dr(e,t){Er(`frak-base-${e}`,t)}function Or(e,t,n){Er(`frak-placement-${e}-${t}`,n)}const kr={injectBase:Dr,injectPlacement:Or};kr.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; }`),Tr(Sr);const Ar={"button-share":()=>import(`./ButtonShare.D4Fok_jW.js`),"button-wallet":()=>import(`./ButtonWallet.BSrHamhP.js`),"open-in-app":()=>import(`./OpenInAppButton.ohEljUuI.js`),"post-purchase":()=>import(`./PostPurchase.yeMv9kOJ.js`),banner:()=>import(`./Banner.CkRQFpJ0.js`)},jr=new MutationObserver(e=>{for(let{addedNodes:t}of e)for(let e of Array.from(t))e.nodeType===Node.ELEMENT_NODE&&Mr(e)});async function Mr(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=>Nr(e)))}async function Nr(e){if(customElements.get(e))return Promise.resolve();try{let t=e.replace(/^frak-/i,``);if(!(t in Ar))throw Error(`Component ${e} is not supported.`);await Ar[t]()}catch{}}Mr(document.body),jr.observe(document.documentElement,{subtree:!0,childList:!0});export{j as C,K as S,D as T,mn as _,vr as a,X as b,lr as c,Qn as d,Zn as f,bn as g,Mn as h,xr as i,sr as l,kn as m,Tr as n,gr as o,Yn as p,Sr as r,fr as s,kr as t,$n as u,_n as v,it as w,xn as x,On as y};
@@ -1,4 +1,4 @@
1
- import{d as e,f as t,h as n,l as r,m as i,p as a}from"./usePlacement.B7jMsQvP.js";function o(e,t){for(var n in t)e[n]=t[n];return e}function s(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function c(e,t){this.props=e,this.context=t}(c.prototype=new n).isPureReactComponent=!0,c.prototype.shouldComponentUpdate=function(e,t){return s(this.props,e)||s(this.state,t)};var l=i.__b;i.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),l&&l(e)},typeof Symbol<`u`&&Symbol.for;var u=i.__e;i.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k),i.__c(e,t)}u(e,t,n,r)};var d=i.unmount;function f(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=o({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return f(e,t,n)})),e}function p(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return p(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function m(){this.__u=0,this.o=null,this.__b=null}function h(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function g(){this.i=null,this.l=null}i.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),d&&d(e)},(m.prototype=new n).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=h(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=p(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},m.prototype.componentWillUnmount=function(){this.o=[]},m.prototype.render=function(e,n){if(this.__b){if(this.__v.__k){var r=document.createElement(`div`),i=this.__v.__k[0].__c;this.__v.__k[0]=f(this.__b,r,i.__O=i.__P)}this.__b=null}var o=n.__a&&t(a,null,e.fallback);return o&&(o.__u&=-33),[t(a,null,n.__a?null:e.children),o]};var _=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(g.prototype=new n).__a=function(e){var t=this,n=h(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),_(t,e,r)):i()};n?n(a):a()}},g.prototype.render=function(t){this.i=null,this.l=new Map;var n=e(t.children);t.revealOrder&&t.revealOrder[0]===`b`&&n.reverse();for(var r=n.length;r--;)this.l.set(n[r],this.i=[1,0,this.i]);return t.children},g.prototype.componentDidUpdate=g.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){_(e,n,t)})};var v=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,y=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,b=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,x=/[A-Z0-9]/g,S=typeof document<`u`,C=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};n.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(n.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var w=i.event;i.event=function(e){return w&&(e=w(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var T={configurable:!0,get:function(){return this.class}},E=i.vnode;i.vnode=function(t){typeof t.type==`string`&&function(t){var n=t.props,r=t.type,i={},a=r.indexOf(`-`)==-1;for(var o in n){var s=n[o];if(!(o===`value`&&`defaultValue`in n&&s==null||S&&o===`children`&&r===`noscript`||o===`class`||o===`className`)){var c=o.toLowerCase();o===`defaultValue`&&`value`in n&&n.value==null?o=`value`:o===`download`&&!0===s?s=``:c===`translate`&&s===`no`?s=!1:c[0]===`o`&&c[1]===`n`?c===`ondoubleclick`?o=`ondblclick`:c!==`onchange`||r!==`input`&&r!==`textarea`||C(n.type)?c===`onfocus`?o=`onfocusin`:c===`onblur`?o=`onfocusout`:b.test(o)&&(o=c):c=o=`oninput`:a&&y.test(o)?o=o.replace(x,`-$&`).toLowerCase():s===null&&(s=void 0),c===`oninput`&&i[o=c]&&(o=`oninputCapture`),i[o]=s}}r==`select`&&(i.multiple&&Array.isArray(i.value)&&(i.value=e(n.children).forEach(function(e){e.props.selected=i.value.indexOf(e.props.value)!=-1})),i.defaultValue!=null&&(i.value=e(n.children).forEach(function(e){e.props.selected=i.multiple?i.defaultValue.indexOf(e.props.value)!=-1:i.defaultValue==e.props.value}))),n.class&&!n.className?(i.class=n.class,Object.defineProperty(i,`className`,T)):n.className&&(i.class=i.className=n.className),t.props=i}(t),t.$$typeof=v,E&&E(t)};var D=i.__r;i.__r=function(e){D&&D(e),e.__c};var O=i.diffed;i.diffed=function(e){O&&O(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};function k(e){return r(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,"aria-hidden":`true`,...e,children:r(`path`,{d:`M7.33301 0C11.383 0 14.6668 3.28307 14.667 7.33301C14.667 11.3831 11.3831 14.667 7.33301 14.667C3.28307 14.6668 0 11.383 0 7.33301C0.000175746 3.28318 3.28318 0.000175742 7.33301 0ZM10.3896 4.27734C10.151 4.0388 9.76303 4.03775 9.52441 4.27637L7.33301 6.46777L5.14258 4.27637C4.90397 4.03776 4.51601 4.03882 4.27734 4.27734C4.03869 4.516 4.03771 4.90392 4.27637 5.14258L6.4668 7.33398L4.27637 9.52441C4.03807 9.76306 4.03891 10.1511 4.27734 10.3896C4.51589 10.6282 4.9039 10.629 5.14258 10.3906L7.33301 8.2002L9.52344 10.3906C9.76198 10.629 10.15 10.6279 10.3887 10.3896C10.6273 10.151 10.6283 9.76209 10.3896 9.52344L8.2002 7.33398L10.3906 5.14258C10.6293 4.90392 10.6283 4.516 10.3896 4.27734Z`,fill:`currentColor`})})}function A(e){return r(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,...e,children:r(`path`,{d:`M5.45508 0C5.75614 0.000209333 6 0.244788 6 0.545898C5.99979 0.846831 5.75601 1.09159 5.45508 1.0918H4.36426C3.05445 1.0918 2.27964 1.35707 1.81836 1.81836C1.35714 2.27966 1.0918 3.05454 1.0918 4.36426V7.63672C1.09186 8.94625 1.35713 9.72139 1.81836 10.1826C2.2797 10.6436 3.05488 10.9092 4.36426 10.9092H7.63672C8.94628 10.9091 9.72135 10.6438 10.1826 10.1826C10.6438 9.72139 10.9091 8.94625 10.9092 7.63672V6.5459C10.9092 6.24466 11.1538 6 11.4551 6C11.7561 6.00028 12 6.24483 12 6.5459V7.63672C11.9999 9.05391 11.72 10.1882 10.9541 10.9541C10.1882 11.7199 9.05394 12 7.63672 12H4.36426C2.94714 12 1.81283 11.7197 1.04688 10.9541C0.280997 10.1882 6.04321e-05 9.05391 0 7.63672V4.36426C0 2.94692 0.28099 1.81283 1.04688 1.04688C1.81284 0.280915 2.94686 0 4.36426 0H5.45508ZM11.4541 0C11.7553 2.20143e-05 11.999 0.244672 11.999 0.545898V3.16406C11.9988 3.46509 11.7552 3.70896 11.4541 3.70898C11.1532 3.70873 10.9084 3.46495 10.9082 3.16406V1.8623L6.93066 5.83984C6.71766 6.05283 6.37218 6.05283 6.15918 5.83984C5.94657 5.62681 5.94632 5.28124 6.15918 5.06836L10.1357 1.0918H8.83594C8.53504 1.09154 8.29025 0.846803 8.29004 0.545898C8.29004 0.244816 8.53491 0.000254588 8.83594 0H11.4541Z`,fill:`currentColor`})})}function j(e){return r(`svg`,{width:`24`,height:`24`,viewBox:`0 0 120 120`,fill:`none`,"aria-hidden":`true`,...e,children:r(`path`,{fill:`currentColor`,d:`M40.9656 92.9592L1.53047 79.6135C0.77971 79.3587 0 79.9184 0 80.7116V105.06C0 105.558 0.316516 105.998 0.78743 106.158L40.2226 119.504C40.9734 119.759 41.7531 119.199 41.7531 118.406V94.0574C41.7531 93.5594 41.4366 93.1194 40.9656 92.9592ZM81.9853 46.2654L42.5405 59.6112C42.0696 59.7714 41.7531 60.2114 41.7531 60.7094V85.0579C41.7531 85.8511 42.5328 86.4108 43.2835 86.1561L82.7283 72.8103C83.1993 72.6501 83.5158 72.2101 83.5158 71.7121V47.3636C83.5158 46.5704 82.738 46.0107 81.9853 46.2654ZM119.027 0.0367608L52.9913 21.3051C52.5127 21.4595 52.1884 21.9053 52.1884 22.409V47.3559C52.1884 47.8519 52.6806 48.2031 53.1592 48.0487L119.195 26.7804C119.674 26.626 120 26.1802 120 25.6765V0.729621C119.998 0.233617 119.506 -0.117637 119.027 0.0367608Z`})})}function M(e){return r(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,...e,children:r(`path`,{d:`M8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0ZM8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5ZM8.10352 10.207C8.82025 10.2071 9.23531 10.6346 9.23535 11.3262C9.23535 12.0304 8.82028 12.4579 8.10352 12.458C7.36167 12.4579 6.97168 12.0304 6.97168 11.3262C6.97172 10.6346 7.36171 10.2072 8.10352 10.207ZM8.84766 3.54102C9.01311 3.54121 9.14736 3.67535 9.14746 3.84082V4.74805L8.84375 8.37012C8.83069 8.52552 8.6999 8.64551 8.54395 8.64551H7.62891C7.47133 8.64523 7.34074 8.52251 7.33008 8.36523L7.08496 4.74805V3.84082C7.08507 3.67533 7.2193 3.54119 7.38477 3.54102H8.84766Z`,fill:`currentColor`})})}const N=`:root {
1
+ import{f as e,g as t,h as n,m as r,p as i,u as a}from"./usePlacement.Di6eZ4ty.js";function o(e,t){for(var n in t)e[n]=t[n];return e}function s(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function c(e,t){this.props=e,this.context=t}(c.prototype=new t).isPureReactComponent=!0,c.prototype.shouldComponentUpdate=function(e,t){return s(this.props,e)||s(this.state,t)};var l=n.__b;n.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),l&&l(e)},typeof Symbol<`u`&&Symbol.for;var u=n.__e;n.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k),i.__c(e,t)}u(e,t,n,r)};var d=n.unmount;function f(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=o({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return f(e,t,n)})),e}function p(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return p(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function m(){this.__u=0,this.o=null,this.__b=null}function h(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function g(){this.i=null,this.l=null}n.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),d&&d(e)},(m.prototype=new t).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=h(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=p(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},m.prototype.componentWillUnmount=function(){this.o=[]},m.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),a=this.__v.__k[0].__c;this.__v.__k[0]=f(this.__b,n,a.__O=a.__P)}this.__b=null}var o=t.__a&&i(r,null,e.fallback);return o&&(o.__u&=-33),[i(r,null,t.__a?null:e.children),o]};var _=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(g.prototype=new t).__a=function(e){var t=this,n=h(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),_(t,e,r)):i()};n?n(a):a()}},g.prototype.render=function(t){this.i=null,this.l=new Map;var n=e(t.children);t.revealOrder&&t.revealOrder[0]===`b`&&n.reverse();for(var r=n.length;r--;)this.l.set(n[r],this.i=[1,0,this.i]);return t.children},g.prototype.componentDidUpdate=g.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){_(e,n,t)})};var v=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,y=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,b=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,x=/[A-Z0-9]/g,S=typeof document<`u`,C=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};t.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(t.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var w=n.event;n.event=function(e){return w&&(e=w(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var T={configurable:!0,get:function(){return this.class}},E=n.vnode;n.vnode=function(t){typeof t.type==`string`&&function(t){var n=t.props,r=t.type,i={},a=r.indexOf(`-`)==-1;for(var o in n){var s=n[o];if(!(o===`value`&&`defaultValue`in n&&s==null||S&&o===`children`&&r===`noscript`||o===`class`||o===`className`)){var c=o.toLowerCase();o===`defaultValue`&&`value`in n&&n.value==null?o=`value`:o===`download`&&!0===s?s=``:c===`translate`&&s===`no`?s=!1:c[0]===`o`&&c[1]===`n`?c===`ondoubleclick`?o=`ondblclick`:c!==`onchange`||r!==`input`&&r!==`textarea`||C(n.type)?c===`onfocus`?o=`onfocusin`:c===`onblur`?o=`onfocusout`:b.test(o)&&(o=c):c=o=`oninput`:a&&y.test(o)?o=o.replace(x,`-$&`).toLowerCase():s===null&&(s=void 0),c===`oninput`&&i[o=c]&&(o=`oninputCapture`),i[o]=s}}r==`select`&&(i.multiple&&Array.isArray(i.value)&&(i.value=e(n.children).forEach(function(e){e.props.selected=i.value.indexOf(e.props.value)!=-1})),i.defaultValue!=null&&(i.value=e(n.children).forEach(function(e){e.props.selected=i.multiple?i.defaultValue.indexOf(e.props.value)!=-1:i.defaultValue==e.props.value}))),n.class&&!n.className?(i.class=n.class,Object.defineProperty(i,`className`,T)):n.className&&(i.class=i.className=n.className),t.props=i}(t),t.$$typeof=v,E&&E(t)};var D=n.__r;n.__r=function(e){D&&D(e),e.__c};var O=n.diffed;n.diffed=function(e){O&&O(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};function k(e){return a(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,"aria-hidden":`true`,...e,children:a(`path`,{d:`M7.33301 0C11.383 0 14.6668 3.28307 14.667 7.33301C14.667 11.3831 11.3831 14.667 7.33301 14.667C3.28307 14.6668 0 11.383 0 7.33301C0.000175746 3.28318 3.28318 0.000175742 7.33301 0ZM10.3896 4.27734C10.151 4.0388 9.76303 4.03775 9.52441 4.27637L7.33301 6.46777L5.14258 4.27637C4.90397 4.03776 4.51601 4.03882 4.27734 4.27734C4.03869 4.516 4.03771 4.90392 4.27637 5.14258L6.4668 7.33398L4.27637 9.52441C4.03807 9.76306 4.03891 10.1511 4.27734 10.3896C4.51589 10.6282 4.9039 10.629 5.14258 10.3906L7.33301 8.2002L9.52344 10.3906C9.76198 10.629 10.15 10.6279 10.3887 10.3896C10.6273 10.151 10.6283 9.76209 10.3896 9.52344L8.2002 7.33398L10.3906 5.14258C10.6293 4.90392 10.6283 4.516 10.3896 4.27734Z`,fill:`currentColor`})})}function A(e){return a(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,...e,children:a(`path`,{d:`M5.45508 0C5.75614 0.000209333 6 0.244788 6 0.545898C5.99979 0.846831 5.75601 1.09159 5.45508 1.0918H4.36426C3.05445 1.0918 2.27964 1.35707 1.81836 1.81836C1.35714 2.27966 1.0918 3.05454 1.0918 4.36426V7.63672C1.09186 8.94625 1.35713 9.72139 1.81836 10.1826C2.2797 10.6436 3.05488 10.9092 4.36426 10.9092H7.63672C8.94628 10.9091 9.72135 10.6438 10.1826 10.1826C10.6438 9.72139 10.9091 8.94625 10.9092 7.63672V6.5459C10.9092 6.24466 11.1538 6 11.4551 6C11.7561 6.00028 12 6.24483 12 6.5459V7.63672C11.9999 9.05391 11.72 10.1882 10.9541 10.9541C10.1882 11.7199 9.05394 12 7.63672 12H4.36426C2.94714 12 1.81283 11.7197 1.04688 10.9541C0.280997 10.1882 6.04321e-05 9.05391 0 7.63672V4.36426C0 2.94692 0.28099 1.81283 1.04688 1.04688C1.81284 0.280915 2.94686 0 4.36426 0H5.45508ZM11.4541 0C11.7553 2.20143e-05 11.999 0.244672 11.999 0.545898V3.16406C11.9988 3.46509 11.7552 3.70896 11.4541 3.70898C11.1532 3.70873 10.9084 3.46495 10.9082 3.16406V1.8623L6.93066 5.83984C6.71766 6.05283 6.37218 6.05283 6.15918 5.83984C5.94657 5.62681 5.94632 5.28124 6.15918 5.06836L10.1357 1.0918H8.83594C8.53504 1.09154 8.29025 0.846803 8.29004 0.545898C8.29004 0.244816 8.53491 0.000254588 8.83594 0H11.4541Z`,fill:`currentColor`})})}function j(e){return a(`svg`,{width:`24`,height:`24`,viewBox:`0 0 120 120`,fill:`none`,"aria-hidden":`true`,...e,children:a(`path`,{fill:`currentColor`,d:`M40.9656 92.9592L1.53047 79.6135C0.77971 79.3587 0 79.9184 0 80.7116V105.06C0 105.558 0.316516 105.998 0.78743 106.158L40.2226 119.504C40.9734 119.759 41.7531 119.199 41.7531 118.406V94.0574C41.7531 93.5594 41.4366 93.1194 40.9656 92.9592ZM81.9853 46.2654L42.5405 59.6112C42.0696 59.7714 41.7531 60.2114 41.7531 60.7094V85.0579C41.7531 85.8511 42.5328 86.4108 43.2835 86.1561L82.7283 72.8103C83.1993 72.6501 83.5158 72.2101 83.5158 71.7121V47.3636C83.5158 46.5704 82.738 46.0107 81.9853 46.2654ZM119.027 0.0367608L52.9913 21.3051C52.5127 21.4595 52.1884 21.9053 52.1884 22.409V47.3559C52.1884 47.8519 52.6806 48.2031 53.1592 48.0487L119.195 26.7804C119.674 26.626 120 26.1802 120 25.6765V0.729621C119.998 0.233617 119.506 -0.117637 119.027 0.0367608Z`})})}function M(e){return a(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,...e,children:a(`path`,{d:`M8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0ZM8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5ZM8.10352 10.207C8.82025 10.2071 9.23531 10.6346 9.23535 11.3262C9.23535 12.0304 8.82028 12.4579 8.10352 12.458C7.36167 12.4579 6.97168 12.0304 6.97168 11.3262C6.97172 10.6346 7.36171 10.2072 8.10352 10.207ZM8.84766 3.54102C9.01311 3.54121 9.14736 3.67535 9.14746 3.84082V4.74805L8.84375 8.37012C8.83069 8.52552 8.6999 8.64551 8.54395 8.64551H7.62891C7.47133 8.64523 7.34074 8.52251 7.33008 8.36523L7.08496 4.74805V3.84082C7.08507 3.67533 7.2193 3.54119 7.38477 3.54102H8.84766Z`,fill:`currentColor`})})}const N=`:root {
2
2
  --text-primary__pbq4ak0: #000000;
3
3
  --text-secondary__pbq4ak1: #525252;
4
4
  --text-tertiary__pbq4ak2: #a3a3a3;
@@ -85,7 +85,7 @@ import{d as e,f as t,h as n,l as r,m as i,p as a}from"./usePlacement.B7jMsQvP.js
85
85
  --icon-error__pbq4ak13: #e31c31;
86
86
  --icon-success__pbq4ak14: #09be67;
87
87
  --icon-warning__pbq4ak15: #ec7e00;
88
- }`;function P(e){return r(`svg`,{viewBox:`0 0 100 100`,fill:`none`,"aria-hidden":`true`,...e,children:[r(`circle`,{cx:`38`,cy:`28`,r:`23`,fill:`#FFF533`}),r(`path`,{d:`M50 38C30 10 12 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),r(`path`,{d:`M50 38C70 10 88 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),r(`rect`,{x:`10`,y:`38`,width:`80`,height:`16`,rx:`2`,stroke:`#222222`,"stroke-width":`4`}),r(`path`,{d:`M15 54V89C15 90.6 16.4 92 18 92H82C83.6 92 85 90.6 85 89V54`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),r(`line`,{x1:`50`,y1:`54`,x2:`50`,y2:`92`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`})]})}const F=`.reset_base__1831jhd0 {
88
+ }`;function P(e){return a(`svg`,{viewBox:`0 0 100 100`,fill:`none`,"aria-hidden":`true`,...e,children:[a(`circle`,{cx:`38`,cy:`28`,r:`23`,fill:`#FFF533`}),a(`path`,{d:`M50 38C30 10 12 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),a(`path`,{d:`M50 38C70 10 88 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),a(`rect`,{x:`10`,y:`38`,width:`80`,height:`16`,rx:`2`,stroke:`#222222`,"stroke-width":`4`}),a(`path`,{d:`M15 54V89C15 90.6 16.4 92 18 92H82C83.6 92 85 90.6 85 89V54`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),a(`line`,{x1:`50`,y1:`54`,x2:`50`,y2:`92`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`})]})}const F=`.reset_base__1831jhd0 {
89
89
  margin: 0;
90
90
  padding: 0;
91
91
  border: 0;
@@ -0,0 +1 @@
1
+ import{S as e}from"./loader.js";import{l as t,o as n,s as r}from"./usePlacement.Di6eZ4ty.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{t as e}from"./loader.js";import{l as t,r as n}from"./usePlacement.Di6eZ4ty.js";function r(r,i,a,o){t(()=>{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{S as e,i as t,n,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(e,t,i=[],a={shadow:!0}){typeof window<`u`&&(n(r),customElements.get(t)||de(e,t,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[n,r]=Y(()=>window.FrakSetup?.config?.waitForBackendConfig===!1?!0:e.isResolved),[i,a]=Y(()=>e.getConfig().hidden??!1),[o,s]=Y(()=>!!window.FrakSetup?.client);return X(()=>{let n=e.getConfig();n.isResolved&&(r(!0),a(n.hidden??!1)),window.FrakSetup?.client&&s(!0);let i=e=>{let t=e.detail;t.isResolved&&r(!0),a(t.hidden??!1)};window.addEventListener(`frak:config`,i);let o=()=>s(!0);return t(`add`,o),()=>{window.removeEventListener(`frak:config`,i),t(`remove`,o)}},[]),{shouldRender:n,isHidden:i,isClientReady:o}}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(t){return e.getConfig().placements?.[t]}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{b as e,f as t,x as n}from"./loader.js";import{l as r,s as i}from"./usePlacement.Di6eZ4ty.js";import{n as a}from"./formatReward.Ch8HzPk1.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};
@@ -0,0 +1 @@
1
+ import{C as e,T as t,h as n,s as r,w as i}from"./loader.js";import{c as a,s as o}from"./usePlacement.Di6eZ4ty.js";function s(s,c,l){let[u,d]=o(void 0),[f,p]=o(!1);return{handleShare:a(async()=>{if(!window.FrakSetup?.client){d(n.empty().formatDebugInfo(`Frak client not found`)),p(!0);return}let a=r(window.FrakSetup.client,{});try{await a.sharing(l?{link:l}:{}).display(e=>({...e,targetInteraction:s}),c)}catch(n){if(n instanceof t&&n.code===i.clientAborted)return;let r=window.FrakSetup.client.debugInfo.formatDebugInfo(n);e(window.FrakSetup.client,`share_modal_error`,{placement:c,target_interaction:s,error:n instanceof Object&&`message`in n?n.message:`Unknown error`}),d(r),p(!0)}},[s,c,l]),isError:f,debugInfo:u}}export{s as t};
package/dist/banner.js CHANGED
@@ -1,11 +1,11 @@
1
- import { a as registerWebComponent, i as useClientReady, t as usePlacement } from "./usePlacement-LqYjZLX_.js";
1
+ import { a as registerWebComponent, i as useClientReady, t as usePlacement } from "./usePlacement-V7NrKoub.js";
2
2
  import { t as useGlobalComponents } from "./useGlobalComponents-Cmfszr7v.js";
3
- import { t as useLightDomStyles } from "./useLightDomStyles-hgYYZsTy.js";
3
+ import { t as useLightDomStyles } from "./useLightDomStyles-C3lcOwY2.js";
4
4
  import { t as useReward } from "./useReward-DU3_yP8Q.js";
5
5
  import { a as CloseCircleIcon, c as cssSource$5, i as ExternalLinkIcon, n as WarningIcon, o as cssSource$6, s as cssSource$4, t as GiftIcon } from "./GiftIcon-4sr9xXyq.js";
6
- import { isInAppBrowser, redirectToExternalBrowser } from "@frak-labs/core-sdk";
6
+ import { isInAppBrowser, redirectToExternalBrowser, trackEvent } from "@frak-labs/core-sdk";
7
7
  import { REFERRAL_SUCCESS_EVENT, getMergeToken } from "@frak-labs/core-sdk/actions";
8
- import { useCallback, useEffect, useMemo, useState } from "preact/hooks";
8
+ import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
9
9
  import { jsx, jsxs } from "preact/jsx-runtime";
10
10
  //#region \0ve-inline:../../packages/design-system/src/styles/inAppBanner.css.ts.vanilla.js
11
11
  const cssSource$3 = `@keyframes inAppBanner_fadeIn__1ibpiy70 {
@@ -241,7 +241,7 @@ var referralCta = "Banner_referralCta__1gnumzi8 reset_element_button__1831jhd6 r
241
241
  var referralDescription = "Banner_referralDescription__1gnumzi7 reset_base__1831jhd0";
242
242
  var referralIconWrapper = "Banner_referralIconWrapper__1gnumzi4";
243
243
  var referralTitle = "Banner_referralTitle__1gnumzi6 reset_base__1831jhd0";
244
- const cssSource = cssSource$5 + cssSource$4 + cssSource$6 + cssSource$1;
244
+ const cssSource = cssSource$5 + cssSource$4 + cssSource$6 + cssSource$3 + cssSource$1;
245
245
  //#endregion
246
246
  //#region src/components/Banner/Banner.tsx
247
247
  /**
@@ -285,6 +285,7 @@ function Banner({ placement: placementId, classname = "", interaction, referralT
285
285
  if (isPreview) return resolvedPreviewMode;
286
286
  return isInAppBrowser ? "inapp" : null;
287
287
  });
288
+ const trackedImpressionModeRef = useRef(null);
288
289
  useEffect(() => {
289
290
  if (isPreview) setMode(resolvedPreviewMode);
290
291
  }, [isPreview, resolvedPreviewMode]);
@@ -299,6 +300,23 @@ function Banner({ placement: placementId, classname = "", interaction, referralT
299
300
  isPreview,
300
301
  isClientReady
301
302
  ]);
303
+ useEffect(() => {
304
+ if (isPreview || !mode || dismissed) return;
305
+ if (trackedImpressionModeRef.current === mode) return;
306
+ if (!isClientReady) return;
307
+ trackEvent(window.FrakSetup?.client, "banner_impression", {
308
+ placement: placementId,
309
+ variant: mode,
310
+ has_reward: mode === "referral" ? Boolean(reward) : void 0
311
+ });
312
+ trackedImpressionModeRef.current = mode;
313
+ }, [
314
+ mode,
315
+ dismissed,
316
+ isClientReady,
317
+ isPreview,
318
+ placementId
319
+ ]);
302
320
  useEffect(() => {
303
321
  if (isPreview || mode === "inapp") return;
304
322
  const handler = () => setMode("referral");
@@ -307,6 +325,11 @@ function Banner({ placement: placementId, classname = "", interaction, referralT
307
325
  }, [isPreview, mode]);
308
326
  const handleAction = useCallback(async () => {
309
327
  if (isPreview) return;
328
+ trackEvent(window.FrakSetup?.client, "banner_resolved", {
329
+ placement: placementId,
330
+ variant: mode ?? "referral",
331
+ outcome: "clicked"
332
+ });
310
333
  if (mode === "referral") {
311
334
  setDismissed(true);
312
335
  return;
@@ -325,12 +348,22 @@ function Banner({ placement: placementId, classname = "", interaction, referralT
325
348
  }, [
326
349
  isPreview,
327
350
  mode,
328
- prefetchedMergeToken
351
+ prefetchedMergeToken,
352
+ placementId
329
353
  ]);
330
354
  const handleDismiss = useCallback(() => {
331
355
  if (isPreview) return;
356
+ trackEvent(window.FrakSetup?.client, "banner_resolved", {
357
+ placement: placementId,
358
+ variant: mode ?? "referral",
359
+ outcome: "dismissed"
360
+ });
332
361
  setDismissed(true);
333
- }, [isPreview]);
362
+ }, [
363
+ isPreview,
364
+ mode,
365
+ placementId
366
+ ]);
334
367
  const globalComponents = useGlobalComponents();
335
368
  const bannerConfig = placement?.components?.banner ?? globalComponents?.banner;
336
369
  const texts = useMemo(() => {
@@ -36,6 +36,13 @@ type ButtonShareProps = {
36
36
  * @defaultValue `"embedded-wallet"`
37
37
  */
38
38
  clickAction?: "embedded-wallet" | "share-modal" | "sharing-page";
39
+ /**
40
+ * When set, renders the button in preview mode (e.g. Shopify/WP editor).
41
+ * Skips the client-ready gating so the button is always enabled visually,
42
+ * and no-ops the click handler so merchants can see the final layout with
43
+ * their configured copy even when no Frak client is initialized.
44
+ */
45
+ preview?: string;
39
46
  };
40
47
  //#endregion
41
48
  //#region src/components/ButtonShare/ButtonShare.d.ts
@@ -87,7 +94,8 @@ declare function ButtonShare({
87
94
  useReward: rawUseReward,
88
95
  noRewardText,
89
96
  targetInteraction,
90
- clickAction: rawClickAction
97
+ clickAction: rawClickAction,
98
+ preview
91
99
  }: ButtonShareProps): _$preact.JSX.Element | null;
92
100
  //#endregion
93
101
  //#region src/components/ButtonShare/index.d.ts