@frak-labs/components 0.0.25 → 0.0.26-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.
@@ -1 +1 @@
1
- import{S as e,a as t,b as n,d as r,f as i,h as a,m as o,n as s,o as c,p as l,s as u,u as d}from"./initFrakSdk.CW4lZNoL.js";import{t as f}from"./Spinner.CpK9_1R-.js";import{a as p,i as m,n as h,o as g,r as _,t as v}from"./useClientReady.CGRQ81It.js";function y(e,t){return!e||e.payoutType!==`fixed`?0:e.amount[t]}function b(e,t){return e.reduce((e,n)=>Math.max(e,y(n.referrer,t)),0)}async function x({targetInteraction:e}){let n=window.FrakSetup?.client;if(!n){console.warn(`Frak client not ready yet`);return}let{rewards:i}=await t(n),a=r(n.config.metadata?.currency),o=b(e?i.filter(t=>t.interactionTypeKey===e):i,a);if(!(o<=0))return d(Math.round(o),n.config.metadata?.currency)}function S(e,t){let[n,r]=_(void 0);return p(()=>{e&&x({targetInteraction:t}).then(e=>{e&&r(e)})},[e,t]),{reward:n}}const C={buttonShare:`nOB7Uq_buttonShare`};C.buttonShare;function w(e={}){let{successDuration:t=2e3}=e,[n,r]=_(!1);return{copy:m(async e=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e),r(!0);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();try{document.execCommand(`copy`),r(!0)}catch(e){return console.error(`Failed to copy text:`,e),!1}finally{t.remove()}}return setTimeout(()=>{r(!1)},t),!0}catch(e){return console.error(`Failed to copy text:`,e),!1}},[t]),copied:n}}const T={errorContainer:{marginTop:`16px`,padding:`16px`,backgroundColor:`#FEE2E2`,border:`1px solid #FCA5A5`,borderRadius:`4px`,color:`#991B1B`},header:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`12px`},title:{margin:0,fontSize:`16px`,fontWeight:500},message:{fontSize:`14px`,lineHeight:`1.5`,margin:`0 0 12px 0`},link:{color:`#991B1B`,textDecoration:`underline`,textUnderlineOffset:`2px`},copyButton:{display:`inline-flex`,alignItems:`center`,gap:`8px`,marginBottom:`10px`,padding:`8px 12px`,backgroundColor:`white`,border:`1px solid #D1D5DB`,borderRadius:`4px`,color:`black`,fontSize:`14px`,fontWeight:500}};function E({debugInfo:e}){let[t,n]=_(!1);return a(`div`,{children:[a(`button`,{type:`button`,style:T.copyButton,onClick:()=>n(!t),children:`Ouvrir les informations`}),t&&a(`textarea`,{style:{display:`block`,width:`100%`,height:`200px`,fontSize:`12px`},children:e})]})}function D({debugInfo:e}){let{copied:t,copy:n}=w();return a(`div`,{style:T.errorContainer,children:[a(`div`,{style:T.header,children:a(`h3`,{style:T.title,children:`Oups ! Nous avons rencontré un petit problème`})}),a(`p`,{style:T.message,children:[`Impossible d'ouvrir le menu de partage pour le moment. Si le problème persiste, copiez les informations ci-dessous et collez-les dans votre mail à`,` `,a(`a`,{href:`mailto:help@frak-labs.com?subject=Debug`,style:T.link,children:`help@frak-labs.com`}),` `,a(`br`,{}),`Merci pour votre retour, nous traitons votre demande dans les plus brefs délais.`]}),a(`button`,{type:`button`,onClick:()=>n(e??``),style:T.copyButton,children:t?`Informations copiées !`:`Copier les informations de débogage`}),a(E,{debugInfo:e})]})}function O(e){let[t,n]=_(void 0),[r,a]=_(!1);return{handleShare:m(async()=>{if(!window.FrakSetup?.client){console.error(`Frak client not found`),n(u.empty().formatDebugInfo(`Frak client not found`)),a(!0);return}let t=s();if(!t)throw Error(`modalBuilderSteps not found`);try{await t.sharing(window.FrakSetup?.modalShareConfig??{}).display(t=>({...t,targetInteraction:e}))}catch(e){if(e instanceof o&&e.code===l.clientAborted){console.debug(`User aborted the modal`);return}let t=window.FrakSetup.client.debugInfo.formatDebugInfo(e);i(window.FrakSetup.client,`share_modal_error`,{error:e instanceof Object&&`message`in e?e.message:`Unknown error`,debugInfo:t}),n(t),a(!0),console.error(`Error while opening the modal`,e)}},[e]),isError:r,debugInfo:t}}async function k(){if(!window.FrakSetup?.client)throw Error(`Frak client not found`);await c(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}function A({text:t=`Share and earn!`,classname:r=``,useReward:o,noRewardText:s,targetInteraction:c,showWallet:l}){let u=h(()=>o!==void 0,[o]),d=h(()=>l!==void 0,[l]),{isClientReady:p}=v(),{reward:g}=S(u&&p,c),{handleShare:_,isError:y,debugInfo:b}=O(c),x=h(()=>u?g?t.includes(`{REWARD}`)?t.replace(`{REWARD}`,g):`${t} ${g}`:s??t.replace(`{REWARD}`,``):t,[u,t,s,g]),w=m(async()=>{i(window.FrakSetup.client,`share_button_clicked`),d?await k():await _()},[d,_]);return a(n,{children:[a(`button`,{type:`button`,className:e(C.buttonShare,r,`override`),onClick:w,children:[!p&&a(f,{}),` `,x]}),y&&a(D,{debugInfo:b})]})}g(A,`frak-button-share`,[`text`],{shadow:!1});export{A as ButtonShare,S as t};
1
+ import{S as e,a as t,b as n,c as r,f as i,h as a,l as o,m as s,n as c,o as l,p as u,s as d}from"./initFrakSdk._ycDRGU2.js";import{t as f}from"./Spinner.sJKLrGhX.js";import{a as p,i as m,n as h,o as g,r as _,t as v}from"./useClientReady.Dyagl92v.js";function y(e,t){return!e||e.payoutType!==`fixed`?0:e.amount[t]}function b(e,t){return e.reduce((e,n)=>Math.max(e,y(n.referrer,t)),0)}async function x({targetInteraction:e}){let n=window.FrakSetup?.client;if(!n){console.warn(`Frak client not ready yet`);return}let{rewards:i}=await t(n),a=r(n.config.metadata?.currency),s=b(e?i.filter(t=>t.interactionTypeKey===e):i,a);if(!(s<=0))return o(Math.round(s),n.config.metadata?.currency)}function S(e,t){let[n,r]=_(void 0);return p(()=>{e&&x({targetInteraction:t}).then(e=>{e&&r(e)})},[e,t]),{reward:n}}const C={buttonShare:`nOB7Uq_buttonShare`};C.buttonShare;function w(e={}){let{successDuration:t=2e3}=e,[n,r]=_(!1);return{copy:m(async e=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e),r(!0);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();try{document.execCommand(`copy`),r(!0)}catch(e){return console.error(`Failed to copy text:`,e),!1}finally{t.remove()}}return setTimeout(()=>{r(!1)},t),!0}catch(e){return console.error(`Failed to copy text:`,e),!1}},[t]),copied:n}}const T={errorContainer:{marginTop:`16px`,padding:`16px`,backgroundColor:`#FEE2E2`,border:`1px solid #FCA5A5`,borderRadius:`4px`,color:`#991B1B`},header:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`12px`},title:{margin:0,fontSize:`16px`,fontWeight:500},message:{fontSize:`14px`,lineHeight:`1.5`,margin:`0 0 12px 0`},link:{color:`#991B1B`,textDecoration:`underline`,textUnderlineOffset:`2px`},copyButton:{display:`inline-flex`,alignItems:`center`,gap:`8px`,marginBottom:`10px`,padding:`8px 12px`,backgroundColor:`white`,border:`1px solid #D1D5DB`,borderRadius:`4px`,color:`black`,fontSize:`14px`,fontWeight:500}};function E({debugInfo:e}){let[t,n]=_(!1);return a(`div`,{children:[a(`button`,{type:`button`,style:T.copyButton,onClick:()=>n(!t),children:`Ouvrir les informations`}),t&&a(`textarea`,{style:{display:`block`,width:`100%`,height:`200px`,fontSize:`12px`},children:e})]})}function D({debugInfo:e}){let{copied:t,copy:n}=w();return a(`div`,{style:T.errorContainer,children:[a(`div`,{style:T.header,children:a(`h3`,{style:T.title,children:`Oups ! Nous avons rencontré un petit problème`})}),a(`p`,{style:T.message,children:[`Impossible d'ouvrir le menu de partage pour le moment. Si le problème persiste, copiez les informations ci-dessous et collez-les dans votre mail à`,` `,a(`a`,{href:`mailto:help@frak-labs.com?subject=Debug`,style:T.link,children:`help@frak-labs.com`}),` `,a(`br`,{}),`Merci pour votre retour, nous traitons votre demande dans les plus brefs délais.`]}),a(`button`,{type:`button`,onClick:()=>n(e??``),style:T.copyButton,children:t?`Informations copiées !`:`Copier les informations de débogage`}),a(E,{debugInfo:e})]})}function O(e){let[t,n]=_(void 0),[r,a]=_(!1);return{handleShare:m(async()=>{if(!window.FrakSetup?.client){console.error(`Frak client not found`),n(d.empty().formatDebugInfo(`Frak client not found`)),a(!0);return}let t=c();if(!t)throw Error(`modalBuilderSteps not found`);try{await t.sharing(window.FrakSetup?.modalShareConfig??{}).display(t=>({...t,targetInteraction:e}))}catch(e){if(e instanceof s&&e.code===u.clientAborted){console.debug(`User aborted the modal`);return}let t=window.FrakSetup.client.debugInfo.formatDebugInfo(e);i(window.FrakSetup.client,`share_modal_error`,{error:e instanceof Object&&`message`in e?e.message:`Unknown error`,debugInfo:t}),n(t),a(!0),console.error(`Error while opening the modal`,e)}},[e]),isError:r,debugInfo:t}}async function k(){if(!window.FrakSetup?.client)throw Error(`Frak client not found`);await l(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}function A({text:t=`Share and earn!`,classname:r=``,useReward:o,noRewardText:s,targetInteraction:c,showWallet:l}){let u=h(()=>o!==void 0,[o]),d=h(()=>l!==void 0,[l]),{isClientReady:p}=v(),{reward:g}=S(u&&p,c),{handleShare:_,isError:y,debugInfo:b}=O(c),x=h(()=>u?g?t.includes(`{REWARD}`)?t.replace(`{REWARD}`,g):`${t} ${g}`:s??t.replace(`{REWARD}`,``):t,[u,t,s,g]),w=m(async()=>{i(window.FrakSetup.client,`share_button_clicked`),d?await k():await _()},[d,_]);return a(n,{children:[a(`button`,{type:`button`,className:e(C.buttonShare,r,`override`),onClick:w,children:[!p&&a(f,{}),` `,x]}),y&&a(D,{debugInfo:b})]})}g(A,`frak-button-share`,[`text`],{shadow:!1});export{A as ButtonShare,S as t};
@@ -1 +1 @@
1
- import{S as e,f as t,h as n,i as r}from"./initFrakSdk.CW4lZNoL.js";import{a as i,n as a,o,r as s,t as c}from"./useClientReady.CGRQ81It.js";import{t as l}from"./ButtonShare.Ql9TdTHB.js";function u(e){return n(`svg`,{fill:`none`,height:`1em`,viewBox:`0 0 28 28`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n(`title`,{children:`Gift icon`}),n(`path`,{d:`m23.1427 13.9999v11.4285h-18.2857v-11.4285m9.1429 11.4285v-17.14282m0 0h-5.1429c-.75776 0-1.48448-.30102-2.0203-.83684s-.83684-1.26255-.83684-2.02031.30102-1.48448.83684-2.0203 1.26254-.83684 2.0203-.83684c4 0 5.1429 5.71429 5.1429 5.71429zm0 0h5.1428c.7578 0 1.4845-.30102 2.0203-.83684s.8369-1.26255.8369-2.02031-.3011-1.48448-.8369-2.0203-1.2625-.83684-2.0203-.83684c-4 0-5.1428 5.71429-5.1428 5.71429zm-11.42861 0h22.85711v5.71432h-22.85711z`,stroke:`#fff`,"stroke-linecap":`round`,"stroke-linejoin":`round`})]})}const d={button:`Kl62ia_button`,button__right:`Kl62ia_button__right`,reward:`Kl62ia_reward`,button__left:`Kl62ia_button__left`};d.button,d.button__right,d.reward,d.button__left;function f({classname:o=``,useReward:f,targetInteraction:p}){let m=a(()=>f!==void 0,[f]),{isClientReady:h}=c(),{reward:g}=l(m&&h,p),[_,v]=s(`right`);return i(()=>{let e=window.FrakSetup?.modalWalletConfig?.metadata?.position;v(e??`right`)},[]),n(`button`,{type:`button`,"aria-label":`Open wallet`,class:e(d.button,_===`left`?d.button__left:d.button__right,o,`override`),disabled:!h,onClick:()=>{t(window.FrakSetup.client,`wallet_button_clicked`),r()},children:[n(u,{}),g&&n(`span`,{className:d.reward,children:g})]})}o(f,`frak-button-wallet`,[],{shadow:!1});export{f as ButtonWallet};
1
+ import{S as e,f as t,h as n,i as r}from"./initFrakSdk._ycDRGU2.js";import{a as i,n as a,o,r as s,t as c}from"./useClientReady.Dyagl92v.js";import{t as l}from"./ButtonShare.Ba6yVLnc.js";function u(e){return n(`svg`,{fill:`none`,height:`1em`,viewBox:`0 0 28 28`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n(`title`,{children:`Gift icon`}),n(`path`,{d:`m23.1427 13.9999v11.4285h-18.2857v-11.4285m9.1429 11.4285v-17.14282m0 0h-5.1429c-.75776 0-1.48448-.30102-2.0203-.83684s-.83684-1.26255-.83684-2.02031.30102-1.48448.83684-2.0203 1.26254-.83684 2.0203-.83684c4 0 5.1429 5.71429 5.1429 5.71429zm0 0h5.1428c.7578 0 1.4845-.30102 2.0203-.83684s.8369-1.26255.8369-2.02031-.3011-1.48448-.8369-2.0203-1.2625-.83684-2.0203-.83684c-4 0-5.1428 5.71429-5.1428 5.71429zm-11.42861 0h22.85711v5.71432h-22.85711z`,stroke:`#fff`,"stroke-linecap":`round`,"stroke-linejoin":`round`})]})}const d={button:`Kl62ia_button`,button__right:`Kl62ia_button__right`,button__left:`Kl62ia_button__left`,reward:`Kl62ia_reward`};d.button,d.button__right,d.button__left,d.reward;function f({classname:o=``,useReward:f,targetInteraction:p}){let m=a(()=>f!==void 0,[f]),{isClientReady:h}=c(),{reward:g}=l(m&&h,p),[_,v]=s(`right`);return i(()=>{let e=window.FrakSetup?.modalWalletConfig?.metadata?.position;v(e??`right`)},[]),n(`button`,{type:`button`,"aria-label":`Open wallet`,class:e(d.button,_===`left`?d.button__left:d.button__right,o,`override`),disabled:!h,onClick:()=>{t(window.FrakSetup.client,`wallet_button_clicked`),r()},children:[n(u,{}),g&&n(`span`,{className:d.reward,children:g})]})}o(f,`frak-button-wallet`,[],{shadow:!1});export{f as ButtonWallet};
@@ -1 +1 @@
1
- import{S as e,c as t,f as n,h as r,l as i}from"./initFrakSdk.CW4lZNoL.js";import{t as a}from"./Spinner.CpK9_1R-.js";import{n as o,o as s,t as c}from"./useClientReady.CGRQ81It.js";function l(){return typeof navigator>`u`?!1:!!(/iPhone|iPad|iPod|Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&navigator.maxTouchPoints>1)}function u(){return{isMobile:o(()=>l(),[])}}function d(e=`wallet`){let r=window.FrakSetup?.client;r&&n(r,`open_in_app_clicked`),t(`${i}${e}`,{onFallback:()=>{r&&n(r,`app_not_installed`)}})}const f={button:`XYfqGq_button`};f.button;function p({text:t=`Open in App`,classname:n=``}){let{isClientReady:i}=c(),{isMobile:o}=u();if(!o)return null;let s=()=>{d()};return r(`button`,{type:`button`,"aria-label":`Open in Frak Wallet app`,className:e(f.button,n,`override`),disabled:!i,onClick:s,children:[!i&&r(a,{}),` `,t]})}s(p,`frak-open-in-app`,[`text`],{shadow:!1});export{p as OpenInAppButton};
1
+ import{S as e,d as t,f as n,h as r,u as i}from"./initFrakSdk._ycDRGU2.js";import{t as a}from"./Spinner.sJKLrGhX.js";import{n as o,o as s,t as c}from"./useClientReady.Dyagl92v.js";function l(){return typeof navigator>`u`?!1:!!(/iPhone|iPad|iPod|Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&navigator.maxTouchPoints>1)}function u(){return{isMobile:o(()=>l(),[])}}function d(e=`wallet`){let r=window.FrakSetup?.client;r&&n(r,`open_in_app_clicked`),t(`${i}${e}`,{onFallback:()=>{r&&n(r,`app_not_installed`)}})}const f={button:`XYfqGq_button`};f.button;function p({text:t=`Open in App`,classname:n=``}){let{isClientReady:i}=c(),{isMobile:o}=u();if(!o)return null;let s=()=>{d()};return r(`button`,{type:`button`,"aria-label":`Open in Frak Wallet app`,className:e(f.button,n,`override`),disabled:!i,onClick:s,children:[!i&&r(a,{}),` `,t]})}s(p,`frak-open-in-app`,[`text`],{shadow:!1});export{p as OpenInAppButton};
@@ -1 +1 @@
1
- import{S as e,h as t}from"./initFrakSdk.CW4lZNoL.js";const n={spinner:`M4fSKa_spinner`,spinner__leaf:`M4fSKa_spinner__leaf`,"rt-spinner-leaf-fade":`M4fSKa_rt-spinner-leaf-fade`};n.spinner,n.spinner__leaf,n[`rt-spinner-leaf-fade`];const r=({ref:r,className:i,...a})=>t(`span`,{...a,ref:r,className:e(n.spinner),children:[t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf})]});r.displayName=`Spinner`;export{r as t};
1
+ import{S as e,h as t}from"./initFrakSdk._ycDRGU2.js";const n={spinner:`M4fSKa_spinner`,"rt-spinner-leaf-fade":`M4fSKa_rt-spinner-leaf-fade`,spinner__leaf:`M4fSKa_spinner__leaf`};n.spinner,n[`rt-spinner-leaf-fade`],n.spinner__leaf;const r=({ref:r,className:i,...a})=>t(`span`,{...a,ref:r,className:e(n.spinner),children:[t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf}),t(`span`,{className:n.spinner__leaf})]});r.displayName=`Spinner`;export{r as t};
package/cdn/components.js CHANGED
@@ -1 +1 @@
1
- import(`https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/cdn/loader.js?v=1772457034927`);
1
+ import(`https://cdn.jsdelivr.net/npm/@frak-labs/components@beta/cdn/loader.js?v=1773682002565`);
@@ -0,0 +1,66 @@
1
+ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function n(e){document.readyState===`complete`||document.readyState===`interactive`?setTimeout(e,1):document.addEventListener?document.addEventListener(`DOMContentLoaded`,e):document.attachEvent(`onreadystatechange`,()=>{document.readyState===`complete`&&e()})}function r(e){var t,n,i=``;if(typeof e==`string`||typeof e==`number`)i+=e;else if(typeof e==`object`)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=r(e[t]))&&(i&&(i+=` `),i+=n)}else for(n in e)e[n]&&(i&&(i+=` `),i+=n);return i}function i(){for(var e,t,n=0,i=``,a=arguments.length;n<a;n++)(e=arguments[n])&&(t=r(e))&&(i&&(i+=` `),i+=t);return i}const a=i;var o,s,c,l,u,d,f,p,m,h,g,_={},v=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,b=Array.isArray;function x(e,t){for(var n in t)e[n]=t[n];return e}function S(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function C(e,t,n){var r,i,a,s={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?o.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return w(e,s,r,i,null)}function w(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++c,__i:-1,__u:0};return i==null&&s.vnode!=null&&s.vnode(a),a}function T(e){return e.children}function ee(e,t){this.props=e,this.context=t}function E(e,t){if(t==null)return e.__?E(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?E(e):null}function D(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=x({},t);a.__v=t.__v+1,s.vnode&&s.vnode(a),le(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??E(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,de(r,a,i),t.__e=t.__=null,a.__e!=n&&O(a)}}function O(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),O(e)}function te(e){(!e.__d&&(e.__d=!0)&&l.push(e)&&!ne.__r++||u!=s.debounceRendering)&&((u=s.debounceRendering)||d)(ne)}function ne(){try{for(var e,t=1;l.length;)l.length>t&&l.sort(f),e=l.shift(),t=l.length,D(e)}finally{l.length=ne.__r=0}}function re(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,y,b=r&&r.__k||v,x=t.length;for(c=k(n,t,b,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&b[p.__i]||_,p.__i=d,g=le(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&me(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),(y=!!(4&p.__u))||f.__k===p.__k?c=ie(p,c,e,y):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function k(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=w(null,o,null,null,null):b(o)?o=e.__k[a]=w(T,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=w(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=ae(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=E(s)),he(s,s));return r}function ie(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=ie(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=E(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ae(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function oe(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||y.test(t)?n:n+`px`}function se(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||oe(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||oe(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(p,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n.u=r.u:(n.u=m,e.addEventListener(t,a?g:h,a)):e.removeEventListener(t,a?g:h,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function ce(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=m++;else if(t.t<n.u)return;return n(s.event?s.event(t):t)}}}function le(e,t,n,r,i,a,o,c,l,u){var d,f,p,m,h,g,_,y,C,w,E,D,O,te,ne,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),a=[c=t.__e=n.__e]),(d=s.__b)&&d(t);n:if(typeof k==`function`)try{if(y=t.props,C=k.prototype&&k.prototype.render,w=(d=k.contextType)&&r[d.__c],E=d?w?w.props.value:d.__:r,n.__c?_=(f=t.__c=n.__c).__=f.__E:(C?t.__c=f=new k(y,E):(t.__c=f=new ee(y,E),f.constructor=k,f.render=ge),w&&w.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),C&&f.__s==null&&(f.__s=f.state),C&&k.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=x({},f.__s)),x(f.__s,k.getDerivedStateFromProps(y,f.__s))),m=f.props,h=f.state,f.__v=t,p)C&&k.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),C&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(C&&k.getDerivedStateFromProps==null&&y!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(y,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(y,f.__s,E)){t.__v!=n.__v&&(f.props=y,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),v.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(y,f.__s,E),C&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=E,f.props=y,f.__P=e,f.__e=!1,D=s.__r,O=0,C)f.state=f.__s,f.__d=!1,D&&D(t),d=f.render(f.props,f.state,f.context),v.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,D&&D(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++O<25);f.state=f.__s,f.getChildContext!=null&&(r=x(x({},r),f.getChildContext())),C&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),te=d!=null&&d.type===T&&d.key==null?fe(d.props.children):d,c=re(e,b(te)?te:[te],t,n,r,i,a,o,c,l,u),f.base=t.__e,t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__E=f.__=null)}catch(e){if(t.__v=null,l||a!=null)if(e.then){for(t.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;a[a.indexOf(c)]=null,t.__e=c}else{for(ne=a.length;ne--;)S(a[ne]);ue(t)}else t.__e=n.__e,t.__k=n.__k,e.then||ue(t);s.__e(e,t,n)}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=pe(n.__e,t,n,r,i,a,o,l,u);return(d=s.diffed)&&d(t),128&t.__u?void 0:c}function ue(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ue))}function de(e,t,n){for(var r=0;r<n.length;r++)me(n[r],n[++r],n[++r]);s.__c&&s.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){s.__e(e,t.__v)}})}function fe(e){return typeof e!=`object`||!e||e.__b>0?e:b(e)?e.map(fe):x({},e)}function pe(e,t,n,r,i,a,c,l,u){var d,f,p,m,h,g,v,y=n.props||_,x=t.props,C=t.type;if(C==`svg`?i=`http://www.w3.org/2000/svg`:C==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(d=0;d<a.length;d++)if((h=a[d])&&`setAttribute`in h==!!C&&(C?h.localName==C:h.nodeType==3)){e=h,a[d]=null;break}}if(e==null){if(C==null)return document.createTextNode(x);e=document.createElementNS(i,C,x.is&&x),l&&=(s.__m&&s.__m(t,a),!1),a=null}if(C==null)y===x||l&&e.data==x||(e.data=x);else{if(a&&=o.call(e.childNodes),!l&&a!=null)for(y={},d=0;d<e.attributes.length;d++)y[(h=e.attributes[d]).name]=h.value;for(d in y)h=y[d],d==`dangerouslySetInnerHTML`?p=h:d==`children`||d in x||d==`value`&&`defaultValue`in x||d==`checked`&&`defaultChecked`in x||se(e,d,null,h,i);for(d in x)h=x[d],d==`children`?m=h:d==`dangerouslySetInnerHTML`?f=h:d==`value`?g=h:d==`checked`?v=h:l&&typeof h!=`function`||y[d]===h||se(e,d,h,y[d],i);if(f)l||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(p&&(e.innerHTML=``),re(t.type==`template`?e.content:e,b(m)?m:[m],t,n,r,C==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,c,a?a[0]:n.__k&&E(n,0),l,u),a!=null)for(d=a.length;d--;)S(a[d]);l||(d=`value`,C==`progress`&&g==null?e.removeAttribute(`value`):g!=null&&(g!==e[d]||C==`progress`&&!g||C==`option`&&g!=y[d])&&se(e,d,g,y[d],i),d=`checked`,v!=null&&v!=e[d]&&se(e,d,v,y[d],i))}return e}function me(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){s.__e(e,n)}}function he(e,t,n){var r,i;if(s.unmount&&s.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||me(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){s.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&he(r[i],t,n||typeof e.type!=`function`);n||S(e.__e),e.__c=e.__=e.__e=void 0}function ge(e,t,n){return this.constructor(e,n)}function _e(e,t,n){var r,i,a,c;t==document&&(t=document.documentElement),s.__&&s.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],c=[],le(t,e=(!r&&n||t).__k=C(T,null,[e]),i||_,_,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?o.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,c),de(a,e,c)}function ve(e,t){_e(e,t,ve)}function ye(e,t,n){var r,i,a,s,c=x({},e.props);for(a in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)a==`key`?r=t[a]:a==`ref`?i=t[a]:c[a]=t[a]===void 0&&s!=null?s[a]:t[a];return arguments.length>2&&(c.children=arguments.length>3?o.call(arguments,2):n),w(e.type,c,r||e.key,i||e.ref,null)}o=v.slice,s={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},c=0,ee.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=x({},this.state);typeof e==`function`&&(e=e(x({},n),this.props)),e&&x(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),te(this))},ee.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),te(this))},ee.prototype.render=T,l=[],d=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f=function(e,t){return e.__v.__b-t.__v.__b},ne.__r=0,p=/(PointerCapture)$|Capture$/i,m=0,h=ce(!1),g=ce(!0);var be=0;Array.isArray;function xe(e,t,n,r,i,a){t||={};var o,c,l=t;if(`ref`in l)for(c in l={},t)c==`ref`?o=t[c]:l[c]=t[c];var u={type:e,props:l,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--be,__i:-1,__u:0,__source:i,__self:a};if(typeof e==`function`&&(o=e.defaultProps))for(c in o)l[c]===void 0&&(l[c]=o[c]);return s.vnode&&s.vnode(u),u}function Se(e,{strict:t=!0}={}){return!e||typeof e!=`string`?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith(`0x`)}function Ce(e){return Se(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const we=`2.46.3`;let Te={getDocsUrl:({docsBaseUrl:e,docsPath:t=``,docsSlug:n})=>t?`${e??`https://viem.sh`}${t}${n?`#${n}`:``}`:void 0,version:`viem@${we}`};var Ee=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=Te.getDocsUrl?.({...n,docsPath:i}),o=[t||`An error occurred.`,``,...n.metaMessages?[...n.metaMessages,``]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...Te.version?[`Version: ${Te.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=we}walk(e){return De(this,e)}};function De(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?De(e.cause,t):t?null:e}var Oe=class extends Ee{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 ke(e,{dir:t,size:n=32}={}){return typeof e==`string`?Ae(e,{dir:t,size:n}):je(e,{dir:t,size:n})}function Ae(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace(`0x`,``);if(r.length>n*2)throw new Oe({size:Math.ceil(r.length/2),targetSize:n,type:`hex`});return`0x${r[t===`right`?`padEnd`:`padStart`](n*2,`0`)}`}function je(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Oe({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 Me=class extends Ee{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`})}},Ne=class extends Ee{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:`SizeOverflowError`})}};function Pe(e,{size:t}){if(Ce(e)>t)throw new Ne({givenSize:Ce(e),maxSize:t})}const Fe=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Ie(e,t={}){return typeof e==`number`||typeof e==`bigint`?ze(e,t):typeof e==`string`?Ve(e,t):typeof e==`boolean`?Le(e,t):Re(e,t)}function Le(e,t={}){let n=`0x${Number(e)}`;return typeof t.size==`number`?(Pe(n,{size:t.size}),ke(n,{size:t.size})):n}function Re(e,t={}){let n=``;for(let t=0;t<e.length;t++)n+=Fe[e[t]];let r=`0x${n}`;return typeof t.size==`number`?(Pe(r,{size:t.size}),ke(r,{dir:`right`,size:t.size})):r}function ze(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 Me({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?ke(s,{size:r}):s}const Be=new TextEncoder;function Ve(e,t={}){return Re(Be.encode(e),t)}const He=new TextEncoder;function Ue(e,t={}){return typeof e==`number`||typeof e==`bigint`?Je(e,t):typeof e==`boolean`?We(e,t):Se(e)?qe(e,t):Ye(e,t)}function We(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size==`number`?(Pe(n,{size:t.size}),ke(n,{size:t.size})):n}const Ge={zero:48,nine:57,A:65,F:70,a:97,f:102};function Ke(e){if(e>=Ge.zero&&e<=Ge.nine)return e-Ge.zero;if(e>=Ge.A&&e<=Ge.F)return e-(Ge.A-10);if(e>=Ge.a&&e<=Ge.f)return e-(Ge.a-10)}function qe(e,t={}){let n=e;t.size&&(Pe(n,{size:t.size}),n=ke(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=Ke(r.charCodeAt(t++)),i=Ke(r.charCodeAt(t++));if(n===void 0||i===void 0)throw new Ee(`Invalid byte sequence ("${r[t-2]}${r[t-1]}" in "${r}").`);a[e]=n*16+i}return a}function Je(e,t){return qe(ze(e,t))}function Ye(e,t={}){let n=He.encode(e);return typeof t.size==`number`?(Pe(n,{size:t.size}),ke(n,{dir:`right`,size:t.size})):n}const Xe=BigInt(2**32-1),Ze=BigInt(32);function Qe(e,t=!1){return t?{h:Number(e&Xe),l:Number(e>>Ze&Xe)}:{h:Number(e>>Ze&Xe)|0,l:Number(e&Xe)|0}}function $e(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=Qe(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}const et=(e,t,n)=>e<<n|t>>>32-n,tt=(e,t,n)=>t<<n|e>>>32-n,nt=(e,t,n)=>t<<n-32|e>>>64-n,rt=(e,t,n)=>e<<n-32|t>>>64-n;function it(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function at(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function ot(e,...t){if(!it(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 st(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function ct(e,t){ot(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function lt(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ut(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const dt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ft(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function pt(e){for(let t=0;t<e.length;t++)e[t]=ft(e[t]);return e}const mt=dt?e=>e:pt;typeof Uint8Array.from([]).toHex==`function`&&Uint8Array.fromHex;function ht(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function gt(e){return typeof e==`string`&&(e=ht(e)),ot(e),e}var _t=class{};function vt(e){let t=t=>e().update(gt(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function yt(e){let t=(t,n)=>e(n).update(gt(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}const bt=BigInt(0),xt=BigInt(1),St=BigInt(2),Ct=BigInt(7),wt=BigInt(256),Tt=BigInt(113),Et=[],Dt=[],Ot=[];for(let e=0,t=xt,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Et.push(2*(5*r+n)),Dt.push((e+1)*(e+2)/2%64);let i=bt;for(let e=0;e<7;e++)t=(t<<xt^(t>>Ct)*Tt)%wt,t&St&&(i^=xt<<(xt<<BigInt(e))-xt);Ot.push(i)}const kt=$e(Ot,!0),At=kt[0],jt=kt[1],Mt=(e,t,n)=>n>32?nt(e,t,n):et(e,t,n),Nt=(e,t,n)=>n>32?rt(e,t,n):tt(e,t,n);function Pt(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,a=n[i],o=n[i+1],s=Mt(a,o,1)^n[r],c=Nt(a,o,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=Dt[n],a=Mt(t,i,r),o=Nt(t,i,r),s=Et[n];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=At[r],e[1]^=jt[r]}ut(n)}var Ft=class e extends _t{constructor(e,t,n,r=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,at(n),!(0<e&&e<200))throw Error(`only keccak-f1600 function is supported`);this.state=new Uint8Array(200),this.state32=lt(this.state)}clone(){return this._cloneInto()}keccak(){mt(this.state32),Pt(this.state32,this.rounds),mt(this.state32),this.posOut=0,this.pos=0}update(e){st(this),e=gt(e),ot(e);let{blockLen:t,state:n}=this,r=e.length;for(let i=0;i<r;){let a=Math.min(t-this.pos,r-i);for(let t=0;t<a;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,t&128&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){st(this,!1),ot(e),this.finish();let t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw Error(`XOF is not possible for this instance`);return this.writeInto(e)}xof(e){return at(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(ct(e,this),this.finished)throw Error(`digest() was already called`);return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,ut(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:i,rounds:a,enableXOF:o}=this;return t||=new e(n,r,i,o,a),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const It=(e,t,n)=>vt(()=>new Ft(t,e,n));It(6,144,224/8),It(6,136,256/8),It(6,104,384/8),It(6,72,512/8),It(1,144,224/8);const Lt=It(1,136,256/8);It(1,104,384/8),It(1,72,512/8);const Rt=(e,t,n)=>yt((r={})=>new Ft(t,e,r.dkLen===void 0?n:r.dkLen,!0));Rt(31,168,128/8),Rt(31,136,256/8);function zt(e,t){let n=t||`hex`,r=Lt(Se(e,{strict:!1})?Ue(e):e);return n===`bytes`?r:Ie(r)}var Bt=class extends Ee{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:[`- Address must be a hex value of 20 bytes (40 hex characters).`,`- Address must match its checksum counterpart.`],name:`InvalidAddressError`})}},Vt=class extends Map{constructor(e){super(),Object.defineProperty(this,`maxSize`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&t!==void 0&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=this.keys().next().value;e&&this.delete(e)}return this}};const Ht=new Vt(8192);function Ut(e,t){if(Ht.has(`${e}.${t}`))return Ht.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=zt(Ye(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 Ht.set(`${e}.${t}`,a),a}const Wt=/^0x[a-fA-F0-9]{40}$/,Gt=new Vt(8192);function Kt(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(Gt.has(r))return Gt.get(r);let i=Wt.test(e)?e.toLowerCase()===e?!0:n?Ut(e)===e:!0:!1;return Gt.set(r,i),i}function qt(e,t){if(!Kt(e,{strict:!1}))throw new Bt({address:e});if(!Kt(t,{strict:!1}))throw new Bt({address:t});return e.toLowerCase()===t.toLowerCase()}let Jt=256,Yt;function Xt(e=11){if(!Yt||Jt+e>256*2){Yt=``,Jt=0;for(let e=0;e<256;e++)Yt+=(256+Math.random()*256|0).toString(16).substring(1)}return Yt.substring(Jt,Jt+++e)}const Zt={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 Qt=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}}},$t=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 en(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 $t;return o.set(t,e=>{e.error?n.reject(new Qt(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 tn(e){return new TextEncoder().encode(JSON.stringify(e))}function nn(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}const rn=`frak-client-id`;function an(){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 on(){if(typeof window>`u`||!window.localStorage)return console.warn(`[Frak SDK] No Window / localStorage available to save the clientId`),an();let e=localStorage.getItem(rn);return e||(e=an(),localStorage.setItem(rn,e)),e}function sn({domain:e}={}){return zt(Ie((e??window.location.host).replace(`www.`,``)))}function cn(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function ln(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 un(e){return cn(tn(e))}function dn(e,t,n,r,i,a){let o=un(fn({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 fn(e){return{r:e.redirectUrl,cId:e.clientId,d:e.directExit,l:e.lang,m:e.merchantId,md:{n:e.metadata?.name,css:e.metadata?.css,l:e.metadata?.logoUrl,h:e.metadata?.homepageLink}}}const pn=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,mn=`frak-sso`;async function hn(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??dn(i??`https://wallet.frak.id`,t,sn(),n.name,on(),r?.css),o=window.open(a,mn,pn);if(!o)throw Error(`Popup was blocked. Please allow popups for this site.`);return o.focus(),await e.request({method:`frak_openSso`,params:[t,n.name,r?.css]})??{}}const gn=`https://backend.frak.id`;function _n(e){return e.includes(`localhost:3000`)||e.includes(`localhost:3010`)}function vn(e){return _n(e)?`http://localhost:3030`:e.includes(`wallet-dev.frak.id`)||e.includes(`wallet.gcp-dev.frak.id`)?`https://backend.gcp-dev.frak.id`:gn}function yn(e){if(e)return vn(e);if(typeof window<`u`){let e=window.FrakSetup?.client?.config?.walletUrl;if(e)return vn(e)}return gn}function bn(e){return nn(ln(e))}function xn(e){return`r`in e&&!(`v`in e)}function Sn(e){return`v`in e&&e.v===2}const Cn=`fCtx`;function wn(e){if(e)try{return Sn(e)?!e.c||!e.m||!e.t?void 0:un({v:2,c:e.c,m:e.m,t:e.t}):cn(qe(e.r))}catch(t){console.error(`Error compressing Frak context`,{e:t,context:e})}}function Tn(e){if(!(!e||e.length===0))try{let t=bn(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=Re(ln(e),{size:20});if(Kt(n))return{r:n}}catch(t){console.error(`Error decompressing Frak context`,{e:t,context:e})}}function En({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(Cn);return t?Tn(t):null}function Dn({url:e,context:t}){if(!e)return null;let n=wn(t);if(!n)return null;let r=new URL(e);return r.searchParams.set(Cn,n),r.toString()}function On(e){let t=new URL(e);return t.searchParams.delete(Cn),t.toString()}function kn({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?On(n):Dn({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}const An={compress:wn,decompress:Tn,parse:En,update:Dn,remove:On,replaceUrl:kn},jn=`frak-merchant-id`;let Mn,Nn;async function Pn(e,t){if(Mn)return Mn;if(typeof window<`u`){let e=window.sessionStorage.getItem(jn);if(e)return Mn=e,e}if(Nn)return Nn;Nn=Fn(e,t);let n=await Nn;return Nn=void 0,n}async function Fn(e,t){let n=e??(typeof window<`u`?window.location.hostname:``);if(n)try{let e=yn(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 Mn=i.merchantId,typeof window<`u`&&window.sessionStorage.setItem(jn,i.merchantId),Mn}catch(e){console.warn(`[Frak SDK] Failed to fetch merchantId:`,e);return}}function In(){Mn=void 0,Nn=void 0,typeof window<`u`&&window.sessionStorage.removeItem(jn)}async function Ln(e,t){return e.metadata?.merchantId?e.metadata.merchantId:Pn(void 0,t)}function Rn(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)}}var zn=zn===void 0?typeof self<`u`?self:typeof window<`u`?window:{}:zn;function Bn(){throw Error(`setTimeout has not been defined`)}function Vn(){throw Error(`clearTimeout has not been defined`)}var Hn=Bn,Un=Vn;typeof zn.setTimeout==`function`&&(Hn=setTimeout),typeof zn.clearTimeout==`function`&&(Un=clearTimeout);function Wn(e){if(Hn===setTimeout)return setTimeout(e,0);if((Hn===Bn||!Hn)&&setTimeout)return Hn=setTimeout,setTimeout(e,0);try{return Hn(e,0)}catch{try{return Hn.call(null,e,0)}catch{return Hn.call(this,e,0)}}}function Gn(e){if(Un===clearTimeout)return clearTimeout(e);if((Un===Vn||!Un)&&clearTimeout)return Un=clearTimeout,clearTimeout(e);try{return Un(e)}catch{try{return Un.call(null,e)}catch{return Un.call(this,e)}}}var Kn=[],qn=!1,Jn,Yn=-1;function Xn(){!qn||!Jn||(qn=!1,Jn.length?Kn=Jn.concat(Kn):Yn=-1,Kn.length&&Zn())}function Zn(){if(!qn){var e=Wn(Xn);qn=!0;for(var t=Kn.length;t;){for(Jn=Kn,Kn=[];++Yn<t;)Jn&&Jn[Yn].run();Yn=-1,t=Kn.length}Jn=null,qn=!1,Gn(e)}}function Qn(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Kn.push(new $n(e,t)),Kn.length===1&&!qn&&Wn(Zn)}function $n(e,t){this.fun=e,this.array=t}$n.prototype.run=function(){this.fun.apply(null,this.array)};var er=`browser`,tr=`browser`,nr=!0,rr={},ir=[],ar=``,or={},sr={},cr={};function lr(){}var ur=lr,dr=lr,fr=lr,pr=lr,mr=lr,hr=lr,gr=lr;function _r(e){throw Error(`process.binding is not supported`)}function vr(){return`/`}function yr(e){throw Error(`process.chdir is not supported`)}function br(){return 0}var xr=zn.performance||{},Sr=xr.now||xr.mozNow||xr.msNow||xr.oNow||xr.webkitNow||function(){return new Date().getTime()};function Cr(e){var t=Sr.call(xr)*.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 wr=new Date;function Tr(){return(new Date-wr)/1e3}var Er={nextTick:Qn,title:er,browser:nr,env:rr,argv:ir,version:ar,versions:or,on:ur,addListener:dr,once:fr,off:pr,removeListener:mr,removeAllListeners:hr,emit:gr,binding:_r,cwd:vr,chdir:yr,umask:br,hrtime:Cr,platform:tr,release:sr,config:cr,uptime:Tr},Dr=[],A=[],Or=typeof Uint8Array<`u`?Uint8Array:Array,kr=!1;function Ar(){kr=!0;for(var e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,t=0,n=e.length;t<n;++t)Dr[t]=e[t],A[e.charCodeAt(t)]=t;A[45]=62,A[95]=63}function jr(e){kr||Ar();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 Or(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=A[e.charCodeAt(t)]<<18|A[e.charCodeAt(t+1)]<<12|A[e.charCodeAt(t+2)]<<6|A[e.charCodeAt(t+3)],o[c++]=i>>16&255,o[c++]=i>>8&255,o[c++]=i&255;return a===2?(i=A[e.charCodeAt(t)]<<2|A[e.charCodeAt(t+1)]>>4,o[c++]=i&255):a===1&&(i=A[e.charCodeAt(t)]<<10|A[e.charCodeAt(t+1)]<<4|A[e.charCodeAt(t+2)]>>2,o[c++]=i>>8&255,o[c++]=i&255),o}function Mr(e){return Dr[e>>18&63]+Dr[e>>12&63]+Dr[e>>6&63]+Dr[e&63]}function Nr(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(Mr(r));return i.join(``)}function Pr(e){kr||Ar();for(var t,n=e.length,r=n%3,i=``,a=[],o=16383,s=0,c=n-r;s<c;s+=o)a.push(Nr(e,s,s+o>c?c:s+o));return r===1?(t=e[n-1],i+=Dr[t>>2],i+=Dr[t<<4&63],i+=`==`):r===2&&(t=(e[n-2]<<8)+e[n-1],i+=Dr[t>>10],i+=Dr[t>>4&63],i+=Dr[t<<2&63],i+=`=`),a.push(i),a.join(``)}function Fr(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 Ir(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 Lr={}.toString,Rr=Array.isArray||function(e){return Lr.call(e)==`[object Array]`},zr=50;j.TYPED_ARRAY_SUPPORT=zn.TYPED_ARRAY_SUPPORT===void 0?!0:zn.TYPED_ARRAY_SUPPORT,Br();function Br(){return j.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Vr(e,t){if(Br()<t)throw RangeError(`Invalid typed array length`);return j.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=j.prototype):(e===null&&(e=new j(t)),e.length=t),e}function j(e,t,n){if(!j.TYPED_ARRAY_SUPPORT&&!(this instanceof j))return new j(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 Gr(this,e)}return Hr(this,e,t,n)}j.poolSize=8192,j._augment=function(e){return e.__proto__=j.prototype,e};function Hr(e,t,n,r){if(typeof t==`number`)throw TypeError(`"value" argument must not be a number`);return typeof ArrayBuffer<`u`&&t instanceof ArrayBuffer?Jr(e,t,n,r):typeof t==`string`?Kr(e,t,n):Yr(e,t)}j.from=function(e,t,n){return Hr(null,e,t,n)},j.TYPED_ARRAY_SUPPORT&&(j.prototype.__proto__=Uint8Array.prototype,j.__proto__=Uint8Array,typeof Symbol<`u`&&Symbol.species&&j[Symbol.species]);function Ur(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 Wr(e,t,n,r){return Ur(t),t<=0||n===void 0?Vr(e,t):typeof r==`string`?Vr(e,t).fill(n,r):Vr(e,t).fill(n)}j.alloc=function(e,t,n){return Wr(null,e,t,n)};function Gr(e,t){if(Ur(t),e=Vr(e,t<0?0:Xr(t)|0),!j.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}j.allocUnsafe=function(e){return Gr(null,e)},j.allocUnsafeSlow=function(e){return Gr(null,e)};function Kr(e,t,n){if((typeof n!=`string`||n===``)&&(n=`utf8`),!j.isEncoding(n))throw TypeError(`"encoding" must be a valid string encoding`);var r=Qr(t,n)|0;e=Vr(e,r);var i=e.write(t,n);return i!==r&&(e=e.slice(0,i)),e}function qr(e,t){var n=t.length<0?0:Xr(t.length)|0;e=Vr(e,n);for(var r=0;r<n;r+=1)e[r]=t[r]&255;return e}function Jr(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),j.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=j.prototype):e=qr(e,t),e}function Yr(e,t){if(Zr(t)){var n=Xr(t.length)|0;return e=Vr(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`||ji(t.length)?Vr(e,0):qr(e,t);if(t.type===`Buffer`&&Rr(t.data))return qr(e,t.data)}throw TypeError(`First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.`)}function Xr(e){if(e>=Br())throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+Br().toString(16)+` bytes`);return e|0}j.isBuffer=Mi;function Zr(e){return!!(e!=null&&e._isBuffer)}j.compare=function(e,t){if(!Zr(e)||!Zr(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},j.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}},j.concat=function(e,t){if(!Rr(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return j.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=j.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(!Zr(a))throw TypeError(`"list" argument must be an Array of Buffers`);a.copy(r,i),i+=a.length}return r};function Qr(e,t){if(Zr(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 Ei(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return ki(e).length;default:if(r)return Ei(e).length;t=(``+t).toLowerCase(),r=!0}}j.byteLength=Qr;function $r(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 hi(this,t,n);case`utf8`:case`utf-8`:return ui(this,t,n);case`ascii`:return pi(this,t,n);case`latin1`:case`binary`:return mi(this,t,n);case`base64`:return li(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return gi(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}j.prototype._isBuffer=!0;function ei(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}j.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)ei(this,t,t+1);return this},j.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)ei(this,t,t+3),ei(this,t+1,t+2);return this},j.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)ei(this,t,t+7),ei(this,t+1,t+6),ei(this,t+2,t+5),ei(this,t+3,t+4);return this},j.prototype.toString=function(){var e=this.length|0;return e===0?``:arguments.length===0?ui(this,0,e):$r.apply(this,arguments)},j.prototype.equals=function(e){if(!Zr(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:j.compare(this,e)===0},j.prototype.inspect=function(){var e=``,t=zr;return this.length>0&&(e=this.toString(`hex`,0,t).match(/.{2}/g).join(` `),this.length>t&&(e+=` ... `)),`<Buffer `+e+`>`},j.prototype.compare=function(e,t,n,r,i){if(!Zr(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 ti(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=j.from(t,r)),Zr(t))return t.length===0?-1:ni(e,t,n,r,i);if(typeof t==`number`)return t&=255,j.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):ni(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function ni(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}j.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},j.prototype.indexOf=function(e,t,n){return ti(this,e,t,n,!0)},j.prototype.lastIndexOf=function(e,t,n){return ti(this,e,t,n,!1)};function ri(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 ii(e,t,n,r){return Ai(Ei(t,e.length-n),e,n,r)}function ai(e,t,n,r){return Ai(Di(t),e,n,r)}function oi(e,t,n,r){return ai(e,t,n,r)}function si(e,t,n,r){return Ai(ki(t),e,n,r)}function ci(e,t,n,r){return Ai(Oi(t,e.length-n),e,n,r)}j.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 ri(this,e,t,n);case`utf8`:case`utf-8`:return ii(this,e,t,n);case`ascii`:return ai(this,e,t,n);case`latin1`:case`binary`:return oi(this,e,t,n);case`base64`:return si(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ci(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},j.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function li(e,t,n){return t===0&&n===e.length?Pr(e):Pr(e.slice(t,n))}function ui(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 fi(r)}var di=4096;function fi(e){var t=e.length;if(t<=di)return String.fromCharCode.apply(String,e);for(var n=``,r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=di));return n}function pi(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 mi(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 hi(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+=Ti(e[a]);return i}function gi(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}j.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(j.TYPED_ARRAY_SUPPORT)r=this.subarray(e,t),r.__proto__=j.prototype;else{var i=t-e;r=new j(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r};function M(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`)}j.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||M(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},j.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||M(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},j.prototype.readUInt8=function(e,t){return t||M(e,1,this.length),this[e]},j.prototype.readUInt16LE=function(e,t){return t||M(e,2,this.length),this[e]|this[e+1]<<8},j.prototype.readUInt16BE=function(e,t){return t||M(e,2,this.length),this[e]<<8|this[e+1]},j.prototype.readUInt32LE=function(e,t){return t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},j.prototype.readUInt32BE=function(e,t){return t||M(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},j.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||M(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},j.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||M(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},j.prototype.readInt8=function(e,t){return t||M(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},j.prototype.readInt16LE=function(e,t){t||M(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},j.prototype.readInt16BE=function(e,t){t||M(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},j.prototype.readInt32LE=function(e,t){return t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},j.prototype.readInt32BE=function(e,t){return t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},j.prototype.readFloatLE=function(e,t){return t||M(e,4,this.length),Fr(this,e,!0,23,4)},j.prototype.readFloatBE=function(e,t){return t||M(e,4,this.length),Fr(this,e,!1,23,4)},j.prototype.readDoubleLE=function(e,t){return t||M(e,8,this.length),Fr(this,e,!0,52,8)},j.prototype.readDoubleBE=function(e,t){return t||M(e,8,this.length),Fr(this,e,!1,52,8)};function N(e,t,n,r,i,a){if(!Zr(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`)}j.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var i=2**(8*n)-1;N(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},j.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var i=2**(8*n)-1;N(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},j.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),j.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e&255,t+1};function _i(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}j.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),j.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):_i(this,e,t,!0),t+2},j.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),j.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):_i(this,e,t,!1),t+2};function vi(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}j.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),j.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255):vi(this,e,t,!0),t+4},j.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),j.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):vi(this,e,t,!1),t+4},j.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=2**(8*n-1);N(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},j.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=2**(8*n-1);N(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},j.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),j.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=e&255,t+1},j.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),j.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):_i(this,e,t,!0),t+2},j.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),j.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):_i(this,e,t,!1),t+2},j.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),j.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):vi(this,e,t,!0),t+4},j.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),j.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):vi(this,e,t,!1),t+4};function yi(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function bi(e,t,n,r,i){return i||yi(e,t,n,4),Ir(e,t,n,r,23,4),n+4}j.prototype.writeFloatLE=function(e,t,n){return bi(this,e,t,!0,n)},j.prototype.writeFloatBE=function(e,t,n){return bi(this,e,t,!1,n)};function xi(e,t,n,r,i){return i||yi(e,t,n,8),Ir(e,t,n,r,52,8),n+8}j.prototype.writeDoubleLE=function(e,t,n){return xi(this,e,t,!0,n)},j.prototype.writeDoubleBE=function(e,t,n){return xi(this,e,t,!1,n)},j.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||!j.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},j.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`&&!j.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=Zr(e)?e:Ei(new j(e,r).toString()),s=o.length;for(a=0;a<n-t;++a)this[a+t]=o[a%s]}return this};var Si=/[^+\/0-9A-Za-z-_]/g;function Ci(e){if(e=wi(e).replace(Si,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function wi(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,``)}function Ti(e){return e<16?`0`+e.toString(16):e.toString(16)}function Ei(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 Di(e){for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function Oi(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 ki(e){return jr(Ci(e))}function Ai(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 ji(e){return e!==e}function Mi(e){return e!=null&&(!!e._isBuffer||Ni(e)||Pi(e))}function Ni(e){return!!e.constructor&&typeof e.constructor.isBuffer==`function`&&e.constructor.isBuffer(e)}function Pi(e){return typeof e.readFloatLE==`function`&&typeof e.slice==`function`&&Ni(e.slice(0,0))}var Fi=Object.defineProperty,Ii=(e,t,n)=>t in e?Fi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P=(e,t,n)=>Ii(e,typeof t==`symbol`?t:t+``,n),Li=Object.defineProperty,Ri=(e,t,n)=>t in e?Li(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zi=(e,t,n)=>Ri(e,typeof t==`symbol`?t:t+``,n),F=(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))(F||{});const Bi={Node:[`childNodes`,`parentNode`,`parentElement`,`textContent`,`ownerDocument`],ShadowRoot:[`host`,`styleSheets`],Element:[`shadowRoot`,`querySelector`,`querySelectorAll`],MutationObserver:[]},Vi={Node:[`contains`,`getRootNode`],ShadowRoot:[`getSelection`],Element:[],MutationObserver:[`constructor`]},Hi={},Ui=()=>!!globalThis.Zone;function Wi(e){if(Hi[e])return Hi[e];let t=globalThis[e],n=t.prototype,r=e in Bi?Bi[e]:void 0,i=!!(r&&r.every(e=>!!(Object.getOwnPropertyDescriptor(n,e)?.get)?.toString().includes(`[native code]`))),a=e in Vi?Vi[e]:void 0,o=!!(a&&a.every(e=>typeof n[e]==`function`&&n[e]?.toString().includes(`[native code]`)));if(i&&o&&!Ui())return Hi[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?Hi[e]=a:n}catch{return n}}const Gi={};function Ki(e,t,n){let r=`${e}.${String(n)}`;if(Gi[r])return Gi[r].call(t);let i=Wi(e),a=Object.getOwnPropertyDescriptor(i,n)?.get;return a?(Gi[r]=a,a.call(t)):t[n]}const qi={};function Ji(e,t,n){let r=`${e}.${String(n)}`;if(qi[r])return qi[r].bind(t);let i=Wi(e)[n];return typeof i==`function`?(qi[r]=i,i.bind(t)):t[n]}function Yi(e){return Ki(`Node`,e,`ownerDocument`)}function Xi(e){return Ki(`Node`,e,`childNodes`)}function Zi(e){return Ki(`Node`,e,`parentNode`)}function Qi(e){return Ki(`Node`,e,`parentElement`)}function $i(e){return Ki(`Node`,e,`textContent`)}function ea(e,t){return Ji(`Node`,e,`contains`)(t)}function ta(e){return Ji(`Node`,e,`getRootNode`)()}function na(e){return!e||!(`host`in e)?null:Ki(`ShadowRoot`,e,`host`)}function ra(e){return e.styleSheets}function ia(e){return!e||!(`shadowRoot`in e)?null:Ki(`Element`,e,`shadowRoot`)}function aa(e,t){return Ki(`Element`,e,`querySelector`)(t)}function oa(e,t){return Ki(`Element`,e,`querySelectorAll`)(t)}function sa(){return Wi(`MutationObserver`).constructor}function ca(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()=>{}}}const I={ownerDocument:Yi,childNodes:Xi,parentNode:Zi,parentElement:Qi,textContent:$i,contains:ea,getRootNode:ta,host:na,styleSheets:ra,shadowRoot:ia,querySelector:aa,querySelectorAll:oa,mutationObserver:sa,patch:ca};function la(e){return e.nodeType===e.ELEMENT_NODE}function ua(e){let t=e&&`host`in e&&`mode`in e&&I.host(e)||null;return!!(t&&`shadowRoot`in t&&I.shadowRoot(t)===e)}function da(e){return Object.prototype.toString.call(e)===`[object ShadowRoot]`}function fa(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 pa(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 ma(e){try{let t=e.rules||e.cssRules;if(!t)return null;let n=e.href;return!n&&e.ownerNode&&(n=e.ownerNode.baseURI),fa(Array.from(t,e=>ha(e,n)).join(``))}catch{return null}}function ha(e,t){if(_a(e)){let t;try{t=ma(e.styleSheet)||pa(e)}catch{t=e.cssText}return e.styleSheet.href?Ma(t,e.styleSheet.href):t}else{let n=e.cssText;return va(e)&&e.selectorText.includes(`:`)&&(n=ga(n)),t?Ma(n,t):n}}function ga(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,`$1\\$2`)}function _a(e){return`styleSheet`in e}function va(e){return`selectorText`in e}var ya=class{constructor(){zi(this,`idNodeMap`,new Map),zi(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 ba(){return new ya}function xa({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:a}){let o=i||``,s=r&&Sa(r);return(t[n.toLowerCase()]||s&&t[s])&&(o=a?a(o,e):`*`.repeat(o.length)),o}function Sa(e){return e.toLowerCase()}const Ca=`__rrweb_original__`;function wa(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=Ca in i?i[Ca]: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 Ta(e){let t=e.type;return e.hasAttribute(`data-rr-is-password`)?`password`:t?Sa(t):null}function Ea(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 Da(e){let t=``;return t=e.indexOf(`//`)>-1?e.split(`/`).slice(0,3).join(`/`):e.split(`/`)[0],t=t.split(`?`)[0],t}const Oa=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ka=/^(?:[a-z+]+:)?\/\//i,Aa=/^www\..*/i,ja=/^(data:)([^,]*),(.*)/i;function Ma(e,t){return(e||``).replace(Oa,(e,n,r,i,a,o)=>{let s=r||a||o,c=n||i||``;if(!s)return e;if(ka.test(s)||Aa.test(s)||ja.test(s))return`url(${c}${s}${c})`;if(s[0]===`/`)return`url(${c}${Da(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 Na(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,``):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,``).replace(/0px/g,`0`)}function Pa(e,t,n=!1){let r=Array.from(t.childNodes),i=[],a=0;if(r.length>1&&e&&typeof e==`string`){let t=Na(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=Na(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=Na(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=Na(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 Fa(e,t){return Pa(e,t).join(`/* rr_split */`)}let Ia=1;const La=RegExp(`[^a-z0-9-_:]`);function Ra(){return Ia++}function za(e){if(e instanceof HTMLFormElement)return`form`;let t=Sa(e.tagName);return La.test(t)?`div`:t}let Ba,Va;const Ha=/^[^ \t\n\r\u000c]+/,Ua=/^[, \t\n\r\u000c]+/;function Wa(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(Ua),!(n>=t.length);){let a=r(Ha);if(a.slice(-1)===`,`)a=Ka(e,a.substring(0,a.length-1)),i.push(a);else{let r=``;a=Ka(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(`, `)}const Ga=new WeakMap;function Ka(e,t){return!t||t.trim()===``?t:Ja(e,t)}function qa(e){return!!(e.tagName===`svg`||e.ownerSVGElement)}function Ja(e,t){let n=Ga.get(e);if(n||(n=e.createElement(`a`),Ga.set(e,n)),!t)t=``;else if(t.startsWith(`blob:`)||t.startsWith(`data:`))return t;return n.setAttribute(`href`,t),n.href}function Ya(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)?Ka(e,r):n===`srcset`?Wa(e,r):n===`style`?Ma(r,Ja(e)):t===`object`&&n===`data`?Ka(e,r):r)}function Xa(e,t,n){return[`video`,`audio`].includes(e)&&t===`autoplay`}function Za(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 Qa(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?Qa(I.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?Qa(I.parentNode(e),t,n):!1}function $a(e,t,n,r){let i;if(la(e)){if(i=e,!I.childNodes(i).length)return!1}else if(I.parentElement(e)===null)return!1;else i=I.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(Qa(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 eo(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 to(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 no(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,_=ro(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode===`CSS1Compat`?{type:F.Document,childNodes:[]}:{type:F.Document,childNodes:[],compatMode:e.compatMode};case e.DOCUMENT_TYPE_NODE:return{type:F.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:_};case e.ELEMENT_NODE:return ao(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 io(e,{doc:n,needsMask:o,maskTextFn:l,rootId:_,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:F.CDATA,textContent:``,rootId:_};case e.COMMENT_NODE:return{type:F.Comment,textContent:I.textContent(e)||``,rootId:_};default:return!1}}function ro(e,t){if(!t.hasNode(e))return;let n=t.getId(e);return n===1?void 0:n}function io(e,t){let{needsMask:n,maskTextFn:r,rootId:i,cssCaptured:a}=t,o=I.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=I.textContent(e),l&&c&&(c=Ma(c,Ja(t.doc)))),!l&&!u&&c&&n&&(c=r?r(c,I.parentElement(e)):c.replace(/[\S]/g,`*`)),{type:F.Text,textContent:c||``,rootId:i}}function ao(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=Za(e,r,i),h=za(e),g={},_=e.attributes.length;for(let t=0;t<_;t++){let r=e.attributes[t];Xa(h,r.name,r.value)||(g[r.name]=Ya(n,h,Sa(r.name),r.value))}if(h===`link`&&a){let t=Array.from(n.styleSheets).find(t=>t.href===e.href),r=null;t&&(r=ma(t)),r&&(delete g.rel,delete g.href,g._cssText=r)}if(h===`style`&&e.sheet){let t=ma(e.sheet);t&&(e.childNodes.length>1&&(t=Fa(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=xa({element:e,type:Ta(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`)wa(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){Ba||(Ba=n.createElement(`canvas`),Va=Ba.getContext(`2d`));let t=e,r=t.currentSrc||t.getAttribute(`src`)||`<unknown-src>`,i=t.crossOrigin,a=()=>{t.removeEventListener(`load`,a);try{Ba.width=t.naturalWidth,Ba.height=t.naturalHeight,Va.drawImage(t,0,0),g.rr_dataURL=Ba.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:F.Element,tagName:h,attributes:g,childNodes:[],isSVG:qa(e)||void 0,needBlock:m,rootId:p,isCustom:v}}function L(e){return e==null?``:e.toLowerCase()}function oo(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 so(e,t){return!!(t.comment&&e.type===F.Comment||e.type===F.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`&&Ea(e.attributes.href)===`js`)||t.headFavicon&&(e.tagName===`link`&&e.attributes.rel===`shortcut icon`||e.tagName===`meta`&&(L(e.attributes.name).match(/^msapplication-tile(image|color)$/)||L(e.attributes.name)===`application-name`||L(e.attributes.rel)===`icon`||L(e.attributes.rel)===`apple-touch-icon`||L(e.attributes.rel)===`shortcut icon`))||e.tagName===`meta`&&(t.headMetaDescKeywords&&L(e.attributes.name).match(/^description|keywords$/)||t.headMetaSocial&&(L(e.attributes.property).match(/^(og|twitter|fb):/)||L(e.attributes.name).match(/^(og|twitter):/)||L(e.attributes.name)===`pinterest`)||t.headMetaRobots&&(L(e.attributes.name)===`robots`||L(e.attributes.name)===`googlebot`||L(e.attributes.name)===`bingbot`)||t.headMetaHttpEquiv&&e.attributes[`http-equiv`]!==void 0||t.headMetaAuthorship&&(L(e.attributes.name)===`author`||L(e.attributes.name)===`generator`||L(e.attributes.name)===`framework`||L(e.attributes.name)===`publisher`||L(e.attributes.name)===`progid`||L(e.attributes.property).match(/^article:/)||L(e.attributes.property).match(/^product:/))||t.headMetaVerification&&(L(e.attributes.name)===`google-site-verification`||L(e.attributes.name)===`yandex-verification`||L(e.attributes.name)===`csrf-token`||L(e.attributes.name)===`p:domain_verify`||L(e.attributes.name)===`verify-v1`||L(e.attributes.name)===`verification`||L(e.attributes.name)===`shopify-checkout-api-token`))))}function co(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:x=5e3,keepIframeSrcFn:S=()=>!1,newlyAddedElement:C=!1,cssCaptured:w=!1}=t,{needsMask:T}=t,{preserveWhiteSpace:ee=!0}=t;T||=$a(e,o,s,T===void 0);let E=no(e,{doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:T,inlineStylesheet:l,maskInputOptions:u,maskTextFn:d,maskInputFn:f,dataURLOptions:m,inlineImages:h,recordCanvas:g,keepIframeSrcFn:S,newlyAddedElement:C,cssCaptured:w});if(!E)return console.warn(e,`not serialized`),null;let D;D=r.hasNode(e)?r.getId(e):so(E,p)||!ee&&E.type===F.Text&&!E.textContent.replace(/^\s+|\s+$/gm,``).length?-2:Ra();let O=Object.assign(E,{id:D});if(r.add(e,O),D===-2)return null;_&&_(e);let te=!c;if(O.type===F.Element){te&&=!O.needBlock,delete O.needBlock;let t=I.shadowRoot(e);t&&da(t)&&(O.isShadowHost=!0)}if((O.type===F.Document||O.type===F.Element)&&te){p.headWhitespace&&O.type===F.Element&&O.tagName===`head`&&(ee=!1);let t={doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:T,maskTextClass:o,maskTextSelector:s,skipChild:c,inlineStylesheet:l,maskInputOptions:u,maskTextFn:d,maskInputFn:f,slimDOMOptions:p,dataURLOptions:m,inlineImages:h,recordCanvas:g,preserveWhiteSpace:ee,onSerialize:_,onIframeLoad:v,iframeLoadTimeout:y,onStylesheetLoad:b,stylesheetLoadTimeout:x,keepIframeSrcFn:S,cssCaptured:!1};if(!(O.type===F.Element&&O.tagName===`textarea`&&O.attributes.value!==void 0)){O.type===F.Element&&O.attributes._cssText!==void 0&&typeof O.attributes._cssText==`string`&&(t.cssCaptured=!0);for(let n of Array.from(I.childNodes(e))){let e=co(n,t);e&&O.childNodes.push(e)}}let C=null;if(la(e)&&(C=I.shadowRoot(e)))for(let e of Array.from(I.childNodes(C))){let n=co(e,t);n&&(da(C)&&(n.isShadow=!0),O.childNodes.push(n))}}let ne=I.parentNode(e);return ne&&ua(ne)&&da(ne)&&(O.isShadow=!0),O.type===F.Element&&O.tagName===`iframe`&&eo(e,()=>{let t=e.contentDocument;if(t&&v){let n=co(t,{doc:t,mirror:r,blockClass:i,blockSelector:a,needsMask:T,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:l,maskInputOptions:u,maskTextFn:d,maskInputFn:f,slimDOMOptions:p,dataURLOptions:m,inlineImages:h,recordCanvas:g,preserveWhiteSpace:ee,onSerialize:_,onIframeLoad:v,iframeLoadTimeout:y,onStylesheetLoad:b,stylesheetLoadTimeout:x,keepIframeSrcFn:S});n&&v(e,n)}},y),O.type===F.Element&&O.tagName===`link`&&typeof O.attributes.rel==`string`&&(O.attributes.rel===`stylesheet`||O.attributes.rel===`preload`&&typeof O.attributes.href==`string`&&Ea(O.attributes.href)===`css`)&&to(e,()=>{if(b){let t=co(e,{doc:n,mirror:r,blockClass:i,blockSelector:a,needsMask:T,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:l,maskInputOptions:u,maskTextFn:d,maskInputFn:f,slimDOMOptions:p,dataURLOptions:m,inlineImages:h,recordCanvas:g,preserveWhiteSpace:ee,onSerialize:_,onIframeLoad:v,iframeLoadTimeout:y,onStylesheetLoad:b,stylesheetLoadTimeout:x,keepIframeSrcFn:S});t&&b(e,t)}},x),O}function lo(e,t){let{mirror:n=new ya,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:x=()=>!1}=t||{};return co(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:oo(p),dataURLOptions:m,inlineImages:c,recordCanvas:l,preserveWhiteSpace:h,onSerialize:g,onIframeLoad:_,iframeLoadTimeout:v,onStylesheetLoad:y,stylesheetLoadTimeout:b,keepIframeSrcFn:x,newlyAddedElement:!1})}function uo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function fo(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 po={exports:{}},R=String,mo=function(){return{isColorSupported:!1,reset:R,bold:R,dim:R,italic:R,underline:R,inverse:R,hidden:R,strikethrough:R,black:R,red:R,green:R,yellow:R,blue:R,magenta:R,cyan:R,white:R,gray:R,bgBlack:R,bgRed:R,bgGreen:R,bgYellow:R,bgBlue:R,bgMagenta:R,bgCyan:R,bgWhite:R}};po.exports=mo(),po.exports.createColors=mo;var ho=po.exports;const go=fo(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:`Module`})));let _o=ho,vo=go,yo=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??=_o.isColorSupported,vo&&e&&(t=vo(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}=_o.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 bo=yo;yo.default=yo;var xo={};xo.isClean=Symbol(`isClean`),xo.my=Symbol(`my`);const So={after:`
8
+ `,beforeClose:`
9
+ `,beforeComment:`
10
+ `,beforeDecl:`
11
+ `,beforeOpen:` `,beforeRule:`
12
+ `,colon:`: `,commentLeft:` `,commentRight:` `,emptyBody:``,indent:` `,semicolon:!1};function Co(e){return e[0].toUpperCase()+e.slice(1)}let wo=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 So[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`+Co(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=So[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 To=wo;wo.default=wo;let Eo=To;function Do(e,t){new Eo(t).stringify(e)}var Oo=Do;Do.default=Do;let{isClean:ko,my:Ao}=xo,jo=bo,Mo=To,No=Oo;function Po(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=>Po(e,n)):(a===`object`&&i!==null&&(i=Po(i)),n[r]=i)}return n}let Fo=class{constructor(e={}){this.raws={},this[ko]=!1,this[Ao]=!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=Po(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 jo(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[ko]){this[ko]=!1;let e=this;for(;e=e.parent;)e[ko]=!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 Mo().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=No){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 Io=Fo;Fo.default=Fo;let Lo=Io,Ro=class extends Lo{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 zo=Ro;Ro.default=Ro;var Bo={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:Vo,SourceMapGenerator:Ho}=go,{existsSync:Uo,readFileSync:Wo}=go,{dirname:Go,join:Ko}=go;function qo(e){return j?j.from(e,`base64`).toString():window.atob(e)}let Jo=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=Go(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||=new Vo(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 qo(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=Go(e),Uo(e))return this.mapFile=e,Wo(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 Vo)return Ho.fromSourceMap(t).toString();else if(t instanceof Ho)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=Ko(Go(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 Yo=Jo;Jo.default=Jo;let{SourceMapConsumer:Xo,SourceMapGenerator:Zo}=go,{fileURLToPath:Qo,pathToFileURL:$o}=go,{isAbsolute:es,resolve:ts}=go,{nanoid:ns}=Bo,rs=go,is=bo,as=Yo,os=Symbol(`fromOffsetCache`),ss=!!(Xo&&Zo),cs=!!(ts&&es),ls=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&&(!cs||/^\w+:\/\//.test(t.from)||es(t.from)?this.file=t.from:this.file=ts(t.from)),cs&&ss){let e=new as(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 `+ns(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 is(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 is(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&&($o&&(i.input.url=$o(this.file).toString()),i.input.file=this.file),i}fromOffset(e){let t,n;if(this[os])n=this[os];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[os]=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:ts(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=es(a.source)?$o(a.source):new URL(a.source,this.map.consumer().sourceRoot||$o(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(Qo)c.file=Qo(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 us=ls;ls.default=ls,rs&&rs.registerInput&&rs.registerInput(ls);let{SourceMapConsumer:ds,SourceMapGenerator:fs}=go,{dirname:ps,relative:ms,resolve:hs,sep:gs}=go,{pathToFileURL:_s}=go,vs=us,ys=!!(ds&&fs),bs=!!(ps&&hs&&ms&&gs);var xs=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||ps(e.file),r;this.mapOpts.sourcesContent===!1?(r=new ds(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(),bs&&ys&&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=fs.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new fs({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 fs({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?ps(this.opts.to):`.`;typeof this.mapOpts.annotation==`string`&&(n=ps(hs(n,this.mapOpts.annotation)));let r=ms(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 vs(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 j?j.from(e).toString(`base64`):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(_s){let t=_s(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;gs===`\\`&&(e=e.replace(/\\/g,`/`));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}};let Ss=Io,Cs=class extends Ss{constructor(e){super(e),this.type=`comment`}};var ws=Cs;Cs.default=Cs;let{isClean:Ts,my:Es}=xo,Ds=zo,Os=ws,ks=Io,As,js,Ms,Ns;function Ps(e){return e.map(e=>(e.nodes&&=Ps(e.nodes),delete e.source,e))}function Fs(e){if(e[Ts]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Fs(t)}let Is=class e extends ks{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=Ps(As(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 Ds(t)]}else if(t.selector)t=[new js(t)];else if(t.name)t=[new Ms(t)];else if(t.text)t=[new Os(t)];else throw Error(`Unknown node type in node creation`);return t.map(t=>(t[Es]||e.rebuild(t),t=t.proxyOf,t.parent&&t.parent.removeChild(t),t[Ts]&&Fs(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]}};Is.registerParse=e=>{As=e},Is.registerRule=e=>{js=e},Is.registerAtRule=e=>{Ms=e},Is.registerRoot=e=>{Ns=e};var Ls=Is;Is.default=Is,Is.rebuild=e=>{e.type===`atrule`?Object.setPrototypeOf(e,Ms.prototype):e.type===`rule`?Object.setPrototypeOf(e,js.prototype):e.type===`decl`?Object.setPrototypeOf(e,Ds.prototype):e.type===`comment`?Object.setPrototypeOf(e,Os.prototype):e.type===`root`&&Object.setPrototypeOf(e,Ns.prototype),e[Es]=!0,e.nodes&&e.nodes.forEach(e=>{Is.rebuild(e)})};let Rs=Ls,zs,Bs,Vs=class extends Rs{constructor(e){super({type:`document`,...e}),this.nodes||=[]}toResult(e={}){return new zs(new Bs,this,e).stringify()}};Vs.registerLazyResult=e=>{zs=e},Vs.registerProcessor=e=>{Bs=e};var Hs=Vs;Vs.default=Vs;let Us=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 Ws=Us;Us.default=Us;let Gs=Ws,Ks=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 Gs(e,t);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>e.type===`warning`)}get content(){return this.css}};var qs=Ks;Ks.default=Ks;const Js=/[\t\n\f\r "#'()/;[\\\]{}]/g,Ys=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Xs=/.[\r\n"'(/\\]/,Zs=/[\da-f]/i;var Qs=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 x(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||Xs.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:Js.lastIndex=h+1,Js.test(n),a=Js.lastIndex===0?n.length-1:Js.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,Zs.test(n.charAt(a)))){for(;Zs.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):(Ys.lastIndex=h+1,Ys.test(n),a=Ys.lastIndex===0?n.length-1:Ys.lastIndex-2,p=[`word`,n.slice(h,a+1),h,a],g.push(p),h=a);break}return h++,p}function S(e){_.push(e)}return{back:S,endOfFile:b,nextToken:x,position:v}};let $s=Ls,ec=class extends $s{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 tc=ec;ec.default=ec,$s.registerAtRule(ec);let nc=Ls,rc,ic,ac=class extends nc{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 rc(new ic,this,e).stringify()}};ac.registerLazyResult=e=>{rc=e},ac.registerProcessor=e=>{ic=e};var oc=ac;ac.default=ac,nc.registerRoot(ac);let sc={comma(e){return sc.split(e,[`,`],!0)},space(e){return sc.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 cc=sc;sc.default=sc;let lc=Ls,uc=cc,dc=class extends lc{constructor(e){super(e),this.type=`rule`,this.nodes||=[]}get selectors(){return uc.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 fc=dc;dc.default=dc,lc.registerRule(dc);let pc=zo,mc=Qs,hc=ws,gc=tc,_c=oc,vc=fc;const yc={empty:!0,space:!0};function bc(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var xc=class{constructor(e){this.input=e,this.root=new _c,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 gc;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 hc;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=mc(this.input)}decl(e,t){let n=new pc;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]||bc(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 vc;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`,!yc[u]&&!yc[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 vc;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 Sc=Ls,Cc=xc,wc=us;function Tc(e,t){let n=new Cc(new wc(e,t));try{n.parse()}catch(e){throw e}return n.root}var Ec=Tc;Tc.default=Tc,Sc.registerParse(Tc);let{isClean:Dc,my:Oc}=xo,kc=xs,Ac=Oo,jc=Ls,Mc=Hs,Nc=qs,Pc=Ec,Fc=oc;const Ic={atrule:`AtRule`,comment:`Comment`,decl:`Declaration`,document:`Document`,root:`Root`,rule:`Rule`},Lc={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},Rc={Once:!0,postcssPlugin:!0,prepare:!0};function zc(e){return typeof e==`object`&&typeof e.then==`function`}function Bc(e){let t=!1,n=Ic[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 Vc(e){let t;return t=e.type===`document`?[`Document`,0,`DocumentExit`]:e.type===`root`?[`Root`,0,`RootExit`]:Bc(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Hc(e){return e[Dc]=!1,e.nodes&&e.nodes.forEach(e=>Hc(e)),e}let Uc={},Wc=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=Hc(n);else if(n instanceof e||n instanceof Nc)i=Hc(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=Pc;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[Oc]&&jc.rebuild(i)}this.result=new Nc(t,i,r),this.helpers={...Uc,postcss:Uc,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(!Lc[n]&&/^[A-Z]/.test(n))throw Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Rc[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(zc(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Dc];){e[Dc]=!0;let t=[Vc(e)];for(;t.length>0;){let e=this.visitTick(t);if(zc(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 zc(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=Ac;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new kc(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(zc(this.runOnRoot(e)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Dc];)e[Dc]=!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(zc(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[Dc]){i[Dc]=!0,e.push(Vc(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[Dc]=!0,t.iterator=n.getIterator());return}else if(this.listeners[e]){t.visitors=this.listeners[e];return}}e.pop()}walkSync(e){e[Dc]=!0;let t=Bc(e);for(let n of t)if(n===0)e.nodes&&e.each(e=>{e[Dc]||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`}};Wc.registerPostcss=e=>{Uc=e};var Gc=Wc;Wc.default=Wc,Fc.registerLazyResult(Wc),Mc.registerLazyResult(Wc);let Kc=xs,qc=Oo,Jc=Ec;const Yc=qs;let Xc=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=qc;this.result=new Yc(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 Kc(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=Jc;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 Zc=Xc;Xc.default=Xc;let Qc=Zc,$c=Gc,el=Hs,tl=oc,nl=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 Qc(this,e,t):new $c(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var rl=nl;nl.default=nl,tl.registerProcessor(nl),el.registerProcessor(nl);let il=zo,al=Yo,ol=ws,sl=tc,cl=us,ll=oc,ul=fc;function dl(e,t){if(Array.isArray(e))return e.map(e=>dl(e));let{inputs:n,...r}=e;if(n){t=[];for(let e of n){let n={...e,__proto__:cl.prototype};n.map&&={...n.map,__proto__:al.prototype},t.push(n)}}if(r.nodes&&=e.nodes.map(e=>dl(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 ll(r);if(r.type===`decl`)return new il(r);if(r.type===`rule`)return new ul(r);if(r.type===`comment`)return new ol(r);if(r.type===`atrule`)return new sl(r);throw Error(`Unknown node type: `+e.type)}var fl=dl;dl.default=dl;let pl=bo,ml=zo,hl=Gc,gl=Ls,_l=rl,vl=Oo,yl=fl,bl=Hs,xl=Ws,Sl=ws,Cl=tc,wl=qs,Tl=us,El=Ec,Dl=cc,Ol=fc,kl=oc,Al=Io;function z(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new _l(e)}z.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`),Er.env.LANG&&Er.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 _l().version,i}let i;return Object.defineProperty(r,`postcss`,{get(){return i||=r(),i}}),r.process=function(e,t,n){return z([r(n)]).process(e,t)},r},z.stringify=vl,z.parse=El,z.fromJSON=yl,z.list=Dl,z.comment=e=>new Sl(e),z.atRule=e=>new Cl(e),z.decl=e=>new ml(e),z.rule=e=>new Ol(e),z.root=e=>new kl(e),z.document=e=>new bl(e),z.CssSyntaxError=pl,z.Declaration=ml,z.Container=gl,z.Processor=_l,z.Document=bl,z.Comment=Sl,z.Warning=xl,z.AtRule=Cl,z.Result=wl,z.Input=Tl,z.Rule=Ol,z.Root=kl,z.Node=Al,hl.registerPostcss(z);var jl=z;z.default=z;const B=uo(jl);B.stringify,B.fromJSON,B.plugin,B.parse,B.list,B.document,B.comment,B.atRule,B.rule,B.decl,B.root,B.CssSyntaxError,B.Declaration,B.Container,B.Processor,B.Document,B.Comment,B.Warning,B.AtRule,B.Result,B.Input,B.Rule,B.Root,B.Node;var Ml=Object.defineProperty,Nl=(e,t,n)=>t in e?Ml(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,V=(e,t,n)=>Nl(e,typeof t==`symbol`?t:t+``,n);function Pl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function Fl(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 Il={exports:{}},H=String,Ll=function(){return{isColorSupported:!1,reset:H,bold:H,dim:H,italic:H,underline:H,inverse:H,hidden:H,strikethrough:H,black:H,red:H,green:H,yellow:H,blue:H,magenta:H,cyan:H,white:H,gray:H,bgBlack:H,bgRed:H,bgGreen:H,bgYellow:H,bgBlue:H,bgMagenta:H,bgCyan:H,bgWhite:H}};Il.exports=Ll(),Il.exports.createColors=Ll;var Rl=Il.exports;const zl=Fl(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:`Module`})));let Bl=Rl,Vl=zl,Hl=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??=Bl.isColorSupported,Vl&&e&&(t=Vl(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}=Bl.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 Ul=Hl;Hl.default=Hl;var Wl={};Wl.isClean=Symbol(`isClean`),Wl.my=Symbol(`my`);const Gl={after:`
33
+ `,beforeClose:`
34
+ `,beforeComment:`
35
+ `,beforeDecl:`
36
+ `,beforeOpen:` `,beforeRule:`
37
+ `,colon:`: `,commentLeft:` `,commentRight:` `,emptyBody:``,indent:` `,semicolon:!1};function Kl(e){return e[0].toUpperCase()+e.slice(1)}let ql=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 Gl[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`+Kl(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=Gl[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 Jl=ql;ql.default=ql;let Yl=Jl;function Xl(e,t){new Yl(t).stringify(e)}var Zl=Xl;Xl.default=Xl;let{isClean:Ql,my:$l}=Wl,eu=Ul,tu=Jl,nu=Zl;function ru(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=>ru(e,n)):(a===`object`&&i!==null&&(i=ru(i)),n[r]=i)}return n}let iu=class{constructor(e={}){this.raws={},this[Ql]=!1,this[$l]=!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=ru(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 eu(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[Ql]){this[Ql]=!1;let e=this;for(;e=e.parent;)e[Ql]=!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 tu().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=nu){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 au=iu;iu.default=iu;let ou=au,su=class extends ou{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 cu=su;su.default=su;var lu={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:uu,SourceMapGenerator:du}=zl,{existsSync:fu,readFileSync:pu}=zl,{dirname:mu,join:hu}=zl;function gu(e){return j?j.from(e,`base64`).toString():window.atob(e)}let _u=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=mu(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||=new uu(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 gu(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=mu(e),fu(e))return this.mapFile=e,pu(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 uu)return du.fromSourceMap(t).toString();else if(t instanceof du)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=hu(mu(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 vu=_u;_u.default=_u;let{SourceMapConsumer:yu,SourceMapGenerator:bu}=zl,{fileURLToPath:xu,pathToFileURL:Su}=zl,{isAbsolute:Cu,resolve:wu}=zl,{nanoid:Tu}=lu,Eu=zl,Du=Ul,Ou=vu,ku=Symbol(`fromOffsetCache`),Au=!!(yu&&bu),ju=!!(wu&&Cu),Mu=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&&(!ju||/^\w+:\/\//.test(t.from)||Cu(t.from)?this.file=t.from:this.file=wu(t.from)),ju&&Au){let e=new Ou(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 `+Tu(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 Du(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 Du(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&&(Su&&(i.input.url=Su(this.file).toString()),i.input.file=this.file),i}fromOffset(e){let t,n;if(this[ku])n=this[ku];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[ku]=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:wu(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=Cu(a.source)?Su(a.source):new URL(a.source,this.map.consumer().sourceRoot||Su(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(xu)c.file=xu(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 Nu=Mu;Mu.default=Mu,Eu&&Eu.registerInput&&Eu.registerInput(Mu);let{SourceMapConsumer:Pu,SourceMapGenerator:Fu}=zl,{dirname:Iu,relative:Lu,resolve:Ru,sep:zu}=zl,{pathToFileURL:Bu}=zl,Vu=Nu,Hu=!!(Pu&&Fu),Uu=!!(Iu&&Ru&&Lu&&zu);var Wu=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||Iu(e.file),r;this.mapOpts.sourcesContent===!1?(r=new Pu(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(),Uu&&Hu&&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=Fu.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Fu({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 Fu({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?Iu(this.opts.to):`.`;typeof this.mapOpts.annotation==`string`&&(n=Iu(Ru(n,this.mapOpts.annotation)));let r=Lu(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 Vu(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 j?j.from(e).toString(`base64`):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Bu){let t=Bu(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;zu===`\\`&&(e=e.replace(/\\/g,`/`));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}};let Gu=au,Ku=class extends Gu{constructor(e){super(e),this.type=`comment`}};var qu=Ku;Ku.default=Ku;let{isClean:Ju,my:Yu}=Wl,Xu=cu,Zu=qu,Qu=au,$u,ed,td,nd;function rd(e){return e.map(e=>(e.nodes&&=rd(e.nodes),delete e.source,e))}function id(e){if(e[Ju]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)id(t)}let ad=class e extends Qu{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=rd($u(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 Xu(t)]}else if(t.selector)t=[new ed(t)];else if(t.name)t=[new td(t)];else if(t.text)t=[new Zu(t)];else throw Error(`Unknown node type in node creation`);return t.map(t=>(t[Yu]||e.rebuild(t),t=t.proxyOf,t.parent&&t.parent.removeChild(t),t[Ju]&&id(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]}};ad.registerParse=e=>{$u=e},ad.registerRule=e=>{ed=e},ad.registerAtRule=e=>{td=e},ad.registerRoot=e=>{nd=e};var od=ad;ad.default=ad,ad.rebuild=e=>{e.type===`atrule`?Object.setPrototypeOf(e,td.prototype):e.type===`rule`?Object.setPrototypeOf(e,ed.prototype):e.type===`decl`?Object.setPrototypeOf(e,Xu.prototype):e.type===`comment`?Object.setPrototypeOf(e,Zu.prototype):e.type===`root`&&Object.setPrototypeOf(e,nd.prototype),e[Yu]=!0,e.nodes&&e.nodes.forEach(e=>{ad.rebuild(e)})};let sd=od,cd,ld,ud=class extends sd{constructor(e){super({type:`document`,...e}),this.nodes||=[]}toResult(e={}){return new cd(new ld,this,e).stringify()}};ud.registerLazyResult=e=>{cd=e},ud.registerProcessor=e=>{ld=e};var dd=ud;ud.default=ud;let fd=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 pd=fd;fd.default=fd;let md=pd,hd=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 md(e,t);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>e.type===`warning`)}get content(){return this.css}};var gd=hd;hd.default=hd;const _d=/[\t\n\f\r "#'()/;[\\\]{}]/g,vd=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,yd=/.[\r\n"'(/\\]/,bd=/[\da-f]/i;var xd=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 x(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||yd.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:_d.lastIndex=h+1,_d.test(n),a=_d.lastIndex===0?n.length-1:_d.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,bd.test(n.charAt(a)))){for(;bd.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):(vd.lastIndex=h+1,vd.test(n),a=vd.lastIndex===0?n.length-1:vd.lastIndex-2,p=[`word`,n.slice(h,a+1),h,a],g.push(p),h=a);break}return h++,p}function S(e){_.push(e)}return{back:S,endOfFile:b,nextToken:x,position:v}};let Sd=od,Cd=class extends Sd{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 wd=Cd;Cd.default=Cd,Sd.registerAtRule(Cd);let Td=od,Ed,Dd,Od=class extends Td{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 Ed(new Dd,this,e).stringify()}};Od.registerLazyResult=e=>{Ed=e},Od.registerProcessor=e=>{Dd=e};var kd=Od;Od.default=Od,Td.registerRoot(Od);let Ad={comma(e){return Ad.split(e,[`,`],!0)},space(e){return Ad.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 jd=Ad;Ad.default=Ad;let Md=od,Nd=jd,Pd=class extends Md{constructor(e){super(e),this.type=`rule`,this.nodes||=[]}get selectors(){return Nd.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 Fd=Pd;Pd.default=Pd,Md.registerRule(Pd);let Id=cu,Ld=xd,Rd=qu,zd=wd,Bd=kd,Vd=Fd;const Hd={empty:!0,space:!0};function Ud(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}var Wd=class{constructor(e){this.input=e,this.root=new Bd,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 zd;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 Rd;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=Ld(this.input)}decl(e,t){let n=new Id;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]||Ud(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 Vd;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`,!Hd[u]&&!Hd[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 Vd;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 Gd=od,Kd=Wd,qd=Nu;function Jd(e,t){let n=new Kd(new qd(e,t));try{n.parse()}catch(e){throw e}return n.root}var Yd=Jd;Jd.default=Jd,Gd.registerParse(Jd);let{isClean:Xd,my:Zd}=Wl,Qd=Wu,$d=Zl,ef=od,tf=dd,nf=gd,rf=Yd,af=kd;const of={atrule:`AtRule`,comment:`Comment`,decl:`Declaration`,document:`Document`,root:`Root`,rule:`Rule`},sf={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},cf={Once:!0,postcssPlugin:!0,prepare:!0};function lf(e){return typeof e==`object`&&typeof e.then==`function`}function uf(e){let t=!1,n=of[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 df(e){let t;return t=e.type===`document`?[`Document`,0,`DocumentExit`]:e.type===`root`?[`Root`,0,`RootExit`]:uf(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function ff(e){return e[Xd]=!1,e.nodes&&e.nodes.forEach(e=>ff(e)),e}let pf={},mf=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=ff(n);else if(n instanceof e||n instanceof nf)i=ff(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=rf;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[Zd]&&ef.rebuild(i)}this.result=new nf(t,i,r),this.helpers={...pf,postcss:pf,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(!sf[n]&&/^[A-Z]/.test(n))throw Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!cf[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(lf(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Xd];){e[Xd]=!0;let t=[df(e)];for(;t.length>0;){let e=this.visitTick(t);if(lf(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 lf(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=$d;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new Qd(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(lf(this.runOnRoot(e)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Xd];)e[Xd]=!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(lf(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[Xd]){i[Xd]=!0,e.push(df(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[Xd]=!0,t.iterator=n.getIterator());return}else if(this.listeners[e]){t.visitors=this.listeners[e];return}}e.pop()}walkSync(e){e[Xd]=!0;let t=uf(e);for(let n of t)if(n===0)e.nodes&&e.each(e=>{e[Xd]||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`}};mf.registerPostcss=e=>{pf=e};var hf=mf;mf.default=mf,af.registerLazyResult(mf),tf.registerLazyResult(mf);let gf=Wu,_f=Zl,vf=Yd;const yf=gd;let bf=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=_f;this.result=new yf(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 gf(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=vf;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 xf=bf;bf.default=bf;let Sf=xf,Cf=hf,wf=dd,Tf=kd,Ef=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 Sf(this,e,t):new Cf(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var Df=Ef;Ef.default=Ef,Tf.registerProcessor(Ef),wf.registerProcessor(Ef);let Of=cu,kf=vu,Af=qu,jf=wd,Mf=Nu,Nf=kd,Pf=Fd;function Ff(e,t){if(Array.isArray(e))return e.map(e=>Ff(e));let{inputs:n,...r}=e;if(n){t=[];for(let e of n){let n={...e,__proto__:Mf.prototype};n.map&&={...n.map,__proto__:kf.prototype},t.push(n)}}if(r.nodes&&=e.nodes.map(e=>Ff(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 Nf(r);if(r.type===`decl`)return new Of(r);if(r.type===`rule`)return new Pf(r);if(r.type===`comment`)return new Af(r);if(r.type===`atrule`)return new jf(r);throw Error(`Unknown node type: `+e.type)}var If=Ff;Ff.default=Ff;let Lf=Ul,Rf=cu,zf=hf,Bf=od,Vf=Df,Hf=Zl,Uf=If,Wf=dd,Gf=pd,Kf=qu,qf=wd,Jf=gd,Yf=Nu,Xf=Yd,Zf=jd,Qf=Fd,$f=kd,ep=au;function U(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Vf(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`),Er.env.LANG&&Er.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 Vf().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=Hf,U.parse=Xf,U.fromJSON=Uf,U.list=Zf,U.comment=e=>new Kf(e),U.atRule=e=>new qf(e),U.decl=e=>new Rf(e),U.rule=e=>new Qf(e),U.root=e=>new $f(e),U.document=e=>new Wf(e),U.CssSyntaxError=Lf,U.Declaration=Rf,U.Container=Bf,U.Processor=Vf,U.Document=Wf,U.Comment=Kf,U.Warning=Gf,U.AtRule=qf,U.Result=Jf,U.Input=Yf,U.Rule=Qf,U.Root=$f,U.Node=ep,zf.registerPostcss(U);var tp=U;U.default=U;const W=Pl(tp);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 np=class e{constructor(...e){V(this,`parentElement`,null),V(this,`parentNode`,null),V(this,`ownerDocument`),V(this,`firstChild`,null),V(this,`lastChild`,null),V(this,`previousSibling`,null),V(this,`nextSibling`,null),V(this,`ELEMENT_NODE`,1),V(this,`TEXT_NODE`,3),V(this,`nodeType`),V(this,`nodeName`),V(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`}};const rp={Node:[`childNodes`,`parentNode`,`parentElement`,`textContent`,`ownerDocument`],ShadowRoot:[`host`,`styleSheets`],Element:[`shadowRoot`,`querySelector`,`querySelectorAll`],MutationObserver:[]},ip={Node:[`contains`,`getRootNode`],ShadowRoot:[`getSelection`],Element:[],MutationObserver:[`constructor`]},ap={},op=()=>!!globalThis.Zone;function sp(e){if(ap[e])return ap[e];let t=globalThis[e],n=t.prototype,r=e in rp?rp[e]:void 0,i=!!(r&&r.every(e=>!!(Object.getOwnPropertyDescriptor(n,e)?.get)?.toString().includes(`[native code]`))),a=e in ip?ip[e]:void 0,o=!!(a&&a.every(e=>typeof n[e]==`function`&&n[e]?.toString().includes(`[native code]`)));if(i&&o&&!op())return ap[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?ap[e]=a:n}catch{return n}}const cp={};function lp(e,t,n){let r=`${e}.${String(n)}`;if(cp[r])return cp[r].call(t);let i=sp(e),a=Object.getOwnPropertyDescriptor(i,n)?.get;return a?(cp[r]=a,a.call(t)):t[n]}const up={};function dp(e,t,n){let r=`${e}.${String(n)}`;if(up[r])return up[r].bind(t);let i=sp(e)[n];return typeof i==`function`?(up[r]=i,i.bind(t)):t[n]}function fp(e){return lp(`Node`,e,`ownerDocument`)}function pp(e){return lp(`Node`,e,`childNodes`)}function mp(e){return lp(`Node`,e,`parentNode`)}function hp(e){return lp(`Node`,e,`parentElement`)}function gp(e){return lp(`Node`,e,`textContent`)}function _p(e,t){return dp(`Node`,e,`contains`)(t)}function vp(e){return dp(`Node`,e,`getRootNode`)()}function yp(e){return!e||!(`host`in e)?null:lp(`ShadowRoot`,e,`host`)}function bp(e){return e.styleSheets}function xp(e){return!e||!(`shadowRoot`in e)?null:lp(`Element`,e,`shadowRoot`)}function Sp(e,t){return lp(`Element`,e,`querySelector`)(t)}function Cp(e,t){return lp(`Element`,e,`querySelectorAll`)(t)}function wp(){return sp(`MutationObserver`).constructor}function Tp(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()=>{}}}const G={ownerDocument:fp,childNodes:pp,parentNode:mp,parentElement:hp,textContent:gp,contains:_p,getRootNode:vp,host:yp,styleSheets:bp,shadowRoot:xp,querySelector:Sp,querySelectorAll:Cp,mutationObserver:wp,patch:Tp};function K(e,t,n=document){let r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const Ep=`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.`;let Dp={map:{},getId(){return console.error(Ep),-1},getNode(){return console.error(Ep),null},removeNodeFromMap(){console.error(Ep)},has(){return console.error(Ep),!1},reset(){console.error(Ep)}};typeof window<`u`&&window.Proxy&&window.Reflect&&(Dp=new Proxy(Dp,{get(e,t,n){return t===`map`&&console.error(Ep),Reflect.get(e,t,n)}}));function Op(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 kp(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)}}),()=>kp(e,t,a||{},!0)}let Ap=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ap=()=>new Date().getTime());function jp(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 Mp(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Np(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Pp(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=Pp(e);if(!i)return!1;try{if(typeof t==`string`){if(i.classList.contains(t)||r&&i.closest(`.`+t)!==null)return!0}else if(Qa(i,t,r))return!0}catch{}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function Fp(e,t){return t.getId(e)!==-1}function Ip(e,t,n){return e.tagName===`TITLE`&&n.headTitleMutations?!0:t.getId(e)===-2}function Lp(e,t){if(ua(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?Lp(r,t):!0}function Rp(e){return!!e.changedTouches}function zp(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 Bp(e,t){return!!(e.nodeName===`IFRAME`&&t.getMeta(e))}function Vp(e,t){return!!(e.nodeName===`LINK`&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute(`rel`)===`stylesheet`&&t.getMeta(e))}function Hp(e){return e?e instanceof np&&`shadowRoot`in e?!!e.shadowRoot:!!G.shadowRoot(e):!1}var Up=class{constructor(){P(this,`id`,1),P(this,`styleIDMap`,new WeakMap),P(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 Wp(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 Gp(e){let t=e,n;for(;n=Wp(t);)t=n;return t}function Kp(e){let t=G.ownerDocument(e);if(!t)return!1;let n=Gp(e);return G.contains(t,n)}function qp(e){let t=G.ownerDocument(e);return t?G.contains(t,e)||Kp(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||{}),Jp=(e=>(e[e.Mouse=0]=`Mouse`,e[e.Pen=1]=`Pen`,e[e.Touch=2]=`Touch`,e))(Jp||{}),Yp=(e=>(e[e[`2D`]=0]=`2D`,e[e.WebGL=1]=`WebGL`,e[e.WebGL2=2]=`WebGL2`,e))(Yp||{}),Xp=(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))(Xp||{}),Zp=(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))(Zp||{});function Qp(e){return`__ln`in e}var $p=class{constructor(){P(this,`length`,0),P(this,`head`,null),P(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&&Qp(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&&Qp(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--)}};const em=(e,t)=>`${e}@${t}`;var tm=class{constructor(){P(this,`frozen`,!1),P(this,`locked`,!1),P(this,`texts`,[]),P(this,`attributes`,[]),P(this,`attributeMap`,new WeakMap),P(this,`removes`,[]),P(this,`mapRemoves`,[]),P(this,`movedMap`,{}),P(this,`addedSet`,new Set),P(this,`movedSet`,new Set),P(this,`droppedSet`,new Set),P(this,`removesSubTreeCache`,new Set),P(this,`mutationCb`),P(this,`blockClass`),P(this,`blockSelector`),P(this,`maskTextClass`),P(this,`maskTextSelector`),P(this,`inlineStylesheet`),P(this,`maskInputOptions`),P(this,`maskTextFn`),P(this,`maskInputFn`),P(this,`keepIframeSrcFn`),P(this,`recordCanvas`),P(this,`inlineImages`),P(this,`slimDOMOptions`),P(this,`dataURLOptions`),P(this,`doc`),P(this,`mirror`),P(this,`iframeManager`),P(this,`stylesheetManager`),P(this,`shadowDomManager`),P(this,`canvasManager`),P(this,`processedNodeManager`),P(this,`unattachedDoc`),P(this,`processMutations`,e=>{e.forEach(this.processMutation),this.emit()}),P(this,`emit`,()=>{if(this.frozen||this.locked)return;let e=[],t=new Set,n=new $p,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||!qp(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=ua(a)?this.mirror.getId(Wp(i)):this.mirror.getId(a),c=r(i);if(s===-1||c===-1)return n.addNode(i);let l=co(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=>{Bp(e,this.mirror)&&this.iframeManager.addIframe(e),Vp(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Hp(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)im(this.removesSubTreeCache,e,this.mirror)&&!this.movedSet.has(G.parentNode(e))||i(e);for(let e of this.addedSet)!om(this.droppedSet,e)&&!im(this.removesSubTreeCache,e,this.mirror)||om(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))}),P(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=xa({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Ta(e),value:n,maskInputFn:this.maskInputFn})}),P(this,`processMutation`,e=>{if(!Ip(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:$a(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Pp(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=Ta(t);r=xa({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`),!Xa(t.tagName,n))if(i.attributes[n]=Ya(this.doc,Sa(t.tagName),Sa(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=ua(e.target)?this.mirror.getId(G.host(e.target)):this.mirror.getId(e.target);q(e.target,this.blockClass,this.blockSelector,!1)||Ip(t,this.mirror,this.slimDOMOptions)||!Fp(t,this.mirror)||(this.addedSet.has(t)?(nm(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&n===-1||Lp(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[em(n,r)]?nm(this.movedSet,t):(this.removes.push({parentId:r,id:n,isShadow:ua(e.target)&&da(e.target)?!0:void 0}),rm(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}),P(this,`genAdds`,(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Ip(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[em(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)),Hp(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 nm(e,t){e.delete(t),G.childNodes(t).forEach(t=>nm(e,t))}function rm(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 im(e,t,n){return e.size===0?!1:am(e,t)}function am(e,t,n){let r=G.parentNode(t);return r?e.has(r):!1}function om(e,t){return e.size===0?!1:sm(e,t)}function sm(e,t){let n=G.parentNode(t);return n?e.has(n)?!0:sm(e,n):!1}let cm;function lm(e){cm=e}function um(){cm=void 0}const Z=e=>cm?(...t)=>{try{return e(...t)}catch(e){if(cm&&cm(e)===!0)return;throw e}}:e,dm=[];function fm(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 pm(e,t){let n=new tm;dm.push(n),n.init(e);let r=new(wp())(Z(n.processMutations.bind(n)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function mm({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=Op(Z(t=>{let n=Date.now()-s;e(o.map(e=>(e.timeOffset-=n,e)),t),o=[],s=null}),a),l=Z(Op(Z(e=>{let t=fm(e),{clientX:n,clientY:i}=Rp(e)?e.changedTouches[0]:e;s||=Ap(),o.push({x:n,y:i,id:r.getId(t),timeOffset:Ap()-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 hm({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=fm(a);if(q(o,r,i,!0))return;let s=null,l=t;if(`pointerType`in a){switch(a.pointerType){case`mouse`:s=Jp.Mouse;break;case`touch`:s=Jp.Touch;break;case`pen`:s=Jp.Pen;break}s===Jp.Touch?X[t]===X.MouseDown?l=`TouchStart`:X[t]===X.MouseUp&&(l=`TouchEnd`):Jp.Pen}else Rp(a)&&(s=Jp.Touch);s===null?X[t]===X.Click&&(s=c,c=null):(c=s,(l.startsWith(`Touch`)&&s===Jp.Touch||l.startsWith(`Mouse`)&&s===Jp.Mouse)&&(s=null));let u=Rp(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=Sa(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 gm({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:a}){return K(`scroll`,Z(Op(Z(a=>{let o=fm(a);if(!o||q(o,r,i,!0))return;let s=n.getId(o);if(o===t&&t.defaultView){let n=jp(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 _m({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return K(`resize`,Z(Op(Z(()=>{let t=Mp(),i=Np();(n!==t||r!==i)&&(e({width:Number(i),height:Number(t)}),n=t,r=i)}),200)),t)}const vm=[`INPUT`,`TEXTAREA`,`SELECT`],ym=new WeakMap;function bm({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=fm(e),l=e.isTrusted,d=n&&n.tagName;if(n&&d===`OPTION`&&(n=G.parentElement(n)),!n||!d||vm.indexOf(d)<0||q(n,r,i,!0)||n.classList.contains(a)||o&&n.matches(o))return;let p=n.value,m=!1,h=Ta(n)||``;h===`radio`||h===`checkbox`?m=n.checked:(s[d.toLowerCase()]||s[h])&&(p=xa({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=ym.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){ym.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=>kp(e[0],e[1],{set(){Z(d)({target:this,isTrusted:!1})}},!1,m))),Z(()=>{p.forEach(e=>e())})}function xm(e){let t=[];function n(e,t){if(Mm(`CSSGroupingRule`)&&e.parentRule instanceof CSSGroupingRule||Mm(`CSSMediaRule`)&&e.parentRule instanceof CSSMediaRule||Mm(`CSSSupportsRule`)&&e.parentRule instanceof CSSSupportsRule||Mm(`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 Sm(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function Cm({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}=Sm(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}=Sm(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}=Sm(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}=Sm(i,t,n.styleMirror);return(s&&s!==-1||c&&c!==-1)&&e({id:s,styleId:c,replaceSync:o}),r.apply(i,a)})}));let c={};Nm(`CSSGroupingRule`)?c.CSSGroupingRule=r.CSSGroupingRule:(Nm(`CSSMediaRule`)&&(c.CSSMediaRule=r.CSSMediaRule),Nm(`CSSConditionRule`)&&(c.CSSConditionRule=r.CSSConditionRule),Nm(`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}=Sm(i.parentStyleSheet,t,n.styleMirror);return(c&&c!==-1||l&&l!==-1)&&e({id:c,styleId:l,adds:[{rule:o,index:[...xm(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}=Sm(i.parentStyleSheet,t,n.styleMirror);return(s&&s!==-1||c&&c!==-1)&&e({id:s,styleId:c,removes:[{index:[...xm(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 wm({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 Tm({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}=Sm(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:xm(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}=Sm(a.parentRule?.parentStyleSheet,t,r.styleMirror);return(l&&l!==-1||u&&u!==-1)&&e({id:l,styleId:u,remove:{property:c},index:xm(a.parentRule)}),i.apply(a,s)})}),Z(()=>{i.CSSStyleDeclaration.prototype.setProperty=a,i.CSSStyleDeclaration.prototype.removeProperty=o})}function Em({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:a}){let o=Z(a=>Op(Z(i=>{let o=fm(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(Xp.Play),a),K(`pause`,o(Xp.Pause),a),K(`seeked`,o(Xp.Seeked),a),K(`volumechange`,o(Xp.VolumeChange),a),K(`ratechange`,o(Xp.RateChange),a)];return Z(()=>{s.forEach(e=>e())})}function Dm({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=Tp(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 Om(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 km({doc:e,customElementCb:t}){let n=e.defaultView;return!n||!n.customElements?()=>{}:Tp(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 Am(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 jm(e,t={}){let n=e.doc.defaultView;if(!n)return()=>{};Am(e,t);let r;e.recordDOM&&(r=pm(e,e.doc));let i=mm(e),a=hm(e),o=gm(e),s=_m(e,{win:n}),c=bm(e),l=Em(e),u=()=>{},d=()=>{},f=()=>{},p=()=>{};e.recordDOM&&(u=Cm(e,{win:n}),d=wm(e,e.doc),f=Tm(e,{win:n}),e.collectFonts&&(p=Dm(e)));let m=Om(e),h=km(e),g=[];for(let t of e.plugins)g.push(t.observer(t.callback,n,t.options));return Z(()=>{dm.forEach(e=>e.reset()),r?.disconnect(),i(),a(),o(),s(),c(),l(),u(),d(),f(),p(),m(),h(),g.forEach(e=>e())})}function Mm(e){return window[e]!==void 0}function Nm(e){return!!(window[e]!==void 0&&window[e].prototype&&`insertRule`in window[e].prototype&&`deleteRule`in window[e].prototype)}for(var Pm=class{constructor(e){P(this,`iframeIdToRemoteIdMap`,new WeakMap),P(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}},Fm=class{constructor(e){P(this,`iframes`,new WeakMap),P(this,`crossOriginIframeMap`,new WeakMap),P(this,`crossOriginIframeMirror`,new Pm(Ra)),P(this,`crossOriginIframeStyleMirror`),P(this,`crossOriginIframeRootIdMap`,new WeakMap),P(this,`mirror`),P(this,`mutationCb`),P(this,`wrappedEmit`),P(this,`loadListener`),P(this,`stylesheetManager`),P(this,`recordCrossOriginIframes`),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Pm(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!==Zp.Document&&!e.rootId&&(e.rootId=t),`childNodes`in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}},Im=class{constructor(e){P(this,`shadowDoms`,new WeakSet),P(this,`mutationCb`),P(this,`scrollCb`),P(this,`bypassOptions`),P(this,`mirror`),P(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(!da(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let n=pm({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(gm({...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(wm({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(Tp(e.prototype,`attachShadow`,function(e){return function(r){let i=e.call(this,r),a=G.shadowRoot(this);return a&&qp(this)&&n.addShadowRoot(a,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Lm=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Rm=typeof Uint8Array>`u`?[]:new Uint8Array(256),zm=0;zm<Lm.length;zm++)Rm[Lm.charCodeAt(zm)]=zm;var Bm=function(e){var t=new Uint8Array(e),n,r=t.length,i=``;for(n=0;n<r;n+=3)i+=Lm[t[n]>>2],i+=Lm[(t[n]&3)<<4|t[n+1]>>4],i+=Lm[(t[n+1]&15)<<2|t[n+2]>>6],i+=Lm[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};const Vm=new Map;function Hm(e,t){let n=Vm.get(e);return n||(n=new Map,Vm.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}const Um=(e,t,n)=>{if(!e||!(Km(e,t)||typeof e==`object`))return;let r=e.constructor.name,i=Hm(n,r),a=i.indexOf(e);return a===-1&&(a=i.length,i.push(e)),a};function Wm(e,t,n){if(e instanceof Array)return e.map(e=>Wm(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:Bm(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Wm(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:[Wm(e.data,t,n),e.width,e.height]};else if(Km(e,t)||typeof e==`object`)return{rr_type:e.constructor.name,index:Um(e,t,n)};return e}const Gm=(e,t,n)=>e.map(e=>Wm(e,t,n)),Km=(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 qm(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=Tp(t.CanvasRenderingContext2D.prototype,o,function(i){return function(...a){return q(this.canvas,n,r,!0)||setTimeout(()=>{let n=Gm(a,t,this);e(this.canvas,{type:Yp[`2D`],property:o,args:n})},0),i.apply(this,a)}});i.push(a)}catch{let n=kp(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:Yp[`2D`],property:o,args:[t],setter:!0})}});i.push(n)}return()=>{i.forEach(e=>e())}}function Jm(e){return e===`experimental-webgl`?`webgl`:e}function Ym(e,t,n,r){let i=[];try{let a=Tp(e.HTMLCanvasElement.prototype,`getContext`,function(e){return function(i,...a){if(!q(this,t,n,!0)){let e=Jm(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 Xm(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=Tp(e,c,function(e){return function(...o){let s=e.apply(this,o);if(Um(s,a,this),`tagName`in this.canvas&&!q(this.canvas,r,i,!0)){let e={type:t,property:c,args:Gm(o,a,this)};n(this.canvas,e)}return s}});o.push(s)}catch{let r=kp(e,c,{set(e){n(this.canvas,{type:t,property:c,args:[e],setter:!0})}});o.push(r)}return o}function Zm(e,t,n,r){let i=[];return i.push(...Xm(t.WebGLRenderingContext.prototype,Yp.WebGL,e,n,r,t)),t.WebGL2RenderingContext!==void 0&&i.push(...Xm(t.WebGL2RenderingContext.prototype,Yp.WebGL2,e,n,r,t)),()=>{i.forEach(e=>e())}}const Qm=`KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=`,$m=typeof window<`u`&&window.Blob&&new Blob([(e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0)))(Qm)],{type:`text/javascript;charset=utf-8`});function eh(e){let t;try{if(t=$m&&(window.URL||window.webkitURL).createObjectURL($m),!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,`+Qm,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var th=class{constructor(e){P(this,`pendingCanvasMutations`,new Map),P(this,`rafStamps`,{latestId:0,invokeId:null}),P(this,`mirror`),P(this,`mutationCb`),P(this,`resetObservers`),P(this,`frozen`,!1),P(this,`locked`,!1),P(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=Ym(t,n,r,!0),o=new Map,s=new eh;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:Yp[`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=Ym(e,t,n,!1),i=qm(this.processMutation.bind(this),e,t,n),a=Zm(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)}},nh=class{constructor(e){P(this,`trackedLinkElements`,new WeakSet),P(this,`mutationCb`),P(this,`adoptedStyleSheetCb`),P(this,`styleMirror`,new Up),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:ha(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){}},rh=class{constructor(){P(this,`nodeMap`,new WeakMap),P(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,ih,ah,oh=!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)}const $=ba();function sh(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:x=!0,recordCanvas:S=!1,recordCrossOriginIframes:C=!1,recordAfter:w=e.recordAfter===`DOMContentLoaded`?e.recordAfter:`load`,userTriggeredOnInput:T=!1,collectFonts:ee=!1,inlineImages:E=!1,plugins:D,keepIframeSrcFn:O=()=>!1,ignoreCSSAttributes:te=new Set([]),errorHandler:ne}=e;lm(ne);let re=C?window.parent===window:!0,k=!1;if(!re)try{window.parent.document&&(k=!1)}catch{k=!0}if(re&&!t)throw Error(`emit function is required`);if(!re&&!k)return()=>{};b!==void 0&&v.mousemove===void 0&&(v.mousemove=b),$.reset();let ie=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,ae=oo(p);zp();let oe,se=0,ce=e=>{for(let t of D||[])t.eventProcessor&&(e=t.eventProcessor(e));return _&&!k&&(e=_(e)),e};Q=(e,i)=>{let a=e;if(a.timestamp=Ap(),dm[0]?.isFrozen()&&a.type!==J.FullSnapshot&&!(a.type===J.IncrementalSnapshot&&a.data.source===Y.Mutation)&&dm.forEach(e=>e.unfreeze()),re)t?.(ce(a),i);else if(k){let e={type:`rrweb`,event:ce(a),origin:window.location.origin,isCheckout:i};window.parent.postMessage(e,`*`)}if(a.type===J.FullSnapshot)oe=a,se=0;else if(a.type===J.IncrementalSnapshot){if(a.data.source===Y.Mutation&&a.data.isAttachIframe)return;se++;let e=r&&se>=r,t=n&&a.timestamp-oe.timestamp>n;(e||t)&&ih(!0)}};let le=e=>{Q({type:J.IncrementalSnapshot,data:{source:Y.Mutation,...e}})},ue=e=>Q({type:J.IncrementalSnapshot,data:{source:Y.Scroll,...e}}),de=e=>Q({type:J.IncrementalSnapshot,data:{source:Y.CanvasMutation,...e}}),fe=new nh({mutationCb:le,adoptedStyleSheetCb:e=>Q({type:J.IncrementalSnapshot,data:{source:Y.AdoptedStyleSheet,...e}})}),pe=new Fm({mirror:$,mutationCb:le,stylesheetManager:fe,recordCrossOriginIframes:C,wrappedEmit:Q});for(let e of D||[])e.getMirror&&e.getMirror({nodeMirror:$,crossOriginIframeMirror:pe.crossOriginIframeMirror,crossOriginIframeStyleMirror:pe.crossOriginIframeStyleMirror});let me=new rh;ah=new th({recordCanvas:S,mutationCb:de,win:window,blockClass:i,blockSelector:a,mirror:$,sampling:v.canvas,dataURLOptions:y});let he=new Im({mutationCb:le,scrollCb:ue,bypassOptions:{blockClass:i,blockSelector:a,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskInputOptions:ie,dataURLOptions:y,maskTextFn:h,maskInputFn:m,recordCanvas:S,inlineImages:E,sampling:v,slimDOMOptions:ae,iframeManager:pe,stylesheetManager:fe,canvasManager:ah,keepIframeSrcFn:O,processedNodeManager:me},mirror:$});ih=(e=!1)=>{if(!x)return;Q({type:J.Meta,data:{href:window.location.href,width:Np(),height:Mp()}},e),fe.reset(),he.init(),dm.forEach(e=>e.lock());let t=lo(document,{mirror:$,blockClass:i,blockSelector:a,maskTextClass:c,maskTextSelector:l,inlineStylesheet:u,maskAllInputs:ie,maskTextFn:h,maskInputFn:m,slimDOM:ae,dataURLOptions:y,recordCanvas:S,inlineImages:E,onSerialize:e=>{Bp(e,$)&&pe.addIframe(e),Vp(e,$)&&fe.trackLinkElement(e),Hp(e)&&he.addShadowRoot(G.shadowRoot(e),document)},onIframeLoad:(e,t)=>{pe.attachIframe(e,t),he.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{fe.attachLinkElement(e,t)},keepIframeSrcFn:O});if(!t)return console.warn(`Failed to snapshot the document`);Q({type:J.FullSnapshot,data:{node:t,initialOffset:jp(window)}},e),dm.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&fe.adoptStyleSheets(document.adoptedStyleSheets,$.getId(document))};try{let e=[],t=e=>Z(jm)({mutationCb:le,mousemoveCb:(e,t)=>Q({type:J.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Q({type:J.IncrementalSnapshot,data:{source:Y.MouseInteraction,...e}}),scrollCb:ue,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:de,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:ie,inlineStylesheet:u,sampling:v,recordDOM:x,recordCanvas:S,inlineImages:E,userTriggeredOnInput:T,collectFonts:ee,doc:e,maskInputFn:m,maskTextFn:h,keepIframeSrcFn:O,blockSelector:a,slimDOMOptions:ae,dataURLOptions:y,mirror:$,iframeManager:pe,stylesheetManager:fe,shadowDomManager:he,processedNodeManager:me,canvasManager:ah,ignoreCSSAttributes:te,plugins:(D?.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);pe.addLoadListener(n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}});let n=()=>{ih(),e.push(t(document)),oh=!0};return[`interactive`,`complete`].includes(document.readyState)?n():(e.push(K(`DOMContentLoaded`,()=>{Q({type:J.DomContentLoaded,data:{}}),w===`DOMContentLoaded`&&n()})),e.push(K(`load`,()=>{Q({type:J.Load,data:{}}),w===`load`&&n()},window))),()=>{e.forEach(e=>{try{e()}catch(e){String(e).toLowerCase().includes(`cross-origin`)||console.warn(e)}}),me.destroy(),oh=!1,um()}}catch(e){console.warn(e)}}sh.addCustomEvent=(e,t)=>{if(!oh)throw Error(`please add custom event after start recording`);Q({type:J.Custom,data:{tag:e,payload:t}})},sh.freezePage=()=>{dm.forEach(e=>e.freeze())},sh.takeFullSnapshot=e=>{if(!oh)throw Error(`please take full snapshot after start recording`);ih(e)},sh.mirror=$;var ch;(function(e){e[e.NotStarted=0]=`NotStarted`,e[e.Running=1]=`Running`,e[e.Stopped=2]=`Stopped`})(ch||={});const{addCustomEvent:lh}=sh,{freezePage:uh}=sh,{takeFullSnapshot:dh}=sh;var fh=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)}},ph=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 fh({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)}},mh=Object.defineProperty,hh=(e,t)=>()=>(e&&(t=e(e=0)),t),gh=(e,t)=>{for(var n in t)mh(e,n,{get:t[n],enumerable:!0})};function _h(e,t){if(typeof document>`u`||typeof window>`u`)return;yh&&yh();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=sh({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),yh=()=>{a.length>0&&c(a.some(e=>e.type===2)),s&&=(clearInterval(s),null),document.removeEventListener(`visibilitychange`,d),window.removeEventListener(`pagehide`,f),u?.(),yh=null}}function vh(){yh&&yh()}var yh,bh=hh(()=>{yh=null}),xh={};gh(xh,{startReplayRecorder:()=>_h,stopReplayRecorder:()=>vh});var Sh=hh(()=>{bh()}),Ch=typeof document<`u`?document.currentScript:null;function wh(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var Th=class extends ph{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=Ch,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(()=>(Sh(),xh))}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[wh(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{}}};const Eh=`nexus-wallet-backup`,Dh=`frakwallet://`;function Oh(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}function kh(e){return`intent://${e.slice(13)}#Intent;scheme=frakwallet;end`}function Ah(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=Oh()&&jh(e)?kh(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function jh(e){return e.startsWith(Dh)}const Mh={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function Nh(e){return e&&e in Mh?e:`eur`}function Ph(e){return e?Mh[e]??Mh.eur:Mh.eur}function Fh(e,t){let n=Ph(t),r=Nh(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function Ih(e){return e?`${e}Amount`:`eurAmount`}const Lh={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 Rh({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);r.id=Lh.id,r.name=Lh.name,r.allow=Lh.allow,r.style.zIndex=Lh.style.zIndex.toString(),zh({iframe:r,isVisible:!1});let i=t?.walletUrl??e??`https://wallet.frak.id`,a=on();return r.src=`${i}/listener?clientId=${encodeURIComponent(a)}`,new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function zh({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 Bh(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 Vh(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 Hh=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 Qt?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`
55
+ Debug Information:
56
+ -----------------
57
+ Timestamp: ${t.timestamp}
58
+ URL: ${t.encodedUrl}
59
+ Config: ${t.encodedConfig}
60
+ Navigator Info: ${t.navigatorInfo}
61
+ IFrame Status: ${t.iframeStatus}
62
+ Last Request: ${t.lastRequest}
63
+ Last Response: ${t.lastResponse}
64
+ Client Status: ${t.clientStatus}
65
+ Error: ${t.error}
66
+ `.trim()}};const Uh=(()=>{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 Wh(e){e?localStorage.setItem(Eh,e):localStorage.removeItem(Eh)}function Gh(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:on()}},n),a&&(i.searchParams.delete(`fmt`),window.history.replaceState({},``,i.toString()))}function Kh(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 qh(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 Jh(e){return e.includes(`/common/social`)}function Yh(e,t,n,r){if(jh(t)){let i=Kh(t,r);Ah(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(Uh&&Jh(t))qh(r);else{let e=Kh(t,r);window.location.href=e}}function Xh({iframe:e,targetOrigin:t,configDomain:n}){let r=new $t;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`:Wh(o.backup);break;case`remove-backup`:localStorage.removeItem(Eh);break;case`show`:case`hide`:zh({iframe:e,isVisible:a===`show`});break;case`handshake`:Gh(e,o.token,t,n);break;case`redirect`:Yh(e,o.baseRedirectUrl,t,o.mergeToken);break}},isConnected:r.promise}}function Zh({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=Xh({iframe:t,targetOrigin:n,configDomain:e.domain}),i=new Hh(e,t);if(!t.contentWindow)throw new Qt(Zt.configError,`The iframe does not have a content window`);let a=en({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await r.isConnected)throw new Qt(Zt.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=Qh(a,r),s=async()=>{o(),a.cleanup(),t.remove()},c;console.log(`[Frak SDK] Initializing OpenPanel`),c=new Th({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:on()}),!0)}),c.setGlobalProperties({sdkVersion:`0.2.1`,userAnonymousClientId:on()}),c.init();let l=$h({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 Qh(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 $h({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,Vh(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(Eh);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([r(),i(),a()])}async function eg({config:e}){let t=tg(e),n=await Rh({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=Zh({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function tg(e){let t=Nh(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}function ng(){return Xt(96)}async function rg(e,t){return await e.request({method:`frak_displayEmbeddedWallet`,params:[t,e.config.metadata]})}async function ig(e,{steps:t,metadata:n}){return await e.request({method:`frak_displayModal`,params:[t,n,e.config.metadata]})}async function ag(e){if(typeof window>`u`)return;let t=on();if(!t)return;let n=await Pn();if(!n)return;let r=`frak-identity-ensured-${n}`;if(!window.sessionStorage.getItem(r))try{let i=yn();(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 og(e){return await e.request({method:`frak_getMerchantInformation`})}async function sg(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}async function cg(e,t){try{await e.request({method:`frak_sendInteraction`,params:[t,{clientId:on()}]})}catch{console.warn(`[Frak SDK] Failed to send interaction:`,t.type)}}function lg(e,t,n){let r=typeof window<`u`?window.location.href:void 0;return Sn(t)?(Rn(e,`user_referred_started`,{properties:{referrerClientId:t.c,walletStatus:n?.key}}),cg(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referralTimestamp:t.t,landingUrl:r}),!0):xn(t)?(Rn(e,`user_referred_started`,{properties:{referrer:t.r,walletStatus:n?.key}}),cg(e,{type:`arrival`,referrerWallet:t.r,landingUrl:r}),!0):!1}function ug(e){let t=on();return t?{v:2,c:t,m:e,t:Math.floor(Date.now()/1e3)}:null}function dg(e,t){return Sn(e)?on()===e.c:xn(e)&&t?.wallet?qt(e.r,t.wallet):!1}function fg(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;if(dg(n,t))return`self-referral`;if(!lg(e,n,t))return`no-referrer`;let i=Sn(n)?n.m:r?.merchantId,a=r?.alwaysAppendUrl&&i?ug(i):null;return An.replaceUrl({url:window.location?.href,context:a}),Rn(e,`user_referred_completed`,{properties:{status:`success`}}),`success`}async function pg(e,{options:t}={}){let n=An.parse({url:window.location.href}),r=await hg(e);try{return fg(e,{walletStatus:r,frakContext:n,options:t})}catch(e){console.warn(`Error processing referral`,{error:e})}}async function mg(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=on();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 Pn();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=yn();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 hg(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(gg(e,t),t));let n=new $t,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{gg(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function gg(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),ag(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function _g(e,{metadata:t,login:n}){return vg(e,{steps:{login:n??{}},metadata:t})}function vg(e,t){function n(n){return vg(e,{...t,steps:{...t.steps,sendTransaction:n}})}function r(n){return vg(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function i(n,r){return vg(e,{...t,steps:{...t.steps,final:{...r,action:{key:`sharing`,options:n}}}})}async function a(n){return n&&(t.metadata=n(t.metadata??{})),await ig(e,t)}return{params:t,sendTx:n,reward:r,sharing:i,display:a}}async function yg(e,{tx:t,metadata:n}){return(await ig(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}async function bg(e,{siwe:t,metadata:n}){let r=e.config?.domain??window.location.host,i=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`;return(await ig(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??ng(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}var xg=t({DEEP_LINK_SCHEME:()=>Dh,DebugInfoGatherer:()=>Hh,FrakContextManager:()=>An,base64urlDecode:()=>ln,base64urlEncode:()=>cn,baseIframeProps:()=>Lh,clearMerchantIdCache:()=>In,compressJsonToB64:()=>un,computeLegacyProductId:()=>sn,createIFrameFrakClient:()=>Zh,createIframe:()=>Rh,decompressJsonFromB64:()=>bn,displayEmbeddedWallet:()=>rg,displayModal:()=>ig,ensureIdentity:()=>ag,fetchMerchantId:()=>Pn,findIframeInOpener:()=>Bh,formatAmount:()=>Fh,generateSsoUrl:()=>dn,getBackendUrl:()=>yn,getClientId:()=>on,getCurrencyAmountKey:()=>Ih,getMerchantInformation:()=>og,getSupportedCurrency:()=>Nh,getSupportedLocale:()=>Ph,isChromiumAndroid:()=>Oh,isFrakDeepLink:()=>jh,isV1Context:()=>xn,isV2Context:()=>Sn,locales:()=>Mh,modalBuilder:()=>_g,openSso:()=>hn,prepareSso:()=>sg,processReferral:()=>fg,referralInteraction:()=>pg,resolveMerchantId:()=>Ln,sendInteraction:()=>cg,sendTransaction:()=>yg,setupClient:()=>eg,siweAuthenticate:()=>bg,ssoPopupFeatures:()=>pn,ssoPopupName:()=>mn,toAndroidIntentUrl:()=>kh,trackEvent:()=>Rn,trackPurchaseStatus:()=>mg,triggerDeepLinkWithFallback:()=>Ah,watchWalletStatus:()=>hg});function Sg(){`vibrate`in navigator?navigator.vibrate(10):console.log(`Vibration not supported`)}function Cg(){if(!window.FrakSetup?.client){console.error(`Frak client not found`);return}Sg(),rg(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}const wg=`frakClientReady`;function Tg(){let e=new CustomEvent(wg);window.dispatchEvent(e)}function Eg(e,t){if(window.FrakSetup?.client&&e===`add`){t();return}(e===`add`?window.addEventListener:window.removeEventListener)(wg,t,!1)}function Dg(e){window.modalBuilderSteps=_g(e,window.FrakSetup?.modalConfig??{})}async function Og(e){let t=await pg(e);console.log(`referral`,t)}function kg(){if(!window.modalBuilderSteps)throw Error(`modalBuilderSteps not found`);return window.modalBuilderSteps}async function Ag(){if(window.FrakSetup.core=xg,!jg())return;if(console.log(`[Frak SDK] Starting initialization`),!window.FrakSetup.config){console.error(`[Frak SDK] Configuration not found`),window.frakSetupInProgress=!1;return}let e=await eg({config:window.FrakSetup.config});if(!e){console.error(`[Frak SDK] Failed to create client`),window.frakSetupInProgress=!1;return}window.FrakSetup.client=e,console.log(`[Frak SDK] Client initialized successfully`),Tg(),Dg(e),Og(e),window.frakSetupInProgress=!1,Mg()}function jg(){return window.frakSetupInProgress?(console.log(`[Frak SDK] Initialization already in progress`),!1):(window.frakSetupInProgress=!0,window.FrakSetup?.client?(console.log(`[Frak SDK] Client already initialized`),window.frakSetupInProgress=!1,!1):window.FrakSetup?.config?!0:(console.error(`[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set.`),window.frakSetupInProgress=!1,!1))}function Mg(){let e=new URLSearchParams(window.location.search).get(`frakAction`);e&&e===`share`&&(console.log(`[Frak SDK] Auto open query param found`),Cg())}export{n as C,a as S,ve as _,og as a,T as b,Ih as c,Ah as d,Rn as f,_e as g,xe as h,Cg as i,Fh as l,Qt as m,kg as n,rg as o,Zt as p,Eg as r,Hh as s,Ag as t,Dh as u,ye as v,s as x,C as y};
package/cdn/loader.js CHANGED
@@ -1 +1 @@
1
- import{C as e,t}from"./initFrakSdk.CW4lZNoL.js";import{t as n}from"./Spinner.CpK9_1R-.js";function r(){let e=`frak-components-styles`;if(document.getElementById(e))return;let t=import.meta.url,n=t.substring(0,t.lastIndexOf(`/`)),r=document.createElement(`link`);r.id=e,r.rel=`stylesheet`,r.href=`${n}/loader.css`,document.head.appendChild(r)}r(),e(t);const i={"button-share":()=>import(`./ButtonShare.Ql9TdTHB.js`),"button-wallet":()=>import(`./ButtonWallet.CZRopLW5.js`),"open-in-app":()=>import(`./OpenInAppButton.D0ffT0OI.js`)},a=new MutationObserver(e=>{for(let{addedNodes:t}of e)for(let e of Array.from(t))e.nodeType===Node.ELEMENT_NODE&&o(e)});async function o(e){let t=e instanceof Element?e.tagName.toLowerCase():``,n=t?.startsWith(`frak-`),r=Array.from(e.querySelectorAll(`:not(:defined)`)).map(e=>e.tagName.toLowerCase()).filter(e=>e.startsWith(`frak-`));n&&!customElements.get(t)&&r.push(t);let i=[...new Set(r)];await Promise.allSettled(i.map(e=>s(e)))}async function s(e){if(customElements.get(e))return Promise.resolve();try{let t=e.replace(/^frak-/i,``);if(!(t in i))throw Error(`Component ${e} is not supported.`);await i[t]()}catch(e){console.error(e)}}o(document.body),a.observe(document.documentElement,{subtree:!0,childList:!0});export{n as Spinner};
1
+ import{C as e,t}from"./initFrakSdk._ycDRGU2.js";import{t as n}from"./Spinner.sJKLrGhX.js";function r(){let e=`frak-components-styles`;if(document.getElementById(e))return;let t=import.meta.url,n=t.substring(0,t.lastIndexOf(`/`)),r=document.createElement(`link`);r.id=e,r.rel=`stylesheet`,r.href=`${n}/loader.css`,document.head.appendChild(r)}r(),e(t);const i={"button-share":()=>import(`./ButtonShare.Ba6yVLnc.js`),"button-wallet":()=>import(`./ButtonWallet.B_iX5OJn.js`),"open-in-app":()=>import(`./OpenInAppButton.Iawrumsu.js`)},a=new MutationObserver(e=>{for(let{addedNodes:t}of e)for(let e of Array.from(t))e.nodeType===Node.ELEMENT_NODE&&o(e)});async function o(e){let t=e instanceof Element?e.tagName.toLowerCase():``,n=t?.startsWith(`frak-`),r=Array.from(e.querySelectorAll(`:not(:defined)`)).map(e=>e.tagName.toLowerCase()).filter(e=>e.startsWith(`frak-`));n&&!customElements.get(t)&&r.push(t);let i=[...new Set(r)];await Promise.allSettled(i.map(e=>s(e)))}async function s(e){if(customElements.get(e))return Promise.resolve();try{let t=e.replace(/^frak-/i,``);if(!(t in i))throw Error(`Component ${e} is not supported.`);await i[t]()}catch(e){console.error(e)}}o(document.body),a.observe(document.documentElement,{subtree:!0,childList:!0});export{n as Spinner};
@@ -1 +1 @@
1
- import{C as e,_ as t,b as n,g as r,r as i,t as a,v as o,x as s,y as c}from"./initFrakSdk.CW4lZNoL.js";function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(this,arguments)}function u(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}var d=[`context`,`children`],f=[`useFragment`];function p(e,t,n,r){function i(){var t,n=Reflect.construct(HTMLElement,[],i);return n._vdomComponent=e,r&&r.shadow?(n._root=n.attachShadow({mode:r.mode||`open`,serializable:(t=r.serializable)!=null&&t}),r.adoptedStyleSheets&&(n._root.adoptedStyleSheets=r.adoptedStyleSheets)):n._root=n,n}return(i.prototype=Object.create(HTMLElement.prototype)).constructor=i,i.prototype.connectedCallback=function(){h.call(this,r)},i.prototype.attributeChangedCallback=_,i.prototype.disconnectedCallback=v,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),i.observedAttributes=n,e.formAssociated&&(i.formAssociated=!0),n.forEach(function(e){Object.defineProperty(i.prototype,e,{get:function(){return this._vdom?this._vdom.props[e]:this._props[e]},set:function(t){this._vdom?this.attributeChangedCallback(e,null,t):(this._props||={},this._props[e]=t);var n=typeof t;t!=null&&n!==`string`&&n!==`boolean`&&n!==`number`||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,i),i}function m(e){this.getChildContext=function(){return e.context};var t=e.children;return o(t,u(e,d))}function h(e){var n=new CustomEvent(`_preact`,{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(n),this._vdom=c(m,l({},this._props,{context:n.detail.context}),b(this,this._vdomComponent,e)),(this.hasAttribute(`hydrate`)?t:r)(this._vdom,this._root)}function g(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():``})}function _(e,t,n){if(this._vdom){var i={};i[e]=n??=void 0,i[g(e)]=n,this._vdom=o(this._vdom,i),r(this._vdom,this._root)}}function v(){r(this._vdom=null,this._root)}function y(e,t){var r=this,i=e.useFragment,a=u(e,f);return c(i?n:`slot`,l({},a,{ref:function(e){e?(r.ref=e,r._listener||(r._listener=function(e){e.stopPropagation(),e.detail.context=t},e.addEventListener(`_preact`,r._listener))):r.ref.removeEventListener(`_preact`,r._listener)}}))}function b(e,t,n){if(e.nodeType===3)return e.data;if(e.nodeType!==1)return null;var r=[],i={},a=0,o=e.attributes,s=e.childNodes;for(a=o.length;a--;)o[a].name!==`slot`&&(i[o[a].name]=o[a].value,i[g(o[a].name)]=o[a].value);for(a=s.length;a--;){var l=b(s[a],null,n),u=s[a].slot;u?i[u]=c(y,{name:u},l):r[a]=l}var d=!(!n||!n.shadow),f=t?c(y,{useFragment:!d},r):r;return!d&&t&&(e.innerHTML=``),c(t||e.nodeName.toLowerCase(),i,f)}function x(t,n,r=[],i={shadow:!1}){typeof window<`u`&&(e(a),customElements.get(n)||p(t,n,r,i))}var S,C,w,T,E=0,D=[],O=s,k=O.__b,A=O.__r,j=O.diffed,M=O.__c,N=O.unmount,P=O.__;function F(e,t){O.__h&&O.__h(C,e,E||t),E=0;var n=C.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function I(e){return E=1,L(q,e)}function L(e,t,n){var r=F(S++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):q(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=C,!C.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};C.__f=!0;var a=C.shouldComponentUpdate,o=C.componentWillUpdate;C.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},C.shouldComponentUpdate=i}return r.__N||r.__}function R(e,t){var n=F(S++,3);!O.__s&&K(n.__H,t)&&(n.__=e,n.u=t,C.__H.__h.push(n))}function z(e,t){var n=F(S++,7);return K(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function B(e,t){return E=8,z(function(){return e},t)}function V(){for(var e;e=D.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(W),t.__h.some(G),t.__h=[]}catch(n){t.__h=[],O.__e(n,e.__v)}}}O.__b=function(e){C=null,k&&k(e)},O.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),P&&P(e,t)},O.__r=function(e){A&&A(e),S=0;var t=(C=e.__c).__H;t&&(w===C?(t.__h=[],C.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(W),t.__h.some(G),t.__h=[],S=0)),w=C},O.diffed=function(e){j&&j(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(D.push(t)!==1&&T===O.requestAnimationFrame||((T=O.requestAnimationFrame)||U)(V)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),w=C=null},O.__c=function(e,t){t.some(function(e){try{e.__h.some(W),e.__h=e.__h.filter(function(e){return!e.__||G(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],O.__e(n,e.__v)}}),M&&M(e,t)},O.unmount=function(e){N&&N(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{W(e)}catch(e){t=e}}),n.__H=void 0,t&&O.__e(t,n.__v))};var H=typeof requestAnimationFrame==`function`;function U(e){var t,n=function(){clearTimeout(r),H&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);H&&(t=requestAnimationFrame(n))}function W(e){var t=C,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),C=t}function G(e){var t=C;e.__c=e.__(),C=t}function K(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function q(e,t){return typeof t==`function`?t(e):t}function J(){let[e,t]=I(!0),n=B(()=>{t(!1)},[]);return R(()=>(i(`add`,n),()=>i(`remove`,n)),[n]),{isClientReady:!e}}export{R as a,B as i,z as n,x as o,I as r,J as t};
1
+ import{C as e,_ as t,b as n,g as r,r as i,t as a,v as o,x as s,y as c}from"./initFrakSdk._ycDRGU2.js";function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(this,arguments)}function u(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}var d=[`context`,`children`],f=[`useFragment`];function p(e,t,n,r){function i(){var t,n=Reflect.construct(HTMLElement,[],i);return n._vdomComponent=e,r&&r.shadow?(n._root=n.attachShadow({mode:r.mode||`open`,serializable:(t=r.serializable)!=null&&t}),r.adoptedStyleSheets&&(n._root.adoptedStyleSheets=r.adoptedStyleSheets)):n._root=n,n}return(i.prototype=Object.create(HTMLElement.prototype)).constructor=i,i.prototype.connectedCallback=function(){h.call(this,r)},i.prototype.attributeChangedCallback=_,i.prototype.disconnectedCallback=v,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),i.observedAttributes=n,e.formAssociated&&(i.formAssociated=!0),n.forEach(function(e){Object.defineProperty(i.prototype,e,{get:function(){return this._vdom?this._vdom.props[e]:this._props[e]},set:function(t){this._vdom?this.attributeChangedCallback(e,null,t):(this._props||={},this._props[e]=t);var n=typeof t;t!=null&&n!==`string`&&n!==`boolean`&&n!==`number`||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,i),i}function m(e){this.getChildContext=function(){return e.context};var t=e.children;return o(t,u(e,d))}function h(e){var n=new CustomEvent(`_preact`,{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(n),this._vdom=c(m,l({},this._props,{context:n.detail.context}),b(this,this._vdomComponent,e)),(this.hasAttribute(`hydrate`)?t:r)(this._vdom,this._root)}function g(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():``})}function _(e,t,n){if(this._vdom){var i={};i[e]=n??=void 0,i[g(e)]=n,this._vdom=o(this._vdom,i),r(this._vdom,this._root)}}function v(){r(this._vdom=null,this._root)}function y(e,t){var r=this,i=e.useFragment,a=u(e,f);return c(i?n:`slot`,l({},a,{ref:function(e){e?(r.ref=e,r._listener||(r._listener=function(e){e.stopPropagation(),e.detail.context=t},e.addEventListener(`_preact`,r._listener))):r.ref.removeEventListener(`_preact`,r._listener)}}))}function b(e,t,n){if(e.nodeType===3)return e.data;if(e.nodeType!==1)return null;var r=[],i={},a=0,o=e.attributes,s=e.childNodes;for(a=o.length;a--;)o[a].name!==`slot`&&(i[o[a].name]=o[a].value,i[g(o[a].name)]=o[a].value);for(a=s.length;a--;){var l=b(s[a],null,n),u=s[a].slot;u?i[u]=c(y,{name:u},l):r[a]=l}var d=!(!n||!n.shadow),f=t?c(y,{useFragment:!d},r):r;return!d&&t&&(e.innerHTML=``),c(t||e.nodeName.toLowerCase(),i,f)}function x(t,n,r=[],i={shadow:!1}){typeof window<`u`&&(e(a),customElements.get(n)||p(t,n,r,i))}var S,C,w,T,E=0,D=[],O=s,k=O.__b,A=O.__r,j=O.diffed,M=O.__c,N=O.unmount,P=O.__;function F(e,t){O.__h&&O.__h(C,e,E||t),E=0;var n=C.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function I(e){return E=1,L(q,e)}function L(e,t,n){var r=F(S++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):q(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=C,!C.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};C.__f=!0;var a=C.shouldComponentUpdate,o=C.componentWillUpdate;C.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},C.shouldComponentUpdate=i}return r.__N||r.__}function R(e,t){var n=F(S++,3);!O.__s&&K(n.__H,t)&&(n.__=e,n.u=t,C.__H.__h.push(n))}function z(e,t){var n=F(S++,7);return K(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function B(e,t){return E=8,z(function(){return e},t)}function V(){for(var e;e=D.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(W),t.__h.some(G),t.__h=[]}catch(n){t.__h=[],O.__e(n,e.__v)}}}O.__b=function(e){C=null,k&&k(e)},O.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),P&&P(e,t)},O.__r=function(e){A&&A(e),S=0;var t=(C=e.__c).__H;t&&(w===C?(t.__h=[],C.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(W),t.__h.some(G),t.__h=[],S=0)),w=C},O.diffed=function(e){j&&j(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(D.push(t)!==1&&T===O.requestAnimationFrame||((T=O.requestAnimationFrame)||U)(V)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),w=C=null},O.__c=function(e,t){t.some(function(e){try{e.__h.some(W),e.__h=e.__h.filter(function(e){return!e.__||G(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],O.__e(n,e.__v)}}),M&&M(e,t)},O.unmount=function(e){N&&N(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{W(e)}catch(e){t=e}}),n.__H=void 0,t&&O.__e(t,n.__v))};var H=typeof requestAnimationFrame==`function`;function U(e){var t,n=function(){clearTimeout(r),H&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);H&&(t=requestAnimationFrame(n))}function W(e){var t=C,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),C=t}function G(e){var t=C;e.__c=e.__(),C=t}function K(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function q(e,t){return typeof t==`function`?t(e):t}function J(){let[e,t]=I(!0),n=B(()=>{t(!1)},[]);return R(()=>(i(`add`,n),()=>i(`remove`,n)),[n]),{isClientReady:!e}}export{R as a,B as i,z as n,x as o,I as r,J as t};
@@ -1,4 +1,4 @@
1
- import { n as registerWebComponent, r as getModalBuilderSteps, t as useClientReady } from "./useClientReady-iCtUeDsc.js";
1
+ import { n as registerWebComponent, r as getModalBuilderSteps, t as useClientReady } from "./useClientReady-0vKBG0-p.js";
2
2
  import { t as Spinner } from "./Spinner-ByXrz_8L.js";
3
3
  import { t as useReward } from "./useReward-DAkT-7wT.js";
4
4
  import { DebugInfoGatherer, trackEvent } from "@frak-labs/core-sdk";
@@ -1,4 +1,4 @@
1
- import { i as openWalletModal, n as registerWebComponent, t as useClientReady } from "./useClientReady-iCtUeDsc.js";
1
+ import { i as openWalletModal, n as registerWebComponent, t as useClientReady } from "./useClientReady-0vKBG0-p.js";
2
2
  import { t as useReward } from "./useReward-DAkT-7wT.js";
3
3
  import { trackEvent } from "@frak-labs/core-sdk";
4
4
  import { cx } from "class-variance-authority";
@@ -26,14 +26,14 @@ function GiftIcon(props) {
26
26
  //#endregion
27
27
  //#region src/components/ButtonWallet/ButtonWallet.module.css?css_module
28
28
  const classes = {
29
+ "button__right": "Kl62ia_button__right",
29
30
  "button__left": "Kl62ia_button__left",
30
31
  "button": "Kl62ia_button",
31
- "button__right": "Kl62ia_button__right",
32
32
  "reward": "Kl62ia_reward"
33
33
  };
34
+ const _button__right0 = classes["button__right"];
34
35
  const _button__left0 = classes["button__left"];
35
36
  const _button0 = classes["button"];
36
- const _button__right0 = classes["button__right"];
37
37
  const _reward0 = classes["reward"];
38
38
 
39
39
  //#endregion
package/dist/openInApp.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as registerWebComponent, t as useClientReady } from "./useClientReady-iCtUeDsc.js";
1
+ import { n as registerWebComponent, t as useClientReady } from "./useClientReady-0vKBG0-p.js";
2
2
  import { t as Spinner } from "./Spinner-ByXrz_8L.js";
3
3
  import { DEEP_LINK_SCHEME, trackEvent, triggerDeepLinkWithFallback } from "@frak-labs/core-sdk";
4
4
  import { cx } from "class-variance-authority";
@@ -81,7 +81,7 @@ function setupModalConfig(client) {
81
81
  * @param client
82
82
  */
83
83
  async function setupReferral(client) {
84
- const referral = await referralInteraction(client, { modalConfig: window.FrakSetup?.modalWalletConfig });
84
+ const referral = await referralInteraction(client);
85
85
  console.log("referral", referral);
86
86
  }
87
87
  /**
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "url": "https://twitter.com/QNivelais"
12
12
  }
13
13
  ],
14
- "version": "0.0.25",
14
+ "version": "0.0.26-beta.21ffe110",
15
15
  "description": "Frak Wallet components, helping any person to interact with the Frak wallet.",
16
16
  "repository": {
17
17
  "url": "https://github.com/frak-id/wallet",
@@ -76,10 +76,10 @@
76
76
  "publish": "echo 'Publishing components...'"
77
77
  },
78
78
  "dependencies": {
79
- "@frak-labs/frame-connector": "0.2.0",
80
- "@frak-labs/core-sdk": "0.2.0",
79
+ "@frak-labs/core-sdk": "0.2.1-beta.21ffe110",
80
+ "@frak-labs/frame-connector": "0.2.0-beta.21ffe110",
81
81
  "class-variance-authority": "^0.7.1",
82
- "preact": "^10.28.3",
82
+ "preact": "^10.29.0",
83
83
  "preact-custom-element": "^4.6.0"
84
84
  },
85
85
  "devDependencies": {
@@ -87,7 +87,7 @@
87
87
  "@frak-labs/dev-tooling": "0.0.0",
88
88
  "@frak-labs/test-foundation": "0.1.0",
89
89
  "@frak-labs/ui": "0.0.0",
90
- "@preact/preset-vite": "^2.10.3",
90
+ "@preact/preset-vite": "^2.10.4",
91
91
  "@rolldown/plugin-node-polyfills": "^1.0.3",
92
92
  "@testing-library/jest-dom": "^6.9.1",
93
93
  "@testing-library/preact": "^3.2.4",
@@ -95,13 +95,12 @@
95
95
  "@types/jsdom": "^27.0.0",
96
96
  "@types/node": "^24.10.13",
97
97
  "@types/preact-custom-element": "^4.0.4",
98
- "@vitest/coverage-v8": "^4.0.18",
99
- "@vitest/ui": "^4.0.18",
100
- "jsdom": "^28.0.0",
98
+ "@vitest/coverage-v8": "^4.1.0",
99
+ "@vitest/ui": "^4.1.0",
100
+ "jsdom": "^28.1.0",
101
101
  "tsdown": "^0.20.3",
102
- "typescript": "^5",
102
+ "typescript": "^5.9.3",
103
103
  "unplugin-lightningcss": "^0.4.5",
104
- "vite-tsconfig-paths": "^6.1.0",
105
- "vitest": "^4.0.18"
104
+ "vitest": "^4.1.0"
106
105
  }
107
106
  }
@@ -1,14 +0,0 @@
1
- var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function n(e){document.readyState===`complete`||document.readyState===`interactive`?setTimeout(e,1):document.addEventListener?document.addEventListener(`DOMContentLoaded`,e):document.attachEvent(`onreadystatechange`,()=>{document.readyState===`complete`&&e()})}function r(e){var t,n,i=``;if(typeof e==`string`||typeof e==`number`)i+=e;else if(typeof e==`object`)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=r(e[t]))&&(i&&(i+=` `),i+=n)}else for(n in e)e[n]&&(i&&(i+=` `),i+=n);return i}function i(){for(var e,t,n=0,i=``,a=arguments.length;n<a;n++)(e=arguments[n])&&(t=r(e))&&(i&&(i+=` `),i+=t);return i}const a=i;var o,s,c,l,u,d,f,p,m,h,g,_={},v=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,b=Array.isArray;function x(e,t){for(var n in t)e[n]=t[n];return e}function ee(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function S(e,t,n){var r,i,a,s={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?o.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return C(e,s,r,i,null)}function C(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++c,__i:-1,__u:0};return i==null&&s.vnode!=null&&s.vnode(a),a}function w(e){return e.children}function T(e,t){this.props=e,this.context=t}function E(e,t){if(t==null)return e.__?E(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?E(e):null}function D(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=x({},t);a.__v=t.__v+1,s.vnode&&s.vnode(a),se(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??E(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,le(r,a,i),t.__e=t.__=null,a.__e!=n&&O(a)}}function O(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),O(e)}function k(e){(!e.__d&&(e.__d=!0)&&l.push(e)&&!A.__r++||u!=s.debounceRendering)&&((u=s.debounceRendering)||d)(A)}function A(){for(var e,t=1;l.length;)l.length>t&&l.sort(f),e=l.shift(),t=l.length,D(e);A.__r=0}function te(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,y,b=r&&r.__k||v,x=t.length;for(c=j(n,t,b,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&b[p.__i]||_,p.__i=d,g=se(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&fe(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),(y=!!(4&p.__u))||f.__k===p.__k?c=ne(p,c,e,y):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function j(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=C(null,o,null,null,null):b(o)?o=e.__k[a]=C(w,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=C(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=re(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=E(s)),pe(s,s));return r}function ne(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=ne(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=E(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function re(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ie(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||y.test(t)?n:n+`px`}function ae(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ie(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ie(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(p,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n.u=r.u:(n.u=m,e.addEventListener(t,a?g:h,a)):e.removeEventListener(t,a?g:h,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function oe(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=m++;else if(t.t<n.u)return;return n(s.event?s.event(t):t)}}}function se(e,t,n,r,i,a,o,c,l,u){var d,f,p,m,h,g,_,y,S,C,E,D,O,k,A,j=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),a=[c=t.__e=n.__e]),(d=s.__b)&&d(t);n:if(typeof j==`function`)try{if(y=t.props,S=`prototype`in j&&j.prototype.render,C=(d=j.contextType)&&r[d.__c],E=d?C?C.props.value:d.__:r,n.__c?_=(f=t.__c=n.__c).__=f.__E:(S?t.__c=f=new j(y,E):(t.__c=f=new T(y,E),f.constructor=j,f.render=me),C&&C.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),S&&f.__s==null&&(f.__s=f.state),S&&j.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=x({},f.__s)),x(f.__s,j.getDerivedStateFromProps(y,f.__s))),m=f.props,h=f.state,f.__v=t,p)S&&j.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),S&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(S&&j.getDerivedStateFromProps==null&&y!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(y,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(y,f.__s,E)){t.__v!=n.__v&&(f.props=y,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),v.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(y,f.__s,E),S&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=E,f.props=y,f.__P=e,f.__e=!1,D=s.__r,O=0,S)f.state=f.__s,f.__d=!1,D&&D(t),d=f.render(f.props,f.state,f.context),v.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,D&&D(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++O<25);f.state=f.__s,f.getChildContext!=null&&(r=x(x({},r),f.getChildContext())),S&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),k=d!=null&&d.type===w&&d.key==null?ue(d.props.children):d,c=te(e,b(k)?k:[k],t,n,r,i,a,o,c,l,u),f.base=t.__e,t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__E=f.__=null)}catch(e){if(t.__v=null,l||a!=null)if(e.then){for(t.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;a[a.indexOf(c)]=null,t.__e=c}else{for(A=a.length;A--;)ee(a[A]);ce(t)}else t.__e=n.__e,t.__k=n.__k,e.then||ce(t);s.__e(e,t,n)}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=de(n.__e,t,n,r,i,a,o,l,u);return(d=s.diffed)&&d(t),128&t.__u?void 0:c}function ce(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ce))}function le(e,t,n){for(var r=0;r<n.length;r++)fe(n[r],n[++r],n[++r]);s.__c&&s.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){s.__e(e,t.__v)}})}function ue(e){return typeof e!=`object`||!e||e.__b>0?e:b(e)?e.map(ue):x({},e)}function de(e,t,n,r,i,a,c,l,u){var d,f,p,m,h,g,v,y=n.props||_,x=t.props,S=t.type;if(S==`svg`?i=`http://www.w3.org/2000/svg`:S==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(d=0;d<a.length;d++)if((h=a[d])&&`setAttribute`in h==!!S&&(S?h.localName==S:h.nodeType==3)){e=h,a[d]=null;break}}if(e==null){if(S==null)return document.createTextNode(x);e=document.createElementNS(i,S,x.is&&x),l&&=(s.__m&&s.__m(t,a),!1),a=null}if(S==null)y===x||l&&e.data==x||(e.data=x);else{if(a&&=o.call(e.childNodes),!l&&a!=null)for(y={},d=0;d<e.attributes.length;d++)y[(h=e.attributes[d]).name]=h.value;for(d in y)h=y[d],d==`dangerouslySetInnerHTML`?p=h:d==`children`||d in x||d==`value`&&`defaultValue`in x||d==`checked`&&`defaultChecked`in x||ae(e,d,null,h,i);for(d in x)h=x[d],d==`children`?m=h:d==`dangerouslySetInnerHTML`?f=h:d==`value`?g=h:d==`checked`?v=h:l&&typeof h!=`function`||y[d]===h||ae(e,d,h,y[d],i);if(f)l||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(p&&(e.innerHTML=``),te(t.type==`template`?e.content:e,b(m)?m:[m],t,n,r,S==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,c,a?a[0]:n.__k&&E(n,0),l,u),a!=null)for(d=a.length;d--;)ee(a[d]);l||(d=`value`,S==`progress`&&g==null?e.removeAttribute(`value`):g!=null&&(g!==e[d]||S==`progress`&&!g||S==`option`&&g!=y[d])&&ae(e,d,g,y[d],i),d=`checked`,v!=null&&v!=e[d]&&ae(e,d,v,y[d],i))}return e}function fe(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){s.__e(e,n)}}function pe(e,t,n){var r,i;if(s.unmount&&s.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||fe(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){s.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&pe(r[i],t,n||typeof e.type!=`function`);n||ee(e.__e),e.__c=e.__=e.__e=void 0}function me(e,t,n){return this.constructor(e,n)}function he(e,t,n){var r,i,a,c;t==document&&(t=document.documentElement),s.__&&s.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],c=[],se(t,e=(!r&&n||t).__k=S(w,null,[e]),i||_,_,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?o.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,c),le(a,e,c)}function ge(e,t){he(e,t,ge)}function _e(e,t,n){var r,i,a,s,c=x({},e.props);for(a in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)a==`key`?r=t[a]:a==`ref`?i=t[a]:c[a]=t[a]===void 0&&s!=null?s[a]:t[a];return arguments.length>2&&(c.children=arguments.length>3?o.call(arguments,2):n),C(e.type,c,r||e.key,i||e.ref,null)}o=v.slice,s={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},c=0,T.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=x({},this.state);typeof e==`function`&&(e=e(x({},n),this.props)),e&&x(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),k(this))},T.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),k(this))},T.prototype.render=w,l=[],d=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f=function(e,t){return e.__v.__b-t.__v.__b},A.__r=0,p=/(PointerCapture)$|Capture$/i,m=0,h=oe(!1),g=oe(!0);var ve=0;Array.isArray;function ye(e,t,n,r,i,a){t||={};var o,c,l=t;if(`ref`in l)for(c in l={},t)c==`ref`?o=t[c]:l[c]=t[c];var u={type:e,props:l,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ve,__i:-1,__u:0,__source:i,__self:a};if(typeof e==`function`&&(o=e.defaultProps))for(c in o)l[c]===void 0&&(l[c]=o[c]);return s.vnode&&s.vnode(u),u}function be(e,{strict:t=!0}={}){return!e||typeof e!=`string`?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith(`0x`)}function xe(e){return be(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Se=`2.46.3`;let Ce={getDocsUrl:({docsBaseUrl:e,docsPath:t=``,docsSlug:n})=>t?`${e??`https://viem.sh`}${t}${n?`#${n}`:``}`:void 0,version:`viem@${Se}`};var M=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=Ce.getDocsUrl?.({...n,docsPath:i}),o=[t||`An error occurred.`,``,...n.metaMessages?[...n.metaMessages,``]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...Ce.version?[`Version: ${Ce.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=Se}walk(e){return we(this,e)}};function we(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?we(e.cause,t):t?null:e}var Te=class extends M{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 N(e,{dir:t,size:n=32}={}){return typeof e==`string`?Ee(e,{dir:t,size:n}):De(e,{dir:t,size:n})}function Ee(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace(`0x`,``);if(r.length>n*2)throw new Te({size:Math.ceil(r.length/2),targetSize:n,type:`hex`});return`0x${r[t===`right`?`padEnd`:`padStart`](n*2,`0`)}`}function De(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Te({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 Oe=class extends M{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`})}},ke=class extends M{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:`SizeOverflowError`})}};function P(e,{size:t}){if(xe(e)>t)throw new ke({givenSize:xe(e),maxSize:t})}const Ae=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function je(e,t={}){return typeof e==`number`||typeof e==`bigint`?Pe(e,t):typeof e==`string`?Ie(e,t):typeof e==`boolean`?Me(e,t):Ne(e,t)}function Me(e,t={}){let n=`0x${Number(e)}`;return typeof t.size==`number`?(P(n,{size:t.size}),N(n,{size:t.size})):n}function Ne(e,t={}){let n=``;for(let t=0;t<e.length;t++)n+=Ae[e[t]];let r=`0x${n}`;return typeof t.size==`number`?(P(r,{size:t.size}),N(r,{dir:`right`,size:t.size})):r}function Pe(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 Oe({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?N(s,{size:r}):s}const Fe=new TextEncoder;function Ie(e,t={}){return Ne(Fe.encode(e),t)}const Le=new TextEncoder;function Re(e,t={}){return typeof e==`number`||typeof e==`bigint`?He(e,t):typeof e==`boolean`?ze(e,t):be(e)?Ve(e,t):Ue(e,t)}function ze(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size==`number`?(P(n,{size:t.size}),N(n,{size:t.size})):n}const F={zero:48,nine:57,A:65,F:70,a:97,f:102};function Be(e){if(e>=F.zero&&e<=F.nine)return e-F.zero;if(e>=F.A&&e<=F.F)return e-(F.A-10);if(e>=F.a&&e<=F.f)return e-(F.a-10)}function Ve(e,t={}){let n=e;t.size&&(P(n,{size:t.size}),n=N(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=Be(r.charCodeAt(t++)),i=Be(r.charCodeAt(t++));if(n===void 0||i===void 0)throw new M(`Invalid byte sequence ("${r[t-2]}${r[t-1]}" in "${r}").`);a[e]=n*16+i}return a}function He(e,t){return Ve(Pe(e,t))}function Ue(e,t={}){let n=Le.encode(e);return typeof t.size==`number`?(P(n,{size:t.size}),N(n,{dir:`right`,size:t.size})):n}const I=BigInt(2**32-1),We=BigInt(32);function Ge(e,t=!1){return t?{h:Number(e&I),l:Number(e>>We&I)}:{h:Number(e>>We&I)|0,l:Number(e&I)|0}}function Ke(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=Ge(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}const qe=(e,t,n)=>e<<n|t>>>32-n,Je=(e,t,n)=>t<<n|e>>>32-n,Ye=(e,t,n)=>t<<n-32|e>>>64-n,Xe=(e,t,n)=>e<<n-32|t>>>64-n;function Ze(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function Qe(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function L(e,...t){if(!Ze(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 $e(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function et(e,t){L(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function tt(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function nt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const rt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function it(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function at(e){for(let t=0;t<e.length;t++)e[t]=it(e[t]);return e}const ot=rt?e=>e:at;typeof Uint8Array.from([]).toHex==`function`&&Uint8Array.fromHex;function st(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function ct(e){return typeof e==`string`&&(e=st(e)),L(e),e}var lt=class{};function ut(e){let t=t=>e().update(ct(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function dt(e){let t=(t,n)=>e(n).update(ct(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}const ft=BigInt(0),R=BigInt(1),pt=BigInt(2),mt=BigInt(7),ht=BigInt(256),gt=BigInt(113),_t=[],vt=[],yt=[];for(let e=0,t=R,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],_t.push(2*(5*r+n)),vt.push((e+1)*(e+2)/2%64);let i=ft;for(let e=0;e<7;e++)t=(t<<R^(t>>mt)*gt)%ht,t&pt&&(i^=R<<(R<<BigInt(e))-R);yt.push(i)}const bt=Ke(yt,!0),xt=bt[0],St=bt[1],Ct=(e,t,n)=>n>32?Ye(e,t,n):qe(e,t,n),wt=(e,t,n)=>n>32?Xe(e,t,n):Je(e,t,n);function Tt(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,a=n[i],o=n[i+1],s=Ct(a,o,1)^n[r],c=wt(a,o,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=vt[n],a=Ct(t,i,r),o=wt(t,i,r),s=_t[n];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=xt[r],e[1]^=St[r]}nt(n)}var Et=class e extends lt{constructor(e,t,n,r=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,Qe(n),!(0<e&&e<200))throw Error(`only keccak-f1600 function is supported`);this.state=new Uint8Array(200),this.state32=tt(this.state)}clone(){return this._cloneInto()}keccak(){ot(this.state32),Tt(this.state32,this.rounds),ot(this.state32),this.posOut=0,this.pos=0}update(e){$e(this),e=ct(e),L(e);let{blockLen:t,state:n}=this,r=e.length;for(let i=0;i<r;){let a=Math.min(t-this.pos,r-i);for(let t=0;t<a;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,t&128&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){$e(this,!1),L(e),this.finish();let t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw Error(`XOF is not possible for this instance`);return this.writeInto(e)}xof(e){return Qe(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(et(e,this),this.finished)throw Error(`digest() was already called`);return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,nt(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:i,rounds:a,enableXOF:o}=this;return t||=new e(n,r,i,o,a),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const z=(e,t,n)=>ut(()=>new Et(t,e,n));z(6,144,224/8),z(6,136,256/8),z(6,104,384/8),z(6,72,512/8),z(1,144,224/8);const Dt=z(1,136,256/8);z(1,104,384/8),z(1,72,512/8);const Ot=(e,t,n)=>dt((r={})=>new Et(t,e,r.dkLen===void 0?n:r.dkLen,!0));Ot(31,168,128/8),Ot(31,136,256/8);function kt(e,t){let n=t||`hex`,r=Dt(be(e,{strict:!1})?Re(e):e);return n===`bytes`?r:je(r)}var At=class extends M{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:[`- Address must be a hex value of 20 bytes (40 hex characters).`,`- Address must match its checksum counterpart.`],name:`InvalidAddressError`})}},jt=class extends Map{constructor(e){super(),Object.defineProperty(this,`maxSize`,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&t!==void 0&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=this.keys().next().value;e&&this.delete(e)}return this}};const Mt=new jt(8192);function Nt(e,t){if(Mt.has(`${e}.${t}`))return Mt.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=kt(Ue(n),`bytes`),i=(t?n.substring(`${t}0x`.length):n).split(``);for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(r[e>>1]&15)>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let a=`0x${i.join(``)}`;return Mt.set(`${e}.${t}`,a),a}const Pt=/^0x[a-fA-F0-9]{40}$/,Ft=new jt(8192);function It(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(Ft.has(r))return Ft.get(r);let i=Pt.test(e)?e.toLowerCase()===e?!0:n?Nt(e)===e:!0:!1;return Ft.set(r,i),i}function Lt(e,t){if(!It(e,{strict:!1}))throw new At({address:e});if(!It(t,{strict:!1}))throw new At({address:t});return e.toLowerCase()===t.toLowerCase()}let B=256,V;function Rt(e=11){if(!V||B+e>256*2){V=``,B=0;for(let e=0;e<256;e++)V+=(256+Math.random()*256|0).toString(16).substring(1)}return V.substring(B,B+++e)}const H={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 U=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}}},zt=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 Bt(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 zt;return o.set(t,e=>{e.error?n.reject(new U(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 Vt(e){return new TextEncoder().encode(JSON.stringify(e))}function Ht(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}const Ut=`frak-client-id`;function Wt(){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 W(){if(typeof window>`u`||!window.localStorage)return console.warn(`[Frak SDK] No Window / localStorage available to save the clientId`),Wt();let e=localStorage.getItem(Ut);return e||(e=Wt(),localStorage.setItem(Ut,e)),e}function Gt({domain:e}={}){return kt(je((e??window.location.host).replace(`www.`,``)))}function Kt(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function qt(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 Jt(e){return Kt(Vt(e))}function Yt(e,t,n,r,i,a){let o=Jt(Xt({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 Xt(e){return{r:e.redirectUrl,cId:e.clientId,d:e.directExit,l:e.lang,m:e.merchantId,md:{n:e.metadata?.name,css:e.metadata?.css,l:e.metadata?.logoUrl,h:e.metadata?.homepageLink}}}const Zt=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,Qt=`frak-sso`;async function $t(e,t){let{metadata:n,customizations:r,walletUrl:i}=e.config;if(t.openInSameWindow??!!t.redirectUrl)return await e.request({method:`frak_openSso`,params:[t,n.name,r?.css]});let a=t.ssoPopupUrl??Yt(i??`https://wallet.frak.id`,t,Gt(),n.name,W(),r?.css),o=window.open(a,Qt,Zt);if(!o)throw Error(`Popup was blocked. Please allow popups for this site.`);return o.focus(),await e.request({method:`frak_openSso`,params:[t,n.name,r?.css]})??{}}const en=`https://backend.frak.id`;function tn(e){return e.includes(`localhost:3000`)||e.includes(`localhost:3010`)}function nn(e){return tn(e)?`http://localhost:3030`:e.includes(`wallet-dev.frak.id`)||e.includes(`wallet.gcp-dev.frak.id`)?`https://backend.gcp-dev.frak.id`:en}function G(e){if(e)return nn(e);if(typeof window<`u`){let e=window.FrakSetup?.client?.config?.walletUrl;if(e)return nn(e)}return en}const rn=`fCtx`;function an(e){if(e?.r)try{return Kt(Ve(e.r))}catch(t){console.error(`Error compressing Frak context`,{e:t,context:e})}}function on(e){if(!(!e||e.length===0))try{return{r:Ne(qt(e),{size:20})}}catch(t){console.error(`Error decompressing Frak context`,{e:t,context:e})}}function sn({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(rn);return t?on(t):null}function cn({url:e,context:t}){if(!e)return null;let n=sn({url:e}),r=n?{...n,...t}:t;if(!r.r)return null;let i=an(r);if(!i)return null;let a=new URL(e);return a.searchParams.set(rn,i),a.toString()}function ln(e){let t=new URL(e);return t.searchParams.delete(rn),t.toString()}function un({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?ln(n):cn({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}const K={compress:an,decompress:on,parse:sn,update:cn,remove:ln,replaceUrl:un},dn=`frak-merchant-id`;let q,J;async function Y(e,t){if(q)return q;if(typeof window<`u`){let e=window.sessionStorage.getItem(dn);if(e)return q=e,e}if(J)return J;J=fn(e,t);let n=await J;return J=void 0,n}async function fn(e,t){let n=e??(typeof window<`u`?window.location.hostname:``);if(n)try{let e=G(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 q=i.merchantId,typeof window<`u`&&window.sessionStorage.setItem(dn,i.merchantId),q}catch(e){console.warn(`[Frak SDK] Failed to fetch merchantId:`,e);return}}function pn(){q=void 0,J=void 0,typeof window<`u`&&window.sessionStorage.removeItem(dn)}async function mn(e,t){return e.metadata?.merchantId?e.metadata.merchantId:Y(void 0,t)}function X(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)}}var hn=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)}},gn=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 hn({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 _n(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var vn=class extends gn{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[_n(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 yn(e){return Ht(qt(e))}const Z=`nexus-wallet-backup`,bn=`frakwallet://`;function xn(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}function Sn(e){return`intent://${e.slice(13)}#Intent;scheme=frakwallet;end`}function Cn(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=xn()&&wn(e)?Sn(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function wn(e){return e.startsWith(bn)}const Q={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function Tn(e){return e&&e in Q?e:`eur`}function En(e){return e?Q[e]??Q.eur:Q.eur}function Dn(e,t){let n=En(t),r=Tn(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function On(e){return e?`${e}Amount`:`eurAmount`}const $={id:`frak-wallet`,name:`frak-wallet`,title:`Frak Wallet`,allow:`publickey-credentials-get *; clipboard-write; web-share *`,style:{width:`0`,height:`0`,border:`0`,position:`absolute`,zIndex:2000001,top:`-1000px`,left:`-1000px`,colorScheme:`auto`}};function kn({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);r.id=$.id,r.name=$.name,r.allow=$.allow,r.style.zIndex=$.style.zIndex.toString(),An({iframe:r,isVisible:!1});let i=t?.walletUrl??e??`https://wallet.frak.id`,a=W();return r.src=`${i}/listener?clientId=${encodeURIComponent(a)}`,new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function An({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 jn(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 Mn(e,t){if(typeof window>`u`)return;let n=new URL(window.location.href),r=n.searchParams.get(`sso`);r&&(t.then(()=>{e.sendLifecycle({clientLifecycle:`sso-redirect-complete`,data:{compressed:r}}),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 Nn=class e{config;iframe;isSetupDone=!1;lastResponse=null;lastRequest=null;constructor(e,t){this.config=e,this.iframe=t,this.lastRequest=null,this.lastResponse=null}setLastResponse(e,t){this.lastResponse={message:e,response:t,timestamp:Date.now()}}setLastRequest(e){this.lastRequest={event:e,timestamp:Date.now()}}updateSetupStatus(e){this.isSetupDone=e}base64Encode(e){try{return btoa(JSON.stringify(e))}catch(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 U?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
- Debug Information:
4
- -----------------
5
- Timestamp: ${t.timestamp}
6
- URL: ${t.encodedUrl}
7
- Config: ${t.encodedConfig}
8
- Navigator Info: ${t.navigatorInfo}
9
- IFrame Status: ${t.iframeStatus}
10
- Last Request: ${t.lastRequest}
11
- Last Response: ${t.lastResponse}
12
- Client Status: ${t.clientStatus}
13
- Error: ${t.error}
14
- `.trim()}};const Pn=(()=>{if(typeof navigator>`u`)return!1;let e=navigator.userAgent;if(!(/iPhone|iPad|iPod/i.test(e)||/Macintosh/i.test(e)&&navigator.maxTouchPoints>1))return!1;let t=e.toLowerCase();return t.includes(`instagram`)||t.includes(`fban`)||t.includes(`fbav`)||t.includes(`facebook`)})();function Fn(e){e?localStorage.setItem(Z,e):localStorage.removeItem(Z)}function In(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:W()}},n),a&&(i.searchParams.delete(`fmt`),window.history.replaceState({},``,i.toString()))}function Ln(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 Rn(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 zn(e){return e.includes(`/common/social`)}function Bn(e,t,n,r){if(wn(t)){let i=Ln(t,r);Cn(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(Pn&&zn(t))Rn(r);else{let e=Ln(t,r);window.location.href=e}}function Vn({iframe:e,targetOrigin:t,configDomain:n}){let r=new zt;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`:Fn(o.backup);break;case`remove-backup`:localStorage.removeItem(Z);break;case`show`:case`hide`:An({iframe:e,isVisible:a===`show`});break;case`handshake`:In(e,o.token,t,n);break;case`redirect`:Bn(e,o.baseRedirectUrl,t,o.mergeToken);break}},isConnected:r.promise}}function Hn({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=Vn({iframe:t,targetOrigin:n,configDomain:e.domain}),i=new Nn(e,t);if(!t.contentWindow)throw new U(H.configError,`The iframe does not have a content window`);let a=Bt({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await r.isConnected)throw new U(H.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=Un(a,r),s=async()=>{o(),a.cleanup(),t.remove()},c;console.log(`[Frak SDK] Initializing OpenPanel`),c=new vn({apiUrl:`https://op-api.gcp.frak.id`,clientId:`f305d11d-b93b-487c-80d4-92deb7903e98`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>(e!==`track`||!t?.properties||`sdkVersion`in t.properties||(t.properties={...t.properties,sdkVersion:`0.2.0`,userAnonymousClientId:W()}),!0)}),c.setGlobalProperties({sdkVersion:`0.2.0`,userAnonymousClientId:W()}),c.init();let l=Wn({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 Un(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 Wn({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,Mn(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(Z);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([r(),i(),a()])}async function Gn({config:e}){let t=Kn(e),n=await kn({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=Hn({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function Kn(e){let t=Tn(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}function qn(){return Rt(96)}async function Jn(e,t){return await e.request({method:`frak_displayEmbeddedWallet`,params:[t,e.config.metadata]})}async function Yn(e,{steps:t,metadata:n}){return await e.request({method:`frak_displayModal`,params:[t,n,e.config.metadata]})}async function Xn(e){if(typeof window>`u`)return;let t=W();if(!t)return;let n=await Y();if(!n)return;let r=`frak-identity-ensured-${n}`;if(!window.sessionStorage.getItem(r))try{let i=G();(await fetch(`${i}/user/identity/ensure`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"x-wallet-sdk-auth":e,"x-frak-client-id":t},body:JSON.stringify({merchantId:n})})).ok&&window.sessionStorage.setItem(r,`1`)}catch{}}async function Zn(e){return await e.request({method:`frak_getMerchantInformation`})}async function Qn(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}async function $n(e,t){try{await e.request({method:`frak_sendInteraction`,params:[t,{clientId:W()}]})}catch{console.warn(`[Frak SDK] Failed to send interaction:`,t.type)}}async function er(e,{walletStatus:t,frakContext:n,modalConfig:r,options:i}){if(!n?.r)return`no-referrer`;X(e,`user_referred_started`,{properties:{referrer:n?.r,walletStatus:t?.key}}),$n(e,{type:`arrival`,referrerWallet:n.r,landingUrl:typeof window<`u`?window.location.href:void 0});let a=!1;async function o(){if(!a)return a=!0,nr(e,{modalConfig:{...r,loggedIn:{action:{key:`referred`}}},walletStatus:t})}try{let{status:r,currentWallet:a}=await tr({initialWalletStatus:t,getFreshWalletStatus:o,frakContext:n});return K.replaceUrl({url:window.location?.href,context:i?.alwaysAppendUrl?{r:a}:null}),X(e,`user_referred_completed`,{properties:{status:r,referrer:n?.r,wallet:a}}),r}catch(r){return console.log(`Error processing referral`,{error:r}),X(e,`user_referred_error`,{properties:{referrer:n?.r,error:r instanceof U?`[${r.code}] ${r.name} - ${r.message}`:r instanceof Error?r.message:`undefined`}}),K.replaceUrl({url:window.location?.href,context:i?.alwaysAppendUrl?{r:t?.wallet}:null}),rr(r)}}async function tr({initialWalletStatus:e,getFreshWalletStatus:t,frakContext:n}){let r=e?.wallet;return r||=await t(),r&&Lt(n.r,r)?{status:`self-referral`,currentWallet:r}:{status:`success`,currentWallet:r}}async function nr(e,{modalConfig:t,walletStatus:n}){return n?.key===`connected`?n.wallet??void 0:(await Jn(e,t??{}))?.wallet??void 0}function rr(e){if(e instanceof U)switch(e.code){case H.walletNotConnected:return`no-wallet`;default:return`error`}return`error`}async function ir(e,{modalConfig:t,options:n}={}){let r=K.parse({url:window.location.href}),i=await or(e);try{return await er(e,{walletStatus:i,frakContext:r,modalConfig:t,options:n})}catch(e){console.warn(`Error processing referral`,{error:e})}}async function ar(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=W();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 Y();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=G();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 or(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(sr(e,t),t));let n=new zt,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{sr(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function sr(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),Xn(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function cr(e,{metadata:t,login:n}){return lr(e,{steps:{login:n??{}},metadata:t})}function lr(e,t){function n(n){return lr(e,{...t,steps:{...t.steps,sendTransaction:n}})}function r(n){return lr(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function i(n,r){return lr(e,{...t,steps:{...t.steps,final:{...r,action:{key:`sharing`,options:n}}}})}async function a(n){return n&&(t.metadata=n(t.metadata??{})),await Yn(e,t)}return{params:t,sendTx:n,reward:r,sharing:i,display:a}}async function ur(e,{tx:t,metadata:n}){return(await Yn(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}async function dr(e,{siwe:t,metadata:n}){let r=e.config?.domain??window.location.host,i=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`;return(await Yn(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??qn(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}var fr=t({DEEP_LINK_SCHEME:()=>bn,DebugInfoGatherer:()=>Nn,FrakContextManager:()=>K,base64urlDecode:()=>qt,base64urlEncode:()=>Kt,baseIframeProps:()=>$,clearMerchantIdCache:()=>pn,compressJsonToB64:()=>Jt,computeLegacyProductId:()=>Gt,createIFrameFrakClient:()=>Hn,createIframe:()=>kn,decompressJsonFromB64:()=>yn,displayEmbeddedWallet:()=>Jn,displayModal:()=>Yn,ensureIdentity:()=>Xn,fetchMerchantId:()=>Y,findIframeInOpener:()=>jn,formatAmount:()=>Dn,generateSsoUrl:()=>Yt,getBackendUrl:()=>G,getClientId:()=>W,getCurrencyAmountKey:()=>On,getMerchantInformation:()=>Zn,getSupportedCurrency:()=>Tn,getSupportedLocale:()=>En,isChromiumAndroid:()=>xn,isFrakDeepLink:()=>wn,locales:()=>Q,modalBuilder:()=>cr,openSso:()=>$t,prepareSso:()=>Qn,processReferral:()=>er,referralInteraction:()=>ir,resolveMerchantId:()=>mn,sendInteraction:()=>$n,sendTransaction:()=>ur,setupClient:()=>Gn,siweAuthenticate:()=>dr,ssoPopupFeatures:()=>Zt,ssoPopupName:()=>Qt,toAndroidIntentUrl:()=>Sn,trackEvent:()=>X,trackPurchaseStatus:()=>ar,triggerDeepLinkWithFallback:()=>Cn,watchWalletStatus:()=>or});function pr(){`vibrate`in navigator?navigator.vibrate(10):console.log(`Vibration not supported`)}function mr(){if(!window.FrakSetup?.client){console.error(`Frak client not found`);return}pr(),Jn(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}const hr=`frakClientReady`;function gr(){let e=new CustomEvent(hr);window.dispatchEvent(e)}function _r(e,t){if(window.FrakSetup?.client&&e===`add`){t();return}(e===`add`?window.addEventListener:window.removeEventListener)(hr,t,!1)}function vr(e){window.modalBuilderSteps=cr(e,window.FrakSetup?.modalConfig??{})}async function yr(e){let t=await ir(e,{modalConfig:window.FrakSetup?.modalWalletConfig});console.log(`referral`,t)}function br(){if(!window.modalBuilderSteps)throw Error(`modalBuilderSteps not found`);return window.modalBuilderSteps}async function xr(){if(window.FrakSetup.core=fr,!Sr())return;if(console.log(`[Frak SDK] Starting initialization`),!window.FrakSetup.config){console.error(`[Frak SDK] Configuration not found`),window.frakSetupInProgress=!1;return}let e=await Gn({config:window.FrakSetup.config});if(!e){console.error(`[Frak SDK] Failed to create client`),window.frakSetupInProgress=!1;return}window.FrakSetup.client=e,console.log(`[Frak SDK] Client initialized successfully`),gr(),vr(e),yr(e),window.frakSetupInProgress=!1,Cr()}function Sr(){return window.frakSetupInProgress?(console.log(`[Frak SDK] Initialization already in progress`),!1):(window.frakSetupInProgress=!0,window.FrakSetup?.client?(console.log(`[Frak SDK] Client already initialized`),window.frakSetupInProgress=!1,!1):window.FrakSetup?.config?!0:(console.error(`[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set.`),window.frakSetupInProgress=!1,!1))}function Cr(){let e=new URLSearchParams(window.location.search).get(`frakAction`);e&&e===`share`&&(console.log(`[Frak SDK] Auto open query param found`),mr())}export{n as C,a as S,ge as _,Zn as a,w as b,Cn as c,On as d,X as f,he as g,ye as h,mr as i,bn as l,U as m,br as n,Jn as o,H as p,_r as r,Nn as s,xr as t,Dn as u,_e as v,s as x,S as y};