@frak-labs/components 0.0.26-beta.7636a862 → 0.0.26-beta.9139651c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/{ButtonShare.CaPaYhEU.js → ButtonShare.DPJWXGbe.js} +1 -1
- package/cdn/{ButtonWallet.Bpx11cuK.js → ButtonWallet.D-zCZ2sI.js} +1 -1
- package/cdn/{OpenInAppButton.BWQe7Fr8.js → OpenInAppButton.Dm1n2RdM.js} +1 -1
- package/cdn/{Spinner.pFaSnCJv.js → Spinner.D80c6dJp.js} +1 -1
- package/cdn/components.js +1 -1
- package/cdn/{initFrakSdk._ycDRGU2.js → initFrakSdk.fQzq4EeW.js} +3 -3
- package/cdn/loader.js +1 -1
- package/cdn/{useClientReady.Dyagl92v.js → useClientReady.Cs0qagaP.js} +1 -1
- package/dist/buttonWallet.js +5 -5
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
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.
|
|
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.fQzq4EeW.js";import{t as f}from"./Spinner.D80c6dJp.js";import{a as p,i as m,n as h,o as g,r as _,t as v}from"./useClientReady.Cs0qagaP.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.
|
|
1
|
+
import{S as e,f as t,h as n,i as r}from"./initFrakSdk.fQzq4EeW.js";import{a as i,n as a,o,r as s,t as c}from"./useClientReady.Cs0qagaP.js";import{t as l}from"./ButtonShare.DPJWXGbe.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__left:`Kl62ia_button__left`,button__right:`Kl62ia_button__right`,button:`Kl62ia_button`,reward:`Kl62ia_reward`};d.button__left,d.button__right,d.button,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,d as t,f as n,h as r,u as i}from"./initFrakSdk.
|
|
1
|
+
import{S as e,d as t,f as n,h as r,u as i}from"./initFrakSdk.fQzq4EeW.js";import{t as a}from"./Spinner.D80c6dJp.js";import{n as o,o as s,t as c}from"./useClientReady.Cs0qagaP.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.
|
|
1
|
+
import{S as e,h as t}from"./initFrakSdk.fQzq4EeW.js";const n={spinner__leaf:`M4fSKa_spinner__leaf`,spinner:`M4fSKa_spinner`,"rt-spinner-leaf-fade":`M4fSKa_rt-spinner-leaf-fade`};n.spinner__leaf,n.spinner,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};
|
package/cdn/components.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import(`https://cdn.jsdelivr.net/npm/@frak-labs/components@beta/cdn/loader.js?v=
|
|
1
|
+
import(`https://cdn.jsdelivr.net/npm/@frak-labs/components@beta/cdn/loader.js?v=1774433350144`);
|
|
@@ -1,5 +1,5 @@
|
|
|
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+`
|
|
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.47.6`;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)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;e!==void 0&&super.delete(e)}return this}};const 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)?`https://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
3
|
`+t+o(`^`)}return` `+s(i)+e}).join(`
|
|
4
4
|
`)}toString(){let e=this.showSourceCode();return e&&=`
|
|
5
5
|
|
|
@@ -51,7 +51,7 @@ https://www.w3ctech.com/topic/2226`));let i=t(...r);return i.postcssPlugin=e,i.p
|
|
|
51
51
|
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),Er.env.LANG&&Er.env.LANG.startsWith(`cn`)&&console.warn(e+`: 里面 postcss.plugin 被弃用. 迁移指南:
|
|
52
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
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`
|
|
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.groups=[],this.queue=[],this.options=e;let t={"openpanel-client-id":e.clientId};e.clientSecret&&(t[`openpanel-client-secret`]=e.clientSecret),t[`openpanel-sdk-name`]=e.sdk||`node`,t[`openpanel-sdk-version`]=e.sdkVersion||`1.3.0`,this.api=new 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){this.log(`track event`,e,t);let{groups:n,profileId:r,...i}=t??{},a=[...new Set([...this.groups,...n??[]])];return this.send({type:`track`,payload:{name:e,profileId:r??this.profileId,groups:a.length>0?a:void 0,properties:{...this.global??{},...i}}})}identify(e){if(this.log(`identify user`,e),e.profileId&&(this.profileId=e.profileId,this.flush()),Object.keys(e).length>1)return this.send({type:`identify`,payload:{...e,properties:{...this.global,...e.properties}}})}upsertGroup(e){return this.log(`upsert group`,e),this.send({type:`group`,payload:e})}setGroup(e){return this.log(`set group`,e),this.groups.includes(e)||(this.groups=[...this.groups,e]),this.send({type:`assign_group`,payload:{groupIds:[e],profileId:this.profileId}})}setGroups(e){return this.log(`set groups`,e),this.groups=[...new Set([...this.groups,...e])],this.send({type:`assign_group`,payload:{groupIds:e,profileId:this.profileId}})}alias(e){}increment(e){return this.send({type:`increment`,payload:e})}decrement(e){return this.send({type:`decrement`,payload:e})}revenue(e,t){let n=t?.deviceId;return delete t?.deviceId,this.track(`revenue`,{...t??{},...n?{__deviceId:n}:{},__revenue:e})}getDeviceId(){return this.deviceId??``}getSessionId(){return this.sessionId??``}fetchDeviceId(){return Promise.resolve(this.deviceId??``)}clear(){this.profileId=void 0,this.groups=[],this.deviceId=void 0,this.sessionId=void 0}buildFlushPayload(e){if(e.type===`replay`)return e.payload;if(e.type===`track`){let t=`groups`in e.payload?e.payload.groups??[]:[],n=[...new Set([...this.groups,...t])];return{...e.payload,profileId:e.payload.profileId??this.profileId,groups:n.length>0?n:void 0}}return e.type===`identify`||e.type===`increment`||e.type===`decrement`||e.type===`assign_group`?{...e.payload,profileId:e.payload.profileId??this.profileId}:e.payload}flush(){let e=[];for(let t of this.queue){if(this.shouldQueue(t)){e.push(t);continue}let n=this.buildFlushPayload(t);this.send({...t,payload:n})}this.queue=e}log(...e){this.options.debug&&console.log(`[OpenPanel.dev]`,...e)}},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=e.maskAllText!==!1,d=e.unmaskTextSelector,f=sh({emit(e,t){a.push(e),l(!!t)},checkoutEveryNms:r,maskAllInputs:e.maskAllInputs??!0,maskTextSelector:u?`*`:`[data-openpanel-replay-mask]`,maskTextFn:u&&d?(e,t)=>t?.closest(d)?e:e.replace(/\S/g,`*`):void 0,blockSelector:e.blockSelector??`[data-openpanel-replay-block]`,blockClass:e.blockClass,ignoreSelector:e.ignoreSelector});s=setInterval(()=>{a.length>0&&c(a.some(e=>e.type===2))},r);function p(){document.visibilityState===`hidden`&&a.length>0&&c(a.some(e=>e.type===2))}function m(){a.length>0&&c(a.some(e=>e.type===2))}document.addEventListener(`visibilitychange`,p),window.addEventListener(`pagehide`,m),yh=()=>{a.length>0&&c(a.some(e=>e.type===2)),s&&=(clearInterval(s),null),document.removeEventListener(`visibilitychange`,p),window.removeEventListener(`pagehide`,m),f?.(),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.3.0`,...e}),this.options=e,this.lastPath=``,this.pendingRevenues=[],!this.isServer()){try{let e=sessionStorage.getItem(`openpanel-pending-revenues`);if(e){let t=JSON.parse(e);Array.isArray(t)&&(this.pendingRevenues=t)}}catch{this.pendingRevenues=[]}if(this.setGlobalProperties({__referrer:document.referrer}),this.options.trackScreenViews&&(this.trackScreenViews(),setTimeout(()=>this.screenView(),0)),this.options.trackOutgoingLinks&&this.trackOutgoingLinks(),this.options.trackAttributes&&this.trackAttributes(),this.options.sessionReplay?.enabled){let e=this.options.sessionReplay.sampleRate??1;Math.random()<e&&this.loadReplayModule().then(e=>{e&&e.startReplayRecorder(this.options.sessionReplay,e=>{this.send({type:`replay`,payload:{...e}})})})}}}async loadReplayModule(){try{if(typeof __OPENPANEL_REPLAY_URL__<`u`){let e=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)}})}track(e,t){return super.track(e,{...t,__path:this.lastPath})}screenView(e,t){if(this.isServer())return;let n,r;typeof e==`string`?(n=e,r=t):(n=window.location.href,r=e),this.lastPath!==n&&(this.lastPath=n,super.track(`screen_view`,{...r??{},__path:n,__title:document.title}))}async flushRevenue(){let e=this.pendingRevenues.map(e=>super.revenue(e.amount,e.properties));await Promise.all(e),this.clearRevenue()}clearRevenue(){if(this.pendingRevenues=[],!this.isServer())try{sessionStorage.removeItem(`openpanel-pending-revenues`)}catch{}}pendingRevenue(e,t){if(this.pendingRevenues.push({amount:e,properties:t}),!this.isServer())try{sessionStorage.setItem(`openpanel-pending-revenues`,JSON.stringify(this.pendingRevenues))}catch{}}};const 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
55
|
Debug Information:
|
|
56
56
|
-----------------
|
|
57
57
|
Timestamp: ${t.timestamp}
|
package/cdn/loader.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,t}from"./initFrakSdk.
|
|
1
|
+
import{C as e,t}from"./initFrakSdk.fQzq4EeW.js";import{t as n}from"./Spinner.D80c6dJp.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.DPJWXGbe.js`),"button-wallet":()=>import(`./ButtonWallet.D-zCZ2sI.js`),"open-in-app":()=>import(`./OpenInAppButton.Dm1n2RdM.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.
|
|
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.fQzq4EeW.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};
|
package/dist/buttonWallet.js
CHANGED
|
@@ -26,15 +26,15 @@ function GiftIcon(props) {
|
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/components/ButtonWallet/ButtonWallet.module.css?css_module
|
|
28
28
|
const classes = {
|
|
29
|
-
"reward": "Kl62ia_reward",
|
|
30
29
|
"button": "Kl62ia_button",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
30
|
+
"button__right": "Kl62ia_button__right",
|
|
31
|
+
"reward": "Kl62ia_reward",
|
|
32
|
+
"button__left": "Kl62ia_button__left"
|
|
33
33
|
};
|
|
34
|
-
const _reward0 = classes["reward"];
|
|
35
34
|
const _button0 = classes["button"];
|
|
36
|
-
const _button__left0 = classes["button__left"];
|
|
37
35
|
const _button__right0 = classes["button__right"];
|
|
36
|
+
const _reward0 = classes["reward"];
|
|
37
|
+
const _button__left0 = classes["button__left"];
|
|
38
38
|
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region src/components/ButtonWallet/ButtonWallet.tsx
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "0.0.26-beta.
|
|
14
|
+
"version": "0.0.26-beta.9139651c",
|
|
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,8 +76,8 @@
|
|
|
76
76
|
"publish": "echo 'Publishing components...'"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@frak-labs/core-sdk": "0.2.1-beta.
|
|
80
|
-
"@frak-labs/frame-connector": "0.2.0-beta.
|
|
79
|
+
"@frak-labs/core-sdk": "0.2.1-beta.9139651c",
|
|
80
|
+
"@frak-labs/frame-connector": "0.2.0-beta.9139651c",
|
|
81
81
|
"class-variance-authority": "^0.7.1",
|
|
82
82
|
"preact": "^10.29.0",
|
|
83
83
|
"preact-custom-element": "^4.6.0"
|