@frak-labs/core-sdk 0.2.0-beta.db56431e → 0.2.1-beta.21ffe110

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cdn/bundle.js CHANGED
@@ -1,5 +1,57 @@
1
- var FrakSDK=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=(e,t)=>()=>(e&&(t=e(e=0)),t);async function n(e,t){return await e.request({method:`frak_displayEmbeddedWallet`,params:[t,e.config.metadata]})}async function r(e,{steps:t,metadata:n}){return await e.request({method:`frak_displayModal`,params:[t,n,e.config.metadata]})}let i=`https://backend.frak.id`;function a(e){return e.includes(`localhost:3000`)||e.includes(`localhost:3010`)}function o(e){return a(e)?`http://localhost:3030`:e.includes(`wallet-dev.frak.id`)||e.includes(`wallet.gcp-dev.frak.id`)?`https://backend.gcp-dev.frak.id`:i}function s(e){if(e)return o(e);if(typeof window<`u`){let e=window.FrakSetup?.client?.config?.walletUrl;if(e)return o(e)}return i}let c=`frak-client-id`;function l(){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 u(){if(typeof window>`u`||!window.localStorage)return console.warn(`[Frak SDK] No Window / localStorage available to save the clientId`),l();let e=localStorage.getItem(c);return e||(e=l(),localStorage.setItem(c,e)),e}let d=`frak-merchant-id`,f,p;async function m(e,t){if(f)return f;if(typeof window<`u`){let e=window.sessionStorage.getItem(d);if(e)return f=e,e}if(p)return p;p=h(e,t);let n=await p;return p=void 0,n}async function h(e,t){let n=e??(typeof window<`u`?window.location.hostname:``);if(n)try{let e=s(t),r=await fetch(`${e}/user/merchant/resolve?domain=${encodeURIComponent(n)}`);if(!r.ok){console.warn(`[Frak SDK] Merchant lookup failed for domain ${n}: ${r.status}`);return}let i=await r.json();return f=i.merchantId,typeof window<`u`&&window.sessionStorage.setItem(d,i.merchantId),f}catch(e){console.warn(`[Frak SDK] Failed to fetch merchantId:`,e);return}}function ee(){f=void 0,p=void 0,typeof window<`u`&&window.sessionStorage.removeItem(d)}async function g(e,t){return e.metadata?.merchantId?e.metadata.merchantId:m(void 0,t)}async function _(e){if(typeof window>`u`)return;let t=u();if(!t)return;let n=await m();if(!n)return;let r=`frak-identity-ensured-${n}`;if(!window.sessionStorage.getItem(r))try{let i=s();(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 te(e){return await e.request({method:`frak_getMerchantInformation`})}function v(e,{strict:t=!0}={}){return!e||typeof e!=`string`?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith(`0x`)}var ne=t((()=>{}));function re(e){return v(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var ie=t((()=>{ne()})),y,ae=t((()=>{y=`2.46.3`}));function oe(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?oe(e.cause,t):t?null:e}var b,x,se=t((()=>{ae(),b={getDocsUrl:({docsBaseUrl:e,docsPath:t=``,docsSlug:n})=>t?`${e??`https://viem.sh`}${t}${n?`#${n}`:``}`:void 0,version:`viem@${y}`},x=class e extends Error{constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof e&&n.cause.docsPath||n.docsPath,a=b.getDocsUrl?.({...n,docsPath:i}),o=[t||`An error occurred.`,``,...n.metaMessages?[...n.metaMessages,``]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...b.version?[`Version: ${b.version}`]:[]].join(`
2
- `);super(o,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=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=y}walk(e){return oe(this,e)}}})),S,ce=t((()=>{se(),S=class extends x{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 C(e,{dir:t,size:n=32}={}){return typeof e==`string`?le(e,{dir:t,size:n}):ue(e,{dir:t,size:n})}function le(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace(`0x`,``);if(r.length>n*2)throw new S({size:Math.ceil(r.length/2),targetSize:n,type:`hex`});return`0x${r[t===`right`?`padEnd`:`padStart`](n*2,`0`)}`}function ue(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new S({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 de=t((()=>{ce()})),fe,pe,me=t((()=>{se(),fe=class extends x{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`})}},pe=class extends x{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:`SizeOverflowError`})}}}));function w(e,{size:t}){if(re(e)>t)throw new pe({givenSize:re(e),maxSize:t})}var he=t((()=>{me(),ie()}));function ge(e,t={}){return typeof e==`number`||typeof e==`bigint`?ve(e,t):typeof e==`string`?ye(e,t):typeof e==`boolean`?_e(e,t):T(e,t)}function _e(e,t={}){let n=`0x${Number(e)}`;return typeof t.size==`number`?(w(n,{size:t.size}),C(n,{size:t.size})):n}function T(e,t={}){let n=``;for(let t=0;t<e.length;t++)n+=be[e[t]];let r=`0x${n}`;return typeof t.size==`number`?(w(r,{size:t.size}),C(r,{dir:`right`,size:t.size})):r}function ve(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 fe({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?C(s,{size:r}):s}function ye(e,t={}){return T(xe.encode(e),t)}var be,xe;function Se(e,t={}){return typeof e==`number`||typeof e==`bigint`?we(e,t):typeof e==`boolean`?Ce(e,t):v(e)?D(e,t):Te(e,t)}function Ce(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size==`number`?(w(n,{size:t.size}),C(n,{size:t.size})):n}function E(e){if(e>=O.zero&&e<=O.nine)return e-O.zero;if(e>=O.A&&e<=O.F)return e-(O.A-10);if(e>=O.a&&e<=O.f)return e-(O.a-10)}function D(e,t={}){let n=e;t.size&&(w(n,{size:t.size}),n=C(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=E(r.charCodeAt(t++)),i=E(r.charCodeAt(t++));if(n===void 0||i===void 0)throw new x(`Invalid byte sequence ("${r[t-2]}${r[t-1]}" in "${r}").`);a[e]=n*16+i}return a}function we(e,t){return D(ve(e,t))}function Te(e,t={}){let n=Ee.encode(e);return typeof t.size==`number`?(w(n,{size:t.size}),C(n,{dir:`right`,size:t.size})):n}var Ee,O,De,Oe;function ke(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function Ae(e,...t){if(!ke(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 je(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Me(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}var Ne,Pe;function Fe(e,t){let n=t||`hex`,r=Pe(v(e,{strict:!1})?Se(e):e);return n===`bytes`?r:ge(r)}var Ie;function Le(e,t){if(k.has(`${e}.${t}`))return k.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=Fe(Te(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 k.set(`${e}.${t}`,a),a}var k;function A(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(j.has(r))return j.get(r);let i=Re.test(e)?e.toLowerCase()===e?!0:n?Le(e)===e:!0:!1;return j.set(r,i),i}var Re,j;function ze(e,t){if(!A(e,{strict:!1}))throw new Ie({address:e});if(!A(t,{strict:!1}))throw new Ie({address:t});return e.toLowerCase()===t.toLowerCase()}let M=256,N;function Be(e=11){if(!N||M+e>256*2){N=``,M=0;for(let e=0;e<256;e++)N+=(256+Math.random()*256|0).toString(16).substring(1)}return N.substring(M,M+++e)}function Ve({domain:e}={}){return Fe(ge((e??window.location.host).replace(`www.`,``)))}let He={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 P=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}}},F=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 Ue(e){let{emittingTransport:t,listeningTransport:n,targetOrigin:r,middleware:i=[],lifecycleHandlers:a}=e,o=new Map;function s(e){return typeof e!=`object`||!e?!1:`clientLifecycle`in e||`iframeLifecycle`in e}function c(e){return typeof e!=`object`||!e?!1:`id`in e&&`topic`in e&&`data`in e}async function l(e){try{`clientLifecycle`in e&&a?.clientLifecycle?await a.clientLifecycle(e,{origin:r,source:null}):`iframeLifecycle`in e&&a?.iframeLifecycle&&await a.iframeLifecycle(e,{origin:r,source:null})}catch(e){console.error(`[RPC Client] Lifecycle handler error:`,e)}}async function u(e){let t={origin:r,source:null};for(let n of i)n.onRequest&&await n.onRequest(e,t);return e}async function d(e,t){let n={origin:r,source:null},a=t;for(let t of i)t.onResponse&&(a=await t.onResponse(e,a,n));return a}async function f(e){try{let t=new URL(e.origin).origin.toLowerCase(),n=new URL(r).origin.toLowerCase();if(t!==n){console.log(`Not expected origin`,t,n);return}}catch(e){console.error(`[RPC Client] Invalid origin`,e);return}if(s(e.data)){await l(e.data);return}if(!c(e.data))return;let t;try{let n=e.data.data,r=n instanceof Uint8Array||ArrayBuffer.isView(n)?{result:n}:n;t=await d(e.data,r)}catch(e){console.error(`[RPC Client] Middleware error on response:`,e);return}let n=o.get(e.data.id);n&&n(t)}async function p(e){let n=e;try{n=await u(e)}catch(e){throw console.error(`[RPC Client] Middleware error on request:`,e),e}t.postMessage(n,r)}function m(e){t.postMessage(e,r)}function h(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}n.addEventListener(`message`,f);function ee(e){let t=h(),n=new F;return o.set(t,e=>{e.error?n.reject(new P(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 g(e,t){let n=h();return o.set(n,e=>{e.error?(console.error(`[RPC Client] Listener error:`,e.error),o.delete(n)):t(e.result)}),p({id:n,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{console.error(`[RPC Client] Failed to send listener request:`,e),o.delete(n)}),()=>{o.delete(n)}}function _(){n.removeEventListener(`message`,f),o.clear()}return{request:ee,listen:g,sendLifecycle:m,cleanup:_}}function We(e){return new TextEncoder().encode(JSON.stringify(e))}function Ge(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}function I(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function L(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 R(e){return I(We(e))}function z(e,t,n,r,i,a){let o=R(Ke({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 Ke(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}}}let B=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,V=`frak-sso`;async function qe(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??z(i??`https://wallet.frak.id`,t,Ve(),n.name,u(),r?.css),o=window.open(a,V,B);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]})??{}}async function Je(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}function H(e){return`r`in e&&!(`v`in e)}function U(e){return`v`in e&&e.v===2}function Ye(e){return Ge(L(e))}let W=`nexus-wallet-backup`,Xe=`frakwallet://`;function Ze(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}function Qe(e){return`intent://${e.slice(13)}#Intent;scheme=frakwallet;end`}function $e(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=Ze()&&G(e)?Qe(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function G(e){return e.startsWith(Xe)}let K=`fCtx`;function et(e){if(e)try{return U(e)?!e.c||!e.m||!e.t?void 0:R({v:2,c:e.c,m:e.m,t:e.t}):I(D(e.r))}catch(t){console.error(`Error compressing Frak context`,{e:t,context:e})}}function tt(e){if(!(!e||e.length===0))try{let t=Ye(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=T(L(e),{size:20});if(A(n))return{r:n}}catch(t){console.error(`Error decompressing Frak context`,{e:t,context:e})}}function nt({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(K);return t?tt(t):null}function rt({url:e,context:t}){if(!e)return null;let n=et(t);if(!n)return null;let r=new URL(e);return r.searchParams.set(K,n),r.toString()}function it(e){let t=new URL(e);return t.searchParams.delete(K),t.toString()}function at({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?it(n):rt({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}let q={compress:et,decompress:tt,parse:nt,update:rt,remove:it,replaceUrl:at},J={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function Y(e){return e&&e in J?e:`eur`}function ot(e){return e?J[e]??J.eur:J.eur}function st(e,t){let n=ot(t),r=Y(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function ct(e){return e?`${e}Amount`:`eurAmount`}let 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 lt({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(),ut({iframe:r,isVisible:!1});let i=t?.walletUrl??e??`https://wallet.frak.id`,a=u();return r.src=`${i}/listener?clientId=${encodeURIComponent(a)}`,new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function ut({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 dt(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 Z(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)}}async function Q(e,t){try{await e.request({method:`frak_sendInteraction`,params:[t,{clientId:u()}]})}catch{console.warn(`[Frak SDK] Failed to send interaction:`,t.type)}}function ft(e,t,n){let r=typeof window<`u`?window.location.href:void 0;return U(t)?(Z(e,`user_referred_started`,{properties:{referrerClientId:t.c,walletStatus:n?.key}}),Q(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referralTimestamp:t.t,landingUrl:r}),!0):H(t)?(Z(e,`user_referred_started`,{properties:{referrer:t.r,walletStatus:n?.key}}),Q(e,{type:`arrival`,referrerWallet:t.r,landingUrl:r}),!0):!1}function pt(e){let t=u();return t?{v:2,c:t,m:e,t:Math.floor(Date.now()/1e3)}:null}function mt(e,t){return U(e)?u()===e.c:H(e)&&t?.wallet?ze(e.r,t.wallet):!1}function ht(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;if(mt(n,t))return`self-referral`;if(!ft(e,n,t))return`no-referrer`;let i=U(n)?n.m:r?.merchantId,a=r?.alwaysAppendUrl&&i?pt(i):null;return q.replaceUrl({url:window.location?.href,context:a}),Z(e,`user_referred_completed`,{properties:{status:`success`}}),`success`}async function gt(e,{options:t}={}){let n=q.parse({url:window.location.href}),r=await vt(e);try{return ht(e,{walletStatus:r,frakContext:n,options:t})}catch(e){console.warn(`Error processing referral`,{error:e})}}async function _t(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=u();if(!t&&!n){console.warn(`[Frak] No identity found, skipping purchase check`);return}let r=window.sessionStorage.getItem(`frak-merchant-id`),i=e.merchantId??r??await m();if(!i){console.warn(`[Frak] No merchant id found, skipping purchase check`);return}let a={Accept:`application/json`,"Content-Type":`application/json`};t&&(a[`x-wallet-sdk-auth`]=t),n&&(a[`x-frak-client-id`]=n);let o=s();await fetch(`${o}/user/track/purchase`,{method:`POST`,headers:a,body:JSON.stringify({customerId:e.customerId,orderId:e.orderId,token:e.token,merchantId:i})})}function vt(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(yt(e,t),t));let n=new F,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{yt(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function yt(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),_(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function bt(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 i(n){return $(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function a(n,r){return $(e,{...t,steps:{...t.steps,final:{...r,action:{key:`sharing`,options:n}}}})}async function o(n){return n&&(t.metadata=n(t.metadata??{})),await r(e,t)}return{params:t,sendTx:n,reward:i,sharing:a,display:o}}async function xt(e,{tx:t,metadata:n}){return(await r(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function St(){return Be(96)}async function Ct(e,{siwe:t,metadata:n}){let i=e.config?.domain??window.location.host,a=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`;return(await r(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:a,nonce:t?.nonce??St(),uri:t?.uri??`https://${i}`,version:t?.version??`1`,domain:i}}}})).siweAuthenticate}var wt=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)}},Tt=class{constructor(e){this.options=e,this.queue=[];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.0.4`,this.api=new wt({baseUrl:e.apiUrl||`https://api.openpanel.dev`,defaultHeaders:t})}init(){}ready(){this.options.waitForProfile=!1,this.flush()}async send(e){return this.options.disabled||this.options.filter&&!this.options.filter(e)?Promise.resolve():this.options.waitForProfile&&!this.profileId?(this.queue.push(e),Promise.resolve()):this.api.fetch(`/track`,e)}setGlobalProperties(e){this.global={...this.global,...e}}async track(e,t){return this.log(`track event`,e,t),this.send({type:`track`,payload:{name:e,profileId:t?.profileId??this.profileId,properties:{...this.global??{},...t??{}}}})}async 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}}})}async alias(e){}async increment(e){return this.send({type:`increment`,payload:e})}async decrement(e){return this.send({type:`decrement`,payload:e})}async revenue(e,t){let n=t?.deviceId;return delete t?.deviceId,this.track(`revenue`,{...t??{},...n?{__deviceId:n}:{},__revenue:e})}async fetchDeviceId(){return(await this.api.fetch(`/track/device-id`,void 0,{method:`GET`,keepalive:!1}))?.deviceId??``}clear(){this.profileId=void 0}flush(){this.queue.forEach(e=>{this.send({...e,payload:{...e.payload,profileId:e.payload.profileId??this.profileId}})}),this.queue=[]}log(...e){this.options.debug&&console.log(`[OpenPanel.dev]`,...e)}};function Et(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var Dt=class extends Tt{constructor(e){if(super({sdk:`web`,sdkVersion:`1.0.7`,...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=[]}this.setGlobalProperties({__referrer:document.referrer}),this.options.trackScreenViews&&(this.trackScreenViews(),setTimeout(()=>this.screenView(),0)),this.options.trackOutgoingLinks&&this.trackOutgoingLinks(),this.options.trackAttributes&&this.trackAttributes()}}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[Et(t.name.replace(/^data-/,``))]=t.value);let t=i.getAttribute(`data-track`);t&&super.track(t,e)}})}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 Ot(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 kt=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:0:-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 P?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`
1
+ var FrakSDK=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=(e,t)=>()=>(e&&(t=e(e=0)),t);async function n(e,t){return await e.request({method:`frak_displayEmbeddedWallet`,params:[t,e.config.metadata]})}async function r(e,{steps:t,metadata:n}){return await e.request({method:`frak_displayModal`,params:[t,n,e.config.metadata]})}let i=`https://backend.frak.id`;function a(e){return e.includes(`localhost:3000`)||e.includes(`localhost:3010`)}function o(e){return a(e)?`http://localhost:3030`:e.includes(`wallet-dev.frak.id`)||e.includes(`wallet.gcp-dev.frak.id`)?`https://backend.gcp-dev.frak.id`:i}function s(e){if(e)return o(e);if(typeof window<`u`){let e=window.FrakSetup?.client?.config?.walletUrl;if(e)return o(e)}return i}let c=`frak-client-id`;function l(){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 u(){if(typeof window>`u`||!window.localStorage)return console.warn(`[Frak SDK] No Window / localStorage available to save the clientId`),l();let e=localStorage.getItem(c);return e||(e=l(),localStorage.setItem(c,e)),e}let d=`frak-merchant-id`,f,p;async function m(e,t){if(f)return f;if(typeof window<`u`){let e=window.sessionStorage.getItem(d);if(e)return f=e,e}if(p)return p;p=h(e,t);let n=await p;return p=void 0,n}async function h(e,t){let n=e??(typeof window<`u`?window.location.hostname:``);if(n)try{let e=s(t),r=await fetch(`${e}/user/merchant/resolve?domain=${encodeURIComponent(n)}`);if(!r.ok){console.warn(`[Frak SDK] Merchant lookup failed for domain ${n}: ${r.status}`);return}let i=await r.json();return f=i.merchantId,typeof window<`u`&&window.sessionStorage.setItem(d,i.merchantId),f}catch(e){console.warn(`[Frak SDK] Failed to fetch merchantId:`,e);return}}function g(){f=void 0,p=void 0,typeof window<`u`&&window.sessionStorage.removeItem(d)}async function _(e,t){return e.metadata?.merchantId?e.metadata.merchantId:m(void 0,t)}async function v(e){if(typeof window>`u`)return;let t=u();if(!t)return;let n=await m();if(!n)return;let r=`frak-identity-ensured-${n}`;if(!window.sessionStorage.getItem(r))try{let i=s();(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 y(e){return await e.request({method:`frak_getMerchantInformation`})}function b(e,{strict:t=!0}={}){return!e||typeof e!=`string`?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith(`0x`)}var ee=t((()=>{}));function x(e){return b(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var te=t((()=>{ee()})),ne,re=t((()=>{ne=`2.46.3`}));function ie(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?ie(e.cause,t):t?null:e}var S,C,w=t((()=>{re(),S={getDocsUrl:({docsBaseUrl:e,docsPath:t=``,docsSlug:n})=>t?`${e??`https://viem.sh`}${t}${n?`#${n}`:``}`:void 0,version:`viem@${ne}`},C=class e extends Error{constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof e&&n.cause.docsPath||n.docsPath,a=S.getDocsUrl?.({...n,docsPath:i}),o=[t||`An error occurred.`,``,...n.metaMessages?[...n.metaMessages,``]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...S.version?[`Version: ${S.version}`]:[]].join(`
2
+ `);super(o,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=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=ne}walk(e){return ie(this,e)}}})),ae,oe=t((()=>{w(),ae=class extends C{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 se(e,{dir:t,size:n=32}={}){return typeof e==`string`?ce(e,{dir:t,size:n}):le(e,{dir:t,size:n})}function ce(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace(`0x`,``);if(r.length>n*2)throw new ae({size:Math.ceil(r.length/2),targetSize:n,type:`hex`});return`0x${r[t===`right`?`padEnd`:`padStart`](n*2,`0`)}`}function le(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new ae({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 ue=t((()=>{oe()})),de,fe,pe=t((()=>{w(),de=class extends C{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`})}},fe=class extends C{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:`SizeOverflowError`})}}}));function me(e,{size:t}){if(x(e)>t)throw new fe({givenSize:x(e),maxSize:t})}var he=t((()=>{pe(),te()}));function ge(e,t={}){return typeof e==`number`||typeof e==`bigint`?ve(e,t):typeof e==`string`?ye(e,t):typeof e==`boolean`?_e(e,t):T(e,t)}function _e(e,t={}){let n=`0x${Number(e)}`;return typeof t.size==`number`?(me(n,{size:t.size}),se(n,{size:t.size})):n}function T(e,t={}){let n=``;for(let t=0;t<e.length;t++)n+=be[e[t]];let r=`0x${n}`;return typeof t.size==`number`?(me(r,{size:t.size}),se(r,{dir:`right`,size:t.size})):r}function ve(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 de({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?se(s,{size:r}):s}function ye(e,t={}){return T(xe.encode(e),t)}var be,xe;function Se(e,t={}){return typeof e==`number`||typeof e==`bigint`?Ee(e,t):typeof e==`boolean`?Ce(e,t):b(e)?Te(e,t):De(e,t)}function Ce(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size==`number`?(me(n,{size:t.size}),se(n,{size:t.size})):n}function we(e){if(e>=ke.zero&&e<=ke.nine)return e-ke.zero;if(e>=ke.A&&e<=ke.F)return e-(ke.A-10);if(e>=ke.a&&e<=ke.f)return e-(ke.a-10)}function Te(e,t={}){let n=e;t.size&&(me(n,{size:t.size}),n=se(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=we(r.charCodeAt(t++)),i=we(r.charCodeAt(t++));if(n===void 0||i===void 0)throw new C(`Invalid byte sequence ("${r[t-2]}${r[t-1]}" in "${r}").`);a[e]=n*16+i}return a}function Ee(e,t){return Te(ve(e,t))}function De(e,t={}){let n=Oe.encode(e);return typeof t.size==`number`?(me(n,{size:t.size}),se(n,{dir:`right`,size:t.size})):n}var Oe,ke,Ae,je;function Me(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function Ne(e,...t){if(!Me(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 Pe(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Fe(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}var Ie,Le;function Re(e,t){let n=t||`hex`,r=Le(b(e,{strict:!1})?Se(e):e);return n===`bytes`?r:ge(r)}var ze;function Be(e,t){if(Ve.has(`${e}.${t}`))return Ve.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=Re(De(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 Ve.set(`${e}.${t}`,a),a}var Ve;function He(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(We.has(r))return We.get(r);let i=Ue.test(e)?e.toLowerCase()===e?!0:n?Be(e)===e:!0:!1;return We.set(r,i),i}var Ue,We;function Ge(e,t){if(!He(e,{strict:!1}))throw new ze({address:e});if(!He(t,{strict:!1}))throw new ze({address:t});return e.toLowerCase()===t.toLowerCase()}let Ke=256,qe;function Je(e=11){if(!qe||Ke+e>256*2){qe=``,Ke=0;for(let e=0;e<256;e++)qe+=(256+Math.random()*256|0).toString(16).substring(1)}return qe.substring(Ke,Ke+++e)}var Ye,Xe=t((()=>{Xe(),Ye=Ye===void 0?typeof self<`u`?self:typeof window<`u`?window:{}:Ye}));function Ze({domain:e}={}){return Re(ge((e??window.location.host).replace(`www.`,``)))}let Qe={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 $e=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}}},et=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 tt(e){let{emittingTransport:t,listeningTransport:n,targetOrigin:r,middleware:i=[],lifecycleHandlers:a}=e,o=new Map;function s(e){return typeof e!=`object`||!e?!1:`clientLifecycle`in e||`iframeLifecycle`in e}function c(e){return typeof e!=`object`||!e?!1:`id`in e&&`topic`in e&&`data`in e}async function l(e){try{`clientLifecycle`in e&&a?.clientLifecycle?await a.clientLifecycle(e,{origin:r,source:null}):`iframeLifecycle`in e&&a?.iframeLifecycle&&await a.iframeLifecycle(e,{origin:r,source:null})}catch(e){console.error(`[RPC Client] Lifecycle handler error:`,e)}}async function u(e){let t={origin:r,source:null};for(let n of i)n.onRequest&&await n.onRequest(e,t);return e}async function d(e,t){let n={origin:r,source:null},a=t;for(let t of i)t.onResponse&&(a=await t.onResponse(e,a,n));return a}async function f(e){try{let t=new URL(e.origin).origin.toLowerCase(),n=new URL(r).origin.toLowerCase();if(t!==n){console.log(`Not expected origin`,t,n);return}}catch(e){console.error(`[RPC Client] Invalid origin`,e);return}if(s(e.data)){await l(e.data);return}if(!c(e.data))return;let t;try{let n=e.data.data,r=n instanceof Uint8Array||ArrayBuffer.isView(n)?{result:n}:n;t=await d(e.data,r)}catch(e){console.error(`[RPC Client] Middleware error on response:`,e);return}let n=o.get(e.data.id);n&&n(t)}async function p(e){let n=e;try{n=await u(e)}catch(e){throw console.error(`[RPC Client] Middleware error on request:`,e),e}t.postMessage(n,r)}function m(e){t.postMessage(e,r)}function h(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}n.addEventListener(`message`,f);function g(e){let t=h(),n=new et;return o.set(t,e=>{e.error?n.reject(new $e(e.error.code,e.error.message,e.error.data)):n.resolve(e.result),o.delete(t)}),p({id:t,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{o.delete(t),n.reject(e)}),n.promise}function _(e,t){let n=h();return o.set(n,e=>{e.error?(console.error(`[RPC Client] Listener error:`,e.error),o.delete(n)):t(e.result)}),p({id:n,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{console.error(`[RPC Client] Failed to send listener request:`,e),o.delete(n)}),()=>{o.delete(n)}}function v(){n.removeEventListener(`message`,f),o.clear()}return{request:g,listen:_,sendLifecycle:m,cleanup:v}}function nt(e){return new TextEncoder().encode(JSON.stringify(e))}function rt(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}function it(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function at(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 ot(e){return it(nt(e))}function st(e,t,n,r,i,a){let o=ot(ct({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 ct(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}}}let lt=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,ut=`frak-sso`;async function dt(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??st(i??`https://wallet.frak.id`,t,Ze(),n.name,u(),r?.css),o=window.open(a,ut,lt);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]})??{}}async function ft(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}function pt(e){return`r`in e&&!(`v`in e)}function mt(e){return`v`in e&&e.v===2}function ht(e){return rt(at(e))}let gt=`nexus-wallet-backup`,_t=`frakwallet://`;function vt(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}function yt(e){return`intent://${e.slice(13)}#Intent;scheme=frakwallet;end`}function bt(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=vt()&&xt(e)?yt(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function xt(e){return e.startsWith(_t)}let St=`fCtx`;function Ct(e){if(e)try{return mt(e)?!e.c||!e.m||!e.t?void 0:ot({v:2,c:e.c,m:e.m,t:e.t}):it(Te(e.r))}catch(t){console.error(`Error compressing Frak context`,{e:t,context:e})}}function wt(e){if(!(!e||e.length===0))try{let t=ht(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=T(at(e),{size:20});if(He(n))return{r:n}}catch(t){console.error(`Error decompressing Frak context`,{e:t,context:e})}}function Tt({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(St);return t?wt(t):null}function Et({url:e,context:t}){if(!e)return null;let n=Ct(t);if(!n)return null;let r=new URL(e);return r.searchParams.set(St,n),r.toString()}function Dt(e){let t=new URL(e);return t.searchParams.delete(St),t.toString()}function Ot({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?Dt(n):Et({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}let kt={compress:Ct,decompress:wt,parse:Tt,update:Et,remove:Dt,replaceUrl:Ot},At={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function jt(e){return e&&e in At?e:`eur`}function Mt(e){return e?At[e]??At.eur:At.eur}function Nt(e,t){let n=Mt(t),r=jt(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function Pt(e){return e?`${e}Amount`:`eurAmount`}let Ft={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 It({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);r.id=Ft.id,r.name=Ft.name,r.allow=Ft.allow,r.style.zIndex=Ft.style.zIndex.toString(),Lt({iframe:r,isVisible:!1});let i=t?.walletUrl??e??`https://wallet.frak.id`,a=u();return r.src=`${i}/listener?clientId=${encodeURIComponent(a)}`,new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function Lt({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 Rt(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 zt(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)}}async function Bt(e,t){try{await e.request({method:`frak_sendInteraction`,params:[t,{clientId:u()}]})}catch{console.warn(`[Frak SDK] Failed to send interaction:`,t.type)}}function Vt(e,t,n){let r=typeof window<`u`?window.location.href:void 0;return mt(t)?(zt(e,`user_referred_started`,{properties:{referrerClientId:t.c,walletStatus:n?.key}}),Bt(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referralTimestamp:t.t,landingUrl:r}),!0):pt(t)?(zt(e,`user_referred_started`,{properties:{referrer:t.r,walletStatus:n?.key}}),Bt(e,{type:`arrival`,referrerWallet:t.r,landingUrl:r}),!0):!1}function Ht(e){let t=u();return t?{v:2,c:t,m:e,t:Math.floor(Date.now()/1e3)}:null}function Ut(e,t){return mt(e)?u()===e.c:pt(e)&&t?.wallet?Ge(e.r,t.wallet):!1}function Wt(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;if(Ut(n,t))return`self-referral`;if(!Vt(e,n,t))return`no-referrer`;let i=mt(n)?n.m:r?.merchantId,a=r?.alwaysAppendUrl&&i?Ht(i):null;return kt.replaceUrl({url:window.location?.href,context:a}),zt(e,`user_referred_completed`,{properties:{status:`success`}}),`success`}async function Gt(e,{options:t}={}){let n=kt.parse({url:window.location.href}),r=await qt(e);try{return Wt(e,{walletStatus:r,frakContext:n,options:t})}catch(e){console.warn(`Error processing referral`,{error:e})}}async function Kt(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=u();if(!t&&!n){console.warn(`[Frak] No identity found, skipping purchase check`);return}let r=window.sessionStorage.getItem(`frak-merchant-id`),i=e.merchantId??r??await m();if(!i){console.warn(`[Frak] No merchant id found, skipping purchase check`);return}let a={Accept:`application/json`,"Content-Type":`application/json`};t&&(a[`x-wallet-sdk-auth`]=t),n&&(a[`x-frak-client-id`]=n);let o=s();await fetch(`${o}/user/track/purchase`,{method:`POST`,headers:a,body:JSON.stringify({customerId:e.customerId,orderId:e.orderId,token:e.token,merchantId:i})})}function qt(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(Jt(e,t),t));let n=new et,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{Jt(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function Jt(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),v(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function Yt(e,{metadata:t,login:n}){return Xt(e,{steps:{login:n??{}},metadata:t})}function Xt(e,t){function n(n){return Xt(e,{...t,steps:{...t.steps,sendTransaction:n}})}function i(n){return Xt(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function a(n,r){return Xt(e,{...t,steps:{...t.steps,final:{...r,action:{key:`sharing`,options:n}}}})}async function o(n){return n&&(t.metadata=n(t.metadata??{})),await r(e,t)}return{params:t,sendTx:n,reward:i,sharing:a,display:o}}async function Zt(e,{tx:t,metadata:n}){return(await r(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function Qt(){return Je(96)}async function $t(e,{siwe:t,metadata:n}){let i=e.config?.domain??window.location.host,a=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`;return(await r(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:a,nonce:t?.nonce??Qt(),uri:t?.uri??`https://${i}`,version:t?.version??`1`,domain:i}}}})).siweAuthenticate}Xe();function en(){throw Error(`setTimeout has not been defined`)}function tn(){throw Error(`clearTimeout has not been defined`)}var nn=en,rn=tn;typeof Ye.setTimeout==`function`&&(nn=setTimeout),typeof Ye.clearTimeout==`function`&&(rn=clearTimeout);function an(e){if(nn===setTimeout)return setTimeout(e,0);if((nn===en||!nn)&&setTimeout)return nn=setTimeout,setTimeout(e,0);try{return nn(e,0)}catch{try{return nn.call(null,e,0)}catch{return nn.call(this,e,0)}}}function on(e){if(rn===clearTimeout)return clearTimeout(e);if((rn===tn||!rn)&&clearTimeout)return rn=clearTimeout,clearTimeout(e);try{return rn(e)}catch{try{return rn.call(null,e)}catch{return rn.call(this,e)}}}var sn=[],cn=!1,ln,un=-1;function dn(){!cn||!ln||(cn=!1,ln.length?sn=ln.concat(sn):un=-1,sn.length&&fn())}function fn(){if(!cn){var e=an(dn);cn=!0;for(var t=sn.length;t;){for(ln=sn,sn=[];++un<t;)ln&&ln[un].run();un=-1,t=sn.length}ln=null,cn=!1,on(e)}}function pn(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];sn.push(new mn(e,t)),sn.length===1&&!cn&&an(fn)}function mn(e,t){this.fun=e,this.array=t}mn.prototype.run=function(){this.fun.apply(null,this.array)};var hn=`browser`,gn=`browser`,_n=!0,vn={},yn=[],bn=``,xn={},Sn={},Cn={};function wn(){}var Tn=wn,En=wn,Dn=wn,On=wn,kn=wn,An=wn,jn=wn;function Mn(e){throw Error(`process.binding is not supported`)}function Nn(){return`/`}function Pn(e){throw Error(`process.chdir is not supported`)}function Fn(){return 0}var In=Ye.performance||{},Ln=In.now||In.mozNow||In.msNow||In.oNow||In.webkitNow||function(){return new Date().getTime()};function Rn(e){var t=Ln.call(In)*.001,n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],r-=e[1],r<0&&(n--,r+=1e9)),[n,r]}var zn=new Date;function Bn(){return(new Date-zn)/1e3}var Vn={nextTick:pn,title:hn,browser:_n,env:vn,argv:yn,version:bn,versions:xn,on:Tn,addListener:En,once:Dn,off:On,removeListener:kn,removeAllListeners:An,emit:jn,binding:Mn,cwd:Nn,chdir:Pn,umask:Fn,hrtime:Rn,platform:gn,release:Sn,config:Cn,uptime:Bn};Xe();var E=[],D=[],Hn=typeof Uint8Array<`u`?Uint8Array:Array,Un=!1;function Wn(){Un=!0;for(var e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,t=0,n=e.length;t<n;++t)E[t]=e[t],D[e.charCodeAt(t)]=t;D[45]=62,D[95]=63}function Gn(e){Un||Wn();var t,n,r,i,a,o,s=e.length;if(s%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);a=e[s-2]===`=`?2:e[s-1]===`=`?1:0,o=new Hn(s*3/4-a),r=a>0?s-4:s;var c=0;for(t=0,n=0;t<r;t+=4,n+=3)i=D[e.charCodeAt(t)]<<18|D[e.charCodeAt(t+1)]<<12|D[e.charCodeAt(t+2)]<<6|D[e.charCodeAt(t+3)],o[c++]=i>>16&255,o[c++]=i>>8&255,o[c++]=i&255;return a===2?(i=D[e.charCodeAt(t)]<<2|D[e.charCodeAt(t+1)]>>4,o[c++]=i&255):a===1&&(i=D[e.charCodeAt(t)]<<10|D[e.charCodeAt(t+1)]<<4|D[e.charCodeAt(t+2)]>>2,o[c++]=i>>8&255,o[c++]=i&255),o}function Kn(e){return E[e>>18&63]+E[e>>12&63]+E[e>>6&63]+E[e&63]}function qn(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],i.push(Kn(r));return i.join(``)}function Jn(e){Un||Wn();for(var t,n=e.length,r=n%3,i=``,a=[],o=16383,s=0,c=n-r;s<c;s+=o)a.push(qn(e,s,s+o>c?c:s+o));return r===1?(t=e[n-1],i+=E[t>>2],i+=E[t<<4&63],i+=`==`):r===2&&(t=(e[n-2]<<8)+e[n-1],i+=E[t>>10],i+=E[t>>4&63],i+=E[t<<2&63],i+=`=`),a.push(i),a.join(``)}function Yn(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)}function Xn(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}var Zn={}.toString,Qn=Array.isArray||function(e){return Zn.call(e)==`[object Array]`},$n=50;O.TYPED_ARRAY_SUPPORT=Ye.TYPED_ARRAY_SUPPORT===void 0?!0:Ye.TYPED_ARRAY_SUPPORT,er();function er(){return O.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function tr(e,t){if(er()<t)throw RangeError(`Invalid typed array length`);return O.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=O.prototype):(e===null&&(e=new O(t)),e.length=t),e}function O(e,t,n){if(!O.TYPED_ARRAY_SUPPORT&&!(this instanceof O))return new O(e,t,n);if(typeof e==`number`){if(typeof t==`string`)throw Error(`If encoding is specified then the first argument must be a string`);return ar(this,e)}return nr(this,e,t,n)}O.poolSize=8192,O._augment=function(e){return e.__proto__=O.prototype,e};function nr(e,t,n,r){if(typeof t==`number`)throw TypeError(`"value" argument must not be a number`);return typeof ArrayBuffer<`u`&&t instanceof ArrayBuffer?cr(e,t,n,r):typeof t==`string`?or(e,t,n):lr(e,t)}O.from=function(e,t,n){return nr(null,e,t,n)},O.TYPED_ARRAY_SUPPORT&&(O.prototype.__proto__=Uint8Array.prototype,O.__proto__=Uint8Array,typeof Symbol<`u`&&Symbol.species&&O[Symbol.species]);function rr(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be a number`);if(e<0)throw RangeError(`"size" argument must not be negative`)}function ir(e,t,n,r){return rr(t),t<=0||n===void 0?tr(e,t):typeof r==`string`?tr(e,t).fill(n,r):tr(e,t).fill(n)}O.alloc=function(e,t,n){return ir(null,e,t,n)};function ar(e,t){if(rr(t),e=tr(e,t<0?0:ur(t)|0),!O.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}O.allocUnsafe=function(e){return ar(null,e)},O.allocUnsafeSlow=function(e){return ar(null,e)};function or(e,t,n){if((typeof n!=`string`||n===``)&&(n=`utf8`),!O.isEncoding(n))throw TypeError(`"encoding" must be a valid string encoding`);var r=dr(t,n)|0;e=tr(e,r);var i=e.write(t,n);return i!==r&&(e=e.slice(0,i)),e}function sr(e,t){var n=t.length<0?0:ur(t.length)|0;e=tr(e,n);for(var r=0;r<n;r+=1)e[r]=t[r]&255;return e}function cr(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw RangeError(`'offset' is out of bounds`);if(t.byteLength<n+(r||0))throw RangeError(`'length' is out of bounds`);return t=n===void 0&&r===void 0?new Uint8Array(t):r===void 0?new Uint8Array(t,n):new Uint8Array(t,n,r),O.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=O.prototype):e=sr(e,t),e}function lr(e,t){if(k(t)){var n=ur(t.length)|0;return e=tr(e,n),e.length===0||t.copy(e,0,0,n),e}if(t){if(typeof ArrayBuffer<`u`&&t.buffer instanceof ArrayBuffer||`length`in t)return typeof t.length!=`number`||Wr(t.length)?tr(e,0):sr(e,t);if(t.type===`Buffer`&&Qn(t.data))return sr(e,t.data)}throw TypeError(`First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.`)}function ur(e){if(e>=er())throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+er().toString(16)+` bytes`);return e|0}O.isBuffer=Gr;function k(e){return!!(e!=null&&e._isBuffer)}O.compare=function(e,t){if(!k(e)||!k(t))throw TypeError(`Arguments must be Buffers`);if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},O.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},O.concat=function(e,t){if(!Qn(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return O.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=O.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(!k(a))throw TypeError(`"list" argument must be an Array of Buffers`);a.copy(r,i),i+=a.length}return r};function dr(e,t){if(k(e))return e.length;if(typeof ArrayBuffer<`u`&&typeof ArrayBuffer.isView==`function`&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;typeof e!=`string`&&(e=``+e);var n=e.length;if(n===0)return 0;for(var r=!1;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:case void 0:return zr(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return Hr(e).length;default:if(r)return zr(e).length;t=(``+t).toLowerCase(),r=!0}}O.byteLength=dr;function fr(e,t,n){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return Or(this,t,n);case`utf8`:case`utf-8`:return Cr(this,t,n);case`ascii`:return Er(this,t,n);case`latin1`:case`binary`:return Dr(this,t,n);case`base64`:return Sr(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return kr(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}O.prototype._isBuffer=!0;function pr(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}O.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(var t=0;t<e;t+=2)pr(this,t,t+1);return this},O.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(var t=0;t<e;t+=4)pr(this,t,t+3),pr(this,t+1,t+2);return this},O.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(var t=0;t<e;t+=8)pr(this,t,t+7),pr(this,t+1,t+6),pr(this,t+2,t+5),pr(this,t+3,t+4);return this},O.prototype.toString=function(){var e=this.length|0;return e===0?``:arguments.length===0?Cr(this,0,e):fr.apply(this,arguments)},O.prototype.equals=function(e){if(!k(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:O.compare(this,e)===0},O.prototype.inspect=function(){var e=``,t=$n;return this.length>0&&(e=this.toString(`hex`,0,t).match(/.{2}/g).join(` `),this.length>t&&(e+=` ... `)),`<Buffer `+e+`>`},O.prototype.compare=function(e,t,n,r,i){if(!k(e))throw TypeError(`Argument must be a Buffer`);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var a=i-r,o=n-t,s=Math.min(a,o),c=this.slice(r,i),l=e.slice(t,n),u=0;u<s;++u)if(c[u]!==l[u]){a=c[u],o=l[u];break}return a<o?-1:o<a?1:0};function mr(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=O.from(t,r)),k(t))return t.length===0?-1:hr(e,t,n,r,i);if(typeof t==`number`)return t&=255,O.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):hr(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function hr(e,t,n,r,i){var a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}var l;if(i){var u=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,u===-1?0:l-u)){if(u===-1&&(u=l),l-u+1===s)return u*a}else u!==-1&&(l-=l-u),u=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){for(var d=!0,f=0;f<s;f++)if(c(e,l+f)!==c(t,f)){d=!1;break}if(d)return l}return-1}O.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},O.prototype.indexOf=function(e,t,n){return mr(this,e,t,n,!0)},O.prototype.lastIndexOf=function(e,t,n){return mr(this,e,t,n,!1)};function gr(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var a=t.length;if(a%2!=0)throw TypeError(`Invalid hex string`);r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s=parseInt(t.substr(o*2,2),16);if(isNaN(s))return o;e[n+o]=s}return o}function _r(e,t,n,r){return Ur(zr(t,e.length-n),e,n,r)}function vr(e,t,n,r){return Ur(Br(t),e,n,r)}function yr(e,t,n,r){return vr(e,t,n,r)}function br(e,t,n,r){return Ur(Hr(t),e,n,r)}function xr(e,t,n,r){return Ur(Vr(t,e.length-n),e,n,r)}O.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t|=0,isFinite(n)?(n|=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);var i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;for(var a=!1;;)switch(r){case`hex`:return gr(this,e,t,n);case`utf8`:case`utf-8`:return _r(this,e,t,n);case`ascii`:return vr(this,e,t,n);case`latin1`:case`binary`:return yr(this,e,t,n);case`base64`:return br(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return xr(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},O.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function Sr(e,t,n){return t===0&&n===e.length?Jn(e):Jn(e.slice(t,n))}function Cr(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var a=e[i],o=null,s=a>239?4:a>223?3:a>191?2:1;if(i+s<=n){var c,l,u,d;switch(s){case 1:a<128&&(o=a);break;case 2:c=e[i+1],(c&192)==128&&(d=(a&31)<<6|c&63,d>127&&(o=d));break;case 3:c=e[i+1],l=e[i+2],(c&192)==128&&(l&192)==128&&(d=(a&15)<<12|(c&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:c=e[i+1],l=e[i+2],u=e[i+3],(c&192)==128&&(l&192)==128&&(u&192)==128&&(d=(a&15)<<18|(c&63)<<12|(l&63)<<6|u&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),i+=s}return Tr(r)}var wr=4096;function Tr(e){var t=e.length;if(t<=wr)return String.fromCharCode.apply(String,e);for(var n=``,r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=wr));return n}function Er(e,t,n){var r=``;n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function Dr(e,t,n){var r=``;n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function Or(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i=``,a=t;a<n;++a)i+=Rr(e[a]);return i}function kr(e,t,n){for(var r=e.slice(t,n),i=``,a=0;a<r.length;a+=2)i+=String.fromCharCode(r[a]+r[a+1]*256);return i}O.prototype.slice=function(e,t){var n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);var r;if(O.TYPED_ARRAY_SUPPORT)r=this.subarray(e,t),r.__proto__=O.prototype;else{var i=t-e;r=new O(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r};function A(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}O.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||A(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},O.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||A(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},O.prototype.readUInt8=function(e,t){return t||A(e,1,this.length),this[e]},O.prototype.readUInt16LE=function(e,t){return t||A(e,2,this.length),this[e]|this[e+1]<<8},O.prototype.readUInt16BE=function(e,t){return t||A(e,2,this.length),this[e]<<8|this[e+1]},O.prototype.readUInt32LE=function(e,t){return t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},O.prototype.readUInt32BE=function(e,t){return t||A(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},O.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||A(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},O.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||A(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},O.prototype.readInt8=function(e,t){return t||A(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},O.prototype.readInt16LE=function(e,t){t||A(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},O.prototype.readInt16BE=function(e,t){t||A(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},O.prototype.readInt32LE=function(e,t){return t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},O.prototype.readInt32BE=function(e,t){return t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},O.prototype.readFloatLE=function(e,t){return t||A(e,4,this.length),Yn(this,e,!0,23,4)},O.prototype.readFloatBE=function(e,t){return t||A(e,4,this.length),Yn(this,e,!1,23,4)},O.prototype.readDoubleLE=function(e,t){return t||A(e,8,this.length),Yn(this,e,!0,52,8)},O.prototype.readDoubleBE=function(e,t){return t||A(e,8,this.length),Yn(this,e,!1,52,8)};function j(e,t,n,r,i,a){if(!k(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}O.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var i=2**(8*n)-1;j(this,e,t,n,i,0)}var a=1,o=0;for(this[t]=e&255;++o<n&&(a*=256);)this[t+o]=e/a&255;return t+n},O.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var i=2**(8*n)-1;j(this,e,t,n,i,0)}var a=n-1,o=1;for(this[t+a]=e&255;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+n},O.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,1,255,0),O.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e&255,t+1};function Ar(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-n,2);i<a;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}O.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,65535,0),O.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):Ar(this,e,t,!0),t+2},O.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,65535,0),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):Ar(this,e,t,!1),t+2};function jr(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-n,4);i<a;++i)e[n+i]=t>>>(r?i:3-i)*8&255}O.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,4294967295,0),O.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255):jr(this,e,t,!0),t+4},O.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,4294967295,0),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):jr(this,e,t,!1),t+4},O.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=2**(8*n-1);j(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=e&255;++a<n&&(o*=256);)e<0&&s===0&&this[t+a-1]!==0&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},O.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=2**(8*n-1);j(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=e&255;--a>=0&&(o*=256);)e<0&&s===0&&this[t+a+1]!==0&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},O.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,1,127,-128),O.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=e&255,t+1},O.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,32767,-32768),O.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):Ar(this,e,t,!0),t+2},O.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,2,32767,-32768),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):Ar(this,e,t,!1),t+2},O.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,2147483647,-2147483648),O.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):jr(this,e,t,!0),t+4},O.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),O.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):jr(this,e,t,!1),t+4};function Mr(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function Nr(e,t,n,r,i){return i||Mr(e,t,n,4),Xn(e,t,n,r,23,4),n+4}O.prototype.writeFloatLE=function(e,t,n){return Nr(this,e,t,!0,n)},O.prototype.writeFloatBE=function(e,t,n){return Nr(this,e,t,!1,n)};function Pr(e,t,n,r,i){return i||Mr(e,t,n,8),Xn(e,t,n,r,52,8),n+8}O.prototype.writeDoubleLE=function(e,t,n){return Pr(this,e,t,!0,n)},O.prototype.writeDoubleBE=function(e,t,n){return Pr(this,e,t,!1,n)},O.prototype.copy=function(e,t,n,r){if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`sourceStart out of bounds`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n,a;if(this===e&&n<t&&t<r)for(a=i-1;a>=0;--a)e[a+t]=this[a+n];else if(i<1e3||!O.TYPED_ARRAY_SUPPORT)for(a=0;a<i;++a)e[a+t]=this[a+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+i),t);return i},O.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),e.length===1){var i=e.charCodeAt(0);i<256&&(e=i)}if(r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!O.isEncoding(r))throw TypeError(`Unknown encoding: `+r)}else typeof e==`number`&&(e&=255);if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;var a;if(typeof e==`number`)for(a=t;a<n;++a)this[a]=e;else{var o=k(e)?e:zr(new O(e,r).toString()),s=o.length;for(a=0;a<n-t;++a)this[a+t]=o[a%s]}return this};var Fr=/[^+\/0-9A-Za-z-_]/g;function Ir(e){if(e=Lr(e).replace(Fr,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function Lr(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,``)}function Rr(e){return e<16?`0`+e.toString(16):e.toString(16)}function zr(e,t){t||=1/0;for(var n,r=e.length,i=null,a=[],o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function Br(e){for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function Vr(e,t){for(var n,r,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function Hr(e){return Gn(Ir(e))}function Ur(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Wr(e){return e!==e}function Gr(e){return e!=null&&(!!e._isBuffer||Kr(e)||qr(e))}function Kr(e){return!!e.constructor&&typeof e.constructor.isBuffer==`function`&&e.constructor.isBuffer(e)}function qr(e){return typeof e.readFloatLE==`function`&&typeof e.slice==`function`&&Kr(e.slice(0,0))}var Jr=Object.defineProperty,Yr=(e,t,n)=>t in e?Jr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M=(e,t,n)=>Yr(e,typeof t==`symbol`?t:t+``,n),Xr=Object.defineProperty,Zr=(e,t,n)=>t in e?Xr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qr=(e,t,n)=>Zr(e,typeof t==`symbol`?t:t+``,n),N=(e=>(e[e.Document=0]=`Document`,e[e.DocumentType=1]=`DocumentType`,e[e.Element=2]=`Element`,e[e.Text=3]=`Text`,e[e.CDATA=4]=`CDATA`,e[e.Comment=5]=`Comment`,e))(N||{});let $r={Node:[`childNodes`,`parentNode`,`parentElement`,`textContent`,`ownerDocument`],ShadowRoot:[`host`,`styleSheets`],Element:[`shadowRoot`,`querySelector`,`querySelectorAll`],MutationObserver:[]},ei={Node:[`contains`,`getRootNode`],ShadowRoot:[`getSelection`],Element:[],MutationObserver:[`constructor`]},ti={},ni=()=>!!globalThis.Zone;function ri(e){if(ti[e])return ti[e];let t=globalThis[e],n=t.prototype,r=e in $r?$r[e]:void 0,i=!!(r&&r.every(e=>!!(Object.getOwnPropertyDescriptor(n,e)?.get)?.toString().includes(`[native code]`))),a=e in ei?ei[e]:void 0,o=!!(a&&a.every(e=>typeof n[e]==`function`&&n[e]?.toString().includes(`[native code]`)));if(i&&o&&!ni())return ti[e]=t.prototype,t.prototype;try{let r=document.createElement(`iframe`);document.body.appendChild(r);let i=r.contentWindow;if(!i)return t.prototype;let a=i[e].prototype;return document.body.removeChild(r),a?ti[e]=a:n}catch{return n}}let ii={};function ai(e,t,n){let r=`${e}.${String(n)}`;if(ii[r])return ii[r].call(t);let i=ri(e),a=Object.getOwnPropertyDescriptor(i,n)?.get;return a?(ii[r]=a,a.call(t)):t[n]}let oi={};function si(e,t,n){let r=`${e}.${String(n)}`;if(oi[r])return oi[r].bind(t);let i=ri(e)[n];return typeof i==`function`?(oi[r]=i,i.bind(t)):t[n]}function ci(e){return ai(`Node`,e,`ownerDocument`)}function li(e){return ai(`Node`,e,`childNodes`)}function ui(e){return ai(`Node`,e,`parentNode`)}function di(e){return ai(`Node`,e,`parentElement`)}function fi(e){return ai(`Node`,e,`textContent`)}function pi(e,t){return si(`Node`,e,`contains`)(t)}function mi(e){return si(`Node`,e,`getRootNode`)()}function hi(e){return!e||!(`host`in e)?null:ai(`ShadowRoot`,e,`host`)}function gi(e){return e.styleSheets}function _i(e){return!e||!(`shadowRoot`in e)?null:ai(`Element`,e,`shadowRoot`)}function vi(e,t){return ai(`Element`,e,`querySelector`)(t)}function yi(e,t){return ai(`Element`,e,`querySelectorAll`)(t)}function bi(){return ri(`MutationObserver`).constructor}function xi(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],i=n(r);return typeof i==`function`&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}let P={ownerDocument:ci,childNodes:li,parentNode:ui,parentElement:di,textContent:fi,contains:pi,getRootNode:mi,host:hi,styleSheets:gi,shadowRoot:_i,querySelector:vi,querySelectorAll:yi,mutationObserver:bi,patch:xi};function Si(e){return e.nodeType===e.ELEMENT_NODE}function Ci(e){let t=e&&`host`in e&&`mode`in e&&P.host(e)||null;return!!(t&&`shadowRoot`in t&&P.shadowRoot(t)===e)}function wi(e){return Object.prototype.toString.call(e)===`[object ShadowRoot]`}function Ti(e){return e.includes(` background-clip: text;`)&&!e.includes(` -webkit-background-clip: text;`)&&(e=e.replace(/\sbackground-clip:\s*text;/g,` -webkit-background-clip: text; background-clip: text;`)),e}function Ei(e){let{cssText:t}=e;if(t.split(`"`).length<3)return t;let n=[`@import`,`url(${JSON.stringify(e.href)})`];return e.layerName===``?n.push(`layer`):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(` `)+`;`}function Di(e){try{let t=e.rules||e.cssRules;if(!t)return null;let n=e.href;return!n&&e.ownerNode&&(n=e.ownerNode.baseURI),Ti(Array.from(t,e=>Oi(e,n)).join(``))}catch{return null}}function Oi(e,t){if(Ai(e)){let t;try{t=Di(e.styleSheet)||Ei(e)}catch{t=e.cssText}return e.styleSheet.href?Gi(t,e.styleSheet.href):t}else{let n=e.cssText;return ji(e)&&e.selectorText.includes(`:`)&&(n=ki(n)),t?Gi(n,t):n}}function ki(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,`$1\\$2`)}function Ai(e){return`styleSheet`in e}function ji(e){return`selectorText`in e}var Mi=class{constructor(){Qr(this,`idNodeMap`,new Map),Qr(this,`nodeMetaMap`,new WeakMap)}getId(e){return e?this.getMeta(e)?.id??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){let t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){let n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){let n=this.getNode(e);if(n){let e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Ni(){return new Mi}function Pi({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:a}){let o=i||``,s=r&&Fi(r);return(t[n.toLowerCase()]||s&&t[s])&&(o=a?a(o,e):`*`.repeat(o.length)),o}function Fi(e){return e.toLowerCase()}let Ii=`__rrweb_original__`;function Li(e){let t=e.getContext(`2d`);if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let r=0;r<e.height;r+=50){let i=t.getImageData,a=Ii in i?i[Ii]:i;if(new Uint32Array(a.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some(e=>e!==0))return!1}return!0}function Ri(e){let t=e.type;return e.hasAttribute(`data-rr-is-password`)?`password`:t?Fi(t):null}function zi(e,t){let n;try{n=new URL(e,t??window.location.href)}catch{return null}return n.pathname.match(/\.([0-9a-z]+)(?:$)/i)?.[1]??null}function Bi(e){let t=``;return t=e.indexOf(`//`)>-1?e.split(`/`).slice(0,3).join(`/`):e.split(`/`)[0],t=t.split(`?`)[0],t}let Vi=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Hi=/^(?:[a-z+]+:)?\/\//i,Ui=/^www\..*/i,Wi=/^(data:)([^,]*),(.*)/i;function Gi(e,t){return(e||``).replace(Vi,(e,n,r,i,a,o)=>{let s=r||a||o,c=n||i||``;if(!s)return e;if(Hi.test(s)||Ui.test(s)||Wi.test(s))return`url(${c}${s}${c})`;if(s[0]===`/`)return`url(${c}${Bi(t)+s}${c})`;let l=t.split(`/`),u=s.split(`/`);l.pop();for(let e of u)if(e===`.`)continue;else e===`..`?l.pop():l.push(e);return`url(${c}${l.join(`/`)}${c})`})}function Ki(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,``):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,``).replace(/0px/g,`0`)}function qi(e,t,n=!1){let r=Array.from(t.childNodes),i=[],a=0;if(r.length>1&&e&&typeof e==`string`){let t=Ki(e,n),o=t.length/e.length;for(let s=1;s<r.length;s++)if(r[s].textContent&&typeof r[s].textContent==`string`){let c=Ki(r[s].textContent,n),l=3;for(;l<c.length&&(c[l].match(/[a-zA-Z0-9]/)||c.indexOf(c.substring(0,l),1)!==-1);l++);for(;l<c.length;l++){let u=c.substring(0,l),d=t.split(u),f=-1;if(d.length===2)f=d[0].length;else if(d.length>2&&d[0]===``&&r[s-1].textContent!==``)f=t.indexOf(u,1);else if(d.length===1){if(u=u.substring(0,u.length-1),d=t.split(u),d.length<=1)return i.push(e),i;l=101}else l===c.length-1&&(f=t.indexOf(u));if(d.length>=2&&l>100){let e=r[s-1].textContent;if(e&&typeof e==`string`){let n=Ki(e).length;f=t.indexOf(u,n)}f===-1&&(f=d[0].length)}if(f!==-1){let s=Math.floor(f/o);for(;s>0&&s<e.length;){if(a+=1,a>50*r.length)return i.push(e),i;let c=Ki(e.substring(0,s),n);if(c.length===f){i.push(e.substring(0,s)),e=e.substring(s),t=t.substring(f);break}else c.length<f?s+=Math.max(1,Math.floor((f-c.length)/o)):s-=Math.max(1,Math.floor((c.length-f)*o))}break}}}}return i.push(e),i}function Ji(e,t){return qi(e,t).join(`/* rr_split */`)}let Yi=1,Xi=RegExp(`[^a-z0-9-_:]`);function Zi(){return Yi++}function Qi(e){if(e instanceof HTMLFormElement)return`form`;let t=Fi(e.tagName);return Xi.test(t)?`div`:t}let $i,ea,ta=/^[^ \t\n\r\u000c]+/,na=/^[, \t\n\r\u000c]+/;function ra(e,t){if(t.trim()===``)return t;let n=0;function r(e){let r,i=e.exec(t.substring(n));return i?(r=i[0],n+=r.length,r):``}let i=[];for(;r(na),!(n>=t.length);){let a=r(ta);if(a.slice(-1)===`,`)a=aa(e,a.substring(0,a.length-1)),i.push(a);else{let r=``;a=aa(e,a);let o=!1;for(;;){let e=t.charAt(n);if(e===``){i.push((a+r).trim());break}else if(o)e===`)`&&(o=!1);else if(e===`,`){n+=1,i.push((a+r).trim());break}else e===`(`&&(o=!0);r+=e,n+=1}}}return i.join(`, `)}let ia=new WeakMap;function aa(e,t){return!t||t.trim()===``?t:sa(e,t)}function oa(e){return!!(e.tagName===`svg`||e.ownerSVGElement)}function sa(e,t){let n=ia.get(e);if(n||(n=e.createElement(`a`),ia.set(e,n)),!t)t=``;else if(t.startsWith(`blob:`)||t.startsWith(`data:`))return t;return n.setAttribute(`href`,t),n.href}function ca(e,t,n,r){return r&&(n===`src`||n===`href`&&!(t===`use`&&r[0]===`#`)||n===`xlink:href`&&r[0]!==`#`||n===`background`&&[`table`,`td`,`th`].includes(t)?aa(e,r):n===`srcset`?ra(e,r):n===`style`?Gi(r,sa(e)):t===`object`&&n===`data`?aa(e,r):r)}function la(e,t,n){return[`video`,`audio`].includes(e)&&t===`autoplay`}function ua(e,t,n){try{if(typeof t==`string`){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch{}return!1}function da(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?da(P.parentNode(e),t,n):!1;for(let n=e.classList.length;n--;){let r=e.classList[n];if(t.test(r))return!0}return n?da(P.parentNode(e),t,n):!1}function fa(e,t,n,r){let i;if(Si(e)){if(i=e,!P.childNodes(i).length)return!1}else if(P.parentElement(e)===null)return!1;else i=P.parentElement(e);try{if(typeof t==`string`){if(r){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(da(i,t,r))return!0;if(n){if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}}catch{}return!1}function pa(e,t,n){let r=e.contentWindow;if(!r)return;let i=!1,a;try{a=r.document.readyState}catch{return}if(a!==`complete`){let r=setTimeout(()=>{i||=(t(),!0)},n);e.addEventListener(`load`,()=>{clearTimeout(r),i=!0,t()});return}let o=`about:blank`;if(r.location.href!==o||e.src===o||e.src===``)return setTimeout(t,0),e.addEventListener(`load`,t);e.addEventListener(`load`,t)}function ma(e,t,n){let r=!1,i;try{i=e.sheet}catch{return}if(i)return;let a=setTimeout(()=>{r||=(t(),!0)},n);e.addEventListener(`load`,()=>{clearTimeout(a),r=!0,t()})}function ha(e,t){let{doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:o,inlineStylesheet:s,maskInputOptions:c={},maskTextFn:l,maskInputFn:u,dataURLOptions:d={},inlineImages:f,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:h=!1,cssCaptured:g=!1}=t,_=ga(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode===`CSS1Compat`?{type:N.Document,childNodes:[]}:{type:N.Document,childNodes:[],compatMode:e.compatMode};case e.DOCUMENT_TYPE_NODE:return{type:N.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:_};case e.ELEMENT_NODE:return va(e,{doc:n,blockClass:i,blockSelector:a,inlineStylesheet:s,maskInputOptions:c,maskInputFn:u,dataURLOptions:d,inlineImages:f,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:h,rootId:_});case e.TEXT_NODE:return _a(e,{doc:n,needsMask:o,maskTextFn:l,rootId:_,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:N.CDATA,textContent:``,rootId:_};case e.COMMENT_NODE:return{type:N.Comment,textContent:P.textContent(e)||``,rootId:_};default:return!1}}function ga(e,t){if(!t.hasNode(e))return;let n=t.getId(e);return n===1?void 0:n}function _a(e,t){let{needsMask:n,maskTextFn:r,rootId:i,cssCaptured:a}=t,o=P.parentNode(e),s=o&&o.tagName,c=``,l=s===`STYLE`?!0:void 0,u=s===`SCRIPT`?!0:void 0;return u?c=`SCRIPT_PLACEHOLDER`:a||(c=P.textContent(e),l&&c&&(c=Gi(c,sa(t.doc)))),!l&&!u&&c&&n&&(c=r?r(c,P.parentElement(e)):c.replace(/[\S]/g,`*`)),{type:N.Text,textContent:c||``,rootId:i}}function va(e,t){let{doc:n,blockClass:r,blockSelector:i,inlineStylesheet:a,maskInputOptions:o={},maskInputFn:s,dataURLOptions:c={},inlineImages:l,recordCanvas:u,keepIframeSrcFn:d,newlyAddedElement:f=!1,rootId:p}=t,m=ua(e,r,i),h=Qi(e),g={},_=e.attributes.length;for(let t=0;t<_;t++){let r=e.attributes[t];la(h,r.name,r.value)||(g[r.name]=ca(n,h,Fi(r.name),r.value))}if(h===`link`&&a){let t=Array.from(n.styleSheets).find(t=>t.href===e.href),r=null;t&&(r=Di(t)),r&&(delete g.rel,delete g.href,g._cssText=r)}if(h===`style`&&e.sheet){let t=Di(e.sheet);t&&(e.childNodes.length>1&&(t=Ji(t,e)),g._cssText=t)}if([`input`,`textarea`,`select`].includes(h)){let t=e.value,n=e.checked;g.type!==`radio`&&g.type!==`checkbox`&&g.type!==`submit`&&g.type!==`button`&&t?g.value=Pi({element:e,type:Ri(e),tagName:h,value:t,maskInputOptions:o,maskInputFn:s}):n&&(g.checked=n)}if(h===`option`&&(e.selected&&!o.select?g.selected=!0:delete g.selected),h===`dialog`&&e.open&&(g.rr_open_mode=e.matches(`dialog:modal`)?`modal`:`non-modal`),h===`canvas`&&u){if(e.__context===`2d`)Li(e)||(g.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!(`__context`in e)){let t=e.toDataURL(c.type,c.quality),r=n.createElement(`canvas`);r.width=e.width,r.height=e.height,t!==r.toDataURL(c.type,c.quality)&&(g.rr_dataURL=t)}}if(h===`img`&&l){$i||($i=n.createElement(`canvas`),ea=$i.getContext(`2d`));let t=e,r=t.currentSrc||t.getAttribute(`src`)||`<unknown-src>`,i=t.crossOrigin,a=()=>{t.removeEventListener(`load`,a);try{$i.width=t.naturalWidth,$i.height=t.naturalHeight,ea.drawImage(t,0,0),g.rr_dataURL=$i.toDataURL(c.type,c.quality)}catch(e){if(t.crossOrigin!==`anonymous`){t.crossOrigin=`anonymous`,t.complete&&t.naturalWidth!==0?a():t.addEventListener(`load`,a);return}else console.warn(`Cannot inline img src=${r}! Error: ${e}`)}t.crossOrigin===`anonymous`&&(i?g.crossOrigin=i:t.removeAttribute(`crossorigin`))};t.complete&&t.naturalWidth!==0?a():t.addEventListener(`load`,a)}if([`audio`,`video`].includes(h)){let t=g;t.rr_mediaState=e.paused?`paused`:`played`,t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}if(f||(e.scrollLeft&&(g.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(g.rr_scrollTop=e.scrollTop)),m){let{width:t,height:n}=e.getBoundingClientRect();g={class:g.class,rr_width:`${t}px`,rr_height:`${n}px`}}h===`iframe`&&!d(g.src)&&(e.contentDocument||(g.rr_src=g.src),delete g.src);let v;try{customElements.get(h)&&(v=!0)}catch{}return{type:N.Element,tagName:h,attributes:g,childNodes:[],isSVG:oa(e)||void 0,needBlock:m,rootId:p,isCustom:v}}function F(e){return e==null?``:e.toLowerCase()}function ya(e){return e===!0||e===`all`?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e===`all`,headMetaDescKeywords:e===`all`,headTitleMutations:e===`all`}:e||{}}function ba(e,t){return!!(t.comment&&e.type===N.Comment||e.type===N.Element&&(t.script&&(e.tagName===`script`||e.tagName===`link`&&(e.attributes.rel===`preload`&&e.attributes.as===`script`||e.attributes.rel===`modulepreload`)||e.tagName===`link`&&e.attributes.rel===`prefetch`&&typeof e.attributes.href==`string`&&zi(e.attributes.href)===`js`)||t.headFavicon&&(e.tagName===`link`&&e.attributes.rel===`shortcut icon`||e.tagName===`meta`&&(F(e.attributes.name).match(/^msapplication-tile(image|color)$/)||F(e.attributes.name)===`application-name`||F(e.attributes.rel)===`icon`||F(e.attributes.rel)===`apple-touch-icon`||F(e.attributes.rel)===`shortcut icon`))||e.tagName===`meta`&&(t.headMetaDescKeywords&&F(e.attributes.name).match(/^description|keywords$/)||t.headMetaSocial&&(F(e.attributes.property).match(/^(og|twitter|fb):/)||F(e.attributes.name).match(/^(og|twitter):/)||F(e.attributes.name)===`pinterest`)||t.headMetaRobots&&(F(e.attributes.name)===`robots`||F(e.attributes.name)===`googlebot`||F(e.attributes.name)===`bingbot`)||t.headMetaHttpEquiv&&e.attributes[`http-equiv`]!==void 0||t.headMetaAuthorship&&(F(e.attributes.name)===`author`||F(e.attributes.name)===`generator`||F(e.attributes.name)===`framework`||F(e.attributes.name)===`publisher`||F(e.attributes.name)===`progid`||F(e.attributes.property).match(/^article:/)||F(e.attributes.property).match(/^product:/))||t.headMetaVerification&&(F(e.attributes.name)===`google-site-verification`||F(e.attributes.name)===`yandex-verification`||F(e.attributes.name)===`csrf-token`||F(e.attributes.name)===`p:domain_verify`||F(e.attributes.name)===`verify-v1`||F(e.attributes.name)===`verification`||F(e.attributes.name)===`shopify-checkout-api-token`))))}function xa(e,t){let{doc:n,mirror:r,blockClass:i,blockSelector:a,maskTextClass:o,maskTextSelector:s,skipChild:c=!1,inlineStylesheet:l=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:f,slimDOMOptions:p,dataURLOptions:m={},inlineImages:h=!1,recordCanvas:g=!1,onSerialize:_,onIframeLoad:v,iframeLoadTimeout:y=5e3,onStylesheetLoad:b,stylesheetLoadTimeout:ee=5e3,keepIframeSrcFn:x=()=>!1,newlyAddedElement:te=!1,cssCaptured:ne=!1}=t,{needsMask:re}=t,{preserveWhiteSpace:ie=!0}=t;re||=fa(e,o,s,re===void 0);let S=ha(e,{doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:re,inlineStylesheet:l,maskInputOptions:u,maskTextFn:d,maskInputFn:f,dataURLOptions:m,inlineImages:h,recordCanvas:g,keepIframeSrcFn:x,newlyAddedElement:te,cssCaptured:ne});if(!S)return console.warn(e,`not serialized`),null;let C;C=r.hasNode(e)?r.getId(e):ba(S,p)||!ie&&S.type===N.Text&&!S.textContent.replace(/^\s+|\s+$/gm,``).length?-2:Zi();let w=Object.assign(S,{id:C});if(r.add(e,w),C===-2)return null;_&&_(e);let ae=!c;if(w.type===N.Element){ae&&=!w.needBlock,delete w.needBlock;let t=P.shadowRoot(e);t&&wi(t)&&(w.isShadowHost=!0)}if((w.type===N.Document||w.type===N.Element)&&ae){p.headWhitespace&&w.type===N.Element&&w.tagName===`head`&&(ie=!1);let t={doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:re,maskTextClass:o,maskTextSelector:s,skipChild:c,inlineStylesheet:l,maskInputOptions:u,maskTextFn:d,maskInputFn:f,slimDOMOptions:p,dataURLOptions:m,inlineImages:h,recordCanvas:g,preserveWhiteSpace:ie,onSerialize:_,onIframeLoad:v,iframeLoadTimeout:y,onStylesheetLoad:b,stylesheetLoadTimeout:ee,keepIframeSrcFn:x,cssCaptured:!1};if(!(w.type===N.Element&&w.tagName===`textarea`&&w.attributes.value!==void 0)){w.type===N.Element&&w.attributes._cssText!==void 0&&typeof w.attributes._cssText==`string`&&(t.cssCaptured=!0);for(let n of Array.from(P.childNodes(e))){let e=xa(n,t);e&&w.childNodes.push(e)}}let te=null;if(Si(e)&&(te=P.shadowRoot(e)))for(let e of Array.from(P.childNodes(te))){let n=xa(e,t);n&&(wi(te)&&(n.isShadow=!0),w.childNodes.push(n))}}let oe=P.parentNode(e);return oe&&Ci(oe)&&wi(oe)&&(w.isShadow=!0),w.type===N.Element&&w.tagName===`iframe`&&pa(e,()=>{let t=e.contentDocument;if(t&&v){let n=xa(t,{doc:t,mirror:r,blockClass:i,blockSelector:a,needsMask:re,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:l,maskInputOptions:u,maskTextFn:d,maskInputFn:f,slimDOMOptions:p,dataURLOptions:m,inlineImages:h,recordCanvas:g,preserveWhiteSpace:ie,onSerialize:_,onIframeLoad:v,iframeLoadTimeout:y,onStylesheetLoad:b,stylesheetLoadTimeout:ee,keepIframeSrcFn:x});n&&v(e,n)}},y),w.type===N.Element&&w.tagName===`link`&&typeof w.attributes.rel==`string`&&(w.attributes.rel===`stylesheet`||w.attributes.rel===`preload`&&typeof w.attributes.href==`string`&&zi(w.attributes.href)===`css`)&&ma(e,()=>{if(b){let t=xa(e,{doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:re,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:l,maskInputOptions:u,maskTextFn:d,maskInputFn:f,slimDOMOptions:p,dataURLOptions:m,inlineImages:h,recordCanvas:g,preserveWhiteSpace:ie,onSerialize:_,onIframeLoad:v,iframeLoadTimeout:y,onStylesheetLoad:b,stylesheetLoadTimeout:ee,keepIframeSrcFn:x});t&&b(e,t)}},ee),w}function Sa(e,t){let{mirror:n=new Mi,blockClass:r=`rr-block`,blockSelector:i=null,maskTextClass:a=`rr-mask`,maskTextSelector:o=null,inlineStylesheet:s=!0,inlineImages:c=!1,recordCanvas:l=!1,maskAllInputs:u=!1,maskTextFn:d,maskInputFn:f,slimDOM:p=!1,dataURLOptions:m,preserveWhiteSpace:h,onSerialize:g,onIframeLoad:_,iframeLoadTimeout:v,onStylesheetLoad:y,stylesheetLoadTimeout:b,keepIframeSrcFn:ee=()=>!1}=t||{};return xa(e,{doc:e,mirror:n,blockClass:r,blockSelector:i,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:s,maskInputOptions:u===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:u===!1?{password:!0}:u,maskTextFn:d,maskInputFn:f,slimDOMOptions:ya(p),dataURLOptions:m,inlineImages:c,recordCanvas:l,preserveWhiteSpace:h,onSerialize:g,onIframeLoad:_,iframeLoadTimeout:v,onStylesheetLoad:y,stylesheetLoadTimeout:b,keepIframeSrcFn:ee,newlyAddedElement:!1})}function Ca(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function wa(e){if(e.__esModule)return e;var t=e.default;if(typeof t==`function`){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,`__esModule`,{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var Ta={exports:{}},I=String,Ea=function(){return{isColorSupported:!1,reset:I,bold:I,dim:I,italic:I,underline:I,inverse:I,hidden:I,strikethrough:I,black:I,red:I,green:I,yellow:I,blue:I,magenta:I,cyan:I,white:I,gray:I,bgBlack:I,bgRed:I,bgGreen:I,bgYellow:I,bgBlue:I,bgMagenta:I,bgCyan:I,bgWhite:I}};Ta.exports=Ea(),Ta.exports.createColors=Ea;var Da=Ta.exports;let L=wa(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:`Module`}))),Oa=Da,ka=L,Aa=class e extends Error{constructor(t,n,r,i,a,o){super(t),this.name=`CssSyntaxError`,this.reason=t,a&&(this.file=a),i&&(this.source=i),o&&(this.plugin=o),n!==void 0&&r!==void 0&&(typeof n==`number`?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+`: `:``,this.message+=this.file?this.file:`<css input>`,this.line!==void 0&&(this.message+=`:`+this.line+`:`+this.column),this.message+=`: `+this.reason}showSourceCode(e){if(!this.source)return``;let t=this.source;e??=Oa.isColorSupported,ka&&e&&(t=ka(t));let n=t.split(/\r?\n/),r=Math.max(this.line-3,0),i=Math.min(this.line+2,n.length),a=String(i).length,o,s;if(e){let{bold:e,gray:t,red:n}=Oa.createColors(!0);o=t=>e(n(t)),s=e=>t(e)}else o=s=e=>e;return n.slice(r,i).map((e,t)=>{let n=r+1+t,i=` `+(` `+n).slice(-a)+` | `;if(n===this.line){let t=s(i.replace(/\d/g,` `))+e.slice(0,this.column-1).replace(/[^\t]/g,` `);return o(`>`)+s(i)+e+`
3
+ `+t+o(`^`)}return` `+s(i)+e}).join(`
4
+ `)}toString(){let e=this.showSourceCode();return e&&=`
5
+
6
+ `+e+`
7
+ `,this.name+`: `+this.message+e}};var ja=Aa;Aa.default=Aa;var Ma={};Ma.isClean=Symbol(`isClean`),Ma.my=Symbol(`my`);let Na={after:`
8
+ `,beforeClose:`
9
+ `,beforeComment:`
10
+ `,beforeDecl:`
11
+ `,beforeOpen:` `,beforeRule:`
12
+ `,colon:`: `,commentLeft:` `,commentRight:` `,emptyBody:``,indent:` `,semicolon:!1};function Pa(e){return e[0].toUpperCase()+e.slice(1)}let Fa=class{constructor(e){this.builder=e}atrule(e,t){let n=`@`+e.name,r=e.params?this.rawValue(e,`params`):``;if(e.raws.afterName===void 0?r&&(n+=` `):n+=e.raws.afterName,e.nodes)this.block(e,n+r);else{let i=(e.raws.between||``)+(t?`;`:``);this.builder(n+r+i,e)}}beforeAfter(e,t){let n;n=e.type===`decl`?this.raw(e,null,`beforeDecl`):e.type===`comment`?this.raw(e,null,`beforeComment`):t===`before`?this.raw(e,null,`beforeRule`):this.raw(e,null,`beforeClose`);let r=e.parent,i=0;for(;r&&r.type!==`root`;)i+=1,r=r.parent;if(n.includes(`
13
+ `)){let t=this.raw(e,null,`indent`);if(t.length)for(let e=0;e<i;e++)n+=t}return n}block(e,t){let n=this.raw(e,`between`,`beforeOpen`);this.builder(t+n+`{`,e,`start`);let r;e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,`after`)):r=this.raw(e,`after`,`emptyBody`),r&&this.builder(r),this.builder(`}`,e,`end`)}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type===`comment`;)--t;let n=this.raw(e,`semicolon`);for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],a=this.raw(i,`before`);a&&this.builder(a),this.stringify(i,t!==r||n)}}comment(e){let t=this.raw(e,`left`,`commentLeft`),n=this.raw(e,`right`,`commentRight`);this.builder(`/*`+t+e.text+n+`*/`,e)}decl(e,t){let n=this.raw(e,`between`,`colon`),r=e.prop+n+this.rawValue(e,`value`);e.important&&(r+=e.raws.important||` !important`),t&&(r+=`;`),this.builder(r,e)}document(e){this.body(e)}raw(e,t,n){let r;if(n||=t,t&&(r=e.raws[t],r!==void 0))return r;let i=e.parent;if(n===`before`&&(!i||i.type===`root`&&i.first===e||i&&i.type===`document`))return``;if(!i)return Na[n];let a=e.root();if(a.rawCache||={},a.rawCache[n]!==void 0)return a.rawCache[n];if(n===`before`||n===`after`)return this.beforeAfter(e,n);{let i=`raw`+Pa(n);this[i]?r=this[i](a,e):a.walk(e=>{if(r=e.raws[t],r!==void 0)return!1})}return r===void 0&&(r=Na[n]),a.rawCache[n]=r,r}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&e.raws.after!==void 0)return t=e.raws.after,t.includes(`
14
+ `)&&(t=t.replace(/[^\n]+$/,``)),!1}),t&&=t.replace(/\S/g,``),t}rawBeforeComment(e,t){let n;return e.walkComments(e=>{if(e.raws.before!==void 0)return n=e.raws.before,n.includes(`
15
+ `)&&(n=n.replace(/[^\n]+$/,``)),!1}),n===void 0?n=this.raw(t,null,`beforeDecl`):n&&=n.replace(/\S/g,``),n}rawBeforeDecl(e,t){let n;return e.walkDecls(e=>{if(e.raws.before!==void 0)return n=e.raws.before,n.includes(`
16
+ `)&&(n=n.replace(/[^\n]+$/,``)),!1}),n===void 0?n=this.raw(t,null,`beforeRule`):n&&=n.replace(/\S/g,``),n}rawBeforeOpen(e){let t;return e.walk(e=>{if(e.type!==`decl`&&(t=e.raws.between,t!==void 0))return!1}),t}rawBeforeRule(e){let t;return e.walk(n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&n.raws.before!==void 0)return t=n.raws.before,t.includes(`
17
+ `)&&(t=t.replace(/[^\n]+$/,``)),!1}),t&&=t.replace(/\S/g,``),t}rawColon(e){let t;return e.walkDecls(e=>{if(e.raws.between!==void 0)return t=e.raws.between.replace(/[^\s:]/g,``),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length===0&&(t=e.raws.after,t!==void 0))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(n=>{let r=n.parent;if(r&&r!==e&&r.parent&&r.parent===e&&n.raws.before!==void 0){let e=n.raws.before.split(`
18
+ `);return t=e[e.length-1],t=t.replace(/\S/g,``),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&e.last.type===`decl`&&(t=e.raws.semicolon,t!==void 0))return!1}),t}rawValue(e,t){let n=e[t],r=e.raws[t];return r&&r.value===n?r.raw:n}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,`selector`)),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,`end`)}stringify(e,t){if(!this[e.type])throw Error(`Unknown AST node type `+e.type+`. Maybe you need to change PostCSS stringifier.`);this[e.type](e,t)}};var Ia=Fa;Fa.default=Fa;let La=Ia;function Ra(e,t){new La(t).stringify(e)}var za=Ra;Ra.default=Ra;let{isClean:Ba,my:Va}=Ma,Ha=ja,Ua=Ia,Wa=za;function Ga(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r)||r===`proxyCache`)continue;let i=e[r],a=typeof i;r===`parent`&&a===`object`?t&&(n[r]=t):r===`source`?n[r]=i:Array.isArray(i)?n[r]=i.map(e=>Ga(e,n)):(a===`object`&&i!==null&&(i=Ga(i)),n[r]=i)}return n}let Ka=class{constructor(e={}){this.raws={},this[Ba]=!1,this[Va]=!0;for(let t in e)if(t===`nodes`){this.nodes=[];for(let n of e[t])typeof n.clone==`function`?this.append(n.clone()):this.append(n)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=Ga(this);for(let n in e)t[n]=e[n];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:n,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:n.column,line:n.line},t)}return new Ha(e)}getProxyProcessor(){return{get(e,t){return t===`proxyOf`?e:t===`root`?()=>e.root().toProxy():e[t]},set(e,t,n){return e[t]===n?!0:(e[t]=n,(t===`prop`||t===`value`||t===`name`||t===`params`||t===`important`||t===`text`)&&e.markDirty(),!0)}}}markDirty(){if(this[Ba]){this[Ba]=!1;let e=this;for(;e=e.parent;)e[Ba]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let n=this.source.start;if(e.index)n=this.positionInside(e.index,t);else if(e.word){t=this.toString();let r=t.indexOf(e.word);r!==-1&&(n=this.positionInside(r,t))}return n}positionInside(e,t){let n=t||this.toString(),r=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)n[t]===`
19
+ `?(r=1,i+=1):r+=1;return{column:r,line:i}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let r=this.toString(),i=r.indexOf(e.word);i!==-1&&(t=this.positionInside(i,r),n=this.positionInside(i+e.word.length,r))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?n={column:e.end.column,line:e.end.line}:typeof e.endIndex==`number`?n=this.positionInside(e.endIndex):e.index&&(n=this.positionInside(e.index+1));return(n.line<t.line||n.line===t.line&&n.column<=t.column)&&(n={column:t.column+1,line:t.line}),{end:n,start:t}}raw(e,t){return new Ua().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,n=!1;for(let r of e)r===this?n=!0:n?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);n||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!==`document`;)e=e.parent;return e}toJSON(e,t){let n={},r=t==null;t||=new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e)||e===`parent`||e===`proxyCache`)continue;let r=this[e];if(Array.isArray(r))n[e]=r.map(e=>typeof e==`object`&&e.toJSON?e.toJSON(null,t):e);else if(typeof r==`object`&&r.toJSON)n[e]=r.toJSON(null,t);else if(e===`source`){let a=t.get(r.input);a??(a=i,t.set(r.input,i),i++),n[e]={end:r.end,inputId:a,start:r.start}}else n[e]=r}return r&&(n.inputs=[...t.keys()].map(e=>e.toJSON())),n}toProxy(){return this.proxyCache||=new Proxy(this,this.getProxyProcessor()),this.proxyCache}toString(e=Wa){e.stringify&&(e=e.stringify);let t=``;return e(this,e=>{t+=e}),t}warn(e,t,n){let r={node:this};for(let e in n)r[e]=n[e];return e.warn(t,r)}get proxyOf(){return this}};var qa=Ka;Ka.default=Ka;let Ja=qa,Ya=class extends Ja{constructor(e){e&&e.value!==void 0&&typeof e.value!=`string`&&(e={...e,value:String(e.value)}),super(e),this.type=`decl`}get variable(){return this.prop.startsWith(`--`)||this.prop[0]===`$`}};var Xa=Ya;Ya.default=Ya;var Za={nanoid:(e=21)=>{let t=``,n=e;for(;n--;)t+=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`[Math.random()*64|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let r=``,i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r}};let{SourceMapConsumer:Qa,SourceMapGenerator:$a}=L,{existsSync:eo,readFileSync:to}=L,{dirname:no,join:ro}=L;function io(e){return O?O.from(e,`base64`).toString():window.atob(e)}let ao=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,`data:`);let n=t.map?t.map.prev:void 0,r=this.loadMap(t.from,n);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=no(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||=new Qa(this.text),this.consumerCache}decodeInline(e){let t=/^data:application\/json;charset=utf-?8;base64,/,n=/^data:application\/json;base64,/;if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||n.test(e))return io(e.substr(RegExp.lastMatch.length));let r=e.match(/data:application\/json;([^,]+),/)[1];throw Error(`Unsupported source map encoding `+r)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,``).trim()}isMap(e){return typeof e==`object`?typeof e.mappings==`string`||typeof e._mappings==`string`||Array.isArray(e.sections):!1}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let n=e.lastIndexOf(t.pop()),r=e.indexOf(`*/`,n);n>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,r)))}loadFile(e){if(this.root=no(e),eo(e))return this.mapFile=e,to(e,`utf-8`).toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t==`string`)return t;if(typeof t==`function`){let n=t(e);if(n){let e=this.loadFile(n);if(!e)throw Error(`Unable to load previous source map: `+n.toString());return e}}else if(t instanceof Qa)return $a.fromSourceMap(t).toString();else if(t instanceof $a)return t.toString();else if(this.isMap(t))return JSON.stringify(t);else throw Error(`Unsupported previous source map format: `+t.toString())}else if(this.inline)return this.decodeInline(this.annotation);else if(this.annotation){let t=this.annotation;return e&&(t=ro(no(e),t)),this.loadFile(t)}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var oo=ao;ao.default=ao;let{SourceMapConsumer:so,SourceMapGenerator:co}=L,{fileURLToPath:lo,pathToFileURL:uo}=L,{isAbsolute:fo,resolve:po}=L,{nanoid:mo}=Za,ho=L,go=ja,_o=oo,vo=Symbol(`fromOffsetCache`),yo=!!(so&&co),bo=!!(po&&fo),xo=class{constructor(e,t={}){if(e==null||typeof e==`object`&&!e.toString)throw Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]===``||this.css[0]===`￾`?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!bo||/^\w+:\/\//.test(t.from)||fo(t.from)?this.file=t.from:this.file=po(t.from)),bo&&yo){let e=new _o(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id=`<input css `+mo(6)+`>`),this.map&&(this.map.file=this.from)}error(e,t,n,r={}){let i,a,o;if(t&&typeof t==`object`){let e=t,r=n;if(typeof e.offset==`number`){let r=this.fromOffset(e.offset);t=r.line,n=r.col}else t=e.line,n=e.column;if(typeof r.offset==`number`){let e=this.fromOffset(r.offset);a=e.line,o=e.col}else a=r.line,o=r.column}else if(!n){let e=this.fromOffset(t);t=e.line,n=e.col}let s=this.origin(t,n,a,o);return i=s?new go(e,s.endLine===void 0?s.line:{column:s.column,line:s.line},s.endLine===void 0?s.column:{column:s.endColumn,line:s.endLine},s.source,s.file,r.plugin):new go(e,a===void 0?t:{column:n,line:t},a===void 0?n:{column:o,line:a},this.css,this.file,r.plugin),i.input={column:n,endColumn:o,endLine:a,line:t,source:this.css},this.file&&(uo&&(i.input.url=uo(this.file).toString()),i.input.file=this.file),i}fromOffset(e){let t,n;if(this[vo])n=this[vo];else{let e=this.css.split(`
20
+ `);n=Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)n[r]=t,t+=e[r].length+1;this[vo]=n}t=n[n.length-1];let r=0;if(e>=t)r=n.length-1;else{let t=n.length-2,i;for(;r<t;)if(i=r+(t-r>>1),e<n[i])t=i-1;else if(e>=n[i+1])r=i+1;else{r=i;break}}return{col:e-n[r]+1,line:r+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:po(this.map.consumer().sourceRoot||this.map.root||`.`,e)}origin(e,t,n,r){if(!this.map)return!1;let i=this.map.consumer(),a=i.originalPositionFor({column:t,line:e});if(!a.source)return!1;let o;typeof n==`number`&&(o=i.originalPositionFor({column:r,line:n}));let s;s=fo(a.source)?uo(a.source):new URL(a.source,this.map.consumer().sourceRoot||uo(this.map.mapFile));let c={column:a.column,endColumn:o&&o.column,endLine:o&&o.line,line:a.line,url:s.toString()};if(s.protocol===`file:`)if(lo)c.file=lo(s);else throw Error(`file: protocol is not available in this PostCSS build`);let l=i.sourceContentFor(a.source);return l&&(c.source=l),c}toJSON(){let e={};for(let t of[`hasBOM`,`css`,`file`,`id`])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var So=xo;xo.default=xo,ho&&ho.registerInput&&ho.registerInput(xo);let{SourceMapConsumer:Co,SourceMapGenerator:wo}=L,{dirname:To,relative:Eo,resolve:Do,sep:Oo}=L,{pathToFileURL:ko}=L,Ao=So,jo=!!(Co&&wo),Mo=!!(To&&Do&&Eo&&Oo);var No=class{constructor(e,t,n,r){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=r,this.originalCSS=r,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?`data:application/json;base64,`+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation==`string`?this.mapOpts.annotation:typeof this.mapOpts.annotation==`function`?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+`.map`;let t=`
21
+ `;this.css.includes(`\r
22
+ `)&&(t=`\r
23
+ `),this.css+=t+`/*# sourceMappingURL=`+e+` */`}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),n=e.root||To(e.file),r;this.mapOpts.sourcesContent===!1?(r=new Co(e.text),r.sourcesContent&&=null):r=e.consumer(),this.map.applySourceMap(r,t,this.toUrl(this.path(n)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type===`comment`&&e.text.indexOf(`# sourceMappingURL=`)===0&&this.root.removeChild(t)}else this.css&&=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,``)}generate(){if(this.clearAnnotation(),Mo&&jo&&this.isMap())return this.generateMap();{let e=``;return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=wo.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new wo({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):`<no source>`});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css=``,this.map=new wo({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,n=`<no source>`,r={generated:{column:0,line:0},original:{column:0,line:0},source:``},i,a;this.stringify(this.root,(o,s,c)=>{if(this.css+=o,s&&c!==`end`&&(r.generated.line=e,r.generated.column=t-1,s.source&&s.source.start?(r.source=this.sourcePath(s),r.original.line=s.source.start.line,r.original.column=s.source.start.column-1,this.map.addMapping(r)):(r.source=n,r.original.line=1,r.original.column=0,this.map.addMapping(r))),i=o.match(/\n/g),i?(e+=i.length,a=o.lastIndexOf(`
24
+ `),t=o.length-a):t+=o.length,s&&c!==`start`){let i=s.parent||{raws:{}};(!(s.type===`decl`||s.type===`atrule`&&!s.nodes)||s!==i.last||i.raws.semicolon)&&(s.source&&s.source.end?(r.source=this.sourcePath(s),r.original.line=s.source.end.line,r.original.column=s.source.end.column-1,r.generated.line=e,r.generated.column=t-2,this.map.addMapping(r)):(r.source=n,r.original.line=1,r.original.column=0,r.generated.line=e,r.generated.column=t-1,this.map.addMapping(r)))}})}isAnnotation(){return this.isInline()?!0:this.mapOpts.annotation===void 0?this.previous().length?this.previous().some(e=>e.annotation):!0:this.mapOpts.annotation}isInline(){if(this.mapOpts.inline!==void 0)return this.mapOpts.inline;let e=this.mapOpts.annotation;return e!==void 0&&e!==!0?!1:this.previous().length?this.previous().some(e=>e.inline):!0}isMap(){return this.opts.map===void 0?this.previous().length>0:!!this.opts.map}isSourcesContent(){return this.mapOpts.sourcesContent===void 0?this.previous().length?this.previous().some(e=>e.withContent()):!0:this.mapOpts.sourcesContent}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):`to.css`}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let n=this.opts.to?To(this.opts.to):`.`;typeof this.mapOpts.annotation==`string`&&(n=To(Do(n,this.mapOpts.annotation)));let r=Eo(n,e);return this.memoizedPaths.set(e,r),r}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Ao(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let r=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(r,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):`<no source>`;this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return O?O.from(e).toString(`base64`):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(ko){let t=ko(e).toString();return this.memoizedFileURLs.set(e,t),t}else throw Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;Oo===`\\`&&(e=e.replace(/\\/g,`/`));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}};let Po=qa,Fo=class extends Po{constructor(e){super(e),this.type=`comment`}};var Io=Fo;Fo.default=Fo;let{isClean:Lo,my:Ro}=Ma,zo=Xa,Bo=Io,Vo=qa,Ho,Uo,Wo,Go;function Ko(e){return e.map(e=>(e.nodes&&=Ko(e.nodes),delete e.source,e))}function qo(e){if(e[Lo]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)qo(t)}let Jo=class e extends Vo{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),n,r;for(;this.indexes[t]<this.proxyOf.nodes.length&&(n=this.indexes[t],r=e(this.proxyOf.nodes[n],n),r!==!1);)this.indexes[t]+=1;return delete this.indexes[t],r}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||=0,this.indexes||={},this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t===`proxyOf`?e:e[t]?t===`each`||typeof t==`string`&&t.startsWith(`walk`)?(...n)=>e[t](...n.map(e=>typeof e==`function`?(t,n)=>e(t.toProxy(),n):e)):t===`every`||t===`some`?n=>e[t]((e,...t)=>n(e.toProxy(),...t)):t===`root`?()=>e.root().toProxy():t===`nodes`?e.nodes.map(e=>e.toProxy()):t===`first`||t===`last`?e[t].toProxy():e[t]:e[t]},set(e,t,n){return e[t]===n?!0:(e[t]=n,(t===`name`||t===`params`||t===`selector`)&&e.markDirty(),!0)}}}index(e){return typeof e==`number`?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let n=this.index(e),r=this.normalize(t,this.proxyOf.nodes[n]).reverse();n=this.index(e);for(let e of r)this.proxyOf.nodes.splice(n+1,0,e);let i;for(let e in this.indexes)i=this.indexes[e],n<i&&(this.indexes[e]=i+r.length);return this.markDirty(),this}insertBefore(e,t){let n=this.index(e),r=n===0?`prepend`:!1,i=this.normalize(t,this.proxyOf.nodes[n],r).reverse();n=this.index(e);for(let e of i)this.proxyOf.nodes.splice(n,0,e);let a;for(let e in this.indexes)a=this.indexes[e],n<=a&&(this.indexes[e]=a+i.length);return this.markDirty(),this}normalize(t,n){if(typeof t==`string`)t=Ko(Ho(t).nodes);else if(t===void 0)t=[];else if(Array.isArray(t)){t=t.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,`ignore`)}else if(t.type===`root`&&this.type!==`document`){t=t.nodes.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,`ignore`)}else if(t.type)t=[t];else if(t.prop){if(t.value===void 0)throw Error(`Value field is missed in node creation`);typeof t.value!=`string`&&(t.value=String(t.value)),t=[new zo(t)]}else if(t.selector)t=[new Uo(t)];else if(t.name)t=[new Wo(t)];else if(t.text)t=[new Bo(t)];else throw Error(`Unknown node type in node creation`);return t.map(t=>(t[Ro]||e.rebuild(t),t=t.proxyOf,t.parent&&t.parent.removeChild(t),t[Lo]&&qo(t),t.raws.before===void 0&&n&&n.raws.before!==void 0&&(t.raws.before=n.raws.before.replace(/\S/g,``)),t.parent=this.proxyOf,t))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,`prepend`).reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,n))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,n)=>{let r;try{r=e(t,n)}catch(e){throw t.addToError(e)}return r!==!1&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if(n.type===`atrule`&&e.test(n.name))return t(n,r)}):this.walk((n,r)=>{if(n.type===`atrule`&&n.name===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if(e.type===`atrule`)return t(e,n)}))}walkComments(e){return this.walk((t,n)=>{if(t.type===`comment`)return e(t,n)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if(n.type===`decl`&&e.test(n.prop))return t(n,r)}):this.walk((n,r)=>{if(n.type===`decl`&&n.prop===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if(e.type===`decl`)return t(e,n)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if(n.type===`rule`&&e.test(n.selector))return t(n,r)}):this.walk((n,r)=>{if(n.type===`rule`&&n.selector===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if(e.type===`rule`)return t(e,n)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};Jo.registerParse=e=>{Ho=e},Jo.registerRule=e=>{Uo=e},Jo.registerAtRule=e=>{Wo=e},Jo.registerRoot=e=>{Go=e};var Yo=Jo;Jo.default=Jo,Jo.rebuild=e=>{e.type===`atrule`?Object.setPrototypeOf(e,Wo.prototype):e.type===`rule`?Object.setPrototypeOf(e,Uo.prototype):e.type===`decl`?Object.setPrototypeOf(e,zo.prototype):e.type===`comment`?Object.setPrototypeOf(e,Bo.prototype):e.type===`root`&&Object.setPrototypeOf(e,Go.prototype),e[Ro]=!0,e.nodes&&e.nodes.forEach(e=>{Jo.rebuild(e)})};let Xo=Yo,Zo,Qo,$o=class extends Xo{constructor(e){super({type:`document`,...e}),this.nodes||=[]}toResult(e={}){return new Zo(new Qo,this,e).stringify()}};$o.registerLazyResult=e=>{Zo=e},$o.registerProcessor=e=>{Qo=e};var es=$o;$o.default=$o;let ts=class{constructor(e,t={}){if(this.type=`warning`,this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+`: `+this.text:this.text}};var ns=ts;ts.default=ts;let rs=ns,is=class{constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let n=new rs(e,t);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>e.type===`warning`)}get content(){return this.css}};var as=is;is.default=is;let os=/[\t\n\f\r "#'()/;[\\\]{}]/g,ss=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,cs=/.[\r\n"'(/\\]/,ls=/[\da-f]/i;var us=function(e,t={}){let n=e.css.valueOf(),r=t.ignoreErrors,i,a,o,s,c,l,u,d,f,p,m=n.length,h=0,g=[],_=[];function v(){return h}function y(t){throw e.error(`Unclosed `+t,h)}function b(){return _.length===0&&h>=m}function ee(e){if(_.length)return _.pop();if(h>=m)return;let t=e?e.ignoreUnclosed:!1;switch(i=n.charCodeAt(h),i){case 10:case 32:case 9:case 13:case 12:a=h;do a+=1,i=n.charCodeAt(a);while(i===32||i===10||i===9||i===13||i===12);p=[`space`,n.slice(h,a)],h=a-1;break;case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let e=String.fromCharCode(i);p=[e,e,h];break}case 40:if(d=g.length?g.pop()[1]:``,f=n.charCodeAt(h+1),d===`url`&&f!==39&&f!==34&&f!==32&&f!==10&&f!==9&&f!==12&&f!==13){a=h;do{if(l=!1,a=n.indexOf(`)`,a+1),a===-1)if(r||t){a=h;break}else y(`bracket`);for(u=a;n.charCodeAt(u-1)===92;)--u,l=!l}while(l);p=[`brackets`,n.slice(h,a+1),h,a],h=a}else a=n.indexOf(`)`,h+1),s=n.slice(h,a+1),a===-1||cs.test(s)?p=[`(`,`(`,h]:(p=[`brackets`,s,h,a],h=a);break;case 39:case 34:o=i===39?`'`:`"`,a=h;do{if(l=!1,a=n.indexOf(o,a+1),a===-1)if(r||t){a=h+1;break}else y(`string`);for(u=a;n.charCodeAt(u-1)===92;)--u,l=!l}while(l);p=[`string`,n.slice(h,a+1),h,a],h=a;break;case 64:os.lastIndex=h+1,os.test(n),a=os.lastIndex===0?n.length-1:os.lastIndex-2,p=[`at-word`,n.slice(h,a+1),h,a],h=a;break;case 92:for(a=h,c=!0;n.charCodeAt(a+1)===92;)a+=1,c=!c;if(i=n.charCodeAt(a+1),c&&i!==47&&i!==32&&i!==10&&i!==9&&i!==13&&i!==12&&(a+=1,ls.test(n.charAt(a)))){for(;ls.test(n.charAt(a+1));)a+=1;n.charCodeAt(a+1)===32&&(a+=1)}p=[`word`,n.slice(h,a+1),h,a],h=a;break;default:i===47&&n.charCodeAt(h+1)===42?(a=n.indexOf(`*/`,h+2)+1,a===0&&(r||t?a=n.length:y(`comment`)),p=[`comment`,n.slice(h,a+1),h,a],h=a):(ss.lastIndex=h+1,ss.test(n),a=ss.lastIndex===0?n.length-1:ss.lastIndex-2,p=[`word`,n.slice(h,a+1),h,a],g.push(p),h=a);break}return h++,p}function x(e){_.push(e)}return{back:x,endOfFile:b,nextToken:ee,position:v}};let ds=Yo,fs=class extends ds{constructor(e){super(e),this.type=`atrule`}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var ps=fs;fs.default=fs,ds.registerAtRule(fs);let ms=Yo,hs,gs,_s=class extends ms{constructor(e){super(e),this.type=`root`,this.nodes||=[]}normalize(e,t,n){let r=super.normalize(e);if(t){if(n===`prepend`)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of r)e.raws.before=t.raws.before}return r}removeChild(e,t){let n=this.index(e);return!t&&n===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(e={}){return new hs(new gs,this,e).stringify()}};_s.registerLazyResult=e=>{hs=e},_s.registerProcessor=e=>{gs=e};var vs=_s;_s.default=_s,ms.registerRoot(_s);let ys={comma(e){return ys.split(e,[`,`],!0)},space(e){return ys.split(e,[` `,`
25
+ `,` `])},split(e,t,n){let r=[],i=``,a=!1,o=0,s=!1,c=``,l=!1;for(let n of e)l?l=!1:n===`\\`?l=!0:s?n===c&&(s=!1):n===`"`||n===`'`?(s=!0,c=n):n===`(`?o+=1:n===`)`?o>0&&--o:o===0&&t.includes(n)&&(a=!0),a?(i!==``&&r.push(i.trim()),i=``,a=!1):i+=n;return(n||i!==``)&&r.push(i.trim()),r}};var bs=ys;ys.default=ys;let xs=Yo,Ss=bs,Cs=class extends xs{constructor(e){super(e),this.type=`rule`,this.nodes||=[]}get selectors(){return Ss.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,n=t?t[0]:`,`+this.raw(`between`,`beforeOpen`);this.selector=e.join(n)}};var ws=Cs;Cs.default=Cs,xs.registerRule(Cs);let Ts=Xa,Es=us,Ds=Io,Os=ps,ks=vs,As=ws,js={empty:!0,space:!0};function Ms(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var Ns=class{constructor(e){this.input=e,this.root=new ks,this.current=this.root,this.spaces=``,this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new Os;t.name=e[1].slice(1),t.name===``&&this.unnamedAtrule(t,e),this.init(t,e[2]);let n,r,i,a=!1,o=!1,s=[],c=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),n=e[0],n===`(`||n===`[`?c.push(n===`(`?`)`:`]`):n===`{`&&c.length>0?c.push(`}`):n===c[c.length-1]&&c.pop(),c.length===0)if(n===`;`){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(n===`{`){o=!0;break}else if(n===`}`){if(s.length>0){for(i=s.length-1,r=s[i];r&&r[0]===`space`;)r=s[--i];r&&(t.source.end=this.getPosition(r[3]||r[2]),t.source.end.offset++)}this.end(e);break}else s.push(e);else s.push(e);if(this.tokenizer.endOfFile()){a=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(s),s.length?(t.raws.afterName=this.spacesAndCommentsFromStart(s),this.raw(t,`params`,s),a&&(e=s[s.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between=``)):(t.raws.afterName=``,t.params=``),o&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let n=0,r;for(let i=t-1;i>=0&&(r=e[i],!(r[0]!==`space`&&(n+=1,n===2)));i--);throw this.input.error(`Missed semicolon`,r[0]===`word`?r[3]+1:r[2])}colon(e){let t=0,n,r,i;for(let[a,o]of e.entries()){if(n=o,r=n[0],r===`(`&&(t+=1),r===`)`&&--t,t===0&&r===`:`)if(!i)this.doubleColon(n);else if(i[0]===`word`&&i[1]===`progid`)continue;else return a;i=n}return!1}comment(e){let t=new Ds;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text=``,t.raws.left=n,t.raws.right=``;else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=Es(this.input)}decl(e,t){let n=new Ts;this.init(n,e[0][2]);let r=e[e.length-1];for(r[0]===`;`&&(this.semicolon=!0,e.pop()),n.source.end=this.getPosition(r[3]||r[2]||Ms(e)),n.source.end.offset++;e[0][0]!==`word`;)e.length===1&&this.unknownWord(e),n.raws.before+=e.shift()[1];for(n.source.start=this.getPosition(e[0][2]),n.prop=``;e.length;){let t=e[0][0];if(t===`:`||t===`space`||t===`comment`)break;n.prop+=e.shift()[1]}n.raws.between=``;let i;for(;e.length;)if(i=e.shift(),i[0]===`:`){n.raws.between+=i[1];break}else i[0]===`word`&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1];(n.prop[0]===`_`||n.prop[0]===`*`)&&(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let a=[],o;for(;e.length&&(o=e[0][0],!(o!==`space`&&o!==`comment`));)a.push(e.shift());this.precheckMissedSemicolon(e);for(let t=e.length-1;t>=0;t--){if(i=e[t],i[1].toLowerCase()===`!important`){n.important=!0;let r=this.stringFrom(e,t);r=this.spacesFromEnd(e)+r,r!==` !important`&&(n.raws.important=r);break}else if(i[1].toLowerCase()===`important`){let r=e.slice(0),i=``;for(let e=t;e>0;e--){let t=r[e][0];if(i.trim().indexOf(`!`)===0&&t!==`space`)break;i=r.pop()[1]+i}i.trim().indexOf(`!`)===0&&(n.important=!0,n.raws.important=i,e=r)}if(i[0]!==`space`&&i[0]!==`comment`)break}e.some(e=>e[0]!==`space`&&e[0]!==`comment`)&&(n.raws.between+=a.map(e=>e[1]).join(``),a=[]),this.raw(n,`value`,a.concat(e),t),n.value.includes(`:`)&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error(`Double colon`,{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new As;this.init(t,e[2]),t.selector=``,t.raws.between=``,this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||``)+this.spaces,this.spaces=``,this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||``)+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&e.type===`rule`&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces=``)}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces=``,e.type!==`comment`&&(this.semicolon=!1)}other(e){let t=!1,n=null,r=!1,i=null,a=[],o=e[1].startsWith(`--`),s=[],c=e;for(;c;){if(n=c[0],s.push(c),n===`(`||n===`[`)i||=c,a.push(n===`(`?`)`:`]`);else if(o&&r&&n===`{`)i||=c,a.push(`}`);else if(a.length===0)if(n===`;`)if(r){this.decl(s,o);return}else break;else if(n===`{`){this.rule(s);return}else if(n===`}`){this.tokenizer.back(s.pop()),t=!0;break}else n===`:`&&(r=!0);else n===a[a.length-1]&&(a.pop(),a.length===0&&(i=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),a.length>0&&this.unclosedBracket(i),t&&r){if(!o)for(;s.length&&(c=s[s.length-1][0],!(c!==`space`&&c!==`comment`));)this.tokenizer.back(s.pop());this.decl(s,o)}else this.unknownWord(s)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case`space`:this.spaces+=e[1];break;case`;`:this.freeSemicolon(e);break;case`}`:this.end(e);break;case`comment`:this.comment(e);break;case`at-word`:this.atrule(e);break;case`{`:this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,n,r){let i,a,o=n.length,s=``,c=!0,l,u;for(let e=0;e<o;e+=1)i=n[e],a=i[0],a===`space`&&e===o-1&&!r?c=!1:a===`comment`?(u=n[e-1]?n[e-1][0]:`empty`,l=n[e+1]?n[e+1][0]:`empty`,!js[u]&&!js[l]?s.slice(-1)===`,`?c=!1:s+=i[1]:c=!1):s+=i[1];if(!c){let r=n.reduce((e,t)=>e+t[1],``);e.raws[t]={raw:r,value:s}}e[t]=s}rule(e){e.pop();let t=new As;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,`selector`,e),this.current=t}spacesAndCommentsFromEnd(e){let t,n=``;for(;e.length&&(t=e[e.length-1][0],!(t!==`space`&&t!==`comment`));)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n=``;for(;e.length&&(t=e[0][0],!(t!==`space`&&t!==`comment`));)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n=``;for(;e.length&&(t=e[e.length-1][0],t===`space`);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n=``;for(let r=t;r<e.length;r++)n+=e[r][1];return e.splice(t,e.length-t),n}unclosedBlock(){let e=this.current.source.start;throw this.input.error(`Unclosed block`,e.line,e.column)}unclosedBracket(e){throw this.input.error(`Unclosed bracket`,{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error(`Unexpected }`,{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error(`Unknown word`,{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error(`At-rule without name`,{offset:t[2]},{offset:t[2]+t[1].length})}};let Ps=Yo,Fs=Ns,Is=So;function Ls(e,t){let n=new Fs(new Is(e,t));try{n.parse()}catch(e){throw e}return n.root}var Rs=Ls;Ls.default=Ls,Ps.registerParse(Ls);let{isClean:zs,my:Bs}=Ma,Vs=No,Hs=za,Us=Yo,Ws=es,Gs=as,Ks=Rs,qs=vs,Js={atrule:`AtRule`,comment:`Comment`,decl:`Declaration`,document:`Document`,root:`Root`,rule:`Rule`},Ys={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},Xs={Once:!0,postcssPlugin:!0,prepare:!0};function Zs(e){return typeof e==`object`&&typeof e.then==`function`}function Qs(e){let t=!1,n=Js[e.type];return e.type===`decl`?t=e.prop.toLowerCase():e.type===`atrule`&&(t=e.name.toLowerCase()),t&&e.append?[n,n+`-`+t,0,n+`Exit`,n+`Exit-`+t]:t?[n,n+`-`+t,n+`Exit`,n+`Exit-`+t]:e.append?[n,0,n+`Exit`]:[n,n+`Exit`]}function $s(e){let t;return t=e.type===`document`?[`Document`,0,`DocumentExit`]:e.type===`root`?[`Root`,0,`RootExit`]:Qs(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function ec(e){return e[zs]=!1,e.nodes&&e.nodes.forEach(e=>ec(e)),e}let tc={},nc=class e{constructor(t,n,r){this.stringified=!1,this.processed=!1;let i;if(typeof n==`object`&&n&&(n.type===`root`||n.type===`document`))i=ec(n);else if(n instanceof e||n instanceof Gs)i=ec(n.root),n.map&&(r.map===void 0&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let e=Ks;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{i=e(n,r)}catch(e){this.processed=!0,this.error=e}i&&!i[Bs]&&Us.rebuild(i)}this.result=new Gs(t,i,r),this.helpers={...tc,postcss:tc,result:this.result},this.plugins=this.processor.plugins.map(e=>typeof e==`object`&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||=this.runAsync(),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw Error(`Use process(css).then(cb) to work with async plugins`)}handleError(e,t){let n=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,e.name===`CssSyntaxError`&&!e.plugin?(e.plugin=n.postcssPlugin,e.setMessage()):n.postcssVersion}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if(typeof t==`object`)for(let n in t){if(!Ys[n]&&/^[A-Z]/.test(n))throw Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Xs[n])if(typeof t[n]==`object`)for(let r in t[n])r===`*`?e(t,n,t[n][r]):e(t,n+`-`+r.toLowerCase(),t[n][r]);else typeof t[n]==`function`&&e(t,n,t[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],n=this.runOnRoot(t);if(Zs(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[zs];){e[zs]=!0;let t=[$s(e)];for(;t.length>0;){let e=this.visitTick(t);if(Zs(e))try{await e}catch(e){let n=t[t.length-1].node;throw this.handleError(e,n)}}}if(this.listeners.OnceExit)for(let[t,n]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type===`document`){let t=e.nodes.map(e=>n(e,this.helpers));await Promise.all(t)}else await n(e,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e==`object`&&e.Once){if(this.result.root.type===`document`){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return Zs(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e==`function`)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=Hs;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new Vs(t,this.result.root,this.result.opts).generate();return this.result.css=n[0],this.result.map=n[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins)if(Zs(this.runOnRoot(e)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[zs];)e[zs]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type===`document`)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[n,r]of e){this.result.lastPlugin=n;let e;try{e=r(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if(t.type!==`root`&&t.type!==`document`&&!t.parent)return!0;if(Zs(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:n,visitors:r}=t;if(n.type!==`root`&&n.type!==`document`&&!n.parent){e.pop();return}if(r.length>0&&t.visitorIndex<r.length){let[e,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(t.iterator!==0){let r=t.iterator,i;for(;i=n.nodes[n.indexes[r]];)if(n.indexes[r]+=1,!i[zs]){i[zs]=!0,e.push($s(i));return}t.iterator=0,delete n.indexes[r]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,e===0){n.nodes&&n.nodes.length&&(n[zs]=!0,t.iterator=n.getIterator());return}else if(this.listeners[e]){t.visitors=this.listeners[e];return}}e.pop()}walkSync(e){e[zs]=!0;let t=Qs(e);for(let n of t)if(n===0)e.nodes&&e.each(e=>{e[zs]||this.walkSync(e)});else{let t=this.listeners[n];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return`LazyResult`}};nc.registerPostcss=e=>{tc=e};var rc=nc;nc.default=nc,qs.registerLazyResult(nc),Ws.registerLazyResult(nc);let ic=No,ac=za,oc=Rs,sc=as,cc=class{constructor(e,t,n){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=n,this._map=void 0;let r=ac;this.result=new sc(this._processor,void 0,this._opts),this.result.css=t;let i=this;Object.defineProperty(this.result,`root`,{get(){return i.root}});let a=new ic(r,void 0,this._opts,t);if(a.isMap()){let[e,t]=a.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=oc;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return`NoWorkResult`}};var lc=cc;cc.default=cc;let uc=lc,dc=rc,fc=es,pc=vs,mc=class{constructor(e=[]){this.version=`8.4.38`,this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(n.postcss===!0?n=n():n.postcss&&(n=n.postcss),typeof n==`object`&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if(typeof n==`object`&&n.postcssPlugin)t.push(n);else if(typeof n==`function`)t.push(n);else if(!(typeof n==`object`&&(n.parse||n.stringify)))throw Error(n+` is not a PostCSS plugin`);return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new uc(this,e,t):new dc(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var hc=mc;mc.default=mc,pc.registerProcessor(mc),fc.registerProcessor(mc);let gc=Xa,_c=oo,vc=Io,yc=ps,bc=So,xc=vs,Sc=ws;function Cc(e,t){if(Array.isArray(e))return e.map(e=>Cc(e));let{inputs:n,...r}=e;if(n){t=[];for(let e of n){let n={...e,__proto__:bc.prototype};n.map&&={...n.map,__proto__:_c.prototype},t.push(n)}}if(r.nodes&&=e.nodes.map(e=>Cc(e,t)),r.source){let{inputId:e,...n}=r.source;r.source=n,e!=null&&(r.source.input=t[e])}if(r.type===`root`)return new xc(r);if(r.type===`decl`)return new gc(r);if(r.type===`rule`)return new Sc(r);if(r.type===`comment`)return new vc(r);if(r.type===`atrule`)return new yc(r);throw Error(`Unknown node type: `+e.type)}var wc=Cc;Cc.default=Cc;let Tc=ja,Ec=Xa,Dc=rc,Oc=Yo,kc=hc,Ac=za,jc=wc,Mc=es,Nc=ns,Pc=Io,Fc=ps,Ic=as,Lc=So,Rc=Rs,zc=bs,Bc=ws,Vc=vs,Hc=qa;function R(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new kc(e)}R.plugin=function(e,t){let n=!1;function r(...r){console&&console.warn&&!n&&(n=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:
26
+ https://evilmartians.com/chronicles/postcss-8-plugin-migration`),Vn.env.LANG&&Vn.env.LANG.startsWith(`cn`)&&console.warn(e+`: 里面 postcss.plugin 被弃用. 迁移指南:
27
+ https://www.w3ctech.com/topic/2226`));let i=t(...r);return i.postcssPlugin=e,i.postcssVersion=new kc().version,i}let i;return Object.defineProperty(r,`postcss`,{get(){return i||=r(),i}}),r.process=function(e,t,n){return R([r(n)]).process(e,t)},r},R.stringify=Ac,R.parse=Rc,R.fromJSON=jc,R.list=zc,R.comment=e=>new Pc(e),R.atRule=e=>new Fc(e),R.decl=e=>new Ec(e),R.rule=e=>new Bc(e),R.root=e=>new Vc(e),R.document=e=>new Mc(e),R.CssSyntaxError=Tc,R.Declaration=Ec,R.Container=Oc,R.Processor=kc,R.Document=Mc,R.Comment=Pc,R.Warning=Nc,R.AtRule=Fc,R.Result=Ic,R.Input=Lc,R.Rule=Bc,R.Root=Vc,R.Node=Hc,Dc.registerPostcss(R);var Uc=R;R.default=R;let z=Ca(Uc);z.stringify,z.fromJSON,z.plugin,z.parse,z.list,z.document,z.comment,z.atRule,z.rule,z.decl,z.root,z.CssSyntaxError,z.Declaration,z.Container,z.Processor,z.Document,z.Comment,z.Warning,z.AtRule,z.Result,z.Input,z.Rule,z.Root,z.Node;var Wc=Object.defineProperty,Gc=(e,t,n)=>t in e?Wc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,B=(e,t,n)=>Gc(e,typeof t==`symbol`?t:t+``,n);function Kc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function qc(e){if(e.__esModule)return e;var t=e.default;if(typeof t==`function`){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,`__esModule`,{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var Jc={exports:{}},V=String,Yc=function(){return{isColorSupported:!1,reset:V,bold:V,dim:V,italic:V,underline:V,inverse:V,hidden:V,strikethrough:V,black:V,red:V,green:V,yellow:V,blue:V,magenta:V,cyan:V,white:V,gray:V,bgBlack:V,bgRed:V,bgGreen:V,bgYellow:V,bgBlue:V,bgMagenta:V,bgCyan:V,bgWhite:V}};Jc.exports=Yc(),Jc.exports.createColors=Yc;var Xc=Jc.exports;let H=qc(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:`Module`}))),Zc=Xc,Qc=H,$c=class e extends Error{constructor(t,n,r,i,a,o){super(t),this.name=`CssSyntaxError`,this.reason=t,a&&(this.file=a),i&&(this.source=i),o&&(this.plugin=o),n!==void 0&&r!==void 0&&(typeof n==`number`?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+`: `:``,this.message+=this.file?this.file:`<css input>`,this.line!==void 0&&(this.message+=`:`+this.line+`:`+this.column),this.message+=`: `+this.reason}showSourceCode(e){if(!this.source)return``;let t=this.source;e??=Zc.isColorSupported,Qc&&e&&(t=Qc(t));let n=t.split(/\r?\n/),r=Math.max(this.line-3,0),i=Math.min(this.line+2,n.length),a=String(i).length,o,s;if(e){let{bold:e,gray:t,red:n}=Zc.createColors(!0);o=t=>e(n(t)),s=e=>t(e)}else o=s=e=>e;return n.slice(r,i).map((e,t)=>{let n=r+1+t,i=` `+(` `+n).slice(-a)+` | `;if(n===this.line){let t=s(i.replace(/\d/g,` `))+e.slice(0,this.column-1).replace(/[^\t]/g,` `);return o(`>`)+s(i)+e+`
28
+ `+t+o(`^`)}return` `+s(i)+e}).join(`
29
+ `)}toString(){let e=this.showSourceCode();return e&&=`
30
+
31
+ `+e+`
32
+ `,this.name+`: `+this.message+e}};var el=$c;$c.default=$c;var tl={};tl.isClean=Symbol(`isClean`),tl.my=Symbol(`my`);let nl={after:`
33
+ `,beforeClose:`
34
+ `,beforeComment:`
35
+ `,beforeDecl:`
36
+ `,beforeOpen:` `,beforeRule:`
37
+ `,colon:`: `,commentLeft:` `,commentRight:` `,emptyBody:``,indent:` `,semicolon:!1};function rl(e){return e[0].toUpperCase()+e.slice(1)}let il=class{constructor(e){this.builder=e}atrule(e,t){let n=`@`+e.name,r=e.params?this.rawValue(e,`params`):``;if(e.raws.afterName===void 0?r&&(n+=` `):n+=e.raws.afterName,e.nodes)this.block(e,n+r);else{let i=(e.raws.between||``)+(t?`;`:``);this.builder(n+r+i,e)}}beforeAfter(e,t){let n;n=e.type===`decl`?this.raw(e,null,`beforeDecl`):e.type===`comment`?this.raw(e,null,`beforeComment`):t===`before`?this.raw(e,null,`beforeRule`):this.raw(e,null,`beforeClose`);let r=e.parent,i=0;for(;r&&r.type!==`root`;)i+=1,r=r.parent;if(n.includes(`
38
+ `)){let t=this.raw(e,null,`indent`);if(t.length)for(let e=0;e<i;e++)n+=t}return n}block(e,t){let n=this.raw(e,`between`,`beforeOpen`);this.builder(t+n+`{`,e,`start`);let r;e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,`after`)):r=this.raw(e,`after`,`emptyBody`),r&&this.builder(r),this.builder(`}`,e,`end`)}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type===`comment`;)--t;let n=this.raw(e,`semicolon`);for(let r=0;r<e.nodes.length;r++){let i=e.nodes[r],a=this.raw(i,`before`);a&&this.builder(a),this.stringify(i,t!==r||n)}}comment(e){let t=this.raw(e,`left`,`commentLeft`),n=this.raw(e,`right`,`commentRight`);this.builder(`/*`+t+e.text+n+`*/`,e)}decl(e,t){let n=this.raw(e,`between`,`colon`),r=e.prop+n+this.rawValue(e,`value`);e.important&&(r+=e.raws.important||` !important`),t&&(r+=`;`),this.builder(r,e)}document(e){this.body(e)}raw(e,t,n){let r;if(n||=t,t&&(r=e.raws[t],r!==void 0))return r;let i=e.parent;if(n===`before`&&(!i||i.type===`root`&&i.first===e||i&&i.type===`document`))return``;if(!i)return nl[n];let a=e.root();if(a.rawCache||={},a.rawCache[n]!==void 0)return a.rawCache[n];if(n===`before`||n===`after`)return this.beforeAfter(e,n);{let i=`raw`+rl(n);this[i]?r=this[i](a,e):a.walk(e=>{if(r=e.raws[t],r!==void 0)return!1})}return r===void 0&&(r=nl[n]),a.rawCache[n]=r,r}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&e.raws.after!==void 0)return t=e.raws.after,t.includes(`
39
+ `)&&(t=t.replace(/[^\n]+$/,``)),!1}),t&&=t.replace(/\S/g,``),t}rawBeforeComment(e,t){let n;return e.walkComments(e=>{if(e.raws.before!==void 0)return n=e.raws.before,n.includes(`
40
+ `)&&(n=n.replace(/[^\n]+$/,``)),!1}),n===void 0?n=this.raw(t,null,`beforeDecl`):n&&=n.replace(/\S/g,``),n}rawBeforeDecl(e,t){let n;return e.walkDecls(e=>{if(e.raws.before!==void 0)return n=e.raws.before,n.includes(`
41
+ `)&&(n=n.replace(/[^\n]+$/,``)),!1}),n===void 0?n=this.raw(t,null,`beforeRule`):n&&=n.replace(/\S/g,``),n}rawBeforeOpen(e){let t;return e.walk(e=>{if(e.type!==`decl`&&(t=e.raws.between,t!==void 0))return!1}),t}rawBeforeRule(e){let t;return e.walk(n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&n.raws.before!==void 0)return t=n.raws.before,t.includes(`
42
+ `)&&(t=t.replace(/[^\n]+$/,``)),!1}),t&&=t.replace(/\S/g,``),t}rawColon(e){let t;return e.walkDecls(e=>{if(e.raws.between!==void 0)return t=e.raws.between.replace(/[^\s:]/g,``),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length===0&&(t=e.raws.after,t!==void 0))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(n=>{let r=n.parent;if(r&&r!==e&&r.parent&&r.parent===e&&n.raws.before!==void 0){let e=n.raws.before.split(`
43
+ `);return t=e[e.length-1],t=t.replace(/\S/g,``),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&e.last.type===`decl`&&(t=e.raws.semicolon,t!==void 0))return!1}),t}rawValue(e,t){let n=e[t],r=e.raws[t];return r&&r.value===n?r.raw:n}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,`selector`)),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,`end`)}stringify(e,t){if(!this[e.type])throw Error(`Unknown AST node type `+e.type+`. Maybe you need to change PostCSS stringifier.`);this[e.type](e,t)}};var al=il;il.default=il;let ol=al;function sl(e,t){new ol(t).stringify(e)}var cl=sl;sl.default=sl;let{isClean:ll,my:ul}=tl,dl=el,fl=al,pl=cl;function ml(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r)||r===`proxyCache`)continue;let i=e[r],a=typeof i;r===`parent`&&a===`object`?t&&(n[r]=t):r===`source`?n[r]=i:Array.isArray(i)?n[r]=i.map(e=>ml(e,n)):(a===`object`&&i!==null&&(i=ml(i)),n[r]=i)}return n}let hl=class{constructor(e={}){this.raws={},this[ll]=!1,this[ul]=!0;for(let t in e)if(t===`nodes`){this.nodes=[];for(let n of e[t])typeof n.clone==`function`?this.append(n.clone()):this.append(n)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=ml(this);for(let n in e)t[n]=e[n];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:n,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:n.column,line:n.line},t)}return new dl(e)}getProxyProcessor(){return{get(e,t){return t===`proxyOf`?e:t===`root`?()=>e.root().toProxy():e[t]},set(e,t,n){return e[t]===n?!0:(e[t]=n,(t===`prop`||t===`value`||t===`name`||t===`params`||t===`important`||t===`text`)&&e.markDirty(),!0)}}}markDirty(){if(this[ll]){this[ll]=!1;let e=this;for(;e=e.parent;)e[ll]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let n=this.source.start;if(e.index)n=this.positionInside(e.index,t);else if(e.word){t=this.toString();let r=t.indexOf(e.word);r!==-1&&(n=this.positionInside(r,t))}return n}positionInside(e,t){let n=t||this.toString(),r=this.source.start.column,i=this.source.start.line;for(let t=0;t<e;t++)n[t]===`
44
+ `?(r=1,i+=1):r+=1;return{column:r,line:i}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let r=this.toString(),i=r.indexOf(e.word);i!==-1&&(t=this.positionInside(i,r),n=this.positionInside(i+e.word.length,r))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?n={column:e.end.column,line:e.end.line}:typeof e.endIndex==`number`?n=this.positionInside(e.endIndex):e.index&&(n=this.positionInside(e.index+1));return(n.line<t.line||n.line===t.line&&n.column<=t.column)&&(n={column:t.column+1,line:t.line}),{end:n,start:t}}raw(e,t){return new fl().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,n=!1;for(let r of e)r===this?n=!0:n?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);n||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!==`document`;)e=e.parent;return e}toJSON(e,t){let n={},r=t==null;t||=new Map;let i=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e)||e===`parent`||e===`proxyCache`)continue;let r=this[e];if(Array.isArray(r))n[e]=r.map(e=>typeof e==`object`&&e.toJSON?e.toJSON(null,t):e);else if(typeof r==`object`&&r.toJSON)n[e]=r.toJSON(null,t);else if(e===`source`){let a=t.get(r.input);a??(a=i,t.set(r.input,i),i++),n[e]={end:r.end,inputId:a,start:r.start}}else n[e]=r}return r&&(n.inputs=[...t.keys()].map(e=>e.toJSON())),n}toProxy(){return this.proxyCache||=new Proxy(this,this.getProxyProcessor()),this.proxyCache}toString(e=pl){e.stringify&&(e=e.stringify);let t=``;return e(this,e=>{t+=e}),t}warn(e,t,n){let r={node:this};for(let e in n)r[e]=n[e];return e.warn(t,r)}get proxyOf(){return this}};var gl=hl;hl.default=hl;let _l=gl,vl=class extends _l{constructor(e){e&&e.value!==void 0&&typeof e.value!=`string`&&(e={...e,value:String(e.value)}),super(e),this.type=`decl`}get variable(){return this.prop.startsWith(`--`)||this.prop[0]===`$`}};var yl=vl;vl.default=vl;var bl={nanoid:(e=21)=>{let t=``,n=e;for(;n--;)t+=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`[Math.random()*64|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let r=``,i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r}};let{SourceMapConsumer:xl,SourceMapGenerator:Sl}=H,{existsSync:Cl,readFileSync:wl}=H,{dirname:Tl,join:El}=H;function Dl(e){return O?O.from(e,`base64`).toString():window.atob(e)}let Ol=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,`data:`);let n=t.map?t.map.prev:void 0,r=this.loadMap(t.from,n);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=Tl(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||=new xl(this.text),this.consumerCache}decodeInline(e){let t=/^data:application\/json;charset=utf-?8;base64,/,n=/^data:application\/json;base64,/;if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||n.test(e))return Dl(e.substr(RegExp.lastMatch.length));let r=e.match(/data:application\/json;([^,]+),/)[1];throw Error(`Unsupported source map encoding `+r)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,``).trim()}isMap(e){return typeof e==`object`?typeof e.mappings==`string`||typeof e._mappings==`string`||Array.isArray(e.sections):!1}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let n=e.lastIndexOf(t.pop()),r=e.indexOf(`*/`,n);n>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,r)))}loadFile(e){if(this.root=Tl(e),Cl(e))return this.mapFile=e,wl(e,`utf-8`).toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t==`string`)return t;if(typeof t==`function`){let n=t(e);if(n){let e=this.loadFile(n);if(!e)throw Error(`Unable to load previous source map: `+n.toString());return e}}else if(t instanceof xl)return Sl.fromSourceMap(t).toString();else if(t instanceof Sl)return t.toString();else if(this.isMap(t))return JSON.stringify(t);else throw Error(`Unsupported previous source map format: `+t.toString())}else if(this.inline)return this.decodeInline(this.annotation);else if(this.annotation){let t=this.annotation;return e&&(t=El(Tl(e),t)),this.loadFile(t)}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var kl=Ol;Ol.default=Ol;let{SourceMapConsumer:Al,SourceMapGenerator:jl}=H,{fileURLToPath:Ml,pathToFileURL:Nl}=H,{isAbsolute:Pl,resolve:Fl}=H,{nanoid:Il}=bl,Ll=H,Rl=el,zl=kl,Bl=Symbol(`fromOffsetCache`),Vl=!!(Al&&jl),Hl=!!(Fl&&Pl),Ul=class{constructor(e,t={}){if(e==null||typeof e==`object`&&!e.toString)throw Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]===``||this.css[0]===`￾`?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Hl||/^\w+:\/\//.test(t.from)||Pl(t.from)?this.file=t.from:this.file=Fl(t.from)),Hl&&Vl){let e=new zl(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id=`<input css `+Il(6)+`>`),this.map&&(this.map.file=this.from)}error(e,t,n,r={}){let i,a,o;if(t&&typeof t==`object`){let e=t,r=n;if(typeof e.offset==`number`){let r=this.fromOffset(e.offset);t=r.line,n=r.col}else t=e.line,n=e.column;if(typeof r.offset==`number`){let e=this.fromOffset(r.offset);a=e.line,o=e.col}else a=r.line,o=r.column}else if(!n){let e=this.fromOffset(t);t=e.line,n=e.col}let s=this.origin(t,n,a,o);return i=s?new Rl(e,s.endLine===void 0?s.line:{column:s.column,line:s.line},s.endLine===void 0?s.column:{column:s.endColumn,line:s.endLine},s.source,s.file,r.plugin):new Rl(e,a===void 0?t:{column:n,line:t},a===void 0?n:{column:o,line:a},this.css,this.file,r.plugin),i.input={column:n,endColumn:o,endLine:a,line:t,source:this.css},this.file&&(Nl&&(i.input.url=Nl(this.file).toString()),i.input.file=this.file),i}fromOffset(e){let t,n;if(this[Bl])n=this[Bl];else{let e=this.css.split(`
45
+ `);n=Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)n[r]=t,t+=e[r].length+1;this[Bl]=n}t=n[n.length-1];let r=0;if(e>=t)r=n.length-1;else{let t=n.length-2,i;for(;r<t;)if(i=r+(t-r>>1),e<n[i])t=i-1;else if(e>=n[i+1])r=i+1;else{r=i;break}}return{col:e-n[r]+1,line:r+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:Fl(this.map.consumer().sourceRoot||this.map.root||`.`,e)}origin(e,t,n,r){if(!this.map)return!1;let i=this.map.consumer(),a=i.originalPositionFor({column:t,line:e});if(!a.source)return!1;let o;typeof n==`number`&&(o=i.originalPositionFor({column:r,line:n}));let s;s=Pl(a.source)?Nl(a.source):new URL(a.source,this.map.consumer().sourceRoot||Nl(this.map.mapFile));let c={column:a.column,endColumn:o&&o.column,endLine:o&&o.line,line:a.line,url:s.toString()};if(s.protocol===`file:`)if(Ml)c.file=Ml(s);else throw Error(`file: protocol is not available in this PostCSS build`);let l=i.sourceContentFor(a.source);return l&&(c.source=l),c}toJSON(){let e={};for(let t of[`hasBOM`,`css`,`file`,`id`])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var Wl=Ul;Ul.default=Ul,Ll&&Ll.registerInput&&Ll.registerInput(Ul);let{SourceMapConsumer:Gl,SourceMapGenerator:Kl}=H,{dirname:ql,relative:Jl,resolve:Yl,sep:Xl}=H,{pathToFileURL:Zl}=H,Ql=Wl,$l=!!(Gl&&Kl),eu=!!(ql&&Yl&&Jl&&Xl);var tu=class{constructor(e,t,n,r){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=r,this.originalCSS=r,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?`data:application/json;base64,`+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation==`string`?this.mapOpts.annotation:typeof this.mapOpts.annotation==`function`?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+`.map`;let t=`
46
+ `;this.css.includes(`\r
47
+ `)&&(t=`\r
48
+ `),this.css+=t+`/*# sourceMappingURL=`+e+` */`}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),n=e.root||ql(e.file),r;this.mapOpts.sourcesContent===!1?(r=new Gl(e.text),r.sourcesContent&&=null):r=e.consumer(),this.map.applySourceMap(r,t,this.toUrl(this.path(n)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type===`comment`&&e.text.indexOf(`# sourceMappingURL=`)===0&&this.root.removeChild(t)}else this.css&&=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,``)}generate(){if(this.clearAnnotation(),eu&&$l&&this.isMap())return this.generateMap();{let e=``;return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Kl.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Kl({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):`<no source>`});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css=``,this.map=new Kl({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,n=`<no source>`,r={generated:{column:0,line:0},original:{column:0,line:0},source:``},i,a;this.stringify(this.root,(o,s,c)=>{if(this.css+=o,s&&c!==`end`&&(r.generated.line=e,r.generated.column=t-1,s.source&&s.source.start?(r.source=this.sourcePath(s),r.original.line=s.source.start.line,r.original.column=s.source.start.column-1,this.map.addMapping(r)):(r.source=n,r.original.line=1,r.original.column=0,this.map.addMapping(r))),i=o.match(/\n/g),i?(e+=i.length,a=o.lastIndexOf(`
49
+ `),t=o.length-a):t+=o.length,s&&c!==`start`){let i=s.parent||{raws:{}};(!(s.type===`decl`||s.type===`atrule`&&!s.nodes)||s!==i.last||i.raws.semicolon)&&(s.source&&s.source.end?(r.source=this.sourcePath(s),r.original.line=s.source.end.line,r.original.column=s.source.end.column-1,r.generated.line=e,r.generated.column=t-2,this.map.addMapping(r)):(r.source=n,r.original.line=1,r.original.column=0,r.generated.line=e,r.generated.column=t-1,this.map.addMapping(r)))}})}isAnnotation(){return this.isInline()?!0:this.mapOpts.annotation===void 0?this.previous().length?this.previous().some(e=>e.annotation):!0:this.mapOpts.annotation}isInline(){if(this.mapOpts.inline!==void 0)return this.mapOpts.inline;let e=this.mapOpts.annotation;return e!==void 0&&e!==!0?!1:this.previous().length?this.previous().some(e=>e.inline):!0}isMap(){return this.opts.map===void 0?this.previous().length>0:!!this.opts.map}isSourcesContent(){return this.mapOpts.sourcesContent===void 0?this.previous().length?this.previous().some(e=>e.withContent()):!0:this.mapOpts.sourcesContent}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):`to.css`}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let n=this.opts.to?ql(this.opts.to):`.`;typeof this.mapOpts.annotation==`string`&&(n=ql(Yl(n,this.mapOpts.annotation)));let r=Jl(n,e);return this.memoizedPaths.set(e,r),r}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Ql(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let r=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(r,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):`<no source>`;this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return O?O.from(e).toString(`base64`):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Zl){let t=Zl(e).toString();return this.memoizedFileURLs.set(e,t),t}else throw Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;Xl===`\\`&&(e=e.replace(/\\/g,`/`));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}};let nu=gl,ru=class extends nu{constructor(e){super(e),this.type=`comment`}};var iu=ru;ru.default=ru;let{isClean:au,my:ou}=tl,su=yl,cu=iu,lu=gl,uu,du,fu,pu;function mu(e){return e.map(e=>(e.nodes&&=mu(e.nodes),delete e.source,e))}function hu(e){if(e[au]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)hu(t)}let gu=class e extends lu{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),n,r;for(;this.indexes[t]<this.proxyOf.nodes.length&&(n=this.indexes[t],r=e(this.proxyOf.nodes[n],n),r!==!1);)this.indexes[t]+=1;return delete this.indexes[t],r}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||=0,this.indexes||={},this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t===`proxyOf`?e:e[t]?t===`each`||typeof t==`string`&&t.startsWith(`walk`)?(...n)=>e[t](...n.map(e=>typeof e==`function`?(t,n)=>e(t.toProxy(),n):e)):t===`every`||t===`some`?n=>e[t]((e,...t)=>n(e.toProxy(),...t)):t===`root`?()=>e.root().toProxy():t===`nodes`?e.nodes.map(e=>e.toProxy()):t===`first`||t===`last`?e[t].toProxy():e[t]:e[t]},set(e,t,n){return e[t]===n?!0:(e[t]=n,(t===`name`||t===`params`||t===`selector`)&&e.markDirty(),!0)}}}index(e){return typeof e==`number`?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let n=this.index(e),r=this.normalize(t,this.proxyOf.nodes[n]).reverse();n=this.index(e);for(let e of r)this.proxyOf.nodes.splice(n+1,0,e);let i;for(let e in this.indexes)i=this.indexes[e],n<i&&(this.indexes[e]=i+r.length);return this.markDirty(),this}insertBefore(e,t){let n=this.index(e),r=n===0?`prepend`:!1,i=this.normalize(t,this.proxyOf.nodes[n],r).reverse();n=this.index(e);for(let e of i)this.proxyOf.nodes.splice(n,0,e);let a;for(let e in this.indexes)a=this.indexes[e],n<=a&&(this.indexes[e]=a+i.length);return this.markDirty(),this}normalize(t,n){if(typeof t==`string`)t=mu(uu(t).nodes);else if(t===void 0)t=[];else if(Array.isArray(t)){t=t.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,`ignore`)}else if(t.type===`root`&&this.type!==`document`){t=t.nodes.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,`ignore`)}else if(t.type)t=[t];else if(t.prop){if(t.value===void 0)throw Error(`Value field is missed in node creation`);typeof t.value!=`string`&&(t.value=String(t.value)),t=[new su(t)]}else if(t.selector)t=[new du(t)];else if(t.name)t=[new fu(t)];else if(t.text)t=[new cu(t)];else throw Error(`Unknown node type in node creation`);return t.map(t=>(t[ou]||e.rebuild(t),t=t.proxyOf,t.parent&&t.parent.removeChild(t),t[au]&&hu(t),t.raws.before===void 0&&n&&n.raws.before!==void 0&&(t.raws.before=n.raws.before.replace(/\S/g,``)),t.parent=this.proxyOf,t))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,`prepend`).reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,n))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,n)=>{let r;try{r=e(t,n)}catch(e){throw t.addToError(e)}return r!==!1&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if(n.type===`atrule`&&e.test(n.name))return t(n,r)}):this.walk((n,r)=>{if(n.type===`atrule`&&n.name===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if(e.type===`atrule`)return t(e,n)}))}walkComments(e){return this.walk((t,n)=>{if(t.type===`comment`)return e(t,n)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if(n.type===`decl`&&e.test(n.prop))return t(n,r)}):this.walk((n,r)=>{if(n.type===`decl`&&n.prop===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if(e.type===`decl`)return t(e,n)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if(n.type===`rule`&&e.test(n.selector))return t(n,r)}):this.walk((n,r)=>{if(n.type===`rule`&&n.selector===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if(e.type===`rule`)return t(e,n)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};gu.registerParse=e=>{uu=e},gu.registerRule=e=>{du=e},gu.registerAtRule=e=>{fu=e},gu.registerRoot=e=>{pu=e};var _u=gu;gu.default=gu,gu.rebuild=e=>{e.type===`atrule`?Object.setPrototypeOf(e,fu.prototype):e.type===`rule`?Object.setPrototypeOf(e,du.prototype):e.type===`decl`?Object.setPrototypeOf(e,su.prototype):e.type===`comment`?Object.setPrototypeOf(e,cu.prototype):e.type===`root`&&Object.setPrototypeOf(e,pu.prototype),e[ou]=!0,e.nodes&&e.nodes.forEach(e=>{gu.rebuild(e)})};let vu=_u,yu,bu,xu=class extends vu{constructor(e){super({type:`document`,...e}),this.nodes||=[]}toResult(e={}){return new yu(new bu,this,e).stringify()}};xu.registerLazyResult=e=>{yu=e},xu.registerProcessor=e=>{bu=e};var Su=xu;xu.default=xu;let Cu=class{constructor(e,t={}){if(this.type=`warning`,this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+`: `+this.text:this.text}};var wu=Cu;Cu.default=Cu;let Tu=wu,Eu=class{constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let n=new Tu(e,t);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>e.type===`warning`)}get content(){return this.css}};var Du=Eu;Eu.default=Eu;let Ou=/[\t\n\f\r "#'()/;[\\\]{}]/g,ku=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Au=/.[\r\n"'(/\\]/,ju=/[\da-f]/i;var Mu=function(e,t={}){let n=e.css.valueOf(),r=t.ignoreErrors,i,a,o,s,c,l,u,d,f,p,m=n.length,h=0,g=[],_=[];function v(){return h}function y(t){throw e.error(`Unclosed `+t,h)}function b(){return _.length===0&&h>=m}function ee(e){if(_.length)return _.pop();if(h>=m)return;let t=e?e.ignoreUnclosed:!1;switch(i=n.charCodeAt(h),i){case 10:case 32:case 9:case 13:case 12:a=h;do a+=1,i=n.charCodeAt(a);while(i===32||i===10||i===9||i===13||i===12);p=[`space`,n.slice(h,a)],h=a-1;break;case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let e=String.fromCharCode(i);p=[e,e,h];break}case 40:if(d=g.length?g.pop()[1]:``,f=n.charCodeAt(h+1),d===`url`&&f!==39&&f!==34&&f!==32&&f!==10&&f!==9&&f!==12&&f!==13){a=h;do{if(l=!1,a=n.indexOf(`)`,a+1),a===-1)if(r||t){a=h;break}else y(`bracket`);for(u=a;n.charCodeAt(u-1)===92;)--u,l=!l}while(l);p=[`brackets`,n.slice(h,a+1),h,a],h=a}else a=n.indexOf(`)`,h+1),s=n.slice(h,a+1),a===-1||Au.test(s)?p=[`(`,`(`,h]:(p=[`brackets`,s,h,a],h=a);break;case 39:case 34:o=i===39?`'`:`"`,a=h;do{if(l=!1,a=n.indexOf(o,a+1),a===-1)if(r||t){a=h+1;break}else y(`string`);for(u=a;n.charCodeAt(u-1)===92;)--u,l=!l}while(l);p=[`string`,n.slice(h,a+1),h,a],h=a;break;case 64:Ou.lastIndex=h+1,Ou.test(n),a=Ou.lastIndex===0?n.length-1:Ou.lastIndex-2,p=[`at-word`,n.slice(h,a+1),h,a],h=a;break;case 92:for(a=h,c=!0;n.charCodeAt(a+1)===92;)a+=1,c=!c;if(i=n.charCodeAt(a+1),c&&i!==47&&i!==32&&i!==10&&i!==9&&i!==13&&i!==12&&(a+=1,ju.test(n.charAt(a)))){for(;ju.test(n.charAt(a+1));)a+=1;n.charCodeAt(a+1)===32&&(a+=1)}p=[`word`,n.slice(h,a+1),h,a],h=a;break;default:i===47&&n.charCodeAt(h+1)===42?(a=n.indexOf(`*/`,h+2)+1,a===0&&(r||t?a=n.length:y(`comment`)),p=[`comment`,n.slice(h,a+1),h,a],h=a):(ku.lastIndex=h+1,ku.test(n),a=ku.lastIndex===0?n.length-1:ku.lastIndex-2,p=[`word`,n.slice(h,a+1),h,a],g.push(p),h=a);break}return h++,p}function x(e){_.push(e)}return{back:x,endOfFile:b,nextToken:ee,position:v}};let Nu=_u,Pu=class extends Nu{constructor(e){super(e),this.type=`atrule`}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var Fu=Pu;Pu.default=Pu,Nu.registerAtRule(Pu);let Iu=_u,Lu,Ru,zu=class extends Iu{constructor(e){super(e),this.type=`root`,this.nodes||=[]}normalize(e,t,n){let r=super.normalize(e);if(t){if(n===`prepend`)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of r)e.raws.before=t.raws.before}return r}removeChild(e,t){let n=this.index(e);return!t&&n===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(e={}){return new Lu(new Ru,this,e).stringify()}};zu.registerLazyResult=e=>{Lu=e},zu.registerProcessor=e=>{Ru=e};var Bu=zu;zu.default=zu,Iu.registerRoot(zu);let Vu={comma(e){return Vu.split(e,[`,`],!0)},space(e){return Vu.split(e,[` `,`
50
+ `,` `])},split(e,t,n){let r=[],i=``,a=!1,o=0,s=!1,c=``,l=!1;for(let n of e)l?l=!1:n===`\\`?l=!0:s?n===c&&(s=!1):n===`"`||n===`'`?(s=!0,c=n):n===`(`?o+=1:n===`)`?o>0&&--o:o===0&&t.includes(n)&&(a=!0),a?(i!==``&&r.push(i.trim()),i=``,a=!1):i+=n;return(n||i!==``)&&r.push(i.trim()),r}};var Hu=Vu;Vu.default=Vu;let Uu=_u,Wu=Hu,Gu=class extends Uu{constructor(e){super(e),this.type=`rule`,this.nodes||=[]}get selectors(){return Wu.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,n=t?t[0]:`,`+this.raw(`between`,`beforeOpen`);this.selector=e.join(n)}};var Ku=Gu;Gu.default=Gu,Uu.registerRule(Gu);let qu=yl,Ju=Mu,Yu=iu,Xu=Fu,Zu=Bu,Qu=Ku,$u={empty:!0,space:!0};function ed(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var td=class{constructor(e){this.input=e,this.root=new Zu,this.current=this.root,this.spaces=``,this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new Xu;t.name=e[1].slice(1),t.name===``&&this.unnamedAtrule(t,e),this.init(t,e[2]);let n,r,i,a=!1,o=!1,s=[],c=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),n=e[0],n===`(`||n===`[`?c.push(n===`(`?`)`:`]`):n===`{`&&c.length>0?c.push(`}`):n===c[c.length-1]&&c.pop(),c.length===0)if(n===`;`){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(n===`{`){o=!0;break}else if(n===`}`){if(s.length>0){for(i=s.length-1,r=s[i];r&&r[0]===`space`;)r=s[--i];r&&(t.source.end=this.getPosition(r[3]||r[2]),t.source.end.offset++)}this.end(e);break}else s.push(e);else s.push(e);if(this.tokenizer.endOfFile()){a=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(s),s.length?(t.raws.afterName=this.spacesAndCommentsFromStart(s),this.raw(t,`params`,s),a&&(e=s[s.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between=``)):(t.raws.afterName=``,t.params=``),o&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let n=0,r;for(let i=t-1;i>=0&&(r=e[i],!(r[0]!==`space`&&(n+=1,n===2)));i--);throw this.input.error(`Missed semicolon`,r[0]===`word`?r[3]+1:r[2])}colon(e){let t=0,n,r,i;for(let[a,o]of e.entries()){if(n=o,r=n[0],r===`(`&&(t+=1),r===`)`&&--t,t===0&&r===`:`)if(!i)this.doubleColon(n);else if(i[0]===`word`&&i[1]===`progid`)continue;else return a;i=n}return!1}comment(e){let t=new Yu;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text=``,t.raws.left=n,t.raws.right=``;else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=Ju(this.input)}decl(e,t){let n=new qu;this.init(n,e[0][2]);let r=e[e.length-1];for(r[0]===`;`&&(this.semicolon=!0,e.pop()),n.source.end=this.getPosition(r[3]||r[2]||ed(e)),n.source.end.offset++;e[0][0]!==`word`;)e.length===1&&this.unknownWord(e),n.raws.before+=e.shift()[1];for(n.source.start=this.getPosition(e[0][2]),n.prop=``;e.length;){let t=e[0][0];if(t===`:`||t===`space`||t===`comment`)break;n.prop+=e.shift()[1]}n.raws.between=``;let i;for(;e.length;)if(i=e.shift(),i[0]===`:`){n.raws.between+=i[1];break}else i[0]===`word`&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1];(n.prop[0]===`_`||n.prop[0]===`*`)&&(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let a=[],o;for(;e.length&&(o=e[0][0],!(o!==`space`&&o!==`comment`));)a.push(e.shift());this.precheckMissedSemicolon(e);for(let t=e.length-1;t>=0;t--){if(i=e[t],i[1].toLowerCase()===`!important`){n.important=!0;let r=this.stringFrom(e,t);r=this.spacesFromEnd(e)+r,r!==` !important`&&(n.raws.important=r);break}else if(i[1].toLowerCase()===`important`){let r=e.slice(0),i=``;for(let e=t;e>0;e--){let t=r[e][0];if(i.trim().indexOf(`!`)===0&&t!==`space`)break;i=r.pop()[1]+i}i.trim().indexOf(`!`)===0&&(n.important=!0,n.raws.important=i,e=r)}if(i[0]!==`space`&&i[0]!==`comment`)break}e.some(e=>e[0]!==`space`&&e[0]!==`comment`)&&(n.raws.between+=a.map(e=>e[1]).join(``),a=[]),this.raw(n,`value`,a.concat(e),t),n.value.includes(`:`)&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error(`Double colon`,{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new Qu;this.init(t,e[2]),t.selector=``,t.raws.between=``,this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||``)+this.spaces,this.spaces=``,this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||``)+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&e.type===`rule`&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces=``)}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces=``,e.type!==`comment`&&(this.semicolon=!1)}other(e){let t=!1,n=null,r=!1,i=null,a=[],o=e[1].startsWith(`--`),s=[],c=e;for(;c;){if(n=c[0],s.push(c),n===`(`||n===`[`)i||=c,a.push(n===`(`?`)`:`]`);else if(o&&r&&n===`{`)i||=c,a.push(`}`);else if(a.length===0)if(n===`;`)if(r){this.decl(s,o);return}else break;else if(n===`{`){this.rule(s);return}else if(n===`}`){this.tokenizer.back(s.pop()),t=!0;break}else n===`:`&&(r=!0);else n===a[a.length-1]&&(a.pop(),a.length===0&&(i=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),a.length>0&&this.unclosedBracket(i),t&&r){if(!o)for(;s.length&&(c=s[s.length-1][0],!(c!==`space`&&c!==`comment`));)this.tokenizer.back(s.pop());this.decl(s,o)}else this.unknownWord(s)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case`space`:this.spaces+=e[1];break;case`;`:this.freeSemicolon(e);break;case`}`:this.end(e);break;case`comment`:this.comment(e);break;case`at-word`:this.atrule(e);break;case`{`:this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,n,r){let i,a,o=n.length,s=``,c=!0,l,u;for(let e=0;e<o;e+=1)i=n[e],a=i[0],a===`space`&&e===o-1&&!r?c=!1:a===`comment`?(u=n[e-1]?n[e-1][0]:`empty`,l=n[e+1]?n[e+1][0]:`empty`,!$u[u]&&!$u[l]?s.slice(-1)===`,`?c=!1:s+=i[1]:c=!1):s+=i[1];if(!c){let r=n.reduce((e,t)=>e+t[1],``);e.raws[t]={raw:r,value:s}}e[t]=s}rule(e){e.pop();let t=new Qu;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,`selector`,e),this.current=t}spacesAndCommentsFromEnd(e){let t,n=``;for(;e.length&&(t=e[e.length-1][0],!(t!==`space`&&t!==`comment`));)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n=``;for(;e.length&&(t=e[0][0],!(t!==`space`&&t!==`comment`));)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n=``;for(;e.length&&(t=e[e.length-1][0],t===`space`);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n=``;for(let r=t;r<e.length;r++)n+=e[r][1];return e.splice(t,e.length-t),n}unclosedBlock(){let e=this.current.source.start;throw this.input.error(`Unclosed block`,e.line,e.column)}unclosedBracket(e){throw this.input.error(`Unclosed bracket`,{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error(`Unexpected }`,{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error(`Unknown word`,{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error(`At-rule without name`,{offset:t[2]},{offset:t[2]+t[1].length})}};let nd=_u,rd=td,id=Wl;function ad(e,t){let n=new rd(new id(e,t));try{n.parse()}catch(e){throw e}return n.root}var od=ad;ad.default=ad,nd.registerParse(ad);let{isClean:sd,my:cd}=tl,ld=tu,ud=cl,dd=_u,fd=Su,pd=Du,md=od,hd=Bu,gd={atrule:`AtRule`,comment:`Comment`,decl:`Declaration`,document:`Document`,root:`Root`,rule:`Rule`},_d={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},vd={Once:!0,postcssPlugin:!0,prepare:!0};function yd(e){return typeof e==`object`&&typeof e.then==`function`}function bd(e){let t=!1,n=gd[e.type];return e.type===`decl`?t=e.prop.toLowerCase():e.type===`atrule`&&(t=e.name.toLowerCase()),t&&e.append?[n,n+`-`+t,0,n+`Exit`,n+`Exit-`+t]:t?[n,n+`-`+t,n+`Exit`,n+`Exit-`+t]:e.append?[n,0,n+`Exit`]:[n,n+`Exit`]}function xd(e){let t;return t=e.type===`document`?[`Document`,0,`DocumentExit`]:e.type===`root`?[`Root`,0,`RootExit`]:bd(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Sd(e){return e[sd]=!1,e.nodes&&e.nodes.forEach(e=>Sd(e)),e}let Cd={},wd=class e{constructor(t,n,r){this.stringified=!1,this.processed=!1;let i;if(typeof n==`object`&&n&&(n.type===`root`||n.type===`document`))i=Sd(n);else if(n instanceof e||n instanceof pd)i=Sd(n.root),n.map&&(r.map===void 0&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let e=md;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{i=e(n,r)}catch(e){this.processed=!0,this.error=e}i&&!i[cd]&&dd.rebuild(i)}this.result=new pd(t,i,r),this.helpers={...Cd,postcss:Cd,result:this.result},this.plugins=this.processor.plugins.map(e=>typeof e==`object`&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||=this.runAsync(),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw Error(`Use process(css).then(cb) to work with async plugins`)}handleError(e,t){let n=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,e.name===`CssSyntaxError`&&!e.plugin?(e.plugin=n.postcssPlugin,e.setMessage()):n.postcssVersion}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if(typeof t==`object`)for(let n in t){if(!_d[n]&&/^[A-Z]/.test(n))throw Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!vd[n])if(typeof t[n]==`object`)for(let r in t[n])r===`*`?e(t,n,t[n][r]):e(t,n+`-`+r.toLowerCase(),t[n][r]);else typeof t[n]==`function`&&e(t,n,t[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],n=this.runOnRoot(t);if(yd(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[sd];){e[sd]=!0;let t=[xd(e)];for(;t.length>0;){let e=this.visitTick(t);if(yd(e))try{await e}catch(e){let n=t[t.length-1].node;throw this.handleError(e,n)}}}if(this.listeners.OnceExit)for(let[t,n]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type===`document`){let t=e.nodes.map(e=>n(e,this.helpers));await Promise.all(t)}else await n(e,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e==`object`&&e.Once){if(this.result.root.type===`document`){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return yd(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e==`function`)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=ud;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new ld(t,this.result.root,this.result.opts).generate();return this.result.css=n[0],this.result.map=n[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins)if(yd(this.runOnRoot(e)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[sd];)e[sd]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type===`document`)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[n,r]of e){this.result.lastPlugin=n;let e;try{e=r(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if(t.type!==`root`&&t.type!==`document`&&!t.parent)return!0;if(yd(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:n,visitors:r}=t;if(n.type!==`root`&&n.type!==`document`&&!n.parent){e.pop();return}if(r.length>0&&t.visitorIndex<r.length){let[e,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(t.iterator!==0){let r=t.iterator,i;for(;i=n.nodes[n.indexes[r]];)if(n.indexes[r]+=1,!i[sd]){i[sd]=!0,e.push(xd(i));return}t.iterator=0,delete n.indexes[r]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,e===0){n.nodes&&n.nodes.length&&(n[sd]=!0,t.iterator=n.getIterator());return}else if(this.listeners[e]){t.visitors=this.listeners[e];return}}e.pop()}walkSync(e){e[sd]=!0;let t=bd(e);for(let n of t)if(n===0)e.nodes&&e.each(e=>{e[sd]||this.walkSync(e)});else{let t=this.listeners[n];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return`LazyResult`}};wd.registerPostcss=e=>{Cd=e};var Td=wd;wd.default=wd,hd.registerLazyResult(wd),fd.registerLazyResult(wd);let Ed=tu,Dd=cl,Od=od,kd=Du,Ad=class{constructor(e,t,n){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=n,this._map=void 0;let r=Dd;this.result=new kd(this._processor,void 0,this._opts),this.result.css=t;let i=this;Object.defineProperty(this.result,`root`,{get(){return i.root}});let a=new Ed(r,void 0,this._opts,t);if(a.isMap()){let[e,t]=a.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Od;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return`NoWorkResult`}};var jd=Ad;Ad.default=Ad;let Md=jd,Nd=Td,Pd=Su,Fd=Bu,Id=class{constructor(e=[]){this.version=`8.4.38`,this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(n.postcss===!0?n=n():n.postcss&&(n=n.postcss),typeof n==`object`&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if(typeof n==`object`&&n.postcssPlugin)t.push(n);else if(typeof n==`function`)t.push(n);else if(!(typeof n==`object`&&(n.parse||n.stringify)))throw Error(n+` is not a PostCSS plugin`);return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Md(this,e,t):new Nd(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var Ld=Id;Id.default=Id,Fd.registerProcessor(Id),Pd.registerProcessor(Id);let Rd=yl,zd=kl,Bd=iu,Vd=Fu,Hd=Wl,Ud=Bu,Wd=Ku;function Gd(e,t){if(Array.isArray(e))return e.map(e=>Gd(e));let{inputs:n,...r}=e;if(n){t=[];for(let e of n){let n={...e,__proto__:Hd.prototype};n.map&&={...n.map,__proto__:zd.prototype},t.push(n)}}if(r.nodes&&=e.nodes.map(e=>Gd(e,t)),r.source){let{inputId:e,...n}=r.source;r.source=n,e!=null&&(r.source.input=t[e])}if(r.type===`root`)return new Ud(r);if(r.type===`decl`)return new Rd(r);if(r.type===`rule`)return new Wd(r);if(r.type===`comment`)return new Bd(r);if(r.type===`atrule`)return new Vd(r);throw Error(`Unknown node type: `+e.type)}var Kd=Gd;Gd.default=Gd;let qd=el,Jd=yl,Yd=Td,Xd=_u,Zd=Ld,Qd=cl,$d=Kd,ef=Su,tf=wu,nf=iu,rf=Fu,af=Du,of=Wl,sf=od,cf=Hu,lf=Ku,uf=Bu,df=gl;function U(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Zd(e)}U.plugin=function(e,t){let n=!1;function r(...r){console&&console.warn&&!n&&(n=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:
51
+ https://evilmartians.com/chronicles/postcss-8-plugin-migration`),Vn.env.LANG&&Vn.env.LANG.startsWith(`cn`)&&console.warn(e+`: 里面 postcss.plugin 被弃用. 迁移指南:
52
+ https://www.w3ctech.com/topic/2226`));let i=t(...r);return i.postcssPlugin=e,i.postcssVersion=new Zd().version,i}let i;return Object.defineProperty(r,`postcss`,{get(){return i||=r(),i}}),r.process=function(e,t,n){return U([r(n)]).process(e,t)},r},U.stringify=Qd,U.parse=sf,U.fromJSON=$d,U.list=cf,U.comment=e=>new nf(e),U.atRule=e=>new rf(e),U.decl=e=>new Jd(e),U.rule=e=>new lf(e),U.root=e=>new uf(e),U.document=e=>new ef(e),U.CssSyntaxError=qd,U.Declaration=Jd,U.Container=Xd,U.Processor=Zd,U.Document=ef,U.Comment=nf,U.Warning=tf,U.AtRule=rf,U.Result=af,U.Input=of,U.Rule=lf,U.Root=uf,U.Node=df,Yd.registerPostcss(U);var ff=U;U.default=U;let W=Kc(ff);W.stringify,W.fromJSON,W.plugin,W.parse,W.list,W.document,W.comment,W.atRule,W.rule,W.decl,W.root,W.CssSyntaxError,W.Declaration,W.Container,W.Processor,W.Document,W.Comment,W.Warning,W.AtRule,W.Result,W.Input,W.Rule,W.Root,W.Node;var pf=class e{constructor(...e){B(this,`parentElement`,null),B(this,`parentNode`,null),B(this,`ownerDocument`),B(this,`firstChild`,null),B(this,`lastChild`,null),B(this,`previousSibling`,null),B(this,`nextSibling`,null),B(this,`ELEMENT_NODE`,1),B(this,`TEXT_NODE`,3),B(this,`nodeType`),B(this,`nodeName`),B(this,`RRNodeType`)}get childNodes(){let e=[],t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(t){if(!(t instanceof e)||t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(e){throw Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.`)}insertBefore(e,t){throw Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.`)}removeChild(e){throw Error(`RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.`)}toString(){return`RRNode`}};let mf={Node:[`childNodes`,`parentNode`,`parentElement`,`textContent`,`ownerDocument`],ShadowRoot:[`host`,`styleSheets`],Element:[`shadowRoot`,`querySelector`,`querySelectorAll`],MutationObserver:[]},hf={Node:[`contains`,`getRootNode`],ShadowRoot:[`getSelection`],Element:[],MutationObserver:[`constructor`]},gf={},_f=()=>!!globalThis.Zone;function vf(e){if(gf[e])return gf[e];let t=globalThis[e],n=t.prototype,r=e in mf?mf[e]:void 0,i=!!(r&&r.every(e=>!!(Object.getOwnPropertyDescriptor(n,e)?.get)?.toString().includes(`[native code]`))),a=e in hf?hf[e]:void 0,o=!!(a&&a.every(e=>typeof n[e]==`function`&&n[e]?.toString().includes(`[native code]`)));if(i&&o&&!_f())return gf[e]=t.prototype,t.prototype;try{let r=document.createElement(`iframe`);document.body.appendChild(r);let i=r.contentWindow;if(!i)return t.prototype;let a=i[e].prototype;return document.body.removeChild(r),a?gf[e]=a:n}catch{return n}}let yf={};function bf(e,t,n){let r=`${e}.${String(n)}`;if(yf[r])return yf[r].call(t);let i=vf(e),a=Object.getOwnPropertyDescriptor(i,n)?.get;return a?(yf[r]=a,a.call(t)):t[n]}let xf={};function Sf(e,t,n){let r=`${e}.${String(n)}`;if(xf[r])return xf[r].bind(t);let i=vf(e)[n];return typeof i==`function`?(xf[r]=i,i.bind(t)):t[n]}function Cf(e){return bf(`Node`,e,`ownerDocument`)}function wf(e){return bf(`Node`,e,`childNodes`)}function Tf(e){return bf(`Node`,e,`parentNode`)}function Ef(e){return bf(`Node`,e,`parentElement`)}function Df(e){return bf(`Node`,e,`textContent`)}function Of(e,t){return Sf(`Node`,e,`contains`)(t)}function kf(e){return Sf(`Node`,e,`getRootNode`)()}function Af(e){return!e||!(`host`in e)?null:bf(`ShadowRoot`,e,`host`)}function jf(e){return e.styleSheets}function Mf(e){return!e||!(`shadowRoot`in e)?null:bf(`Element`,e,`shadowRoot`)}function Nf(e,t){return bf(`Element`,e,`querySelector`)(t)}function Pf(e,t){return bf(`Element`,e,`querySelectorAll`)(t)}function Ff(){return vf(`MutationObserver`).constructor}function If(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],i=n(r);return typeof i==`function`&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}let G={ownerDocument:Cf,childNodes:wf,parentNode:Tf,parentElement:Ef,textContent:Df,contains:Of,getRootNode:kf,host:Af,styleSheets:jf,shadowRoot:Mf,querySelector:Nf,querySelectorAll:Pf,mutationObserver:Ff,patch:If};function K(e,t,n=document){let r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}let Lf=`Please stop import mirror directly. Instead of that,\r
53
+ now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
54
+ or you can use record.mirror to access the mirror instance during recording.`,Rf={map:{},getId(){return console.error(Lf),-1},getNode(){return console.error(Lf),null},removeNodeFromMap(){console.error(Lf)},has(){return console.error(Lf),!1},reset(){console.error(Lf)}};typeof window<`u`&&window.Proxy&&window.Reflect&&(Rf=new Proxy(Rf,{get(e,t,n){return t===`map`&&console.error(Lf),Reflect.get(e,t,n)}}));function zf(e,t,n={}){let r=null,i=0;return function(...a){let o=Date.now();!i&&n.leading===!1&&(i=o);let s=t-(o-i),c=this;s<=0||s>t?(r&&=(clearTimeout(r),null),i=o,e.apply(c,a)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{i=n.leading===!1?0:Date.now(),r=null,e.apply(c,a)},s))}}function Bf(e,t,n,r,i=window){let a=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),a&&a.set&&a.set.call(this,e)}}),()=>Bf(e,t,a||{},!0)}let Vf=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Vf=()=>new Date().getTime());function Hf(e){let t=e.document;return{left:t.scrollingElement?t.scrollingElement.scrollLeft:e.pageXOffset===void 0?t.documentElement.scrollLeft||t?.body&&G.parentElement(t.body)?.scrollLeft||t?.body?.scrollLeft||0:e.pageXOffset,top:t.scrollingElement?t.scrollingElement.scrollTop:e.pageYOffset===void 0?t?.documentElement.scrollTop||t?.body&&G.parentElement(t.body)?.scrollTop||t?.body?.scrollTop||0:e.pageYOffset}}function Uf(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Wf(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Gf(e){return e?e.nodeType===e.ELEMENT_NODE?e:G.parentElement(e):null}function q(e,t,n,r){if(!e)return!1;let i=Gf(e);if(!i)return!1;try{if(typeof t==`string`){if(i.classList.contains(t)||r&&i.closest(`.`+t)!==null)return!0}else if(da(i,t,r))return!0}catch{}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function Kf(e,t){return t.getId(e)!==-1}function qf(e,t,n){return e.tagName===`TITLE`&&n.headTitleMutations?!0:t.getId(e)===-2}function Jf(e,t){if(Ci(e))return!1;let n=t.getId(e);if(!t.has(n))return!0;let r=G.parentNode(e);return r&&r.nodeType===e.DOCUMENT_NODE?!1:r?Jf(r,t):!0}function Yf(e){return!!e.changedTouches}function Xf(e=window){`NodeList`in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),`DOMTokenList`in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Zf(e,t){return!!(e.nodeName===`IFRAME`&&t.getMeta(e))}function Qf(e,t){return!!(e.nodeName===`LINK`&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute(`rel`)===`stylesheet`&&t.getMeta(e))}function $f(e){return e?e instanceof pf&&`shadowRoot`in e?!!e.shadowRoot:!!G.shadowRoot(e):!1}var ep=class{constructor(){M(this,`id`,1),M(this,`styleIDMap`,new WeakMap),M(this,`idStyleMap`,new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=t===void 0?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function tp(e){let t=null;return`getRootNode`in e&&G.getRootNode(e)?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&G.host(G.getRootNode(e))&&(t=G.host(G.getRootNode(e))),t}function np(e){let t=e,n;for(;n=tp(t);)t=n;return t}function rp(e){let t=G.ownerDocument(e);if(!t)return!1;let n=np(e);return G.contains(t,n)}function ip(e){let t=G.ownerDocument(e);return t?G.contains(t,e)||rp(e):!1}var J=(e=>(e[e.DomContentLoaded=0]=`DomContentLoaded`,e[e.Load=1]=`Load`,e[e.FullSnapshot=2]=`FullSnapshot`,e[e.IncrementalSnapshot=3]=`IncrementalSnapshot`,e[e.Meta=4]=`Meta`,e[e.Custom=5]=`Custom`,e[e.Plugin=6]=`Plugin`,e))(J||{}),Y=(e=>(e[e.Mutation=0]=`Mutation`,e[e.MouseMove=1]=`MouseMove`,e[e.MouseInteraction=2]=`MouseInteraction`,e[e.Scroll=3]=`Scroll`,e[e.ViewportResize=4]=`ViewportResize`,e[e.Input=5]=`Input`,e[e.TouchMove=6]=`TouchMove`,e[e.MediaInteraction=7]=`MediaInteraction`,e[e.StyleSheetRule=8]=`StyleSheetRule`,e[e.CanvasMutation=9]=`CanvasMutation`,e[e.Font=10]=`Font`,e[e.Log=11]=`Log`,e[e.Drag=12]=`Drag`,e[e.StyleDeclaration=13]=`StyleDeclaration`,e[e.Selection=14]=`Selection`,e[e.AdoptedStyleSheet=15]=`AdoptedStyleSheet`,e[e.CustomElement=16]=`CustomElement`,e))(Y||{}),X=(e=>(e[e.MouseUp=0]=`MouseUp`,e[e.MouseDown=1]=`MouseDown`,e[e.Click=2]=`Click`,e[e.ContextMenu=3]=`ContextMenu`,e[e.DblClick=4]=`DblClick`,e[e.Focus=5]=`Focus`,e[e.Blur=6]=`Blur`,e[e.TouchStart=7]=`TouchStart`,e[e.TouchMove_Departed=8]=`TouchMove_Departed`,e[e.TouchEnd=9]=`TouchEnd`,e[e.TouchCancel=10]=`TouchCancel`,e))(X||{}),ap=(e=>(e[e.Mouse=0]=`Mouse`,e[e.Pen=1]=`Pen`,e[e.Touch=2]=`Touch`,e))(ap||{}),op=(e=>(e[e[`2D`]=0]=`2D`,e[e.WebGL=1]=`WebGL`,e[e.WebGL2=2]=`WebGL2`,e))(op||{}),sp=(e=>(e[e.Play=0]=`Play`,e[e.Pause=1]=`Pause`,e[e.Seeked=2]=`Seeked`,e[e.VolumeChange=3]=`VolumeChange`,e[e.RateChange=4]=`RateChange`,e))(sp||{}),cp=(e=>(e[e.Document=0]=`Document`,e[e.DocumentType=1]=`DocumentType`,e[e.Element=2]=`Element`,e[e.Text=3]=`Text`,e[e.CDATA=4]=`CDATA`,e[e.Comment=5]=`Comment`,e))(cp||{});function lp(e){return`__ln`in e}var up=class{constructor(){M(this,`length`,0),M(this,`head`,null),M(this,`tail`,null)}get(e){if(e>=this.length)throw Error(`Position outside of list range`);let t=this.head;for(let n=0;n<e;n++)t=t?.next||null;return t}addNode(e){let t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&lp(e.previousSibling)){let n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&lp(e.nextSibling)&&e.nextSibling.__ln.previous){let n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){let t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}};let dp=(e,t)=>`${e}@${t}`;var fp=class{constructor(){M(this,`frozen`,!1),M(this,`locked`,!1),M(this,`texts`,[]),M(this,`attributes`,[]),M(this,`attributeMap`,new WeakMap),M(this,`removes`,[]),M(this,`mapRemoves`,[]),M(this,`movedMap`,{}),M(this,`addedSet`,new Set),M(this,`movedSet`,new Set),M(this,`droppedSet`,new Set),M(this,`removesSubTreeCache`,new Set),M(this,`mutationCb`),M(this,`blockClass`),M(this,`blockSelector`),M(this,`maskTextClass`),M(this,`maskTextSelector`),M(this,`inlineStylesheet`),M(this,`maskInputOptions`),M(this,`maskTextFn`),M(this,`maskInputFn`),M(this,`keepIframeSrcFn`),M(this,`recordCanvas`),M(this,`inlineImages`),M(this,`slimDOMOptions`),M(this,`dataURLOptions`),M(this,`doc`),M(this,`mirror`),M(this,`iframeManager`),M(this,`stylesheetManager`),M(this,`shadowDomManager`),M(this,`canvasManager`),M(this,`processedNodeManager`),M(this,`unattachedDoc`),M(this,`processMutations`,e=>{e.forEach(this.processMutation),this.emit()}),M(this,`emit`,()=>{if(this.frozen||this.locked)return;let e=[],t=new Set,n=new up,r=e=>{let t=e,n=-2;for(;n===-2;)t&&=t.nextSibling,n=t&&this.mirror.getId(t);return n},i=i=>{let a=G.parentNode(i);if(!a||!ip(i))return;let o=!1;if(i.nodeType===Node.TEXT_NODE){let e=a.tagName;if(e===`TEXTAREA`)return;e===`STYLE`&&this.addedSet.has(a)&&(o=!0)}let s=Ci(a)?this.mirror.getId(tp(i)):this.mirror.getId(a),c=r(i);if(s===-1||c===-1)return n.addNode(i);let l=xa(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{Zf(e,this.mirror)&&this.iframeManager.addIframe(e),Qf(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),$f(i)&&this.shadowDomManager.addShadowRoot(G.shadowRoot(i),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)},cssCaptured:o});l&&(e.push({parentId:s,nextId:c,node:l}),t.add(l.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let e of this.movedSet)hp(this.removesSubTreeCache,e,this.mirror)&&!this.movedSet.has(G.parentNode(e))||i(e);for(let e of this.addedSet)!_p(this.droppedSet,e)&&!hp(this.removesSubTreeCache,e,this.mirror)||_p(this.movedSet,e)?i(e):this.droppedSet.add(e);let a=null;for(;n.length;){let e=null;if(a){let t=this.mirror.getId(G.parentNode(a.value)),n=r(a.value);t!==-1&&n!==-1&&(e=a)}if(!e){let t=n.tail;for(;t;){let n=t;if(t=t.previous,n){let t=this.mirror.getId(G.parentNode(n.value));if(r(n.value)===-1)continue;if(t!==-1){e=n;break}else{let t=n.value,r=G.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let t=G.host(r);if(this.mirror.getId(t)!==-1){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}a=e.previous,n.removeNode(e.value),i(e.value)}let o={texts:this.texts.map(e=>{let t=e.node,n=G.parentNode(t);return n&&n.tagName===`TEXTAREA`&&this.genTextAreaValueMutation(n),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>{let{attributes:t}=e;if(typeof t.style==`string`){let n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+r).split(`var(`).length===t.style.split(`var(`).length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};!o.texts.length&&!o.attributes.length&&!o.removes.length&&!o.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(o))}),M(this,`genTextAreaValueMutation`,e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let n=Array.from(G.childNodes(e),e=>G.textContent(e)||``).join(``);t.attributes.value=Pi({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Ri(e),value:n,maskInputFn:this.maskInputFn})}),M(this,`processMutation`,e=>{if(!qf(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case`characterData`:{let t=G.textContent(e.target);!q(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:fa(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Gf(e.target)):t.replace(/[\S]/g,`*`):t,node:e.target});break}case`attributes`:{let t=e.target,n=e.attributeName,r=e.target.getAttribute(n);if(n===`value`){let e=Ri(t);r=Pi({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(q(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let i=this.attributeMap.get(e.target);if(t.tagName===`IFRAME`&&n===`src`&&!this.keepIframeSrcFn(r))if(!t.contentDocument)n=`rr_src`;else return;if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),n===`type`&&t.tagName===`INPUT`&&(e.oldValue||``).toLowerCase()===`password`&&t.setAttribute(`data-rr-is-password`,`true`),!la(t.tagName,n))if(i.attributes[n]=ca(this.doc,Fi(t.tagName),Fi(n),r),n===`style`){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let n=this.unattachedDoc.createElement(`span`);e.oldValue&&n.setAttribute(`style`,e.oldValue);for(let e of Array.from(t.style)){let r=t.style.getPropertyValue(e),a=t.style.getPropertyPriority(e);r!==n.style.getPropertyValue(e)||a!==n.style.getPropertyPriority(e)?a===``?i.styleDiff[e]=r:i.styleDiff[e]=[r,a]:i._unchangedStyles[e]=[r,a]}for(let e of Array.from(n.style))t.style.getPropertyValue(e)===``&&(i.styleDiff[e]=!1)}else n===`open`&&t.tagName===`DIALOG`&&(t.matches(`dialog:modal`)?i.attributes.rr_open_mode=`modal`:i.attributes.rr_open_mode=`non-modal`);break}case`childList`:if(q(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName===`TEXTAREA`){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{let n=this.mirror.getId(t),r=Ci(e.target)?this.mirror.getId(G.host(e.target)):this.mirror.getId(e.target);q(e.target,this.blockClass,this.blockSelector,!1)||qf(t,this.mirror,this.slimDOMOptions)||!Kf(t,this.mirror)||(this.addedSet.has(t)?(pp(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&n===-1||Jf(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[dp(n,r)]?pp(this.movedSet,t):(this.removes.push({parentId:r,id:n,isShadow:Ci(e.target)&&wi(e.target)?!0:void 0}),mp(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}),M(this,`genAdds`,(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(qf(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&n!==-1&&(this.movedMap[dp(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);q(e,this.blockClass,this.blockSelector,!1)||(G.childNodes(e).forEach(e=>this.genAdds(e)),$f(e)&&G.childNodes(G.shadowRoot(e)).forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}})}init(e){[`mutationCb`,`blockClass`,`blockSelector`,`maskTextClass`,`maskTextSelector`,`inlineStylesheet`,`maskInputOptions`,`maskTextFn`,`maskInputFn`,`keepIframeSrcFn`,`recordCanvas`,`inlineImages`,`slimDOMOptions`,`dataURLOptions`,`doc`,`mirror`,`iframeManager`,`stylesheetManager`,`shadowDomManager`,`canvasManager`,`processedNodeManager`].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function pp(e,t){e.delete(t),G.childNodes(t).forEach(t=>pp(e,t))}function mp(e,t){let n=[e];for(;n.length;){let e=n.pop();t.has(e)||(t.add(e),G.childNodes(e).forEach(e=>n.push(e)))}}function hp(e,t,n){return e.size===0?!1:gp(e,t)}function gp(e,t,n){let r=G.parentNode(t);return r?e.has(r):!1}function _p(e,t){return e.size===0?!1:vp(e,t)}function vp(e,t){let n=G.parentNode(t);return n?e.has(n)?!0:vp(e,n):!1}let yp;function bp(e){yp=e}function xp(){yp=void 0}let Z=e=>yp?(...t)=>{try{return e(...t)}catch(e){if(yp&&yp(e)===!0)return;throw e}}:e,Sp=[];function Cp(e){try{if(`composedPath`in e){let t=e.composedPath();if(t.length)return t[0]}else if(`path`in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function wp(e,t){let n=new fp;Sp.push(n),n.init(e);let r=new(Ff())(Z(n.processMutations.bind(n)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function Tp({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(t.mousemove===!1)return()=>{};let i=typeof t.mousemove==`number`?t.mousemove:50,a=typeof t.mousemoveCallback==`number`?t.mousemoveCallback:500,o=[],s,c=zf(Z(t=>{let n=Date.now()-s;e(o.map(e=>(e.timeOffset-=n,e)),t),o=[],s=null}),a),l=Z(zf(Z(e=>{let t=Cp(e),{clientX:n,clientY:i}=Yf(e)?e.changedTouches[0]:e;s||=Vf(),o.push({x:n,y:i,id:r.getId(t),timeOffset:Vf()-s}),c(typeof DragEvent<`u`&&e instanceof DragEvent?Y.Drag:e instanceof MouseEvent?Y.MouseMove:Y.TouchMove)}),i,{trailing:!1})),u=[K(`mousemove`,l,n),K(`touchmove`,l,n),K(`drag`,l,n)];return Z(()=>{u.forEach(e=>e())})}function Ep({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:a}){if(a.mouseInteraction===!1)return()=>{};let o=a.mouseInteraction===!0||a.mouseInteraction===void 0?{}:a.mouseInteraction,s=[],c=null,l=t=>a=>{let o=Cp(a);if(q(o,r,i,!0))return;let s=null,l=t;if(`pointerType`in a){switch(a.pointerType){case`mouse`:s=ap.Mouse;break;case`touch`:s=ap.Touch;break;case`pen`:s=ap.Pen;break}s===ap.Touch?X[t]===X.MouseDown?l=`TouchStart`:X[t]===X.MouseUp&&(l=`TouchEnd`):ap.Pen}else Yf(a)&&(s=ap.Touch);s===null?X[t]===X.Click&&(s=c,c=null):(c=s,(l.startsWith(`Touch`)&&s===ap.Touch||l.startsWith(`Mouse`)&&s===ap.Mouse)&&(s=null));let u=Yf(a)?a.changedTouches[0]:a;if(!u)return;let d=n.getId(o),{clientX:f,clientY:p}=u;Z(e)({type:X[l],id:d,x:f,y:p,...s!==null&&{pointerType:s}})};return Object.keys(X).filter(e=>Number.isNaN(Number(e))&&!e.endsWith(`_Departed`)&&o[e]!==!1).forEach(e=>{let n=Fi(e),r=l(e);if(window.PointerEvent)switch(X[e]){case X.MouseDown:case X.MouseUp:n=n.replace(`mouse`,`pointer`);break;case X.TouchStart:case X.TouchEnd:return}s.push(K(n,r,t))}),Z(()=>{s.forEach(e=>e())})}function Dp({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:a}){return K(`scroll`,Z(zf(Z(a=>{let o=Cp(a);if(!o||q(o,r,i,!0))return;let s=n.getId(o);if(o===t&&t.defaultView){let n=Hf(t.defaultView);e({id:s,x:n.left,y:n.top})}else e({id:s,x:o.scrollLeft,y:o.scrollTop})}),a.scroll||100)),t)}function Op({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return K(`resize`,Z(zf(Z(()=>{let t=Uf(),i=Wf();(n!==t||r!==i)&&(e({width:Number(i),height:Number(t)}),n=t,r=i)}),200)),t)}let kp=[`INPUT`,`TEXTAREA`,`SELECT`],Ap=new WeakMap;function jp({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:a,ignoreSelector:o,maskInputOptions:s,maskInputFn:c,sampling:l,userTriggeredOnInput:u}){function d(e){let n=Cp(e),l=e.isTrusted,d=n&&n.tagName;if(n&&d===`OPTION`&&(n=G.parentElement(n)),!n||!d||kp.indexOf(d)<0||q(n,r,i,!0)||n.classList.contains(a)||o&&n.matches(o))return;let p=n.value,m=!1,h=Ri(n)||``;h===`radio`||h===`checkbox`?m=n.checked:(s[d.toLowerCase()]||s[h])&&(p=Pi({element:n,maskInputOptions:s,tagName:d,type:h,value:p,maskInputFn:c})),f(n,u?{text:p,isChecked:m,userTriggered:l}:{text:p,isChecked:m});let g=n.name;h===`radio`&&g&&m&&t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach(e=>{if(e!==n){let t=e.value;f(e,u?{text:t,isChecked:!m,userTriggered:!1}:{text:t,isChecked:!m})}})}function f(t,r){let i=Ap.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){Ap.set(t,r);let i=n.getId(t);Z(e)({...r,id:i})}}let p=(l.input===`last`?[`change`]:[`input`,`change`]).map(e=>K(e,Z(d),t)),m=t.defaultView;if(!m)return()=>{p.forEach(e=>e())};let h=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,`value`),g=[[m.HTMLInputElement.prototype,`value`],[m.HTMLInputElement.prototype,`checked`],[m.HTMLSelectElement.prototype,`value`],[m.HTMLTextAreaElement.prototype,`value`],[m.HTMLSelectElement.prototype,`selectedIndex`],[m.HTMLOptionElement.prototype,`selected`]];return h&&h.set&&p.push(...g.map(e=>Bf(e[0],e[1],{set(){Z(d)({target:this,isTrusted:!1})}},!1,m))),Z(()=>{p.forEach(e=>e())})}function Mp(e){let t=[];function n(e,t){if(Up(`CSSGroupingRule`)&&e.parentRule instanceof CSSGroupingRule||Up(`CSSMediaRule`)&&e.parentRule instanceof CSSMediaRule||Up(`CSSSupportsRule`)&&e.parentRule instanceof CSSSupportsRule||Up(`CSSConditionRule`)&&e.parentRule instanceof CSSConditionRule){let n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){let n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}return n(e,t)}function Np(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function Pp({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:Z((r,i,a)=>{let[o,s]=a,{id:c,styleId:l}=Np(i,t,n.styleMirror);return(c&&c!==-1||l&&l!==-1)&&e({id:c,styleId:l,adds:[{rule:o,index:s}]}),r.apply(i,a)})}),r.CSSStyleSheet.prototype.addRule=function(e,t,n=this.cssRules.length){let i=`${e} { ${t} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[i,n])};let a=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:Z((r,i,a)=>{let[o]=a,{id:s,styleId:c}=Np(i,t,n.styleMirror);return(s&&s!==-1||c&&c!==-1)&&e({id:s,styleId:c,removes:[{index:o}]}),r.apply(i,a)})}),r.CSSStyleSheet.prototype.removeRule=function(e){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[e])};let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:Z((r,i,a)=>{let[o]=a,{id:s,styleId:c}=Np(i,t,n.styleMirror);return(s&&s!==-1||c&&c!==-1)&&e({id:s,styleId:c,replace:o}),r.apply(i,a)})}));let s;r.CSSStyleSheet.prototype.replaceSync&&(s=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(s,{apply:Z((r,i,a)=>{let[o]=a,{id:s,styleId:c}=Np(i,t,n.styleMirror);return(s&&s!==-1||c&&c!==-1)&&e({id:s,styleId:c,replaceSync:o}),r.apply(i,a)})}));let c={};Wp(`CSSGroupingRule`)?c.CSSGroupingRule=r.CSSGroupingRule:(Wp(`CSSMediaRule`)&&(c.CSSMediaRule=r.CSSMediaRule),Wp(`CSSConditionRule`)&&(c.CSSConditionRule=r.CSSConditionRule),Wp(`CSSSupportsRule`)&&(c.CSSSupportsRule=r.CSSSupportsRule));let l={};return Object.entries(c).forEach(([r,i])=>{l[r]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=new Proxy(l[r].insertRule,{apply:Z((r,i,a)=>{let[o,s]=a,{id:c,styleId:l}=Np(i.parentStyleSheet,t,n.styleMirror);return(c&&c!==-1||l&&l!==-1)&&e({id:c,styleId:l,adds:[{rule:o,index:[...Mp(i),s||0]}]}),r.apply(i,a)})}),i.prototype.deleteRule=new Proxy(l[r].deleteRule,{apply:Z((r,i,a)=>{let[o]=a,{id:s,styleId:c}=Np(i.parentStyleSheet,t,n.styleMirror);return(s&&s!==-1||c&&c!==-1)&&e({id:s,styleId:c,removes:[{index:[...Mp(i),o]}]}),r.apply(i,a)})})}),Z(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=a,o&&(r.CSSStyleSheet.prototype.replace=o),s&&(r.CSSStyleSheet.prototype.replaceSync=s),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule})})}function Fp({mirror:e,stylesheetManager:t},n){let r=null;r=n.nodeName===`#document`?e.getId(n):e.getId(G.host(n));let i=n.nodeName===`#document`?n.defaultView?.Document:n.ownerDocument?.defaultView?.ShadowRoot,a=i?.prototype?Object.getOwnPropertyDescriptor(i?.prototype,`adoptedStyleSheets`):void 0;return r===null||r===-1||!i||!a?()=>{}:(Object.defineProperty(n,`adoptedStyleSheets`,{configurable:a.configurable,enumerable:a.enumerable,get(){return a.get?.call(this)},set(e){let n=a.set?.call(this,e);if(r!==null&&r!==-1)try{t.adoptStyleSheets(e,r)}catch{}return n}}),Z(()=>{Object.defineProperty(n,`adoptedStyleSheets`,{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function Ip({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){let a=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:Z((i,o,s)=>{let[c,l,u]=s;if(n.has(c))return a.apply(o,[c,l,u]);let{id:d,styleId:f}=Np(o.parentRule?.parentStyleSheet,t,r.styleMirror);return(d&&d!==-1||f&&f!==-1)&&e({id:d,styleId:f,set:{property:c,value:l,priority:u},index:Mp(o.parentRule)}),i.apply(o,s)})});let o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:Z((i,a,s)=>{let[c]=s;if(n.has(c))return o.apply(a,[c]);let{id:l,styleId:u}=Np(a.parentRule?.parentStyleSheet,t,r.styleMirror);return(l&&l!==-1||u&&u!==-1)&&e({id:l,styleId:u,remove:{property:c},index:Mp(a.parentRule)}),i.apply(a,s)})}),Z(()=>{i.CSSStyleDeclaration.prototype.setProperty=a,i.CSSStyleDeclaration.prototype.removeProperty=o})}function Lp({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:a}){let o=Z(a=>zf(Z(i=>{let o=Cp(i);if(!o||q(o,t,n,!0))return;let{currentTime:s,volume:c,muted:l,playbackRate:u,loop:d}=o;e({type:a,id:r.getId(o),currentTime:s,volume:c,muted:l,playbackRate:u,loop:d})}),i.media||500)),s=[K(`play`,o(sp.Play),a),K(`pause`,o(sp.Pause),a),K(`seeked`,o(sp.Seeked),a),K(`volumechange`,o(sp.VolumeChange),a),K(`ratechange`,o(sp.RateChange),a)];return Z(()=>{s.forEach(e=>e())})}function Rp({fontCb:e,doc:t}){let n=t.defaultView;if(!n)return()=>{};let r=[],i=new WeakMap,a=n.FontFace;n.FontFace=function(e,t,n){let r=new a(e,t,n);return i.set(r,{family:e,buffer:typeof t!=`string`,descriptors:n,fontSource:typeof t==`string`?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};let o=If(t.fonts,`add`,function(t){return function(n){return setTimeout(Z(()=>{let t=i.get(n);t&&(e(t),i.delete(n))}),0),t.apply(this,[n])}});return r.push(()=>{n.FontFace=a}),r.push(o),Z(()=>{r.forEach(e=>e())})}function zp(e){let{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:a}=e,o=!0,s=Z(()=>{let e=t.getSelection();if(!e||o&&e?.isCollapsed)return;o=e.isCollapsed||!1;let s=[],c=e.rangeCount||0;for(let t=0;t<c;t++){let{startContainer:a,startOffset:o,endContainer:c,endOffset:l}=e.getRangeAt(t);q(a,r,i,!0)||q(c,r,i,!0)||s.push({start:n.getId(a),startOffset:o,end:n.getId(c),endOffset:l})}a({ranges:s})});return s(),K(`selectionchange`,s)}function Bp({doc:e,customElementCb:t}){let n=e.defaultView;return!n||!n.customElements?()=>{}:If(n.customElements,`define`,function(e){return function(n,r,i){try{t({define:{name:n}})}catch{console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,r,i])}})}function Vp(e,t){let{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:a,viewportResizeCb:o,inputCb:s,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:u,canvasMutationCb:d,fontCb:f,selectionCb:p,customElementCb:m}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),i(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),a(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),o(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),s(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),f(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),m(...e)}}function Hp(e,t={}){let n=e.doc.defaultView;if(!n)return()=>{};Vp(e,t);let r;e.recordDOM&&(r=wp(e,e.doc));let i=Tp(e),a=Ep(e),o=Dp(e),s=Op(e,{win:n}),c=jp(e),l=Lp(e),u=()=>{},d=()=>{},f=()=>{},p=()=>{};e.recordDOM&&(u=Pp(e,{win:n}),d=Fp(e,e.doc),f=Ip(e,{win:n}),e.collectFonts&&(p=Rp(e)));let m=zp(e),h=Bp(e),g=[];for(let t of e.plugins)g.push(t.observer(t.callback,n,t.options));return Z(()=>{Sp.forEach(e=>e.reset()),r?.disconnect(),i(),a(),o(),s(),c(),l(),u(),d(),f(),p(),m(),h(),g.forEach(e=>e())})}function Up(e){return window[e]!==void 0}function Wp(e){return!!(window[e]!==void 0&&window[e].prototype&&`insertRule`in window[e].prototype&&`deleteRule`in window[e].prototype)}for(var Gp=class{constructor(e){M(this,`iframeIdToRemoteIdMap`,new WeakMap),M(this,`iframeRemoteIdToIdMap`,new WeakMap),this.generateIdFn=e}getId(e,t,n,r){let i=n||this.getIdToRemoteIdMap(e),a=r||this.getRemoteIdToIdMap(e),o=i.get(t);return o||(o=this.generateIdFn(),i.set(t,o),a.set(o,t)),o}getIds(e,t){let n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,n,r))}getRemoteId(e,t,n){let r=n||this.getRemoteIdToIdMap(e);return typeof t==`number`?r.get(t)||-1:t}getRemoteIds(e,t){let n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,n))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},Kp=class{constructor(e){M(this,`iframes`,new WeakMap),M(this,`crossOriginIframeMap`,new WeakMap),M(this,`crossOriginIframeMirror`,new Gp(Zi)),M(this,`crossOriginIframeStyleMirror`),M(this,`crossOriginIframeRootIdMap`,new WeakMap),M(this,`mirror`),M(this,`mutationCb`),M(this,`wrappedEmit`),M(this,`loadListener`),M(this,`stylesheetManager`),M(this,`recordCrossOriginIframes`),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Gp(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener(`message`,this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n,r;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((n=e.contentWindow)==null||n.addEventListener(`message`,this.handleMessage.bind(this))),(r=this.loadListener)==null||r.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){let t=e;if(t.data.type!==`rrweb`||t.origin!==t.data.origin||!e.source)return;let n=this.crossOriginIframeMap.get(e.source);if(!n)return;let r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case J.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:J.IncrementalSnapshot,data:{source:Y.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case J.Meta:case J.Load:case J.DomContentLoaded:return!1;case J.Plugin:return t;case J.Custom:return this.replaceIds(t.data.payload,e,[`id`,`parentId`,`previousId`,`nextId`]),t;case J.IncrementalSnapshot:switch(t.data.source){case Y.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,[`parentId`,`nextId`,`previousId`]),this.replaceIdOnNode(t.node,e);let n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,[`parentId`,`id`])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,[`id`])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,[`id`])}),t;case Y.Drag:case Y.TouchMove:case Y.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,[`id`])}),t;case Y.ViewportResize:return!1;case Y.MediaInteraction:case Y.MouseInteraction:case Y.Scroll:case Y.CanvasMutation:case Y.Input:return this.replaceIds(t.data,e,[`id`]),t;case Y.StyleSheetRule:case Y.StyleDeclaration:return this.replaceIds(t.data,e,[`id`]),this.replaceStyleIds(t.data,e,[`styleId`]),t;case Y.Font:return t;case Y.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,[`start`,`end`])}),t;case Y.AdoptedStyleSheet:return this.replaceIds(t.data,e,[`id`]),this.replaceStyleIds(t.data,e,[`styleIds`]),(n=t.data.styles)==null||n.forEach(t=>{this.replaceStyleIds(t,e,[`styleId`])}),t}}return!1}replace(e,t,n,r){for(let i of r)!Array.isArray(t[i])&&typeof t[i]!=`number`||(Array.isArray(t[i])?t[i]=e.getIds(n,t[i]):t[i]=e.getId(n,t[i]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,[`id`,`rootId`]),`childNodes`in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type!==cp.Document&&!e.rootId&&(e.rootId=t),`childNodes`in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}},qp=class{constructor(e){M(this,`shadowDoms`,new WeakSet),M(this,`mutationCb`),M(this,`scrollCb`),M(this,`bypassOptions`),M(this,`mirror`),M(this,`restoreHandlers`,[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!wi(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let n=wp({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(Dp({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(G.host(e))),this.restoreHandlers.push(Fp({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let n=this;this.restoreHandlers.push(If(e.prototype,`attachShadow`,function(e){return function(r){let i=e.call(this,r),a=G.shadowRoot(this);return a&&ip(this)&&n.addShadowRoot(a,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Jp=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Yp=typeof Uint8Array>`u`?[]:new Uint8Array(256),Xp=0;Xp<Jp.length;Xp++)Yp[Jp.charCodeAt(Xp)]=Xp;var Zp=function(e){var t=new Uint8Array(e),n,r=t.length,i=``;for(n=0;n<r;n+=3)i+=Jp[t[n]>>2],i+=Jp[(t[n]&3)<<4|t[n+1]>>4],i+=Jp[(t[n+1]&15)<<2|t[n+2]>>6],i+=Jp[t[n+2]&63];return r%3==2?i=i.substring(0,i.length-1)+`=`:r%3==1&&(i=i.substring(0,i.length-2)+`==`),i};let Qp=new Map;function $p(e,t){let n=Qp.get(e);return n||(n=new Map,Qp.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}let em=(e,t,n)=>{if(!e||!(rm(e,t)||typeof e==`object`))return;let r=e.constructor.name,i=$p(n,r),a=i.indexOf(e);return a===-1&&(a=i.length,i.push(e)),a};function tm(e,t,n){if(e instanceof Array)return e.map(e=>tm(e,t,n));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:Zp(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[tm(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}else if(e instanceof HTMLCanvasElement)return{rr_type:`HTMLImageElement`,src:e.toDataURL()};else if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[tm(e.data,t,n),e.width,e.height]};else if(rm(e,t)||typeof e==`object`)return{rr_type:e.constructor.name,index:em(e,t,n)};return e}let nm=(e,t,n)=>e.map(e=>tm(e,t,n)),rm=(e,t)=>!![`WebGLActiveInfo`,`WebGLBuffer`,`WebGLFramebuffer`,`WebGLProgram`,`WebGLRenderbuffer`,`WebGLShader`,`WebGLShaderPrecisionFormat`,`WebGLTexture`,`WebGLUniformLocation`,`WebGLVertexArrayObject`,`WebGLVertexArrayObjectOES`].filter(e=>typeof t[e]==`function`).find(n=>e instanceof t[n]);function im(e,t,n,r){let i=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let o of a)try{if(typeof t.CanvasRenderingContext2D.prototype[o]!=`function`)continue;let a=If(t.CanvasRenderingContext2D.prototype,o,function(i){return function(...a){return q(this.canvas,n,r,!0)||setTimeout(()=>{let n=nm(a,t,this);e(this.canvas,{type:op[`2D`],property:o,args:n})},0),i.apply(this,a)}});i.push(a)}catch{let n=Bf(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:op[`2D`],property:o,args:[t],setter:!0})}});i.push(n)}return()=>{i.forEach(e=>e())}}function am(e){return e===`experimental-webgl`?`webgl`:e}function om(e,t,n,r){let i=[];try{let a=If(e.HTMLCanvasElement.prototype,`getContext`,function(e){return function(i,...a){if(!q(this,t,n,!0)){let e=am(i);if(`__context`in this||(this.__context=e),r&&[`webgl`,`webgl2`].includes(e))if(a[0]&&typeof a[0]==`object`){let e=a[0];e.preserveDrawingBuffer||=!0}else a.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[i,...a])}});i.push(a)}catch{console.error(`failed to patch HTMLCanvasElement.prototype.getContext`)}return()=>{i.forEach(e=>e())}}function sm(e,t,n,r,i,a){let o=[],s=Object.getOwnPropertyNames(e);for(let c of s)if(![`isContextLost`,`canvas`,`drawingBufferWidth`,`drawingBufferHeight`].includes(c))try{if(typeof e[c]!=`function`)continue;let s=If(e,c,function(e){return function(...o){let s=e.apply(this,o);if(em(s,a,this),`tagName`in this.canvas&&!q(this.canvas,r,i,!0)){let e={type:t,property:c,args:nm(o,a,this)};n(this.canvas,e)}return s}});o.push(s)}catch{let r=Bf(e,c,{set(e){n(this.canvas,{type:t,property:c,args:[e],setter:!0})}});o.push(r)}return o}function cm(e,t,n,r){let i=[];return i.push(...sm(t.WebGLRenderingContext.prototype,op.WebGL,e,n,r,t)),t.WebGL2RenderingContext!==void 0&&i.push(...sm(t.WebGL2RenderingContext.prototype,op.WebGL2,e,n,r,t)),()=>{i.forEach(e=>e())}}let lm=`KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=`,um=typeof window<`u`&&window.Blob&&new Blob([(e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0)))(lm)],{type:`text/javascript;charset=utf-8`});function dm(e){let t;try{if(t=um&&(window.URL||window.webkitURL).createObjectURL(um),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;base64,`+lm,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var fm=class{constructor(e){M(this,`pendingCanvasMutations`,new Map),M(this,`rafStamps`,{latestId:0,invokeId:null}),M(this,`mirror`),M(this,`mutationCb`),M(this,`resetObservers`),M(this,`frozen`,!1),M(this,`locked`,!1),M(this,`processMutation`,(e,t)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)});let{sampling:t=`all`,win:n,blockClass:r,blockSelector:i,recordCanvas:a,dataURLOptions:o}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&t===`all`&&this.initCanvasMutationObserver(n,r,i),a&&typeof t==`number`&&this.initCanvasFPSObserver(t,n,r,i,{dataURLOptions:o})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,n,r,i){let a=om(t,n,r,!0),o=new Map,s=new dm;s.onmessage=e=>{let{id:t}=e.data;if(o.set(t,!1),!(`base64`in e.data))return;let{base64:n,type:r,width:i,height:a}=e.data;this.mutationCb({id:t,type:op[`2D`],commands:[{property:`clearRect`,args:[0,0,i,a]},{property:`drawImage`,args:[{rr_type:`ImageBitmap`,args:[{rr_type:`Blob`,data:[{rr_type:`ArrayBuffer`,base64:n}],type:r}]},0,0]}]})};let c=1e3/e,l=0,u,d=()=>{let e=[];return t.document.querySelectorAll(`canvas`).forEach(t=>{q(t,n,r,!0)||e.push(t)}),e},f=e=>{if(l&&e-l<c){u=requestAnimationFrame(f);return}l=e,d().forEach(async e=>{let t=this.mirror.getId(e);if(o.get(t)||e.width===0||e.height===0)return;if(o.set(t,!0),[`webgl`,`webgl2`].includes(e.__context)){let t=e.getContext(e.__context);t?.getContextAttributes()?.preserveDrawingBuffer===!1&&t.clear(t.COLOR_BUFFER_BIT)}let n=await createImageBitmap(e);s.postMessage({id:t,bitmap:n,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[n])}),u=requestAnimationFrame(f)};u=requestAnimationFrame(f),this.resetObservers=()=>{a(),cancelAnimationFrame(u)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let r=om(e,t,n,!1),i=im(this.processMutation.bind(this),e,t,n),a=cm(this.processMutation.bind(this),e,t,n);this.resetObservers=()=>{r(),i(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(e);if(!n||t===-1)return;let r=n.map(e=>{let{type:t,...n}=e;return n}),{type:i}=n[0];this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}},pm=class{constructor(e){M(this,`trackedLinkElements`,new WeakSet),M(this,`mutationCb`),M(this,`adoptedStyleSheetCb`),M(this,`styleMirror`,new ep),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){`_cssText`in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let n={id:t,styleIds:[]},r=[];for(let t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),r.push({styleId:e,rules:Array.from(t.rules||CSSRule,(e,n)=>({rule:Oi(e,t.href),index:n}))})),n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},mm=class{constructor(){M(this,`nodeMap`,new WeakMap),M(this,`active`,!1)}inOtherBuffer(e,t){let n=this.nodeMap.get(e);return n&&Array.from(n).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}};let Q,hm,gm,_m=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement(`iframe`);document.body.appendChild(e),Array.from=e.contentWindow?.Array.from||Array.from,document.body.removeChild(e)}}catch(e){console.debug(`Unable to override Array.from`,e)}let $=Ni();function vm(e={}){let{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i=`rr-block`,blockSelector:a=null,ignoreClass:o=`rr-ignore`,ignoreSelector:s=null,maskTextClass:c=`rr-mask`,maskTextSelector:l=null,inlineStylesheet:u=!0,maskAllInputs:d,maskInputOptions:f,slimDOMOptions:p,maskInputFn:m,maskTextFn:h,hooks:g,packFn:_,sampling:v={},dataURLOptions:y={},mousemoveWait:b,recordDOM:ee=!0,recordCanvas:x=!1,recordCrossOriginIframes:te=!1,recordAfter:ne=e.recordAfter===`DOMContentLoaded`?e.recordAfter:`load`,userTriggeredOnInput:re=!1,collectFonts:ie=!1,inlineImages:S=!1,plugins:C,keepIframeSrcFn:w=()=>!1,ignoreCSSAttributes:ae=new Set([]),errorHandler:oe}=e;bp(oe);let se=te?window.parent===window:!0,ce=!1;if(!se)try{window.parent.document&&(ce=!1)}catch{ce=!0}if(se&&!t)throw Error(`emit function is required`);if(!se&&!ce)return()=>{};b!==void 0&&v.mousemove===void 0&&(v.mousemove=b),$.reset();let le=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f===void 0?{password:!0}:f,ue=ya(p);Xf();let de,fe=0,pe=e=>{for(let t of C||[])t.eventProcessor&&(e=t.eventProcessor(e));return _&&!ce&&(e=_(e)),e};Q=(e,i)=>{let a=e;if(a.timestamp=Vf(),Sp[0]?.isFrozen()&&a.type!==J.FullSnapshot&&!(a.type===J.IncrementalSnapshot&&a.data.source===Y.Mutation)&&Sp.forEach(e=>e.unfreeze()),se)t?.(pe(a),i);else if(ce){let e={type:`rrweb`,event:pe(a),origin:window.location.origin,isCheckout:i};window.parent.postMessage(e,`*`)}if(a.type===J.FullSnapshot)de=a,fe=0;else if(a.type===J.IncrementalSnapshot){if(a.data.source===Y.Mutation&&a.data.isAttachIframe)return;fe++;let e=r&&fe>=r,t=n&&a.timestamp-de.timestamp>n;(e||t)&&hm(!0)}};let me=e=>{Q({type:J.IncrementalSnapshot,data:{source:Y.Mutation,...e}})},he=e=>Q({type:J.IncrementalSnapshot,data:{source:Y.Scroll,...e}}),ge=e=>Q({type:J.IncrementalSnapshot,data:{source:Y.CanvasMutation,...e}}),_e=new pm({mutationCb:me,adoptedStyleSheetCb:e=>Q({type:J.IncrementalSnapshot,data:{source:Y.AdoptedStyleSheet,...e}})}),T=new Kp({mirror:$,mutationCb:me,stylesheetManager:_e,recordCrossOriginIframes:te,wrappedEmit:Q});for(let e of C||[])e.getMirror&&e.getMirror({nodeMirror:$,crossOriginIframeMirror:T.crossOriginIframeMirror,crossOriginIframeStyleMirror:T.crossOriginIframeStyleMirror});let ve=new mm;gm=new fm({recordCanvas:x,mutationCb:ge,win:window,blockClass:i,blockSelector:a,mirror:$,sampling:v.canvas,dataURLOptions:y});let ye=new qp({mutationCb:me,scrollCb:he,bypassOptions:{blockClass:i,blockSelector:a,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskInputOptions:le,dataURLOptions:y,maskTextFn:h,maskInputFn:m,recordCanvas:x,inlineImages:S,sampling:v,slimDOMOptions:ue,iframeManager:T,stylesheetManager:_e,canvasManager:gm,keepIframeSrcFn:w,processedNodeManager:ve},mirror:$});hm=(e=!1)=>{if(!ee)return;Q({type:J.Meta,data:{href:window.location.href,width:Wf(),height:Uf()}},e),_e.reset(),ye.init(),Sp.forEach(e=>e.lock());let t=Sa(document,{mirror:$,blockClass:i,blockSelector:a,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskAllInputs:le,maskTextFn:h,maskInputFn:m,slimDOM:ue,dataURLOptions:y,recordCanvas:x,inlineImages:S,onSerialize:e=>{Zf(e,$)&&T.addIframe(e),Qf(e,$)&&_e.trackLinkElement(e),$f(e)&&ye.addShadowRoot(G.shadowRoot(e),document)},onIframeLoad:(e,t)=>{T.attachIframe(e,t),ye.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{_e.attachLinkElement(e,t)},keepIframeSrcFn:w});if(!t)return console.warn(`Failed to snapshot the document`);Q({type:J.FullSnapshot,data:{node:t,initialOffset:Hf(window)}},e),Sp.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&_e.adoptStyleSheets(document.adoptedStyleSheets,$.getId(document))};try{let e=[],t=e=>Z(Hp)({mutationCb:me,mousemoveCb:(e,t)=>Q({type:J.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Q({type:J.IncrementalSnapshot,data:{source:Y.MouseInteraction,...e}}),scrollCb:he,viewportResizeCb:e=>Q({type:J.IncrementalSnapshot,data:{source:Y.ViewportResize,...e}}),inputCb:e=>Q({type:J.IncrementalSnapshot,data:{source:Y.Input,...e}}),mediaInteractionCb:e=>Q({type:J.IncrementalSnapshot,data:{source:Y.MediaInteraction,...e}}),styleSheetRuleCb:e=>Q({type:J.IncrementalSnapshot,data:{source:Y.StyleSheetRule,...e}}),styleDeclarationCb:e=>Q({type:J.IncrementalSnapshot,data:{source:Y.StyleDeclaration,...e}}),canvasMutationCb:ge,fontCb:e=>Q({type:J.IncrementalSnapshot,data:{source:Y.Font,...e}}),selectionCb:e=>{Q({type:J.IncrementalSnapshot,data:{source:Y.Selection,...e}})},customElementCb:e=>{Q({type:J.IncrementalSnapshot,data:{source:Y.CustomElement,...e}})},blockClass:i,ignoreClass:o,ignoreSelector:s,maskTextClass:c,maskTextSelector:l,maskInputOptions:le,inlineStylesheet:u,sampling:v,recordDOM:ee,recordCanvas:x,inlineImages:S,userTriggeredOnInput:re,collectFonts:ie,doc:e,maskInputFn:m,maskTextFn:h,keepIframeSrcFn:w,blockSelector:a,slimDOMOptions:ue,dataURLOptions:y,mirror:$,iframeManager:T,stylesheetManager:_e,shadowDomManager:ye,processedNodeManager:ve,canvasManager:gm,ignoreCSSAttributes:ae,plugins:(C?.filter(e=>e.observer))?.map(e=>({observer:e.observer,options:e.options,callback:t=>Q({type:J.Plugin,data:{plugin:e.name,payload:t}})}))||[]},g);T.addLoadListener(n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}});let n=()=>{hm(),e.push(t(document)),_m=!0};return[`interactive`,`complete`].includes(document.readyState)?n():(e.push(K(`DOMContentLoaded`,()=>{Q({type:J.DomContentLoaded,data:{}}),ne===`DOMContentLoaded`&&n()})),e.push(K(`load`,()=>{Q({type:J.Load,data:{}}),ne===`load`&&n()},window))),()=>{e.forEach(e=>{try{e()}catch(e){String(e).toLowerCase().includes(`cross-origin`)||console.warn(e)}}),ve.destroy(),_m=!1,xp()}}catch(e){console.warn(e)}}vm.addCustomEvent=(e,t)=>{if(!_m)throw Error(`please add custom event after start recording`);Q({type:J.Custom,data:{tag:e,payload:t}})},vm.freezePage=()=>{Sp.forEach(e=>e.freeze())},vm.takeFullSnapshot=e=>{if(!_m)throw Error(`please take full snapshot after start recording`);hm(e)},vm.mirror=$;var ym;(function(e){e[e.NotStarted=0]=`NotStarted`,e[e.Running=1]=`Running`,e[e.Stopped=2]=`Stopped`})(ym||={});let{addCustomEvent:bm}=vm,{freezePage:xm}=vm,{takeFullSnapshot:Sm}=vm;var Cm=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)}},wm=class{constructor(e){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.2.0`,this.api=new Cm({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){return this.log(`track event`,e,t),this.send({type:`track`,payload:{name:e,profileId:t?.profileId??this.profileId,properties:{...this.global??{},...t??{}}}})}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}}})}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.deviceId=void 0,this.sessionId=void 0}flush(){let e=[];for(let t of this.queue){if(this.shouldQueue(t)){e.push(t);continue}let n=t.type===`replay`?t.payload:{...t.payload,profileId:`profileId`in t.payload?t.payload.profileId??this.profileId:this.profileId};this.send({...t,payload:n})}this.queue=e}log(...e){this.options.debug&&console.log(`[OpenPanel.dev]`,...e)}},Tm=Object.defineProperty,Em=(e,t)=>()=>(e&&(t=e(e=0)),t),Dm=(e,t)=>{for(var n in t)Tm(e,n,{get:t[n],enumerable:!0})};function Om(e,t){if(typeof document>`u`||typeof window>`u`)return;Am&&Am();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=vm({emit(e,t){a.push(e),l(!!t)},checkoutEveryNms:r,maskAllInputs:e.maskAllInputs??!0,maskTextSelector:e.maskTextSelector??`[data-openpanel-replay-mask]`,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 d(){document.visibilityState===`hidden`&&a.length>0&&c(a.some(e=>e.type===2))}function f(){a.length>0&&c(a.some(e=>e.type===2))}document.addEventListener(`visibilitychange`,d),window.addEventListener(`pagehide`,f),Am=()=>{a.length>0&&c(a.some(e=>e.type===2)),s&&=(clearInterval(s),null),document.removeEventListener(`visibilitychange`,d),window.removeEventListener(`pagehide`,f),u?.(),Am=null}}function km(){Am&&Am()}var Am,jm=Em(()=>{"use strict";Am=null}),Mm={};Dm(Mm,{startReplayRecorder:()=>Om,stopReplayRecorder:()=>km});var Nm=Em(()=>{"use strict";jm()}),Pm=typeof document<`u`?document.currentScript:null;function Fm(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var Im=class extends wm{constructor(e){if(super({sdk:`web`,sdkVersion:`1.2.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=Pm,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(()=>(Nm(),Mm))}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[Fm(t.name.replace(/^data-/,``))]=t.value);let t=i.getAttribute(`data-track`);t&&super.track(t,e)}})}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 Lm(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 Rm=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:0:-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 $e?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
55
  Debug Information:
4
56
  -----------------
5
57
  Timestamp: ${t.timestamp}
@@ -11,4 +63,4 @@ var FrakSDK=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Modu
11
63
  Last Response: ${t.lastResponse}
12
64
  Client Status: ${t.clientStatus}
13
65
  Error: ${t.error}
14
- `.trim()}};let At=(()=>{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 jt(e){e?localStorage.setItem(W,e):localStorage.removeItem(W)}function Mt(e,t,n,r){let i=new URL(window.location.href),a=i.searchParams.get(`fmt`)??void 0;e.contentWindow?.postMessage({clientLifecycle:`handshake-response`,data:{token:t,currentUrl:window.location.href,pendingMergeToken:a,configDomain:r,clientId:u()}},n),a&&(i.searchParams.delete(`fmt`),window.history.replaceState({},``,i.toString()))}function Nt(e,t){try{let n=new URL(e);return n.searchParams.has(`u`)?(n.searchParams.delete(`u`),n.searchParams.append(`u`,window.location.href),t&&n.searchParams.append(`fmt`,t),n.toString()):e}catch{return e}}function Pt(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 Ft(e){return e.includes(`/common/social`)}function It(e,t,n,r){if(G(t)){let i=Nt(t,r);$e(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(At&&Ft(t))Pt(r);else{let e=Nt(t,r);window.location.href=e}}function Lt({iframe:e,targetOrigin:t,configDomain:n}){let r=new F;return{handleEvent:async i=>{if(!(`iframeLifecycle`in i))return;let{iframeLifecycle:a,data:o}=i;switch(a){case`connected`:r.resolve(!0);break;case`do-backup`:jt(o.backup);break;case`remove-backup`:localStorage.removeItem(W);break;case`show`:case`hide`:ut({iframe:e,isVisible:a===`show`});break;case`handshake`:Mt(e,o.token,t,n);break;case`redirect`:It(e,o.baseRedirectUrl,t,o.mergeToken);break}},isConnected:r.promise}}function Rt({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=Lt({iframe:t,targetOrigin:n,configDomain:e.domain}),i=new kt(e,t);if(!t.contentWindow)throw new P(He.configError,`The iframe does not have a content window`);let a=Ue({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await r.isConnected)throw new P(He.clientNotConnected,`The iframe provider isn't connected yet`);return t}},{onRequest(e,t){return i.setLastRequest(e),t},onResponse(e,t){return i.setLastResponse(e,t),t}}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await r.handleEvent(e)}}}),o=zt(a,r),s=async()=>{o(),a.cleanup(),t.remove()},c;console.log(`[Frak SDK] Initializing OpenPanel`),c=new Dt({apiUrl:`https://op-api.gcp.frak.id`,clientId:`6eacc8d7-49ac-4936-95e9-81ef29449570`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>(e!==`track`||!t?.properties||`sdkVersion`in t.properties||(t.properties={...t.properties,sdkVersion:`0.2.0`,userAnonymousClientId:u()}),!0)}),c.setGlobalProperties({sdkVersion:`0.2.0`,userAnonymousClientId:u()}),c.init();let l=Bt({config:e,rpcClient:a,lifecycleManager:r}).then(()=>i.updateSetupStatus(!0));return{config:e,debugInfo:i,waitForConnection:r.isConnected,waitForSetup:l,request:a.request,listenerRequest:a.listen,destroy:s,openPanel:c}}function zt(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 Bt({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,Ot(t,n.isConnected);async function r(){let n=e.customizations?.css;if(!n)return;let r={clientLifecycle:`modal-css`,data:{cssLink:n}};t.sendLifecycle(r)}async function i(){let n=e.customizations?.i18n;if(!n)return;let r={clientLifecycle:`modal-i18n`,data:{i18n:n}};t.sendLifecycle(r)}async function a(){if(typeof window>`u`)return;let e=window.localStorage.getItem(W);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([r(),i(),a()])}async function Vt({config:e}){let t=Ht(e),n=await lt({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=Rt({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function Ht(e){let t=Y(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}return e.DEEP_LINK_SCHEME=Xe,e.DebugInfoGatherer=kt,e.FrakContextManager=q,e.base64urlDecode=L,e.base64urlEncode=I,e.baseIframeProps=X,e.clearMerchantIdCache=ee,e.compressJsonToB64=R,e.computeLegacyProductId=Ve,e.createIFrameFrakClient=Rt,e.createIframe=lt,e.decompressJsonFromB64=Ye,e.displayEmbeddedWallet=n,e.displayModal=r,e.ensureIdentity=_,e.fetchMerchantId=m,e.findIframeInOpener=dt,e.formatAmount=st,e.generateSsoUrl=z,e.getBackendUrl=s,e.getClientId=u,e.getCurrencyAmountKey=ct,e.getMerchantInformation=te,e.getSupportedCurrency=Y,e.getSupportedLocale=ot,e.isChromiumAndroid=Ze,e.isFrakDeepLink=G,e.isV1Context=H,e.isV2Context=U,e.locales=J,e.modalBuilder=bt,e.openSso=qe,e.prepareSso=Je,e.processReferral=ht,e.referralInteraction=gt,e.resolveMerchantId=g,e.sendInteraction=Q,e.sendTransaction=xt,e.setupClient=Vt,e.siweAuthenticate=Ct,e.ssoPopupFeatures=B,e.ssoPopupName=V,e.toAndroidIntentUrl=Qe,e.trackEvent=Z,e.trackPurchaseStatus=_t,e.triggerDeepLinkWithFallback=$e,e.watchWalletStatus=vt,e})({});
66
+ `.trim()}};let zm=(()=>{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 Bm(e){e?localStorage.setItem(gt,e):localStorage.removeItem(gt)}function Vm(e,t,n,r){let i=new URL(window.location.href),a=i.searchParams.get(`fmt`)??void 0;e.contentWindow?.postMessage({clientLifecycle:`handshake-response`,data:{token:t,currentUrl:window.location.href,pendingMergeToken:a,configDomain:r,clientId:u()}},n),a&&(i.searchParams.delete(`fmt`),window.history.replaceState({},``,i.toString()))}function Hm(e,t){try{let n=new URL(e);return n.searchParams.has(`u`)?(n.searchParams.delete(`u`),n.searchParams.append(`u`,window.location.href),t&&n.searchParams.append(`fmt`,t),n.toString()):e}catch{return e}}function Um(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 Wm(e){return e.includes(`/common/social`)}function Gm(e,t,n,r){if(xt(t)){let i=Hm(t,r);bt(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(zm&&Wm(t))Um(r);else{let e=Hm(t,r);window.location.href=e}}function Km({iframe:e,targetOrigin:t,configDomain:n}){let r=new et;return{handleEvent:async i=>{if(!(`iframeLifecycle`in i))return;let{iframeLifecycle:a,data:o}=i;switch(a){case`connected`:r.resolve(!0);break;case`do-backup`:Bm(o.backup);break;case`remove-backup`:localStorage.removeItem(gt);break;case`show`:case`hide`:Lt({iframe:e,isVisible:a===`show`});break;case`handshake`:Vm(e,o.token,t,n);break;case`redirect`:Gm(e,o.baseRedirectUrl,t,o.mergeToken);break}},isConnected:r.promise}}function qm({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=Km({iframe:t,targetOrigin:n,configDomain:e.domain}),i=new Rm(e,t);if(!t.contentWindow)throw new $e(Qe.configError,`The iframe does not have a content window`);let a=tt({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await r.isConnected)throw new $e(Qe.clientNotConnected,`The iframe provider isn't connected yet`);return t}},{onRequest(e,t){return i.setLastRequest(e),t},onResponse(e,t){return i.setLastResponse(e,t),t}}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await r.handleEvent(e)}}}),o=Jm(a,r),s=async()=>{o(),a.cleanup(),t.remove()},c;console.log(`[Frak SDK] Initializing OpenPanel`),c=new Im({apiUrl:`https://op-api.gcp.frak.id`,clientId:`6eacc8d7-49ac-4936-95e9-81ef29449570`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>(e!==`track`||!t?.properties||`sdkVersion`in t.properties||(t.properties={...t.properties,sdkVersion:`0.2.1`,userAnonymousClientId:u()}),!0)}),c.setGlobalProperties({sdkVersion:`0.2.1`,userAnonymousClientId:u()}),c.init();let l=Ym({config:e,rpcClient:a,lifecycleManager:r}).then(()=>i.updateSetupStatus(!0));return{config:e,debugInfo:i,waitForConnection:r.isConnected,waitForSetup:l,request:a.request,listenerRequest:a.listen,destroy:s,openPanel:c}}function Jm(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 Ym({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,Lm(t,n.isConnected);async function r(){let n=e.customizations?.css;if(!n)return;let r={clientLifecycle:`modal-css`,data:{cssLink:n}};t.sendLifecycle(r)}async function i(){let n=e.customizations?.i18n;if(!n)return;let r={clientLifecycle:`modal-i18n`,data:{i18n:n}};t.sendLifecycle(r)}async function a(){if(typeof window>`u`)return;let e=window.localStorage.getItem(gt);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([r(),i(),a()])}async function Xm({config:e}){let t=Zm(e),n=await It({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=qm({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function Zm(e){let t=jt(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}return e.DEEP_LINK_SCHEME=_t,e.DebugInfoGatherer=Rm,e.FrakContextManager=kt,e.base64urlDecode=at,e.base64urlEncode=it,e.baseIframeProps=Ft,e.clearMerchantIdCache=g,e.compressJsonToB64=ot,e.computeLegacyProductId=Ze,e.createIFrameFrakClient=qm,e.createIframe=It,e.decompressJsonFromB64=ht,e.displayEmbeddedWallet=n,e.displayModal=r,e.ensureIdentity=v,e.fetchMerchantId=m,e.findIframeInOpener=Rt,e.formatAmount=Nt,e.generateSsoUrl=st,e.getBackendUrl=s,e.getClientId=u,e.getCurrencyAmountKey=Pt,e.getMerchantInformation=y,e.getSupportedCurrency=jt,e.getSupportedLocale=Mt,e.isChromiumAndroid=vt,e.isFrakDeepLink=xt,e.isV1Context=pt,e.isV2Context=mt,e.locales=At,e.modalBuilder=Yt,e.openSso=dt,e.prepareSso=ft,e.processReferral=Wt,e.referralInteraction=Gt,e.resolveMerchantId=_,e.sendInteraction=Bt,e.sendTransaction=Zt,e.setupClient=Xm,e.siweAuthenticate=$t,e.ssoPopupFeatures=lt,e.ssoPopupName=ut,e.toAndroidIntentUrl=yt,e.trackEvent=zt,e.trackPurchaseStatus=Kt,e.triggerDeepLinkWithFallback=bt,e.watchWalletStatus=qt,e})({});
package/dist/bundle.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./trackEvent-Ew5r5zfI.cjs`),t=require(`./setupClient-nl8Dhh4V.cjs`),n=require(`./siweAuthenticate-BWmI2_TN.cjs`);exports.DEEP_LINK_SCHEME=t.g,exports.DebugInfoGatherer=t.r,exports.FrakContextManager=e.a,exports.base64urlDecode=e.h,exports.base64urlEncode=e.g,exports.baseIframeProps=t.i,exports.clearMerchantIdCache=e.n,exports.compressJsonToB64=e.m,exports.computeLegacyProductId=e._,exports.createIFrameFrakClient=t.n,exports.createIframe=t.a,exports.decompressJsonFromB64=e.c,exports.displayEmbeddedWallet=n.p,exports.displayModal=n.f,exports.ensureIdentity=n.d,exports.fetchMerchantId=e.r,exports.findIframeInOpener=t.o,exports.formatAmount=t.c,exports.generateSsoUrl=e.p,exports.getBackendUrl=e.l,exports.getClientId=e.v,exports.getCurrencyAmountKey=t.s,exports.getMerchantInformation=n.u,exports.getSupportedCurrency=t.u,exports.getSupportedLocale=t.l,exports.isChromiumAndroid=t.f,exports.isFrakDeepLink=t.p,exports.isV1Context=e.o,exports.isV2Context=e.s,exports.locales=t.d,exports.modalBuilder=n.r,exports.openSso=e.u,exports.prepareSso=n.l,exports.processReferral=n.s,exports.referralInteraction=n.o,exports.resolveMerchantId=e.i,exports.sendInteraction=n.c,exports.sendTransaction=n.n,exports.setupClient=t.t,exports.siweAuthenticate=n.t,exports.ssoPopupFeatures=e.d,exports.ssoPopupName=e.f,exports.toAndroidIntentUrl=t.m,exports.trackEvent=e.t,exports.trackPurchaseStatus=n.a,exports.triggerDeepLinkWithFallback=t.h,exports.watchWalletStatus=n.i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./trackEvent-Ew5r5zfI.cjs`),t=require(`./setupClient-CqTHGvVa.cjs`),n=require(`./siweAuthenticate-BWmI2_TN.cjs`);exports.DEEP_LINK_SCHEME=t.g,exports.DebugInfoGatherer=t.r,exports.FrakContextManager=e.a,exports.base64urlDecode=e.h,exports.base64urlEncode=e.g,exports.baseIframeProps=t.i,exports.clearMerchantIdCache=e.n,exports.compressJsonToB64=e.m,exports.computeLegacyProductId=e._,exports.createIFrameFrakClient=t.n,exports.createIframe=t.a,exports.decompressJsonFromB64=e.c,exports.displayEmbeddedWallet=n.p,exports.displayModal=n.f,exports.ensureIdentity=n.d,exports.fetchMerchantId=e.r,exports.findIframeInOpener=t.o,exports.formatAmount=t.c,exports.generateSsoUrl=e.p,exports.getBackendUrl=e.l,exports.getClientId=e.v,exports.getCurrencyAmountKey=t.s,exports.getMerchantInformation=n.u,exports.getSupportedCurrency=t.u,exports.getSupportedLocale=t.l,exports.isChromiumAndroid=t.f,exports.isFrakDeepLink=t.p,exports.isV1Context=e.o,exports.isV2Context=e.s,exports.locales=t.d,exports.modalBuilder=n.r,exports.openSso=e.u,exports.prepareSso=n.l,exports.processReferral=n.s,exports.referralInteraction=n.o,exports.resolveMerchantId=e.i,exports.sendInteraction=n.c,exports.sendTransaction=n.n,exports.setupClient=t.t,exports.siweAuthenticate=n.t,exports.ssoPopupFeatures=e.d,exports.ssoPopupName=e.f,exports.toAndroidIntentUrl=t.m,exports.trackEvent=e.t,exports.trackPurchaseStatus=n.a,exports.triggerDeepLinkWithFallback=t.h,exports.watchWalletStatus=n.i;
package/dist/bundle.js CHANGED
@@ -1 +1 @@
1
- import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g,v as _}from"./trackEvent-CeLFVzZn.js";import{a as v,c as y,d as b,f as x,g as S,h as C,i as w,l as T,m as E,n as D,o as O,p as k,r as A,s as j,t as M,u as N}from"./setupClient-BICl5fdX.js";import{a as P,c as F,d as I,f as L,i as R,l as z,n as B,o as V,p as H,r as U,s as W,t as G,u as K}from"./siweAuthenticate-zczqxm0a.js";export{S as DEEP_LINK_SCHEME,A as DebugInfoGatherer,t as FrakContextManager,o as base64urlDecode,a as base64urlEncode,w as baseIframeProps,u as clearMerchantIdCache,l as compressJsonToB64,e as computeLegacyProductId,D as createIFrameFrakClient,v as createIframe,n as decompressJsonFromB64,H as displayEmbeddedWallet,L as displayModal,I as ensureIdentity,p as fetchMerchantId,O as findIframeInOpener,y as formatAmount,f as generateSsoUrl,c as getBackendUrl,_ as getClientId,j as getCurrencyAmountKey,K as getMerchantInformation,N as getSupportedCurrency,T as getSupportedLocale,x as isChromiumAndroid,k as isFrakDeepLink,d as isV1Context,m as isV2Context,b as locales,U as modalBuilder,g as openSso,z as prepareSso,W as processReferral,V as referralInteraction,s as resolveMerchantId,F as sendInteraction,B as sendTransaction,M as setupClient,G as siweAuthenticate,r as ssoPopupFeatures,i as ssoPopupName,E as toAndroidIntentUrl,h as trackEvent,P as trackPurchaseStatus,C as triggerDeepLinkWithFallback,R as watchWalletStatus};
1
+ import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g,v as _}from"./trackEvent-CeLFVzZn.js";import{a as v,c as y,d as b,f as x,g as S,h as C,i as w,l as T,m as E,n as D,o as O,p as k,r as A,s as j,t as M,u as N}from"./setupClient-DTyvAPgh.js";import{a as P,c as F,d as I,f as L,i as R,l as z,n as B,o as V,p as H,r as U,s as W,t as G,u as K}from"./siweAuthenticate-zczqxm0a.js";export{S as DEEP_LINK_SCHEME,A as DebugInfoGatherer,t as FrakContextManager,o as base64urlDecode,a as base64urlEncode,w as baseIframeProps,u as clearMerchantIdCache,l as compressJsonToB64,e as computeLegacyProductId,D as createIFrameFrakClient,v as createIframe,n as decompressJsonFromB64,H as displayEmbeddedWallet,L as displayModal,I as ensureIdentity,p as fetchMerchantId,O as findIframeInOpener,y as formatAmount,f as generateSsoUrl,c as getBackendUrl,_ as getClientId,j as getCurrencyAmountKey,K as getMerchantInformation,N as getSupportedCurrency,T as getSupportedLocale,x as isChromiumAndroid,k as isFrakDeepLink,d as isV1Context,m as isV2Context,b as locales,U as modalBuilder,g as openSso,z as prepareSso,W as processReferral,V as referralInteraction,s as resolveMerchantId,F as sendInteraction,B as sendTransaction,M as setupClient,G as siweAuthenticate,r as ssoPopupFeatures,i as ssoPopupName,E as toAndroidIntentUrl,h as trackEvent,P as trackPurchaseStatus,C as triggerDeepLinkWithFallback,R as watchWalletStatus};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./trackEvent-Ew5r5zfI.cjs`),t=require(`./setupClient-nl8Dhh4V.cjs`);exports.DEEP_LINK_SCHEME=t.g,exports.DebugInfoGatherer=t.r,exports.FrakContextManager=e.a,exports.base64urlDecode=e.h,exports.base64urlEncode=e.g,exports.baseIframeProps=t.i,exports.clearMerchantIdCache=e.n,exports.compressJsonToB64=e.m,exports.computeLegacyProductId=e._,exports.createIFrameFrakClient=t.n,exports.createIframe=t.a,exports.decompressJsonFromB64=e.c,exports.fetchMerchantId=e.r,exports.findIframeInOpener=t.o,exports.formatAmount=t.c,exports.generateSsoUrl=e.p,exports.getBackendUrl=e.l,exports.getClientId=e.v,exports.getCurrencyAmountKey=t.s,exports.getSupportedCurrency=t.u,exports.getSupportedLocale=t.l,exports.isChromiumAndroid=t.f,exports.isFrakDeepLink=t.p,exports.isV1Context=e.o,exports.isV2Context=e.s,exports.locales=t.d,exports.resolveMerchantId=e.i,exports.setupClient=t.t,exports.ssoPopupFeatures=e.d,exports.ssoPopupName=e.f,exports.toAndroidIntentUrl=t.m,exports.trackEvent=e.t,exports.triggerDeepLinkWithFallback=t.h;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./trackEvent-Ew5r5zfI.cjs`),t=require(`./setupClient-CqTHGvVa.cjs`);exports.DEEP_LINK_SCHEME=t.g,exports.DebugInfoGatherer=t.r,exports.FrakContextManager=e.a,exports.base64urlDecode=e.h,exports.base64urlEncode=e.g,exports.baseIframeProps=t.i,exports.clearMerchantIdCache=e.n,exports.compressJsonToB64=e.m,exports.computeLegacyProductId=e._,exports.createIFrameFrakClient=t.n,exports.createIframe=t.a,exports.decompressJsonFromB64=e.c,exports.fetchMerchantId=e.r,exports.findIframeInOpener=t.o,exports.formatAmount=t.c,exports.generateSsoUrl=e.p,exports.getBackendUrl=e.l,exports.getClientId=e.v,exports.getCurrencyAmountKey=t.s,exports.getSupportedCurrency=t.u,exports.getSupportedLocale=t.l,exports.isChromiumAndroid=t.f,exports.isFrakDeepLink=t.p,exports.isV1Context=e.o,exports.isV2Context=e.s,exports.locales=t.d,exports.resolveMerchantId=e.i,exports.setupClient=t.t,exports.ssoPopupFeatures=e.d,exports.ssoPopupName=e.f,exports.toAndroidIntentUrl=t.m,exports.trackEvent=e.t,exports.triggerDeepLinkWithFallback=t.h;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,v as g}from"./trackEvent-CeLFVzZn.js";import{a as _,c as v,d as y,f as b,g as x,h as S,i as C,l as w,m as T,n as E,o as D,p as O,r as k,s as A,t as j,u as M}from"./setupClient-BICl5fdX.js";export{x as DEEP_LINK_SCHEME,k as DebugInfoGatherer,t as FrakContextManager,o as base64urlDecode,a as base64urlEncode,C as baseIframeProps,u as clearMerchantIdCache,l as compressJsonToB64,e as computeLegacyProductId,E as createIFrameFrakClient,_ as createIframe,n as decompressJsonFromB64,p as fetchMerchantId,D as findIframeInOpener,v as formatAmount,f as generateSsoUrl,c as getBackendUrl,g as getClientId,A as getCurrencyAmountKey,M as getSupportedCurrency,w as getSupportedLocale,b as isChromiumAndroid,O as isFrakDeepLink,d as isV1Context,m as isV2Context,y as locales,s as resolveMerchantId,j as setupClient,r as ssoPopupFeatures,i as ssoPopupName,T as toAndroidIntentUrl,h as trackEvent,S as triggerDeepLinkWithFallback};
1
+ import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,v as g}from"./trackEvent-CeLFVzZn.js";import{a as _,c as v,d as y,f as b,g as x,h as S,i as C,l as w,m as T,n as E,o as D,p as O,r as k,s as A,t as j,u as M}from"./setupClient-DTyvAPgh.js";export{x as DEEP_LINK_SCHEME,k as DebugInfoGatherer,t as FrakContextManager,o as base64urlDecode,a as base64urlEncode,C as baseIframeProps,u as clearMerchantIdCache,l as compressJsonToB64,e as computeLegacyProductId,E as createIFrameFrakClient,_ as createIframe,n as decompressJsonFromB64,p as fetchMerchantId,D as findIframeInOpener,v as formatAmount,f as generateSsoUrl,c as getBackendUrl,g as getClientId,A as getCurrencyAmountKey,M as getSupportedCurrency,w as getSupportedLocale,b as isChromiumAndroid,O as isFrakDeepLink,d as isV1Context,m as isV2Context,y as locales,s as resolveMerchantId,j as setupClient,r as ssoPopupFeatures,i as ssoPopupName,T as toAndroidIntentUrl,h as trackEvent,S as triggerDeepLinkWithFallback};
@@ -10,4 +10,4 @@ const e=require(`./trackEvent-Ew5r5zfI.cjs`);let t=require(`@frak-labs/frame-con
10
10
  Last Response: ${t.lastResponse}
11
11
  Client Status: ${t.clientStatus}
12
12
  Error: ${t.error}
13
- `.trim()}};const b=(()=>{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 x(e){e?localStorage.setItem(r,e):localStorage.removeItem(r)}function S(t,n,r,i){let a=new URL(window.location.href),o=a.searchParams.get(`fmt`)??void 0;t.contentWindow?.postMessage({clientLifecycle:`handshake-response`,data:{token:n,currentUrl:window.location.href,pendingMergeToken:o,configDomain:i,clientId:e.v()}},r),o&&(a.searchParams.delete(`fmt`),window.history.replaceState({},``,a.toString()))}function C(e,t){try{let n=new URL(e);return n.searchParams.has(`u`)?(n.searchParams.delete(`u`),n.searchParams.append(`u`,window.location.href),t&&n.searchParams.append(`fmt`,t),n.toString()):e}catch{return e}}function w(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 T(e){return e.includes(`/common/social`)}function E(e,t,n,r){if(c(t)){let i=C(t,r);s(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(b&&T(t))w(r);else{let e=C(t,r);window.location.href=e}}function D({iframe:e,targetOrigin:n,configDomain:i}){let a=new t.Deferred;return{handleEvent:async t=>{if(!(`iframeLifecycle`in t))return;let{iframeLifecycle:o,data:s}=t;switch(o){case`connected`:a.resolve(!0);break;case`do-backup`:x(s.backup);break;case`remove-backup`:localStorage.removeItem(r);break;case`show`:case`hide`:g({iframe:e,isVisible:o===`show`});break;case`handshake`:S(e,s.token,n,i);break;case`redirect`:E(e,s.baseRedirectUrl,n,s.mergeToken);break}},isConnected:a.promise}}function O({config:r,iframe:i}){let a=r?.walletUrl??`https://wallet.frak.id`,o=D({iframe:i,targetOrigin:a,configDomain:r.domain}),s=new y(r,i);if(!i.contentWindow)throw new t.FrakRpcError(t.RpcErrorCodes.configError,`The iframe does not have a content window`);let c=(0,t.createRpcClient)({emittingTransport:i.contentWindow,listeningTransport:window,targetOrigin:a,middleware:[{async onRequest(e,n){if(!await o.isConnected)throw new t.FrakRpcError(t.RpcErrorCodes.clientNotConnected,`The iframe provider isn't connected yet`);return n}},{onRequest(e,t){return s.setLastRequest(e),t},onResponse(e,t){return s.setLastResponse(e,t),t}}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await o.handleEvent(e)}}}),l=k(c,o),u=async()=>{l(),c.cleanup(),i.remove()},d;console.log(`[Frak SDK] Initializing OpenPanel`),d=new n.OpenPanel({apiUrl:`https://op-api.gcp.frak.id`,clientId:`6eacc8d7-49ac-4936-95e9-81ef29449570`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:t,payload:n})=>(t!==`track`||!n?.properties||`sdkVersion`in n.properties||(n.properties={...n.properties,sdkVersion:`0.2.0`,userAnonymousClientId:e.v()}),!0)}),d.setGlobalProperties({sdkVersion:`0.2.0`,userAnonymousClientId:e.v()}),d.init();let f=A({config:r,rpcClient:c,lifecycleManager:o}).then(()=>s.updateSetupStatus(!0));return{config:r,debugInfo:s,waitForConnection:o.isConnected,waitForSetup:f,request:c.request,listenerRequest:c.listen,destroy:u,openPanel:d}}function k(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 A({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,v(t,n.isConnected);async function i(){let n=e.customizations?.css;if(!n)return;let r={clientLifecycle:`modal-css`,data:{cssLink:n}};t.sendLifecycle(r)}async function a(){let n=e.customizations?.i18n;if(!n)return;let r={clientLifecycle:`modal-i18n`,data:{i18n:n}};t.sendLifecycle(r)}async function o(){if(typeof window>`u`)return;let e=window.localStorage.getItem(r);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([i(),a(),o()])}async function j({config:e}){let t=M(e),n=await h({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=O({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function M(e){let t=u(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return u}});
13
+ `.trim()}};const b=(()=>{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 x(e){e?localStorage.setItem(r,e):localStorage.removeItem(r)}function S(t,n,r,i){let a=new URL(window.location.href),o=a.searchParams.get(`fmt`)??void 0;t.contentWindow?.postMessage({clientLifecycle:`handshake-response`,data:{token:n,currentUrl:window.location.href,pendingMergeToken:o,configDomain:i,clientId:e.v()}},r),o&&(a.searchParams.delete(`fmt`),window.history.replaceState({},``,a.toString()))}function C(e,t){try{let n=new URL(e);return n.searchParams.has(`u`)?(n.searchParams.delete(`u`),n.searchParams.append(`u`,window.location.href),t&&n.searchParams.append(`fmt`,t),n.toString()):e}catch{return e}}function w(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 T(e){return e.includes(`/common/social`)}function E(e,t,n,r){if(c(t)){let i=C(t,r);s(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(b&&T(t))w(r);else{let e=C(t,r);window.location.href=e}}function D({iframe:e,targetOrigin:n,configDomain:i}){let a=new t.Deferred;return{handleEvent:async t=>{if(!(`iframeLifecycle`in t))return;let{iframeLifecycle:o,data:s}=t;switch(o){case`connected`:a.resolve(!0);break;case`do-backup`:x(s.backup);break;case`remove-backup`:localStorage.removeItem(r);break;case`show`:case`hide`:g({iframe:e,isVisible:o===`show`});break;case`handshake`:S(e,s.token,n,i);break;case`redirect`:E(e,s.baseRedirectUrl,n,s.mergeToken);break}},isConnected:a.promise}}function O({config:r,iframe:i}){let a=r?.walletUrl??`https://wallet.frak.id`,o=D({iframe:i,targetOrigin:a,configDomain:r.domain}),s=new y(r,i);if(!i.contentWindow)throw new t.FrakRpcError(t.RpcErrorCodes.configError,`The iframe does not have a content window`);let c=(0,t.createRpcClient)({emittingTransport:i.contentWindow,listeningTransport:window,targetOrigin:a,middleware:[{async onRequest(e,n){if(!await o.isConnected)throw new t.FrakRpcError(t.RpcErrorCodes.clientNotConnected,`The iframe provider isn't connected yet`);return n}},{onRequest(e,t){return s.setLastRequest(e),t},onResponse(e,t){return s.setLastResponse(e,t),t}}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await o.handleEvent(e)}}}),l=k(c,o),u=async()=>{l(),c.cleanup(),i.remove()},d;console.log(`[Frak SDK] Initializing OpenPanel`),d=new n.OpenPanel({apiUrl:`https://op-api.gcp.frak.id`,clientId:`6eacc8d7-49ac-4936-95e9-81ef29449570`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:t,payload:n})=>(t!==`track`||!n?.properties||`sdkVersion`in n.properties||(n.properties={...n.properties,sdkVersion:`0.2.1`,userAnonymousClientId:e.v()}),!0)}),d.setGlobalProperties({sdkVersion:`0.2.1`,userAnonymousClientId:e.v()}),d.init();let f=A({config:r,rpcClient:c,lifecycleManager:o}).then(()=>s.updateSetupStatus(!0));return{config:r,debugInfo:s,waitForConnection:o.isConnected,waitForSetup:f,request:c.request,listenerRequest:c.listen,destroy:u,openPanel:d}}function k(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 A({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,v(t,n.isConnected);async function i(){let n=e.customizations?.css;if(!n)return;let r={clientLifecycle:`modal-css`,data:{cssLink:n}};t.sendLifecycle(r)}async function a(){let n=e.customizations?.i18n;if(!n)return;let r={clientLifecycle:`modal-i18n`,data:{i18n:n}};t.sendLifecycle(r)}async function o(){if(typeof window>`u`)return;let e=window.localStorage.getItem(r);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([i(),a(),o()])}async function j({config:e}){let t=M(e),n=await h({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=O({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function M(e){let t=u(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return u}});
@@ -10,4 +10,4 @@ import{v as e}from"./trackEvent-CeLFVzZn.js";import{Deferred as t,FrakRpcError a
10
10
  Last Response: ${t.lastResponse}
11
11
  Client Status: ${t.clientStatus}
12
12
  Error: ${t.error}
13
- `.trim()}};const C=(()=>{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 w(e){e?localStorage.setItem(o,e):localStorage.removeItem(o)}function T(t,n,r,i){let a=new URL(window.location.href),o=a.searchParams.get(`fmt`)??void 0;t.contentWindow?.postMessage({clientLifecycle:`handshake-response`,data:{token:n,currentUrl:window.location.href,pendingMergeToken:o,configDomain:i,clientId:e()}},r),o&&(a.searchParams.delete(`fmt`),window.history.replaceState({},``,a.toString()))}function E(e,t){try{let n=new URL(e);return n.searchParams.has(`u`)?(n.searchParams.delete(`u`),n.searchParams.append(`u`,window.location.href),t&&n.searchParams.append(`fmt`,t),n.toString()):e}catch{return e}}function D(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 O(e){return e.includes(`/common/social`)}function k(e,t,n,r){if(d(t)){let i=E(t,r);u(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(C&&O(t))D(r);else{let e=E(t,r);window.location.href=e}}function A({iframe:e,targetOrigin:n,configDomain:r}){let i=new t;return{handleEvent:async t=>{if(!(`iframeLifecycle`in t))return;let{iframeLifecycle:a,data:s}=t;switch(a){case`connected`:i.resolve(!0);break;case`do-backup`:w(s.backup);break;case`remove-backup`:localStorage.removeItem(o);break;case`show`:case`hide`:y({iframe:e,isVisible:a===`show`});break;case`handshake`:T(e,s.token,n,r);break;case`redirect`:k(e,s.baseRedirectUrl,n,s.mergeToken);break}},isConnected:i.promise}}function j({config:t,iframe:o}){let s=t?.walletUrl??`https://wallet.frak.id`,c=A({iframe:o,targetOrigin:s,configDomain:t.domain}),l=new S(t,o);if(!o.contentWindow)throw new n(r.configError,`The iframe does not have a content window`);let u=i({emittingTransport:o.contentWindow,listeningTransport:window,targetOrigin:s,middleware:[{async onRequest(e,t){if(!await c.isConnected)throw new n(r.clientNotConnected,`The iframe provider isn't connected yet`);return t}},{onRequest(e,t){return l.setLastRequest(e),t},onResponse(e,t){return l.setLastResponse(e,t),t}}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await c.handleEvent(e)}}}),d=M(u,c),f=async()=>{d(),u.cleanup(),o.remove()},p;console.log(`[Frak SDK] Initializing OpenPanel`),p=new a({apiUrl:`https://op-api.gcp.frak.id`,clientId:`6eacc8d7-49ac-4936-95e9-81ef29449570`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:t,payload:n})=>(t!==`track`||!n?.properties||`sdkVersion`in n.properties||(n.properties={...n.properties,sdkVersion:`0.2.0`,userAnonymousClientId:e()}),!0)}),p.setGlobalProperties({sdkVersion:`0.2.0`,userAnonymousClientId:e()}),p.init();let m=N({config:t,rpcClient:u,lifecycleManager:c}).then(()=>l.updateSetupStatus(!0));return{config:t,debugInfo:l,waitForConnection:c.isConnected,waitForSetup:m,request:u.request,listenerRequest:u.listen,destroy:f,openPanel:p}}function M(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 N({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,x(t,n.isConnected);async function r(){let n=e.customizations?.css;if(!n)return;let r={clientLifecycle:`modal-css`,data:{cssLink:n}};t.sendLifecycle(r)}async function i(){let n=e.customizations?.i18n;if(!n)return;let r={clientLifecycle:`modal-i18n`,data:{i18n:n}};t.sendLifecycle(r)}async function a(){if(typeof window>`u`)return;let e=window.localStorage.getItem(o);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([r(),i(),a()])}async function P({config:e}){let t=F(e),n=await v({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=j({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function F(e){let t=p(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}export{v as a,h as c,f as d,c as f,s as g,u as h,_ as i,m as l,l as m,j as n,b as o,d as p,S as r,g as s,P as t,p as u};
13
+ `.trim()}};const C=(()=>{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 w(e){e?localStorage.setItem(o,e):localStorage.removeItem(o)}function T(t,n,r,i){let a=new URL(window.location.href),o=a.searchParams.get(`fmt`)??void 0;t.contentWindow?.postMessage({clientLifecycle:`handshake-response`,data:{token:n,currentUrl:window.location.href,pendingMergeToken:o,configDomain:i,clientId:e()}},r),o&&(a.searchParams.delete(`fmt`),window.history.replaceState({},``,a.toString()))}function E(e,t){try{let n=new URL(e);return n.searchParams.has(`u`)?(n.searchParams.delete(`u`),n.searchParams.append(`u`,window.location.href),t&&n.searchParams.append(`fmt`,t),n.toString()):e}catch{return e}}function D(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 O(e){return e.includes(`/common/social`)}function k(e,t,n,r){if(d(t)){let i=E(t,r);u(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(C&&O(t))D(r);else{let e=E(t,r);window.location.href=e}}function A({iframe:e,targetOrigin:n,configDomain:r}){let i=new t;return{handleEvent:async t=>{if(!(`iframeLifecycle`in t))return;let{iframeLifecycle:a,data:s}=t;switch(a){case`connected`:i.resolve(!0);break;case`do-backup`:w(s.backup);break;case`remove-backup`:localStorage.removeItem(o);break;case`show`:case`hide`:y({iframe:e,isVisible:a===`show`});break;case`handshake`:T(e,s.token,n,r);break;case`redirect`:k(e,s.baseRedirectUrl,n,s.mergeToken);break}},isConnected:i.promise}}function j({config:t,iframe:o}){let s=t?.walletUrl??`https://wallet.frak.id`,c=A({iframe:o,targetOrigin:s,configDomain:t.domain}),l=new S(t,o);if(!o.contentWindow)throw new n(r.configError,`The iframe does not have a content window`);let u=i({emittingTransport:o.contentWindow,listeningTransport:window,targetOrigin:s,middleware:[{async onRequest(e,t){if(!await c.isConnected)throw new n(r.clientNotConnected,`The iframe provider isn't connected yet`);return t}},{onRequest(e,t){return l.setLastRequest(e),t},onResponse(e,t){return l.setLastResponse(e,t),t}}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await c.handleEvent(e)}}}),d=M(u,c),f=async()=>{d(),u.cleanup(),o.remove()},p;console.log(`[Frak SDK] Initializing OpenPanel`),p=new a({apiUrl:`https://op-api.gcp.frak.id`,clientId:`6eacc8d7-49ac-4936-95e9-81ef29449570`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:t,payload:n})=>(t!==`track`||!n?.properties||`sdkVersion`in n.properties||(n.properties={...n.properties,sdkVersion:`0.2.1`,userAnonymousClientId:e()}),!0)}),p.setGlobalProperties({sdkVersion:`0.2.1`,userAnonymousClientId:e()}),p.init();let m=N({config:t,rpcClient:u,lifecycleManager:c}).then(()=>l.updateSetupStatus(!0));return{config:t,debugInfo:l,waitForConnection:c.isConnected,waitForSetup:m,request:u.request,listenerRequest:u.listen,destroy:f,openPanel:p}}function M(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 N({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,x(t,n.isConnected);async function r(){let n=e.customizations?.css;if(!n)return;let r={clientLifecycle:`modal-css`,data:{cssLink:n}};t.sendLifecycle(r)}async function i(){let n=e.customizations?.i18n;if(!n)return;let r={clientLifecycle:`modal-i18n`,data:{i18n:n}};t.sendLifecycle(r)}async function a(){if(typeof window>`u`)return;let e=window.localStorage.getItem(o);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([r(),i(),a()])}async function P({config:e}){let t=F(e),n=await v({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=j({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function F(e){let t=p(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}export{v as a,h as c,f as d,c as f,s as g,u as h,_ as i,m as l,l as m,j as n,b as o,d as p,S as r,g as s,P as t,p as u};
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "url": "https://twitter.com/QNivelais"
12
12
  }
13
13
  ],
14
- "version": "0.2.0-beta.db56431e",
14
+ "version": "0.2.1-beta.21ffe110",
15
15
  "description": "Core SDK of the Frak wallet, low level library to interact directly with the frak ecosystem.",
16
16
  "repository": {
17
17
  "url": "https://github.com/frak-id/wallet",
@@ -91,8 +91,8 @@
91
91
  "viem": "^2.x"
92
92
  },
93
93
  "dependencies": {
94
- "@frak-labs/frame-connector": "0.2.0-beta.db56431e",
95
- "@openpanel/web": "^1.0.7"
94
+ "@frak-labs/frame-connector": "0.2.0-beta.21ffe110",
95
+ "@openpanel/web": "^1.2.0"
96
96
  },
97
97
  "devDependencies": {
98
98
  "@arethetypeswrong/cli": "^0.18.2",
@@ -101,12 +101,12 @@
101
101
  "@rolldown/plugin-node-polyfills": "^1.0.3",
102
102
  "@types/jsdom": "^27.0.0",
103
103
  "@types/node": "^24.10.13",
104
- "@vitest/coverage-v8": "^4.0.18",
105
- "@vitest/ui": "^4.0.18",
106
- "jsdom": "^28.0.0",
104
+ "@vitest/coverage-v8": "^4.1.0",
105
+ "@vitest/ui": "^4.1.0",
106
+ "jsdom": "^28.1.0",
107
107
  "tsdown": "^0.20.3",
108
108
  "typescript": "^5.9.3",
109
109
  "viem": "^2.39.0",
110
- "vitest": "^4.0.18"
110
+ "vitest": "^4.1.0"
111
111
  }
112
112
  }